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
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
923f780237c00743eaca4b58e18496e3f9dd1477
| 5,836 |
java
|
Java
|
sermant-plugins/sermant-service-registry/spring-cloud-registry-plugin/src/main/java/com/huawei/registry/interceptors/SpringFactoriesInterceptor.java
|
huaweicloud/java-mesh
|
8e0eb443062327b2b63a85bdecdd2f6d7aec5829
|
[
"Apache-2.0"
] | 11 |
2021-11-12T03:17:15.000Z
|
2021-12-08T00:53:03.000Z
|
sermant-plugins/sermant-service-registry/spring-cloud-registry-plugin/src/main/java/com/huawei/registry/interceptors/SpringFactoriesInterceptor.java
|
huaweicloud/java-mesh
|
8e0eb443062327b2b63a85bdecdd2f6d7aec5829
|
[
"Apache-2.0"
] | 99 |
2021-10-18T05:39:19.000Z
|
2021-12-13T07:33:15.000Z
|
sermant-plugins/sermant-service-registry/spring-cloud-registry-plugin/src/main/java/com/huawei/registry/interceptors/SpringFactoriesInterceptor.java
|
huaweicloud/java-mesh
|
8e0eb443062327b2b63a85bdecdd2f6d7aec5829
|
[
"Apache-2.0"
] | 9 |
2021-10-30T09:28:16.000Z
|
2021-12-13T07:19:49.000Z
| 42.289855 | 118 | 0.686943 | 1,001,172 |
/*
* Copyright (C) 2022-2022 Huawei Technologies Co., Ltd. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package com.huawei.registry.interceptors;
import com.huawei.registry.config.GraceConfig;
import com.huawei.registry.support.RegisterSwitchSupport;
import com.huaweicloud.sermant.core.common.LoggerFactory;
import com.huaweicloud.sermant.core.plugin.agent.entity.ExecuteContext;
import com.huaweicloud.sermant.core.plugin.config.PluginConfigManager;
import com.huaweicloud.sermant.core.plugin.inject.ClassInjectDefine;
import com.huaweicloud.sermant.core.plugin.inject.ClassInjectDefine.Plugin;
import com.huaweicloud.sermant.core.plugin.inject.ClassInjectService;
import com.huaweicloud.sermant.core.service.ServiceManager;
import com.huaweicloud.sermant.core.utils.StringUtils;
import org.springframework.core.io.support.SpringFactoriesLoader;
import org.springframework.util.MultiValueMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Logger;
/**
* 拦截loadFactories注入自定义配置源
*
* @author zhouss
* @since 2022-04-08
*/
public class SpringFactoriesInterceptor extends RegisterSwitchSupport {
private static final Logger LOGGER = LoggerFactory.getLogger();
private static final List<ClassInjectDefine> CLASS_DEFINES = new ArrayList<>();
private static final AtomicBoolean IS_INJECTED = new AtomicBoolean();
private volatile Boolean hasMethodLoadSpringFactories;
/**
* 初始化加载注入定义
*/
public SpringFactoriesInterceptor() {
for (ClassInjectDefine define : ServiceLoader.load(ClassInjectDefine.class)) {
if (define.plugin() == Plugin.SPRING_REGISTRY_PLUGIN) {
CLASS_DEFINES.add(define);
}
}
}
@Override
public ExecuteContext doAfter(ExecuteContext context) {
if (isHasMethodLoadSpringFactories()) {
// 仅当在高版本采用LoadSpringFactories的方式注入, 高版本存在缓存会更加高效, 仅需注入一次
if (IS_INJECTED.compareAndSet(false, true)) {
injectConfigurations(context.getResult());
}
} else {
final Object rawFactoryType = context.getArguments()[0];
if (rawFactoryType instanceof Class) {
final Class<?> factoryType = (Class<?>) rawFactoryType;
injectConfigurationsWithLowVersion(context.getResult(), factoryType.getName());
}
}
return context;
}
private boolean isHasMethodLoadSpringFactories() {
if (hasMethodLoadSpringFactories == null) {
try {
SpringFactoriesLoader.class.getDeclaredMethod("loadSpringFactories", ClassLoader.class);
hasMethodLoadSpringFactories = Boolean.TRUE;
} catch (NoSuchMethodException ex) {
LoggerFactory.getLogger().fine(
"It is low version spring framework, class will be injected by loadFactoryNames");
hasMethodLoadSpringFactories = Boolean.FALSE;
}
}
return hasMethodLoadSpringFactories;
}
private void injectConfigurationsWithLowVersion(Object result, String factoryName) {
final ClassInjectService service = ServiceManager.getService(ClassInjectService.class);
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
if (result instanceof List) {
final List<String> convertedResult = (List<String>) result;
CLASS_DEFINES.stream()
.filter(classInjectDefine -> StringUtils.equals(classInjectDefine.factoryName(), factoryName)
|| StringUtils.isBlank(classInjectDefine.factoryName()))
.forEach(classInjectDefine -> {
final List<String> injectClasses = service.injectConfiguration(factoryName, null,
classInjectDefine, contextClassLoader);
injectClasses.stream().filter(injectClass -> !convertedResult.contains(injectClass))
.forEach(convertedResult::add);
});
}
}
private void injectConfigurations(Object result) {
final ClassInjectService service = ServiceManager.getService(ClassInjectService.class);
final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
final boolean isMultiValueMap = result instanceof MultiValueMap;
if (result instanceof Map) {
// spring 高版本处理, 针对List其为不可变list,需做一层处理
CLASS_DEFINES.forEach(classInjectDefine -> service.injectConfiguration((Map<String, List<String>>) result,
classInjectDefine, contextClassLoader, !isMultiValueMap));
} else {
LOGGER.warning(String.format(Locale.ENGLISH,
"[DynamicConfig] Can not inject dynamic configuration! the type of cache is [%s]",
result.getClass().getName()));
}
}
@Override
protected boolean isEnabled() {
return registerConfig.isEnableSpringRegister()
|| PluginConfigManager.getPluginConfig(GraceConfig.class).isEnableSpring();
}
}
|
923f787da735f3c50701bec22002a669e1518d53
| 1,812 |
java
|
Java
|
sample-rest/src/main/java/io/jmix/samples/rest/entity/driver/DriverAllocation.java
|
garnetresearchcorp/jmix-rest
|
8698e88375d0cc9ee436907331c16972cd7ae77f
|
[
"Apache-2.0"
] | 30 |
2019-02-26T07:42:11.000Z
|
2022-03-31T16:46:03.000Z
|
sample-rest/src/main/java/io/jmix/samples/rest/entity/driver/DriverAllocation.java
|
garnetresearchcorp/jmix-rest
|
8698e88375d0cc9ee436907331c16972cd7ae77f
|
[
"Apache-2.0"
] | 909 |
2019-02-26T08:29:19.000Z
|
2022-03-31T16:56:18.000Z
|
sample-rest/src/main/java/io/jmix/samples/rest/entity/driver/DriverAllocation.java
|
garnetresearchcorp/jmix-rest
|
8698e88375d0cc9ee436907331c16972cd7ae77f
|
[
"Apache-2.0"
] | 15 |
2019-05-08T19:17:03.000Z
|
2022-03-31T06:24:22.000Z
| 27.044776 | 75 | 0.717439 | 1,001,173 |
/*
* Copyright 2019 Haulmont.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.jmix.samples.rest.entity.driver;
import io.jmix.core.DeletePolicy;
import io.jmix.core.entity.annotation.OnDeleteInverse;
import io.jmix.core.metamodel.annotation.InstanceName;
import io.jmix.core.metamodel.annotation.JmixEntity;
import io.jmix.samples.rest.entity.StandardEntity;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity(name = "ref$DriverAllocation")
@JmixEntity
@Table(name = "REF_DRIVER_ALLOC")
public class DriverAllocation extends StandardEntity {
private static final long serialVersionUID = 8101497971694305079L;
@ManyToOne
@JoinColumn(name = "DRIVER_ID")
@OnDeleteInverse(DeletePolicy.DENY)
private Driver driver;
@ManyToOne
@JoinColumn(name = "CAR_ID")
private Car car;
@InstanceName
public String getCaption() {
return String.format("%s:(%s)", getDriver(), getCar());
}
public Driver getDriver() {
return driver;
}
public void setDriver(Driver driver) {
this.driver = driver;
}
public Car getCar() {
return car;
}
public void setCar(Car car) {
this.car = car;
}
}
|
923f78efca2855143f0d6f2577738d183377284d
| 7,579 |
java
|
Java
|
Javelin/src/main/java/jp/co/acroquest/endosnipe/javelin/resource/proc/WindowsProcParser.java
|
t-hiramatsu/ENdoSnipe
|
ee6af4a70946d42e4a7b0134f17f6851d2921db4
|
[
"MIT"
] | null | null | null |
Javelin/src/main/java/jp/co/acroquest/endosnipe/javelin/resource/proc/WindowsProcParser.java
|
t-hiramatsu/ENdoSnipe
|
ee6af4a70946d42e4a7b0134f17f6851d2921db4
|
[
"MIT"
] | null | null | null |
Javelin/src/main/java/jp/co/acroquest/endosnipe/javelin/resource/proc/WindowsProcParser.java
|
t-hiramatsu/ENdoSnipe
|
ee6af4a70946d42e4a7b0134f17f6851d2921db4
|
[
"MIT"
] | null | null | null | 38.668367 | 100 | 0.645468 | 1,001,174 |
/*******************************************************************************
* ENdoSnipe 5.0 - (https://github.com/endosnipe)
*
* The MIT License (MIT)
*
* Copyright (c) 2012 Acroquest Technology Co.,Ltd.
*
* 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 jp.co.acroquest.endosnipe.javelin.resource.proc;
import java.util.Map;
import jp.co.acroquest.endosnipe.javelin.bean.proc.DiskStats;
import jp.co.acroquest.endosnipe.javelin.bean.proc.MemInfo;
import jp.co.acroquest.endosnipe.javelin.bean.proc.ProcInfo;
import jp.co.acroquest.endosnipe.javelin.bean.proc.SelfStatInfo;
import jp.co.acroquest.endosnipe.javelin.bean.proc.StatInfo;
import jp.co.acroquest.endosnipe.javelin.resource.ProcessorCountGetter;
/**
* Windowsのリソース情報を読み込むProcParser。
*
* @author ochiai
*/
public class WindowsProcParser implements ProcParser
{
/** 秒をナノ秒に直すための定数:1000 * 1000 * 1000 */
private static final int SECONDS_TO_NANO_SECONDS = 1000 * 1000 * 1000;
/** パーセント値を小数に直すための定数:100 */
private static final double PERCENT_TO_DECIMAL = 100;
/** CPUシステム時間 */
private static long cpuTimeSystem__ = 0;
/** CPUユーザ時間 */
private static long cpuTimeUser__ = 0;
/** CPU処理時間 */
private static long processUserTime__ = 0;
/** CPUシステム時間 */
private static long processSTime__ = 0;
/** 取得したリソース値 */
private ProcInfo procInfo_;
/** リソース値の取得 */
private PerfCounter perfCounter_ = null;
/**
* 初期化を行う。成功した場合にのみtrue
*
* @return 成功した場合にのみtrue
*/
public boolean init()
{
// 準備
this.perfCounter_ = new PerfCounter();
return this.perfCounter_.init();
}
/**
* /proc/meminfo、/proc/stat、/proc/self/statから読み込み、
* ProcInfoに格納する。
*/
public void load()
{
ProcInfo procInfo = parseStatInfo();
this.procInfo_ = procInfo;
}
/**
* /proc/statの以下の情報をStatInfoにセットし、返す。<br>
* <ul>
* <li>cpu(nano秒)</li>
* <li>cpu0,cpu1,cpu2,・・・(nano秒)</li>
* <li>pgpgin(byte)</li>
* <li>pgpgout(byte)</li>
* </ul>
* @return SelfStatInfo /proc/stat,/proc/vmstatの情報
*/
private ProcInfo parseStatInfo()
{
ProcInfo procInfo = new ProcInfo();
MemInfo memInfo = new MemInfo();
StatInfo statInfo = new StatInfo();
SelfStatInfo selfStatInfo = new SelfStatInfo();
DiskStats diskStats = new DiskStats();
if (this.perfCounter_ == null)
{
// 準備
this.perfCounter_ = new PerfCounter();
this.perfCounter_.init();
}
Map<String, Double> perfData = this.perfCounter_.getPerfData();
Double userobj = perfData.get(PerfCounter.PROCESSOR_TOTAL_USER_TIME);
Double sysobj = perfData.get(PerfCounter.PROCESSOR_TOTAL_PRIVILEGED_TIME);
Double memTotal = perfData.get(PerfCounter.MEMORY_TOTAL);
Double memAvailable = perfData.get(PerfCounter.MEMORY_AVAILABLE_BYTES);
Double pageUsage = perfData.get(PerfCounter.PAGING_FILE_USAGE);
Double pageBytes = perfData.get(PerfCounter.PROCESS_TOTAL_PAGE_FILE_BYTES);
Double pageIn = perfData.get(PerfCounter.MEMORY_PAGES_INPUT_SEC);
Double pageOut = perfData.get(PerfCounter.MEMORY_PAGES_OUTPUT_SEC);
Double userTime = perfData.get(PerfCounter.PROCESS_USER_TIME);
Double privilegedTime = perfData.get(PerfCounter.PROCESS_PRIVILEGED_TIME);
Double majFlt = perfData.get(PerfCounter.PROCESS_PAGE_FAULTS_SEC);
Double vsize = perfData.get(PerfCounter.PROCESS_VIRTUAL_BYTES);
Double rss = perfData.get(PerfCounter.PROCESS_WORKING_SET);
Double numThreads = perfData.get(PerfCounter.PROCESS_THREAD_COUNT);
Double procFDCount = perfData.get(PerfCounter.PROCESS_NUMBER_FDS);
Double systemFDCount = perfData.get(PerfCounter.PROCESS_TOTAL_NUMBER_FDS);
// 積算値を渡すために変換する
ProcessorCountGetter procCountGetter = new ProcessorCountGetter();
int procCount = procCountGetter.getValue().intValue();
double interval = perfData.get(PerfCounter.INTERVAL);
cpuTimeUser__ +=
procCount * userobj
/ PERCENT_TO_DECIMAL * interval * SECONDS_TO_NANO_SECONDS;
cpuTimeSystem__ +=
procCount * sysobj
/ PERCENT_TO_DECIMAL * interval * SECONDS_TO_NANO_SECONDS;
processUserTime__ += userTime / PERCENT_TO_DECIMAL * interval * SECONDS_TO_NANO_SECONDS;
processSTime__ += privilegedTime / PERCENT_TO_DECIMAL * interval * SECONDS_TO_NANO_SECONDS;
Double pageInTotal = pageIn * interval;
Double pageOutTotal = pageOut * interval;
Double majFltTotal = majFlt * interval;
Double swapTotal = pageBytes / pageUsage * PERCENT_TO_DECIMAL;
Double swapFree = swapTotal - pageBytes;
statInfo.setCpuSystem(cpuTimeSystem__);
statInfo.setCpuUser(cpuTimeUser__);
//statInfo.setCpuTask(cpuTask);
statInfo.setPageIn(pageInTotal.longValue());
statInfo.setPageOut(pageOutTotal.longValue());
statInfo.setFdCount(systemFDCount.intValue());
selfStatInfo.setMajflt(majFltTotal.longValue());
selfStatInfo.setVsize(vsize.longValue());
selfStatInfo.setRss(rss.longValue());
selfStatInfo.setNumThreads(numThreads.longValue());
selfStatInfo.setUtime(processUserTime__);
selfStatInfo.setStime(processSTime__);
selfStatInfo.setFdCount(procFDCount.intValue());
memInfo.setMemTotal(memTotal.longValue());
memInfo.setMemFree(memAvailable.longValue());
memInfo.setBufferes(0);
memInfo.setCached(0);
memInfo.setSwapTotal(swapTotal.longValue());
memInfo.setSwapFree(swapFree.longValue());
//memInfo.setVmallocTotal(0);
procInfo.setMemInfo(memInfo);
procInfo.setStatInfo(statInfo);
procInfo.setSelfStatInfo(selfStatInfo);
procInfo.setDiskStats(diskStats);
return procInfo;
}
/**
* リソース使用状況のデータ procInfo を返す
* @return ProcInfo
*/
public ProcInfo getProcInfo()
{
return this.procInfo_;
}
}
|
923f79c46814059f498d53c2b7db6e5727abb287
| 7,841 |
java
|
Java
|
src/main/java/sorts/BubbleSort.java
|
pepemxl/SortingAlgorithms
|
55f69873a2f23cc49ae4c2a7fc22d4687b11330c
|
[
"MIT"
] | 1 |
2020-12-02T23:50:12.000Z
|
2020-12-02T23:50:12.000Z
|
src/main/java/sorts/BubbleSort.java
|
pepemxl/SortingAlgorithms
|
55f69873a2f23cc49ae4c2a7fc22d4687b11330c
|
[
"MIT"
] | 1 |
2019-01-08T16:52:47.000Z
|
2019-01-08T16:52:47.000Z
|
src/main/java/sorts/BubbleSort.java
|
pepemxl/SortingAlgorithms
|
55f69873a2f23cc49ae4c2a7fc22d4687b11330c
|
[
"MIT"
] | null | null | null | 23.40597 | 110 | 0.562046 | 1,001,175 |
package sorts;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
public class BubbleSort implements Sortable {
@Override
public int[] sort(int[] in) {
boolean swaps = true;
int aux;
int i, n = in.length;
while (swaps) {
swaps = false;
for (i = 0; i < n - 1; ++i) {
if (in[i] > in[i + 1]) {
aux = in[i];
in[i] = in[i + 1];
in[i + 1] = aux;
swaps = true;
}
}
}
return in;
}
@Override
public String toString() {
return "BubbleSort";
}
@Override
public int[] sortThreaded(int version, int[] in, int threads) throws Exception {
switch (version) {
case 0:
return bubleByFragmentsJoinAtTheFinal(in, threads);
case 1:
return sortThreaded1(in, threads);
}
return null;
}
public int[] sortThreaded0(int[] in, int threads) throws Exception {
class BubbleSortRunnable implements Runnable {
private final int s;
private final int e;
private int[] in;
public boolean swaps;
BubbleSortRunnable(int[] in, int start, int end) {
s = start;
e = end;
this.in = in;
}
public void run() {
swaps = false;
// System.out.println(s + "-" + e);
int aux;
for (int i = s; i < e; i++) {
if (in[i] > in[i + 1]) {
aux = in[i];
in[i] = in[i + 1];
in[i + 1] = aux;
swaps = true;
}
}
}
}
BubbleSortRunnable[] runners = new BubbleSortRunnable[threads];
int chunks = (in.length - 1) / threads;
int index = 0;
int i;
for (i = 0; i < threads - 1; i++) {
runners[i] = new BubbleSortRunnable(in, index, index + chunks);
index += chunks;
}
runners[i] = new BubbleSortRunnable(in, index, in.length - 1);
Future<?>[] results = new Future<?>[threads];
ExecutorService executor = Executors.newFixedThreadPool(threads);
boolean swaps = true;
while (swaps) {
// System.out.println("Loop " + j);
for (i = 0; i < threads; i++) {
results[i] = executor.submit(runners[i]);
}
swaps = false;
for (i = 0; i < threads; i++) {
results[i].get();
swaps = swaps | runners[i].swaps;
}
// System.out.println("Loop End " + j);
}
executor.shutdown();
// System.out.println("Finallizing");
return in;
}
public int[] sortThreaded1(int[] in, int threads) throws Exception {
final Object[] lock = new Object[threads];
for (int i = 0; i < threads; ++i) {
lock[i] = new Object();
}
class BubbleSortRunnable implements Runnable {
private int id;
private int s;
private int e;
private int[] in;
public volatile boolean swaps;
public BubbleSortRunnable[] siblings;
BubbleSortRunnable(int id, int[] in, BubbleSortRunnable[] siblings, int start, int end) {
this.id = id;
this.s = start;
this.e = id == siblings.length - 1 ? end - 1 : end;
this.in = in;
this.siblings = siblings;
swaps = true;
}
public void run() {
// System.out.println("Range:" + s + "-" + e);
while (swaps) {
swaps = false;
int i = s;
if (id > 0) {
synchronized (lock[id - 1]) {
int aux;
if (in[i] > in[i + 1]) {
aux = in[i];
in[i] = in[i + 1];
in[i + 1] = aux;
swaps = true;
}
}
}
for (; i < e; i++) {
int aux;
if (in[i] > in[i + 1]) {
aux = in[i];
in[i] = in[i + 1];
in[i + 1] = aux;
swaps = true;
}
}
synchronized (lock[id]) {
int aux;
if (in[i] > in[i + 1]) {
aux = in[i];
in[i] = in[i + 1];
in[i + 1] = aux;
if (id < siblings.length - 1) {
siblings[id + 1].swaps = true;
}
}
}
}
}
}
BubbleSortRunnable[] runners = new BubbleSortRunnable[threads];
int chunks = (in.length - 1) / threads;
int index = 0;
int i;
for (i = 0; i < threads - 1; i++) {
runners[i] = new BubbleSortRunnable(i, in, runners, index, index + chunks);
index += chunks;
}
runners[i] = new BubbleSortRunnable(i, in, runners, index, in.length - 1);
Future<?>[] results = new Future<?>[threads];
ExecutorService executor = Executors.newFixedThreadPool(threads);
boolean swaps = true;
while (swaps) {
// System.out.println("in " + Arrays.toString(in));
// Thread.sleep(1000);
for (i = 0; i < threads; i++) {
results[i] = executor.submit(runners[i]);
}
for (i = 0; i < threads; i++) {
results[i].get();
}
swaps = false;
for (i = 0; i < threads; i++) {
swaps = swaps | runners[i].swaps;
}
if (!swaps) {
for (i = 0; i < in.length - 1; ++i) {
if (in[i] > in[i + 1]) {
swaps = true;
for (i = 0; i < threads; ++i) {
runners[i].swaps = true;
}
break;
}
}
}
// System.out.println("Loop End " + j);
}
executor.shutdown();
// System.out.println("Finallizing");
return in;
}
public int[] bubleByFragmentsJoinAtTheFinal(int[] in, int threads) throws Exception {
int[] buff = new int[in.length];
class BubbleSortRunnable extends HelperRunnable {
CyclicBarrier barrier;
private int s;
private int e;
private int id;
private int join;
private int[] in;
public boolean joinb = true;
BubbleSortRunnable[] runners;
BubbleSortRunnable(int[] in, int s, int end, CyclicBarrier barrier, int id, BubbleSortRunnable[] runners) {
this.s = s;
this.in = in;
this.e = end;
this.barrier = barrier;
this.id = id;
this.join = 1;
this.runners = runners;
}
public void run() {
boolean swaps = true;
int aux;
int i;
while (swaps) {
swaps = false;
for (i = s; i < e - 1; ++i) {
if (in[i] > in[i + 1]) {
aux = in[i];
in[i] = in[i + 1];
in[i + 1] = aux;
swaps = true;
}
}
}
// System.out.println("size:" + result.length + " - " +
// Arrays.toString(result));
try {
barrier.await();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
// Join
while (join < threads) {
if (!joinb || id + join > threads - 1) {
} else {
merge(in, buff, s, e, runners[id + join].s, runners[id + join].e);
for (i = s; i < runners[id + join].e; ++i) {
in[i] = buff[i];
}
e = runners[id + join].e;
}
join <<= 1;
try {
barrier.await();
} catch (InterruptedException e) {
e.printStackTrace();
} catch (BrokenBarrierException e) {
e.printStackTrace();
}
}
}
}
class BubbleSortRunnableChecker implements Runnable {
BubbleSortRunnable[] runners;
int start = 1;
int join = 2;
public BubbleSortRunnableChecker(BubbleSortRunnable[] runners) {
this.runners = runners;
}
@Override
public void run() {
for (int i = start; i < threads; i += join) {
runners[i].joinb = false;
}
start <<= 1;
join <<= 1;
}
}
BubbleSortRunnable[] runners = new BubbleSortRunnable[threads];
BubbleSortRunnableChecker checker = new BubbleSortRunnableChecker(runners);
CyclicBarrier barrier = new CyclicBarrier(threads, checker);
int chunks = in.length / threads;
int index = 0;
int i;
for (i = 0; i < threads - 1; i++) {
runners[i] = new BubbleSortRunnable(in, index, index + chunks, barrier, i, runners);
index += chunks;
}
runners[i] = new BubbleSortRunnable(in, index, in.length, barrier, i, runners);
Thread[] results = new Thread[threads];
for (i = 0; i < threads; i++) {
results[i] = new Thread(runners[i], "BubbleSortT-" + i);
results[i].setDaemon(true);
results[i].start();
}
for (i = 0; i < threads; i++) {
results[i].join();
}
return in;
}
}
|
923f7a6106015e271f49bf93c91a0916c4c3e16d
| 5,695 |
java
|
Java
|
core/src/main/java/eu/okaeri/placeholders/context/PlaceholderContext.java
|
OkaeriPoland/okaeri-placeholders
|
7c6f6dab11482b455202dbad13a078921642ae76
|
[
"MIT"
] | 5 |
2021-04-08T14:17:05.000Z
|
2022-03-28T12:43:20.000Z
|
core/src/main/java/eu/okaeri/placeholders/context/PlaceholderContext.java
|
OkaeriPoland/okaeri-placeholders
|
7c6f6dab11482b455202dbad13a078921642ae76
|
[
"MIT"
] | 1 |
2022-03-04T10:35:12.000Z
|
2022-03-05T06:17:59.000Z
|
core/src/main/java/eu/okaeri/placeholders/context/PlaceholderContext.java
|
OkaeriPoland/okaeri-placeholders
|
7c6f6dab11482b455202dbad13a078921642ae76
|
[
"MIT"
] | null | null | null | 37.222222 | 140 | 0.608604 | 1,001,176 |
package eu.okaeri.placeholders.context;
import eu.okaeri.placeholders.Placeholders;
import eu.okaeri.placeholders.message.CompiledMessage;
import eu.okaeri.placeholders.message.part.MessageElement;
import eu.okaeri.placeholders.message.part.MessageField;
import eu.okaeri.placeholders.message.part.MessageStatic;
import lombok.Data;
import lombok.NonNull;
import org.jetbrains.annotations.Nullable;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@Data
public class PlaceholderContext {
private final Map<String, Placeholder> fields = new LinkedHashMap<>();
private final CompiledMessage message;
private final FailMode failMode;
private Placeholders placeholders;
public static PlaceholderContext create() {
return create(FailMode.FAIL_SAFE);
}
public static PlaceholderContext create(@NonNull FailMode failMode) {
return new PlaceholderContext(null, failMode);
}
public static PlaceholderContext of(@NonNull CompiledMessage message) {
return of(null, message);
}
public static PlaceholderContext of(@Nullable Placeholders placeholders, @NonNull CompiledMessage message) {
return of(placeholders, message, FailMode.FAIL_SAFE);
}
public static PlaceholderContext of(@Nullable Placeholders placeholders, @NonNull CompiledMessage message, @NonNull FailMode failMode) {
PlaceholderContext context = new PlaceholderContext(message, failMode);
context.setPlaceholders(placeholders);
return context;
}
public PlaceholderContext with(@NonNull String field, @Nullable Object value) {
if ((this.message != null) && (!this.message.isWithFields() || !this.message.hasField(field))) {
return this;
}
this.fields.put(field, Placeholder.of(this.placeholders, value));
return this;
}
public PlaceholderContext with(@NonNull Map<String, Object> fields) {
fields.forEach(this::with);
return this;
}
public String apply() {
return this.apply(this.message);
}
public String apply(@NonNull CompiledMessage message) {
// someone is trying to apply message on the specific non-shareable context
if ((message != this.message) && (this.message != null)) {
throw new IllegalArgumentException("cannot apply another message for context created with prepacked message: " +
"if you intended to use this context as shared please use empty context from #create(), " +
"if you're just trying to send a message use of(message)");
}
// no fields, no need for processing
if (!message.isWithFields()) {
return message.getRaw();
}
// prepare for fields
String state = message.getRaw();
List<MessageElement> parts = message.getParts();
Map<MessageField, String> rendered = new LinkedHashMap<>();
int totalRenderLength = 0;
// render field parts
for (MessageElement part : parts) {
if (!(part instanceof MessageField)) {
continue;
}
MessageField field = (MessageField) part;
String name = field.getName();
String alreadyRendered = rendered.get(field);
if (alreadyRendered != null) {
totalRenderLength += alreadyRendered.length();
continue;
}
Placeholder placeholder = this.fields.get(name);
if ((placeholder == null) || (placeholder.getValue() == null)) {
if (field.getDefaultValue() != null) {
placeholder = Placeholder.of(field.getDefaultValue());
} else if (this.failMode == FailMode.FAIL_FAST) {
throw new IllegalArgumentException("missing placeholder '" + name + "' for message '" + state + "'");
} else if (this.failMode == FailMode.FAIL_SAFE) {
placeholder = Placeholder.of("<missing:" + field.getLastSubPath() + ">");
} else {
throw new RuntimeException("unknown fail mode: " + this.failMode);
}
}
String render = placeholder.render(field);
if (render == null) {
if (field.getDefaultValue() != null) {
render = field.getDefaultValue();
} else if (this.failMode == FailMode.FAIL_FAST) {
throw new IllegalArgumentException("rendered null for placeholder '" + name + "' for message '" + state + "'");
} else if (this.failMode == FailMode.FAIL_SAFE) {
render = "<null:" + field.getLastSubPath() + ">";
} else {
throw new RuntimeException("unknown fail mode: " + this.failMode);
}
}
rendered.put(field, render);
totalRenderLength += render.length();
}
// build message
StringBuilder builder = new StringBuilder(message.getStaticLength() + totalRenderLength);
for (MessageElement part : parts) {
if (part instanceof MessageStatic) {
builder.append(((MessageStatic) part).getValue());
continue;
}
if (part instanceof MessageField) {
MessageField field = (MessageField) part;
String render = rendered.get(field);
builder.append(render);
continue;
}
throw new IllegalArgumentException("unknown message part: " + part);
}
return builder.toString();
}
}
|
923f7ad709062b197c3970a1becd6f7717535257
| 1,574 |
java
|
Java
|
3_chapter_003_sale_car/src/main/java/ru/job4j/dao/car/BodyDaoImpl.java
|
EgorVasilyev/job4j
|
031024ee8dea275d074beceb8fef34449c706cc8
|
[
"Apache-2.0"
] | null | null | null |
3_chapter_003_sale_car/src/main/java/ru/job4j/dao/car/BodyDaoImpl.java
|
EgorVasilyev/job4j
|
031024ee8dea275d074beceb8fef34449c706cc8
|
[
"Apache-2.0"
] | 19 |
2020-03-04T23:18:55.000Z
|
2022-02-16T00:58:56.000Z
|
3_chapter_003_sale_car/src/main/java/ru/job4j/dao/car/BodyDaoImpl.java
|
EgorVasilyev/job4j
|
031024ee8dea275d074beceb8fef34449c706cc8
|
[
"Apache-2.0"
] | null | null | null | 25.387097 | 88 | 0.560356 | 1,001,177 |
package ru.job4j.dao.car;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import ru.job4j.dao.EntityDao;
import ru.job4j.entity.car.Body;
import ru.job4j.entity.user.User;
import ru.job4j.persistent.DbProvider;
import java.util.List;
public class BodyDaoImpl implements EntityDao<Body> {
private static final Logger LOG = LogManager.getLogger(BodyDaoImpl.class.getName());
private static final BodyDaoImpl BODY_DAO = new BodyDaoImpl();
private static final DbProvider DB_PROVIDER = DbProvider.getInstance();
public static BodyDaoImpl getInstance() {
return BODY_DAO;
}
private BodyDaoImpl() {
}
@Override
public List<Body> getEntities() {
return (List<Body>) DB_PROVIDER.fn(
session -> session.createQuery("from Body order by id").list()
);
}
@Override
public int save(Body body) {
return (int) DB_PROVIDER.fn(
session -> {
LOG.info("save - " + body);
return session.save(body);
}
);
}
@Override
public void update(Body body) {
DB_PROVIDER.cn(
session -> {
session.update(body);
LOG.info("update - " + body);
}
);
}
@Override
public void delete(Body body) {
DB_PROVIDER.cn(
session -> {
session.delete(body);
LOG.info("delete - " + body);
}
);
}
}
|
923f7aea18f683eb2d6cc13d7b4e8ab71c86100b
| 337 |
java
|
Java
|
University manager (LS)/src/main/java/pt/isel/ls/resultview/PathLink.java
|
LuisGuerraa/CollegeWork
|
064e9dbe28a090ea0f1fa1a57c9c8710238da186
|
[
"Apache-2.0"
] | 4 |
2021-05-21T18:57:16.000Z
|
2021-12-01T15:39:02.000Z
|
University manager (LS)/src/main/java/pt/isel/ls/resultview/PathLink.java
|
LuisGuerraa/CollegeWork
|
064e9dbe28a090ea0f1fa1a57c9c8710238da186
|
[
"Apache-2.0"
] | 1 |
2020-07-23T21:42:51.000Z
|
2020-07-23T21:42:51.000Z
|
University manager (LS)/src/main/java/pt/isel/ls/resultview/PathLink.java
|
LuisGuerraa/StolenWorkOfCourse
|
661dd1339df51e063650d3b11e98f53eac046312
|
[
"Apache-2.0"
] | null | null | null | 16.85 | 48 | 0.593472 | 1,001,178 |
package pt.isel.ls.resultview;
public class PathLink {
private String title;
private String link;
public PathLink(String title, String link) {
this.title = title;
this.link = link;
}
public String getTitle() {
return title;
}
public String getLink() {
return link;
}
}
|
923f7af9e3036d385a78b65d16dc1a307ea8d7da
| 2,573 |
java
|
Java
|
app/src/main/java/edu/cnm/deepdive/abq_film_tour/model/entity/User.java
|
ABQFilmTour/abq-film-tour
|
a169d37bd5fd50cdc3a43c0a93339c3b7519162e
|
[
"Apache-2.0"
] | 1 |
2018-12-15T01:35:28.000Z
|
2018-12-15T01:35:28.000Z
|
app/src/main/java/edu/cnm/deepdive/abq_film_tour/model/entity/User.java
|
ABQFilmTour/ABQFilmTour
|
a169d37bd5fd50cdc3a43c0a93339c3b7519162e
|
[
"Apache-2.0"
] | 1 |
2021-08-16T18:13:57.000Z
|
2021-08-16T18:13:57.000Z
|
app/src/main/java/edu/cnm/deepdive/abq_film_tour/model/entity/User.java
|
ABQFilmTour/abq-film-tour
|
a169d37bd5fd50cdc3a43c0a93339c3b7519162e
|
[
"Apache-2.0"
] | null | null | null | 19.059259 | 73 | 0.640109 | 1,001,179 |
package edu.cnm.deepdive.abq_film_tour.model.entity;
import android.arch.persistence.room.Entity;
import android.arch.persistence.room.PrimaryKey;
import com.google.gson.annotations.Expose;
import java.util.UUID;
/**
* This class represents a user to submit data, tied to a Google account.
*/
@Entity
public class User {
/**
* The UUID associated with this user.
*/
@PrimaryKey(autoGenerate = false)
@Expose
private UUID id;
/**
* The name on the user's Google account.
*/
@Expose
private String googleName;
/**
* The ID associated with the user's Google account.
*/
@Expose
private String googleId;
/**
* Flag to check if a user is banned from using the app.
*/
@Expose
private boolean banned;
/**
* Reason for a ban.
*/
@Expose
private String banReason;
/**
* Returns the UUID associated with this user.
*
* @return the UUID associated with this user
*/
public UUID getId() {
return id;
}
/**
* Sets the UUID associated with this user.
*
* @param id the UUID associated with this user
*/
public void setId(UUID id) {
this.id = id;
}
/**
* Returns the name on the user's Google account.
*
* @return the name on the user's Google account
*/
public String getGoogleName() {
return googleName;
}
/**
* Sets the name on the user's Google account.
*
* @param googleName the name on the user's Google account
*/
public void setGoogleName(String googleName) {
this.googleName = googleName;
}
/**
* Returns the ID associated with the user's Google account.
*
* @return the ID associated with the user's Google account
*/
public String getGoogleId() {
return googleId;
}
/**
* Sets the ID associated with the user's Google account.
*
* @param googleId the ID associated with the user's Google account
*/
public void setGoogleId(String googleId) {
this.googleId = googleId;
}
/**
* Boolean flag if user is banned.
*
* @return the boolean banned flag
*/
public boolean isBanned() {
return banned;
}
/**
* Sets boolean banned flag
*
* @param banned the banned boolean flag
*/
public void setBanned(boolean banned) {
this.banned = banned;
}
/**
* Gets ban reason.
*
* @return the ban reason
*/
public String getBanReason() {
return banReason;
}
/**
* Sets ban reason.
*
* @param banReason the ban reason
*/
public void setBanReason(String banReason) {
this.banReason = banReason;
}
}
|
923f7b84b2a503f50da3e1c51da1bc10a53c82e4
| 576 |
java
|
Java
|
utf-8/src/main/java/ch/schlau/pesche/snppts/utf8/SeparatorForClassNames.java
|
pe-st/snppts
|
e73b7a508a19d414549353128a2bd39441b3ce49
|
[
"MIT"
] | null | null | null |
utf-8/src/main/java/ch/schlau/pesche/snppts/utf8/SeparatorForClassNames.java
|
pe-st/snppts
|
e73b7a508a19d414549353128a2bd39441b3ce49
|
[
"MIT"
] | 1 |
2018-05-31T10:05:23.000Z
|
2018-06-01T06:01:41.000Z
|
utf-8/src/main/java/ch/schlau/pesche/snppts/utf8/SeparatorForClassNames.java
|
pe-st/snppts
|
e73b7a508a19d414549353128a2bd39441b3ce49
|
[
"MIT"
] | null | null | null | 33.882353 | 85 | 0.612847 | 1,001,180 |
package ch.schlau.pesche.snppts.utf8;
public class SeparatorForClassNames {
public static String displayValidCharacters(int codepointFrom, int codepointTo) {
StringBuilder builder = new StringBuilder();
for (int i = codepointFrom; i < codepointTo; i++) {
if (Character.isJavaIdentifierPart(i) &&
Character.getType(i) == Character.CONNECTOR_PUNCTUATION) {
System.out.printf("codepoint %x\n", i);
builder.appendCodePoint(i);
}
}
return builder.toString();
}
}
|
923f7bc8d050fcbdf1b8d32803b9bce4f9fc96f0
| 91 |
java
|
Java
|
7/corpproc/src/main/java/cz/vutbr/fit/knot/corpproc/queryserver/OPERATOR.java
|
SergeyPanov/processing_steps
|
86526ccfadcd1272fb72eb95bd60c631105b16c4
|
[
"Apache-2.0"
] | null | null | null |
7/corpproc/src/main/java/cz/vutbr/fit/knot/corpproc/queryserver/OPERATOR.java
|
SergeyPanov/processing_steps
|
86526ccfadcd1272fb72eb95bd60c631105b16c4
|
[
"Apache-2.0"
] | null | null | null |
7/corpproc/src/main/java/cz/vutbr/fit/knot/corpproc/queryserver/OPERATOR.java
|
SergeyPanov/processing_steps
|
86526ccfadcd1272fb72eb95bd60c631105b16c4
|
[
"Apache-2.0"
] | null | null | null | 15.166667 | 48 | 0.692308 | 1,001,181 |
package cz.vutbr.fit.knot.corpproc.queryserver;
public enum OPERATOR {
OR, AND
}
|
923f7bef7777033dd82bdd630fd601707ec8a784
| 1,912 |
java
|
Java
|
kythe/java/com/google/devtools/kythe/platform/shared/MemoryStatisticsCollector.java
|
sfreilich/kythe
|
63f0a01a2c96c3b200c3c62c61f6cb96951a2dcf
|
[
"Apache-2.0"
] | 1,168 |
2015-01-27T10:19:25.000Z
|
2018-10-30T15:07:11.000Z
|
kythe/java/com/google/devtools/kythe/platform/shared/MemoryStatisticsCollector.java
|
sfreilich/kythe
|
63f0a01a2c96c3b200c3c62c61f6cb96951a2dcf
|
[
"Apache-2.0"
] | 2,811 |
2015-01-29T16:19:04.000Z
|
2018-11-01T19:48:06.000Z
|
kythe/java/com/google/devtools/kythe/platform/shared/MemoryStatisticsCollector.java
|
sfreilich/kythe
|
63f0a01a2c96c3b200c3c62c61f6cb96951a2dcf
|
[
"Apache-2.0"
] | 165 |
2015-01-27T19:06:27.000Z
|
2018-10-30T17:31:10.000Z
| 31.866667 | 82 | 0.71705 | 1,001,182 |
/*
* Copyright 2015 The Kythe Authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.devtools.kythe.platform.shared;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
/** {@link StatisticsCollector} backed by an in-memory map that can be printed. */
public class MemoryStatisticsCollector implements StatisticsCollector {
private final Map<String, AtomicLong> counters = new HashMap<>();
/** Prints the current statistics to the given {@link PrintStream}. */
public synchronized void printStatistics(PrintStream out) {
for (Map.Entry<String, AtomicLong> entry : counters.entrySet()) {
out.printf("%s:\t%d\n", entry.getKey(), entry.getValue().get());
}
}
/** Returns the value of the given counter. */
public long getValue(String name) {
return getCounter(name).get();
}
@Override
public void incrementCounter(String name) {
getCounter(name).getAndIncrement();
}
@Override
public void incrementCounter(String name, int amount) {
getCounter(name).getAndAdd(amount);
}
private synchronized AtomicLong getCounter(String name) {
if (counters.containsKey(name)) {
return counters.get(name);
} else {
AtomicLong counter = new AtomicLong();
counters.put(name, counter);
return counter;
}
}
}
|
923f7c547e43e95d2a14b96fe2d801dc95fb02e0
| 584 |
java
|
Java
|
sources/p005cm/aptoide/p006pt/app/view/C1973Ya.java
|
tusharchoudhary0003/Custom-Football-Game
|
47283462b2066ad5c53b3c901182e7ae62a34fc8
|
[
"MIT"
] | 1 |
2019-10-01T11:34:10.000Z
|
2019-10-01T11:34:10.000Z
|
sources/p005cm/aptoide/p006pt/app/view/C1973Ya.java
|
tusharchoudhary0003/Custom-Football-Game
|
47283462b2066ad5c53b3c901182e7ae62a34fc8
|
[
"MIT"
] | null | null | null |
sources/p005cm/aptoide/p006pt/app/view/C1973Ya.java
|
tusharchoudhary0003/Custom-Football-Game
|
47283462b2066ad5c53b3c901182e7ae62a34fc8
|
[
"MIT"
] | 1 |
2020-05-26T05:10:33.000Z
|
2020-05-26T05:10:33.000Z
| 27.809524 | 71 | 0.705479 | 1,001,183 |
package p005cm.aptoide.p006pt.app.view;
import p005cm.aptoide.p006pt.presenter.View.LifecycleEvent;
import p026rx.p027b.C0132p;
/* renamed from: cm.aptoide.pt.app.view.Ya */
/* compiled from: lambda */
public final /* synthetic */ class C1973Ya implements C0132p {
/* renamed from: a */
private final /* synthetic */ AppViewPresenter f5005a;
public /* synthetic */ C1973Ya(AppViewPresenter appViewPresenter) {
this.f5005a = appViewPresenter;
}
public final Object call(Object obj) {
return this.f5005a.mo10734ua((LifecycleEvent) obj);
}
}
|
923f7d26c12f685590b90ae7804f16e64c17e688
| 1,716 |
java
|
Java
|
src/main/java/at/bostijancic/vertx/jwt/JsonWebTokenValidator.java
|
ebostijancic/vertx-jwt
|
2433b5fe9660682fbfaca1e1593096003e93bff4
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/at/bostijancic/vertx/jwt/JsonWebTokenValidator.java
|
ebostijancic/vertx-jwt
|
2433b5fe9660682fbfaca1e1593096003e93bff4
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/at/bostijancic/vertx/jwt/JsonWebTokenValidator.java
|
ebostijancic/vertx-jwt
|
2433b5fe9660682fbfaca1e1593096003e93bff4
|
[
"Apache-2.0"
] | null | null | null | 34.5 | 81 | 0.646957 | 1,001,184 |
package at.bostijancic.vertx.jwt;
import org.vertx.java.core.Handler;
import org.vertx.java.core.eventbus.Message;
import org.vertx.java.core.json.JsonObject;
import org.vertx.java.platform.Verticle;
/**
* JsonWebTokenValidator is a verticle used to create and
* verify JWT (json web tokens) using HMAC SHA256 algorithm).
*
* The secret key is obtained from the config.json file.
*
* @author [email protected] 2015-01-01.
*/
public class JsonWebTokenValidator extends Verticle {
public static final String SIGN_MESSAGE = "jwt-sign-message";
public static final String VERIFY_MESSAGE = "jwt-verify-message";
public static final String SECRET_KEY_JSON_FIELD = "jwt_secret_key";
@Override
public void start() {
// get secret key from config.json
final String key = container.config().getString(SECRET_KEY_JSON_FIELD);
assert key != null && !key.equals("");
vertx.eventBus().registerHandler(SIGN_MESSAGE, new Handler<Message>() {
@Override
public void handle(Message event) {
final JsonObject payload = (JsonObject) event.body();
// reply with signed token for given payload and secret key.
// the header is fixed.
event.reply(JwtUtil.signToken(payload, key));
}
});
// verify token when verify-message is received.
vertx.eventBus().registerHandler(VERIFY_MESSAGE, new Handler<Message>() {
@Override
public void handle(Message event) {
// reply with true if token is verified.
event.reply(JwtUtil.verifyToken((String) event.body(), key));
}
});
}
}
|
923f7d59aab0d8445b8ae19c880ea6e05b75d781
| 7,488 |
java
|
Java
|
src/main/java/com/github/yuebo/dyna/backup/SystemInit.java
|
yuebo/dyna-starter
|
f11aeb58279af4062c32408b17e95a4e02fd4672
|
[
"Apache-2.0"
] | 4 |
2018-10-11T09:13:04.000Z
|
2021-09-06T07:01:09.000Z
|
src/main/java/com/github/yuebo/dyna/backup/SystemInit.java
|
yuebo/dyna-starter
|
f11aeb58279af4062c32408b17e95a4e02fd4672
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/com/github/yuebo/dyna/backup/SystemInit.java
|
yuebo/dyna-starter
|
f11aeb58279af4062c32408b17e95a4e02fd4672
|
[
"Apache-2.0"
] | 2 |
2018-10-11T09:13:04.000Z
|
2018-10-12T02:42:54.000Z
| 37.628141 | 138 | 0.565304 | 1,001,185 |
/*
*
* * Copyright 2002-2017 the original author or authors.
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
*
*/
package com.github.yuebo.dyna.backup;
import com.github.yuebo.dyna.core.ViewContext;
import com.github.yuebo.dyna.service.JDBCService;
import com.github.yuebo.dyna.utils.ClasspathViewLoader;
import com.github.yuebo.dyna.utils.SpringUtils;
import com.mongodb.BasicDBObject;
import com.mongodb.util.JSON;
import org.apache.commons.collections.map.CaseInsensitiveMap;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.github.yuebo.dyna.AppConstants.*;
/**
* User: yuebo
* Date: 1/7/15
* Time: 10:38 AM
*/
public class SystemInit {
private static Logger logger= LoggerFactory.getLogger(SystemInit.class);
private JDBCService jdbcService;
private List<String> configFiles;
private List<String> dataFiles;
private boolean initData;
private boolean initView;
private ClasspathViewLoader viewLoader;
public void setViewLoader(ClasspathViewLoader viewLoader) {
this.viewLoader = viewLoader;
}
public void setInitData(boolean initData) {
this.initData = initData;
}
public void setInitView(boolean initView) {
this.initView = initView;
}
private ApplicationContext applicationContext;
public void setConfigFiles(List<String> configFiles) {
this.configFiles = configFiles;
}
public void setDataFiles(List<String> dataFiles) {
this.dataFiles = dataFiles;
}
public void setJdbcService(JDBCService jdbcService) {
this.jdbcService = jdbcService;
}
public void init() throws IOException {
if(initData){
EvaluationContext evaluationContext = new StandardEvaluationContext();
evaluationContext.setVariable("db", this);
for (String file : dataFiles) {
ClassPathResource classPathResource = new ClassPathResource("json/" + file);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
IOUtils.copy(classPathResource.getInputStream(), outputStream);
Map<String, List<Map>> list = (Map<String, List<Map>>) JSON.parse(new String(outputStream.toByteArray(), "utf-8"));
for (String c : list.keySet()) {
String[] val = c.split("#");
List<Map> data = list.get(c);
HashMap temp = new HashMap();
for (Map d : data) {
temp.clear();
for (Object key : d.keySet()) {
if (d.get(key) instanceof String) {
String value = (String) d.get(key);
if (value.startsWith("#")) {
Object result = SpringUtils.execute(evaluationContext, value);
temp.put(key, result);
}
}
}
d.putAll(temp);
CaseInsensitiveMap dataToSave = new CaseInsensitiveMap();
dataToSave.putAll(d);
BasicDBObject condition = new BasicDBObject();
for (int j = 1; j < val.length; j++) {
condition.put(val[j], d.get(val[j]));
}
Map result = jdbcService.find(val[0], condition);
if (result == null) {
dataToSave.put(AUDIT_CREATED_BY, "system");
dataToSave.put(AUDIT_CREATED_TIME, new Date());
dataToSave.put(AUDIT_UPDATED_BY, "system");
dataToSave.put(AUDIT_UPDATED_TIME, new Date());
jdbcService.save(val[0], dataToSave);
} else {
//no update if found
}
}
}
}
}
if(initView){
jdbcService.ensureLength("tbl_view_deployment","data",8000);
jdbcService.ensureLength("tbl_view_deployment","name",500);
Resource[] resources= viewLoader.getMatchingResources();
for (Resource resource:resources){
if (resource != null) {
try (InputStream inputStream = resource.getInputStream()) {
List<String> lines = IOUtils.readLines(inputStream, "UTF-8");
StringBuffer json = new StringBuffer();
for (String s : lines) {
json.append(s);
json.append("\n");
}
ViewContext viewContext=new ViewContext((Map<String, Object>) JSON.parse(json.toString()));
Map<String,Object> result=jdbcService.find("tbl_view_deployment",new BasicDBObject("name",viewContext.getName()));
if(StringUtils.isEmpty(viewContext.getType())){
logger.error("view type cannot find {}",resource.getFilename());
}
if(result==null){
BasicDBObject view=new BasicDBObject();
view.append("name",viewContext.getName());
view.append("type",viewContext.getType());
view.append("data", com.alibaba.fastjson.JSON.toJSONString(viewContext.getViewMap(),true));
jdbcService.save("tbl_view_deployment",view);
}else {
logger.debug("view {} exist in db, ignore the file in classpath", viewContext.getName());
}
} catch (IOException e) {
logger.error("load view error: {}", resource.getFilename());
}
}
}
}
}
public Object id(String table, String name, String value) {
Map param = new HashMap();
param.put("_data", table);
param.put(name, value);
return jdbcService.findData(param).get(DB_FIELD__ID);
}
public Date now(){
return new Date();
}
}
|
923f7f0e1c59ddfd0dd0f066c2815d5865197729
| 742 |
java
|
Java
|
Part6Algs4/MyAlgs4/src/test/java/com/huawei/l00379880/algs4/chapter3search/P297SeparateChainingHashSTTest.java
|
19920625lsg/liuyubobobo-algorithms
|
2c274d785adc75c0952a79cbdd69304452e6d7c1
|
[
"MulanPSL-1.0"
] | 171 |
2018-04-13T17:47:09.000Z
|
2019-11-03T11:13:39.000Z
|
Part6Algs4/MyAlgs4/src/test/java/com/huawei/l00379880/algs4/chapter3search/P297SeparateChainingHashSTTest.java
|
luqian2017/algorithms
|
e83a17ecf1a7cfea77c5b4ecddc92eb9f1fc329c
|
[
"MulanPSL-1.0"
] | 2 |
2020-09-16T06:23:54.000Z
|
2021-09-22T15:42:06.000Z
|
Part6Algs4/MyAlgs4/src/test/java/com/huawei/l00379880/algs4/chapter3search/P297SeparateChainingHashSTTest.java
|
luqian2017/algorithms
|
e83a17ecf1a7cfea77c5b4ecddc92eb9f1fc329c
|
[
"MulanPSL-1.0"
] | 59 |
2018-06-09T01:06:24.000Z
|
2019-10-29T03:53:26.000Z
| 23.935484 | 92 | 0.574124 | 1,001,186 |
package com.huawei.l00379880.algs4.chapter3search;
import org.junit.Test;
/**
* P297SeparateChainingHashST Tester.
*
* @author liangshanguang
* @date 02/12/2018
* @description test
*/
public class P297SeparateChainingHashSTTest {
@Test
public void testMain() {
P297SeparateChainingHashST<String, Integer> st = new P297SeparateChainingHashST<>();
st.put("China", 1);
st.put("India", 3);
st.put("England", 34);
st.put("Austrilia", 0);
st.put("America", 5);
st.put("Canada", 67);
st.put("France", 45);
st.put("Germany", 11);
// print keys
for (String s : st.keys()) {
System.out.println(s + " " + st.get(s));
}
}
}
|
923f7fa4568e8117804528befbbf640b01cb9a0d
| 15,912 |
java
|
Java
|
passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java
|
wwjiang007/ofbiz-plugins
|
35af1778930eb50976778c5b165d0016e80a2986
|
[
"Apache-2.0"
] | 98 |
2017-03-23T01:56:30.000Z
|
2022-03-23T08:21:42.000Z
|
passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java
|
wwjiang007/ofbiz-plugins
|
35af1778930eb50976778c5b165d0016e80a2986
|
[
"Apache-2.0"
] | 71 |
2020-01-29T12:13:23.000Z
|
2022-02-01T15:30:47.000Z
|
passport/src/main/java/org/apache/ofbiz/passport/event/LinkedInEvents.java
|
wwjiang007/ofbiz-plugins
|
35af1778930eb50976778c5b165d0016e80a2986
|
[
"Apache-2.0"
] | 162 |
2017-05-12T06:41:26.000Z
|
2022-03-31T21:16:12.000Z
| 52.863787 | 147 | 0.665033 | 1,001,187 |
/*******************************************************************************
* 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.ofbiz.passport.event;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.security.SecureRandom;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.BasicResponseHandler;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.ofbiz.base.conversion.ConversionException;
import org.apache.ofbiz.base.conversion.JSONConverters.JSONToMap;
import org.apache.ofbiz.base.crypto.HashCrypt;
import org.apache.ofbiz.base.lang.JSON;
import org.apache.ofbiz.base.util.Debug;
import org.apache.ofbiz.base.util.UtilHttp;
import org.apache.ofbiz.base.util.UtilMisc;
import org.apache.ofbiz.base.util.UtilProperties;
import org.apache.ofbiz.base.util.UtilValidate;
import org.apache.ofbiz.common.authentication.api.AuthenticatorException;
import org.apache.ofbiz.common.login.LoginServices;
import org.apache.ofbiz.entity.Delegator;
import org.apache.ofbiz.entity.GenericEntityException;
import org.apache.ofbiz.entity.GenericValue;
import org.apache.ofbiz.entity.util.EntityQuery;
import org.apache.ofbiz.entity.util.EntityUtilProperties;
import org.apache.ofbiz.passport.user.LinkedInAuthenticator;
import org.apache.ofbiz.passport.util.PassportUtil;
import org.apache.ofbiz.product.store.ProductStoreWorker;
import org.apache.ofbiz.service.LocalDispatcher;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/**
* LinkedEvents - Events for LinkedIn login.
* Refs: https://developer.linkedin.com/documents/authentication
*/
public class LinkedInEvents {
private static final String MODULE = LinkedInEvents.class.getName();
private static final String RESOURCE = "PassportUiLabels";
public static final String AUTHORIZE_URI = "/uas/oauth2/authorization";
public static final String TOKEN_SERVICE_URI = "/uas/oauth2/accessToken";
public static final String USER_API_URI = "/v1/people/~";
public static final String DEFAULT_SCOPE = "r_basicprofile%20r_emailaddress";
public static final String TOKEN_END_POINT = "https://www.linkedin.com";
public static final String SESSION_LINKEDIN_STATE = "_LINKEDIN_STATE_";
public static final String ENV_PREFIX = UtilProperties.getPropertyValue(LinkedInAuthenticator.getPROPS(), "linkedin.env.prefix", "test");
private static final SecureRandom SECURE_RANDOM = new SecureRandom();
/**
* Redirect to LinkedIn login page.
* @return string "success" or "error"
*/
public static String linkedInRedirect(HttpServletRequest request, HttpServletResponse response) {
GenericValue oauth2LinkedIn = getOAuth2LinkedInConfig(request);
if (UtilValidate.isEmpty(oauth2LinkedIn)) {
return "error";
}
String clientId = oauth2LinkedIn.getString(PassportUtil.API_KEY_LABEL);
String returnURI = oauth2LinkedIn.getString(ENV_PREFIX + PassportUtil.RETURN_URL_LABEL);
// Get user authorization code
try {
String state = System.currentTimeMillis() + String.valueOf((SECURE_RANDOM.nextLong()));
request.getSession().setAttribute(SESSION_LINKEDIN_STATE, state);
String redirectUrl = TOKEN_END_POINT + AUTHORIZE_URI
+ "?client_id=" + clientId
+ "&response_type=code"
+ "&scope=" + DEFAULT_SCOPE
+ "&redirect_uri=" + URLEncoder.encode(returnURI, "UTF-8")
+ "&state=" + state;
response.sendRedirect(redirectUrl);
} catch (NullPointerException e) {
String errMsg = UtilProperties.getMessage(RESOURCE, "LinkedInRedirectToOAuth2NullException", UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
} catch (IOException e) {
Map<String, String> messageMap = UtilMisc.toMap("errorMessage", e.toString());
String errMsg = UtilProperties.getMessage(RESOURCE, "LinkedInRedirectToOAuth2Error", messageMap, UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
return "success";
}
/**
* Parse LinkedIn login response and login the user if possible.
* @return string "success" or "error"
*/
public static String parseLinkedInResponse(HttpServletRequest request, HttpServletResponse response) {
String authorizationCode = request.getParameter(PassportUtil.COMMON_CODE);
String state = request.getParameter(PassportUtil.COMMON_STATE);
if (!state.equals(request.getSession().getAttribute(SESSION_LINKEDIN_STATE))) {
String errMsg = UtilProperties.getMessage(RESOURCE, "LinkedInFailedToMatchState", UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
if (UtilValidate.isEmpty(authorizationCode)) {
String error = request.getParameter(PassportUtil.COMMON_ERROR);
String errorDescpriton = request.getParameter(PassportUtil.COMMON_ERROR_DESCRIPTION);
String errMsg = null;
try {
errMsg = UtilProperties.getMessage(RESOURCE, "LinkedInFailedToGetAuthorizationCode", UtilMisc.toMap(PassportUtil.COMMON_ERROR,
error, PassportUtil.COMMON_ERROR_DESCRIPTION, URLDecoder.decode(errorDescpriton, "UTF-8")), UtilHttp.getLocale(request));
} catch (UnsupportedEncodingException e) {
errMsg = UtilProperties.getMessage(RESOURCE, "LinkedInGetAuthorizationCodeError", UtilHttp.getLocale(request));
}
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
// Debug.logInfo("LinkedIn authorization code: " + authorizationCode, MODULE);
GenericValue oauth2LinkedIn = getOAuth2LinkedInConfig(request);
if (UtilValidate.isEmpty(oauth2LinkedIn)) {
String errMsg = UtilProperties.getMessage(RESOURCE, "LinkedInGetOAuth2ConfigError", UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
String clientId = oauth2LinkedIn.getString(PassportUtil.API_KEY_LABEL);
String secret = oauth2LinkedIn.getString(PassportUtil.SECRET_KEY_LABEL);
String returnURI = oauth2LinkedIn.getString(ENV_PREFIX + PassportUtil.RETURN_URL_LABEL);
// Grant token from authorization code and oauth2 token
// Use the authorization code to obtain an access token
String accessToken = null;
try {
URI uri = new URIBuilder()
.setScheme(TOKEN_END_POINT.substring(0, TOKEN_END_POINT.indexOf(":")))
.setHost(TOKEN_END_POINT.substring(TOKEN_END_POINT.indexOf(":") + 3))
.setPath(TOKEN_SERVICE_URI)
.setParameter("client_id", clientId)
.setParameter("client_secret", secret)
.setParameter("grant_type", "authorization_code")
.setParameter("code", authorizationCode)
.setParameter("redirect_uri", returnURI)
.build();
HttpPost postMethod = new HttpPost(uri);
CloseableHttpClient jsonClient = HttpClients.custom().build();
// Debug.logInfo("LinkedIn get access token query string: " + postMethod.getURI(), MODULE);
postMethod.setConfig(PassportUtil.STANDARD_REQ_CONFIG);
CloseableHttpResponse postResponse = jsonClient.execute(postMethod);
String responseString = new BasicResponseHandler().handleResponse(postResponse);
// Debug.logInfo("LinkedIn get access token response code: " + postResponse.getStatusLine().getStatusCode(), MODULE);
// Debug.logInfo("LinkedIn get access token response content: " + responseString, MODULE);
if (postResponse.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
// Debug.logInfo("Json Response from LinkedIn: " + responseString, MODULE);
JSON jsonObject = JSON.from(responseString);
JSONToMap jsonMap = new JSONToMap();
Map<String, Object> userMap = jsonMap.convert(jsonObject);
accessToken = (String) userMap.get("access_token");
// Debug.logInfo("Generated Access Token : " + accessToken, MODULE);
} else {
String errMsg = UtilProperties.getMessage(RESOURCE, "LinkedInGetOAuth2AccessTokenError", UtilMisc.toMap("error",
responseString), UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
return "error";
}
} catch (URISyntaxException | ConversionException | IOException e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
}
// Get User Profile
HttpGet getMethod = new HttpGet(TOKEN_END_POINT + USER_API_URI + "?oauth2_access_token=" + accessToken);
Document userInfo = null;
try {
userInfo = LinkedInAuthenticator.getUserInfo(getMethod, UtilHttp.getLocale(request));
} catch (IOException | ParserConfigurationException | SAXException | AuthenticatorException e) {
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
} finally {
getMethod.releaseConnection();
}
// Debug.logInfo("LinkedIn User Info:" + userInfo, MODULE);
// Store the user info and check login the user
return checkLoginLinkedInUser(request, userInfo, accessToken);
}
private static String checkLoginLinkedInUser(HttpServletRequest request, Document userInfo, String accessToken) {
Delegator delegator = (Delegator) request.getAttribute("delegator");
LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher");
String productStoreId = ProductStoreWorker.getProductStoreId(request);
String linkedInUserId = LinkedInAuthenticator.getLinkedInUserId(userInfo);
GenericValue linkedInUser = null;
try {
linkedInUser = EntityQuery.use(delegator).from("LinkedInUser").where("linkedInUserId", linkedInUserId).queryOne();
} catch (GenericEntityException e) {
request.setAttribute("_ERROR_MESSAGE_", e.getMessage());
return "error";
}
if (linkedInUser != null) {
boolean dataChanged = false;
if (!accessToken.equals(linkedInUser.getString("accessToken"))) {
linkedInUser.set("accessToken", accessToken);
dataChanged = true;
}
if (!ENV_PREFIX.equals(linkedInUser.getString("ENV_PREFIX"))) {
linkedInUser.set("ENV_PREFIX", ENV_PREFIX);
dataChanged = true;
}
if (!productStoreId.equals(linkedInUser.getString("productStoreId"))) {
linkedInUser.set("productStoreId", productStoreId);
dataChanged = true;
}
if (dataChanged) {
try {
linkedInUser.store();
} catch (GenericEntityException e) {
Debug.logError(e.getMessage(), MODULE);
}
}
} else {
linkedInUser = delegator.makeValue("LinkedInUser", UtilMisc.toMap("accessToken", accessToken,
"productStoreId", productStoreId,
"ENV_PREFIX", ENV_PREFIX,
"linkedInUserId", linkedInUserId));
try {
linkedInUser.create();
} catch (GenericEntityException e) {
Debug.logError(e.getMessage(), MODULE);
}
}
try {
GenericValue userLogin = EntityQuery.use(delegator).from("UserLogin").where("externalAuthId", linkedInUserId).queryFirst();
LinkedInAuthenticator authn = new LinkedInAuthenticator();
authn.initialize(dispatcher);
if (UtilValidate.isEmpty(userLogin)) {
String userLoginId = authn.createUser(userInfo);
userLogin = EntityQuery.use(delegator).from("UserLogin").where("userLoginId", userLoginId).queryOne();
}
String autoPassword = RandomStringUtils.randomAlphanumeric(EntityUtilProperties.getPropertyAsInteger("security",
"password.length.min", 5));
boolean useEncryption = "true".equals(UtilProperties.getPropertyValue("security", "password.encrypt"));
userLogin.set("currentPassword", useEncryption ? HashCrypt.digestHash(LoginServices.getHashType(), null, autoPassword) : autoPassword);
userLogin.store();
request.setAttribute("USERNAME", userLogin.getString("userLoginId"));
request.setAttribute("PASSWORD", autoPassword);
} catch (GenericEntityException | AuthenticatorException e) {
Debug.logError(e.getMessage(), MODULE);
request.setAttribute("_ERROR_MESSAGE_", e.toString());
return "error";
}
return "success";
}
public static GenericValue getOAuth2LinkedInConfig(HttpServletRequest request) {
Delegator delegator = (Delegator) request.getAttribute("delegator");
String productStoreId = ProductStoreWorker.getProductStoreId(request);
try {
return getOAuth2LinkedInConfig(delegator, productStoreId);
} catch (GenericEntityException e) {
Map<String, String> messageMap = UtilMisc.toMap("errorMessage", e.toString());
String errMsg = UtilProperties.getMessage(RESOURCE, "LinkedInGetOAuth2Error", messageMap, UtilHttp.getLocale(request));
request.setAttribute("_ERROR_MESSAGE_", errMsg);
}
return null;
}
public static GenericValue getOAuth2LinkedInConfig(Delegator delegator, String productStoreId) throws GenericEntityException {
return EntityQuery.use(delegator).from("OAuth2LinkedIn").where("productStoreId", productStoreId).filterByDate().queryFirst();
}
}
|
923f81ed60b715e8f3097522766d07119a601921
| 3,476 |
java
|
Java
|
app/src/main/java/com/memory_app/BackgroundSoundService.java
|
LarsHorvath/memory_app
|
8095d141d40070bf45b170e6f53ea8cd4e9db9b0
|
[
"MIT"
] | 1 |
2020-11-19T22:08:42.000Z
|
2020-11-19T22:08:42.000Z
|
app/src/main/java/com/memory_app/BackgroundSoundService.java
|
LarsHorvath/memory_app
|
8095d141d40070bf45b170e6f53ea8cd4e9db9b0
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/memory_app/BackgroundSoundService.java
|
LarsHorvath/memory_app
|
8095d141d40070bf45b170e6f53ea8cd4e9db9b0
|
[
"MIT"
] | null | null | null | 25.940299 | 121 | 0.569045 | 1,001,188 |
package com.memory_app;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Binder;
import android.os.IBinder;
import android.widget.Toast;
import androidx.annotation.Nullable;
public class BackgroundSoundService extends Service implements MediaPlayer.OnErrorListener {
private static final String TAG = "BackgroundSoundService";
MediaPlayer mediaPlayer;
private final IBinder mBinder = new ServiceBinder();
private int length = 0;
public BackgroundSoundService() {
}
public class ServiceBinder extends Binder {
BackgroundSoundService getService() {
return BackgroundSoundService.this;
}
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return mBinder;
}
@Override
public void onCreate() {
super.onCreate();
mediaPlayer = MediaPlayer.create(this, R.raw.tetris);
mediaPlayer.setOnErrorListener(this);
if (mediaPlayer != null){
mediaPlayer.setLooping(true); // Set looping
mediaPlayer.setVolume(70, 70);
}
assert mediaPlayer != null;
mediaPlayer.setOnErrorListener(new MediaPlayer.OnErrorListener() {
public boolean onError(MediaPlayer mp, int what, int
extra) {
onError(mediaPlayer, what, extra);
return true;
}
});
}
public void pauseMusic() {
if (mediaPlayer != null) {
if (mediaPlayer.isPlaying()) {
mediaPlayer.pause();
length = mediaPlayer.getCurrentPosition();
}
}
}
public void resumeMusic() {
if (mediaPlayer != null) {
if (!mediaPlayer.isPlaying()) {
mediaPlayer.seekTo(length);
mediaPlayer.start();
}
}
}
public void startMusic() {
super.onCreate();
mediaPlayer = MediaPlayer.create(this, R.raw.tetris);
mediaPlayer.setOnErrorListener(this);
if (mediaPlayer != null) {
mediaPlayer.setLooping(true);
mediaPlayer.setVolume(50, 50);
mediaPlayer.start();
}
}
public void stopMusic() {
if (mediaPlayer != null) {
mediaPlayer.stop();
mediaPlayer.release();
mediaPlayer = null;
}
}
public int onStartCommand(Intent intent, int flags, int startId) {
mediaPlayer.start();
Toast.makeText(getApplicationContext(), "Playing the Tetris Theme in the Background", Toast.LENGTH_SHORT).show();
return startId;
}
@Override
public void onDestroy() {
super.onDestroy();
if (mediaPlayer != null) {
try {
mediaPlayer.stop();
mediaPlayer.release();
} finally {
mediaPlayer = null;
}
}
}
@Override
public void onLowMemory() {
}
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
Toast.makeText(this, "Music player failed", Toast.LENGTH_SHORT).show();
if (mediaPlayer != null) {
try {
mediaPlayer.stop();
mediaPlayer.release();
} finally {
mediaPlayer = null;
}
}
return false; }
}
|
923f821fd56c06283c288b4076d8a4aabc33c2a0
| 1,902 |
java
|
Java
|
platform-dom/src/main/java/com/softicar/platform/dom/elements/DomLink.java
|
softicar/platform
|
d4cf99f3e3537272af23bf60f6b088891bd271ff
|
[
"MIT"
] | 1 |
2021-11-25T09:58:31.000Z
|
2021-11-25T09:58:31.000Z
|
platform-dom/src/main/java/com/softicar/platform/dom/elements/DomLink.java
|
softicar/platform
|
d4cf99f3e3537272af23bf60f6b088891bd271ff
|
[
"MIT"
] | 22 |
2021-11-10T13:59:22.000Z
|
2022-03-04T16:38:33.000Z
|
platform-dom/src/main/java/com/softicar/platform/dom/elements/DomLink.java
|
softicar/platform
|
d4cf99f3e3537272af23bf60f6b088891bd271ff
|
[
"MIT"
] | null | null | null | 18.831683 | 72 | 0.715563 | 1,001,189 |
package com.softicar.platform.dom.elements;
import com.softicar.platform.common.io.mime.MimeType;
import com.softicar.platform.dom.document.DomHead;
import com.softicar.platform.dom.element.DomElement;
import com.softicar.platform.dom.element.DomElementTag;
/**
* This class represents an HTML link element.
* <p>
* {@link DomLink} elements may only be appended to the {@link DomHead}.
*
* @author Oliver Richers
*/
public class DomLink extends DomElement {
@Override
public DomElementTag getTag() {
return DomElementTag.LINK;
}
public DomLink setCrossOrigin(String crossorigin) {
setAttribute("crossorigin", crossorigin);
return this;
}
public DomLink setHref(String url) {
setAttribute("href", url);
return this;
}
public DomLink setHrefLang(String languageCode) {
setAttribute("hreflang", languageCode);
return this;
}
public DomLink setMedia(String mediaQuery) {
setAttribute("media", mediaQuery);
return this;
}
public DomLink setRel(String relationship) {
setAttribute("rel", relationship);
return this;
}
public DomLink setRel(Relationship relationship) {
return setRel(relationship.toString());
}
public DomLink setType(MimeType type) {
return setType(type.toString());
}
public DomLink setType(String type) {
setAttribute("type", type);
return this;
}
public static enum Relationship {
ALTERNATE("alternate"),
AUTHOR("author"),
DNS_PREFETCH("dns-prefetch"),
HELP("help"),
ICON("icon"),
LICENSE("license"),
NEXT("next"),
PINGBACK("pingback"),
PRECONNECT("preconnect"),
PREFETCH("prefetch"),
PRELOAD("preload"),
PRERENDER("prerender"),
PREV("prev"),
SEARCH("search"),
STYLESHEET("stylesheet");
private final String identifier;
private Relationship(String identifier) {
this.identifier = identifier;
}
@Override
public String toString() {
return identifier;
}
}
}
|
923f8321f9d445e24ef872e3be5b2b1b6ecc29bc
| 1,663 |
java
|
Java
|
app/src/main/java/com/example/fei5_feelsbook/Emotion.java
|
feiooo/fei5-FeelsBook
|
bce7cf9c011358ff2f8c1f466ec1d0b855220c76
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/example/fei5_feelsbook/Emotion.java
|
feiooo/fei5-FeelsBook
|
bce7cf9c011358ff2f8c1f466ec1d0b855220c76
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/example/fei5_feelsbook/Emotion.java
|
feiooo/fei5-FeelsBook
|
bce7cf9c011358ff2f8c1f466ec1d0b855220c76
|
[
"MIT"
] | null | null | null | 18.685393 | 211 | 0.570054 | 1,001,190 |
/*
* Copyright (c) Fei Yang, CMPUT301, University of Alberta - All Rights Reserved. You may use, distribute, or modify this code under terms and conditions of the Code of Students Behavior at University of Alberta
*/
package com.example.fei5_feelsbook;
import java.util.Date;
/**
* The type Emotion.
*/
public abstract class Emotion {
private Date date;
private String feeling;
private String comment;
/**
* Set feeling.
*
* @param feeling the feeling
*/
//feeling
public void setFeeling(String feeling){
this.feeling = feeling;
}
/**
* Gets feeling.
*
* @return the feeling
*/
public String getFeeling() {
return this.feeling;
}
/**
* Sets comment.
*
* @param comment the comment
*/
//comment
public void setComment(String comment) {
this.comment = comment;
}
/**
* Gets comment.
*
* @return the comment
*/
public String getComment() {
return this.comment;
}
/**
* Set date.
*
* @param date the date
*/
//date
public void setDate(Date date){
this.date = date;
}
/**
* Gets date.
*
* @return the date
*/
public Date getDate() {
return this.date;
}
/**
* Is important boolean.
*
* @return the boolean
*/
//No method body implemented! We leave that up to the subclasses (they MUST implement it)
public abstract Boolean isImportant();
@Override
public String toString() {
return this.feeling + "|" + this.comment + " | " + this.date.toString();
}
}
|
923f84157177c90935f70d4cb5bff815b020276b
| 558 |
java
|
Java
|
src/main/java/org/xmlet/androidlayoutsapi/EnumScrollbarStyleView.java
|
xmlet/AndroidLayoutsApi
|
339a24cf2e58eff6dfcc5e3b8191816c0b1219fc
|
[
"MIT"
] | 2 |
2018-08-28T17:14:20.000Z
|
2018-12-06T00:42:34.000Z
|
src/main/java/org/xmlet/androidlayoutsapi/EnumScrollbarStyleView.java
|
xmlet/AndroidLayoutsApi
|
339a24cf2e58eff6dfcc5e3b8191816c0b1219fc
|
[
"MIT"
] | null | null | null |
src/main/java/org/xmlet/androidlayoutsapi/EnumScrollbarStyleView.java
|
xmlet/AndroidLayoutsApi
|
339a24cf2e58eff6dfcc5e3b8191816c0b1219fc
|
[
"MIT"
] | null | null | null | 26.571429 | 69 | 0.752688 | 1,001,191 |
package org.xmlet.androidlayoutsapi;
import org.xmlet.xsdasmfaster.classes.infrastructure.EnumInterface;
public enum EnumScrollbarStyleView implements EnumInterface<String> {
INSIDEINSET(String.valueOf("insideInset")),
INSIDEOVERLAY(String.valueOf("insideOverlay")),
OUTSIDEINSET(String.valueOf("outsideInset")),
OUTSIDEOVERLAY(String.valueOf("outsideOverlay"));
private final String value;
private EnumScrollbarStyleView(String var3) {
this.value = var3;
}
public final String getValue() {
return this.value;
}
}
|
923f8435e61b5141afc4a501ead5378cd5cc3a02
| 363 |
java
|
Java
|
BackEnd/src/main/java/lk/ijse/spring/rest/traveler/entity/Media_PK.java
|
DinukaX4/Traveler
|
c194e6740b2ee2c0959a0cdbbf5b017de89958ee
|
[
"Apache-2.0"
] | null | null | null |
BackEnd/src/main/java/lk/ijse/spring/rest/traveler/entity/Media_PK.java
|
DinukaX4/Traveler
|
c194e6740b2ee2c0959a0cdbbf5b017de89958ee
|
[
"Apache-2.0"
] | null | null | null |
BackEnd/src/main/java/lk/ijse/spring/rest/traveler/entity/Media_PK.java
|
DinukaX4/Traveler
|
c194e6740b2ee2c0959a0cdbbf5b017de89958ee
|
[
"Apache-2.0"
] | null | null | null | 19.105263 | 47 | 0.688705 | 1,001,192 |
package lk.ijse.spring.rest.traveler.entity;
import javax.persistence.Embeddable;
import java.io.Serializable;
@Embeddable
public class Media_PK implements Serializable {
private String name;
private String path;
public Media_PK() {
}
public Media_PK(String name, String path) {
this.name = name;
this.path = path;
}
}
|
923f849fcdfdb8ca68cd6f593d1d6fd8ef696003
| 99,614 |
java
|
Java
|
gumiho/src/main/java/com/kent/gumiho/sql/dialect/oracle/parser/OracleSQLStatementParserVisitor.java
|
kent-bo-hai/gumiho
|
6cdf295e884f99bdc7c405b9c9ab107114985588
|
[
"Apache-2.0"
] | null | null | null |
gumiho/src/main/java/com/kent/gumiho/sql/dialect/oracle/parser/OracleSQLStatementParserVisitor.java
|
kent-bo-hai/gumiho
|
6cdf295e884f99bdc7c405b9c9ab107114985588
|
[
"Apache-2.0"
] | null | null | null |
gumiho/src/main/java/com/kent/gumiho/sql/dialect/oracle/parser/OracleSQLStatementParserVisitor.java
|
kent-bo-hai/gumiho
|
6cdf295e884f99bdc7c405b9c9ab107114985588
|
[
"Apache-2.0"
] | null | null | null | 39.94146 | 151 | 0.77449 | 1,001,193 |
// Generated from /Users/kent/IdeaProjects/github/gumiho/gumiho/src/main/resources/grammars/sql/dialect/oracle/OracleSQLStatementParser.g4 by ANTLR 4.7
package com.kent.gumiho.sql.dialect.oracle.parser;
import org.antlr.v4.runtime.tree.ParseTreeVisitor;
/**
* This interface defines a complete generic visitor for a parse tree produced
* by {@link OracleSQLStatementParser}.
*
* @param <T> The return type of the visit operation. Use {@link Void} for
* operations with no return type.
*/
public interface OracleSQLStatementParserVisitor<T> extends ParseTreeVisitor<T> {
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#parse}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParse(OracleSQLStatementParser.ParseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#swallow_to_semi}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSwallow_to_semi(OracleSQLStatementParser.Swallow_to_semiContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#unit_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUnit_statement(OracleSQLStatementParser.Unit_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#drop_function}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDrop_function(OracleSQLStatementParser.Drop_functionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_function}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_function(OracleSQLStatementParser.Alter_functionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_function_body}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_function_body(OracleSQLStatementParser.Create_function_bodyContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#parallel_enable_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParallel_enable_clause(OracleSQLStatementParser.Parallel_enable_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#partition_by_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPartition_by_clause(OracleSQLStatementParser.Partition_by_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#result_cache_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitResult_cache_clause(OracleSQLStatementParser.Result_cache_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#relies_on_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRelies_on_part(OracleSQLStatementParser.Relies_on_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#streaming_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStreaming_clause(OracleSQLStatementParser.Streaming_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#drop_package}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDrop_package(OracleSQLStatementParser.Drop_packageContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_package}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_package(OracleSQLStatementParser.Alter_packageContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_package}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_package(OracleSQLStatementParser.Create_packageContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_package_body}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_package_body(OracleSQLStatementParser.Create_package_bodyContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#package_obj_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPackage_obj_spec(OracleSQLStatementParser.Package_obj_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#procedure_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitProcedure_spec(OracleSQLStatementParser.Procedure_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#function_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunction_spec(OracleSQLStatementParser.Function_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#package_obj_body}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPackage_obj_body(OracleSQLStatementParser.Package_obj_bodyContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#drop_procedure}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDrop_procedure(OracleSQLStatementParser.Drop_procedureContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_procedure}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_procedure(OracleSQLStatementParser.Alter_procedureContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#function_body}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunction_body(OracleSQLStatementParser.Function_bodyContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#procedure_body}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitProcedure_body(OracleSQLStatementParser.Procedure_bodyContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_procedure_body}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_procedure_body(OracleSQLStatementParser.Create_procedure_bodyContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#drop_trigger}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDrop_trigger(OracleSQLStatementParser.Drop_triggerContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_trigger}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_trigger(OracleSQLStatementParser.Alter_triggerContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_trigger}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_trigger(OracleSQLStatementParser.Create_triggerContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#trigger_follows_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTrigger_follows_clause(OracleSQLStatementParser.Trigger_follows_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#trigger_when_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTrigger_when_clause(OracleSQLStatementParser.Trigger_when_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#simple_dml_trigger}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSimple_dml_trigger(OracleSQLStatementParser.Simple_dml_triggerContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#for_each_row}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFor_each_row(OracleSQLStatementParser.For_each_rowContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#compound_dml_trigger}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCompound_dml_trigger(OracleSQLStatementParser.Compound_dml_triggerContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#non_dml_trigger}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNon_dml_trigger(OracleSQLStatementParser.Non_dml_triggerContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#trigger_body}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTrigger_body(OracleSQLStatementParser.Trigger_bodyContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#compound_trigger_block}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCompound_trigger_block(OracleSQLStatementParser.Compound_trigger_blockContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#timing_point_section}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTiming_point_section(OracleSQLStatementParser.Timing_point_sectionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#non_dml_event}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNon_dml_event(OracleSQLStatementParser.Non_dml_eventContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#dml_event_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDml_event_clause(OracleSQLStatementParser.Dml_event_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#dml_event_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDml_event_element(OracleSQLStatementParser.Dml_event_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#dml_event_nested_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDml_event_nested_clause(OracleSQLStatementParser.Dml_event_nested_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#referencing_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReferencing_clause(OracleSQLStatementParser.Referencing_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#referencing_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReferencing_element(OracleSQLStatementParser.Referencing_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#drop_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDrop_type(OracleSQLStatementParser.Drop_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_type(OracleSQLStatementParser.Alter_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#compile_type_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCompile_type_clause(OracleSQLStatementParser.Compile_type_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#replace_type_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReplace_type_clause(OracleSQLStatementParser.Replace_type_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_method_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_method_spec(OracleSQLStatementParser.Alter_method_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_method_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_method_element(OracleSQLStatementParser.Alter_method_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_attribute_definition}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_attribute_definition(OracleSQLStatementParser.Alter_attribute_definitionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#attribute_definition}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAttribute_definition(OracleSQLStatementParser.Attribute_definitionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_collection_clauses}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_collection_clauses(OracleSQLStatementParser.Alter_collection_clausesContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#dependent_handling_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDependent_handling_clause(OracleSQLStatementParser.Dependent_handling_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#dependent_exceptions_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDependent_exceptions_part(OracleSQLStatementParser.Dependent_exceptions_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_type(OracleSQLStatementParser.Create_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_type_body}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_type_body(OracleSQLStatementParser.Create_type_bodyContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#type_definition}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType_definition(OracleSQLStatementParser.Type_definitionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#object_type_def}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitObject_type_def(OracleSQLStatementParser.Object_type_defContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#object_as_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitObject_as_part(OracleSQLStatementParser.Object_as_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#object_under_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitObject_under_part(OracleSQLStatementParser.Object_under_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#nested_table_type_def}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNested_table_type_def(OracleSQLStatementParser.Nested_table_type_defContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#sqlj_object_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSqlj_object_type(OracleSQLStatementParser.Sqlj_object_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#type_body}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType_body(OracleSQLStatementParser.Type_bodyContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#type_body_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType_body_elements(OracleSQLStatementParser.Type_body_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#map_order_func_declaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMap_order_func_declaration(OracleSQLStatementParser.Map_order_func_declarationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#subprog_decl_in_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSubprog_decl_in_type(OracleSQLStatementParser.Subprog_decl_in_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#proc_decl_in_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitProc_decl_in_type(OracleSQLStatementParser.Proc_decl_in_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#func_decl_in_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunc_decl_in_type(OracleSQLStatementParser.Func_decl_in_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#constructor_declaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConstructor_declaration(OracleSQLStatementParser.Constructor_declarationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#modifier_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModifier_clause(OracleSQLStatementParser.Modifier_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#object_member_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitObject_member_spec(OracleSQLStatementParser.Object_member_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#sqlj_object_type_attr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSqlj_object_type_attr(OracleSQLStatementParser.Sqlj_object_type_attrContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#element_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitElement_spec(OracleSQLStatementParser.Element_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#element_spec_options}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitElement_spec_options(OracleSQLStatementParser.Element_spec_optionsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#subprogram_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSubprogram_spec(OracleSQLStatementParser.Subprogram_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#type_procedure_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType_procedure_spec(OracleSQLStatementParser.Type_procedure_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#return_type_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReturn_type_spec(OracleSQLStatementParser.Return_type_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#type_function_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType_function_spec(OracleSQLStatementParser.Type_function_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#constructor_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConstructor_spec(OracleSQLStatementParser.Constructor_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#map_order_function_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMap_order_function_spec(OracleSQLStatementParser.Map_order_function_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#pragma_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPragma_clause(OracleSQLStatementParser.Pragma_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#pragma_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPragma_elements(OracleSQLStatementParser.Pragma_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#drop_sequence}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDrop_sequence(OracleSQLStatementParser.Drop_sequenceContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_sequence}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_sequence(OracleSQLStatementParser.Alter_sequenceContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_sequence}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_sequence(OracleSQLStatementParser.Create_sequenceContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#sequence_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSequence_spec(OracleSQLStatementParser.Sequence_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#sequence_start_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSequence_start_clause(OracleSQLStatementParser.Sequence_start_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_table}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_table(OracleSQLStatementParser.Create_tableContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_view}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_view(OracleSQLStatementParser.Create_viewContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#drop_table}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDrop_table(OracleSQLStatementParser.Drop_tableContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#comment_on_column}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComment_on_column(OracleSQLStatementParser.Comment_on_columnContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#create_synonym}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCreate_synonym(OracleSQLStatementParser.Create_synonymContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#comment_on_table}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComment_on_table(OracleSQLStatementParser.Comment_on_tableContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alter_table}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlter_table(OracleSQLStatementParser.Alter_tableContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#add_constraint}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAdd_constraint(OracleSQLStatementParser.Add_constraintContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#foreign_key_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitForeign_key_clause(OracleSQLStatementParser.Foreign_key_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#references_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReferences_clause(OracleSQLStatementParser.References_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#on_delete_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOn_delete_clause(OracleSQLStatementParser.On_delete_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#unique_key_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUnique_key_clause(OracleSQLStatementParser.Unique_key_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#primary_key_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPrimary_key_clause(OracleSQLStatementParser.Primary_key_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#anonymous_block}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAnonymous_block(OracleSQLStatementParser.Anonymous_blockContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#invoker_rights_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInvoker_rights_clause(OracleSQLStatementParser.Invoker_rights_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#compiler_parameters_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCompiler_parameters_clause(OracleSQLStatementParser.Compiler_parameters_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#call_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCall_spec(OracleSQLStatementParser.Call_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#java_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitJava_spec(OracleSQLStatementParser.Java_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#c_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitC_spec(OracleSQLStatementParser.C_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#c_agent_in_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitC_agent_in_clause(OracleSQLStatementParser.C_agent_in_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#c_parameters_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitC_parameters_clause(OracleSQLStatementParser.C_parameters_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#parameter}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParameter(OracleSQLStatementParser.ParameterContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#default_value_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDefault_value_part(OracleSQLStatementParser.Default_value_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#declare_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDeclare_spec(OracleSQLStatementParser.Declare_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#variable_declaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVariable_declaration(OracleSQLStatementParser.Variable_declarationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#subtype_declaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSubtype_declaration(OracleSQLStatementParser.Subtype_declarationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#cursor_declaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCursor_declaration(OracleSQLStatementParser.Cursor_declarationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#parameter_specs}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParameter_specs(OracleSQLStatementParser.Parameter_specsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#parameter_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParameter_spec(OracleSQLStatementParser.Parameter_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#exception_declaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitException_declaration(OracleSQLStatementParser.Exception_declarationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#pragma_declaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPragma_declaration(OracleSQLStatementParser.Pragma_declarationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#record_type_def}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRecord_type_def(OracleSQLStatementParser.Record_type_defContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#field_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitField_spec(OracleSQLStatementParser.Field_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#ref_cursor_type_def}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRef_cursor_type_def(OracleSQLStatementParser.Ref_cursor_type_defContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#type_declaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType_declaration(OracleSQLStatementParser.Type_declarationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#table_type_def}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_type_def(OracleSQLStatementParser.Table_type_defContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#table_indexed_by_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_indexed_by_part(OracleSQLStatementParser.Table_indexed_by_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#varray_type_def}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVarray_type_def(OracleSQLStatementParser.Varray_type_defContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#seq_of_statements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSeq_of_statements(OracleSQLStatementParser.Seq_of_statementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#label_declaration}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLabel_declaration(OracleSQLStatementParser.Label_declarationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStatement(OracleSQLStatementParser.StatementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#assignment_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAssignment_statement(OracleSQLStatementParser.Assignment_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#continue_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitContinue_statement(OracleSQLStatementParser.Continue_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#exit_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExit_statement(OracleSQLStatementParser.Exit_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#goto_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGoto_statement(OracleSQLStatementParser.Goto_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#if_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIf_statement(OracleSQLStatementParser.If_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#elsif_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitElsif_part(OracleSQLStatementParser.Elsif_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#else_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitElse_part(OracleSQLStatementParser.Else_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#loop_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLoop_statement(OracleSQLStatementParser.Loop_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#cursor_loop_param}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCursor_loop_param(OracleSQLStatementParser.Cursor_loop_paramContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#forall_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitForall_statement(OracleSQLStatementParser.Forall_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#bounds_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBounds_clause(OracleSQLStatementParser.Bounds_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#between_bound}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBetween_bound(OracleSQLStatementParser.Between_boundContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#lower_bound}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLower_bound(OracleSQLStatementParser.Lower_boundContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#upper_bound}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUpper_bound(OracleSQLStatementParser.Upper_boundContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#null_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNull_statement(OracleSQLStatementParser.Null_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#raise_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRaise_statement(OracleSQLStatementParser.Raise_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#return_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReturn_statement(OracleSQLStatementParser.Return_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#function_call}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunction_call(OracleSQLStatementParser.Function_callContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#pipe_row_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPipe_row_statement(OracleSQLStatementParser.Pipe_row_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#body}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBody(OracleSQLStatementParser.BodyContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#exception_handler}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitException_handler(OracleSQLStatementParser.Exception_handlerContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#trigger_block}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTrigger_block(OracleSQLStatementParser.Trigger_blockContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#block}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBlock(OracleSQLStatementParser.BlockContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#sql_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSql_statement(OracleSQLStatementParser.Sql_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#execute_immediate}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExecute_immediate(OracleSQLStatementParser.Execute_immediateContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#dynamic_returning_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDynamic_returning_clause(OracleSQLStatementParser.Dynamic_returning_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#data_manipulation_language_statements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitData_manipulation_language_statements(OracleSQLStatementParser.Data_manipulation_language_statementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#cursor_manipulation_statements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCursor_manipulation_statements(OracleSQLStatementParser.Cursor_manipulation_statementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#close_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitClose_statement(OracleSQLStatementParser.Close_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#open_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOpen_statement(OracleSQLStatementParser.Open_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#fetch_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFetch_statement(OracleSQLStatementParser.Fetch_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#open_for_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOpen_for_statement(OracleSQLStatementParser.Open_for_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#transaction_control_statements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTransaction_control_statements(OracleSQLStatementParser.Transaction_control_statementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#set_transaction_command}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSet_transaction_command(OracleSQLStatementParser.Set_transaction_commandContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#set_constraint_command}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSet_constraint_command(OracleSQLStatementParser.Set_constraint_commandContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#commit_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCommit_statement(OracleSQLStatementParser.Commit_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#rollback_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRollback_statement(OracleSQLStatementParser.Rollback_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#savepoint_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSavepoint_statement(OracleSQLStatementParser.Savepoint_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#explain_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExplain_statement(OracleSQLStatementParser.Explain_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#select_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelect_statement(OracleSQLStatementParser.Select_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#subquery_factoring_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSubquery_factoring_clause(OracleSQLStatementParser.Subquery_factoring_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#factoring_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFactoring_element(OracleSQLStatementParser.Factoring_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#search_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSearch_clause(OracleSQLStatementParser.Search_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#cycle_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCycle_clause(OracleSQLStatementParser.Cycle_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#subquery}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSubquery(OracleSQLStatementParser.SubqueryContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#subquery_operation_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSubquery_operation_part(OracleSQLStatementParser.Subquery_operation_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#subquery_basic_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSubquery_basic_elements(OracleSQLStatementParser.Subquery_basic_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#query_block}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitQuery_block(OracleSQLStatementParser.Query_blockContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#selected_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelected_element(OracleSQLStatementParser.Selected_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#from_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFrom_clause(OracleSQLStatementParser.From_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#select_list_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelect_list_elements(OracleSQLStatementParser.Select_list_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#table_ref_list}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_ref_list(OracleSQLStatementParser.Table_ref_listContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#table_ref}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_ref(OracleSQLStatementParser.Table_refContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#table_ref_aux}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_ref_aux(OracleSQLStatementParser.Table_ref_auxContext ctx);
/**
* Visit a parse tree produced by the {@code table_ref_aux_internal_one}
* labeled alternative in {@link OracleSQLStatementParser#table_ref_aux_internal}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_ref_aux_internal_one(OracleSQLStatementParser.Table_ref_aux_internal_oneContext ctx);
/**
* Visit a parse tree produced by the {@code table_ref_aux_internal_two}
* labeled alternative in {@link OracleSQLStatementParser#table_ref_aux_internal}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_ref_aux_internal_two(OracleSQLStatementParser.Table_ref_aux_internal_twoContext ctx);
/**
* Visit a parse tree produced by the {@code table_ref_aux_internal_three}
* labeled alternative in {@link OracleSQLStatementParser#table_ref_aux_internal}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_ref_aux_internal_three(OracleSQLStatementParser.Table_ref_aux_internal_threeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#join_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitJoin_clause(OracleSQLStatementParser.Join_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#join_on_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitJoin_on_part(OracleSQLStatementParser.Join_on_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#join_using_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitJoin_using_part(OracleSQLStatementParser.Join_using_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#outer_join_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOuter_join_type(OracleSQLStatementParser.Outer_join_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#query_partition_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitQuery_partition_clause(OracleSQLStatementParser.Query_partition_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#flashback_query_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFlashback_query_clause(OracleSQLStatementParser.Flashback_query_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#pivot_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPivot_clause(OracleSQLStatementParser.Pivot_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#pivot_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPivot_element(OracleSQLStatementParser.Pivot_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#pivot_for_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPivot_for_clause(OracleSQLStatementParser.Pivot_for_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#pivot_in_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPivot_in_clause(OracleSQLStatementParser.Pivot_in_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#pivot_in_clause_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPivot_in_clause_element(OracleSQLStatementParser.Pivot_in_clause_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#pivot_in_clause_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPivot_in_clause_elements(OracleSQLStatementParser.Pivot_in_clause_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#unpivot_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUnpivot_clause(OracleSQLStatementParser.Unpivot_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#unpivot_in_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUnpivot_in_clause(OracleSQLStatementParser.Unpivot_in_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#unpivot_in_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUnpivot_in_elements(OracleSQLStatementParser.Unpivot_in_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#hierarchical_query_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitHierarchical_query_clause(OracleSQLStatementParser.Hierarchical_query_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#start_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStart_part(OracleSQLStatementParser.Start_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#group_by_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGroup_by_clause(OracleSQLStatementParser.Group_by_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#group_by_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGroup_by_elements(OracleSQLStatementParser.Group_by_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#rollup_cube_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRollup_cube_clause(OracleSQLStatementParser.Rollup_cube_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#grouping_sets_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGrouping_sets_clause(OracleSQLStatementParser.Grouping_sets_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#grouping_sets_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGrouping_sets_elements(OracleSQLStatementParser.Grouping_sets_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#having_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitHaving_clause(OracleSQLStatementParser.Having_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_clause(OracleSQLStatementParser.Model_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#cell_reference_options}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCell_reference_options(OracleSQLStatementParser.Cell_reference_optionsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#return_rows_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReturn_rows_clause(OracleSQLStatementParser.Return_rows_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#reference_model}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReference_model(OracleSQLStatementParser.Reference_modelContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#main_model}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMain_model(OracleSQLStatementParser.Main_modelContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_column_clauses}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_column_clauses(OracleSQLStatementParser.Model_column_clausesContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_column_partition_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_column_partition_part(OracleSQLStatementParser.Model_column_partition_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_column_list}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_column_list(OracleSQLStatementParser.Model_column_listContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_column}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_column(OracleSQLStatementParser.Model_columnContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_rules_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_rules_clause(OracleSQLStatementParser.Model_rules_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_rules_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_rules_part(OracleSQLStatementParser.Model_rules_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_rules_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_rules_element(OracleSQLStatementParser.Model_rules_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#cell_assignment}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCell_assignment(OracleSQLStatementParser.Cell_assignmentContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_iterate_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_iterate_clause(OracleSQLStatementParser.Model_iterate_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#until_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUntil_part(OracleSQLStatementParser.Until_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#order_by_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOrder_by_clause(OracleSQLStatementParser.Order_by_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#order_by_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOrder_by_elements(OracleSQLStatementParser.Order_by_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#for_update_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFor_update_clause(OracleSQLStatementParser.For_update_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#for_update_of_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFor_update_of_part(OracleSQLStatementParser.For_update_of_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#for_update_options}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFor_update_options(OracleSQLStatementParser.For_update_optionsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#update_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUpdate_statement(OracleSQLStatementParser.Update_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#update_set_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUpdate_set_clause(OracleSQLStatementParser.Update_set_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#column_based_update_set_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitColumn_based_update_set_clause(OracleSQLStatementParser.Column_based_update_set_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#delete_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDelete_statement(OracleSQLStatementParser.Delete_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#insert_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInsert_statement(OracleSQLStatementParser.Insert_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#single_table_insert}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSingle_table_insert(OracleSQLStatementParser.Single_table_insertContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#multi_table_insert}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMulti_table_insert(OracleSQLStatementParser.Multi_table_insertContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#multi_table_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMulti_table_element(OracleSQLStatementParser.Multi_table_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#conditional_insert_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConditional_insert_clause(OracleSQLStatementParser.Conditional_insert_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#conditional_insert_when_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConditional_insert_when_part(OracleSQLStatementParser.Conditional_insert_when_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#conditional_insert_else_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConditional_insert_else_part(OracleSQLStatementParser.Conditional_insert_else_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#insert_into_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInsert_into_clause(OracleSQLStatementParser.Insert_into_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#values_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitValues_clause(OracleSQLStatementParser.Values_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#merge_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMerge_statement(OracleSQLStatementParser.Merge_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#merge_update_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMerge_update_clause(OracleSQLStatementParser.Merge_update_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#merge_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMerge_element(OracleSQLStatementParser.Merge_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#merge_update_delete_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMerge_update_delete_part(OracleSQLStatementParser.Merge_update_delete_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#merge_insert_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMerge_insert_clause(OracleSQLStatementParser.Merge_insert_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#selected_tableview}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSelected_tableview(OracleSQLStatementParser.Selected_tableviewContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#lock_table_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLock_table_statement(OracleSQLStatementParser.Lock_table_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#wait_nowait_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWait_nowait_part(OracleSQLStatementParser.Wait_nowait_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#lock_table_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLock_table_element(OracleSQLStatementParser.Lock_table_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#lock_mode}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLock_mode(OracleSQLStatementParser.Lock_modeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#general_table_ref}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGeneral_table_ref(OracleSQLStatementParser.General_table_refContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#static_returning_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStatic_returning_clause(OracleSQLStatementParser.Static_returning_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#error_logging_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitError_logging_clause(OracleSQLStatementParser.Error_logging_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#error_logging_into_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitError_logging_into_part(OracleSQLStatementParser.Error_logging_into_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#error_logging_reject_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitError_logging_reject_part(OracleSQLStatementParser.Error_logging_reject_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#dml_table_expression_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDml_table_expression_clause(OracleSQLStatementParser.Dml_table_expression_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#table_collection_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_collection_expression(OracleSQLStatementParser.Table_collection_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#subquery_restriction_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSubquery_restriction_clause(OracleSQLStatementParser.Subquery_restriction_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#sample_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSample_clause(OracleSQLStatementParser.Sample_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#seed_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSeed_part(OracleSQLStatementParser.Seed_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#cursor_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCursor_expression(OracleSQLStatementParser.Cursor_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#expression_list}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExpression_list(OracleSQLStatementParser.Expression_listContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#condition}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCondition(OracleSQLStatementParser.ConditionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExpression(OracleSQLStatementParser.ExpressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#logical_or_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLogical_or_expression(OracleSQLStatementParser.Logical_or_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#logical_and_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLogical_and_expression(OracleSQLStatementParser.Logical_and_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#negated_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNegated_expression(OracleSQLStatementParser.Negated_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#equality_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitEquality_expression(OracleSQLStatementParser.Equality_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#multiset_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMultiset_expression(OracleSQLStatementParser.Multiset_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#multiset_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMultiset_type(OracleSQLStatementParser.Multiset_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#relational_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRelational_expression(OracleSQLStatementParser.Relational_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#relational_operator}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRelational_operator(OracleSQLStatementParser.Relational_operatorContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#compound_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCompound_expression(OracleSQLStatementParser.Compound_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#like_concatenation}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLike_concatenation(OracleSQLStatementParser.Like_concatenationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#like_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLike_type(OracleSQLStatementParser.Like_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#like_escape_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLike_escape_part(OracleSQLStatementParser.Like_escape_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#in_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIn_elements(OracleSQLStatementParser.In_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#between_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBetween_elements(OracleSQLStatementParser.Between_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#concatenation}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConcatenation(OracleSQLStatementParser.ConcatenationContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#additive_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAdditive_expression(OracleSQLStatementParser.Additive_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#multiply_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMultiply_expression(OracleSQLStatementParser.Multiply_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#datetime_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDatetime_expression(OracleSQLStatementParser.Datetime_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#interval_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInterval_expression(OracleSQLStatementParser.Interval_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_expression(OracleSQLStatementParser.Model_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#model_expression_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitModel_expression_element(OracleSQLStatementParser.Model_expression_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#single_column_for_loop}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSingle_column_for_loop(OracleSQLStatementParser.Single_column_for_loopContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#for_like_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFor_like_part(OracleSQLStatementParser.For_like_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#for_increment_decrement_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFor_increment_decrement_type(OracleSQLStatementParser.For_increment_decrement_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#multi_column_for_loop}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMulti_column_for_loop(OracleSQLStatementParser.Multi_column_for_loopContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#unary_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUnary_expression(OracleSQLStatementParser.Unary_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#case_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCase_statement(OracleSQLStatementParser.Case_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#simple_case_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSimple_case_statement(OracleSQLStatementParser.Simple_case_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#simple_case_when_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSimple_case_when_part(OracleSQLStatementParser.Simple_case_when_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#searched_case_statement}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSearched_case_statement(OracleSQLStatementParser.Searched_case_statementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#searched_case_when_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSearched_case_when_part(OracleSQLStatementParser.Searched_case_when_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#case_else_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCase_else_part(OracleSQLStatementParser.Case_else_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#atom}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAtom(OracleSQLStatementParser.AtomContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#expression_or_vector}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExpression_or_vector(OracleSQLStatementParser.Expression_or_vectorContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#vector_expr}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVector_expr(OracleSQLStatementParser.Vector_exprContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#quantified_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitQuantified_expression(OracleSQLStatementParser.Quantified_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#string_function}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitString_function(OracleSQLStatementParser.String_functionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#standard_function}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStandard_function(OracleSQLStatementParser.Standard_functionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#numeric_function_wrapper}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNumeric_function_wrapper(OracleSQLStatementParser.Numeric_function_wrapperContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#numeric_function}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNumeric_function(OracleSQLStatementParser.Numeric_functionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#date_time_function}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDate_time_function(OracleSQLStatementParser.Date_time_functionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#other_function}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOther_function(OracleSQLStatementParser.Other_functionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#over_clause_keyword}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOver_clause_keyword(OracleSQLStatementParser.Over_clause_keywordContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#within_or_over_clause_keyword}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWithin_or_over_clause_keyword(OracleSQLStatementParser.Within_or_over_clause_keywordContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#standard_prediction_function_keyword}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStandard_prediction_function_keyword(OracleSQLStatementParser.Standard_prediction_function_keywordContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#over_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOver_clause(OracleSQLStatementParser.Over_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#windowing_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWindowing_clause(OracleSQLStatementParser.Windowing_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#windowing_type}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWindowing_type(OracleSQLStatementParser.Windowing_typeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#windowing_elements}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWindowing_elements(OracleSQLStatementParser.Windowing_elementsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#using_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUsing_clause(OracleSQLStatementParser.Using_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#using_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitUsing_element(OracleSQLStatementParser.Using_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#collect_order_by_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCollect_order_by_part(OracleSQLStatementParser.Collect_order_by_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#within_or_over_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWithin_or_over_part(OracleSQLStatementParser.Within_or_over_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#cost_matrix_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCost_matrix_clause(OracleSQLStatementParser.Cost_matrix_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xml_passing_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXml_passing_clause(OracleSQLStatementParser.Xml_passing_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xml_attributes_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXml_attributes_clause(OracleSQLStatementParser.Xml_attributes_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xml_namespaces_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXml_namespaces_clause(OracleSQLStatementParser.Xml_namespaces_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xml_table_column}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXml_table_column(OracleSQLStatementParser.Xml_table_columnContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xml_general_default_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXml_general_default_part(OracleSQLStatementParser.Xml_general_default_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xml_multiuse_expression_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXml_multiuse_expression_element(OracleSQLStatementParser.Xml_multiuse_expression_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xmlroot_param_version_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXmlroot_param_version_part(OracleSQLStatementParser.Xmlroot_param_version_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xmlroot_param_standalone_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXmlroot_param_standalone_part(OracleSQLStatementParser.Xmlroot_param_standalone_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xmlserialize_param_enconding_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXmlserialize_param_enconding_part(OracleSQLStatementParser.Xmlserialize_param_enconding_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xmlserialize_param_version_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXmlserialize_param_version_part(OracleSQLStatementParser.Xmlserialize_param_version_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xmlserialize_param_ident_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXmlserialize_param_ident_part(OracleSQLStatementParser.Xmlserialize_param_ident_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#sql_plus_command}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSql_plus_command(OracleSQLStatementParser.Sql_plus_commandContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#whenever_command}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWhenever_command(OracleSQLStatementParser.Whenever_commandContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#set_command}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSet_command(OracleSQLStatementParser.Set_commandContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#exit_command}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitExit_command(OracleSQLStatementParser.Exit_commandContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#prompt_command}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPrompt_command(OracleSQLStatementParser.Prompt_commandContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#show_errors_command}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitShow_errors_command(OracleSQLStatementParser.Show_errors_commandContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#start_command}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitStart_command(OracleSQLStatementParser.Start_commandContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#partition_extension_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPartition_extension_clause(OracleSQLStatementParser.Partition_extension_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#column_alias}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitColumn_alias(OracleSQLStatementParser.Column_aliasContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#table_alias}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_alias(OracleSQLStatementParser.Table_aliasContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#alias_quoted_string}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAlias_quoted_string(OracleSQLStatementParser.Alias_quoted_stringContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#where_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitWhere_clause(OracleSQLStatementParser.Where_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#current_of_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCurrent_of_clause(OracleSQLStatementParser.Current_of_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#into_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInto_clause(OracleSQLStatementParser.Into_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#xml_column_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitXml_column_name(OracleSQLStatementParser.Xml_column_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#cost_class_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCost_class_name(OracleSQLStatementParser.Cost_class_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#attribute_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAttribute_name(OracleSQLStatementParser.Attribute_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#savepoint_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSavepoint_name(OracleSQLStatementParser.Savepoint_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#rollback_segment_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRollback_segment_name(OracleSQLStatementParser.Rollback_segment_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#table_var_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_var_name(OracleSQLStatementParser.Table_var_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#schema_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchema_name(OracleSQLStatementParser.Schema_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#routine_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRoutine_name(OracleSQLStatementParser.Routine_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#package_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPackage_name(OracleSQLStatementParser.Package_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#implementation_type_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitImplementation_type_name(OracleSQLStatementParser.Implementation_type_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#parameter_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitParameter_name(OracleSQLStatementParser.Parameter_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#reference_model_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitReference_model_name(OracleSQLStatementParser.Reference_model_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#main_model_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitMain_model_name(OracleSQLStatementParser.Main_model_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#aggregate_function_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAggregate_function_name(OracleSQLStatementParser.Aggregate_function_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#query_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitQuery_name(OracleSQLStatementParser.Query_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#constraint_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConstraint_name(OracleSQLStatementParser.Constraint_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#label_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLabel_name(OracleSQLStatementParser.Label_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#type_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType_name(OracleSQLStatementParser.Type_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#sequence_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSequence_name(OracleSQLStatementParser.Sequence_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#exception_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitException_name(OracleSQLStatementParser.Exception_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#function_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunction_name(OracleSQLStatementParser.Function_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#procedure_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitProcedure_name(OracleSQLStatementParser.Procedure_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#constructor_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConstructor_name(OracleSQLStatementParser.Constructor_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#trigger_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTrigger_name(OracleSQLStatementParser.Trigger_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#variable_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitVariable_name(OracleSQLStatementParser.Variable_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#index_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIndex_name(OracleSQLStatementParser.Index_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#cursor_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCursor_name(OracleSQLStatementParser.Cursor_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#record_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRecord_name(OracleSQLStatementParser.Record_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#collection_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitCollection_name(OracleSQLStatementParser.Collection_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#link_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLink_name(OracleSQLStatementParser.Link_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#column_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitColumn_name(OracleSQLStatementParser.Column_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#tableview_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTableview_name(OracleSQLStatementParser.Tableview_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#char_set_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitChar_set_name(OracleSQLStatementParser.Char_set_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#synonym_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSynonym_name(OracleSQLStatementParser.Synonym_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#schema_object_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitSchema_object_name(OracleSQLStatementParser.Schema_object_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#keep_clause}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitKeep_clause(OracleSQLStatementParser.Keep_clauseContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#comma}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitComma(OracleSQLStatementParser.CommaContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#function_argument}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunction_argument(OracleSQLStatementParser.Function_argumentContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#function_argument_analytic}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunction_argument_analytic(OracleSQLStatementParser.Function_argument_analyticContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#function_argument_modeling}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFunction_argument_modeling(OracleSQLStatementParser.Function_argument_modelingContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#respect_or_ignore_nulls}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRespect_or_ignore_nulls(OracleSQLStatementParser.Respect_or_ignore_nullsContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#argument}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitArgument(OracleSQLStatementParser.ArgumentContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#type_spec}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitType_spec(OracleSQLStatementParser.Type_specContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#datatype}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDatatype(OracleSQLStatementParser.DatatypeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#precision_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitPrecision_part(OracleSQLStatementParser.Precision_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#native_datatype_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNative_datatype_element(OracleSQLStatementParser.Native_datatype_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#bind_variable}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitBind_variable(OracleSQLStatementParser.Bind_variableContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#general_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGeneral_element(OracleSQLStatementParser.General_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#general_element_part}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGeneral_element_part(OracleSQLStatementParser.General_element_partContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#table_element}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitTable_element(OracleSQLStatementParser.Table_elementContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#constant}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConstant(OracleSQLStatementParser.ConstantContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#numeric}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNumeric(OracleSQLStatementParser.NumericContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#int_value}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitInt_value(OracleSQLStatementParser.Int_valueContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#float_value}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitFloat_value(OracleSQLStatementParser.Float_valueContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#numeric_negative}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNumeric_negative(OracleSQLStatementParser.Numeric_negativeContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#quoted_string}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitQuoted_string(OracleSQLStatementParser.Quoted_stringContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#identifier}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitIdentifier(OracleSQLStatementParser.IdentifierContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#id_expression}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitId_expression(OracleSQLStatementParser.Id_expressionContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#not_equal_op}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNot_equal_op(OracleSQLStatementParser.Not_equal_opContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#greater_than_or_equals_op}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitGreater_than_or_equals_op(OracleSQLStatementParser.Greater_than_or_equals_opContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#less_than_or_equals_op}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitLess_than_or_equals_op(OracleSQLStatementParser.Less_than_or_equals_opContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#concatenation_op}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConcatenation_op(OracleSQLStatementParser.Concatenation_opContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#outer_join_sign}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitOuter_join_sign(OracleSQLStatementParser.Outer_join_signContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#regular_id}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitRegular_id(OracleSQLStatementParser.Regular_idContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#string_function_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitString_function_name(OracleSQLStatementParser.String_function_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#numeric_function_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitNumeric_function_name(OracleSQLStatementParser.Numeric_function_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#date_time_function_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitDate_time_function_name(OracleSQLStatementParser.Date_time_function_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#conversion_function_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitConversion_function_name(OracleSQLStatementParser.Conversion_function_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#analytic_function_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAnalytic_function_name(OracleSQLStatementParser.Analytic_function_nameContext ctx);
/**
* Visit a parse tree produced by {@link OracleSQLStatementParser#advanced_function_name}.
* @param ctx the parse tree
* @return the visitor result
*/
T visitAdvanced_function_name(OracleSQLStatementParser.Advanced_function_nameContext ctx);
}
|
923f84af394a4c262d1916f8fb8682bca624ade0
| 450 |
java
|
Java
|
src/main/java/weblx/str/TrimFun.java
|
viegasfh/hpweblang
|
939376753a3fed56fc47033012e9784148290dce
|
[
"RSA-MD"
] | 1 |
2020-06-24T05:19:37.000Z
|
2020-06-24T05:19:37.000Z
|
src/main/java/weblx/str/TrimFun.java
|
viegasfh/hpweblang
|
939376753a3fed56fc47033012e9784148290dce
|
[
"RSA-MD"
] | 10 |
2020-06-20T00:23:47.000Z
|
2020-07-23T20:35:12.000Z
|
src/main/java/weblx/str/TrimFun.java
|
viegasfh/weblang
|
939376753a3fed56fc47033012e9784148290dce
|
[
"RSA-MD"
] | null | null | null | 25 | 84 | 0.637778 | 1,001,194 |
package weblx.str;
import webl.lang.*;
import webl.lang.expr.*;
import webl.lang.builtins.*;
import java.util.*;
public class TrimFun extends AbstractFunExpr
{
public String toString() {
return "<Trim>";
}
public Expr Apply(Context c, Vector args, Expr callsite) throws WebLException {
CheckArgCount(c, args, callsite, 1);
return Program.Str(StringArg(c, args, callsite, 0).trim());
}
}
|
923f8541c32bf9a171f50c6123021658ffff5306
| 7,815 |
java
|
Java
|
attribute-masking-service/src/main/java/uk/gov/gchq/palisade/service/attributemask/domain/AuthorisedRequestEntity.java
|
gchq/Palisade-services
|
105c35f7fe42216858cb1011c749e6f5db76b86f
|
[
"Apache-2.0",
"CC-BY-4.0"
] | 3 |
2020-07-13T09:43:55.000Z
|
2021-01-07T12:44:52.000Z
|
attribute-masking-service/src/main/java/uk/gov/gchq/palisade/service/attributemask/domain/AuthorisedRequestEntity.java
|
gchq/Palisade-services
|
105c35f7fe42216858cb1011c749e6f5db76b86f
|
[
"Apache-2.0",
"CC-BY-4.0"
] | 66 |
2019-10-03T14:47:59.000Z
|
2022-01-24T03:36:02.000Z
|
attribute-masking-service/src/main/java/uk/gov/gchq/palisade/service/attributemask/domain/AuthorisedRequestEntity.java
|
gchq/Palisade-services
|
105c35f7fe42216858cb1011c749e6f5db76b86f
|
[
"Apache-2.0",
"CC-BY-4.0"
] | 4 |
2020-05-07T20:39:11.000Z
|
2021-05-19T04:55:21.000Z
| 34.888393 | 151 | 0.659757 | 1,001,195 |
/*
* Copyright 2018-2021 Crown Copyright
*
* 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 uk.gov.gchq.palisade.service.attributemask.domain;
import org.springframework.data.annotation.PersistenceConstructor;
import org.springframework.data.redis.core.RedisHash;
import org.springframework.data.redis.core.TimeToLive;
import org.springframework.data.redis.core.index.Indexed;
import uk.gov.gchq.palisade.Context;
import uk.gov.gchq.palisade.Generated;
import uk.gov.gchq.palisade.resource.LeafResource;
import uk.gov.gchq.palisade.rule.Rules;
import uk.gov.gchq.palisade.service.attributemask.config.RedisConfiguration;
import uk.gov.gchq.palisade.user.User;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import java.util.Objects;
import java.util.StringJoiner;
/**
* An entity for access to a single leafResource with a set of rules (and user/context to apply)
* to be persisted in a repository/database. A (unique) key is created from the concatenation of
* the token and leafResource id, which is used for indexing. This will later be retrieved by the
* Data Service to assert the client's access has been authorised and the rules for such access.
*/
@Entity
@Table(
name = "authorised_requests",
uniqueConstraints = {
@UniqueConstraint(columnNames = "unique_id"),
@UniqueConstraint(columnNames = {"token", "resource_id"})
}
)
@RedisHash(timeToLive = 86400)
public class AuthorisedRequestEntity {
@Id
@Column(name = "unique_id", columnDefinition = "varchar(255)")
@org.springframework.data.annotation.Id
@Indexed
private String uniqueId;
@Column(name = "token", columnDefinition = "varchar(255)")
private String token;
@Column(name = "resource_id", columnDefinition = "varchar(255)")
private String resourceId;
@Column(name = "user", columnDefinition = "clob")
@Convert(converter = UserConverter.class)
private User user;
@Column(name = "leaf_resource", columnDefinition = "clob")
@Convert(converter = LeafResourceConverter.class)
private LeafResource leafResource;
@Column(name = "context", columnDefinition = "clob")
@Convert(converter = ContextConverter.class)
private Context context;
@Column(name = "rules", columnDefinition = "clob")
@Convert(converter = RulesConverter.class)
private Rules<?> rules;
@TimeToLive
protected Long timeToLive;
/**
* Empty-constructor for (de)serialisation functions
*/
public AuthorisedRequestEntity() {
// Empty constructor
}
/**
* Constructor for an AuthorisedRequestEntity to be persisted in a repository/database.
* A (unique) key is created from the concatenation of the token and leafResource id, which is used for indexing.
*
* @param token the token {@link String} for the client request as a whole, created by the Palisade Service
* @param user the {@link User} as authorised and returned by the User Service
* @param leafResource one of many {@link LeafResource} as discovered and returned by the Resource Rervice
* @param context the {@link Context} as originally supplied by the client
* @param rules the {@link Rules} that will be applied to the resource and its records as returned by the Policy Service
*/
@PersistenceConstructor
public AuthorisedRequestEntity(final String token, final User user, final LeafResource leafResource, final Context context, final Rules<?> rules) {
this.uniqueId = new AuthorisedRequestEntityId(token, leafResource.getId()).getUniqueId();
this.token = token;
this.resourceId = leafResource.getId();
this.user = user;
this.leafResource = leafResource;
this.context = context;
this.rules = rules;
this.timeToLive = RedisConfiguration.getTimeToLiveSeconds("AuthorisedRequestEntity");
}
@Generated
public String getToken() {
return token;
}
@Generated
public String getResourceId() {
return resourceId;
}
@Generated
public User getUser() {
return user;
}
@Generated
public LeafResource getLeafResource() {
return leafResource;
}
@Generated
public Context getContext() {
return context;
}
@Generated
// Generic wildcard types should not be used in return types
// But we don't necessarily know the type of the record
@SuppressWarnings("java:S1452")
public Rules<?> getRules() {
return rules;
}
@Generated
public Long getTimeToLive() {
return timeToLive;
}
@Override
@Generated
public boolean equals(final Object o) {
if (this == o) {
return true;
}
if (!(o instanceof AuthorisedRequestEntity)) {
return false;
}
final AuthorisedRequestEntity that = (AuthorisedRequestEntity) o;
return Objects.equals(uniqueId, that.uniqueId) &&
Objects.equals(token, that.token) &&
Objects.equals(resourceId, that.resourceId) &&
Objects.equals(user, that.user) &&
Objects.equals(leafResource, that.leafResource) &&
Objects.equals(context, that.context) &&
Objects.equals(rules, that.rules);
}
@Override
@Generated
public int hashCode() {
return Objects.hash(uniqueId, token, resourceId, user, leafResource, context, rules);
}
@Override
@Generated
public String toString() {
return new StringJoiner(", ", AuthorisedRequestEntity.class.getSimpleName() + "[", "]")
.add("token='" + token + "'")
.add("resourceId='" + resourceId + "'")
.add("user=" + user)
.add("leafResource=" + leafResource)
.add("context=" + context)
.add("rules=" + rules)
.add(super.toString())
.toString();
}
/**
* Helper class for mapping tokens and resourceIds to a (unique) product of the two.
*/
public static class AuthorisedRequestEntityId {
private final String token;
private final String resourceId;
/**
* Basic constructor taking in the pair of non-unique keys
*
* @param token the token of the request - unique per each new client request
* @param resourceId the resource id for this response - unique per resource and
* thus across all returned resources for this request
*/
public AuthorisedRequestEntityId(final String token, final String resourceId) {
this.token = token;
this.resourceId = resourceId;
}
/**
* Create a unique product of the token and resourceId
* Concatenate the two strings with a separator that shouldn't appear in either String
*
* @return a unique id for indexing the entity on
*/
public String getUniqueId() {
return token + "::" + resourceId;
}
}
}
|
923f8570027cb77adc269b8158bfec710ef30ffd
| 4,997 |
java
|
Java
|
support/cas-server-support-gauth-redis/src/main/java/org/apereo/cas/gauth/credential/RedisGoogleAuthenticatorTokenCredentialRepository.java
|
borisParis1/cas
|
cfd5c065e221eef25699e1f2254fc52205603a8d
|
[
"Apache-2.0"
] | 2 |
2019-05-23T15:45:42.000Z
|
2021-07-01T01:49:54.000Z
|
support/cas-server-support-gauth-redis/src/main/java/org/apereo/cas/gauth/credential/RedisGoogleAuthenticatorTokenCredentialRepository.java
|
borisParis1/cas
|
cfd5c065e221eef25699e1f2254fc52205603a8d
|
[
"Apache-2.0"
] | 1 |
2019-06-06T22:43:59.000Z
|
2019-06-06T22:44:01.000Z
|
support/cas-server-support-gauth-redis/src/main/java/org/apereo/cas/gauth/credential/RedisGoogleAuthenticatorTokenCredentialRepository.java
|
borisParis1/cas
|
cfd5c065e221eef25699e1f2254fc52205603a8d
|
[
"Apache-2.0"
] | 1 |
2020-10-14T04:44:19.000Z
|
2020-10-14T04:44:19.000Z
| 34.944056 | 129 | 0.644787 | 1,001,196 |
package org.apereo.cas.gauth.credential;
import org.apereo.cas.CipherExecutor;
import org.apereo.cas.authentication.OneTimeTokenAccount;
import com.warrenstrange.googleauth.IGoogleAuthenticator;
import lombok.Getter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.springframework.data.redis.core.RedisTemplate;
import javax.persistence.NoResultException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.stream.Collectors;
/**
* This is {@link RedisGoogleAuthenticatorTokenCredentialRepository}.
*
* @author Misagh Moayyed
* @since 6.1.0
*/
@Slf4j
@ToString
@Getter
public class RedisGoogleAuthenticatorTokenCredentialRepository extends BaseGoogleAuthenticatorTokenCredentialRepository {
private static final String KEY_SEPARATOR = ":";
private static final String CAS_PREFIX = RedisGoogleAuthenticatorTokenCredentialRepository.class.getSimpleName();
private final RedisTemplate template;
public RedisGoogleAuthenticatorTokenCredentialRepository(final IGoogleAuthenticator googleAuthenticator,
final RedisTemplate template,
final CipherExecutor<String, String> tokenCredentialCipher) {
super(tokenCredentialCipher, googleAuthenticator);
this.template = template;
}
@Override
public OneTimeTokenAccount get(final String username) {
try {
val redisKey = getGoogleAuthenticatorRedisKey(username);
val ops = this.template.boundValueOps(redisKey);
val r = (OneTimeTokenAccount) ops.get();
if (r != null) {
return decode(r);
}
} catch (final NoResultException e) {
LOGGER.debug("No record could be found for google authenticator id [{}]", username);
}
return null;
}
@Override
public Collection<? extends OneTimeTokenAccount> load() {
try {
return getGoogleAuthenticatorTokenKeys()
.stream()
.map(redisKey -> this.template.boundValueOps(redisKey).get())
.filter(Objects::nonNull)
.map(r -> (OneTimeTokenAccount) r)
.map(this::decode)
.collect(Collectors.toList());
} catch (final Exception e) {
LOGGER.error("No record could be found for google authenticator", e);
}
return new ArrayList<>();
}
@Override
public void save(final String userName, final String secretKey, final int validationCode, final List<Integer> scratchCodes) {
val account = new GoogleAuthenticatorAccount(userName, secretKey, validationCode, scratchCodes);
update(account);
}
@Override
public OneTimeTokenAccount update(final OneTimeTokenAccount account) {
val encodedAccount = encode(account);
val redisKey = getGoogleAuthenticatorRedisKey(account.getUsername());
LOGGER.trace("Saving [{}] using key [{}]", encodedAccount, redisKey);
val ops = this.template.boundValueOps(redisKey);
ops.set(encodedAccount);
return encodedAccount;
}
@Override
public void deleteAll() {
try {
val redisKey = getGoogleAuthenticatorTokenKeys();
LOGGER.trace("Deleting tokens using key [{}]", redisKey);
this.template.delete(redisKey);
LOGGER.trace("Deleted tokens");
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
}
}
@Override
public void delete(final String username) {
try {
val redisKey = getGoogleAuthenticatorTokenKeys(username);
LOGGER.trace("Deleting tokens using key [{}]", redisKey);
this.template.delete(redisKey);
LOGGER.trace("Deleted tokens");
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
}
}
@Override
public long count() {
try {
val keys = getGoogleAuthenticatorTokenKeys();
return keys.size();
} catch (final Exception e) {
LOGGER.warn(e.getMessage(), e);
}
return 0;
}
private static String getGoogleAuthenticatorRedisKey(final String username) {
return CAS_PREFIX + KEY_SEPARATOR + username;
}
private Set<String> getGoogleAuthenticatorTokenKeys(final String username) {
val key = CAS_PREFIX + KEY_SEPARATOR + username;
LOGGER.trace("Fetching Google Authenticator records based on key [{}]", key);
return this.template.keys(key);
}
private Set<String> getGoogleAuthenticatorTokenKeys() {
val key = CAS_PREFIX + KEY_SEPARATOR + '*';
LOGGER.trace("Fetching Google Authenticator records based on key [{}]", key);
return this.template.keys(key);
}
}
|
923f85926fe3960db13886bd944d8d037b7383c7
| 26,192 |
java
|
Java
|
src/main/java/glitchwitch/decoratives/BlockRegistry.java
|
Glitch-Witch/FurnitureMod-Fabric
|
1a8a84886338536275798fee0ac647cd3af1211e
|
[
"CC0-1.0"
] | 2 |
2021-07-25T02:11:42.000Z
|
2021-08-19T04:26:19.000Z
|
src/main/java/glitchwitch/decoratives/BlockRegistry.java
|
Glitch-Witch/FurnitureMod-Fabric
|
1a8a84886338536275798fee0ac647cd3af1211e
|
[
"CC0-1.0"
] | null | null | null |
src/main/java/glitchwitch/decoratives/BlockRegistry.java
|
Glitch-Witch/FurnitureMod-Fabric
|
1a8a84886338536275798fee0ac647cd3af1211e
|
[
"CC0-1.0"
] | null | null | null | 80.097859 | 118 | 0.867135 | 1,001,197 |
package glitchwitch.decoratives;
import glitchwitch.decoratives.blocks.*;
import net.fabricmc.fabric.api.item.v1.FabricItemSettings;
import net.minecraft.block.Block;
import net.minecraft.item.BlockItem;
import net.minecraft.util.Identifier;
import net.minecraft.util.registry.Registry;
public class BlockRegistry {
public static final Cupboard BIRCH_CUPBOARD = new Cupboard();
public static final Cupboard OAK_CUPBOARD = new Cupboard();
public static final Shutters OAK_SHUTTERS = new Shutters();
public static final Shutters SPRUCE_SHUTTERS = new Shutters();
public static final Shutters BIRCH_SHUTTERS = new Shutters();
public static final Shutters JUNGLE_SHUTTERS = new Shutters();
public static final Shutters ACACIA_SHUTTERS = new Shutters();
public static final Shutters DARK_OAK_SHUTTERS = new Shutters();
public static final Shutters CRIMSON_SHUTTERS = new Shutters();
public static final Shutters WARPED_SHUTTERS = new Shutters();
public static final ShinglesRoof SHINGLES_OAK_PLANKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_SPRUCE_PLANKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_BIRCH_PLANKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_ACACIA_PLANKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_JUNGLE_PLANKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_DARK_OAK_PLANKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_WARPED_PLANKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_CRIMSON_PLANKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_STONE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_COBBLESTONE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_STONE_BRICKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_ANDESITE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_POLISHED_ANDESITE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_DIORITE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_POLISHED_DIORITE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_GRANITE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_POLISHED_GRANITE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_DEEPSLATE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_COBBLED_DEEPSLATE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_POLISHED_DEEPSLATE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_DEEPSLATE_BRICKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_DEEPSLATE_TILES_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_SANDSTONE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_SMOOTH_SANDSTONE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_RED_SANDSTONE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_SMOOTH_RED_SANDSTONE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_SMOOTH_QUARTZ_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_QUARTZ_BRICKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_BRICKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_NETHER_BRICKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_END_STONE_BRICKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_BLACKSTONE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_POLISHED_BLACKSTONE_BRICKS_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_WHITE_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_ORANGE_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_MAGENTA_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_LIGHT_BLUE_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_YELLOW_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_LIME_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_PINK_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_GRAY_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_LIGHT_GRAY_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_CYAN_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_PURPLE_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_BLUE_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_BROWN_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_GREEN_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_RED_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_BLACK_TERRACOTTA_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_WHITE_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_ORANGE_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_MAGENTA_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_LIGHT_BLUE_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_YELLOW_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_LIME_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_PINK_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_GRAY_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_LIGHT_GRAY_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_CYAN_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_PURPLE_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_BLUE_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_BROWN_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_GREEN_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_RED_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoof SHINGLES_BLACK_CONCRETE_ROOF = new ShinglesRoof();
public static final ShinglesRoofCap SHINGLES_OAK_PLANKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_SPRUCE_PLANKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_BIRCH_PLANKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_ACACIA_PLANKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_JUNGLE_PLANKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_DARK_OAK_PLANKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_WARPED_PLANKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_CRIMSON_PLANKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_STONE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_COBBLESTONE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_STONE_BRICKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_ANDESITE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_POLISHED_ANDESITE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_DIORITE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_POLISHED_DIORITE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_GRANITE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_POLISHED_GRANITE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_DEEPSLATE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_COBBLED_DEEPSLATE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_POLISHED_DEEPSLATE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_DEEPSLATE_BRICKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_DEEPSLATE_TILES_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_SANDSTONE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_SMOOTH_SANDSTONE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_RED_SANDSTONE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_SMOOTH_RED_SANDSTONE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_SMOOTH_QUARTZ_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_QUARTZ_BRICKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_BRICKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_NETHER_BRICKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_END_STONE_BRICKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_BLACKSTONE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_POLISHED_BLACKSTONE_BRICKS_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_WHITE_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_ORANGE_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_MAGENTA_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_LIGHT_BLUE_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_YELLOW_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_LIME_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_PINK_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_GRAY_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_LIGHT_GRAY_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_CYAN_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_PURPLE_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_BLUE_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_BROWN_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_GREEN_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_RED_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_BLACK_TERRACOTTA_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_WHITE_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_ORANGE_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_MAGENTA_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_LIGHT_BLUE_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_YELLOW_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_LIME_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_PINK_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_GRAY_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_LIGHT_GRAY_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_CYAN_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_PURPLE_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_BLUE_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_BROWN_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_GREEN_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_RED_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static final ShinglesRoofCap SHINGLES_BLACK_CONCRETE_ROOF_CAP = new ShinglesRoofCap();
public static void registerBlocks() {
registerWithBlockItem("birch_cupboard", BIRCH_CUPBOARD);
registerWithBlockItem("oak_cupboard", OAK_CUPBOARD);
registerWithBlockItem("shingles_acacia_planks_roof", SHINGLES_ACACIA_PLANKS_ROOF);
registerWithBlockItem("shingles_birch_planks_roof", SHINGLES_BIRCH_PLANKS_ROOF);
registerWithBlockItem("shingles_crimson_planks_roof", SHINGLES_CRIMSON_PLANKS_ROOF);
registerWithBlockItem("shingles_dark_oak_planks_roof", SHINGLES_DARK_OAK_PLANKS_ROOF);
registerWithBlockItem("shingles_jungle_planks_roof", SHINGLES_JUNGLE_PLANKS_ROOF);
registerWithBlockItem("shingles_oak_planks_roof", SHINGLES_OAK_PLANKS_ROOF);
registerWithBlockItem("shingles_spruce_planks_roof", SHINGLES_SPRUCE_PLANKS_ROOF);
registerWithBlockItem("shingles_warped_planks_roof", SHINGLES_WARPED_PLANKS_ROOF);
registerWithBlockItem("shingles_oak_planks_roof_cap", SHINGLES_OAK_PLANKS_ROOF_CAP);
registerWithBlockItem("shingles_spruce_planks_roof_cap", SHINGLES_SPRUCE_PLANKS_ROOF_CAP);
registerWithBlockItem("shingles_birch_planks_roof_cap", SHINGLES_BIRCH_PLANKS_ROOF_CAP);
registerWithBlockItem("shingles_acacia_planks_roof_cap", SHINGLES_ACACIA_PLANKS_ROOF_CAP);
registerWithBlockItem("shingles_jungle_planks_roof_cap", SHINGLES_JUNGLE_PLANKS_ROOF_CAP);
registerWithBlockItem("shingles_dark_oak_planks_roof_cap", SHINGLES_DARK_OAK_PLANKS_ROOF_CAP);
registerWithBlockItem("shingles_warped_planks_roof_cap", SHINGLES_WARPED_PLANKS_ROOF_CAP);
registerWithBlockItem("shingles_crimson_planks_roof_cap", SHINGLES_CRIMSON_PLANKS_ROOF_CAP);
registerWithBlockItem("shingles_stone_roof", SHINGLES_STONE_ROOF);
registerWithBlockItem("shingles_cobblestone_roof", SHINGLES_COBBLESTONE_ROOF);
registerWithBlockItem("shingles_stone_bricks_roof", SHINGLES_STONE_BRICKS_ROOF);
registerWithBlockItem("shingles_andesite_roof", SHINGLES_ANDESITE_ROOF);
registerWithBlockItem("shingles_polished_andesite_roof", SHINGLES_POLISHED_ANDESITE_ROOF);
registerWithBlockItem("shingles_diorite_roof", SHINGLES_DIORITE_ROOF);
registerWithBlockItem("shingles_polished_diorite_roof", SHINGLES_POLISHED_DIORITE_ROOF);
registerWithBlockItem("shingles_granite_roof", SHINGLES_GRANITE_ROOF);
registerWithBlockItem("shingles_polished_granite_roof", SHINGLES_POLISHED_GRANITE_ROOF);
registerWithBlockItem("shingles_deepslate_roof", SHINGLES_DEEPSLATE_ROOF);
registerWithBlockItem("shingles_cobbled_deepslate_roof", SHINGLES_COBBLED_DEEPSLATE_ROOF);
registerWithBlockItem("shingles_polished_deepslate_roof", SHINGLES_POLISHED_DEEPSLATE_ROOF);
registerWithBlockItem("shingles_deepslate_bricks_roof", SHINGLES_DEEPSLATE_BRICKS_ROOF);
registerWithBlockItem("shingles_deepslate_tiles_roof", SHINGLES_DEEPSLATE_TILES_ROOF);
registerWithBlockItem("shingles_sandstone_roof", SHINGLES_SANDSTONE_ROOF);
registerWithBlockItem("shingles_smooth_sandstone_roof", SHINGLES_SMOOTH_SANDSTONE_ROOF);
registerWithBlockItem("shingles_red_sandstone_roof", SHINGLES_RED_SANDSTONE_ROOF);
registerWithBlockItem("shingles_smooth_red_sandstone_roof", SHINGLES_SMOOTH_RED_SANDSTONE_ROOF);
registerWithBlockItem("shingles_smooth_quartz_roof", SHINGLES_SMOOTH_QUARTZ_ROOF);
registerWithBlockItem("shingles_quartz_bricks_roof", SHINGLES_QUARTZ_BRICKS_ROOF);
registerWithBlockItem("shingles_bricks_roof", SHINGLES_BRICKS_ROOF);
registerWithBlockItem("shingles_nether_bricks_roof", SHINGLES_NETHER_BRICKS_ROOF);
registerWithBlockItem("shingles_end_stone_bricks_roof", SHINGLES_END_STONE_BRICKS_ROOF);
registerWithBlockItem("shingles_blackstone_roof", SHINGLES_BLACKSTONE_ROOF);
registerWithBlockItem("shingles_polished_blackstone_bricks_roof", SHINGLES_POLISHED_BLACKSTONE_BRICKS_ROOF);
registerWithBlockItem("shingles_terracotta_roof", SHINGLES_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_white_terracotta_roof", SHINGLES_WHITE_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_orange_terracotta_roof", SHINGLES_ORANGE_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_magenta_terracotta_roof", SHINGLES_MAGENTA_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_light_blue_terracotta_roof", SHINGLES_LIGHT_BLUE_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_yellow_terracotta_roof", SHINGLES_YELLOW_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_lime_terracotta_roof", SHINGLES_LIME_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_pink_terracotta_roof", SHINGLES_PINK_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_gray_terracotta_roof", SHINGLES_GRAY_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_light_gray_terracotta_roof", SHINGLES_LIGHT_GRAY_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_cyan_terracotta_roof", SHINGLES_CYAN_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_purple_terracotta_roof", SHINGLES_PURPLE_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_blue_terracotta_roof", SHINGLES_BLUE_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_brown_terracotta_roof", SHINGLES_BROWN_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_green_terracotta_roof", SHINGLES_GREEN_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_red_terracotta_roof", SHINGLES_RED_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_black_terracotta_roof", SHINGLES_BLACK_TERRACOTTA_ROOF);
registerWithBlockItem("shingles_white_concrete_roof", SHINGLES_WHITE_CONCRETE_ROOF);
registerWithBlockItem("shingles_orange_concrete_roof", SHINGLES_ORANGE_CONCRETE_ROOF);
registerWithBlockItem("shingles_magenta_concrete_roof", SHINGLES_MAGENTA_CONCRETE_ROOF);
registerWithBlockItem("shingles_light_blue_concrete_roof", SHINGLES_LIGHT_BLUE_CONCRETE_ROOF);
registerWithBlockItem("shingles_yellow_concrete_roof", SHINGLES_YELLOW_CONCRETE_ROOF);
registerWithBlockItem("shingles_lime_concrete_roof", SHINGLES_LIME_CONCRETE_ROOF);
registerWithBlockItem("shingles_pink_concrete_roof", SHINGLES_PINK_CONCRETE_ROOF);
registerWithBlockItem("shingles_gray_concrete_roof", SHINGLES_GRAY_CONCRETE_ROOF);
registerWithBlockItem("shingles_light_gray_concrete_roof", SHINGLES_LIGHT_GRAY_CONCRETE_ROOF);
registerWithBlockItem("shingles_cyan_concrete_roof", SHINGLES_CYAN_CONCRETE_ROOF);
registerWithBlockItem("shingles_purple_concrete_roof", SHINGLES_PURPLE_CONCRETE_ROOF);
registerWithBlockItem("shingles_blue_concrete_roof", SHINGLES_BLUE_CONCRETE_ROOF);
registerWithBlockItem("shingles_brown_concrete_roof", SHINGLES_BROWN_CONCRETE_ROOF);
registerWithBlockItem("shingles_green_concrete_roof", SHINGLES_GREEN_CONCRETE_ROOF);
registerWithBlockItem("shingles_red_concrete_roof", SHINGLES_RED_CONCRETE_ROOF);
registerWithBlockItem("shingles_black_concrete_roof", SHINGLES_BLACK_CONCRETE_ROOF);
registerWithBlockItem("shingles_stone_roof_cap", SHINGLES_STONE_ROOF_CAP);
registerWithBlockItem("shingles_cobblestone_roof_cap", SHINGLES_COBBLESTONE_ROOF_CAP);
registerWithBlockItem("shingles_stone_bricks_roof_cap", SHINGLES_STONE_BRICKS_ROOF_CAP);
registerWithBlockItem("shingles_andesite_roof_cap", SHINGLES_ANDESITE_ROOF_CAP);
registerWithBlockItem("shingles_polished_andesite_roof_cap", SHINGLES_POLISHED_ANDESITE_ROOF_CAP);
registerWithBlockItem("shingles_diorite_roof_cap", SHINGLES_DIORITE_ROOF_CAP);
registerWithBlockItem("shingles_polished_diorite_roof_cap", SHINGLES_POLISHED_DIORITE_ROOF_CAP);
registerWithBlockItem("shingles_granite_roof_cap", SHINGLES_GRANITE_ROOF_CAP);
registerWithBlockItem("shingles_polished_granite_roof_cap", SHINGLES_POLISHED_GRANITE_ROOF_CAP);
registerWithBlockItem("shingles_deepslate_roof_cap", SHINGLES_DEEPSLATE_ROOF_CAP);
registerWithBlockItem("shingles_cobbled_deepslate_roof_cap", SHINGLES_COBBLED_DEEPSLATE_ROOF_CAP);
registerWithBlockItem("shingles_polished_deepslate_roof_cap", SHINGLES_POLISHED_DEEPSLATE_ROOF_CAP);
registerWithBlockItem("shingles_deepslate_bricks_roof_cap", SHINGLES_DEEPSLATE_BRICKS_ROOF_CAP);
registerWithBlockItem("shingles_deepslate_tiles_roof_cap", SHINGLES_DEEPSLATE_TILES_ROOF_CAP);
registerWithBlockItem("shingles_sandstone_roof_cap", SHINGLES_SANDSTONE_ROOF_CAP);
registerWithBlockItem("shingles_smooth_sandstone_roof_cap", SHINGLES_SMOOTH_SANDSTONE_ROOF_CAP);
registerWithBlockItem("shingles_red_sandstone_roof_cap", SHINGLES_RED_SANDSTONE_ROOF_CAP);
registerWithBlockItem("shingles_smooth_red_sandstone_roof_cap", SHINGLES_SMOOTH_RED_SANDSTONE_ROOF_CAP);
registerWithBlockItem("shingles_smooth_quartz_roof_cap", SHINGLES_SMOOTH_QUARTZ_ROOF_CAP);
registerWithBlockItem("shingles_quartz_bricks_roof_cap", SHINGLES_QUARTZ_BRICKS_ROOF_CAP);
registerWithBlockItem("shingles_bricks_roof_cap", SHINGLES_BRICKS_ROOF_CAP);
registerWithBlockItem("shingles_nether_bricks_roof_cap", SHINGLES_NETHER_BRICKS_ROOF_CAP);
registerWithBlockItem("shingles_end_stone_bricks_roof_cap", SHINGLES_END_STONE_BRICKS_ROOF_CAP);
registerWithBlockItem("shingles_blackstone_roof_cap", SHINGLES_BLACKSTONE_ROOF_CAP);
registerWithBlockItem("shingles_polished_blackstone_bricks_roof_cap", SHINGLES_POLISHED_BLACKSTONE_BRICKS_ROOF_CAP);
registerWithBlockItem("shingles_terracotta_roof_cap", SHINGLES_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_white_terracotta_roof_cap", SHINGLES_WHITE_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_orange_terracotta_roof_cap", SHINGLES_ORANGE_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_magenta_terracotta_roof_cap", SHINGLES_MAGENTA_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_light_blue_terracotta_roof_cap", SHINGLES_LIGHT_BLUE_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_yellow_terracotta_roof_cap", SHINGLES_YELLOW_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_lime_terracotta_roof_cap", SHINGLES_LIME_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_pink_terracotta_roof_cap", SHINGLES_PINK_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_gray_terracotta_roof_cap", SHINGLES_GRAY_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_light_gray_terracotta_roof_cap", SHINGLES_LIGHT_GRAY_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_cyan_terracotta_roof_cap", SHINGLES_CYAN_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_purple_terracotta_roof_cap", SHINGLES_PURPLE_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_blue_terracotta_roof_cap", SHINGLES_BLUE_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_brown_terracotta_roof_cap", SHINGLES_BROWN_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_green_terracotta_roof_cap", SHINGLES_GREEN_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_red_terracotta_roof_cap", SHINGLES_RED_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_black_terracotta_roof_cap", SHINGLES_BLACK_TERRACOTTA_ROOF_CAP);
registerWithBlockItem("shingles_white_concrete_roof_cap", SHINGLES_WHITE_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_orange_concrete_roof_cap", SHINGLES_ORANGE_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_magenta_concrete_roof_cap", SHINGLES_MAGENTA_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_light_blue_concrete_roof_cap", SHINGLES_LIGHT_BLUE_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_yellow_concrete_roof_cap", SHINGLES_YELLOW_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_lime_concrete_roof_cap", SHINGLES_LIME_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_pink_concrete_roof_cap", SHINGLES_PINK_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_gray_concrete_roof_cap", SHINGLES_GRAY_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_light_gray_concrete_roof_cap", SHINGLES_LIGHT_GRAY_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_cyan_concrete_roof_cap", SHINGLES_CYAN_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_purple_concrete_roof_cap", SHINGLES_PURPLE_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_blue_concrete_roof_cap", SHINGLES_BLUE_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_brown_concrete_roof_cap", SHINGLES_BROWN_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_green_concrete_roof_cap", SHINGLES_GREEN_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_red_concrete_roof_cap", SHINGLES_RED_CONCRETE_ROOF_CAP);
registerWithBlockItem("shingles_black_concrete_roof_cap", SHINGLES_BLACK_CONCRETE_ROOF_CAP);
registerWithBlockItem("oak_shutters", OAK_SHUTTERS);
registerWithBlockItem("spruce_shutters", SPRUCE_SHUTTERS);
registerWithBlockItem("birch_shutters", BIRCH_SHUTTERS);
registerWithBlockItem("jungle_shutters", JUNGLE_SHUTTERS);
registerWithBlockItem("acacia_shutters", ACACIA_SHUTTERS);
registerWithBlockItem("dark_oak_shutters", DARK_OAK_SHUTTERS);
registerWithBlockItem("crimson_shutters", CRIMSON_SHUTTERS);
registerWithBlockItem("warped_shutters", WARPED_SHUTTERS);
}
@SuppressWarnings("unused")
private static void register(String name, Block block) {
Identifier blockID = new Identifier(Decoratives.MODID, name);
Registry.register(Registry.BLOCK, blockID, block);
}
private static void registerWithBlockItem(String name, Block block) {
FabricItemSettings genericItemSettings = new FabricItemSettings().group(Decoratives.IG);
Identifier blockID = new Identifier(Decoratives.MODID, name);
BlockItem item = new BlockItem(block, genericItemSettings);
Registry.register(Registry.BLOCK, blockID, block);
Registry.register(Registry.ITEM, blockID, item);
}
}
|
923f85c2a337cb3d05d6fc6fc5f9f8385da893d3
| 1,919 |
java
|
Java
|
codes/lista-04/q02/src/calculator/Calculator.java
|
VictorM-Coder/POO-Java
|
420cb2701249b70d1d42785f79a7821899c55f18
|
[
"MIT"
] | null | null | null |
codes/lista-04/q02/src/calculator/Calculator.java
|
VictorM-Coder/POO-Java
|
420cb2701249b70d1d42785f79a7821899c55f18
|
[
"MIT"
] | null | null | null |
codes/lista-04/q02/src/calculator/Calculator.java
|
VictorM-Coder/POO-Java
|
420cb2701249b70d1d42785f79a7821899c55f18
|
[
"MIT"
] | null | null | null | 27.028169 | 103 | 0.565399 | 1,001,198 |
package calculator;
import java.text.DecimalFormat;
public class Calculator {
private int batteryMax;
private int battery;
private float display;
public Calculator(int batteryMax){ //Inicia os atributos, battery e display começam com o zero.
this.batteryMax = batteryMax;
this.display = 0;
this.battery = 0;
}
public String toString(){//Retorna o conteúdo do display com duas casas decimais.
DecimalFormat decimalFormat = new DecimalFormat("0.00");
return "display = " + decimalFormat.format(this.display) + ", battery = " + this.battery;
}
public void chargeBattery(int value){//Aumenta a bateria, porém não além do máximo.
if ((value + this.battery) < this.batteryMax){
this.battery += value;
}else{
this.battery = this.batteryMax;
}
}
public boolean useBattery(){//Tenta gastar uma unidade da bateria e emite um erro se não conseguir.
if (this.battery > 0){
this.battery--;
return true;
}else{
System.out.println("fail: bateria insuficiente");
return false;
}
}
public void sum(int a, int b){//Se conseguir gastar bateria, armazene a soma no atributo display.
if (this.useBattery()){
this.display = a + b;
}
}
public void division(int a, int b){//Se conseguir gastar bateria e não for divisão por 0.
if (this.useBattery()){
if (b == 0){
System.out.println("fail: divisao por zero");
}else{
this.display = (float) a/b;
}
}
}
public void subtract(int a, int b){
if (this.useBattery()){
this.display = a - b;
}
}
public void multiply(int a, int b){
if (this.useBattery()){
this.display = a * b;
}
}
}
|
923f85d41d95401ba2820a5e011b6926f5b0fe51
| 2,821 |
java
|
Java
|
app/src/main/java/com/laboratory600/peng/http/MonitorActivity.java
|
SmallBookworm/bugfree-wight
|
f72cc1ba48482ef8f943cc55af1c0f06a4cf5fbf
|
[
"MIT"
] | 1 |
2017-11-11T05:09:44.000Z
|
2017-11-11T05:09:44.000Z
|
app/src/main/java/com/laboratory600/peng/http/MonitorActivity.java
|
SmallBookworm/bugfree-wight
|
f72cc1ba48482ef8f943cc55af1c0f06a4cf5fbf
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/laboratory600/peng/http/MonitorActivity.java
|
SmallBookworm/bugfree-wight
|
f72cc1ba48482ef8f943cc55af1c0f06a4cf5fbf
|
[
"MIT"
] | null | null | null | 31 | 109 | 0.593052 | 1,001,199 |
package com.laboratory600.peng.http;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.lang.ref.WeakReference;
import java.net.HttpURLConnection;
import java.net.URL;
/**
*
* Created by Peng on 2015/5/14.
*/
public class MonitorActivity extends Activity {
String url = "http://172.31.138.70:8080/myServlet/servlet/MyServlet?secret=12580";
TextView monitorTextView;
MonitorMyHandler myHandler;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_monitor);
monitorTextView = (TextView) findViewById(R.id.monitor_textView_dutyshow);
Button monitorButton = (Button) findViewById(R.id.monitor_button);
myHandler = new MonitorMyHandler(MonitorActivity.this);
monitorButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new Thread(new HttpConnect()).start();
}
});
}
static class MonitorMyHandler extends Handler {
WeakReference<MonitorActivity> mActivity;
MonitorMyHandler(MonitorActivity activity) {
mActivity = new WeakReference<>(activity);
}
@Override
public void handleMessage(Message msg) {
MonitorActivity theActivity = mActivity.get();
switch (msg.what) {
case 0:
String text = (String) msg.obj;
theActivity.monitorTextView.setText(text);
break;
}
}
}
class HttpConnect implements Runnable {
@Override
public void run() {
try {
URL urll = new URL(url);
HttpURLConnection urlConnection = (HttpURLConnection) urll.openConnection();
InputStreamReader in = new InputStreamReader(urlConnection.getInputStream(), "UTF-8");//读取字节
BufferedReader bufferedReader = new BufferedReader(in);
StringBuilder buffer = new StringBuilder();//缓冲
String line;
while ((line = bufferedReader.readLine()) != null) {
buffer.append(line);
}
myHandler.obtainMessage(0, buffer.toString()).sendToTarget();
in.close();
urlConnection.disconnect();
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
|
923f86df10789f8e15ee591deaeca53f087d97b4
| 1,881 |
java
|
Java
|
asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java
|
srinivas491/AsterixDB
|
116b2fdac5de9cf113e3bf63ecd1fb4f59dbae90
|
[
"Apache-2.0"
] | null | null | null |
asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java
|
srinivas491/AsterixDB
|
116b2fdac5de9cf113e3bf63ecd1fb4f59dbae90
|
[
"Apache-2.0"
] | null | null | null |
asterixdb/asterix-lang-sqlpp/src/main/java/org/apache/asterix/lang/sqlpp/visitor/SqlppSubstituteVariablesVisitor.java
|
srinivas491/AsterixDB
|
116b2fdac5de9cf113e3bf63ecd1fb4f59dbae90
|
[
"Apache-2.0"
] | null | null | null | 38.387755 | 100 | 0.762892 | 1,001,200 |
/*
* 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.asterix.lang.sqlpp.visitor;
import org.apache.asterix.common.exceptions.AsterixException;
import org.apache.asterix.lang.common.base.Expression;
import org.apache.asterix.lang.common.expression.VariableExpr;
import org.apache.asterix.lang.common.rewrites.LangRewritingContext;
import org.apache.asterix.lang.common.rewrites.VariableSubstitutionEnvironment;
import org.apache.asterix.lang.sqlpp.util.SqlppRewriteUtil;
public class SqlppSubstituteVariablesVisitor extends SqlppCloneAndSubstituteVariablesVisitor {
public SqlppSubstituteVariablesVisitor() {
super(null);
}
@Override
protected Expression rewriteVariableExpr(VariableExpr expr, VariableSubstitutionEnvironment env)
throws AsterixException {
if (env.constainsOldVar(expr)) {
return (Expression) SqlppRewriteUtil.deepCopy(env.findSubstitution(expr));
}
return expr;
}
@Override
public VariableExpr generateNewVariable(LangRewritingContext context, VariableExpr varExpr) {
return varExpr;
}
}
|
923f8730245fc8d897640b6208827026ae5a6e8c
| 232 |
java
|
Java
|
client/src/main/java/listener/Listener.java
|
Shahedrazavi/AP-Project-Phase3
|
09ee94b2b79558778ec43846c2d3698c8de36a5c
|
[
"MIT"
] | null | null | null |
client/src/main/java/listener/Listener.java
|
Shahedrazavi/AP-Project-Phase3
|
09ee94b2b79558778ec43846c2d3698c8de36a5c
|
[
"MIT"
] | null | null | null |
client/src/main/java/listener/Listener.java
|
Shahedrazavi/AP-Project-Phase3
|
09ee94b2b79558778ec43846c2d3698c8de36a5c
|
[
"MIT"
] | null | null | null | 19.333333 | 52 | 0.75431 | 1,001,201 |
package listener;
import ui.GraphicalAgent;
public abstract class Listener {
protected GraphicalAgent graphicalAgent;
public Listener(GraphicalAgent graphicalAgent) {
this.graphicalAgent = graphicalAgent;
}
}
|
923f8774717ab7d1eb2e426e3039153e41b6bf75
| 1,896 |
java
|
Java
|
blockchain/java/src/main/java/com/antgroup/antchain/openapi/blockchain/models/CreateDigitalassetartArtCreateResponse.java
|
alipay/antchain-openapi-prod-sdk
|
f78549e5135d91756093bd88d191ca260b28e083
|
[
"MIT"
] | 6 |
2020-06-28T06:40:50.000Z
|
2022-02-25T11:02:18.000Z
|
blockchain/java/src/main/java/com/antgroup/antchain/openapi/blockchain/models/CreateDigitalassetartArtCreateResponse.java
|
alipay/antchain-openapi-prod-sdk
|
f78549e5135d91756093bd88d191ca260b28e083
|
[
"MIT"
] | null | null | null |
blockchain/java/src/main/java/com/antgroup/antchain/openapi/blockchain/models/CreateDigitalassetartArtCreateResponse.java
|
alipay/antchain-openapi-prod-sdk
|
f78549e5135d91756093bd88d191ca260b28e083
|
[
"MIT"
] | 6 |
2020-06-30T09:29:03.000Z
|
2022-01-07T10:42:22.000Z
| 25.972603 | 111 | 0.68038 | 1,001,202 |
// This file is auto-generated, don't edit it. Thanks.
package com.antgroup.antchain.openapi.blockchain.models;
import com.aliyun.tea.*;
public class CreateDigitalassetartArtCreateResponse extends TeaModel {
// 请求唯一ID,用于链路跟踪和问题排查
@NameInMap("req_msg_id")
public String reqMsgId;
// 结果码,一般OK表示调用成功
@NameInMap("result_code")
public String resultCode;
// 异常信息的文本描述
@NameInMap("result_msg")
public String resultMsg;
// 艺术品唯一id
@NameInMap("art_id")
public String artId;
// 艺术品状态信息
@NameInMap("status")
public Long status;
public static CreateDigitalassetartArtCreateResponse build(java.util.Map<String, ?> map) throws Exception {
CreateDigitalassetartArtCreateResponse self = new CreateDigitalassetartArtCreateResponse();
return TeaModel.build(map, self);
}
public CreateDigitalassetartArtCreateResponse setReqMsgId(String reqMsgId) {
this.reqMsgId = reqMsgId;
return this;
}
public String getReqMsgId() {
return this.reqMsgId;
}
public CreateDigitalassetartArtCreateResponse setResultCode(String resultCode) {
this.resultCode = resultCode;
return this;
}
public String getResultCode() {
return this.resultCode;
}
public CreateDigitalassetartArtCreateResponse setResultMsg(String resultMsg) {
this.resultMsg = resultMsg;
return this;
}
public String getResultMsg() {
return this.resultMsg;
}
public CreateDigitalassetartArtCreateResponse setArtId(String artId) {
this.artId = artId;
return this;
}
public String getArtId() {
return this.artId;
}
public CreateDigitalassetartArtCreateResponse setStatus(Long status) {
this.status = status;
return this;
}
public Long getStatus() {
return this.status;
}
}
|
923f88bb6534e86d005d792a081e297db45ee8e2
| 2,617 |
java
|
Java
|
caas-web/src/main/java/im/conversations/compliance/pojo/HistoricalSnapshot.java
|
Flowdalic/caas
|
a3f8a5299a9bcda8d859dc20ba33b7782507b329
|
[
"BSD-3-Clause"
] | 97 |
2018-05-26T17:20:36.000Z
|
2022-01-14T22:28:27.000Z
|
caas-web/src/main/java/im/conversations/compliance/pojo/HistoricalSnapshot.java
|
Flowdalic/caas
|
a3f8a5299a9bcda8d859dc20ba33b7782507b329
|
[
"BSD-3-Clause"
] | 80 |
2018-07-18T03:10:03.000Z
|
2022-02-07T12:14:11.000Z
|
caas-web/src/main/java/im/conversations/compliance/pojo/HistoricalSnapshot.java
|
Flowdalic/caas
|
a3f8a5299a9bcda8d859dc20ba33b7782507b329
|
[
"BSD-3-Clause"
] | 34 |
2018-05-27T12:07:30.000Z
|
2022-01-29T11:29:01.000Z
| 25.407767 | 102 | 0.486435 | 1,001,203 |
package im.conversations.compliance.pojo;
import java.util.ArrayList;
import java.util.List;
public class HistoricalSnapshot {
private int iteration;
private String timestamp;
private int passed;
private int total;
private Change change;
public HistoricalSnapshot(int iteration, String timestamp, int passed, int total, Change change) {
this.iteration = iteration;
this.timestamp = timestamp;
this.passed = passed;
this.total = total;
this.change = change;
}
public int getIteration() {
return iteration;
}
public String getTimestamp() {
return timestamp;
}
public int getPassed() {
return passed;
}
public int getTotal() {
return total;
}
public Change getChange() {
return change;
}
@Override
public boolean equals(Object o) {
if (o instanceof HistoricalSnapshot) {
HistoricalSnapshot hs = (HistoricalSnapshot) o;
boolean value = hs.iteration == iteration &&
hs.timestamp.equals(timestamp) &&
hs.change.equals(change) &&
hs.total == total &&
hs.passed == passed;
return value;
}
return false;
}
public static class Change {
private List<String> pass;
private List<String> fail;
public Change() {
this.pass = new ArrayList<>();
this.fail = new ArrayList<>();
}
public Change(List<String> pass, List<String> fail) {
this.pass = pass;
this.fail = fail;
}
public List<String> getPass() {
return pass;
}
public List<String> getFail() {
return fail;
}
@Override
public boolean equals(Object o) {
if (o instanceof Change) {
Change change = (Change) o;
if (change.pass.size() != this.pass.size()) {
return false;
}
if (change.fail.size() != this.fail.size()) {
return false;
}
for (String p : change.pass) {
if (!pass.contains(p)) {
return false;
}
}
for (String f : change.fail) {
if (!fail.contains(f)) {
return false;
}
}
return true;
}
return false;
}
}
}
|
923f88d57eed012b34fca78466409308226b02dc
| 11,036 |
java
|
Java
|
centromere-core/src/main/java/com/blueprint/centromere/core/repository/QueryParameterUtil.java
|
mikephelan/centromere
|
08927a561db9b25b7a1a5b28f96f373585c2052d
|
[
"Apache-2.0"
] | null | null | null |
centromere-core/src/main/java/com/blueprint/centromere/core/repository/QueryParameterUtil.java
|
mikephelan/centromere
|
08927a561db9b25b7a1a5b28f96f373585c2052d
|
[
"Apache-2.0"
] | null | null | null |
centromere-core/src/main/java/com/blueprint/centromere/core/repository/QueryParameterUtil.java
|
mikephelan/centromere
|
08927a561db9b25b7a1a5b28f96f373585c2052d
|
[
"Apache-2.0"
] | null | null | null | 37.537415 | 115 | 0.687387 | 1,001,204 |
/*
* Copyright 2018 the original author or authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.blueprint.centromere.core.repository;
import com.blueprint.centromere.core.exceptions.QueryParameterException;
import com.blueprint.centromere.core.model.Ignored;
import com.blueprint.centromere.core.model.Model;
import java.lang.reflect.Field;
import java.lang.reflect.ParameterizedType;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.convert.ConversionFailedException;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.support.DefaultConversionService;
/**
* @author woemler
*/
public class QueryParameterUtil {
private static final Logger logger = LoggerFactory.getLogger(QueryParameterUtil.class);
/**
* Inspects a {@link Model} class and returns all of the available and acceptable query parameter
* definitions, as a map of parameter names and {@link QueryParameterDescriptor} objects.
*
* @param model model to inspect
* @return map of parameter names and their descriptors
*/
public static Map<String,QueryParameterDescriptor> getAvailableQueryParameters(
Class<? extends Model<?>> model, boolean recursive)
{
logger.debug(String.format("Determining available query parameters for model: %s", model.getName()));
Class<?> current = model;
Map<String,QueryParameterDescriptor> paramMap = new HashMap<>();
while (current.getSuperclass() != null) {
for (Field field : current.getDeclaredFields()) {
logger.debug(String.format("Inspecting field %s for model: %s", field.getName(), model.getName()));
String fieldName = field.getName();
String paramName = field.getName();
Class<?> type = field.getType();
Class<?> keyType = type;
boolean regex = false;
boolean dynamic = true;
if (Collection.class.isAssignableFrom(type)) {
ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
type = parameterizedType.getActualTypeArguments()[0].getClass();
} else if (Map.class.isAssignableFrom(type)){
ParameterizedType parameterizedType = (ParameterizedType) field.getGenericType();
keyType = (Class<?>) parameterizedType.getActualTypeArguments()[0];
type = (Class<?>) parameterizedType.getActualTypeArguments()[1];
paramName = paramName + ".\\w+";
regex = true;
}
if (field.isSynthetic()) continue;
if (field.isAnnotationPresent(Ignored.class)) continue;
QueryParameterDescriptor descriptor = new QueryParameterDescriptor(paramName, fieldName,
type, Evaluation.EQUALS, regex, dynamic);
paramMap.put(paramName, descriptor);
logger.debug(String.format("Adding default query parameter: %s = %s",
fieldName, descriptor.toString()));
}
current = current.getSuperclass();
}
logger.debug(String.format("Found %d query parameters for model: %s", paramMap.size(), model.getName()));
return paramMap;
}
/**
* Inspects a {@link Model} class and returns all of the available and acceptable query parameter
* definitions, as a map of parameter names and {@link QueryParameterDescriptor} objects.
*
* @param model model to inspect
* @return map of parameter names and their descriptors
*/
public static Map<String,QueryParameterDescriptor> getAvailableQueryParameters(Class<? extends Model<?>> model) {
return getAvailableQueryParameters(model, true);
}
/**
* Creates a {@link QueryCriteria} object based upon a request parameter and {@link Evaluation}
* value.
*
* @param param
* @param values
* @param type
* @param evaluation
* @return
*/
public static QueryCriteria getQueryCriteriaFromParameter(
String param,
Object[] values,
Class<?> type,
Evaluation evaluation
){
if (!dynamicParamEvalutationMatchesType(evaluation, type)){
throw new QueryParameterException(String.format("Evaluation %s cannot be applied to field type %s",
evaluation.toString(), type.getName()));
}
if (evaluation.equals(Evaluation.EQUALS) && values.length > 1) evaluation = Evaluation.IN;
switch (evaluation){
case EQUALS:
return new QueryCriteria(param, convertParameter(values[0], type), Evaluation.EQUALS);
case NOT_EQUALS:
return new QueryCriteria(param, convertParameter(values[0], type), Evaluation.NOT_EQUALS);
case IN:
return new QueryCriteria(param, convertParameterArray(values, type), Evaluation.IN);
case NOT_IN:
return new QueryCriteria(param, convertParameterArray(values, type), Evaluation.NOT_IN);
case LIKE :
return new QueryCriteria(param, values[0], Evaluation.LIKE);
case NOT_LIKE:
return new QueryCriteria(param, values[0], Evaluation.NOT_LIKE);
case IS_NULL:
return new QueryCriteria(param, true, Evaluation.IS_NULL);
case NOT_NULL:
return new QueryCriteria(param, true, Evaluation.NOT_NULL);
case IS_TRUE:
return new QueryCriteria(param, true, Evaluation.IS_TRUE);
case IS_FALSE:
return new QueryCriteria(param, true, Evaluation.IS_FALSE);
case GREATER_THAN:
return new QueryCriteria(param, convertParameter(values[0], type), Evaluation.GREATER_THAN);
case GREATER_THAN_EQUALS:
return new QueryCriteria(param, convertParameter(values[0], type), Evaluation.GREATER_THAN_EQUALS);
case LESS_THAN:
return new QueryCriteria(param, convertParameter(values[0], type), Evaluation.LESS_THAN);
case LESS_THAN_EQUALS:
return new QueryCriteria(param, convertParameter(values[0], type), Evaluation.LESS_THAN_EQUALS);
case BETWEEN:
return new QueryCriteria(param, Arrays.asList(convertParameter(values[0], type),
convertParameter(values[1], type)), Evaluation.BETWEEN);
case OUTSIDE:
return new QueryCriteria(param, Arrays.asList(convertParameter(values[0], type),
convertParameter(values[1], type)), Evaluation.OUTSIDE);
case BETWEEN_INCLUSIVE:
return new QueryCriteria(param, Arrays.asList(convertParameter(values[0], type),
convertParameter(values[1], type)), Evaluation.BETWEEN_INCLUSIVE);
case OUTSIDE_INCLUSIVE:
return new QueryCriteria(param, Arrays.asList(convertParameter(values[0], type),
convertParameter(values[1], type)), Evaluation.OUTSIDE_INCLUSIVE);
case STARTS_WITH:
return new QueryCriteria(param, convertParameter(values[0], type), Evaluation.STARTS_WITH);
case ENDS_WITH:
return new QueryCriteria(param, convertParameter(values[0], type), Evaluation.ENDS_WITH);
default:
return null;
}
}
/**
* Tests to see whether the selected {@link Evaluation} can be applied to the target attribute
* type.
*
* @param evaluation query evaluation
* @param type parameter type
* @return true if evaluation can be applied to type
*/
public static boolean dynamicParamEvalutationMatchesType(Evaluation evaluation, Class<?> type){
if (String.class.isAssignableFrom(type) || char.class.isAssignableFrom(type)){
return Arrays.asList(
Evaluation.EQUALS,
Evaluation.NOT_EQUALS,
Evaluation.IN,
Evaluation.NOT_IN,
Evaluation.LIKE,
Evaluation.NOT_LIKE,
Evaluation.STARTS_WITH,
Evaluation.ENDS_WITH,
Evaluation.IS_NULL,
Evaluation.NOT_NULL
).contains(evaluation);
} else if (Number.class.isAssignableFrom(type) || int.class.isAssignableFrom(type)
|| long.class.isAssignableFrom(type) || double.class.isAssignableFrom(type)
|| float.class.isAssignableFrom(type)){
return Arrays.asList(
Evaluation.EQUALS,
Evaluation.NOT_EQUALS,
Evaluation.IN,
Evaluation.NOT_IN,
Evaluation.GREATER_THAN,
Evaluation.GREATER_THAN_EQUALS,
Evaluation.LESS_THAN,
Evaluation.LESS_THAN_EQUALS,
Evaluation.OUTSIDE,
Evaluation.OUTSIDE_INCLUSIVE,
Evaluation.BETWEEN,
Evaluation.BETWEEN_INCLUSIVE,
Evaluation.IS_NULL,
Evaluation.NOT_NULL
).contains(evaluation);
} else if (Boolean.class.isAssignableFrom(type) || boolean.class.isAssignableFrom(type)){
return Arrays.asList(
Evaluation.EQUALS,
Evaluation.NOT_EQUALS,
Evaluation.IN,
Evaluation.NOT_IN,
Evaluation.IS_TRUE,
Evaluation.IS_FALSE
).contains(evaluation);
} else {
return Arrays.asList(
Evaluation.EQUALS,
Evaluation.NOT_EQUALS,
Evaluation.IN,
Evaluation.NOT_IN,
Evaluation.IS_NULL,
Evaluation.NOT_NULL
).contains(evaluation);
}
}
/**
* Converts an object into the appropriate type defined by the model field being queried.
*
* @param param
* @param type
* @return
*/
private static Object convertParameter(Object param, Class<?> type, ConversionService conversionService){
if (conversionService.canConvert(param.getClass(), type)){
try {
return conversionService.convert(param, type);
} catch (ConversionFailedException e){
e.printStackTrace();
throw new QueryParameterException("Unable to convert parameter string to " + type.getName());
}
} else {
return param;
}
}
/**
* {@link QueryParameterUtil#convertParameter(Object, Class, ConversionService)}
*/
private static Object convertParameter(Object param, Class<?> type){
ConversionService conversionService = new DefaultConversionService();
return convertParameter(param, type, conversionService);
}
/**
* Converts an array of objects into the appropriate type defined by the model field being queried
*
* @param params
* @param type
* @return
*/
private static List<Object> convertParameterArray(Object[] params, Class<?> type){
List<Object> objects = new ArrayList<>();
for (Object param: params){
objects.add(convertParameter(param, type));
}
return objects;
}
}
|
923f8a3f85276eca40485c4583f5fba9e697308a
| 2,051 |
java
|
Java
|
linkbinder-core/src/test/java/jp/co/opentone/bsol/linkbinder/dto/UpdateModeTest.java
|
otsecbsol/linkbinder
|
1e59055771d3c4c45c8e2ff4cda05386bc7b19fc
|
[
"Apache-2.0"
] | 6 |
2016-06-28T13:49:45.000Z
|
2021-07-03T02:53:59.000Z
|
linkbinder-core/src/test/java/jp/co/opentone/bsol/linkbinder/dto/UpdateModeTest.java
|
otsecbsol/linkbinder
|
1e59055771d3c4c45c8e2ff4cda05386bc7b19fc
|
[
"Apache-2.0"
] | null | null | null |
linkbinder-core/src/test/java/jp/co/opentone/bsol/linkbinder/dto/UpdateModeTest.java
|
otsecbsol/linkbinder
|
1e59055771d3c4c45c8e2ff4cda05386bc7b19fc
|
[
"Apache-2.0"
] | 1 |
2020-01-19T07:26:03.000Z
|
2020-01-19T07:26:03.000Z
| 27.346667 | 127 | 0.636763 | 1,001,205 |
/*
* Copyright 2016 OPEN TONE 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 jp.co.opentone.bsol.linkbinder.dto;
import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.junit.Test;
import jp.co.opentone.bsol.linkbinder.dto.UpdateMode.ModeHolder;
/**
* {@link UpdateMode}のテストケース.
* @author opentone
*/
public class UpdateModeTest {
/**
* {@link UpdateMode#setUpdateMode(List, UpdateMode)}の検証.
*/
@Test
public void testSetUpdateMode() {
UpdateMode[] modes = UpdateMode.values();
int length = modes.length;
List<Value> values = new ArrayList<Value>();
for (int i = 0; i < 10; i++) {
values.add(new Value(modes[i % length]));
}
UpdateMode.setUpdateMode(values, UpdateMode.NEW);
for (Value v : values) {
assertEquals(UpdateMode.NEW, v.getMode());
}
}
static class Value implements ModeHolder {
private UpdateMode mode;
Value(UpdateMode mode) {
this.mode = mode;
}
/* (non-Javadoc)
* @see jp.co.opentone.bsol.linkbinder.dto.UpdateMode.ModeHolder#getMode()
*/
public UpdateMode getMode() {
return mode;
}
/* (non-Javadoc)
* @see jp.co.opentone.bsol.linkbinder.dto.UpdateMode.ModeHolder#setMode(jp.co.opentone.bsol.linkbinder.dto.UpdateMode)
*/
public void setMode(UpdateMode mode) {
this.mode = mode;
}
}
}
|
923f8b37303793ce2ddc32f5d2932fddb53c4294
| 915 |
java
|
Java
|
cms-admin/src/main/java/com/oneops/cms/admin/service/ActivitiManager.java
|
smittap/oneops
|
c0e143bca76fae55ffa79d43d935d67db326c2a5
|
[
"Apache-2.0"
] | 160 |
2017-06-05T22:08:31.000Z
|
2022-03-27T02:10:54.000Z
|
cms-admin/src/main/java/com/oneops/cms/admin/service/ActivitiManager.java
|
smittap/oneops
|
c0e143bca76fae55ffa79d43d935d67db326c2a5
|
[
"Apache-2.0"
] | 142 |
2017-06-06T17:59:38.000Z
|
2021-09-08T14:09:22.000Z
|
cms-admin/src/main/java/com/oneops/cms/admin/service/ActivitiManager.java
|
smittap/oneops
|
c0e143bca76fae55ffa79d43d935d67db326c2a5
|
[
"Apache-2.0"
] | 190 |
2017-06-05T21:49:14.000Z
|
2022-03-23T09:52:11.000Z
| 35.192308 | 81 | 0.583607 | 1,001,206 |
/*******************************************************************************
*
* Copyright 2015 Walmart, 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.oneops.cms.admin.service;
import java.util.List;
public interface ActivitiManager {
List getProcesses();
}
|
923f8b6de9581d57965801c641fc3a4107b1cdda
| 6,910 |
java
|
Java
|
extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibConfig.java
|
RuanNunes/quarkus
|
6bf55dcbb386b45586eb7d65ec98b6c3133697a5
|
[
"Apache-2.0"
] | 2 |
2021-02-17T02:52:58.000Z
|
2021-07-27T10:45:53.000Z
|
extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibConfig.java
|
RuanNunes/quarkus
|
6bf55dcbb386b45586eb7d65ec98b6c3133697a5
|
[
"Apache-2.0"
] | 184 |
2020-03-09T10:03:02.000Z
|
2022-03-21T22:50:37.000Z
|
extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibConfig.java
|
RuanNunes/quarkus
|
6bf55dcbb386b45586eb7d65ec98b6c3133697a5
|
[
"Apache-2.0"
] | 2 |
2019-09-27T09:54:49.000Z
|
2020-01-18T17:23:57.000Z
| 39.039548 | 158 | 0.685094 | 1,001,207 |
package io.quarkus.container.image.jib.deployment;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
@ConfigRoot(phase = ConfigPhase.BUILD_TIME)
public class JibConfig {
/**
* The base image to be used when a container image is being produced for the jar build.
*
* When the application is built against Java 17 or higher, {@code registry.access.redhat.com/ubi8/openjdk-17-runtime:1.10}
* is used as the default.
* Otherwise {@code registry.access.redhat.com/ubi8/openjdk-11-runtime:1.10} is used as the default.
*/
@ConfigItem
public Optional<String> baseJvmImage;
/**
* The base image to be used when a container image is being produced for the native binary build
*/
@ConfigItem(defaultValue = "quay.io/quarkus/quarkus-micro-image:1.0")
public String baseNativeImage;
/**
* Additional JVM arguments to pass to the JVM when starting the application
*/
@ConfigItem(defaultValue = "-Djava.util.logging.manager=org.jboss.logmanager.LogManager")
public List<String> jvmArguments;
/**
* Additional arguments to pass when starting the native application
*/
@ConfigItem
public Optional<List<String>> nativeArguments;
/**
* If this is set, then it will be used as the entry point of the container image.
* There are a few things to be aware of when creating an entry point
* <ul>
* <li>A valid entrypoint is jar package specific (see {@code quarkus.package.type})</li>
* <li>A valid entrypoint depends on the location of both the launching scripts and the application jar file. To that
* end it's helpful to remember that when {@code fast-jar} packaging is used (the default), all necessary application
* jars are added to the {@code /work} directory and that the same
* directory is also used as the working directory. When {@code legacy-jar} or {@code uber-jar} are used, the application
* jars
* are unpacked under the {@code /app} directory
* and that directory is used as the working directory.</li>
* <li>Even if the {@code jvmArguments} field is set, it is ignored completely</li>
* </ul>
*
* When this is not set, a proper default entrypoint will be constructed.
*
* As a final note, a very useful tool for inspecting container image layers that can greatly aid
* when debugging problems with endpoints is <a href="https://github.com/wagoodman/dive">dive</a>
*/
@ConfigItem
public Optional<List<String>> jvmEntrypoint;
/**
* If this is set, then it will be used as the entry point of the container image.
* There are a few things to be aware of when creating an entry point
* <ul>
* <li>A valid entrypoint depends on the location of both the launching scripts and the native binary file. To that end
* it's helpful to remember that the native application is added to the {@code /work} directory and that and the same
* directory is also used as the working directory</li>
* <li>Even if the {@code nativeArguments} field is set, it is ignored completely</li>
* </ul>
*
* When this is not set, a proper default entrypoint will be constructed.
*
* As a final note, a very useful tool for inspecting container image layers that can greatly aid
* when debugging problems with endpoints is <a href="https://github.com/wagoodman/dive">dive</a>
*/
@ConfigItem
public Optional<List<String>> nativeEntrypoint;
/**
* Environment variables to add to the container image
*/
@ConfigItem
public Map<String, String> environmentVariables;
/**
* Custom labels to add to the generated image
*
* @deprecated Use 'quarkus.container-image.labels' instead
*/
@ConfigItem
@Deprecated
public Map<String, String> labels;
/**
* The username to use to authenticate with the registry used to pull the base JVM image
*/
@ConfigItem
public Optional<String> baseRegistryUsername;
/**
* The password to use to authenticate with the registry used to pull the base JVM image
*/
@ConfigItem
public Optional<String> baseRegistryPassword;
/**
* The ports to expose
*/
@ConfigItem(defaultValue = "${quarkus.http.port:8080}")
public List<Integer> ports;
/**
* The user to use in generated image
*/
@ConfigItem
public Optional<String> user;
/**
* Controls the optimization which skips downloading base image layers that exist in a target
* registry. If the user does not set this property, then read as false.
*
* If {@code true}, base image layers are always pulled and cached. If
* {@code false}, base image layers will not be pulled/cached if they already exist on the
* target registry.
*/
@ConfigItem(defaultValue = "false")
public boolean alwaysCacheBaseImage;
/**
* List of target platforms. Each platform is defined using the pattern: \<os\>|\<arch\>[/variant]|\<os\>/\<arch\>[/variant]
* ex: linux/amd64,linux/arm64/v8. If not specified, OS default is linux and architecture default is amd64
*
* If more than one platform is configured, it is important to note that the base image has to be a Docker manifest or an
* OCI image index containing a version of each chosen platform
*
* It doesn't work with native images, as cross-compilation is not supported
*
* Target Platform is a incubating feature of Jib. See <a href=
* "https://github.com/GoogleContainerTools/jib/blob/master/docs/faq.md#how-do-i-specify-a-platform-in-the-manifest-list-or-oci-index-of-a-base-image">Jib
* FAQ</a> for more information
*/
@ConfigItem
public Optional<Set<String>> platforms;
/**
* The path of a file that will be written containing the digest of the generated image.
* If the path is relative, is writen to the output directory of the build tool
*/
@ConfigItem(defaultValue = "jib-image.digest")
public String imageDigestFile;
/**
* The path of a file that will be written containing the id of the generated image.
* If the path is relative, is writen to the output directory of the build tool
*/
@ConfigItem(defaultValue = "jib-image.id")
public String imageIdFile;
/**
* Whether or not to operate offline.
*/
@ConfigItem(defaultValue = "false")
public boolean offlineMode;
/**
* Name of binary used to execute the docker commands. This is only used by Jib
* when the container image is being built locally.
*/
@ConfigItem
public Optional<String> dockerExecutableName;
}
|
923f8b87a02fe9dcd32b255a90ec7a0347e0c9ba
| 1,297 |
java
|
Java
|
java_backup/my java/bishwarup/firstandnminusoneswap_array.java
|
SayanGhoshBDA/code-backup
|
8b6135facc0e598e9686b2e8eb2d69dd68198b80
|
[
"MIT"
] | 16 |
2018-11-26T08:39:42.000Z
|
2019-05-08T10:09:52.000Z
|
java_backup/my java/bishwarup/firstandnminusoneswap_array.java
|
SayanGhoshBDA/code-backup
|
8b6135facc0e598e9686b2e8eb2d69dd68198b80
|
[
"MIT"
] | 8 |
2020-05-04T06:29:26.000Z
|
2022-02-12T05:33:16.000Z
|
java_backup/my java/bishwarup/firstandnminusoneswap_array.java
|
SayanGhoshBDA/code-backup
|
8b6135facc0e598e9686b2e8eb2d69dd68198b80
|
[
"MIT"
] | 5 |
2020-02-11T16:02:21.000Z
|
2021-02-05T07:48:30.000Z
| 25.94 | 72 | 0.681573 | 1,001,208 |
import java.io.*;
class firstandnminusone
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int a[]=new int [100];
int n,i,s1,s2;
System.out.println("Give the term");
n=Integer.parseInt(br.readLine());
//input for array
for(i=0;i<n;i++)
{
System.out.println("Give the number");
a[i]=Integer.parseInt(br.readLine());
}
System.out.println("1 st element of array:"+a[0]);
System.out.println("Last element:"+a[n-1]);
}
}
import java.io.*;
class swaping
{
public static void main(String args[])throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int a,b,c;
System.out.println("give values");
a=Integer.parseInt(br.readLine());
b=Integer.parseInt(br.readLine());
System.out.println("Before swaping,a is "+a+" and b is "+b);
c=a;
a=b;
b=c;
System.out.println("After swaping,");
System.out.println("a is "+a);
System.out.println("b is "+b);
System.out.println("give values");
a=Integer.parseInt(br.readLine());
b=Integer.parseInt(br.readLine());
System.out.println("Before swaping,a is "+a+" and b is "+b);
a=a+b;
b=a-b;
a=a-b;
System.out.println("After swaping,");
System.out.println("a is "+a);
System.out.println("b is "+b);
}
}
|
923f8bdc30fa96e3850d54c073583cfd6152be27
| 2,212 |
java
|
Java
|
java-usecase-commons/src/test/java/com/usecase/lang/annotation/AnnotationInfoTest.java
|
java-usecase/java-usecase
|
9b078fb2b4f0c7e615ad6879b70b1a18eede7f5a
|
[
"Apache-2.0"
] | null | null | null |
java-usecase-commons/src/test/java/com/usecase/lang/annotation/AnnotationInfoTest.java
|
java-usecase/java-usecase
|
9b078fb2b4f0c7e615ad6879b70b1a18eede7f5a
|
[
"Apache-2.0"
] | 2 |
2021-08-13T16:17:40.000Z
|
2021-11-26T07:29:26.000Z
|
java-usecase-commons/src/test/java/com/usecase/lang/annotation/AnnotationInfoTest.java
|
java-cases/java-usecase
|
9b078fb2b4f0c7e615ad6879b70b1a18eede7f5a
|
[
"Apache-2.0"
] | 1 |
2020-05-29T08:08:52.000Z
|
2020-05-29T08:08:52.000Z
| 32.529412 | 96 | 0.670886 | 1,001,209 |
package com.usecase.lang.annotation;
import org.junit.Assert;
import org.junit.Test;
import java.util.Map;
import java.util.Optional;
import static org.junit.Assert.assertEquals;
public class AnnotationInfoTest {
@Test
public void getTableAnnotation() {
Optional<Entity> optional = AnnotationInfo.getTableAnnotation();
Assert.assertTrue(optional.isPresent());
Entity table = optional.get();
System.out.println(table);
Assert.assertNotNull(table);
Assert.assertEquals("t_entity", table.name());
Assert.assertEquals("id", table.key());
}
@Test
public void getTableAnnotationWithClazz() {
Optional<Entity> optional = AnnotationInfo.getTableAnnotation(DBEntity.class);
Assert.assertTrue(optional.isPresent());
optional = AnnotationInfo.getTableAnnotation(AnnotationInfo.class);
Assert.assertFalse(optional.isPresent());
}
@Test
public void getColumnAnnotations() {
Map<String, Column> map = AnnotationInfo.getColumnAnnotations(DBEntityExt.class);
System.out.println(map);
Assert.assertNotNull(map);
Assert.assertEquals("name", map.get("name").name());
Assert.assertEquals("age", map.get("age").name());
Assert.assertEquals("birthday", map.get("birthday").name());
}
@Test
public void getColumnAnnotationsOfSuper() {
Map<String, Column> map = AnnotationInfo.getColumnAnnotationsOfSuper(DBEntityExt.class);
System.out.println(map);
Assert.assertNotNull(map);
Assert.assertEquals("id", map.get("id").name());
Assert.assertEquals(false, map.get("id").autoIncrement());
Assert.assertEquals(false, map.get("id").nullable());
assertEquals(ColumnType.VARCHAR, map.get("id").type());
}
@Test
public void getColumnAnnotationsWithClazz() {
Map<String, Column> map = AnnotationInfo.getColumnAnnotations(DBEntity.class);
Assert.assertNotNull(map);
Assert.assertTrue(map.size() > 0);
map = AnnotationInfo.getColumnAnnotations(AnnotationInfo.class);
Assert.assertNotNull(map);
Assert.assertTrue(map.size() == 0);
}
}
|
923f8c0d3eeb7e3229b7fc44ee33ac7fa54df146
| 4,443 |
java
|
Java
|
src/test/java/de/javagl/obj/TestObjWriter.java
|
javagl/Obj
|
59b0c3266fcef8c07f0d33bb7821d4472632e9a2
|
[
"MIT"
] | 140 |
2017-06-03T16:18:47.000Z
|
2022-03-29T12:38:39.000Z
|
src/test/java/de/javagl/obj/TestObjWriter.java
|
GoMeta/Obj
|
f56d1cba6ada458aed18ba1ef68293e6fd34b2b0
|
[
"MIT"
] | 19 |
2017-11-06T05:47:05.000Z
|
2022-03-20T02:06:35.000Z
|
src/test/java/de/javagl/obj/TestObjWriter.java
|
javagl/Obj
|
59b0c3266fcef8c07f0d33bb7821d4472632e9a2
|
[
"MIT"
] | 31 |
2015-10-19T18:39:03.000Z
|
2022-03-02T00:57:34.000Z
| 31.964029 | 66 | 0.6158 | 1,001,210 |
package de.javagl.obj;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Scanner;
import static org.junit.Assert.*;
import org.junit.Test;
@SuppressWarnings("javadoc")
public class TestObjWriter
{
@Test
public void readWriteSquare()
throws IOException
{
String inputString = readResourceAsString(
"/square.obj");
Obj obj = ObjReader.read(
new ByteArrayInputStream(inputString.getBytes()));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjWriter.write(obj, baos);
String outputString = new String(baos.toByteArray());
//System.out.println(outputString);
assertEquals(inputString, outputString);
}
@Test
public void readWriteSquareAndTriangle()
throws IOException
{
String inputString = readResourceAsString(
"/squareAndTriangle.obj");
Obj obj = ObjReader.read(
new ByteArrayInputStream(inputString.getBytes()));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjWriter.write(obj, baos);
String outputString = new String(baos.toByteArray());
//System.out.println(outputString);
assertEquals(inputString, outputString);
}
@Test
public void readWriteSquareAndTriangleInTwoGroups()
throws IOException
{
String inputString = readResourceAsString(
"/squareAndTriangleInTwoGroups.obj");
Obj obj = ObjReader.read(
new ByteArrayInputStream(inputString.getBytes()));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjWriter.write(obj, baos);
String outputString = new String(baos.toByteArray());
//System.out.println(outputString);
assertEquals(inputString, outputString);
}
@Test
public void readWriteFourTrianglesInMixedGroups()
throws IOException
{
String inputString = readResourceAsString(
"/fourTrianglesInMixedGroups.obj");
Obj obj = ObjReader.read(
new ByteArrayInputStream(inputString.getBytes()));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjWriter.write(obj, baos);
String outputString = new String(baos.toByteArray());
//System.out.println(outputString);
assertEquals(inputString, outputString);
}
@Test
public void readWriteTwoTrianglesOneInDefaultGroup()
throws IOException
{
String inputString = readResourceAsString(
"/twoTrianglesOneInDefaultGroup.obj");
Obj obj = ObjReader.read(
new ByteArrayInputStream(inputString.getBytes()));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjWriter.write(obj, baos);
String outputString = new String(baos.toByteArray());
//System.out.println(outputString);
assertEquals(inputString, outputString);
}
@Test
public void readTwoTrianglesSharedInThreeGroups()
throws IOException
{
String inputString = readResourceAsString(
"/twoTrianglesSharedInThreeGroups.obj");
Obj obj = ObjReader.read(
new ByteArrayInputStream(inputString.getBytes()));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjWriter.write(obj, baos);
String outputString = new String(baos.toByteArray());
//System.out.println(outputString);
assertEquals(inputString, outputString);
}
private static String readResourceAsString(String name)
{
InputStream inputStream =
TestObjWriter.class.getResourceAsStream(name);
String string = readAsString(inputStream);
string = string.replaceAll("\r\n", "\n");
return string;
}
private static String readAsString(InputStream inputStream)
{
try (Scanner scanner = new Scanner(inputStream))
{
scanner.useDelimiter("\\A");
String string = scanner.next();
return string;
}
}
}
|
923f8cd9c364c766e432530adbcf29538602e3db
| 804 |
java
|
Java
|
src/main/java/mapreduce/WordCountReducer.java
|
WonderBo/HadoopLearningDemo
|
3c2e4315b79f2eda9a7c5865ad2e18a74df5c6cb
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/mapreduce/WordCountReducer.java
|
WonderBo/HadoopLearningDemo
|
3c2e4315b79f2eda9a7c5865ad2e18a74df5c6cb
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/mapreduce/WordCountReducer.java
|
WonderBo/HadoopLearningDemo
|
3c2e4315b79f2eda9a7c5865ad2e18a74df5c6cb
|
[
"Apache-2.0"
] | null | null | null | 33.5 | 126 | 0.723881 | 1,001,211 |
package mapreduce;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
import java.io.IOException;
public class WordCountReducer extends Reducer<Text, LongWritable, Text, LongWritable> {
// 框架在map处理完成之后,将所有key-value对缓存起来,进行分组,然后传递一个组<key,values{}>并调用一次reduce方法
// values封装为Iterable类型,保存对应key的所有value结果
@Override
protected void reduce(Text key, Iterable<LongWritable> values, Context context) throws IOException, InterruptedException {
// 业务逻辑:1.遍历value的List进行累加求和; 2.输出对应key的统计结果
long counter = 0L;
for(LongWritable value : values) {
counter += value.get();
}
// 将reduce的输出结果写入到context,其后可以保存到相应文件路径下
context.write(key, new LongWritable(counter));
}
}
|
923f8d2717c3b52c017601da81f606f60d198b08
| 2,927 |
java
|
Java
|
ymer/src/main/java/com/avanza/ymer/DocumentDb.java
|
AvanzaBank/ymer
|
886dc7565b5657f6a18485da0656587451892acb
|
[
"Apache-2.0"
] | 7 |
2016-01-29T13:54:18.000Z
|
2022-01-24T12:10:36.000Z
|
ymer/src/main/java/com/avanza/ymer/DocumentDb.java
|
AvanzaBank/ymer
|
886dc7565b5657f6a18485da0656587451892acb
|
[
"Apache-2.0"
] | 39 |
2016-01-21T08:31:34.000Z
|
2022-03-16T18:02:30.000Z
|
ymer/src/main/java/com/avanza/ymer/DocumentDb.java
|
AvanzaBank/ymer
|
886dc7565b5657f6a18485da0656587451892acb
|
[
"Apache-2.0"
] | 10 |
2016-01-25T10:25:46.000Z
|
2022-03-15T13:39:14.000Z
| 31.815217 | 228 | 0.773488 | 1,001,212 |
/*
* Copyright 2015 Avanza Bank AB
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.avanza.ymer;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import org.bson.Document;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.mongodb.ReadPreference;
import com.mongodb.WriteConcern;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;
/**
*
* @author Elias Lindholm (elilin)
*
*/
final class DocumentDb {
private final Provider provider;
private DocumentDb(Provider provider) {
this.provider = provider;
}
static DocumentDb create(Provider provider) {
return new DocumentDb(provider);
}
static DocumentDb mongoDb(MongoDatabase db, ReadPreference readPreference) {
return new DocumentDb(new MongoDocumentDb(db, readPreference));
}
DocumentCollection getCollection(String name) {
return getCollection(name, null);
}
DocumentCollection getCollection(String name, ReadPreference readPreference) {
return provider.get(name, readPreference);
}
interface Provider {
DocumentCollection get(String name, ReadPreference readPreference);
}
private static final class MongoDocumentDb implements DocumentDb.Provider {
private static final Set<WriteConcern> EXPECTED_WRITE_CONCERNS = new HashSet<>(List.of(WriteConcern.ACKNOWLEDGED));
private static final Logger LOGGER = LoggerFactory.getLogger(MongoDocumentDb.class);
private final MongoDatabase mongoDatabase;
private final ReadPreference readPreference;
MongoDocumentDb(MongoDatabase mongoDb, ReadPreference readPreference) {
this.readPreference = readPreference;
this.mongoDatabase = Objects.requireNonNull(mongoDb);
if (!EXPECTED_WRITE_CONCERNS.contains(mongoDb.getWriteConcern())) {
LOGGER.error("Expected WriteConcern={} but was {}! Ymer is not designed for use with this WriteConcern and using it in production can/will lead to irrevocable data loss!", EXPECTED_WRITE_CONCERNS, mongoDb.getWriteConcern());
}
}
@Override
public DocumentCollection get(String name, ReadPreference readPreference) {
MongoCollection<Document> collection = mongoDatabase.getCollection(name);
collection.withReadPreference(Optional.ofNullable(readPreference)
.orElse(this.readPreference));
return new MongoDocumentCollection(collection);
}
}
}
|
923f8e5891f85a391d6ef1a287fa27e3e8b9fcff
| 3,072 |
java
|
Java
|
src/main/java/com/cjburkey/freeboi/components/Camera.java
|
cjburkey01/FreeBoi
|
04527acaa805964261bcf5b3fe8dc41bf9f23fe6
|
[
"MIT"
] | null | null | null |
src/main/java/com/cjburkey/freeboi/components/Camera.java
|
cjburkey01/FreeBoi
|
04527acaa805964261bcf5b3fe8dc41bf9f23fe6
|
[
"MIT"
] | null | null | null |
src/main/java/com/cjburkey/freeboi/components/Camera.java
|
cjburkey01/FreeBoi
|
04527acaa805964261bcf5b3fe8dc41bf9f23fe6
|
[
"MIT"
] | null | null | null | 31.030303 | 142 | 0.616862 | 1,001,213 |
package com.cjburkey.freeboi.components;
import com.cjburkey.freeboi.FreeBoi;
import com.cjburkey.freeboi.ecs.ECSComponent;
import com.cjburkey.freeboi.value.Property;
import org.joml.Matrix4f;
import org.joml.Quaternionf;
import org.joml.Vector2i;
import org.joml.Vector3f;
public class Camera extends ECSComponent {
private static Camera main;
public final Property<Float> fov = new Property<>(75.0f);
public final Property<Float> near = new Property<>(0.01f);
public final Property<Float> far = new Property<>(1000.0f);
private final Vector3f prevPos = new Vector3f();
private final Quaternionf prevRot = new Quaternionf();
private final Vector3f prevScale = new Vector3f();
private float aspect = 0.0f;
private final Matrix4f projectionMatrix = new Matrix4f().identity();
private final Matrix4f viewMatrix = new Matrix4f().identity();
public Camera() {
if (main == null) {
main = this;
}
fov.addListener((o, n) -> updateProjectionMatrix(n, near.get(), far.get()));
near.addListener((o, n) -> updateProjectionMatrix(fov.get(), n, far.get()));
far.addListener((o, n) -> updateProjectionMatrix(fov.get(), near.get(), n));
FreeBoi.instance.windowSize.addListener((o, n) -> {
setAspect(n);
updateProjectionMatrix(fov.get(), near.get(), far.get());
});
setAspect(FreeBoi.instance.windowSize.get());
updateProjectionMatrix(fov.get(), near.get(), far.get());
}
public void onUpdate() {
checkForUpdate();
}
private void checkForUpdate() {
if (getEntity() == null) {
return;
}
if (!getTransform().position.equals(prevPos) || !getTransform().rotation.equals(prevRot) || !getTransform().scale.equals(prevScale)) {
updateViewMatrix();
prevPos.set(getTransform().position);
prevRot.set(getTransform().rotation);
prevScale.set(getTransform().scale);
}
}
private void setAspect(Vector2i size) {
aspect = (float) size.x / size.y;
}
public Matrix4f getProjectionMatrix() {
return new Matrix4f(projectionMatrix);
}
private void updateProjectionMatrix(float fov, float near, float far) {
update();
projectionMatrix.identity().perspective((float) Math.toRadians(fov), aspect, near, far);
}
private void updateViewMatrix() {
update();
viewMatrix.identity().rotate(getTransform().rotation).translate(getTransform().position.negate(new Vector3f()));
}
private void update() {
//cullingFilter.filterMeshes(MeshRenderer.getRenderers());
}
public Matrix4f getViewMatrix() {
return new Matrix4f(viewMatrix);
}
public void makeMain() {
main = this;
}
public boolean cameraExists() {
return main != null;
}
public static Camera getMain() {
return main;
}
}
|
923f8ea4f73c10ae397b5def2dcfb9f4abb9c33b
| 13,448 |
java
|
Java
|
src/main/java/com/bath/tcpviz/dis/controller/ExamplesController.java
|
perrymant/TCPviz
|
37004f361905ba396d6c929fa75bbc9295c3aa99
|
[
"MIT"
] | null | null | null |
src/main/java/com/bath/tcpviz/dis/controller/ExamplesController.java
|
perrymant/TCPviz
|
37004f361905ba396d6c929fa75bbc9295c3aa99
|
[
"MIT"
] | null | null | null |
src/main/java/com/bath/tcpviz/dis/controller/ExamplesController.java
|
perrymant/TCPviz
|
37004f361905ba396d6c929fa75bbc9295c3aa99
|
[
"MIT"
] | null | null | null | 39.093023 | 132 | 0.670732 | 1,001,214 |
package com.bath.tcpviz.dis.controller;
import com.bath.tcpviz.dis.algorithms.Segment;
import com.bath.tcpviz.dis.domain.Display;
import com.bath.tcpviz.dis.domain.Statistics;
import com.bath.tcpviz.dis.domain.Stream;
import com.bath.tcpviz.dis.domain.ViewLabel;
import com.bath.tcpviz.dis.fileupload.controller.ShareFileName;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.HashMap;
import java.util.List;
@Controller
public class ExamplesController {
@Autowired
private ShareFileName shareFileName;
@RequestMapping(value = "/syn1", method = RequestMethod.GET)
public String syn1(Model model) {
String fileName = "src/main/resources/example/Establish Connection.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/syn2", method = RequestMethod.GET)
public String syn2(Model model) {
String fileName = "src/main/resources/example/Establish Connection.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/syn3", method = RequestMethod.GET)
public String syn3(Model model) {
String fileName = "src/main/resources/example/Establish Connection.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/connectionTermination", method = RequestMethod.GET)
public String fin(Model model) {
String fileName = "src/main/resources/example/Terminate Connection.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/dupAck", method = RequestMethod.GET)
public String dupAck(Model model) {
String fileName = "src/main/resources/example/DupAck.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/windowUpdate", method = RequestMethod.GET)
public String windowUpdate(Model model) {
String fileName = "src/main/resources/example/Window Update.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/windowFull", method = RequestMethod.GET)
public String windowFull(Model model) {
String fileName = "src/main/resources/example/Window Full.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/zeroWindow", method = RequestMethod.GET)
public String zeroWindow(Model model) {
String fileName = "src/main/resources/example/Zero Window.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/zeroWindowProbe", method = RequestMethod.GET)
public String zeroWindowProbe(Model model) {
String fileName = "src/main/resources/example/Zero Window Probe.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/zeroWindowProbeAck", method = RequestMethod.GET)
public String zeroWindowProbeAck(Model model) {
String fileName = "src/main/resources/example/Zero Window Probe Ack.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/keepAlive", method = RequestMethod.GET)
public String keepAlive(Model model) {
String fileName = "src/main/resources/example/Keep Alive.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/keepAliveAck", method = RequestMethod.GET)
public String keepAliveAck(Model model) {
String fileName = "src/main/resources/example/Keep Alive Ack.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/spuriousRetransmission", method = RequestMethod.GET)
public String spuriousRetransmission(Model model) {
String fileName = "src/main/resources/example/Spurious Retransmission.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/fastRetransmission", method = RequestMethod.GET)
public String fastRetransmission(Model model) {
String fileName = "src/main/resources/example/Fast Retransmission.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/retransmission", method = RequestMethod.GET)
public String retransmission(Model model) {
String fileName = "src/main/resources/example/Retransmission.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/outOfOrder", method = RequestMethod.GET)
public String outOfOrder(Model model) {
String fileName = "src/main/resources/example/OutOfOrder.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/previousSegmentNotCaptured", method = RequestMethod.GET)
public String previousSegmentNotCaptured(Model model) {
String fileName = "src/main/resources/example/Previous Segment Not Captured.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/ackUnseenSegment", method = RequestMethod.GET)
public String ackUnseenSegment(Model model) {
String fileName = "src/main/resources/example/ACKed Unseen Segment.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/goodAck", method = RequestMethod.GET)
public String goodAck(Model model) {
String fileName = "src/main/resources/example/Example.pcap";
int streamId = 3;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/badAck", method = RequestMethod.GET)
public String badAck(Model model) {
String fileName = "src/main/resources/example/Example.pcap";
int streamId = 100;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/appData", method = RequestMethod.GET)
public String appData(Model model) {
String fileName = "src/main/resources/example/Example.pcap";
int streamId = 5;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/rst", method = RequestMethod.GET)
public String rst(Model model) {
String fileName = "src/main/resources/example/Home.pcap";
int streamId = 4;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/good", method = RequestMethod.GET)
public String good(Model model) {
String fileName = "src/main/resources/example/GoodBehaviour.pcap";
int streamId = 2;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/slowStart", method = RequestMethod.GET)
public String slowStart(Model model) {
String fileName = "src/main/resources/example/SlowStart.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/ackOoo", method = RequestMethod.GET)
public String ackOoo(Model model) {
String fileName = "src/main/resources/example/SlowStart.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/reusedPorts", method = RequestMethod.GET)
public String reused(Model model) {
String fileName = "src/main/resources/example/ReusedPorts.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/ManyDupacks", method = RequestMethod.GET)
public String ManyDupacks(Model model) {
String fileName = "src/main/resources/example/ManyDupacks.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/FINandRST", method = RequestMethod.GET)
public String FINandRST(Model model) {
String fileName = "src/main/resources/example/FINandRST.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/SegmentsAfterRST", method = RequestMethod.GET)
public String SegmentsAfterRST(Model model) {
String fileName = "src/main/resources/example/SegmentsAfterRST.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/FRisOOO", method = RequestMethod.GET)
public String FRisOOO(Model model) {
String fileName = "src/main/resources/example/FRisOOO.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/TLSencryptedAlert1", method = RequestMethod.GET)
public String TLSencryptedAlert1(Model model) {
String fileName = "src/main/resources/example/TLSencryptedAlert1.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/tlsError", method = RequestMethod.GET)
public String tlsError(Model model) {
String fileName = "src/main/resources/example/TLSencryptedAlert1.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/httpMessage", method = RequestMethod.GET)
public String httpMessage(Model model) {
String fileName = "src/main/resources/example/http.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/TLSencryptedAlert2", method = RequestMethod.GET)
public String TLSencryptedAlert2(Model model) {
String fileName = "src/main/resources/example/TLSencryptedAlert2.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/URGACKPSHflood", method = RequestMethod.GET)
public String URGACKPSHflood(Model model) {
String fileName = "src/main/resources/example/URG-ACK-PSHflood.pcap";
shareFileName.setFileName(fileName);
return "redirect:/readUploaded";
}
@RequestMapping(value = "/LargerExample", method = RequestMethod.GET)
public String LargerExample(Model model) {
String fileName = "src/main/resources/example/LargerExample.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
@RequestMapping(value = "/ecn", method = RequestMethod.GET)
public String ecn(Model model) {
String fileName = "src/main/resources/pcapFiles/tcp-ecn-sample.pcap";
int streamId = 1;
modelSetup(model, fileName, streamId);
return "index";
}
private void modelSetup(Model model, String fileName, int streamId) {
shareFileName.setFileName(fileName);
Display display = new Display();
Statistics statistics = new Statistics();
Stream stream = new Stream();
display.passFileName(fileName);
HashMap<Integer, List<Segment>> segmentMap = stream.analysedPcapFileToStreamMap(fileName);
HashMap<Integer, List<ViewLabel>> analysisFlagList = display.createAnalysisFlagList(segmentMap);
List<Integer> keys = display.getKeys(analysisFlagList);
List<List<Object>> dataTableSender = statistics.generateDataTableChartSender(streamId, analysisFlagList);
List<List<Object>> dataTableReceiver = statistics.generateDataTableChartReceiver(streamId, analysisFlagList);
List<ViewLabel> displayStreamIdPackets = analysisFlagList.get(streamId);
String viewFileName = displayStreamIdPackets.get(0).getFileName().substring(27);
model.addAttribute("map", analysisFlagList);
model.addAttribute("listOfKeys", keys);
model.addAttribute("numberOfStreams", segmentMap.size());
model.addAttribute("streamId", streamId);
model.addAttribute("packets", displayStreamIdPackets);
model.addAttribute("sender", displayStreamIdPackets.get(0).getSender());
model.addAttribute("receiver", displayStreamIdPackets.get(0).getReceiver());
model.addAttribute("isTCP", displayStreamIdPackets.get(0).getProtocol().equals("TCP") && displayStreamIdPackets.size() > 1);
model.addAttribute("fileName", viewFileName);
model.addAttribute("dataTableSender", dataTableSender);
model.addAttribute("dataTableReceiver", dataTableReceiver);
}
}
|
923f8fe13a1831e08c450524fa02144e5fd0a5b8
| 877 |
java
|
Java
|
textrepo-app/src/main/java/nl/knaw/huc/service/logging/LoggingApplicationEventListener.java
|
BasLee/textrepo
|
c858e9eb190ddbd51949c620fa3af6233b0d7e05
|
[
"Apache-2.0"
] | null | null | null |
textrepo-app/src/main/java/nl/knaw/huc/service/logging/LoggingApplicationEventListener.java
|
BasLee/textrepo
|
c858e9eb190ddbd51949c620fa3af6233b0d7e05
|
[
"Apache-2.0"
] | null | null | null |
textrepo-app/src/main/java/nl/knaw/huc/service/logging/LoggingApplicationEventListener.java
|
BasLee/textrepo
|
c858e9eb190ddbd51949c620fa3af6233b0d7e05
|
[
"Apache-2.0"
] | null | null | null | 32.481481 | 86 | 0.836944 | 1,001,215 |
package nl.knaw.huc.service.logging;
import java.util.UUID;
import java.util.function.Supplier;
import org.glassfish.jersey.server.monitoring.ApplicationEvent;
import org.glassfish.jersey.server.monitoring.ApplicationEventListener;
import org.glassfish.jersey.server.monitoring.RequestEvent;
import org.glassfish.jersey.server.monitoring.RequestEventListener;
public class LoggingApplicationEventListener implements ApplicationEventListener {
private final LoggingRequestEventListener loggingRequestEventListener;
public LoggingApplicationEventListener(Supplier<UUID> uuidGenerator) {
this.loggingRequestEventListener = new LoggingRequestEventListener(uuidGenerator);
}
@Override
public void onEvent(ApplicationEvent event) {
}
@Override
public RequestEventListener onRequest(RequestEvent requestEvent) {
return loggingRequestEventListener;
}
}
|
923f91bcb898917b06a25784bd09c49bee394957
| 1,025 |
java
|
Java
|
src/main/java/chylex/hee/game/save/handlers/GlobalDataHandler.java
|
chylex/Hardcore-Ender-Expansion
|
d962137c81eb5d48c05c6083e7700f2156d5b05d
|
[
"FSFAP"
] | 35 |
2015-01-12T07:11:01.000Z
|
2022-03-25T23:29:35.000Z
|
src/main/java/chylex/hee/game/save/handlers/GlobalDataHandler.java
|
chylex/Hardcore-Ender-Expansion
|
d962137c81eb5d48c05c6083e7700f2156d5b05d
|
[
"FSFAP"
] | 132 |
2015-01-08T01:30:04.000Z
|
2022-01-16T02:19:01.000Z
|
src/main/java/chylex/hee/game/save/handlers/GlobalDataHandler.java
|
chylex/Hardcore-Ender-Expansion
|
d962137c81eb5d48c05c6083e7700f2156d5b05d
|
[
"FSFAP"
] | 37 |
2015-01-07T19:46:52.000Z
|
2021-10-31T14:50:22.000Z
| 25 | 115 | 0.712195 | 1,001,216 |
package chylex.hee.game.save.handlers;
import java.io.File;
import java.util.IdentityHashMap;
import java.util.Map;
import chylex.hee.game.save.ISaveDataHandler;
import chylex.hee.game.save.SaveFile;
public final class GlobalDataHandler implements ISaveDataHandler{
private final Map<Class<? extends SaveFile>, SaveFile> cache = new IdentityHashMap<>();
private File root;
@Override
public void register(){}
@Override
public void clear(File root){
cache.clear();
this.root = root;
}
public <T extends SaveFile> T get(Class<T> cls){
SaveFile savefile = cache.get(cls);
if (savefile == null){
try{
cache.put(cls, savefile = cls.newInstance());
savefile.loadFromNBT(root);
}catch(Exception e){
throw new RuntimeException("Could not construct a new instance of SaveFile - "+cls.getName(), e);
}
}
return (T)savefile;
}
@Override
public void save(){
cache.values().stream().filter(savefile -> savefile.wasModified()).forEach(savefile -> savefile.saveToNBT(root));
}
}
|
923f91f246599928ed1abd7a15a21a44af608b09
| 6,921 |
java
|
Java
|
uitest/src/com/vaadin/tests/layouts/GridLayoutCaptions.java
|
allanim/vaadin
|
b7f9b2316bff98bc7d37c959fa6913294d9608e4
|
[
"Apache-2.0"
] | 2 |
2016-12-06T09:05:58.000Z
|
2016-12-07T08:57:55.000Z
|
uitest/src/com/vaadin/tests/layouts/GridLayoutCaptions.java
|
allanim/vaadin
|
b7f9b2316bff98bc7d37c959fa6913294d9608e4
|
[
"Apache-2.0"
] | null | null | null |
uitest/src/com/vaadin/tests/layouts/GridLayoutCaptions.java
|
allanim/vaadin
|
b7f9b2316bff98bc7d37c959fa6913294d9608e4
|
[
"Apache-2.0"
] | null | null | null | 29.961039 | 112 | 0.558879 | 1,001,217 |
package com.vaadin.tests.layouts;
import com.vaadin.data.Item;
import com.vaadin.data.Validator;
import com.vaadin.data.util.BeanItem;
import com.vaadin.server.AbstractErrorMessage;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Component;
import com.vaadin.ui.CssLayout;
import com.vaadin.ui.DefaultFieldFactory;
import com.vaadin.ui.Field;
import com.vaadin.ui.Form;
import com.vaadin.ui.FormFieldFactory;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.Label;
import com.vaadin.ui.LegacyWindow;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
public class GridLayoutCaptions extends TestBase {
class CustomForm extends Form {
private com.vaadin.ui.GridLayout layout;
private VerticalLayout wrapper = new VerticalLayout();
private CssLayout wrapper2 = new CssLayout();
private FormFieldFactory fff = new FormFieldFactory() {
@Override
public Field<?> createField(Item item, Object propertyId,
Component uiContext) {
if (propertyId.equals(DataPOJO.Fields.name.name())) {
Field<?> f = DefaultFieldFactory.get().createField(item,
propertyId, uiContext);
f.setCaption("This is a long caption for the name field");
return f;
} else if (propertyId.equals(DataPOJO.Fields.hp.name())) {
Field<?> f = DefaultFieldFactory.get().createField(item,
propertyId, uiContext);
f.setCaption("This is a long caption for the HP field, but it has a VL as a wrapper");
return f;
} else if (propertyId.equals(DataPOJO.Fields.place.name())) {
Field<?> f = DefaultFieldFactory.get().createField(item,
propertyId, uiContext);
f.setCaption("This is a long caption for the Place field, but it has a CSSLo as a wrapper");
return f;
} else if (propertyId.equals(DataPOJO.Fields.price.name())) {
Field<?> f = DefaultFieldFactory.get().createField(item,
propertyId, uiContext);
f.setCaption("With size undefined the caption behaves like this...");
f.setSizeFull();
return f;
} else {
return DefaultFieldFactory.get().createField(item,
propertyId, uiContext);
}
}
};
public CustomForm() {
super();
layout = new GridLayout(3, 3);
layout.addComponent(wrapper, 1, 0);
layout.addComponent(wrapper2, 2, 0);
layout.setSpacing(true);
setLayout(layout);
setFormFieldFactory(fff);
Label l = new Label("A label with caption");
l.setCaption("A really long caption that is clipped");
layout.addComponent(l, 0, 2);
Label l2 = new Label("A wrapped label with caption");
l2.setCaption("A really long caption that is not clipped");
VerticalLayout vl = new VerticalLayout();
vl.addComponent(l2);
layout.addComponent(vl, 1, 2);
}
public void createErrors() {
Validator.InvalidValueException ive = new Validator.InvalidValueException(
"Ipsum lipsum laarum lop... ");
for (Object propIDs : getItemDataSource().getItemPropertyIds()) {
((TextField) getField(propIDs))
.setComponentError(AbstractErrorMessage
.getErrorMessageForException(ive));
}
}
public void clearErrors() {
for (Object propIDs : getItemDataSource().getItemPropertyIds()) {
((TextField) getField(propIDs)).setComponentError(null);
}
}
@Override
protected void attachField(Object propertyId, Field field) {
if (propertyId.equals(DataPOJO.Fields.name.name())) {
layout.addComponent(field, 0, 0);
} else if (propertyId.equals(DataPOJO.Fields.hp.name())) {
wrapper.removeAllComponents();
wrapper.addComponent(field);
} else if (propertyId.equals(DataPOJO.Fields.place.name())) {
wrapper2.removeAllComponents();
wrapper2.addComponent(field);
} else if (propertyId.equals(DataPOJO.Fields.price.name())) {
layout.addComponent(field, 0, 1);
}
}
}
public static class DataPOJO {
public enum Fields {
name, price, hp, place;
}
private String name;
private int price;
private String hp;
private String place;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getPrice() {
return price;
}
public void setPrice(int price) {
this.price = price;
}
public String getHp() {
return hp;
}
public void setHp(String hp) {
this.hp = hp;
}
public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
}
@Override
protected void setup() {
LegacyWindow mainWindow = getMainWindow();
Label label = new Label("Hello Vaadin user");
mainWindow.addComponent(label);
DataPOJO forDemo = new DataPOJO();
BeanItem<DataPOJO> bi = new BeanItem<DataPOJO>(forDemo);
final CustomForm aFormWithGl = new CustomForm();
aFormWithGl.setItemDataSource(bi);
mainWindow.addComponent(aFormWithGl);
Button b = new Button("Give me an error!", new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
aFormWithGl.createErrors();
}
});
mainWindow.addComponent(b);
Button b2 = new Button("Get rid of an error!",
new Button.ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
aFormWithGl.clearErrors();
}
});
mainWindow.addComponent(b2);
}
@Override
protected String getDescription() {
return "Captions in Gridlayout behaves differently than in other layouts";
}
@Override
protected Integer getTicketNumber() {
return 5424;
}
}
|
923f924882013ff301036e401719d496574ad7d6
| 3,064 |
java
|
Java
|
app/src/main/java/com/atlas/drive/MainActivity.java
|
AtlasWork/AtlasGateway-Android
|
550e48495378a6cd472f6f1f68f9ff48b29b98e9
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/atlas/drive/MainActivity.java
|
AtlasWork/AtlasGateway-Android
|
550e48495378a6cd472f6f1f68f9ff48b29b98e9
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/atlas/drive/MainActivity.java
|
AtlasWork/AtlasGateway-Android
|
550e48495378a6cd472f6f1f68f9ff48b29b98e9
|
[
"MIT"
] | null | null | null | 29.747573 | 118 | 0.657637 | 1,001,218 |
package com.atlas.drive;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.content.Intent;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import com.atlas.drive.fragments.LoginFragment;
import com.atlas.drive.fragments.ResetPasswordDialog;
public class MainActivity extends AppCompatActivity implements ResetPasswordDialog.Listener {
public static final String TAG = MainActivity.class.getSimpleName();
private LoginFragment mLoginFragment;
private ResetPasswordDialog mResetPasswordDialog;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
if (savedInstanceState == null) {
loadFragment();
}
}
private void loadFragment(){
if (mLoginFragment == null) {
mLoginFragment = new LoginFragment();
}
getFragmentManager().beginTransaction().replace(R.id.fragmentFrame,mLoginFragment,LoginFragment.TAG).commit();
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
String data = intent.getData().getLastPathSegment();
Log.d(TAG, "onNewIntent: "+data);
mResetPasswordDialog = (ResetPasswordDialog) getFragmentManager().findFragmentByTag(ResetPasswordDialog.TAG);
if (mResetPasswordDialog != null)
mResetPasswordDialog.setToken(data);
}
@Override
public void onPasswordReset(String message) {
showSnackBarMessage(message);
}
private void showSnackBarMessage(String message) {
Snackbar.make(findViewById(R.id.activity_main),message,Snackbar.LENGTH_SHORT).show();
}
// private Button mDriver, mCustomer;
// @Override
// protected void onCreate(Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// setContentView(R.layout.activity_main);
//
// mDriver = (Button) findViewById(R.id.driver);
// mCustomer = (Button) findViewById(R.id.customer);
//
// startService(new Intent(MainActivity.this, onAppKilled.class));
// mDriver.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Intent intent = new Intent(MainActivity.this, DriverLoginActivity.class);
// startActivity(intent);
// finish();
// return;
// }
// });
//
// mCustomer.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Intent intent = new Intent(MainActivity.this, CustomerLoginActivity.class);
// startActivity(intent);
// finish();
// return;
// }
// });
// }
}
|
923f938767bbfee824d510650587d2989220f028
| 1,475 |
java
|
Java
|
BD-Labs/Exercise21/src/main/java/it/polito/bigdata/hadoop/E21Mapper.java
|
AndreaCossio/PoliTo-Projects
|
f89c8ce1e04d54e38a1309a01c7e3a9aa67d5a81
|
[
"MIT"
] | null | null | null |
BD-Labs/Exercise21/src/main/java/it/polito/bigdata/hadoop/E21Mapper.java
|
AndreaCossio/PoliTo-Projects
|
f89c8ce1e04d54e38a1309a01c7e3a9aa67d5a81
|
[
"MIT"
] | null | null | null |
BD-Labs/Exercise21/src/main/java/it/polito/bigdata/hadoop/E21Mapper.java
|
AndreaCossio/PoliTo-Projects
|
f89c8ce1e04d54e38a1309a01c7e3a9aa67d5a81
|
[
"MIT"
] | 1 |
2022-02-19T11:26:30.000Z
|
2022-02-19T11:26:30.000Z
| 28.921569 | 112 | 0.680678 | 1,001,219 |
package it.polito.bigdata.hadoop;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class E21Mapper extends Mapper<LongWritable, Text, NullWritable, Text> {
private ArrayList<String> stopwords;
@SuppressWarnings("deprecation")
protected void setup(Context context) throws IOException, InterruptedException {
String nextLine;
Path[] PathsCachedFiles;
BufferedReader fileStopWords;
stopwords = new ArrayList<String>();
PathsCachedFiles = context.getLocalCacheFiles();
fileStopWords = new BufferedReader(new FileReader(new File(PathsCachedFiles[0].toUri())));
while ((nextLine = fileStopWords.readLine()) != null) {
stopwords.add(nextLine);
}
fileStopWords.close();
}
@Override
protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
String splits[] = value.toString().split("\\s+");
String result = "";
for (String s : splits) {
if (!stopwords.contains(s)) {
result = result.concat(s + " ");
}
}
context.write(NullWritable.get(), new Text(result));
}
}
|
923f958104ea218d39d39f5c899936c4abed11ad
| 1,360 |
java
|
Java
|
src/main/java/sd/samples/akka/slacktojirabot/Slack/WhereAmILocator.java
|
SergeyDz/SlackToJiraBot
|
1805fd5a2f7d3ec5f1a4bc153cbe6d13a030b4d2
|
[
"Apache-2.0"
] | 2 |
2017-02-01T11:57:13.000Z
|
2019-11-13T09:16:59.000Z
|
src/main/java/sd/samples/akka/slacktojirabot/Slack/WhereAmILocator.java
|
SergeyDz/SlackToJiraBot
|
1805fd5a2f7d3ec5f1a4bc153cbe6d13a030b4d2
|
[
"Apache-2.0"
] | 23 |
2016-08-25T12:05:22.000Z
|
2021-07-21T03:18:18.000Z
|
src/main/java/sd/samples/akka/slacktojirabot/Slack/WhereAmILocator.java
|
SergeyDz/SlackToJiraBot
|
1805fd5a2f7d3ec5f1a4bc153cbe6d13a030b4d2
|
[
"Apache-2.0"
] | 1 |
2018-07-18T09:47:47.000Z
|
2018-07-18T09:47:47.000Z
| 23.448276 | 79 | 0.503676 | 1,001,220 |
package sd.samples.akka.slacktojirabot.Slack;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author sdzyuban
*/
public class WhereAmILocator {
private final String message;
private final String channel;
public WhereAmILocator(String message, String channel)
{
this.message = message;
this.channel = channel;
}
public String call() {
String removeReqularWords = this.message
.replace("sprint", "")
.replace("status", "")
.replace("jirabot", "")
.trim();
if(removeReqularWords.isEmpty())
{
if(channel.startsWith("team-"))
{
return channel.replace("team-", "");
}
else if(channel.endsWith("-private"))
{
return channel.replace("-private", "");
}
else if(channel.endsWith("-sdzyuban"))
{
return channel.replace("-sdzyuban", "");
}
}
else if(message.split(" ").length > 1)
{
return removeReqularWords;
}
return "";
}
}
|
923f95e37dbdbc7bd164df176153d6e0e87ea769
| 188 |
java
|
Java
|
taotao-cloud-java/taotao-cloud-javaweb/src/main/java/com/taotao/cloud/java/javaweb/p2_jdbc/jdbc/advanced/RowMapper.java
|
shuigedeng/taotao-cloud-paren
|
3d281b919490f7cbee4520211e2eee5da7387564
|
[
"Apache-2.0"
] | 47 |
2021-04-13T10:32:13.000Z
|
2022-03-31T10:30:30.000Z
|
taotao-cloud-java/taotao-cloud-javaweb/src/main/java/com/taotao/cloud/java/javaweb/p2_jdbc/jdbc/advanced/RowMapper.java
|
shuigedeng/taotao-cloud-paren
|
3d281b919490f7cbee4520211e2eee5da7387564
|
[
"Apache-2.0"
] | 1 |
2021-11-01T07:41:04.000Z
|
2021-11-01T07:41:10.000Z
|
taotao-cloud-java/taotao-cloud-javaweb/src/main/java/com/taotao/cloud/java/javaweb/p2_jdbc/jdbc/advanced/RowMapper.java
|
shuigedeng/taotao-cloud-paren
|
3d281b919490f7cbee4520211e2eee5da7387564
|
[
"Apache-2.0"
] | 21 |
2021-04-13T10:32:17.000Z
|
2022-03-26T07:43:22.000Z
| 17.090909 | 60 | 0.739362 | 1,001,221 |
package com.taotao.cloud.java.javaweb.p2_jdbc.jdbc.advanced;
import java.sql.ResultSet;
/**
* 约束封装对象的ORM
*/
public interface RowMapper<T> {
public T getRow(ResultSet resultSet);
}
|
923f965906ef66ae20fd1dfcba2d9816784bc73c
| 893 |
java
|
Java
|
devday-parent/devday-ui/src/main/java/com/vaadin/devday/mvp/ui/Views.java
|
peterl1084/devday-cdi
|
7311f02c438fe592f7e2c8b85b322fdd8582f69a
|
[
"Apache-2.0"
] | 1 |
2015-09-26T21:15:35.000Z
|
2015-09-26T21:15:35.000Z
|
devday-parent/devday-ui/src/main/java/com/vaadin/devday/mvp/ui/Views.java
|
peterl1084/devday-cdi
|
7311f02c438fe592f7e2c8b85b322fdd8582f69a
|
[
"Apache-2.0"
] | 1 |
2015-09-26T21:21:27.000Z
|
2015-09-26T21:21:27.000Z
|
devday-parent/devday-ui/src/main/java/com/vaadin/devday/mvp/ui/Views.java
|
peterl1084/devday-cdi
|
7311f02c438fe592f7e2c8b85b322fdd8582f69a
|
[
"Apache-2.0"
] | null | null | null | 21.780488 | 83 | 0.723404 | 1,001,222 |
package com.vaadin.devday.mvp.ui;
import com.vaadin.devday.mvp.ui.customer.CustomerViewBean;
import com.vaadin.devday.mvp.ui.job.JobViewBean;
import com.vaadin.navigator.View;
import com.vaadin.server.FontAwesome;
import com.vaadin.server.Resource;
public enum Views {
CUSTOMER("Customers", FontAwesome.USERS, "", CustomerViewBean.class),
JOB("Jobs", FontAwesome.ROCKET, "job", JobViewBean.class);
private final String name;
private final Resource icon;
private final String id;
private final Class<? extends View> type;
private Views(String name, Resource icon, String id, Class<? extends View> type) {
this.name = name;
this.icon = icon;
this.id = id;
this.type = type;
}
public String getName() {
return name;
}
public Resource getIcon() {
return icon;
}
public String getId() {
return id;
}
public Class<? extends View> getType() {
return type;
}
}
|
923f96b03a7d4772c972106f8959888912abd29a
| 2,397 |
java
|
Java
|
3_servlets/src/main/java/ru/bgbrakhi/servlets/servlets/UserUpdateServlet.java
|
brakhin/job4j
|
2eea240e5f14353fb3272db1e71cb5ed0576a912
|
[
"Apache-2.0"
] | null | null | null |
3_servlets/src/main/java/ru/bgbrakhi/servlets/servlets/UserUpdateServlet.java
|
brakhin/job4j
|
2eea240e5f14353fb3272db1e71cb5ed0576a912
|
[
"Apache-2.0"
] | 18 |
2019-11-14T13:36:14.000Z
|
2022-02-16T01:00:23.000Z
|
3_servlets/src/main/java/ru/bgbrakhi/servlets/servlets/UserUpdateServlet.java
|
brakhin/job4j
|
2eea240e5f14353fb3272db1e71cb5ed0576a912
|
[
"Apache-2.0"
] | null | null | null | 40.627119 | 114 | 0.549854 | 1,001,223 |
package ru.bgbrakhi.servlets.servlets;
import ru.bgbrakhi.servlets.DispatchPattern;
import ru.bgbrakhi.servlets.User;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
public class UserUpdateServlet extends HttpServlet {
private final DispatchPattern dispatcher = new DispatchPattern().init();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String action = "find";
String id = req.getParameter("id");
User user = (User) dispatcher.init().process(action, new User(Integer.parseInt(id), ""));
if (user != null) {
resp.setContentType("text/html");
PrintWriter writer = new PrintWriter(resp.getOutputStream());
writer.write("<!DOCTYPE html>\n"
+ "<html lang=\"en\">\n"
+ "<head>\n"
+ " <meta charset=\"UTF-8\">\n"
+ " <title>Title</title>\n"
+ "</head>\n"
+ "<body>\n"
+ "<form action=" + req.getContextPath() + "/edit method='post'>\n"
+ "<input type='hidden' name='action' value='update'/>\n"
+ "<input type='hidden' name='id' value='" + user.getId() + "'/>\n"
+ "ID : " + user.getId() + "<br>"
+ "Name : <input type = 'text' name='name' value='" + user.getName() + "'>"
+ "<input type = 'submit'>"
+ "</form>\n"
+ "</body>\n"
+ "</html>");
writer.flush();
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
String action = req.getParameter("action");
String id = req.getParameter("id");
String name = req.getParameter("name");
if ("update".equals(action)) {
if ((Boolean) new DispatchPattern().init().process(action, new User(Integer.parseInt(id), name))) {
resp.sendRedirect(req.getContextPath() + "/list");
}
} else {
doGet(req, resp);
}
}
}
|
923f96c5f6f19011903689ffc8c10277c751f31c
| 2,876 |
java
|
Java
|
src/jvm/storm/mesos/MesosCommon.java
|
mesosphere/storm-mesos
|
0353632a926b6b89dbeb26bd03ab93e1854cc769
|
[
"Apache-2.0"
] | 6 |
2015-01-02T08:49:48.000Z
|
2016-03-24T14:01:02.000Z
|
src/jvm/storm/mesos/MesosCommon.java
|
mesosphere/storm-mesos
|
0353632a926b6b89dbeb26bd03ab93e1854cc769
|
[
"Apache-2.0"
] | null | null | null |
src/jvm/storm/mesos/MesosCommon.java
|
mesosphere/storm-mesos
|
0353632a926b6b89dbeb26bd03ab93e1854cc769
|
[
"Apache-2.0"
] | null | null | null | 35.506173 | 114 | 0.666551 | 1,001,224 |
package storm.mesos;
import backtype.storm.scheduler.TopologyDetails;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
public class MesosCommon {
public static final Logger LOG = Logger.getLogger(MesosCommon.class);
public static final String CPU_CONF = "topology.mesos.worker.cpu";
public static final String MEM_CONF = "topology.mesos.worker.mem.mb";
public static final String SUICIDE_CONF = "mesos.supervisor.suicide.inactive.timeout.secs";
public static final double DEFAULT_CPU = 1;
public static final double DEFAULT_MEM_MB = 1000;
public static final int DEFAULT_SUICIDE_TIMEOUT_SECS = 120;
public static final String SUPERVISOR_ID = "supervisorid";
public static final String ASSIGNMENT_ID = "assignmentid";
public static String taskId(String nodeid, int port) {
return nodeid + "-" + port;
}
public static int portFromTaskId(String taskId) {
int last = taskId.lastIndexOf("-");
String port = taskId.substring(last+1);
return Integer.parseInt(port);
}
public static int getSuicideTimeout(Map conf) {
Number timeout = (Number) conf.get(SUICIDE_CONF);
if(timeout==null) return DEFAULT_SUICIDE_TIMEOUT_SECS;
else return timeout.intValue();
}
public static Map getFullTopologyConfig(Map conf, TopologyDetails info) {
Map ret = new HashMap(conf);
ret.putAll(info.getConf());
return ret;
}
public static double topologyCpu(Map conf, TopologyDetails info) {
conf = getFullTopologyConfig(conf, info);
Object cpuObj = conf.get(CPU_CONF);
if(cpuObj!=null && !(cpuObj instanceof Number)) {
LOG.warn("Topology has invalid mesos cpu configuration: " + cpuObj + " for topology " + info.getId());
cpuObj = null;
}
if(cpuObj==null) return DEFAULT_CPU;
else return ((Number)cpuObj).doubleValue();
}
public static double topologyMem(Map conf, TopologyDetails info) {
conf = getFullTopologyConfig(conf, info);
Object memObj = conf.get(MEM_CONF);
if(memObj!=null && !(memObj instanceof Number)) {
LOG.warn("Topology has invalid mesos mem configuration: " + memObj + " for topology " + info.getId());
memObj = null;
}
if (memObj==null) return DEFAULT_MEM_MB;
else return ((Number)memObj).doubleValue();
}
public static int numWorkers(Map conf, TopologyDetails info) {
return info.getNumWorkers();
}
public static List<String> getTopologyIds(Collection<TopologyDetails> details) {
List<String> ret = new ArrayList();
for(TopologyDetails d: details) {
ret.add(d.getId());
}
return ret;
}
}
|
923f97419306adfb66cef314dcb82de5aaa7ef6e
| 20,886 |
java
|
Java
|
src/br/com/ariane/fiora/app/FrmAddAlbum.java
|
ArianeGomes/ProjetoFiora
|
2ff879f41fcdc29cf11f6aec8af17bbac579a59a
|
[
"MIT"
] | null | null | null |
src/br/com/ariane/fiora/app/FrmAddAlbum.java
|
ArianeGomes/ProjetoFiora
|
2ff879f41fcdc29cf11f6aec8af17bbac579a59a
|
[
"MIT"
] | null | null | null |
src/br/com/ariane/fiora/app/FrmAddAlbum.java
|
ArianeGomes/ProjetoFiora
|
2ff879f41fcdc29cf11f6aec8af17bbac579a59a
|
[
"MIT"
] | null | null | null | 52.609572 | 179 | 0.661975 | 1,001,225 |
package br.com.ariane.fiora.app;
import br.com.ariane.fiora.modelo.Album;
import br.com.ariane.fiora.modelo.Artista;
import br.com.ariane.fiora.modelo.Usuario;
import java.awt.Dimension;
import java.awt.Image;
import java.io.File;
import java.io.IOException;
import java.security.Principal;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
public class FrmAddAlbum extends javax.swing.JInternalFrame {
private int codigoArtista;
private JFileChooser fc;
private File f;
private Usuario usuario;
public FrmAddAlbum() {
initComponents();
preencherComboMidia();
}
//Parâmetro contém o usuário logado no momento
public FrmAddAlbum(Usuario usuario) {
this();
this.usuario = usuario;
}
//Apaga todos os dados dos campos preenchidos
private void limparTela() {
tfTitulo.setText("");
tfAnoLancamento.setText("");
tfGravadora.setText("");
lbCapa.setIcon(null);
lbArtista.setText("");
}
//Configura a posição do Internal Frame para o meio do DesktopPane
public void setPosicao() {
Dimension d = this.getDesktopPane().getSize();
this.setLocation((d.width - this.getSize().width) / 2, (d.height - this.getSize().height) / 2);
}
//Atualiza o artista assim que o FrmSelecionarArtista o aciona
public void atualizarArtista(Artista a) {
codigoArtista = a.getCodArtista();
lbArtista.setText(a.getNome());
}
private void preencherComboMidia() {
cbMidia.removeAllItems();
cbMidia.addItem("CD");
cbMidia.addItem("CD Ao Vivo");
cbMidia.addItem("CD Duplo");
cbMidia.addItem("Vinil");
cbMidia.addItem("Vinil Ao Vivo");
cbMidia.addItem("Vinil Duplo");
cbMidia.addItem("Coletânea");
cbMidia.addItem("DVD");
cbMidia.addItem("Fita Cassete");
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel4 = new javax.swing.JPanel();
jPanel1 = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
tfGravadora = new javax.swing.JTextField();
tfAnoLancamento = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
tfTitulo = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
cbMidia = new javax.swing.JComboBox();
jPanel3 = new javax.swing.JPanel();
btnImagem = new javax.swing.JButton();
lbCapa = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jPanel6 = new javax.swing.JPanel();
btnArtista = new javax.swing.JButton();
jLabel7 = new javax.swing.JLabel();
lbArtista = new javax.swing.JLabel();
btnLimparTela = new javax.swing.JButton();
btnIncluir = new javax.swing.JButton();
lbDica = new javax.swing.JLabel();
setClosable(true);
setIconifiable(true);
setMaximizable(true);
setResizable(true);
setTitle("Incluir Álbum");
jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Informações do Álbum"));
jLabel1.setText("*Título do Álbum:");
jLabel5.setText("*Mídia:");
jLabel3.setText("Gravadora:");
jLabel2.setText("*Ano de Lançamento:");
cbMidia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(tfTitulo)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(tfAnoLancamento, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cbMidia, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tfGravadora, javax.swing.GroupLayout.DEFAULT_SIZE, 170, Short.MAX_VALUE)))
.addContainerGap())
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(tfTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(tfAnoLancamento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel5)
.addComponent(cbMidia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(tfGravadora, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("*Capa do Álbum"));
btnImagem.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/ariane/fiora/images/adicionar.png"))); // NOI18N
btnImagem.setText("Selecionar Imagem");
btnImagem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnImagemActionPerformed(evt);
}
});
lbCapa.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
jLabel4.setText("Capa selecionada:");
javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
jPanel3.setLayout(jPanel3Layout);
jPanel3Layout.setHorizontalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addComponent(btnImagem)
.addGap(18, 18, 18)
.addComponent(jLabel4)
.addGap(18, 18, 18)
.addComponent(lbCapa, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel3Layout.setVerticalGroup(
jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnImagem)
.addComponent(jLabel4))
.addComponent(lbCapa, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("*Artista do Álbum"));
btnArtista.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/ariane/fiora/images/adicionar.png"))); // NOI18N
btnArtista.setText("Selecionar Artista");
btnArtista.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnArtistaActionPerformed(evt);
}
});
jLabel7.setText("Artista selecionado:");
lbArtista.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N
lbArtista.setForeground(new java.awt.Color(51, 51, 51));
javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
jPanel6.setLayout(jPanel6Layout);
jPanel6Layout.setHorizontalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addComponent(btnArtista)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel7)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(lbArtista, javax.swing.GroupLayout.PREFERRED_SIZE, 279, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(66, Short.MAX_VALUE))
);
jPanel6Layout.setVerticalGroup(
jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel6Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnArtista, javax.swing.GroupLayout.PREFERRED_SIZE, 39, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel7)))
.addComponent(lbArtista, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap())
);
btnLimparTela.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/ariane/fiora/images/limpar.png"))); // NOI18N
btnLimparTela.setText("Limpar Tela");
btnLimparTela.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLimparTelaActionPerformed(evt);
}
});
btnIncluir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/ariane/fiora/images/confirmar.png"))); // NOI18N
btnIncluir.setText("Incluir");
btnIncluir.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnIncluirActionPerformed(evt);
}
});
lbDica.setIcon(new javax.swing.ImageIcon(getClass().getResource("/br/com/ariane/fiora/images/dica.png"))); // NOI18N
lbDica.setText("Campos com * são obrigatórios");
javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
jPanel4.setLayout(jPanel4Layout);
jPanel4Layout.setHorizontalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel6, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(lbDica)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnIncluir)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btnLimparTela)))
.addContainerGap())
);
jPanel4Layout.setVerticalGroup(
jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel4Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btnLimparTela)
.addComponent(btnIncluir, javax.swing.GroupLayout.PREFERRED_SIZE, 41, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(lbDica))
.addContainerGap(14, Short.MAX_VALUE))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnImagemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnImagemActionPerformed
//Cria um arquivo JFileChooser e retorna ao objeto File o que foi selecionado
try {
fc = new JFileChooser();
fc.setDialogTitle("Selecione o arquivo");
if (fc.showOpenDialog(this) == JFileChooser.APPROVE_OPTION){
f = fc.getSelectedFile();
//Transforma o arquivo em objeto File e o exibe no lbCapa
Image capa = ImageIO.read(f);
lbCapa.setIcon(new ImageIcon(capa.getScaledInstance(lbCapa.getWidth(), lbCapa.getHeight(), Image.SCALE_DEFAULT)));
}
} catch (IOException ex) {
Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex);
}
}//GEN-LAST:event_btnImagemActionPerformed
private void btnIncluirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnIncluirActionPerformed
try {
//Valida campos obrigatórios
if ((tfTitulo.getText().isEmpty()) || (tfAnoLancamento.getText().isEmpty()) || (lbArtista.getText().isEmpty()) || (f == null)) {
JOptionPane.showMessageDialog(this, "Preencha todos os campos!", "Aviso", JOptionPane.WARNING_MESSAGE);
} else {
//Valida o ano
if ((tfAnoLancamento.getComponentCount() > 4) || Calendar.getInstance().get(Calendar.YEAR) < Integer.parseInt(tfAnoLancamento.getText())) {
JOptionPane.showMessageDialog(this, "Ano de Lançamento incorreto!\nVerifique e tente novamente.", "Aviso", JOptionPane.WARNING_MESSAGE);
} else {
//Cria um objeto do tipo Album para incluir os dados na classe
Album album = new Album();
album.setTitulo(tfTitulo.getText());
album.setAnoLancamento(Integer.parseInt(tfAnoLancamento.getText()));
album.setGravadora(tfGravadora.getText());
album.setCodArtista(codigoArtista);
album.setLoginUsuario(usuario.getLogin());
album.setMidia((String) cbMidia.getSelectedItem());
//Adiciona os dados no banco de dados
album.incluirAlbum(album, f);
JOptionPane.showMessageDialog(this, "Álbum cadastrado com sucesso!", "Cadastro", JOptionPane.INFORMATION_MESSAGE);
limparTela();
this.dispose();
}
}
} catch (NumberFormatException e) {
JOptionPane.showMessageDialog(this, "Digite somente números no campo Ano de Lançamento", "Erro", JOptionPane.ERROR_MESSAGE);
tfAnoLancamento.setText("");
}
}//GEN-LAST:event_btnIncluirActionPerformed
private void btnLimparTelaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLimparTelaActionPerformed
limparTela();
}//GEN-LAST:event_btnLimparTelaActionPerformed
private void btnArtistaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnArtistaActionPerformed
//Cria novo formulário para alteração do artista
FrmSelecionarArtista frm = new FrmSelecionarArtista(this, 0);
frm.setVisible(true);
frm.setAlwaysOnTop(true);
frm.setLocationRelativeTo(null);
}//GEN-LAST:event_btnArtistaActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnArtista;
private javax.swing.JButton btnImagem;
private javax.swing.JButton btnIncluir;
private javax.swing.JButton btnLimparTela;
private javax.swing.JComboBox cbMidia;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel3;
private javax.swing.JPanel jPanel4;
private javax.swing.JPanel jPanel6;
private javax.swing.JLabel lbArtista;
private javax.swing.JLabel lbCapa;
private javax.swing.JLabel lbDica;
private javax.swing.JTextField tfAnoLancamento;
private javax.swing.JTextField tfGravadora;
private javax.swing.JTextField tfTitulo;
// End of variables declaration//GEN-END:variables
}
|
923f99411477606914ce185c9fbffa90a1d3b034
| 229 |
java
|
Java
|
spring-cloud-tutorial/discovery-service/src/test/java/io/github/shirohoo/eureka/DiscoveryApplicationTests.java
|
shirohoo/spring-cloud-examples
|
d74fd1d305c8e67de56c2d07dfbbba5021c8763e
|
[
"MIT"
] | null | null | null |
spring-cloud-tutorial/discovery-service/src/test/java/io/github/shirohoo/eureka/DiscoveryApplicationTests.java
|
shirohoo/spring-cloud-examples
|
d74fd1d305c8e67de56c2d07dfbbba5021c8763e
|
[
"MIT"
] | null | null | null |
spring-cloud-tutorial/discovery-service/src/test/java/io/github/shirohoo/eureka/DiscoveryApplicationTests.java
|
shirohoo/spring-cloud-examples
|
d74fd1d305c8e67de56c2d07dfbbba5021c8763e
|
[
"MIT"
] | null | null | null | 16.357143 | 60 | 0.759825 | 1,001,226 |
package io.github.shirohoo.eureka;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class DiscoveryApplicationTests {
@Test
void contextLoads() {
}
}
|
923f994124e2d73c55b01a3f0b4fbc2fd4f81a86
| 21,793 |
java
|
Java
|
app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/BFH16DeviceSupport.java
|
hurjeesic/YourSleeping
|
de5e83902cd2e8df0a697c041f7f7223ad2de40d
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/BFH16DeviceSupport.java
|
hurjeesic/YourSleeping
|
de5e83902cd2e8df0a697c041f7f7223ad2de40d
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/jyou/BFH16DeviceSupport.java
|
hurjeesic/YourSleeping
|
de5e83902cd2e8df0a697c041f7f7223ad2de40d
|
[
"Apache-2.0"
] | null | null | null | 33.787597 | 165 | 0.570091 | 1,001,227 |
/* Copyright (C) 2019 Sophanimus
This file is part of Gadgetbridge.
Gadgetbridge is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gadgetbridge 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 Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/*
Features:
Working
work in progress
possible
not supported
Get firmware version (X) () (X) ()
Get battery level (X) () (X) ()
Set alarms (1-3) (X) () (X) ()
Sync date and time (X) () (X) ()
Find device (X) () (X) ()
Switch 12/24 hour mode () () (X) ()
Set step goal () () (X) ()
Set sitting reminder () () (X) ()
Trigger a photo () () (X) ()
Switch automated heartbeat detection (X) () (X) ()
Switch display illumination () () (X) ()
Switch vibration () () (X) ()
Switch notifications () () (X) ()
Set do not distract time () () (X) ()
Get Steps () () (X) ()
Get Heart Rate () () (X) ()
Get Blood Pressure () () (x) ()
Get Blood Satiation () () (X) ()
Send Notification () () (X) ()
*/
package nodomain.freeyourgadget.gadgetbridge.service.devices.jyou;
import android.bluetooth.BluetoothGatt;
import android.bluetooth.BluetoothGattCharacteristic;
import android.net.Uri;
import android.widget.Toast;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInfo;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo;
import nodomain.freeyourgadget.gadgetbridge.devices.jyou.BFH16Constants;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
import nodomain.freeyourgadget.gadgetbridge.model.CannedMessagesSpec;
import nodomain.freeyourgadget.gadgetbridge.model.MusicSpec;
import nodomain.freeyourgadget.gadgetbridge.model.MusicStateSpec;
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
import nodomain.freeyourgadget.gadgetbridge.model.WeatherSpec;
import nodomain.freeyourgadget.gadgetbridge.service.btle.AbstractBTLEDeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
import nodomain.freeyourgadget.gadgetbridge.util.AlarmUtils;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
import nodomain.freeyourgadget.gadgetbridge.util.StringUtils;
public class BFH16DeviceSupport extends AbstractBTLEDeviceSupport {
private static final Logger LOG = LoggerFactory.getLogger(BFH16DeviceSupport.class);
public BluetoothGattCharacteristic ctrlCharacteristic = null;
public BluetoothGattCharacteristic measureCharacteristic = null;
private final GBDeviceEventVersionInfo versionCmd = new GBDeviceEventVersionInfo();
private final GBDeviceEventBatteryInfo batteryCmd = new GBDeviceEventBatteryInfo();
public BFH16DeviceSupport() {
super(LOG);
addSupportedService(BFH16Constants.BFH16_SERVICE1);
addSupportedService(BFH16Constants.BFH16_SERVICE2);
}
@Override
public boolean useAutoConnect() {
return true;
}
@Override
protected TransactionBuilder initializeDevice(TransactionBuilder builder) {
LOG.info("Initializing BFH16");
gbDevice.setState(GBDevice.State.INITIALIZING);
gbDevice.sendDeviceUpdateIntent(getContext());
measureCharacteristic = getCharacteristic(BFH16Constants.BFH16_SERVICE1_NOTIFY);
ctrlCharacteristic = getCharacteristic(BFH16Constants.BFH16_SERVICE1_WRITE);
builder.setGattCallback(this);
builder.notify(measureCharacteristic, true);
syncSettings(builder);
gbDevice.setState(GBDevice.State.INITIALIZED);
gbDevice.sendDeviceUpdateIntent(getContext());
LOG.info("Initialization BFH16 Done");
return builder;
}
//onXYZ
//______________________________________________________________________________________________
//TODO check TODOs in method
@Override
public boolean onCharacteristicChanged(BluetoothGatt gatt,
BluetoothGattCharacteristic characteristic) {
if (super.onCharacteristicChanged(gatt, characteristic)) {
return true;
}
UUID characteristicUUID = characteristic.getUuid();
byte[] data = characteristic.getValue();
if (data.length == 0)
return true;
switch (data[0]) {
case BFH16Constants.RECEIVE_DEVICE_INFO:
int fwVerNum = data[4] & 0xFF;
versionCmd.fwVersion = (fwVerNum / 100) + "." + ((fwVerNum % 100) / 10) + "." + ((fwVerNum % 100) % 10);
handleGBDeviceEvent(versionCmd);
LOG.info("Firmware version is: " + versionCmd.fwVersion);
return true;
case BFH16Constants.RECEIVE_BATTERY_LEVEL:
batteryCmd.level = data[8];
handleGBDeviceEvent(batteryCmd);
LOG.info("Battery level is: " + batteryCmd.level);
return true;
case BFH16Constants.RECEIVE_STEPS_DATA:
int steps = ByteBuffer.wrap(data, 5, 4).getInt();
//TODO handle step data
LOG.info("Number of walked steps: " + steps);
return true;
case BFH16Constants.RECEIVE_HEART_DATA:
//TODO handle heart data
LOG.info("Current heart rate: " + data[1]);
LOG.info("Current blood pressure: " + data[2] + "/" + data[3]);
LOG.info("Current satiation: " + data[4]);
return true;
case BFH16Constants.RECEIVE_PHOTO_TRIGGER:
//TODO handle photo trigger
LOG.info("Received photo trigger: " + data[8]);
return true;
default:
LOG.info("Unhandled characteristic change: " + characteristicUUID + " code: " + String.format("0x%1x ...", data[0]));
LOG.info("Unhandled characteristic data: "+ data[0]+" "+data[1]+" "+data[2]+" "+data[3]+" "+data[4]+" "+data[5]+" "+data[6]+" "+data[7]+" "+data[8]);
return true;
}
}
//working
@Override
public void onSetAlarms(ArrayList<? extends Alarm> alarms) {
try {
TransactionBuilder builder = performInitialized("SetAlarms");
for (int i = 0; i < alarms.size(); i++)
{
byte cmd;
switch (i) {
case 0:
cmd = BFH16Constants.CMD_SET_ALARM_1;
break;
case 1:
cmd = BFH16Constants.CMD_SET_ALARM_2;
break;
case 2:
cmd = BFH16Constants.CMD_SET_ALARM_3;
break;
default:
return;
}
Calendar cal = AlarmUtils.toCalendar(alarms.get(i));
builder.write(ctrlCharacteristic, commandWithChecksum(
cmd,
alarms.get(i).getEnabled() ? cal.get(Calendar.HOUR_OF_DAY) : -1,
alarms.get(i).getEnabled() ? cal.get(Calendar.MINUTE) : -1
));
}
builder.queue(getQueue());
GB.toast(getContext(), "Alarm settings applied - do note that the current device does not support day specification", Toast.LENGTH_LONG, GB.INFO);
} catch(IOException e) {
LOG.warn(e.getMessage());
}
}
//working
@Override
public void onSetTime() {
try {
TransactionBuilder builder = performInitialized("SetTime");
syncDateAndTime(builder);
builder.queue(getQueue());
} catch(IOException e) {
LOG.warn(e.getMessage());
}
}
//working
@Override
public void onFindDevice(boolean start) {
try {
TransactionBuilder builder = performInitialized("FindDevice");
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_VIBRATE, 0, start ? 1 : 0
));
builder.queue(getQueue());
} catch(Exception e) {
LOG.warn(e.getMessage());
}
GB.toast(getContext(), "Your device will vibrate 3 times!", Toast.LENGTH_LONG, GB.INFO);
}
//TODO: checked + rework
@Override
public void onNotification(NotificationSpec notificationSpec) {
String notificationTitle = StringUtils.getFirstOf(notificationSpec.sender, notificationSpec.title);
byte icon;
switch (notificationSpec.type) {
case GENERIC_SMS:
icon = BFH16Constants.ICON_SMS;
break;
case FACEBOOK:
case FACEBOOK_MESSENGER:
icon = BFH16Constants.ICON_FACEBOOK;
break;
case TWITTER:
icon = BFH16Constants.ICON_TWITTER;
break;
case WHATSAPP:
icon = BFH16Constants.ICON_WHATSAPP;
break;
default:
icon = BFH16Constants.ICON_LINE;
break;
}
showNotification(icon, notificationTitle, notificationSpec.body);
}
@Override
public void onDeleteNotification(int id) {
}
//TODO: check
@Override
public void onSetCallState(CallSpec callSpec) {
switch (callSpec.command) {
case CallSpec.CALL_INCOMING:
showNotification(BFH16Constants.ICON_CALL, callSpec.name, callSpec.number);
break;
}
}
//TODO: check
@Override
public void onEnableRealtimeSteps(boolean enable) {
onEnableRealtimeHeartRateMeasurement(enable);
}
//TODO: check
@Override
public void onReset(int flags) {
try {
TransactionBuilder builder = performInitialized("Reboot");
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_ACTION_REBOOT_DEVICE, 0, 0
));
builder.queue(getQueue());
} catch(Exception e) {
LOG.warn(e.getMessage());
}
}
//TODO: check
@Override
public void onHeartRateTest() {
try {
TransactionBuilder builder = performInitialized("HeartRateTest");
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_MEASURE_HEART, 0, 1
));
builder.queue(getQueue());
} catch(Exception e) {
LOG.warn(e.getMessage());
}
}
//TODO: check
@Override
public void onEnableRealtimeHeartRateMeasurement(boolean enable) {
// TODO: test
try {
TransactionBuilder builder = performInitialized("RealTimeHeartMeasurement");
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_MEASURE_HEART, 0, enable ? 1 : 0
));
builder.queue(getQueue());
} catch(Exception e) {
LOG.warn(e.getMessage());
}
}
//TODO: check
@Override
public void onSetConstantVibration(int integer) {
try {
TransactionBuilder builder = performInitialized("Vibrate");
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_VIBRATE, 0, 1
));
builder.queue(getQueue());
} catch(Exception e) {
LOG.warn(e.getMessage());
}
}
@Override
public void onSetCannedMessages(CannedMessagesSpec cannedMessagesSpec) {
}
@Override
public void onSetMusicState(MusicStateSpec stateSpec) {
}
@Override
public void onSetMusicInfo(MusicSpec musicSpec) {
}
@Override
public void onInstallApp(Uri uri) {
}
@Override
public void onAppInfoReq() {
}
@Override
public void onAppStart(UUID uuid, boolean start) {
}
@Override
public void onAppDelete(UUID uuid) {
}
@Override
public void onAppConfiguration(UUID appUuid, String config, Integer id) {
}
@Override
public void onAppReorder(UUID[] uuids) {
}
@Override
public void onFetchRecordedData(int dataTypes) {
}
@Override
public void onScreenshotReq() {
}
@Override
public void onEnableHeartRateSleepSupport(boolean enable) {
}
@Override
public void onSetHeartRateMeasurementInterval(int seconds) {
}
@Override
public void onAddCalendarEvent(CalendarEventSpec calendarEventSpec) {
}
@Override
public void onDeleteCalendarEvent(byte type, long id) {
}
@Override
public void onSendConfiguration(String config) {
}
@Override
public void onReadConfiguration(String config) {
}
@Override
public void onSendWeather(WeatherSpec weatherSpec) {
}
@Override
public void onTestNewFunction() {
showNotification((byte)0xFF, "", "");
// try {
// TransactionBuilder builder = performInitialized("TestNewFunction");
//
// //Test new command
// builder.write(ctrlCharacteristic, commandWithChecksum( (byte)0x32, 0, 0));
// builder.queue(getQueue());
//
// GB.toast(getContext(), "TestNewFunction executed!", Toast.LENGTH_LONG, GB.INFO);
//
// } catch(IOException e) {
// LOG.warn(e.getMessage());
// }
}
//FUNCTIONS
//______________________________________________________________________________________________
//TODO: check
private void showNotification(byte icon, String title, String message) {
try {
TransactionBuilder builder = performInitialized("ShowNotification");
byte[] titleBytes = stringToUTF8Bytes(title, 16);
byte[] messageBytes = stringToUTF8Bytes(message, 80);
for (int i = 1; i <= 7; i++)
{
byte[] currentPacket = new byte[20];
currentPacket[0] = BFH16Constants.CMD_ACTION_SHOW_NOTIFICATION;
currentPacket[1] = 7;
currentPacket[2] = (byte)i;
switch(i) {
case 1:
currentPacket[4] = icon;
break;
case 2:
if (titleBytes != null) {
System.arraycopy(titleBytes, 0, currentPacket, 3, 6);
System.arraycopy(titleBytes, 6, currentPacket, 10, 10);
}
break;
default:
if (messageBytes != null) {
System.arraycopy(messageBytes, 16 * (i - 3), currentPacket, 3, 6);
System.arraycopy(messageBytes, 6 + 16 * (i - 3), currentPacket, 10, 10);
}
break;
}
builder.write(ctrlCharacteristic, currentPacket);
}
builder.queue(getQueue());
} catch (IOException e) {
LOG.warn(e.getMessage());
}
}
//TODO: check
private void syncSettings(TransactionBuilder builder) {
syncDateAndTime(builder);
// TODO: unhardcode and separate stuff
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_SET_HEARTRATE_WARNING_VALUE, 0, 152
));
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_SET_TARGET_STEPS, 0, 10000
));
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_SWITCH_METRIC_IMPERIAL, 0, 0
));
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_GET_SLEEP_TIME, 0, 0
));
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_SET_NOON_TIME, 12 * 60 * 60, 14 * 60 * 60 // 12:00 - 14:00
));
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_SET_SLEEP_TIME, 21 * 60 * 60, 8 * 60 * 60 // 21:00 - 08:00
));
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_SET_INACTIVITY_WARNING_TIME, 0, 0
));
// do not disturb and a couple more features
byte dndStartHour = 22;
byte dndStartMin = 0;
byte dndEndHour = 8;
byte dndEndMin = 0;
boolean dndToggle = false;
boolean vibrationToggle = true;
boolean wakeOnRaiseToggle = true;
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_SET_DND_SETTINGS,
(dndStartHour << 24) | (dndStartMin << 16) | (dndEndHour << 8) | dndEndMin,
((dndToggle ? 0 : 1) << 2) | ((vibrationToggle ? 1 : 0) << 1) | (wakeOnRaiseToggle ? 1 : 0)
));
}
//working
private void syncDateAndTime(TransactionBuilder builder) {
Calendar cal = Calendar.getInstance();
String strYear = String.valueOf(cal.get(Calendar.YEAR));
byte year1 = (byte)Integer.parseInt(strYear.substring(0, 2));
byte year2 = (byte)Integer.parseInt(strYear.substring(2, 4));
byte month = (byte)cal.get(Calendar.MONTH);
byte day = (byte)cal.get(Calendar.DAY_OF_MONTH);
byte hour = (byte)cal.get(Calendar.HOUR_OF_DAY);
byte minute = (byte)cal.get(Calendar.MINUTE);
byte second = (byte)cal.get(Calendar.SECOND);
byte weekDay = (byte)cal.get(Calendar.DAY_OF_WEEK);
builder.write(ctrlCharacteristic, commandWithChecksum(
BFH16Constants.CMD_SET_DATE_AND_TIME,
(year1 << 24) | (year2 << 16) | (month << 8) | day,
(hour << 24) | (minute << 16) | (second << 8) | weekDay
));
}
//working
private byte[] commandWithChecksum(byte cmd, int argSlot1, int argSlot2)
{
ByteBuffer buf = ByteBuffer.allocate(10);
buf.put(cmd);
buf.putInt(argSlot1);
buf.putInt(argSlot2);
byte[] bytesToWrite = buf.array();
byte checksum = 0;
for (byte b : bytesToWrite) {
checksum += b;
}
bytesToWrite[9] = checksum;
return bytesToWrite;
}
/**
* Checksum is calculated by the sum of bytes 0 to 8 and send as byte 9
*/
private byte[] commandWithChecksum(byte s0, byte s1, byte s2, byte s3, byte s4, byte s5, byte s6, byte s7, byte s8)
{
ByteBuffer buf = ByteBuffer.allocate(10);
buf.put(s0);
buf.put(s1);
buf.put(s2);
buf.put(s3);
buf.put(s4);
buf.put(s5);
buf.put(s6);
buf.put(s7);
buf.put(s8);
byte[] bytesToWrite = buf.array();
byte checksum = 0;
for (byte b : bytesToWrite) {
checksum += b;
}
//checksum = (byte) ((byte) checksum & (byte) 0xFF); //TODO EXPERIMENTAL
LOG.debug("Checksum = " + checksum);
bytesToWrite[9] = checksum;
return bytesToWrite;
}
private byte[] stringToUTF8Bytes(String src, int byteCount) {
try {
if (src == null)
return null;
for (int i = src.length(); i > 0; i--) {
String sub = src.substring(0, i);
byte[] subUTF8 = sub.getBytes("UTF-8");
if (subUTF8.length == byteCount) {
return subUTF8;
}
if (subUTF8.length < byteCount) {
byte[] largerSubUTF8 = new byte[byteCount];
System.arraycopy(subUTF8, 0, largerSubUTF8, 0, subUTF8.length);
return largerSubUTF8;
}
}
} catch (UnsupportedEncodingException e) {
LOG.warn(e.getMessage());
}
return null;
}
}
|
923f99c0ca5298f3e44570c0fa4aeda6cd9420ca
| 1,622 |
java
|
Java
|
src/nl/knokko/rpg/world/maps/MapGenDeadDungeon1.java
|
knokko/Old-RPG
|
bb138f942e1d2df58a8d3bfecf707a1bcf35801a
|
[
"MIT"
] | null | null | null |
src/nl/knokko/rpg/world/maps/MapGenDeadDungeon1.java
|
knokko/Old-RPG
|
bb138f942e1d2df58a8d3bfecf707a1bcf35801a
|
[
"MIT"
] | null | null | null |
src/nl/knokko/rpg/world/maps/MapGenDeadDungeon1.java
|
knokko/Old-RPG
|
bb138f942e1d2df58a8d3bfecf707a1bcf35801a
|
[
"MIT"
] | null | null | null | 19.082353 | 109 | 0.692355 | 1,001,228 |
package nl.knokko.rpg.world.maps;
import java.awt.*;
import java.util.ArrayList;
import nl.knokko.rpg.entities.Entity;
import nl.knokko.rpg.entities.monsters.Spider;
import nl.knokko.rpg.entities.monsters.Zombie;
import nl.knokko.rpg.main.Game;
import nl.knokko.rpg.utils.BackGrounds;
import nl.knokko.rpg.world.Portal;
import nl.knokko.rpg.world.maps.MapGenBase;
public class MapGenDeadDungeon1 extends MapGenBase {
public MapGenDeadDungeon1(){
super();
build();
placePortals();
}
@Override
public int getXSize(){
return 200;
}
@Override
public int getYSize(){
return 200;
}
@Override
public Color getBackGroundColor(){
return Color.BLACK;
}
@Override
public String getName(){
return "Dead Dungeon 1";
}
@Override
public ArrayList<Entity> getEnemies(){
ArrayList<Entity> enemies = new ArrayList<Entity>();
Point p = new Point();
Game g = Game.game;
enemies.add(new Spider(g, p, 40));
enemies.add(new Zombie(g, p, 10));
return enemies;
}
@Override
public int getMaxEnemies(){
return 4;
}
@Override
public Point getStartPoint(MapGenBase old){
return new Point();
}
public void build(){
fill2(0, 199, 10, 199, 28);
fill2(10, 194, 10, 198, 28);
fill2(0, 193, 10, 193, 28);
fill2(0, 194, 0, 198, 28);
fill(1, 194, 9, 198, 6);
tiles2[6][199] = 7;
}
public void placePortals(){
portals.add(new Portal(new Point(180, 5970), "Dead Dungeon 1", new Point(2310, 1890), "Dark Forest West"));
}
@Override
public String getMusic() {
return "dead mansion";
}
@Override
public String getFightBackGround() {
return BackGrounds.miay_cave;
}
}
|
923f9a0a20e72e1cb9b50425894c994bc0c43cd4
| 1,262 |
java
|
Java
|
plugins/eCommerce/src/main/java/com/skytala/eCommerce/domain/order/relations/desiredFeature/model/DesiredFeature.java
|
ArcticReal/eCommerce
|
ea4c82442acdc9e663571e2d07e1f1ddc844f135
|
[
"Apache-2.0"
] | 1 |
2020-09-28T08:23:11.000Z
|
2020-09-28T08:23:11.000Z
|
plugins/eCommerce/src/main/java/com/skytala/eCommerce/domain/order/relations/desiredFeature/model/DesiredFeature.java
|
ArcticReal/eCommerce
|
ea4c82442acdc9e663571e2d07e1f1ddc844f135
|
[
"Apache-2.0"
] | null | null | null |
plugins/eCommerce/src/main/java/com/skytala/eCommerce/domain/order/relations/desiredFeature/model/DesiredFeature.java
|
ArcticReal/eCommerce
|
ea4c82442acdc9e663571e2d07e1f1ddc844f135
|
[
"Apache-2.0"
] | null | null | null | 22.945455 | 95 | 0.820127 | 1,001,229 |
package com.skytala.eCommerce.domain.order.relations.desiredFeature.model;
import java.util.Map;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.Map;
import java.io.Serializable;
import com.skytala.eCommerce.domain.order.relations.desiredFeature.mapper.DesiredFeatureMapper;
public class DesiredFeature implements Serializable{
private static final long serialVersionUID = 1L;
private String desiredFeatureId;
private String requirementId;
private String productFeatureId;
private Boolean optionalInd;
public String getDesiredFeatureId() {
return desiredFeatureId;
}
public void setDesiredFeatureId(String desiredFeatureId) {
this.desiredFeatureId = desiredFeatureId;
}
public String getRequirementId() {
return requirementId;
}
public void setRequirementId(String requirementId) {
this.requirementId = requirementId;
}
public String getProductFeatureId() {
return productFeatureId;
}
public void setProductFeatureId(String productFeatureId) {
this.productFeatureId = productFeatureId;
}
public Boolean getOptionalInd() {
return optionalInd;
}
public void setOptionalInd(Boolean optionalInd) {
this.optionalInd = optionalInd;
}
public Map<String, Object> mapAttributeField() {
return DesiredFeatureMapper.map(this);
}
}
|
923f9a842e22493b909b31a11d5614ce4d640c93
| 30,568 |
java
|
Java
|
src/main/java/com/azure/management/vanilla/network/FirewallPolicyRuleGroupsAsyncClient.java
|
weidongxu-microsoft/azure-java-sdk-samples
|
8bc9acca79999cc169a40e2e42d5b32d5616a4c2
|
[
"MIT"
] | null | null | null |
src/main/java/com/azure/management/vanilla/network/FirewallPolicyRuleGroupsAsyncClient.java
|
weidongxu-microsoft/azure-java-sdk-samples
|
8bc9acca79999cc169a40e2e42d5b32d5616a4c2
|
[
"MIT"
] | null | null | null |
src/main/java/com/azure/management/vanilla/network/FirewallPolicyRuleGroupsAsyncClient.java
|
weidongxu-microsoft/azure-java-sdk-samples
|
8bc9acca79999cc169a40e2e42d5b32d5616a4c2
|
[
"MIT"
] | null | null | null | 50.693201 | 120 | 0.741429 | 1,001,230 |
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.management.vanilla.network;
import com.azure.core.annotation.ReturnType;
import com.azure.core.annotation.ServiceClient;
import com.azure.core.annotation.ServiceMethod;
import com.azure.core.http.rest.PagedFlux;
import com.azure.core.http.rest.PagedResponse;
import com.azure.core.http.rest.Response;
import com.azure.core.management.exception.ManagementException;
import com.azure.core.management.polling.PollResult;
import com.azure.core.util.Context;
import com.azure.core.util.polling.PollerFlux;
import com.azure.management.vanilla.network.implementation.FirewallPolicyRuleGroupsImpl;
import com.azure.management.vanilla.network.models.FirewallPolicyRuleGroup;
import java.nio.ByteBuffer;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;
/** Initializes a new instance of the asynchronous NetworkManagementClient type. */
@ServiceClient(builder = NetworkManagementClientBuilder.class)
public final class FirewallPolicyRuleGroupsAsyncClient {
private FirewallPolicyRuleGroupsImpl serviceClient;
/** Initializes an instance of FirewallPolicyRuleGroups client. */
FirewallPolicyRuleGroupsAsyncClient(FirewallPolicyRuleGroupsImpl serviceClient) {
this.serviceClient = serviceClient;
}
/**
* Deletes the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> deleteWithResponse(
String resourceGroupName, String firewallPolicyName, String ruleGroupName) {
return this.serviceClient.deleteWithResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName);
}
/**
* Deletes the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> deleteWithResponse(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, Context context) {
return this
.serviceClient
.deleteWithResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, context);
}
/**
* Deletes the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String firewallPolicyName, String ruleGroupName) {
return this.serviceClient.beginDelete(resourceGroupName, firewallPolicyName, ruleGroupName);
}
/**
* Deletes the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<Void>, Void> beginDelete(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, Context context) {
return this.serviceClient.beginDelete(resourceGroupName, firewallPolicyName, ruleGroupName, context);
}
/**
* Deletes the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> delete(String resourceGroupName, String firewallPolicyName, String ruleGroupName) {
return this.serviceClient.deleteAsync(resourceGroupName, firewallPolicyName, ruleGroupName);
}
/**
* Deletes the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> delete(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, Context context) {
return this.serviceClient.deleteAsync(resourceGroupName, firewallPolicyName, ruleGroupName, context);
}
/**
* Gets the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the specified FirewallPolicyRuleGroup.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<FirewallPolicyRuleGroup>> getWithResponse(
String resourceGroupName, String firewallPolicyName, String ruleGroupName) {
return this.serviceClient.getWithResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName);
}
/**
* Gets the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the specified FirewallPolicyRuleGroup.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<FirewallPolicyRuleGroup>> getWithResponse(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, Context context) {
return this.serviceClient.getWithResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, context);
}
/**
* Gets the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the specified FirewallPolicyRuleGroup.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<FirewallPolicyRuleGroup> get(
String resourceGroupName, String firewallPolicyName, String ruleGroupName) {
return this.serviceClient.getAsync(resourceGroupName, firewallPolicyName, ruleGroupName);
}
/**
* Gets the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the specified FirewallPolicyRuleGroup.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<FirewallPolicyRuleGroup> get(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, Context context) {
return this.serviceClient.getAsync(resourceGroupName, firewallPolicyName, ruleGroupName, context);
}
/**
* Creates or updates the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param parameters Rule Group resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return rule Group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponse(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroup parameters) {
return this
.serviceClient
.createOrUpdateWithResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters);
}
/**
* Creates or updates the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param parameters Rule Group resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return rule Group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Flux<ByteBuffer>>> createOrUpdateWithResponse(
String resourceGroupName,
String firewallPolicyName,
String ruleGroupName,
FirewallPolicyRuleGroup parameters,
Context context) {
return this
.serviceClient
.createOrUpdateWithResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters, context);
}
/**
* Creates or updates the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param parameters Rule Group resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return rule Group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<FirewallPolicyRuleGroup>, FirewallPolicyRuleGroup> beginCreateOrUpdate(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroup parameters) {
return this.serviceClient.beginCreateOrUpdate(resourceGroupName, firewallPolicyName, ruleGroupName, parameters);
}
/**
* Creates or updates the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param parameters Rule Group resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return rule Group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public PollerFlux<PollResult<FirewallPolicyRuleGroup>, FirewallPolicyRuleGroup> beginCreateOrUpdate(
String resourceGroupName,
String firewallPolicyName,
String ruleGroupName,
FirewallPolicyRuleGroup parameters,
Context context) {
return this
.serviceClient
.beginCreateOrUpdate(resourceGroupName, firewallPolicyName, ruleGroupName, parameters, context);
}
/**
* Creates or updates the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param parameters Rule Group resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return rule Group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<FirewallPolicyRuleGroup> createOrUpdate(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroup parameters) {
return this.serviceClient.createOrUpdateAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters);
}
/**
* Creates or updates the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param parameters Rule Group resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return rule Group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<FirewallPolicyRuleGroup> createOrUpdate(
String resourceGroupName,
String firewallPolicyName,
String ruleGroupName,
FirewallPolicyRuleGroup parameters,
Context context) {
return this
.serviceClient
.createOrUpdateAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters, context);
}
/**
* Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return response for ListFirewallPolicyRuleGroups API service call.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public Mono<PagedResponse<FirewallPolicyRuleGroup>> listSinglePage(
String resourceGroupName, String firewallPolicyName) {
return this.serviceClient.listSinglePageAsync(resourceGroupName, firewallPolicyName);
}
/**
* Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return response for ListFirewallPolicyRuleGroups API service call.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public Mono<PagedResponse<FirewallPolicyRuleGroup>> listSinglePage(
String resourceGroupName, String firewallPolicyName, Context context) {
return this.serviceClient.listSinglePageAsync(resourceGroupName, firewallPolicyName, context);
}
/**
* Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return response for ListFirewallPolicyRuleGroups API service call.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<FirewallPolicyRuleGroup> list(String resourceGroupName, String firewallPolicyName) {
return this.serviceClient.listAsync(resourceGroupName, firewallPolicyName);
}
/**
* Lists all FirewallPolicyRuleGroups in a FirewallPolicy resource.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return response for ListFirewallPolicyRuleGroups API service call.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public PagedFlux<FirewallPolicyRuleGroup> list(
String resourceGroupName, String firewallPolicyName, Context context) {
return this.serviceClient.listAsync(resourceGroupName, firewallPolicyName, context);
}
/**
* Deletes the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> beginDeleteWithoutPollingWithResponse(
String resourceGroupName, String firewallPolicyName, String ruleGroupName) {
return this
.serviceClient
.beginDeleteWithoutPollingWithResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName);
}
/**
* Deletes the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> beginDeleteWithoutPollingWithResponse(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, Context context) {
return this
.serviceClient
.beginDeleteWithoutPollingWithResponseAsync(resourceGroupName, firewallPolicyName, ruleGroupName, context);
}
/**
* Deletes the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> beginDeleteWithoutPolling(
String resourceGroupName, String firewallPolicyName, String ruleGroupName) {
return this.serviceClient.beginDeleteWithoutPollingAsync(resourceGroupName, firewallPolicyName, ruleGroupName);
}
/**
* Deletes the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return the completion.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Void> beginDeleteWithoutPolling(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, Context context) {
return this
.serviceClient
.beginDeleteWithoutPollingAsync(resourceGroupName, firewallPolicyName, ruleGroupName, context);
}
/**
* Creates or updates the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param parameters Rule Group resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return rule Group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<FirewallPolicyRuleGroup>> beginCreateOrUpdateWithoutPollingWithResponse(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroup parameters) {
return this
.serviceClient
.beginCreateOrUpdateWithoutPollingWithResponseAsync(
resourceGroupName, firewallPolicyName, ruleGroupName, parameters);
}
/**
* Creates or updates the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param parameters Rule Group resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return rule Group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<FirewallPolicyRuleGroup>> beginCreateOrUpdateWithoutPollingWithResponse(
String resourceGroupName,
String firewallPolicyName,
String ruleGroupName,
FirewallPolicyRuleGroup parameters,
Context context) {
return this
.serviceClient
.beginCreateOrUpdateWithoutPollingWithResponseAsync(
resourceGroupName, firewallPolicyName, ruleGroupName, parameters, context);
}
/**
* Creates or updates the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param parameters Rule Group resource.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return rule Group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<FirewallPolicyRuleGroup> beginCreateOrUpdateWithoutPolling(
String resourceGroupName, String firewallPolicyName, String ruleGroupName, FirewallPolicyRuleGroup parameters) {
return this
.serviceClient
.beginCreateOrUpdateWithoutPollingAsync(resourceGroupName, firewallPolicyName, ruleGroupName, parameters);
}
/**
* Creates or updates the specified FirewallPolicyRuleGroup.
*
* @param resourceGroupName The name of the resource group.
* @param firewallPolicyName The name of the Firewall Policy.
* @param ruleGroupName The name of the FirewallPolicyRuleGroup.
* @param parameters Rule Group resource.
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return rule Group resource.
*/
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<FirewallPolicyRuleGroup> beginCreateOrUpdateWithoutPolling(
String resourceGroupName,
String firewallPolicyName,
String ruleGroupName,
FirewallPolicyRuleGroup parameters,
Context context) {
return this
.serviceClient
.beginCreateOrUpdateWithoutPollingAsync(
resourceGroupName, firewallPolicyName, ruleGroupName, parameters, context);
}
/**
* Get the next page of items.
*
* @param nextLink null
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return response for ListFirewallPolicyRuleGroups API service call.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public Mono<PagedResponse<FirewallPolicyRuleGroup>> listNextSinglePage(String nextLink) {
return this.serviceClient.listNextSinglePageAsync(nextLink);
}
/**
* Get the next page of items.
*
* @param nextLink null
* @param context The context to associate with this operation.
* @throws IllegalArgumentException thrown if parameters fail the validation.
* @throws ManagementException thrown if the request is rejected by server.
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
* @return response for ListFirewallPolicyRuleGroups API service call.
*/
@ServiceMethod(returns = ReturnType.COLLECTION)
public Mono<PagedResponse<FirewallPolicyRuleGroup>> listNextSinglePage(String nextLink, Context context) {
return this.serviceClient.listNextSinglePageAsync(nextLink, context);
}
}
|
923f9cd11f67bb31d4b7166f3c3c59821336909d
| 991 |
java
|
Java
|
app/src/main/java/com/github/arcanjoaq/Java17.java
|
aarcanjoq/java17-new-features
|
22bc5f345c88ff385981503e6266bdf226ed02af
|
[
"Apache-2.0"
] | 3 |
2022-01-19T20:25:20.000Z
|
2022-01-26T13:26:41.000Z
|
app/src/main/java/com/github/arcanjoaq/Java17.java
|
aarcanjoq/java17-new-features
|
22bc5f345c88ff385981503e6266bdf226ed02af
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/com/github/arcanjoaq/Java17.java
|
aarcanjoq/java17-new-features
|
22bc5f345c88ff385981503e6266bdf226ed02af
|
[
"Apache-2.0"
] | null | null | null | 20.645833 | 88 | 0.584258 | 1,001,231 |
package com.github.arcanjoaq;
public class Java17 {
public static void main(String[] args) {
final Command c = new LoginCommand();
c.execute();
}
// Sealed Classes
public sealed interface Command permits LoginCommand, LogoutCommand, PluginCommand {
void execute();
}
static final class LoginCommand implements Command {
@Override
public void execute() {
System.out.println("login");
}
}
static final class LogoutCommand implements Command {
@Override
public void execute() {
System.out.println("logout");
}
}
static non-sealed class PluginCommand implements Command {
@Override
public void execute() {
System.out.println("plugin");
}
}
static class MyPluginCommand extends PluginCommand {
@Override
public void execute() {
System.out.println("plugin");
}
}
}
|
923f9d7a7eeee0c42999b962c38a77ddb74a9710
| 5,660 |
java
|
Java
|
modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/service/ComponentInvocationProxy.java
|
apache/tuscany-sca-2.x
|
89f2d366d4b0869a4e42ff265ccf4503dda4dc8b
|
[
"Apache-2.0"
] | 18 |
2015-01-17T17:09:47.000Z
|
2021-11-10T16:04:56.000Z
|
modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/service/ComponentInvocationProxy.java
|
apache/tuscany-sca-2.x
|
89f2d366d4b0869a4e42ff265ccf4503dda4dc8b
|
[
"Apache-2.0"
] | null | null | null |
modules/binding-corba-runtime/src/main/java/org/apache/tuscany/sca/binding/corba/provider/service/ComponentInvocationProxy.java
|
apache/tuscany-sca-2.x
|
89f2d366d4b0869a4e42ff265ccf4503dda4dc8b
|
[
"Apache-2.0"
] | 18 |
2015-08-26T15:18:06.000Z
|
2021-11-10T16:04:45.000Z
| 44.920635 | 120 | 0.674382 | 1,001,232 |
/*
* 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.tuscany.sca.binding.corba.provider.service;
import java.lang.annotation.Annotation;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.tuscany.sca.binding.corba.provider.exceptions.RequestConfigurationException;
import org.apache.tuscany.sca.binding.corba.provider.types.TypeTree;
import org.apache.tuscany.sca.binding.corba.provider.types.TypeTreeCreator;
import org.apache.tuscany.sca.binding.corba.provider.util.OperationMapper;
import org.apache.tuscany.sca.interfacedef.DataType;
import org.apache.tuscany.sca.interfacedef.Interface;
import org.apache.tuscany.sca.interfacedef.Operation;
import org.apache.tuscany.sca.runtime.Invocable;
import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
/**
* @version $Rev$ $Date$
* Invocation proxy for SCA components
*/
public class ComponentInvocationProxy implements InvocationProxy {
private Invocable wire;
private Map<Method, Operation> methodOperationMapping;
private Map<Operation, Method> operationMethodMapping;
private Map<String, Method> operationsMap;
private Map<Operation, OperationTypes> operationsCache = new HashMap<Operation, OperationTypes>();
public ComponentInvocationProxy(RuntimeEndpoint wire, Class javaClass)
throws RequestConfigurationException {
this.wire = wire;
Interface interfaze = wire.getComponentTypeServiceInterfaceContract().getInterface();
operationsMap = OperationMapper.mapOperationNameToMethod(javaClass);
operationMethodMapping = OperationMapper.mapOperationToMethod(interfaze.getOperations(), javaClass);
methodOperationMapping = OperationMapper.mapMethodToOperation(interfaze.getOperations(), javaClass);
cacheOperationTypes(interfaze.getOperations());
}
/**
* Caches TypeTree for every operation in backed component
*
* @param operations
* @throws RequestConfigurationException
*/
private void cacheOperationTypes(List<Operation> operations) throws RequestConfigurationException {
for (Operation operation : operations) {
try {
OperationTypes operationTypes = new OperationTypes();
List<TypeTree> inputInstances = new ArrayList<TypeTree>();
// cache output type tree
if (operation.getOutputType() != null) {
// Should only be one output, since this was created when we only supported one output.
DataType returnType = operation.getOutputType().getLogical().get(0);
Class<?> returnClass = returnType.getPhysical();
if (returnClass != null && !returnClass.equals(void.class)) {
Annotation[] notes = operationMethodMapping.get(operation).getAnnotations();
TypeTree outputType =
TypeTreeCreator.createTypeTree(returnClass, notes);
operationTypes.setOutputType(outputType);
}
}
// cache input types trees
if (operation.getInputType() != null) {
Method method = operationMethodMapping.get(operation);
Annotation[][] notes = method.getParameterAnnotations();
int i = 0;
for (DataType<List<DataType<?>>> type : operation.getInputType().getLogical()) {
Class<?> forClass = type.getPhysical();
TypeTree inputType = TypeTreeCreator.createTypeTree(forClass, notes[i]);
inputInstances.add(inputType);
i++;
}
}
operationTypes.setInputType(inputInstances);
operationsCache.put(operation, operationTypes);
} catch (RequestConfigurationException e) {
throw e;
}
}
}
private Operation getOperation4Name(String operationName) {
Method method = operationsMap.get(operationName);
return methodOperationMapping.get(method);
}
public OperationTypes getOperationTypes(String operationName) {
return operationsCache.get(getOperation4Name(operationName));
}
public Object invoke(String operationName, List<Object> arguments) throws InvocationException {
Object result = null;
try {
result = wire.invoke(getOperation4Name(operationName), arguments.toArray());
} catch (InvocationTargetException e) {
InvocationException exception = new InvocationException(e.getCause());
throw exception;
}
return result;
}
}
|
923f9e36e2e504a12c6eb8d7d40feb09faf738e0
| 112 |
java
|
Java
|
spring-in-5-steps/src/main/java/com/tm/srping/basics/springin5steps/basic/SortAlgo.java
|
bksinha4497/Spring
|
c61b43abdd672f328c3863a434384f364630b7e7
|
[
"Unlicense"
] | null | null | null |
spring-in-5-steps/src/main/java/com/tm/srping/basics/springin5steps/basic/SortAlgo.java
|
bksinha4497/Spring
|
c61b43abdd672f328c3863a434384f364630b7e7
|
[
"Unlicense"
] | null | null | null |
spring-in-5-steps/src/main/java/com/tm/srping/basics/springin5steps/basic/SortAlgo.java
|
bksinha4497/Spring
|
c61b43abdd672f328c3863a434384f364630b7e7
|
[
"Unlicense"
] | null | null | null | 14 | 50 | 0.741071 | 1,001,233 |
package com.tm.srping.basics.springin5steps.basic;
public interface SortAlgo {
int[] sort(int[] numbers);
}
|
923f9fcf3bf061d8272104368e1990056ae51cdd
| 1,490 |
java
|
Java
|
app/src/main/java/com/androidumloader/cache/memory/BaseMemoryCache.java
|
caopeng000/AndroidUMLoader
|
1f980579a1a298e297d0e89d2c425e7fb07c58b6
|
[
"Apache-2.0"
] | 1 |
2017-04-26T03:55:22.000Z
|
2017-04-26T03:55:22.000Z
|
app/src/main/java/com/androidumloader/cache/memory/BaseMemoryCache.java
|
caopeng000/AndroidUMLoader
|
1f980579a1a298e297d0e89d2c425e7fb07c58b6
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/com/androidumloader/cache/memory/BaseMemoryCache.java
|
caopeng000/AndroidUMLoader
|
1f980579a1a298e297d0e89d2c425e7fb07c58b6
|
[
"Apache-2.0"
] | 2 |
2017-04-26T03:55:23.000Z
|
2020-10-20T03:00:48.000Z
| 25.254237 | 129 | 0.610738 | 1,001,234 |
package com.androidumloader.cache.memory;
import android.graphics.Bitmap;
import java.lang.ref.Reference;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
/******************************************
* 类名称:BaseMemoryCache
* 类描述:
*
* @version: 2.3.1
* @author: caopeng
* @time: 2017/4/24 17:04
******************************************/
public abstract class BaseMemoryCache implements MemoryCache {
private final Map<String, Reference<Bitmap>> softMap = Collections.synchronizedMap(new HashMap<String, Reference<Bitmap>>());
@Override
public boolean put(String key, Bitmap value) {
softMap.put(key, createReference(value));
return true;
}
@Override
public Bitmap get(String key) {
Bitmap result = null;
Reference<Bitmap> reference = softMap.get(key);
if (reference != null) {
result = reference.get();
}
return result;
}
@Override
public Bitmap remove(String key) {
Reference<Bitmap> bmpRef = softMap.remove(key);
return bmpRef == null ? null : bmpRef.get();
}
@Override
public Collection<String> keys() {
synchronized (softMap) {
return new HashSet<String>(softMap.keySet());
}
}
@Override
public void clear() {
softMap.clear();
}
protected abstract Reference<Bitmap> createReference(Bitmap value);
}
|
923fa0e2e08d62dbac8990022d3e880b67632e96
| 230 |
java
|
Java
|
src/test/java/org/psjava/algo/geometry/convexhull/JarvisMarchTest.java
|
psjava/psjava
|
73622c365c3b29343268664fcb0aba0fab647c9b
|
[
"MIT"
] | 58 |
2015-02-19T12:58:33.000Z
|
2022-02-17T17:29:38.000Z
|
src/test/java/org/psjava/algo/geometry/convexhull/JarvisMarchTest.java
|
psjava/psjava
|
73622c365c3b29343268664fcb0aba0fab647c9b
|
[
"MIT"
] | 2 |
2015-03-03T09:03:17.000Z
|
2016-05-16T08:07:12.000Z
|
src/test/java/org/psjava/algo/geometry/convexhull/JarvisMarchTest.java
|
psjava/psjava
|
73622c365c3b29343268664fcb0aba0fab647c9b
|
[
"MIT"
] | 22 |
2015-02-19T12:55:35.000Z
|
2022-03-24T22:11:01.000Z
| 20.909091 | 66 | 0.756522 | 1,001,235 |
package org.psjava.algo.geometry.convexhull;
public class JarvisMarchTest extends ConvexHullAlgorithmTestBase {
@Override
protected ConvexHullAlgorithm getAlgorithm() {
return JarvisMarch.getInstance();
}
}
|
923fa17560a4af2208cbb139d68d6fce4bd3c34f
| 1,838 |
java
|
Java
|
src/test/java/tech/jhipster/lite/generator/server/javatool/base/domain/JavaBaseModuleFactoryTest.java
|
Bolo89/jhipster-lite
|
b7033059312b3a90924625acf97e52dcb659c198
|
[
"Apache-2.0"
] | 96 |
2021-12-09T21:11:33.000Z
|
2022-03-27T01:10:33.000Z
|
src/test/java/tech/jhipster/lite/generator/server/javatool/base/domain/JavaBaseModuleFactoryTest.java
|
jhipster/jhipster-lite
|
f794b0fb994d363be20ed4f6b101bf393b069633
|
[
"Apache-2.0"
] | 839 |
2021-12-09T22:05:23.000Z
|
2022-03-31T14:31:57.000Z
|
src/test/java/tech/jhipster/lite/generator/server/javatool/base/domain/JavaBaseModuleFactoryTest.java
|
Bolo89/jhipster-lite
|
b7033059312b3a90924625acf97e52dcb659c198
|
[
"Apache-2.0"
] | 29 |
2021-12-09T22:47:21.000Z
|
2022-03-30T07:43:12.000Z
| 35.346154 | 103 | 0.726877 | 1,001,236 |
package tech.jhipster.lite.generator.server.javatool.base.domain;
import static tech.jhipster.lite.generator.module.infrastructure.secondary.JHipsterModulesAssertions.*;
import org.junit.jupiter.api.Test;
import tech.jhipster.lite.UnitTest;
import tech.jhipster.lite.common.domain.FileUtils;
import tech.jhipster.lite.generator.module.domain.JHipsterModule;
@UnitTest
class JavaBaseModuleFactoryTest {
private static final JavaBaseModuleFactory factory = new JavaBaseModuleFactory();
@Test
void shouldCreateModule() {
JavaBaseModuleProperties properties = JavaBaseModuleProperties
.builder()
.project(FileUtils.tmpDirForTest())
.basePackage("com.jhipster.test")
.projectBaseName("myapp")
.build();
JHipsterModule module = factory.buildModule(properties);
assertThatModule(module)
.createPrefixedFiles(
"src/main/java/com/jhipster/test/error/domain",
"Assert.java",
"MissingMandatoryValueException.java",
"AssertionException.java",
"NotAfterTimeException.java",
"NotBeforeTimeException.java",
"NullElementInCollectionException.java",
"NumberValueTooHighException.java",
"NumberValueTooLowException.java",
"StringTooLongException.java",
"StringTooShortException.java",
"TooManyElementsException.java"
)
.createJavaTests(
"com/jhipster/test/error/domain/AssertTest.java",
"com/jhipster/test/error/domain/MissingMandatoryValueExceptionTest.java",
"com/jhipster/test/common/domain/MyappCollectionsTest.java",
"com/jhipster/test/UnitTest.java",
"com/jhipster/test/ReplaceCamelCase.java"
)
.createFile("src/main/java/com/jhipster/test/common/domain/MyappCollections.java")
.containing("class MyappCollections");
}
}
|
923fa2035dfeec5353d8a88ac8f65760dcb92f3e
| 30,630 |
java
|
Java
|
browsermob-core/src/main/java/net/lightbody/bmp/proxy/jetty/jetty/servlet/WebApplicationHandler.java
|
YangMann/browsermob-proxy
|
736ccd671011e0a0cbf372fb012b662ea3d8b569
|
[
"Apache-2.0"
] | 1,683 |
2015-01-02T20:54:07.000Z
|
2022-03-31T02:00:50.000Z
|
browsermob-core/src/main/java/net/lightbody/bmp/proxy/jetty/jetty/servlet/WebApplicationHandler.java
|
YangMann/browsermob-proxy
|
736ccd671011e0a0cbf372fb012b662ea3d8b569
|
[
"Apache-2.0"
] | 605 |
2015-01-08T10:08:05.000Z
|
2022-03-31T15:40:26.000Z
|
browsermob-core/src/main/java/net/lightbody/bmp/proxy/jetty/jetty/servlet/WebApplicationHandler.java
|
YangMann/browsermob-proxy
|
736ccd671011e0a0cbf372fb012b662ea3d8b569
|
[
"Apache-2.0"
] | 604 |
2015-01-21T16:52:00.000Z
|
2022-03-24T14:45:46.000Z
| 36.377672 | 155 | 0.524421 | 1,001,237 |
// ========================================================================
// $Id: WebApplicationHandler.java,v 1.62 2006/01/04 13:55:31 gregwilkins Exp $
// Copyright 1996-2004 Mort Bay Consulting Pty. 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 net.lightbody.bmp.proxy.jetty.jetty.servlet;
import net.lightbody.bmp.proxy.jetty.http.HttpContext;
import net.lightbody.bmp.proxy.jetty.http.HttpResponse;
import net.lightbody.bmp.proxy.jetty.http.PathMap;
import net.lightbody.bmp.proxy.jetty.log.LogFactory;
import net.lightbody.bmp.proxy.jetty.util.*;
import org.apache.commons.logging.Log;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.IOException;
import java.util.*;
/* --------------------------------------------------------------------- */
/** WebApp HttpHandler.
* This handler extends the ServletHandler with security, filter and resource
* capabilities to provide full J2EE web container support.
* <p>
* @since Jetty 4.1
* @see net.lightbody.bmp.proxy.jetty.jetty.servlet.WebApplicationContext
* @version $Id: WebApplicationHandler.java,v 1.62 2006/01/04 13:55:31 gregwilkins Exp $
* @author Greg Wilkins
*/
public class WebApplicationHandler extends ServletHandler
{
private static Log log= LogFactory.getLog(WebApplicationHandler.class);
private Map _filterMap= new HashMap();
private List _pathFilters= new ArrayList();
private List _filters= new ArrayList();
private MultiMap _servletFilterMap= new MultiMap();
private boolean _acceptRanges= true;
private boolean _filterChainsCached=true;
private transient WebApplicationContext _webApplicationContext;
protected transient Object _requestListeners;
protected transient Object _requestAttributeListeners;
protected transient Object _sessionListeners;
protected transient Object _contextAttributeListeners;
protected transient FilterHolder jsr154FilterHolder;
protected transient JSR154Filter jsr154Filter;
protected transient HashMap _chainCache[];
protected transient HashMap _namedChainCache[];
/* ------------------------------------------------------------ */
public boolean isAcceptRanges()
{
return _acceptRanges;
}
/* ------------------------------------------------------------ */
/** Set if the handler accepts range requests.
* Default is false;
* @param ar True if the handler should accept ranges
*/
public void setAcceptRanges(boolean ar)
{
_acceptRanges= ar;
}
/* ------------------------------------------------------------ */
/**
* @return Returns the jsr154Filter.
*/
public JSR154Filter getJsr154Filter()
{
return jsr154Filter;
}
/* ------------------------------------------------------------ */
public FilterHolder defineFilter(String name, String className)
{
FilterHolder holder= newFilterHolder(name,className);
addFilterHolder(holder);
return holder;
}
/* ------------------------------------------------------------ */
protected FilterHolder newFilterHolder(String name, String className)
{
return new FilterHolder(this, name, className);
}
/* ------------------------------------------------------------ */
public void addFilterHolder(FilterHolder holder)
{
_filterMap.put(holder.getName(), holder);
_filters.add(holder);
addComponent(holder);
}
/* ------------------------------------------------------------ */
public FilterHolder getFilter(String name)
{
return (FilterHolder)_filterMap.get(name);
}
/* ------------------------------------------------------------ */
/** Add a mapping from a pathSpec to a Filter.
* @param pathSpec The path specification
* @param filterName The name of the filter (must already be added or defined)
* @param dispatches An integer formed by the logical OR of FilterHolder.__REQUEST,
* FilterHolder.__FORWARD,FilterHolder.__INCLUDE and/or FilterHolder.__ERROR.
* @return The holder of the filter instance.
*/
public FilterHolder addFilterPathMapping(String pathSpec, String filterName, int dispatches)
{
FilterHolder holder = (FilterHolder)_filterMap.get(filterName);
if (holder==null)
throw new IllegalArgumentException("unknown filter: "+filterName);
FilterMapping mapping = new FilterMapping(pathSpec,holder,dispatches);
_pathFilters.add(mapping);
return holder;
}
/* ------------------------------------------------------------ */
/**
* Add a servlet filter mapping
* @param servletName The name of the servlet to be filtered.
* @param filterName The name of the filter.
* @param dispatches An integer formed by the logical OR of FilterHolder.__REQUEST,
* FilterHolder.__FORWARD,FilterHolder.__INCLUDE and/or FilterHolder.__ERROR.
* @return The holder of the filter instance.
*/
public FilterHolder addFilterServletMapping(String servletName, String filterName, int dispatches)
{
FilterHolder holder= (FilterHolder)_filterMap.get(filterName);
if (holder == null)
throw new IllegalArgumentException("Unknown filter :" + filterName);
_servletFilterMap.add(servletName, new FilterMapping(null,holder,dispatches));
return holder;
}
/* ------------------------------------------------------------ */
public List getFilters()
{
return _filters;
}
/* ------------------------------------------------------------ */
public synchronized void addEventListener(EventListener listener)
throws IllegalArgumentException
{
if ((listener instanceof HttpSessionActivationListener)
|| (listener instanceof HttpSessionAttributeListener)
|| (listener instanceof HttpSessionBindingListener)
|| (listener instanceof HttpSessionListener))
{
if (_sessionManager != null)
_sessionManager.addEventListener(listener);
_sessionListeners= LazyList.add(_sessionListeners, listener);
}
if (listener instanceof ServletRequestListener)
{
_requestListeners= LazyList.add(_requestListeners, listener);
}
if (listener instanceof ServletRequestAttributeListener)
{
_requestAttributeListeners= LazyList.add(_requestAttributeListeners, listener);
}
if (listener instanceof ServletContextAttributeListener)
{
_contextAttributeListeners= LazyList.add(_contextAttributeListeners, listener);
}
super.addEventListener(listener);
}
/* ------------------------------------------------------------ */
public synchronized void removeEventListener(EventListener listener)
{
if (_sessionManager != null)
_sessionManager.removeEventListener(listener);
_sessionListeners= LazyList.remove(_sessionListeners, listener);
_requestListeners= LazyList.remove(_requestListeners, listener);
_requestAttributeListeners= LazyList.remove(_requestAttributeListeners, listener);
_contextAttributeListeners= LazyList.remove(_contextAttributeListeners, listener);
super.removeEventListener(listener);
}
/* ------------------------------------------------------------ */
public void setSessionManager(SessionManager sm)
{
if (isStarted())
throw new IllegalStateException("Started");
SessionManager old= getSessionManager();
if (getHttpContext() != null)
{
// recover config and remove listeners from old session manager
if (old != null && old != sm)
{
if (_sessionListeners != null)
{
for (Iterator i= LazyList.iterator(_sessionListeners); i.hasNext();)
{
EventListener listener= (EventListener)i.next();
_sessionManager.removeEventListener(listener);
}
}
}
// Set listeners and config on new listener.
if (sm != null && old != sm)
{
if (_sessionListeners != null)
{
for (Iterator i= LazyList.iterator(_sessionListeners); i.hasNext();)
{
EventListener listener= (EventListener)i.next();
sm.addEventListener(listener);
}
}
}
}
super.setSessionManager(sm);
}
/* ----------------------------------------------------------------- */
protected synchronized void doStart() throws Exception
{
// Start Servlet Handler
super.doStart();
if (log.isDebugEnabled())
log.debug("Path Filters: " + _pathFilters);
if (log.isDebugEnabled())
log.debug("Servlet Filters: " + _servletFilterMap);
if (getHttpContext() instanceof WebApplicationContext)
_webApplicationContext= (WebApplicationContext)getHttpContext();
if (_filterChainsCached)
{
_chainCache = getChainCache();
_namedChainCache = getChainCache();
}
}
/* ----------------------------------------------------------------- */
private HashMap[] getChainCache() {
HashMap[] _chainCache=new HashMap[Dispatcher.__ERROR+1];
_chainCache[Dispatcher.__REQUEST]=new HashMap();
_chainCache[Dispatcher.__FORWARD]=new HashMap();
_chainCache[Dispatcher.__INCLUDE]=new HashMap();
_chainCache[Dispatcher.__ERROR]=new HashMap();
return _chainCache;
}
/* ------------------------------------------------------------ */
public void initializeServlets() throws Exception
{
// initialize Filters
MultiException mex= new MultiException();
Iterator iter= _filters.iterator();
while (iter.hasNext())
{
FilterHolder holder= (FilterHolder)iter.next();
try
{
holder.start();
}
catch (Exception e)
{
mex.add(e);
}
}
// initialize Servlets
try
{
super.initializeServlets();
}
catch (Exception e)
{
mex.add(e);
}
jsr154FilterHolder=getFilter("jsr154");
if (jsr154FilterHolder!=null)
jsr154Filter= (JSR154Filter)jsr154FilterHolder.getFilter();
log.debug("jsr154filter="+jsr154Filter);
if (LazyList.size(_requestAttributeListeners) > 0 || LazyList.size(_requestListeners) > 0)
{
if (jsr154Filter==null)
log.warn("Filter jsr154 not defined for RequestAttributeListeners");
else
{
jsr154Filter.setRequestAttributeListeners(_requestAttributeListeners);
jsr154Filter.setRequestListeners(_requestListeners);
}
}
mex.ifExceptionThrow();
}
/* ------------------------------------------------------------ */
protected synchronized void doStop() throws Exception
{
try
{
// Stop servlets
super.doStop();
// Stop filters
for (int i= _filters.size(); i-- > 0;)
{
FilterHolder holder= (FilterHolder)_filters.get(i);
holder.stop();
}
}
finally
{
_webApplicationContext= null;
_sessionListeners= null;
_requestListeners= null;
_requestAttributeListeners= null;
_contextAttributeListeners= null;
}
}
/* ------------------------------------------------------------ */
public String getErrorPage(int status, ServletHttpRequest request)
{
String error_page= null;
Class exClass= (Class)request.getAttribute(__J_S_ERROR_EXCEPTION_TYPE);
if (ServletException.class.equals(exClass))
{
error_page= _webApplicationContext.getErrorPage(exClass.getName());
if (error_page == null)
{
Throwable th= (Throwable)request.getAttribute(__J_S_ERROR_EXCEPTION);
while (th instanceof ServletException)
th= ((ServletException)th).getRootCause();
if (th != null)
exClass= th.getClass();
}
}
if (error_page == null && exClass != null)
{
while (error_page == null && exClass != null && _webApplicationContext != null)
{
error_page= _webApplicationContext.getErrorPage(exClass.getName());
exClass= exClass.getSuperclass();
}
if (error_page == null)
{}
}
if (error_page == null && _webApplicationContext != null)
error_page= _webApplicationContext.getErrorPage(TypeUtil.toString(status));
return error_page;
}
/* ------------------------------------------------------------ */
protected void dispatch(String pathInContext,
HttpServletRequest request,
HttpServletResponse response,
ServletHolder servletHolder,
int type)
throws ServletException, UnavailableException, IOException
{
if (type == Dispatcher.__REQUEST)
{
// This is NOT a dispatched request (it it is an initial request)
ServletHttpRequest servletHttpRequest= (ServletHttpRequest)request;
ServletHttpResponse servletHttpResponse= (ServletHttpResponse)response;
// protect web-inf and meta-inf
if (StringUtil.startsWithIgnoreCase(pathInContext, "/web-inf") || StringUtil.startsWithIgnoreCase(pathInContext, "/meta-inf"))
{
response.sendError(HttpResponse.__404_Not_Found);
return;
}
// Security Check
if (!getHttpContext().checkSecurityConstraints(
pathInContext,
servletHttpRequest.getHttpRequest(),
servletHttpResponse.getHttpResponse()))
return;
}
else
{
// This is a dispatched request.
// Handle dispatch to j_security_check
HttpContext context= getHttpContext();
if (context != null
&& context instanceof ServletHttpContext
&& pathInContext != null
&& pathInContext.endsWith(FormAuthenticator.__J_SECURITY_CHECK))
{
ServletHttpRequest servletHttpRequest=
(ServletHttpRequest)context.getHttpConnection().getRequest().getWrapper();
ServletHttpResponse servletHttpResponse= servletHttpRequest.getServletHttpResponse();
ServletHttpContext servletContext= (ServletHttpContext)context;
if (!servletContext.jSecurityCheck(pathInContext,servletHttpRequest.getHttpRequest(),servletHttpResponse.getHttpResponse()))
return;
}
}
// Build and/or cache filter chain
FilterChain chain=null;
if (pathInContext != null) {
chain = getChainForPath(type, pathInContext, servletHolder);
} else {
chain = getChainForName(type, servletHolder);
}
if (log.isDebugEnabled()) log.debug("chain="+chain);
// Do the handling thang
if (chain!=null)
chain.doFilter(request, response);
else if (servletHolder != null)
servletHolder.handle(request, response);
else // Not found
notFound(request, response);
}
/* ------------------------------------------------------------ */
private FilterChain getChainForName(int requestType, ServletHolder servletHolder) {
if (servletHolder == null) {
throw new IllegalStateException("Named dispatch must be to an explicitly named servlet");
}
if (_filterChainsCached)
{
synchronized(this)
{
if (_namedChainCache[requestType].containsKey(servletHolder.getName()))
return (FilterChain)_namedChainCache[requestType].get(servletHolder.getName());
}
}
// Build list of filters
Object filters= null;
if (jsr154Filter!=null)
{
// Slight hack for Named servlets
// TODO query JSR how to apply filter to all dispatches
filters=LazyList.add(filters,jsr154FilterHolder);
}
// Servlet filters
if (_servletFilterMap.size() > 0)
{
Object o= _servletFilterMap.get(servletHolder.getName());
for (int i=0; i<LazyList.size(o);i++)
{
FilterMapping mapping = (FilterMapping)LazyList.get(o,i);
if (mapping.appliesTo(null,requestType))
filters=LazyList.add(filters,mapping.getHolder());
}
}
FilterChain chain = null;
if (_filterChainsCached)
{
synchronized(this)
{
if (LazyList.size(filters) > 0)
chain= new CachedChain(filters, servletHolder);
_namedChainCache[requestType].put(servletHolder.getName(),chain);
}
}
else if (LazyList.size(filters) > 0)
chain = new Chain(filters, servletHolder);
return chain;
}
/* ------------------------------------------------------------ */
private FilterChain getChainForPath(int requestType, String pathInContext, ServletHolder servletHolder)
{
if (_filterChainsCached)
{
synchronized(this)
{
if(_chainCache[requestType].containsKey(pathInContext))
return (FilterChain)_chainCache[requestType].get(pathInContext);
}
}
// Build list of filters
Object filters= null;
// Path filters
for (int i= 0; i < _pathFilters.size(); i++)
{
FilterMapping mapping = (FilterMapping)_pathFilters.get(i);
if (mapping.appliesTo(pathInContext, requestType))
filters= LazyList.add(filters, mapping.getHolder());
}
// Servlet filters
if (servletHolder != null && _servletFilterMap.size() > 0)
{
Object o= _servletFilterMap.get(servletHolder.getName());
for (int i=0; i<LazyList.size(o);i++)
{
FilterMapping mapping = (FilterMapping)LazyList.get(o,i);
if (mapping.appliesTo(null,requestType))
filters=LazyList.add(filters,mapping.getHolder());
}
}
FilterChain chain = null;
if (_filterChainsCached)
{
synchronized(this)
{
if (LazyList.size(filters) > 0)
chain= new CachedChain(filters, servletHolder);
_chainCache[requestType].put(pathInContext,chain);
}
}
else if (LazyList.size(filters) > 0)
chain = new Chain(filters, servletHolder);
return chain;
}
/* ------------------------------------------------------------ */
public synchronized void setContextAttribute(String name, Object value)
{
Object old= super.getContextAttribute(name);
super.setContextAttribute(name, value);
if (_contextAttributeListeners != null)
{
ServletContextAttributeEvent event=
new ServletContextAttributeEvent(getServletContext(), name, old != null ? old : value);
for (int i= 0; i < LazyList.size(_contextAttributeListeners); i++)
{
ServletContextAttributeListener l=
(ServletContextAttributeListener)LazyList.get(_contextAttributeListeners, i);
if (old == null)
l.attributeAdded(event);
else
if (value == null)
l.attributeRemoved(event);
else
l.attributeReplaced(event);
}
}
}
/* ------------------------------------------------------------ */
public synchronized void removeContextAttribute(String name)
{
Object old= super.getContextAttribute(name);
super.removeContextAttribute(name);
if (old != null && _contextAttributeListeners != null)
{
ServletContextAttributeEvent event= new ServletContextAttributeEvent(getServletContext(), name, old);
for (int i= 0; i < LazyList.size(_contextAttributeListeners); i++)
{
ServletContextAttributeListener l=
(ServletContextAttributeListener)LazyList.get(_contextAttributeListeners, i);
l.attributeRemoved(event);
}
}
}
/* ------------------------------------------------------------ */
/**
* @return Returns the filterChainsCached.
*/
public boolean isFilterChainsCached()
{
return _filterChainsCached;
}
/* ------------------------------------------------------------ */
/** Cache filter chains.
* If true, filter chains are cached by the URI path within the
* context. Caching should not be used if the webapp encodes
* information in URLs.
* @param filterChainsCached The filterChainsCached to set.
*/
public void setFilterChainsCached(boolean filterChainsCached)
{
_filterChainsCached = filterChainsCached;
}
/* ------------------------------------------------------------ */
/**
* @see net.lightbody.bmp.proxy.jetty.util.Container#addComponent(java.lang.Object)
*/
protected void addComponent(Object o)
{
if (_filterChainsCached && isStarted())
{
synchronized(this)
{
for (int i=0;i<_chainCache.length;i++)
if (_chainCache[i]!=null)
_chainCache[i].clear();
}
}
super.addComponent(o);
}
/* ------------------------------------------------------------ */
/**
* @see net.lightbody.bmp.proxy.jetty.util.Container#removeComponent(java.lang.Object)
*/
protected void removeComponent(Object o)
{
if (_filterChainsCached && isStarted())
{
synchronized(this)
{
for (int i=0;i<_chainCache.length;i++)
if (_chainCache[i]!=null)
_chainCache[i].clear();
}
}
super.removeComponent(o);
}
/* ----------------------------------------------------------------- */
public void destroy()
{
Iterator iter = _filterMap.values().iterator();
while (iter.hasNext())
{
Object sh=iter.next();
iter.remove();
removeComponent(sh);
}
}
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
private static class FilterMapping
{
private String _pathSpec;
private FilterHolder _holder;
private int _dispatches;
/* ------------------------------------------------------------ */
FilterMapping(String pathSpec,FilterHolder holder,int dispatches)
{
_pathSpec=pathSpec;
_holder=holder;
_dispatches=dispatches;
}
/* ------------------------------------------------------------ */
FilterHolder getHolder()
{
return _holder;
}
/* ------------------------------------------------------------ */
/** Check if this filter applies to a path.
* @param path The path to check.
* @param type The type of request: __REQUEST,__FORWARD,__INCLUDE or __ERROR.
* @return True if this filter applies
*/
boolean appliesTo(String path, int type)
{
boolean b=((_dispatches&type)!=0 || (_dispatches==0 && type==Dispatcher.__REQUEST)) && (_pathSpec==null || PathMap.match(_pathSpec, path,true));
return b;
}
}
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
private class Chain implements FilterChain
{
int _filter= 0;
Object _filters;
ServletHolder _servletHolder;
/* ------------------------------------------------------------ */
Chain(Object filters, ServletHolder servletHolder)
{
_filters= filters;
_servletHolder= servletHolder;
}
/* ------------------------------------------------------------ */
public void doFilter(ServletRequest request, ServletResponse response)
throws IOException, ServletException
{
if (log.isTraceEnabled())
log.trace("doFilter " + _filter);
// pass to next filter
if (_filter < LazyList.size(_filters))
{
FilterHolder holder= (FilterHolder)LazyList.get(_filters, _filter++);
if (log.isTraceEnabled())
log.trace("call filter " + holder);
Filter filter= holder.getFilter();
filter.doFilter(request, response, this);
return;
}
// Call servlet
if (_servletHolder != null)
{
if (log.isTraceEnabled())
log.trace("call servlet " + _servletHolder);
_servletHolder.handle(request, response);
}
else // Not found
notFound((HttpServletRequest)request, (HttpServletResponse)response);
}
public String toString()
{
StringBuffer b = new StringBuffer();
for (int i=0; i<LazyList.size(_filters);i++)
{
b.append(LazyList.get(_filters, i).toString());
b.append("->");
}
b.append(_servletHolder);
return b.toString();
}
}
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
/* ------------------------------------------------------------ */
private class CachedChain implements FilterChain
{
FilterHolder _filterHolder;
ServletHolder _servletHolder;
CachedChain _next;
/* ------------------------------------------------------------ */
CachedChain(Object filters, ServletHolder servletHolder)
{
if (LazyList.size(filters)>0)
{
_filterHolder=(FilterHolder)LazyList.get(filters, 0);
filters=LazyList.remove(filters,0);
_next=new CachedChain(filters,servletHolder);
}
else
_servletHolder=servletHolder;
}
public void doFilter(ServletRequest request, ServletResponse response)
throws IOException, ServletException
{
// pass to next filter
if (_filterHolder!=null)
{
if (log.isTraceEnabled())
log.trace("call filter " + _filterHolder);
Filter filter= _filterHolder.getFilter();
filter.doFilter(request, response, _next);
return;
}
// Call servlet
if (_servletHolder != null)
{
if (log.isTraceEnabled())
log.trace("call servlet " + _servletHolder);
_servletHolder.handle(request, response);
}
else // Not found
notFound((HttpServletRequest)request, (HttpServletResponse)response);
}
public String toString()
{
if (_filterHolder!=null)
return _filterHolder+"->"+_next.toString();
if (_servletHolder!=null)
return _servletHolder.toString();
return "null";
}
}
public static void main(String[] arg)
{
ServletHandler mServletHandler = new ServletHandler();
ServletHolder servletHolder = mServletHandler.addServlet("/mPath",
"wicket.protocol.http.WicketServlet");
servletHolder.getServletContext().setAttribute("webApplication", "mWebApplication");
servletHolder.getServletContext().setAttribute ("applicationContext", "mApplicationContext");
WebApplicationHandler mWebApplicationHandler = new WebApplicationHandler();
ServletHolder servletHolder2 = mWebApplicationHandler.addServlet("/mpath",
"wicket.protocol.http.WicketServlet");
servletHolder2.getServletContext().setAttribute("webApplication", "mWebApplication");
servletHolder2.getServletContext().setAttribute ("applicationContext", "mApplicationContext");
}
}
|
923fa4bdc47b53af075ed88d1a0c1a3a6ba7f4d9
| 8,159 |
java
|
Java
|
infra/prism/src/test/java/com/evolveum/midpoint/prism/foo/EventOperationFilterType.java
|
vitalikc/testmidpoint
|
3822e4b013dbeb703550a2a81cc63dca5c66b6bb
|
[
"Apache-2.0"
] | 27 |
2017-04-27T15:15:08.000Z
|
2021-12-12T10:53:16.000Z
|
infra/prism/src/test/java/com/evolveum/midpoint/prism/foo/EventOperationFilterType.java
|
vitalikc/testmidpoint
|
3822e4b013dbeb703550a2a81cc63dca5c66b6bb
|
[
"Apache-2.0"
] | 2 |
2016-11-28T12:47:14.000Z
|
2016-11-30T07:42:43.000Z
|
infra/prism/src/test/java/com/evolveum/midpoint/prism/foo/EventOperationFilterType.java
|
vitalikc/testmidpoint
|
3822e4b013dbeb703550a2a81cc63dca5c66b6bb
|
[
"Apache-2.0"
] | 6 |
2017-04-02T15:52:32.000Z
|
2021-12-12T10:53:23.000Z
| 35.168103 | 195 | 0.635862 | 1,001,238 |
/*
* Copyright (c) 2010-2014 Evolveum
*
* 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.evolveum.midpoint.prism.foo;
import com.evolveum.midpoint.util.xml.DomAwareEqualsStrategy;
import com.evolveum.midpoint.util.xml.DomAwareHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* <p>Java class for EventOperationFilterType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="EventOperationFilterType">
* <complexContent>
* <extension base="{http://midpoint.evolveum.com/xml/ns/public/common/common-3}EventHandlerType">
* <sequence>
* <element name="operation" type="{http://midpoint.evolveum.com/xml/ns/public/common/common-3}EventOperationType" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "EventOperationFilterType", propOrder = {
"operation"
})
public class EventOperationFilterType
extends EventHandlerType
implements Serializable, Cloneable, Equals, HashCode
{
private final static long serialVersionUID = 201105211233L;
protected List<String> operation;
/**
* Creates a new {@code EventOperationFilterType} instance.
*
*/
public EventOperationFilterType() {
// CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
super();
}
/**
* Creates a new {@code EventOperationFilterType} instance by deeply copying a given {@code EventOperationFilterType} instance.
*
*
* @param o
* The instance to copy.
* @throws NullPointerException
* if {@code o} is {@code null}.
*/
public EventOperationFilterType(final EventOperationFilterType o) {
// CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
super(o);
if (o == null) {
throw new NullPointerException("Cannot create a copy of 'EventOperationFilterType' from 'null'.");
}
// 'Operation' collection.
if (o.operation!= null) {
copyOperation(o.getOperation(), this.getOperation());
}
}
/**
* Gets the value of the operation property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the operation property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getOperation().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link EventOperationType }
*
*
*/
public List<String> getOperation() {
if (operation == null) {
operation = new ArrayList<String>();
}
return this.operation;
}
/**
* Generates a String representation of the contents of this type.
* This is an extension method, produced by the 'ts' xjc plugin
*
*/
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = super.hashCode(locator, strategy);
{
List<String> theOperation;
theOperation = (((this.operation!= null)&&(!this.operation.isEmpty()))?this.getOperation():null);
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "operation", theOperation), currentHashCode, theOperation);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = DomAwareHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof EventOperationFilterType)) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(thisLocator, thatLocator, object, strategy)) {
return false;
}
final EventOperationFilterType that = ((EventOperationFilterType) object);
{
List<String> lhsOperation;
lhsOperation = (((this.operation!= null)&&(!this.operation.isEmpty()))?this.getOperation():null);
List<String> rhsOperation;
rhsOperation = (((that.operation!= null)&&(!that.operation.isEmpty()))?that.getOperation():null);
if (!strategy.equals(LocatorUtils.property(thisLocator, "operation", lhsOperation), LocatorUtils.property(thatLocator, "operation", rhsOperation), lhsOperation, rhsOperation)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = DomAwareEqualsStrategy.INSTANCE;
return equals(null, null, object, strategy);
}
/**
* Copies all values of property {@code Operation} deeply.
*
* @param source
* The source to copy from.
* @param target
* The target to copy {@code source} to.
* @throws NullPointerException
* if {@code target} is {@code null}.
*/
@SuppressWarnings("unchecked")
private static void copyOperation(final List<String> source, final List<String> target) {
// CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
if ((source!= null)&&(!source.isEmpty())) {
for (final Iterator<?> it = source.iterator(); it.hasNext(); ) {
final Object next = it.next();
if (next instanceof String) {
// CEnumLeafInfo: com.evolveum.midpoint.xml.ns._public.common.common_3.EventOperationType
target.add(((String) next));
continue;
}
// Please report this at https://apps.sourceforge.net/mantisbt/ccxjc/
throw new AssertionError((("Unexpected instance '"+ next)+"' for property 'Operation' of class 'com.evolveum.midpoint.xml.ns._public.common.common_3.EventOperationFilterType'."));
}
}
}
/**
* Creates and returns a deep copy of this object.
*
*
* @return
* A deep copy of this object.
*/
@Override
public EventOperationFilterType clone() {
{
// CC-XJC Version 2.0 Build 2011-09-16T18:27:24+0000
final EventOperationFilterType clone = ((EventOperationFilterType) super.clone());
// 'Operation' collection.
if (this.operation!= null) {
clone.operation = null;
copyOperation(this.getOperation(), clone.getOperation());
}
return clone;
}
}
@Override
public String toString() {
return "EventOperationFilterType{" +
"operation=" + operation +
'}';
}
}
|
923fa53234852304656045d8639f924634d7d162
| 4,511 |
java
|
Java
|
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/RoutingServiceBusQueueEndpointProperties.java
|
minaltolpadi/azure-sdk-for-java
|
a6bb33fc71f21ee92d4246d6b5fe30ad8a5689cb
|
[
"MIT"
] | 3 |
2021-09-15T16:25:19.000Z
|
2021-12-17T05:41:00.000Z
|
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/RoutingServiceBusQueueEndpointProperties.java
|
minaltolpadi/azure-sdk-for-java
|
a6bb33fc71f21ee92d4246d6b5fe30ad8a5689cb
|
[
"MIT"
] | 306 |
2019-09-27T06:41:56.000Z
|
2019-10-14T08:19:57.000Z
|
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/RoutingServiceBusQueueEndpointProperties.java
|
minaltolpadi/azure-sdk-for-java
|
a6bb33fc71f21ee92d4246d6b5fe30ad8a5689cb
|
[
"MIT"
] | 1 |
2022-01-31T19:22:33.000Z
|
2022-01-31T19:22:33.000Z
| 35.519685 | 383 | 0.702727 | 1,001,239 |
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for
* license information.
*
* Code generated by Microsoft (R) AutoRest Code Generator.
*/
package com.microsoft.azure.management.iothub.v2018_04_01;
import com.fasterxml.jackson.annotation.JsonProperty;
/**
* The properties related to service bus queue endpoint types.
*/
public class RoutingServiceBusQueueEndpointProperties {
/**
* The connection string of the service bus queue endpoint.
*/
@JsonProperty(value = "connectionString", required = true)
private String connectionString;
/**
* The name that identifies this endpoint. The name can only include
* alphanumeric characters, periods, underscores, hyphens and has a maximum
* length of 64 characters. The following names are reserved: events,
* operationsMonitoringEvents, fileNotifications, $default. Endpoint names
* must be unique across endpoint types. The name need not be the same as
* the actual queue name.
*/
@JsonProperty(value = "name", required = true)
private String name;
/**
* The subscription identifier of the service bus queue endpoint.
*/
@JsonProperty(value = "subscriptionId")
private String subscriptionId;
/**
* The name of the resource group of the service bus queue endpoint.
*/
@JsonProperty(value = "resourceGroup")
private String resourceGroup;
/**
* Get the connection string of the service bus queue endpoint.
*
* @return the connectionString value
*/
public String connectionString() {
return this.connectionString;
}
/**
* Set the connection string of the service bus queue endpoint.
*
* @param connectionString the connectionString value to set
* @return the RoutingServiceBusQueueEndpointProperties object itself.
*/
public RoutingServiceBusQueueEndpointProperties withConnectionString(String connectionString) {
this.connectionString = connectionString;
return this;
}
/**
* Get the name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual queue name.
*
* @return the name value
*/
public String name() {
return this.name;
}
/**
* Set the name that identifies this endpoint. The name can only include alphanumeric characters, periods, underscores, hyphens and has a maximum length of 64 characters. The following names are reserved: events, operationsMonitoringEvents, fileNotifications, $default. Endpoint names must be unique across endpoint types. The name need not be the same as the actual queue name.
*
* @param name the name value to set
* @return the RoutingServiceBusQueueEndpointProperties object itself.
*/
public RoutingServiceBusQueueEndpointProperties withName(String name) {
this.name = name;
return this;
}
/**
* Get the subscription identifier of the service bus queue endpoint.
*
* @return the subscriptionId value
*/
public String subscriptionId() {
return this.subscriptionId;
}
/**
* Set the subscription identifier of the service bus queue endpoint.
*
* @param subscriptionId the subscriptionId value to set
* @return the RoutingServiceBusQueueEndpointProperties object itself.
*/
public RoutingServiceBusQueueEndpointProperties withSubscriptionId(String subscriptionId) {
this.subscriptionId = subscriptionId;
return this;
}
/**
* Get the name of the resource group of the service bus queue endpoint.
*
* @return the resourceGroup value
*/
public String resourceGroup() {
return this.resourceGroup;
}
/**
* Set the name of the resource group of the service bus queue endpoint.
*
* @param resourceGroup the resourceGroup value to set
* @return the RoutingServiceBusQueueEndpointProperties object itself.
*/
public RoutingServiceBusQueueEndpointProperties withResourceGroup(String resourceGroup) {
this.resourceGroup = resourceGroup;
return this;
}
}
|
923fa5964ed89dd7bd013b44f14bac1de09d80c1
| 683 |
java
|
Java
|
src/com/connectsdk/discovery/provider/ssdp/Icon.java
|
zvikachu/Connect-SDK-Android-Core
|
d9e0e2137a829863006e7aaa37c5be275a286784
|
[
"Apache-2.0"
] | 102 |
2015-04-09T17:06:28.000Z
|
2022-02-06T03:41:04.000Z
|
src/com/connectsdk/discovery/provider/ssdp/Icon.java
|
zvikachu/Connect-SDK-Android-Core
|
d9e0e2137a829863006e7aaa37c5be275a286784
|
[
"Apache-2.0"
] | 61 |
2015-01-19T08:07:05.000Z
|
2022-02-25T07:10:23.000Z
|
src/com/connectsdk/discovery/provider/ssdp/Icon.java
|
zvikachu/Connect-SDK-Android-Core
|
d9e0e2137a829863006e7aaa37c5be275a286784
|
[
"Apache-2.0"
] | 87 |
2015-01-29T12:17:18.000Z
|
2022-01-28T02:47:45.000Z
| 31.045455 | 59 | 0.669107 | 1,001,240 |
package com.connectsdk.discovery.provider.ssdp;
public class Icon {
static final String TAG = "icon";
static final String TAG_MIME_TYPE = "mimetype";
static final String TAG_WIDTH = "width";
static final String TAG_HEIGHT = "height";
static final String TAG_DEPTH = "depth";
static final String TAG_URL = "url";
/* Required. Icon's MIME type. */
String mimetype;
/* Required. Horizontal dimension of icon in pixels. */
String width;
/* Required. Vertical dimension of icon in pixels. */
String height;
/* Required. Number of color bits per pixel. */
String depth;
/* Required. Pointer to icon image. */
String url;
}
|
923fa6b528bef7971dc0f28ba64d703637872967
| 5,976 |
java
|
Java
|
google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingConfig.java
|
vam-google/java-logging
|
c1d65597ee8ce95dc6276c4f19d13a922c819f0d
|
[
"Apache-2.0"
] | null | null | null |
google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingConfig.java
|
vam-google/java-logging
|
c1d65597ee8ce95dc6276c4f19d13a922c819f0d
|
[
"Apache-2.0"
] | null | null | null |
google-cloud-logging/src/main/java/com/google/cloud/logging/LoggingConfig.java
|
vam-google/java-logging
|
c1d65597ee8ce95dc6276c4f19d13a922c819f0d
|
[
"Apache-2.0"
] | null | null | null | 32.835165 | 100 | 0.713521 | 1,001,241 |
/*
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.cloud.logging;
import static com.google.common.base.MoreObjects.firstNonNull;
import com.google.cloud.MonitoredResource;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Filter;
import java.util.logging.Formatter;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.SimpleFormatter;
class LoggingConfig {
private final LogManager manager = LogManager.getLogManager();
private final String className;
private static final String FLUSH_LEVEL_TAG = "flushLevel";
private static final String LOG_FILENAME_TAG = "log";
private static final String LOG_LEVEL_TAG = "level";
private static final String FILTER_TAG = "filter";
private static final String FORMATTER_TAG = "formatter";
private static final String SYNCHRONICITY_TAG = "synchronicity";
private static final String RESOURCE_TYPE_TAG = "resourceType";
private static final String ENHANCERS_TAG = "enhancers";
private static final String USE_INHERITED_CONTEXT = "useInheritedContext";
private static final String AUTO_POPULATE_METADATA = "autoPopulateMetadata";
private static final String REDIRECT_TO_STDOUT = "redirectToStdout";
public LoggingConfig(String className) {
this.className = className;
}
Level getFlushLevel() {
return getLevelProperty(FLUSH_LEVEL_TAG, LoggingLevel.ERROR);
}
String getLogName() {
return getProperty(LOG_FILENAME_TAG, "java.log");
}
Level getLogLevel() {
return getLevelProperty(LOG_LEVEL_TAG, LoggingLevel.INFO);
}
Filter getFilter() {
return getFilterProperty(FILTER_TAG, null);
}
Synchronicity getSynchronicity() {
String synchronicityStr = getProperty(SYNCHRONICITY_TAG);
try {
return Synchronicity.valueOf(synchronicityStr);
} catch (Exception ex) {
// If we cannot create the Synchronicity we fall back to default value
}
return Synchronicity.ASYNC;
}
Formatter getFormatter() {
return getFormatterProperty(FORMATTER_TAG, new SimpleFormatter());
}
Boolean getAutoPopulateMetadata() {
return getBooleanProperty(AUTO_POPULATE_METADATA, null);
}
Boolean getRedirectToStdout() {
return getBooleanProperty(REDIRECT_TO_STDOUT, null);
}
MonitoredResource getMonitoredResource(String projectId) {
String resourceType = getProperty(RESOURCE_TYPE_TAG, "");
return MonitoredResourceUtil.getResource(projectId, resourceType);
}
List<LoggingEnhancer> getEnhancers() {
String list = getProperty(ENHANCERS_TAG);
try {
List<LoggingEnhancer> enhancers = new ArrayList<>();
if (list != null) {
String[] items = list.split(",");
for (String e_name : items) {
Class<? extends LoggingEnhancer> clazz =
ClassLoader.getSystemClassLoader()
.loadClass(e_name)
.asSubclass(LoggingEnhancer.class);
enhancers.add(clazz.getDeclaredConstructor().newInstance());
}
}
return enhancers;
} catch (Exception ex) {
// If we cannot create the enhancers we fall back to the default
}
return Collections.emptyList();
}
/**
* Returns boolean value of the property {@code
* com.google.cloud.logging.context.ContextHandler.useInheritedContext}. If no value is defined or
* the property does not represent a valid boolean value returns {@code false}.
*
* @return {@code true} or {@code false}
*/
boolean getUseInheritedContext() {
String flag = getProperty(USE_INHERITED_CONTEXT, "FALSE");
return Boolean.parseBoolean(flag);
}
private String getProperty(String name, String defaultValue) {
return firstNonNull(getProperty(name), defaultValue);
}
private Boolean getBooleanProperty(String name, Boolean defaultValue) {
String flag = getProperty(name);
if (flag != null) {
return Boolean.parseBoolean(flag);
}
return defaultValue;
}
private Level getLevelProperty(String name, Level defaultValue) {
String stringLevel = getProperty(name);
if (stringLevel == null) {
return defaultValue;
}
try {
return Level.parse(stringLevel);
} catch (IllegalArgumentException ex) {
// If the level does not exist we fall back to default value
}
return defaultValue;
}
private Filter getFilterProperty(String name, Filter defaultValue) {
String stringFilter = getProperty(name);
try {
if (stringFilter != null) {
Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(stringFilter);
return (Filter) clz.getDeclaredConstructor().newInstance();
}
} catch (Exception ex) {
// If we cannot create the filter we fall back to default value
}
return defaultValue;
}
private Formatter getFormatterProperty(String name, Formatter defaultValue) {
String stringFilter = getProperty(name);
try {
if (stringFilter != null) {
Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(stringFilter);
return (Formatter) clz.getDeclaredConstructor().newInstance();
}
} catch (Exception ex) {
// If we cannot create the filter we fall back to default value
}
return defaultValue;
}
private String getProperty(String propertyName) {
return manager.getProperty(className + "." + propertyName);
}
}
|
923fa7f30e017f817bf3f7a3db4c510763229255
| 7,095 |
java
|
Java
|
limbus-system/src/main/java/com/remondis/limbus/system/ApplicationBuilder.java
|
remondis-it/limbus-engine
|
3e1c5762c928ea98881a826c0e449b5ab6490ce4
|
[
"Apache-2.0"
] | 3 |
2018-05-21T13:34:36.000Z
|
2018-09-20T06:09:09.000Z
|
limbus-system/src/main/java/com/remondis/limbus/system/ApplicationBuilder.java
|
remondis-it/limbus-engine
|
3e1c5762c928ea98881a826c0e449b5ab6490ce4
|
[
"Apache-2.0"
] | 2 |
2020-05-07T13:14:56.000Z
|
2020-05-07T13:20:22.000Z
|
limbus-system/src/main/java/com/remondis/limbus/system/ApplicationBuilder.java
|
remondis-it/limbus-engine
|
3e1c5762c928ea98881a826c0e449b5ab6490ce4
|
[
"Apache-2.0"
] | 1 |
2020-08-09T03:22:35.000Z
|
2020-08-09T03:22:35.000Z
| 41.011561 | 120 | 0.72389 | 1,001,242 |
package com.remondis.limbus.system;
import static java.util.Objects.nonNull;
import static java.util.Objects.requireNonNull;
import java.util.Arrays;
import java.util.HashSet;
//import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import com.remondis.limbus.system.api.LimbusApplication;
import com.remondis.limbus.system.api.LimbusComponent;
import com.remondis.limbus.system.api.ObjectFactory;
import com.remondis.limbus.system.api.PrivateComponent;
import com.remondis.limbus.system.api.PublicComponent;
import com.remondis.limbus.utils.LambdaException;
import com.remondis.limbus.utils.ReflectionUtil;
/**
* Internal class to build a {@link LimbusSystem} from a {@link LimbusApplication} configuration.
*
* @author schuettec
*
*/
public class ApplicationBuilder {
/**
* Builds a {@link SystemConfiguration} to be used to create a {@link LimbusSystem} or a staging environment.
*
* @param applicationClass The application class that defines the application configuration.
* @return Returns a {@link SystemConfiguration} reflecting the component configurations.
* @throws LimbusSystemException Thrown on any error.
*/
public static SystemConfiguration buildConfigurationFromApplicationClass(Class<?> applicationClass)
throws LimbusSystemException {
requireNonNull(applicationClass, "application class must not be null!");
LimbusApplication application = applicationClass.getDeclaredAnnotation(LimbusApplication.class);
ObjectFactory objectFactory = createObjectFactory(application);
SystemConfiguration configuration = new SystemConfiguration();
configuration.setObjectFactory(objectFactory);
if (nonNull(application)) {
importBundles(applicationClass, configuration);
}
addComponentConfigurationFromPackage(applicationClass, configuration);
getComponentConfigurationFromAnnotations(applicationClass).stream()
.forEach(compConf -> {
if (compConf.isPublicComponent()) {
if (configuration.hasPrivateComponent(compConf.getComponentType())) {
configuration.removePrivateComponent(compConf.getComponentType());
}
}
configuration.addComponentConfiguration(compConf);
});
return configuration;
}
private static void addComponentConfigurationFromPackage(Class<?> applicationClass, SystemConfiguration configuration)
throws LimbusSystemException {
String packageName = applicationClass.getPackage()
.getName();
try {
List<String> classNamesFromPackage = ReflectionUtil.getClassNamesFromPackage(packageName);
Set<Class> classes = loadComponentClasses(classNamesFromPackage);
Set<Class> requestTypes = new HashSet<>();
requestTypes.addAll(configuration.getKnownRequestTypes());
requestTypes.addAll(classes.stream()
.filter(filterInterface())
.collect(Collectors.toSet()));
// Minimize the amount of classes to be analyzed
classes.removeAll(requestTypes);
// add public components and collect the private components.
classes.stream()
// Class has to implement one of the request types
.filter(cls -> {
Optional<Class> requestType = requestTypes.stream()
.filter(superType -> superType.isAssignableFrom(cls))
.findFirst();
if (requestType.isPresent()) {
// TODO: We should support failOnError. Maybe with @LimbusComponent(failOnError=...) on components.
configuration.addComponentConfiguration(new ComponentConfiguration(requestType.get(), cls, true));
return false;
} else {
return true;
}
})
.forEach(cls ->
// TODO: We should support failOnError. Maybe with @LimbusComponent(failOnError=...) on components.
configuration.addComponentConfiguration(new ComponentConfiguration(cls, true)));
} catch (Exception e) {
throw new LimbusSystemException("Cannot determine classes for package " + packageName, e);
}
}
private static Set<Class> loadComponentClasses(List<String> classNamesFromPackage) throws Exception {
try {
return classNamesFromPackage.stream()
.map(clsName -> {
try {
return Class.forName(clsName, false, Thread.currentThread()
.getContextClassLoader());
} catch (ClassNotFoundException e) {
throw LambdaException.of(e);
}
})
.filter(filterLimbusComponentAnnotation())
.collect(Collectors.toSet());
} catch (LambdaException e) {
throw e.getCause();
}
}
private static ObjectFactory createObjectFactory(LimbusApplication application) throws LimbusSystemException {
Class<? extends ObjectFactory> objectFactoryType = application.objectFactory();
try {
return ReflectionUtil.newInstance(ObjectFactory.class, objectFactoryType);
} catch (Exception e) {
throw new LimbusSystemException("Could not create object factory: " + objectFactoryType.getName(), e);
}
}
private static void importBundles(Class<?> applicationClass, SystemConfiguration configuration) {
Arrays.stream(applicationClass.getAnnotationsByType(ImportBundle.class))
.forEach(importBundle -> {
Arrays.stream(importBundle.value())
.map(ApplicationBuilder::getComponentConfigurationFromAnnotations)
.flatMap(List::stream)
.forEach(configuration::addComponentConfiguration);
});
}
private static List<ComponentConfiguration> getComponentConfigurationFromAnnotations(Class<?> type) {
List<ComponentConfiguration> confs = new LinkedList<>();
Arrays.stream(type.getAnnotationsByType(PrivateComponent.class))
.forEach(privateComponent -> confs.add(getConfigurationComponentFromPrivateAnnotation(privateComponent)));
Arrays.stream(type.getAnnotationsByType(PublicComponent.class))
.forEach(publicComponent -> confs.add(getConfigurationComponentFromPublicAnnotation(publicComponent)));
return confs;
}
@SuppressWarnings("unchecked")
private static ComponentConfiguration getConfigurationComponentFromPublicAnnotation(PublicComponent publicComponent) {
Class requestType = publicComponent.requestType();
return new ComponentConfiguration(requestType, publicComponent.type(), publicComponent.failOnError());
}
private static ComponentConfiguration getConfigurationComponentFromPrivateAnnotation(
PrivateComponent privateComponent) {
return new ComponentConfiguration(privateComponent.value(), privateComponent.failOnError());
}
private static Predicate<? super Class> filterLimbusComponentAnnotation() {
return cls -> nonNull(cls.getAnnotation(LimbusComponent.class));
}
private static Predicate<? super Class> filterInterface() {
return Class::isInterface;
}
}
|
923fa87adc8be6bf6607dfe916819831b1fb71c0
| 729 |
java
|
Java
|
src/com/daxie/testspace/joglf/g2/fullscreen/FullScreenWindow.java
|
daba-backup/JOGLFramework2Samples
|
086938c054a9974e369cda1a32a2f26c57ac1348
|
[
"MIT"
] | null | null | null |
src/com/daxie/testspace/joglf/g2/fullscreen/FullScreenWindow.java
|
daba-backup/JOGLFramework2Samples
|
086938c054a9974e369cda1a32a2f26c57ac1348
|
[
"MIT"
] | null | null | null |
src/com/daxie/testspace/joglf/g2/fullscreen/FullScreenWindow.java
|
daba-backup/JOGLFramework2Samples
|
086938c054a9974e369cda1a32a2f26c57ac1348
|
[
"MIT"
] | null | null | null | 25.137931 | 101 | 0.753086 | 1,001,243 |
package com.daxie.testspace.joglf.g2.fullscreen;
import com.daxie.basis.coloru8.ColorU8Functions;
import com.daxie.joglf.gl.input.keyboard.KeyboardEnum;
import com.daxie.joglf.gl.text.TextMgr;
import com.daxie.joglf.gl.window.JOGLFWindow;
import com.daxie.joglf.gl.window.WindowMode;
class FullScreenWindow extends JOGLFWindow{
public FullScreenWindow() {
}
@Override
protected void Init() {
this.SetWindowMode(WindowMode.FULL_SCREEN);
}
@Override
protected void Update() {
if(this.GetKeyboardPressingCount(KeyboardEnum.KEY_ESCAPE)==1) {
this.CloseWindow();
}
}
@Override
protected void Draw() {
TextMgr.DrawText(5, 5, "Full Screen", ColorU8Functions.GetColorU8(0.0f, 1.0f, 0.0f, 1.0f), 64, 64);
}
}
|
923fa91e919cd850e902256cde56a90ad9207140
| 987 |
java
|
Java
|
core/cas-server-core-services-api/src/test/java/org/apereo/cas/services/util/RegisteredServiceSerializationCustomizerTests.java
|
mac-reid/cas
|
d02a22240b90301be41a2dce3bccd11f84633779
|
[
"Apache-2.0"
] | null | null | null |
core/cas-server-core-services-api/src/test/java/org/apereo/cas/services/util/RegisteredServiceSerializationCustomizerTests.java
|
mac-reid/cas
|
d02a22240b90301be41a2dce3bccd11f84633779
|
[
"Apache-2.0"
] | null | null | null |
core/cas-server-core-services-api/src/test/java/org/apereo/cas/services/util/RegisteredServiceSerializationCustomizerTests.java
|
mac-reid/cas
|
d02a22240b90301be41a2dce3bccd11f84633779
|
[
"Apache-2.0"
] | null | null | null | 31.83871 | 109 | 0.766971 | 1,001,244 |
package org.apereo.cas.services.util;
import org.apereo.cas.util.serialization.JacksonObjectMapperFactory;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.val;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.springframework.core.Ordered;
import static org.junit.jupiter.api.Assertions.*;
/**
* This is {@link RegisteredServiceSerializationCustomizerTests}.
*
* @author Misagh Moayyed
* @since 6.6.0
*/
@Tag("RegisteredService")
public class RegisteredServiceSerializationCustomizerTests {
private static final ObjectMapper MAPPER = JacksonObjectMapperFactory.builder().build().toObjectMapper();
@Test
public void verifyOperation() {
val customizer = RegisteredServiceSerializationCustomizer.noOp();
assertEquals(Ordered.LOWEST_PRECEDENCE, customizer.getOrder());
assertDoesNotThrow(() -> customizer.customize(MAPPER));
assertTrue(customizer.getInjectableValues().isEmpty());
}
}
|
923fa97bc5cfa85827fafec10887b0971d2d49f0
| 11,472 |
java
|
Java
|
MovieWeb/src/main/java/com/team2/movie/controller/MovieController.java
|
nire9221/springboot_movie_project_team2
|
4c09d26578bb22cf222e58ea1213df86f1540b8b
|
[
"MIT"
] | null | null | null |
MovieWeb/src/main/java/com/team2/movie/controller/MovieController.java
|
nire9221/springboot_movie_project_team2
|
4c09d26578bb22cf222e58ea1213df86f1540b8b
|
[
"MIT"
] | null | null | null |
MovieWeb/src/main/java/com/team2/movie/controller/MovieController.java
|
nire9221/springboot_movie_project_team2
|
4c09d26578bb22cf222e58ea1213df86f1540b8b
|
[
"MIT"
] | 1 |
2021-06-21T14:39:33.000Z
|
2021-06-21T14:39:33.000Z
| 41.11828 | 124 | 0.69735 | 1,001,245 |
package com.team2.movie.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.apache.http.client.HttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.HttpServerErrorException;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponents;
import org.springframework.web.util.UriComponentsBuilder;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.team2.movie.dao.api.MovieDetailDao;
import com.team2.movie.dao.api.MovieMainDao;
import com.team2.movie.dao.dto.MovieDetail;
import com.team2.movie.dao.dto.MovieMain;
@RestController
public class MovieController {
@Autowired
MovieMainDao movieMainDao;
@Autowired
MovieDetailDao movieDetailDao;
//--------------------------------------영화 API-----------------------------------------
// 메인페이지 영화 정보
@GetMapping("/updateMovie")
public String callBoxOffice() throws JsonProcessingException {
HashMap<String, Object> result = new HashMap<String, Object>();
String jsonInString = "";
// 가져와야할 json
String url = "https://www.kobis.or.kr/kobisopenapi/webservice/rest/boxoffice/searchDailyBoxOfficeList.json"; // movieemain
String key = "ab4da447d209d1ad3bcce6ca4e89ef03";
// SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
// Calendar cal = Calendar.getInstance();
// String today = sdf.format(cal.getTime());
Date dDate = new Date();
dDate = new Date(dDate.getTime() + (1000 * 60 * 60 * 24 * -1));
SimpleDateFormat dSdf = new SimpleDateFormat("yyyyMMdd", Locale.KOREA);
String yesterday = dSdf.format(dDate);
String targetDate = yesterday;
try {
// RestTemplate 설정
// RestTemplate 이란? -> https://sjh836.tistory.com/141 참고
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
factory.setConnectTimeout(5000); // 연결시간 초과, 타임아웃 설정 5초
factory.setReadTimeout(5000);// 읽기시간초과, 타임아웃 설정 5초
RestTemplate restTemplate = new RestTemplate(factory);
// HttpClient는 HTTP를 사용하여 통신하는 범용 라이브러리
HttpClient httpClient = HttpClientBuilder.create().setMaxConnTotal(100) // connection pool 적용
.setMaxConnPerRoute(5) // connection pool 적용
.build();
factory.setHttpClient(httpClient); // 동기실행에 사용될 HttpClient 세팅
HttpHeaders header = new HttpHeaders(); // 헤더에 key들을 담아준다
HttpEntity<?> entity = new HttpEntity<>(header);
// 요청할 주소
// movie main 의 정보, 여기서 movieCd 값을 찾아 받는다
UriComponents uri = UriComponentsBuilder.fromHttpUrl(url + "?key=" + key + "&targetDt=" + targetDate)
.build();
// API를 호출해 MAP타입으로 전달 받는다.
// RestTemplate은 HttpClient 를 추상화(HttpEntity의 json, xml 등)해서 제공
// exchage : HTTP header setting 가능, ResponseEntity로 반환
// RequeResponseEntity -> return body obj, header obj, status code
ResponseEntity<Map> resultMap = restTemplate.exchange(uri.toString(), HttpMethod.GET, entity, Map.class);
result.put("statusCode", resultMap.getStatusCodeValue()); // http status code를 확인
result.put("header", resultMap.getHeaders()); // 헤더 정보 확인
result.put("body", resultMap.getBody()); // 실제 데이터 정보 확인
// HashMap<String, List<String>> // 하나의 키에 여러개의 밸류
// LinkedHashMap 입력 순서대로 저장
LinkedHashMap lm = (LinkedHashMap) resultMap.getBody().get("boxOfficeResult");
// dailybox office list 결과를 리스트로 출력, 리스트 안의 내용은 map 형식 <string 키, list 타입 value)
ArrayList<Map> dboxoffList = (ArrayList<Map>) lm.get("dailyBoxOfficeList");
LinkedHashMap mnList = new LinkedHashMap<>(); // K object, V object
List<MovieMain> movieMain = new ArrayList<>();
// if(movie.getRank().isEmpty() || !movie.getRank().equals(obj.get("rank"))) {
// 중복데이터 처리해줘야하는데...
for (Map obj : dboxoffList) {
MovieMain movie = new MovieMain();
movie.setRnum((String) obj.get("rnum"));
movie.setRank((String) obj.get("rank"));
movie.setRankInten((String) obj.get("rankInten"));
movie.setRankOldAndNew((String) obj.get("rankOldAndNew"));
movie.setMovieCd((String) obj.get("movieCd"));
movie.setMovieNm((String) obj.get("movieNm"));
movie.setOpenDt((String) obj.get("openDt"));
movie.setSalesAmt((String) obj.get("salesAmt"));
movie.setSalesShare((String) obj.get("salesShare"));
movie.setSalesInten((String) obj.get("salesInten"));
movie.setSalesChange((String) obj.get("salesChange"));
movie.setSalesAcc((String) obj.get("salesAcc"));
movie.setAudiCnt((String) obj.get("audiCnt"));
movie.setAudiInten((String) obj.get("audiInten"));
movie.setAudiChange((String) obj.get("audiChange"));
movie.setAudiAcc((String) obj.get("audiAcc"));
movie.setShowCnt((String) obj.get("showCnt"));
movieMainDao.save(movie);
movieMain.add(movie);
}
// System.out.println("movie List : nawara " + movieMain);
// // 데이터를 제대로 전달 받았는지 확인 string형태로 파싱해줌 object to json
ObjectMapper mapper = new ObjectMapper();
jsonInString = mapper.writeValueAsString(mnList);
} catch (HttpClientErrorException | HttpServerErrorException e) {
result.put("statusCode", e.getRawStatusCode());
result.put("body", e.getStatusText());
System.out.println(e.toString());
} catch (Exception e) {
result.put("statusCode", "999");
result.put("body", "excpetion오류");
System.out.println(e.toString());
}
return jsonInString;
}
//--------------------movie detail-------------------------
@GetMapping("/updateDetail")
public String getMovieDetail() throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
String jsonInString = "";
String urladd = "https://www.kobis.or.kr/kobisopenapi/webservice/rest/movie/searchMovieInfo.json"; // moviedetail
String key = "ab4da447d209d1ad3bcce6ca4e89ef03";
// MovieMain movie = new MovieMain();
// movieCd = movie.getMovieCd();
String movieCd = "20201122";
try {
HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
factory.setConnectTimeout(5000); // 연결시간 초과, 타임아웃 설정 5초
factory.setReadTimeout(5000);// 읽기시간초과, 타임아웃 설정 5초
RestTemplate restTemplate = new RestTemplate(factory);
HttpClient httpClient = HttpClientBuilder.create().setMaxConnTotal(100) // connection pool 적용
.setMaxConnPerRoute(5).build();
factory.setHttpClient(httpClient); // 동기실행에 사용될 HttpClient 세팅
HttpHeaders header = new HttpHeaders(); // 헤더에 key들을 담아준다
HttpEntity<?> entity = new HttpEntity<>(header);
UriComponents uri = UriComponentsBuilder.fromHttpUrl(urladd + "?key=" + key + "&movieCd=" + movieCd)
.build();
ResponseEntity<Map> resultMap = restTemplate.exchange(uri.toString(), HttpMethod.GET, entity, Map.class);
result.put("statusCode", resultMap.getStatusCodeValue()); // http status code를 확인
result.put("header", resultMap.getHeaders()); // 헤더 정보 확인
result.put("body", resultMap.getBody()); // 실제 데이터 정보 확인
LinkedHashMap lm = (LinkedHashMap) resultMap.getBody().get("movieInfoResult");
HashMap detailmap = (HashMap) lm.get("movieInfo");
LinkedHashMap mnList = new LinkedHashMap<>(); // K object, V object
// System.out.println("detailmap: " + detailmap);
MovieDetail movieDetail = new MovieDetail();
movieDetail.setMovieCd((String) detailmap.get("movieCd"));
movieDetail.setMovieNm((String) detailmap.get("movieNm"));
movieDetail.setMovieNmEn((String) detailmap.get("movieNmEn"));
movieDetail.setMovieNmOg((String) detailmap.get("movieNmog"));
movieDetail.setPrdtYear((String) detailmap.get("prdtYear"));
movieDetail.setShowTm((String) detailmap.get("showTm"));
movieDetail.setOpenDt((String) detailmap.get("openDt"));
movieDetail.setPrdtStatNm((String) detailmap.get("prdtStatNm"));
movieDetail.setTypeNm((String) detailmap.get("typeNm"));
ArrayList<Map> gmap = (ArrayList<Map>) detailmap.get("genres");
for (int i = 0; i < gmap.size(); i++) {
Map<String, String> ggmap = gmap.get(i);
// movieDetail.setGenre(ggmap);
String genre = (String) ggmap.get("genreNm");
movieDetail.setGenreNm(genre);
// System.out.println(nation);
// System.out.println("nation : " + nnmap.get("nationNm"));
}
ArrayList<Map> nmap = (ArrayList<Map>) detailmap.get("nations");
for (int i = 0; i < nmap.size(); i++) {
Map<String, String> nnmap = nmap.get(i);
// movieDetail.setNation(nnmap);
String nation = (String) nnmap.get("nationNm");
movieDetail.setGenreNm(nation);
// System.out.println(nation);
// System.out.println("nation : " + nnmap.get("nationNm"));
}
ArrayList<Map> amap = (ArrayList<Map>) detailmap.get("actors");
for (int i = 0; i < amap.size(); i++) {
Map<String, String> aamap = amap.get(i);
// movieDetail.setActor(aamap);
String actorname = (String) aamap.get("peopleNm");
movieDetail.setActorNm(actorname);
// System.out.println(actorname);
// System.out.println("actor name : " + aamap.get("peopleNm") + " ename : " + aamap.get("peopleNmEn")
// + " cast : " + aamap.get("cast") + " castEn : " + aamap.get("castEn"));
}
ArrayList<Map> cmap = (ArrayList<Map>) detailmap.get("companys");
for (int i = 0; i < cmap.size(); i++) {
Map<String, String> ccmap = cmap.get(i);
// movieDetail.setCompany(ccmap);
movieDetail.setCompanyNm(ccmap.get("companyNm"));
// System.out.println("company cd : " + ccmap.get("companyCd") + " name : " + ccmap.get("companyNm")
// + " ename : " + ccmap.get("companyNmEn") + " partname : " + ccmap.get("companyPartNm"));
}
ArrayList<Map> dmap = (ArrayList<Map>) detailmap.get("directors");
for (int i = 0; i < dmap.size(); i++) {
Map<String, String> ddmap = dmap.get(i);
// movieDetail.setDirector(ddmap);
movieDetail.setDirectorNm(ddmap.get("peopleNm"));
// System.out.println("director name : " + ddmap.get("peopleNm") + " ename : " + ddmap.get("peopleNmEn"));
}
ArrayList<Map> umap = (ArrayList<Map>) detailmap.get("audits");
for (int i = 0; i < umap.size(); i++) {
Map<String, String> uumap = umap.get(i);
// movieDetail.setAudit(uumap);
movieDetail.setDirectorNm(uumap.get("watchGradeNm"));
// System.out.println("audit num : " + uumap.get("auditNo") + " grade : " + uumap.get("watchGradeNm"));
}
movieDetailDao.save(movieDetail);
ObjectMapper mapper = new ObjectMapper();
jsonInString = mapper.writeValueAsString(mnList);
} catch (HttpClientErrorException | HttpServerErrorException e) {
result.put("statusCode", e.getRawStatusCode());
result.put("body", e.getStatusText());
e.printStackTrace();
System.out.println(e.toString());
} catch (Exception e) {
result.put("statusCode", "999");
result.put("body", "excpetion오류");
e.printStackTrace();
System.out.println(e.toString());
}
return jsonInString;
}
}
|
923fa997045196667ae4f0bc5cf602d5415f7dc5
| 5,051 |
java
|
Java
|
src/main/java/pl/put/poznan/rulestudio/rest/MetadataController.java
|
dominieq/rule-work
|
681e10ad06319ec5918d51b6feccf7ceba02f9d5
|
[
"Apache-2.0"
] | 3 |
2020-05-10T23:06:39.000Z
|
2020-05-11T11:57:24.000Z
|
src/main/java/pl/put/poznan/rulestudio/rest/MetadataController.java
|
dominieq/rule-work
|
681e10ad06319ec5918d51b6feccf7ceba02f9d5
|
[
"Apache-2.0"
] | 25 |
2020-02-21T10:35:02.000Z
|
2020-05-25T11:58:02.000Z
|
src/main/java/pl/put/poznan/rulestudio/rest/MetadataController.java
|
dominieq/rule-studio
|
681e10ad06319ec5918d51b6feccf7ceba02f9d5
|
[
"Apache-2.0"
] | 1 |
2020-10-29T09:43:23.000Z
|
2020-10-29T09:43:23.000Z
| 45.504505 | 130 | 0.728569 | 1,001,246 |
package pl.put.poznan.rulestudio.rest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import pl.put.poznan.rulestudio.model.NamedResource;
import pl.put.poznan.rulestudio.model.response.AttributesResponse;
import pl.put.poznan.rulestudio.model.response.GlobalDescriptiveAttributesResponse;
import pl.put.poznan.rulestudio.model.response.InformationTableResponse;
import pl.put.poznan.rulestudio.service.MetadataService;
import java.io.IOException;
import java.util.UUID;
@CrossOrigin(exposedHeaders = {"Content-Disposition"})
@RequestMapping("projects/{id}/metadata")
@RestController
public class MetadataController {
private static final Logger logger = LoggerFactory.getLogger(MetadataController.class);
private final MetadataService metadataService;
@Autowired
public MetadataController(MetadataService metadataService) {
this.metadataService = metadataService;
}
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<AttributesResponse> getMetadata(
@PathVariable("id") UUID id) throws IOException {
logger.info("[START] Getting metadata...");
final AttributesResponse result = metadataService.getMetadata(id);
logger.info("[ END ] Getting metadata is done.");
return ResponseEntity.ok(result);
}
@RequestMapping(method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<InformationTableResponse> putMetadata(
@PathVariable("id") UUID id,
@RequestParam(name = "metadata") String metadata) throws IOException {
logger.info("[START] Putting metadata...");
final InformationTableResponse result = metadataService.putMetadata(id, metadata);
logger.info("[ END ] Putting metadata is done.");
return ResponseEntity.ok(result);
}
@RequestMapping(value = "/download", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Resource> getDownload(
@PathVariable("id") UUID id) throws IOException {
logger.info("[START] Downloading server's metadata...");
final NamedResource namedResource = metadataService.getDownload(id);
final String projectName = namedResource.getName();
final Resource resource = namedResource.getResource();
logger.info("[ END ] Downloading server's metadata is done.");
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + projectName + " metadata.json")
.body(resource);
}
@RequestMapping(value = "/download", method = RequestMethod.PUT, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Resource> putDownload(
@PathVariable("id") UUID id,
@RequestParam(name = "metadata") String metadata) throws IOException {
logger.info("[START] Downloading client's metadata...");
final NamedResource namedResource = metadataService.putDownload(id, metadata);
final String projectName = namedResource.getName();
final Resource resource = namedResource.getResource();
logger.info("[ END ] Downloading client's metadata is done.");
return ResponseEntity.ok()
.header(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + projectName + " metadata.json")
.body(resource);
}
@RequestMapping(value = "/descriptiveAttributes", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<GlobalDescriptiveAttributesResponse> getDescriptiveAttributes(
@PathVariable("id") UUID id) {
logger.info("[START] Getting descriptive attributes in project...");
final GlobalDescriptiveAttributesResponse result = metadataService.getGlobalDescriptiveAttributes(id);
logger.info("[ END ] Getting descriptive attributes in project is done.");
return ResponseEntity.ok(result);
}
@RequestMapping(value = "/descriptiveAttributes", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<GlobalDescriptiveAttributesResponse> postDescriptiveAttributes(
@PathVariable("id") UUID id,
@RequestParam(name = "objectVisibleName", required = false) String objectVisibleName) {
logger.info("[START] Posting descriptive attributes in project...");
final GlobalDescriptiveAttributesResponse result = metadataService.postGlobalDescriptiveAttributes(id, objectVisibleName);
logger.info("[ END ] Posting descriptive attributes in project is done.");
return ResponseEntity.ok(result);
}
}
|
923fa9d463faf786eaede79fd5dea700cebfb6f5
| 548 |
java
|
Java
|
src/main/java/education/uwithme/bot/config/TelegramConfig.java
|
Misha999777/UniBot-Service_University-With-Me
|
53638019a36f380686e89900c46e969a849e9491
|
[
"Apache-2.0"
] | 2 |
2021-11-12T22:16:32.000Z
|
2022-01-20T10:45:02.000Z
|
src/main/java/education/uwithme/bot/config/TelegramConfig.java
|
Misha999777/UniBot-Service_University-With-Me
|
53638019a36f380686e89900c46e969a849e9491
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/education/uwithme/bot/config/TelegramConfig.java
|
Misha999777/UniBot-Service_University-With-Me
|
53638019a36f380686e89900c46e969a849e9491
|
[
"Apache-2.0"
] | null | null | null | 32.235294 | 74 | 0.828467 | 1,001,247 |
package education.uwithme.bot.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.telegram.telegrambots.meta.TelegramBotsApi;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import org.telegram.telegrambots.updatesreceivers.DefaultBotSession;
@Configuration
public class TelegramConfig {
@Bean
public TelegramBotsApi telegramBotsApi() throws TelegramApiException {
return new TelegramBotsApi(DefaultBotSession.class);
}
}
|
923fa9ef9ee478763b9fbfe3b99277b76a56f5c9
| 262 |
java
|
Java
|
app/src/main/java/com/asher/threeline/serve/data/music/DbMusicServeComponent.java
|
AsherYang/ThreeLine
|
351dc8bfd1c0a536ffbf36ce8b1af953cc71f93a
|
[
"Apache-2.0"
] | 1 |
2017-05-02T10:02:28.000Z
|
2017-05-02T10:02:28.000Z
|
app/src/main/java/com/asher/threeline/serve/data/music/DbMusicServeComponent.java
|
AsherYang/ThreeLine
|
351dc8bfd1c0a536ffbf36ce8b1af953cc71f93a
|
[
"Apache-2.0"
] | null | null | null |
app/src/main/java/com/asher/threeline/serve/data/music/DbMusicServeComponent.java
|
AsherYang/ThreeLine
|
351dc8bfd1c0a536ffbf36ce8b1af953cc71f93a
|
[
"Apache-2.0"
] | null | null | null | 17.466667 | 45 | 0.732824 | 1,001,248 |
package com.asher.threeline.serve.data.music;
import dagger.Component;
/**
* Created by ouyangfan on 2017/4/6.
*/
@Component(
modules = {DbMusicServeModule.class}
)
public interface DbMusicServeComponent {
IDbMusicServe provideDbMusicServe();
}
|
923fa9fb2ee3258807bfd078dc8676d476888677
| 436 |
java
|
Java
|
src/penjualan/interfc/transaksiInterfc.java
|
Rahadian347/SISTEM-INFORMASI-PENJUALAN
|
116dd945458962f9c7c4f7821a5cdfa9f72f50e0
|
[
"MIT"
] | null | null | null |
src/penjualan/interfc/transaksiInterfc.java
|
Rahadian347/SISTEM-INFORMASI-PENJUALAN
|
116dd945458962f9c7c4f7821a5cdfa9f72f50e0
|
[
"MIT"
] | null | null | null |
src/penjualan/interfc/transaksiInterfc.java
|
Rahadian347/SISTEM-INFORMASI-PENJUALAN
|
116dd945458962f9c7c4f7821a5cdfa9f72f50e0
|
[
"MIT"
] | null | null | null | 23.473684 | 79 | 0.748879 | 1,001,249 |
/*
* 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 penjualan.interfc;
import java.sql.SQLException;
import penjualan.entity.transaksi;
/**
*
* @author Rahadian Permana <[email protected]>
*/
public interface transaksiInterfc {
transaksi insert(transaksi o) throws SQLException;
}
|
923faa86ea9382f6c065b83c5a5f237e71635473
| 3,714 |
java
|
Java
|
tck/core/src/main/java/io/machinecode/chainlink/tck/core/repository/GridGainRepositoryFactory.java
|
machinecode-io/chainlink
|
31d5c367bd94ce83f3d0fa7a22b38c680651eb5a
|
[
"Apache-2.0"
] | null | null | null |
tck/core/src/main/java/io/machinecode/chainlink/tck/core/repository/GridGainRepositoryFactory.java
|
machinecode-io/chainlink
|
31d5c367bd94ce83f3d0fa7a22b38c680651eb5a
|
[
"Apache-2.0"
] | null | null | null |
tck/core/src/main/java/io/machinecode/chainlink/tck/core/repository/GridGainRepositoryFactory.java
|
machinecode-io/chainlink
|
31d5c367bd94ce83f3d0fa7a22b38c680651eb5a
|
[
"Apache-2.0"
] | null | null | null | 47.679487 | 114 | 0.743479 | 1,001,250 |
package io.machinecode.chainlink.tck.core.repository;
import io.machinecode.chainlink.repository.gridgain.GridGainRepository;
import io.machinecode.chainlink.spi.configuration.Dependencies;
import io.machinecode.chainlink.spi.property.PropertyLookup;
import io.machinecode.chainlink.spi.configuration.factory.RepositoryFactory;
import io.machinecode.chainlink.spi.repository.Repository;
import org.gridgain.grid.GridConfiguration;
import org.gridgain.grid.GridException;
import org.gridgain.grid.GridGain;
import org.gridgain.grid.GridGainState;
import org.gridgain.grid.cache.GridCacheAtomicityMode;
import org.gridgain.grid.cache.GridCacheConfiguration;
import org.gridgain.grid.spi.discovery.tcp.GridTcpDiscoverySpi;
import org.gridgain.grid.spi.discovery.tcp.ipfinder.multicast.GridTcpDiscoveryMulticastIpFinder;
/**
* @author <a href="mailto:[email protected]">Brent Douglas</a>
* @since 1.0
*/
public class GridGainRepositoryFactory implements RepositoryFactory {
public static final String CHAINLINK_TCK_GRID = "chainlink-tck-grid";
static {
final GridCacheConfiguration[] caches = new GridCacheConfiguration[11];
for (int i = 0; i < 11; ++i) {
caches[i] = new GridCacheConfiguration();
}
setCacheConf(caches[0], GridGainRepository.IDS);
setIndexeddCacheConf(caches[1], GridGainRepository.JOB_INSTANCES);
setIndexeddCacheConf(caches[2], GridGainRepository.JOB_EXECUTIONS);
setCacheConf(caches[3], GridGainRepository.STEP_EXECUTIONS);
setCacheConf(caches[4], GridGainRepository.PARTITION_EXECUTIONS);
setCacheConf(caches[5], GridGainRepository.JOB_INSTANCE_EXECUTIONS);
setCacheConf(caches[6], GridGainRepository.JOB_EXECUTION_INSTANCES);
setCacheConf(caches[7], GridGainRepository.JOB_EXECUTION_STEP_EXECUTIONS);
setCacheConf(caches[8], GridGainRepository.LATEST_JOB_EXECUTION_FOR_INSTANCE);
setCacheConf(caches[9], GridGainRepository.STEP_EXECUTION_PARTITION_EXECUTIONS);
setCacheConf(caches[10], GridGainRepository.JOB_EXECUTION_HISTORY);
final GridConfiguration configuration = new GridConfiguration();
configuration.setCacheConfiguration(caches);
configuration.setGridName(CHAINLINK_TCK_GRID);
final GridTcpDiscoverySpi discovery = new GridTcpDiscoverySpi();
discovery.setLocalAddress(System.getProperty("gridgain.host", "127.0.0.1"));
discovery.setLocalPort(Integer.parseInt(System.getProperty("gridgain.port", "47500")));
final GridTcpDiscoveryMulticastIpFinder finder = new GridTcpDiscoveryMulticastIpFinder();
finder.setMulticastGroup(System.getProperty("gridgain.multicast.group", "172.16.17.32"));
discovery.setIpFinder(finder);
configuration.setDiscoverySpi(discovery);
try {
if (GridGain.state(CHAINLINK_TCK_GRID) != GridGainState.STARTED) {
GridGain.start(configuration);
}
} catch (GridException e) {
throw new RuntimeException(e);
}
}
private static void setCacheConf(final GridCacheConfiguration conf, final String name) {
conf.setName(name);
conf.setAtomicityMode(GridCacheAtomicityMode.ATOMIC);
}
private static void setIndexeddCacheConf(final GridCacheConfiguration conf, final String name) {
setCacheConf(conf, name);
conf.setQueryIndexEnabled(true);
}
@Override
public Repository produce(final Dependencies dependencies, final PropertyLookup properties) throws Exception {
return new GridGainRepository(
dependencies.getMarshalling(),
GridGain.grid(CHAINLINK_TCK_GRID)
);
}
}
|
923faaae3fa9e0537803632fec035cae800b9291
| 4,424 |
java
|
Java
|
ftests/core/src/main/java/org/commonjava/indy/ftest/core/content/DeleteGroupWithContentTest.java
|
pkocandr/indy
|
ca7233edea09b2a55be930f471d91a3b0d21bc31
|
[
"Apache-2.0"
] | 22 |
2016-07-21T13:32:44.000Z
|
2022-03-16T20:20:11.000Z
|
ftests/core/src/main/java/org/commonjava/indy/ftest/core/content/DeleteGroupWithContentTest.java
|
pkocandr/indy
|
ca7233edea09b2a55be930f471d91a3b0d21bc31
|
[
"Apache-2.0"
] | 865 |
2015-12-11T16:59:17.000Z
|
2022-03-23T09:02:56.000Z
|
ftests/core/src/main/java/org/commonjava/indy/ftest/core/content/DeleteGroupWithContentTest.java
|
pkocandr/indy
|
ca7233edea09b2a55be930f471d91a3b0d21bc31
|
[
"Apache-2.0"
] | 39 |
2015-12-10T16:11:29.000Z
|
2022-02-26T11:28:46.000Z
| 40.587156 | 115 | 0.675407 | 1,001,251 |
/**
* Copyright (C) 2011-2020 Red Hat, Inc. (https://github.com/Commonjava/indy)
*
* 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.commonjava.indy.ftest.core.content;
import org.apache.commons.io.IOUtils;
import org.commonjava.indy.ftest.core.AbstractContentManagementTest;
import org.commonjava.indy.ftest.core.category.EventDependent;
import org.commonjava.indy.model.core.Group;
import org.commonjava.indy.model.core.HostedRepository;
import org.commonjava.indy.util.LocationUtils;
import org.commonjava.maven.galley.model.ConcreteResource;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import static org.commonjava.indy.pkg.maven.model.MavenPackageTypeDescriptor.MAVEN_PKG_KEY;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
public class DeleteGroupWithContentTest
extends AbstractContentManagementTest
{
protected boolean createStandardTestStructures()
{
return false;
}
/* @formatter:off */
private static final String pomContent = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<project>\n" +
" <modelVersion>4.0.0</modelVersion>\n" +
" <groupId>org.foo</groupId>\n" +
" <artifactId>bar</artifactId>\n" +
" <version>1.0</version>\n" +
" <packaging>pom</packaging>\n" +
"</project>\n";
/* @formatter:on */
String pomPath = "org/foo/bar/1.0/bar-1.0.pom";
String metadataPath = "org/foo/bar/maven-metadata.xml";
@Test
@Category( EventDependent.class )
public void run() throws Exception
{
// Create hosted repo
final HostedRepository repo = new HostedRepository( MAVEN_PKG_KEY, "test_1" );
assertThat( client.stores().create( repo, name.getMethodName(), HostedRepository.class ), notNullValue() );
// Store pom file in hosted repo
client.content().store( repo.getKey(), pomPath, new ByteArrayInputStream( pomContent.getBytes() ) );
// Generate metadata file in hosted repo
try (InputStream in = client.content().get( repo.getKey(), metadataPath ))
{
IOUtils.toString( in );
}
// Verify the hosted meta file exists
ConcreteResource r_meta_hosted = new ConcreteResource( LocationUtils.toLocation( repo ), metadataPath );
assertTrue( cacheProvider.exists( r_meta_hosted ) );
// Create group with hosted member
final Group group = new Group( MAVEN_PKG_KEY, "test_1", repo.getKey() );
assertThat( client.stores().create( group, name.getMethodName(), Group.class ), notNullValue() );
// Generate group metadata file
try (InputStream in = client.content().get( group.getKey(), metadataPath ))
{
IOUtils.toString( in );
}
// Verify the group meta file exists
ConcreteResource r_meta = new ConcreteResource( LocationUtils.toLocation( group ), metadataPath );
assertTrue( cacheProvider.exists( r_meta ) );
// Delete group
client.stores().delete( group.getKey(), "Delete", true );
assertThat( client.stores().exists( group.getKey() ), equalTo( false ) );
// Verify the group meta file gone
assertFalse( cacheProvider.exists( r_meta ) );
// Verify hosted files not change (delete group not affect the files in hosted repo)
ConcreteResource r1 = new ConcreteResource( LocationUtils.toLocation( repo ), pomPath );
assertTrue( cacheProvider.exists( r1 ) );
assertTrue( cacheProvider.exists( r_meta_hosted ) );
}
}
|
923fab10ce33c79090a268d556da00beb8d44d5e
| 663 |
java
|
Java
|
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmodes/red/RedSkystoneAuto.java
|
NicholsSchool/2020-ftc-mokey-2
|
8c46e92d43f431529e8aeb488410fad5d0db448b
|
[
"MIT"
] | null | null | null |
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmodes/red/RedSkystoneAuto.java
|
NicholsSchool/2020-ftc-mokey-2
|
8c46e92d43f431529e8aeb488410fad5d0db448b
|
[
"MIT"
] | null | null | null |
TeamCode/src/main/java/org/firstinspires/ftc/teamcode/opmodes/red/RedSkystoneAuto.java
|
NicholsSchool/2020-ftc-mokey-2
|
8c46e92d43f431529e8aeb488410fad5d0db448b
|
[
"MIT"
] | null | null | null | 27.625 | 109 | 0.707391 | 1,001,252 |
package org.firstinspires.ftc.teamcode.opmodes.red;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode;
import org.firstinspires.ftc.teamcode.autonomous.SkystoneRoutine;
/**
* An auto OpMode for grabbing a Skystone while starting on the red alliance.
*/
@Autonomous(name="RedSkystoneAuto")
public class RedSkystoneAuto extends LinearOpMode {
/**
* Runs the OpMode.
*/
@Override
public void runOpMode() {
String[] args = getClass().getSimpleName().split("(?<=[a-z])(?=[A-Z])"); // split class name for args
SkystoneRoutine.run(this, args[0]);
}
}
|
923faeeedbdd432159c86ed7fea4a310bc7c04bf
| 2,991 |
java
|
Java
|
src/model/TbAction.java
|
FIVJ/ECA-Importer
|
a05aaf5d52c6b716de8e5067660ae61cd8c87133
|
[
"MIT"
] | 1 |
2017-09-30T03:43:15.000Z
|
2017-09-30T03:43:15.000Z
|
src/model/TbAction.java
|
FIVJ/ECA-Importer
|
a05aaf5d52c6b716de8e5067660ae61cd8c87133
|
[
"MIT"
] | null | null | null |
src/model/TbAction.java
|
FIVJ/ECA-Importer
|
a05aaf5d52c6b716de8e5067660ae61cd8c87133
|
[
"MIT"
] | null | null | null | 29.038835 | 152 | 0.684386 | 1,001,253 |
/*
* 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 model;
import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
/**
*
* @author tassio
*/
@Entity
@Table(name = "tb_action")
@XmlRootElement
@NamedQueries({
@NamedQuery(name = "TbAction.findAll", query = "SELECT t FROM TbAction t")
, @NamedQuery(name = "TbAction.findByIntCodAction", query = "SELECT t FROM TbAction t WHERE t.intCodAction = :intCodAction")
, @NamedQuery(name = "TbAction.findByStrNameAction", query = "SELECT t FROM TbAction t WHERE t.strNameAction = :strNameAction")})
public class TbAction implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "int_cod_action")
private Integer intCodAction;
@Column(name = "str_name_action")
private String strNameAction;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "tbActionIdAction")
private List<TbPayments> tbPaymentsList;
public TbAction() {
}
public TbAction(Integer intCodAction) {
this.intCodAction = intCodAction;
}
public Integer getIntCodAction() {
return intCodAction;
}
public void setIntCodAction(Integer intCodAction) {
this.intCodAction = intCodAction;
}
public String getStrNameAction() {
return strNameAction;
}
public void setStrNameAction(String strNameAction) {
this.strNameAction = strNameAction;
}
@XmlTransient
public List<TbPayments> getTbPaymentsList() {
return tbPaymentsList;
}
public void setTbPaymentsList(List<TbPayments> tbPaymentsList) {
this.tbPaymentsList = tbPaymentsList;
}
@Override
public int hashCode() {
int hash = 0;
hash += (intCodAction != null ? intCodAction.hashCode() : 0);
return hash;
}
@Override
public boolean equals(Object object) {
// TODO: Warning - this method won't work in the case the id fields are not set
if (!(object instanceof TbAction)) {
return false;
}
TbAction other = (TbAction) object;
if ((this.intCodAction == null && other.intCodAction != null) || (this.intCodAction != null && !this.intCodAction.equals(other.intCodAction))) {
return false;
}
return true;
}
@Override
public String toString() {
return "model.TbAction[ intCodAction=" + intCodAction + " ]";
}
}
|
923fb01db9d916a744286423bd55fdecee5c0a76
| 5,434 |
java
|
Java
|
src/main/java/eu/fbk/das/challenge/gui/rs/RSUploader.java
|
das-fbk/game-engine.challenge-gen-gui
|
fc2fd3a311273083206e6470258eebeabf4718d8
|
[
"Apache-1.1"
] | null | null | null |
src/main/java/eu/fbk/das/challenge/gui/rs/RSUploader.java
|
das-fbk/game-engine.challenge-gen-gui
|
fc2fd3a311273083206e6470258eebeabf4718d8
|
[
"Apache-1.1"
] | null | null | null |
src/main/java/eu/fbk/das/challenge/gui/rs/RSUploader.java
|
das-fbk/game-engine.challenge-gen-gui
|
fc2fd3a311273083206e6470258eebeabf4718d8
|
[
"Apache-1.1"
] | null | null | null | 28.6 | 174 | 0.591645 | 1,001,254 |
package eu.fbk.das.challenge.gui.rs;
import eu.fbk.das.GamificationEngineRestFacade;
import eu.fbk.das.api.exec.RecommenderSystemWeekly;
import eu.fbk.das.model.ChallengeExpandedDTO;
import it.smartcommunitylab.model.ChallengeConcept;
import org.apache.log4j.Logger;
import org.joda.time.DateTime;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static eu.fbk.das.utils.Utils.*;
/**
* {@link Runnable} class for challenge upload into GamificationEngine
*/
public class RSUploader extends SwingWorker<String, Object> {
private static final Logger logger = Logger
.getLogger(RSUploader.class);
private final Map<String, String> conf;
private RecommenderSystemController controller;
private String output;
private GamificationEngineRestFacade facade;
Map<String, List<ChallengeExpandedDTO>> challenges;
private String gameId;
private DateTime monday;
RSUploader(RecommenderSystemController controller, Map<String, String> conf, String output) {
this.controller = controller;
this.conf = conf;
this.output = output;
this.facade = controller.getFacade();
}
@Override
public String doInBackground() {
p("Start upload");
challenges = controller.challenges;
gameId = conf.get("GAMEID");
DateTime date = stringToDate(conf.get("date"));
if (date == null) {
err(logger, "Invalid date! %s", conf.get("date"));
}
monday = jumpToMonday(date);
if (!check())
return "";
if (!upload())
return "";
controller.setStatusBar(true,"Challenge upload completed");
return "done";
}
private boolean check() {
if (facade == null) {
controller.addLog("ERROR! facade cannot be null");
return false;
}
if (output == null) {
controller.addLog("output file cannot be null");
return false;
}
if (controller.challenges == null) {
controller.addLog("ERROR! challenges cannot be null");
return false;
}
return true;
}
private boolean upload() {
// int tot = 0;
// controller.addLog("Read challenges: %d", controller.challenges.size());
boolean success;
RecommenderSystemWeekly rsw = new RecommenderSystemWeekly();
for (String playerId : challenges.keySet()) {
List<ChallengeExpandedDTO> lcha = challenges.get(playerId);
if (lcha == null || lcha.isEmpty())
continue;
String already = existsPlayerChallenge(gameId, playerId, lcha.get(0));
if (!"".equals(already)) {
controller.addLog("ERROR: this user already has challenges this week: %s", already);
int result = controller.newDialog(f("User '%s' has already the following challenges in this week. Do you wish to add another? \n \n %s", playerId, already));
if (result != 0)
continue;
}
int tot = lcha.size();
int ix = 0;
for (ChallengeExpandedDTO cha : lcha) {
// upload every challenge
cha.setOrigin("rs");
controller.setStatusBar(false, "Inserting challenge: %d / %d - %s\n", ++ix, tot, cha.getInstanceName());
success = rsw.upload(conf, cha);
if (!success) {
controller.addLog("ERROR", cha.getInstanceName());
return false;
}
}
}
controller.addLog("Challenges upload completed!");
return true;
}
private String existsPlayerChallenge(String gameId, String playerId, ChallengeExpandedDTO old) {
DateTime currentChaEnd = jumpToMonday(new DateTime(old.getEnd()));
List<String> already = new ArrayList<>();
List<ChallengeConcept> currentChallenges = facade.getChallengesPlayer(gameId, playerId);
for (ChallengeConcept cha: currentChallenges) {
p(cha);
DateTime existingChaEnd = jumpToMonday(new DateTime(cha.getEnd()));
String s = (String) cha.getName();
if (s.contains("survey") || s.contains("initial") || s.contains("bonus") || s.contains("group") || s.contains("recommend"))
continue;
int v = Math.abs(daysApart(currentChaEnd, existingChaEnd));
if (v < 1) {
already.add(s);
}
}
return String.join("\n", already);
}
/*
private List<ChallengeDataInternalDto> readChallenges() {
// read output file
ObjectMapper mapper = new ObjectMapper();
TypeFactory typeFactory = mapper.getTypeFactory();
String jsonString;
List<ChallengeDataInternalDto> challenges;
try {
jsonString = IOUtils.toString(new FileInputStream(output));
challenges = mapper.readValue(jsonString, typeFactory
.constructCollectionType(List.class,
ChallengeDataInternalDto.class));
} catch (IOException e1) {
controller.addLog("Error in reading output file for uploader " + output);
return null;
}
return challenges;
} */
}
|
923fb08b90de65d8a9c1d69109121961c15cdeac
| 8,839 |
java
|
Java
|
firebase-firestore/src/main/java/com/google/firebase/firestore/model/MutableDocument.java
|
truthiswill/firebase-android-sdk
|
41e38cb6cdf0d0f5347f826f11cee757df3186d1
|
[
"Apache-2.0"
] | 12 |
2021-10-21T12:08:42.000Z
|
2022-03-23T06:15:22.000Z
|
firebase-firestore/src/main/java/com/google/firebase/firestore/model/MutableDocument.java
|
Mindula-Dilthushan/firebase-android-sdk
|
56c238cd975deb56c3d81ad7f956798949853ee4
|
[
"Apache-2.0"
] | 4 |
2021-11-15T19:19:50.000Z
|
2021-12-28T19:19:07.000Z
|
firebase-firestore/src/main/java/com/google/firebase/firestore/model/MutableDocument.java
|
Mindula-Dilthushan/firebase-android-sdk
|
56c238cd975deb56c3d81ad7f956798949853ee4
|
[
"Apache-2.0"
] | null | null | null | 31.567857 | 100 | 0.713655 | 1,001,255 |
// Copyright 2020 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.firebase.firestore.model;
import androidx.annotation.NonNull;
import com.google.firestore.v1.Value;
/**
* Represents a document in Firestore with a key, version, data and whether it has local mutations
* applied to it.
*
* <p>Documents can transition between states via {@link #convertToFoundDocument}, {@link
* #convertToNoDocument} and {@link #convertToUnknownDocument}. If a document does not transition to
* one of these states even after all mutations have been applied, {@link #isValidDocument} returns
* false and the document should be removed from all views.
*/
public final class MutableDocument implements Document {
private enum DocumentType {
/**
* Represents the initial state of a MutableDocument when only the document key is known.
* Invalid documents transition to other states as mutations are applied. If a document remains
* invalid after applying mutations, it should be discarded.
*/
INVALID,
/**
* Represents a document in Firestore with a key, version, data and whether the data has local
* mutations applied to it.
*/
FOUND_DOCUMENT,
/** Represents that no documents exists for the key at the given version. */
NO_DOCUMENT,
/**
* Represents an existing document whose data is unknown (e.g. a document that was updated
* without a known base document).
*/
UNKNOWN_DOCUMENT;
}
/** Describes the `hasPendingWrites` state of a document. */
private enum DocumentState {
/** Local mutations applied via the mutation queue. Document is potentially inconsistent. */
HAS_LOCAL_MUTATIONS,
/** Mutations applied based on a write acknowledgment. Document is potentially inconsistent. */
HAS_COMMITTED_MUTATIONS,
/** No mutations applied. Document was sent to us by Watch. */
SYNCED
}
private final DocumentKey key;
private DocumentType documentType;
private SnapshotVersion version;
private SnapshotVersion readTime;
private ObjectValue value;
private DocumentState documentState;
private MutableDocument(DocumentKey key) {
this.key = key;
this.readTime = SnapshotVersion.NONE;
}
private MutableDocument(
DocumentKey key,
DocumentType documentType,
SnapshotVersion version,
SnapshotVersion readTime,
ObjectValue value,
DocumentState documentState) {
this.key = key;
this.version = version;
this.readTime = readTime;
this.documentType = documentType;
this.documentState = documentState;
this.value = value;
}
/**
* Creates a document with no known version or data, but which can serve as base document for
* mutations.
*/
public static MutableDocument newInvalidDocument(DocumentKey documentKey) {
return new MutableDocument(
documentKey,
DocumentType.INVALID,
SnapshotVersion.NONE,
SnapshotVersion.NONE,
new ObjectValue(),
DocumentState.SYNCED);
}
/** Creates a new document that is known to exist with the given data at the given version. */
public static MutableDocument newFoundDocument(
DocumentKey documentKey, SnapshotVersion version, ObjectValue value) {
return new MutableDocument(documentKey).convertToFoundDocument(version, value);
}
/** Creates a new document that is known to not exisr at the given version. */
public static MutableDocument newNoDocument(DocumentKey documentKey, SnapshotVersion version) {
return new MutableDocument(documentKey).convertToNoDocument(version);
}
/**
* Creates a new document that is known to exist at the given version but whose data is not known
* (e.g. a document that was updated without a known base document).
*/
public static MutableDocument newUnknownDocument(
DocumentKey documentKey, SnapshotVersion version) {
return new MutableDocument(documentKey).convertToUnknownDocument(version);
}
/**
* Changes the document type to indicate that it exists and that its version and data are known.
*/
public MutableDocument convertToFoundDocument(SnapshotVersion version, ObjectValue value) {
this.version = version;
this.documentType = DocumentType.FOUND_DOCUMENT;
this.value = value;
this.documentState = DocumentState.SYNCED;
return this;
}
/** Changes the document type to indicate that it doesn't exist at the given version. */
public MutableDocument convertToNoDocument(SnapshotVersion version) {
this.version = version;
this.documentType = DocumentType.NO_DOCUMENT;
this.value = new ObjectValue();
this.documentState = DocumentState.SYNCED;
return this;
}
/**
* Changes the document type to indicate that it exists at a given version but that its data is
* not known (e.g. a document that was updated without a known base document).
*/
public MutableDocument convertToUnknownDocument(SnapshotVersion version) {
this.version = version;
this.documentType = DocumentType.UNKNOWN_DOCUMENT;
this.value = new ObjectValue();
this.documentState = DocumentState.HAS_COMMITTED_MUTATIONS;
return this;
}
public MutableDocument setHasCommittedMutations() {
this.documentState = DocumentState.HAS_COMMITTED_MUTATIONS;
return this;
}
public MutableDocument setHasLocalMutations() {
this.documentState = DocumentState.HAS_LOCAL_MUTATIONS;
this.version = SnapshotVersion.NONE;
return this;
}
public MutableDocument setReadTime(SnapshotVersion readTime) {
this.readTime = readTime;
return this;
}
@Override
public DocumentKey getKey() {
return key;
}
@Override
public SnapshotVersion getVersion() {
return version;
}
@Override
public SnapshotVersion getReadTime() {
return readTime;
}
@Override
public boolean hasLocalMutations() {
return documentState.equals(DocumentState.HAS_LOCAL_MUTATIONS);
}
@Override
public boolean hasCommittedMutations() {
return documentState.equals(DocumentState.HAS_COMMITTED_MUTATIONS);
}
@Override
public boolean hasPendingWrites() {
return hasLocalMutations() || hasCommittedMutations();
}
@Override
public ObjectValue getData() {
return value;
}
@Override
public Value getField(FieldPath field) {
return getData().get(field);
}
@Override
public boolean isValidDocument() {
return !documentType.equals(DocumentType.INVALID);
}
@Override
public boolean isFoundDocument() {
return documentType.equals(DocumentType.FOUND_DOCUMENT);
}
@Override
public boolean isNoDocument() {
return documentType.equals(DocumentType.NO_DOCUMENT);
}
@Override
public boolean isUnknownDocument() {
return documentType.equals(DocumentType.UNKNOWN_DOCUMENT);
}
@Override
@NonNull
public MutableDocument mutableCopy() {
return new MutableDocument(key, documentType, version, readTime, value.clone(), documentState);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
MutableDocument document = (MutableDocument) o;
if (!key.equals(document.key)) return false;
if (!version.equals(document.version)) return false;
// TODO(mrschmidt): Include readTime (requires a lot of test updates)
// if (!readTime.equals(document.readTime)) return false;
if (!documentType.equals(document.documentType)) return false;
if (!documentState.equals(document.documentState)) return false;
return value.equals(document.value);
}
@Override
public int hashCode() {
// We only use the key for the hashcode as all other document properties are mutable.
// While mutable documents should not be uses as keys in collections, the hash code is used
// in DocumentSet, which tracks Documents that are no longer being mutated but which are
// backed by this class.
return key.hashCode();
}
@Override
public String toString() {
return "Document{"
+ "key="
+ key
+ ", version="
+ version
+ ", readTime="
+ readTime
+ ", type="
+ documentType
+ ", documentState="
+ documentState
+ ", value="
+ value
+ '}';
}
}
|
923fb17147d4a03de4dfca5fdf9040a4928e9c1e
| 476 |
java
|
Java
|
backend/project-board/src/test/java/helper/adapter/mail/StringWriterArgumentMatcher.java
|
jonasdenis/project-board
|
4a49050822ede30cb392a81343a0f1b8c1be3aae
|
[
"MIT"
] | 9 |
2018-08-15T07:38:47.000Z
|
2020-09-25T11:32:29.000Z
|
backend/project-board/src/test/java/helper/adapter/mail/StringWriterArgumentMatcher.java
|
jonasdenis/project-board
|
4a49050822ede30cb392a81343a0f1b8c1be3aae
|
[
"MIT"
] | 27 |
2018-08-22T07:54:20.000Z
|
2019-07-08T09:15:18.000Z
|
backend/project-board/src/test/java/helper/adapter/mail/StringWriterArgumentMatcher.java
|
jonasdenis/project-board
|
4a49050822ede30cb392a81343a0f1b8c1be3aae
|
[
"MIT"
] | 4 |
2019-06-02T13:26:46.000Z
|
2021-08-17T08:49:28.000Z
| 22.666667 | 83 | 0.760504 | 1,001,256 |
package helper.adapter.mail;
import org.mockito.ArgumentMatcher;
import java.io.StringWriter;
public class StringWriterArgumentMatcher implements ArgumentMatcher<StringWriter> {
private final String referenceString;
public StringWriterArgumentMatcher(String referenceString) {
this.referenceString = referenceString;
}
@Override
public boolean matches(StringWriter writer) {
return writer.toString().equals(referenceString);
}
}
|
923fb18f0ef44cc54c1e4356725c70035472af2d
| 2,283 |
java
|
Java
|
o.n.erdbeans/src/main/java/org/netbeans/modules/erd/model/ERDDocumentAwareness.java
|
timboudreau/netbeans-contrib
|
e414495e8585df9911392d7e3b190153759ff6d3
|
[
"Apache-2.0"
] | 2 |
2018-07-19T08:40:29.000Z
|
2019-12-07T19:37:03.000Z
|
o.n.erdbeans/src/main/java/org/netbeans/modules/erd/model/ERDDocumentAwareness.java
|
timboudreau/netbeans-contrib
|
e414495e8585df9911392d7e3b190153759ff6d3
|
[
"Apache-2.0"
] | 4 |
2021-02-03T19:27:41.000Z
|
2021-08-02T17:04:13.000Z
|
o.n.erdbeans/src/main/java/org/netbeans/modules/erd/model/ERDDocumentAwareness.java
|
timboudreau/netbeans-contrib
|
e414495e8585df9911392d7e3b190153759ff6d3
|
[
"Apache-2.0"
] | 2 |
2020-10-03T14:44:58.000Z
|
2022-01-13T22:03:24.000Z
| 43.903846 | 75 | 0.754709 | 1,001,257 |
/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright 1997-2009 Sun Microsystems, Inc. All rights reserved.
*
* The contents of this file are subject to the terms of either the GNU
* General Public License Version 2 only ("GPL") or the Common
* Development and Distribution License("CDDL") (collectively, the
* "License"). You may not use this file except in compliance with the
* License. You can obtain a copy of the License at
* http://www.netbeans.org/cddl-gplv2.html
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
* specific language governing permissions and limitations under the
* License. When distributing the software, include this License Header
* Notice in each file and include the License file at
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the
* License Header, with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* Contributor(s):
*
* The Original Software is NetBeans. The Initial Developer of the Original
* Software is Sun Microsystems, Inc. Portions Copyright 1997-2009 Sun
* Microsystems, Inc. All Rights Reserved.
*
* If you wish your version of this file to be governed by only the CDDL
* or only the GPL Version 2, indicate your decision by adding
* "[Contributor] elects to include this software in this distribution
* under the [CDDL or GPL Version 2] license." If you do not indicate a
* single choice of license, a recipient has the option to distribute
* your version of this file under either the CDDL, the GPL Version 2 or
* to extend the choice of license to its licensees as provided above.
* However, if you add GPL Version 2 code and therefore, elected the GPL
* Version 2 license, then the option applies only if the new code is
* made subject to such option by the copyright holder.
*/
package org.netbeans.modules.erd.model;
/**
* @author David Kaspar
*/
public interface ERDDocumentAwareness {
public void setERDDocument (ERDDocument designDocument);
}
|
923fb3fef9ab3f0874d46d462421b8c5ea94d5ad
| 926 |
java
|
Java
|
v14.2/trunk/source/Modules/DL-Affirm-Payment/java/com/deplabs/affirm/app/b2c/checkout/shipping/impl/AffirmContactModel.java
|
Affirm/Kibo_ML_Affirm
|
d993512dac3575a377c421bd95ef90ab03e15e34
|
[
"BSD-3-Clause"
] | null | null | null |
v14.2/trunk/source/Modules/DL-Affirm-Payment/java/com/deplabs/affirm/app/b2c/checkout/shipping/impl/AffirmContactModel.java
|
Affirm/Kibo_ML_Affirm
|
d993512dac3575a377c421bd95ef90ab03e15e34
|
[
"BSD-3-Clause"
] | null | null | null |
v14.2/trunk/source/Modules/DL-Affirm-Payment/java/com/deplabs/affirm/app/b2c/checkout/shipping/impl/AffirmContactModel.java
|
Affirm/Kibo_ML_Affirm
|
d993512dac3575a377c421bd95ef90ab03e15e34
|
[
"BSD-3-Clause"
] | null | null | null | 27.235294 | 83 | 0.815335 | 1,001,258 |
package com.deplabs.affirm.app.b2c.checkout.shipping.impl;
import org.codehaus.jackson.annotate.JsonPropertyOrder;
import com.deplabs.affirm.app.b2c.checkout.shipping.IAffirmAddressModel;
import com.deplabs.affirm.app.b2c.checkout.shipping.IAffirmContactModel;
import com.deplabs.affirm.app.b2c.checkout.shipping.IAffirmPersonModel;
import com.marketlive.app.common.components.ModelData;
@JsonPropertyOrder({IAffirmContactModel.PERSON,IAffirmContactModel.ADDRESS})
public class AffirmContactModel extends ModelData implements IAffirmContactModel {
@Override
public IAffirmPersonModel getName() {
return getAttribute(PERSON);
}
@Override
public void setName(IAffirmPersonModel name) {
setAttribute(PERSON, name);
}
@Override
public IAffirmAddressModel getAddress() {
return getAttribute(ADDRESS);
}
@Override
public void setAddress(IAffirmAddressModel address) {
setAttribute(ADDRESS,address);
}
}
|
923fb41ceda9315acf285fd86933fde73e1cad88
| 3,212 |
java
|
Java
|
clients/google-api-services-networkmanagement/v1beta1/1.31.0/com/google/api/services/networkmanagement/v1beta1/model/VpcConnectorInfo.java
|
yoshi-code-bot/google-api-java-client-services
|
9f5e3b6073c822db4078d638c980b11a0effc686
|
[
"Apache-2.0"
] | null | null | null |
clients/google-api-services-networkmanagement/v1beta1/1.31.0/com/google/api/services/networkmanagement/v1beta1/model/VpcConnectorInfo.java
|
yoshi-code-bot/google-api-java-client-services
|
9f5e3b6073c822db4078d638c980b11a0effc686
|
[
"Apache-2.0"
] | null | null | null |
clients/google-api-services-networkmanagement/v1beta1/1.31.0/com/google/api/services/networkmanagement/v1beta1/model/VpcConnectorInfo.java
|
yoshi-code-bot/google-api-java-client-services
|
9f5e3b6073c822db4078d638c980b11a0effc686
|
[
"Apache-2.0"
] | null | null | null | 27.689655 | 182 | 0.691781 | 1,001,259 |
/*
* 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.
*/
/*
* This code was generated by https://github.com/googleapis/google-api-java-client-services/
* Modify at your own risk.
*/
package com.google.api.services.networkmanagement.v1beta1.model;
/**
* For display only. Metadata associated with a VPC connector.
*
* <p> This is the Java data model class that specifies how to parse/serialize into the JSON that is
* transmitted over HTTP when working with the Network Management API. For a detailed explanation
* see:
* <a href="https://developers.google.com/api-client-library/java/google-http-java-client/json">https://developers.google.com/api-client-library/java/google-http-java-client/json</a>
* </p>
*
* @author Google, Inc.
*/
@SuppressWarnings("javadoc")
public final class VpcConnectorInfo extends com.google.api.client.json.GenericJson {
/**
* Name of a VPC connector.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String displayName;
/**
* Location in which the VPC connector is deployed.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String location;
/**
* URI of a VPC connector.
* The value may be {@code null}.
*/
@com.google.api.client.util.Key
private java.lang.String uri;
/**
* Name of a VPC connector.
* @return value or {@code null} for none
*/
public java.lang.String getDisplayName() {
return displayName;
}
/**
* Name of a VPC connector.
* @param displayName displayName or {@code null} for none
*/
public VpcConnectorInfo setDisplayName(java.lang.String displayName) {
this.displayName = displayName;
return this;
}
/**
* Location in which the VPC connector is deployed.
* @return value or {@code null} for none
*/
public java.lang.String getLocation() {
return location;
}
/**
* Location in which the VPC connector is deployed.
* @param location location or {@code null} for none
*/
public VpcConnectorInfo setLocation(java.lang.String location) {
this.location = location;
return this;
}
/**
* URI of a VPC connector.
* @return value or {@code null} for none
*/
public java.lang.String getUri() {
return uri;
}
/**
* URI of a VPC connector.
* @param uri uri or {@code null} for none
*/
public VpcConnectorInfo setUri(java.lang.String uri) {
this.uri = uri;
return this;
}
@Override
public VpcConnectorInfo set(String fieldName, Object value) {
return (VpcConnectorInfo) super.set(fieldName, value);
}
@Override
public VpcConnectorInfo clone() {
return (VpcConnectorInfo) super.clone();
}
}
|
923fb53a524caa101a83e46553f47fd63d015227
| 4,114 |
java
|
Java
|
jar-infer/jar-infer-cli/src/main/java/com/uber/nullaway/jarinfer/JarInfer.java
|
KengoTODA/NullAway
|
2f9e565a98e10f1901afc554ac3646c8e98aa2e9
|
[
"MIT"
] | 3,229 |
2017-09-06T16:36:25.000Z
|
2022-03-28T11:49:01.000Z
|
jar-infer/jar-infer-cli/src/main/java/com/uber/nullaway/jarinfer/JarInfer.java
|
KengoTODA/NullAway
|
2f9e565a98e10f1901afc554ac3646c8e98aa2e9
|
[
"MIT"
] | 434 |
2017-09-06T20:58:04.000Z
|
2022-03-26T16:11:05.000Z
|
jar-infer/jar-infer-cli/src/main/java/com/uber/nullaway/jarinfer/JarInfer.java
|
KengoTODA/NullAway
|
2f9e565a98e10f1901afc554ac3646c8e98aa2e9
|
[
"MIT"
] | 284 |
2017-09-06T18:48:09.000Z
|
2022-03-28T07:45:35.000Z
| 35.465517 | 98 | 0.616432 | 1,001,260 |
/*
* Copyright (C) 2018. Uber Technologies
*
* 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.uber.nullaway.jarinfer;
import java.io.File;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
/** CLI interface for running the jarinfer analysis. {@link DefinitelyDerefedParamsDriver} */
public class JarInfer {
private static final String appName = JarInfer.class.getName();
/**
* This is the main method of the cli tool. It parses the arguments, invokes the analysis driver
* and checks that the output file is written.
*
* @param args Command line arguments.
*/
public static void main(String[] args) throws Exception {
Options options = new Options();
HelpFormatter hf = new HelpFormatter();
hf.setWidth(100);
options.addOption(
Option.builder("i")
.argName("in_path")
.longOpt("input-file")
.hasArg()
.required()
.desc("path to target jar/aar file")
.build());
options.addOption(
Option.builder("p")
.argName("pkg_name")
.longOpt("package")
.hasArg()
.desc("qualified package name")
.build());
options.addOption(
Option.builder("o")
.argName("out_path")
.longOpt("output-file")
.hasArg()
.required()
.desc("path to processed jar/aar file")
.build());
options.addOption(
Option.builder("b")
.argName("annotate_bytecode")
.longOpt("annotate_bytecode")
.desc("annotate bytecode")
.build());
options.addOption(
Option.builder("s")
.argName("strip-jar-signatures")
.longOpt("strip-jar-signatures")
.desc("handle signed jars by removing signature information from META-INF/")
.build());
options.addOption(
Option.builder("h")
.argName("help")
.longOpt("help")
.desc("print usage information")
.build());
options.addOption(
Option.builder("d")
.argName("debug")
.longOpt("debug")
.desc("print debug information")
.build());
options.addOption(
Option.builder("v").argName("verbose").longOpt("verbose").desc("set verbosity").build());
try {
CommandLine line = new DefaultParser().parse(options, args);
if (line.hasOption('h')) {
hf.printHelp(appName, options, true);
return;
}
String jarPath = line.getOptionValue('i');
String pkgName = line.getOptionValue('p', "");
String outPath = line.getOptionValue('o');
boolean annotateBytecode = line.hasOption('b');
boolean stripJarSignatures = line.hasOption('s');
boolean debug = line.hasOption('d');
boolean verbose = line.hasOption('v');
if (!pkgName.isEmpty()) {
pkgName = "L" + pkgName.replaceAll("\\.", "/");
}
DefinitelyDerefedParamsDriver driver = new DefinitelyDerefedParamsDriver();
driver.run(
jarPath, pkgName, outPath, annotateBytecode, stripJarSignatures, false, debug, verbose);
if (!new File(outPath).exists()) {
System.out.println("Could not write jar file: " + outPath);
}
} catch (ParseException pe) {
hf.printHelp(appName, options, true);
}
}
}
|
923fb54e0a447bc52d435af9f7263060be94d655
| 364 |
java
|
Java
|
every question/20210726 (2).java
|
guyihan-zb/xiangmu
|
51c296deb3a3d949704405e2e046718e3ced2303
|
[
"Apache-2.0"
] | null | null | null |
every question/20210726 (2).java
|
guyihan-zb/xiangmu
|
51c296deb3a3d949704405e2e046718e3ced2303
|
[
"Apache-2.0"
] | null | null | null |
every question/20210726 (2).java
|
guyihan-zb/xiangmu
|
51c296deb3a3d949704405e2e046718e3ced2303
|
[
"Apache-2.0"
] | null | null | null | 21.411765 | 54 | 0.568681 | 1,001,261 |
//整数中1出现的次数(从1到n整数中1出现的次数)
public class Solution {
public int NumberOf1Between1AndN_Solution(int n) {
int count=0;
StringBuffer s=new StringBuffer();
for(int i=1;i<n+1;i++){
s.append(i);
}
String str=s.toString();
for(int i=0;i<str.length();i++){
if(str.charAt(i)=='1')
count++;
}
return count;
}
}
|
923fb5e4807260b1ae7476e30b2e7f40dc03e593
| 785 |
java
|
Java
|
app/src/main/java/com/example/talangweather/util/StatusBarUtil.java
|
huangguojia/TaLangWeather
|
e5d2cbc7438f89637fb05962a06f057935521492
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/example/talangweather/util/StatusBarUtil.java
|
huangguojia/TaLangWeather
|
e5d2cbc7438f89637fb05962a06f057935521492
|
[
"MIT"
] | null | null | null |
app/src/main/java/com/example/talangweather/util/StatusBarUtil.java
|
huangguojia/TaLangWeather
|
e5d2cbc7438f89637fb05962a06f057935521492
|
[
"MIT"
] | null | null | null | 27.068966 | 79 | 0.578344 | 1,001,262 |
package com.example.talangweather.util;
import android.content.Context;
import java.lang.reflect.Field;
public class StatusBarUtil {
//获取状态栏高度
public static int getStatusBarHeight(Context context) {
Class<?> c = null;
Object obj = null;
Field field = null;
int x = 0, statusBarHeight = 0;
try {
c = Class.forName("com.android.internal.R$dimen");
obj = c.newInstance();
field = c.getField("status_bar_height");
x = Integer.parseInt(field.get(obj).toString());
statusBarHeight = context.getResources().getDimensionPixelSize(x);
} catch (Exception e1) {
e1.printStackTrace();
}
return statusBarHeight;
}
}
|
923fb7a52b9bb80a350bb3286c5bc8070f6ddb7a
| 2,094 |
java
|
Java
|
projects/things/src/things/data/ReceiptList.java
|
erich-gatejen/things
|
731e28ad9b30f03b644c2c906e8af4bc663f07a6
|
[
"Apache-2.0"
] | null | null | null |
projects/things/src/things/data/ReceiptList.java
|
erich-gatejen/things
|
731e28ad9b30f03b644c2c906e8af4bc663f07a6
|
[
"Apache-2.0"
] | null | null | null |
projects/things/src/things/data/ReceiptList.java
|
erich-gatejen/things
|
731e28ad9b30f03b644c2c906e8af4bc663f07a6
|
[
"Apache-2.0"
] | null | null | null | 29.492958 | 159 | 0.649475 | 1,001,263 |
/**
* THINGS/THINGER 2009
* Copyright Erich P Gatejen (c) 2001 through 2009 ALL RIGHTS RESERVED
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package things.data;
import java.util.Iterator;
import java.util.LinkedHashSet;
/**
* This is standard receipt list.
* <p>
* @author Erich P. Gatejen
* @version 1.0
* <p>
* <i>Version History</i>
* <pre>EPG - Initial - 2 JUL 05
* </pre>
*/
public class ReceiptList extends LinkedHashSet<Receipt> {
final static long serialVersionUID = 1;
/**
* Get the first receipt in the list or a blank receipt ( as created by the Receipt default constructor). If it returns a null, something very bad happened.
* @return the first receipt.
* @see things.data.Receipt
*/
public Receipt first() {
Receipt result = null;
if (this.size() > 0) {
result = this.iterator().next();
} else {
try {
result = new Receipt();
} catch (Throwable ee) {
// SCREWED UP GOOD AND PROPER
}
}
return result;
}
/**
* Get the first receipt that is OK and TERMINAL. If none are, it'll return null.
* @return the first receipt or a null.
* @see things.data.Receipt
*/
public Receipt firstOk() {
if (this.size() > 0) {
// Not sure why it wont let me use the new FOR here. Perhaps it is just eclipse.
Receipt item;
Iterator<Receipt> items = this.iterator();
while (items.hasNext()) {
item = items.next();
if ((item.getType().isOk()) && (item.getType().isTerminal())) return item;
}
}
return null;
}
}
|
923fb8be049957de49d4b80086f6471a3ee77d9a
| 4,771 |
java
|
Java
|
trunk/adhoc-solr/src/main/java/org/apache/lucene/search/TermRangeFilter.java
|
yblucky/mdrill
|
8621180ac977e670a8e50a16053d4fce2b1c6a3e
|
[
"ICU",
"Apache-2.0"
] | 1,104 |
2015-01-01T07:45:27.000Z
|
2022-03-31T04:09:24.000Z
|
trunk/adhoc-solr/src/main/java/org/apache/lucene/search/TermRangeFilter.java
|
jwpttcg66/mdrill
|
3acf33cfa72527fc1d949e933cc87fba340f2524
|
[
"ICU",
"Apache-2.0"
] | 7 |
2020-03-04T21:45:38.000Z
|
2021-12-09T19:59:55.000Z
|
trunk/adhoc-solr/src/main/java/org/apache/lucene/search/TermRangeFilter.java
|
jwpttcg66/mdrill
|
3acf33cfa72527fc1d949e933cc87fba340f2524
|
[
"ICU",
"Apache-2.0"
] | 579 |
2015-01-04T06:40:10.000Z
|
2022-03-28T11:53:15.000Z
| 43.770642 | 103 | 0.726263 | 1,001,264 |
package org.apache.lucene.search;
/**
* 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.
*/
import java.text.Collator;
/**
* A Filter that restricts search results to a range of term
* values in a given field.
*
* <p>This filter matches the documents looking for terms that fall into the
* supplied range according to {@link
* String#compareTo(String)}, unless a <code>Collator</code> is provided. It is not intended
* for numerical ranges; use {@link NumericRangeFilter} instead.
*
* <p>If you construct a large number of range filters with different ranges but on the
* same field, {@link FieldCacheRangeFilter} may have significantly better performance.
* @since 2.9
*/
public class TermRangeFilter extends MultiTermQueryWrapperFilter<TermRangeQuery> {
/**
* @param fieldName The field this range applies to
* @param lowerTerm The lower bound on this range
* @param upperTerm The upper bound on this range
* @param includeLower Does this range include the lower bound?
* @param includeUpper Does this range include the upper bound?
* @throws IllegalArgumentException if both terms are null or if
* lowerTerm is null and includeLower is true (similar for upperTerm
* and includeUpper)
*/
public TermRangeFilter(String fieldName, String lowerTerm, String upperTerm,
boolean includeLower, boolean includeUpper) {
super(new TermRangeQuery(fieldName, lowerTerm, upperTerm, includeLower, includeUpper));
}
/**
* <strong>WARNING:</strong> Using this constructor and supplying a non-null
* value in the <code>collator</code> parameter will cause every single
* index Term in the Field referenced by lowerTerm and/or upperTerm to be
* examined. Depending on the number of index Terms in this Field, the
* operation could be very slow.
*
* @param lowerTerm The lower bound on this range
* @param upperTerm The upper bound on this range
* @param includeLower Does this range include the lower bound?
* @param includeUpper Does this range include the upper bound?
* @param collator The collator to use when determining range inclusion; set
* to null to use Unicode code point ordering instead of collation.
* @throws IllegalArgumentException if both terms are null or if
* lowerTerm is null and includeLower is true (similar for upperTerm
* and includeUpper)
*/
public TermRangeFilter(String fieldName, String lowerTerm, String upperTerm,
boolean includeLower, boolean includeUpper,
Collator collator) {
super(new TermRangeQuery(fieldName, lowerTerm, upperTerm, includeLower, includeUpper, collator));
}
/**
* Constructs a filter for field <code>fieldName</code> matching
* less than or equal to <code>upperTerm</code>.
*/
public static TermRangeFilter Less(String fieldName, String upperTerm) {
return new TermRangeFilter(fieldName, null, upperTerm, false, true);
}
/**
* Constructs a filter for field <code>fieldName</code> matching
* greater than or equal to <code>lowerTerm</code>.
*/
public static TermRangeFilter More(String fieldName, String lowerTerm) {
return new TermRangeFilter(fieldName, lowerTerm, null, true, false);
}
/** Returns the field name for this filter */
public String getField() { return query.getField(); }
/** Returns the lower value of this range filter */
public String getLowerTerm() { return query.getLowerTerm(); }
/** Returns the upper value of this range filter */
public String getUpperTerm() { return query.getUpperTerm(); }
/** Returns <code>true</code> if the lower endpoint is inclusive */
public boolean includesLower() { return query.includesLower(); }
/** Returns <code>true</code> if the upper endpoint is inclusive */
public boolean includesUpper() { return query.includesUpper(); }
/** Returns the collator used to determine range inclusion, if any. */
public Collator getCollator() { return query.getCollator(); }
}
|
923fb8cfae8160bdb188f9772cf3a0ffb56ca20a
| 1,725 |
java
|
Java
|
src/main/java/ca/uhn/fhir/jpa/starter/myhw/message/MyhwMessageUtil.java
|
joohyukjung/fhir
|
0bbb5741b3f760135d96074bf0a46462a557c73e
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/ca/uhn/fhir/jpa/starter/myhw/message/MyhwMessageUtil.java
|
joohyukjung/fhir
|
0bbb5741b3f760135d96074bf0a46462a557c73e
|
[
"Apache-2.0"
] | null | null | null |
src/main/java/ca/uhn/fhir/jpa/starter/myhw/message/MyhwMessageUtil.java
|
joohyukjung/fhir
|
0bbb5741b3f760135d96074bf0a46462a557c73e
|
[
"Apache-2.0"
] | null | null | null | 23 | 81 | 0.689855 | 1,001,265 |
package ca.uhn.fhir.jpa.starter.myhw.message;
import java.text.MessageFormat;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
*
* @ClassName : MyhwMessageUtil.java
* @Description :
* @Modification
* 수정일 수정자 수정내용
* --------- ------- ------------------------
* 2022. 1. 4 iteyes-hskim 최초작성
*
* @author iteyes-hskim
* @since 2022. 1. 4
* @version 1.0
* @see
*/
@Component
public class MyhwMessageUtil {
@Autowired
private MyhwMessageSource myhwMessageSource;
private static MyhwMessageSource sMyhwMessageSource;
@PostConstruct
public void instance() {
MyhwMessageUtil.sMyhwMessageSource = myhwMessageSource;
}
public static String getMessage(String code) {
String strMsg = sMyhwMessageSource.getMessage(code);
return strMsg != null ? strMsg : null;
}
public static String getMessage(String code, String obj) {
String strMsg = sMyhwMessageSource.getMessageArgs(code, new String[] { obj });
return strMsg;
}
public static String getMessage(String code, String[] args) {
String strMsg = sMyhwMessageSource.getMessageArgs(code, args);
return strMsg;
}
public static String generateMessage(String errorCode, Object[] params) {
String errorMessage = getMessage(errorCode);
if (errorMessage == null)
return null;
if (params != null) {
errorMessage = applyFormat(errorMessage, params);
}
return errorMessage;
}
private static String applyFormat(String errorMessage, Object[] params) {
MessageFormat mf = new MessageFormat(errorMessage);
return mf.format(params);
}
}
|
923fb9de28c7b342545bd83653c8f04823b74fda
| 789 |
java
|
Java
|
src/com/sentosatech/worldcup2014de/utility/SmartLog.java
|
WolfgangHolzem/worldcup
|
fbc374377fdc75b3610d04ceb6692689fb00f54f
|
[
"Apache-2.0"
] | 1 |
2020-05-27T14:21:14.000Z
|
2020-05-27T14:21:14.000Z
|
src/com/sentosatech/worldcup2014de/utility/SmartLog.java
|
WolfgangHolzem/worldcup
|
fbc374377fdc75b3610d04ceb6692689fb00f54f
|
[
"Apache-2.0"
] | null | null | null |
src/com/sentosatech/worldcup2014de/utility/SmartLog.java
|
WolfgangHolzem/worldcup
|
fbc374377fdc75b3610d04ceb6692689fb00f54f
|
[
"Apache-2.0"
] | 1 |
2020-08-09T09:53:52.000Z
|
2020-08-09T09:53:52.000Z
| 19.243902 | 70 | 0.629911 | 1,001,266 |
/*
* Name: SmartLog.java,v $
* Version: $Revision: 1.4 $
* Date: $Date: Nov 15, 2013 2:05:59 PM $
*
* Copyright (C) Wolfgang Holzem - All rights reserved.
*/
package com.sentosatech.worldcup2014de.utility;
import android.util.Log;
import com.sentosatech.worldcup2014de.activity.config.ConfigSmartLog;
public final class SmartLog {
/**
* Call SmartLog.log
*
* @param TAG
* @param msg
*/
public static void log(String TAG, String msg) {
if (ConfigSmartLog.DEBUG_MODE) {
Log.d(TAG, msg);
}
}
public static void logWS(String TAG, String msg) {
if (ConfigSmartLog.DEBUG_WS) {
Log.w(TAG, msg);
}
}
public static void logDB(String TAG, String msg) {
if (ConfigSmartLog.DEBUG_DB) {
Log.e(TAG, msg);
}
}
}
|
923fba50a93c1d00cb0c11879df0f25d1c2285da
| 264 |
java
|
Java
|
middlewarelib/src/main/java/com/instantgcm/middleware/net/MiddlewareDataInterface.java
|
Sneha010/Push_Using_Retrofit
|
85d1532bce5eb91c5998bc4115a87ead4ef54514
|
[
"Apache-2.0"
] | null | null | null |
middlewarelib/src/main/java/com/instantgcm/middleware/net/MiddlewareDataInterface.java
|
Sneha010/Push_Using_Retrofit
|
85d1532bce5eb91c5998bc4115a87ead4ef54514
|
[
"Apache-2.0"
] | null | null | null |
middlewarelib/src/main/java/com/instantgcm/middleware/net/MiddlewareDataInterface.java
|
Sneha010/Push_Using_Retrofit
|
85d1532bce5eb91c5998bc4115a87ead4ef54514
|
[
"Apache-2.0"
] | null | null | null | 14.666667 | 42 | 0.693182 | 1,001,267 |
package com.instantgcm.middleware.net;
/**
* Created by Sneha Khadatare : 587823
* on 4/18/2016.
*/
public interface MiddlewareDataInterface {
String getBaseURL();
String getDeviceId();
String getProjectId();
boolean isLoggingEnabled();
}
|
923fbaad3972e93e297bb25d33c88550cd881a87
| 1,897 |
java
|
Java
|
JavaSource/lebah/report/Record.java
|
nawawi/LebahFramework
|
a16f9859f2a65fdd2987fd20f1ab4235828e2916
|
[
"Apache-2.0"
] | 1 |
2022-03-20T08:56:23.000Z
|
2022-03-20T08:56:23.000Z
|
JavaSource/lebah/report/Record.java
|
aalihusni/LebahFramework
|
97a31c43faa0e8c18b00411f578b18616b8e32d2
|
[
"Apache-2.0"
] | null | null | null |
JavaSource/lebah/report/Record.java
|
aalihusni/LebahFramework
|
97a31c43faa0e8c18b00411f578b18616b8e32d2
|
[
"Apache-2.0"
] | 1 |
2021-05-31T05:09:25.000Z
|
2021-05-31T05:09:25.000Z
| 25.986301 | 79 | 0.654191 | 1,001,268 |
/* ************************************************************************
LEBAH PORTAL FRAMEWORK, http://lebah.sf.net
Copyright (C) 2007 Shamsul Bahrin
This program is free software; you can redistribute it and/or
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* ************************************************************************ */
package lebah.report;
import java.util.ArrayList;
import java.util.List;
/**
* @author Shamsul Bahrin Abd Mutalib
* @version 1.01
*/
public class Record {
private String id;
private RecordHeader header;
private List items;
private int col;
private int itemnum;
private boolean moreItem;
private List properties;
public Record(RecordHeader h) {
header = h;
items = new ArrayList();
properties = new ArrayList();
}
public void add(String data) {
if (col < header.getCols()) {
items.add(data);
properties.add(new Property());
col++;
moreItem = true;
}
}
public String next() {
String data = "";
if (itemnum < header.getCols()) {
data = (String) items.get(itemnum);
itemnum++;
if (itemnum == header.getCols()) moreItem = false;
}
return data;
}
public boolean hasNext() {
return moreItem;
}
public void setProperty(int i, Property prop) {
properties.set(i, prop);
}
public Property getPropertyAt(int i) {
return (Property) properties.get(i);
}
public void setId(String id) { this.id = id; }
public String getId() { return this.id; }
public RecordHeader getHeader() { return header; }
}
|
923fbaad86325eba52bb38132b960328e2d85ef9
| 696 |
java
|
Java
|
disconnect-classlib/src/main/java/js/util/iterable/IntIterator.java
|
fluorumlabs/disconnect-project
|
54f4ea5e6f05265ea985e1ee615cc3d59d5842b4
|
[
"Apache-2.0"
] | 4 |
2019-08-21T12:30:11.000Z
|
2020-11-03T07:37:16.000Z
|
disconnect-classlib/src/main/java/js/util/iterable/IntIterator.java
|
fluorumlabs/disconnect-project
|
54f4ea5e6f05265ea985e1ee615cc3d59d5842b4
|
[
"Apache-2.0"
] | 7 |
2020-02-05T08:13:00.000Z
|
2020-07-09T16:50:30.000Z
|
disconnect-classlib/src/main/java/js/util/iterable/IntIterator.java
|
fluorumlabs/disconnect-project
|
54f4ea5e6f05265ea985e1ee615cc3d59d5842b4
|
[
"Apache-2.0"
] | 1 |
2020-06-25T11:56:48.000Z
|
2020-06-25T11:56:48.000Z
| 24 | 67 | 0.686782 | 1,001,269 |
package js.util.iterable;
import js.lang.Any;
import org.teavm.jso.JSBody;
import java.util.Iterator;
public interface IntIterator extends Any {
@JSBody(script = "return this.next()")
IntIteratorResult doNext();
@JSBody(params = "value", script = "return this.return(value)")
IntIteratorResult doReturn(int value);
@JSBody(script = "return this.return()")
IntIteratorResult doReturn();
@JSBody(params = "e", script = "return this.throw(e)")
IntIteratorResult doThrow(Any e);
@JSBody(script = "return this.throw()")
IntIteratorResult doThrow();
default Iterator<Integer> getJavaIterator() {
return new IntIteratorWrapper(this);
}
}
|
923fbb0b466a90552565fa68d98e9466a96e3f10
| 1,893 |
java
|
Java
|
src/main/java/com/qa/ims/persistence/domain/Item.java
|
RichMans96/IMS
|
afbd67ff11d45ecd69ff6e148ba01cc4cf69b082
|
[
"MIT"
] | null | null | null |
src/main/java/com/qa/ims/persistence/domain/Item.java
|
RichMans96/IMS
|
afbd67ff11d45ecd69ff6e148ba01cc4cf69b082
|
[
"MIT"
] | null | null | null |
src/main/java/com/qa/ims/persistence/domain/Item.java
|
RichMans96/IMS
|
afbd67ff11d45ecd69ff6e148ba01cc4cf69b082
|
[
"MIT"
] | 1 |
2021-09-30T10:45:16.000Z
|
2021-09-30T10:45:16.000Z
| 22.270588 | 85 | 0.665082 | 1,001,270 |
package com.qa.ims.persistence.domain;
public class Item {
private Long itemId;
private String itemName;
private Double itemPrice;
public Item(String itemName, Double itemPrice) {
this.setItemName(itemName);
this.setItemPrice(itemPrice);
}
public Item(Long itemId, String itemName, Double itemPrice) {
this.setItemId(itemId);
this.setItemName(itemName);
this.setItemPrice(itemPrice);
}
public Long getItemId() {
return itemId;
}
public void setItemId(Long itemId) {
this.itemId = itemId;
}
public String getItemName() {
return itemName;
}
public void setItemName(String itemName) {
this.itemName = itemName;
}
public Double getItemPrice() {
return itemPrice;
}
public void setItemPrice(Double itemPrice) {
this.itemPrice = itemPrice;
}
@Override
public String toString() {
return "item id:" + itemId + " item name:" + itemName + " item price:" + itemPrice;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((itemName == null) ? 0 : itemName.hashCode());
result = prime * result + ((itemId == null) ? 0 : itemId.hashCode());
result = prime * result + ((itemPrice == null) ? 0 : itemPrice.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Item other = (Item) obj;
if (getItemName() == null) {
if (other.getItemName() != null)
return false;
} else if (!getItemName().equals(other.getItemName()))
return false;
if (itemId == null) {
if (other.itemId != null)
return false;
} else if (!itemId.equals(other.itemId))
return false;
if (itemPrice == null) {
if (other.itemPrice != null)
return false;
} else if (!itemPrice.equals(other.itemPrice))
return false;
return true;
}
}
|
923fbb8c2e2d8dbf28a440fb3bf2f4829679121c
| 1,846 |
java
|
Java
|
src/test/java/com/google/jenkins/plugins/storage/StdoutUploadTest.java
|
astroilov/google-storage-plugin
|
6515687b2f53a9f6655fbe9319efe2c71b8c501e
|
[
"Apache-2.0"
] | null | null | null |
src/test/java/com/google/jenkins/plugins/storage/StdoutUploadTest.java
|
astroilov/google-storage-plugin
|
6515687b2f53a9f6655fbe9319efe2c71b8c501e
|
[
"Apache-2.0"
] | null | null | null |
src/test/java/com/google/jenkins/plugins/storage/StdoutUploadTest.java
|
astroilov/google-storage-plugin
|
6515687b2f53a9f6655fbe9319efe2c71b8c501e
|
[
"Apache-2.0"
] | null | null | null | 30.262295 | 75 | 0.744854 | 1,001,271 |
/*
* Copyright 2013 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.jenkins.plugins.storage;
import java.io.IOException;
import static org.junit.Assert.assertEquals;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.mockito.MockitoAnnotations;
import com.google.jenkins.plugins.storage.StdoutUpload.DescriptorImpl;
import hudson.util.FormValidation;
/**
* Unit test for {@link StdoutUpload} and friends.
*/
public class StdoutUploadTest {
@Rule public JenkinsRule jenkins = new JenkinsRule();
@Before
public void setup() throws Exception {
MockitoAnnotations.initMocks(this);
}
@Test
public void doCheckLogNameTest() throws IOException {
DescriptorImpl descriptor = new DescriptorImpl();
assertEquals(FormValidation.Kind.OK,
descriptor.doCheckLogName("asdf").kind);
// Successfully resolved
assertEquals(FormValidation.Kind.OK,
descriptor.doCheckLogName("asdf$BUILD_NUMBER").kind);
// UN-successfully resolved
assertEquals(FormValidation.Kind.ERROR,
descriptor.doCheckLogName("$foo").kind);
// Escaped $BUILD_NUMBER
assertEquals(FormValidation.Kind.ERROR,
descriptor.doCheckLogName("$$BUILD_NUMBER").kind);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.