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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
923c335aa039de4f29cdb0838aa1d8d7719e8e9f | 587 | java | Java | src/test/java/uk/co/mruoc/file/content/Base64FileContentLoaderTest.java | michaelruocco/property-loader | b339f4fe860cad538c0d9d229cb61bea5a87a0f3 | [
"MIT"
] | null | null | null | src/test/java/uk/co/mruoc/file/content/Base64FileContentLoaderTest.java | michaelruocco/property-loader | b339f4fe860cad538c0d9d229cb61bea5a87a0f3 | [
"MIT"
] | null | null | null | src/test/java/uk/co/mruoc/file/content/Base64FileContentLoaderTest.java | michaelruocco/property-loader | b339f4fe860cad538c0d9d229cb61bea5a87a0f3 | [
"MIT"
] | null | null | null | 26.681818 | 87 | 0.758092 | 999,865 | package uk.co.mruoc.file.content;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
class Base64FileContentLoaderTest {
private final FileContentLoader cannedLoader = new CannedFileContentLoader();
private final FileContentLoader loader = new Base64FileContentLoader(cannedLoader);
@Test
void shouldReturnBase64EncodedFileContent() {
String expectedContent = "Y2FubmVkIGZpbGUgY29udGVudA==";
String content = loader.loadContent("any/path");
assertThat(content).isEqualTo(expectedContent);
}
}
|
923c34b00d6fdd143fd918d5f1fdce9e89278c0f | 3,705 | java | Java | app/src/main/java/com/example/blix/ui/search/SearchPresenter.java | Omar099/Blix | 08f7096585a88af0d5f383c8cbae728ca922ed76 | [
"MIT"
] | null | null | null | app/src/main/java/com/example/blix/ui/search/SearchPresenter.java | Omar099/Blix | 08f7096585a88af0d5f383c8cbae728ca922ed76 | [
"MIT"
] | null | null | null | app/src/main/java/com/example/blix/ui/search/SearchPresenter.java | Omar099/Blix | 08f7096585a88af0d5f383c8cbae728ca922ed76 | [
"MIT"
] | null | null | null | 33.681818 | 102 | 0.597301 | 999,866 | package com.example.blix.ui.search;
import android.util.Log;
import com.example.blix.api.ApiClient;
import com.example.blix.model.ResponseDiscover;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class SearchPresenter implements SearchListener.Presenter {
private static String TAG = SearchPresenter.class.getSimpleName();
ResponseDiscover itemsMedia;
private ApiClient apiClient;
private SearchListener.View view;
public SearchPresenter(ResponseDiscover itemsMedia, ApiClient apiClient) {
this.itemsMedia = itemsMedia;
this.apiClient = apiClient;
}
@Override
public void setView(SearchListener.View view) {
this.view = view;
itemsMedia = new ResponseDiscover();
}
@Override
public void getSearchRequest(String apiKey, String lang, String query, int pag) {
Call<ResponseDiscover> call = apiClient.getSearchMovie(apiKey, lang, query, pag);
call.enqueue(new Callback<ResponseDiscover>() {
@Override
public void onResponse(Call<ResponseDiscover> call, Response<ResponseDiscover> response) {
if (response.isSuccessful()) {
itemsMedia = response.body();
// view.showSearchList(itemsMedia);
}
view.showSearchList(itemsMedia);
}
@Override
public void onFailure(Call<ResponseDiscover> call, Throwable t) {
Log.e(TAG, "onFailure: ", t);
}
});
}
@Override
public void getPopularRequest(String apiKey, String lang, int pag) {
Call<ResponseDiscover> call = apiClient.getPopularMovies(apiKey, lang, pag);
call.enqueue(new Callback<ResponseDiscover>() {
@Override
public void onResponse(Call<ResponseDiscover> call, Response<ResponseDiscover> response) {
if (response.isSuccessful()) {
itemsMedia = response.body();
}
view.showPopularList(itemsMedia);
}
@Override
public void onFailure(Call<ResponseDiscover> call, Throwable t) {
Log.e(TAG, "onFailure: ", t);
}
});
}
@Override
public void getTopRatedRequest(String apiKey, String lang, int pag) {
Call<ResponseDiscover> call = apiClient.getTopMovies(apiKey, lang, pag);
call.enqueue(new Callback<ResponseDiscover>() {
@Override
public void onResponse(Call<ResponseDiscover> call, Response<ResponseDiscover> response) {
if (response.isSuccessful()) {
itemsMedia = response.body();
}
view.showTopRatedList(itemsMedia);
}
@Override
public void onFailure(Call<ResponseDiscover> call, Throwable t) {
Log.e(TAG, "onFailure: ", t);
}
});
}
@Override
public void getUpcomingRequest(String apiKey, String lang, int pag) {
Call<ResponseDiscover> call = apiClient.getUpcomingMovies(apiKey, lang, pag);
call.enqueue(new Callback<ResponseDiscover>() {
@Override
public void onResponse(Call<ResponseDiscover> call, Response<ResponseDiscover> response) {
if (response.isSuccessful()) {
itemsMedia = response.body();
}
view.showUpcomingList(itemsMedia);
}
@Override
public void onFailure(Call<ResponseDiscover> call, Throwable t) {
Log.e(TAG, "onFailure: ", t);
}
});
}
}
|
923c367f8ca18925d9c9f253e82ec865775ffcc0 | 5,426 | java | Java | src/main/java/ai/apptuit/metrics/jinsight/ContextualModuleLoader.java | ApptuitAI/jinsight | c6822180695883b3a81a9d33e2c6bdee52b8692a | [
"Apache-2.0"
] | 17 | 2017-09-19T11:36:26.000Z | 2021-06-05T13:08:36.000Z | src/main/java/ai/apptuit/metrics/jinsight/ContextualModuleLoader.java | ApptuitAI/jinsight | c6822180695883b3a81a9d33e2c6bdee52b8692a | [
"Apache-2.0"
] | 79 | 2017-12-21T05:14:34.000Z | 2022-01-21T23:10:05.000Z | src/main/java/ai/apptuit/metrics/jinsight/ContextualModuleLoader.java | ApptuitAI/jinsight | c6822180695883b3a81a9d33e2c6bdee52b8692a | [
"Apache-2.0"
] | 7 | 2017-09-19T16:35:17.000Z | 2019-03-04T10:03:08.000Z | 34.125786 | 97 | 0.682271 | 999,867 | /*
* Copyright 2017 Agilx, 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 ai.apptuit.metrics.jinsight;
import ai.apptuit.metrics.jinsight.ContextualModuleLoader.ModuleClassLoader;
import java.io.File;
import java.io.IOException;
import java.lang.ref.SoftReference;
import java.net.URL;
import java.net.URLClassLoader;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
import org.jboss.byteman.modules.ModuleSystem;
import org.jboss.byteman.rule.helper.Helper;
/**
* @author Rajiv Shivane
*/
public class ContextualModuleLoader implements ModuleSystem<ModuleClassLoader> {
private final Map<ClassLoader, SoftReference<ModuleClassLoader>> moduleLoaders = Collections
.synchronizedMap(new WeakHashMap<>());
public void initialize(String args) {
if (!args.isEmpty()) {
Helper.err("Unexpected module system arguments: " + args);
}
}
public ModuleClassLoader createLoader(ClassLoader triggerClassLoader, String[] imports) {
if (imports.length > 0) {
throw new IllegalArgumentException("IMPORTs are not supported");
}
ModuleClassLoader moduleClassLoader = getModuleClassLoader(triggerClassLoader);
if (moduleClassLoader != null) {
return moduleClassLoader;
}
synchronized (moduleLoaders) {
//Double check idiom
moduleClassLoader = getModuleClassLoader(triggerClassLoader);
if (moduleClassLoader != null) {
return moduleClassLoader;
}
moduleClassLoader = AccessController.doPrivileged(
(PrivilegedAction<ModuleClassLoader>) () -> new ModuleClassLoader(triggerClassLoader));
//Since there are no strong references to moduleClassloader, it might be collected
//We should probably hold a PhantomReference to moduleClassloader
//that is collected only after the triggerClassloader is collected
moduleLoaders.put(triggerClassLoader, new SoftReference<>(moduleClassLoader));
return moduleClassLoader;
}
}
private ModuleClassLoader getModuleClassLoader(ClassLoader triggerClassLoader) {
SoftReference<ModuleClassLoader> reference = moduleLoaders.get(triggerClassLoader);
if (reference != null) {
ModuleClassLoader moduleClassLoader = reference.get();
if (moduleClassLoader != null) {
return moduleClassLoader;
}
}
return null;
}
public void destroyLoader(ModuleClassLoader helperLoader) {
moduleLoaders.remove(helperLoader.getParent());
}
public Class<?> loadHelperAdapter(ModuleClassLoader helperLoader, String helperAdapterName,
byte[] classBytes) {
return helperLoader.addClass(helperAdapterName, classBytes);
}
public static class ModuleClassLoader extends URLClassLoader {
private static final URL[] SYS_CLASS_PATH = getSystemClassPath();
public ModuleClassLoader(ClassLoader cl) {
super(SYS_CLASS_PATH, cl);
}
private static URL[] getSystemClassPath() {
String cp = System.getProperty("java.class.path");
if (cp == null || cp.isEmpty()) {
String initialModuleName = System.getProperty("jdk.module.main");
cp = initialModuleName == null ? "" : null;
}
ArrayList<URL> path = new ArrayList<>();
if (cp != null) {
int off = 0;
int next;
do {
next = cp.indexOf(File.pathSeparator, off);
String element = next == -1 ? cp.substring(off) : cp.substring(off, next);
if (!element.isEmpty()) {
try {
URL url = (new File(element)).getCanonicalFile().toURI().toURL();
path.add(url);
} catch (IOException ignored) {
//Ignore invalid urls
}
}
off = next + 1;
} while (next != -1);
}
path.add(ContextualModuleLoader.class.getProtectionDomain().getCodeSource().getLocation());
return path.toArray(new URL[0]);
}
public Class<?> addClass(String name, byte[] bytes)
throws ClassFormatError {
Class<?> cl = defineClass(name, bytes, 0, bytes.length);
resolveClass(cl);
return cl;
}
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (name.startsWith("ai.apptuit.metrics.jinsight.modules.")) {
Class<?> clazz = findLoadedClass(name);
if (clazz != null) {
return clazz;
}
synchronized (this) {
clazz = findClass(name);
resolveClass(clazz);
return clazz;
}
} else if (name.startsWith("ai.apptuit.metrics.jinsight.")) {
//If jinsight.jar is added to the war, by mistake, we should always go to sys classloader
return ClassLoader.getSystemClassLoader().loadClass(name);
}
return super.loadClass(name);
}
}
}
|
923c376d4a30a40354dd13e60925b8b380242e32 | 12,494 | java | Java | src/main/java/maud/tool/MeshTool.java | stephengold/Maud | 267242dc2d08b4763f407b0b26c24008a1b255da | [
"BSD-3-Clause"
] | 37 | 2017-04-10T19:23:00.000Z | 2022-03-20T23:12:50.000Z | src/main/java/maud/tool/MeshTool.java | stephengold/Maud | 267242dc2d08b4763f407b0b26c24008a1b255da | [
"BSD-3-Clause"
] | 5 | 2017-09-01T21:51:27.000Z | 2021-10-19T00:57:56.000Z | src/main/java/maud/tool/MeshTool.java | stephengold/Maud | 267242dc2d08b4763f407b0b26c24008a1b255da | [
"BSD-3-Clause"
] | 5 | 2020-07-28T21:27:16.000Z | 2022-03-26T23:05:00.000Z | 35.089888 | 81 | 0.571326 | 999,868 | /*
Copyright (c) 2018-2021, Stephen Gold
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package maud.tool;
import com.jme3.bounding.BoundingVolume;
import com.jme3.scene.Geometry;
import com.jme3.scene.Mesh;
import com.jme3.scene.VertexBuffer;
import java.util.List;
import java.util.logging.Logger;
import jme3utilities.nifty.GuiScreenController;
import jme3utilities.nifty.Tool;
import maud.DescribeUtil;
import maud.Maud;
import maud.menu.WhichSpatials;
import maud.model.cgm.Cgm;
import maud.model.cgm.EditableCgm;
import maud.model.cgm.SelectedBuffer;
import maud.model.cgm.SelectedSpatial;
/**
* The controller for the "Mesh" tool in Maud's editor screen.
*
* @author Stephen Gold efpyi@example.com
*/
class MeshTool extends Tool {
// *************************************************************************
// constants and loggers
/**
* message logger for this class
*/
final private static Logger logger
= Logger.getLogger(MeshTool.class.getName());
// *************************************************************************
// constructors
/**
* Instantiate an uninitialized tool.
*
* @param screenController the controller of the screen that will contain
* the tool (not null)
*/
MeshTool(GuiScreenController screenController) {
super(screenController, "mesh");
}
// *************************************************************************
// Tool methods
/**
* Enumerate this tool's check boxes.
*
* @return a new list of names (unique id prefixes)
*/
@Override
protected List<String> listCheckBoxes() {
List<String> result = super.listCheckBoxes();
result.add("vbNormalized");
return result;
}
/**
* Update the MVC model based on a check-box event.
*
* @param name the name (unique id prefix) of the checkbox
* @param isChecked the new state of the checkbox (true→checked,
* false→unchecked)
*/
@Override
public void onCheckBoxChanged(String name, boolean isChecked) {
EditableCgm target = Maud.getModel().getTarget();
switch (name) {
case "vbNormalized":
target.getBuffer().setNormalized(isChecked);
break;
default:
super.onCheckBoxChanged(name, isChecked);
}
}
/**
* Update this tool prior to rendering. (Invoked once per frame while this
* tool is displayed.)
*/
@Override
protected void toolUpdate() {
updateBufferInfo();
updateBufferIndex();
updateGeometryIndex();
updateMeshInfo();
updateSelect();
updateTreePosition();
}
// *************************************************************************
// private methods
/**
* Update the information about the selected vertex buffer.
*/
private void updateBufferInfo() {
String capacityText, formatText, instanceButton;
String limitButton, strideButton, typeText, usageButton;
SelectedBuffer buffer = Maud.getModel().getTarget().getBuffer();
if (buffer.isSelected()) {
int capacity = buffer.capacity();
capacityText = Integer.toString(capacity);
int numComponents = buffer.countComponents();
VertexBuffer.Format format = buffer.format();
if (numComponents == 1) {
formatText = format.toString();
} else {
formatText = String.format("%d x %s", numComponents, format);
}
int limit = buffer.limit();
limitButton = Integer.toString(limit);
int stride = buffer.stride();
strideButton = Integer.toString(stride);
VertexBuffer.Type vbType = buffer.type();
typeText = vbType.toString();
VertexBuffer.Usage usage = buffer.usage();
usageButton = usage.toString();
int instanceSpan = buffer.instanceSpan();
instanceButton = Integer.toString(instanceSpan);
boolean isNormalized = buffer.isNormalized();
setChecked("vbNormalized", isNormalized);
} else {
capacityText = "";
formatText = "";
instanceButton = "";
limitButton = "";
strideButton = "";
typeText = "(none selected)";
usageButton = "";
disableCheckBox("vbNormalized");
}
setStatusText("vbCapacity", capacityText);
setStatusText("vbFormat", " " + formatText);
setButtonText("vbInstanceSpan", instanceButton);
setButtonText("vbLimit", limitButton);
setButtonText("vbStride", strideButton);
setStatusText("vbType", " " + typeText);
setButtonText("vbUsage", usageButton);
}
/**
* Update the buffer-index status and next/previous/delete/select texts.
*/
private void updateBufferIndex() {
String indexStatus;
String nextButton = "", previousButton = "";
String deleteButton = "", selectButton = "";
Cgm target = Maud.getModel().getTarget();
List<String> list = target.getSpatial().listBufferDescs("");
int numBuffers = list.size();
if (numBuffers > 0) {
selectButton = "Select buffer";
}
SelectedBuffer buffer = target.getBuffer();
int selectedIndex = buffer.index();
if (selectedIndex >= 0) {
indexStatus = DescribeUtil.index(selectedIndex, numBuffers);
if (numBuffers > 1) {
nextButton = "+";
previousButton = "-";
}
if (buffer.canDelete()) {
deleteButton = "Delete";
}
} else { // no buffer selected
if (numBuffers == 0) {
indexStatus = "none";
} else if (numBuffers == 1) {
indexStatus = "one buffer";
} else {
indexStatus = String.format("%d buffers", numBuffers);
}
}
setStatusText("vbIndex", indexStatus);
setButtonText("vbNext", nextButton);
setButtonText("vbPrevious", previousButton);
setButtonText("vbDelete", deleteButton);
setButtonText("vbSelect", selectButton);
}
/**
* Update the geometry index status and next/previous buttons.
*/
private void updateGeometryIndex() {
String indexStatus;
String nextButton = "", previousButton = "";
Cgm target = Maud.getModel().getTarget();
int numGeometries = target.countSpatials(Geometry.class);
SelectedSpatial selected = target.getSpatial();
int selectedIndex = selected.findGeometryIndex();
if (selectedIndex >= 0) {
indexStatus = DescribeUtil.index(selectedIndex, numGeometries);
if (numGeometries > 1) {
nextButton = "+";
previousButton = "-";
}
} else { // none selected
if (numGeometries == 0) {
indexStatus = "no geometry";
} else if (numGeometries == 1) {
indexStatus = "one geometry";
} else {
indexStatus = String.format("%d geometries", numGeometries);
}
}
setStatusText("meshIndex", indexStatus);
setButtonText("meshNext", nextButton);
setButtonText("meshPrevious", previousButton);
}
/**
* Update the information on the selected mesh.
*/
private void updateMeshInfo() {
String btButton, calcButton, describeStatus, modeButton;
String indexedButton, lodsText, verticesButton, weightsButton;
SelectedSpatial spatial = Maud.getModel().getTarget().getSpatial();
if (spatial.hasMesh()) {
calcButton = "Recalc normals";
int numElements = spatial.countElements();
describeStatus = Integer.toString(numElements);
if (spatial.hasAnimatedMesh()) {
describeStatus += " animated ";
int maxWeights = spatial.getMaxNumWeights();
weightsButton = Integer.toString(maxWeights);
} else {
describeStatus += " non-animated ";
weightsButton = "";
}
BoundingVolume.Type type = spatial.getWorldBoundType();
if (type == null) {
btButton = "null";
} else {
btButton = type.toString();
}
if (spatial.hasIndexedMesh()) {
indexedButton = "indexed";
} else {
indexedButton = "non-indexed";
}
int numLods = spatial.countLodLevels();
lodsText = Integer.toString(numLods);
Mesh.Mode mode = spatial.getMeshMode();
modeButton = mode.toString();
int numVertices = spatial.countVertices();
verticesButton = Integer.toString(numVertices);
} else {
describeStatus = "no mesh";
btButton = "";
calcButton = "";
indexedButton = "";
lodsText = "";
modeButton = "";
verticesButton = "";
weightsButton = "";
}
setButtonText("meshBoundType", btButton);
setButtonText("meshCalculateNormals", calcButton);
setStatusText("meshElements", describeStatus);
setButtonText("meshIndexed", indexedButton);
setStatusText("meshLods", lodsText);
setButtonText("meshMode", modeButton);
setButtonText("meshVertices", verticesButton);
setButtonText("meshWeights", weightsButton);
}
/**
* Update the geometry-select button.
*/
private void updateSelect() {
String selectButton;
Cgm target = Maud.getModel().getTarget();
List<String> names
= target.listSpatialNames("", WhichSpatials.Geometries);
if (names.isEmpty()) {
selectButton = "";
} else {
selectButton = "Select geometry";
}
setButtonText("meshSelect", selectButton);
}
/**
* Update the display of the geometry's position in the model's scene graph.
*/
private void updateTreePosition() {
String positionText;
SelectedSpatial spatial = Maud.getModel().getTarget().getSpatial();
if (spatial.isCgmRoot()) {
positionText = "model root";
} else {
positionText = spatial.toString();
}
setButtonText("meshTreePosition", positionText);
}
}
|
923c37d31f94893827b19405f213dc4270360b0c | 394 | java | Java | backend/src/main/java/edu/gatech/cdcproject/backend/model/Response.java | HealthInformatics/CDCProject-One | e639dbf9b0c23556dd2db07c3ed35a5aa609325c | [
"MIT"
] | null | null | null | backend/src/main/java/edu/gatech/cdcproject/backend/model/Response.java | HealthInformatics/CDCProject-One | e639dbf9b0c23556dd2db07c3ed35a5aa609325c | [
"MIT"
] | null | null | null | backend/src/main/java/edu/gatech/cdcproject/backend/model/Response.java | HealthInformatics/CDCProject-One | e639dbf9b0c23556dd2db07c3ed35a5aa609325c | [
"MIT"
] | null | null | null | 19.7 | 58 | 0.713198 | 999,869 | package edu.gatech.cdcproject.backend.model;
import com.googlecode.objectify.annotation.Entity;
/**
* Created by guoweidong on 2/18/16.
*/
@Entity
public class Response {
String stringResponse;
public void setStringResponse(String stringResponse) {
this.stringResponse = stringResponse;
}
public String getStringResponse() {
return stringResponse;
}
}
|
923c3928878b78ab811edcb6ec812ef59f26b5c7 | 916 | java | Java | knowledge/src/main/java/org/support/project/knowledge/control/KnowledgeControlBase.java | skylarkjava/skylark-knowledge | ac4b66d53051ddb7cf46921c008d191759fbb57b | [
"MIT"
] | null | null | null | knowledge/src/main/java/org/support/project/knowledge/control/KnowledgeControlBase.java | skylarkjava/skylark-knowledge | ac4b66d53051ddb7cf46921c008d191759fbb57b | [
"MIT"
] | null | null | null | knowledge/src/main/java/org/support/project/knowledge/control/KnowledgeControlBase.java | skylarkjava/skylark-knowledge | ac4b66d53051ddb7cf46921c008d191759fbb57b | [
"MIT"
] | null | null | null | 35.230769 | 79 | 0.716157 | 999,870 | package org.support.project.knowledge.control;
import org.support.project.di.DI;
import org.support.project.di.Instance;
@DI(instance=Instance.Prototype)
public class KnowledgeControlBase extends Control {
protected String setViewParam() {
StringBuilder params = new StringBuilder();
params.append("?keyword=").append(getParamWithDefault("keyword", ""));
params.append("&tag=").append(getParamWithDefault("tag", ""));
params.append("&tagNames=").append(getParamWithDefault("tagNames", ""));
params.append("&user=").append(getParamWithDefault("user", ""));
params.append("&offset=").append(getParamWithDefault("offset", ""));
if (super.getLoginedUser() != null) {
params.append("&group=").append(getParamWithDefault("group", ""));
params.append("&groupNames=").append(getParamWithDefault("groupNames", ""));
}
setAttribute("params", params.toString());
return params.toString();
}
}
|
923c39822ec66f3aeb557a460a199aea08b90c7d | 3,310 | java | Java | src/Hand.java | catherineweiss/Blackjack | 2b601ce6b522956e6b6f8dace192950e98c8f455 | [
"MIT"
] | null | null | null | src/Hand.java | catherineweiss/Blackjack | 2b601ce6b522956e6b6f8dace192950e98c8f455 | [
"MIT"
] | null | null | null | src/Hand.java | catherineweiss/Blackjack | 2b601ce6b522956e6b6f8dace192950e98c8f455 | [
"MIT"
] | null | null | null | 19.022989 | 69 | 0.638671 | 999,871 | import java.util.ArrayList;
/**
* Represents a hand of playing cards in a particular round of a game
* @author Catherine Weiss
*
*/
public class Hand {
private Player player;
private ArrayList<Card> hand;
private int currentScore = 0;
private int finalScore = 0;
private boolean isBust = false;
private boolean stands = false;
private int indexLastCard = 0;
// private int lastCardPosition;
Hand (Player p){
player = p;
hand = new ArrayList<Card>();
currentScore = 0;
finalScore = 0;
isBust = false;
stands = false;
indexLastCard = 0;
}
/**
* Adds a card to the hand and computes the currentScore of cards
* in the hand
* @param newCard card
*/
public void addCardToHand(Card newCard) {
currentScore = 0;
int sumOfNonAces = 0;
int numOfAces = 0;
hand.add(newCard);
//compute currentScore after new card was added to hand
for (int i=0; i<hand.size();i++) {
String rank = hand.get(i).getCardRank();
int value = hand.get(i).getCardValue();
if (!rank.equals("Ace")) {
sumOfNonAces = sumOfNonAces + value;
}
if (rank.equals("Ace")) {
numOfAces++;
}
}
if (numOfAces==0) {
currentScore = sumOfNonAces;
}
if (numOfAces==1 && sumOfNonAces<=10) {
currentScore = sumOfNonAces + 11;
}
if (numOfAces==1 && sumOfNonAces>10) {
currentScore = sumOfNonAces + numOfAces;
}
if (numOfAces==2 && sumOfNonAces<=9) {
currentScore = sumOfNonAces + 12;
}
if (numOfAces==2 && sumOfNonAces>9) {
currentScore = sumOfNonAces + numOfAces;
}
if (numOfAces==3 && sumOfNonAces<=8) {
currentScore = sumOfNonAces + 13;
}
if (numOfAces==3 && sumOfNonAces>8) {
currentScore = sumOfNonAces + numOfAces;
}
if (numOfAces==4 && sumOfNonAces<=7) {
currentScore = sumOfNonAces + 14;
}
if (numOfAces==4 && sumOfNonAces>7) {
currentScore = sumOfNonAces + numOfAces;
}
if (currentScore > 21) {
isBust = true;
}
}
public void stand() {
finalScore = currentScore;
stands = true;
}
public void clear() {
for (int i=hand.size()-1; i>=0; i--) {
hand.remove(i);
}
currentScore = 0;
finalScore = 0;
isBust = false;
stands = false;
}
public String getPlayerName() {
String name = player.getName();
return name;
}
public String getCardRank (int num) {
int index = num;
String rank = hand.get(index).getCardRank();
return rank;
}
public int getCardValue (int num) {
int index = num;
int cardValue = hand.get(index).getCardValue();
return cardValue;
}
public String getCardDescription(int num) {
int index = num;
String nameOfCard = hand.get(index).getCardRank()+" of "
+hand.get(index).getCardSuit();
return nameOfCard;
}
public ArrayList<String> getAllCardDescriptions() {
ArrayList<String> cards = new ArrayList<String>();
for (int i=0; i<hand.size(); i++) {
cards.add(hand.get(i).getCardRank()+" of "
+hand.get(i).getCardSuit());
}
return cards;
}
public int getCurrentScore() {
return currentScore;
}
public int getFinalScore() {
return finalScore;
}
public int getIndexLastCard() {
indexLastCard = hand.size()-1;
return indexLastCard;
}
public boolean isBust() {
return isBust;
}
public boolean isStands() {
return stands;
}
}
|
923c3ae12473da6fd91c3cb2f48c3e1f3dc5dded | 1,504 | java | Java | ibm.jdk8/src/java/lang/reflect/GenericSignatureFormatError.java | flyzsd/java-code-snippets | 1202b941ec4686d157fbc8643b65d247c6cd2b27 | [
"MIT"
] | null | null | null | ibm.jdk8/src/java/lang/reflect/GenericSignatureFormatError.java | flyzsd/java-code-snippets | 1202b941ec4686d157fbc8643b65d247c6cd2b27 | [
"MIT"
] | null | null | null | ibm.jdk8/src/java/lang/reflect/GenericSignatureFormatError.java | flyzsd/java-code-snippets | 1202b941ec4686d157fbc8643b65d247c6cd2b27 | [
"MIT"
] | null | null | null | 22.117647 | 79 | 0.600399 | 999,872 | /*===========================================================================
* Licensed Materials - Property of IBM
* "Restricted Materials of IBM"
*
* IBM SDK, Java(tm) Technology Edition, v8
* (C) Copyright IBM Corp. 2003, 2011. All Rights Reserved
*
* US Government Users Restricted Rights - Use, duplication or disclosure
* restricted by GSA ADP Schedule Contract with IBM Corp.
*===========================================================================
*/
/*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
* ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*/
package java.lang.reflect;
/**
* Thrown when a syntactically malformed signature attribute is
* encountered by a reflective method that needs to interpret the
* generic signature information for a type, method or constructor.
*
* @since 1.5
*/
public class GenericSignatureFormatError extends ClassFormatError {
private static final long serialVersionUID = 6709919147137911034L;
/**
* Constructs a new {@code GenericSignatureFormatError}.
*
*/
public GenericSignatureFormatError() {
super();
}
/**
* Constructs a new {@code GenericSignatureFormatError} with the
* specified message.
*
* @param message the detail message, may be {@code null}
*/
public GenericSignatureFormatError(String message) {
super(message);
}
}
|
923c3bab146d353c492596872f52d7b31bca3f55 | 2,426 | java | Java | core/src/test/java/PrefixMapperTest.java | kremi151/JServe | 14832311a0481e26f10e8f45ca496031f1a66a5e | [
"MIT"
] | null | null | null | core/src/test/java/PrefixMapperTest.java | kremi151/JServe | 14832311a0481e26f10e8f45ca496031f1a66a5e | [
"MIT"
] | null | null | null | core/src/test/java/PrefixMapperTest.java | kremi151/JServe | 14832311a0481e26f10e8f45ca496031f1a66a5e | [
"MIT"
] | null | null | null | 43.321429 | 89 | 0.689613 | 999,873 | import lu.mkremer.jserve.mappers.MapperState;
import lu.mkremer.jserve.mappers.PrefixPathMapper;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class PrefixMapperTest {
@Tag("fast")
@Test
public void prefixMapperTestIgnoreCaseTerminal() {
PrefixPathMapper mapper = new PrefixPathMapper("/from", "/to", true, true);
assertEquals(MapperState.ACCEPT_FINISH, mapper.applies("/from/here.txt"));
assertEquals(MapperState.ACCEPT_FINISH, mapper.applies("/FRom/HERE.txt"));
assertEquals(MapperState.NOT_APPLICABLE, mapper.applies("/stop/there.txt"));
}
@Tag("fast")
@Test
public void prefixMapperTestIgnoreCaseNotTerminal() {
PrefixPathMapper mapper = new PrefixPathMapper("/from", "/to", true, false);
assertEquals(MapperState.ACCEPT_FORWARD, mapper.applies("/from/here.txt"));
assertEquals(MapperState.ACCEPT_FORWARD, mapper.applies("/FRom/HERE.txt"));
assertEquals(MapperState.NOT_APPLICABLE, mapper.applies("/stop/there.txt"));
}
@Tag("fast")
@Test
public void prefixMapperTestTerminal() {
PrefixPathMapper mapper = new PrefixPathMapper("/from", "/to", false, true);
assertEquals(MapperState.ACCEPT_FINISH, mapper.applies("/from/here.txt"));
assertEquals(MapperState.NOT_APPLICABLE, mapper.applies("/FRom/HERE.txt"));
assertEquals(MapperState.NOT_APPLICABLE, mapper.applies("/stop/there.txt"));
}
@Tag("fast")
@Test
public void prefixMapperTestNotTerminal() {
PrefixPathMapper mapper = new PrefixPathMapper("/from", "/to", false, false);
assertEquals(MapperState.ACCEPT_FORWARD, mapper.applies("/from/here.txt"));
assertEquals(MapperState.NOT_APPLICABLE, mapper.applies("/FRom/HERE.txt"));
assertEquals(MapperState.NOT_APPLICABLE, mapper.applies("/stop/there.txt"));
}
@Tag("fast")
@Test
public void mapPrefixPathText() {
PrefixPathMapper mapper = new PrefixPathMapper("/from", "/to", true, true);
assertEquals("/to/here.png", mapper.map("/from/here.png"));
assertEquals("/to/from/until/when.txt", mapper.map("/from/from/until/when.txt"));
assertEquals("/to/here.png", mapper.map("/from/here.png"));
assertEquals("/to/from/until/when.txt", mapper.map("/from/from/until/when.txt"));
}
}
|
923c3c2ba7d9f738a50669a95865ffd29bc58cf3 | 15,566 | java | Java | src/main/java/com/jstarcraft/rns/model/content/rating/HFTModel.java | luengmingbiao/jstarcraft-rns | 6bd678579d6cae470c4f479ac5b61dd4e1dce2d1 | [
"Apache-2.0"
] | 348 | 2019-05-07T02:32:13.000Z | 2022-03-24T06:32:16.000Z | src/main/java/com/jstarcraft/rns/model/content/rating/HFTModel.java | luengmingbiao/jstarcraft-rns | 6bd678579d6cae470c4f479ac5b61dd4e1dce2d1 | [
"Apache-2.0"
] | 4 | 2020-01-06T08:13:19.000Z | 2020-10-30T09:09:45.000Z | src/main/java/com/jstarcraft/rns/model/content/rating/HFTModel.java | luengmingbiao/jstarcraft-rns | 6bd678579d6cae470c4f479ac5b61dd4e1dce2d1 | [
"Apache-2.0"
] | 80 | 2019-05-09T09:08:49.000Z | 2022-01-17T09:07:23.000Z | 40.855643 | 184 | 0.590711 | 999,874 | package com.jstarcraft.rns.model.content.rating;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import com.jstarcraft.ai.data.DataInstance;
import com.jstarcraft.ai.data.DataModule;
import com.jstarcraft.ai.data.DataSpace;
import com.jstarcraft.ai.data.attribute.MemoryQualityAttribute;
import com.jstarcraft.ai.math.MathUtility;
import com.jstarcraft.ai.math.structure.DefaultScalar;
import com.jstarcraft.ai.math.structure.MathCalculator;
import com.jstarcraft.ai.math.structure.matrix.DenseMatrix;
import com.jstarcraft.ai.math.structure.matrix.MatrixScalar;
import com.jstarcraft.ai.math.structure.vector.DenseVector;
import com.jstarcraft.ai.model.neuralnetwork.activation.ActivationFunction;
import com.jstarcraft.ai.model.neuralnetwork.activation.SoftMaxActivationFunction;
import com.jstarcraft.core.common.option.Option;
import com.jstarcraft.core.utility.RandomUtility;
import com.jstarcraft.rns.model.MatrixFactorizationModel;
import com.jstarcraft.rns.utility.SampleUtility;
import it.unimi.dsi.fastutil.ints.Int2ObjectRBTreeMap;
/**
*
* HFT推荐器
*
* <pre>
* Hidden factors and hidden topics: understanding rating dimensions with review text
* 参考LibRec团队
* </pre>
*
* @author Birdy
*
*/
public class HFTModel extends MatrixFactorizationModel {
private static class Content {
private int[] wordIndexes;
private int[] topicIndexes;
private Content(int[] wordIndexes) {
this.wordIndexes = wordIndexes;
}
int[] getWordIndexes() {
return wordIndexes;
}
int[] getTopicIndexes() {
return topicIndexes;
}
void setTopicIndexes(int[] topicIndexes) {
this.topicIndexes = topicIndexes;
}
}
// TODO 考虑重构
private Int2ObjectRBTreeMap<Content> contentMatrix;
private DenseMatrix wordFactors;
protected String commentField;
protected int commentDimension;
/** 单词数量(TODO 考虑改名为numWords) */
private int numberOfWords;
/**
* user biases
*/
private DenseVector userBiases;
/**
* user biases
*/
private DenseVector itemBiases;
/**
* user latent factors
*/
// TODO 取消,父类已实现.
private DenseMatrix userFactors;
/**
* item latent factors
*/
// TODO 取消,父类已实现.
private DenseMatrix itemFactors;
/**
* init mean
*/
// TODO 取消,父类已实现.
private float initMean;
/**
* init standard deviation
*/
// TODO 取消,父类已实现.
private float initStd;
/**
* bias regularization
*/
private float biasRegularization;
/**
* user regularization
*/
// TODO 取消,父类已实现.
private float userRegularization;
/**
* item regularization
*/
// TODO 取消,父类已实现.
private float itemRegularization;
private DenseVector probability;
private DenseMatrix userProbabilities;
private DenseMatrix wordProbabilities;
protected ActivationFunction function;
@Override
public void prepare(Option configuration, DataModule model, DataSpace space) {
super.prepare(configuration, model, space);
commentField = configuration.getString("data.model.fields.comment");
commentDimension = model.getQualityInner(commentField);
MemoryQualityAttribute attribute = (MemoryQualityAttribute) space.getQualityAttribute(commentField);
Object[] wordValues = attribute.getDatas();
biasRegularization = configuration.getFloat("recommender.bias.regularization", 0.01F);
userRegularization = configuration.getFloat("recommender.user.regularization", 0.01F);
itemRegularization = configuration.getFloat("recommender.item.regularization", 0.01F);
userFactors = DenseMatrix.valueOf(userSize, factorSize);
itemFactors = DenseMatrix.valueOf(itemSize, factorSize);
// TODO 此处需要重构initMean与initStd
initMean = 0.0F;
initStd = 0.1F;
userBiases = DenseVector.valueOf(userSize);
userBiases.iterateElement(MathCalculator.SERIAL, (scalar) -> {
scalar.setValue(distribution.sample().floatValue());
});
itemBiases = DenseVector.valueOf(itemSize);
itemBiases.iterateElement(MathCalculator.SERIAL, (scalar) -> {
scalar.setValue(distribution.sample().floatValue());
});
numberOfWords = 0;
// build review matrix and counting the number of words
contentMatrix = new Int2ObjectRBTreeMap<>();
Map<String, Integer> wordDictionaries = new HashMap<>();
for (DataInstance sample : model) {
int userIndex = sample.getQualityFeature(userDimension);
int itemIndex = sample.getQualityFeature(itemDimension);
int contentIndex = sample.getQualityFeature(commentDimension);
String data = (String) wordValues[contentIndex];
String[] words = data.isEmpty() ? new String[0] : data.split(":");
for (String word : words) {
if (!wordDictionaries.containsKey(word) && StringUtils.isNotEmpty(word)) {
wordDictionaries.put(word, numberOfWords);
numberOfWords++;
}
}
// TODO 此处旧代码使用indexes[index] =
// Integer.valueOf(words[index])似乎有Bug,应该使用indexes[index] =
// wordDictionaries.get(word);
int[] wordIndexes = new int[words.length];
for (int index = 0; index < words.length; index++) {
wordIndexes[index] = Integer.valueOf(words[index]);
}
Content content = new Content(wordIndexes);
contentMatrix.put(userIndex * itemSize + itemIndex, content);
}
// TODO 此处保证所有特征都会被识别
for (Object value : wordValues) {
String content = (String) value;
String[] words = content.split(":");
for (String word : words) {
if (!wordDictionaries.containsKey(word) && StringUtils.isNotEmpty(word)) {
wordDictionaries.put(word, numberOfWords);
numberOfWords++;
}
}
}
logger.info("number of users : " + userSize);
logger.info("number of items : " + itemSize);
logger.info("number of words : " + numberOfWords);
wordFactors = DenseMatrix.valueOf(factorSize, numberOfWords);
wordFactors.iterateElement(MathCalculator.SERIAL, (scalar) -> {
scalar.setValue(RandomUtility.randomFloat(0.1F));
});
userProbabilities = DenseMatrix.valueOf(userSize, factorSize);
wordProbabilities = DenseMatrix.valueOf(factorSize, numberOfWords);
probability = DenseVector.valueOf(factorSize);
probability.setValues(1F);
function = new SoftMaxActivationFunction();
for (MatrixScalar term : scoreMatrix) {
int userIndex = term.getRow(); // user
int itemIndex = term.getColumn(); // item
Content content = contentMatrix.get(userIndex * itemSize + itemIndex);
int[] wordIndexes = content.getWordIndexes();
int[] topicIndexes = new int[wordIndexes.length];
for (int wordIndex = 0; wordIndex < wordIndexes.length; wordIndex++) {
topicIndexes[wordIndex] = RandomUtility.randomInteger(factorSize);
}
content.setTopicIndexes(topicIndexes);
}
calculateThetas();
calculatePhis();
}
private void sample() {
calculateThetas();
calculatePhis();
for (MatrixScalar term : scoreMatrix) {
int userIndex = term.getRow(); // user
int itemIndex = term.getColumn(); // item
Content content = contentMatrix.get(userIndex * itemSize + itemIndex);
int[] wordIndexes = content.getWordIndexes();
int[] topicIndexes = content.getTopicIndexes();
sampleTopicsToWords(userIndex, wordIndexes, topicIndexes);
// LOG.info("user:" + u + ", item:" + j + ", topics:" + s);
}
}
/**
* Update function for thetas and phiks, check if softmax comes in to NaN and
* update the parameters.
*
* @param oldValues old values of the parameter
* @param newValues new values to update the parameter
* @return the old values if new values contain NaN
* @throws Exception if error occurs
*/
private float[] updateArray(float[] oldValues, float[] newValues) {
for (float value : newValues) {
if (Float.isNaN(value)) {
return oldValues;
}
}
return newValues;
}
private void calculateThetas() {
for (int userIndex = 0; userIndex < userSize; userIndex++) {
DenseVector factorVector = userFactors.getRowVector(userIndex);
function.forward(factorVector, userProbabilities.getRowVector(userIndex));
}
}
private void calculatePhis() {
for (int factorIndex = 0; factorIndex < factorSize; factorIndex++) {
DenseVector factorVector = wordFactors.getRowVector(factorIndex);
function.forward(factorVector, wordProbabilities.getRowVector(factorIndex));
}
}
// TODO 考虑整理到Content.
private int[] sampleTopicsToWords(int userIndex, int[] wordsIndexes, int[] topicIndexes) {
for (int wordIndex = 0; wordIndex < wordsIndexes.length; wordIndex++) {
int topicIndex = wordsIndexes[wordIndex];
DefaultScalar sum = DefaultScalar.getInstance();
sum.setValue(0F);
probability.iterateElement(MathCalculator.SERIAL, (scalar) -> {
int index = scalar.getIndex();
float value = userProbabilities.getValue(userIndex, index) * wordProbabilities.getValue(index, topicIndex);
sum.shiftValue(value);
scalar.setValue(sum.getValue());
});
topicIndexes[wordIndex] = SampleUtility.binarySearch(probability, 0, probability.getElementSize() - 1, RandomUtility.randomFloat(sum.getValue()));
}
return topicIndexes;
}
/**
* The training approach is SGD instead of L-BFGS, so it can be slow if the
* dataset is big.
*/
@Override
protected void doPractice() {
for (int epocheIndex = 0; epocheIndex < epocheSize; epocheIndex++) {
// SGD training
// TODO 此处应该修改为配置
for (int iterationSDG = 0; iterationSDG < 5; iterationSDG++) {
totalError = 0F;
for (MatrixScalar term : scoreMatrix) {
int userIndex = term.getRow(); // user
int itemIndex = term.getColumn(); // item
float score = term.getValue();
float predict = predict(userIndex, itemIndex);
float error = score - predict;
totalError += error * error;
// update factors
float userBias = userBiases.getValue(userIndex);
float userSgd = error - biasRegularization * userBias;
userBiases.shiftValue(userIndex, learnRatio * userSgd);
// loss += regB * bu * bu;
float itemBias = itemBiases.getValue(itemIndex);
float itemSgd = error - biasRegularization * itemBias;
itemBiases.shiftValue(itemIndex, learnRatio * itemSgd);
// loss += regB * bj * bj;
// TODO 此处应该重构
Content content = contentMatrix.get(userIndex * itemSize + itemIndex);
int[] wordIndexes = content.getWordIndexes();
if (wordIndexes.length == 0) {
continue;
}
int[] topicIndexes = content.getTopicIndexes();
for (int factorIndex = 0; factorIndex < factorSize; factorIndex++) {
float userFactor = userFactors.getValue(userIndex, factorIndex);
float itemFactor = itemFactors.getValue(itemIndex, factorIndex);
float userSGD = error * itemFactor - userRegularization * userFactor;
float itemSGD = error * userFactor - itemRegularization * itemFactor;
userFactors.shiftValue(userIndex, factorIndex, learnRatio * userSGD);
itemFactors.shiftValue(itemIndex, factorIndex, learnRatio * itemSGD);
for (int wordIndex = 0; wordIndex < wordIndexes.length; wordIndex++) {
int topicIndex = topicIndexes[wordIndex];
if (factorIndex == topicIndex) {
userFactors.shiftValue(userIndex, factorIndex, learnRatio * (1 - userProbabilities.getValue(userIndex, topicIndex)));
} else {
userFactors.shiftValue(userIndex, factorIndex, learnRatio * (-userProbabilities.getValue(userIndex, topicIndex)));
}
totalError -= MathUtility.logarithm(userProbabilities.getValue(userIndex, topicIndex) * wordProbabilities.getValue(topicIndex, wordIndexes[wordIndex]), 2);
}
}
for (int wordIndex = 0; wordIndex < wordIndexes.length; wordIndex++) {
int topicIndex = topicIndexes[wordIndex];
for (int dictionaryIndex = 0; dictionaryIndex < numberOfWords; dictionaryIndex++) {
if (dictionaryIndex == wordIndexes[wordIndex]) {
wordFactors.shiftValue(topicIndex, wordIndexes[wordIndex], learnRatio * (-1 + wordProbabilities.getValue(topicIndex, wordIndexes[wordIndex])));
} else {
wordFactors.shiftValue(topicIndex, wordIndexes[wordIndex], learnRatio * (wordProbabilities.getValue(topicIndex, wordIndexes[wordIndex])));
}
}
}
}
totalError *= 0.5F;
} // end of SGDtraining
logger.info(" iter:" + epocheIndex + ", loss:" + totalError);
logger.info(" iter:" + epocheIndex + ", sampling");
sample();
logger.info(" iter:" + epocheIndex + ", sample finished");
}
}
@Override
protected float predict(int userIndex, int itemIndex) {
DefaultScalar scalar = DefaultScalar.getInstance();
DenseVector userVector = userFactors.getRowVector(userIndex);
DenseVector itemVector = itemFactors.getRowVector(itemIndex);
float value = scalar.dotProduct(userVector, itemVector).getValue();
value += meanScore + userBiases.getValue(userIndex) + itemBiases.getValue(itemIndex);
if (value > maximumScore) {
value = maximumScore;
} else if (value < minimumScore) {
value = minimumScore;
}
return value;
}
}
|
923c3da4c8dc8c5ee58bf5bb89b6f7c0a82f91bf | 343 | java | Java | src/main/java/ua/pragmasoft/jlinkplayground/JlinkPlaygroundApplication.java | pragmasoft-ua/jlink-playground | 217cca8ff498c2d83b6f56dcbcebff20eb775bea | [
"MIT"
] | null | null | null | src/main/java/ua/pragmasoft/jlinkplayground/JlinkPlaygroundApplication.java | pragmasoft-ua/jlink-playground | 217cca8ff498c2d83b6f56dcbcebff20eb775bea | [
"MIT"
] | null | null | null | src/main/java/ua/pragmasoft/jlinkplayground/JlinkPlaygroundApplication.java | pragmasoft-ua/jlink-playground | 217cca8ff498c2d83b6f56dcbcebff20eb775bea | [
"MIT"
] | null | null | null | 26.384615 | 68 | 0.827988 | 999,875 | package ua.pragmasoft.jlinkplayground;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class JlinkPlaygroundApplication {
public static void main(String[] args) {
SpringApplication.run(JlinkPlaygroundApplication.class, args);
}
}
|
923c3de4439ef4262c0804285ff2bf46e95707d1 | 1,957 | java | Java | src/main/java/com/youhualife/common/utils/Constant.java | hunji/sendrepair | 8f84ecca83629d53a22e7eed922269afdc446433 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/youhualife/common/utils/Constant.java | hunji/sendrepair | 8f84ecca83629d53a22e7eed922269afdc446433 | [
"Apache-2.0"
] | 1 | 2021-04-22T16:50:27.000Z | 2021-04-22T16:50:27.000Z | src/main/java/com/youhualife/common/utils/Constant.java | hunji/sendrepair | 8f84ecca83629d53a22e7eed922269afdc446433 | [
"Apache-2.0"
] | null | null | null | 16.090164 | 64 | 0.42486 | 999,876 | package com.youhualife.common.utils;
/**
* 常量
*
* @author hunji
*/
public class Constant {
/** 超级管理员ID */
public static final int SUPER_ADMIN = 1;
/**
* 当前页码
*/
public static final String PAGE = "page";
/**
* 每页显示记录数
*/
public static final String LIMIT = "limit";
/**
* 排序字段
*/
public static final String ORDER_FIELD = "sidx";
/**
* 排序方式
*/
public static final String ORDER = "order";
/**
* 升序
*/
public static final String ASC = "asc";
public static final String SERIALI_NUMBER_SR_ORDER = "SRNO";
/**
* 菜单类型
*
* @author chenshun
* @email efpyi@example.com
* @date 2016年11月15日 下午1:24:29
*/
public enum MenuType {
/**
* 目录
*/
CATALOG(0),
/**
* 菜单
*/
MENU(1),
/**
* 按钮
*/
BUTTON(2);
private int value;
MenuType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
/**
* 定时任务状态
*
* @author chenshun
* @email efpyi@example.com
* @date 2016年12月3日 上午12:07:22
*/
public enum ScheduleStatus {
/**
* 正常
*/
NORMAL(0),
/**
* 暂停
*/
PAUSE(1);
private int value;
ScheduleStatus(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
/**
* 云服务商
*/
public enum CloudService {
/**
* 七牛云
*/
QINIU(1),
/**
* 阿里云
*/
ALIYUN(2),
/**
* 腾讯云
*/
QCLOUD(3);
private int value;
CloudService(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}
}
|
923c3df9ac8cab56dd9de71c74de06c60052c01f | 702 | java | Java | servers/Controller/src/main/java/com/controller/services/HelloResource.java | DChaushev/DISS-project | 90105e331c5dacb78ee0d6eff9dae056c0aaac08 | [
"MIT"
] | null | null | null | servers/Controller/src/main/java/com/controller/services/HelloResource.java | DChaushev/DISS-project | 90105e331c5dacb78ee0d6eff9dae056c0aaac08 | [
"MIT"
] | null | null | null | servers/Controller/src/main/java/com/controller/services/HelloResource.java | DChaushev/DISS-project | 90105e331c5dacb78ee0d6eff9dae056c0aaac08 | [
"MIT"
] | null | null | null | 20.647059 | 79 | 0.678063 | 999,877 | /*
* 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 com.controller.services;
import javax.ws.rs.Produces;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.MediaType;
/**
* REST Web Service
*
* @author Dimitar
*/
@Path("hello")
public class HelloResource {
/**
* Retrieves representation of an instance of
* com.controller.services.HelloResource
*
* @return an instance of java.lang.String
*/
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getText() {
return "Hello!";
}
}
|
923c3e95e899b2137a2c067c5e652e0d05114795 | 2,294 | java | Java | TeamCode/src/main/java/OpModes/Debug/MotionDebug.java | OutoftheBoxFTC/UltimateGoal6.1 | 34490ba2eab679f3521a697f6a5cb31da162061f | [
"MIT"
] | null | null | null | TeamCode/src/main/java/OpModes/Debug/MotionDebug.java | OutoftheBoxFTC/UltimateGoal6.1 | 34490ba2eab679f3521a697f6a5cb31da162061f | [
"MIT"
] | null | null | null | TeamCode/src/main/java/OpModes/Debug/MotionDebug.java | OutoftheBoxFTC/UltimateGoal6.1 | 34490ba2eab679f3521a697f6a5cb31da162061f | [
"MIT"
] | null | null | null | 35.292308 | 145 | 0.655623 | 999,878 | package OpModes.Debug;
import com.qualcomm.robotcore.eventloop.opmode.Disabled;
import com.qualcomm.robotcore.eventloop.opmode.TeleOp;
import com.qualcomm.robotcore.util.RobotLog;
import Hardware.*;
import Hardware.Packets.HardwareData;
import Hardware.Packets.SensorData;
import MathSystems.*;
import MathSystems.Vector3;
import Motion.DriveToPoint.DriveToPointBuilder;
import Odometry.ConstantVOdometer;
import Odometry.Odometer;
import OpModes.BasicOpmode;
import State.GamepadDriveState;
import State.LogicState;
@TeleOp
@Disabled
public class MotionDebug extends BasicOpmode {
Vector3 position, velocity;
Odometer odometer;
public MotionDebug() {
super(new UltimateGoalHardware());
}
@Override
public void setup() {
hardware.registerAll();
hardware.enableAll();
position = Vector3.ZERO();
velocity = Vector3.ZERO();
odometer = new ConstantVOdometer(stateMachine, position, velocity);
eventSystem.onStart("Odometer", odometer);
eventSystem.onStart("Drive", new GamepadDriveState(stateMachine, gamepad1));
eventSystem.onStart("Logging", new LogicState(stateMachine) {
double maxX, maxY, maxR;
@Override
public void update(SensorData sensorData, HardwareData hardwareData) {
this.maxX = Math.max(maxX, Math.abs(velocity.getA()));
this.maxY = Math.max(maxY, Math.abs(velocity.getB()));
this.maxR = Math.max(maxR, Math.toDegrees(Math.abs(velocity.getC())));
telemetry.addData("MaxX", maxX);
telemetry.addData("MaxY", maxY);
telemetry.addData("MaxR", maxR);
}
});
eventSystem.onStart("Telemetry", new LogicState(stateMachine) {
@Override
public void update(SensorData sensorData, HardwareData hardwareData) {
telemetry.addData("Position", position);
telemetry.addData("Velocity", velocity);
telemetry.addData("FPS", fps);
telemetry.addData("Pods", new Vector3(sensorData.getOdometryLeft(), sensorData.getOdometryRight(), sensorData.getOdometryAux()));
RobotLog.ii("Vel", velocity.toString());
}
});
}
}
|
923c3f71ede478fc89579fed4b2ef2bc7bd32c01 | 1,972 | java | Java | FromBooks/src/main/java/basicsOfJava/OOP3_innnerClass/Main.java | MartyMcAir/OtherCodeAndTrash | 66b74ea0cd50acc2bd4579830095905a00b6e45c | [
"MIT"
] | null | null | null | FromBooks/src/main/java/basicsOfJava/OOP3_innnerClass/Main.java | MartyMcAir/OtherCodeAndTrash | 66b74ea0cd50acc2bd4579830095905a00b6e45c | [
"MIT"
] | null | null | null | FromBooks/src/main/java/basicsOfJava/OOP3_innnerClass/Main.java | MartyMcAir/OtherCodeAndTrash | 66b74ea0cd50acc2bd4579830095905a00b6e45c | [
"MIT"
] | null | null | null | 24.04878 | 80 | 0.506592 | 999,879 | /*
* 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 basicsOfJava.OOP3_innnerClass;
/**
*
* @author MartyMcAir
*/
public class Main {
static String txt="статическая переменная";
public static void main(String[] args) {
AbsAnimals abs1, abs2;
abs1 = new Cat("МяуУ");
abs2 = new ChildAbs1("что-то кричит");
abs1.doAny();
abs1.doSound();
System.out.println();
abs2.doAny();
abs2.doSound();
System.out.println();
Main m = new Main();
m.runInnerClass(333, ", проверочный текст");
System.out.println();
C.getSt();
}
static class C {
public static void getSt(){
System.out.println(txt+" вызвана из вложенного статического класса "
+ " статического метода getSt()");
}
}
class A {
int a;
public void setA(int a){
this.a=a;
}
public int getA(){
return this.a;
}
}
class B {
String text;
B(String text){
this.text=text;
}
void show(){
System.out.println("вложенный класс B "+text);
}
}
public void runInnerClass(int a, String text) {
A aa = new A();
aa.setA(a);
System.out.println("значение а: "+aa.getA());
B bb = new B(text);
bb.show();
class D{
static final String CONST = "статическая константа из D класса";
String var = "статическая переменнная D класса",
var2="класс D внутри метода runInnerClass()";
void show(){
System.out.println(CONST+"\n"+var+"\n"+var2);
}
}
D dd = new D();
dd.show();
}
}
|
923c419be8fbd4d975cb4a78b4d64a6f3748a574 | 856 | java | Java | src/main/java/org/myan/jschedule/web/data/Response.java | TobeDeveloper/jschedule | 11879e72dd92a31f2759b2e1cd04a86f9bc53e9e | [
"MIT"
] | null | null | null | src/main/java/org/myan/jschedule/web/data/Response.java | TobeDeveloper/jschedule | 11879e72dd92a31f2759b2e1cd04a86f9bc53e9e | [
"MIT"
] | null | null | null | src/main/java/org/myan/jschedule/web/data/Response.java | TobeDeveloper/jschedule | 11879e72dd92a31f2759b2e1cd04a86f9bc53e9e | [
"MIT"
] | null | null | null | 24.457143 | 72 | 0.676402 | 999,880 | package org.myan.jschedule.web.data;
import java.util.Collection;
import java.util.Map;
/**
* Created by myan on 11/17/2017.
* Intellij IDEA
*/
public abstract class Response<T> {
protected Header<T> headers;
public void setResponseCode(String responseCode) {
if (headers == null)
headers = new Header<>();
headers.setResponseCode(responseCode);
}
public void setResponseMessage(String responseMessage) {
if (headers == null)
headers = new Header<>();
headers.setResponseMessage(responseMessage);
}
public abstract void putObject(String name, Object value);
public abstract void putCollection(String name, Collection<T> list);
public abstract void putArray(String name, Object[] array);
public abstract void putMap(String name, Map<String, T> map);
}
|
923c42d7e35ce78163ae8737a874e06172ef837e | 1,889 | java | Java | app/src/main/java/com/x/vscam/global/net/SerializableOkHttpCookies.java | ayaseruri/vscam | 454fb2a4eda05d457e45acfca38e7c814b026aa0 | [
"Apache-2.0"
] | 11 | 2017-01-19T10:49:26.000Z | 2019-02-13T04:15:07.000Z | app/src/main/java/com/x/vscam/global/net/SerializableOkHttpCookies.java | ayaseruri/vscam | 454fb2a4eda05d457e45acfca38e7c814b026aa0 | [
"Apache-2.0"
] | 1 | 2017-01-22T03:39:54.000Z | 2017-01-22T04:07:31.000Z | app/src/main/java/com/x/vscam/global/net/SerializableOkHttpCookies.java | ayaseruri/vscam | 454fb2a4eda05d457e45acfca38e7c814b026aa0 | [
"Apache-2.0"
] | 4 | 2017-01-22T03:57:22.000Z | 2020-11-19T05:42:27.000Z | 32.568966 | 94 | 0.663314 | 999,881 | package com.x.vscam.global.net;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import okhttp3.Cookie;
/**
* Created by wufeiyang on 2017/1/16.
*/
public class SerializableOkHttpCookies implements Serializable {
private transient Cookie mCookie;
public SerializableOkHttpCookies(Cookie cookies) {
mCookie = cookies;
}
public Cookie getCookies() {
return mCookie;
}
private void writeObject(ObjectOutputStream out) throws IOException {
out.writeObject(mCookie.name());
out.writeObject(mCookie.value());
out.writeLong(mCookie.expiresAt());
out.writeObject(mCookie.domain());
out.writeObject(mCookie.path());
out.writeBoolean(mCookie.secure());
out.writeBoolean(mCookie.httpOnly());
out.writeBoolean(mCookie.hostOnly());
out.writeBoolean(mCookie.persistent());
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
String name = (String) in.readObject();
String value = (String) in.readObject();
long expiresAt = in.readLong();
String domain = (String) in.readObject();
String path = (String) in.readObject();
boolean secure = in.readBoolean();
boolean httpOnly = in.readBoolean();
boolean hostOnly = in.readBoolean();
Cookie.Builder builder = new Cookie.Builder();
builder = builder.name(name);
builder = builder.value(value);
builder = builder.expiresAt(expiresAt);
builder = hostOnly ? builder.hostOnlyDomain(domain) : builder.domain(domain);
builder = builder.path(path);
builder = secure ? builder.secure() : builder;
builder = httpOnly ? builder.httpOnly() : builder;
mCookie =builder.build();
}
}
|
923c430224a79127d2f4cbf67ddf09c9f1b96c54 | 742 | java | Java | notifications/rest/credentials/delete-credential/delete-credential.7.x.java | Gray-Wind/api-snippets | 24a6ce31a48b1dfd6e9d0e5914d4630ab9bc10f4 | [
"MIT"
] | 3 | 2020-05-05T10:01:02.000Z | 2021-02-06T14:23:13.000Z | notifications/rest/credentials/delete-credential/delete-credential.7.x.java | Gray-Wind/api-snippets | 24a6ce31a48b1dfd6e9d0e5914d4630ab9bc10f4 | [
"MIT"
] | null | null | null | notifications/rest/credentials/delete-credential/delete-credential.7.x.java | Gray-Wind/api-snippets | 24a6ce31a48b1dfd6e9d0e5914d4630ab9bc10f4 | [
"MIT"
] | 1 | 2019-10-02T14:36:36.000Z | 2019-10-02T14:36:36.000Z | 35.333333 | 90 | 0.762803 | 999,882 | // NOTE: This example uses the next generation Twilio helper library - for more
// information on how to download and install this version, visit
// https://www.twilio.com/docs/libraries/java
import com.twilio.Twilio;
import com.twilio.rest.notify.v1.Credential;
public class Example {
// Find your Account Sid and Token at twilio.com/user/account
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
public static final String AUTH_TOKEN = "your_auth_token";
public static void main(String args[]) {
// Initialize the client
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
boolean didDelete = Credential.deleter("CRXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete();
System.out.println(didDelete);
}
}
|
923c43250ee86da12be38e894971ed5a37443291 | 1,503 | java | Java | src/test/java/de/eposcat/master/PagePostgresEavIT.java | matthias-epos/dynamic-datamodels | cec8a41e956b7223b05d3f888ae97a71c3b27e08 | [
"MIT"
] | 1 | 2020-10-26T10:01:46.000Z | 2020-10-26T10:01:46.000Z | src/test/java/de/eposcat/master/PagePostgresEavIT.java | matthias-epos/dynamic-datamodels | cec8a41e956b7223b05d3f888ae97a71c3b27e08 | [
"MIT"
] | 5 | 2020-12-09T11:36:33.000Z | 2021-02-22T10:35:47.000Z | src/test/java/de/eposcat/master/PagePostgresEavIT.java | matthias-epos/dynamic-datamodels | cec8a41e956b7223b05d3f888ae97a71c3b27e08 | [
"MIT"
] | 1 | 2021-03-30T06:58:35.000Z | 2021-03-30T06:58:35.000Z | 44.205882 | 172 | 0.793081 | 999,883 | package de.eposcat.master;
import de.eposcat.master.approachImpl.EAV_DatabaseAdapter;
import de.eposcat.master.connection.PostgresConnectionManager;
import de.eposcat.master.connection.RelationalApproach;
import de.eposcat.master.model.AttributeBuilder;
import de.eposcat.master.model.AttributeType;
import org.junit.jupiter.api.BeforeAll;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.wait.strategy.Wait;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;
import org.testcontainers.utility.DockerImageName;
import java.time.Duration;
@Testcontainers
public class PagePostgresEavIT extends PageTest {
@Container
public static GenericContainer postgres = new GenericContainer(DockerImageName.parse("mstrepos1/dynamic_datamodels:postgres"))
.withExposedPorts(5432).withEnv("POSTGRES_PASSWORD", "admin")
.waitingFor(Wait.forLogMessage(".*database system is ready to accept connections\\s*",2)
.withStartupTimeout(Duration.ofMinutes(2)));
@BeforeAll
static void initDataBase(){
PostgresConnectionManager connectionManager = new PostgresConnectionManager(RelationalApproach.EAV, "localhost", postgres.getMappedPort(5432), "postgres", "admin");
dbAdapter = new EAV_DatabaseAdapter(connectionManager);
defaultAttribute = new AttributeBuilder().setType(AttributeType.String).setValue("A test value").createAttribute();
}
}
|
923c45abb3c677fd4292d99089c26e6df52a8807 | 4,666 | java | Java | gdx-ai/src/com/badlogic/gdx/ai/btree/Task.java | just4phil/gdx-ai | 31810ad8c811a43b412a0007b0ae84127a97da11 | [
"Apache-2.0"
] | null | null | null | gdx-ai/src/com/badlogic/gdx/ai/btree/Task.java | just4phil/gdx-ai | 31810ad8c811a43b412a0007b0ae84127a97da11 | [
"Apache-2.0"
] | null | null | null | gdx-ai/src/com/badlogic/gdx/ai/btree/Task.java | just4phil/gdx-ai | 31810ad8c811a43b412a0007b0ae84127a97da11 | [
"Apache-2.0"
] | null | null | null | 31.315436 | 122 | 0.683669 | 999,884 | /*******************************************************************************
* Copyright 2014 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
package com.badlogic.gdx.ai.btree;
import com.badlogic.gdx.utils.Array;
import com.badlogic.gdx.utils.reflect.ClassReflection;
import com.badlogic.gdx.utils.reflect.ReflectionException;
/** The {@code Task} of a behavior tree has one control and a list of children.
*
* @param <E> type of the blackboard object that tasks use to read or modify game state
*
* @author implicit-invocation
* @author davebaol */
public abstract class Task<E> {
/** The task metadata specifying static information used by parsers and tools. */
public static final Metadata METADATA = new Metadata();
protected Task<E> control;
protected Task<E> runningTask;
protected Array<Task<E>> children;
protected E object;
/** This method will add a child to the list of this task's children
*
* @param child the child task which will be added */
public void addChild (Task<E> child) {
children.add(child);
}
/** Returns the number of children of this task.
*
* @return an int giving the number of children of this task */
public int getChildCount () {
return children.size;
}
/** Returns the child at the given index. */
public Task<E> getChild (int i) {
return children.get(i);
}
/** This method will set a task as this task's control (parent)
*
* @param control the parent task */
public void setControl (Task<E> control) {
this.control = control;
}
/** This method will be called once before this task's first run
*
* @param object the blackboard object */
public void start (E object) {
}
/** This method will be called when this task succeeds or fails
*
* @param object the blackboard object */
public void end (E object) {
}
/** This method contains update logic of this task
*
* @param object the blackboard object */
public abstract void run (E object);
/** This method will be called in {@link #run(Object) run()} to inform control that this task needs to run again */
public final void running () {
control.childRunning(this, this);
}
/** This method will be called in {@link #run(Object) run()} to inform control that this task has finished running with a
* success result */
public void success () {
end(object);
control.childSuccess(this);
}
/** This method will be called in {@link #run(Object) run()} to inform control that this task has finished running with a
* failure result */
public void fail () {
end(object);
control.childFail(this);
}
/** This method will be called when one of the children of this task succeeds
*
* @param task the task that succeeded */
public void childSuccess (Task<E> task) {
this.runningTask = null;
}
/** This method will be called when one of the children of this task fails
*
* @param task the task that failed */
public void childFail (Task<E> task) {
this.runningTask = null;
}
/** This method will be called when one of the ancestors of this task needs to run again
*
* @param runningTask the task that needs to run again
* @param reporter the task that reports, usually one of this task's children */
public void childRunning (Task<E> runningTask, Task<E> reporter) {
this.runningTask = runningTask;
}
/** Returns the metadata of this task. */
public Metadata getMetadata () {
return Metadata.findMetadata(this.getClass());
}
/** Clones this task to a new one.
* @return the cloned task
* @throws TaskCloneException if the task cannot be successfully cloned. */
@SuppressWarnings("unchecked")
public Task<E> cloneTask () {
try {
return copyTo(ClassReflection.newInstance(this.getClass()));
} catch (ReflectionException e) {
throw new TaskCloneException(e);
}
}
/** Copies this task to the given task.
* @param task the task to be filled
* @return the given task for chaining
* @throws TaskCloneException if the task cannot be successfully copied. */
protected abstract Task<E> copyTo (Task<E> task);
}
|
923c4617d12c4c43c5dd890854b0874aed8509d9 | 2,719 | java | Java | src/main/java/com/beligum/blocks/endpoints/AssetsEndpoint.java | bramdvrepublic/com.beligum.blocks.core | 3087c2cce1df774ffd501a8898d09326a4083ded | [
"Apache-2.0"
] | null | null | null | src/main/java/com/beligum/blocks/endpoints/AssetsEndpoint.java | bramdvrepublic/com.beligum.blocks.core | 3087c2cce1df774ffd501a8898d09326a4083ded | [
"Apache-2.0"
] | null | null | null | src/main/java/com/beligum/blocks/endpoints/AssetsEndpoint.java | bramdvrepublic/com.beligum.blocks.core | 3087c2cce1df774ffd501a8898d09326a4083ded | [
"Apache-2.0"
] | null | null | null | 35.311688 | 127 | 0.734829 | 999,885 | /*
* Copyright 2017 Republic of Reinvention bvba. 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.beligum.blocks.endpoints;
import com.beligum.base.filesystem.HtmlFile;
import com.beligum.base.resources.MimeTypes;
import com.beligum.base.resources.ifaces.Resource;
import com.beligum.base.resources.repositories.AssetsRepository;
import com.beligum.base.resources.sources.StringSource;
import com.beligum.base.server.R;
import com.beligum.blocks.templating.TemplateCache;
import gen.com.beligum.blocks.core.fs.html.templates.blocks.core.snippets.sidebar;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import static gen.com.beligum.base.core.constants.base.core.*;
/**
* Some dynamic endpoints, dealing with the resources
* <p>
* Created by bas on 21.10.14.
*/
@Path("/")
public class AssetsEndpoint
{
/**
* Returns a css reset code of all known blocks in the system (resetting padding, margin and display)
*/
@GET
@Path(AssetsRepository.PUBLIC_PATH_PREFIX + "blocks/core/styles/imports/styles.css")
@RequiresPermissions(ASSET_VIEW_ALL_PERM)
public Resource getImportsStyles()
{
//note: by returning a resource instead of a response, we pass through the caching mechanisms
return R.resourceManager().create(new StringSource(TemplateCache.instance().getCssReset(), MimeTypes.CSS, null));
}
/**
* As JS plugin with all known block names in this system
*/
@GET
@Path(AssetsRepository.PUBLIC_PATH_PREFIX + "blocks/core/scripts/imports/scripts.js")
@RequiresPermissions(ASSET_VIEW_ALL_PERM)
public Resource getImportsScripts()
{
//note: by returning a resource instead of a response, we pass through the caching mechanisms
return R.resourceManager().create(new StringSource(TemplateCache.instance().getJsArray(), MimeTypes.JAVASCRIPT, null));
}
/**
* The code for the JS-loaded sidebar
*/
@GET
@Path("/templates/blocks/core/snippets/sidebar.html")
@RequiresPermissions(ASSET_VIEW_ALL_PERM)
public HtmlFile getSidebar()
{
return sidebar.get();
}
}
|
923c4722fa5b0bfdf0083d772f9beff97adb602e | 1,883 | java | Java | app/src/main/java/com/engloryintertech/small/model/bean/MallPayBean.java | XinRan5312/JpushIMAndUmengPay | 2c5ba6f5a8d5b7dea83217a242c212d28b00128a | [
"Apache-2.0"
] | 2 | 2016-12-05T06:27:14.000Z | 2018-05-08T15:05:13.000Z | app/src/main/java/com/engloryintertech/small/model/bean/MallPayBean.java | XinRan5312/JpushIMAndUmengPay | 2c5ba6f5a8d5b7dea83217a242c212d28b00128a | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/engloryintertech/small/model/bean/MallPayBean.java | XinRan5312/JpushIMAndUmengPay | 2c5ba6f5a8d5b7dea83217a242c212d28b00128a | [
"Apache-2.0"
] | null | null | null | 19.412371 | 84 | 0.670207 | 999,886 | package com.engloryintertech.small.model.bean;
import java.io.Serializable;
/**微信支付*/
public class MallPayBean implements Serializable{
private String AppId;
private String PrepayId; //预支付交易会话ID
/**微信*/
private String PartnerId; //商户号
private String PackageValue; //固定值 Sign=WXPay
private String NonceStr; //随机字符串
private long TimeStamp; //时间戳
private String Sign; //签名
/**支付宝*/
private String SignAliPay;
/**微信*/
public MallPayBean(String PrepayId, String NonceStr, long TimeStamp, String Sign){
this.PrepayId = PrepayId;
this.NonceStr = NonceStr;
this.TimeStamp = TimeStamp;
this.Sign = Sign;
}
/**支付宝*/
public MallPayBean(String PrepayId, String SignAliPay){
this.PrepayId = PrepayId;
this.SignAliPay = SignAliPay;
}
public void setAppId(String appId) {
AppId = appId;
}
public void setPartnerId(String partnerId) {
PartnerId = partnerId;
}
public void setPackageValue(String packageValue) {
PackageValue = packageValue;
}
public void setPrepayId(String prepayId) {
PrepayId = prepayId;
}
public void setNonceStr(String nonceStr) {
NonceStr = nonceStr;
}
public void setTimeStamp(long timeStamp) {
TimeStamp = timeStamp;
}
public void setSign(String sign) {
Sign = sign;
}
public String getAppId() {
return AppId;
}
public String getPartnerId() {
return PartnerId;
}
public String getPackageValue() {
return PackageValue;
}
public String getPrepayId() {
return PrepayId;
}
public long getTimeStamp() {
return TimeStamp;
}
public String getNonceStr() {
return NonceStr;
}
public String getSign() {
return Sign;
}
public void setSignAliPay(String signAliPay) {
SignAliPay = signAliPay;
}
public String getSignAliPay() {
return SignAliPay;
}
}
|
923c4777a3731243637161f9983174feed6555da | 976 | java | Java | src/main/java/io/alauda/jenkins/devops/sync/controller/util/Wait.java | daniel-beck-bot/alauda-devops-sync-plugin | 469bb80b8a55fb052a2b1876cfb78feb778a4edb | [
"Apache-2.0",
"MIT"
] | 3 | 2018-08-14T06:35:00.000Z | 2021-06-26T06:09:43.000Z | src/main/java/io/alauda/jenkins/devops/sync/controller/util/Wait.java | daniel-beck-bot/alauda-devops-sync-plugin | 469bb80b8a55fb052a2b1876cfb78feb778a4edb | [
"Apache-2.0",
"MIT"
] | null | null | null | src/main/java/io/alauda/jenkins/devops/sync/controller/util/Wait.java | daniel-beck-bot/alauda-devops-sync-plugin | 469bb80b8a55fb052a2b1876cfb78feb778a4edb | [
"Apache-2.0",
"MIT"
] | 2 | 2019-10-16T17:59:58.000Z | 2020-09-02T13:04:42.000Z | 33.655172 | 179 | 0.701844 | 999,887 | package io.alauda.jenkins.devops.sync.controller.util;
import java.util.concurrent.*;
import java.util.function.Predicate;
public final class Wait {
private Wait() {
}
public static <T> void waitUntil(T t, Predicate<T> predicate, long period, long timeout, TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException {
ScheduledExecutorService scheduledExecutor = Executors.newSingleThreadScheduledExecutor();
CompletableFuture<Void> completedFuture = new CompletableFuture<>();
ScheduledFuture scheduledFuture = scheduledExecutor.scheduleAtFixedRate(() -> {
if (predicate.test(t)) {
completedFuture.complete(null);
}
}, period, period, timeUnit);
// When all controllers synced, we cancel the schedule task
completedFuture.whenComplete((v, throwable) -> scheduledFuture.cancel(true));
completedFuture.get(timeout, timeUnit);
}
}
|
923c477889223dfbcd9bcd3432d1402743d2fc8f | 1,260 | java | Java | src/MazePanel.java | Putoke/Mazer | 5e40e37c24d6848b48eecf44b9a77a569e8dbd43 | [
"Apache-2.0"
] | null | null | null | src/MazePanel.java | Putoke/Mazer | 5e40e37c24d6848b48eecf44b9a77a569e8dbd43 | [
"Apache-2.0"
] | null | null | null | src/MazePanel.java | Putoke/Mazer | 5e40e37c24d6848b48eecf44b9a77a569e8dbd43 | [
"Apache-2.0"
] | null | null | null | 22.909091 | 116 | 0.711905 | 999,888 | import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.JPanel;
public class MazePanel extends JPanel{
private Maze maze;
private Color mazeColor;
private MainFrame mainFrame;
public MazePanel(MainFrame mainFrame) {
maze = new Maze(0, 0);
mazeColor = Color.BLACK;//new Color(100, 149, 237);
this.mainFrame = mainFrame;
}
@Override
public void paintComponent(Graphics g) {
g.setColor(mazeColor);
g.fillRect(0, 0, getWidth(), getHeight());
maze.printCells(g);
maze.printWalls(g);
}
public void updateMaze(Maze maze) {
this.maze = maze;
repaint();
setPreferredSize(new Dimension(maze.getMazeSize()*maze.getCellSize()+1, maze.getMazeSize()*maze.getCellSize()+1));
mainFrame.pack();
}
public void setMazeColor(Color color) {
mazeColor = color;
}
public void saveImage() {
BufferedImage bi = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics g = bi.createGraphics();
paintComponent(g);
g.dispose();
try {
ImageIO.write(bi, "png", new File("test.png"));
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
923c488d94fd4e687227e74f4f1e436483af13d6 | 4,302 | java | Java | bundles/sirix-core/src/test/java/org/sirix/node/json/JSONArrayNodeTest.java | ethanwillis/sirix | 6d69fcef36476729918fc27d22314a41ff8a9b9c | [
"BSD-3-Clause"
] | 1 | 2021-11-08T05:40:25.000Z | 2021-11-08T05:40:25.000Z | bundles/sirix-core/src/test/java/org/sirix/node/json/JSONArrayNodeTest.java | ethanwillis/sirix | 6d69fcef36476729918fc27d22314a41ff8a9b9c | [
"BSD-3-Clause"
] | null | null | null | bundles/sirix-core/src/test/java/org/sirix/node/json/JSONArrayNodeTest.java | ethanwillis/sirix | 6d69fcef36476729918fc27d22314a41ff8a9b9c | [
"BSD-3-Clause"
] | 1 | 2021-11-08T05:40:36.000Z | 2021-11-08T05:40:36.000Z | 42.176471 | 109 | 0.744073 | 999,889 | /**
* Copyright (c) 2011, University of Konstanz, Distributed Systems Group All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met: * Redistributions of source code must retain the
* above copyright notice, this list of conditions and the following disclaimer. * Redistributions
* in binary form must reproduce the above copyright notice, this list of conditions and the
* following disclaimer in the documentation and/or other materials provided with the distribution.
* * Neither the name of the University of Konstanz nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.sirix.node.json;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sirix.Holder;
import org.sirix.XdmTestHelper;
import org.sirix.api.PageTrx;
import org.sirix.exception.SirixException;
import org.sirix.node.Kind;
import org.sirix.node.SirixDeweyID;
import org.sirix.node.delegates.NodeDelegate;
import org.sirix.node.delegates.StructNodeDelegate;
import org.sirix.node.interfaces.Record;
import org.sirix.page.UnorderedKeyValuePage;
import org.sirix.settings.Fixed;
/**
* Object record node test.
*/
public class JSONArrayNodeTest {
/** {@link Holder} instance. */
private Holder mHolder;
/** Sirix {@link PageTrxImpl} instance. */
private PageTrx<Long, Record, UnorderedKeyValuePage> mPageWriteTrx;
@Before
public void setUp() throws SirixException {
XdmTestHelper.closeEverything();
XdmTestHelper.deleteEverything();
mHolder = Holder.openResourceManager();
mPageWriteTrx = mHolder.getResourceManager().beginPageTrx();
}
@After
public void tearDown() throws SirixException {
mPageWriteTrx.close();
mHolder.close();
}
@Test
public void testNode() throws IOException {
final NodeDelegate del = new NodeDelegate(13, 14, 0, 0, SirixDeweyID.newRootID());
final StructNodeDelegate strucDel =
new StructNodeDelegate(del, Fixed.NULL_NODE_KEY.getStandardProperty(), 16l, 15l, 0l, 0l);
final ArrayNode node = new ArrayNode(strucDel, 18);
check(node);
// Serialize and deserialize node.
final ByteArrayOutputStream out = new ByteArrayOutputStream();
node.getKind().serialize(new DataOutputStream(out), node, mPageWriteTrx);
final ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
final ArrayNode node2 =
(ArrayNode) Kind.ARRAY.deserialize(new DataInputStream(in), node.getNodeKey(), null, mPageWriteTrx);
check(node2);
}
private final void check(final ArrayNode node) {
// Now compare.
assertEquals(13L, node.getNodeKey());
assertEquals(14L, node.getParentKey());
assertEquals(Fixed.NULL_NODE_KEY.getStandardProperty(), node.getFirstChildKey());
assertEquals(16L, node.getRightSiblingKey());
assertEquals(18L, node.getPathNodeKey());
assertEquals(Kind.ARRAY, node.getKind());
assertEquals(false, node.hasFirstChild());
assertEquals(true, node.hasParent());
assertEquals(true, node.hasRightSibling());
}
}
|
923c49513b64a8f6a827cc789c8877d6de90ac8b | 1,555 | java | Java | app/src/main/java/com/dalilu/Dalilu.java | crataristo4/EmergencyAlerter | 122a55ef3b0d30e8d6e0335aed8850293bd89f79 | [
"MIT"
] | 1 | 2020-08-18T02:21:17.000Z | 2020-08-18T02:21:17.000Z | app/src/main/java/com/dalilu/Dalilu.java | crataristo4/EmergencyAlerter | 122a55ef3b0d30e8d6e0335aed8850293bd89f79 | [
"MIT"
] | null | null | null | app/src/main/java/com/dalilu/Dalilu.java | crataristo4/EmergencyAlerter | 122a55ef3b0d30e8d6e0335aed8850293bd89f79 | [
"MIT"
] | 1 | 2021-04-01T07:43:47.000Z | 2021-04-01T07:43:47.000Z | 28.272727 | 84 | 0.722186 | 999,890 | package com.dalilu;
import android.app.Application;
import android.content.Context;
import androidx.multidex.MultiDex;
import com.danikula.videocache.HttpProxyCacheServer;
import com.google.firebase.database.FirebaseDatabase;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreSettings;
public class Dalilu extends Application {
private HttpProxyCacheServer proxy;
public static Context context;
public static HttpProxyCacheServer getProxy(Context context) {
Dalilu app = (Dalilu) context.getApplicationContext();
return app.proxy == null ? (app.proxy = app.newProxy()) : app.proxy;
}
public static Context getDaliluAppContext() {
return Dalilu.context;
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
private HttpProxyCacheServer newProxy() {
return new HttpProxyCacheServer(this);
}
@Override
public void onCreate() {
super.onCreate();
FirebaseFirestoreSettings settings = new FirebaseFirestoreSettings.Builder()
.setCacheSizeBytes(FirebaseFirestoreSettings.CACHE_SIZE_UNLIMITED)
.build();
FirebaseFirestore.getInstance().setFirestoreSettings(settings);
Dalilu.context = getApplicationContext();
FirebaseDatabase.getInstance().setPersistenceEnabled(true);
FirebaseDatabase.getInstance().getReference().keepSynced(true);
}
}
|
923c4957135f69d7e5deaab807938a957f3eb5c2 | 1,208 | java | Java | me/prisoncore/commands/vanish.java | iFlyPolar/PrisonCore | f8812b86f4eac9d3ec37f01306baca75ed4270e7 | [
"Apache-2.0"
] | null | null | null | me/prisoncore/commands/vanish.java | iFlyPolar/PrisonCore | f8812b86f4eac9d3ec37f01306baca75ed4270e7 | [
"Apache-2.0"
] | null | null | null | me/prisoncore/commands/vanish.java | iFlyPolar/PrisonCore | f8812b86f4eac9d3ec37f01306baca75ed4270e7 | [
"Apache-2.0"
] | null | null | null | 28.093023 | 97 | 0.68543 | 999,891 | package me.prisoncore.commands;
import java.util.ArrayList;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import me.prisoncore.Main;
import net.md_5.bungee.api.ChatColor;
public class vanish implements CommandExecutor {
private ArrayList<String> vanished = new ArrayList<String>();
Main plugin;
public vanish(Main instance) {
this.plugin = instance;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String string, String[] args) {
if(!vanished.contains(sender.getName())) {
vanished.add(sender.getName());
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
p.hidePlayer((Player) sender);
}
sender.sendMessage(ChatColor.GRAY + "You are now " + ChatColor.GREEN + "Vanished");
} else {
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
p.showPlayer((Player) sender);
}
sender.sendMessage(ChatColor.GRAY + "You are no longer " + ChatColor.RED + "Vanished");
vanished.remove(sender.getName());
}
return true;
}
}
|
923c4a3ea7f34435db4d9baf93c8a53b088a8d34 | 365 | java | Java | net/steel3d/graphics/Face.java | avocadojoe/Steel3D | b7d3026396a813f54c53717a40b82484c7b1f0fe | [
"MIT"
] | 1 | 2016-01-28T14:30:27.000Z | 2016-01-28T14:30:27.000Z | net/steel3d/graphics/Face.java | avocadojoe/Steel3D | b7d3026396a813f54c53717a40b82484c7b1f0fe | [
"MIT"
] | null | null | null | net/steel3d/graphics/Face.java | avocadojoe/Steel3D | b7d3026396a813f54c53717a40b82484c7b1f0fe | [
"MIT"
] | null | null | null | 19.210526 | 59 | 0.739726 | 999,892 | package net.steel3d.graphics;
import org.lwjgl.util.vector.Vector4f;
import net.steel3d.util.Material;
public class Face {
public Vector4f vertex = new Vector4f();
public Vector4f normal = new Vector4f();
public Material mat;
public Face(Vector4f vertex,Vector4f normal,Material mat){
this.vertex = vertex;
this.normal = normal;
this.mat = mat;
}
}
|
923c4aabf3f65516103a9a86ad21a7f1e852b4d1 | 2,512 | java | Java | service-registry-static/src/main/java/dk/dma/enav/services/registry/StaticServiceRegistry.java | maritime-web/Enav-Services | e0329646b924d74b7dc45dd2ca21a6ebdde31d9d | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2019-11-20T18:07:06.000Z | 2019-11-20T18:07:06.000Z | service-registry-static/src/main/java/dk/dma/enav/services/registry/StaticServiceRegistry.java | maritime-web/Enav-Services | e0329646b924d74b7dc45dd2ca21a6ebdde31d9d | [
"ECL-2.0",
"Apache-2.0"
] | 22 | 2016-04-11T12:00:46.000Z | 2022-01-21T23:09:38.000Z | service-registry-static/src/main/java/dk/dma/enav/services/registry/StaticServiceRegistry.java | maritime-web/Enav-Services | e0329646b924d74b7dc45dd2ca21a6ebdde31d9d | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2021-03-08T09:54:11.000Z | 2021-03-08T09:54:11.000Z | 39.25 | 114 | 0.701433 | 999,893 | /* Copyright (c) 2011 Danish Maritime Authority.
*
* 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 dk.dma.enav.services.registry;
import dk.dma.embryo.common.configuration.Property;
import dk.dma.enav.services.registry.api.EnavServiceRegister;
import dk.dma.enav.services.registry.api.InstanceMetadata;
import dk.dma.enav.services.registry.api.TechnicalDesignId;
import dk.dma.enav.services.registry.api.VendorInfo;
import javax.inject.Inject;
import java.util.Collections;
import java.util.List;
public class StaticServiceRegistry implements EnavServiceRegister {
private final String url;
@Inject
public StaticServiceRegistry(@Property("enav-service.service-registry-static.nwnm.endpoint.url") String url) {
this.url = url;
}
@Override
public List<InstanceMetadata> getServiceInstances(TechnicalDesignId id, String wktLocationFilter) {
throw new UnsupportedOperationException("");
}
@Override
public List<InstanceMetadata> getServiceInstances(String wktLocationFilter) {
InstanceMetadata res = new InstanceMetadata("NWNM", "1.0", 1L);
res
.setDescription("Arctic specific service registry providing access to the NW-NM service")
.setName("NWNM Service Endpoint")
.setProducedBy(new VendorInfo("DMA"))
.setProvidedBy(new VendorInfo("DMA"))
.setUrl(url);
return Collections.singletonList(res);
}
@Override
public List<InstanceMetadata> getServiceInstances(List<String> instanceIds) {
InstanceMetadata res = new InstanceMetadata("NWNM", "1.0", 1L);
res
.setDescription("Arctic specific service registry providing access to the NW-NM service")
.setName("NWNM Service Endpoint")
.setProducedBy(new VendorInfo("DMA"))
.setProvidedBy(new VendorInfo("DMA"))
.setUrl(url);
return Collections.singletonList(res);
}
}
|
923c4af160b7d6dade1a9cba25a9ddc4bc46eec7 | 4,163 | java | Java | sdk/src/test/java/com/appdynamics/iot/DeviceInfoTest.java | lbk003/iot-java-sdk | 0402ac4a3e55b3b5206e3a1502e7a1dbfaadb29c | [
"Apache-2.0"
] | null | null | null | sdk/src/test/java/com/appdynamics/iot/DeviceInfoTest.java | lbk003/iot-java-sdk | 0402ac4a3e55b3b5206e3a1502e7a1dbfaadb29c | [
"Apache-2.0"
] | null | null | null | sdk/src/test/java/com/appdynamics/iot/DeviceInfoTest.java | lbk003/iot-java-sdk | 0402ac4a3e55b3b5206e3a1502e7a1dbfaadb29c | [
"Apache-2.0"
] | null | null | null | 40.417476 | 108 | 0.720154 | 999,894 | /**
* Copyright (c) 2018 AppDynamics LLC and its affiliates
*
* 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.appdynamics.iot;
import com.appdynamics.iot.utils.Constants;
import com.appdynamics.iot.utils.StringUtilsTest;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class DeviceInfoTest {
private static final String DEVICE_TYPE = "CAR_MODEL_A";
private static final String DEVICE_ID = "1FMHK7F8XCGA67893";
@Test
public void testDefaultContext() throws Exception {
DeviceInfo deviceInfo = DeviceInfo.builder(DEVICE_TYPE, DEVICE_ID).build();
assertEquals(DEVICE_TYPE, deviceInfo.deviceType);
assertEquals(DEVICE_ID, deviceInfo.deviceId);
}
@Test
public void testDefaultContextNull() throws Exception {
DeviceInfo deviceInfo = DeviceInfo.builder(null, null).build();
assertNull(deviceInfo.deviceType);
assertNull(deviceInfo.deviceId);
}
@Test
public void testDefaultContextWithPipe() throws Exception {
final String pipedDeviceType = "Device| Type";
final String pipedDeviceTypeNoPipe = "Device Type";
final String pipedDeviceId = "Device| Id";
DeviceInfo deviceInfo = DeviceInfo.builder(pipedDeviceType, pipedDeviceId).build();
assertEquals(deviceInfo.deviceType, pipedDeviceTypeNoPipe);
assertEquals(deviceInfo.deviceId, pipedDeviceId);
}
@Test
public void testDefaultContextInvalidInput() throws Exception {
final String longDeviceType = StringUtilsTest.repeat('w', Constants.DEVICE_INFO_DEVICETYPE_MAX + 1);
final String longDeviceId = StringUtilsTest.repeat('x', Constants.DEVICE_INFO_DEVICEID_MAX + 1);
DeviceInfo deviceInfo = DeviceInfo.builder(longDeviceType, longDeviceId).build();
assertEquals(Constants.DEVICE_INFO_DEVICETYPE_MAX, deviceInfo.deviceType.length());
assertEquals(Constants.DEVICE_INFO_DEVICEID_MAX, deviceInfo.deviceId.length());
}
@Test
public void testWithDeviceName() throws Exception {
final String deviceName = "Peter_s_car";
DeviceInfo deviceInfo = DeviceInfo.builder(DEVICE_TYPE, DEVICE_ID)
.withDeviceName(deviceName).build();
assertEquals(DEVICE_TYPE, deviceInfo.deviceType);
assertEquals(DEVICE_ID, deviceInfo.deviceId);
assertEquals(deviceName, deviceInfo.deviceName);
}
@Test
public void testWithDeviceNameNull() throws Exception {
DeviceInfo deviceInfo = DeviceInfo.builder(DEVICE_TYPE, DEVICE_ID)
.withDeviceName(null).build();
assertEquals(DEVICE_TYPE, deviceInfo.deviceType);
assertEquals(DEVICE_ID, deviceInfo.deviceId);
assertNull(deviceInfo.deviceName);
}
@Test
public void testWithDeviceNameLong() throws Exception {
final String longDeviceName = StringUtilsTest.repeat('y', Constants.DEVICE_INFO_DEVICENAME_MAX + 1);
DeviceInfo deviceInfo = DeviceInfo.builder(DEVICE_TYPE, DEVICE_ID)
.withDeviceName(longDeviceName).build();
assertEquals(Constants.DEVICE_INFO_DEVICENAME_MAX, deviceInfo.deviceName.length());
}
@Test
public void testBuild() throws Exception {
final String deviceName = "Peter_s_car";
DeviceInfo deviceInfo = DeviceInfo.builder(DEVICE_TYPE, DEVICE_ID)
.withDeviceName(deviceName)
.build();
assertEquals(DEVICE_TYPE, deviceInfo.deviceType);
assertEquals(DEVICE_ID, deviceInfo.deviceId);
assertEquals(deviceName, deviceInfo.deviceName);
}
}
|
923c4bd1585541d681e26d57e3c3fd7dd4fc52c7 | 211 | java | Java | src/test/java/com/yeye/ohmykids/OhmykidsApplicationTests.java | Hyejung85/Spring_Ohmykids_0910 | 54e43a92dae849d8da64a55232307764b0851cd9 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-10-14T01:00:20.000Z | 2021-10-14T01:00:20.000Z | src/test/java/com/yeye/ohmykids/OhmykidsApplicationTests.java | Hyejung85/Ohmykids_0910 | 54e43a92dae849d8da64a55232307764b0851cd9 | [
"Apache-2.0",
"MIT"
] | 8 | 2021-09-13T02:53:48.000Z | 2021-10-13T00:31:38.000Z | src/test/java/com/yeye/ohmykids/OhmykidsApplicationTests.java | Hyejung85/Ohmykids_0910 | 54e43a92dae849d8da64a55232307764b0851cd9 | [
"Apache-2.0",
"MIT"
] | null | null | null | 15.071429 | 60 | 0.78673 | 999,895 | package com.yeye.ohmykids;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class OhmykidsApplicationTests {
@Test
void contextLoads() {
}
}
|
923c4ef9a01f5142caf661a5dc360c335ed82c9a | 811 | java | Java | EzMail/src/main/java/org/ezlibs/ezmail/Email.java | DanJSG/EzMail | 513ecb6eda7fbd56adf59d415ef99ddf09a99f41 | [
"MIT"
] | null | null | null | EzMail/src/main/java/org/ezlibs/ezmail/Email.java | DanJSG/EzMail | 513ecb6eda7fbd56adf59d415ef99ddf09a99f41 | [
"MIT"
] | null | null | null | EzMail/src/main/java/org/ezlibs/ezmail/Email.java | DanJSG/EzMail | 513ecb6eda7fbd56adf59d415ef99ddf09a99f41 | [
"MIT"
] | null | null | null | 22.527778 | 114 | 0.628853 | 999,896 | package org.ezlibs.ezmail;
import javax.activation.DataSource;
/**
* An email containing HTML body content, a subject, and optional images. If images are not present, these will be
* returned as {@code null}.
*
* This email can be sent using the {@code EmailSender} class method {@code send(email, to)}.
*
*/
public interface Email {
/**
* Get the subject line of the email.
*
* @return the email subject line
*/
String getSubject();
/**
* Get the email's HTML content.
*
* @return the email's HTML content as a {@code String}
*/
String getHtmlContent();
/**
* Get the email's images as an array of data sources.
*
* @return an array of {@code DataSource} objects representing images
*/
DataSource[] getImages();
}
|
923c4f06f53e5f44f69146a2c21c6515b8839548 | 1,659 | java | Java | src/main/java/com/dataiku/dss/intellij/actions/checkout/CheckoutWizard.java | dataiku/dss-integration-pycharm | ff4cae4b49955475dd1a9b5010ba5f4814e5f08a | [
"Apache-2.0"
] | null | null | null | src/main/java/com/dataiku/dss/intellij/actions/checkout/CheckoutWizard.java | dataiku/dss-integration-pycharm | ff4cae4b49955475dd1a9b5010ba5f4814e5f08a | [
"Apache-2.0"
] | null | null | null | src/main/java/com/dataiku/dss/intellij/actions/checkout/CheckoutWizard.java | dataiku/dss-integration-pycharm | ff4cae4b49955475dd1a9b5010ba5f4814e5f08a | [
"Apache-2.0"
] | null | null | null | 30.722222 | 99 | 0.677517 | 999,897 | package com.dataiku.dss.intellij.actions.checkout;
import java.util.ArrayList;
import java.util.List;
import com.intellij.ide.BrowserUtil;
import com.intellij.ide.wizard.AbstractWizardEx;
import com.intellij.ide.wizard.AbstractWizardStepEx;
import com.intellij.openapi.project.Project;
public class CheckoutWizard {
private final CheckoutModel model;
private final AbstractWizardEx wizard;
public CheckoutWizard(Project project) {
model = new CheckoutModel();
wizard = new Wizard("Open Dataiku DSS", project, createSteps(project, model));
}
private static List<AbstractWizardStepEx> createSteps(Project project, CheckoutModel model) {
List<AbstractWizardStepEx> steps = new ArrayList<>();
steps.add(new CheckoutStep1(model, project));
steps.add(new CheckoutStep2Recipe(model));
steps.add(new CheckoutStep2Plugin(model));
return steps;
}
private static class Wizard extends AbstractWizardEx {
public Wizard(String title, Project project, List<AbstractWizardStepEx> steps) {
super(title, project, steps);
this.setHorizontalStretch(1.25f);
this.setVerticalStretch(1.25f);
}
@Override
protected void helpAction() {
BrowserUtil.browse("https://doc.dataiku.com/dss/latest/python-api/outside-usage.html");
}
@Override
protected String getDimensionServiceKey() {
return this.getClass().getName();
}
}
public boolean showAndGet() {
return wizard.showAndGet();
}
public CheckoutModel getModel() {
return model;
}
}
|
923c4fcbe8edcbbc9486d3a10947321debd3fe35 | 4,318 | java | Java | trunk/adhoc-solr/src/main/java/org/apache/lucene/analysis/tr/TurkishLowerCaseFilter.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/analysis/tr/TurkishLowerCaseFilter.java | jwpttcg66/mdrill | 3acf33cfa72527fc1d949e933cc87fba340f2524 | [
"ICU",
"Apache-2.0"
] | 7 | 2015-05-04T10:29:01.000Z | 2019-01-07T05:38:55.000Z | trunk/adhoc-solr/src/main/java/org/apache/lucene/analysis/tr/TurkishLowerCaseFilter.java | jwpttcg66/mdrill | 3acf33cfa72527fc1d949e933cc87fba340f2524 | [
"ICU",
"Apache-2.0"
] | 579 | 2015-01-04T06:40:10.000Z | 2022-03-28T11:53:15.000Z | 34.544 | 82 | 0.652617 | 999,898 | package org.apache.lucene.analysis.tr;
/**
* 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.io.IOException;
import org.apache.lucene.analysis.TokenFilter;
import org.apache.lucene.analysis.TokenStream;
import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
/**
* Normalizes Turkish token text to lower case.
* <p>
* Turkish and Azeri have unique casing behavior for some characters. This
* filter applies Turkish lowercase rules. For more information, see <a
* href="http://en.wikipedia.org/wiki/Turkish_dotted_and_dotless_I"
* >http://en.wikipedia.org/wiki/Turkish_dotted_and_dotless_I</a>
* </p>
*/
public final class TurkishLowerCaseFilter extends TokenFilter {
private static final int LATIN_CAPITAL_LETTER_I = '\u0049';
private static final int LATIN_SMALL_LETTER_I = '\u0069';
private static final int LATIN_SMALL_LETTER_DOTLESS_I = '\u0131';
private static final int COMBINING_DOT_ABOVE = '\u0307';
private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
/**
* Create a new TurkishLowerCaseFilter, that normalizes Turkish token text
* to lower case.
*
* @param in TokenStream to filter
*/
public TurkishLowerCaseFilter(TokenStream in) {
super(in);
}
@Override
public final boolean incrementToken() throws IOException {
boolean iOrAfter = false;
if (input.incrementToken()) {
final char[] buffer = termAtt.buffer();
int length = termAtt.length();
for (int i = 0; i < length;) {
final int ch = Character.codePointAt(buffer, i);
iOrAfter = (ch == LATIN_CAPITAL_LETTER_I ||
(iOrAfter && Character.getType(ch) == Character.NON_SPACING_MARK));
if (iOrAfter) { // all the special I turkish handling happens here.
switch(ch) {
// remove COMBINING_DOT_ABOVE to mimic composed lowercase
case COMBINING_DOT_ABOVE:
length = delete(buffer, i, length);
continue;
// i itself, it depends if it is followed by COMBINING_DOT_ABOVE
// if it is, we will make it small i and later remove the dot
case LATIN_CAPITAL_LETTER_I:
if (isBeforeDot(buffer, i + 1, length)) {
buffer[i] = LATIN_SMALL_LETTER_I;
} else {
buffer[i] = LATIN_SMALL_LETTER_DOTLESS_I;
// below is an optimization. no COMBINING_DOT_ABOVE follows,
// so don't waste time calculating Character.getType(), etc
iOrAfter = false;
}
i++;
continue;
}
}
i += Character.toChars(Character.toLowerCase(ch), buffer, i);
}
termAtt.setLength(length);
return true;
} else
return false;
}
/**
* lookahead for a combining dot above.
* other NSMs may be in between.
*/
private boolean isBeforeDot(char s[], int pos, int len) {
for (int i = pos; i < len;) {
final int ch = Character.codePointAt(s, i);
if (Character.getType(ch) != Character.NON_SPACING_MARK)
return false;
if (ch == COMBINING_DOT_ABOVE)
return true;
i += Character.charCount(ch);
}
return false;
}
/**
* delete a character in-place.
* rarely happens, only if COMBINING_DOT_ABOVE is found after an i
*/
private int delete(char s[], int pos, int len) {
if (pos < len)
System.arraycopy(s, pos + 1, s, pos, len - pos - 1);
return len - 1;
}
}
|
923c4fdb59a5a9c1ead3d59be254770ca9b3710c | 550 | java | Java | src/main/java/edu/hm/hafner/analysis/registry/SunCDescriptor.java | theuktr4/analysis-model | 69b1b9e9c24df8de68d281a37bb45e055b229b91 | [
"MIT"
] | 73 | 2018-08-28T20:25:40.000Z | 2022-03-04T07:09:56.000Z | src/main/java/edu/hm/hafner/analysis/registry/SunCDescriptor.java | theuktr4/analysis-model | 69b1b9e9c24df8de68d281a37bb45e055b229b91 | [
"MIT"
] | 645 | 2017-10-24T08:13:02.000Z | 2022-03-31T22:44:10.000Z | src/main/java/edu/hm/hafner/analysis/registry/SunCDescriptor.java | theuktr4/analysis-model | 69b1b9e9c24df8de68d281a37bb45e055b229b91 | [
"MIT"
] | 186 | 2017-10-12T12:48:40.000Z | 2022-03-22T22:11:06.000Z | 22.916667 | 62 | 0.687273 | 999,899 | package edu.hm.hafner.analysis.registry;
import edu.hm.hafner.analysis.IssueParser;
import edu.hm.hafner.analysis.parser.SunCParser;
/**
* A descriptor for the the SUN Studio C++ compiler.
*
* @author Lorenz Munsch
*/
class SunCDescriptor extends ParserDescriptor {
private static final String ID = "sunc";
private static final String NAME = "SUN C++ Compiler";
SunCDescriptor() {
super(ID, NAME);
}
@Override
public IssueParser createParser(final Option... options) {
return new SunCParser();
}
}
|
923c4fee0b51c8946e360be1e18760c165c88eea | 543 | java | Java | gulimall-product/src/main/java/com/zc/gulimall/product/service/CategoryService.java | Hcrxyc/gulimall | 123b11cae6faa0a062c9e7f6eb2bf1ab7b380102 | [
"Apache-2.0"
] | null | null | null | gulimall-product/src/main/java/com/zc/gulimall/product/service/CategoryService.java | Hcrxyc/gulimall | 123b11cae6faa0a062c9e7f6eb2bf1ab7b380102 | [
"Apache-2.0"
] | 2 | 2021-05-08T18:12:27.000Z | 2021-09-20T20:58:51.000Z | gulimall-product/src/main/java/com/zc/gulimall/product/service/CategoryService.java | Hcrxyc/gulimall | 123b11cae6faa0a062c9e7f6eb2bf1ab7b380102 | [
"Apache-2.0"
] | null | null | null | 20.769231 | 67 | 0.75 | 999,900 | package com.zc.gulimall.product.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zc.common.utils.PageUtils;
import com.zc.gulimall.product.entity.CategoryEntity;
import java.util.List;
import java.util.Map;
/**
* 商品三级分类
*
* @author zc
* @email hzdkv@example.com
* @date 2020-05-23 17:41:17
*/
public interface CategoryService extends IService<CategoryEntity> {
PageUtils queryPage(Map<String, Object> params);
List<CategoryEntity> listWithTree();
void removeMenuByIds(List<Long> ids);
}
|
923c50526dc80d01179493db34cbe9f8c4fcd0d8 | 184 | java | Java | simple-pubsub-redis/src/main/java/org/wit/ff/ps/listener/redis/IRedisMessageListenerTask.java | fangfan/ff | e07c4a7e81c8ea7b2750ef46ec864d134d7df0d3 | [
"Apache-2.0"
] | null | null | null | simple-pubsub-redis/src/main/java/org/wit/ff/ps/listener/redis/IRedisMessageListenerTask.java | fangfan/ff | e07c4a7e81c8ea7b2750ef46ec864d134d7df0d3 | [
"Apache-2.0"
] | null | null | null | simple-pubsub-redis/src/main/java/org/wit/ff/ps/listener/redis/IRedisMessageListenerTask.java | fangfan/ff | e07c4a7e81c8ea7b2750ef46ec864d134d7df0d3 | [
"Apache-2.0"
] | null | null | null | 16.727273 | 73 | 0.766304 | 999,901 | package org.wit.ff.ps.listener.redis;
import org.wit.ff.ps.listener.IMessageListenerTask;
public interface IRedisMessageListenerTask extends IMessageListenerTask {
}
|
923c519b53bd35a307068ad92f244eeb59722231 | 2,016 | java | Java | src/main/java/io/curity/identityserver/plugin/eventlistener/zapier/config/EventListenerConfiguration.java | curityio/zapier-eventlistener | 800ec2de18dc4fca169be26609451efa55316e38 | [
"Apache-2.0"
] | null | null | null | src/main/java/io/curity/identityserver/plugin/eventlistener/zapier/config/EventListenerConfiguration.java | curityio/zapier-eventlistener | 800ec2de18dc4fca169be26609451efa55316e38 | [
"Apache-2.0"
] | null | null | null | src/main/java/io/curity/identityserver/plugin/eventlistener/zapier/config/EventListenerConfiguration.java | curityio/zapier-eventlistener | 800ec2de18dc4fca169be26609451efa55316e38 | [
"Apache-2.0"
] | null | null | null | 32 | 106 | 0.766369 | 999,902 | /*
* Copyright 2018 Curity 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 io.curity.identityserver.plugin.eventlistener.zapier.config;
import se.curity.identityserver.sdk.config.Configuration;
import se.curity.identityserver.sdk.config.annotation.DefaultBoolean;
import se.curity.identityserver.sdk.config.annotation.Description;
import se.curity.identityserver.sdk.service.Bucket;
import se.curity.identityserver.sdk.service.ExceptionFactory;
import se.curity.identityserver.sdk.service.HttpClient;
import se.curity.identityserver.sdk.service.Json;
import se.curity.identityserver.sdk.service.WebServiceClientFactory;
import java.util.List;
import java.util.Optional;
@SuppressWarnings("InterfaceNeverImplemented")
public interface EventListenerConfiguration extends Configuration
{
@Description("Handle account created SCIM event.")
@DefaultBoolean(false)
boolean isHandleAccountCreatedScimEvent();
List<Events> handleEvents();
enum Events
{
AccountDeletedScimEvent,
CreatedAccountEvent,
CreatedSsoSessionEvent,
AuthenticationEvent,
LogoutAuthenticationEvent
}
ExceptionFactory exceptionFactory();
Bucket getBucket();
Json json();
@Description("The HTTP client with any proxy and TLS settings that will be used to connect to zapier")
Optional<HttpClient> getHttpClient();
WebServiceClientFactory getWebServiceClientFactory();
ExceptionFactory getExceptionFactory();
}
|
923c519e0139e1aceef7df38c86868617da1843d | 1,810 | java | Java | src/main/java/com/github/aadavydov/fastjsonquery/parser/ErrorListener.java | a-a-davydov/fast-json-query | 0c7609a6846eb09d5f9c6335beacb61aaefed70e | [
"MIT"
] | null | null | null | src/main/java/com/github/aadavydov/fastjsonquery/parser/ErrorListener.java | a-a-davydov/fast-json-query | 0c7609a6846eb09d5f9c6335beacb61aaefed70e | [
"MIT"
] | null | null | null | src/main/java/com/github/aadavydov/fastjsonquery/parser/ErrorListener.java | a-a-davydov/fast-json-query | 0c7609a6846eb09d5f9c6335beacb61aaefed70e | [
"MIT"
] | null | null | null | 40.377778 | 152 | 0.751238 | 999,903 | /*
* Copyright (c) 2021-2021. Andrey Davydov (upchh@example.com; https://github.com/a-a-davydov)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*
*
*/
package com.github.aadavydov.fastjsonquery.parser;
import org.antlr.v4.runtime.BaseErrorListener;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Recognizer;
public final class ErrorListener extends BaseErrorListener {
public static ErrorListener INSTANCE = new ErrorListener();
private ErrorListener() {
}
@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
throw new IllegalStateException("<" + line + ":" + charPositionInLine + "> " + msg);
}
}
|
923c5267886d92412ef742f26e94ddd1fe2802e8 | 468 | java | Java | comparadorAig_Java/src/aig_sat_bdd_solver/AigNode.java | FranciscoKnebel/comparadorAIG | 59e075c83bbfdb3dce605042d4818f092c8c65f1 | [
"Apache-2.0"
] | null | null | null | comparadorAig_Java/src/aig_sat_bdd_solver/AigNode.java | FranciscoKnebel/comparadorAIG | 59e075c83bbfdb3dce605042d4818f092c8c65f1 | [
"Apache-2.0"
] | null | null | null | comparadorAig_Java/src/aig_sat_bdd_solver/AigNode.java | FranciscoKnebel/comparadorAIG | 59e075c83bbfdb3dce605042d4818f092c8c65f1 | [
"Apache-2.0"
] | null | null | null | 18.72 | 96 | 0.587607 | 999,904 | package aig_sat_bdd_solver;
/**
* @author luciano/rodrigo
*/
public class AigNode {
int input1;
int input2;
int output;
String equacao;
public AigNode(int input1, int input2, int output){
this.input1 = input1;
this.input2 = input2;
this.output = output;
}
@Override
public String toString(){
return "Input1: "+input1+" Input2: "+input2+" Output: "+output + " Equacao: " + equacao;
}
}
|
923c52db28ec850d393a31dfc73f36ab199b52ec | 2,381 | java | Java | src/main/kotlin/mx/buap/cs/labmngmnt/model/Imagen.java | carlosmontoyargz/lab-management | 01f3a03588e76276d071e3182002aa0d4e3b27a8 | [
"MIT"
] | null | null | null | src/main/kotlin/mx/buap/cs/labmngmnt/model/Imagen.java | carlosmontoyargz/lab-management | 01f3a03588e76276d071e3182002aa0d4e3b27a8 | [
"MIT"
] | null | null | null | src/main/kotlin/mx/buap/cs/labmngmnt/model/Imagen.java | carlosmontoyargz/lab-management | 01f3a03588e76276d071e3182002aa0d4e3b27a8 | [
"MIT"
] | null | null | null | 29.395062 | 80 | 0.711886 | 999,905 | /*
* The MIT License (MIT)
*
* Copyright (c) 2021. Carlos Alberto Montoya Rodríguez.
*
* 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 mx.buap.cs.labmngmnt.model;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.time.LocalDateTime;
import java.util.UUID;
/**
* @author Carlos Montoya
* @since 1.0
*/
@Entity
@EntityListeners(AuditingEntityListener.class)
public class Imagen
{
@Id
@GeneratedValue(generator = "UUID")
@GenericGenerator(
name = "UUID",
strategy = "org.hibernate.id.UUIDGenerator")
@Column(name = "imagen_id", updatable = false, nullable = false)
private UUID id;
private String nombre;
@CreatedDate
@Column(updatable = false)
private LocalDateTime creacion;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public LocalDateTime getCreacion() {
return creacion;
}
public void setCreacion(LocalDateTime creacion) {
this.creacion = creacion;
}
}
|
923c53198e87b0627fdb6c0e531856e06394061a | 3,814 | java | Java | plato-model/src/main/java/eu/scape_project/planning/model/policy/ControlPolicy.java | openpreserve/plato | 10d9fc276c23c773a6a346af8312e48c50ac8755 | [
"Apache-2.0"
] | 2 | 2016-04-02T18:02:21.000Z | 2019-07-23T21:31:31.000Z | plato-model/src/main/java/eu/scape_project/planning/model/policy/ControlPolicy.java | openpreserve/plato | 10d9fc276c23c773a6a346af8312e48c50ac8755 | [
"Apache-2.0"
] | 8 | 2015-05-07T06:14:03.000Z | 2022-01-27T16:17:54.000Z | plato-model/src/main/java/eu/scape_project/planning/model/policy/ControlPolicy.java | openpreserve/plato | 10d9fc276c23c773a6a346af8312e48c50ac8755 | [
"Apache-2.0"
] | 2 | 2017-03-06T11:20:56.000Z | 2018-03-28T19:36:45.000Z | 22.304094 | 81 | 0.551914 | 999,906 | package eu.scape_project.planning.model.policy;
import eu.scape_project.planning.model.measurement.Measure;
/**
* A control policy, which is of type {@link #controlPolicyType}, refers to a
* measure {@link #measure} which must/should ({@link #modality}) have a certain
* {@link #value}.
*
* @author hku
*
*/
public class ControlPolicy {
public enum ControlPolicyType {
FORMAT_OBJECTIVE("Format Objective"),
AUTHENTICITY_OBJECTIVE("Authenticity Objective"),
ACTION_OBJECTIVE("Action Objective"),
REPRESENTATION_INSTANCE_OBJECTIVE("Representation Instance Objective"),
ACCESS_OBJECTIVE("Access Objective");
private ControlPolicyType(final String text) {
this.text = text;
}
public String toString() {
return text;
}
private final String text;
}
public enum Modality {
MUST("must"),
SHOULD("should");
private final String key;
private final String text;
private Modality(final String text) {
this.text = text;
this.key = "modality."+name();
}
public String toString() {
return this.text;
}
public String getKey(){
return key;
}
}
public enum Qualifier {
GT("greater than"),
LT("lower than"),
EQ("equal"),
GE("greater or equal"),
LE("lower or equal");
private final String text;
private final String key;
private Qualifier(final String text) {
this.text = text;
this.key = "qualifier."+name();
}
public String toString() {
return text;
}
public String getKey() {
return key;
}
}
/**
* URI of the control policy.
*/
private String uri;
/**
* Human understandable name of the control policy
*/
private String name;
/**
* Type of control policy.
*/
private ControlPolicyType controlPolicyType;
/**
* modality that describes whether the particular property-value pair is
* present or not.
*/
private Modality modality;
/**
* A qualifier (equals, greater than, less than etc).
*/
private Qualifier qualifier;
/**
* A value associated with the measure.
*/
private String value;
/**
* A measure that the control policy pertains to
*/
private Measure measure;
public String getUri() {
return uri;
}
public void setUri(String uri) {
this.uri = uri;
}
public Qualifier getQualifier() {
return qualifier;
}
public void setQualifier(Qualifier qualifier) {
this.qualifier = qualifier;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public Modality getModality() {
return modality;
}
public void setModality(Modality modality) {
this.modality = modality;
}
public ControlPolicyType getControlPolicyType() {
return controlPolicyType;
}
public void setControlPolicyType(ControlPolicyType controlPolicyType) {
this.controlPolicyType = controlPolicyType;
}
public Measure getMeasure() {
return measure;
}
public void setMeasure(Measure measure) {
this.measure = measure;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
|
923c53ca34e096740a95398c40d852dbd4724a3b | 1,178 | java | Java | app/src/main/java/com/bluetooth/mad/Global.java | arfaat28/bluetoothchat | b30514257a678a7438fd92b114726f13f4389cd7 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/bluetooth/mad/Global.java | arfaat28/bluetoothchat | b30514257a678a7438fd92b114726f13f4389cd7 | [
"Apache-2.0"
] | 1 | 2021-07-14T15:46:18.000Z | 2021-07-14T15:46:18.000Z | app/src/main/java/com/bluetooth/mad/Global.java | arfaat28/bluetoothchat | b30514257a678a7438fd92b114726f13f4389cd7 | [
"Apache-2.0"
] | null | null | null | 31.837838 | 124 | 0.679117 | 999,907 | package com.bluetooth.mad;
import android.app.Application;
import com.bluetooth.communicator.BluetoothCommunicator;
import com.bluetooth.communicator.tools.BluetoothTools;
import java.util.ArrayList;
import java.util.Random;
public class Global extends Application {
private BluetoothCommunicator bluetoothCommunicator;
@Override
public void onCreate() {
super.onCreate();
String name = android.os.Build.MODEL;
//compatibily check for supported characters
ArrayList<Character> supportedCharacters = BluetoothTools.getSupportedUTFCharacters(this);
boolean equals = true;
for (int i = 0; i < name.length() && equals; i++) {
if (!supportedCharacters.contains(Character.valueOf(name.charAt(i)))) {
equals = false;
}
}
if (!equals || name.length() > 18) {
name = "User " + new Random().nextInt(21);
}
bluetoothCommunicator = new BluetoothCommunicator(this, name, BluetoothCommunicator.STRATEGY_P2P_WITH_RECONNECTION);
}
public BluetoothCommunicator getBluetoothCommunicator() {
return bluetoothCommunicator;
}
}
|
923c56136dd5b6ad6e93cb1470e2f92268556020 | 3,282 | java | Java | src/main/java/engine/graphics/geometry/Mesh.java | Slushy/goldendragon | ddddc5bb165d973c727a5db27470e7bfc43d13b9 | [
"MIT"
] | 1 | 2020-02-06T00:32:00.000Z | 2020-02-06T00:32:00.000Z | src/main/java/engine/graphics/geometry/Mesh.java | Slushy/goldendragon | ddddc5bb165d973c727a5db27470e7bfc43d13b9 | [
"MIT"
] | null | null | null | src/main/java/engine/graphics/geometry/Mesh.java | Slushy/goldendragon | ddddc5bb165d973c727a5db27470e7bfc43d13b9 | [
"MIT"
] | null | null | null | 23.442857 | 108 | 0.684339 | 999,908 | package engine.graphics.geometry;
import engine.common.Entity;
import engine.utils.Debug;
/**
* Represents the geometric vertices for a game object
*
* @author brandon.porter
*
*/
public class Mesh extends Entity {
private static final String ENTITY_NAME = "Mesh";
private VAO _vao;
private MeshVBOData _vboData;
private int _vertexCount = -1;
private int _triangleCount = -1;
public Mesh() {
super(ENTITY_NAME);
}
/**
* Constructs a new mesh with the specified name
*
* @param name
* the name of the mesh
*/
public Mesh(String name) {
super(name);
}
/**
* A mesh is loaded once all of its vbo data (positions, texture coords,
* vertices, etc.) have been loaded and stored within this mesh instance
*
* @return true if mesh is loaded and ready, false otherwise
*/
public final boolean isLoaded() {
return _vao != null;
}
/**
* @return the number of vertices for this mesh
*/
public int getVertexCount() {
return _vertexCount;
}
/**
* @return the number of triangles as determined by the index list
*/
public int getTriangleCount() {
return _triangleCount;
}
/**
* Registers the vbo data with opengl. [WARNING] - This MUST be called from
* the main thread.
*
* @param vboData
* the vbo data to set for the mesh
*/
public void loadVAO(MeshVBOData vboData) {
this._vboData = vboData;
this._vertexCount = vboData.indices.length;
this._triangleCount = vboData.indices.length / 3;
Debug.log("Loading new mesh with Triangles: " + _triangleCount + ", Vertices: " + _vertexCount);
// Create and bind new VAO
this._vao = new VAO();
_vao.use();
// Create all VBOS (Cannot change this order, if you do
// you will have to edit the hardcoded VBO locations in
// the actual shader files - maybe that should be changed?)
VBO[] vbos = { VBO.POSITION, VBO.TEXTURE, VBO.NORMAL };
float[][] vboDataArrays = { vboData.vertexPositions, vboData.textureCoords, vboData.vertexNormals };
// Interleaved VBOs are much better performance-wise
_vao.bindInterleavedVBO(vboData.vertexPositions.length / 3, vbos, vboDataArrays);
_vao.bindVBO(VBO.INDEX, vboData.indices);
// Unbind and return new vao
_vao.done();
}
/**
* @return the vao for the mesh
*/
public VAO getVAO() {
return _vao;
}
/**
* @return the vertices for this mesh
*/
public MeshVBOData getVBOData() {
return _vboData;
}
/**
* Disposes VAO/VBOS and any other entities relating to this mesh
*/
@Override
protected void onDispose() {
_vao.dispose();
}
/**
* Container used to hold data for loading in the mesh
*
* @author Brandon Porter
*
*/
public static class MeshVBOData {
public final float[] vertexPositions;
public final float[] textureCoords;
public final float[] vertexNormals;
public final int[] indices;
/**
* Constructs a new mesh vbo data wrapper
*
* @param vertexPositions
* @param textureCoords
* @param vertexNormals
* @param indices
*/
public MeshVBOData(float[] vertexPositions, float[] textureCoords, float[] vertexNormals, int[] indices) {
this.vertexPositions = vertexPositions;
this.textureCoords = textureCoords;
this.vertexNormals = vertexNormals;
this.indices = indices;
}
}
}
|
923c56cb05a3207bf8cec88df3c8728e9e680b9c | 95 | java | Java | liteql-skeleton-core/src/main/java/org/cheeryworks/liteql/skeleton/query/PublicQuery.java | cheeryworks/liteql-java | e144293d22038f43c2e0dcb2ef72c88d33215f31 | [
"MIT"
] | 1 | 2021-05-06T04:24:31.000Z | 2021-05-06T04:24:31.000Z | liteql-skeleton-core/src/main/java/org/cheeryworks/liteql/skeleton/query/PublicQuery.java | cheeryworks/liteql-java | e144293d22038f43c2e0dcb2ef72c88d33215f31 | [
"MIT"
] | null | null | null | liteql-skeleton-core/src/main/java/org/cheeryworks/liteql/skeleton/query/PublicQuery.java | cheeryworks/liteql-java | e144293d22038f43c2e0dcb2ef72c88d33215f31 | [
"MIT"
] | null | null | null | 19 | 46 | 0.821053 | 999,909 | package org.cheeryworks.liteql.skeleton.query;
public interface PublicQuery extends Query {
}
|
923c56e22c92badea17bcbb04e84017eb73d1e23 | 7,231 | java | Java | java/Assignment2.java | c4santot/csc343-assing02 | 30e1ffab1c1fcb82fb0a68832a239384c86b1d31 | [
"MIT"
] | 1 | 2019-03-10T03:35:51.000Z | 2019-03-10T03:35:51.000Z | java/Assignment2.java | c4santot/csc343-assing02 | 30e1ffab1c1fcb82fb0a68832a239384c86b1d31 | [
"MIT"
] | null | null | null | java/Assignment2.java | c4santot/csc343-assing02 | 30e1ffab1c1fcb82fb0a68832a239384c86b1d31 | [
"MIT"
] | 1 | 2020-06-12T13:42:20.000Z | 2020-06-12T13:42:20.000Z | 21.585075 | 141 | 0.540589 | 999,910 | import java.sql.*;
public class Assignment2 {
// A connection to the database
Connection connection;
// Statement to run queries
Statement sql;
// Prepared Statement
PreparedStatement ps;
// Resultset for the query
ResultSet rs;
//CONSTRUCTOR
Assignment2(){
try{
Class.forName("org.postgresql.Driver");
}catch(ClassNotFoundException e){
}
}
//Using the input parameters, establish a connection to be used for this session. Returns true if connection is sucessful
public boolean connectDB(String URL, String username, String password){
try {
connection = DriverManager.getConnection(URL, username, password);
String statement = "SET search_path TO A2";
sql = connection.createStatement();
sql.executeUpdate(statement);
sql.close();
}catch (Exception e) {
// TODO: handle exception
}
return (connection!=null);
}
//Closes the connection. Returns true if closure was sucessful
public boolean disconnectDB(){
boolean connectionClosed = false;
boolean statementClosed = false;
boolean preparedStatementClosed = false;
boolean resultSetClosed = false;
try{
if(rs!=null){
rs.close();
resultSetClosed = rs.isClosed();
}
if(ps!=null){
ps.close();
preparedStatementClosed = ps.isClosed();
}
if(sql!=null){
sql.close();
statementClosed = sql.isClosed();
}
if(connection!=null){
connection.close();
connectionClosed = connection.isClosed();
}
}catch(SQLException e){
}
return (resultSetClosed && preparedStatementClosed && statementClosed && connectionClosed);
}
public boolean insertCountry (int cid, String name, int height, int population) {
if(connection!=null){
boolean psClosed = false;
int psReturn = 0;
try{
String statement = "INSERT INTO country(cid, cname, height, population) VALUES (?, ?, ?, ?)";
ps = connection.prepareStatement(statement);
ps.setInt(1, cid);
ps.setString(2, name);
ps.setInt(3, height);
ps.setInt(4, population);
psReturn = ps.executeUpdate();
ps.close();
psClosed = ps.isClosed();
}catch(SQLException e){
}
return (psClosed && (psReturn==1));
}
return false;
}
public int getCountriesNextToOceanCount(int oid) {
if(connection!=null){
boolean psClosed = false;
boolean rsClosed = false;
int total = 0;
try{
String statement = "SELECT COUNT(cid) AS number FROM oceanAccess WHERE oid=?";
ps = connection.prepareStatement(statement);
ps.setInt(1, oid);
rs = ps.executeQuery();
if(rs.next()){
total = rs.getInt(1);
}
if(rs!=null){
rs.close();
}
rsClosed = rs.isClosed();
ps.close();
psClosed = ps.isClosed();
}catch(SQLException e){
}
if(rsClosed && psClosed){
return total;
}else{
return -1;
}
}
return -1;
}
public String getOceanInfo(int oid){
if(connection!=null){
boolean psClosed = false;
boolean rsClosed = false;
String info;
try{
String statement = "SELECT * FROM ocean WHERE oid=?";
ps = connection.prepareStatement(statement);
ps.setInt(1, oid);
rs = ps.executeQuery();
if(rs.next()){
info = rs.getInt(1) + ":" + rs.getString(2) + ":" + rs.getInt(3);
}else{
info = "";
}
if(rs!=null){
rs.close();
}
rsClosed = rs.isClosed();
ps.close();
psClosed = ps.isClosed();
return info;
}catch(SQLException e){
}
}
return "";
}
public boolean chgHDI(int cid, int year, float newHDI){
if(connection!=null){
boolean psClosed = false;
int psReturn = 0;
try{
String statement = "UPDATE hdi SET hdi_score=? WHERE cid=? AND year=?";
ps = connection.prepareStatement(statement);
ps.setFloat(1, newHDI);
ps.setInt(2, cid);
ps.setInt(3, year);
psReturn = ps.executeUpdate();
ps.close();
psClosed = ps.isClosed();
}catch(SQLException e){
}
return (psClosed && (psReturn==1));
}
return false;
}
public boolean deleteNeighbour(int c1id, int c2id){
if(connection!=null){
boolean psClosed = false;
int psReturn = 0;
try{
String statement = "DELETE FROM neighbour WHERE country=? AND neighbor=?";
ps = connection.prepareStatement(statement);
ps.setInt(1, c1id);
ps.setInt(2, c2id);
psReturn += ps.executeUpdate();
ps.setInt(1, c2id);
ps.setInt(2, c1id);
psReturn += ps.executeUpdate();
ps.close();
psClosed = ps.isClosed();
}catch(SQLException e){
}
return (psClosed && (psReturn==2));
}
return false;
}
public String listCountryLanguages(int cid){
if(connection!=null){
boolean psClosed = false;
boolean rsClosed = false;
String list = "";
try{
String statement = "SELECT * FROM language WHERE cid=? ORDER BY lpercentage DESC";
ps = connection.prepareStatement(statement);
ps.setInt(1, cid);
rs = ps.executeQuery();
int i=1;
while(rs.next()){
list += "|" + i + rs.getInt(2) + ":|" + i + rs.getString(3) + ":|" + i + rs.getDouble(4) + "#";
}
if(rs!=null){
rs.close();
}
rsClosed = rs.isClosed();
ps.close();
psClosed = ps.isClosed();
return list;
}catch(SQLException e){
}
}
return "";
}
public boolean updateHeight(int cid, int decrH){
if(connection!=null){
boolean psClosed = false;
int psReturn = 0;
try{
String statement = "UPDATE country SET height=? WHERE cid=?";
ps = connection.prepareStatement(statement);
ps.setInt(1, decrH);
ps.setInt(2, cid);
psReturn = ps.executeUpdate();
ps.close();
psClosed = ps.isClosed();
}catch(SQLException e){
}
return (psClosed && (psReturn==1));
}
return false;
}
public boolean updateDB(){
if(connection!=null){
boolean sqlClosed = false;
int sqlReturn = 0;
try{
String statement = "CREATE TABLE mostPopulousCountries AS (SELECT cid,cname FROM country WHERE population>100000000 ORDER BY cid ASC)";
sql = connection.createStatement();
sqlReturn = sql.executeUpdate(statement);
sql.close();
sqlClosed = sql.isClosed();
}catch(SQLException e){
}
return (sqlClosed && (sqlReturn==0));
}
return false;
}
}
|
923c57047d6265cbc33dfd3e95d2a0770da32c81 | 2,567 | java | Java | src/test/java/com/catic/test/prepexpress/pages/home/table/FileTableFilterWidget.java | VivanSanjay/catic | dc1c44c1de9297c80c1c86a2a2d8ad3dbcda1290 | [
"Apache-2.0"
] | null | null | null | src/test/java/com/catic/test/prepexpress/pages/home/table/FileTableFilterWidget.java | VivanSanjay/catic | dc1c44c1de9297c80c1c86a2a2d8ad3dbcda1290 | [
"Apache-2.0"
] | null | null | null | src/test/java/com/catic/test/prepexpress/pages/home/table/FileTableFilterWidget.java | VivanSanjay/catic | dc1c44c1de9297c80c1c86a2a2d8ad3dbcda1290 | [
"Apache-2.0"
] | null | null | null | 26.193878 | 98 | 0.717959 | 999,911 | package com.catic.test.prepexpress.pages.home.table;
import java.time.LocalDate;
import net.serenitybdd.core.annotations.ImplementedBy;
import net.serenitybdd.core.pages.WidgetObject;
@ImplementedBy(FileTableFilterWidgetImpl.class)
public interface FileTableFilterWidget extends WidgetObject {
/**
* Enters a search term into the filter options
* @param searchTerm
* @return this object
*/
FileTableFilterWidget setSearchTerm(String searchTerm);
/**
* Returns the currently displayed value in the search input field
* @return the current value in search input field
*/
String getSearchTerm();
/**
* Selects the 'Active Files Only' radio button
* @return this object
*/
FileTableFilterWidget setActiveFilesOnly();
/**
* Returns whether the 'Active Files Only' radio button is selected
* @return {@code true} if it is selected, {@code false} otherwise
*/
boolean activeFilesOnly();
/**
* Selects the 'All Files' radio button
* @return this object
*/
FileTableFilterWidget setAllFiles();
/**
* Returns whether the 'All Files' radio button is selected
* @return {@code true} if it is selected, {@code false} otherwise
*/
boolean allFiles();
/**
* Selects the 'Inactive Files Only' radio button
* @return this object
*/
FileTableFilterWidget setInactiveFilesOnly();
/**
* Returns whether the 'Inactive Files Only' radio button is selected
* @return {@code true} if it is selected, {@code false} otherwise
*/
boolean inactiveFilesOnly();
/**
* Sets the dates for the 'Created Between' filter
* @param from the start date
* @param to the end date
* @return this object
*/
FileTableFilterWidget setCreatedBetween(LocalDate from, LocalDate to);
/**
* Sets the start date for the 'Created Between' filter
* @param start the start date
* @return this object
*/
FileTableFilterWidget setStartDate(LocalDate start);
/**
* Returns the currently displayed value in the start date field for the 'Created Between' filter
* @return the currently displayed start date
*/
String getStartDate();
/**
* Sets the end date for the 'Created Between' filter
* @param end the end date
* @return this object
*/
FileTableFilterWidget setEndDate(LocalDate end);
/**
* Returns the currently displayed value in the end date field for the 'Created Between' filter
* @return the currently displayed end date
*/
String getEndDate();
/**
* Clicks the 'Clear' button to clear filter options
* @return this object
*/
FileTableFilterWidget clickClear();
}
|
923c57513b4133424916e3f262654d5bf882bad7 | 1,114 | java | Java | ssm/src/main/java/com/shuangji/demo/ssm/controller/UserController.java | litoujkl/learn-spring | f61a100271aed568835c056c3df2d18977542dd9 | [
"Apache-2.0"
] | null | null | null | ssm/src/main/java/com/shuangji/demo/ssm/controller/UserController.java | litoujkl/learn-spring | f61a100271aed568835c056c3df2d18977542dd9 | [
"Apache-2.0"
] | null | null | null | ssm/src/main/java/com/shuangji/demo/ssm/controller/UserController.java | litoujkl/learn-spring | f61a100271aed568835c056c3df2d18977542dd9 | [
"Apache-2.0"
] | null | null | null | 30.944444 | 65 | 0.790844 | 999,912 | package com.shuangji.demo.ssm.controller;
import com.shuangji.demo.ssm.pojo.User;
import com.shuangji.demo.ssm.service.IUserService;
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.ResponseBody;
import javax.servlet.http.HttpServletRequest;
@Controller
@RequestMapping("/user")
public class UserController {
@Autowired
private IUserService userService;
@RequestMapping("/showUser")
public String toIndex(HttpServletRequest request, Model model) {
int userId = Integer.parseInt(request.getParameter("id"));
User user = this.userService.getUserById(userId);
model.addAttribute("user", user);
return "showUser";
}
@RequestMapping("/test")
@ResponseBody
public Model test(HttpServletRequest request, Model model) {
int userId = Integer.parseInt(request.getParameter("id"));
User user = this.userService.getUserById(userId);
model.addAttribute("user", user);
return model;
}
}
|
923c5ad9dec072f815c604c77b7566c61c2ac85b | 3,170 | java | Java | artrade/src/main/java/com/megait/artrade/authentication/Oauth2UserService.java | hek316/new_repository | 1c79d4864e8b17605072f4cbb6728489b7a92339 | [
"Apache-2.0"
] | null | null | null | artrade/src/main/java/com/megait/artrade/authentication/Oauth2UserService.java | hek316/new_repository | 1c79d4864e8b17605072f4cbb6728489b7a92339 | [
"Apache-2.0"
] | null | null | null | artrade/src/main/java/com/megait/artrade/authentication/Oauth2UserService.java | hek316/new_repository | 1c79d4864e8b17605072f4cbb6728489b7a92339 | [
"Apache-2.0"
] | 1 | 2022-01-07T06:09:48.000Z | 2022-01-07T06:09:48.000Z | 39.135802 | 112 | 0.711987 | 999,913 | package com.megait.artrade.authentication;
import com.megait.artrade.member.Member;
import com.megait.artrade.member.MemberRepository;
import com.megait.artrade.member.MemberType;
import com.megait.artrade.provider.FacebookUserInfo;
import com.megait.artrade.provider.GoogleUserInfo;
import com.megait.artrade.provider.NaverUserInfo;
import com.megait.artrade.provider.OAuth2UserInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.oauth2.client.userinfo.DefaultOAuth2UserService;
import org.springframework.security.oauth2.client.userinfo.OAuth2UserRequest;
import org.springframework.security.oauth2.core.OAuth2AuthenticationException;
import org.springframework.security.oauth2.core.user.OAuth2User;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.Map;
@Service
@RequiredArgsConstructor
@Slf4j
public class Oauth2UserService extends DefaultOAuth2UserService {
private final MemberRepository memberRepository;
private final PasswordEncoder passwordEncoder;
@Override
public OAuth2User loadUser(OAuth2UserRequest userRequest) throws OAuth2AuthenticationException {
OAuth2User oAuth2User = super.loadUser(userRequest);
System.out.println(userRequest.getClientRegistration());
System.out.println(super.loadUser(userRequest).getAttributes());
OAuth2UserInfo oAuth2UserInfo = null;
if(userRequest.getClientRegistration().getRegistrationId().equals("google")) {
log.info("구글 로그인 요청");
oAuth2UserInfo = new GoogleUserInfo(oAuth2User.getAttributes());
}else if(userRequest.getClientRegistration().getRegistrationId().equals("facebook")){
log.info("페이스북 로그인 요청");
oAuth2UserInfo = new FacebookUserInfo(oAuth2User.getAttributes());
}else if(userRequest.getClientRegistration().getRegistrationId().equals("naver")){
oAuth2UserInfo = new NaverUserInfo((Map<String, Object>)oAuth2User.getAttributes().get("response"));
}else {
log.info("지원하지 않는 형식의 로그인 접근방식입니다");
}
String email = oAuth2UserInfo.getProvider()+"_"+oAuth2UserInfo.getProviderId()+"@"+"test.com";
String password = passwordEncoder.encode("OauthPassword!");
Member principal = memberRepository.findByEmail(email).orElse(null);
if(principal == null ) {
principal = Member.builder()
.email(email)
.username(oAuth2UserInfo.getName())
.nickname(oAuth2UserInfo.getName())
.password(password)
.provider(oAuth2UserInfo.getProvider())
.registerDateTime(LocalDateTime.now())
.lastLoginDatetime(LocalDateTime.now())
.type(MemberType.일반회원).build();
}else{
principal.setLastLoginDatetime(LocalDateTime.now());
}
memberRepository.save(principal);
return new MemberUser(principal, oAuth2User.getAttributes());
}
}
|
923c5af9d1eb80dd40e38f1560a322787e794b32 | 2,076 | java | Java | commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcherUnitTest.java | rim99/JCS-tag-2.2 | 5f6e13ac76a08e636d64d0263e2b62b032a3367c | [
"Apache-2.0"
] | null | null | null | commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcherUnitTest.java | rim99/JCS-tag-2.2 | 5f6e13ac76a08e636d64d0263e2b62b032a3367c | [
"Apache-2.0"
] | null | null | null | commons-jcs-core/src/test/java/org/apache/commons/jcs/auxiliary/remote/http/client/RemoteHttpCacheDispatcherUnitTest.java | rim99/JCS-tag-2.2 | 5f6e13ac76a08e636d64d0263e2b62b032a3367c | [
"Apache-2.0"
] | null | null | null | 39.169811 | 115 | 0.735067 | 999,914 | package org.apache.commons.jcs.auxiliary.remote.http.client;
/*
* 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 junit.framework.TestCase;
import org.apache.commons.jcs.auxiliary.remote.value.RemoteCacheRequest;
import org.apache.commons.jcs.auxiliary.remote.value.RemoteRequestType;
/** Unit tests for the dispatcher. */
public class RemoteHttpCacheDispatcherUnitTest
extends TestCase
{
/**
* Verify that we don't get two ?'s
*/
public void testAddParameters_withQueryString()
{
// SETUP
RemoteHttpCacheAttributes remoteHttpCacheAttributes = new RemoteHttpCacheAttributes();
RemoteHttpCacheDispatcher dispatcher = new RemoteHttpCacheDispatcher( remoteHttpCacheAttributes );
RemoteCacheRequest<String, String> remoteCacheRequest = new RemoteCacheRequest<String, String>();
remoteCacheRequest.setRequestType( RemoteRequestType.REMOVE_ALL );
String cacheName = "myCache";
remoteCacheRequest.setCacheName( cacheName );
String baseUrl = "http://localhost?thishasaquestionmark";
// DO WORK
String result = dispatcher.addParameters( remoteCacheRequest, baseUrl );
// VERIFY
assertEquals( "Wrong url", baseUrl + "&CacheName=" + cacheName + "&Key=&RequestType=REMOVE_ALL", result );
}
}
|
923c5b1a217f7edaa32130c65206b369f55022bf | 288 | java | Java | app/src/main/java/com/tiny/demo/firstlinecode/proxy/static0/Subject.java | gabyallen/Android_Base_Test | bd518423d9831ed844ad0b8efc870a139ea0876a | [
"Apache-2.0"
] | 26 | 2019-08-09T09:18:04.000Z | 2021-01-06T08:24:55.000Z | app/src/main/java/com/tiny/demo/firstlinecode/proxy/static0/Subject.java | gabyallen/Android_Base_Test | bd518423d9831ed844ad0b8efc870a139ea0876a | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/tiny/demo/firstlinecode/proxy/static0/Subject.java | gabyallen/Android_Base_Test | bd518423d9831ed844ad0b8efc870a139ea0876a | [
"Apache-2.0"
] | 14 | 2019-08-12T05:33:54.000Z | 2022-01-18T06:03:33.000Z | 17.176471 | 50 | 0.664384 | 999,915 | package com.tiny.demo.firstlinecode.proxy.static0;
/**
* (一句话功能简介)$desc$
* (功能详细描述)$detail$
*
* @author upchh@example.com
* @version APP版本号(以修改为准)$version$
* @date 2018/8/7 12:00
* modify by:
* modify date:
* modify content:
*/
public interface Subject {
void request();
}
|
923c5ba43c47687f19c47a41cf681d1a6cbc436e | 3,504 | java | Java | flow-tests/test-live-reload/src/test/java/com/vaadin/flow/uitest/ui/FrontendLiveReloadIT.java | vaadin/flow | 290feac84a2234b343402e5a604f46fc8908a94f | [
"Apache-2.0"
] | 402 | 2017-10-02T09:00:34.000Z | 2022-03-30T06:09:40.000Z | flow-tests/test-live-reload/src/test/java/com/vaadin/flow/uitest/ui/FrontendLiveReloadIT.java | vaadin/flow | 290feac84a2234b343402e5a604f46fc8908a94f | [
"Apache-2.0"
] | 9,144 | 2017-10-02T07:12:23.000Z | 2022-03-31T19:16:56.000Z | flow-tests/test-live-reload/src/test/java/com/vaadin/flow/uitest/ui/FrontendLiveReloadIT.java | vaadin/flow | 290feac84a2234b343402e5a604f46fc8908a94f | [
"Apache-2.0"
] | 167 | 2017-10-11T13:07:29.000Z | 2022-03-22T09:02:42.000Z | 35.393939 | 80 | 0.682934 | 999,916 | /*
* Copyright 2000-2021 Vaadin 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 com.vaadin.flow.uitest.ui;
import net.jcip.annotations.NotThreadSafe;
import org.junit.After;
import org.junit.Assert;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import com.vaadin.flow.testcategory.SlowTests;
import com.vaadin.testbench.TestBenchElement;
@NotThreadSafe
@Category(SlowTests.class)
public class FrontendLiveReloadIT extends AbstractLiveReloadIT {
@After
public void resetFrontend() {
executeScript("fetch('/context/view/reset_frontend')");
}
@Test
public void liveReloadOnTouchedFrontendFile() {
open();
// when: the frontend code is updated
WebElement codeField = findElement(
By.id(FrontendLiveReloadView.FRONTEND_CODE_TEXT));
String oldCode = getValue(codeField);
String newCode = oldCode.replace("Custom component contents",
"Updated component contents");
codeField.clear();
codeField.sendKeys(newCode);
waitForElementPresent(
By.id(FrontendLiveReloadView.FRONTEND_CODE_UPDATE_BUTTON));
WebElement liveReloadTrigger = findElement(
By.id(FrontendLiveReloadView.FRONTEND_CODE_UPDATE_BUTTON));
liveReloadTrigger.click();
// when: the page has reloaded
waitForLiveReload();
// then: the frontend changes are visible in the DOM
TestBenchElement customComponent = $("*")
.id(FrontendLiveReloadView.CUSTOM_COMPONENT);
TestBenchElement embeddedDiv = customComponent.$("*").id("custom-div");
Assert.assertEquals("Updated component contents",
embeddedDiv.getText());
}
@Test
public void webpackErrorIsShownAfterReloadAndHiddenAfterFix() {
open();
// when: a webpack error occurs during frontend file edit
WebElement codeField = findElement(
By.id(FrontendLiveReloadView.FRONTEND_CODE_TEXT));
String oldCode = getValue(codeField);
String erroneousCode = "{" + oldCode;
codeField.clear();
codeField.sendKeys(erroneousCode); // illegal TS
WebElement insertWebpackError = findElement(
By.id(FrontendLiveReloadView.FRONTEND_CODE_UPDATE_BUTTON));
insertWebpackError.click();
// then: an error box is shown
waitForElementPresent(By.className("v-system-error"));
// when: the error is corrected
resetFrontend();
// then: the error box is not shown and the view is reloaded
waitForElementNotPresent(By.className("v-system-error"));
}
private String getValue(WebElement element) {
Object result = getCommandExecutor()
.executeScript("return arguments[0].value;", element);
return result == null ? "" : result.toString();
}
}
|
923c5bba5a138d9767ebc31b00d54cc7fe276bd4 | 1,654 | java | Java | src/main/java/com/adi/amf/lbcheck/controller/LbCheckerController.java | openmft/lbcheck | 1ae27e96eee4b7985c4fc3cbfcf64648d4462a34 | [
"MIT"
] | 1 | 2020-10-28T07:50:25.000Z | 2020-10-28T07:50:25.000Z | src/main/java/com/adi/amf/lbcheck/controller/LbCheckerController.java | openmft/lbcheck | 1ae27e96eee4b7985c4fc3cbfcf64648d4462a34 | [
"MIT"
] | null | null | null | src/main/java/com/adi/amf/lbcheck/controller/LbCheckerController.java | openmft/lbcheck | 1ae27e96eee4b7985c4fc3cbfcf64648d4462a34 | [
"MIT"
] | null | null | null | 44.702703 | 87 | 0.697098 | 999,917 | /*
##################################################################################
# License: MIT
# Copyright 2018 Agile Data Inc
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the # rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
# the Software, and to permit persons to whom the Software is furnished to do so,
# subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
# OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE.
##################################################################################
*/
package com.adi.amf.lbcheck.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.adi.amf.lbcheck.restservice.LbChecker;
@RestController
public class LbCheckerController {
@GetMapping("/help")
public LbChecker help() {
return new LbChecker("Running LbChecker");
}
}
|
923c5c93bebb9b0eec4b7fdec283311ed3ba052f | 1,542 | java | Java | Speech Processing - Maori/src/com/a03/gui/view/GameScreen.java | mfrost433/Tatai | da3c8b5ba2c6037a7d21e0ce0156e72c5165ac57 | [
"MIT"
] | null | null | null | Speech Processing - Maori/src/com/a03/gui/view/GameScreen.java | mfrost433/Tatai | da3c8b5ba2c6037a7d21e0ce0156e72c5165ac57 | [
"MIT"
] | null | null | null | Speech Processing - Maori/src/com/a03/gui/view/GameScreen.java | mfrost433/Tatai | da3c8b5ba2c6037a7d21e0ce0156e72c5165ac57 | [
"MIT"
] | null | null | null | 19.518987 | 67 | 0.702983 | 999,918 | package com.a03.gui.view;
import com.a03.gui.Main;
import com.a03.gui.controller.GameScreenController;
import javafx.concurrent.Task;
import javafx.concurrent.WorkerStateEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.scene.Scene;
import javafx.scene.layout.AnchorPane;
import javafx.stage.Stage;
/**
* Class sets up the game screen, loads the FXML
* @author Matt
*
*/
public class GameScreen {
private AnchorPane pane;
private Scene gameScene;
private GameScreenController gameController;
public GameScreen(final int _level, final Stage s) {
Task<Void> loaderTask = new Task<Void>() {
@Override
protected Void call() throws Exception {
try {
//Creating the game screen and its controller
FXMLLoader loader = new FXMLLoader();
loader.setLocation(Main.class.getResource("gamescreen.fxml"));
gameController = new GameScreenController();
loader.setController(gameController);
pane = (AnchorPane) loader.load();
gameController = loader.getController();
gameController.start(_level);
}catch(Exception e) {
e.printStackTrace();
}
return null;
}
};
loaderTask.setOnSucceeded(new EventHandler<WorkerStateEvent>(){
public void handle(WorkerStateEvent event) {
gameScene = new Scene(pane);
s.setScene(gameScene);
}
});
Thread thr = new Thread(loaderTask);
thr.start();
s.show();
}
public GameScreenController getController(){
return gameController;
}
}
|
923c62240df99dec1fb82ce5c4ff1902e3b15024 | 368 | java | Java | src/main/java/ch/bisi/jicon/FaviconsFetchingStrategy.java | bisignam/jicon | 290007ec76e6dc2e442115af0bab08762f4e1bf0 | [
"MIT"
] | null | null | null | src/main/java/ch/bisi/jicon/FaviconsFetchingStrategy.java | bisignam/jicon | 290007ec76e6dc2e442115af0bab08762f4e1bf0 | [
"MIT"
] | null | null | null | src/main/java/ch/bisi/jicon/FaviconsFetchingStrategy.java | bisignam/jicon | 290007ec76e6dc2e442115af0bab08762f4e1bf0 | [
"MIT"
] | null | null | null | 24.533333 | 72 | 0.790761 | 999,919 | package ch.bisi.jicon;
import ch.bisi.jicon.fetcher.icon.IconsFetcher;
import java.io.IOException;
import java.net.URL;
/**
* The favicons fetching strategy.
* It has the single responsibility of returning a {@link IconsFetcher}.
*/
@FunctionalInterface
public interface FaviconsFetchingStrategy {
IconsFetcher getFaviconsFetcher(URL url) throws IOException;
}
|
923c628fbaf8a88017f885c5943cc273979af497 | 1,492 | java | Java | autobahn/src/main/java/io/crossbar/autobahn/wamp/auth/TicketAuth.java | zorouyang/autobahn-java | a1af94afd41e88dfe7b045d22abdafcc03ed231b | [
"MIT"
] | 662 | 2017-05-14T13:05:25.000Z | 2022-03-30T09:26:09.000Z | autobahn/src/main/java/io/crossbar/autobahn/wamp/auth/TicketAuth.java | zorouyang/autobahn-java | a1af94afd41e88dfe7b045d22abdafcc03ed231b | [
"MIT"
] | 301 | 2017-05-14T12:44:50.000Z | 2022-02-28T15:04:51.000Z | autobahn/src/main/java/io/crossbar/autobahn/wamp/auth/TicketAuth.java | zorouyang/autobahn-java | a1af94afd41e88dfe7b045d22abdafcc03ed231b | [
"MIT"
] | 169 | 2017-05-15T06:35:58.000Z | 2022-03-30T09:26:12.000Z | 30.44898 | 99 | 0.650134 | 999,920 | ///////////////////////////////////////////////////////////////////////////////
//
// AutobahnJava - http://crossbar.io/autobahn
//
// Copyright (c) Crossbar.io Technologies GmbH and contributors
//
// Licensed under the MIT License.
// http://www.opensource.org/licenses/mit-license.php
//
///////////////////////////////////////////////////////////////////////////////
package io.crossbar.autobahn.wamp.auth;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import io.crossbar.autobahn.wamp.interfaces.IAuthenticator;
import io.crossbar.autobahn.wamp.types.Challenge;
import io.crossbar.autobahn.wamp.types.ChallengeResponse;
import io.crossbar.autobahn.wamp.Session;
public class TicketAuth implements IAuthenticator {
public static final String authmethod = "ticket";
public final String authid;
public final Map<String, Object> authextra;
public final String ticket;
public TicketAuth(String authid, String ticket) {
this(authid, ticket, null);
}
public TicketAuth(String authid, String ticket, Map<String, Object> authextra) {
this.authid = authid;
this.ticket = ticket;
this.authextra = authextra;
}
public CompletableFuture<ChallengeResponse> onChallenge(Session session, Challenge challenge) {
return CompletableFuture.completedFuture(new ChallengeResponse(ticket, authextra));
}
@Override
public String getAuthMethod() {
return authmethod;
}
}
|
923c62c98dd20ec61bd2269ddf0dd3c8fd90b7d7 | 1,106 | java | Java | org.apache.http.legacy_intermediates/src/android/net/http/HttpsConnection.java | team-miracle/android-libs | a6fbe765c2b862c25950ec339b6345b1c6bd7c43 | [
"Apache-2.0"
] | 1 | 2020-12-24T01:33:37.000Z | 2020-12-24T01:33:37.000Z | org.apache.http.legacy_intermediates/src/android/net/http/HttpsConnection.java | team-miracle/android-libs | a6fbe765c2b862c25950ec339b6345b1c6bd7c43 | [
"Apache-2.0"
] | null | null | null | org.apache.http.legacy_intermediates/src/android/net/http/HttpsConnection.java | team-miracle/android-libs | a6fbe765c2b862c25950ec339b6345b1c6bd7c43 | [
"Apache-2.0"
] | null | null | null | 42.538462 | 164 | 0.781193 | 999,921 | /*
* Copyright (C) 2007 The Android Open Source Project
*
* 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 android.net.http;
public class HttpsConnection
extends android.net.http.Connection
{
HttpsConnection() { super((android.content.Context)null,(org.apache.http.HttpHost)null,(android.net.http.RequestFeeder)null); throw new RuntimeException("Stub!"); }
public static void initializeEngine(java.io.File sessionDir) { throw new RuntimeException("Stub!"); }
protected android.net.http.SslCertificate mCertificate;
protected android.net.http.AndroidHttpClientConnection mHttpClientConnection;
}
|
923c63e781bd92f079bb1009c285f7d1d87ba686 | 2,920 | java | Java | src/test/java/seedu/address/testutil/RecipePrecursorBuilder.java | aqcd/tp | 55452a909f3f8ef972497eaf4e5cc0e73b7bdc03 | [
"MIT"
] | null | null | null | src/test/java/seedu/address/testutil/RecipePrecursorBuilder.java | aqcd/tp | 55452a909f3f8ef972497eaf4e5cc0e73b7bdc03 | [
"MIT"
] | 141 | 2020-09-17T11:42:10.000Z | 2020-11-09T05:01:48.000Z | src/test/java/seedu/address/testutil/RecipePrecursorBuilder.java | aqcd/tp | 55452a909f3f8ef972497eaf4e5cc0e73b7bdc03 | [
"MIT"
] | 5 | 2020-09-12T10:27:41.000Z | 2020-09-18T04:13:43.000Z | 31.73913 | 90 | 0.684932 | 999,922 | package seedu.address.testutil;
import java.util.List;
import seedu.address.model.recipe.IngredientPrecursor;
import seedu.address.model.recipe.ProductQuantity;
import seedu.address.model.recipe.RecipePrecursor;
public class RecipePrecursorBuilder {
public static final int DEFAULT_ID = 1;
public static final String DEFAULT_PRODUCT_NAME = "Apple";
public static final String DEFAULT_PRODUCT_QUANTITY = "1";
public static final String DEFAULT_DESCRIPTION = "Craftable Material";
private int id;
private String productName;
private ProductQuantity quantity;
private List<IngredientPrecursor> ingredients;
private String description;
/**
* Creates a {@code RecipeBuilder} with the default details.
*/
public RecipePrecursorBuilder() {
this.id = DEFAULT_ID;
this.productName = DEFAULT_PRODUCT_NAME;
this.quantity = new ProductQuantity(DEFAULT_PRODUCT_QUANTITY);
this.ingredients = TypicalIngredientPrecursors.getTypicalIngredientList();
this.description = DEFAULT_DESCRIPTION;
}
/**
* Initializes the RecipeBuilder with the data of {@code recipeToCopy}.
*/
public RecipePrecursorBuilder(RecipePrecursor recipeToCopy) {
id = recipeToCopy.getId();
productName = recipeToCopy.getProductName();
quantity = recipeToCopy.getProductQuantity();
ingredients = recipeToCopy.getIngredientPrecursors();
description = recipeToCopy.getDescription();
}
/**
* Sets the id of the {@code RecipePrecursor} that we are building.
*/
public RecipePrecursorBuilder withId(int id) {
this.id = id;
return this;
}
/**
* Sets the product name of the {@code RecipePrecursor} that we are building.
*/
public RecipePrecursorBuilder withProductName(String productName) {
this.productName = productName;
return this;
}
/**
* Sets the {@code Quantity} of the {@code RecipePrecursor} that we are building.
*/
public RecipePrecursorBuilder withQuantity(String quantity) {
this.quantity = new ProductQuantity(quantity);
return this;
}
/**
* Sets the {@code Ingredients} of the {@code RecipePrecursor} that we are building.
*/
public RecipePrecursorBuilder withIngredients(List<IngredientPrecursor> ingredients) {
this.ingredients = ingredients;
return this;
}
/**
* Sets the {@code Description} of the {@code RecipePrecursor} that we are building.
*/
public RecipePrecursorBuilder withDescription(String description) {
this.description = description;
return this;
}
/**
* Builds a recipe precursor.
*
* @return a sample RecipePrecursor
*/
public RecipePrecursor build() {
return new RecipePrecursor(id, ingredients, productName, quantity, description);
}
}
|
923c642566eb21731f53d12e85120c54482f4207 | 4,201 | java | Java | x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/WeeklySchedule.java | abdulazizali77/elasticsearch | 19dfa7be9e163b50a042358246cdbc4e45d2d797 | [
"Apache-2.0"
] | 49 | 2017-05-19T04:43:12.000Z | 2021-07-03T05:59:26.000Z | x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/WeeklySchedule.java | abdulazizali77/elasticsearch | 19dfa7be9e163b50a042358246cdbc4e45d2d797 | [
"Apache-2.0"
] | 61 | 2015-01-09T10:44:57.000Z | 2018-04-17T14:56:08.000Z | x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/trigger/schedule/WeeklySchedule.java | abdulazizali77/elasticsearch | 19dfa7be9e163b50a042358246cdbc4e45d2d797 | [
"Apache-2.0"
] | 39 | 2017-04-02T16:15:51.000Z | 2020-02-03T14:37:28.000Z | 33.879032 | 127 | 0.619138 | 999,923 | /*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
package org.elasticsearch.xpack.watcher.trigger.schedule;
import org.elasticsearch.ElasticsearchParseException;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.common.xcontent.XContentParser;
import org.elasticsearch.xpack.watcher.trigger.schedule.support.WeekTimes;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class WeeklySchedule extends CronnableSchedule {
public static final String TYPE = "weekly";
public static final WeekTimes[] DEFAULT_TIMES = new WeekTimes[] { new WeekTimes() };
private final WeekTimes[] times;
WeeklySchedule() {
this(DEFAULT_TIMES);
}
WeeklySchedule(WeekTimes... times) {
super(crons(times));
this.times = times;
}
@Override
public String type() {
return TYPE;
}
public WeekTimes[] times() {
return times;
}
@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
if (params.paramAsBoolean("normalize", false) && times.length == 1) {
return times[0].toXContent(builder, params);
}
builder.startArray();
for (WeekTimes weekTimes : times) {
weekTimes.toXContent(builder, params);
}
return builder.endArray();
}
public static Builder builder() {
return new Builder();
}
static String[] crons(WeekTimes[] times) {
assert times.length > 0 : "at least one time must be defined";
List<String> crons = new ArrayList<>(times.length);
for (WeekTimes time : times) {
crons.addAll(time.crons());
}
return crons.toArray(new String[crons.size()]);
}
public static class Parser implements Schedule.Parser<WeeklySchedule> {
@Override
public String type() {
return TYPE;
}
@Override
public WeeklySchedule parse(XContentParser parser) throws IOException {
if (parser.currentToken() == XContentParser.Token.START_OBJECT) {
try {
return new WeeklySchedule(WeekTimes.parse(parser, parser.currentToken()));
} catch (ElasticsearchParseException pe) {
throw new ElasticsearchParseException("could not parse [{}] schedule. invalid weekly times", pe, TYPE);
}
}
if (parser.currentToken() == XContentParser.Token.START_ARRAY) {
List<WeekTimes> times = new ArrayList<>();
XContentParser.Token token;
while ((token = parser.nextToken()) != XContentParser.Token.END_ARRAY) {
try {
times.add(WeekTimes.parse(parser, token));
} catch (ElasticsearchParseException pe) {
throw new ElasticsearchParseException("could not parse [{}] schedule. invalid weekly times", pe, TYPE);
}
}
return times.isEmpty() ? new WeeklySchedule() : new WeeklySchedule(times.toArray(new WeekTimes[times.size()]));
}
throw new ElasticsearchParseException("could not parse [{}] schedule. expected either an object or an array " +
"of objects representing weekly times, but found [{}] instead", TYPE, parser.currentToken());
}
}
public static class Builder {
private final Set<WeekTimes> times = new HashSet<>();
public Builder time(WeekTimes time) {
times.add(time);
return this;
}
public Builder time(WeekTimes.Builder time) {
return time(time.build());
}
public WeeklySchedule build() {
return times.isEmpty() ? new WeeklySchedule() : new WeeklySchedule(times.toArray(new WeekTimes[times.size()]));
}
}
}
|
923c64c7d793c5b2fb2974ccae3fd459572ccfac | 3,766 | java | Java | src/main/java/net/mattlabs/crewchat/Config.java | mattboy9921/CrewChat | 46e8151276261812a5e1a13b2c14e8d4637e8b51 | [
"MIT"
] | null | null | null | src/main/java/net/mattlabs/crewchat/Config.java | mattboy9921/CrewChat | 46e8151276261812a5e1a13b2c14e8d4637e8b51 | [
"MIT"
] | 11 | 2019-08-29T04:12:39.000Z | 2021-12-09T17:38:45.000Z | src/main/java/net/mattlabs/crewchat/Config.java | mattboy9921/CrewChat | 46e8151276261812a5e1a13b2c14e8d4637e8b51 | [
"MIT"
] | null | null | null | 45.373494 | 260 | 0.546999 | 999,924 | package net.mattlabs.crewchat;
import net.kyori.adventure.text.format.NamedTextColor;
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
import org.spongepowered.configurate.objectmapping.meta.Comment;
import org.spongepowered.configurate.objectmapping.meta.Setting;
import java.util.*;
@SuppressWarnings({"FieldMayBeFinal", "FieldCanBeLocal"})
@ConfigSerializable
public class Config {
// Header fields
@Setting(value = "_schema-version")
@Comment("#######################################################################################################\n" +
" ________ ________ _______ ___ __ ________ ___ ___ ________ _________ \n" +
" |\\ ____\\|\\ __ \\|\\ ___ \\ |\\ \\ |\\ \\|\\ ____\\|\\ \\|\\ \\|\\ __ \\|\\___ ___\\ \n" +
" \\ \\ \\___|\\ \\ \\|\\ \\ \\ __/|\\ \\ \\ \\ \\ \\ \\ \\___|\\ \\ \\\\\\ \\ \\ \\|\\ \\|___ \\ \\_| \n" +
" \\ \\ \\ \\ \\ _ _\\ \\ \\_|/_\\ \\ \\ __\\ \\ \\ \\ \\ \\ \\ __ \\ \\ __ \\ \\ \\ \\ \n" +
" \\ \\ \\____\\ \\ \\\\ \\\\ \\ \\_|\\ \\ \\ \\|\\__\\_\\ \\ \\ \\____\\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \\ \n" +
" \\ \\_______\\ \\__\\\\ _\\\\ \\_______\\ \\____________\\ \\_______\\ \\__\\ \\__\\ \\__\\ \\__\\ \\ \\__\\\n" +
" \\|_______|\\|__|\\|__|\\|_______|\\|____________|\\|_______|\\|__|\\|__|\\|__|\\|__| \\|__|\n\n" +
"CrewChat Configuration\n" +
"By Mattboy9921\n" +
"https://github.com/mattboy9921/CrewChat\n\n" +
"This is the main configuration file for CrewChat.\n\n" +
"#######################################################################################################\n\n" +
"Config version. Do not change this!")
private int schemaVersion = 0;
@Setting(value = "enable-discordsrv")
@Comment("\nEnable DiscordSRV integration.")
private boolean enableDiscordSRV = false;
public boolean isEnableDiscordSRV() {
return enableDiscordSRV;
}
@Comment("\nShow channel names on Discord to in game messages.")
private boolean showDiscordChannelNameInGame = false;
public boolean isShowDiscordChannelNameInGame() {
return showDiscordChannelNameInGame;
}
@Comment("\nAllow color codes/MiniMessage tags in chat globally.")
private boolean allowColor = false;
public boolean isAllowColor() {
return allowColor;
}
@Comment("\nTime parties exist with nobody in them (in minutes).")
private int partyTimeout = 10;
public int getPartyTimeout() {
return partyTimeout;
}
@Setting(value = "channels")
@Comment("\nChannel Configuration\n" +
"Define each channel here. Text colors can be either a named color or a hex code surrounded by quotes (\"#ff2acb\").")
private Map<String, Channel> channelsMap = new HashMap<>(Collections.singletonMap("Global", new Channel("Global", "Global chat channel", NamedTextColor.WHITE, true, false, false, false)));
public List<Channel> getChannels() {
// Convert map to arraylist
ArrayList<Channel> channels = new ArrayList<>();
channelsMap.forEach((name, channel) -> channels.add(new Channel(name, channel.getDescription(), channel.getTextColor(), channel.isAutoSubscribe(), channel.isShowChannelNameInGame(), channel.isShowChannelNameDiscord(), channel.isExcludeFromDiscord())));
return channels;
}
public void setChannel(String oldChannelName, Channel updatedChannel) {
channelsMap.remove(oldChannelName);
channelsMap.put(updatedChannel.getName(), updatedChannel);
}
}
|
923c65e6e58073da85e7cbc8237ce0e111935ff1 | 2,452 | java | Java | src/cmps252/HW4_2/UnitTesting/record_1319.java | issasaidi/cmps252_hw4.2 | f8e96065e2a4f172c8b685f03f954694f4810c14 | [
"MIT"
] | 1 | 2020-10-27T22:16:21.000Z | 2020-10-27T22:16:21.000Z | src/cmps252/HW4_2/UnitTesting/record_1319.java | issasaidi/cmps252_hw4.2 | f8e96065e2a4f172c8b685f03f954694f4810c14 | [
"MIT"
] | 2 | 2020-10-27T17:31:16.000Z | 2020-10-28T02:16:49.000Z | src/cmps252/HW4_2/UnitTesting/record_1319.java | issasaidi/cmps252_hw4.2 | f8e96065e2a4f172c8b685f03f954694f4810c14 | [
"MIT"
] | 108 | 2020-10-26T11:54:05.000Z | 2021-01-16T20:00:17.000Z | 25.583333 | 78 | 0.732899 | 999,925 | package cmps252.HW4_2.UnitTesting;
import static org.junit.jupiter.api.Assertions.*;
import java.io.FileNotFoundException;
import java.util.List;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import cmps252.HW4_2.Customer;
import cmps252.HW4_2.FileParser;
@Tag("10")
class Record_1319 {
private static List<Customer> customers;
@BeforeAll
public static void init() throws FileNotFoundException {
customers = FileParser.getCustomers(Configuration.CSV_File);
}
@Test
@DisplayName("Record 1319: FirstName is Virginia")
void FirstNameOfRecord1319() {
assertEquals("Virginia", customers.get(1318).getFirstName());
}
@Test
@DisplayName("Record 1319: LastName is Cleare")
void LastNameOfRecord1319() {
assertEquals("Cleare", customers.get(1318).getLastName());
}
@Test
@DisplayName("Record 1319: Company is Jones, Thomas V Md")
void CompanyOfRecord1319() {
assertEquals("Jones, Thomas V Md", customers.get(1318).getCompany());
}
@Test
@DisplayName("Record 1319: Address is 20100 Saint Clair Ave")
void AddressOfRecord1319() {
assertEquals("20100 Saint Clair Ave", customers.get(1318).getAddress());
}
@Test
@DisplayName("Record 1319: City is Euclid")
void CityOfRecord1319() {
assertEquals("Euclid", customers.get(1318).getCity());
}
@Test
@DisplayName("Record 1319: County is Cuyahoga")
void CountyOfRecord1319() {
assertEquals("Cuyahoga", customers.get(1318).getCounty());
}
@Test
@DisplayName("Record 1319: State is OH")
void StateOfRecord1319() {
assertEquals("OH", customers.get(1318).getState());
}
@Test
@DisplayName("Record 1319: ZIP is 44117")
void ZIPOfRecord1319() {
assertEquals("44117", customers.get(1318).getZIP());
}
@Test
@DisplayName("Record 1319: Phone is 216-486-7156")
void PhoneOfRecord1319() {
assertEquals("216-486-7156", customers.get(1318).getPhone());
}
@Test
@DisplayName("Record 1319: Fax is 216-486-1742")
void FaxOfRecord1319() {
assertEquals("216-486-1742", customers.get(1318).getFax());
}
@Test
@DisplayName("Record 1319: Email is lyhxr@example.com")
void EmailOfRecord1319() {
assertEquals("lyhxr@example.com", customers.get(1318).getEmail());
}
@Test
@DisplayName("Record 1319: Web is http://www.virginiacleare.com")
void WebOfRecord1319() {
assertEquals("http://www.virginiacleare.com", customers.get(1318).getWeb());
}
}
|
923c6650b315976a0de0eee50a3e6cc310236459 | 24,492 | java | Java | core/src/main/java/io/questdb/cairo/pool/WriterPool.java | haotiaz/questdb | 1738791ac1230d4a69f9d0d8a009066735d41ede | [
"Apache-2.0"
] | 1 | 2022-03-14T14:22:38.000Z | 2022-03-14T14:22:38.000Z | core/src/main/java/io/questdb/cairo/pool/WriterPool.java | Twilight-Shuxin/questdb | bfc48610757f0843623cfbd046a8b7caad993716 | [
"Apache-2.0"
] | null | null | null | core/src/main/java/io/questdb/cairo/pool/WriterPool.java | Twilight-Shuxin/questdb | bfc48610757f0843623cfbd046a8b7caad993716 | [
"Apache-2.0"
] | null | null | null | 42.010292 | 144 | 0.58762 | 999,926 | /*******************************************************************************
* ___ _ ____ ____
* / _ \ _ _ ___ ___| |_| _ \| __ )
* | | | | | | |/ _ \/ __| __| | | | _ \
* | |_| | |_| | __/\__ \ |_| |_| | |_) |
* \__\_\\__,_|\___||___/\__|____/|____/
*
* Copyright (c) 2014-2019 Appsicle
* Copyright (c) 2019-2022 QuestDB
*
* 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.questdb.cairo.pool;
import io.questdb.MessageBus;
import io.questdb.Metrics;
import io.questdb.cairo.*;
import io.questdb.cairo.pool.ex.EntryLockedException;
import io.questdb.cairo.pool.ex.PoolClosedException;
import io.questdb.log.Log;
import io.questdb.log.LogFactory;
import io.questdb.std.ConcurrentHashMap;
import io.questdb.std.Misc;
import io.questdb.std.Os;
import io.questdb.std.Unsafe;
import io.questdb.std.datetime.microtime.MicrosecondClock;
import io.questdb.std.str.Path;
import io.questdb.tasks.TableWriterTask;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Iterator;
/**
* This class maintains cache of open writers to avoid OS overhead of
* opening and closing files. While doing so it abides by the same
* rule as non-pooled writers: there can only be one TableWriter instance
* for any given name.
* <p>
* This implementation is thread-safe. Writer allocated by one thread
* cannot be used by any other threads until it is released. This factory
* will be returning NULL when writer is already in use and cached
* instance of writer otherwise. Writers are released back to pool via
* standard writer.close() call.
* <p>
* Writers that have been idle for some time can be expunged from pool
* by calling Job.run() method asynchronously. Pool implementation is
* guaranteeing thread-safety of this method at all times.
* <p>
* This factory can be closed via close() call. This method is also
* thread-safe and is guarantying that all open writers will be eventually
* closed.
*/
public class WriterPool extends AbstractPool {
public static final String OWNERSHIP_REASON_NONE = null;
public static final String OWNERSHIP_REASON_UNKNOWN = "unknown";
public static final String OWNERSHIP_REASON_RELEASED = "released";
static final String OWNERSHIP_REASON_MISSING = "missing or owned by other process";
static final String OWNERSHIP_REASON_WRITER_ERROR = "writer error";
private static final Log LOG = LogFactory.getLog(WriterPool.class);
private final static long ENTRY_OWNER = Unsafe.getFieldOffset(Entry.class, "owner");
private final ConcurrentHashMap<Entry> entries = new ConcurrentHashMap<>();
private final CairoConfiguration configuration;
private final Path path = new Path();
private final MicrosecondClock clock;
private final CharSequence root;
@NotNull
private final MessageBus messageBus;
@NotNull
private final Metrics metrics;
/**
* Pool constructor. WriterPool root directory is passed via configuration.
*
* @param configuration configuration parameters.
* @param messageBus message bus instance to allow index tasks to be communicated to available threads.
* @param metrics metrics instance to be used by table writers.
*/
public WriterPool(CairoConfiguration configuration, @NotNull MessageBus messageBus, @NotNull Metrics metrics) {
super(configuration, configuration.getInactiveWriterTTL());
this.configuration = configuration;
this.messageBus = messageBus;
this.clock = configuration.getMicrosecondClock();
this.root = configuration.getRoot();
this.metrics = metrics;
notifyListener(Thread.currentThread().getId(), null, PoolListener.EV_POOL_OPEN);
}
public boolean exists(CharSequence tableName) {
checkClosed();
return entries.contains(tableName);
}
/**
* <p>
* Creates or retrieves existing TableWriter from pool. Because of TableWriter compliance with <b>single
* writer model</b> pool ensures there is single TableWriter instance for given table name. Table name is unique in
* context of <b>root</b> and pool instance covers single root.
* </p>
* When TableWriter from this pool is used by another thread @{@link EntryUnavailableException} is thrown and
* when table is locked outside of pool, which includes same or different process, @{@link CairoException} instead.
* In case of former application can retry getting writer from pool again at any time. When latter occurs application has
* to call {@link #releaseAll(long)} before retrying for TableWriter.
*
* @param tableName name of the table
* @param lockReason description of where or why lock is held
* @return cached TableWriter instance.
*/
public TableWriter get(CharSequence tableName, CharSequence lockReason) {
return getWriterEntry(tableName, lockReason, null);
}
/**
* Counts busy writers in pool.
*
* @return number of busy writer instances.
*/
public int getBusyCount() {
int count = 0;
for (Entry e : entries.values()) {
if (e.owner != UNALLOCATED) {
count++;
}
}
return count;
}
/**
* Returns writer from the pool or sends writer command
*
* @param tableName name of the table
* @param lockReason reason for the action
* @param writeAction lambda to write to TableWriterTask
* @return null if command is published or TableWriter instance if writer is available
*/
public TableWriter getOrPublishCommand(CharSequence tableName, String lockReason, WriteToQueue<TableWriterTask> writeAction) {
while (true) {
try {
return getWriterEntry(tableName, lockReason, writeAction);
} catch (EntryUnavailableException ex) {
// means retry in this context
}
}
}
/**
* Locks writer. Locking operation is always non-blocking. Lock is usually successful
* when writer is in pool or owned by calling thread, in which case
* writer instance is closed. Lock will also succeed when writer does not exist.
* This will prevent from writer being created before it is unlocked.
* <p>
* Lock fails immediately with {@link EntryUnavailableException} when writer is used by another thread and with
* {@link PoolClosedException} when pool is closed.
* </p>
* <p>
* Lock is beneficial before table directory is renamed or deleted.
* </p>
*
* @param tableName table name
* @param lockReason description of where or why lock is held
* @return true if lock was successful, false otherwise
*/
public CharSequence lock(CharSequence tableName, CharSequence lockReason) {
checkClosed();
long thread = Thread.currentThread().getId();
Entry e = entries.get(tableName);
if (e == null) {
// We are racing to create new writer!
e = new Entry(clock.getTicks());
Entry other = entries.putIfAbsent(tableName, e);
if (other == null) {
if (lockAndNotify(thread, e, tableName, lockReason)) {
return OWNERSHIP_REASON_NONE;
} else {
entries.remove(tableName);
return reinterpretOwnershipReason(e.ownershipReason);
}
} else {
e = other;
}
}
// try to change owner
if ((Unsafe.cas(e, ENTRY_OWNER, UNALLOCATED, thread) /*|| Unsafe.cas(e, ENTRY_OWNER, thread, thread)*/)) {
closeWriter(thread, e, PoolListener.EV_LOCK_CLOSE, PoolConstants.CR_NAME_LOCK);
if (lockAndNotify(thread, e, tableName, lockReason)) {
return OWNERSHIP_REASON_NONE;
}
return reinterpretOwnershipReason(e.ownershipReason);
}
LOG.error().$("could not lock, busy [table=`").utf8(tableName).$("`, owner=").$(e.owner).$(", thread=").$(thread).$(']').$();
notifyListener(thread, tableName, PoolListener.EV_LOCK_BUSY);
return reinterpretOwnershipReason(e.ownershipReason);
}
public int size() {
return entries.size();
}
public void unlock(CharSequence name) {
unlock(name, null, false);
}
public void unlock(CharSequence name, @Nullable TableWriter writer, boolean newTable) {
long thread = Thread.currentThread().getId();
Entry e = entries.get(name);
if (e == null) {
notifyListener(thread, name, PoolListener.EV_NOT_LOCKED);
return;
}
// When entry is locked, writer must be null,
// however if writer is not null, calling thread must be trying to unlock
// writer that hasn't been locked. This qualifies for "illegal state"
if (e.owner == thread) {
if (e.writer != null) {
notifyListener(thread, name, PoolListener.EV_NOT_LOCKED);
throw CairoException.instance(0).put("Writer ").put(name).put(" is not locked");
}
if (newTable) {
// Note that the TableUtils.createTable method will create files, but on some OS's these files will not immediately become
// visible on all threads,
// only in this thread will they definitely be visible. To prevent spurious file system errors (or even allowing the same
// table to be created twice),
// we cache the writer in the writerPool whose access via the engine is thread safe
assert writer == null && e.lockFd != -1;
LOG.info().$("created [table=`").utf8(name).$("`, thread=").$(thread).$(']').$();
writer = new TableWriter(configuration, name, messageBus, null, false, e, root, metrics);
}
if (writer == null) {
// unlock must remove entry because pool does not deal with null writer
if (e.lockFd != -1) {
ff.close(e.lockFd);
TableUtils.lockName(path.of(root).concat(name));
if (!ff.remove(path)) {
LOG.error().$("could not remove [file=").$(path).$(']').$();
}
}
entries.remove(name);
} else {
e.writer = writer;
writer.setLifecycleManager(e);
writer.transferLock(e.lockFd);
e.lockFd = -1;
e.ownershipReason = OWNERSHIP_REASON_NONE;
Unsafe.getUnsafe().storeFence();
Unsafe.getUnsafe().putOrderedLong(e, ENTRY_OWNER, UNALLOCATED);
}
notifyListener(thread, name, PoolListener.EV_UNLOCKED);
LOG.debug().$("unlocked [table=`").utf8(name).$("`, thread=").$(thread).I$();
} else {
notifyListener(thread, name, PoolListener.EV_NOT_LOCK_OWNER);
throw CairoException.instance(0).put("Not lock owner of ").put(name);
}
}
private void addCommandToWriterQueue(Entry e, WriteToQueue<TableWriterTask> writeAction) {
TableWriter writer;
while ((writer = e.writer) == null && e.owner != UNALLOCATED) {
Os.pause();
}
if (writer == null) {
// Can be anything e.g. writer evicted from the pool, retry from very beginning
throw EntryUnavailableException.instance("please retry");
}
writer.processCommandAsync(writeAction);
}
private void assertLockReason(CharSequence lockReason) {
if (lockReason == OWNERSHIP_REASON_NONE) {
throw new NullPointerException();
}
}
private void checkClosed() {
if (isClosed()) {
LOG.info().$("is closed").$();
throw PoolClosedException.INSTANCE;
}
}
private TableWriter checkClosedAndGetWriter(CharSequence tableName, Entry e, CharSequence lockReason) {
assertLockReason(lockReason);
if (isClosed()) {
// pool closed, but we somehow managed to lock writer
// make sure that interceptor cleared to allow calling thread close writer normally
LOG.info().$('\'').utf8(tableName).$("' born free").$();
return e.goodbye();
}
e.ownershipReason = lockReason;
return logAndReturn(e, PoolListener.EV_GET);
}
/**
* Closes writer pool. When pool is closed only writers that are in pool are proactively released. Writers that
* are outside of pool will close when their close() method is invoked.
* <p>
* After pool is closed it will notify listener with #EV_POOL_CLOSED event.
* </p>
*/
@Override
protected void closePool() {
super.closePool();
Misc.free(path);
LOG.info().$("closed").$();
}
@Override
protected boolean releaseAll(long deadline) {
long thread = Thread.currentThread().getId();
boolean removed = false;
final int reason;
if (deadline == Long.MAX_VALUE) {
reason = PoolConstants.CR_POOL_CLOSE;
} else {
reason = PoolConstants.CR_IDLE;
}
Iterator<Entry> iterator = entries.values().iterator();
while (iterator.hasNext()) {
Entry e = iterator.next();
// lastReleaseTime is volatile, which makes
// order of conditions important
if ((deadline > e.lastReleaseTime && e.owner == UNALLOCATED)) {
// looks like this writer is unallocated and can be released
// Lock with negative 2-based owner thread id to indicate it's that next
// allocating thread can wait until the entry is released.
// Avoid negative thread id clashing with UNALLOCATED value
if (Unsafe.cas(e, ENTRY_OWNER, UNALLOCATED, -thread - 2)) {
// lock successful
closeWriter(thread, e, PoolListener.EV_EXPIRE, reason);
iterator.remove();
removed = true;
}
} else if (e.lockFd != -1L && deadline == Long.MAX_VALUE) {
// do not release locks unless pool is shutting down, which is
// indicated via deadline to be Long.MAX_VALUE
if (ff.close(e.lockFd)) {
e.lockFd = -1L;
iterator.remove();
removed = true;
}
} else if (e.ex != null) {
LOG.info().$("purging entry for failed to allocate writer").$();
iterator.remove();
removed = true;
}
}
return removed;
}
private void closeWriter(long thread, Entry e, short ev, int reason) {
TableWriter w = e.writer;
if (w != null) {
CharSequence name = e.writer.getTableName();
w.setLifecycleManager(DefaultLifecycleManager.INSTANCE);
w.close();
e.writer = null;
e.ownershipReason = OWNERSHIP_REASON_RELEASED;
LOG.info().$("closed [table=`").utf8(name).$("`, reason=").$(PoolConstants.closeReasonText(reason)).$(", by=").$(thread).$(']').$();
notifyListener(thread, name, ev);
}
}
int countFreeWriters() {
int count = 0;
for (Entry e : entries.values()) {
final long owner = e.owner;
if (owner == UNALLOCATED) {
count++;
} else {
LOG.info().$("'").utf8(e.writer.getTableName()).$("' is still busy [owner=").$(owner).$(']').$();
}
}
return count;
}
private TableWriter createWriter(CharSequence name, Entry e, long thread, CharSequence lockReason) {
try {
checkClosed();
LOG.info().$("open [table=`").utf8(name).$("`, thread=").$(thread).$(']').$();
e.writer = new TableWriter(configuration, name, messageBus, null, true, e, root, metrics);
e.ownershipReason = lockReason;
return logAndReturn(e, PoolListener.EV_CREATE);
} catch (CairoException ex) {
LOG.error()
.$("could not open [table=`").utf8(name)
.$("`, thread=").$(e.owner)
.$(", ex=").$(ex.getFlyweightMessage())
.$(", errno=").$(ex.getErrno())
.$(']').$();
e.ex = ex;
e.ownershipReason = OWNERSHIP_REASON_WRITER_ERROR;
e.owner = UNALLOCATED;
notifyListener(e.owner, name, PoolListener.EV_CREATE_EX);
throw ex;
}
}
private TableWriter getWriterEntry(CharSequence tableName, CharSequence lockReason, WriteToQueue<TableWriterTask> writeAction) {
assert null != lockReason;
checkClosed();
long thread = Thread.currentThread().getId();
while (true) {
Entry e = entries.get(tableName);
if (e == null) {
// We are racing to create new writer!
e = new Entry(clock.getTicks());
Entry other = entries.putIfAbsent(tableName, e);
if (other == null) {
// race won
return createWriter(tableName, e, thread, lockReason);
} else {
e = other;
}
}
long owner = e.owner;
// try to change owner
if (Unsafe.cas(e, ENTRY_OWNER, UNALLOCATED, thread)) {
// in an extreme race condition it is possible that e.writer will be null
// in this case behaviour should be identical to entry missing entirely
if (e.writer == null) {
return createWriter(tableName, e, thread, lockReason);
}
return checkClosedAndGetWriter(tableName, e, lockReason);
} else {
if (owner < 0) {
// writer is about to be released from the pool by release method.
// try again, it should become available soon.
Os.pause();
continue;
}
if (owner == thread) {
if (e.lockFd != -1L) {
throw EntryLockedException.instance(reinterpretOwnershipReason(e.ownershipReason));
}
if (e.ex != null) {
notifyListener(thread, tableName, PoolListener.EV_EX_RESEND);
// this writer failed to allocate by this very thread
// ensure consistent response
entries.remove(tableName);
throw e.ex;
}
}
if (writeAction != null) {
addCommandToWriterQueue(e, writeAction);
return null;
}
LOG.info().$("busy [table=`").utf8(tableName).$("`, owner=").$(owner).$(", thread=").$(thread).I$();
throw EntryUnavailableException.instance(reinterpretOwnershipReason(e.ownershipReason));
}
}
}
private boolean lockAndNotify(long thread, Entry e, CharSequence tableName, CharSequence lockReason) {
assertLockReason(lockReason);
TableUtils.lockName(path.of(root).concat(tableName));
e.lockFd = TableUtils.lock(ff, path);
if (e.lockFd == -1L) {
LOG.error().$("could not lock [table=`").utf8(tableName).$("`, thread=").$(thread).$(']').$();
e.ownershipReason = OWNERSHIP_REASON_MISSING;
e.owner = UNALLOCATED;
return false;
}
LOG.debug().$("locked [table=`").utf8(tableName).$("`, thread=").$(thread).$(']').$();
notifyListener(thread, tableName, PoolListener.EV_LOCK_SUCCESS);
e.ownershipReason = lockReason;
return true;
}
private TableWriter logAndReturn(Entry e, short event) {
LOG.info().$(">> [table=`").utf8(e.writer.getTableName()).$("`, thread=").$(e.owner).$(']').$();
notifyListener(e.owner, e.writer.getTableName(), event);
return e.writer;
}
private CharSequence reinterpretOwnershipReason(CharSequence providedReason) {
// we cannot always guarantee that ownership reason is set
// allocating writer and setting "reason" are non-atomic
// therefore we could be in a situation where we can be confident writer is locked
// but reason has not yet caught up. In this case we do not really know the reason
// but not to confuse the caller, we have to provide a non-null value
return providedReason == OWNERSHIP_REASON_NONE ? OWNERSHIP_REASON_UNKNOWN : providedReason;
}
private boolean returnToPool(Entry e) {
final long thread = Thread.currentThread().getId();
final CharSequence name = e.writer.getTableName();
try {
e.writer.rollback();
// We can apply structure changing ALTER TABLE before writer returns to the pool
e.writer.tick(true);
} catch (Throwable ex) {
// We are here because of a systemic issues of some kind
// one of the known issues is "disk is full" so we could not roll back properly.
// In this case we just close TableWriter
entries.remove(name);
closeWriter(thread, e, PoolListener.EV_LOCK_CLOSE, PoolConstants.CR_DISTRESSED);
return true;
}
if (e.owner != UNALLOCATED) {
LOG.info().$("<< [table=`").utf8(name).$("`, thread=").$(thread).$(']').$();
e.ownershipReason = OWNERSHIP_REASON_NONE;
e.lastReleaseTime = configuration.getMicrosecondClock().getTicks();
Unsafe.getUnsafe().storeFence();
Unsafe.getUnsafe().putOrderedLong(e, ENTRY_OWNER, UNALLOCATED);
if (isClosed()) {
// when pool is closed it could be busy releasing writer
// to avoid race condition try to grab the writer before declaring it a
// free agent
if (Unsafe.cas(e, ENTRY_OWNER, UNALLOCATED, thread)) {
e.writer = null;
notifyListener(thread, name, PoolListener.EV_OUT_OF_POOL_CLOSE);
return false;
}
}
notifyListener(thread, name, PoolListener.EV_RETURN);
} else {
LOG.error().$("orphaned [table=`").utf8(name).$("`]").$();
notifyListener(thread, name, PoolListener.EV_UNEXPECTED_CLOSE);
}
return true;
}
private class Entry implements LifecycleManager {
// owner thread id or -1 if writer is available for hire
private volatile long owner = Thread.currentThread().getId();
private volatile CharSequence ownershipReason = OWNERSHIP_REASON_NONE;
private TableWriter writer;
// time writer was last released
private volatile long lastReleaseTime;
private CairoException ex = null;
private volatile long lockFd = -1L;
public Entry(long lastReleaseTime) {
this.lastReleaseTime = lastReleaseTime;
}
@Override
public boolean close() {
return !WriterPool.this.returnToPool(this);
}
public TableWriter goodbye() {
TableWriter w = writer;
if (writer != null) {
writer.setLifecycleManager(DefaultLifecycleManager.INSTANCE);
writer = null;
}
return w;
}
}
}
|
923c68150c8ecc3e131cce61b9a1cf8ec4a96f04 | 719 | java | Java | support/cas-server-support-acceptto-mfa/src/main/java/org/apereo/cas/mfa/accepto/AccepttoMultifactorTokenCredential.java | chulei926/cas | 2ad43ec75016fb43fff98b37922c2daecefffeb9 | [
"Apache-2.0"
] | 8,772 | 2016-05-08T04:44:50.000Z | 2022-03-31T06:02:13.000Z | support/cas-server-support-acceptto-mfa/src/main/java/org/apereo/cas/mfa/accepto/AccepttoMultifactorTokenCredential.java | chulei926/cas | 2ad43ec75016fb43fff98b37922c2daecefffeb9 | [
"Apache-2.0"
] | 2,911 | 2016-05-07T23:07:52.000Z | 2022-03-31T15:09:08.000Z | support/cas-server-support-acceptto-mfa/src/main/java/org/apereo/cas/mfa/accepto/AccepttoMultifactorTokenCredential.java | chulei926/cas | 2ad43ec75016fb43fff98b37922c2daecefffeb9 | [
"Apache-2.0"
] | 3,675 | 2016-05-08T04:45:46.000Z | 2022-03-31T09:34:54.000Z | 24.793103 | 85 | 0.792768 | 999,927 | package org.apereo.cas.mfa.accepto;
import org.apereo.cas.authentication.credential.BasicIdentifiableCredential;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* This is {@link AccepttoMultifactorTokenCredential}.
*
* @author Misagh Moayyed
* @since 6.1.0
*/
@ToString(callSuper = true)
@Getter
@Setter
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class AccepttoMultifactorTokenCredential extends BasicIdentifiableCredential {
private static final long serialVersionUID = -4245622701132144037L;
public AccepttoMultifactorTokenCredential(final String channel) {
super(channel);
}
}
|
923c684f10b9d85a377864430fee9199ee6be92a | 301 | java | Java | src/main/java/com/example/pontoacesso/repository/OcorrenciaRepository.java | shyoutarou/pontoacesso | 0e59c1e75dc7408718329cbe9118e7eb98a62a86 | [
"Apache-2.0"
] | 1 | 2021-07-31T16:43:38.000Z | 2021-07-31T16:43:38.000Z | src/main/java/com/example/pontoacesso/repository/OcorrenciaRepository.java | shyoutarou/pontoacesso | 0e59c1e75dc7408718329cbe9118e7eb98a62a86 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/example/pontoacesso/repository/OcorrenciaRepository.java | shyoutarou/pontoacesso | 0e59c1e75dc7408718329cbe9118e7eb98a62a86 | [
"Apache-2.0"
] | null | null | null | 30.1 | 79 | 0.853821 | 999,928 | package com.example.pontoacesso.repository;
import com.example.pontoacesso.model.Ocorrencia;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
public interface OcorrenciaRepository extends JpaRepository<Ocorrencia, Long> {
}
|
923c68650f5c81637bf5c334d5bf07e51d1608f0 | 1,832 | java | Java | app/src/main/java/com/example/fiveinarow/SaveSheet.java | wz649588/Five_In_A_Line | 1e7cfaa43b531f2207d7fb748004256d64d265ab | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/fiveinarow/SaveSheet.java | wz649588/Five_In_A_Line | 1e7cfaa43b531f2207d7fb748004256d64d265ab | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/fiveinarow/SaveSheet.java | wz649588/Five_In_A_Line | 1e7cfaa43b531f2207d7fb748004256d64d265ab | [
"Apache-2.0"
] | null | null | null | 27.757576 | 104 | 0.565502 | 999,929 | package com.example.fiveinarow;
import android.content.Context;
import android.graphics.Point;
import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;
/**
* Created by wz649 on 2017/4/26.
*/
public class SaveSheet {
private List<Point> whiteArray;
private List<Point> blackArray;
String fileName;
String inputText;
Context context;
public SaveSheet(List<Point> blackArray, List<Point> whiteArray, String fileName, Context context) {
this.blackArray = blackArray;
this.whiteArray = whiteArray;
this.context = context;
this.fileName = fileName;
inputText = parseText();
}
private String parseText() {
StringBuilder sb = new StringBuilder();
int i = 0;
while (i < blackArray.size()) {
sb.append(blackArray.get(i).x + ",");
sb.append(blackArray.get(i).y + ",");
if (i < whiteArray.size()){
sb.append(whiteArray.get(i).x + ",");
sb.append(whiteArray.get(i).y + ",");
}
i++;
}
return sb.toString();
}
public void save() {
FileOutputStream out = null;
BufferedWriter writer = null;
try {
out = context.openFileOutput(fileName, Context.MODE_PRIVATE);
writer = new BufferedWriter(new OutputStreamWriter(out));
writer.write(inputText);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
|
923c6a1b151b802177c27429b4a5dfabaab58828 | 3,405 | java | Java | src/SecondSemester/src/DLSearchTree.java | nwatx/APCS-2019-2020 | 8c4d47ac3e0a5689c15686d1bd82547991019ede | [
"Unlicense"
] | null | null | null | src/SecondSemester/src/DLSearchTree.java | nwatx/APCS-2019-2020 | 8c4d47ac3e0a5689c15686d1bd82547991019ede | [
"Unlicense"
] | null | null | null | src/SecondSemester/src/DLSearchTree.java | nwatx/APCS-2019-2020 | 8c4d47ac3e0a5689c15686d1bd82547991019ede | [
"Unlicense"
] | null | null | null | 26.601563 | 93 | 0.484581 | 999,930 |
import static java.lang.System.*;
public class DLSearchTree
{
// instance variables (attributes, properties, global)
private DLRecordNode first;
// default constructor
public DLSearchTree( )
{
// FINISH ME
// we do not have any objects,
// so first should
// be set to null
first = null;
}
public boolean add(DLRecordNode item)
{
if (first == null)
{
// FINISH ME
// point first to the DLRecordNode
// i.e. first should refer to item
first = item;
return true;
}
DLRecordNode currentItem = first;
boolean finished = false;
while (!finished)
{
// FINISH ME
// see if item's driversLicense is less than
// currentItem's driversLicense
// remember that driversLicense is a String
// so you need to compare these Strings
if (item.getDriversLicense().compareTo(currentItem.getDriversLicense()) < 0)
{
// FINISH ME
// see if currentItem's left pointer is null
if ( currentItem.getLeft() == null )
{
// FINISH ME
// change currentItem's left pointer so
// that it points to where item is pointing
currentItem.setLeft(item);
return true;
}
// FINISH ME
// change currentItem so that it points to
// where currentItems's left pointer is pointing
currentItem = currentItem.getLeft();
}
// FINISH ME
// see if item's driversLicense is greater than
// currentItem's driversLicense
// remember that driversLicense is a String
// so you need to compare these Strings
else if (item.getDriversLicense().compareTo(currentItem.getDriversLicense()) > 0)
{
// FINISH ME
// see if currentItem's right pointer is null
if (currentItem.getRight() == null)
{
// FINISH ME
// change currentItem's right pointer so
// that it points to where item is pointing
currentItem.setRight(item);
return true;
}
// FINISH ME
// change currentItem so that it points to
// where currentItems's right pointer is pointing
currentItem = currentItem.getRight();
}
else
{
// it must be equal, and we cannot have duplicate keys
finished = true;
}
}
return false;
}
private String output = "";
public void inOrder(DLRecordNode item)
{
if (item != null)
{
// FINISH ME
// go left
inOrder(item.getLeft());
output += item.toString();
// FINISH ME
// go right
inOrder(item.getRight());
}
}
public String toString()
{
output = "[\n\n";
inOrder(first);
output += "]\n\n";
// return the output String
return output;
}
} |
923c6a31b259f986ebf2f31c3e6613b10fb8e0e0 | 777 | java | Java | shop-order/shop-order-model/src/main/java/quick/pager/shop/order/enums/TradeTypeEnums.java | liuchuanfengdw/spring-cloud-shop | f09d2ec6108dd726f539af3d8a65252b65a9392c | [
"MIT"
] | 660 | 2018-11-24T10:20:47.000Z | 2022-03-25T16:16:56.000Z | shop-order/shop-order-model/src/main/java/quick/pager/shop/order/enums/TradeTypeEnums.java | liuchuanfengdw/spring-cloud-shop | f09d2ec6108dd726f539af3d8a65252b65a9392c | [
"MIT"
] | 6 | 2018-11-18T13:10:27.000Z | 2021-12-03T08:41:34.000Z | shop-order/shop-order-model/src/main/java/quick/pager/shop/order/enums/TradeTypeEnums.java | liuchuanfengdw/spring-cloud-shop | f09d2ec6108dd726f539af3d8a65252b65a9392c | [
"MIT"
] | 294 | 2019-03-10T14:31:26.000Z | 2022-03-31T05:52:19.000Z | 18.069767 | 66 | 0.576577 | 999,931 | package quick.pager.shop.order.enums;
import quick.pager.shop.enums.IEnum;
/**
* 交易方式
*
* @author siguiyang
*/
public enum TradeTypeEnums implements IEnum<Integer> {
PAY(0, "支付下单"),
REFUSE(1, "退款");
private Integer code;
private String desc;
TradeTypeEnums(Integer code, String desc) {
this.code = code;
this.desc = desc;
}
@Override
public Integer getCode() {
return this.code;
}
@Override
public String getDesc() {
return this.desc;
}
public static TradeTypeEnums parse(int code) {
for (TradeTypeEnums typeEnums : TradeTypeEnums.values()) {
if (typeEnums.code == code) {
return typeEnums;
}
}
return null;
}
}
|
923c6b19f1b75671df445cc46350c96aa679f3e2 | 460 | java | Java | JavaOde/src/ch/ethz/bhepp/ode/lsodar/JniException.java | bennihepp/HybridStochasticSimulation | a19a777339be375a7301b69fbf1c0d840040e471 | [
"Apache-2.0"
] | null | null | null | JavaOde/src/ch/ethz/bhepp/ode/lsodar/JniException.java | bennihepp/HybridStochasticSimulation | a19a777339be375a7301b69fbf1c0d840040e471 | [
"Apache-2.0"
] | null | null | null | JavaOde/src/ch/ethz/bhepp/ode/lsodar/JniException.java | bennihepp/HybridStochasticSimulation | a19a777339be375a7301b69fbf1c0d840040e471 | [
"Apache-2.0"
] | null | null | null | 18.4 | 68 | 0.726087 | 999,932 | package ch.ethz.bhepp.ode.lsodar;
public class JniException extends RuntimeException {
private static final long serialVersionUID = -6143760954096210505L;
private int errorCode;
public JniException(String message) {
super(message);
errorCode = 0;
}
public JniException(String message, int errorCode) {
super(message + " (error code=" + errorCode + ")");
this.errorCode = errorCode;
}
public int getErrorCode() {
return errorCode;
}
}
|
923c6c546099b3115ee3a2621a78273e1ddbdd7e | 324 | java | Java | spring/spring-boot/spring-boot-aop/src/main/java/com/github/leleact/jtest/spring/boot/aop/service/AopService.java | leleact/JTest | 99aadb93b1d8f4ddd67ea9c8a64965c092ca80fb | [
"MIT"
] | null | null | null | spring/spring-boot/spring-boot-aop/src/main/java/com/github/leleact/jtest/spring/boot/aop/service/AopService.java | leleact/JTest | 99aadb93b1d8f4ddd67ea9c8a64965c092ca80fb | [
"MIT"
] | 19 | 2021-12-12T09:53:58.000Z | 2022-03-12T17:09:33.000Z | spring/spring-boot/spring-boot-aop/src/main/java/com/github/leleact/jtest/spring/boot/aop/service/AopService.java | leleact/JTest | 99aadb93b1d8f4ddd67ea9c8a64965c092ca80fb | [
"MIT"
] | null | null | null | 24.923077 | 65 | 0.734568 | 999,933 | package com.github.leleact.jtest.spring.boot.aop.service;
import com.github.leleact.jtest.spring.boot.aop.annotation.AopEx;
import org.springframework.stereotype.Service;
@Service
public class AopService {
@AopEx(value = Exception.class)
public String execute(String str) {
return "hello, " + str;
}
}
|
923c6c73bc3c3fd6a738e9b6f53632cbc23f5b95 | 1,711 | java | Java | External_TrafficBroadcast/src/cn/ffcs/external/trafficbroadcast/tool/Constants.java | un097/wuxianchangchun | cc7ffcdf171eb9463ef396e389127d69cbd18c93 | [
"Apache-2.0"
] | 1 | 2019-03-28T14:48:57.000Z | 2019-03-28T14:48:57.000Z | External_TrafficBroadcast/src/cn/ffcs/external/trafficbroadcast/tool/Constants.java | un097/wuxianchangchun | cc7ffcdf171eb9463ef396e389127d69cbd18c93 | [
"Apache-2.0"
] | null | null | null | External_TrafficBroadcast/src/cn/ffcs/external/trafficbroadcast/tool/Constants.java | un097/wuxianchangchun | cc7ffcdf171eb9463ef396e389127d69cbd18c93 | [
"Apache-2.0"
] | null | null | null | 41.731707 | 95 | 0.678551 | 999,934 | /*******************************************************************************
* Copyright 2011-2013 Sergey Tarasevich
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package cn.ffcs.external.trafficbroadcast.tool;
import com.example.external_trafficbroadcast.R;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer;
/**
* @author Sergey Tarasevich (nostra13[at]gmail[dot]com)
*/
public final class Constants {
public static ImageLoader imageLoader = ImageLoader.getInstance();
public static DisplayImageOptions image_display_options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.ic_stub)
.showImageForEmptyUri(R.drawable.ic_empty)
.showImageOnFail(R.drawable.ic_error)
.displayer(new RoundedBitmapDisplayer(20))
.cacheInMemory(true)
.cacheOnDisc(true)
.build();
public static class Config {
public static final boolean DEVELOPER_MODE = false;
}
}
|
923c6c7ba11aab4e66ffc6f2abf401c4c3c12dce | 7,638 | java | Java | src/main/java/com/github/maricn/fantasticrpg/model/map/MapFactory.java | maricn/fantastic-rpg | 9c0fd9199063a9f08e7cbe92f2f5bc64fa79d3d8 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/github/maricn/fantasticrpg/model/map/MapFactory.java | maricn/fantastic-rpg | 9c0fd9199063a9f08e7cbe92f2f5bc64fa79d3d8 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/github/maricn/fantasticrpg/model/map/MapFactory.java | maricn/fantastic-rpg | 9c0fd9199063a9f08e7cbe92f2f5bc64fa79d3d8 | [
"Apache-2.0"
] | null | null | null | 34.876712 | 113 | 0.530505 | 999,935 | package com.github.maricn.fantasticrpg.model.map;
import com.github.maricn.fantasticrpg.model.character.MonsterFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Factory used to generate levels. Level number is a seed used for {@link java.util.Random},
* so using same seed will result in same level.
*
* @author nikola
*/
public class MapFactory {
private static final int MAX_ROOM_WIDTH = 22;
private static final int MAX_ROOM_HEIGHT = 6;
private static final int MIN_ROOM_WIDTH = 6;
private static final int MIN_ROOM_HEIGHT = 3;
private static final double MIN_ROOM_RATIO = 0.5;
private static final double MAX_ROOM_RATIO = 0.94;
private static final int LEVELS_PER_DIFFICULTY = 10;
private Random random;
private MonsterFactory monsterFactory;
public MapFactory(MonsterFactory monsterFactory) {
this.monsterFactory = monsterFactory;
}
public Map generateMap(int seed) {
return generateMap(80, 24, seed);
}
public Map generateMap(int mapWidth, int mapHeight, int seed) {
random = new Random(seed);
// Create blank map fields
Field[][] fields = new Field[mapHeight][mapWidth];
for (int i = 0; i < mapHeight; i++) {
for (int j = 0; j < mapWidth; j++) {
fields[i][j] = new Field(FieldType.WALL);
}
}
// Simulate a table of rooms
int roomsAcross = mapWidth / MAX_ROOM_WIDTH;
int maxRooms = roomsAcross * (mapHeight / MAX_ROOM_HEIGHT);
boolean[] usedRoomId = new boolean[maxRooms];
for (int i = 0; i < maxRooms; i++) {
usedRoomId[i] = false;
}
// Generate rooms
int totalRooms = random.nextInt(
(int) (maxRooms * MAX_ROOM_RATIO - maxRooms * MIN_ROOM_RATIO)) + (int) (maxRooms * MIN_ROOM_RATIO
);
List<Room> rooms = new ArrayList<>(totalRooms);
int numOfMonsters = 0;
for (int i = 0; i < totalRooms; i++) {
// Choose a table cell for a room
int roomCell;
do {
roomCell = random.nextInt(maxRooms);
} while (usedRoomId[roomCell]);
// Randomize room size
int width = random.nextInt(MAX_ROOM_WIDTH - MIN_ROOM_WIDTH) + MIN_ROOM_WIDTH;
int height = random.nextInt(MAX_ROOM_HEIGHT - MIN_ROOM_HEIGHT) + MIN_ROOM_HEIGHT;
// Randomize room position
int x = (roomCell % roomsAcross) * MAX_ROOM_WIDTH;
x += random.nextInt(MAX_ROOM_WIDTH - width);
int y = (roomCell / roomsAcross) * MAX_ROOM_HEIGHT;
y += random.nextInt(MAX_ROOM_HEIGHT - height);
// Place room at map
Room room = new Room(x, y, width, height);
placeRoom(fields, room, seed);
numOfMonsters += placeMonsters(fields, room, seed);
rooms.add(room);
}
// Connect rooms with tunnels
for (int i = 0; i < totalRooms + 2; i++) {
Room currentRoom = rooms.get(i % totalRooms);
Room goalRoom = rooms.get((i + 1) % totalRooms);
int currentX = currentRoom.x + (currentRoom.width / 2);
int currentY = currentRoom.y + (currentRoom.height / 2);
int deltaX = (goalRoom.x + (goalRoom.width / 2)) - currentX;
int deltaY = (goalRoom.y + (goalRoom.height / 2)) - currentY;
int deltaXSign = deltaX >= 0 ? 1 : -1;
int deltaYSign = deltaY >= 0 ? 1 : -1;
while (!(deltaX == 0 && deltaY == 0)) {
boolean movingInX = random.nextBoolean();
if (movingInX && deltaX == 0) {
movingInX = false;
}
if (!movingInX && deltaY == 0) {
movingInX = true;
}
int carveLength = random.nextInt(Math.abs(movingInX ? deltaX : deltaY)) + 1;
for (int carver = 0; carver < carveLength; carver++) {
if (movingInX) {
currentX += deltaXSign;
} else {
currentY += deltaYSign;
}
if (FieldType.WALL.equals(fields[currentY][currentX].getType())) {
fields[currentY][currentX].setType(FieldType.EMPTY);
}
}
if (movingInX) {
deltaX -= deltaXSign * carveLength;
} else {
deltaY -= deltaYSign * carveLength;
}
}
}
// Generate player's starting position
int startY, startX;
do {
startY = random.nextInt(mapHeight);
startX = random.nextInt(mapWidth);
} while (!FieldType.EMPTY.equals(fields[startY][startX].getType()) ||
fields[startY][startX].getOccupying() != null);
return new Map(fields, startY, startX, numOfMonsters);
}
private int placeMonsters(Field[][] fields, Room room, int level) {
int numOfMonsters = random.nextInt(
1 + (room.width * room.height) /
(((level - 1) / LEVELS_PER_DIFFICULTY + 1) * 6)
);
for (int i = 0; i < numOfMonsters; i++) {
int monsterX, monsterY;
do {
monsterX = room.x + random.nextInt(room.width);
monsterY = room.y + random.nextInt(room.height);
} while (fields[monsterY][monsterX].getOccupying() != null);
int monsterDifficulty = random.nextInt(level);
MonsterFactory.MonsterDifficulty difficulty;
switch (monsterDifficulty / LEVELS_PER_DIFFICULTY) {
case 0:
difficulty = MonsterFactory.MonsterDifficulty.EASY;
break;
case 1:
difficulty = MonsterFactory.MonsterDifficulty.MODERATE;
break;
default:
difficulty = MonsterFactory.MonsterDifficulty.HARD;
}
fields[monsterY][monsterX].setOccupying(
monsterFactory.createMonster(random, difficulty, fields[monsterY][monsterX].getType())
);
}
return numOfMonsters;
}
private Field[][] placeRoom(Field[][] fields, Room room, int seed) {
FieldType fieldType = getRandomFieldType(seed);
for (int i = room.y; i < room.y + room.height; i++) {
for (int j = room.x; j < room.x + room.width; j++) {
fields[i][j].setType(fieldType);
}
}
return fields;
}
private FieldType getRandomFieldType(int seed) {
FieldType fieldType = FieldType.EMPTY;
if (seed >= 11) {
if (seed >= 21) {
int rnd = random.nextInt(42);
if (rnd > seed) {
fieldType = FieldType.WALL;
} else {
if (rnd > 21) {
fieldType = FieldType.WATER;
}
}
} else {
// Actually a very magic number in this case!
fieldType = random.nextInt(42) > seed ? FieldType.WATER : FieldType.EMPTY;
}
}
return fieldType;
}
class Room {
int x, y, width, height;
public Room(int x, int y, int width, int height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
}
}
|
923c6d5b33fb26f6ce9cc06a7fe50e90a41bdfda | 285 | java | Java | tools/bitTriples/src/main/java/dk/alexandra/fresco/tools/bitTriples/prg/BytePrg.java | Gugi264/fresco | 1c937d2298e572d22dde250d5ba0b53e5d6316d5 | [
"MIT"
] | 110 | 2015-11-26T13:25:38.000Z | 2022-03-29T17:56:40.000Z | tools/bitTriples/src/main/java/dk/alexandra/fresco/tools/bitTriples/prg/BytePrg.java | Gugi264/fresco | 1c937d2298e572d22dde250d5ba0b53e5d6316d5 | [
"MIT"
] | 274 | 2015-11-26T14:25:13.000Z | 2022-03-25T11:56:48.000Z | tools/bitTriples/src/main/java/dk/alexandra/fresco/tools/bitTriples/prg/BytePrg.java | Gugi264/fresco | 1c937d2298e572d22dde250d5ba0b53e5d6316d5 | [
"MIT"
] | 54 | 2015-11-30T20:10:44.000Z | 2022-02-21T06:04:03.000Z | 19 | 58 | 0.74386 | 999,936 | package dk.alexandra.fresco.tools.bitTriples.prg;
import dk.alexandra.fresco.framework.util.StrictBitVector;
public interface BytePrg {
/**
* Deterministically generates random field element.
*
* @return random field element
*/
StrictBitVector getNext(int size);
}
|
923c6ef24673405c157a60ff685bd542ac57e988 | 325 | java | Java | src/com/morgan/shared/nav/NavigationConstant.java | mmm2a/game-center | 39742829e0fef6452d6a59d20c826919bb5976dc | [
"Apache-2.0"
] | 1 | 2020-05-27T22:02:21.000Z | 2020-05-27T22:02:21.000Z | src/com/morgan/shared/nav/NavigationConstant.java | mmm2a/game-center | 39742829e0fef6452d6a59d20c826919bb5976dc | [
"Apache-2.0"
] | 1 | 2015-01-02T17:55:53.000Z | 2015-01-02T17:55:53.000Z | src/com/morgan/shared/nav/NavigationConstant.java | mmm2a/game-center | 39742829e0fef6452d6a59d20c826919bb5976dc | [
"Apache-2.0"
] | null | null | null | 20.5 | 99 | 0.768293 | 999,937 | package com.morgan.shared.nav;
/**
* An enumeration representing constants bound to the client dictionary for the navigation package.
*
* @author anpch@example.com (Mark Morgan)
*/
public enum NavigationConstant {
APPLICATION_PROTOCOL,
APPLICATION_HOST,
APPLICATION_PORT,
APPLICATION_TYPE,
APPLICATION_URL;
}
|
923c72d5ebcd72efa5f859fd73e50ea318976557 | 2,537 | java | Java | org.opentosca.container.core/src/main/java/org/opentosca/container/core/engine/xml/impl/FormatOutputUtil.java | OpenTOSCA/container | d1753b56793781965298344b3bb1e0e8c41faca6 | [
"Apache-2.0"
] | 41 | 2015-01-18T15:17:56.000Z | 2022-03-04T07:32:00.000Z | org.opentosca.container.core/src/main/java/org/opentosca/container/core/engine/xml/impl/FormatOutputUtil.java | OpenTOSCA/container | d1753b56793781965298344b3bb1e0e8c41faca6 | [
"Apache-2.0"
] | 100 | 2015-01-16T16:27:41.000Z | 2022-03-30T19:54:20.000Z | org.opentosca.container.core/src/main/java/org/opentosca/container/core/engine/xml/impl/FormatOutputUtil.java | OpenTOSCA/container | d1753b56793781965298344b3bb1e0e8c41faca6 | [
"Apache-2.0"
] | 29 | 2015-01-15T02:42:16.000Z | 2022-02-10T08:59:30.000Z | 41.590164 | 317 | 0.650769 | 999,938 | package org.opentosca.container.core.engine.xml.impl;
import java.io.ByteArrayInputStream;
import java.io.StringWriter;
import javax.xml.transform.Result;
import javax.xml.transform.Source;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import javax.xml.transform.stream.StreamSource;
import org.w3c.dom.Node;
public class FormatOutputUtil implements IOutputFormatter {
/**
* Serializes ServiceTemplate node to String
*
* @param ServiceTemplate
* @param removeWhitespaces Remove whitespace (e.g. line breaks)?
* @return
*/
private static final String stripSpaceXSL =
"<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output method=\"xml\" omit-xml-declaration=\"yes\" /><xsl:strip-space elements=\"*\" /><xsl:template match=\"@*|node()\"><xsl:copy><xsl:apply-templates select=\"@*|node()\" /></xsl:copy></xsl:template></xsl:stylesheet>";
/**
* Serializes DOM node to String
*
* @param removeWhitespaces Remove whitespace (e.g. line breaks)?
*/
@Override
public String docToString(final Node node, final boolean removeWhitespaces) {
String result = null;
if (node != null) {
try {
final Source source = new DOMSource(node);
final StringWriter stringWriter = new StringWriter();
final Result streamResult = new StreamResult(stringWriter);
final TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer;
if (removeWhitespaces) {
transformer = factory.newTransformer(new StreamSource(
new ByteArrayInputStream(FormatOutputUtil.stripSpaceXSL.getBytes())));
} else {
transformer = factory.newTransformer();
}
transformer.transform(source, streamResult);
result = stringWriter.getBuffer().toString();
} catch (final TransformerConfigurationException e) {
e.printStackTrace();
} catch (final TransformerException e) {
e.printStackTrace();
}
}
return result.replace(System.getProperty("line.separator"), "");
}
}
|
923c74fcb061903a38fe107c85c5241ae11cae75 | 10,223 | java | Java | hzero-boot-import/src/main/java/org/hzero/boot/imported/infra/execute/ExcelImportExecute.java | open-hand/hzero-boot-parent | 0af68f260d4cb8c04fd04a23ed76a62822898c89 | [
"Apache-2.0"
] | 1 | 2021-01-21T16:32:09.000Z | 2021-01-21T16:32:09.000Z | hzero-boot-import/src/main/java/org/hzero/boot/imported/infra/execute/ExcelImportExecute.java | open-hand/hzero-boot-parent | 0af68f260d4cb8c04fd04a23ed76a62822898c89 | [
"Apache-2.0"
] | 1 | 2020-11-26T02:05:23.000Z | 2020-11-26T02:05:23.000Z | hzero-boot-import/src/main/java/org/hzero/boot/imported/infra/execute/ExcelImportExecute.java | open-hand/hzero-boot-parent | 0af68f260d4cb8c04fd04a23ed76a62822898c89 | [
"Apache-2.0"
] | 13 | 2020-09-23T07:53:11.000Z | 2021-11-23T13:52:38.000Z | 46.730594 | 177 | 0.627614 | 999,939 | package org.hzero.boot.imported.infra.execute;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import com.monitorjbl.xlsx.StreamingReader;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.hzero.boot.imported.config.ImportConfig;
import org.hzero.boot.imported.domain.entity.Import;
import org.hzero.boot.imported.domain.entity.ImportData;
import org.hzero.boot.imported.domain.entity.Template;
import org.hzero.boot.imported.domain.entity.TemplateColumn;
import org.hzero.boot.imported.domain.repository.ImportDataRepository;
import org.hzero.boot.imported.domain.repository.ImportRepository;
import org.hzero.boot.imported.infra.constant.HimpBootConstants;
import org.hzero.boot.imported.infra.enums.DataStatus;
import org.hzero.boot.imported.infra.redis.AmountRedis;
import org.hzero.boot.imported.infra.util.StepUtils;
import org.hzero.core.base.BaseConstants;
import org.hzero.core.message.MessageAccessor;
import org.hzero.excel.supporter.ExcelReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.Assert;
import io.choerodon.core.exception.CommonException;
/**
* 从Excel导入到ImportData执行器
*
* @author upchh@example.com 2018/12/14 9:04
*/
public class ExcelImportExecute implements Runnable {
private static final Logger logger = LoggerFactory.getLogger(ExcelImportExecute.class);
private final InputStream fileIo;
private final Template template;
private final String batch;
private final ImportDataRepository dataRepository;
private final ImportRepository importRepository;
private final Integer batchNumber;
private final Integer bufferMemory;
private Integer count = 0;
private Integer stepSize;
public ExcelImportExecute(InputStream fileIo,
Template template,
String batch,
ImportConfig importConfig,
ImportRepository importRepository,
ImportDataRepository dataRepository) {
this.fileIo = fileIo;
this.template = template;
this.batch = batch;
this.dataRepository = dataRepository;
this.importRepository = importRepository;
this.batchNumber = importConfig.getBatchSize();
this.bufferMemory = importConfig.getBufferMemory();
}
@Override
public void run() {
try (Workbook workbook = StreamingReader.builder()
.rowCacheSize(batchNumber)
// 读取资源时,缓存到内存的字节大小,默认是1024
.bufferSize(bufferMemory)
// 打开资源,必须,可以是InputStream或者是File,注意:只能打开XLSX格式的文件
.open(fileIo)) {
// 获取数据总量
Iterator<Sheet> iterator = workbook.sheetIterator();
while (iterator.hasNext()) {
Sheet sheet = iterator.next();
count += sheet.getLastRowNum();
}
AmountRedis.refreshCount(null, batch, count);
// 进度刷新步长
stepSize = StepUtils.getStepSize(count);
long start = System.nanoTime();
Assert.notNull(template, HimpBootConstants.ErrorCode.LOCAL_TEMPLATE_NOT_EXISTS);
Assert.notEmpty(template.getTemplatePageList(), HimpBootConstants.ErrorCode.TEMPLATE_PAGE_NOT_EXISTS);
logger.debug("<<<<<<<<<<<<<<< batch {} start >>>>>>>>>>>>>>>", batch);
template.getTemplatePageList().forEach(templatePage ->
readSheet(templatePage.getSheetIndex(), workbook.getSheetAt(templatePage.getSheetIndex()), templatePage.getTemplateColumnList(), templatePage.getStartLine())
);
logger.debug("<<<<<<<<<<<<<<< batch {} upload success , time consuming : {} >>>>>>>>>>>>>>>>", batch, System.nanoTime() - start);
} catch (Exception e) {
logger.error("<<<<<<<<<<<<<<< batch {} upload failed >>>>>>>>>>>>>>>", batch);
logger.error("upload failed", e);
} finally {
// 更新状态
Import imported = importRepository.selectOne(new Import().setBatch(batch));
importRepository.updateOptional(
imported.setStatus(HimpBootConstants.ImportStatus.UPLOADED),
Import.FIELD_STATUS);
// 清除进度缓存
AmountRedis.clear(null, batch);
}
}
private void readSheet(int sheetIndex, Sheet sheet, List<TemplateColumn> templateColumnList, Integer startLine) {
List<ImportData> dataList = new ArrayList<>();
templateColumnList = templateColumnList.stream().sorted(Comparator.comparing(TemplateColumn::getColumnIndex)).collect(Collectors.toList());
Map<Integer, TemplateColumn> columnTemplateColumnMap = new HashMap<>(16);
for (TemplateColumn column : templateColumnList) {
columnTemplateColumnMap.put(column.getColumnIndex(), column);
}
// 默认起始行为1
int starterLine = startLine - 1;
for (Row row : sheet) {
if (row.getRowNum() < starterLine) {
continue;
}
ImportData importData = new ImportData().setDataStatus(DataStatus.NEW);
String rowJson = readDataRow(row, columnTemplateColumnMap, importData);
if (!rowJson.equals(HimpBootConstants.EMPTY_JSON)) {
importData.setBatch(batch)
.setSheetIndex(sheetIndex)
.setTemplateCode(template.getTemplateCode())
.setData(rowJson);
dataList.add(importData);
}
// 步长整数倍刷新进度
if (CollectionUtils.isNotEmpty(dataList) && dataList.size() % stepSize == 0) {
AmountRedis.refreshReady(null, batch, stepSize);
}
// 每次到达阈值进行存储,重置list
if (dataList.size() == batchNumber) {
saveImportData(dataList);
}
}
// 存储未到阈值的最后一批数据
saveImportData(dataList);
}
private void saveImportData(List<ImportData> dataList) {
dataRepository.batchInsertSelective(dataList);
// 更新数量
Import imported = importRepository.selectOne(new Import().setBatch(batch));
int dataCount = imported.getDataCount() + dataList.size();
importRepository.updateOptional(imported.setDataCount(dataCount), Import.FIELD_DATA_COUNT);
dataList.clear();
// 刷新进度缓存
AmountRedis.refresh(null, batch, dataCount);
}
private String readDataRow(Row dataRow, Map<Integer, TemplateColumn> columnTemplateColumnMap, ImportData importData) {
JSONObject jsonObject = new JSONObject();
Map<String, Map<String, String>> tls = new HashMap<>(BaseConstants.Digital.SIXTEEN);
for (int cellIndex = dataRow.getFirstCellNum(); cellIndex <= dataRow.getLastCellNum(); ++cellIndex) {
if (!columnTemplateColumnMap.containsKey(cellIndex)) {
continue;
}
TemplateColumn templateColumn = columnTemplateColumnMap.get(cellIndex);
String value = readDataCell(dataRow.getCell(cellIndex), templateColumn, importData);
if (value == null) {
continue;
}
String columnCode = templateColumn.getColumnCode();
if (HimpBootConstants.ColumnType.MULTI.equals(templateColumn.getColumnType())) {
String lang = columnCode.substring(columnCode.lastIndexOf(BaseConstants.Symbol.COLON) + 1);
columnCode = columnCode.substring(0, columnCode.lastIndexOf(BaseConstants.Symbol.COLON));
tls.computeIfAbsent(columnCode, k -> new HashMap<>(BaseConstants.Digital.SIXTEEN)).put(lang, value);
}
if (!jsonObject.containsKey(columnCode)) {
jsonObject.put(columnCode, value);
}
}
if (!tls.isEmpty()) {
jsonObject.put(HimpBootConstants.TLS, tls);
}
return jsonObject.toJSONString();
}
private String readDataCell(Cell cell, TemplateColumn templateColumn, ImportData importData) {
try {
if (cell != null) {
switch (cell.getCellType()) {
case NUMERIC:
if (HimpBootConstants.ColumnType.DATE.equals(templateColumn.getColumnType())) {
return ExcelReader.readValue(cell.getNumericCellValue(), templateColumn.toColumn());
} else {
return ExcelReader.readValue(cell.getStringCellValue(), templateColumn.toColumn());
}
case STRING:
return ExcelReader.readValue(cell.getStringCellValue(), templateColumn.toColumn());
case FORMULA:
// TODO : 暂不支持公式
throw new CommonException(HimpBootConstants.ErrorCode.FORMULA, cell.getCellFormula());
case BOOLEAN:
return ExcelReader.readValue(cell.getBooleanCellValue(), templateColumn.toColumn());
case ERROR:
throw new CommonException(HimpBootConstants.ErrorCode.CELL_ERROR);
case _NONE:
case BLANK:
default:
break;
}
}
} catch (CommonException ce) {
logger.error("exception", ce);
importData.setDataStatus(DataStatus.ERROR);
importData.addErrorMsg(MessageAccessor.getMessage(ce.getCode(), ce.getParameters()).desc());
} catch (Exception e) {
logger.error("exception", e);
importData.setDataStatus(DataStatus.ERROR);
importData.addErrorMsg(StringEscapeUtils.escapeJavaScript(ExceptionUtils.getMessage(e)));
}
return null;
}
}
|
923c760d05c39f99975c17b9efa82755225cb310 | 1,057 | java | Java | app/src/main/java/com/example/minirestaurant/Model/ManufacturerInfo.java | me0830code/Code_MiniRestaurant | 45444706b80cb8b2fc5dd472527d252b2ddb452e | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/minirestaurant/Model/ManufacturerInfo.java | me0830code/Code_MiniRestaurant | 45444706b80cb8b2fc5dd472527d252b2ddb452e | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/example/minirestaurant/Model/ManufacturerInfo.java | me0830code/Code_MiniRestaurant | 45444706b80cb8b2fc5dd472527d252b2ddb452e | [
"Apache-2.0"
] | null | null | null | 27.102564 | 83 | 0.695364 | 999,940 | package com.example.minirestaurant.Model;
// ManufacturerInfo Model
public class ManufacturerInfo {
private String mID ;
private String manufacturerName ;
private String manufacturerCountry ;
private String manufacturerPeopleNum ;
// Setting mID & manufacturerName & manufacturerCountry & manufacturerPeopleNum
public void init(String mID, String name, String country, String peopleNum) {
this.mID = mID ;
this.manufacturerName = name ;
this.manufacturerCountry = country ;
this.manufacturerPeopleNum = peopleNum ;
}
// Read manufacturerID
public String GetManufacturerID() {
return this.mID ;
}
// Read manufacturerName
public String GetManufacturerName() {
return this.manufacturerName ;
}
// Read manufacturerCountry
public String GetManufacturerCountry() {
return this.manufacturerCountry ;
}
// Read manufacturerPeopleNum
public String GetManufacturerPeopleNum() {
return this.manufacturerPeopleNum ;
}
}
|
923c761b520c942d15ec69aa44523abba4b48375 | 2,057 | java | Java | persistence-mongo/src/main/java/org/propagate/persistence/mongo/dao/FeatureFlagDaoImpl.java | lunar-logan/propagate | ac770f0df76ef2735c342a5089d460af71655861 | [
"Apache-2.0"
] | null | null | null | persistence-mongo/src/main/java/org/propagate/persistence/mongo/dao/FeatureFlagDaoImpl.java | lunar-logan/propagate | ac770f0df76ef2735c342a5089d460af71655861 | [
"Apache-2.0"
] | 1 | 2021-02-27T18:30:44.000Z | 2021-02-27T18:30:44.000Z | persistence-mongo/src/main/java/org/propagate/persistence/mongo/dao/FeatureFlagDaoImpl.java | lunar-logan/propagate | ac770f0df76ef2735c342a5089d460af71655861 | [
"Apache-2.0"
] | 1 | 2021-07-01T09:29:06.000Z | 2021-07-01T09:29:06.000Z | 31.646154 | 126 | 0.731648 | 999,941 | package org.propagate.persistence.mongo.dao;
import lombok.AllArgsConstructor;
import org.propagate.common.dao.FeatureFlagDao;
import org.propagate.common.domain.FeatureFlag;
import org.propagate.persistence.mongo.entity.FeatureFlagMongoEntity;
import org.propagate.persistence.mongo.helper.ConversionHelper;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
@Repository
@AllArgsConstructor
public class FeatureFlagDaoImpl implements FeatureFlagDao {
private final FeatureFlagMongoDao featureFlagMongoDao;
@Override
public FeatureFlag save(FeatureFlag featureFlag) {
final FeatureFlagMongoEntity featureFlagMongoEntity = featureFlagMongoDao.save(ConversionHelper.convert(featureFlag));
return ConversionHelper.convert(featureFlagMongoEntity);
}
@Override
public Optional<FeatureFlag> findById(String id) {
return featureFlagMongoDao.findById(id).map(ConversionHelper::convert);
}
@Override
public List<FeatureFlag> findAll() {
return featureFlagMongoDao.findAll().stream()
.map(ConversionHelper::convert)
.collect(Collectors.toList());
}
@Override
public List<FeatureFlag> findAll(int page, int size) {
return featureFlagMongoDao.findAll(PageRequest.of(page, size))
.map(ConversionHelper::convert)
.toList();
}
@Override
public void delete(FeatureFlag entity) {
featureFlagMongoDao.deleteById(entity.getId());
}
@Override
public void deleteById(String id) {
featureFlagMongoDao.deleteById(id);
}
@Override
public Optional<FeatureFlag> findByKey(String key) {
return featureFlagMongoDao.findByKey(key).map(ConversionHelper::convert);
}
@Override
public List<FeatureFlag> findByName(String name) {
throw new UnsupportedOperationException("Find by name is unsupported");
}
}
|
923c767bf0101d6123ff59a9e2aa1cfab29a0bde | 71,660 | java | Java | src/main/java/grammar/picsqlParser.java | OlivierCavadenti/picsql | 92445a08f909a43bb2de14605f272d474ddad412 | [
"MIT"
] | 7 | 2022-03-07T08:49:24.000Z | 2022-03-09T23:46:22.000Z | src/main/java/grammar/picsqlParser.java | OlivierCavadenti/picsql | 92445a08f909a43bb2de14605f272d474ddad412 | [
"MIT"
] | 6 | 2022-03-07T09:30:34.000Z | 2022-03-20T19:07:54.000Z | src/main/java/grammar/picsqlParser.java | OlivierCavadenti/picsql | 92445a08f909a43bb2de14605f272d474ddad412 | [
"MIT"
] | null | null | null | 31.778271 | 124 | 0.692395 | 999,942 | // Generated from C:/Users/olivi/IdeaProjects/picsql/src/main/java/grammar\picsql.g4 by ANTLR 4.9.2
package grammar;
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;
@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class picsqlParser extends Parser {
static { RuntimeMetaData.checkVersion("4.9.2", RuntimeMetaData.VERSION); }
protected static final DFA[] _decisionToDFA;
protected static final PredictionContextCache _sharedContextCache =
new PredictionContextCache();
public static final int
SELECT=1, FROM=2, WHERE=3, COMMA=4, OPERATOR_LOGIC=5, STAR=6, DIVIDE=7,
PATH_SLASH=8, MIN=9, MAX=10, X=11, Y=12, T=13, R=14, G=15, B=16, RAND=17,
RANK=18, PI=19, SIN=20, COS=21, TAN=22, LAG=23, LEAD=24, MODULO=25, PLUS=26,
MINUS=27, DIGITS=28, DECIMAL=29, STR=30, SPECIAL_CHAR=31, STR_PATH=32,
DOTS=33, LEFT_PARENTHESIS=34, RIGHT_PARENTHESIS=35, LEFT_BRACKET=36, RIGHT_BRACKET=37,
OPERATOR_CONDITION=38, DOT=39, IN=40, WS=41;
public static final int
RULE_query = 0, RULE_selectstmt = 1, RULE_from_pic_source = 2, RULE_from_source_list = 3,
RULE_selectionlist = 4, RULE_selection = 5, RULE_col_value = 6, RULE_mask_conv_vals = 7,
RULE_mask_conv = 8, RULE_negate_single_field = 9, RULE_single_field = 10,
RULE_alias_value = 11, RULE_zero_param_function = 12, RULE_one_params_function = 13,
RULE_three_params_function = 14, RULE_multiple_params_function = 15, RULE_bool_expression = 16,
RULE_begin_path = 17, RULE_alias = 18, RULE_alias_dot = 19, RULE_path_part = 20,
RULE_path = 21, RULE_pic_path = 22, RULE_subquery = 23, RULE_where_clause = 24;
private static String[] makeRuleNames() {
return new String[] {
"query", "selectstmt", "from_pic_source", "from_source_list", "selectionlist",
"selection", "col_value", "mask_conv_vals", "mask_conv", "negate_single_field",
"single_field", "alias_value", "zero_param_function", "one_params_function",
"three_params_function", "multiple_params_function", "bool_expression",
"begin_path", "alias", "alias_dot", "path_part", "path", "pic_path",
"subquery", "where_clause"
};
}
public static final String[] ruleNames = makeRuleNames();
private static String[] makeLiteralNames() {
return new String[] {
null, "'select'", "'from'", "'where'", "','", null, "'*'", "'/'", "'\\'",
"'min'", "'max'", "'x'", "'y'", "'t'", "'r'", "'g'", "'b'", "'rand()'",
"'rank()'", "'pi()'", "'sin'", "'cos'", "'tan'", "'lag'", "'lead'", "'%'",
"'+'", "'-'", null, null, null, null, null, "':'", "'('", "')'", "'['",
"']'", null, "'.'", "'in'"
};
}
private static final String[] _LITERAL_NAMES = makeLiteralNames();
private static String[] makeSymbolicNames() {
return new String[] {
null, "SELECT", "FROM", "WHERE", "COMMA", "OPERATOR_LOGIC", "STAR", "DIVIDE",
"PATH_SLASH", "MIN", "MAX", "X", "Y", "T", "R", "G", "B", "RAND", "RANK",
"PI", "SIN", "COS", "TAN", "LAG", "LEAD", "MODULO", "PLUS", "MINUS",
"DIGITS", "DECIMAL", "STR", "SPECIAL_CHAR", "STR_PATH", "DOTS", "LEFT_PARENTHESIS",
"RIGHT_PARENTHESIS", "LEFT_BRACKET", "RIGHT_BRACKET", "OPERATOR_CONDITION",
"DOT", "IN", "WS"
};
}
private static final String[] _SYMBOLIC_NAMES = makeSymbolicNames();
public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES);
/**
* @deprecated Use {@link #VOCABULARY} instead.
*/
@Deprecated
public static final String[] tokenNames;
static {
tokenNames = new String[_SYMBOLIC_NAMES.length];
for (int i = 0; i < tokenNames.length; i++) {
tokenNames[i] = VOCABULARY.getLiteralName(i);
if (tokenNames[i] == null) {
tokenNames[i] = VOCABULARY.getSymbolicName(i);
}
if (tokenNames[i] == null) {
tokenNames[i] = "<INVALID>";
}
}
}
@Override
@Deprecated
public String[] getTokenNames() {
return tokenNames;
}
@Override
public Vocabulary getVocabulary() {
return VOCABULARY;
}
@Override
public String getGrammarFileName() { return "picsql.g4"; }
@Override
public String[] getRuleNames() { return ruleNames; }
@Override
public String getSerializedATN() { return _serializedATN; }
@Override
public ATN getATN() { return _ATN; }
public picsqlParser(TokenStream input) {
super(input);
_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
}
public static class QueryContext extends ParserRuleContext {
public SelectstmtContext selectstmt() {
return getRuleContext(SelectstmtContext.class,0);
}
public QueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_query; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterQuery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitQuery(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitQuery(this);
else return visitor.visitChildren(this);
}
}
public final QueryContext query() throws RecognitionException {
QueryContext _localctx = new QueryContext(_ctx, getState());
enterRule(_localctx, 0, RULE_query);
try {
enterOuterAlt(_localctx, 1);
{
setState(50);
selectstmt();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class SelectstmtContext extends ParserRuleContext {
public TerminalNode SELECT() { return getToken(picsqlParser.SELECT, 0); }
public SelectionlistContext selectionlist() {
return getRuleContext(SelectionlistContext.class,0);
}
public TerminalNode FROM() { return getToken(picsqlParser.FROM, 0); }
public List<From_source_listContext> from_source_list() {
return getRuleContexts(From_source_listContext.class);
}
public From_source_listContext from_source_list(int i) {
return getRuleContext(From_source_listContext.class,i);
}
public List<TerminalNode> COMMA() { return getTokens(picsqlParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(picsqlParser.COMMA, i);
}
public TerminalNode WHERE() { return getToken(picsqlParser.WHERE, 0); }
public Where_clauseContext where_clause() {
return getRuleContext(Where_clauseContext.class,0);
}
public SelectstmtContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_selectstmt; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterSelectstmt(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitSelectstmt(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitSelectstmt(this);
else return visitor.visitChildren(this);
}
}
public final SelectstmtContext selectstmt() throws RecognitionException {
SelectstmtContext _localctx = new SelectstmtContext(_ctx, getState());
enterRule(_localctx, 2, RULE_selectstmt);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(52);
match(SELECT);
setState(53);
selectionlist();
setState(54);
match(FROM);
setState(55);
from_source_list();
setState(60);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==COMMA) {
{
{
setState(56);
match(COMMA);
setState(57);
from_source_list();
}
}
setState(62);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(65);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==WHERE) {
{
setState(63);
match(WHERE);
setState(64);
where_clause(0);
}
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class From_pic_sourceContext extends ParserRuleContext {
public TerminalNode LEFT_PARENTHESIS() { return getToken(picsqlParser.LEFT_PARENTHESIS, 0); }
public List<TerminalNode> DIGITS() { return getTokens(picsqlParser.DIGITS); }
public TerminalNode DIGITS(int i) {
return getToken(picsqlParser.DIGITS, i);
}
public List<TerminalNode> COMMA() { return getTokens(picsqlParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(picsqlParser.COMMA, i);
}
public TerminalNode RIGHT_PARENTHESIS() { return getToken(picsqlParser.RIGHT_PARENTHESIS, 0); }
public AliasContext alias() {
return getRuleContext(AliasContext.class,0);
}
public From_pic_sourceContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_from_pic_source; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterFrom_pic_source(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitFrom_pic_source(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitFrom_pic_source(this);
else return visitor.visitChildren(this);
}
}
public final From_pic_sourceContext from_pic_source() throws RecognitionException {
From_pic_sourceContext _localctx = new From_pic_sourceContext(_ctx, getState());
enterRule(_localctx, 4, RULE_from_pic_source);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(67);
match(LEFT_PARENTHESIS);
setState(68);
match(DIGITS);
setState(69);
match(COMMA);
setState(70);
match(DIGITS);
setState(71);
match(COMMA);
setState(72);
match(DIGITS);
setState(73);
match(COMMA);
setState(74);
match(DIGITS);
setState(75);
match(COMMA);
setState(76);
match(DIGITS);
setState(77);
match(RIGHT_PARENTHESIS);
setState(79);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==STR) {
{
setState(78);
alias();
}
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class From_source_listContext extends ParserRuleContext {
public Pic_pathContext pic_path() {
return getRuleContext(Pic_pathContext.class,0);
}
public From_pic_sourceContext from_pic_source() {
return getRuleContext(From_pic_sourceContext.class,0);
}
public SubqueryContext subquery() {
return getRuleContext(SubqueryContext.class,0);
}
public From_source_listContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_from_source_list; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterFrom_source_list(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitFrom_source_list(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitFrom_source_list(this);
else return visitor.visitChildren(this);
}
}
public final From_source_listContext from_source_list() throws RecognitionException {
From_source_listContext _localctx = new From_source_listContext(_ctx, getState());
enterRule(_localctx, 6, RULE_from_source_list);
try {
enterOuterAlt(_localctx, 1);
{
setState(84);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) {
case 1:
{
setState(81);
pic_path();
}
break;
case 2:
{
setState(82);
from_pic_source();
}
break;
case 3:
{
setState(83);
subquery();
}
break;
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class SelectionlistContext extends ParserRuleContext {
public List<SelectionContext> selection() {
return getRuleContexts(SelectionContext.class);
}
public SelectionContext selection(int i) {
return getRuleContext(SelectionContext.class,i);
}
public List<TerminalNode> COMMA() { return getTokens(picsqlParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(picsqlParser.COMMA, i);
}
public SelectionlistContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_selectionlist; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterSelectionlist(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitSelectionlist(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitSelectionlist(this);
else return visitor.visitChildren(this);
}
}
public final SelectionlistContext selectionlist() throws RecognitionException {
SelectionlistContext _localctx = new SelectionlistContext(_ctx, getState());
enterRule(_localctx, 8, RULE_selectionlist);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(86);
selection(0);
setState(91);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==COMMA) {
{
{
setState(87);
match(COMMA);
setState(88);
selection(0);
}
}
setState(93);
_errHandler.sync(this);
_la = _input.LA(1);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class SelectionContext extends ParserRuleContext {
public Single_fieldContext single_field() {
return getRuleContext(Single_fieldContext.class,0);
}
public TerminalNode LEFT_PARENTHESIS() { return getToken(picsqlParser.LEFT_PARENTHESIS, 0); }
public List<SelectionContext> selection() {
return getRuleContexts(SelectionContext.class);
}
public SelectionContext selection(int i) {
return getRuleContext(SelectionContext.class,i);
}
public TerminalNode RIGHT_PARENTHESIS() { return getToken(picsqlParser.RIGHT_PARENTHESIS, 0); }
public TerminalNode STAR() { return getToken(picsqlParser.STAR, 0); }
public TerminalNode DIVIDE() { return getToken(picsqlParser.DIVIDE, 0); }
public TerminalNode MODULO() { return getToken(picsqlParser.MODULO, 0); }
public TerminalNode PLUS() { return getToken(picsqlParser.PLUS, 0); }
public TerminalNode MINUS() { return getToken(picsqlParser.MINUS, 0); }
public SelectionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_selection; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterSelection(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitSelection(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitSelection(this);
else return visitor.visitChildren(this);
}
}
public final SelectionContext selection() throws RecognitionException {
return selection(0);
}
private SelectionContext selection(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
SelectionContext _localctx = new SelectionContext(_ctx, _parentState);
SelectionContext _prevctx = _localctx;
int _startState = 10;
enterRecursionRule(_localctx, 10, RULE_selection, _p);
int _la;
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(100);
_errHandler.sync(this);
switch (_input.LA(1)) {
case STAR:
case MIN:
case MAX:
case X:
case Y:
case T:
case R:
case G:
case B:
case RAND:
case RANK:
case PI:
case SIN:
case COS:
case TAN:
case LAG:
case LEAD:
case MINUS:
case DIGITS:
case DECIMAL:
case STR:
case LEFT_BRACKET:
{
setState(95);
single_field();
}
break;
case LEFT_PARENTHESIS:
{
setState(96);
match(LEFT_PARENTHESIS);
setState(97);
selection(0);
setState(98);
match(RIGHT_PARENTHESIS);
}
break;
default:
throw new NoViableAltException(this);
}
_ctx.stop = _input.LT(-1);
setState(110);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,7,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
setState(108);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,6,_ctx) ) {
case 1:
{
_localctx = new SelectionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_selection);
setState(102);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(103);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << STAR) | (1L << DIVIDE) | (1L << MODULO))) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(104);
selection(3);
}
break;
case 2:
{
_localctx = new SelectionContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_selection);
setState(105);
if (!(precpred(_ctx, 1))) throw new FailedPredicateException(this, "precpred(_ctx, 1)");
setState(106);
_la = _input.LA(1);
if ( !(_la==PLUS || _la==MINUS) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(107);
selection(2);
}
break;
}
}
}
setState(112);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,7,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public static class Col_valueContext extends ParserRuleContext {
public Alias_valueContext alias_value() {
return getRuleContext(Alias_valueContext.class,0);
}
public Alias_dotContext alias_dot() {
return getRuleContext(Alias_dotContext.class,0);
}
public TerminalNode X() { return getToken(picsqlParser.X, 0); }
public TerminalNode Y() { return getToken(picsqlParser.Y, 0); }
public TerminalNode T() { return getToken(picsqlParser.T, 0); }
public Col_valueContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_col_value; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterCol_value(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitCol_value(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitCol_value(this);
else return visitor.visitChildren(this);
}
}
public final Col_valueContext col_value() throws RecognitionException {
Col_valueContext _localctx = new Col_valueContext(_ctx, getState());
enterRule(_localctx, 12, RULE_col_value);
int _la;
try {
setState(120);
_errHandler.sync(this);
switch (_input.LA(1)) {
case R:
case G:
case B:
case STR:
enterOuterAlt(_localctx, 1);
{
setState(114);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==STR) {
{
setState(113);
alias_dot();
}
}
setState(116);
alias_value();
}
break;
case X:
enterOuterAlt(_localctx, 2);
{
setState(117);
match(X);
}
break;
case Y:
enterOuterAlt(_localctx, 3);
{
setState(118);
match(Y);
}
break;
case T:
enterOuterAlt(_localctx, 4);
{
setState(119);
match(T);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Mask_conv_valsContext extends ParserRuleContext {
public List<SelectionContext> selection() {
return getRuleContexts(SelectionContext.class);
}
public SelectionContext selection(int i) {
return getRuleContext(SelectionContext.class,i);
}
public List<TerminalNode> COMMA() { return getTokens(picsqlParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(picsqlParser.COMMA, i);
}
public Mask_conv_valsContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_mask_conv_vals; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterMask_conv_vals(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitMask_conv_vals(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitMask_conv_vals(this);
else return visitor.visitChildren(this);
}
}
public final Mask_conv_valsContext mask_conv_vals() throws RecognitionException {
Mask_conv_valsContext _localctx = new Mask_conv_valsContext(_ctx, getState());
enterRule(_localctx, 14, RULE_mask_conv_vals);
try {
enterOuterAlt(_localctx, 1);
{
setState(122);
selection(0);
setState(123);
match(COMMA);
setState(124);
selection(0);
setState(125);
match(COMMA);
setState(126);
selection(0);
setState(127);
match(COMMA);
setState(128);
selection(0);
setState(129);
match(COMMA);
setState(130);
selection(0);
setState(131);
match(COMMA);
setState(132);
selection(0);
setState(133);
match(COMMA);
setState(134);
selection(0);
setState(135);
match(COMMA);
setState(136);
selection(0);
setState(137);
match(COMMA);
setState(138);
selection(0);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Mask_convContext extends ParserRuleContext {
public TerminalNode LEFT_BRACKET() { return getToken(picsqlParser.LEFT_BRACKET, 0); }
public Mask_conv_valsContext mask_conv_vals() {
return getRuleContext(Mask_conv_valsContext.class,0);
}
public TerminalNode RIGHT_BRACKET() { return getToken(picsqlParser.RIGHT_BRACKET, 0); }
public Mask_convContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_mask_conv; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterMask_conv(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitMask_conv(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitMask_conv(this);
else return visitor.visitChildren(this);
}
}
public final Mask_convContext mask_conv() throws RecognitionException {
Mask_convContext _localctx = new Mask_convContext(_ctx, getState());
enterRule(_localctx, 16, RULE_mask_conv);
try {
enterOuterAlt(_localctx, 1);
{
setState(140);
match(LEFT_BRACKET);
setState(141);
mask_conv_vals();
setState(142);
match(RIGHT_BRACKET);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Negate_single_fieldContext extends ParserRuleContext {
public TerminalNode MINUS() { return getToken(picsqlParser.MINUS, 0); }
public Single_fieldContext single_field() {
return getRuleContext(Single_fieldContext.class,0);
}
public Negate_single_fieldContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_negate_single_field; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterNegate_single_field(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitNegate_single_field(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitNegate_single_field(this);
else return visitor.visitChildren(this);
}
}
public final Negate_single_fieldContext negate_single_field() throws RecognitionException {
Negate_single_fieldContext _localctx = new Negate_single_fieldContext(_ctx, getState());
enterRule(_localctx, 18, RULE_negate_single_field);
try {
enterOuterAlt(_localctx, 1);
{
setState(144);
match(MINUS);
setState(145);
single_field();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Single_fieldContext extends ParserRuleContext {
public Negate_single_fieldContext negate_single_field() {
return getRuleContext(Negate_single_fieldContext.class,0);
}
public TerminalNode DIGITS() { return getToken(picsqlParser.DIGITS, 0); }
public TerminalNode DECIMAL() { return getToken(picsqlParser.DECIMAL, 0); }
public TerminalNode STAR() { return getToken(picsqlParser.STAR, 0); }
public Col_valueContext col_value() {
return getRuleContext(Col_valueContext.class,0);
}
public Mask_convContext mask_conv() {
return getRuleContext(Mask_convContext.class,0);
}
public Zero_param_functionContext zero_param_function() {
return getRuleContext(Zero_param_functionContext.class,0);
}
public One_params_functionContext one_params_function() {
return getRuleContext(One_params_functionContext.class,0);
}
public Three_params_functionContext three_params_function() {
return getRuleContext(Three_params_functionContext.class,0);
}
public Multiple_params_functionContext multiple_params_function() {
return getRuleContext(Multiple_params_functionContext.class,0);
}
public Single_fieldContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_single_field; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterSingle_field(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitSingle_field(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitSingle_field(this);
else return visitor.visitChildren(this);
}
}
public final Single_fieldContext single_field() throws RecognitionException {
Single_fieldContext _localctx = new Single_fieldContext(_ctx, getState());
enterRule(_localctx, 20, RULE_single_field);
try {
setState(157);
_errHandler.sync(this);
switch (_input.LA(1)) {
case MINUS:
enterOuterAlt(_localctx, 1);
{
setState(147);
negate_single_field();
}
break;
case DIGITS:
enterOuterAlt(_localctx, 2);
{
setState(148);
match(DIGITS);
}
break;
case DECIMAL:
enterOuterAlt(_localctx, 3);
{
setState(149);
match(DECIMAL);
}
break;
case STAR:
enterOuterAlt(_localctx, 4);
{
setState(150);
match(STAR);
}
break;
case X:
case Y:
case T:
case R:
case G:
case B:
case STR:
enterOuterAlt(_localctx, 5);
{
setState(151);
col_value();
}
break;
case LEFT_BRACKET:
enterOuterAlt(_localctx, 6);
{
setState(152);
mask_conv();
}
break;
case RAND:
case RANK:
case PI:
enterOuterAlt(_localctx, 7);
{
setState(153);
zero_param_function();
}
break;
case SIN:
case COS:
case TAN:
enterOuterAlt(_localctx, 8);
{
setState(154);
one_params_function();
}
break;
case LAG:
case LEAD:
enterOuterAlt(_localctx, 9);
{
setState(155);
three_params_function();
}
break;
case MIN:
case MAX:
enterOuterAlt(_localctx, 10);
{
setState(156);
multiple_params_function();
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Alias_valueContext extends ParserRuleContext {
public TerminalNode R() { return getToken(picsqlParser.R, 0); }
public TerminalNode G() { return getToken(picsqlParser.G, 0); }
public TerminalNode B() { return getToken(picsqlParser.B, 0); }
public Alias_valueContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_alias_value; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterAlias_value(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitAlias_value(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitAlias_value(this);
else return visitor.visitChildren(this);
}
}
public final Alias_valueContext alias_value() throws RecognitionException {
Alias_valueContext _localctx = new Alias_valueContext(_ctx, getState());
enterRule(_localctx, 22, RULE_alias_value);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(159);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << R) | (1L << G) | (1L << B))) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Zero_param_functionContext extends ParserRuleContext {
public TerminalNode RAND() { return getToken(picsqlParser.RAND, 0); }
public TerminalNode RANK() { return getToken(picsqlParser.RANK, 0); }
public TerminalNode PI() { return getToken(picsqlParser.PI, 0); }
public Zero_param_functionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_zero_param_function; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterZero_param_function(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitZero_param_function(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitZero_param_function(this);
else return visitor.visitChildren(this);
}
}
public final Zero_param_functionContext zero_param_function() throws RecognitionException {
Zero_param_functionContext _localctx = new Zero_param_functionContext(_ctx, getState());
enterRule(_localctx, 24, RULE_zero_param_function);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(161);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << RAND) | (1L << RANK) | (1L << PI))) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class One_params_functionContext extends ParserRuleContext {
public TerminalNode LEFT_PARENTHESIS() { return getToken(picsqlParser.LEFT_PARENTHESIS, 0); }
public SelectionContext selection() {
return getRuleContext(SelectionContext.class,0);
}
public TerminalNode RIGHT_PARENTHESIS() { return getToken(picsqlParser.RIGHT_PARENTHESIS, 0); }
public TerminalNode SIN() { return getToken(picsqlParser.SIN, 0); }
public TerminalNode COS() { return getToken(picsqlParser.COS, 0); }
public TerminalNode TAN() { return getToken(picsqlParser.TAN, 0); }
public One_params_functionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_one_params_function; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterOne_params_function(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitOne_params_function(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitOne_params_function(this);
else return visitor.visitChildren(this);
}
}
public final One_params_functionContext one_params_function() throws RecognitionException {
One_params_functionContext _localctx = new One_params_functionContext(_ctx, getState());
enterRule(_localctx, 26, RULE_one_params_function);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(163);
_la = _input.LA(1);
if ( !((((_la) & ~0x3f) == 0 && ((1L << _la) & ((1L << SIN) | (1L << COS) | (1L << TAN))) != 0)) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(164);
match(LEFT_PARENTHESIS);
setState(165);
selection(0);
setState(166);
match(RIGHT_PARENTHESIS);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Three_params_functionContext extends ParserRuleContext {
public TerminalNode LEFT_PARENTHESIS() { return getToken(picsqlParser.LEFT_PARENTHESIS, 0); }
public Alias_valueContext alias_value() {
return getRuleContext(Alias_valueContext.class,0);
}
public List<TerminalNode> COMMA() { return getTokens(picsqlParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(picsqlParser.COMMA, i);
}
public List<SelectionContext> selection() {
return getRuleContexts(SelectionContext.class);
}
public SelectionContext selection(int i) {
return getRuleContext(SelectionContext.class,i);
}
public TerminalNode RIGHT_PARENTHESIS() { return getToken(picsqlParser.RIGHT_PARENTHESIS, 0); }
public TerminalNode LAG() { return getToken(picsqlParser.LAG, 0); }
public TerminalNode LEAD() { return getToken(picsqlParser.LEAD, 0); }
public Alias_dotContext alias_dot() {
return getRuleContext(Alias_dotContext.class,0);
}
public Three_params_functionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_three_params_function; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterThree_params_function(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitThree_params_function(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitThree_params_function(this);
else return visitor.visitChildren(this);
}
}
public final Three_params_functionContext three_params_function() throws RecognitionException {
Three_params_functionContext _localctx = new Three_params_functionContext(_ctx, getState());
enterRule(_localctx, 28, RULE_three_params_function);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(168);
_la = _input.LA(1);
if ( !(_la==LAG || _la==LEAD) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(169);
match(LEFT_PARENTHESIS);
setState(171);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==STR) {
{
setState(170);
alias_dot();
}
}
setState(173);
alias_value();
setState(174);
match(COMMA);
setState(175);
selection(0);
setState(176);
match(COMMA);
setState(177);
selection(0);
setState(178);
match(RIGHT_PARENTHESIS);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Multiple_params_functionContext extends ParserRuleContext {
public TerminalNode LEFT_PARENTHESIS() { return getToken(picsqlParser.LEFT_PARENTHESIS, 0); }
public List<SelectionContext> selection() {
return getRuleContexts(SelectionContext.class);
}
public SelectionContext selection(int i) {
return getRuleContext(SelectionContext.class,i);
}
public TerminalNode RIGHT_PARENTHESIS() { return getToken(picsqlParser.RIGHT_PARENTHESIS, 0); }
public TerminalNode MIN() { return getToken(picsqlParser.MIN, 0); }
public TerminalNode MAX() { return getToken(picsqlParser.MAX, 0); }
public List<TerminalNode> COMMA() { return getTokens(picsqlParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(picsqlParser.COMMA, i);
}
public Multiple_params_functionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_multiple_params_function; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterMultiple_params_function(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitMultiple_params_function(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitMultiple_params_function(this);
else return visitor.visitChildren(this);
}
}
public final Multiple_params_functionContext multiple_params_function() throws RecognitionException {
Multiple_params_functionContext _localctx = new Multiple_params_functionContext(_ctx, getState());
enterRule(_localctx, 30, RULE_multiple_params_function);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(180);
_la = _input.LA(1);
if ( !(_la==MIN || _la==MAX) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(181);
match(LEFT_PARENTHESIS);
setState(182);
selection(0);
setState(187);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==COMMA) {
{
{
setState(183);
match(COMMA);
setState(184);
selection(0);
}
}
setState(189);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(190);
match(RIGHT_PARENTHESIS);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Bool_expressionContext extends ParserRuleContext {
public List<SelectionContext> selection() {
return getRuleContexts(SelectionContext.class);
}
public SelectionContext selection(int i) {
return getRuleContext(SelectionContext.class,i);
}
public TerminalNode OPERATOR_CONDITION() { return getToken(picsqlParser.OPERATOR_CONDITION, 0); }
public Bool_expressionContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_bool_expression; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterBool_expression(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitBool_expression(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitBool_expression(this);
else return visitor.visitChildren(this);
}
}
public final Bool_expressionContext bool_expression() throws RecognitionException {
Bool_expressionContext _localctx = new Bool_expressionContext(_ctx, getState());
enterRule(_localctx, 32, RULE_bool_expression);
try {
enterOuterAlt(_localctx, 1);
{
setState(192);
selection(0);
setState(193);
match(OPERATOR_CONDITION);
setState(194);
selection(0);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Begin_pathContext extends ParserRuleContext {
public List<TerminalNode> DOT() { return getTokens(picsqlParser.DOT); }
public TerminalNode DOT(int i) {
return getToken(picsqlParser.DOT, i);
}
public TerminalNode PATH_SLASH() { return getToken(picsqlParser.PATH_SLASH, 0); }
public TerminalNode DIVIDE() { return getToken(picsqlParser.DIVIDE, 0); }
public TerminalNode STR() { return getToken(picsqlParser.STR, 0); }
public TerminalNode DOTS() { return getToken(picsqlParser.DOTS, 0); }
public Begin_pathContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_begin_path; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterBegin_path(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitBegin_path(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitBegin_path(this);
else return visitor.visitChildren(this);
}
}
public final Begin_pathContext begin_path() throws RecognitionException {
Begin_pathContext _localctx = new Begin_pathContext(_ctx, getState());
enterRule(_localctx, 34, RULE_begin_path);
int _la;
try {
setState(204);
_errHandler.sync(this);
switch (_input.LA(1)) {
case DOT:
enterOuterAlt(_localctx, 1);
{
setState(196);
match(DOT);
setState(198);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==DOT) {
{
setState(197);
match(DOT);
}
}
setState(200);
_la = _input.LA(1);
if ( !(_la==DIVIDE || _la==PATH_SLASH) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
break;
case STR:
enterOuterAlt(_localctx, 2);
{
setState(201);
match(STR);
setState(202);
match(DOTS);
setState(203);
_la = _input.LA(1);
if ( !(_la==DIVIDE || _la==PATH_SLASH) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class AliasContext extends ParserRuleContext {
public TerminalNode STR() { return getToken(picsqlParser.STR, 0); }
public AliasContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_alias; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterAlias(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitAlias(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitAlias(this);
else return visitor.visitChildren(this);
}
}
public final AliasContext alias() throws RecognitionException {
AliasContext _localctx = new AliasContext(_ctx, getState());
enterRule(_localctx, 36, RULE_alias);
try {
enterOuterAlt(_localctx, 1);
{
setState(206);
match(STR);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Alias_dotContext extends ParserRuleContext {
public TerminalNode STR() { return getToken(picsqlParser.STR, 0); }
public TerminalNode DOT() { return getToken(picsqlParser.DOT, 0); }
public Alias_dotContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_alias_dot; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterAlias_dot(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitAlias_dot(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitAlias_dot(this);
else return visitor.visitChildren(this);
}
}
public final Alias_dotContext alias_dot() throws RecognitionException {
Alias_dotContext _localctx = new Alias_dotContext(_ctx, getState());
enterRule(_localctx, 38, RULE_alias_dot);
try {
enterOuterAlt(_localctx, 1);
{
setState(208);
match(STR);
setState(209);
match(DOT);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Path_partContext extends ParserRuleContext {
public List<TerminalNode> DOT() { return getTokens(picsqlParser.DOT); }
public TerminalNode DOT(int i) {
return getToken(picsqlParser.DOT, i);
}
public TerminalNode STR() { return getToken(picsqlParser.STR, 0); }
public TerminalNode SPECIAL_CHAR() { return getToken(picsqlParser.SPECIAL_CHAR, 0); }
public Path_partContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_path_part; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterPath_part(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitPath_part(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitPath_part(this);
else return visitor.visitChildren(this);
}
}
public final Path_partContext path_part() throws RecognitionException {
Path_partContext _localctx = new Path_partContext(_ctx, getState());
enterRule(_localctx, 40, RULE_path_part);
try {
setState(215);
_errHandler.sync(this);
switch (_input.LA(1)) {
case DOT:
enterOuterAlt(_localctx, 1);
{
setState(211);
match(DOT);
setState(212);
match(DOT);
}
break;
case STR:
enterOuterAlt(_localctx, 2);
{
setState(213);
match(STR);
}
break;
case SPECIAL_CHAR:
enterOuterAlt(_localctx, 3);
{
setState(214);
match(SPECIAL_CHAR);
}
break;
default:
throw new NoViableAltException(this);
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class PathContext extends ParserRuleContext {
public List<Path_partContext> path_part() {
return getRuleContexts(Path_partContext.class);
}
public Path_partContext path_part(int i) {
return getRuleContext(Path_partContext.class,i);
}
public TerminalNode DOT() { return getToken(picsqlParser.DOT, 0); }
public Begin_pathContext begin_path() {
return getRuleContext(Begin_pathContext.class,0);
}
public List<TerminalNode> PATH_SLASH() { return getTokens(picsqlParser.PATH_SLASH); }
public TerminalNode PATH_SLASH(int i) {
return getToken(picsqlParser.PATH_SLASH, i);
}
public List<TerminalNode> DIVIDE() { return getTokens(picsqlParser.DIVIDE); }
public TerminalNode DIVIDE(int i) {
return getToken(picsqlParser.DIVIDE, i);
}
public PathContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_path; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterPath(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitPath(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitPath(this);
else return visitor.visitChildren(this);
}
}
public final PathContext path() throws RecognitionException {
PathContext _localctx = new PathContext(_ctx, getState());
enterRule(_localctx, 42, RULE_path);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(218);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,16,_ctx) ) {
case 1:
{
setState(217);
begin_path();
}
break;
}
setState(220);
path_part();
setState(225);
_errHandler.sync(this);
_la = _input.LA(1);
while (_la==DIVIDE || _la==PATH_SLASH) {
{
{
setState(221);
_la = _input.LA(1);
if ( !(_la==DIVIDE || _la==PATH_SLASH) ) {
_errHandler.recoverInline(this);
}
else {
if ( _input.LA(1)==Token.EOF ) matchedEOF = true;
_errHandler.reportMatch(this);
consume();
}
setState(222);
path_part();
}
}
setState(227);
_errHandler.sync(this);
_la = _input.LA(1);
}
setState(228);
match(DOT);
setState(229);
path_part();
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Pic_pathContext extends ParserRuleContext {
public TerminalNode LEFT_PARENTHESIS() { return getToken(picsqlParser.LEFT_PARENTHESIS, 0); }
public PathContext path() {
return getRuleContext(PathContext.class,0);
}
public List<TerminalNode> COMMA() { return getTokens(picsqlParser.COMMA); }
public TerminalNode COMMA(int i) {
return getToken(picsqlParser.COMMA, i);
}
public List<TerminalNode> DIGITS() { return getTokens(picsqlParser.DIGITS); }
public TerminalNode DIGITS(int i) {
return getToken(picsqlParser.DIGITS, i);
}
public TerminalNode RIGHT_PARENTHESIS() { return getToken(picsqlParser.RIGHT_PARENTHESIS, 0); }
public AliasContext alias() {
return getRuleContext(AliasContext.class,0);
}
public Pic_pathContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_pic_path; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterPic_path(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitPic_path(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitPic_path(this);
else return visitor.visitChildren(this);
}
}
public final Pic_pathContext pic_path() throws RecognitionException {
Pic_pathContext _localctx = new Pic_pathContext(_ctx, getState());
enterRule(_localctx, 44, RULE_pic_path);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(258);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,18,_ctx) ) {
case 1:
{
setState(231);
match(LEFT_PARENTHESIS);
setState(232);
path();
setState(233);
match(COMMA);
setState(234);
match(DIGITS);
setState(235);
match(RIGHT_PARENTHESIS);
}
break;
case 2:
{
setState(237);
match(LEFT_PARENTHESIS);
setState(238);
path();
setState(239);
match(COMMA);
setState(240);
match(DIGITS);
setState(241);
match(COMMA);
setState(242);
match(DIGITS);
setState(243);
match(RIGHT_PARENTHESIS);
}
break;
case 3:
{
setState(245);
match(LEFT_PARENTHESIS);
setState(246);
path();
setState(247);
match(COMMA);
setState(248);
match(DIGITS);
setState(249);
match(COMMA);
setState(250);
match(DIGITS);
setState(251);
match(COMMA);
setState(252);
match(DIGITS);
setState(253);
match(COMMA);
setState(254);
match(DIGITS);
setState(255);
match(RIGHT_PARENTHESIS);
}
break;
case 4:
{
setState(257);
path();
}
break;
}
setState(261);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==STR) {
{
setState(260);
alias();
}
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class SubqueryContext extends ParserRuleContext {
public TerminalNode LEFT_PARENTHESIS() { return getToken(picsqlParser.LEFT_PARENTHESIS, 0); }
public SelectstmtContext selectstmt() {
return getRuleContext(SelectstmtContext.class,0);
}
public TerminalNode RIGHT_PARENTHESIS() { return getToken(picsqlParser.RIGHT_PARENTHESIS, 0); }
public AliasContext alias() {
return getRuleContext(AliasContext.class,0);
}
public SubqueryContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_subquery; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterSubquery(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitSubquery(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitSubquery(this);
else return visitor.visitChildren(this);
}
}
public final SubqueryContext subquery() throws RecognitionException {
SubqueryContext _localctx = new SubqueryContext(_ctx, getState());
enterRule(_localctx, 46, RULE_subquery);
int _la;
try {
enterOuterAlt(_localctx, 1);
{
setState(263);
match(LEFT_PARENTHESIS);
setState(264);
selectstmt();
setState(265);
match(RIGHT_PARENTHESIS);
setState(267);
_errHandler.sync(this);
_la = _input.LA(1);
if (_la==STR) {
{
setState(266);
alias();
}
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
exitRule();
}
return _localctx;
}
public static class Where_clauseContext extends ParserRuleContext {
public Bool_expressionContext bool_expression() {
return getRuleContext(Bool_expressionContext.class,0);
}
public TerminalNode LEFT_PARENTHESIS() { return getToken(picsqlParser.LEFT_PARENTHESIS, 0); }
public List<Where_clauseContext> where_clause() {
return getRuleContexts(Where_clauseContext.class);
}
public Where_clauseContext where_clause(int i) {
return getRuleContext(Where_clauseContext.class,i);
}
public TerminalNode RIGHT_PARENTHESIS() { return getToken(picsqlParser.RIGHT_PARENTHESIS, 0); }
public TerminalNode OPERATOR_LOGIC() { return getToken(picsqlParser.OPERATOR_LOGIC, 0); }
public Where_clauseContext(ParserRuleContext parent, int invokingState) {
super(parent, invokingState);
}
@Override public int getRuleIndex() { return RULE_where_clause; }
@Override
public void enterRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).enterWhere_clause(this);
}
@Override
public void exitRule(ParseTreeListener listener) {
if ( listener instanceof picsqlListener ) ((picsqlListener)listener).exitWhere_clause(this);
}
@Override
public <T> T accept(ParseTreeVisitor<? extends T> visitor) {
if ( visitor instanceof picsqlVisitor ) return ((picsqlVisitor<? extends T>)visitor).visitWhere_clause(this);
else return visitor.visitChildren(this);
}
}
public final Where_clauseContext where_clause() throws RecognitionException {
return where_clause(0);
}
private Where_clauseContext where_clause(int _p) throws RecognitionException {
ParserRuleContext _parentctx = _ctx;
int _parentState = getState();
Where_clauseContext _localctx = new Where_clauseContext(_ctx, _parentState);
Where_clauseContext _prevctx = _localctx;
int _startState = 48;
enterRecursionRule(_localctx, 48, RULE_where_clause, _p);
try {
int _alt;
enterOuterAlt(_localctx, 1);
{
setState(275);
_errHandler.sync(this);
switch ( getInterpreter().adaptivePredict(_input,21,_ctx) ) {
case 1:
{
setState(270);
bool_expression();
}
break;
case 2:
{
setState(271);
match(LEFT_PARENTHESIS);
setState(272);
where_clause(0);
setState(273);
match(RIGHT_PARENTHESIS);
}
break;
}
_ctx.stop = _input.LT(-1);
setState(282);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,22,_ctx);
while ( _alt!=2 && _alt!=org.antlr.v4.runtime.atn.ATN.INVALID_ALT_NUMBER ) {
if ( _alt==1 ) {
if ( _parseListeners!=null ) triggerExitRuleEvent();
_prevctx = _localctx;
{
{
_localctx = new Where_clauseContext(_parentctx, _parentState);
pushNewRecursionContext(_localctx, _startState, RULE_where_clause);
setState(277);
if (!(precpred(_ctx, 2))) throw new FailedPredicateException(this, "precpred(_ctx, 2)");
setState(278);
match(OPERATOR_LOGIC);
setState(279);
where_clause(3);
}
}
}
setState(284);
_errHandler.sync(this);
_alt = getInterpreter().adaptivePredict(_input,22,_ctx);
}
}
}
catch (RecognitionException re) {
_localctx.exception = re;
_errHandler.reportError(this, re);
_errHandler.recover(this, re);
}
finally {
unrollRecursionContexts(_parentctx);
}
return _localctx;
}
public boolean sempred(RuleContext _localctx, int ruleIndex, int predIndex) {
switch (ruleIndex) {
case 5:
return selection_sempred((SelectionContext)_localctx, predIndex);
case 24:
return where_clause_sempred((Where_clauseContext)_localctx, predIndex);
}
return true;
}
private boolean selection_sempred(SelectionContext _localctx, int predIndex) {
switch (predIndex) {
case 0:
return precpred(_ctx, 2);
case 1:
return precpred(_ctx, 1);
}
return true;
}
private boolean where_clause_sempred(Where_clauseContext _localctx, int predIndex) {
switch (predIndex) {
case 2:
return precpred(_ctx, 2);
}
return true;
}
public static final String _serializedATN =
"\3\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786\u5964\3+\u0120\4\2\t\2\4"+
"\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n\4\13\t"+
"\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22\t\22"+
"\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31\t\31"+
"\4\32\t\32\3\2\3\2\3\3\3\3\3\3\3\3\3\3\3\3\7\3=\n\3\f\3\16\3@\13\3\3\3"+
"\3\3\5\3D\n\3\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\3\4\5\4R\n\4"+
"\3\5\3\5\3\5\5\5W\n\5\3\6\3\6\3\6\7\6\\\n\6\f\6\16\6_\13\6\3\7\3\7\3\7"+
"\3\7\3\7\3\7\5\7g\n\7\3\7\3\7\3\7\3\7\3\7\3\7\7\7o\n\7\f\7\16\7r\13\7"+
"\3\b\5\bu\n\b\3\b\3\b\3\b\3\b\5\b{\n\b\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t"+
"\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\n\3\n\3\n\3\n\3\13\3\13\3\13"+
"\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\f\5\f\u00a0\n\f\3\r\3\r\3\16\3"+
"\16\3\17\3\17\3\17\3\17\3\17\3\20\3\20\3\20\5\20\u00ae\n\20\3\20\3\20"+
"\3\20\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\21\7\21\u00bc\n\21\f\21"+
"\16\21\u00bf\13\21\3\21\3\21\3\22\3\22\3\22\3\22\3\23\3\23\5\23\u00c9"+
"\n\23\3\23\3\23\3\23\3\23\5\23\u00cf\n\23\3\24\3\24\3\25\3\25\3\25\3\26"+
"\3\26\3\26\3\26\5\26\u00da\n\26\3\27\5\27\u00dd\n\27\3\27\3\27\3\27\7"+
"\27\u00e2\n\27\f\27\16\27\u00e5\13\27\3\27\3\27\3\27\3\30\3\30\3\30\3"+
"\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3"+
"\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\3\30\5\30\u0105\n\30\3\30"+
"\5\30\u0108\n\30\3\31\3\31\3\31\3\31\5\31\u010e\n\31\3\32\3\32\3\32\3"+
"\32\3\32\3\32\5\32\u0116\n\32\3\32\3\32\3\32\7\32\u011b\n\32\f\32\16\32"+
"\u011e\13\32\3\32\2\4\f\62\33\2\4\6\b\n\f\16\20\22\24\26\30\32\34\36 "+
"\"$&(*,.\60\62\2\n\4\2\b\t\33\33\3\2\34\35\3\2\20\22\3\2\23\25\3\2\26"+
"\30\3\2\31\32\3\2\13\f\3\2\t\n\2\u012b\2\64\3\2\2\2\4\66\3\2\2\2\6E\3"+
"\2\2\2\bV\3\2\2\2\nX\3\2\2\2\ff\3\2\2\2\16z\3\2\2\2\20|\3\2\2\2\22\u008e"+
"\3\2\2\2\24\u0092\3\2\2\2\26\u009f\3\2\2\2\30\u00a1\3\2\2\2\32\u00a3\3"+
"\2\2\2\34\u00a5\3\2\2\2\36\u00aa\3\2\2\2 \u00b6\3\2\2\2\"\u00c2\3\2\2"+
"\2$\u00ce\3\2\2\2&\u00d0\3\2\2\2(\u00d2\3\2\2\2*\u00d9\3\2\2\2,\u00dc"+
"\3\2\2\2.\u0104\3\2\2\2\60\u0109\3\2\2\2\62\u0115\3\2\2\2\64\65\5\4\3"+
"\2\65\3\3\2\2\2\66\67\7\3\2\2\678\5\n\6\289\7\4\2\29>\5\b\5\2:;\7\6\2"+
"\2;=\5\b\5\2<:\3\2\2\2=@\3\2\2\2><\3\2\2\2>?\3\2\2\2?C\3\2\2\2@>\3\2\2"+
"\2AB\7\5\2\2BD\5\62\32\2CA\3\2\2\2CD\3\2\2\2D\5\3\2\2\2EF\7$\2\2FG\7\36"+
"\2\2GH\7\6\2\2HI\7\36\2\2IJ\7\6\2\2JK\7\36\2\2KL\7\6\2\2LM\7\36\2\2MN"+
"\7\6\2\2NO\7\36\2\2OQ\7%\2\2PR\5&\24\2QP\3\2\2\2QR\3\2\2\2R\7\3\2\2\2"+
"SW\5.\30\2TW\5\6\4\2UW\5\60\31\2VS\3\2\2\2VT\3\2\2\2VU\3\2\2\2W\t\3\2"+
"\2\2X]\5\f\7\2YZ\7\6\2\2Z\\\5\f\7\2[Y\3\2\2\2\\_\3\2\2\2][\3\2\2\2]^\3"+
"\2\2\2^\13\3\2\2\2_]\3\2\2\2`a\b\7\1\2ag\5\26\f\2bc\7$\2\2cd\5\f\7\2d"+
"e\7%\2\2eg\3\2\2\2f`\3\2\2\2fb\3\2\2\2gp\3\2\2\2hi\f\4\2\2ij\t\2\2\2j"+
"o\5\f\7\5kl\f\3\2\2lm\t\3\2\2mo\5\f\7\4nh\3\2\2\2nk\3\2\2\2or\3\2\2\2"+
"pn\3\2\2\2pq\3\2\2\2q\r\3\2\2\2rp\3\2\2\2su\5(\25\2ts\3\2\2\2tu\3\2\2"+
"\2uv\3\2\2\2v{\5\30\r\2w{\7\r\2\2x{\7\16\2\2y{\7\17\2\2zt\3\2\2\2zw\3"+
"\2\2\2zx\3\2\2\2zy\3\2\2\2{\17\3\2\2\2|}\5\f\7\2}~\7\6\2\2~\177\5\f\7"+
"\2\177\u0080\7\6\2\2\u0080\u0081\5\f\7\2\u0081\u0082\7\6\2\2\u0082\u0083"+
"\5\f\7\2\u0083\u0084\7\6\2\2\u0084\u0085\5\f\7\2\u0085\u0086\7\6\2\2\u0086"+
"\u0087\5\f\7\2\u0087\u0088\7\6\2\2\u0088\u0089\5\f\7\2\u0089\u008a\7\6"+
"\2\2\u008a\u008b\5\f\7\2\u008b\u008c\7\6\2\2\u008c\u008d\5\f\7\2\u008d"+
"\21\3\2\2\2\u008e\u008f\7&\2\2\u008f\u0090\5\20\t\2\u0090\u0091\7\'\2"+
"\2\u0091\23\3\2\2\2\u0092\u0093\7\35\2\2\u0093\u0094\5\26\f\2\u0094\25"+
"\3\2\2\2\u0095\u00a0\5\24\13\2\u0096\u00a0\7\36\2\2\u0097\u00a0\7\37\2"+
"\2\u0098\u00a0\7\b\2\2\u0099\u00a0\5\16\b\2\u009a\u00a0\5\22\n\2\u009b"+
"\u00a0\5\32\16\2\u009c\u00a0\5\34\17\2\u009d\u00a0\5\36\20\2\u009e\u00a0"+
"\5 \21\2\u009f\u0095\3\2\2\2\u009f\u0096\3\2\2\2\u009f\u0097\3\2\2\2\u009f"+
"\u0098\3\2\2\2\u009f\u0099\3\2\2\2\u009f\u009a\3\2\2\2\u009f\u009b\3\2"+
"\2\2\u009f\u009c\3\2\2\2\u009f\u009d\3\2\2\2\u009f\u009e\3\2\2\2\u00a0"+
"\27\3\2\2\2\u00a1\u00a2\t\4\2\2\u00a2\31\3\2\2\2\u00a3\u00a4\t\5\2\2\u00a4"+
"\33\3\2\2\2\u00a5\u00a6\t\6\2\2\u00a6\u00a7\7$\2\2\u00a7\u00a8\5\f\7\2"+
"\u00a8\u00a9\7%\2\2\u00a9\35\3\2\2\2\u00aa\u00ab\t\7\2\2\u00ab\u00ad\7"+
"$\2\2\u00ac\u00ae\5(\25\2\u00ad\u00ac\3\2\2\2\u00ad\u00ae\3\2\2\2\u00ae"+
"\u00af\3\2\2\2\u00af\u00b0\5\30\r\2\u00b0\u00b1\7\6\2\2\u00b1\u00b2\5"+
"\f\7\2\u00b2\u00b3\7\6\2\2\u00b3\u00b4\5\f\7\2\u00b4\u00b5\7%\2\2\u00b5"+
"\37\3\2\2\2\u00b6\u00b7\t\b\2\2\u00b7\u00b8\7$\2\2\u00b8\u00bd\5\f\7\2"+
"\u00b9\u00ba\7\6\2\2\u00ba\u00bc\5\f\7\2\u00bb\u00b9\3\2\2\2\u00bc\u00bf"+
"\3\2\2\2\u00bd\u00bb\3\2\2\2\u00bd\u00be\3\2\2\2\u00be\u00c0\3\2\2\2\u00bf"+
"\u00bd\3\2\2\2\u00c0\u00c1\7%\2\2\u00c1!\3\2\2\2\u00c2\u00c3\5\f\7\2\u00c3"+
"\u00c4\7(\2\2\u00c4\u00c5\5\f\7\2\u00c5#\3\2\2\2\u00c6\u00c8\7)\2\2\u00c7"+
"\u00c9\7)\2\2\u00c8\u00c7\3\2\2\2\u00c8\u00c9\3\2\2\2\u00c9\u00ca\3\2"+
"\2\2\u00ca\u00cf\t\t\2\2\u00cb\u00cc\7 \2\2\u00cc\u00cd\7#\2\2\u00cd\u00cf"+
"\t\t\2\2\u00ce\u00c6\3\2\2\2\u00ce\u00cb\3\2\2\2\u00cf%\3\2\2\2\u00d0"+
"\u00d1\7 \2\2\u00d1\'\3\2\2\2\u00d2\u00d3\7 \2\2\u00d3\u00d4\7)\2\2\u00d4"+
")\3\2\2\2\u00d5\u00d6\7)\2\2\u00d6\u00da\7)\2\2\u00d7\u00da\7 \2\2\u00d8"+
"\u00da\7!\2\2\u00d9\u00d5\3\2\2\2\u00d9\u00d7\3\2\2\2\u00d9\u00d8\3\2"+
"\2\2\u00da+\3\2\2\2\u00db\u00dd\5$\23\2\u00dc\u00db\3\2\2\2\u00dc\u00dd"+
"\3\2\2\2\u00dd\u00de\3\2\2\2\u00de\u00e3\5*\26\2\u00df\u00e0\t\t\2\2\u00e0"+
"\u00e2\5*\26\2\u00e1\u00df\3\2\2\2\u00e2\u00e5\3\2\2\2\u00e3\u00e1\3\2"+
"\2\2\u00e3\u00e4\3\2\2\2\u00e4\u00e6\3\2\2\2\u00e5\u00e3\3\2\2\2\u00e6"+
"\u00e7\7)\2\2\u00e7\u00e8\5*\26\2\u00e8-\3\2\2\2\u00e9\u00ea\7$\2\2\u00ea"+
"\u00eb\5,\27\2\u00eb\u00ec\7\6\2\2\u00ec\u00ed\7\36\2\2\u00ed\u00ee\7"+
"%\2\2\u00ee\u0105\3\2\2\2\u00ef\u00f0\7$\2\2\u00f0\u00f1\5,\27\2\u00f1"+
"\u00f2\7\6\2\2\u00f2\u00f3\7\36\2\2\u00f3\u00f4\7\6\2\2\u00f4\u00f5\7"+
"\36\2\2\u00f5\u00f6\7%\2\2\u00f6\u0105\3\2\2\2\u00f7\u00f8\7$\2\2\u00f8"+
"\u00f9\5,\27\2\u00f9\u00fa\7\6\2\2\u00fa\u00fb\7\36\2\2\u00fb\u00fc\7"+
"\6\2\2\u00fc\u00fd\7\36\2\2\u00fd\u00fe\7\6\2\2\u00fe\u00ff\7\36\2\2\u00ff"+
"\u0100\7\6\2\2\u0100\u0101\7\36\2\2\u0101\u0102\7%\2\2\u0102\u0105\3\2"+
"\2\2\u0103\u0105\5,\27\2\u0104\u00e9\3\2\2\2\u0104\u00ef\3\2\2\2\u0104"+
"\u00f7\3\2\2\2\u0104\u0103\3\2\2\2\u0105\u0107\3\2\2\2\u0106\u0108\5&"+
"\24\2\u0107\u0106\3\2\2\2\u0107\u0108\3\2\2\2\u0108/\3\2\2\2\u0109\u010a"+
"\7$\2\2\u010a\u010b\5\4\3\2\u010b\u010d\7%\2\2\u010c\u010e\5&\24\2\u010d"+
"\u010c\3\2\2\2\u010d\u010e\3\2\2\2\u010e\61\3\2\2\2\u010f\u0110\b\32\1"+
"\2\u0110\u0116\5\"\22\2\u0111\u0112\7$\2\2\u0112\u0113\5\62\32\2\u0113"+
"\u0114\7%\2\2\u0114\u0116\3\2\2\2\u0115\u010f\3\2\2\2\u0115\u0111\3\2"+
"\2\2\u0116\u011c\3\2\2\2\u0117\u0118\f\4\2\2\u0118\u0119\7\7\2\2\u0119"+
"\u011b\5\62\32\5\u011a\u0117\3\2\2\2\u011b\u011e\3\2\2\2\u011c\u011a\3"+
"\2\2\2\u011c\u011d\3\2\2\2\u011d\63\3\2\2\2\u011e\u011c\3\2\2\2\31>CQ"+
"V]fnptz\u009f\u00ad\u00bd\u00c8\u00ce\u00d9\u00dc\u00e3\u0104\u0107\u010d"+
"\u0115\u011c";
public static final ATN _ATN =
new ATNDeserializer().deserialize(_serializedATN.toCharArray());
static {
_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
}
}
} |
923c77fcf9ccca95ca77d25c0b1f925798005671 | 5,569 | java | Java | rest/src/main/java/com/epam/eco/schemacatalog/rest/view/ParameterizedSchemaFieldType.java | epam/eco-schema-catalog | 7456ece21f9a88095885f20247189551da3a1810 | [
"Apache-2.0"
] | 14 | 2019-09-19T22:38:18.000Z | 2020-11-02T06:28:18.000Z | rest/src/main/java/com/epam/eco/schemacatalog/rest/view/ParameterizedSchemaFieldType.java | epam/eco-schema-catalog | 7456ece21f9a88095885f20247189551da3a1810 | [
"Apache-2.0"
] | 1 | 2020-03-16T12:21:18.000Z | 2020-03-16T12:21:18.000Z | rest/src/main/java/com/epam/eco/schemacatalog/rest/view/ParameterizedSchemaFieldType.java | epam/eco-schema-catalog | 7456ece21f9a88095885f20247189551da3a1810 | [
"Apache-2.0"
] | 7 | 2019-09-26T13:19:36.000Z | 2022-03-29T04:50:04.000Z | 30.938889 | 107 | 0.622015 | 999,943 | /*
* Copyright 2020 EPAM Systems
*
* 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.epam.eco.schemacatalog.rest.view;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.StringJoiner;
import org.apache.avro.Schema;
import org.apache.commons.lang3.Validate;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.epam.eco.commons.avro.AvroUtils;
/**
* @author Raman_Babich
*/
public final class ParameterizedSchemaFieldType implements SchemaFieldType {
private final Schema.Type type;
private final String logicalType;
private final List<SchemaFieldType> parameters;
private final String fullName;
public ParameterizedSchemaFieldType(
@JsonProperty("type") Schema.Type type,
@JsonProperty("logicalType") String logicalType,
@JsonProperty("parameters") List<SchemaFieldType> parameters) {
Validate.notNull(type, "Type can't be null");
Validate.isTrue(AvroUtils.isParametrized(type), "Type should be parametrized");
Validate.notNull(parameters, "Parameters can't be null");
Validate.noNullElements(parameters, "Parameters can't contains null elements");
Validate.notEmpty(parameters, "Parameters can't be empty");
this.type = type;
this.logicalType = logicalType;
this.parameters = Collections.unmodifiableList(new ArrayList<>(parameters));
this.fullName = createFullName(this.type, this.logicalType, this.parameters);
}
@Override
public Schema.Type getType() {
return type;
}
@Override
public String getLogicalType() {
return logicalType;
}
@Override
public String getFullName() {
return fullName;
}
public List<SchemaFieldType> getParameters() {
return parameters;
}
private String createFullName(Schema.Type type, String logicalType, List<SchemaFieldType> parameters) {
String typePart;
if (logicalType == null) {
typePart = type.getName() ;
} else {
typePart = String.format(TYPE_NAME_WITH_LOGICAL_TYPE_FORMAT, type.getName(), logicalType);
}
StringJoiner paramJoiner = new StringJoiner(", ", typePart + "<", ">");
parameters.forEach(param -> paramJoiner.add(param.getFullName()));
return paramJoiner.toString();
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ParameterizedSchemaFieldType that = (ParameterizedSchemaFieldType) o;
return type == that.type &&
Objects.equals(logicalType, that.logicalType) &&
Objects.equals(parameters, that.parameters);
}
@Override
public int hashCode() {
return Objects.hash(type, logicalType, parameters);
}
@Override
public String toString() {
return "ParameterizedSchemaFieldType{" +
"type=" + type +
", logicalType='" + logicalType + '\'' +
", parameters=" + parameters +
", fullName='" + fullName + '\'' +
'}';
}
public Builder toBuilder() {
return builder(this);
}
public static Builder builder() {
return builder(null);
}
public static Builder builder(ParameterizedSchemaFieldType type) {
return new Builder(type);
}
public static class Builder {
private Schema.Type type;
private String logicalType;
private List<SchemaFieldType> parameters;
public Builder(ParameterizedSchemaFieldType type) {
if (type == null) {
return;
}
this.type = type.type;
this.logicalType = type.logicalType;
this.parameters = new ArrayList<>(type.parameters);
}
public Builder type(Schema.Type type) {
this.type = type;
return this;
}
public Builder logicalType(String logicalType) {
this.logicalType = logicalType;
return this;
}
public Builder addParameter(SchemaFieldType parameter) {
if (this.parameters == null) {
this.parameters = new ArrayList<>();
}
this.parameters.add(parameter);
return this;
}
public Builder parameters(List<SchemaFieldType> parameters) {
if (parameters == null) {
this.parameters = null;
return this;
}
if (this.parameters == null) {
this.parameters = new ArrayList<>();
} else {
this.parameters.clear();
}
this.parameters.addAll(parameters);
return this;
}
public ParameterizedSchemaFieldType build() {
return new ParameterizedSchemaFieldType(type, logicalType, parameters);
}
}
}
|
923c78ead8962c6caea4e98be1b3aff8d968c80a | 4,838 | java | Java | pro/gravit/repackage/io/netty/handler/codec/rtsp/RtspDecoder.java | Fliros228/StreamCraft | 50c6aedb60358d6e3c2d3be903c8e9e1d72f2351 | [
"MIT"
] | 2 | 2020-08-19T17:38:32.000Z | 2020-08-19T17:41:36.000Z | pro/gravit/repackage/io/netty/handler/codec/rtsp/RtspDecoder.java | Fliros228/StreamCraft | 50c6aedb60358d6e3c2d3be903c8e9e1d72f2351 | [
"MIT"
] | 1 | 2020-11-17T14:28:42.000Z | 2020-11-17T14:28:42.000Z | pro/gravit/repackage/io/netty/handler/codec/rtsp/RtspDecoder.java | Fliros228/StreamCraft | 50c6aedb60358d6e3c2d3be903c8e9e1d72f2351 | [
"MIT"
] | 1 | 2020-11-17T14:33:52.000Z | 2020-11-17T14:33:52.000Z | 27.027933 | 156 | 0.486151 | 999,944 | /* */ package pro.gravit.repackage.io.netty.handler.codec.rtsp;
/* */
/* */ import java.util.regex.Pattern;
/* */ import pro.gravit.repackage.io.netty.handler.codec.http.DefaultFullHttpRequest;
/* */ import pro.gravit.repackage.io.netty.handler.codec.http.DefaultFullHttpResponse;
/* */ import pro.gravit.repackage.io.netty.handler.codec.http.DefaultHttpRequest;
/* */ import pro.gravit.repackage.io.netty.handler.codec.http.DefaultHttpResponse;
/* */ import pro.gravit.repackage.io.netty.handler.codec.http.HttpMessage;
/* */ import pro.gravit.repackage.io.netty.handler.codec.http.HttpObjectDecoder;
/* */ import pro.gravit.repackage.io.netty.handler.codec.http.HttpResponseStatus;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class RtspDecoder
/* */ extends HttpObjectDecoder
/* */ {
/* 61 */ private static final HttpResponseStatus UNKNOWN_STATUS = new HttpResponseStatus(999, "Unknown");
/* */
/* */
/* */
/* */
/* */
/* */ private boolean isDecodingRequest;
/* */
/* */
/* */
/* */
/* 72 */ private static final Pattern versionPattern = Pattern.compile("RTSP/\\d\\.\\d");
/* */
/* */
/* */
/* */
/* */
/* */ public static final int DEFAULT_MAX_INITIAL_LINE_LENGTH = 4096;
/* */
/* */
/* */
/* */
/* */ public static final int DEFAULT_MAX_HEADER_SIZE = 8192;
/* */
/* */
/* */
/* */
/* */ public static final int DEFAULT_MAX_CONTENT_LENGTH = 8192;
/* */
/* */
/* */
/* */
/* */
/* */ public RtspDecoder() {
/* 95 */ this(4096, 8192, 8192);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public RtspDecoder(int maxInitialLineLength, int maxHeaderSize, int maxContentLength) {
/* 109 */ super(maxInitialLineLength, maxHeaderSize, maxContentLength * 2, false);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public RtspDecoder(int maxInitialLineLength, int maxHeaderSize, int maxContentLength, boolean validateHeaders) {
/* 123 */ super(maxInitialLineLength, maxHeaderSize, maxContentLength * 2, false, validateHeaders);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected HttpMessage createMessage(String[] initialLine) throws Exception {
/* 135 */ if (versionPattern.matcher(initialLine[0]).matches()) {
/* 136 */ this.isDecodingRequest = false;
/* 137 */ return (HttpMessage)new DefaultHttpResponse(RtspVersions.valueOf(initialLine[0]), new HttpResponseStatus(
/* 138 */ Integer.parseInt(initialLine[1]), initialLine[2]), this.validateHeaders);
/* */ }
/* */
/* */
/* 142 */ this.isDecodingRequest = true;
/* 143 */ return (HttpMessage)new DefaultHttpRequest(RtspVersions.valueOf(initialLine[2]),
/* 144 */ RtspMethods.valueOf(initialLine[0]), initialLine[1], this.validateHeaders);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ protected boolean isContentAlwaysEmpty(HttpMessage msg) {
/* 154 */ return (super.isContentAlwaysEmpty(msg) || !msg.headers().contains((CharSequence)RtspHeaderNames.CONTENT_LENGTH));
/* */ }
/* */
/* */
/* */ protected HttpMessage createInvalidMessage() {
/* 159 */ if (this.isDecodingRequest) {
/* 160 */ return (HttpMessage)new DefaultFullHttpRequest(RtspVersions.RTSP_1_0, RtspMethods.OPTIONS, "/bad-request", this.validateHeaders);
/* */ }
/* */
/* 163 */ return (HttpMessage)new DefaultFullHttpResponse(RtspVersions.RTSP_1_0, UNKNOWN_STATUS, this.validateHeaders);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ protected boolean isDecodingRequest() {
/* 171 */ return this.isDecodingRequest;
/* */ }
/* */ }
/* Location: C:\Users\Main\AppData\Roaming\StreamCraf\\updates\Launcher.jar!\pro\gravit\repackage\io\netty\handler\codec\rtsp\RtspDecoder.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 1.1.3
*/ |
923c7968a448da237bb991a3e764ba30f25c5d34 | 692 | java | Java | app/src/main/java/com/hui/tally/frag_record/OutcomeFragment.java | xuNceh-9vudsy-qovces/Tommy | df7752adaf83920a265869c3d9e1913484f44277 | [
"MIT"
] | null | null | null | app/src/main/java/com/hui/tally/frag_record/OutcomeFragment.java | xuNceh-9vudsy-qovces/Tommy | df7752adaf83920a265869c3d9e1913484f44277 | [
"MIT"
] | null | null | null | app/src/main/java/com/hui/tally/frag_record/OutcomeFragment.java | xuNceh-9vudsy-qovces/Tommy | df7752adaf83920a265869c3d9e1913484f44277 | [
"MIT"
] | null | null | null | 24.714286 | 58 | 0.679191 | 999,945 | package com.hui.tally.frag_record;
import com.hui.tally.R;
import com.hui.tally.db.DBManager;
import com.hui.tally.db.TypeBean;
import java.util.List;
/*
支出紀錄頁面
*/
public class OutcomeFragment extends BaseRecordFragment {
@Override
public void loadDataToGv() {
super.loadDataToGv();
//獲取數據庫當中的數據源
List<TypeBean> outlist = DBManager.getTypeList(0);
typeList.addAll(outlist);
adapter.notifyDataSetChanged();
typeTv.setText("其他");
typeIv.setImageResource(R.mipmap.ic_more_fs);
}
@Override
public void saveAccountToDB() {
accountBean.setKind(0);
DBManager.insertItemToAccounttb(accountBean);
}
} |
923c79bbaa88ddae789c62485e1736bbc3a586d3 | 7,250 | java | Java | merchantapp/com/google/commerce/tapandpay/merchantapp/validation/Schema.java | ydong08/GooglePay_AP | 8063f2946cb74a070f2009cefae29887bfae0dbb | [
"MIT"
] | null | null | null | merchantapp/com/google/commerce/tapandpay/merchantapp/validation/Schema.java | ydong08/GooglePay_AP | 8063f2946cb74a070f2009cefae29887bfae0dbb | [
"MIT"
] | null | null | null | merchantapp/com/google/commerce/tapandpay/merchantapp/validation/Schema.java | ydong08/GooglePay_AP | 8063f2946cb74a070f2009cefae29887bfae0dbb | [
"MIT"
] | null | null | null | 36.069652 | 240 | 0.624138 | 999,946 | package com.google.commerce.tapandpay.merchantapp.validation;
import android.content.ContentResolver;
import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.Parcelable.Creator;
import com.google.android.libraries.logging.text.FormattingLogger;
import com.google.android.libraries.logging.text.FormattingLoggers;
import com.google.commerce.tapandpay.merchantapp.validation.ValidationResults.Status;
import com.google.common.base.Strings;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonSyntaxException;
import com.google.gson.TypeAdapter;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Scanner;
public abstract class Schema implements Parcelable {
public static final Creator<Schema> CREATOR = new Creator<Schema>() {
public Schema createFromParcel(Parcel parcel) {
return Schema.create(parcel);
}
public Schema[] newArray(int i) {
return new Schema[i];
}
};
private static final Gson GSON = new GsonBuilder().registerTypeAdapterFactory(ValidationAutoValueTypeAdapterFactory.create()).setPrettyPrinting().create();
private static final FormattingLogger LOG = FormattingLoggers.newContextLogger();
public static abstract class Builder {
public abstract Schema build();
public abstract Builder setName(String str);
public abstract Builder setSessions(ArrayList<Session> arrayList);
public abstract Builder setType(Type type);
public static Builder builder() {
return new Builder().setName("Schema").setType(Type.UNSPECIFIED).setSessions(new ArrayList());
}
}
enum Type {
UNSPECIFIED,
ALL,
ONE_OF,
NONE
}
public abstract String name();
public abstract ArrayList<Session> sessions();
public abstract Type type();
public static Schema create(String str, Type type, ArrayList<Session> arrayList) {
return Builder.builder().setName(str).setType(type).setSessions(arrayList).build();
}
public static Schema create(String str, Type type, Session... sessionArr) {
return create(str, type, new ArrayList(Arrays.asList(sessionArr)));
}
public static Schema create(String str, ArrayList<Session> arrayList) {
return create(str, Type.ALL, (ArrayList) arrayList);
}
public static Schema create(String str, Session... sessionArr) {
return create(str, new ArrayList(Arrays.asList(sessionArr)));
}
public static Schema create(Parcel parcel) {
String readString = parcel.readString();
String readString2 = parcel.readString();
if (readString2 == null) {
return create(readString, (Session[]) parcel.createTypedArray(Session.CREATOR));
}
return create(readString, Type.valueOf(readString2), (Session[]) parcel.createTypedArray(Session.CREATOR));
}
public static Schema fromUri(ContentResolver contentResolver, Uri uri) throws IOException, JsonSyntaxException {
InputStream openInputStream = contentResolver.openInputStream(uri);
try {
Schema fromStream = fromStream(openInputStream);
return fromStream;
} finally {
if (openInputStream != null) {
openInputStream.close();
}
}
}
public static Schema fromStream(InputStream inputStream) throws JsonSyntaxException {
Scanner useDelimiter = new Scanner(inputStream).useDelimiter("\\A");
if (useDelimiter.hasNext()) {
return fromString(useDelimiter.next());
}
LOG.d("Validation file was empty.", new Object[0]);
return null;
}
public static Schema fromString(String str) throws JsonSyntaxException {
if (Strings.isNullOrEmpty(str)) {
return null;
}
return (Schema) GSON.fromJson(str, Schema.class);
}
public ValidationResults validate(List<byte[]> list) {
if (sessions() == null || sessions().isEmpty()) {
return ValidationResults.create(Status.NO_SCHEMA, "%s: Schema contains no sessions.", name());
}
com.google.commerce.tapandpay.merchantapp.validation.ValidationResults.Builder status = com.google.commerce.tapandpay.merchantapp.validation.ValidationResults.Builder.builder().setMessage(name()).setStatus(Status.SUCCESS);
Iterator it = sessions().iterator();
while (it.hasNext()) {
status.addNestedResult(((Session) it.next()).validate(list));
}
if (status.status() == Status.INVALID) {
return status.build();
}
switch (type()) {
case ALL:
break;
case ONE_OF:
it = status.nestedResults().iterator();
while (it.hasNext()) {
if (((ValidationResults) it.next()).status() == Status.SUCCESS) {
status.setStatus(Status.SUCCESS);
break;
}
}
break;
case NONE:
if (status.status() == Status.FAILURE) {
status.setStatus(Status.SUCCESS);
}
it = status.nestedResults().iterator();
while (it.hasNext()) {
if (((ValidationResults) it.next()).status() == Status.SUCCESS) {
status.setStatus(Status.FAILURE);
break;
}
}
break;
default:
return ValidationResults.create(Status.INVALID, "%s: Unsupprted schema validation type for sessions.", name());
}
return status.build();
}
public String toJson() {
return GSON.toJson((Object) this);
}
public String toString() {
return toJson();
}
public boolean equals(Object obj) {
if (obj == null || obj.getClass() != getClass()) {
return false;
}
Schema schema = (Schema) obj;
if (sessions() != null && schema.sessions() != null && Objects.equals(name(), schema.name()) && Objects.equals(type(), schema.type()) && Arrays.equals(sessions().toArray(new Session[0]), schema.sessions().toArray(new Session[0]))) {
return true;
}
return false;
}
public int hashCode() {
return com.google.common.base.Objects.hashCode(name(), type(), sessions());
}
public int describeContents() {
return 0;
}
public void writeToParcel(Parcel parcel, int i) {
Parcelable[] parcelableArr = null;
parcel.writeString(name());
parcel.writeString(type() == null ? null : type().name());
if (sessions() != null) {
Object[] objArr = (Session[]) sessions().toArray(new Session[0]);
}
parcel.writeTypedArray(parcelableArr, i);
}
public static TypeAdapter<Schema> typeAdapter(Gson gson) {
return new AutoValue_Schema$GsonTypeAdapter(gson);
}
}
|
923c7a5b8812823a0b7869ed894fe15b9e437cf4 | 1,110 | java | Java | Library/src/main/java/uk/ac/ucl/excites/sapelli/storage/util/UnexportableRecordsException.java | natural-apptitude/Sapelli | b29b34f211834a6abcb0e5fa0bc02e7a60f09816 | [
"Apache-2.0"
] | 17 | 2015-05-06T16:57:42.000Z | 2022-02-11T19:50:18.000Z | Library/src/main/java/uk/ac/ucl/excites/sapelli/storage/util/UnexportableRecordsException.java | natural-apptitude/Sapelli | b29b34f211834a6abcb0e5fa0bc02e7a60f09816 | [
"Apache-2.0"
] | 111 | 2015-01-06T20:37:14.000Z | 2021-11-01T17:08:33.000Z | Library/src/main/java/uk/ac/ucl/excites/sapelli/storage/util/UnexportableRecordsException.java | natural-apptitude/Sapelli | b29b34f211834a6abcb0e5fa0bc02e7a60f09816 | [
"Apache-2.0"
] | 11 | 2015-02-05T17:21:35.000Z | 2021-05-20T10:45:54.000Z | 31.714286 | 149 | 0.715315 | 999,947 | /**
* Sapelli data collection platform: http://sapelli.org
*
* Copyright 2012-2016 University College London - ExCiteS group
*
* 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.ac.ucl.excites.sapelli.storage.util;
/**
* @author mstevens
*/
public class UnexportableRecordsException extends IllegalArgumentException
{
private static final long serialVersionUID = 2L;
public UnexportableRecordsException(int count)
{
super("Could not export " + count + " record" + (count > 1 ? "s" : "") + " because " + (count > 1 ? "their" : "its") + " schema is unexportable.");
}
}
|
923c7b0684247d2a9f0472e9366f06a429a569f2 | 113 | java | Java | src/main/java/com/ericosouza/pontointeligente/api/enums/PerfilEnum.java | ericosouza/ponto-inteligente-api | a7754642e973c12c41d6912970340506ca9dd7a5 | [
"MIT"
] | null | null | null | src/main/java/com/ericosouza/pontointeligente/api/enums/PerfilEnum.java | ericosouza/ponto-inteligente-api | a7754642e973c12c41d6912970340506ca9dd7a5 | [
"MIT"
] | null | null | null | src/main/java/com/ericosouza/pontointeligente/api/enums/PerfilEnum.java | ericosouza/ponto-inteligente-api | a7754642e973c12c41d6912970340506ca9dd7a5 | [
"MIT"
] | null | null | null | 16.142857 | 51 | 0.761062 | 999,948 | package com.ericosouza.pontointeligente.api.enums;
public enum PerfilEnum {
ROLE_ADMIN,
ROLE_USUARIO;
}
|
923c7bbf3e75008bb8882bdb371de2fb9ac9484b | 417 | java | Java | 응용/2일차/src/com/java/collection/Rectangle.java | kyuyounglee/tj_java_basic_weekand | e1b9dd4d47b0849037064915dcb7c317e3f2b458 | [
"Apache-2.0"
] | 1 | 2021-03-26T20:07:36.000Z | 2021-03-26T20:07:36.000Z | 응용/2일차/src/com/java/collection/Rectangle.java | kyuyounglee/tj_java_basic_weekand | e1b9dd4d47b0849037064915dcb7c317e3f2b458 | [
"Apache-2.0"
] | null | null | null | 응용/2일차/src/com/java/collection/Rectangle.java | kyuyounglee/tj_java_basic_weekand | e1b9dd4d47b0849037064915dcb7c317e3f2b458 | [
"Apache-2.0"
] | null | null | null | 14.37931 | 41 | 0.589928 | 999,949 | package com.java.collection;
public class Rectangle implements Shape{
int x, y;
public Rectangle() {
this(0,0);
}
public Rectangle(int x, int y) {
super();
this.x = x;
this.y = y;
}
@Override
public double area() {
// TODO Auto-generated method stub
return x*y;
}
@Override
public double length() {
// TODO Auto-generated method stub
return (x+y)*2;
}
}
|
923c7d0df2d09edaf1121706a22dd0d196369747 | 491 | java | Java | src/main/java/com/tomtop/filters/IIndexFilter.java | liudih/search-engine | 4febe7e53f5916e4908045bee2b83ad269bf3935 | [
"Apache-2.0"
] | 2 | 2016-02-21T04:25:47.000Z | 2017-12-19T03:39:12.000Z | src/main/java/com/tomtop/filters/IIndexFilter.java | liudih/search-engine | 4febe7e53f5916e4908045bee2b83ad269bf3935 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/tomtop/filters/IIndexFilter.java | liudih/search-engine | 4febe7e53f5916e4908045bee2b83ad269bf3935 | [
"Apache-2.0"
] | 6 | 2016-03-08T17:13:39.000Z | 2018-03-13T09:45:16.000Z | 15.34375 | 69 | 0.659878 | 999,950 | package com.tomtop.filters;
import java.util.Map;
/**
* 建索引过滤器
*
* @author lijuns
*
*/
public interface IIndexFilter {
public static final String ITEMS_KEY = "mutil.items";
public static final String PRODUCT_TYPES_KEY = "mutil.productTypes";
public static final String MUTIL_KEY = "mutil";
/**
* 优先级
*
* @return
*/
public int getPriority();
/**
* 做特殊处理
*
* @param attributes
* @return
*/
public void handle(int lang, Map<String, Object> attributes);
}
|
923c7ff7c9cf854a416695282f8509dc2598ad12 | 626 | java | Java | src/com/haxademic/core/draw/filters/pshader/PixelateHexFilter.java | cacheflowe/haxademic | 9873996e1553c7b5d9807801581c82abf1895f27 | [
"MIT"
] | 142 | 2015-01-04T05:24:37.000Z | 2022-02-07T15:05:28.000Z | src/com/haxademic/core/draw/filters/pshader/PixelateHexFilter.java | cacheflowe/haxademic | 9873996e1553c7b5d9807801581c82abf1895f27 | [
"MIT"
] | 5 | 2015-04-19T00:36:40.000Z | 2022-02-02T20:02:04.000Z | src/com/haxademic/core/draw/filters/pshader/PixelateHexFilter.java | cacheflowe/haxademic | 9873996e1553c7b5d9807801581c82abf1895f27 | [
"MIT"
] | 27 | 2015-01-04T05:24:41.000Z | 2021-06-25T20:36:34.000Z | 22.357143 | 73 | 0.768371 | 999,951 | package com.haxademic.core.draw.filters.pshader;
import com.haxademic.core.draw.filters.pshader.shared.BaseFragmentShader;
import processing.core.PApplet;
public class PixelateHexFilter
extends BaseFragmentShader {
public static PixelateHexFilter instance;
public PixelateHexFilter(PApplet p) {
super(p, "haxademic/shaders/filters/pixelate-hex.glsl");
setDivider(20f);
}
public static PixelateHexFilter instance(PApplet p) {
if(instance != null) return instance;
instance = new PixelateHexFilter(p);
return instance;
}
public void setDivider(float divider) {
shader.set("divider", divider);
}
}
|
923c81f12045f495b969877eb1fdcdb11fb6c594 | 1,011 | java | Java | src/main/java/com/firefly/operation/core/DoubleBinary.java | linyuxiangfly/derivative | 752dcb4f8c8113055c1d8463caf54bc13c2b7599 | [
"Apache-2.0"
] | 4 | 2020-09-10T06:31:28.000Z | 2022-03-04T02:24:13.000Z | src/main/java/com/firefly/operation/core/DoubleBinary.java | iangellove/derivative | 752dcb4f8c8113055c1d8463caf54bc13c2b7599 | [
"Apache-2.0"
] | null | null | null | src/main/java/com/firefly/operation/core/DoubleBinary.java | iangellove/derivative | 752dcb4f8c8113055c1d8463caf54bc13c2b7599 | [
"Apache-2.0"
] | 1 | 2022-03-04T02:24:14.000Z | 2022-03-04T02:24:14.000Z | 34.862069 | 68 | 0.599407 | 999,952 | package com.firefly.operation.core;
import com.firefly.layers.data.MultiDim;
/**
* double型的双目操作
*/
public interface DoubleBinary {
double calc(double a,double b);
void calc(double[] a,double[] b,double[] out);
void calc(double[][] a,double[][] b,double[][] out);
void calc(double[][][] a,double[][][] b,double[][][] out);
void calc(double[][][][] a,double[][][][] b,double[][][][] out);
void calc(MultiDim a, MultiDim b, MultiDim out);
void calc(double[] a,double b,double[] out);
void calc(double[][] a,double b,double[][] out);
void calc(double[][][] a,double b,double[][][] out);
void calc(double[][][][] a,double b,double[][][][] out);
void calc(MultiDim a, double b, MultiDim out);
void calc(double a,double[] b,double[] out);
void calc(double a,double[][] b,double[][] out);
void calc(double a,double[][][] b,double[][][] out);
void calc(double a,double[][][][] b,double[][][][] out);
void calc(double a, MultiDim b, MultiDim out);
}
|
923c83d80c6f2bd4ad8a8cf9294419821c7895b1 | 436 | java | Java | design-patterns/src/main/java/pers/huangyuhui/froxy_pattern/froxy_pattern_1/Client.java | YUbuntu0109/design-patterns-in-java | 1695bfd7e2c84f366e94b4576682560dd05dab6e | [
"MIT"
] | 26 | 2019-09-26T05:33:32.000Z | 2021-01-07T02:53:19.000Z | design-patterns/src/main/java/pers/huangyuhui/froxy_pattern/froxy_pattern_1/Client.java | tianqingyueming/design-patterns-in-java | 1695bfd7e2c84f366e94b4576682560dd05dab6e | [
"MIT"
] | null | null | null | design-patterns/src/main/java/pers/huangyuhui/froxy_pattern/froxy_pattern_1/Client.java | tianqingyueming/design-patterns-in-java | 1695bfd7e2c84f366e94b4576682560dd05dab6e | [
"MIT"
] | 8 | 2019-12-12T13:38:24.000Z | 2020-12-17T08:11:54.000Z | 24.222222 | 88 | 0.674312 | 999,953 | package pers.huangyuhui.froxy_pattern.froxy_pattern_1;
/**
* @project: design-patterns
* @description: 客户端测试类
* @author: 黄宇辉
* @date: 9/25/2019-1:13 PM
* @version: 1.0
* @website: https://yubuntu0109.github.io/
*/
public class Client {
public static void main(String[] args) {
Searcher searcher = new ProxySearcher();
System.out.println(searcher.doSearch("yubuntu0109", "design-patterns-in-java"));
}
}
|
923c83ea2c1f20f3ad98416b10255c0bd5c62c0a | 3,238 | java | Java | backend/de.metas.dlm/base/src/main/java/de/metas/dlm/model/interceptor/Main.java | dram/metasfresh | a1b881a5b7df8b108d4c4ac03082b72c323873eb | [
"RSA-MD"
] | 1,144 | 2016-02-14T10:29:35.000Z | 2022-03-30T09:50:41.000Z | backend/de.metas.dlm/base/src/main/java/de/metas/dlm/model/interceptor/Main.java | dram/metasfresh | a1b881a5b7df8b108d4c4ac03082b72c323873eb | [
"RSA-MD"
] | 8,283 | 2016-04-28T17:41:34.000Z | 2022-03-30T13:30:12.000Z | backend/de.metas.dlm/base/src/main/java/de/metas/dlm/model/interceptor/Main.java | dram/metasfresh | a1b881a5b7df8b108d4c4ac03082b72c323873eb | [
"RSA-MD"
] | 441 | 2016-04-29T08:06:07.000Z | 2022-03-28T06:09:56.000Z | 37.651163 | 123 | 0.804509 | 999,954 | package de.metas.dlm.model.interceptor;
import org.adempiere.ad.callout.spi.IProgramaticCalloutProvider;
import org.adempiere.ad.modelvalidator.AbstractModuleInterceptor;
import org.adempiere.ad.modelvalidator.IModelValidationEngine;
import org.adempiere.ad.persistence.po.NoDataFoundHandlers;
import org.adempiere.exceptions.DBException;
import org.adempiere.service.ISysConfigBL;
import de.metas.connection.IConnectionCustomizerService;
import de.metas.dlm.IDLMService;
import de.metas.dlm.connection.DLMPermanentIniCustomizer;
import de.metas.dlm.coordinator.ICoordinatorService;
import de.metas.dlm.coordinator.impl.LastUpdatedInspector;
import de.metas.dlm.exception.DLMReferenceExceptionWrapper;
import de.metas.dlm.po.UnArchiveRecordHandler;
import de.metas.util.Services;
/*
* #%L
* metasfresh-dlm
* %%
* Copyright (C) 2016 metas GmbH
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-2.0.html>.
* #L%
*/
public class Main extends AbstractModuleInterceptor
{
/**
* @task https://github.com/metasfresh/metasfresh/issues/969
*/
private static final String SYSCONFIG_DLM_PARTITIONER_INTERCEPTOR_ENABLED = "de.metas.dlm.PartitionerInterceptor.enabled";
@Override
protected void registerInterceptors(final IModelValidationEngine engine)
{
engine.addModelValidator(DLM_Partition_Config.INSTANCE);
engine.addModelValidator(DLM_Partition_Config_Line.INSTANCE);
final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
if (sysConfigBL.getBooleanValue(SYSCONFIG_DLM_PARTITIONER_INTERCEPTOR_ENABLED, false))
{
// gh #969: only do partitioning if it's enabled
engine.addModelValidator(PartitionerInterceptor.INSTANCE);
}
}
@Override
protected void registerCallouts(final IProgramaticCalloutProvider calloutsRegistry)
{
calloutsRegistry.registerAnnotatedCallout(DLM_Partition_Config_Reference.INSTANCE);
}
@Override
public void onUserLogin(final int AD_Org_ID, final int AD_Role_ID, final int AD_User_ID)
{
DBException.registerExceptionWrapper(DLMReferenceExceptionWrapper.INSTANCE);
// gh #1411: only register the connection customizer if it was enabled.
final IDLMService dlmService = Services.get(IDLMService.class);
if (dlmService.isConnectionCustomizerEnabled(AD_User_ID))
{
Services.get(IConnectionCustomizerService.class).registerPermanentCustomizer(DLMPermanentIniCustomizer.INSTANCE);
}
Services.get(ICoordinatorService.class).registerInspector(LastUpdatedInspector.INSTANCE);
// gh #968: register handler to try to get back archived records, if PO could not load them
NoDataFoundHandlers.get().addHandler(UnArchiveRecordHandler.INSTANCE);
}
}
|
923c83f5bb3f0fe333db2d3195b0bb346729e9b8 | 7,677 | java | Java | src/integration/java/org/jlab/jlog/util/WireLogSSLSocketFactory.java | JeffersonLab/jlog | eb8f6c50ed7ba655a4ac38d795898403475f29a8 | [
"MIT"
] | null | null | null | src/integration/java/org/jlab/jlog/util/WireLogSSLSocketFactory.java | JeffersonLab/jlog | eb8f6c50ed7ba655a4ac38d795898403475f29a8 | [
"MIT"
] | null | null | null | src/integration/java/org/jlab/jlog/util/WireLogSSLSocketFactory.java | JeffersonLab/jlog | eb8f6c50ed7ba655a4ac38d795898403475f29a8 | [
"MIT"
] | 1 | 2020-01-21T21:11:42.000Z | 2020-01-21T21:11:42.000Z | 27.03169 | 127 | 0.667839 | 999,955 | package org.jlab.jlog.util;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.channels.SocketChannel;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.net.ssl.HandshakeCompletedListener;
import javax.net.ssl.SSLSession;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
/**
* This is a utility class useful for debugging. You can wrap an
* SSLSocketFactory to enable logging of the messages written to the peer. This
* class is not for use in production and is known to cause Socket connection
* issues (but usually after it has logged a fair amount of data such as HTTP
* headers).
*
* @author ryans
*/
public class WireLogSSLSocketFactory extends SSLSocketFactory {
private final SSLSocketFactory delegate;
public WireLogSSLSocketFactory(SSLSocketFactory delegate) {
this.delegate = delegate;
}
@Override
public String[] getDefaultCipherSuites() {
return delegate.getDefaultCipherSuites();
}
@Override
public String[] getSupportedCipherSuites() {
return delegate.getSupportedCipherSuites();
}
@Override
public Socket createSocket(Socket socket, String string, int i, boolean bln) throws IOException {
return new WireLogSocket((SSLSocket)delegate.createSocket(socket, string, i, bln));
}
@Override
public Socket createSocket(String string, int i) throws IOException {
return new WireLogSocket((SSLSocket)delegate.createSocket(string, i));
}
@Override
public Socket createSocket(String string, int i, InetAddress ia, int i1) throws IOException {
return new WireLogSocket((SSLSocket)delegate.createSocket(string, i, ia, i1));
}
@Override
public Socket createSocket(InetAddress ia, int i) throws IOException {
return new WireLogSocket((SSLSocket)delegate.createSocket(ia, i));
}
@Override
public Socket createSocket(InetAddress ia, int i, InetAddress ia1, int i1) throws IOException {
return new WireLogSocket((SSLSocket)delegate.createSocket(ia, i, ia1, i1));
}
}
class WireLogSocket extends SSLSocket {
private final SSLSocket delegate;
public WireLogSocket(SSLSocket delegate) {
this.delegate = delegate;
}
@Override
public void connect(SocketAddress endpoint) throws IOException {
delegate.connect(endpoint);
}
@Override
public void connect(SocketAddress endpoint, int timeout) throws IOException {
delegate.connect(endpoint, timeout);
}
@Override
public boolean equals(Object obj) {
return delegate.equals(obj);
}
@Override
public int hashCode() {
return delegate.hashCode();
}
@Override
public void close() throws IOException {
delegate.close();
}
@Override
public void bind(SocketAddress bindpoint) throws IOException {
delegate.bind(bindpoint);
}
@Override
public SocketChannel getChannel() {
return delegate.getChannel();
}
@Override
public boolean isConnected() {
return delegate.isConnected();
}
@Override
public boolean isBound() {
return delegate.isBound();
}
@Override
public boolean isClosed() {
return delegate.isClosed();
}
@Override
public boolean isInputShutdown() {
return delegate.isInputShutdown();
}
@Override
public boolean isOutputShutdown() {
return delegate.isOutputShutdown();
}
@Override
public InetAddress getInetAddress() {
return delegate.getInetAddress();
}
@Override
public InetAddress getLocalAddress() {
return delegate.getLocalAddress();
}
@Override
public boolean getKeepAlive() throws SocketException {
return delegate.getKeepAlive();
}
@Override
public OutputStream getOutputStream() throws IOException {
return new LoggingOutputStream(delegate.getOutputStream());
}
@Override
public String[] getSupportedCipherSuites() {
return delegate.getSupportedCipherSuites();
}
@Override
public String[] getEnabledCipherSuites() {
return delegate.getEnabledCipherSuites();
}
@Override
public void setEnabledCipherSuites(String[] strings) {
delegate.setEnabledCipherSuites(strings);
}
@Override
public String[] getSupportedProtocols() {
return delegate.getSupportedProtocols();
}
@Override
public String[] getEnabledProtocols() {
return delegate.getEnabledProtocols();
}
@Override
public void setEnabledProtocols(String[] strings) {
delegate.setEnabledProtocols(strings);
}
@Override
public SSLSession getSession() {
return delegate.getSession();
}
@Override
public void addHandshakeCompletedListener(HandshakeCompletedListener hl) {
delegate.addHandshakeCompletedListener(hl);
}
@Override
public void removeHandshakeCompletedListener(HandshakeCompletedListener hl) {
delegate.removeHandshakeCompletedListener(hl);
}
@Override
public void startHandshake() throws IOException {
delegate.startHandshake();
}
@Override
public void setUseClientMode(boolean bln) {
delegate.setUseClientMode(bln);
}
@Override
public boolean getUseClientMode() {
return delegate.getUseClientMode();
}
@Override
public void setNeedClientAuth(boolean bln) {
delegate.setNeedClientAuth(bln);
}
@Override
public boolean getNeedClientAuth() {
return delegate.getNeedClientAuth();
}
@Override
public void setWantClientAuth(boolean bln) {
delegate.setWantClientAuth(bln);
}
@Override
public boolean getWantClientAuth() {
return delegate.getWantClientAuth();
}
@Override
public void setEnableSessionCreation(boolean bln) {
delegate.setEnableSessionCreation(bln);
}
@Override
public boolean getEnableSessionCreation() {
return delegate.getEnableSessionCreation();
}
}
class LoggingOutputStream extends FilterOutputStream {
private static final Logger logger = Logger.getLogger(
LoggingOutputStream.class.getName());
private static final int MAX_LOG_MESSAGE_BYTES = 1024;
private static final String ENCODING = "UTF-8";
private static final Level level = Level.INFO;
public LoggingOutputStream(OutputStream out) {
super(out);
}
@Override
public void write(byte[] b) throws IOException {
logger.log(level, "write(byte[]): {0}", new String(b, ENCODING));
out.write(b);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
if(len > MAX_LOG_MESSAGE_BYTES) {
logger.log(level, "write(byte[], int, int) [truncated]: {0}", new String(b, off, MAX_LOG_MESSAGE_BYTES, ENCODING));
} else {
logger.log(level, "write(byte[], int, int): {0}", new String(b, off, len, ENCODING));
}
out.write(b, off, len);
}
@Override
public void write(int b) throws IOException {
// This could be unintelligable if byte is part of multi-byte character
logger.log(level, "write(int): {0}", new String(new byte[] {(byte)(b & 0xFF)}, ENCODING));
out.write(b);
}
}
|
923c843cda60ac27ec2ea2161b5db5acce499d0d | 320 | java | Java | src/main/java/com/fcamara/mongorest/MongoRestApplication.java | matheusferr/fcamara-spring-mongo-rest | 107969c630874203f1e15cef883ba220c270f499 | [
"MIT"
] | null | null | null | src/main/java/com/fcamara/mongorest/MongoRestApplication.java | matheusferr/fcamara-spring-mongo-rest | 107969c630874203f1e15cef883ba220c270f499 | [
"MIT"
] | null | null | null | src/main/java/com/fcamara/mongorest/MongoRestApplication.java | matheusferr/fcamara-spring-mongo-rest | 107969c630874203f1e15cef883ba220c270f499 | [
"MIT"
] | null | null | null | 22.857143 | 68 | 0.825 | 999,956 | package com.fcamara.mongorest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MongoRestApplication {
public static void main(String[] args) {
SpringApplication.run(MongoRestApplication.class, args);
}
}
|
923c84905f538a9caeb38edce19f2f1547ac0488 | 2,116 | java | Java | src/main/java/bbidder/inferences/bound/PartialStoppersBoundInf.java | ericgoffster/bidderbot | b52e99127c3545016989ac9b972cb321c4749348 | [
"Apache-2.0"
] | null | null | null | src/main/java/bbidder/inferences/bound/PartialStoppersBoundInf.java | ericgoffster/bidderbot | b52e99127c3545016989ac9b972cb321c4749348 | [
"Apache-2.0"
] | null | null | null | src/main/java/bbidder/inferences/bound/PartialStoppersBoundInf.java | ericgoffster/bidderbot | b52e99127c3545016989ac9b972cb321c4749348 | [
"Apache-2.0"
] | null | null | null | 24.604651 | 84 | 0.638941 | 999,958 | package bbidder.inferences.bound;
import java.util.Objects;
import bbidder.Hand;
import bbidder.IBoundInference;
import bbidder.InfSummary;
import bbidder.StopperSet;
/**
* Represents the inference for stoppers.
*
* @author goffster
*
*/
public final class PartialStoppersBoundInf implements IBoundInference {
private final StopperSet stoppers;
@Override
public IBoundInference negate() {
return create(stoppers.not());
}
private PartialStoppersBoundInf(StopperSet stoppers) {
this.stoppers = stoppers;
}
@Override
public InfSummary getSummary() {
return InfSummary.ALL.withPartialStoppers(stoppers);
}
@Override
public IBoundInference andWith(IBoundInference other) {
if (other instanceof PartialStoppersBoundInf) {
return create(((PartialStoppersBoundInf) other).stoppers.and(stoppers));
}
return null;
}
@Override
public IBoundInference orWith(IBoundInference other) {
if (other instanceof PartialStoppersBoundInf) {
return create(((PartialStoppersBoundInf) other).stoppers.or(stoppers));
}
return null;
}
public static IBoundInference create(StopperSet r) {
if (r.isEmpty()) {
return ConstBoundInference.F;
}
if (r.unBounded()) {
return ConstBoundInference.T;
}
return new PartialStoppersBoundInf(r);
}
@Override
public boolean test(Hand hand) {
return stoppers.contains(hand.getPartialStoppers());
}
@Override
public String toString() {
return "partial stoppers " + stoppers;
}
@Override
public int hashCode() {
return Objects.hash(stoppers);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
PartialStoppersBoundInf other = (PartialStoppersBoundInf) obj;
return Objects.equals(stoppers, other.stoppers);
}
}
|
923c84e2f5e75135b63b02a59c95707db3be7892 | 387 | java | Java | app/core/error/CustomFinderException.java | VictorAdad/sigi-api-adad | 412511b04b420a82cf6ae5338e401b181faae022 | [
"CC0-1.0"
] | null | null | null | app/core/error/CustomFinderException.java | VictorAdad/sigi-api-adad | 412511b04b420a82cf6ae5338e401b181faae022 | [
"CC0-1.0"
] | null | null | null | app/core/error/CustomFinderException.java | VictorAdad/sigi-api-adad | 412511b04b420a82cf6ae5338e401b181faae022 | [
"CC0-1.0"
] | null | null | null | 19.35 | 67 | 0.684755 | 999,959 | package core.error;
public class CustomFinderException extends Exception {
public CustomFinderException() {}
public CustomFinderException(String message) {
super(message);
}
public CustomFinderException(Throwable cause) {
super(cause);
}
public CustomFinderException(String message, Throwable cause) {
super(message, cause);
}
}
|
923c8523330246c49ec68dc66663c47e57d9c45f | 1,712 | java | Java | shepherd-model/src/main/java/com/devsda/platform/shepherd/model/NodeConfiguration.java | arvindsinghms/shepherd | 8844cf43b23e883e346ff6f892d8f533a3153e8a | [
"MIT"
] | 5 | 2018-11-11T18:45:42.000Z | 2020-05-30T15:14:46.000Z | shepherd-model/src/main/java/com/devsda/platform/shepherd/model/NodeConfiguration.java | arvindsinghms/shepherd | 8844cf43b23e883e346ff6f892d8f533a3153e8a | [
"MIT"
] | 24 | 2019-03-27T17:25:00.000Z | 2021-12-09T20:30:08.000Z | shepherd-model/src/main/java/com/devsda/platform/shepherd/model/NodeConfiguration.java | arvindsinghms/shepherd | 8844cf43b23e883e346ff6f892d8f533a3153e8a | [
"MIT"
] | 5 | 2019-05-05T12:35:40.000Z | 2019-05-28T17:15:53.000Z | 22.233766 | 63 | 0.604556 | 999,960 | package com.devsda.platform.shepherd.model;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Map;
@JsonIgnoreProperties(ignoreUnknown = true)
public class NodeConfiguration {
@JsonProperty("name")
private String name;
@JsonProperty("URI")
private String URI;
@JsonProperty("httpMethod")
private String httpMethod;
@JsonProperty("headers")
private Map<String, String> headers;
@JsonProperty("serverDetails")
private ServerDetails serverDetails;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getURI() {
return URI;
}
public void setURI(String URI) {
this.URI = URI;
}
public String getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(String httpMethod) {
this.httpMethod = httpMethod;
}
public Map<String, String> getHeaders() {
return headers;
}
public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}
public ServerDetails getServerDetails() {
return serverDetails;
}
public void setServerDetails(ServerDetails serverDetails) {
this.serverDetails = serverDetails;
}
@Override
public String toString() {
return "NodeConfiguration{" +
"name='" + name + '\'' +
", URI='" + URI + '\'' +
", httpMethod='" + httpMethod + '\'' +
", headers=" + headers +
", serverDetails=" + serverDetails +
'}';
}
}
|
923c858e198a64e4e7b374615bec1572a8fb9563 | 2,529 | java | Java | src/main/java/com/ipaixao/ibeer/domain/manufacturer/ManufacturerService.java | iagopaixao/i-beer | a3a3615500e1c9ac46f46586a12799fd4636b1e5 | [
"MIT"
] | 5 | 2021-02-08T21:05:38.000Z | 2022-03-23T21:08:26.000Z | src/main/java/com/ipaixao/ibeer/domain/manufacturer/ManufacturerService.java | iagopaixao/i-beer | a3a3615500e1c9ac46f46586a12799fd4636b1e5 | [
"MIT"
] | null | null | null | src/main/java/com/ipaixao/ibeer/domain/manufacturer/ManufacturerService.java | iagopaixao/i-beer | a3a3615500e1c9ac46f46586a12799fd4636b1e5 | [
"MIT"
] | null | null | null | 35.619718 | 100 | 0.711348 | 999,961 | package com.ipaixao.ibeer.domain.manufacturer;
import com.ipaixao.ibeer.domain.common.DuplicationValidator;
import com.ipaixao.ibeer.interfaces.incomming.manufacturer.dto.ManufacturerDTO;
import com.ipaixao.ibeer.interfaces.incomming.manufacturer.mapper.ManufacturerMapper;
import com.ipaixao.ibeer.interfaces.incomming.manufacturer.response.ManufacturerResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.lang.NonNull;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.EntityNotFoundException;
import java.util.Optional;
import static java.util.Objects.nonNull;
import static lombok.AccessLevel.PROTECTED;
@Slf4j
@Service
@RequiredArgsConstructor(access = PROTECTED)
public class ManufacturerService {
private final ManufacturerRepository repository;
private final ManufacturerMapper mapper;
@Transactional
public ManufacturerResponse create(ManufacturerDTO dto) {
applyValidations(dto);
return mapper.toResponse(repository.save(mapper.toEntity(dto)));
}
private void applyValidations(@NonNull ManufacturerDTO dto) {
final var duplicatedManufacturer = Optional.of(dto)
.filter(d -> nonNull(d.id()))
.flatMap(d -> repository.findByNameAndIdNot(d.name(), d.id()).map(mapper::toDTO))
.orElseGet(() -> repository.findByName(dto.name()).map(mapper::toDTO).orElse(null));
new DuplicationValidator()
.accept(duplicatedManufacturer);
}
@Transactional(readOnly = true)
public Page<ManufacturerResponse> getAll(Pageable pageable) {
return repository.findAll(pageable).map(mapper::toResponse);
}
@Transactional(readOnly = true)
public ManufacturerResponse getById(long id) {
return repository.findById(id)
.map(mapper::toResponse)
.orElseThrow(() -> {
final var e = new EntityNotFoundException("Entity not found!");
log.error("m=getById, status=error, message={}", e.getMessage(), e);
return e;
});
}
@Transactional
public ManufacturerResponse update(ManufacturerDTO dto) {
return create(dto);
}
@Transactional
public void deleteById(long id) {
repository.deleteById(id);
}
}
|
923c86beb319ad38fd7b455ac17e8f5bc417169b | 1,498 | java | Java | src/main/java/com/tokyo/beach/restaurants/comment/CommentDataMapper.java | pivotal-tokyo/osusume-java-spring | a1561e41ed63b028998f4a61ad5203ffed6e4f9e | [
"BSD-2-Clause"
] | null | null | null | src/main/java/com/tokyo/beach/restaurants/comment/CommentDataMapper.java | pivotal-tokyo/osusume-java-spring | a1561e41ed63b028998f4a61ad5203ffed6e4f9e | [
"BSD-2-Clause"
] | null | null | null | src/main/java/com/tokyo/beach/restaurants/comment/CommentDataMapper.java | pivotal-tokyo/osusume-java-spring | a1561e41ed63b028998f4a61ad5203ffed6e4f9e | [
"BSD-2-Clause"
] | 1 | 2017-12-15T11:09:24.000Z | 2017-12-15T11:09:24.000Z | 29.372549 | 117 | 0.646195 | 999,962 | package com.tokyo.beach.restaurants.comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
import static com.tokyo.beach.restaurants.comment.CommentRowMapper.commentRowMapper;
@Repository
public class CommentDataMapper {
private JdbcTemplate jdbcTemplate;
@Autowired
public CommentDataMapper(JdbcTemplate jdbcTemplate) {
this.jdbcTemplate = jdbcTemplate;
}
public Comment create(NewComment newComment, long createdByUserId, long restaurantId) {
String sql = "INSERT INTO comment (content, restaurant_id, created_by_user_id) VALUES (?, ?, ?) RETURNING *";
return jdbcTemplate.queryForObject(
sql,
commentRowMapper,
newComment.getComment(),
restaurantId,
createdByUserId
);
}
public Optional<Comment> get(long commentId) {
List<Comment> comments = jdbcTemplate.query(
"SELECT * FROM comment WHERE id = ?",
commentRowMapper,
commentId
);
if ( comments.size() > 0 ) {
return Optional.of(comments.get(0));
} else {
return Optional.empty();
}
}
public void delete(long commentId) {
jdbcTemplate.update("DELETE FROM comment WHERE id = ?", commentId);
}
}
|
923c8704043d3a4198e476ecf79dc5451d0e14a7 | 4,736 | java | Java | src/main/java/galaxyspace/systems/SolarSystem/planets/overworld/items/armor/ItemJetpack.java | JovGH/GalaxySpace | eaeec0679982d189ebc1f2c5f1a4d574f0d6d2ce | [
"Apache-2.0"
] | 69 | 2015-04-01T23:45:19.000Z | 2022-03-30T11:20:33.000Z | src/main/java/galaxyspace/systems/SolarSystem/planets/overworld/items/armor/ItemJetpack.java | JovGH/GalaxySpace | eaeec0679982d189ebc1f2c5f1a4d574f0d6d2ce | [
"Apache-2.0"
] | 531 | 2015-03-13T20:20:20.000Z | 2022-03-12T07:45:34.000Z | src/main/java/galaxyspace/systems/SolarSystem/planets/overworld/items/armor/ItemJetpack.java | JovGH/GalaxySpace | eaeec0679982d189ebc1f2c5f1a4d574f0d6d2ce | [
"Apache-2.0"
] | 66 | 2016-02-05T09:20:45.000Z | 2022-02-26T17:59:40.000Z | 27.858824 | 135 | 0.748733 | 999,963 | package galaxyspace.systems.SolarSystem.planets.overworld.items.armor;
import java.util.List;
import javax.annotation.Nullable;
import galaxyspace.api.item.IJetpackArmor;
import galaxyspace.core.prefab.items.ItemElectricArmor;
import galaxyspace.core.util.GSCreativeTabs;
import galaxyspace.systems.SolarSystem.planets.overworld.render.item.ItemSpaceSuitModel;
import micdoodle8.mods.galacticraft.api.item.IItemElectricBase;
import micdoodle8.mods.galacticraft.core.energy.EnergyDisplayHelper;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource;
import net.minecraft.util.NonNullList;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemJetpack extends ItemElectricArmor implements ISpecialArmor, IJetpackArmor{
public ItemJetpack(ArmorMaterial materialIn, EntityEquipmentSlot equipmentSlotIn) {
super(materialIn, equipmentSlotIn);
this.setUnlocalizedName("jetpack");
}
@Override
public void getSubItems(CreativeTabs tab, NonNullList<ItemStack> list)
{
if (tab == GSCreativeTabs.GSArmorTab || tab == CreativeTabs.SEARCH)
{
list.add(new ItemStack(this, 1, this.getMaxDamage()));
}
}
@Override
@SideOnly(Side.CLIENT)
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, EntityEquipmentSlot armorSlot, ModelBiped model) {
// ModelBiped model = new ModelJetPack();
ModelBiped armormodel = new ItemSpaceSuitModel(6);
if (itemStack.getItem() instanceof ItemJetpack) {
armormodel = ItemSpaceSuit.fillingArmorModel(armormodel, entityLiving);
}
return armormodel;
}
@Override
public float getMaxElectricityStored(ItemStack theItem) {
return 100000;
}
@Override
public void consumeFuel(ItemStack stack, int fuel) {
this.discharge(stack, 5, true);
}
@Override
public void decrementFuel(ItemStack stack) {
if(stack.getItem() instanceof IItemElectricBase)
((IItemElectricBase)stack.getItem()).discharge(stack, 1, true);
}
@Override
public int getFuel(ItemStack stack) {
return stack.getTagCompound().getInteger(TAG_FUEL);
}
@Override
public boolean canFly(ItemStack stack, EntityPlayer player) {
if(stack.hasTagCompound())
{
if(stack.getItemDamage() < stack.getMaxDamage())
{
return true;
}
}
return false;
}
@Override
public boolean isActivated(ItemStack stack) {
return stack.getTagCompound().getBoolean(TAG_ACT);
}
@Override
public void switchState(ItemStack stack, boolean state) {
if(stack.hasTagCompound())
stack.getTagCompound().setBoolean(TAG_ACT, state);
else
{
stack.setTagCompound(new NBTTagCompound());
}
}
@Override
public int getFireStreams(ItemStack stack) {
return 2;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, @Nullable World world, List<String> list, ITooltipFlag flagIn)
{
String color = "";
float joules = this.getElectricityStored(stack);
if (joules <= this.getMaxElectricityStored(stack) / 3) {
color = "\u00a74";
} else if (joules > this.getMaxElectricityStored(stack) * 2 / 3) {
color = "\u00a72";
} else {
color = "\u00a76";
}
list.add("");
list.add(color + EnergyDisplayHelper.getEnergyDisplayS(joules) + "/"
+ EnergyDisplayHelper.getEnergyDisplayS(this.getMaxElectricityStored(stack)));
}
@Override
public int getRGBDurabilityForDisplay(ItemStack stack)
{
return 0x2ed8db;
}
@Override
public boolean showDurabilityBar(ItemStack stack)
{
return true;
}
@Override
public boolean isBookEnchantable(ItemStack stack, ItemStack book)
{
return false;
}
@Override
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
if(source.isUnblockable())
return new ISpecialArmor.ArmorProperties(0, 0.0, 0);
return new ISpecialArmor.ArmorProperties(2, 0.15, Integer.MAX_VALUE);
}
@Override
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
return this.damageReduceAmount;
}
@Override
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
this.discharge(stack, 5, true);
}
}
|
923c884b390ab83f07528aebb7c570b846f8afd7 | 1,529 | java | Java | client/client-multi/client-java-core/src/main/java/org/kaaproject/kaa/client/channel/TransportConnectionInfo.java | MiddlewareICS/kaa | 65c02e847d6019e4afb20fbfb03c3416e0972908 | [
"ECL-2.0",
"Apache-2.0"
] | 2 | 2019-08-27T10:45:57.000Z | 2019-08-30T06:21:04.000Z | client/client-multi/client-java-core/src/main/java/org/kaaproject/kaa/client/channel/TransportConnectionInfo.java | MiddlewareICS/kaa | 65c02e847d6019e4afb20fbfb03c3416e0972908 | [
"ECL-2.0",
"Apache-2.0"
] | 8 | 2020-01-31T18:26:22.000Z | 2022-01-21T23:34:19.000Z | client/client-multi/client-java-core/src/main/java/org/kaaproject/kaa/client/channel/TransportConnectionInfo.java | MiddlewareICS/kaa | 65c02e847d6019e4afb20fbfb03c3416e0972908 | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2019-11-24T07:01:26.000Z | 2019-11-24T07:01:26.000Z | 27.303571 | 97 | 0.708306 | 999,964 | /*
* Copyright 2014-2016 CyberVision, 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 org.kaaproject.kaa.client.channel;
/**
* Interface for server information. Used by {@link KaaDataChannel} and
* {@link KaaChannelManager}
*/
public interface TransportConnectionInfo {
/**
* Retrieves the channel's server type (i.e. OPERATIONS or BOOTSTRAP).
*
* @return the channel's server type.
* @see ServerType
*/
ServerType getServerType();
/**
* Retrieves the {@link TransportProtocolId}.
*
* @return the transport protocol id.
* @see TransportProtocolId
*/
TransportProtocolId getTransportId();
/**
* Retrieves the access point id (operations/bootstrap service id).
*
* @return access point id
*/
int getAccessPointId();
/**
* Retrieves serialized connection properties. Serialization may be specific for each transport
* protocol implementation.
*
* @return serialized connection properties
*/
byte[] getConnectionInfo();
}
|
923c888a1f742daba2b1513405de21f2e06e0cd4 | 189 | java | Java | app/src/main/java/com/ankitgarg/instagram/model/Images.java | gargankit90/Instagram | 4dbdb5b326bda5f87caa22e6ca2db4220a8fa865 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/ankitgarg/instagram/model/Images.java | gargankit90/Instagram | 4dbdb5b326bda5f87caa22e6ca2db4220a8fa865 | [
"Apache-2.0"
] | null | null | null | app/src/main/java/com/ankitgarg/instagram/model/Images.java | gargankit90/Instagram | 4dbdb5b326bda5f87caa22e6ca2db4220a8fa865 | [
"Apache-2.0"
] | null | null | null | 18.9 | 42 | 0.730159 | 999,965 | package com.ankitgarg.instagram.model;
public class Images {
private Image standard_resolution;
public Image getStandardResolution() {
return standard_resolution;
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.