hexsha stringlengths 40 40 | size int64 8 1.04M | content stringlengths 8 1.04M | avg_line_length float64 2.24 100 | max_line_length int64 4 1k | alphanum_fraction float64 0.25 0.97 |
|---|---|---|---|---|---|
53b976d8d37685ecbb34dab6c9718fe313257d30 | 6,585 | package eu.smartdatalake.simsearch.engine.processor;
import java.util.HashMap;
import java.util.Map;
import eu.smartdatalake.simsearch.engine.IResult;
import eu.smartdatalake.simsearch.engine.measure.ISimilarity;
import eu.smartdatalake.simsearch.manager.DatasetIdentifier;
import eu.smartdatalake.simsearch.manager.ingested.numerical.INormal;
import eu.smartdatalake.simsearch.pivoting.MetricSimilarity;
import eu.smartdatalake.simsearch.pivoting.rtree.geometry.Point;
/**
* A matrix indicating the similarity between all possible pairwise combinations in the query results.
*/
public class ResultMatrix {
// List of all data/index datasetIdentifiers involved in the search
Map<String, DatasetIdentifier> datasetIdentifiers;
// Weights
Map<String, Double> weights;
// Normalization functions
Map<String, INormal> normalizations;
//Dictionaries built for the various datasets as needed in random access similarity calculations
// Using the column number as a reference to the collected values for each attribute
Map<String, Map<?, ?>> datasets;
// List of similarity functions to be used in random access calculations
Map<String, ISimilarity> similarities;
// List of metric similarities per attribute (to be applied in pivot-based search only)
Map<String, MetricSimilarity> metricSimilarities;
/**
* Constructor
* @param datasetIdentifiers List of the attributes involved in similarity search queries
* @param lookups List of the various data collections involved in the similarity search queries.
* @param similarities List of the similarity measures applied in each search query.
* @param weights List of the weights to be applied in similarity scores returned by each search query.
* @param normalizations List of normalization functions to be applied in data values during random access.
* @param metricSimilarities List of metric similarities per attribute (to be applied in pivot-based search only).
*/
public ResultMatrix(Map<String, DatasetIdentifier> datasetIdentifiers, Map<String, Map<?, ?>> lookups, Map<String, ISimilarity> similarities, Map<String, Double> weights, Map<String, INormal> normalizations, Map<String, MetricSimilarity> metricSimilarities) {
this.datasetIdentifiers = datasetIdentifiers;
this.datasets = lookups;
this.similarities = similarities;
this.weights = weights;
this.normalizations = normalizations;
this.metricSimilarities = metricSimilarities;
}
/**
* Post-processing of the search results in order to calculate their pairwise similarity.
* @param results Array of results returned after multi-faceted similarity search.
* @return A similarity matrix with result datasetIdentifiers and the estimated similarity scores per pair.
*/
public ResultPair[] calc(IResult[] results) {
// No ranked results, so no matrix can be produced
if ((results == null) || (results.length == 0))
return null; // Empty array
// Full symmetrical similarity matrix with all pairs; NOT USED: keeping only distinct combinations
ResultPair[] matrix = new ResultPair[results.length * results.length]; // IntMath.factorial(results.length)/(2 * IntMath.factorial(results.length-2))
// Keep correspondence of column names to datasetIdentifiers (hash keys) used in parameterization on weights, normalizations, and similarity measures
// FIXME: Assuming the each attribute (column) is uniquely identified by its name and operation (even if multiple datasets are involved in the search)
Map<String, String> colIdentifiers = new HashMap<String, String>();
for (int r = 0; r < results[0].getAttributes().length; r++) {
for (Map.Entry<String, DatasetIdentifier> entry : this.datasetIdentifiers.entrySet()) {
if (entry.getValue().getValueAttribute().equals(results[0].getAttributes()[r].getName())) {
// Attribute is used in pivot-based search
if ((this.metricSimilarities != null) && (this.metricSimilarities.get(entry.getValue().getHashKey()) != null)) {
colIdentifiers.put(results[0].getAttributes()[r].getName(), entry.getValue().getHashKey());
break;
}
// Attribute is involved in rank aggregation
if ((this.similarities != null) && (this.similarities.get(entry.getValue().getHashKey()) != null)) {
colIdentifiers.put(results[0].getAttributes()[r].getName(), entry.getValue().getHashKey());
break;
}
}
}
}
IResult left, right;
ResultPair pair;
// The sum of weights specified for the given batch
double sumWeights = this.weights.values().stream().mapToDouble(f -> f.doubleValue()).sum();
// Full similarity matrix: Calculate pairwise similarity scores for all results
for (int i = 0; i < results.length; i++) {
left = results[i];
for (int j = 0; j < results.length; j++) {
right = results[j];
pair = new ResultPair(left.getId(), right.getId());
double score = 0.0;
// Estimate similarity score according to the specifications for each attribute involved in the search
for (int r = 0; r < right.getAttributes().length; r++) {
// Identify the attribute values to compare for this pair
String hashKey = colIdentifiers.get(right.getAttributes()[r].getName());
Object valLeft = this.datasets.get(hashKey).get(left.getId());
Object valRight = this.datasets.get(hashKey).get(right.getId());
if ((valLeft != null) && (valRight != null)) { // If not null, then update score accordingly
if ((this.metricSimilarities != null) && (this.metricSimilarities.get(hashKey) != null)) // The respective distance metric in pivot-based search; CAUTION! weights identified using attribute names
score += this.weights.get(right.getAttributes()[r].getName()) * this.metricSimilarities.get(hashKey).calc((Point) valLeft, (Point) valRight);
else if (this.normalizations.get(hashKey) != null) // Apply normalization, if specified for ranked aggregation
score += this.weights.get(hashKey) * this.similarities.get(hashKey).calc(this.normalizations.get(hashKey).normalize(valLeft), this.normalizations.get(hashKey).normalize(valRight));
else // No normalization in ranked aggregation methods
score += this.weights.get(hashKey) * this.similarities.get(hashKey).calc(valLeft, valRight);
}
}
pair.setScore(score / sumWeights); // Weighted aggregate score over all attribute values
matrix[i*results.length + j] = pair;
}
}
return matrix;
}
}
| 51.850394 | 261 | 0.719666 |
59d3de2b54d7197cc549180fd0fde15ea08d4b46 | 1,577 | package at.co.svc.bs;
import javax.json.bind.annotation.JsonbProperty;
import javax.json.bind.annotation.JsonbPropertyOrder;
import at.co.svc.jareto.common.exceptions.AppExceptionData;
/**
* Custom, extended data to be transported along with an exception.
* Note that we add explicitly annotated getters and setters for the fields from the parent class
* to make sure that they are serialized by every library implementing JSON-B.
*/
@JsonbPropertyOrder({ "code", "detailCode", "text", "bean" })
public class AppExceptionDataWithBean extends AppExceptionData {
private Bean bean;
public AppExceptionDataWithBean() {
}
public AppExceptionDataWithBean(String code, String text, Bean bean) {
super(code, text);
setBean(bean);
}
@JsonbProperty
public Bean getBean() {
return this.bean;
}
@JsonbProperty
public void setBean(Bean bean) {
this.bean = bean;
}
@Override
@JsonbProperty
public String getCode() {
return super.getCode();
}
@Override
@JsonbProperty
public void setCode(String code) {
super.setCode(code);
}
@Override
@JsonbProperty
public String getDetailCode() {
return super.getDetailCode();
}
@Override
@JsonbProperty
public void setDetailCode(String detailCode) {
super.setDetailCode(detailCode);
}
@Override
@JsonbProperty
public String getText() {
return super.getText();
}
@Override
@JsonbProperty
public void setText(String text) {
super.setText(text);
}
}
| 21.60274 | 98 | 0.679138 |
1d30a2d724ca2a49402d380b545c74a1873cf85b | 530 | package no.nnsn.seisanquakemljpa.models.quakeml.v12;
import lombok.Data;
import lombok.NoArgsConstructor;
import no.nnsn.seisanquakemljpa.models.quakeml.v12.event.elements.EventParametersDto;
import javax.xml.bind.annotation.*;
@Data
@NoArgsConstructor
@XmlRootElement(name = "quakeml")
@XmlAccessorType(XmlAccessType.FIELD)
public class QuakeMLDto {
@XmlAttribute
private String xmlns = "http://quakeml.org/xmlns/bed/1.2";
@XmlElement(name = "eventParameters")
private EventParametersDto eventParameters;
}
| 24.090909 | 85 | 0.784906 |
ae02415f590e6e2b75e6610e9910232c7b820742 | 5,725 | /*
* Copyright 2016 Bjoern Bilger
*
* 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.jrestless.aws.gateway.io;
import java.util.Collections;
import java.util.Map;
import java.util.Objects;
/**
* Implementation of {@link GatewayRequest}.
* <p>
* The implementation makes sure that the request object passed from AWS API
* Gateway can get de-serialized into this representation.
*
* @author Bjoern Bilger
*
*/
public final class DefaultGatewayRequest implements GatewayRequest {
private String resource;
private String path;
private String httpMethod;
private Map<String, String> headers = Collections.emptyMap();
private Map<String, String> queryStringParameters = Collections.emptyMap();
private Map<String, String> pathParameters = Collections.emptyMap();
private Map<String, String> stageVariables = Collections.emptyMap();
private GatewayRequestContext requestContext;
private String body;
private boolean base64Encoded;
public DefaultGatewayRequest() {
// for de-serialization
}
// for unit testing, only
// CHECKSTYLE:OFF
DefaultGatewayRequest(String resource, String path, String httpMethod, Map<String, String> headers,
Map<String, String> queryStringParameters, Map<String, String> pathParameters,
Map<String, String> stageVariables, DefaultGatewayRequestContext requestContext, String body,
boolean base64Encoded) {
setResource(resource);
setPath(path);
setHttpMethod(httpMethod);
setHeaders(headers);
setQueryStringParameters(queryStringParameters);
setPathParameters(pathParameters);
setStageVariables(stageVariables);
setRequestContext(requestContext);
setBody(body);
setIsBase64Encoded(base64Encoded);
}
// CHECKSTYLE:ON
@Override
public String getResource() {
return resource;
}
public void setResource(String resource) {
this.resource = resource;
}
@Override
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
@Override
public String getHttpMethod() {
return httpMethod;
}
public void setHttpMethod(String httpMethod) {
this.httpMethod = httpMethod;
}
@Override
public Map<String, String> getHeaders() {
return headers;
}
public void setHeaders(Map<String, String> headers) {
this.headers = toUnmodifiableMap(headers);
}
@Override
public Map<String, String> getQueryStringParameters() {
return queryStringParameters;
}
public void setQueryStringParameters(Map<String, String> queryStringParameters) {
this.queryStringParameters = toUnmodifiableMap(queryStringParameters);
}
@Override
public Map<String, String> getPathParameters() {
return pathParameters;
}
public void setPathParameters(Map<String, String> pathParameters) {
this.pathParameters = toUnmodifiableMap(pathParameters);
}
@Override
public Map<String, String> getStageVariables() {
return stageVariables;
}
public void setStageVariables(Map<String, String> stageVariables) {
this.stageVariables = toUnmodifiableMap(stageVariables);
}
@Override
public GatewayRequestContext getRequestContext() {
return requestContext;
}
public void setRequestContext(DefaultGatewayRequestContext requestContext) {
this.requestContext = requestContext;
}
@Override
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
private Map<String, String> toUnmodifiableMap(Map<String, String> map) {
if (map == null) {
return Collections.emptyMap();
}
return Collections.unmodifiableMap(map);
}
@Override
public boolean isBase64Encoded() {
return base64Encoded;
}
// the property is called "isBase64Encoded"
public void setIsBase64Encoded(boolean base64Encoded) {
this.base64Encoded = base64Encoded;
}
@Override
public boolean equals(final Object other) {
if (this == other) {
return true;
}
if (other == null) {
return false;
}
if (!getClass().equals(other.getClass())) {
return false;
}
DefaultGatewayRequest castOther = (DefaultGatewayRequest) other;
return Objects.equals(resource, castOther.resource)
&& Objects.equals(path, castOther.path)
&& Objects.equals(httpMethod, castOther.httpMethod)
&& Objects.equals(headers, castOther.headers)
&& Objects.equals(queryStringParameters, castOther.queryStringParameters)
&& Objects.equals(pathParameters, castOther.pathParameters)
&& Objects.equals(stageVariables, castOther.stageVariables)
&& Objects.equals(requestContext, castOther.requestContext)
&& Objects.equals(body, castOther.body)
&& Objects.equals(base64Encoded, castOther.base64Encoded);
}
@Override
public int hashCode() {
return Objects.hash(resource, path, httpMethod, headers, queryStringParameters, pathParameters, stageVariables,
requestContext, body, base64Encoded);
}
@Override
public String toString() {
return "DefaultGatewayRequest [resource=" + resource + ", path=" + path + ", httpMethod=" + httpMethod
+ ", headers=" + headers + ", queryStringParameters=" + queryStringParameters + ", pathParameters="
+ pathParameters + ", stageVariables=" + stageVariables + ", requestContext=" + requestContext
+ ", body=" + body + ", base64Encoded=" + base64Encoded + "]";
}
}
| 28.341584 | 113 | 0.7469 |
eaa221e6bb4257c3104c55fab3d0dc3de7872d3a | 469 | package com.handcoding.template.controller;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class RootController implements ErrorController {
@GetMapping({"/", "/error"})
public String getUsers() {
return "index";
}
@Override
public String getErrorPath() {
return "/error";
}
} | 23.45 | 66 | 0.724947 |
fe184872fd869345e618bdf6659e823605751840 | 247 | package com.clsaa.tiad.buidlingblock.enums;
/**
* @author clsaa
*/
public enum ContextMappingRole {
/**
* UPSTREAM
*/
UPSTREAM,
/**
* CONSUMER
*/
DOWNSTREAM,
/**
* PARTNER
*/
PARTNER,
}
| 10.291667 | 43 | 0.502024 |
5dbdc608fbaca244d3eb9bbb62a28c865ac20e0f | 2,218 | package io.github.mightycoderx.quiteusefulcommands.maps;
import io.github.mightycoderx.quiteusefulcommands.QuiteUsefulCommands;
import io.github.mightycoderx.quiteusefulcommands.utils.HTTPUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.MapMeta;
import java.awt.*;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.atomic.AtomicReference;
public class CustomMapManager
{
private final QuiteUsefulCommands plugin;
private final Map<Integer, Object> maps = new HashMap<>();
private final MapsConfiguration mapsConfiguration;
public CustomMapManager(QuiteUsefulCommands plugin)
{
this.plugin = plugin;
this.mapsConfiguration = new MapsConfiguration(this);
mapsConfiguration.loadMaps();
}
public void addMap(int mapId, Object obj)
{
maps.put(mapId, obj);
mapsConfiguration.saveMaps();
}
public void renderAllMaps()
{
for(int id : maps.keySet())
{
for(Player player : Bukkit.getOnlinePlayers())
{
for(ItemStack item : player.getInventory().all(Material.FILLED_MAP).values())
{
MapMeta mapMeta = (MapMeta) item.getItemMeta();
if(mapMeta == null || mapMeta.getMapView() == null) continue;
if (mapMeta.getMapView().getId() != id) continue;
mapMeta.getMapView().getRenderers().clear();
Object obj = maps.get(id);
if(obj instanceof MapImage mapImage)
{
HTTPUtils httpUtils = new HTTPUtils(plugin);
AtomicReference<Image> image = new AtomicReference<>();
httpUtils.getImageFromUrl(mapImage.getUrl(), image::set);
mapMeta.getMapView().addRenderer(
new ImageMapRenderer(
image.get(),
mapImage.getStartPos(),
mapImage.shouldScaleDown()
)
);
}
else if(obj instanceof Byte color)
{
mapMeta.getMapView().addRenderer(new ColorMapRenderer(color));
}
item.setItemMeta(mapMeta);
}
}
}
}
public QuiteUsefulCommands getPlugin()
{
return plugin;
}
public Map<Integer, Object> getMaps()
{
return maps;
}
public MapsConfiguration getMapsConfiguration()
{
return mapsConfiguration;
}
}
| 23.347368 | 81 | 0.710099 |
9812f230032610cc0d55be10e75bbe46ee3cb9ed | 2,655 | package natlab.refactoring;
import ast.FunctionList;
import mclint.MatlabProgram;
import mclint.McLintTestCase;
public class FunctionInlinerTest extends McLintTestCase {
private void assertInliningOutput(String... expectedCode) {
MatlabProgram f1 = project.getMatlabProgram("f1.m");
FunctionInliner inliner = new FunctionInliner(basicContext(), ((FunctionList) f1.parse()).getFunction(0));
inliner.apply();
assertEquals(inliner.getErrors().size(), 0);
assertEquivalent(f1.parse(), expectedCode);
}
public void testNoInline() {
parse("f2.m",
"function f2()",
" f = 1;",
"end");
parse("f1.m",
"function x()",
" TT();",
"end");
assertInliningOutput(
"function [] = x()",
" TT();",
"end");
}
public void testInlineSimple() {
parse("f2.m",
"function out=f2()",
" out = 2;",
"end");
parse("f1.m",
"function x()",
" in=f2();",
" disp(in);",
"end");
assertInliningOutput(
"function [] = x()",
" out = 2;",
" disp(out);",
"end");
}
public void testInlineWithExtraAssignments() {
parse("f2.m",
"function out=f2()",
" out = 2;",
"end");
parse("f1.m",
"function x()",
" in=f2();",
"end");
assertInliningOutput(
"function [] = x()",
" out = 2;",
"end");
}
public void testInlineWithExtraAssignmentsAndInputs() {
parse("f2.m",
"function out=f2(j)",
" out = j;",
"end");
parse("f1.m",
"function x(y)",
" in=f2(y);",
"end");
assertInliningOutput(
"function [] = x(y)",
" out = y;",
"end");
}
public void testInlineWithNoExtraAssignments() {
parse("f2.m",
"function out=f2(j)",
" if(1)",
" disp(j);",
" else",
" j=1;",
" end",
" out = j;",
"end");
parse("f1.m",
"function x(y)",
" in=f2(y);",
"end");
assertInliningOutput(
"function [] = x(y)",
" j = y;",
" if 1",
" disp(j);",
" else",
" j = 1;",
" end",
" out = j;",
"end");
}
}
| 25.528846 | 112 | 0.401883 |
c63460456966728253b3030b1f511e705c6883c4 | 1,626 | package com.yelelen.sfish.helper;
import android.support.annotation.NonNull;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Created by yelelen on 17-9-4.
*/
public class ThreadPoolHelper {
private volatile static ThreadPoolHelper mInstance;
private ThreadPoolExecutor mExecutor;
private ThreadPoolHelper() {
BlockingQueue<Runnable> queue = new LinkedBlockingQueue<>();
int cores = Runtime.getRuntime().availableProcessors();
// Log.e("ThreadPoolHelper -> ", cores + "");
mExecutor = new ThreadPoolExecutor(cores, cores * 2,
10, TimeUnit.SECONDS, queue, new SfishThreadFactory());
}
public static ThreadPoolHelper getInstance() {
if (mInstance == null) {
synchronized (ThreadPoolHelper.class) {
if (mInstance == null) {
mInstance = new ThreadPoolHelper();
}
}
}
return mInstance;
}
public void start(Runnable runnable) {
getInstance().mExecutor.execute(runnable);
}
public boolean isTerminated() {
return getInstance().mExecutor.isTerminated();
}
class SfishThreadFactory implements ThreadFactory {
@Override
public Thread newThread(@NonNull Runnable r) {
Thread thread = new Thread(r, "SfishThread");
thread.setPriority(Thread.MIN_PRIORITY);
return thread;
}
}
}
| 29.035714 | 71 | 0.648216 |
d3bb416dfaf68666e9048d73fb8c71250185bbef | 1,409 | package org.cloudfoundry.multiapps.mta.parsers;
import static org.cloudfoundry.multiapps.mta.handlers.v2.Schemas.MODULE_TYPE;
import java.util.Map;
import org.cloudfoundry.multiapps.common.ParsingException;
import org.cloudfoundry.multiapps.mta.model.ModuleType;
import org.cloudfoundry.multiapps.mta.schema.MapElement;
public class ModuleTypeParser extends ModelParser<ModuleType> {
protected static final String PROCESSED_OBJECT_NAME = "MTA module type";
public static final String NAME = "name";
public static final String PROPERTIES = "properties";
public static final String PARAMETERS = "parameters";
public ModuleTypeParser(Map<String, Object> source) {
this(MODULE_TYPE, source);
}
protected ModuleTypeParser(MapElement schema, Map<String, Object> source) {
super(PROCESSED_OBJECT_NAME, schema, source);
}
@Override
public ModuleType parse() throws ParsingException {
return new ModuleType().setName(getName())
.setProperties(getProperties())
.setParameters(getParameters());
}
protected String getName() {
return getStringElement(NAME);
}
protected Map<String, Object> getProperties() {
return getMapElement(PROPERTIES);
}
protected Map<String, Object> getParameters() {
return getMapElement(PARAMETERS);
}
}
| 29.978723 | 79 | 0.699787 |
558784808159128a64115f969b6e706bdb0353ed | 3,061 | /**
* Copyright (c) 2013-2015 www.javahih.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
package com.hihsoft.sso.business.service;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import com.hihsoft.baseclass.service.BaseService;
import com.hihsoft.sso.util.BaseTestCase;
public class BaseServiceTestCase extends BaseTestCase {
@Autowired
BaseService svc;
@Test
public void testQeuryForList() {
long time = System.currentTimeMillis();
// String sql = "select t.modulename,t.moduleno,o.operatename from T_SYS_MODULEINFO t, t_sys_moduleoperate o where t.moduleid = o.moduleid";
// List<Map<String,Object>> list = svc.queryForPagedListBySQL(sql, 2, 20);
// final String pwd = Eryptogram.getUserPasswd("admin");
// svc.executeHQL("update TaclUserinfo u set u.userpw=? where u.userid='4028828530f7dfd30130f7dff01a014c'", pwd);
// String privilege = svc.getPrivilege("4028828530f7dfd30130f7dff01a014c");
// System.out.println(privilege);
// String directOrgId = svc.getDirectOrgId("4028818a33f3334e0133f38226f70270", "3");
// String orgid = svc.getSubOrgIds("4028828530f8df160130f8e4b7be0000");
// System.out.println(orgid);
// String[] names = { "分流部长", "储运部长", "仓管", "装卸工", "车管", "零担部长", "市场部长",
// "软件开发", "广告设计", "软件测试", "需求分析", "杂志主编", "公司行政人事", "股份总务主管",
// "股份业务主管", "站点会计", "业务部长", "信息部长", "副省经理", "组长", "后勤", "数据库维护",
// "站点出纳","软件开发","广告设计","软件测试","需求分析","杂志主编" };
//
// svc.executeSQL("delete from t_acl_roleprivilege where roleid in(select roleid from t_acl_role where rolename in ("+StringHelpers.join(names)+"))");
// String roleId = "4028828c355ba19701355ba6d2220001";
// List<TaclRoleprivilege> pri = svc.getValueObjectsByHQL("from TaclRoleprivilege where roleid=?", roleId);
// List<TaclRole> roles = svc.getValueObjectsByHQL("from TaclRole where rolename in ("+StringHelpers.join(names)+")");
// for (TaclRole role : roles) {
// List<TaclRoleprivilege> roleSet = new ArrayList<TaclRoleprivilege>();
// for (TaclRoleprivilege p : pri) {
// TaclRoleprivilege copy = new TaclRoleprivilege();
// copy.setRoleid(role.getRoleid());
// copy.setModuleid(p.getModuleid());
// copy.setOperateid(p.getOperateid());
// roleSet.add(copy);
// }
// svc.saveOrUpdateBatchVO(roleSet);
// }
// int index = 0;
// for (String name : names) {
// TaclRole r = new TaclRole();
// r.setRolename(name);
// r.setRemark(name);
// r.setOrgid("4028828530f7dfd30130f7dfef9d002b");
// r.setRoletype(index >= 23 ? "1" : "2");
// r.setRoleSort("1");
// svc.saveOrUpdateVO(r);
// List<TaclRoleprivilege> roleSet = new ArrayList<TaclRoleprivilege>();
// for (TaclRoleprivilege p : pri) {
// TaclRoleprivilege copy = new TaclRoleprivilege();
// copy.setRoleid(r.getRoleid());
// copy.setModuleid(p.getModuleid());
// copy.setOperateid(p.getOperateid());
// roleSet.add(copy);
// }
// svc.saveOrUpdateBatchVO(roleSet);
// index++;
// }
}
}
| 41.931507 | 152 | 0.67625 |
459bd503023e7c6d2e8cc4942168e89fb7e27612 | 342 | package com.svn.gsheetsserviceaccount.repositories;
import com.svn.gsheetsserviceaccount.model.Contact;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.repository.MongoRepository;
public interface ContactRepository extends MongoRepository<Contact, ObjectId> {
public boolean existsContactByCode(String code);
}
| 31.090909 | 79 | 0.842105 |
c187dbde934cd7c2ad14e5919382c679307431ab | 6,388 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.sysds.test.functions.builtin.part2;
import org.apache.sysds.common.Types;
import org.apache.sysds.runtime.matrix.data.MatrixValue;
import org.apache.sysds.test.AutomatedTestBase;
import org.apache.sysds.test.TestConfiguration;
import org.apache.sysds.test.TestUtils;
import org.junit.Test;
import java.util.HashMap;
public class BuiltinXgBoostTest_regression extends AutomatedTestBase {
private final static String TEST_NAME = "xgboost_regression";
private final static String TEST_DIR = "functions/builtin/";
private static final String TEST_CLASS_DIR = TEST_DIR + BuiltinXgBoostTest_regression.class.getSimpleName() + "/";
double eps = 1e-10;
@Override
public void setUp() {
TestUtils.clearAssertionInformation();
addTestConfiguration(TEST_NAME, new TestConfiguration(TEST_CLASS_DIR, TEST_NAME, new String[]{"C"}));
}
@Test
public void testXgBoost() {
executeXgBoost(Types.ExecMode.SINGLE_NODE);
}
private void executeXgBoost(Types.ExecMode mode) {
Types.ExecMode platformOld = setExecMode(mode);
try {
loadTestConfiguration(getTestConfiguration(TEST_NAME));
String HOME = SCRIPT_DIR + TEST_DIR;
fullDMLScriptName = HOME + TEST_NAME + ".dml";
programArgs = new String[]{"-args", input("X"), input("y"), input("R"), input("sml_type"),
input("num_trees"), output("M")};
double[][] y = {
{5.0},
{1.9},
{10.0},
{8.0},
{0.7}};
double[][] X = {
{4.5, 4.0, 3.0, 2.8, 3.5},
{1.9, 2.4, 1.0, 3.4, 2.9},
{2.0, 1.1, 1.0, 4.9, 3.4},
{2.3, 5.0, 2.0, 1.4, 1.8},
{2.1, 1.1, 3.0, 1.0, 1.9}};
double[][] R = {
{1.0, 1.0, 1.0, 1.0, 1.0}};
writeInputMatrixWithMTD("X", X, true);
writeInputMatrixWithMTD("y", y, true);
writeInputMatrixWithMTD("R", R, true);
runTest(true, false, null, -1);
HashMap<MatrixValue.CellIndex, Double> actual_M = readDMLMatrixFromOutputDir("M");
// root node of first tree
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(1,2)), 1.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(2,2)), 1.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(3,2)), 1.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(4,2)), 4.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(5,2)), 1.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(6,2)), 2.10, eps);
// random leaf node of first tree
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(1,8)), 7.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(2,8)), 1.0, eps);
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(3, 8))), "null");
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(4, 8))), "null");
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(5, 8))), "null");
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(6,8)), 5.0, eps);
// last node in first tree
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(1,10)), 13.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(2,10)), 1.0, eps);
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(3, 10))), "null");
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(4, 10))), "null");
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(5, 10))), "null");
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(6, 10))), "null");
// root node of second tree
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(1,11)), 1.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(2,11)), 2.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(3,11)), 1.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(4,11)), 4.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(5,11)), 1.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(6,11)), 2.10, eps);
// random leaf node of second tree
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(1,15)), 5.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(2,15)), 2.0, eps);
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(3, 15))), "null");
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(4, 15))), "null");
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(5, 15))), "null");
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(6,15)), 2.10, eps);
// last node in matrix and second tree
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(1,19)), 13.0, eps);
TestUtils.compareScalars(actual_M.get(new MatrixValue.CellIndex(2,19)), 2.0, eps);
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(3, 19))), "null");
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(4, 19))), "null");
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(5, 19))), "null");
TestUtils.compareScalars(String.valueOf(actual_M.get(new MatrixValue.CellIndex(6, 19))), "null");
}
catch (Exception ex) {
System.out.println("[ERROR] Xgboost test failed, cause: " + ex);
throw ex;
} finally {
rtplatform = platformOld;
}
}
}
| 45.628571 | 115 | 0.724953 |
22ea408d77732b8f93e334df21f6939553a5db26 | 10,274 | package gov.va.escreening.dto.ae;
import static com.google.common.base.Preconditions.*;
import com.google.common.base.Strings;
import gov.va.escreening.constants.AssessmentConstants;
import gov.va.escreening.entity.MeasureAnswer;
import gov.va.escreening.entity.MeasureAnswerBaseProperties;
import gov.va.escreening.entity.SurveyMeasureResponse;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.Serializable;
public class Answer implements Serializable, MeasureAnswerBaseProperties {
@SuppressWarnings("unused")
private static final Logger logger = LoggerFactory.getLogger(Answer.class);
/* Possible answer types
* These should all be lower case */
public enum Type{
NONE, OTHER, HEIGHT_FEET, HEIGHT_INCHES, TABLE_COLUMN;
public static Type fromString(String name){
if(name == null || name.isEmpty())
return null;
String lowerName = name.toLowerCase();
if(lowerName.equals("none"))
return NONE;
if(lowerName.equals("other"))
return OTHER;
if(lowerName.equals("feet"))
return HEIGHT_FEET;
if(lowerName.equals("inches"))
return HEIGHT_INCHES;
if(lowerName.equals("tablecolumn"))
return TABLE_COLUMN;
throw new IllegalArgumentException("Invalid Answer type: " + name);
}
}
private static final long serialVersionUID = 1L;
private Integer answerId;
private String answerText;
private String answerType;
private String answerResponse;
private String vistaText;
private String exportName;
private String otherAnswerResponse;
//set to answerResponse when this is a text answer, otherwise set to answerText
private String answerDisplayResponse;
private Integer rowId;
private String calculationType;
private String calculationValue;
private Integer displayOrder;
private String mhaValue;
@Override
public String getCalculationValue() {
return calculationValue;
}
@Override
public void setCalculationValue(String calculationValue) {
this.calculationValue = calculationValue;
}
public String getCalculationType() {
return calculationType;
}
public void setCalculationType(String calculationType) {
this.calculationType = calculationType;
}
@Override
public Integer getDisplayOrder() {
return displayOrder;
}
@Override
public void setDisplayOrder(Integer displayOrder) {
this.displayOrder = displayOrder;
}
@Override
public String getMhaValue() {
return mhaValue;
}
@Override
public void setMhaValue(String mhaValue) {
this.mhaValue = mhaValue;
}
@Override
public String getVistaText() {
return vistaText;
}
@Override
public void setVistaText(String vistaText) {
this.vistaText = vistaText;
}
@Override
public String getExportName() {
return exportName;
}
@Override
public void setExportName(String exportName) {
this.exportName = exportName;
}
@Override
public Integer getAnswerId() {
return answerId;
}
@Override
public void setAnswerId(Integer answerId) {
this.answerId = answerId;
}
@Override
public String getAnswerText() {
return answerText;
}
@Override
public void setAnswerText(String answerText) {
this.answerText = answerText;
}
@Override
public String getAnswerType() {
return answerType;
}
@Override
public void setAnswerType(String type) {
this.answerType = type;
}
@Override
public String getAnswerResponse() {
return answerResponse;
}
@Override
public void setAnswerResponse(String answerResponse) {
this.answerResponse = answerResponse;
}
@Override
public String getOtherAnswerResponse() {
return otherAnswerResponse;
}
@Override
public void setOtherAnswerResponse(String otherAnswerResponse) {
this.otherAnswerResponse = otherAnswerResponse;
}
@Override
public Integer getRowId() {
return rowId;
}
@Override
public void setRowId(Integer rowId) {
this.rowId = rowId;
}
/**
* Pseudo field used for AV Dto resolution.
* Takes care of what an answer's display text should be
* when used in templates.
* @return set to answerResponse when this is a text answer,
* otherwise set to answerText. Returns null if no response
* has been set.
*/
public String getAnswerDisplayResponse() {
return answerDisplayResponse;
}
private void setAnswerDisplayResponse(MeasureAnswer measureAnswer){
if(measureAnswer.getMeasure() == null){
throw new IllegalArgumentException("Answer " + measureAnswer.getMeasureAnswerId()
+ " is not associated with a measure. This means it was deleted using our forms editor. The call to this method should have checked for that.");
}
if(measureAnswer.getMeasure().getMeasureType().getMeasureTypeId()
== AssessmentConstants.MEASURE_TYPE_FREE_TEXT){
answerDisplayResponse = answerResponse;
}
else{
//The constraint has been removed which would set null here if the answer is of type none. Template functions do not assume
//this business rule but it is possible that the handwritten templates do. This constraint was lifted because it causes the
//delimited output of select multi to throw error since null was being returned here for the display text. PO would like to
//show the text of the None answer so null should not be returned.
answerDisplayResponse = answerText;
}
//logger.trace("Set answerDisplayResponse to: {}", answerDisplayResponse);
}
/**
* @return true if the response is set and can be interpreted as a boolean
*/
public boolean isTrue(){
return Boolean.valueOf(answerResponse);
}
public Answer() {}
public Answer(MeasureAnswer measureAnswer){
answerId = measureAnswer.getMeasureAnswerId();
answerText = measureAnswer.getAnswerText();
answerType = measureAnswer.getAnswerType();
vistaText = measureAnswer.getVistaText();
exportName = measureAnswer.getExportName();
//TODO: Remove this when the use of calculation type is removed
calculationType=measureAnswer.getCalculationType()==null?null:measureAnswer.getCalculationType().getName();
calculationValue=measureAnswer.getCalculationValue();
displayOrder = measureAnswer.getDisplayOrder();
mhaValue = measureAnswer.getMhaValue();
}
public Answer(MeasureAnswer measureAnswer, SurveyMeasureResponse measureResponse){
this(measureAnswer);
//logger.trace("Creating answer using measure answer {} with response {}", measureAnswer, measureResponse);
checkNotNull(measureResponse, "measureResponse is required");
//set user response
rowId = measureResponse.getTabularRow();
if (StringUtils.isNotBlank(measureResponse.getOtherValue())) {
otherAnswerResponse = measureResponse.getOtherValue();
}
if (measureResponse.getNumberValue() != null) {
answerResponse = measureResponse.getNumberValue().toString();
}
else if (measureResponse.getBooleanValue() != null) {
answerResponse = measureResponse.getBooleanValue().toString();
}
else if (!Strings.isNullOrEmpty(measureResponse.getTextValue())) {
answerResponse = measureResponse.getTextValue();
}
setAnswerDisplayResponse(measureAnswer);
}
/**
* Constructor which builds an answer with the DB field values given by the measureAnswer and then applies any
* responses to the object.
* @param measureAnswer contains the meta data fields from the database.
* @param otherAnswer the other Answer object to pull response values from
*/
public Answer(MeasureAnswer measureAnswer, Answer otherAnswer){
this(measureAnswer);
//logger.trace("Creating answer using measure answer {} and other answer {}", measureAnswer, otherAnswer);
checkNotNull(otherAnswer, "otherAnswer is required");
setRowId(otherAnswer.getRowId());
setAnswerResponse(otherAnswer.getAnswerResponse());
if (StringUtils.isNotBlank(otherAnswer.getOtherAnswerResponse())) {
setOtherAnswerResponse(otherAnswer.getOtherAnswerResponse());
}
if(otherAnswer.getAnswerDisplayResponse() != null){
answerDisplayResponse = otherAnswer.getAnswerDisplayResponse();
}
else{
setAnswerDisplayResponse(measureAnswer);
}
}
public Answer(Integer answerId, String answerText, String answerResponse) {
this.answerId = answerId;
this.answerText = answerText;
this.answerResponse = answerResponse;
//logger.trace("Creating with: answerId {}, answerText {}, answerResponse {}", new Object[]{ answerId, answerText, answerResponse});
}
@Override
public String toString() {
return "Answer [answerId=" + answerId + ", answerText=" + answerText + ", hasOther=" + answerType
+ ", answerResponse=" + answerResponse + ", otherAnswerResponse=" + otherAnswerResponse + ", rowId:" + rowId
+ ", displayOrder=" + displayOrder + ", calculationValue=" + calculationValue + ", mhaValue=" + mhaValue + "]";
}
}
| 33.357143 | 165 | 0.638018 |
698efc1fcd5c6f2becc86b542fa01ded41a06aa4 | 785 | package com.sinotrans.transport.dto.out;
import com.sinotrans.transport.dto.common.RestResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by jason on 2016/5/18.
*/
public class QueryCrmResponse extends RestResponse {
List<Map<String,Object>> crms = new ArrayList<Map<String,Object>>();
public List<Map<String, Object>> getCrms() {
return crms;
}
public void setCrms(List<Map<String, Object>> crms) {
this.crms = crms;
}
public QueryCrmResponse() {
super();
}
public QueryCrmResponse(List<Map<String, Object>> crms) {
this();
this.crms = crms;
}
public QueryCrmResponse(int errorCode, String errorMsg) {
super(errorCode, errorMsg);
}
}
| 20.657895 | 72 | 0.650955 |
886ce105e82bc5f305e7d64c4393e3882dfab99f | 16,039 | /*
* Copyright 2020 The Apache Software Foundation.
*
* 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.apache.activemq.artemis.jdbc.store.file;
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.net.URLClassLoader;
import java.sql.Array;
import java.sql.Blob;
import java.sql.CallableStatement;
import java.sql.Clob;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.NClob;
import java.sql.PreparedStatement;
import java.sql.SQLClientInfoException;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.SQLXML;
import java.sql.Savepoint;
import java.sql.Statement;
import java.sql.Struct;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.Executor;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import org.junit.Test;
public class PostgresLargeObjectManagerTest {
@Test
public void testShouldNotUseReflection() throws SQLException {
PostgresLargeObjectManager manager = new PostgresLargeObjectManager(new MockConnection());
try {
manager.createLO();
fail("Shouldn't be using reflection");
} catch (ClassCastException ex) {
}
}
@Test
public void testShouldUseReflection() throws SQLException, ClassNotFoundException, NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
ClassLoader loader = new FunkyClassLoader();
Class funkyClass = loader.loadClass("org.apache.activemq.artemis.jdbc.store.file.PostgresLargeObjectManager");
Object manager = funkyClass.getConstructor(Connection.class).newInstance(new MockConnection());
try {
funkyClass.getMethod("createLO").invoke(manager);
fail("Shouldn't be using reflection");
} catch (java.lang.reflect.InvocationTargetException ex) {
assertEquals("Couldn't access org.postgresql.largeobject.LargeObjectManager", ex.getCause().getMessage());
}
}
private static final class FunkyClassLoader extends URLClassLoader {
private FunkyClassLoader() {
super(new URL[]{
FunkyClassLoader.class.getProtectionDomain().getCodeSource().getLocation(),
PostgresLargeObjectManager.class.getProtectionDomain().getCodeSource().getLocation()
},
ClassLoader.getSystemClassLoader());
}
@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if ("org.postgresql.PGConnection".equals(name)) {
throw new ClassNotFoundException(name);
}
if ("org.apache.activemq.artemis.jdbc.store.file.PostgresLargeObjectManager".equals(name)) {
return this.findClass(name);
}
return super.loadClass(name);
}
}
private static final class MockConnection implements Connection {
@Override
public Statement createStatement() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PreparedStatement prepareStatement(String sql) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public CallableStatement prepareCall(String sql) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String nativeSQL(String sql) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setAutoCommit(boolean autoCommit) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean getAutoCommit() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void commit() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void rollback() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void close() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean isClosed() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public DatabaseMetaData getMetaData() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setReadOnly(boolean readOnly) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean isReadOnly() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setCatalog(String catalog) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getCatalog() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setTransactionIsolation(int level) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public int getTransactionIsolation() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public SQLWarning getWarnings() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void clearWarnings() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Map<String, Class<?>> getTypeMap() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setTypeMap(Map<String, Class<?>> map) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setHoldability(int holdability) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public int getHoldability() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Savepoint setSavepoint() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Savepoint setSavepoint(String name) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void rollback(Savepoint savepoint) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void releaseSavepoint(Savepoint savepoint) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Clob createClob() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Blob createBlob() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public NClob createNClob() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public SQLXML createSQLXML() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public boolean isValid(int timeout) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setClientInfo(String name, String value) throws SQLClientInfoException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setClientInfo(Properties properties) throws SQLClientInfoException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getClientInfo(String name) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Properties getClientInfo() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Array createArrayOf(String typeName, Object[] elements) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public Struct createStruct(String typeName, Object[] attributes) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setSchema(String schema) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public String getSchema() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void abort(Executor executor) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public void setNetworkTimeout(Executor executor, int milliseconds) throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public int getNetworkTimeout() throws SQLException {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public <T> T unwrap(Class<T> iface) throws SQLException {
return (T) this;
}
@Override
public boolean isWrapperFor(Class<?> iface) throws SQLException {
return false;
}
}
}
| 44.184573 | 184 | 0.712451 |
5d7192a77364b15804d4a7b11036cebbc67a82fa | 935 | package Chapter07.P162_GetPublicAndPrivateFields.src.modern.challenge;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
Class<Melon> clazz = Melon.class;
Field[] fields = clazz.getDeclaredFields();
List<Field> publicFields = new ArrayList<>();
List<Field> privateFields = new ArrayList<>();
for (Field field : fields) {
if (Modifier.isPublic(field.getModifiers())) {
publicFields.add(field);
}
if (Modifier.isPrivate(field.getModifiers())) {
privateFields.add(field);
}
}
System.out.println("Public fields: ");
System.out.println(publicFields);
System.out.println("\nPrivate fields: ");
System.out.println(privateFields);
}
}
| 25.27027 | 70 | 0.616043 |
5ab2274642db56f15f69fb3cf33edce59bab2b14 | 10,324 | /*
* __ .__ .__ ._____.
* _/ |_ _______ __|__| ____ | | |__\_ |__ ______
* \ __\/ _ \ \/ / |/ ___\| | | || __ \ / ___/
* | | ( <_> > <| \ \___| |_| || \_\ \\___ \
* |__| \____/__/\_ \__|\___ >____/__||___ /____ >
* \/ \/ \/ \/
*
* Copyright (c) 2006-2011 Karsten Schmidt
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* http://creativecommons.org/licenses/LGPL/2.1/
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
package toxi.geom;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import toxi.geom.Line3D.LineIntersection.Type;
import toxi.math.MathUtils;
public class Line3D {
public static class LineIntersection {
public static enum Type {
NON_INTERSECTING,
INTERSECTING
}
private final Type type;
private final Line3D line;
private final float[] coeff;
private LineIntersection(Type type) {
this(type, null, 0, 0);
}
private LineIntersection(Type type, Line3D line, float mua, float mub) {
this.type = type;
this.line = line;
this.coeff = new float[] {
mua, mub
};
}
public float[] getCoefficients() {
return coeff;
}
public float getLength() {
return line.getLength();
}
/**
* @return the pos
*/
public Line3D getLine() {
return line.copy();
}
/**
* @return the type
*/
public Type getType() {
return type;
}
public boolean isIntersectionInside() {
return type == Type.INTERSECTING && coeff[0] >= 0 && coeff[0] <= 1
&& coeff[1] >= 0 && coeff[1] <= 1;
}
public String toString() {
return "type: " + type + " line: " + line;
}
}
/**
* Splits the line between A and B into segments of the given length,
* starting at point A. The tweened points are added to the given result
* list. The last point added is B itself and hence it is likely that the
* last segment has a shorter length than the step length requested. The
* first point (A) can be omitted and not be added to the list if so
* desired.
*
* @param a
* start point
* @param b
* end point (always added to results)
* @param stepLength
* desired distance between points
* @param segments
* existing array list for results (or a new list, if null)
* @param addFirst
* false, if A is NOT to be added to results
* @return list of result vectors
*/
public static final List<Vec3D> splitIntoSegments(Vec3D a, Vec3D b,
float stepLength, List<Vec3D> segments, boolean addFirst) {
if (segments == null) {
segments = new ArrayList<Vec3D>();
}
if (addFirst) {
segments.add(a.copy());
}
float dist = a.distanceTo(b);
if (dist > stepLength) {
Vec3D pos = a.copy();
Vec3D step = b.sub(a).limit(stepLength);
while (dist > stepLength) {
pos.addSelf(step);
segments.add(pos.copy());
dist -= stepLength;
}
}
segments.add(b.copy());
return segments;
}
@XmlElement
public Vec3D a, b;
public Line3D(float x1, float y1, float z1, float x2, float y2, float z2) {
this.a = new Vec3D(x1, y1, z1);
this.b = new Vec3D(x2, y2, z2);
}
public Line3D(ReadonlyVec3D a, ReadonlyVec3D b) {
this.a = a.copy();
this.b = b.copy();
}
public Line3D(Vec3D a, Vec3D b) {
this.a = a;
this.b = b;
}
/**
* Calculates the line segment that is the shortest route between this line
* and the given one. Also calculates the coefficients where the end points
* of this new line lie on the existing ones. If these coefficients are
* within the 0.0 .. 1.0 interval the endpoints of the intersection line are
* within the given line segments, if not then the intersection line is
* outside.
*
* <p>
* Code based on original by Paul Bourke:<br/>
* http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline3d/
* </p>
*/
public LineIntersection closestLineTo(Line3D l) {
Vec3D p43 = l.a.sub(l.b);
if (p43.isZeroVector()) {
return new LineIntersection(Type.NON_INTERSECTING);
}
Vec3D p21 = b.sub(a);
if (p21.isZeroVector()) {
return new LineIntersection(Type.NON_INTERSECTING);
}
Vec3D p13 = a.sub(l.a);
double d1343 = p13.x * p43.x + p13.y * p43.y + p13.z * p43.z;
double d4321 = p43.x * p21.x + p43.y * p21.y + p43.z * p21.z;
double d1321 = p13.x * p21.x + p13.y * p21.y + p13.z * p21.z;
double d4343 = p43.x * p43.x + p43.y * p43.y + p43.z * p43.z;
double d2121 = p21.x * p21.x + p21.y * p21.y + p21.z * p21.z;
double denom = d2121 * d4343 - d4321 * d4321;
if (MathUtils.abs(denom) < MathUtils.EPS) {
return new LineIntersection(Type.NON_INTERSECTING);
}
double numer = d1343 * d4321 - d1321 * d4343;
float mua = (float) (numer / denom);
float mub = (float) ((d1343 + d4321 * mua) / d4343);
Vec3D pa = a.add(p21.scaleSelf(mua));
Vec3D pb = l.a.add(p43.scaleSelf(mub));
return new LineIntersection(Type.INTERSECTING, new Line3D(pa, pb), mua,
mub);
}
/**
* Computes the closest point on this line to the given one.
*
* @param p
* point to check against
* @return closest point on the line
*/
public Vec3D closestPointTo(ReadonlyVec3D p) {
final Vec3D v = b.sub(a);
final float t = p.sub(a).dot(v) / v.magSquared();
// Check to see if t is beyond the extents of the line segment
if (t < 0.0f) {
return a.copy();
} else if (t > 1.0f) {
return b.copy();
}
// Return the point between 'a' and 'b'
return a.add(v.scaleSelf(t));
}
public Line3D copy() {
return new Line3D(a.copy(), b.copy());
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
if (this == obj) {
return true;
}
if (!(obj instanceof Line3D)) {
return false;
}
Line3D l = (Line3D) obj;
return (a.equals(l.a) || a.equals(l.b))
&& (b.equals(l.b) || b.equals(l.a));
}
/**
* Returns the line's axis-aligned bounding box.
*
* @return aabb
* @see toxi.geom.AABB
*/
public AABB getBounds() {
return AABB.fromMinMax(a, b);
}
public Vec3D getDirection() {
return b.sub(a).normalize();
}
public float getLength() {
return a.distanceTo(b);
}
public float getLengthSquared() {
return a.distanceToSquared(b);
}
public Vec3D getMidPoint() {
return a.add(b).scaleSelf(0.5f);
}
public Vec3D getNormal() {
return b.cross(a);
}
public boolean hasEndPoint(Vec3D p) {
return a.equals(p) || b.equals(p);
}
/**
* Computes a hash code ignoring the directionality of the line.
*
* @return hash code
*
* @see java.lang.Object#hashCode()
* @see #hashCodeWithDirection()
*/
public int hashCode() {
return a.hashCode() + b.hashCode();
}
/**
* Computes the hash code for this instance taking directionality into
* account. A->B will produce a different hash code than B->A. If
* directionality is not required or desired use the default
* {@link #hashCode()} method.
*
* @return hash code
*
* @see #hashCode()
*/
public int hashCodeWithDirection() {
long bits = 1L;
bits = 31L * bits + a.hashCode();
bits = 31L * bits + b.hashCode();
return (int) (bits ^ (bits >> 32));
}
public Line3D offsetAndGrowBy(float offset, float scale, Vec3D ref) {
Vec3D m = getMidPoint();
Vec3D d = getDirection();
Vec3D n = a.cross(d).normalize();
if (ref != null && m.sub(ref).dot(n) < 0) {
n.invert();
}
n.normalizeTo(offset);
a.addSelf(n);
b.addSelf(n);
d.scaleSelf(scale);
a.subSelf(d);
b.addSelf(d);
return this;
}
public Line3D scaleLength(float scale) {
float delta = (1 - scale) * 0.5f;
Vec3D newA = a.interpolateTo(b, delta);
b.interpolateToSelf(a, delta);
a.set(newA);
return this;
}
public Line3D set(ReadonlyVec3D a, ReadonlyVec3D b) {
this.a = a.copy();
this.b = b.copy();
return this;
}
public Line3D set(Vec3D a, Vec3D b) {
this.a = a;
this.b = b;
return this;
}
public List<Vec3D> splitIntoSegments(List<Vec3D> segments,
float stepLength, boolean addFirst) {
return splitIntoSegments(a, b, stepLength, segments, addFirst);
}
public Ray3D toRay3D() {
return new Ray3D(a.copy(), getDirection());
}
public String toString() {
return a.toString() + " -> " + b.toString();
}
}
| 29.413105 | 80 | 0.5432 |
308d9f079db47749ac6ba739c89d5a2b844aef90 | 1,614 | package se.david.moviesimporter.importers;
import java.io.IOException;
import java.util.List;
import java.util.function.Consumer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import se.david.moviesimporter.domain.tmdb.ProductionCompany;
import se.david.moviesimporter.repository.CompanyRepository;
import se.david.moviesimporter.util.RestTemplateFetcher;
@Service
public class CompanyImporter extends BaseImporter {
private final CompanyRepository companyRepository;
public CompanyImporter(CompanyRepository companyRepository) {
this.companyRepository = companyRepository;
}
public String processEntity(long companyId) {
String url = String.format("%s/3/company/%s?api_key=%s", tmdbApiUrl, companyId, apiKey);
try {
RestTemplateFetcher.fetch(url, ProductionCompany.class)
.ifPresentOrElse(handleProcessed(companyId), handleDeleted(companyId));
return String.format("Fetched company: %s", companyId);
} catch (IOException e) {
e.printStackTrace();
return String.format("Error fetching company: %s. %s", companyId, e.getMessage());
}
}
private Runnable handleDeleted(long personId) {
return () -> companyRepository.deleteByIdWithTransaction(personId);
}
private Consumer<ProductionCompany> handleProcessed(long personId) {
return result -> companyRepository.findById(personId)
.ifPresent(company -> {
company.processInfo(result);
companyRepository.saveAndFlush(company);
});
}
@Override
public List<Long> findAllUnprocessed() {
return companyRepository.findAllUnprocessed();
}
}
| 31.647059 | 90 | 0.780669 |
5b4eb7c8dc574dbb48dd1bd3f8830bb7e45380ad | 1,375 | package es.luepg.es.worlddata;
import java.util.Collection;
import java.util.List;
/**
* Applies custom overrides
*
* @author elmexl
* Created on 28.05.2019.
*/
public class ManualOverrides {
/**
* Custom renaming for properties
* @param blockname the blockname (reversed order)
* @param propertyName the name of the property
* @param values the values of the property
* @return the blockname to use
*/
static String customRenaming(String blockname, String propertyName, Collection<String> values) {
switch (blockname) {
case "DAEH_NOTSIP": //PISTON_HEAD
case "NOTSIP_GNIVOM": //MOVING_PISTON
return "NOTSIP"; // PISTON
}
if (propertyName.equals("face")) {
if (blockname.contains("NOTTUB") // contains Button
|| blockname.equals("REVEL") // LEVER
|| blockname.equals("ENOTSDNIRG") // GRINDSTONE
)
return "GNICAF"; // FACING
} else if (propertyName.equals("half") && values.contains("top")) { // Handle slabs, stairs, etc
return "KCOLBFLAH"; //HALFBLOCK
} else if (propertyName.equals("half") && values.contains("upper")) { // Blocks as doors, tall grass, ...
return "KCOLB"; //BLOCK
}
return blockname;
}
}
| 32.738095 | 113 | 0.584 |
9d933c7e8f628c2aff70e9a94d94a405ae8c8f8a | 1,333 | /*
* Copyright (C) 2019-2021 ConnectorIO Sp. z o.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* SPDX-License-Identifier: Apache-2.0
*/
package org.connectorio.addons.profile.internal;
import java.util.concurrent.ScheduledExecutorService;
import org.openhab.core.config.core.Configuration;
import org.openhab.core.thing.profiles.ProfileContext;
public class SubProfileContext implements ProfileContext {
private final ProfileContext parent;
private final Configuration config;
public SubProfileContext(ProfileContext parent, Configuration config) {
this.parent = parent;
this.config = config;
}
@Override
public Configuration getConfiguration() {
return config;
}
@Override
public ScheduledExecutorService getExecutorService() {
return parent.getExecutorService();
}
}
| 29.622222 | 75 | 0.756939 |
824226497bde67c3df22f288fb0c58b7b6fa1720 | 110 |
public class HelloWorld3 {
public static void main(String[] args) {
System.out.println("TESTE");
}
}
| 10 | 41 | 0.663636 |
590f3c76d6b8806cffc4d0e33ac1536887978961 | 1,069 | package com.mtapo.app.entity;
import lombok.*;
import javax.persistence.*;
import javax.validation.constraints.Email;
import java.util.Set;
@NoArgsConstructor
@AllArgsConstructor
@Setter
@Getter
@ToString
@Entity
@Table(name = "user")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private Integer id;
@Column(name = "first_name", nullable = false)
private String firstName;
@Column(name = "last_name", nullable = false)
private String lastName;
@Email
@Column(name = "email", nullable = false, unique = true)
private String email;
@Column(name = "password", nullable = false)
private String password;
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "user_role",
joinColumns = @JoinColumn(name = "id_user", nullable = false),
inverseJoinColumns = @JoinColumn(name = "id_role"))
private Set<Role> roles;
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "id_category")
private Category category;
}
| 23.23913 | 74 | 0.679139 |
b22bd4db8cc8b2559c725b7990bc8b085bee260b | 5,868 | package org.jacobvv.calendar.model;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
import org.jacobvv.calendar.model.BaseLunarDataSource.GetLunarCallback;
import org.jacobvv.calendar.util.Utils;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
/**
* An imputable representation of a day on a calendar
* <p>
* Created by hui.yin on 2017/5/25.
*/
public class CalendarInfo implements Parcelable {
public static CalendarInfo TODAY = CalendarInfo.today();
/**
* Get a new instance set to getCurrentDate
*
* @return CalendarDay set to getCurrentDate's mDate
*/
@NonNull
private static CalendarInfo today() {
return from(Calendar.getInstance());
}
/**
* Get a new instance set to the specified day
*
* @param year new instance's year
* @param month new instance's month as range of 1~12
* @param day new instance's day of month
* @return CalendarDay set to the specified mDate
*/
@NonNull
public static CalendarInfo from(int year, int month, int day) {
return new CalendarInfo(year, month, day);
}
/**
* Get a new instance set to the specified day
*
* @param calendar {@linkplain Calendar} to pull mDate information from. Passing null will return null
* @return CalendarDay set to the specified mDate
*/
public static CalendarInfo from(@NonNull Calendar calendar) {
return new CalendarInfo(
Utils.getYear(calendar),
Utils.getMonth(calendar),
Utils.getDay(calendar)
);
}
/**
* Get a new instance set to the specified day
*
* @param date {@linkplain Date} to pull mDate information from. Passing null will return null.
* @return CalendarDay set to the specified mDate
*/
public static CalendarInfo from(@NonNull Date date) {
return from(Utils.fromDate(date));
}
@NonNull
private final BaseInfo mSolar;
private LunarInfo mLunar;
private int flag = 0;
private List<GetLunarCallback> mCallbacks = new ArrayList<>();
private GetLunarCallback Callback = new GetLunarCallback() {
@Override
public void onLunarLoaded(LunarInfo info) {
mLunar = info;
for (GetLunarCallback callback : mCallbacks) {
callback.onLunarLoaded(info);
}
mCallbacks.clear();
}
@Override
public void onDataNotAvailable() {
for (GetLunarCallback callback : mCallbacks) {
callback.onDataNotAvailable();
}
mCallbacks.clear();
}
};
/**
* Cache for calls to {@linkplain #getCalendar(Calendar)}
*/
private transient Calendar _calendar;
/**
* Cache for calls to {@linkplain #getDate()}
*/
private transient Date _date;
private CalendarInfo(int year, int month, int day) {
mSolar = new BaseInfo(year, month, day);
LunarCalendarProvider.getInstance().getLunar(mSolar, Callback);
}
@NonNull
public BaseInfo getSolar() {
return mSolar;
}
public LunarInfo getLunar() {
return mLunar;
}
public void getLunar(GetLunarCallback callback) {
if (mLunar != null) {
callback.onLunarLoaded(mLunar);
} else {
mCallbacks.add(callback);
}
}
public int getFlag() {
return 0;
}
public List<String> getHolidays() {
return null;
}
@NonNull
public Calendar getCalendar(Calendar cache) {
if (cache == null) {
if (_calendar != null) {
cache = _calendar;
} else {
cache = Calendar.getInstance();
_calendar = cache;
}
}
cache.clear();
cache.set(mSolar.getYear(), mSolar.getMonth() - 1, mSolar.getDay());
return cache;
}
@NonNull
public Date getDate() {
if (_date == null) {
_date = getCalendar(null).getTime();
}
return _date;
}
public boolean isBefore(CalendarInfo other) {
return mSolar.isBefore(other.getSolar());
}
public boolean isAfter(CalendarInfo other) {
return mSolar.isAfter(other.getSolar());
}
public boolean inRange(@NonNull CalendarInfo minDate, @NonNull CalendarInfo maxDate) {
return mSolar.inRange(minDate.getSolar(), maxDate.getSolar());
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
CalendarInfo that = (CalendarInfo) o;
return mSolar.equals(that.mSolar);
}
@Override
public int hashCode() {
return mSolar.hashCode();
}
protected CalendarInfo(Parcel in) {
mSolar = in.readParcelable(BaseInfo.class.getClassLoader());
mLunar = in.readParcelable(BaseInfo.class.getClassLoader());
flag = in.readInt();
if (mLunar == null) {
LunarCalendarProvider.getInstance().getLunar(mSolar, Callback);
}
}
public static final Creator<CalendarInfo> CREATOR = new Creator<CalendarInfo>() {
@Override
public CalendarInfo createFromParcel(Parcel in) {
return new CalendarInfo(in);
}
@Override
public CalendarInfo[] newArray(int size) {
return new CalendarInfo[size];
}
};
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(mSolar, flags);
dest.writeParcelable(mLunar, flags);
dest.writeInt(flag);
}
}
| 26.313901 | 106 | 0.605658 |
c2fa9e6e91208b0572695431e7cbddf6b444ba5f | 4,109 | /*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.frauddetector.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;
/**
* <p>
* The KMS key details.
* </p>
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/frauddetector-2019-11-15/KMSKey" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class KMSKey implements Serializable, Cloneable, StructuredPojo {
/**
* <p>
* The encryption key ARN.
* </p>
*/
private String kmsEncryptionKeyArn;
/**
* <p>
* The encryption key ARN.
* </p>
*
* @param kmsEncryptionKeyArn
* The encryption key ARN.
*/
public void setKmsEncryptionKeyArn(String kmsEncryptionKeyArn) {
this.kmsEncryptionKeyArn = kmsEncryptionKeyArn;
}
/**
* <p>
* The encryption key ARN.
* </p>
*
* @return The encryption key ARN.
*/
public String getKmsEncryptionKeyArn() {
return this.kmsEncryptionKeyArn;
}
/**
* <p>
* The encryption key ARN.
* </p>
*
* @param kmsEncryptionKeyArn
* The encryption key ARN.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public KMSKey withKmsEncryptionKeyArn(String kmsEncryptionKeyArn) {
setKmsEncryptionKeyArn(kmsEncryptionKeyArn);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getKmsEncryptionKeyArn() != null)
sb.append("KmsEncryptionKeyArn: ").append(getKmsEncryptionKeyArn());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof KMSKey == false)
return false;
KMSKey other = (KMSKey) obj;
if (other.getKmsEncryptionKeyArn() == null ^ this.getKmsEncryptionKeyArn() == null)
return false;
if (other.getKmsEncryptionKeyArn() != null && other.getKmsEncryptionKeyArn().equals(this.getKmsEncryptionKeyArn()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getKmsEncryptionKeyArn() == null) ? 0 : getKmsEncryptionKeyArn().hashCode());
return hashCode;
}
@Override
public KMSKey clone() {
try {
return (KMSKey) super.clone();
} catch (CloneNotSupportedException e) {
throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e);
}
}
@com.amazonaws.annotation.SdkInternalApi
@Override
public void marshall(ProtocolMarshaller protocolMarshaller) {
com.amazonaws.services.frauddetector.model.transform.KMSKeyMarshaller.getInstance().marshall(this, protocolMarshaller);
}
}
| 29.992701 | 137 | 0.639572 |
7c76a29f8e773551d45f1823af243094cec5278f | 2,266 | package org.hydev.veracross.sdk.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* This class is the data POJO class for faculty and staff directory:
* https://portals-app.veracross.com/.../student/directory/faculty
* API:
* https://portals-app.veracross.com/.../directory/entries.json?directory=faculty&portal=student&refresh=0
* <p>
* Class created by the HyDEV Team on 2019-09-14!
*
* @author HyDEV Team (https://github.com/HyDevelop)
* @author Hykilpikonna (https://github.com/hykilpikonna)
* @author Vanilla (https://github.com/VergeDX)
* @since 2019-09-14 15:47
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class VeraFaculty implements VeraData
{
@SerializedName("person_pk")
@Expose
private Integer personPk;
@SerializedName("is_faculty")
@Expose
private Byte isFaculty;
@SerializedName("first_name")
@Expose
private String firstName;
@SerializedName("nick_name")
@Expose
private String nickName;
@SerializedName("last_name")
@Expose
private String lastName;
@SerializedName("spouse")
@Expose
private String spouse;
@SerializedName("address")
@Expose
private String address;
@SerializedName("job_title")
@Expose
private String jobTitle;
@SerializedName("faculty_type")
@Expose
private String facultyType;
@SerializedName("phone_home")
@Expose
private String phoneHome;
@SerializedName("phone_business")
@Expose
private String phoneBusiness;
@SerializedName("cell")
@Expose
private String cell;
@SerializedName("email")
@Expose
private String email;
@SerializedName("photo_url")
@Expose
private String photoUrl;
@SerializedName("map_url")
@Expose
private String mapUrl;
@SerializedName("school_level_id")
@Expose
private String schoolLevelId;
@SerializedName("department_id")
@Expose
private Short departmentId;
@SerializedName("campus_id")
@Expose
private Short campusId;
@SerializedName("faculty_type_id")
@Expose
private Short facultyTypeId;
}
| 22 | 106 | 0.704766 |
77d3e057791b7f65d23224db6881d77c6662f5f5 | 317 | package org.adorsys.adpharma.client.jpa.documentstore;
import org.adorsys.javafx.crud.extensions.InitialScreenController;
public class DocumentStoreIntialScreenController extends InitialScreenController<DocumentStore>
{
@Override
public DocumentStore newEntity()
{
return new DocumentStore();
}
}
| 24.384615 | 95 | 0.798107 |
ef80f6d0a38c63ad10a1e044559b10b72914fe05 | 9,499 | package com.weikaiyun.fragmentation;
import android.os.Bundle;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.core.app.ActivityCompat;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import com.weikaiyun.fragmentation.animation.FragmentAnimator;
import com.weikaiyun.fragmentation.debug.DebugStackDelegate;
import com.weikaiyun.fragmentation.queue.Action;
import java.util.List;
public class SupportActivityDelegate {
private final ISupportActivity mSupport;
private final FragmentActivity mActivity;
private TransactionDelegate mTransactionDelegate;
private final DebugStackDelegate mDebugStackDelegate;
private int mDefaultFragmentBackground = 0;
private FragmentAnimator mFragmentAnimator = new FragmentAnimator();
static final String S_FRAGMENTATION_FRAGMENT_ANIMATOR = "s_fragmentation_fragment_animator";
public SupportActivityDelegate(ISupportActivity support) {
if (!(support instanceof FragmentActivity))
throw new RuntimeException("Must extends FragmentActivity/AppCompatActivity");
this.mSupport = support;
this.mActivity = (FragmentActivity) support;
this.mDebugStackDelegate = new DebugStackDelegate(this.mActivity);
}
/**
* Perform some extra transactions.
* 额外的事务:自定义Tag,操作非回退栈Fragment
*/
public ExtraTransaction extraTransaction() {
return new ExtraTransaction.ExtraTransactionImpl<>((FragmentActivity) mSupport,
getTopFragment(), getTransactionDelegate(), true);
}
public void onCreate(@Nullable Bundle savedInstanceState) {
if (savedInstanceState != null) {
FragmentAnimator animator = savedInstanceState.getParcelable(S_FRAGMENTATION_FRAGMENT_ANIMATOR);
if (animator != null) {
mFragmentAnimator = animator;
}
}
mTransactionDelegate = getTransactionDelegate();
mDebugStackDelegate.onCreate(Fragmentation.getDefault().getMode());
}
public void onSaveInstanceState(@NonNull Bundle outState) {
outState.putParcelable(S_FRAGMENTATION_FRAGMENT_ANIMATOR, mFragmentAnimator);
}
public void onPostCreate(@Nullable Bundle savedInstanceState) {
mDebugStackDelegate.onPostCreate(Fragmentation.getDefault().getMode());
}
public void onDestroy() {
mDebugStackDelegate.onDestroy();
}
public TransactionDelegate getTransactionDelegate() {
if (mTransactionDelegate == null) {
mTransactionDelegate = new TransactionDelegate(mSupport);
}
return mTransactionDelegate;
}
/**
* Causes the Runnable r to be added to the action queue.
* <p>
* The runnable will be run after all the previous action has been run.
* <p>
* 前面的事务全部执行后 执行该Action
*/
public void post(final Runnable runnable) {
mTransactionDelegate.post(runnable);
}
/**
* 不建议复写该方法,请使用 {@link #onBackPressedSupport} 代替
*/
public void onBackPressed() {
mTransactionDelegate.mActionQueue.enqueue(new Action(Action.ACTION_BACK) {
@Override
public void run() {
// 获取activeFragment:即从栈顶开始 状态为show的那个Fragment
ISupportFragment activeFragment =
SupportHelper.getActiveFragment(getSupportFragmentManager());
if (mTransactionDelegate.dispatchBackPressedEvent(activeFragment)) return;
mSupport.onBackPressedSupport();
}
});
}
/**
* 该方法回调时机为,Activity回退栈内Fragment的数量 小于等于1 时,默认finish Activity
* 请尽量复写该方法,避免复写onBackPress(),以保证SupportFragment内的onBackPressedSupport()回退事件正常执行
*/
public void onBackPressedSupport() {
List<Fragment> list = SupportHelper.getActiveFragments(getSupportFragmentManager());
int fragmentNum = 0;
for (Fragment f : list) {
if (f instanceof ISupportFragment
&& ((ISupportFragment) f).getSupportDelegate().isCanPop()
&& ((ISupportFragment) f).getSupportDelegate().isStartByFragmentation()) {
fragmentNum++;
}
}
if (fragmentNum > 0) {
pop();
} else {
ActivityCompat.finishAfterTransition(mActivity);
}
}
public FragmentAnimator getFragmentAnimator() {
return mFragmentAnimator;
}
public void setFragmentAnimator(FragmentAnimator mFragmentAnimator) {
this.mFragmentAnimator = mFragmentAnimator;
}
/**
* 加载根Fragment, 即Activity内的第一个Fragment 或 Fragment内的第一个子Fragment
*/
public void loadRootFragment(int containerId, ISupportFragment toFragment) {
mTransactionDelegate.loadRootTransaction(getSupportFragmentManager(),
containerId, toFragment);
}
/**
* 加载多个同级根Fragment,类似Wechat, QQ主页的场景
*/
public void loadMultipleRootFragment(int containerId, int showPosition, ISupportFragment... toFragments) {
mTransactionDelegate.loadMultipleRootTransaction(getSupportFragmentManager(),
containerId, showPosition, toFragments);
}
/**
* 这个的使用必须要注意
* show一个Fragment,hide其他同栈所有Fragment
* 使用该方法时,要确保同级栈内无多余的Fragment,(只有通过loadMultipleRootFragment()载入的Fragment)
* <p>
*
* 建议使用更明确的{@link #showHideFragment(ISupportFragment, ISupportFragment)}
*
* @param showFragment 需要show的Fragment
*/
public void showHideFragment(ISupportFragment showFragment) {
showHideFragment(showFragment, null);
}
/**
* show一个Fragment,hide一个Fragment
*
* @param showFragment 需要show的Fragment
* @param hideFragment 需要hide的Fragment
*/
public void showHideFragment(ISupportFragment showFragment, ISupportFragment hideFragment) {
mTransactionDelegate.showHideFragment(getSupportFragmentManager(), showFragment, hideFragment);
}
public void start(ISupportFragment toFragment) {
start(toFragment, ISupportFragment.STANDARD);
}
/**
* @param launchMode Similar to Activity's LaunchMode.
*/
public void start(ISupportFragment toFragment, @ISupportFragment.LaunchMode int launchMode) {
mTransactionDelegate.dispatchStartTransaction(getSupportFragmentManager(),
getTopFragment(), toFragment, 0, launchMode, TransactionDelegate.TYPE_ADD);
}
/**
* Launch an fragment for which you would like a result when it popped.
*/
public void startForResult(ISupportFragment toFragment, int requestCode) {
mTransactionDelegate.dispatchStartTransaction(getSupportFragmentManager(),
getTopFragment(), toFragment, requestCode, ISupportFragment.STANDARD,
TransactionDelegate.TYPE_ADD_RESULT);
}
/**
* Start the target Fragment and pop itself
*/
public void startWithPop(ISupportFragment toFragment) {
mTransactionDelegate.dispatchStartWithPopTransaction(getSupportFragmentManager(), getTopFragment(), toFragment);
}
public void startWithPopTo(ISupportFragment toFragment, Class<?> targetFragmentClass,
boolean includeTargetFragment) {
mTransactionDelegate.dispatchStartWithPopToTransaction(getSupportFragmentManager(),
getTopFragment(), toFragment, targetFragmentClass.getName(), includeTargetFragment);
}
public void replaceFragment(ISupportFragment toFragment) {
mTransactionDelegate.dispatchStartTransaction(getSupportFragmentManager(),
getTopFragment(), toFragment, 0, ISupportFragment.STANDARD,
TransactionDelegate.TYPE_REPLACE);
}
/**
* Pop the child fragment.
*/
public void pop() {
mTransactionDelegate.pop(getSupportFragmentManager());
}
/**
* Pop the last fragment transition from the manager's fragment
* back stack.
* <p>
* 出栈到目标fragment
*
* @param targetFragmentClass 目标fragment
* @param includeTargetFragment 是否包含该fragment
*/
public void popTo(Class<?> targetFragmentClass, boolean includeTargetFragment) {
popTo(targetFragmentClass, includeTargetFragment, null);
}
/**
* If you want to begin another FragmentTransaction immediately after popTo(), use this method.
* 如果你想在出栈后, 立刻进行FragmentTransaction操作,请使用该方法
*/
public void popTo(Class<?> targetFragmentClass, boolean includeTargetFragment,
Runnable afterPopTransactionRunnable) {
mTransactionDelegate.popTo(targetFragmentClass.getName(), includeTargetFragment,
afterPopTransactionRunnable, getSupportFragmentManager());
}
private FragmentManager getSupportFragmentManager() {
return mActivity.getSupportFragmentManager();
}
private ISupportFragment getTopFragment() {
return SupportHelper.getTopFragment(getSupportFragmentManager());
}
/**
* 当Fragment根布局 没有设定background属性时,
* Fragmentation默认使用Theme的android:windowbackground作为Fragment的背景,
* 可以通过该方法改变Fragment背景。
*/
public void setDefaultFragmentBackground(@DrawableRes int backgroundRes) {
mDefaultFragmentBackground = backgroundRes;
}
public int getDefaultFragmentBackground() {
return mDefaultFragmentBackground;
}
}
| 33.925 | 120 | 0.694599 |
eca42ac7c0d298c833294b5aabba96d8b62ed9c0 | 890 | package de.samply.share.client.quality.report.file.id.path;
import de.samply.share.client.quality.report.file.csvline.manager.QualityResultCsvLineManager002;
import de.samply.share.client.quality.report.file.excel.pattern.ExcelPattern002;
import de.samply.share.client.quality.report.file.metadata.txtcolumn.MetadataTxtColumnManager002;
public class IdPathManager002 extends
IdPathManagerImpl<QualityResultCsvLineManager002, ExcelPattern002,
MetadataTxtColumnManager002> {
@Override
public Class<QualityResultCsvLineManager002> getQualityResultCsvLineManagerClass() {
return QualityResultCsvLineManager002.class;
}
@Override
public Class<ExcelPattern002> getExcelPatternClass() {
return ExcelPattern002.class;
}
@Override
public Class<MetadataTxtColumnManager002> getMetadataTxtColumnManager() {
return MetadataTxtColumnManager002.class;
}
}
| 32.962963 | 97 | 0.819101 |
d931fcbf79157f4be25334e2106b38a3ef85e161 | 3,798 | package com.alibaba.tc.table;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.NavigableMap;
import java.util.TreeMap;
import static java.util.Objects.requireNonNull;
public class SortedTable {
private TreeMap<List<Comparable>, LinkedList<List<Comparable>>> sorted = new TreeMap<>(new Comparator<List<Comparable>>() {
@Override
public int compare(List<Comparable> o1, List<Comparable> o2) {
if (o1 == o2) {
return 0;
}
if (o1.size() != o2.size()) {
throw new IllegalArgumentException();
}
for (int i = 0; i < o1.size(); i++) {
int cmp = o1.get(i).compareTo(o2.get(i));
if (cmp == 0) {
continue;
}
return cmp;
}
return 0;
}
});
private final LinkedHashMap<String, Integer> columnName2Index = new LinkedHashMap<>();
private final String[] sortColumnNames;
private int size;
public SortedTable(Table table, String... sortColumnNames) {
for (int i = 0; i < table.getColumns().size(); i++) {
columnName2Index.put(table.getColumn(i).name(), i);
}
this.sortColumnNames = requireNonNull(sortColumnNames);
}
public void addRow(Table table, int row) {
List<Comparable> key = new ArrayList<>(sortColumnNames.length);
for (int i = 0; i < sortColumnNames.length; i++) {
key.add(table.getColumn(sortColumnNames[i]).get(row));
}
List<Comparable> record = new ArrayList<>(columnName2Index.keySet().size());
for (int i = 0; i < columnName2Index.keySet().size(); i++) {
record.add(table.getColumn(i).get(row));
}
LinkedList<List<Comparable>> rows = sorted.get(key);
if (null == rows) {
rows = new LinkedList<>();
sorted.put(key, rows);
}
rows.addLast(record);
size++;
}
public int countLessThan(long start) {
List<Comparable> toKey = new ArrayList<>(1);
toKey.add(start);
int sum = 0;
for (LinkedList<List<Comparable>> rowsForKey : sorted.headMap(toKey, false).values()) {
sum += rowsForKey.size();
}
return sum;
}
public void removeLessThan(long start) {
List<Comparable> toKey = new ArrayList<>(1);
toKey.add(start);
NavigableMap<List<Comparable>, LinkedList<List<Comparable>>> willRemove = sorted.headMap(toKey, false);
int remove = 0;
for (LinkedList<List<Comparable>> rowsForKey : willRemove.values()) {
remove += rowsForKey.size();
}
willRemove.clear();
size -= remove;
}
public void removeFirstRow() {
if (size < 1) {
throw new IllegalStateException("no row");
}
sorted.firstEntry().getValue().removeFirst();
if (sorted.firstEntry().getValue().size() <= 0) {
sorted.remove(sorted.firstKey());
}
size--;
}
public int size() {
return size;
}
public List<Row> rows() {
List<Row> rows = new ArrayList<>(size);
for (LinkedList<List<Comparable>> rowsForKey : sorted.values()) {
for (List<Comparable> row : rowsForKey) {
rows.add(new RowByList(columnName2Index, row));
}
}
return rows;
}
public void clear() {
sorted.clear();
size = 0;
}
public List<Comparable> firstKey() {
return sorted.firstKey();
}
public List<Comparable> lastKey() {
return sorted.lastKey();
}
}
| 28.772727 | 127 | 0.558452 |
5275af4d49697dc174065abf82d71d8a7b635bf9 | 29,216 | // This is a generated file. Not intended for manual editing.
package org.intellij.clojure.parser;
import com.intellij.lang.PsiBuilder;
import com.intellij.lang.PsiBuilder.Marker;
import static org.intellij.clojure.psi.ClojureTypes.*;
import static com.intellij.lang.parser.GeneratedParserUtilBase.*;
import com.intellij.psi.tree.IElementType;
import com.intellij.psi.tree.IFileElementType;
import com.intellij.lang.ASTNode;
import com.intellij.psi.tree.TokenSet;
import com.intellij.lang.PsiParser;
import com.intellij.lang.LightPsiParser;
import static org.intellij.clojure.parser.ClojureParserUtil.adapt_builder_;
import static org.intellij.clojure.parser.ClojureParserUtil.*;
@SuppressWarnings({"SimplifiableIfStatement", "UnusedAssignment"})
public class ClojureParser implements PsiParser, LightPsiParser {
public ASTNode parse(IElementType t, PsiBuilder b) {
parseLight(t, b);
return b.getTreeBuilt();
}
public void parseLight(IElementType t, PsiBuilder b) {
boolean r;
b = adapt_builder_(t, b, this, EXTENDS_SETS_);
Marker m = enter_section_(b, 0, _COLLAPSE_, null);
if (t instanceof IFileElementType) {
r = parse_root_(t, b, 0);
}
else {
r = false;
}
exit_section_(b, 0, m, t, r, true, TRUE_CONDITION);
}
protected boolean parse_root_(IElementType t, PsiBuilder b, int l) {
return root(b, l + 1);
}
public static final TokenSet[] EXTENDS_SETS_ = new TokenSet[] {
create_token_set_(C_ACCESS, C_CONSTRUCTOR, C_FORM, C_FUN,
C_KEYWORD, C_LIST, C_LITERAL, C_MAP,
C_REGEXP, C_SET, C_SYMBOL, C_VEC),
};
/* ********************************************************** */
// ('.' | '.-') symbol
public static boolean access(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "access")) return false;
if (!nextTokenIs(b, "<access>", C_DOT, C_DOTDASH)) return false;
boolean r;
Marker m = enter_section_(b, l, _COLLAPSE_, C_ACCESS, "<access>");
r = access_0(b, l + 1);
r = r && symbol(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
// '.' | '.-'
private static boolean access_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "access_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, C_DOT);
if (!r) r = consumeToken(b, C_DOTDASH);
exit_section_(b, m, null, r);
return r;
}
/* ********************************************************** */
// !<<space>> '.'
public static boolean access_left(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "access_left")) return false;
boolean r;
Marker m = enter_section_(b, l, _LEFT_, C_ACCESS, "<access left>");
r = access_left_0(b, l + 1);
r = r && consumeToken(b, C_DOT);
exit_section_(b, l, m, r, false, null);
return r;
}
// !<<space>>
private static boolean access_left_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "access_left_0")) return false;
boolean r;
Marker m = enter_section_(b, l, _NOT_);
r = !space(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// &('::' sym)
static boolean alias_condition(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "alias_condition")) return false;
boolean r;
Marker m = enter_section_(b, l, _AND_);
r = alias_condition_0(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
// '::' sym
private static boolean alias_condition_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "alias_condition_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeTokens(b, 0, C_COLONCOLON, C_SYM);
exit_section_(b, m, null, r);
return r;
}
/* ********************************************************** */
// "#_" form
public static boolean commented(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "commented")) return false;
if (!nextTokenIsFast(b, C_SHARP_COMMENT)) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_, C_COMMENTED, null);
r = consumeTokenFast(b, C_SHARP_COMMENT);
p = r; // pin = 1
r = r && form(b, l + 1);
exit_section_(b, l, m, r, p, null);
return r || p;
}
/* ********************************************************** */
// '#' skip symbol skip form
public static boolean constructor(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "constructor")) return false;
if (!nextTokenIs(b, "<form>", C_SHARP)) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_, C_CONSTRUCTOR, "<form>");
r = consumeToken(b, C_SHARP);
p = r; // pin = 1
r = r && report_error_(b, skip(b, l + 1));
r = p && report_error_(b, symbol(b, l + 1)) && r;
r = p && report_error_(b, skip(b, l + 1)) && r;
r = p && form(b, l + 1) && r;
exit_section_(b, l, m, r, p, null);
return r || p;
}
/* ********************************************************** */
// form_prefix form_prefix * form_upper | form_inner
public static boolean form(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "form")) return false;
boolean r;
Marker m = enter_section_(b, l, _COLLAPSE_, C_FORM, "<form>");
r = form_0(b, l + 1);
if (!r) r = form_inner(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
// form_prefix form_prefix * form_upper
private static boolean form_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "form_0")) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_);
r = form_prefix(b, l + 1);
p = r; // pin = 1
r = r && report_error_(b, form_0_1(b, l + 1));
r = p && form_upper(b, l + 1) && r;
exit_section_(b, l, m, r, p, null);
return r || p;
}
// form_prefix *
private static boolean form_0_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "form_0_1")) return false;
while (true) {
int c = current_position_(b);
if (!form_prefix(b, l + 1)) break;
if (!empty_element_parsed_guard_(b, "form_0_1", c)) break;
}
return true;
}
/* ********************************************************** */
// p_forms | s_forms | constructor
static boolean form_inner(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "form_inner")) return false;
boolean r;
r = p_forms(b, l + 1);
if (!r) r = s_forms(b, l + 1);
if (!r) r = constructor(b, l + 1);
return r;
}
/* ********************************************************** */
// metadata | reader_macro | commented
static boolean form_prefix(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "form_prefix")) return false;
boolean r;
r = metadata(b, l + 1);
if (!r) r = reader_macro(b, l + 1);
if (!r) r = commented(b, l + 1);
return r;
}
/* ********************************************************** */
// form_inner
public static boolean form_upper(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "form_upper")) return false;
boolean r;
Marker m = enter_section_(b, l, _COLLAPSE_ | _UPPER_, C_FORM, "<form>");
r = form_inner(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// '#' <<nospace>> '(' list_body ')'
public static boolean fun(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "fun")) return false;
if (!nextTokenIs(b, C_SHARP)) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_, C_FUN, null);
r = consumeToken(b, C_SHARP);
r = r && nospace(b, l + 1);
r = r && consumeToken(b, C_PAREN1);
p = r; // pin = '[\(\[\{]'
r = r && report_error_(b, list_body(b, l + 1));
r = p && consumeToken(b, C_PAREN2) && r;
exit_section_(b, l, m, r, p, null);
return r || p;
}
/* ********************************************************** */
// <<items_entry <<recover>> <<param>>>> *
static boolean items(PsiBuilder b, int l, Parser _recover, Parser _param) {
if (!recursion_guard_(b, l, "items")) return false;
Marker m = enter_section_(b, l, _NONE_);
while (true) {
int c = current_position_(b);
if (!items_entry(b, l + 1, _recover, _param)) break;
if (!empty_element_parsed_guard_(b, "items", c)) break;
}
exit_section_(b, l, m, true, false, _recover);
return true;
}
/* ********************************************************** */
// (not_eof <<recover>>) (commented | <<param>>)
static boolean items_entry(PsiBuilder b, int l, Parser _recover, Parser _param) {
if (!recursion_guard_(b, l, "items_entry")) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_);
r = items_entry_0(b, l + 1, _recover);
p = r; // pin = 1
r = r && items_entry_1(b, l + 1, _param);
exit_section_(b, l, m, r, p, form_recover_parser_);
return r || p;
}
// not_eof <<recover>>
private static boolean items_entry_0(PsiBuilder b, int l, Parser _recover) {
if (!recursion_guard_(b, l, "items_entry_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = not_eof(b, l + 1);
r = r && _recover.parse(b, l);
exit_section_(b, m, null, r);
return r;
}
// commented | <<param>>
private static boolean items_entry_1(PsiBuilder b, int l, Parser _param) {
if (!recursion_guard_(b, l, "items_entry_1")) return false;
boolean r;
Marker m = enter_section_(b);
r = commented(b, l + 1);
if (!r) r = _param.parse(b, l);
exit_section_(b, m, null, r);
return r;
}
/* ********************************************************** */
// (':' | '::') <<nospace>> symbol_qualified
public static boolean keyword(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "keyword")) return false;
if (!nextTokenIs(b, "<keyword>", C_COLON, C_COLONCOLON)) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, C_KEYWORD, "<keyword>");
r = keyword_0(b, l + 1);
r = r && nospace(b, l + 1);
r = r && symbol_qualified(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
// ':' | '::'
private static boolean keyword_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "keyword_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, C_COLON);
if (!r) r = consumeToken(b, C_COLONCOLON);
exit_section_(b, m, null, r);
return r;
}
/* ********************************************************** */
// '(' list_body ')'
public static boolean list(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "list")) return false;
if (!nextTokenIs(b, C_PAREN1)) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_, C_LIST, null);
r = consumeToken(b, C_PAREN1);
p = r; // pin = '[\(\[\{]'
r = r && report_error_(b, list_body(b, l + 1));
r = p && consumeToken(b, C_PAREN2) && r;
exit_section_(b, l, m, r, p, null);
return r || p;
}
/* ********************************************************** */
// <<items !')' form>>
static boolean list_body(PsiBuilder b, int l) {
return items(b, l + 1, list_body_0_0_parser_, form_parser_);
}
// !')'
private static boolean list_body_0_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "list_body_0_0")) return false;
boolean r;
Marker m = enter_section_(b, l, _NOT_);
r = !consumeToken(b, C_PAREN2);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// number | hexnum | rdxnum | ratio | bool | nil | string | char
public static boolean literal(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "literal")) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, C_LITERAL, "<literal>");
r = consumeToken(b, C_NUMBER);
if (!r) r = consumeToken(b, C_HEXNUM);
if (!r) r = consumeToken(b, C_RDXNUM);
if (!r) r = consumeToken(b, C_RATIO);
if (!r) r = consumeToken(b, C_BOOL);
if (!r) r = consumeToken(b, C_NIL);
if (!r) r = consumeToken(b, C_STRING);
if (!r) r = consumeToken(b, C_CHAR);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// '{' map_body '}'
public static boolean map(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "map")) return false;
if (!nextTokenIs(b, C_BRACE1)) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_, C_MAP, null);
r = consumeToken(b, C_BRACE1);
p = r; // pin = '[\(\[\{]'
r = r && report_error_(b, map_body(b, l + 1));
r = p && consumeToken(b, C_BRACE2) && r;
exit_section_(b, l, m, r, p, null);
return r || p;
}
/* ********************************************************** */
// <<items !'}' map_entry>>
static boolean map_body(PsiBuilder b, int l) {
return items(b, l + 1, map_body_0_0_parser_, map_entry_parser_);
}
// !'}'
private static boolean map_body_0_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "map_body_0_0")) return false;
boolean r;
Marker m = enter_section_(b, l, _NOT_);
r = !consumeToken(b, C_BRACE2);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// form skip form
static boolean map_entry(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "map_entry")) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_);
r = form(b, l + 1);
r = r && skip(b, l + 1);
p = r; // pin = 2
r = r && form(b, l + 1);
exit_section_(b, l, m, r, p, null);
return r || p;
}
/* ********************************************************** */
// "#:" (':' <<nospace>> symbol_plain
// | alias_condition '::' <<nospace>> symbol_plain
// | '::' ) &'{'
static boolean map_ns_prefix(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "map_ns_prefix")) return false;
if (!nextTokenIs(b, C_SHARP_NS)) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_);
r = consumeToken(b, C_SHARP_NS);
p = r; // pin = 1
r = r && report_error_(b, map_ns_prefix_1(b, l + 1));
r = p && map_ns_prefix_2(b, l + 1) && r;
exit_section_(b, l, m, r, p, null);
return r || p;
}
// ':' <<nospace>> symbol_plain
// | alias_condition '::' <<nospace>> symbol_plain
// | '::'
private static boolean map_ns_prefix_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "map_ns_prefix_1")) return false;
boolean r;
Marker m = enter_section_(b);
r = map_ns_prefix_1_0(b, l + 1);
if (!r) r = map_ns_prefix_1_1(b, l + 1);
if (!r) r = consumeToken(b, C_COLONCOLON);
exit_section_(b, m, null, r);
return r;
}
// ':' <<nospace>> symbol_plain
private static boolean map_ns_prefix_1_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "map_ns_prefix_1_0")) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_);
r = consumeToken(b, C_COLON);
p = r; // pin = 1
r = r && report_error_(b, nospace(b, l + 1));
r = p && symbol_plain(b, l + 1) && r;
exit_section_(b, l, m, r, p, null);
return r || p;
}
// alias_condition '::' <<nospace>> symbol_plain
private static boolean map_ns_prefix_1_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "map_ns_prefix_1_1")) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_);
r = alias_condition(b, l + 1);
p = r; // pin = 1
r = r && report_error_(b, consumeToken(b, C_COLONCOLON));
r = p && report_error_(b, nospace(b, l + 1)) && r;
r = p && symbol_plain(b, l + 1) && r;
exit_section_(b, l, m, r, p, null);
return r || p;
}
// &'{'
private static boolean map_ns_prefix_2(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "map_ns_prefix_2")) return false;
boolean r;
Marker m = enter_section_(b, l, _AND_);
r = consumeToken(b, C_BRACE1);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// ("^" | "#^") (string | symbol | keyword | map)
public static boolean metadata(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "metadata")) return false;
if (!nextTokenIs(b, "<form>", C_HAT, C_SHARP_HAT)) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, C_METADATA, "<form>");
r = metadata_0(b, l + 1);
r = r && metadata_1(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
// "^" | "#^"
private static boolean metadata_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "metadata_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, C_HAT);
if (!r) r = consumeToken(b, C_SHARP_HAT);
exit_section_(b, m, null, r);
return r;
}
// string | symbol | keyword | map
private static boolean metadata_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "metadata_1")) return false;
boolean r;
r = consumeToken(b, C_STRING);
if (!r) r = symbol(b, l + 1);
if (!r) r = keyword(b, l + 1);
if (!r) r = map(b, l + 1);
return r;
}
/* ********************************************************** */
// !<<eof>>
static boolean not_eof(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "not_eof")) return false;
boolean r;
Marker m = enter_section_(b, l, _NOT_);
r = !eof(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// list | set | vec | map | fun
static boolean p_forms(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "p_forms")) return false;
boolean r;
r = list(b, l + 1);
if (!r) r = set(b, l + 1);
if (!r) r = vec(b, l + 1);
if (!r) r = map(b, l + 1);
if (!r) r = fun(b, l + 1);
return r;
}
/* ********************************************************** */
// ('#?' | '#?@') &'('
static boolean reader_cond(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "reader_cond")) return false;
if (!nextTokenIs(b, "<form>", C_SHARP_QMARK, C_SHARP_QMARK_AT)) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_, null, "<form>");
r = reader_cond_0(b, l + 1);
p = r; // pin = 1
r = r && reader_cond_1(b, l + 1);
exit_section_(b, l, m, r, p, null);
return r || p;
}
// '#?' | '#?@'
private static boolean reader_cond_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "reader_cond_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, C_SHARP_QMARK);
if (!r) r = consumeToken(b, C_SHARP_QMARK_AT);
exit_section_(b, m, null, r);
return r;
}
// &'('
private static boolean reader_cond_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "reader_cond_1")) return false;
boolean r;
Marker m = enter_section_(b, l, _AND_);
r = consumeToken(b, C_PAREN1);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// "'" | "~" | "~@" | "@" | "`" | "#'" | "#=" | symbolic_value | reader_cond | map_ns_prefix
public static boolean reader_macro(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "reader_macro")) return false;
boolean r;
Marker m = enter_section_(b, l, _NONE_, C_READER_MACRO, "<form>");
r = consumeToken(b, C_QUOTE);
if (!r) r = consumeToken(b, C_TILDE);
if (!r) r = consumeToken(b, C_TILDE_AT);
if (!r) r = consumeToken(b, C_AT);
if (!r) r = consumeToken(b, C_SYNTAX_QUOTE);
if (!r) r = consumeToken(b, C_SHARP_QUOTE);
if (!r) r = consumeToken(b, C_SHARP_EQ);
if (!r) r = symbolic_value(b, l + 1);
if (!r) r = reader_cond(b, l + 1);
if (!r) r = map_ns_prefix(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// '#' <<nospace>> string
public static boolean regexp(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "regexp")) return false;
if (!nextTokenIs(b, C_SHARP)) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, C_SHARP);
r = r && nospace(b, l + 1);
r = r && consumeToken(b, C_STRING);
exit_section_(b, m, C_REGEXP, r);
return r;
}
/* ********************************************************** */
// <<parseTree (root_entry)>>
static boolean root(PsiBuilder b, int l) {
return parseTree(b, l + 1, root_0_0_parser_);
}
// (root_entry)
private static boolean root_0_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "root_0_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = root_entry(b, l + 1);
exit_section_(b, m, null, r);
return r;
}
/* ********************************************************** */
// not_eof (commented | form)
static boolean root_entry(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "root_entry")) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_);
r = not_eof(b, l + 1);
p = r; // pin = 1
r = r && root_entry_1(b, l + 1);
exit_section_(b, l, m, r, p, root_entry_recover_parser_);
return r || p;
}
// commented | form
private static boolean root_entry_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "root_entry_1")) return false;
boolean r;
r = commented(b, l + 1);
if (!r) r = form(b, l + 1);
return r;
}
/* ********************************************************** */
// symbol access_left? | keyword | literal | regexp | access
static boolean s_forms(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "s_forms")) return false;
boolean r;
Marker m = enter_section_(b);
r = s_forms_0(b, l + 1);
if (!r) r = keyword(b, l + 1);
if (!r) r = literal(b, l + 1);
if (!r) r = regexp(b, l + 1);
if (!r) r = access(b, l + 1);
exit_section_(b, m, null, r);
return r;
}
// symbol access_left?
private static boolean s_forms_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "s_forms_0")) return false;
boolean r;
Marker m = enter_section_(b);
r = symbol(b, l + 1);
r = r && s_forms_0_1(b, l + 1);
exit_section_(b, m, null, r);
return r;
}
// access_left?
private static boolean s_forms_0_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "s_forms_0_1")) return false;
access_left(b, l + 1);
return true;
}
/* ********************************************************** */
// '#' <<nospace>> '{' set_body '}'
public static boolean set(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "set")) return false;
if (!nextTokenIs(b, C_SHARP)) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_, C_SET, null);
r = consumeToken(b, C_SHARP);
r = r && nospace(b, l + 1);
r = r && consumeToken(b, C_BRACE1);
p = r; // pin = '[\(\[\{]'
r = r && report_error_(b, set_body(b, l + 1));
r = p && consumeToken(b, C_BRACE2) && r;
exit_section_(b, l, m, r, p, null);
return r || p;
}
/* ********************************************************** */
// <<items !'}' form>>
static boolean set_body(PsiBuilder b, int l) {
return items(b, l + 1, set_body_0_0_parser_, form_parser_);
}
// !'}'
private static boolean set_body_0_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "set_body_0_0")) return false;
boolean r;
Marker m = enter_section_(b, l, _NOT_);
r = !consumeToken(b, C_BRACE2);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// commented *
static boolean skip(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "skip")) return false;
while (true) {
int c = current_position_(b);
if (!commented(b, l + 1)) break;
if (!empty_element_parsed_guard_(b, "skip", c)) break;
}
return true;
}
/* ********************************************************** */
// symbol_qualified
public static boolean symbol(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "symbol")) return false;
if (!nextTokenIs(b, C_SYM)) return false;
boolean r;
Marker m = enter_section_(b, l, _COLLAPSE_, C_SYMBOL, null);
r = symbol_qualified(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// '/' sym
public static boolean symbol_nsq(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "symbol_nsq")) return false;
if (!nextTokenIsFast(b, C_SLASH)) return false;
boolean r;
Marker m = enter_section_(b, l, _LEFT_, C_SYMBOL, null);
r = consumeTokens(b, 0, C_SLASH, C_SYM);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// sym
public static boolean symbol_plain(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "symbol_plain")) return false;
if (!nextTokenIs(b, C_SYM)) return false;
boolean r;
Marker m = enter_section_(b);
r = consumeToken(b, C_SYM);
exit_section_(b, m, C_SYMBOL, r);
return r;
}
/* ********************************************************** */
// symbol_plain symbol_nsq?
static boolean symbol_qualified(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "symbol_qualified")) return false;
if (!nextTokenIs(b, C_SYM)) return false;
boolean r;
Marker m = enter_section_(b);
r = symbol_plain(b, l + 1);
r = r && symbol_qualified_1(b, l + 1);
exit_section_(b, m, null, r);
return r;
}
// symbol_nsq?
private static boolean symbol_qualified_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "symbol_qualified_1")) return false;
symbol_nsq(b, l + 1);
return true;
}
/* ********************************************************** */
// '##' &sym
static boolean symbolic_value(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "symbolic_value")) return false;
if (!nextTokenIs(b, C_SHARP_SYM)) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_);
r = consumeToken(b, C_SHARP_SYM);
p = r; // pin = 1
r = r && symbolic_value_1(b, l + 1);
exit_section_(b, l, m, r, p, null);
return r || p;
}
// &sym
private static boolean symbolic_value_1(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "symbolic_value_1")) return false;
boolean r;
Marker m = enter_section_(b, l, _AND_);
r = consumeToken(b, C_SYM);
exit_section_(b, l, m, r, false, null);
return r;
}
/* ********************************************************** */
// '[' vec_body ']'
public static boolean vec(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "vec")) return false;
if (!nextTokenIs(b, C_BRACKET1)) return false;
boolean r, p;
Marker m = enter_section_(b, l, _NONE_, C_VEC, null);
r = consumeToken(b, C_BRACKET1);
p = r; // pin = '[\(\[\{]'
r = r && report_error_(b, vec_body(b, l + 1));
r = p && consumeToken(b, C_BRACKET2) && r;
exit_section_(b, l, m, r, p, null);
return r || p;
}
/* ********************************************************** */
// <<items !']' form>>
static boolean vec_body(PsiBuilder b, int l) {
return items(b, l + 1, vec_body_0_0_parser_, form_parser_);
}
// !']'
private static boolean vec_body_0_0(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "vec_body_0_0")) return false;
boolean r;
Marker m = enter_section_(b, l, _NOT_);
r = !consumeToken(b, C_BRACKET2);
exit_section_(b, l, m, r, false, null);
return r;
}
static final Parser form_parser_ = new Parser() {
public boolean parse(PsiBuilder b, int l) {
return form(b, l + 1);
}
};
static final Parser form_recover_parser_ = new Parser() {
public boolean parse(PsiBuilder b, int l) {
return formRecover(b, l + 1);
}
};
static final Parser list_body_0_0_parser_ = new Parser() {
public boolean parse(PsiBuilder b, int l) {
return list_body_0_0(b, l + 1);
}
};
static final Parser map_body_0_0_parser_ = new Parser() {
public boolean parse(PsiBuilder b, int l) {
return map_body_0_0(b, l + 1);
}
};
static final Parser map_entry_parser_ = new Parser() {
public boolean parse(PsiBuilder b, int l) {
return map_entry(b, l + 1);
}
};
static final Parser root_0_0_parser_ = new Parser() {
public boolean parse(PsiBuilder b, int l) {
return root_0_0(b, l + 1);
}
};
static final Parser root_entry_recover_parser_ = new Parser() {
public boolean parse(PsiBuilder b, int l) {
return rootFormRecover(b, l + 1);
}
};
static final Parser set_body_0_0_parser_ = new Parser() {
public boolean parse(PsiBuilder b, int l) {
return set_body_0_0(b, l + 1);
}
};
static final Parser vec_body_0_0_parser_ = new Parser() {
public boolean parse(PsiBuilder b, int l) {
return vec_body_0_0(b, l + 1);
}
};
}
| 33.620253 | 94 | 0.550452 |
7dc3d2e3e889044f1ca3f98e0c019f870817455a | 248 | package br.com.zup.desafioproposta.repository;
import br.com.zup.desafioproposta.model.AvisoViagem;
import org.springframework.data.jpa.repository.JpaRepository;
public interface AvisoViagemRepository extends JpaRepository<AvisoViagem, Long> {
}
| 31 | 81 | 0.846774 |
399725b9167188a9ddccde331878c43bae57ef96 | 97 | package com.tvd12.ezyfoxserver.command;
public interface EzyAppResponse extends EzyResponse {
}
| 19.4 | 53 | 0.835052 |
3091e9df95a0818171f4cbc9c7b387ed5e17f1a5 | 1,179 | package gov.usgs.volcanoes.swarm.data;
import java.util.HashMap;
import java.util.Map;
/**
*
* @author Dan Cervelli
*/
public class GulperList {
public final static GulperList INSTANCE = new GulperList();
private Map<String, Gulper> gulpers;
private GulperList() {
gulpers = new HashMap<String, Gulper>();
}
public synchronized Gulper requestGulper(String key, GulperListener gl, SeismicDataSource source,
String ch, double t1, double t2, int size, int delay) {
Gulper g = gulpers.get(key);
if (g != null) {
g.addListener(gl);
g.update(t1, t2);
} else {
if (t2 - t1 < size) {
source.getWave(ch, t1, t2);
} else {
g = source.createGulper(this, key, ch, t1, t2, size, delay);
g.addListener(gl);
g.update(t1, t2);
g.start();
gulpers.put(key, g);
}
}
return g;
}
public synchronized void killGulper(String key, GulperListener gl) {
Gulper g = gulpers.get(key);
if (g != null)
g.kill(gl);
}
/**
* Called from the gulper.
* @param g
*/
public synchronized void removeGulper(Gulper g) {
gulpers.remove(g.getKey());
}
}
| 22.245283 | 99 | 0.605598 |
992abb85492b4398d69163e8def4b1e13f47f93a | 1,102 | package com.genius.backend.domain.repository;
import com.genius.backend.domain.model.alimy.AlimyDto;
import com.genius.backend.domain.model.alimy.QAlimy;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Predicate;
public class AlimyPredicate {
private AlimyPredicate() {
throw new IllegalStateException("Utility class");
}
public static Predicate search(AlimyDto.Search search) {
QAlimy alimy = QAlimy.alimy;
BooleanBuilder builder = new BooleanBuilder();
if (search.getId() != 0) {
builder.and(alimy.id.eq(search.getId()));
}
if (search.getUserId() != 0) {
builder.and(alimy.user.id.eq(search.getUserId()));
}
if(!search.getUsername().isEmpty()) {
builder.and(alimy.user.username.like(search.getUsername()));
}
if (!search.getSubject().isEmpty()) {
builder.and(alimy.subject.contains(search.getSubject()));
}
if (!search.getMessage().isEmpty()) {
builder.and(alimy.message.contains(search.getMessage()));
}
if (search.getStatus() != null) {
builder.and(alimy.status.eq(search.getStatus()));
}
return builder;
}
} | 24.488889 | 63 | 0.708711 |
f4a2189c1350edafe2dd218650f6056fd03b29dd | 2,131 | /**
*/
package substationStandard.Dataclasses;
import org.eclipse.emf.ecore.EObject;
/**
* <!-- begin-user-doc -->
* A representation of the model object '<em><b>Point</b></em>'.
* <!-- end-user-doc -->
*
* <p>
* The following features are supported:
* </p>
* <ul>
* <li>{@link substationStandard.Dataclasses.Point#getXVal <em>XVal</em>}</li>
* <li>{@link substationStandard.Dataclasses.Point#getYVal <em>YVal</em>}</li>
* </ul>
*
* @see substationStandard.Dataclasses.DataclassesPackage#getPoint()
* @model
* @generated
*/
public interface Point extends EObject {
/**
* Returns the value of the '<em><b>XVal</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>XVal</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>XVal</em>' attribute.
* @see #setXVal(float)
* @see substationStandard.Dataclasses.DataclassesPackage#getPoint_XVal()
* @model
* @generated
*/
float getXVal();
/**
* Sets the value of the '{@link substationStandard.Dataclasses.Point#getXVal <em>XVal</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>XVal</em>' attribute.
* @see #getXVal()
* @generated
*/
void setXVal(float value);
/**
* Returns the value of the '<em><b>YVal</b></em>' attribute.
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>YVal</em>' attribute isn't clear,
* there really should be more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>YVal</em>' attribute.
* @see #setYVal(float)
* @see substationStandard.Dataclasses.DataclassesPackage#getPoint_YVal()
* @model
* @generated
*/
float getYVal();
/**
* Sets the value of the '{@link substationStandard.Dataclasses.Point#getYVal <em>YVal</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @param value the new value of the '<em>YVal</em>' attribute.
* @see #getYVal()
* @generated
*/
void setYVal(float value);
} // Point
| 27.320513 | 105 | 0.626936 |
6201223cb3a63b53be372dad7ee5af91f714cdc0 | 484 | package com.javatraining.abstraction;
import java.util.Arrays;
import com.javatraining.interfaces.Library;
public abstract class AbstractLibrary implements Library {
public boolean validateAndCheckoutBook(String isbn, String id) {
String[] idArr = new String[]{"111","222","333","444"};
if(Arrays.asList(idArr).contains(id)) {
checkout(isbn);
return true;
}
System.out.println("Unable to validate the id provided, please check and try again");
return false;
}
}
| 25.473684 | 87 | 0.737603 |
34366a1ccbcc4da4776fd81bd7ad8cc6d231fd57 | 303 | package com.graly.mes.prd.designer.model;
public class PriorityType {
public static final String HIGHEST = "highest";
public static final String HIGH = "high";
public static final String NORMAL = "normal";
public static final String LOW = "low";
public static final String LOWEST = "lowest";
}
| 25.25 | 48 | 0.739274 |
f2ce3e5f47d11c29629940696941e85a0a03ebd7 | 2,794 | package salvo.jesus.graph.xml;
/**
* Defines constants and literals within the XGMML vocabulary.
*
* @author Jesus M. Salvo Jr.
*/
public class XGMML {
/**
* Public ID of XGMML
*/
public static final String PUBLIC_ID = "-//John Punin//DTD graph description//EN";
/**
* System ID / DTD of XGMML
*/
public static final String SYSTEM_ID = "http://www.cs.rpi.edu/~puninj/XGMML/xgmml.dtd";
public static final String DOCTYPE_NAME = "graph";
public static final String GRAPH_ELEMENT_LITERAL = "graph";
public static final String VENDOR_ATTRIBUTE_LITERAL = "Vendor";
public static final String DIRECTED_ATTRIBUTE_LITERAL = "directed";
public static final String GRAPHIC_ATTRIBUTE_LITERAL = "Graphic";
public static final String ATT_ELEMENT_LITERAL = "att";
public static final String ATT_ELEMENT_NAME_ATTRIBUTE_VALUE_WEIGHTED = "weighted";
public static final String ATT_ELEMENT_NAME_ATTRIBUTE_VALUE_DAG = "dag";
public static final String TYPE_ATTRIBUTE_LITERAL = "type";
public static final String NAME_ATTRIBUTE_LITERAL = "name";
public static final String VALUE_ATTRIBUTE_LITERAL = "value";
public static final String NODE_ELEMENT_LITERAL = "node";
public static final String EDGE_ELEMENT_LITERAL = "edge";
public static final String SOURCE_ATTRIBUTE_LITERAL = "source";
public static final String TARGET_ATTRIBUTE_LITERAL = "target";
public static final String WEIGHT_ATTRIBUTE_LITERAL = "weight";
public static final String ID_ATTRIBUTE_LITERAL = "id";
public static final String LABEL_ATTRIBUTE_LITERAL = "label";
public static final String GRAPHICS_ELEMENT_LITERAL = "graphics";
public static final String WIDTH_ATTRIBUTE_LITERAL = "w";
public static final String HEIGHT_ATTRIBUTE_LITERAL = "h";
public static final String FONT_ATTRIBUTE_LITERAL = "font";
public static final String VISIBLE_ATTRIBUTE_LITERAL = "visible";
public static final String FILL_ATTRIBUTE_LITERAL = "fill";
public static final String OUTLINE_ATTRIBUTE_LITERAL = "outline";
public static final String CENTER_ELEMENT_LITERAL = "center";
public static final String X_ATTRIBUTE_LITERAL = "x";
public static final String Y_ATTRIBUTE_LITERAL = "y";
public static final String Z_ATTRIBUTE_LITERAL = "z";
public static final String LINE_ELEMENT_LITERAL = "Line";
public static final String POINT_ELEMENT_LITERAL = "point";
public static final String ATT_ELEMENT_NAME_ATTRIBUTE_VALUE_GRAPHFACTORY = "graphFactory";
public static final String ATT_ELEMENT_NAME_ATTRIBUTE_VALUE_TRAVERSAL = "traversal";
public XGMML() {
}
} | 41.088235 | 97 | 0.716535 |
2843dd8450a44d89c22060b3e8c120d1d10200a6 | 1,114 |
public class Member {
private int memberID;
private String fName, lName;
private double donationAmount;
public Member() {
this(1000, "John", "Smith", 250.0);
}
public Member(String fn, String ln) {
this(1001, fn, ln, 500.0);
}
public Member(int memberID, String fName, String lName, double donationAmount) {
this.memberID = memberID;
this.fName = fName;
this.lName = lName;
this.donationAmount= donationAmount;
}
public void displayMemberInfo(){
System.out.println("MemberID = " + memberID);
System.out.println("Member First Name = " + fName);
System.out.println("Member Last Name = " + lName);
System.out.println("Member Donation = " + donationAmount);
}
@Override
public String toString(){
return ("MemberID = " + memberID +
"\nMember First Name = " + fName +
"\nMember Last Name = " + lName +
"\nMember Donation = " + donationAmount);
}
} | 31.828571 | 85 | 0.539497 |
008ecdc8dab849c7561b7b1f07f2a660094e1f53 | 1,591 | package seedu.address.logic.commands.main;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.ExitCommand;
import seedu.address.model.Model;
/**
* Format full help instructions for every command for display.
*/
public class HelpBudgetCommand extends Command {
public static final String COMMAND_WORD = "help";
public static final String SYNTAX = COMMAND_WORD;
public static final String DESCRIPTION = "Shows a list of commands that is currently available.";
public static final String MESSAGE_USAGE = COMMAND_WORD + ":\n"
+ "Usage: " + SYNTAX + "\n"
+ "Description: " + DESCRIPTION + "\n";
public static final String HELP_MESSAGE = CreateBudgetCommand.MESSAGE_USAGE
+ "\n" + DeleteBudgetCommand.MESSAGE_USAGE
+ "\n" + EditBudgetCommand.MESSAGE_USAGE
+ "\n" + FindBudgetCommand.MESSAGE_USAGE
+ "\n" + ListBudgetCommand.MESSAGE_USAGE
+ "\n" + SortBudgetCommand.MESSAGE_USAGE
+ "\n" + ClearBudgetsCommand.MESSAGE_USAGE
+ "\n" + OpenBudgetCommand.MESSAGE_USAGE
+ "\n" + HelpBudgetCommand.MESSAGE_USAGE
+ "\n" + ExitCommand.MESSAGE_USAGE;
/**
* Executes the help command.
* @param model {@code Model} which the command should operate on.
* @return the commmand result along with a success message
*/
@Override
public CommandResult execute(Model model) {
return new CommandResult(HELP_MESSAGE, false, false);
}
}
| 38.804878 | 101 | 0.674419 |
62a23ee8d6273e4f84720180dfc3477de1ea65a7 | 1,113 | package com.cloud.network.nicira;
import static org.junit.Assert.assertTrue;
import com.google.gson.FieldNamingPolicy;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.junit.Test;
public class NatRuleTest {
@Test
public void testNatRuleEncoding() {
final Gson gson =
new GsonBuilder().registerTypeAdapter(NatRule.class, new NatRuleAdapter())
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
.create();
final DestinationNatRule rn1 = new DestinationNatRule();
rn1.setToDestinationIpAddress("10.10.10.10");
rn1.setToDestinationPort(80);
final Match mr1 = new Match();
mr1.setSourceIpAddresses("11.11.11.11/24");
mr1.setEthertype("IPv4");
mr1.setProtocol(6);
rn1.setMatch(mr1);
final String jsonString = gson.toJson(rn1);
final NatRule dnr = gson.fromJson(jsonString, NatRule.class);
assertTrue(dnr instanceof DestinationNatRule);
assertTrue(rn1.equals(dnr));
}
}
| 31.8 | 101 | 0.65319 |
cba9a5c950eb94c4cd21077f6bc0a6f8e581f4b0 | 330 | package com.dennyy.oldschoolcompanion.interfaces;
import com.dennyy.oldschoolcompanion.customviews.ObservableWebView;
public interface WebViewScrollListener {
void onWebViewScrollDown(ObservableWebView observableWebView, int y, int oldY);
void onWebViewScrollUp(ObservableWebView observableWebView, int y, int oldY);
}
| 33 | 83 | 0.833333 |
6d1289f78decf54f0a986914f1900d346ef9a441 | 2,595 | package com.eyelinecom.whoisd.sads2.telegram.interceptors;
import com.eyelinecom.whoisd.sads2.RequestDispatcher;
import com.eyelinecom.whoisd.sads2.connector.SADSRequest;
import com.eyelinecom.whoisd.sads2.connector.Session;
import com.eyelinecom.whoisd.sads2.content.ContentRequest;
import com.eyelinecom.whoisd.sads2.exception.InterceptionException;
import com.eyelinecom.whoisd.sads2.interceptor.BlankInterceptor;
import com.eyelinecom.whoisd.sads2.profile.Profile;
/**
* Passes current client language to content provider via request param.
*/
public class UserLocaleInterceptor extends BlankInterceptor {
public static final String LANG_PARAM = "lang";
@Override
public void beforeContentRequest(SADSRequest request,
ContentRequest contentRequest,
RequestDispatcher dispatcher) throws InterceptionException {
final String lang = getLangParam(request);
if (lang != null) {
contentRequest.getParameters().put(LANG_PARAM, lang);
// For internal use.
// XXX: Better find a way to avoid this duplication. Maybe, just put it
// into SADSRequest parameters?
request.getAttributes().put(LANG_PARAM, lang);
}
super.beforeContentRequest(request, contentRequest, dispatcher);
}
private String getLangParam(SADSRequest request) {
// 1. Check current session.
final Session session = request.getSession();
if (session != null && !session.isClosed()) {
final String sessionParam = (String) session.getAttribute(LANG_PARAM);
if (sessionParam != null) {
return sessionParam;
}
}
final Profile profile = request.getProfile();
if (profile != null) {
// 2. Check service-specific profile.
final String safeSid = request.getServiceId().replace(".", "_");
final String profileParam = profile
.property("services", "lang-" + safeSid)
.getValue();
if (profileParam != null) {
return profileParam;
}
// 3. Check global profile.
final String globalProfileParam = profile
.property(LANG_PARAM)
.getValue();
if (globalProfileParam != null) {
return globalProfileParam;
}
}
// 4. Fall back to service config.
final String serviceParam =
request.getServiceScenario().getAttributes().getProperty(LANG_PARAM, null);
if (serviceParam != null) {
return serviceParam;
}
// Well, we expect a global default value in scenario configuration, but that's okay.
return null;
}
}
| 30.892857 | 95 | 0.679383 |
ee5521828f52e97dca24aa3f934b5bfdd1764082 | 6,110 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ignite.configuration;
import org.apache.ignite.internal.util.typedef.internal.A;
import org.apache.ignite.internal.util.typedef.internal.S;
/**
* The configuration of the SQL query subsystem.
*/
public class SqlConfiguration {
/** Default SQL query history size. */
public static final int DFLT_SQL_QUERY_HISTORY_SIZE = 1000;
/** Default query timeout. */
public static final long DFLT_QRY_TIMEOUT = 0;
/** Default timeout after which long query warning will be printed. */
public static final long DFLT_LONG_QRY_WARN_TIMEOUT = 3000;
/** */
private long longQryWarnTimeout = DFLT_LONG_QRY_WARN_TIMEOUT;
/** Default query timeout. */
private long dfltQryTimeout = DFLT_QRY_TIMEOUT;
/** SQL schemas to be created on node start. */
private String[] sqlSchemas;
/** SQL query history size. */
private int sqlQryHistSize = DFLT_SQL_QUERY_HISTORY_SIZE;
/** Enable validation of key & values against sql schema. */
private boolean validationEnabled;
/**
* Defines the default query timeout.
*
* Defaults to {@link #DFLT_QRY_TIMEOUT}.
* {@code 0} means there is no timeout (this is a default value)
*
* @return Default query timeout.
* @deprecated Since 2.9. Please use distributed default query timeout.
*/
@Deprecated
public long getDefaultQueryTimeout() {
return dfltQryTimeout;
}
/**
* Sets timeout in milliseconds for default query timeout.
* {@code 0} means there is no timeout (this is a default value)
*
* @param dfltQryTimeout Timeout in milliseconds.
* @return {@code this} for chaining.
* @deprecated Since 2.9. Please use distributed default query timeout.
*/
@Deprecated
public SqlConfiguration setDefaultQueryTimeout(long dfltQryTimeout) {
A.ensure(dfltQryTimeout >= 0 && dfltQryTimeout <= Integer.MAX_VALUE,
"default query timeout value should be valid Integer.");
this.dfltQryTimeout = dfltQryTimeout;
return this;
}
/**
* Number of SQL query history elements to keep in memory. If not provided, then default value {@link
* #DFLT_SQL_QUERY_HISTORY_SIZE} is used. If provided value is less or equals 0, then gathering SQL query history
* will be switched off.
*
* @return SQL query history size.
*/
public int getSqlQueryHistorySize() {
return sqlQryHistSize;
}
/**
* Sets number of SQL query history elements kept in memory. If not explicitly set, then default value is {@link
* #DFLT_SQL_QUERY_HISTORY_SIZE}.
*
* @param size Number of SQL query history elements kept in memory.
* @return {@code this} for chaining.
*/
public SqlConfiguration setSqlQueryHistorySize(int size) {
sqlQryHistSize = size;
return this;
}
/**
* Gets SQL schemas to be created on node startup.
* <p>
* See {@link #setSqlSchemas(String...)} for more information.
*
* @return SQL schemas to be created on node startup.
*/
public String[] getSqlSchemas() {
return sqlSchemas;
}
/**
* Sets SQL schemas to be created on node startup. Schemas are created on local node only and are not propagated
* to other cluster nodes. Created schemas cannot be dropped.
* <p>
* By default schema names are case-insensitive, i.e. {@code my_schema} and {@code My_Schema} represents the same
* object. Use quotes to enforce case sensitivity (e.g. {@code "My_Schema"}).
* <p>
* Property is ignored if {@code ignite-indexing} module is not in classpath.
*
* @param sqlSchemas SQL schemas to be created on node startup.
* @return {@code this} for chaining.
*/
public SqlConfiguration setSqlSchemas(String... sqlSchemas) {
this.sqlSchemas = sqlSchemas;
return this;
}
/**
* Gets timeout in milliseconds after which long query warning will be printed.
*
* @return Timeout in milliseconds.
*/
public long getLongQueryWarningTimeout() {
return longQryWarnTimeout;
}
/**
* Sets timeout in milliseconds after which long query warning will be printed.
*
* @param longQryWarnTimeout Timeout in milliseconds.
* @return {@code this} for chaining.
*/
public SqlConfiguration setLongQueryWarningTimeout(long longQryWarnTimeout) {
this.longQryWarnTimeout = longQryWarnTimeout;
return this;
}
/**
* Is key & value validation enabled.
*
* @return {@code true} When key & value shall be validated against SQL schema.
*/
public boolean isValidationEnabled() {
return validationEnabled;
}
/**
* Enable/disable key & value validation.
*
* @param validationEnabled {@code true} When key & value shall be validated against SQL schema.
* Default value is {@code false}.
* @return {@code this} for chaining.
*/
public SqlConfiguration setValidationEnabled(boolean validationEnabled) {
this.validationEnabled = validationEnabled;
return this;
}
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(SqlConfiguration.class, this);
}
}
| 33.206522 | 117 | 0.672504 |
34911f1e28cbe3a3f0300924beb581b506c6e57a | 26,577 | /*
* This file was automatically generated by EvoSuite
* Fri Nov 06 14:17:22 GMT 2020
*/
package weka.core.stemmers;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.runtime.EvoAssertions.*;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.junit.runner.RunWith;
import weka.core.TechnicalInformation;
import weka.core.stemmers.LovinsStemmer;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true, useJEE = true)
public class LovinsStemmer_ESTest extends LovinsStemmer_ESTest_scaffolding {
/**
//Test case number: 0
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test00() throws Throwable {
String[] stringArray0 = new String[8];
stringArray0[0] = "lAvi]'ME`3i";
stringArray0[1] = "q2";
stringArray0[2] = "-h";
LovinsStemmer.main(stringArray0);
assertEquals(8, stringArray0.length);
}
/**
//Test case number: 1
/*Coverage entropy=0.6365141682948128
*/
@Test(timeout = 4000)
public void test01() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("");
assertEquals("", string0);
}
/**
//Test case number: 2
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test02() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
// Undeclared exception!
try {
lovinsStemmer0.stemString((String) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
/**
//Test case number: 3
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test03() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
// Undeclared exception!
try {
lovinsStemmer0.stem((String) null);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
/**
//Test case number: 4
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test04() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("");
assertEquals("", string0);
}
/**
//Test case number: 5
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test05() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
TechnicalInformation technicalInformation0 = lovinsStemmer0.getTechnicalInformation();
assertEquals(TechnicalInformation.Type.ARTICLE, technicalInformation0.getType());
}
/**
//Test case number: 6
/*Coverage entropy=0.9948360687584032
*/
@Test(timeout = 4000)
public void test06() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("ed8mpptyz");
assertEquals("ed8mpptys", string0);
}
/**
//Test case number: 7
/*Coverage entropy=0.9826446443097824
*/
@Test(timeout = 4000)
public void test07() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("4qbyt");
assertEquals("4qbys", string0);
}
/**
//Test case number: 8
/*Coverage entropy=0.7610604104439116
*/
@Test(timeout = 4000)
public void test08() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("ationet");
assertEquals("ationet", string0);
}
/**
//Test case number: 9
/*Coverage entropy=0.9925378778810804
*/
@Test(timeout = 4000)
public void test09() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("byhpmert");
assertEquals("byhpmers", string0);
}
/**
//Test case number: 10
/*Coverage entropy=0.9864885932036829
*/
@Test(timeout = 4000)
public void test10() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("kztmit");
assertEquals("kztmis", string0);
}
/**
//Test case number: 11
/*Coverage entropy=0.976388556423862
*/
@Test(timeout = 4000)
public void test11() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("Morgan Kafmann Publishers");
assertEquals("morgan kafman publishes", string0);
}
/**
//Test case number: 12
/*Coverage entropy=0.9872944966435662
*/
@Test(timeout = 4000)
public void test12() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("Qu5wHHmpher");
assertEquals("qu5whhmpher", string0);
}
/**
//Test case number: 13
/*Coverage entropy=0.9897700299385648
*/
@Test(timeout = 4000)
public void test13() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("8034rud");
assertEquals("8034rus", string0);
}
/**
//Test case number: 14
/*Coverage entropy=0.9671568298620783
*/
@Test(timeout = 4000)
public void test14() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("lud");
assertEquals("lus", string0);
}
/**
//Test case number: 15
/*Coverage entropy=0.9671568298620783
*/
@Test(timeout = 4000)
public void test15() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("ond");
assertEquals("ons", string0);
}
/**
//Test case number: 16
/*Coverage entropy=0.9734476835888628
*/
@Test(timeout = 4000)
public void test16() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("eflend");
assertEquals("eflens", string0);
}
/**
//Test case number: 17
/*Coverage entropy=0.9597095891352391
*/
@Test(timeout = 4000)
public void test17() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("end");
assertEquals("ens", string0);
}
/**
//Test case number: 18
/*Coverage entropy=0.7450373458332782
*/
@Test(timeout = 4000)
public void test18() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("lusend");
assertEquals("lusens", string0);
}
/**
//Test case number: 19
/*Coverage entropy=0.9781835205352001
*/
@Test(timeout = 4000)
public void test19() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("erid");
assertEquals("eris", string0);
}
/**
//Test case number: 20
/*Coverage entropy=0.7802433017528706
*/
@Test(timeout = 4000)
public void test20() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("glmdiclid");
assertEquals("glmdiclis", string0);
}
/**
//Test case number: 21
/*Coverage entropy=0.9864885932036829
*/
@Test(timeout = 4000)
public void test21() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("hkqcid");
assertEquals("hkqcis", string0);
}
/**
//Test case number: 22
/*Coverage entropy=0.9864885932036829
*/
@Test(timeout = 4000)
public void test22() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("dicvad");
assertEquals("dicvas", string0);
}
/**
//Test case number: 23
/*Coverage entropy=0.9671568298620783
*/
@Test(timeout = 4000)
public void test23() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("uad");
assertEquals("uas", string0);
}
/**
//Test case number: 24
/*Coverage entropy=0.9826446443097824
*/
@Test(timeout = 4000)
public void test24() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("ondix");
assertEquals("ondic", string0);
}
/**
//Test case number: 25
/*Coverage entropy=0.7758353327309706
*/
@Test(timeout = 4000)
public void test25() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("wkeiusex");
assertEquals("wkeiusec", string0);
}
/**
//Test case number: 26
/*Coverage entropy=0.7758353327309706
*/
@Test(timeout = 4000)
public void test26() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("wkeiusax");
assertEquals("wkeiusac", string0);
}
/**
//Test case number: 27
/*Coverage entropy=0.7356907463699587
*/
@Test(timeout = 4000)
public void test27() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("pex");
assertEquals("pic", string0);
}
/**
//Test case number: 28
/*Coverage entropy=0.9897700299385648
*/
@Test(timeout = 4000)
public void test28() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("miscdex");
assertEquals("miscdic", string0);
}
/**
//Test case number: 29
/*Coverage entropy=0.7356907463699587
*/
@Test(timeout = 4000)
public void test29() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("bex");
assertEquals("bic", string0);
}
/**
//Test case number: 30
/*Coverage entropy=1.0330165500005002
*/
@Test(timeout = 4000)
public void test30() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("e^f ully");
assertEquals("e^f l", string0);
}
/**
//Test case number: 31
/*Coverage entropy=0.7303095607169532
*/
@Test(timeout = 4000)
public void test31() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("eful");
assertEquals("efl", string0);
}
/**
//Test case number: 32
/*Coverage entropy=0.9671568298620783
*/
@Test(timeout = 4000)
public void test32() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("olv");
assertEquals("olut", string0);
}
/**
//Test case number: 33
/*Coverage entropy=0.7356907463699587
*/
@Test(timeout = 4000)
public void test33() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("rpt");
assertEquals("rb", string0);
}
/**
//Test case number: 34
/*Coverage entropy=0.9781835205352001
*/
@Test(timeout = 4000)
public void test34() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("umpt");
assertEquals("um", string0);
}
/**
//Test case number: 35
/*Coverage entropy=0.9671568298620783
*/
@Test(timeout = 4000)
public void test35() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("iev");
assertEquals("ief", string0);
}
/**
//Test case number: 36
/*Coverage entropy=1.0960147097893065
*/
@Test(timeout = 4000)
public void test36() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("!.ZZ!;x-$kPP-=Dj");
assertEquals("!.zz!;x-$kp-=dj", string0);
}
/**
//Test case number: 37
/*Coverage entropy=0.9795276407612141
*/
@Test(timeout = 4000)
public void test37() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("A stemmer based on the Lovins stemmer, described here:\n\nJulie Beth Lovins (1968). Development of a stemming algorithm. Mechanical Translation and Computational Linguistics. 11:22-31.");
assertEquals("a stemmer bas on th lovin stemmer, describ hes:\n\njuli beth lovin (1968). developm of a stem algorithm. mechan transl and comput lingu. 11:22-31.", string0);
}
/**
//Test case number: 38
/*Coverage entropy=1.0314280459800158
*/
@Test(timeout = 4000)
public void test38() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("The Library of Congress Call Number. I've also seen this as lib-congress.");
assertEquals("th libr of congres cal number. i'v als seen th as lib-congres.", string0);
}
/**
//Test case number: 39
/*Coverage entropy=1.0488327012836316
*/
@Test(timeout = 4000)
public void test39() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("}DUx;QKvFBGg>NXw%");
assertEquals("}dux;qkvfbg>nxw%", string0);
}
/**
//Test case number: 40
/*Coverage entropy=1.002727982931539
*/
@Test(timeout = 4000)
public void test40() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("probToLogOdds: probability must be in [0,1] ");
assertEquals("probtologod: prob must be in [0,1] ", string0);
}
/**
//Test case number: 41
/*Coverage entropy=1.1480707082364556
*/
@Test(timeout = 4000)
public void test41() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("InBb}#`6<%Ek;i");
assertEquals("inb}#`6<%ek;i", string0);
}
/**
//Test case number: 42
/*Coverage entropy=0.964982005450428
*/
@Test(timeout = 4000)
public void test42() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("Fatal Auerror.");
assertEquals("fat auerror.", string0);
}
/**
//Test case number: 43
/*Coverage entropy=1.0086768778828243
*/
@Test(timeout = 4000)
public void test43() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("oPmwR5HVv)6W}wXal");
assertEquals("opmwr5hvv)6w}wxal", string0);
}
/**
//Test case number: 44
/*Coverage entropy=0.7587346953736293
*/
@Test(timeout = 4000)
public void test44() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("j4kzmm312:t%TxAr");
assertEquals("j4kzmm312:t%txar", string0);
}
/**
//Test case number: 45
/*Coverage entropy=1.0307451919192103
*/
@Test(timeout = 4000)
public void test45() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("th number of a journ, magaz, techn report, or of a work in a ser. an issu of a journ or magaz is usu identif by it volum and number; th organ that issu a techn report usu giv it a number; and sometim book ar giv number in a nam ser.");
assertEquals("th number of a journ, magaz, techn report, or of a work in a ser. an issu of a journ or magaz is usu identif by it vol and number; th organ that issu a techn report usu giv it a number; and sometim book ar giv number in a nam ser.", string0);
}
/**
//Test case number: 46
/*Coverage entropy=0.9367490397930263
*/
@Test(timeout = 4000)
public void test46() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("RGAIZATON");
assertEquals("rgaizat", string0);
}
/**
//Test case number: 47
/*Coverage entropy=0.9800333291173933
*/
@Test(timeout = 4000)
public void test47() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("RbAI&ATION");
assertEquals("rba&ation", string0);
}
/**
//Test case number: 48
/*Coverage entropy=0.9424669566424351
*/
@Test(timeout = 4000)
public void test48() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("encies");
assertEquals("enci", string0);
}
/**
//Test case number: 49
/*Coverage entropy=0.9717988770641838
*/
@Test(timeout = 4000)
public void test49() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("\tUses lowercase strings.");
assertEquals("\tus lowercas string.", string0);
}
/**
//Test case number: 50
/*Coverage entropy=0.9746415911927695
*/
@Test(timeout = 4000)
public void test50() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("Used for alphabetizing, cross referencing, and creating a label when the ``author'' information is missing. This field should not be confused with the key that appears in the cite command and at the beginning of the database entry.");
assertEquals("us for alphabes, cros refer, and creat a label when th ``author'' inform is mis. th field should not be confus with th key that appear in th cit command and at th begin of th databas entr.", string0);
}
/**
//Test case number: 51
/*Coverage entropy=0.9901352687449608
*/
@Test(timeout = 4000)
public void test51() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("Induction of decision trees");
assertEquals("induc of decis tree", string0);
}
/**
//Test case number: 52
/*Coverage entropy=0.9481113174336513
*/
@Test(timeout = 4000)
public void test52() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("ement");
assertEquals("ement", string0);
}
/**
//Test case number: 53
/*Coverage entropy=1.0245115514622898
*/
@Test(timeout = 4000)
public void test53() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("sxk;X&5fq@!<DKlite");
assertEquals("sxk;x&5fq@!<dkl", string0);
}
/**
//Test case number: 54
/*Coverage entropy=0.9869288541846833
*/
@Test(timeout = 4000)
public void test54() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("us for alphabes, cros refer, and creat a label when th ``author'' inform is mis. th field should not be confus with th key that appear in th cit command and at th begin of th databas entr.");
assertEquals("us for alphab, cro refer, and creat a label when th ``author'' inform is mi. th field should not be confus with th key that appear in th cit command and at th begin of th datab entr.", string0);
}
/**
//Test case number: 55
/*Coverage entropy=1.0055402695773097
*/
@Test(timeout = 4000)
public void test55() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("q=0mtkum&e,2_9LBQI");
assertEquals("q=0mtkum&e,2_9lbq", string0);
}
/**
//Test case number: 56
/*Coverage entropy=1.018115514686177
*/
@Test(timeout = 4000)
public void test56() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString(")jtton_y.bvu8mpand");
assertEquals(")jtton_y.bvu8mpans", string0);
}
/**
//Test case number: 57
/*Coverage entropy=1.0090684143263557
*/
@Test(timeout = 4000)
public void test57() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("th year of public or, for an unpubl work, th year it wa writ. gener it should cons of four numer, such as 1984, although th standard styl can handl any year whos last four nonpunctu character ar numer, such as `hbox{(about 1984)}'.");
assertEquals("th year of publ or, for an unpubl work, th year it wa writ. gener it should con of four numer, such as 1984, although th standard styl can handl any year who last four nonpunctu character ar numer, such as `hbox{(about 1984)}'.", string0);
}
/**
//Test case number: 58
/*Coverage entropy=1.0089028346629454
*/
@Test(timeout = 4000)
public void test58() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("Title of a book, part of which is being cited. See the LaTeX book for how to type titles. For book entries, use the title field instead.");
assertEquals("titl of a book, part of which is being cit. se th latic book for how to typ titl. for book entr, us th titl field instead.", string0);
}
/**
//Test case number: 59
/*Coverage entropy=0.9563968167464134
*/
@Test(timeout = 4000)
public void test59() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("icide");
assertEquals("ic", string0);
}
/**
//Test case number: 60
/*Coverage entropy=0.9607162505764949
*/
@Test(timeout = 4000)
public void test60() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("The year of publication or, for an unpublished work, the year it was written. Generally it should consist of four numerals, such as 1984, although the standard styles can handle any year whose last four nonpunctuation characters are numerals, such as `hbox{(about 1984)}'.");
assertEquals("th year of public or, for an unpubl work, th year it wa writ. gener it should cons of four numer, such as 1984, although th standard styl can handl any year whos last four nonpunctu character ar numer, such as `hbox{(about 1984)}'.", string0);
}
/**
//Test case number: 61
/*Coverage entropy=0.9582101602470495
*/
@Test(timeout = 4000)
public void test61() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("Name(s) of editor(s), typed as indicated in the LaTeX book. If there is also an author field, then the editor field gives the editor of the book or collection in which the reference appears.");
assertEquals("nam(s) of edit(s), typ as indic in th latic book. if ther is als an author field, then th edit field giv th edit of th book or collect in which th refer appear.", string0);
}
/**
//Test case number: 62
/*Coverage entropy=0.9757988965482207
*/
@Test(timeout = 4000)
public void test62() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("The database key of the entry being cross referenced. An7 fields=that are missing from the current record are inherited from the field being cross referenced.");
assertEquals("th databas key of th entr being cros refer. an7 field=that ar mis from th cur record ar inherit from th field being cros refer.", string0);
}
/**
//Test case number: 63
/*Coverage entropy=0.9707906975158642
*/
@Test(timeout = 4000)
public void test63() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stemString("Proceeding of the Sixteenth International Conference on Machine Learning");
assertEquals("proceed of th sixteenth intern confer on mach learn", string0);
}
/**
//Test case number: 64
/*Coverage entropy=0.7789097596789128
*/
@Test(timeout = 4000)
public void test64() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem("encing");
assertEquals("enc", string0);
}
/**
//Test case number: 65
/*Coverage entropy=0.7905698620453724
*/
@Test(timeout = 4000)
public void test65() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.stem(")glm[n!6(mlux");
assertEquals(")glm[n!6(mluc", string0);
}
/**
//Test case number: 66
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test66() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.getRevision();
assertEquals("8034", string0);
}
/**
//Test case number: 67
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test67() throws Throwable {
String[] stringArray0 = new String[1];
LovinsStemmer.main(stringArray0);
assertEquals(1, stringArray0.length);
}
/**
//Test case number: 68
/*Coverage entropy=1.0986122886681096
*/
@Test(timeout = 4000)
public void test68() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.globalInfo();
assertEquals("A stemmer based on the Lovins stemmer, described here:\n\nJulie Beth Lovins (1968). Development of a stemming algorithm. Mechanical Translation and Computational Linguistics. 11:22-31.", string0);
}
/**
//Test case number: 69
/*Coverage entropy=0.6931471805599453
*/
@Test(timeout = 4000)
public void test69() throws Throwable {
LovinsStemmer lovinsStemmer0 = new LovinsStemmer();
String string0 = lovinsStemmer0.toString();
assertEquals("weka.core.stemmers.LovinsStemmer", string0);
}
}
| 32.851669 | 325 | 0.683072 |
c6c48601cd4cae4264ae2b2f2b533dc7d5082a22 | 2,555 | package owlmoney.logic.command.transaction;
import static owlmoney.commons.log.LogsCenter.getLogger;
import java.util.Date;
import java.util.logging.Logger;
import owlmoney.logic.command.Command;
import owlmoney.model.bank.exception.BankException;
import owlmoney.model.profile.Profile;
import owlmoney.model.transaction.Expenditure;
import owlmoney.model.transaction.Transaction;
import owlmoney.model.transaction.exception.TransactionException;
import owlmoney.ui.Ui;
/**
* Executes AddRecurringExpenditureCommand to add a recurring expenditure transaction.
*/
public class AddRecurringExpenditureCommand extends Command {
private final String accountName;
private final double amount;
private final Date date;
private final String description;
private final String category;
private final String type;
private static final Logger logger = getLogger(AddRecurringExpenditureCommand.class);
/**
* Creates an instance of AddRecurringExpenditureCommand.
*
* @param name Bank account name.
* @param amount Amount of the recurring expenditure.
* @param date Date of the next expenditure.
* @param description Description of the recurring expenditure.
* @param category Category of the recurring expenditure.
* @param type Represents type of expenditure to be added.
*/
public AddRecurringExpenditureCommand(String name, double amount, Date date, String description,
String category, String type) {
this.accountName = name;
this.amount = amount;
this.date = date;
this.description = description;
this.category = category;
this.type = type;
}
/**
* Executes the function to add a new recurring expenditure to the bank account.
*
* @param profile Profile of the user.
* @param ui Ui of OwlMoney.
* @return false so OwlMoney will not terminate yet.
* @throws BankException If bank account does not exists or is an investment account.
* @throws TransactionException If the recurring expenditure list is full.
*/
public boolean execute(Profile profile, Ui ui) throws BankException, TransactionException {
Transaction newExpenditure = new Expenditure(this.description, this.amount, this.date, this.category);
profile.profileAddRecurringExpenditure(accountName, newExpenditure, ui, this.type);
logger.info("Successful execution of AddRecurringExpenditureCommand");
return this.isExit;
}
}
| 39.921875 | 110 | 0.723679 |
e695ef55087fc0217ae34342217ccda476188767 | 2,891 | package com.dea42.watchlist.search;
import com.dea42.watchlist.controller.FieldMatch;
import com.dea42.watchlist.controller.UniqueEmail;
import com.dea42.watchlist.controller.ValidatePassword;
import com.dea42.watchlist.entity.Account;
import com.dea42.watchlist.utils.MessageHelper;
import com.fasterxml.jackson.annotation.JsonIgnore;
import java.io.Serializable;
import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.data.domain.Sort;
import org.springframework.format.annotation.DateTimeFormat;
/**
* Title: AccountSearchForm <br>
* Description: Class for holding data from the Account table for searching. <br>
* Copyright: Copyright (c) 2001-2021<br>
* Company: RMRR<br>
*
* @author Gened by com.dea42.build.GenSpring version 0.7.2<br>
* @version 0.7.2<br>
*/
@Data
public class AccountSearchForm implements Serializable {
private static final long serialVersionUID = 1L;
private String email = "";
/* info=ColInfo(fNum=2, colName=id, msgKey=Account.id, vName=id, type=Long, jtype=null, stype=-5, gsName=Id, length=0, pk=true, defaultVal=null, constraint=null, required=true, list=false, jsonIgnore=false, unique=false, hidden=false, password=false, email=false, created=false, lastMod=false, adminOnly=false, foreignTable=null, foreignCol=null, colScale=0, colPrecision=0, comment= * Table name: Account<br>
* Column name: id<br>
* Catalog name: Watchlist<br>
* Primary key sequence: 1<br>
* Primary key name: PRIMARY<br>
* <br>) */
private Long idMin;
private Long idMax;
private String name = "";
private String password = "";
private String userrole = "";
private String sortField = "id";
private int page = 1;
private int pageSize = 10;
private boolean sortAsc = true;
private int totalPages = 0;
private long totalItems = 0;
private SearchType doOr = SearchType.ADD;
private boolean advanced = true;
/**
* Clones Account obj into form
*
* @param obj
*/
public static AccountSearchForm getInstance(Account obj) {
AccountSearchForm form = new AccountSearchForm();
form.setEmail(obj.getEmail());
form.setIdMin(obj.getId());
form.setIdMax(obj.getId());
form.setName(obj.getName());
form.setPassword(obj.getPassword());
form.setUserrole(obj.getUserrole());
return form;
}
/**
* Generate a Sort from fields
* @return
*/
public Sort getSort() {
if (sortAsc)
return Sort.by(sortField).ascending();
return Sort.by(sortField).descending();
}
public String getSortDir() {
if (sortAsc)
return "asc";
else
return "desc";
}
public String getReverseSortDir() {
if (sortAsc)
return "desc";
else
return "asc";
}
boolean getSortAscFlip() {
return !sortAsc;
}
}
| 30.114583 | 410 | 0.711173 |
0125850c3d648828f0703dc97c0a2e298abf53ce | 825 | package com.example.android.popularmovies;
import android.arch.lifecycle.ViewModel;
import android.arch.lifecycle.ViewModelProvider;
import android.support.annotation.NonNull;
import com.example.android.popularmovies.database.AppDatabase;
public class DetailViewModelFactory extends ViewModelProvider.NewInstanceFactory {
private final AppDatabase movieDb;
private final int favMovieId;
private final int tmdbMovieId;
public DetailViewModelFactory(AppDatabase movieDb, int favMovieId, int tmdbMovieId) {
this.movieDb = movieDb;
this.favMovieId = favMovieId;
this.tmdbMovieId = tmdbMovieId;
}
@NonNull
@Override
public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
return (T) new DetailViewModel(movieDb, favMovieId, tmdbMovieId);
}
}
| 30.555556 | 89 | 0.757576 |
ec49dfc54a8b5cd2043b82a0705b75bfbc800590 | 10,700 | package org.xiaoxingqi.gmdoc.entity.user;
import org.xiaoxingqi.gmdoc.entity.BaseRespData;
/**
* Created by yzm on 2017/11/7.
*/
public class UserInfoData extends BaseRespData {
/**
* state : 200
* data : {"username":"大王","top_image":null,"sex":1,"avatar":"/images/avatar_default.png","desc":null,"id":null,"uid":109,"etm_num":null,"com_num":null,"like_num":null,"msg_num":null,"fans_num":null,"follow_num":null,"dt_num":null,"blog_num":null,"short_num":null,"long_num":null,"photo_num":null,"blacklist_num":null,"wish_num":null,"collection_num":null,"contribution_num":null,"invite_num":null,"updated_at":null,"like_game":"你猜,我擦,他猜","is_sub":0,"is_black":0,"gold_num":0,"silver_num":0,"bronze_num":0,"role":2,"is_application":null,"application_time":null}
*/
private DataBean data;
public DataBean getData() {
return data;
}
public void setData(DataBean data) {
this.data = data;
}
public static class DataBean {
/**
* username : 大王
* top_image : null
* sex : 1
* avatar : /images/avatar_default.png
* desc : null
* id : null
* uid : 109
* etm_num : null
* com_num : null
* like_num : null
* msg_num : null
* fans_num : null
* follow_num : null
* dt_num : null
* blog_num : null
* short_num : null
* long_num : null
* photo_num : null
* blacklist_num : null
* wish_num : null
* collection_num : null
* contribution_num : null
* invite_num : null
* updated_at : null
* like_game : 你猜,我擦,他猜
* is_sub : 0
* is_black : 0
* gold_num : 0
* silver_num : 0
* bronze_num : 0
* role : 2
* is_application : null
* application_time : null
*/
private String email;
private String username;
private String top_image;
private String sex;//1 女
private String avatar;
private String desc;
private String id;
private String uid;
private String etm_num;
private String com_num;
private String like_num;
private String msg_num;
private String fans_num;
private String follow_num;
private String dt_num;
private String blog_num;
private String short_num;
private String long_num;
private String photo_num;
private String blacklist_num;
private String wish_num;
private String collection_num;
private String contribution_num;
private String invite_num;
private String updated_at;
private String like_game;
private int is_sub;//0 没有关系 1已经关注 2互相关注
private int is_black;// 0 1
private String gold_num;
private String silver_num;
private String bronze_num;
private String role;//正式用户 1 正式 2 注册
private String is_application;
private String application_time;
private String phone;
private int has_qq;//1 已绑定 0 未绑定
private int has_wx;//
private String playing_num;
private int jutou;//0 是开 1是关
private int fans_switch;//全局1开启0不开启 默认0 是否打开隐藏粉丝数
private String waiting_num;//待评分列表数量
public String getWaiting_num() {
return waiting_num;
}
public void setWaiting_num(String waiting_num) {
this.waiting_num = waiting_num;
}
public int getFans_switch() {
return fans_switch;
}
public void setFans_switch(int fans_switch) {
this.fans_switch = fans_switch;
}
public int getJutou() {
return jutou;
}
public void setJutou(int jutou) {
this.jutou = jutou;
}
public String getPlaying_num() {
return playing_num;
}
public void setPlaying_num(String playing_num) {
this.playing_num = playing_num;
}
public int getHas_qq() {
return has_qq;
}
public void setHas_qq(int has_qq) {
this.has_qq = has_qq;
}
public int getHas_wx() {
return has_wx;
}
public void setHas_wx(int has_wx) {
this.has_wx = has_wx;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getTop_image() {
return top_image;
}
public void setTop_image(String top_image) {
this.top_image = top_image;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getAvatar() {
return avatar;
}
public void setAvatar(String avatar) {
this.avatar = avatar;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getEtm_num() {
return etm_num;
}
public void setEtm_num(String etm_num) {
this.etm_num = etm_num;
}
public String getCom_num() {
return com_num;
}
public void setCom_num(String com_num) {
this.com_num = com_num;
}
public String getLike_num() {
return like_num;
}
public void setLike_num(String like_num) {
this.like_num = like_num;
}
public String getMsg_num() {
return msg_num;
}
public void setMsg_num(String msg_num) {
this.msg_num = msg_num;
}
public String getFans_num() {
return fans_num;
}
public void setFans_num(String fans_num) {
this.fans_num = fans_num;
}
public String getFollow_num() {
return follow_num;
}
public void setFollow_num(String follow_num) {
this.follow_num = follow_num;
}
public String getDt_num() {
return dt_num;
}
public void setDt_num(String dt_num) {
this.dt_num = dt_num;
}
public String getBlog_num() {
return blog_num;
}
public void setBlog_num(String blog_num) {
this.blog_num = blog_num;
}
public String getShort_num() {
return short_num;
}
public void setShort_num(String short_num) {
this.short_num = short_num;
}
public String getLong_num() {
return long_num;
}
public void setLong_num(String long_num) {
this.long_num = long_num;
}
public String getPhoto_num() {
return photo_num;
}
public void setPhoto_num(String photo_num) {
this.photo_num = photo_num;
}
public String getBlacklist_num() {
return blacklist_num;
}
public void setBlacklist_num(String blacklist_num) {
this.blacklist_num = blacklist_num;
}
public String getWish_num() {
return wish_num;
}
public void setWish_num(String wish_num) {
this.wish_num = wish_num;
}
public String getCollection_num() {
return collection_num;
}
public void setCollection_num(String collection_num) {
this.collection_num = collection_num;
}
public String getContribution_num() {
return contribution_num;
}
public void setContribution_num(String contribution_num) {
this.contribution_num = contribution_num;
}
public String getInvite_num() {
return invite_num;
}
public void setInvite_num(String invite_num) {
this.invite_num = invite_num;
}
public String getUpdated_at() {
return updated_at;
}
public void setUpdated_at(String updated_at) {
this.updated_at = updated_at;
}
public String getLike_game() {
return like_game;
}
public void setLike_game(String like_game) {
this.like_game = like_game;
}
public int getIs_sub() {
return is_sub;
}
public void setIs_sub(int is_sub) {
this.is_sub = is_sub;
}
public int getIs_black() {
return is_black;
}
public void setIs_black(int is_black) {
this.is_black = is_black;
}
public String getGold_num() {
return gold_num;
}
public void setGold_num(String gold_num) {
this.gold_num = gold_num;
}
public String getSilver_num() {
return silver_num;
}
public void setSilver_num(String silver_num) {
this.silver_num = silver_num;
}
public String getBronze_num() {
return bronze_num;
}
public void setBronze_num(String bronze_num) {
this.bronze_num = bronze_num;
}
public String getRole() {
return role;
}
public void setRole(String role) {
this.role = role;
}
public String getIs_application() {
return is_application;
}
public void setIs_application(String is_application) {
this.is_application = is_application;
}
public String getApplication_time() {
return application_time;
}
public void setApplication_time(String application_time) {
this.application_time = application_time;
}
}
}
| 24.597701 | 565 | 0.542243 |
9f8bc7700de7030c3c1647ba9890c929c87e2165 | 762 | package ru.revuelArvida.pomodoroTelegramBot.command.messageCommands.settingsMenu.pesonalSettings;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@Getter
@Setter
@NoArgsConstructor
class Checker {
enum SetField{
WORK("Длительность работы"),
SHORT("Длительность короткого перерыва"),
LONG("Длительность большого перерыва");
private String FieldName;
SetField(String fieldName){
this.FieldName = fieldName;
}
public String getFieldName() {
return FieldName;
}
}
private Boolean isWorkSet = false;
private Boolean isShortBrakeSet = false;
private Boolean isLongBreakSet = false;
private SetField setField = null;
}
| 21.771429 | 97 | 0.686352 |
6ac8eabbcd934990ed16f4738434edaa86090b4b | 1,556 | /*
* Copyright (C) 2015 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.view;
public final class KeyboardShortcutInfo
implements android.os.Parcelable
{
public KeyboardShortcutInfo(java.lang.CharSequence label, int keycode, int modifiers) { throw new RuntimeException("Stub!"); }
public KeyboardShortcutInfo(java.lang.CharSequence label, char baseCharacter, int modifiers) { throw new RuntimeException("Stub!"); }
public java.lang.CharSequence getLabel() { throw new RuntimeException("Stub!"); }
public int getKeycode() { throw new RuntimeException("Stub!"); }
public char getBaseCharacter() { throw new RuntimeException("Stub!"); }
public int getModifiers() { throw new RuntimeException("Stub!"); }
public int describeContents() { throw new RuntimeException("Stub!"); }
public void writeToParcel(android.os.Parcel dest, int flags) { throw new RuntimeException("Stub!"); }
public static final android.os.Parcelable.Creator<android.view.KeyboardShortcutInfo> CREATOR;
static { CREATOR = null; }
}
| 50.193548 | 134 | 0.764781 |
498117324f5f332366430cc4bd5578a197166b8f | 3,287 | package com.mycompany.drawingboard.light;
import grizzly.MyGrizzlyServerContainer;
import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.server.ResourceConfig;
import java.io.IOException;
import java.net.URI;
import java.util.Optional;
import javax.websocket.DeploymentException;
import org.glassfish.grizzly.http.server.CLStaticHttpHandler;
import org.glassfish.jersey.media.sse.SseFeature;
import org.glassfish.jersey.moxy.json.MoxyJsonFeature;
import org.glassfish.tyrus.server.TyrusServerContainer;
/**
* Main class.
*
*/
public class Main {
public static final Optional<String> host = Optional.ofNullable(System.getenv("HOST"));
public static final Optional<String> port = Optional.ofNullable(System.getenv("PORT"));
// Base URI the Grizzly HTTP server will listen on
public static final String BASE_URI = "http://" + host.orElse("0.0.0.0")
+ ":" + port.orElse("8080") + "/api/";
/**
* Creates and configures a Grizzly HTTP server as a Jersey container,
* exposing JAX-RS resources defined in this application.
* @return Grizzly HTTP server.
*/
public static HttpServer getJerseyContainer() {
// create a resource config that scans for JAX-RS resources and providers
// in com.mycompany.drawingboard.light package
final ResourceConfig rc = new ResourceConfig()
.register(DrawingsResource.class)
.register(SseFeature.class)
.register(MoxyJsonFeature.class);
// create and start a new instance of grizzly http server
// exposing the Jersey application at BASE_URI
HttpServer server = GrizzlyHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc, false);
server.getServerConfiguration().addHttpHandler(new CLStaticHttpHandler(Main.class.getClassLoader()), "/");
//com.sun.net.httpserver.HttpServer server = JdkHttpServerFactory.createHttpServer(URI.create(BASE_URI), rc, false);
return server;
}
/**
* Creates and configures a Tyrus server container, based on an existing grizzly HTTP server
* @return Tyrus server container.
*/
public static TyrusServerContainer getTyrusContainer(HttpServer server) throws DeploymentException {
TyrusServerContainer container = (TyrusServerContainer)new MyGrizzlyServerContainer(server).createContainer(null);
container.addEndpoint(DrawingWebSocket.class);
return container;
}
/**
* Main method.
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException, DeploymentException {
final HttpServer jcontainer = getJerseyContainer();
TyrusServerContainer tcontainer = getTyrusContainer(jcontainer);
tcontainer.start("/", Integer.valueOf(port.orElse("8080")));
System.out.println(String.format("drawingboard-light started at %s" +
"\nHit enter to stop it...", BASE_URI.substring(0, BASE_URI.indexOf("api"))));
System.in.read();
tcontainer.stop();
}
}
| 42.688312 | 125 | 0.684819 |
cb1888c7311b7fc41dc4f070083486b0149ad6e5 | 2,514 | /* ###
* IP: GHIDRA
* REVIEWED: YES
*
* 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 ghidra.app.util.bin.format.coff;
import ghidra.app.util.bin.BinaryReader;
import java.io.IOException;
final class CoffSymbolAuxFactory {
static CoffSymbolAux read(BinaryReader reader, CoffSymbol symbol) throws IOException {
if (symbol.getDerivedType(1) == CoffSymbolType.DT_NON && symbol.getBasicType() == CoffSymbolType.T_NULL) {
if (symbol.getStorageClass() == CoffSymbolStorageClass.C_FILE) {
return new CoffSymbolAuxFilename(reader);
}
if (symbol.getStorageClass() == CoffSymbolStorageClass.C_STAT) {
return new CoffSymbolAuxSection(reader);
}
if (symbol.getStorageClass() == CoffSymbolStorageClass.C_STRTAG ||
symbol.getStorageClass() == CoffSymbolStorageClass.C_UNTAG ||
symbol.getStorageClass() == CoffSymbolStorageClass.C_ENTAG) {
return new CoffSymbolAuxTagName(reader);
}
if (symbol.getStorageClass() == CoffSymbolStorageClass.C_EOS) {
return new CoffSymbolAuxEndOfStruct(reader);
}
if (symbol.getStorageClass() == CoffSymbolStorageClass.C_BLOCK) {
return new CoffSymbolAuxBeginningOfBlock(reader);
}
if (symbol.getStorageClass() == CoffSymbolStorageClass.C_FCN) {
return new CoffSymbolAuxFunction(reader);
}
}
if (symbol.getDerivedType(1) == CoffSymbolType.DT_FCN) {
if (symbol.getStorageClass() == CoffSymbolStorageClass.C_EXT) {
return new CoffSymbolAuxFunction(reader);
}
if (symbol.getStorageClass() == CoffSymbolStorageClass.C_STAT) {
return new CoffSymbolAuxFunction(reader);
}
}
if (symbol.getDerivedType(1) == CoffSymbolType.DT_ARY) {
switch (symbol.getStorageClass()) {
case CoffSymbolStorageClass.C_AUTO:
case CoffSymbolStorageClass.C_STAT:
case CoffSymbolStorageClass.C_MOS:
case CoffSymbolStorageClass.C_MOU:
case CoffSymbolStorageClass.C_TPDEF:
return new CoffSymbolAuxArray(reader);
}
}
return new CoffSymbolAuxDefault(reader);
}
}
| 33.52 | 108 | 0.737868 |
add065fd07d715d05322abdc5396408807af5e2f | 6,719 | package com.cxm.android.semaforo;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.os.Vibrator;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.LinearLayout;
import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.Random;
public class MainActivity extends AppCompatActivity implements Animation.AnimationListener {
private ArrayList<Button> controls;
private ArrayList<Integer> path;
private ArrayList<Integer> virtualPath;
private Animation animationScaleUp;
private Animation animationBlink;
private Snackbar snackbar;
private LinearLayout rootLayout;
private static final int START_DIFFICULTY = 3;
private int level = 1;
private boolean lose = false;
private int it = 0;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button ctrlRed = findViewById(R.id.button_red);
Button ctrlYellow = findViewById(R.id.button_yellow);
Button ctrlGreen = findViewById(R.id.button_green);
Button ctrlBlue = findViewById(R.id.button_blue);
Button ctrlViolet = findViewById(R.id.button_violet);
controls = new ArrayList<>();
controls.add(ctrlRed);
controls.add(ctrlYellow);
controls.add(ctrlGreen);
controls.add(ctrlBlue);
controls.add(ctrlViolet);
rootLayout = findViewById(R.id.main);
setup();
}
private void setup() {
level = 1;
lose = false;
path = new ArrayList<>();
virtualPath = new ArrayList<>();
controls.get(4).setVisibility(View.GONE);
disableControls();
Random random = new Random();
for (int i = 0; i < START_DIFFICULTY + level; i++) {
path.add(random.nextInt(4));
}
printPath();
}
private void levelUp() {
level++;
if (level > 3){
controls.get(4).setVisibility(View.VISIBLE);
}
path = new ArrayList<>();
virtualPath = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < START_DIFFICULTY + level; i++) {
path.add(random.nextInt(level > 3 ? 5 : 4));
}
printPath();
}
private void printPath() {
it = 0;
animationScaleUp = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.anim_scale_up);
animationScaleUp.setAnimationListener(this);
controls.get(path.get(it)).startAnimation(animationScaleUp);
}
private void loseGame() {
if (!lose) {
lose = true;
disableControls();
showSnackLose();
}
}
public void onClickControl(View v) {
int index = -1;
Button button = (Button) v;
switch (button.getId()){
case R.id.button_red:
index = 0;
break;
case R.id.button_yellow:
index = 1;
break;
case R.id.button_green:
index = 2;
break;
case R.id.button_blue:
index = 3;
break;
case R.id.button_violet:
index = 4;
break;
}
virtualPath.add(index);
if (virtualPath.get(virtualPath.size() - 1).equals(path.get(virtualPath.size() - 1)) && virtualPath.size() == path.size()){
animateOnClick(index, true);
disableControls();
showSnackLevelUp();
}else if (virtualPath.get(virtualPath.size() - 1).equals(path.get(virtualPath.size() - 1))){
animateOnClick(index, true);
}else {
animateOnClick(index, false);
}
}
public void animateOnClick(int idButton, boolean isGood) {
if (isGood) {
controls.get(idButton).clearAnimation();
animationScaleUp = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.anim_scale_up);
controls.get(idButton).startAnimation(animationScaleUp);
} else {
controls.get(idButton).clearAnimation();
animationBlink = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.anim_blink);
controls.get(idButton).startAnimation(animationBlink);
loseGame();
}
}
private void enableControls() {
for (Button button : controls) {
button.setEnabled(true);
button.clearAnimation();
}
}
private void disableControls() {
for (Button button : controls) {
button.setEnabled(false);
}
}
private void showSnackLevelUp() {
snackbar = Snackbar.make(rootLayout, "Nivel " + level + " completado.", Snackbar.LENGTH_INDEFINITE);
snackbar.setAction("Siguiente", new View.OnClickListener() {
@Override
public void onClick(View view) {
snackbar.dismiss();
levelUp();
}
});
Vibrator vibrator = (Vibrator) getApplication().getSystemService(MainActivity.VIBRATOR_SERVICE);
if (vibrator.hasVibrator()) {
vibrator.vibrate(200);
}
snackbar.show();
}
private void showSnackLose() {
snackbar = Snackbar.make(rootLayout, "Sorry! Camino incorrecto.", Snackbar.LENGTH_INDEFINITE);
snackbar.setAction("Reintentar", new View.OnClickListener() {
@Override
public void onClick(View view) {
snackbar.dismiss();
for (Button button : controls) {
button.clearAnimation();
}
setup();
}
});
Vibrator vibrator = (Vibrator) getApplication().getSystemService(MainActivity.VIBRATOR_SERVICE);
if (vibrator.hasVibrator()) {
vibrator.vibrate(1000);
}
snackbar.show();
}
@Override
public void onAnimationEnd(Animation animation) {
it++;
if (it < path.size()){
animationScaleUp = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.anim_scale_up);
animationScaleUp.setAnimationListener(this);
controls.get(path.get(it)).startAnimation(animationScaleUp);
}else{
enableControls();
}
}
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
}
| 30.680365 | 131 | 0.592797 |
765a3292db63cbbaf0da326cff65c6289f041a2a | 1,576 | /*
* Copyright (c) 2011-2013, Peter Abeles. All Rights Reserved.
*
* This file is part of BoofCV (http://boofcv.org).
*
* 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 boofcv.abst.geo.fitting;
import org.ejml.data.DenseMatrix64F;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
/**
* @author Peter Abeles
*/
public class TestModelManagerEpipolarMatrix {
@Test
public void createModelInstance() {
ModelManagerEpipolarMatrix alg = new ModelManagerEpipolarMatrix();
DenseMatrix64F found = alg.createModelInstance();
assertTrue( found != null );
assertEquals(3, found.getNumRows());
assertEquals(3,found.getNumCols());
}
@Test
public void copyModel() {
ModelManagerEpipolarMatrix alg = new ModelManagerEpipolarMatrix();
DenseMatrix64F m = new DenseMatrix64F(3,3);
for( int i = 0; i < 9; i++ )
m.data[i] = i+1;
DenseMatrix64F copy = new DenseMatrix64F(3,3);
alg.copyModel(m,copy);
for( int i = 0; i < 9; i++ )
assertEquals(i+1,copy.data[i],1e-8);
}
}
| 27.649123 | 75 | 0.721447 |
bb90e9c5fa6e00a6f2b7d82c15e8b9e2e20afa62 | 1,285 | package org.example.second;
public class Customer extends Thread {
private final BarberShop barberShop;
private volatile boolean cut = false;
public Customer(BarberShop barberShop) {
this.barberShop = barberShop;
}
@Override
public void run() {
while (!cut) {
if (barberShop.hasFreeSpace()) enter();
else {
leaveNoSpace();
break;
}
try {
barberShop.customerReady.release();
barberShop.barberReady.acquire();
} catch (InterruptedException e) {
e.printStackTrace();
}
getHairCut();
leave();
}
}
public void enter() {
System.out.println("Customer entered the barbershop " + Thread.currentThread().getName());
}
public void getHairCut() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
cut = true;
System.out.println("Customer is getting the hair cut " + Thread.currentThread().getName());
}
public void leaveNoSpace() {
System.out.println(
"Customer has left the shop because there was no space "
+ Thread.currentThread().getName());
}
public void leave() {
System.out.println("Customer has left the shop " + Thread.currentThread().getName());
}
}
| 22.946429 | 95 | 0.622568 |
0cc945a86da9019f9ed38305f053ea42f868fc60 | 1,707 | /**
* Copyright (c) 2016 Julian Sven Baehr
*
* See the file license.txt for copying permission.
*/
package de.eternity.input;
/**
* Handles button related input.
* @author Julian Sven Baehr
*
*/
public class ButtonInput {
public static final boolean STATE_PRESSED = true, STATE_RELEASED = false;
private boolean[] buffer, active;
private Object eventLock = new Object(){};
/**
* Creates a new button input instance.
* @param buttonCount The amount of buttons.
*/
public ButtonInput(int buttonCount){
buffer = new boolean[buttonCount];
active = new boolean[buttonCount];
}
/**
* Flips the buffer of currently pressed keys.
* Must be called once every game tick.
* @throws InterruptedException
*/
public void flip() throws InterruptedException{
//use the atomic integer value as a lock
synchronized (eventLock) {
for(int i = 0; i < buffer.length; i++)
active[i] = buffer[i];
}
}
/**
* Sets the buffer at the key to the given state.
* @param key The key.
* @param state The keys state.
*/
void setBuffer(int key, boolean state){
//for listeners there will always only be one thread in here
//therefore the simple synchronized(eventLock) is the most efficient way
//to synchronize between reading/flipping and writinga
synchronized (eventLock) {
//update the button state
if(key >= 0 && key < buffer.length)
buffer[key] = state;
}
}
/**
* @param key The key.
* @return True if the key is pressed.
*/
public boolean isPressed(int key){
if(key >= 0 && key < buffer.length)
return active[key];
else
//this is true since the button does not exist or is not accounted for
return false;
}
}
| 23.067568 | 74 | 0.674868 |
24caa59cd5b8b6dd7b86176f0d41ada85ad866c6 | 5,093 | /*
* Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package software.amazon.awssdk.http.urlconnection;
import static software.amazon.awssdk.http.HttpStatusFamily.CLIENT_ERROR;
import static software.amazon.awssdk.http.HttpStatusFamily.SERVER_ERROR;
import static software.amazon.awssdk.http.SdkHttpConfigurationOption.CONNECTION_TIMEOUT;
import static software.amazon.awssdk.http.SdkHttpConfigurationOption.SOCKET_TIMEOUT;
import static software.amazon.awssdk.utils.FunctionalUtils.invokeSafely;
import static software.amazon.awssdk.utils.NumericUtils.saturatedCast;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import software.amazon.awssdk.annotations.SdkInternalApi;
import software.amazon.awssdk.http.AbortableCallable;
import software.amazon.awssdk.http.AbortableInputStream;
import software.amazon.awssdk.http.HttpStatusFamily;
import software.amazon.awssdk.http.SdkHttpClient;
import software.amazon.awssdk.http.SdkHttpConfigurationOption;
import software.amazon.awssdk.http.SdkHttpFullRequest;
import software.amazon.awssdk.http.SdkHttpFullResponse;
import software.amazon.awssdk.http.SdkRequestContext;
import software.amazon.awssdk.utils.AttributeMap;
import software.amazon.awssdk.utils.IoUtils;
@SdkInternalApi
final class UrlConnectionHttpClient implements SdkHttpClient {
private final AttributeMap options;
UrlConnectionHttpClient(AttributeMap options) {
this.options = options;
}
@Override
public AbortableCallable<SdkHttpFullResponse> prepareRequest(SdkHttpFullRequest request, SdkRequestContext requestContext) {
final HttpURLConnection connection = createAndConfigureConnection(request);
return new RequestCallable(connection, request);
}
@Override
public <T> Optional<T> getConfigurationValue(SdkHttpConfigurationOption<T> key) {
return Optional.ofNullable(options.get(key));
}
@Override
public void close() {
}
private HttpURLConnection createAndConfigureConnection(SdkHttpFullRequest request) {
HttpURLConnection connection = invokeSafely(() -> (HttpURLConnection) request.getUri().toURL().openConnection());
request.headers().forEach((key, values) -> values.forEach(value -> connection.setRequestProperty(key, value)));
invokeSafely(() -> connection.setRequestMethod(request.method().name()));
if (request.content().isPresent()) {
connection.setDoOutput(true);
}
connection.setConnectTimeout(saturatedCast(options.get(CONNECTION_TIMEOUT).toMillis()));
connection.setReadTimeout(saturatedCast(options.get(SOCKET_TIMEOUT).toMillis()));
return connection;
}
private static class RequestCallable implements AbortableCallable<SdkHttpFullResponse> {
private final HttpURLConnection connection;
private final SdkHttpFullRequest request;
private RequestCallable(HttpURLConnection connection, SdkHttpFullRequest request) {
this.connection = connection;
this.request = request;
}
@Override
public SdkHttpFullResponse call() throws Exception {
connection.connect();
request.content().ifPresent(content -> invokeSafely(() -> IoUtils.copy(content, connection.getOutputStream())));
int responseCode = connection.getResponseCode();
boolean isErrorResponse = HttpStatusFamily.of(responseCode).isOneOf(CLIENT_ERROR, SERVER_ERROR);
InputStream content = !isErrorResponse ? connection.getInputStream() : connection.getErrorStream();
return SdkHttpFullResponse.builder()
.statusCode(responseCode)
.statusText(connection.getResponseMessage())
.content(new AbortableInputStream(content, () -> { /* TODO: Don't ignore abort? */ }))
.headers(extractHeaders(connection))
.build();
}
private Map<String, List<String>> extractHeaders(HttpURLConnection response) {
return response.getHeaderFields().entrySet().stream()
.filter(e -> e.getKey() != null)
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}
@Override
public void abort() {
connection.disconnect();
}
}
}
| 41.745902 | 128 | 0.709601 |
76d74e588c2576417a5d5f5b6f9065b67d7906c6 | 3,736 | package cn.ucai.SuperWechat.activity;
import java.util.Collections;
import java.util.List;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.easemob.chat.EMContactManager;
import cn.ucai.SuperWechat.R;
import com.easemob.exceptions.EaseMobException;
/**
* 黑名单列表页面
*
*/
public class BlacklistActivity extends Activity {
private ListView listView;
private BlacklistAdapater adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_black_list);
listView = (ListView) findViewById(R.id.list);
// 从本地获取黑名单
List<String> blacklist = EMContactManager.getInstance().getBlackListUsernames();
// 显示黑名单列表
if (blacklist != null) {
Collections.sort(blacklist);
adapter = new BlacklistAdapater(this, 1, blacklist);
listView.setAdapter(adapter);
}
// 注册上下文菜单
registerForContextMenu(listView);
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
super.onCreateContextMenu(menu, v, menuInfo);
getMenuInflater().inflate(R.menu.remove_from_blacklist, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item) {
if (item.getItemId() == R.id.remove) {
final String tobeRemoveUser = adapter.getItem(((AdapterContextMenuInfo) item.getMenuInfo()).position);
// 把目标user移出黑名单
removeOutBlacklist(tobeRemoveUser);
return true;
}
return super.onContextItemSelected(item);
}
/**
* 移出黑民单
*
* @param tobeRemoveUser
*/
void removeOutBlacklist(final String tobeRemoveUser) {
final ProgressDialog pd = new ProgressDialog(this);
pd.setMessage(getString(R.string.be_removing));
pd.setCanceledOnTouchOutside(false);
pd.show();
new Thread(new Runnable() {
public void run() {
try {
// 移出黑民单
EMContactManager.getInstance().deleteUserFromBlackList(tobeRemoveUser);
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
adapter.remove(tobeRemoveUser);
}
});
} catch (EaseMobException e) {
e.printStackTrace();
runOnUiThread(new Runnable() {
public void run() {
pd.dismiss();
Toast.makeText(getApplicationContext(), R.string.Removed_from_the_failure, 0).show();
}
});
}
}
}).start();
}
/**
* adapter
*
*/
private class BlacklistAdapater extends ArrayAdapter<String> {
public BlacklistAdapater(Context context, int textViewResourceId, List<String> objects) {
super(context, textViewResourceId, objects);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (convertView == null) {
convertView = View.inflate(getContext(), R.layout.row_contact, null);
}
TextView name = (TextView) convertView.findViewById(R.id.name);
name.setText(getItem(position));
return convertView;
}
}
/**
* 返回
*
* @param view
*/
public void back(View view) {
finish();
}
}
| 26.877698 | 113 | 0.658458 |
93598c252bec6a1e8b6c70ca021fb6b824d0c8d2 | 6,551 | /*******************************************************************************
* Copyright (c) 2010, 2011 Tran Nam Quang.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Tran Nam Quang - initial API and implementation
*******************************************************************************/
package net.sourceforge.docfetcher.model.index.file;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import net.sourceforge.docfetcher.enums.ProgramConf;
import net.sourceforge.docfetcher.model.Path;
import net.sourceforge.docfetcher.model.TreeNode;
import net.sourceforge.docfetcher.model.index.IndexingConfig;
import net.sourceforge.docfetcher.model.index.IndexingError;
import net.sourceforge.docfetcher.model.index.IndexingError.ErrorType;
import net.sourceforge.docfetcher.model.index.IndexingReporter;
import net.sourceforge.docfetcher.util.Stoppable;
import net.sourceforge.docfetcher.util.Util;
import net.sourceforge.docfetcher.util.annotations.NotNull;
import net.sourceforge.docfetcher.util.annotations.Nullable;
/**
* @author Tran Nam Quang
*/
abstract class HtmlFileLister<T extends Throwable> extends Stoppable<T> {
private final File parentDir;
private final IndexingConfig config;
private final Collection<String> htmlExtensions;
private final boolean htmlPairing;
@Nullable private final IndexingReporter reporter;
public HtmlFileLister( @NotNull File parentDir,
@NotNull IndexingConfig config,
@Nullable IndexingReporter reporter) {
Util.checkNotNull(parentDir, config);
this.parentDir = parentDir;
this.config = config;
this.htmlExtensions = config.getHtmlExtensions();
this.htmlPairing = config.isHtmlPairing();
this.reporter = reporter;
}
protected final void doRun() {
if (htmlPairing)
runWithHtmlPairing();
else
runWithoutHtmlPairing();
}
private void runWithoutHtmlPairing() {
for (File fileOrDir : Util.listFiles(parentDir)) {
if (isStopped())
return;
boolean isFile;
try {
if (Util.isSymLink(fileOrDir))
continue;
if (skip(fileOrDir))
continue;
isFile = fileOrDir.isFile();
if (ProgramConf.Bool.IgnoreJunctionsAndSymlinks.get()
&& !isFile && Util.isJunctionOrSymlink(fileOrDir))
continue;
}
catch (Throwable t) {
handleFileException(t, fileOrDir);
continue;
}
if (isFile) {
if (isHtmlFile(fileOrDir))
handleHtmlPair(fileOrDir, null);
else
handleFile(fileOrDir);
} else if (fileOrDir.isDirectory()) {
handleDir(fileOrDir);
}
}
}
private void runWithHtmlPairing() {
File[] filesOrDirs = Util.listFiles(parentDir);
if (filesOrDirs.length == 0)
return; // Returning early avoids allocating the two lists below
List<File> htmlFiles = new LinkedList<File> ();
List<File> tempDirs = new ArrayList<File> ();
// Note: The file filter should be applied *after* the HTML pairing.
for (final File fileOrDir : filesOrDirs) {
if (isStopped())
return;
boolean isFile;
try {
if (Util.isSymLink(fileOrDir))
continue;
isFile = fileOrDir.isFile();
if (ProgramConf.Bool.IgnoreJunctionsAndSymlinks.get()
&& !isFile && Util.isJunctionOrSymlink(fileOrDir))
continue;
}
catch (Throwable t) {
handleFileException(t, fileOrDir);
continue;
}
if (isFile) {
if (isHtmlFile(fileOrDir))
htmlFiles.add(fileOrDir);
else if (!skip(fileOrDir))
handleFile(fileOrDir);
}
else if (fileOrDir.isDirectory()) {
tempDirs.add(fileOrDir);
}
}
/*
* Bug #3538230: We've already called isFile() and isDirectory() on all
* found files and directories in the previous loop, but we must do it
* again in the two following loops, because enough time may have passed
* due to indexing to allow the user to delete any of the files and
* directories from outside.
*/
for (File dirCandidate : tempDirs) {
if (isStopped())
return;
String dirBasename = HtmlUtil.getHtmlDirBasename(dirCandidate);
if (dirBasename == null) {
if (!skip(dirCandidate) && dirCandidate.isDirectory())
handleDir(dirCandidate);
continue;
}
boolean htmlPairFound = false;
for (Iterator<File> it = htmlFiles.iterator(); it.hasNext(); ) {
File htmlCandidate = it.next();
if (Util.splitFilename(htmlCandidate)[0].equals(dirBasename)) {
if (!skip(htmlCandidate) && htmlCandidate.isFile()
&& dirCandidate.isDirectory())
handleHtmlPair(htmlCandidate, dirCandidate);
it.remove();
htmlPairFound = true;
break;
}
}
if (!htmlPairFound && !skip(dirCandidate)
&& dirCandidate.isDirectory())
handleDir(dirCandidate);
}
// Visit unpaired html files
for (File htmlFile : htmlFiles) {
if (isStopped())
return;
if (!skip(htmlFile) && htmlFile.isFile())
handleHtmlPair(htmlFile, null);
}
}
private boolean isHtmlFile(@NotNull File file) {
return Util.hasExtension(file.getName(), htmlExtensions);
}
private void handleFileException( @NotNull Throwable t,
@NotNull final File file) {
/*
* TrueZIP can throw various runtime exceptions, e.g. a
* CharConversionException while traversing zip files containing Chinese
* encodings. There was also a tar-related crash, as reported in
* #3436750.
*/
if (reporter == null) {
Util.printErr(Util.getLowestMessage(t));
return;
}
String filename = file.getName();
TreeNode treeNode = new TreeNode(filename) {
private static final long serialVersionUID = 1L;
public Path getPath() {
return config.getStorablePath(file);
}
};
reporter.fail(new IndexingError(ErrorType.ENCODING, treeNode, t.getCause()));
}
// guaranteed not to be an HTML file
protected abstract void handleFile(@NotNull File file);
// if HTML pairing is off, this method will be called on HTML files as well,
// but with empty htmlDir argument
protected abstract void handleHtmlPair( @NotNull File htmlFile,
@Nullable File htmlDir);
// dir will never be a symlink
protected abstract void handleDir(@NotNull File dir);
// Will be called before any of the handle methods is called
protected abstract boolean skip(@NotNull File fileOrDir);
}
| 30.050459 | 81 | 0.691192 |
002a25365676aa421c3c6b9aca02b5d75e96901b | 6,924 | package com.aaa.project.system.planInfo.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.aaa.framework.web.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 计划定制表 hn_plan_info
*
* @author teacherChen
* @date 2019-07-30
*/
public class PlanInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 计划id */
private Integer planId;
/** 计划名称 */
private String planName;
/** 站点id */
private Integer resId;
/** 驻点id */
private Integer stpoId;
/** 起始时间 */
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")//从javabean到js
@DateTimeFormat(pattern="yyyy-MM-dd")//form表单到javabean
private Date starttime;
/** 结束时间 */
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")//从javabean到js
@DateTimeFormat(pattern="yyyy-MM-dd")//form表单到javabean
private Date endtime;
/** 审核结果 */
private String planState;
/** 审核结果id */
private Integer checkId;
/** 模板id */
private Integer templateId;
/*模板类型*/
private String temp_type;
/*驻点名称*/
private String stpo_name;
/*站点名称*/
private String sitename;
/*审核结果*/
private String check_reasons;
/*巡检项名称*/
private String standard_name;
/*质量标注*/
private String standard_quality;
/*周期*/
private String standard_cycle;
/*驻点地址*/
private String stpo_address;
/*站点经纬度*/
private String longandlat;
private String dept_name;
private String deptName;
private String phone;
private String email;
private String checkResult;
private Integer deptId;
private String tempType;
private Integer tempId;
private Integer dept_id;
private String checkReasons;
private String checkState;
public String getCheckState() {
return checkState;
}
public void setCheckState(String checkState) {
this.checkState = checkState;
}
public String getCheckReasons() {
return checkReasons;
}
public void setCheckReasons(String checkReasons) {
this.checkReasons = checkReasons;
}
public Integer getDept_id() {
return dept_id;
}
public void setDept_id(Integer dept_id) {
this.dept_id = dept_id;
}
public String getDeptName() {
return deptName;
}
public void setDeptName(String deptName) {
this.deptName = deptName;
}
public Integer getTempId() {
return tempId;
}
public void setTempId(Integer tempId) {
this.tempId = tempId;
}
public Integer getDeptId() {
return deptId;
}
public void setDeptId(Integer deptId) {
this.deptId = deptId;
}
public String getCheckResult() {
return checkResult;
}
public void setCheckResult(String checkResult) {
this.checkResult = checkResult;
}
public String getDept_name() {
return dept_name;
}
public void setDept_name(String dept_name) {
this.dept_name = dept_name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getTempType() {
return tempType;
}
public void setTempType(String tempType) {
this.tempType = tempType;
}
public void setPlanId(Integer planId)
{
this.planId = planId;
}
public Integer getPlanId()
{
return planId;
}
public void setPlanName(String planName)
{
this.planName = planName;
}
public String getPlanName()
{
return planName;
}
public void setResId(Integer resId)
{
this.resId = resId;
}
public Integer getResId()
{
return resId;
}
public void setStpoId(Integer stpoId)
{
this.stpoId = stpoId;
}
public Integer getStpoId()
{
return stpoId;
}
public void setStarttime(Date starttime)
{
this.starttime = starttime;
}
public Date getStarttime()
{
return starttime;
}
public void setEndtime(Date endtime)
{
this.endtime = endtime;
}
public Date getEndtime()
{
return endtime;
}
public void setPlanState(String planState)
{
this.planState = planState;
}
public String getPlanState()
{
return planState;
}
public void setCheckId(Integer checkId)
{
this.checkId = checkId;
}
public Integer getCheckId()
{
return checkId;
}
public void setTemplateId(Integer templateId)
{
this.templateId = templateId;
}
public Integer getTemplateId()
{
return templateId;
}
public String getTemp_type() {
return temp_type;
}
public void setTemp_type(String temp_type) {
this.temp_type = temp_type;
}
public String getStpo_name() {
return stpo_name;
}
public void setStpo_name(String stpo_name) {
this.stpo_name = stpo_name;
}
public String getSitename() {
return sitename;
}
public void setSitename(String sitename) {
this.sitename = sitename;
}
public String getCheck_reasons() {
return check_reasons;
}
public void setCheck_reasons(String check_reasons) {
this.check_reasons = check_reasons;
}
public String getStandard_name() {
return standard_name;
}
public void setStandard_name(String standard_name) {
this.standard_name = standard_name;
}
public String getStandard_quality() {
return standard_quality;
}
public void setStandard_quality(String standard_quality) {
this.standard_quality = standard_quality;
}
public String getStandard_cycle() {
return standard_cycle;
}
public void setStandard_cycle(String standard_cycle) {
this.standard_cycle = standard_cycle;
}
public String getStpo_address() {
return stpo_address;
}
public void setStpo_address(String stpo_address) {
this.stpo_address = stpo_address;
}
public String getLongandlat() {
return longandlat;
}
public void setLongandlat(String longandlat) {
this.longandlat = longandlat;
}
@Override
public String toString() {
return "PlanInfo{" +
"planId=" + planId +
", planName='" + planName + '\'' +
", resId=" + resId +
", stpoId=" + stpoId +
", starttime=" + starttime +
", endtime=" + endtime +
", planState='" + planState + '\'' +
", checkId=" + checkId +
", templateId=" + templateId +
", temp_type='" + temp_type + '\'' +
", stpo_name='" + stpo_name + '\'' +
", sitename='" + sitename + '\'' +
", check_reasons='" + check_reasons + '\'' +
", standard_name='" + standard_name + '\'' +
", standard_quality='" + standard_quality + '\'' +
", standard_cycle='" + standard_cycle + '\'' +
", stpo_address='" + stpo_address + '\'' +
", longandlat='" + longandlat + '\'' +
", dept_name='" + dept_name + '\'' +
", deptName='" + deptName + '\'' +
", phone='" + phone + '\'' +
", email='" + email + '\'' +
", checkResult='" + checkResult + '\'' +
", deptId=" + deptId +
", tempType='" + tempType + '\'' +
", tempId=" + tempId +
", dept_id=" + dept_id +
", checkReasons='" + checkReasons + '\'' +
", checkState='" + checkState + '\'' +
'}';
}
}
| 19.07438 | 65 | 0.679376 |
7049d0f1db6e504e81478a5892ee7e865a943bbd | 8,892 | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.pinot.core.query.aggregation.function;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.apache.pinot.common.request.context.ExpressionContext;
import org.apache.pinot.common.utils.DataSchema.ColumnDataType;
import org.apache.pinot.core.common.BlockValSet;
import org.apache.pinot.core.common.ObjectSerDeUtils;
import org.apache.pinot.core.query.aggregation.AggregationResultHolder;
import org.apache.pinot.core.query.aggregation.ObjectAggregationResultHolder;
import org.apache.pinot.core.query.aggregation.groupby.GroupByResultHolder;
import org.apache.pinot.core.query.aggregation.groupby.ObjectGroupByResultHolder;
import org.apache.pinot.segment.local.customobject.ValueLongPair;
import org.apache.pinot.segment.spi.AggregationFunctionType;
import org.apache.pinot.spi.data.FieldSpec.DataType;
/**
* This function is used for FirstWithTime calculations.
* <p>The function can be used as FirstWithTime(dataExpression, timeExpression, 'dataType')
* <p>Following arguments are supported:
* <ul>
* <li>dataExpression: expression that contains the column to be calculated first on</li>
* <li>timeExpression: expression that contains the column to be used to decide which data is first, can be any
* Numeric column</li>
* <li>dataType: the data type of data column</li>
* </ul>
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public abstract class FirstWithTimeAggregationFunction<V extends Comparable<V>>
extends BaseSingleInputAggregationFunction<ValueLongPair<V>, V> {
protected final ExpressionContext _timeCol;
private final ObjectSerDeUtils.ObjectSerDe<? extends ValueLongPair<V>> _objectSerDe;
public FirstWithTimeAggregationFunction(ExpressionContext dataCol,
ExpressionContext timeCol,
ObjectSerDeUtils.ObjectSerDe<? extends ValueLongPair<V>> objectSerDe) {
super(dataCol);
_timeCol = timeCol;
_objectSerDe = objectSerDe;
}
public abstract ValueLongPair<V> constructValueLongPair(V value, long time);
public abstract ValueLongPair<V> getDefaultValueTimePair();
public abstract void aggregateResultWithRawData(int length, AggregationResultHolder aggregationResultHolder,
BlockValSet blockValSet, BlockValSet timeValSet);
public abstract void aggregateGroupResultWithRawDataSv(int length,
int[] groupKeyArray,
GroupByResultHolder groupByResultHolder,
BlockValSet blockValSet,
BlockValSet timeValSet);
public abstract void aggregateGroupResultWithRawDataMv(int length,
int[][] groupKeysArray,
GroupByResultHolder groupByResultHolder,
BlockValSet blockValSet,
BlockValSet timeValSet);
@Override
public AggregationFunctionType getType() {
return AggregationFunctionType.FIRSTWITHTIME;
}
@Override
public AggregationResultHolder createAggregationResultHolder() {
return new ObjectAggregationResultHolder();
}
@Override
public GroupByResultHolder createGroupByResultHolder(int initialCapacity, int maxCapacity) {
return new ObjectGroupByResultHolder(initialCapacity, maxCapacity);
}
@Override
public void aggregate(int length, AggregationResultHolder aggregationResultHolder,
Map<ExpressionContext, BlockValSet> blockValSetMap) {
BlockValSet blockValSet = blockValSetMap.get(_expression);
BlockValSet blockTimeSet = blockValSetMap.get(_timeCol);
if (blockValSet.getValueType() != DataType.BYTES) {
aggregateResultWithRawData(length, aggregationResultHolder, blockValSet, blockTimeSet);
} else {
ValueLongPair<V> defaultValueLongPair = getDefaultValueTimePair();
V firstData = defaultValueLongPair.getValue();
long firstTime = defaultValueLongPair.getTime();
// Serialized FirstPair
byte[][] bytesValues = blockValSet.getBytesValuesSV();
for (int i = 0; i < length; i++) {
ValueLongPair<V> firstWithTimePair = _objectSerDe.deserialize(bytesValues[i]);
V data = firstWithTimePair.getValue();
long time = firstWithTimePair.getTime();
if (time <= firstTime) {
firstTime = time;
firstData = data;
}
}
setAggregationResult(aggregationResultHolder, firstData, firstTime);
}
}
protected void setAggregationResult(AggregationResultHolder aggregationResultHolder, V data, long time) {
ValueLongPair firstWithTimePair = aggregationResultHolder.getResult();
if (firstWithTimePair == null || time <= firstWithTimePair.getTime()) {
aggregationResultHolder.setValue(constructValueLongPair(data, time));
}
}
@Override
public void aggregateGroupBySV(int length, int[] groupKeyArray, GroupByResultHolder groupByResultHolder,
Map<ExpressionContext, BlockValSet> blockValSetMap) {
BlockValSet blockValSet = blockValSetMap.get(_expression);
BlockValSet timeValSet = blockValSetMap.get(_timeCol);
if (blockValSet.getValueType() != DataType.BYTES) {
aggregateGroupResultWithRawDataSv(length, groupKeyArray, groupByResultHolder,
blockValSet, timeValSet);
} else {
// Serialized FirstPair
byte[][] bytesValues = blockValSet.getBytesValuesSV();
for (int i = 0; i < length; i++) {
ValueLongPair<V> firstWithTimePair = _objectSerDe.deserialize(bytesValues[i]);
setGroupByResult(groupKeyArray[i],
groupByResultHolder,
firstWithTimePair.getValue(),
firstWithTimePair.getTime());
}
}
}
@Override
public void aggregateGroupByMV(int length, int[][] groupKeysArray, GroupByResultHolder groupByResultHolder,
Map<ExpressionContext, BlockValSet> blockValSetMap) {
BlockValSet blockValSet = blockValSetMap.get(_expression);
BlockValSet timeValSet = blockValSetMap.get(_timeCol);
if (blockValSet.getValueType() != DataType.BYTES) {
aggregateGroupResultWithRawDataMv(length, groupKeysArray, groupByResultHolder, blockValSet, timeValSet);
} else {
// Serialized ValueTimePair
byte[][] bytesValues = blockValSet.getBytesValuesSV();
for (int i = 0; i < length; i++) {
ValueLongPair<V> firstWithTimePair = _objectSerDe.deserialize(bytesValues[i]);
V data = firstWithTimePair.getValue();
long time = firstWithTimePair.getTime();
for (int groupKey : groupKeysArray[i]) {
setGroupByResult(groupKey, groupByResultHolder, data, time);
}
}
}
}
protected void setGroupByResult(int groupKey, GroupByResultHolder groupByResultHolder, V data, long time) {
ValueLongPair firstWithTimePair = groupByResultHolder.getResult(groupKey);
if (firstWithTimePair == null || time <= firstWithTimePair.getTime()) {
groupByResultHolder.setValueForKey(groupKey, constructValueLongPair(data, time));
}
}
@Override
public ValueLongPair<V> extractAggregationResult(AggregationResultHolder aggregationResultHolder) {
ValueLongPair firstWithTimePair = aggregationResultHolder.getResult();
if (firstWithTimePair == null) {
return getDefaultValueTimePair();
} else {
return firstWithTimePair;
}
}
@Override
public ValueLongPair<V> extractGroupByResult(GroupByResultHolder groupByResultHolder, int groupKey) {
ValueLongPair<V> firstWithTimePair = groupByResultHolder.getResult(groupKey);
if (firstWithTimePair == null) {
return getDefaultValueTimePair();
} else {
return firstWithTimePair;
}
}
@Override
public ValueLongPair<V> merge(ValueLongPair<V> intermediateResult1, ValueLongPair<V> intermediateResult2) {
if (intermediateResult1.getTime() <= intermediateResult2.getTime()) {
return intermediateResult1;
} else {
return intermediateResult2;
}
}
@Override
public List<ExpressionContext> getInputExpressions() {
return Arrays.asList(_expression, _timeCol);
}
@Override
public ColumnDataType getIntermediateResultColumnType() {
return ColumnDataType.OBJECT;
}
@Override
public V extractFinalResult(ValueLongPair<V> intermediateResult) {
return intermediateResult.getValue();
}
}
| 39.874439 | 113 | 0.747301 |
5384b8c41f3a7311c0cc512e09a715d5c3fe55b5 | 34,620 | begin_unit|revision:0.9.5;language:Java;cregit-version:0.0.1
begin_comment
comment|/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
end_comment
begin_package
package|package
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|session
package|;
end_package
begin_import
import|import static
name|com
operator|.
name|google
operator|.
name|common
operator|.
name|base
operator|.
name|Preconditions
operator|.
name|checkNotNull
import|;
end_import
begin_import
import|import static
name|com
operator|.
name|google
operator|.
name|common
operator|.
name|collect
operator|.
name|Sets
operator|.
name|newHashSet
import|;
end_import
begin_import
import|import static
name|com
operator|.
name|google
operator|.
name|common
operator|.
name|collect
operator|.
name|Sets
operator|.
name|newTreeSet
import|;
end_import
begin_import
import|import static
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|plugins
operator|.
name|value
operator|.
name|jcr
operator|.
name|PartialValueFactory
operator|.
name|DEFAULT_BLOB_ACCESS_PROVIDER
import|;
end_import
begin_import
import|import
name|java
operator|.
name|util
operator|.
name|ArrayList
import|;
end_import
begin_import
import|import
name|java
operator|.
name|util
operator|.
name|Iterator
import|;
end_import
begin_import
import|import
name|java
operator|.
name|util
operator|.
name|List
import|;
end_import
begin_import
import|import
name|java
operator|.
name|util
operator|.
name|Map
import|;
end_import
begin_import
import|import
name|java
operator|.
name|util
operator|.
name|Set
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|jcr
operator|.
name|PathNotFoundException
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|jcr
operator|.
name|Repository
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|jcr
operator|.
name|RepositoryException
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|jcr
operator|.
name|UnsupportedRepositoryOperationException
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|jcr
operator|.
name|ValueFactory
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|jcr
operator|.
name|observation
operator|.
name|ObservationManager
import|;
end_import
begin_import
import|import
name|javax
operator|.
name|jcr
operator|.
name|security
operator|.
name|AccessControlManager
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|api
operator|.
name|security
operator|.
name|JackrabbitAccessControlManager
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|api
operator|.
name|security
operator|.
name|authorization
operator|.
name|PrivilegeManager
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|api
operator|.
name|security
operator|.
name|principal
operator|.
name|PrincipalManager
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|api
operator|.
name|security
operator|.
name|user
operator|.
name|UserManager
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|api
operator|.
name|stats
operator|.
name|RepositoryStatistics
operator|.
name|Type
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|api
operator|.
name|blob
operator|.
name|BlobAccessProvider
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|delegate
operator|.
name|AccessControlManagerDelegator
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|delegate
operator|.
name|JackrabbitAccessControlManagerDelegator
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|delegate
operator|.
name|NodeDelegate
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|delegate
operator|.
name|PrincipalManagerDelegator
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|delegate
operator|.
name|PrivilegeManagerDelegator
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|delegate
operator|.
name|SessionDelegate
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|delegate
operator|.
name|UserManagerDelegator
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|observation
operator|.
name|ObservationManagerImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|security
operator|.
name|AccessManager
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|jcr
operator|.
name|session
operator|.
name|operation
operator|.
name|SessionOperation
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|namepath
operator|.
name|NamePathMapper
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|namepath
operator|.
name|impl
operator|.
name|NamePathMapperImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|plugins
operator|.
name|nodetype
operator|.
name|ReadOnlyNodeTypeManager
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|plugins
operator|.
name|observation
operator|.
name|CommitRateLimiter
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|plugins
operator|.
name|value
operator|.
name|jcr
operator|.
name|ValueFactoryImpl
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|spi
operator|.
name|mount
operator|.
name|MountInfoProvider
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|spi
operator|.
name|security
operator|.
name|SecurityConfiguration
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|spi
operator|.
name|security
operator|.
name|SecurityProvider
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|spi
operator|.
name|security
operator|.
name|authorization
operator|.
name|AuthorizationConfiguration
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|spi
operator|.
name|security
operator|.
name|principal
operator|.
name|PrincipalConfiguration
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|spi
operator|.
name|security
operator|.
name|privilege
operator|.
name|PrivilegeConfiguration
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|spi
operator|.
name|security
operator|.
name|user
operator|.
name|UserConfiguration
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|spi
operator|.
name|whiteboard
operator|.
name|Whiteboard
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|spi
operator|.
name|xml
operator|.
name|ProtectedItemImporter
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|stats
operator|.
name|CounterStats
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|stats
operator|.
name|MeterStats
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|stats
operator|.
name|StatisticManager
import|;
end_import
begin_import
import|import
name|org
operator|.
name|apache
operator|.
name|jackrabbit
operator|.
name|oak
operator|.
name|stats
operator|.
name|TimerStats
import|;
end_import
begin_import
import|import
name|org
operator|.
name|jetbrains
operator|.
name|annotations
operator|.
name|NotNull
import|;
end_import
begin_import
import|import
name|org
operator|.
name|jetbrains
operator|.
name|annotations
operator|.
name|Nullable
import|;
end_import
begin_import
import|import
name|org
operator|.
name|slf4j
operator|.
name|Logger
import|;
end_import
begin_import
import|import
name|org
operator|.
name|slf4j
operator|.
name|LoggerFactory
import|;
end_import
begin_comment
comment|/** * Instances of this class are passed to all JCR implementation classes * (e.g. {@code SessionImpl}, {@code NodeImpl}, etc.) and provide access to * the session scoped instances generally needed (e.g. {@code NamePathMapper}, * {@code ValueFactory}, etc.). */
end_comment
begin_class
specifier|public
class|class
name|SessionContext
implements|implements
name|NamePathMapper
block|{
specifier|private
specifier|static
specifier|final
name|Logger
name|log
init|=
name|LoggerFactory
operator|.
name|getLogger
argument_list|(
name|SessionContext
operator|.
name|class
argument_list|)
decl_stmt|;
specifier|private
specifier|final
name|Repository
name|repository
decl_stmt|;
specifier|private
specifier|final
name|StatisticManager
name|statisticManager
decl_stmt|;
specifier|private
specifier|final
name|SecurityProvider
name|securityProvider
decl_stmt|;
specifier|private
specifier|final
name|Whiteboard
name|whiteboard
decl_stmt|;
specifier|private
specifier|final
name|Map
argument_list|<
name|String
argument_list|,
name|Object
argument_list|>
name|attributes
decl_stmt|;
specifier|private
specifier|final
name|SessionDelegate
name|delegate
decl_stmt|;
specifier|private
specifier|final
name|int
name|observationQueueLength
decl_stmt|;
specifier|private
specifier|final
name|CommitRateLimiter
name|commitRateLimiter
decl_stmt|;
specifier|private
name|MountInfoProvider
name|mountInfoProvider
decl_stmt|;
specifier|private
specifier|final
name|NamePathMapper
name|namePathMapper
decl_stmt|;
specifier|private
specifier|final
name|ValueFactory
name|valueFactory
decl_stmt|;
specifier|private
name|SessionImpl
name|session
init|=
literal|null
decl_stmt|;
specifier|private
name|WorkspaceImpl
name|workspace
init|=
literal|null
decl_stmt|;
specifier|private
name|AccessControlManager
name|accessControlManager
decl_stmt|;
specifier|private
name|AccessManager
name|accessManager
decl_stmt|;
specifier|private
name|PrincipalManager
name|principalManager
decl_stmt|;
specifier|private
name|UserManager
name|userManager
decl_stmt|;
specifier|private
name|PrivilegeManager
name|privilegeManager
decl_stmt|;
specifier|private
name|ObservationManagerImpl
name|observationManager
decl_stmt|;
specifier|private
name|BlobAccessProvider
name|blobAccessProvider
decl_stmt|;
comment|/** Paths (tokens) of all open scoped locks held by this session. */
specifier|private
specifier|final
name|Set
argument_list|<
name|String
argument_list|>
name|openScopedLocks
init|=
name|newTreeSet
argument_list|()
decl_stmt|;
comment|/** Paths of all session scoped locks held by this session. */
specifier|private
specifier|final
name|Set
argument_list|<
name|String
argument_list|>
name|sessionScopedLocks
init|=
name|newHashSet
argument_list|()
decl_stmt|;
specifier|private
specifier|final
name|boolean
name|fastQueryResultSize
decl_stmt|;
specifier|public
name|SessionContext
parameter_list|(
annotation|@
name|NotNull
name|Repository
name|repository
parameter_list|,
annotation|@
name|NotNull
name|StatisticManager
name|statisticManager
parameter_list|,
annotation|@
name|NotNull
name|SecurityProvider
name|securityProvider
parameter_list|,
annotation|@
name|NotNull
name|Whiteboard
name|whiteboard
parameter_list|,
annotation|@
name|NotNull
name|Map
argument_list|<
name|String
argument_list|,
name|Object
argument_list|>
name|attributes
parameter_list|,
annotation|@
name|NotNull
specifier|final
name|SessionDelegate
name|delegate
parameter_list|,
name|int
name|observationQueueLength
parameter_list|,
name|CommitRateLimiter
name|commitRateLimiter
parameter_list|)
block|{
name|this
argument_list|(
name|repository
argument_list|,
name|statisticManager
argument_list|,
name|securityProvider
argument_list|,
name|whiteboard
argument_list|,
name|attributes
argument_list|,
name|delegate
argument_list|,
name|observationQueueLength
argument_list|,
name|commitRateLimiter
argument_list|,
literal|null
argument_list|,
literal|null
argument_list|,
literal|false
argument_list|)
expr_stmt|;
block|}
specifier|public
name|SessionContext
parameter_list|(
annotation|@
name|NotNull
name|Repository
name|repository
parameter_list|,
annotation|@
name|NotNull
name|StatisticManager
name|statisticManager
parameter_list|,
annotation|@
name|NotNull
name|SecurityProvider
name|securityProvider
parameter_list|,
annotation|@
name|NotNull
name|Whiteboard
name|whiteboard
parameter_list|,
annotation|@
name|NotNull
name|Map
argument_list|<
name|String
argument_list|,
name|Object
argument_list|>
name|attributes
parameter_list|,
annotation|@
name|NotNull
specifier|final
name|SessionDelegate
name|delegate
parameter_list|,
name|int
name|observationQueueLength
parameter_list|,
name|CommitRateLimiter
name|commitRateLimiter
parameter_list|,
name|MountInfoProvider
name|mountInfoProvider
parameter_list|,
annotation|@
name|Nullable
name|BlobAccessProvider
name|blobAccessProvider
parameter_list|,
name|boolean
name|fastQueryResultSize
parameter_list|)
block|{
name|this
operator|.
name|repository
operator|=
name|checkNotNull
argument_list|(
name|repository
argument_list|)
expr_stmt|;
name|this
operator|.
name|statisticManager
operator|=
name|statisticManager
expr_stmt|;
name|this
operator|.
name|securityProvider
operator|=
name|checkNotNull
argument_list|(
name|securityProvider
argument_list|)
expr_stmt|;
name|this
operator|.
name|whiteboard
operator|=
name|checkNotNull
argument_list|(
name|whiteboard
argument_list|)
expr_stmt|;
name|this
operator|.
name|attributes
operator|=
name|checkNotNull
argument_list|(
name|attributes
argument_list|)
expr_stmt|;
name|this
operator|.
name|delegate
operator|=
name|checkNotNull
argument_list|(
name|delegate
argument_list|)
expr_stmt|;
name|this
operator|.
name|observationQueueLength
operator|=
name|observationQueueLength
expr_stmt|;
name|this
operator|.
name|commitRateLimiter
operator|=
name|commitRateLimiter
expr_stmt|;
name|this
operator|.
name|mountInfoProvider
operator|=
name|mountInfoProvider
expr_stmt|;
name|this
operator|.
name|blobAccessProvider
operator|=
name|blobAccessProvider
operator|==
literal|null
condition|?
name|DEFAULT_BLOB_ACCESS_PROVIDER
else|:
name|blobAccessProvider
expr_stmt|;
name|SessionStats
name|sessionStats
init|=
name|delegate
operator|.
name|getSessionStats
argument_list|()
decl_stmt|;
name|sessionStats
operator|.
name|setAttributes
argument_list|(
name|attributes
argument_list|)
expr_stmt|;
name|this
operator|.
name|namePathMapper
operator|=
operator|new
name|NamePathMapperImpl
argument_list|(
name|delegate
operator|.
name|getNamespaces
argument_list|()
argument_list|,
name|delegate
operator|.
name|getIdManager
argument_list|()
argument_list|)
expr_stmt|;
name|this
operator|.
name|valueFactory
operator|=
operator|new
name|ValueFactoryImpl
argument_list|(
name|delegate
operator|.
name|getRoot
argument_list|()
argument_list|,
name|namePathMapper
argument_list|,
name|this
operator|.
name|blobAccessProvider
argument_list|)
expr_stmt|;
name|this
operator|.
name|fastQueryResultSize
operator|=
name|fastQueryResultSize
expr_stmt|;
block|}
specifier|public
specifier|final
name|Map
argument_list|<
name|String
argument_list|,
name|Object
argument_list|>
name|getAttributes
parameter_list|()
block|{
return|return
name|attributes
return|;
block|}
specifier|public
specifier|final
specifier|synchronized
name|SessionImpl
name|getSession
parameter_list|()
block|{
if|if
condition|(
name|session
operator|==
literal|null
condition|)
block|{
name|session
operator|=
name|createSession
argument_list|()
expr_stmt|;
block|}
return|return
name|session
return|;
block|}
specifier|public
specifier|final
specifier|synchronized
name|WorkspaceImpl
name|getWorkspace
parameter_list|()
block|{
if|if
condition|(
name|workspace
operator|==
literal|null
condition|)
block|{
name|workspace
operator|=
name|createWorkspace
argument_list|()
expr_stmt|;
block|}
return|return
name|workspace
return|;
block|}
comment|/** * Factory method for creating the {@link javax.jcr.Session} instance for this * context. Called by {@link #getSession()} when first accessed. Can be * overridden by subclasses to customize the session implementation. * * @return session instance */
specifier|protected
name|SessionImpl
name|createSession
parameter_list|()
block|{
return|return
operator|new
name|SessionImpl
argument_list|(
name|this
argument_list|)
return|;
block|}
comment|/** * Factory method for creating the {@link javax.jcr.Workspace} instance for this * context. Called by {@link #getWorkspace()} when first accessed. Can be * overridden by subclasses to customize the workspace implementation. * * @return session instance */
specifier|protected
name|WorkspaceImpl
name|createWorkspace
parameter_list|()
block|{
return|return
operator|new
name|WorkspaceImpl
argument_list|(
name|this
argument_list|)
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|StatisticManager
name|getStatisticManager
parameter_list|()
block|{
return|return
name|statisticManager
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|MeterStats
name|getMeter
parameter_list|(
name|Type
name|type
parameter_list|)
block|{
return|return
name|statisticManager
operator|.
name|getMeter
argument_list|(
name|type
argument_list|)
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|TimerStats
name|getTimer
parameter_list|(
name|Type
name|type
parameter_list|)
block|{
return|return
name|statisticManager
operator|.
name|getTimer
argument_list|(
name|type
argument_list|)
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|CounterStats
name|getCount
parameter_list|(
name|Type
name|type
parameter_list|)
block|{
return|return
name|statisticManager
operator|.
name|getStatsCounter
argument_list|(
name|type
argument_list|)
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|Repository
name|getRepository
parameter_list|()
block|{
return|return
name|repository
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|SessionDelegate
name|getSessionDelegate
parameter_list|()
block|{
return|return
name|delegate
return|;
block|}
name|SessionNamespaces
name|getNamespaces
parameter_list|()
block|{
return|return
name|delegate
operator|.
name|getNamespaces
argument_list|()
return|;
block|}
annotation|@
name|Override
annotation|@
name|NotNull
specifier|public
name|Map
argument_list|<
name|String
argument_list|,
name|String
argument_list|>
name|getSessionLocalMappings
parameter_list|()
block|{
return|return
name|getNamespaces
argument_list|()
operator|.
name|getSessionLocalMappings
argument_list|()
return|;
block|}
specifier|public
name|ValueFactory
name|getValueFactory
parameter_list|()
block|{
return|return
name|valueFactory
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|AccessControlManager
name|getAccessControlManager
parameter_list|()
throws|throws
name|RepositoryException
block|{
if|if
condition|(
name|accessControlManager
operator|==
literal|null
condition|)
block|{
name|AccessControlManager
name|acm
init|=
name|getConfig
argument_list|(
name|AuthorizationConfiguration
operator|.
name|class
argument_list|)
operator|.
name|getAccessControlManager
argument_list|(
name|delegate
operator|.
name|getRoot
argument_list|()
argument_list|,
name|namePathMapper
argument_list|)
decl_stmt|;
if|if
condition|(
name|acm
operator|instanceof
name|JackrabbitAccessControlManager
condition|)
block|{
name|accessControlManager
operator|=
operator|new
name|JackrabbitAccessControlManagerDelegator
argument_list|(
name|delegate
argument_list|,
operator|(
name|JackrabbitAccessControlManager
operator|)
name|acm
argument_list|)
expr_stmt|;
block|}
else|else
block|{
name|accessControlManager
operator|=
operator|new
name|AccessControlManagerDelegator
argument_list|(
name|delegate
argument_list|,
name|acm
argument_list|)
expr_stmt|;
block|}
block|}
return|return
name|accessControlManager
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|PrincipalManager
name|getPrincipalManager
parameter_list|()
block|{
if|if
condition|(
name|principalManager
operator|==
literal|null
condition|)
block|{
name|principalManager
operator|=
operator|new
name|PrincipalManagerDelegator
argument_list|(
name|delegate
argument_list|,
name|getConfig
argument_list|(
name|PrincipalConfiguration
operator|.
name|class
argument_list|)
operator|.
name|getPrincipalManager
argument_list|(
name|delegate
operator|.
name|getRoot
argument_list|()
argument_list|,
name|namePathMapper
argument_list|)
argument_list|)
expr_stmt|;
block|}
return|return
name|principalManager
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|UserManager
name|getUserManager
parameter_list|()
block|{
if|if
condition|(
name|userManager
operator|==
literal|null
condition|)
block|{
name|userManager
operator|=
operator|new
name|UserManagerDelegator
argument_list|(
name|delegate
argument_list|,
name|getConfig
argument_list|(
name|UserConfiguration
operator|.
name|class
argument_list|)
operator|.
name|getUserManager
argument_list|(
name|delegate
operator|.
name|getRoot
argument_list|()
argument_list|,
name|namePathMapper
argument_list|)
argument_list|)
expr_stmt|;
block|}
return|return
name|userManager
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|PrivilegeManager
name|getPrivilegeManager
parameter_list|()
block|{
if|if
condition|(
name|privilegeManager
operator|==
literal|null
condition|)
block|{
name|privilegeManager
operator|=
operator|new
name|PrivilegeManagerDelegator
argument_list|(
name|delegate
argument_list|,
name|getConfig
argument_list|(
name|PrivilegeConfiguration
operator|.
name|class
argument_list|)
operator|.
name|getPrivilegeManager
argument_list|(
name|delegate
operator|.
name|getRoot
argument_list|()
argument_list|,
name|namePathMapper
argument_list|)
argument_list|)
expr_stmt|;
block|}
return|return
name|privilegeManager
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|List
argument_list|<
name|ProtectedItemImporter
argument_list|>
name|getProtectedItemImporters
parameter_list|()
block|{
comment|// TODO: take non-security related importers into account as well (proper configuration)
name|List
argument_list|<
name|ProtectedItemImporter
argument_list|>
name|importers
init|=
operator|new
name|ArrayList
argument_list|<
name|ProtectedItemImporter
argument_list|>
argument_list|()
decl_stmt|;
for|for
control|(
name|SecurityConfiguration
name|sc
range|:
name|securityProvider
operator|.
name|getConfigurations
argument_list|()
control|)
block|{
name|importers
operator|.
name|addAll
argument_list|(
name|sc
operator|.
name|getProtectedItemImporters
argument_list|()
argument_list|)
expr_stmt|;
block|}
return|return
name|importers
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|ObservationManager
name|getObservationManager
parameter_list|()
throws|throws
name|UnsupportedRepositoryOperationException
block|{
if|if
condition|(
name|observationManager
operator|==
literal|null
condition|)
block|{
name|observationManager
operator|=
operator|new
name|ObservationManagerImpl
argument_list|(
name|this
argument_list|,
name|ReadOnlyNodeTypeManager
operator|.
name|getInstance
argument_list|(
name|delegate
operator|.
name|getRoot
argument_list|()
argument_list|,
name|namePathMapper
argument_list|)
argument_list|,
name|whiteboard
argument_list|,
name|observationQueueLength
argument_list|,
name|commitRateLimiter
argument_list|)
expr_stmt|;
block|}
return|return
name|observationManager
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|BlobAccessProvider
name|getBlobAccessProvider
parameter_list|()
block|{
return|return
name|blobAccessProvider
return|;
block|}
specifier|public
name|boolean
name|hasEventListeners
parameter_list|()
block|{
if|if
condition|(
name|observationManager
operator|!=
literal|null
condition|)
block|{
return|return
name|observationManager
operator|.
name|getRegisteredEventListeners
argument_list|()
operator|.
name|hasNext
argument_list|()
return|;
block|}
return|return
literal|false
return|;
block|}
specifier|public
name|Set
argument_list|<
name|String
argument_list|>
name|getOpenScopedLocks
parameter_list|()
block|{
return|return
name|openScopedLocks
return|;
block|}
specifier|public
name|Set
argument_list|<
name|String
argument_list|>
name|getSessionScopedLocks
parameter_list|()
block|{
return|return
name|sessionScopedLocks
return|;
block|}
specifier|public
name|boolean
name|getFastQueryResultSize
parameter_list|()
block|{
if|if
condition|(
name|System
operator|.
name|getProperty
argument_list|(
literal|"oak.fastQuerySize"
argument_list|)
operator|!=
literal|null
condition|)
block|{
return|return
name|Boolean
operator|.
name|getBoolean
argument_list|(
literal|"oak.fastQuerySize"
argument_list|)
return|;
block|}
return|return
name|fastQueryResultSize
return|;
block|}
annotation|@
name|Nullable
specifier|public
name|MountInfoProvider
name|getMountInfoProvider
parameter_list|()
block|{
return|return
name|mountInfoProvider
return|;
block|}
comment|//-----------------------------------------------------< NamePathMapper>---
annotation|@
name|Override
annotation|@
name|NotNull
specifier|public
name|String
name|getOakName
parameter_list|(
annotation|@
name|NotNull
name|String
name|jcrName
parameter_list|)
throws|throws
name|RepositoryException
block|{
return|return
name|namePathMapper
operator|.
name|getOakName
argument_list|(
name|jcrName
argument_list|)
return|;
block|}
annotation|@
name|Override
annotation|@
name|Nullable
specifier|public
name|String
name|getOakNameOrNull
parameter_list|(
annotation|@
name|NotNull
name|String
name|jcrName
parameter_list|)
block|{
return|return
name|namePathMapper
operator|.
name|getOakNameOrNull
argument_list|(
name|jcrName
argument_list|)
return|;
block|}
annotation|@
name|NotNull
annotation|@
name|Override
specifier|public
name|String
name|getJcrName
parameter_list|(
annotation|@
name|NotNull
name|String
name|oakName
parameter_list|)
block|{
return|return
name|namePathMapper
operator|.
name|getJcrName
argument_list|(
name|oakName
argument_list|)
return|;
block|}
annotation|@
name|Override
annotation|@
name|Nullable
specifier|public
name|String
name|getOakPath
parameter_list|(
name|String
name|jcrPath
parameter_list|)
block|{
return|return
name|namePathMapper
operator|.
name|getOakPath
argument_list|(
name|jcrPath
argument_list|)
return|;
block|}
annotation|@
name|Override
annotation|@
name|NotNull
specifier|public
name|String
name|getJcrPath
parameter_list|(
name|String
name|oakPath
parameter_list|)
block|{
return|return
name|namePathMapper
operator|.
name|getJcrPath
argument_list|(
name|oakPath
argument_list|)
return|;
block|}
comment|/** * Returns the Oak path for the given JCR path, or throws a * {@link javax.jcr.RepositoryException} if the path can not be mapped. * * @param jcrPath JCR path * @return Oak path * @throws javax.jcr.RepositoryException if the path can not be mapped */
annotation|@
name|NotNull
specifier|public
name|String
name|getOakPathOrThrow
parameter_list|(
name|String
name|jcrPath
parameter_list|)
throws|throws
name|RepositoryException
block|{
name|String
name|oakPath
init|=
name|getOakPath
argument_list|(
name|jcrPath
argument_list|)
decl_stmt|;
if|if
condition|(
name|oakPath
operator|!=
literal|null
condition|)
block|{
return|return
name|oakPath
return|;
block|}
else|else
block|{
throw|throw
operator|new
name|RepositoryException
argument_list|(
literal|"Invalid name or path: "
operator|+
name|jcrPath
argument_list|)
throw|;
block|}
block|}
comment|/** * Returns the Oak path for the given JCR path, or throws a * {@link javax.jcr.PathNotFoundException} if the path can not be mapped. * * @param jcrPath JCR path * @return Oak path * @throws javax.jcr.PathNotFoundException if the path can not be mapped */
annotation|@
name|NotNull
specifier|public
name|String
name|getOakPathOrThrowNotFound
parameter_list|(
name|String
name|jcrPath
parameter_list|)
throws|throws
name|PathNotFoundException
block|{
name|String
name|oakPath
init|=
name|getOakPath
argument_list|(
name|jcrPath
argument_list|)
decl_stmt|;
if|if
condition|(
name|oakPath
operator|!=
literal|null
condition|)
block|{
return|return
name|oakPath
return|;
block|}
else|else
block|{
throw|throw
operator|new
name|PathNotFoundException
argument_list|(
name|jcrPath
argument_list|)
throw|;
block|}
block|}
annotation|@
name|NotNull
specifier|public
name|AccessManager
name|getAccessManager
parameter_list|()
block|{
if|if
condition|(
name|accessManager
operator|==
literal|null
condition|)
block|{
name|accessManager
operator|=
operator|new
name|AccessManager
argument_list|(
name|delegate
argument_list|,
name|delegate
operator|.
name|getPermissionProvider
argument_list|()
argument_list|)
expr_stmt|;
block|}
return|return
name|accessManager
return|;
block|}
annotation|@
name|NotNull
specifier|public
name|SecurityProvider
name|getSecurityProvider
parameter_list|()
block|{
return|return
name|securityProvider
return|;
block|}
comment|//-----------------------------------------------------------< internal>---
name|void
name|dispose
parameter_list|()
block|{
try|try
block|{
name|unlockAllSessionScopedLocks
argument_list|()
expr_stmt|;
block|}
catch|catch
parameter_list|(
name|RepositoryException
name|e
parameter_list|)
block|{
throw|throw
operator|new
name|RuntimeException
argument_list|(
literal|"Unexpected repository error"
argument_list|,
name|e
argument_list|)
throw|;
block|}
if|if
condition|(
name|observationManager
operator|!=
literal|null
condition|)
block|{
name|observationManager
operator|.
name|dispose
argument_list|()
expr_stmt|;
block|}
name|getNamespaces
argument_list|()
operator|.
name|clear
argument_list|()
expr_stmt|;
block|}
comment|/** * Unlocks all existing session-scoped locks (if any). Used for cleanup * when a session is being closed. * * @throws RepositoryException if an unexpected problem occurs */
comment|// TODO: should this be in SessionImpl?
specifier|private
name|void
name|unlockAllSessionScopedLocks
parameter_list|()
throws|throws
name|RepositoryException
block|{
name|delegate
operator|.
name|performVoid
argument_list|(
operator|new
name|SessionOperation
argument_list|<
name|Void
argument_list|>
argument_list|(
literal|"unlockAllSessionScopedLocks"
argument_list|)
block|{
annotation|@
name|Override
specifier|public
name|void
name|performVoid
parameter_list|()
block|{
name|Iterator
argument_list|<
name|String
argument_list|>
name|iterator
init|=
name|sessionScopedLocks
operator|.
name|iterator
argument_list|()
decl_stmt|;
while|while
condition|(
name|iterator
operator|.
name|hasNext
argument_list|()
condition|)
block|{
name|NodeDelegate
name|node
init|=
name|delegate
operator|.
name|getNode
argument_list|(
name|iterator
operator|.
name|next
argument_list|()
argument_list|)
decl_stmt|;
if|if
condition|(
name|node
operator|!=
literal|null
condition|)
block|{
try|try
block|{
name|node
operator|.
name|unlock
argument_list|()
expr_stmt|;
comment|// TODO: use a single commit
block|}
catch|catch
parameter_list|(
name|RepositoryException
name|e
parameter_list|)
block|{
name|log
operator|.
name|warn
argument_list|(
literal|"Failed to unlock a session scoped lock"
argument_list|,
name|e
argument_list|)
expr_stmt|;
block|}
block|}
name|iterator
operator|.
name|remove
argument_list|()
expr_stmt|;
block|}
block|}
block|}
argument_list|)
expr_stmt|;
block|}
annotation|@
name|NotNull
specifier|private
parameter_list|<
name|T
parameter_list|>
name|T
name|getConfig
parameter_list|(
name|Class
argument_list|<
name|T
argument_list|>
name|clss
parameter_list|)
block|{
return|return
name|securityProvider
operator|.
name|getConfiguration
argument_list|(
name|clss
argument_list|)
return|;
block|}
block|}
end_class
end_unit
| 14.725649 | 810 | 0.809301 |
05c532f35d44f2a3a3a3b856749c50a4cd763707 | 2,277 | package net.Nephty.rgbee.data;
import net.Nephty.rgbee.Rgbee;
import net.Nephty.rgbee.setup.ModTags;
import net.minecraft.data.BlockTagsProvider;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.ItemTagsProvider;
import net.minecraftforge.common.Tags;
import net.minecraftforge.common.data.ExistingFileHelper;
public class ModItemTagsProvider extends ItemTagsProvider {
public ModItemTagsProvider(DataGenerator dataGenerator, BlockTagsProvider blockTagProvider, ExistingFileHelper existingFileHelper) {
super(dataGenerator, blockTagProvider, Rgbee.MOD_ID, existingFileHelper);
}
@Override
protected void addTags() {
copy(ModTags.Blocks.STORAGE_BLOCKS_POLLEN_BLOCK, ModTags.Items.STORAGE_BLOCKS_POLLEN_BLOCK);
copy(ModTags.Blocks.DECORATION_BLOCKS_ENCHANTED_FLOWER, ModTags.Items.DECORATION_BLOCKS_ENCHANTED_FLOWER);
tag(ModTags.Items.MATERIALS_LIQUID_POLLEN).addTag(Tags.Items.SLIMEBALLS);
tag(ModTags.Items.TOOLS_POLLEN_HARVESTER).addTag(Tags.Items.SHEARS);
tag(ModTags.Items.MISC_POLLEN).addTag(Tags.Items.DUSTS);
tag(ModTags.Items.MISC_GREEN_POLLEN).addTag(Tags.Items.DUSTS);
tag(ModTags.Items.MISC_RED_POLLEN).addTag(Tags.Items.DUSTS);
tag(ModTags.Items.MISC_BLUE_POLLEN).addTag(Tags.Items.DUSTS);
tag(ModTags.Items.MISC_CYAN_POLLEN).addTag(Tags.Items.DUSTS);
tag(ModTags.Items.MISC_MAGENTA_POLLEN).addTag(Tags.Items.DUSTS);
tag(ModTags.Items.MISC_GREEN_WHEAT).addTag(Tags.Items.CROPS_WHEAT);
tag(ModTags.Items.MISC_RED_WHEAT).addTag(Tags.Items.CROPS_WHEAT);
tag(ModTags.Items.MISC_BLUE_WHEAT).addTag(Tags.Items.CROPS_WHEAT);
tag(ModTags.Items.MISC_CYAN_WHEAT).addTag(Tags.Items.CROPS_WHEAT);
tag(ModTags.Items.MISC_MAGENTA_WHEAT).addTag(Tags.Items.CROPS_WHEAT);
// tag(ModTags.Items.MISC_GREEN_COOKIE).addTag(Tags.Items.CROPS_WHEAT);
// tag(ModTags.Items.MISC_RED_COOKIE).addTag(Tags.Items.CROPS_WHEAT);
// tag(ModTags.Items.MISC_BLUE_COOKIE).addTag(Tags.Items.CROPS_WHEAT);
// tag(ModTags.Items.MISC_CYAN_COOKIE).addTag(Tags.Items.CROPS_WHEAT);
// tag(ModTags.Items.MISC_MAGENTA_COOKIE).addTag(Tags.Items.CROPS_WHEAT);
}
}
| 56.925 | 137 | 0.754502 |
2cf09c3bc2af2626bc97cf8c78180d53b3413f0f | 3,183 | /*
* This file provided by Facebook is for non-commercial testing and evaluation
* purposes only. Facebook reserves all rights not expressly granted.
*
* 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
* FACEBOOK 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.facebook.samples.litho.lithography;
import static android.support.v7.widget.LinearSmoothScroller.SNAP_TO_START;
import android.support.v7.widget.LinearLayoutManager;
import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.litho.Component;
import com.facebook.litho.ComponentContext;
import com.facebook.litho.annotations.FromEvent;
import com.facebook.litho.annotations.LayoutSpec;
import com.facebook.litho.annotations.OnCreateLayout;
import com.facebook.litho.annotations.OnEvent;
import com.facebook.litho.annotations.Prop;
import com.facebook.litho.fresco.FrescoImage;
import com.facebook.litho.sections.SectionContext;
import com.facebook.litho.sections.common.DataDiffSection;
import com.facebook.litho.sections.common.RenderEvent;
import com.facebook.litho.sections.widget.ListRecyclerConfiguration;
import com.facebook.litho.sections.widget.RecyclerCollectionComponent;
import com.facebook.litho.sections.widget.RecyclerCollectionComponentSpec.RecyclerConfiguration;
import com.facebook.litho.widget.ComponentRenderInfo;
import com.facebook.litho.widget.RenderInfo;
import java.util.Arrays;
@LayoutSpec
public class FeedImageComponentSpec {
private static final RecyclerConfiguration LIST_CONFIGURATION =
new ListRecyclerConfiguration(
LinearLayoutManager.HORIZONTAL, /*reverseLayout*/ false, SNAP_TO_START);
@OnCreateLayout
static Component onCreateLayout(ComponentContext c, @Prop final String[] images) {
return images.length == 1
? createImageComponent(c, images[0]).build()
: RecyclerCollectionComponent.create(c)
.disablePTR(true)
.recyclerConfiguration(LIST_CONFIGURATION)
.section(
DataDiffSection.<String>create(new SectionContext(c))
.data(Arrays.asList(images))
.renderEventHandler(FeedImageComponent.onRender(c))
.build())
.canMeasureRecycler(true)
.aspectRatio(2)
.build();
}
@OnEvent(RenderEvent.class)
static RenderInfo onRender(ComponentContext c, @FromEvent String model) {
return ComponentRenderInfo.create().component(createImageComponent(c, model).build()).build();
}
private static Component.Builder createImageComponent(ComponentContext c, String image) {
final DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(image).build();
return FrescoImage.create(c).controller(controller).imageAspectRatio(2f);
}
}
| 43.013514 | 98 | 0.768457 |
64931e6639eb27b9b4e5f530083199d124cd5b76 | 3,835 | package ru.andreymarkelov.atlas.plugins.jira.groovioli.listeners;
import com.atlassian.event.api.EventListener;
import com.atlassian.event.api.EventPublisher;
import com.atlassian.jira.event.DashboardViewEvent;
import com.atlassian.jira.event.issue.IssueEvent;
import com.atlassian.jira.event.user.LoginEvent;
import com.atlassian.jira.event.user.LogoutEvent;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import ru.andreymarkelov.atlas.plugins.jira.groovioli.data.EventType;
import ru.andreymarkelov.atlas.plugins.jira.groovioli.manager.ListenerDataManager;
import ru.andreymarkelov.atlas.plugins.jira.groovioli.manager.ScriptManager;
import ru.andreymarkelov.atlas.plugins.jira.groovioli.util.ScriptException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static ru.andreymarkelov.atlas.plugins.jira.groovioli.manager.ListenerDataManager.NO_PROJECT;
public class GroovioliListener implements InitializingBean, DisposableBean {
private static final Logger log = LoggerFactory.getLogger(GroovioliListener.class);
private static final int THREAD_COUNT = 2;
private final EventPublisher eventPublisher;
private final ListenerDataManager listenerDataManager;
private final ScriptManager scriptManager;
private final ExecutorService executorService;
public GroovioliListener(
EventPublisher eventPublisher,
ListenerDataManager listenerDataManager,
ScriptManager scriptManager) {
this.eventPublisher = eventPublisher;
this.listenerDataManager = listenerDataManager;
this.scriptManager = scriptManager;
this.executorService = Executors.newFixedThreadPool(THREAD_COUNT);
}
@Override
public void afterPropertiesSet() {
eventPublisher.register(this);
}
@Override
public void destroy() {
eventPublisher.unregister(this);
executorService.shutdownNow();
}
@EventListener
public void onIssueEvent(IssueEvent issueEvent) {
List<String> scripts = listenerDataManager.getScripts(EventType.ISSUE, issueEvent.getProject().getId());
for (final String script : scripts) {
final Map<String, Object> parameters = new HashMap<>();
parameters.put("changeLog", issueEvent.getChangeLog());
parameters.put("eventComment", issueEvent.getComment());
parameters.put("eventWorklog", issueEvent.getWorklog());
parameters.put("issue", issueEvent.getIssue());
parameters.put("eventTypeId", issueEvent.getEventTypeId());
parameters.put("eventUser", issueEvent.getUser());
parameters.put("log", log);
executorService.execute(new Runnable() {
@Override
public void run() {
try {
scriptManager.executeScript(script, parameters);
} catch (ScriptException ex) {
log.error("Listener error", ex);
}
}
});
}
}
@EventListener
public void onDashboardViewEvent(DashboardViewEvent dashboardViewEvent) {
List<String> scripts = listenerDataManager.getScripts(EventType.DASHBOARD_VIEW, NO_PROJECT);
}
@EventListener
public void onLoginEvent(LoginEvent loginEvent) {
List<String> scripts = listenerDataManager.getScripts(EventType.LOGIN, NO_PROJECT);
}
@EventListener
public void onLogoutEvent(LogoutEvent logoutEvent) {
List<String> scripts = listenerDataManager.getScripts(EventType.LOGOUT, NO_PROJECT);
}
}
| 39.536082 | 112 | 0.71395 |
9df74ad5ce9a94a6d0ca52a4b811767d5e01d4f6 | 4,297 | package cn.orgid.common.sms;
import java.io.IOException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Date;
import java.util.Random;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.squareup.okhttp.MediaType;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.RequestBody;
import com.squareup.okhttp.Response;
import cn.orgid.common.exception.ApplicationException;
public class TencentSmsAPI {
private static final String url = "https://yun.tim.qq.com/v5/tlssmssvr/sendsms";
public static boolean sendSms(String appId, String appKey, Message message) {
Random r = new Random();
int r1 = r.nextInt();
long t1 = new Date().getTime()/1000;
message.setTime(t1);
String sign = buildSign(appKey, message, r1, t1);
message.setSig(sign);
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url(url + "?sdkappid=" + appId + "&random=" + r1).post(RequestBody
.create(MediaType.parse("application/json; charset=utf-8"), JSON.toJSONString(message)))
.build();
try {
Response response = client.newCall(request).execute();
String ret = response.body().string();
JSONObject jsonObject = JSON.parseObject(ret);
int code = jsonObject.getIntValue("result");
if(code==0){
return true;
}
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
private static String buildSign(String appKey, Message message, int r1, long t1) {
try {
return strToHash(String.format(
"appkey=%s&random=%d&time=%d&mobile=%s",
appKey, r1, t1, message.getTel().getMobile()));
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
}
throw new ApplicationException("buildSign error");
}
public static class Message {
public static final int TypeNotify=0;
public static final int TypeMarketing=1;
private Tel tel;
private int type;
private String msg;
private String sig;
private long time;
public Tel getTel() {
return tel;
}
public void setTel(Tel tel) {
this.tel = tel;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public String getSig() {
return sig;
}
public void setSig(String sig) {
this.sig = sig;
}
public long getTime() {
return time;
}
public void setTime(long time) {
this.time = time;
}
}
public static class Tel {
private String nationcode;
private String mobile;
public static Tel cnTel(String mobile){
Tel t = new Tel();
t.setMobile(mobile);
t.setNationcode("86");
return t;
}
public String getNationcode() {
return nationcode;
}
public void setNationcode(String nationcode) {
this.nationcode = nationcode;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
}
protected static String strToHash(String str) throws NoSuchAlgorithmException {
MessageDigest messageDigest = MessageDigest.getInstance("SHA-256");
byte[] inputByteArray = str.getBytes();
messageDigest.update(inputByteArray);
byte[] resultByteArray = messageDigest.digest();
return byteArrayToHex(resultByteArray);
}
public static String byteArrayToHex(byte[] byteArray) {
char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'};
char[] resultCharArray = new char[byteArray.length * 2];
int index = 0;
for (byte b : byteArray) {
resultCharArray[index++] = hexDigits[b >>> 4 & 0xf];
resultCharArray[index++] = hexDigits[b & 0xf];
}
return new String(resultCharArray);
}
public static void main(String args[]) {
Message message = new Message();
Tel tel = new Tel();
tel.setMobile("18658150769");
tel.setNationcode("86");
message.setTel(tel);
message.setMsg("你的验证码是123123,请于1分钟内填写。");
message.setType(0);
TencentSmsAPI.sendSms("1400034182", "7907157f4db22b17a8e331c5d13a0f84", message);
}
}
| 22.73545 | 108 | 0.665813 |
506d5a26d758a2d72262e9336adb7d5d71ccf3ac | 496 | class auto
{
public static void main(String args[])
{
int i,k,m,s,s1,s2,f,m1;
for(i=1;i<=1000;i++)
{
k=i;
m=k*k;
s1=m;
s=0;
while(m>0)
{
s++;
m=m/10;
}
s2=(int)Math.pow(10,s-1);
if(s1%s2==i)
System.out.println(i+"automorphic");
}
}
}
| 19.84 | 50 | 0.27621 |
8e80951c053436d9b029362b6082dca276dc2755 | 141 | import foo.bar.*;
class Main {
void foo() throws ReflectiveOperationException {
Test.class.getDeclaredAnnotationsByType(<caret>);
}
} | 23.5 | 53 | 0.737589 |
14e4a6f88e6dee3964d75da18fda50b92d484bb7 | 5,583 | /*
Derby - Class com.pivotal.gemfirexd.internal.impl.store.access.sort.SortScan
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package com.pivotal.gemfirexd.internal.impl.store.access.sort;
import com.pivotal.gemfirexd.internal.iapi.error.StandardException;
import com.pivotal.gemfirexd.internal.iapi.reference.SQLState;
import com.pivotal.gemfirexd.internal.iapi.services.sanity.SanityManager;
import com.pivotal.gemfirexd.internal.iapi.sql.execute.ExecRow;
import com.pivotal.gemfirexd.internal.iapi.store.access.conglomerate.TransactionManager;
import com.pivotal.gemfirexd.internal.iapi.types.DataValueDescriptor;
/**
Abstract base class for merge sort scans.
**/
public abstract class SortScan extends Scan
{
/**
The sort that this class is scanning.
**/
protected MergeSort sort = null;
/**
The transactionManager that opened this scan.
**/
protected TransactionManager tran = null;
/**
The row at the current position of the scan, from which
fetch will return values.
**/
protected ExecRow current;
/**
The row at the current position of the scan, from which
fetch will return values.
**/
protected boolean hold;
/*
* Constructors
*/
SortScan(MergeSort sort, TransactionManager tran, boolean hold)
{
super();
this.sort = sort;
this.tran = tran;
this.hold = hold;
}
/*
* Abstract methods of Scan
*/
/**
Fetch the row at the next position of the Scan.
If there is a valid next position in the scan then
the value in the template storable row is replaced
with the value of the row at the current scan
position. The columns of the template row must
be of the same type as the actual columns in the
underlying conglomerate.
The resulting contents of templateRow after a fetchNext()
which returns false is undefined.
The result of calling fetchNext(row) is exactly logically
equivalent to making a next() call followed by a fetch(row)
call. This interface allows implementations to optimize
the 2 calls if possible.
RESOLVE (mikem - 2/24/98) - come back to this and see if
coding this differently saves in sort scans, as did the
heap recoding.
@param row The template row into which the value
of the next position in the scan is to be stored.
@return True if there is a next position in the scan,
false if there isn't.
@exception StandardException Standard exception policy.
**/
public final boolean fetchNext(DataValueDescriptor[] row)
throws StandardException
{
boolean ret_val = next();
if (ret_val)
fetch(row);
return(ret_val);
}
/**
Fetch the row at the current position of the Scan.
@see com.pivotal.gemfirexd.internal.iapi.store.access.ScanController#fetch
**/
public final void fetch(DataValueDescriptor[] result)
throws StandardException
{
if (SanityManager.DEBUG)
{
SanityManager.ASSERT(sort != null);
}
if (current == null)
{
throw StandardException.newException(
SQLState.SORT_SCAN_NOT_POSITIONED);
}
// Make sure the passed in template row is of the correct type.
sort.checkColumnTypes(result);
// RESOLVE
// Note that fetch() basically throws away the object's passed in.
// We should figure out how to allow callers in this situation to
// not go through the work of allocating objects in the first place.
// Sort has allocated objects for this row, and will not
// reference them any more. So just pass the objects out
// to the caller instead of copying them into the provided
// objects.
System.arraycopy(current.getRowArray(), 0, result, 0, result.length);
//release the held up row
// the current row can be a value row or CompactExecRow. If it is a compact exec row it will be released here.
//If it is a value row it will be no op. While the underlying compact exec row for the value row would have
// been released while adding it to the sort buffer.
}
/**
Fetch the row at the current position of the Scan and does not apply the
qualifiers.
This method will always throw an exception.
(SQLState.SORT_IMPROPER_SCAN_METHOD)
@see com.pivotal.gemfirexd.internal.iapi.store.access.ScanController#fetchWithoutQualify
**/
public final void fetchWithoutQualify(DataValueDescriptor[] result)
throws StandardException
{
throw StandardException.newException(
SQLState.SORT_IMPROPER_SCAN_METHOD);
}
/**
Close the scan. @see ScanController#close
**/
public void close()
{
sort = null;
current = null;
tran.closeMe(this);
}
/*
* Methods of SortScan. Arranged alphabetically.
*/
}
| 28.340102 | 118 | 0.70249 |
a7ff0412ffc17e9ca6407bf98e3490173ccdaaab | 747 | package com.tks.wearosheartbeatsample;
import android.app.AlertDialog;
import android.content.Context;
public class ErrDialog {
/* AlertDialog生成 */
public static AlertDialog.Builder create(Context context, String ErrStr) {
return new AlertDialog.Builder(context)
.setMessage(ErrStr)
.setNegativeButton(R.string.error_end, (dialog, id) -> {
android.os.Process.killProcess(android.os.Process.myPid());
});
}
/* AlertDialog生成 */
public static AlertDialog.Builder create(Context context, int resid) {
return new AlertDialog.Builder(context)
.setMessage(context.getString(resid))
.setNegativeButton(R.string.error_end, (dialog, id) -> {
android.os.Process.killProcess(android.os.Process.myPid());
});
}
}
| 29.88 | 75 | 0.732262 |
1b666ecfc6b1ede0264266c3364f3e6f991e5009 | 1,124 | package com.duckblade.runelite.togindicator;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "ToG Indicator"
)
public class TOGIndicatorPlugin extends Plugin
{
@Inject
private OverlayManager overlayManager;
@Inject
private TOGIndicatorOverlay overlay;
@Inject
private Client client;
@Override
protected void startUp() throws Exception
{
overlayManager.add(overlay);
if (client.getGameState() == GameState.LOGGED_IN)
{
overlay.attachHoverListeners();
}
}
@Override
protected void shutDown() throws Exception
{
overlayManager.remove(overlay);
}
@Subscribe
public void onWidgetLoaded(WidgetLoaded widget)
{
if (widget.getGroupId() == WidgetInfo.SKILLS_CONTAINER.getGroupId())
{
overlay.attachHoverListeners();
}
}
}
| 20.436364 | 70 | 0.77758 |
1a383140fe2f90fbdfbe34303bbf4c6b408fe2fc | 2,575 | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.logic.implementation;
import com.azure.core.http.rest.PagedIterable;
import com.azure.core.util.Context;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.logic.fluent.IntegrationServiceEnvironmentSkusClient;
import com.azure.resourcemanager.logic.fluent.models.IntegrationServiceEnvironmentSkuDefinitionInner;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentSkuDefinition;
import com.azure.resourcemanager.logic.models.IntegrationServiceEnvironmentSkus;
import com.fasterxml.jackson.annotation.JsonIgnore;
public final class IntegrationServiceEnvironmentSkusImpl implements IntegrationServiceEnvironmentSkus {
@JsonIgnore private final ClientLogger logger = new ClientLogger(IntegrationServiceEnvironmentSkusImpl.class);
private final IntegrationServiceEnvironmentSkusClient innerClient;
private final com.azure.resourcemanager.logic.LogicManager serviceManager;
public IntegrationServiceEnvironmentSkusImpl(
IntegrationServiceEnvironmentSkusClient innerClient,
com.azure.resourcemanager.logic.LogicManager serviceManager) {
this.innerClient = innerClient;
this.serviceManager = serviceManager;
}
public PagedIterable<IntegrationServiceEnvironmentSkuDefinition> list(
String resourceGroup, String integrationServiceEnvironmentName) {
PagedIterable<IntegrationServiceEnvironmentSkuDefinitionInner> inner =
this.serviceClient().list(resourceGroup, integrationServiceEnvironmentName);
return Utils
.mapPage(inner, inner1 -> new IntegrationServiceEnvironmentSkuDefinitionImpl(inner1, this.manager()));
}
public PagedIterable<IntegrationServiceEnvironmentSkuDefinition> list(
String resourceGroup, String integrationServiceEnvironmentName, Context context) {
PagedIterable<IntegrationServiceEnvironmentSkuDefinitionInner> inner =
this.serviceClient().list(resourceGroup, integrationServiceEnvironmentName, context);
return Utils
.mapPage(inner, inner1 -> new IntegrationServiceEnvironmentSkuDefinitionImpl(inner1, this.manager()));
}
private IntegrationServiceEnvironmentSkusClient serviceClient() {
return this.innerClient;
}
private com.azure.resourcemanager.logic.LogicManager manager() {
return this.serviceManager;
}
}
| 47.685185 | 114 | 0.79767 |
58041844b0da56e54fb30891fba4350ba8d2300e | 44,350 | /*
* 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 br.com.park.screen;
import br.com.park.dtbase.ServicoDAO;
import br.com.park.dtbase.TBdao;
import br.com.park.dtbase.bdBack;
import br.com.park.job.Caixa;
import br.com.park.job.Estacionamento;
import br.com.park.job.Servicos;
import br.com.park.job.TabelaPreco;
import br.com.park.logs.Logs;
import br.com.park.tools.MinhaTabela;
import java.awt.Choice;
import java.awt.Color;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import javax.swing.JTextField;
import javax.swing.JButton;
import javax.swing.ListSelectionModel;
public class ConfigEsta extends javax.swing.JPanel {
private Estacionamento park;
private Servicos servico;
private final ServicoDAO bancoServico = new ServicoDAO();
private bdBack banco;
private Logs lg;
TBdao bancoDAO = new TBdao();
public ConfigEsta() {
initComponents();
initMethods();
try {
bancoDAO.bdtoArray();
} catch (SQLException ex) {
Logger.getLogger(ConfigEsta.class.getName()).log(Level.SEVERE, null, ex);
}
}
public void printLog(String modulo, String txt) {
lg = new Logs();
lg.setDescricao(txt);
lg.setModulo(modulo);
}
public void ppCb() {
cb_unidadeServico.add("");
cb_unidadeServico.add("Minuto");
cb_unidadeServico.add("Hora");
cb_unidadeServico.add("Dia");
cb_unidadeServico.add("Mês");
cb_unidadeServico.add("Ano");
}
public void carregaTabServico() {
ArrayList dados = new ArrayList();
dados.clear();
String[] colunas = new String[]{"", "ID", "Nome", "Tempo", "Unidade"};
// Tem que preencher o arraylist do banco com o Servico e trocar aqui para o Array certo
try {
for (Servicos s : bancoServico.writeService()) {
int id = s.getId();
String nome = s.getNome();
int tempo = s.getTolerancia();
String unMedida = s.getUnidadeMedida();
dados.add(new Object[]{"", id, nome, tempo, unMedida});
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Erro Ao preencher" + e);
}
MinhaTabela Mtable = new MinhaTabela(dados, colunas);
tb_servico1.setModel(Mtable);
tb_servico1.getColumnModel().getColumn(0).setPreferredWidth(20);
tb_servico1.getColumnModel().getColumn(0).setResizable(false);
tb_servico1.getColumnModel().getColumn(1).setPreferredWidth(22);
tb_servico1.getColumnModel().getColumn(1).setResizable(false);
tb_servico1.getColumnModel().getColumn(2).setPreferredWidth(120);
tb_servico1.getColumnModel().getColumn(2).setResizable(false);
tb_servico1.getColumnModel().getColumn(3).setPreferredWidth(80);
tb_servico1.getColumnModel().getColumn(3).setResizable(false);
tb_servico1.getTableHeader().setReorderingAllowed(false);
tb_servico1.setAutoResizeMode(tb_servico1.AUTO_RESIZE_OFF);
tb_servico1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
public void carregaTabTBPreco() {
ArrayList dados1 = new ArrayList();
dados1.clear();
try {
bancoDAO.bdtoArray();
} catch (SQLException ex) {
Logger.getLogger(ConfigEsta.class.getName()).log(Level.SEVERE, null, ex);
}
String[] colunas = new String[]{"", "ID", "Nome", "Tempo", "Valor R$"};
// Tem que preencher o arraylist do banco com o Servico e trocar aqui para o Array certo
try {
for (TabelaPreco tb : bancoDAO.bdtoArray()) {
int id = tb.getId();
String nome = String.valueOf(tb.getId() + 1 + " ª Hora");
double tole = tb.getTempo();
double uni = tb.getMoeda();
dados1.add(new Object[]{"x", id, nome, tole, uni});
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Erro Ao preencher" + e);
}
MinhaTabela Mtable = new MinhaTabela(dados1, colunas);
tb_tbPreco.setModel(Mtable);
tb_tbPreco.getColumnModel().getColumn(0).setPreferredWidth(20);
tb_tbPreco.getColumnModel().getColumn(0).setResizable(false);
tb_tbPreco.getColumnModel().getColumn(1).setPreferredWidth(22);
tb_tbPreco.getColumnModel().getColumn(1).setResizable(false);
tb_tbPreco.getColumnModel().getColumn(2).setPreferredWidth(120);
tb_tbPreco.getColumnModel().getColumn(2).setResizable(false);
tb_tbPreco.getColumnModel().getColumn(3).setPreferredWidth(80);
tb_tbPreco.getColumnModel().getColumn(3).setResizable(false);
tb_tbPreco.getTableHeader().setReorderingAllowed(false);
tb_tbPreco.setAutoResizeMode(tb_servico1.AUTO_RESIZE_OFF);
tb_tbPreco.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
}
public void txtHide(String texto, JTextField lb_texto) {
lb_texto.setText(texto);
lb_texto.setForeground(Color.black);
}
public void setTxtShow(String texto, JTextField lb_texto) {
lb_texto.setText(texto);
lb_texto.setForeground(Color.getHSBColor(70, 7, 80));
}
public void validTxtShow(String texto, JTextField lb_texto) {
if (lb_texto.getText().trim().equals("")) {
lb_texto.setText(texto);
lb_texto.setForeground(Color.getHSBColor(70, 7, 80));
}
}
public void txtErrorShow(String texto, JTextField lb_texto) {
lb_texto.setText(texto);
lb_texto.setForeground(Color.red);
}
public void habilitaBotoes(JButton botao, JTextField j1, JTextField j2, String txt1, String txt2) {
String nomeServico = j1.getText().trim();
String tempoTolerancia = j2.getText().trim();
if (!(nomeServico.equals(txt1)) || !(tempoTolerancia.equals(txt2))) {
botao.setEnabled(true);
} else {
botao.setEnabled(false);
}
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
private void initMethods() {
ppCb();
carregaTabServico();
carregaTabTBPreco();
abas_parametros.setEnabledAt(1, false);
try {
bancoServico.writeService();
} catch (Exception e) {
}
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
abas_parametros = new javax.swing.JTabbedPane();
jPanel1 = new javax.swing.JPanel();
pn_serv = new javax.swing.JPanel();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
tf_nomeServico = new javax.swing.JTextField();
tf_tolerancia = new javax.swing.JTextField();
btn_salvar = new javax.swing.JButton();
btn_cancelarServico = new javax.swing.JButton();
jLabel8 = new javax.swing.JLabel();
cb_unidadeServico = new java.awt.Choice();
jScrollPane1 = new javax.swing.JScrollPane();
tb_tbPreco = new javax.swing.JTable();
jButton3 = new javax.swing.JButton();
jPanel2 = new javax.swing.JPanel();
label1 = new java.awt.Label();
label2 = new java.awt.Label();
label3 = new java.awt.Label();
js_tempo = new javax.swing.JSpinner();
tf_valor = new javax.swing.JTextField();
btn_salvarTP = new javax.swing.JButton();
btn_cancelarTP = new javax.swing.JButton();
check_ConvenioSp = new java.awt.Checkbox();
jScrollPane3 = new javax.swing.JScrollPane();
tb_servico1 = new javax.swing.JTable();
pn_ConvenioSP = new javax.swing.JPanel();
jLabel7 = new javax.swing.JLabel();
jPanel5 = new javax.swing.JPanel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
tf_nomeConvenio = new javax.swing.JTextField();
tf_DescontoConvenio = new javax.swing.JTextField();
btn_salvarConvenio = new javax.swing.JButton();
btn_cancelarConvenio = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
tb_convenio = new javax.swing.JTable();
pn_serv.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
pn_serv.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusLost(java.awt.event.FocusEvent evt) {
pn_servFocusLost(evt);
}
});
jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel1.setText("Serviços");
jLabel2.setText("Nome:");
jLabel3.setText("Tempo Livre:");
tf_nomeServico.setForeground(new java.awt.Color(201, 204, 189));
tf_nomeServico.setHorizontalAlignment(javax.swing.JTextField.CENTER);
tf_nomeServico.setText("Título do Serviço");
tf_nomeServico.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
tf_nomeServicoFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
tf_nomeServicoFocusLost(evt);
}
});
tf_tolerancia.setForeground(new java.awt.Color(204, 204, 204));
tf_tolerancia.setHorizontalAlignment(javax.swing.JTextField.CENTER);
tf_tolerancia.setText("Tempo de Tolerancia");
tf_tolerancia.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
tf_toleranciaFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
tf_toleranciaFocusLost(evt);
}
});
btn_salvar.setText("Adicionar");
btn_salvar.setEnabled(false);
btn_salvar.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_salvarActionPerformed(evt);
}
});
btn_cancelarServico.setText("Cancelar");
btn_cancelarServico.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_cancelarServicoActionPerformed(evt);
}
});
jLabel8.setText("Un:");
cb_unidadeServico.setName(""); // NOI18N
javax.swing.GroupLayout pn_servLayout = new javax.swing.GroupLayout(pn_serv);
pn_serv.setLayout(pn_servLayout);
pn_servLayout.setHorizontalGroup(
pn_servLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pn_servLayout.createSequentialGroup()
.addGap(112, 112, 112)
.addComponent(jLabel1)
.addContainerGap(151, Short.MAX_VALUE))
.addGroup(pn_servLayout.createSequentialGroup()
.addGap(49, 49, 49)
.addGroup(pn_servLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pn_servLayout.createSequentialGroup()
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tf_nomeServico, javax.swing.GroupLayout.PREFERRED_SIZE, 206, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(pn_servLayout.createSequentialGroup()
.addGroup(pn_servLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(btn_salvar, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(pn_servLayout.createSequentialGroup()
.addComponent(jLabel3)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tf_tolerancia, javax.swing.GroupLayout.PREFERRED_SIZE, 43, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(pn_servLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(btn_cancelarServico)
.addGroup(pn_servLayout.createSequentialGroup()
.addComponent(jLabel8, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cb_unidadeServico, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)))))
.addGap(0, 40, Short.MAX_VALUE))
);
pn_servLayout.setVerticalGroup(
pn_servLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pn_servLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(pn_servLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(tf_nomeServico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(pn_servLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pn_servLayout.createSequentialGroup()
.addGroup(pn_servLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(tf_tolerancia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8))
.addGap(18, 18, 18)
.addGroup(pn_servLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn_salvar)
.addComponent(btn_cancelarServico)))
.addComponent(cb_unidadeServico, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap(34, Short.MAX_VALUE))
);
tb_tbPreco.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"", "ID", "Nome", "Tempo"
}
) {
Class[] types = new Class [] {
java.lang.Object.class, java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class
};
boolean[] canEdit = new boolean [] {
false, false, true, true
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tb_tbPreco.getTableHeader().setReorderingAllowed(false);
jScrollPane1.setViewportView(tb_tbPreco);
if (tb_tbPreco.getColumnModel().getColumnCount() > 0) {
tb_tbPreco.getColumnModel().getColumn(0).setResizable(false);
tb_tbPreco.getColumnModel().getColumn(0).setPreferredWidth(20);
tb_tbPreco.getColumnModel().getColumn(1).setResizable(false);
tb_tbPreco.getColumnModel().getColumn(1).setPreferredWidth(30);
tb_tbPreco.getColumnModel().getColumn(2).setResizable(false);
tb_tbPreco.getColumnModel().getColumn(2).setPreferredWidth(200);
tb_tbPreco.getColumnModel().getColumn(3).setResizable(false);
}
jButton3.setText("jButton3");
jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
label1.setText("Tempo:");
label2.setText("Valor:");
label3.setFont(new java.awt.Font("Dialog", 1, 18)); // NOI18N
label3.setText("Tabela de Preço");
js_tempo.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1));
js_tempo.setToolTipText("");
tf_valor.setToolTipText("");
btn_salvarTP.setText("Adicionar");
btn_salvarTP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_salvarTPActionPerformed(evt);
}
});
btn_cancelarTP.setText("Cancelar");
btn_cancelarTP.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btn_cancelarTPActionPerformed(evt);
}
});
check_ConvenioSp.setLabel("Convênio Especial");
check_ConvenioSp.addItemListener(new java.awt.event.ItemListener() {
public void itemStateChanged(java.awt.event.ItemEvent evt) {
check_ConvenioSpItemStateChanged(evt);
}
});
javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(42, 42, 42)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(js_tempo, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
.addComponent(tf_valor))
.addComponent(check_ConvenioSp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(jPanel2Layout.createSequentialGroup()
.addComponent(btn_salvarTP, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(btn_cancelarTP)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
.addContainerGap()
.addComponent(label3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(label1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(js_tempo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(label2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(tf_valor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(check_ConvenioSp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn_salvarTP)
.addComponent(btn_cancelarTP))
.addContainerGap())
);
label1.getAccessibleContext().setAccessibleName("Jlabel");
tb_servico1.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"", "ID", "Nome", "Tempo"
}
) {
Class[] types = new Class [] {
java.lang.Object.class, java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class
};
boolean[] canEdit = new boolean [] {
false, false, true, true
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tb_servico1.getTableHeader().setReorderingAllowed(false);
jScrollPane3.setViewportView(tb_servico1);
if (tb_servico1.getColumnModel().getColumnCount() > 0) {
tb_servico1.getColumnModel().getColumn(0).setResizable(false);
tb_servico1.getColumnModel().getColumn(0).setPreferredWidth(20);
tb_servico1.getColumnModel().getColumn(1).setResizable(false);
tb_servico1.getColumnModel().getColumn(1).setPreferredWidth(30);
tb_servico1.getColumnModel().getColumn(2).setResizable(false);
tb_servico1.getColumnModel().getColumn(2).setPreferredWidth(200);
tb_servico1.getColumnModel().getColumn(3).setResizable(false);
}
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jButton3)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(pn_serv, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 320, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(67, Short.MAX_VALUE))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addContainerGap()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(pn_serv, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGap(27, 27, 27))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
.addComponent(jButton3)
.addContainerGap())
);
abas_parametros.addTab("Serviços", jPanel1);
pn_ConvenioSP.setAutoscrolls(true);
jLabel7.setText("AQUI SERÁ o CONVENIO ESPECIAL se habilitado aparecera essa tela");
jPanel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
jLabel4.setText("Convênio");
jLabel5.setText("Nome:");
jLabel6.setText("Desconto:");
tf_nomeConvenio.setForeground(new java.awt.Color(204, 204, 204));
tf_nomeConvenio.setHorizontalAlignment(javax.swing.JTextField.CENTER);
tf_nomeConvenio.setText("Descrição do Convênio");
tf_nomeConvenio.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
tf_nomeConvenioFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
tf_nomeConvenioFocusLost(evt);
}
});
tf_DescontoConvenio.setForeground(new java.awt.Color(204, 204, 204));
tf_DescontoConvenio.setHorizontalAlignment(javax.swing.JTextField.CENTER);
tf_DescontoConvenio.setText("Tolerância");
tf_DescontoConvenio.addFocusListener(new java.awt.event.FocusAdapter() {
public void focusGained(java.awt.event.FocusEvent evt) {
tf_DescontoConvenioFocusGained(evt);
}
public void focusLost(java.awt.event.FocusEvent evt) {
tf_DescontoConvenioFocusLost(evt);
}
});
btn_salvarConvenio.setText("Adicionar");
btn_cancelarConvenio.setText("Cancelar");
javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
jPanel5.setLayout(jPanel5Layout);
jPanel5Layout.setHorizontalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(112, 112, 112)
.addComponent(jLabel4))
.addGroup(jPanel5Layout.createSequentialGroup()
.addGap(34, 34, 34)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addComponent(jLabel5)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tf_nomeConvenio, javax.swing.GroupLayout.PREFERRED_SIZE, 166, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addComponent(jLabel6)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tf_DescontoConvenio, javax.swing.GroupLayout.PREFERRED_SIZE, 148, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
.addComponent(btn_salvarConvenio, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(btn_cancelarConvenio)))))
.addContainerGap(72, Short.MAX_VALUE))
);
jPanel5Layout.setVerticalGroup(
jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel5Layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel4)
.addGap(37, 37, 37)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(tf_nomeConvenio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(23, 23, 23)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6)
.addComponent(tf_DescontoConvenio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(btn_salvarConvenio)
.addComponent(btn_cancelarConvenio))
.addContainerGap(50, Short.MAX_VALUE))
);
tb_convenio.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
},
new String [] {
"", "ID", "Nome", "Desconto"
}
) {
Class[] types = new Class [] {
java.lang.Object.class, java.lang.Integer.class, java.lang.String.class, java.lang.Integer.class
};
boolean[] canEdit = new boolean [] {
false, false, true, true
};
public Class getColumnClass(int columnIndex) {
return types [columnIndex];
}
public boolean isCellEditable(int rowIndex, int columnIndex) {
return canEdit [columnIndex];
}
});
tb_convenio.getTableHeader().setReorderingAllowed(false);
jScrollPane2.setViewportView(tb_convenio);
if (tb_convenio.getColumnModel().getColumnCount() > 0) {
tb_convenio.getColumnModel().getColumn(0).setResizable(false);
tb_convenio.getColumnModel().getColumn(0).setPreferredWidth(20);
tb_convenio.getColumnModel().getColumn(1).setResizable(false);
tb_convenio.getColumnModel().getColumn(1).setPreferredWidth(40);
tb_convenio.getColumnModel().getColumn(2).setResizable(false);
tb_convenio.getColumnModel().getColumn(2).setPreferredWidth(200);
tb_convenio.getColumnModel().getColumn(3).setResizable(false);
}
javax.swing.GroupLayout pn_ConvenioSPLayout = new javax.swing.GroupLayout(pn_ConvenioSP);
pn_ConvenioSP.setLayout(pn_ConvenioSPLayout);
pn_ConvenioSPLayout.setHorizontalGroup(
pn_ConvenioSPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pn_ConvenioSPLayout.createSequentialGroup()
.addGroup(pn_ConvenioSPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(pn_ConvenioSPLayout.createSequentialGroup()
.addGap(156, 156, 156)
.addComponent(jLabel7))
.addGroup(pn_ConvenioSPLayout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 309, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(107, Short.MAX_VALUE))
);
pn_ConvenioSPLayout.setVerticalGroup(
pn_ConvenioSPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pn_ConvenioSPLayout.createSequentialGroup()
.addGap(26, 26, 26)
.addGroup(pn_ConvenioSPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 62, Short.MAX_VALUE)
.addComponent(jLabel7)
.addGap(77, 77, 77))
);
abas_parametros.addTab("Convênio Especial", pn_ConvenioSP);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(abas_parametros, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(abas_parametros, javax.swing.GroupLayout.PREFERRED_SIZE, 433, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
private void btn_salvarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_salvarActionPerformed
lg = new Logs();
try {
String nome = tf_nomeServico.getText();
int tolerancia = Integer.valueOf(tf_tolerancia.getText());
String unidade = String.valueOf(cb_unidadeServico.getSelectedItem());
servico = new Servicos();
servico.setNome(nome);
servico.setTolerancia(tolerancia);
servico.setUnidadeMedida(unidade);
bancoServico.salvaServico(servico);
carregaTabServico();
setTxtShow("Título do Serviço", tf_nomeServico);
setTxtShow("Tempo de Tolerancia", tf_tolerancia);
printLog("Serviço", "Novo serviço criado");
JOptionPane.showMessageDialog(js_tempo, "Serviço Criado!");
} catch (Error ex) {
printLog("Serviço", "Não foi possivel Gerar novo Serviço");
}
//IMplementar metodo para salvar no banco de dados
}//GEN-LAST:event_btn_salvarActionPerformed
private void tf_nomeServicoFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_nomeServicoFocusGained
txtHide("", tf_nomeServico);
}//GEN-LAST:event_tf_nomeServicoFocusGained
private void tf_nomeServicoFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_nomeServicoFocusLost
validTxtShow("Título do Serviço", tf_nomeServico);
habilitaBotoes(btn_salvar, tf_nomeServico, tf_tolerancia, "Título do Serviço", "Tempo de Tolerancia");
}//GEN-LAST:event_tf_nomeServicoFocusLost
private void tf_toleranciaFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_toleranciaFocusGained
txtHide("", tf_tolerancia);
}//GEN-LAST:event_tf_toleranciaFocusGained
private void tf_toleranciaFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_toleranciaFocusLost
validTxtShow("Tempo de Tolerancia", tf_tolerancia);
habilitaBotoes(btn_salvar, tf_nomeServico, tf_tolerancia, "Título do Serviço", "Tempo de Tolerancia");
}//GEN-LAST:event_tf_toleranciaFocusLost
private void tf_nomeConvenioFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_nomeConvenioFocusGained
txtHide("", tf_nomeConvenio);
}//GEN-LAST:event_tf_nomeConvenioFocusGained
private void tf_nomeConvenioFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_nomeConvenioFocusLost
validTxtShow("Título do Convênio", tf_nomeConvenio);
}//GEN-LAST:event_tf_nomeConvenioFocusLost
private void tf_DescontoConvenioFocusGained(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_DescontoConvenioFocusGained
txtHide("", tf_DescontoConvenio);
}//GEN-LAST:event_tf_DescontoConvenioFocusGained
private void tf_DescontoConvenioFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_tf_DescontoConvenioFocusLost
validTxtShow("Tempo em minutos", tf_DescontoConvenio);
}//GEN-LAST:event_tf_DescontoConvenioFocusLost
private void pn_servFocusLost(java.awt.event.FocusEvent evt) {//GEN-FIRST:event_pn_servFocusLost
// TODO add your handling code here:
tf_nomeServico.setText("Tempo de tolerancia");
}//GEN-LAST:event_pn_servFocusLost
private void btn_cancelarServicoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_cancelarServicoActionPerformed
setTxtShow("Título do Serviço", tf_nomeServico);
setTxtShow("Tempo de Tolerancia", tf_tolerancia);
}//GEN-LAST:event_btn_cancelarServicoActionPerformed
private void btn_salvarTPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_salvarTPActionPerformed
TabelaPreco tb = new TabelaPreco();
banco = new bdBack();
Double tempo = Double.valueOf(js_tempo.getValue().toString());
float valor = Float.parseFloat(tf_valor.getText());
tb.setMoeda(valor);
tb.setTempo(tempo);
try {
bancoDAO.create(tb);
} catch (SQLException ex) {
Logger.getLogger(ConfigEsta.class.getName()).log(Level.SEVERE, null, ex);
}
/*-- AQUI TERÁ que ser MUDADO para da a opção de Fazer o Convenio Especial
Caso seja habilitado.
*/
Caixa convenio = new Caixa();
convenio.setConvenioNome(convenio.getId() + "ª Hora");
convenio.setDesconto(Integer.valueOf(tf_valor.getText()));
// pode ser feita uma intervenção por aqui
banco.salvaConvenio(convenio);
carregaTabTBPreco();
}//GEN-LAST:event_btn_salvarTPActionPerformed
private void btn_cancelarTPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_cancelarTPActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_btn_cancelarTPActionPerformed
private void check_ConvenioSpItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_check_ConvenioSpItemStateChanged
if (check_ConvenioSp.getState()) {
abas_parametros.setEnabledAt(1, true);
JOptionPane.showMessageDialog(check_ConvenioSp, "Convênio Especial Habilitado");
} else {
System.out.println("Está sendo usado o Convenio automático");
abas_parametros.setEnabledAt(1, false);
JOptionPane.showConfirmDialog(check_ConvenioSp, "Deseja Realmente desabilitar?\n por enquanto vai ficar essa");
}
}//GEN-LAST:event_check_ConvenioSpItemStateChanged
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTabbedPane abas_parametros;
private javax.swing.JButton btn_cancelarConvenio;
private javax.swing.JButton btn_cancelarServico;
private javax.swing.JButton btn_cancelarTP;
private javax.swing.JButton btn_salvar;
private javax.swing.JButton btn_salvarConvenio;
private javax.swing.JButton btn_salvarTP;
private java.awt.Choice cb_unidadeServico;
private java.awt.Checkbox check_ConvenioSp;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPanel jPanel5;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JSpinner js_tempo;
private java.awt.Label label1;
private java.awt.Label label2;
private java.awt.Label label3;
private javax.swing.JPanel pn_ConvenioSP;
private javax.swing.JPanel pn_serv;
private javax.swing.JTable tb_convenio;
private javax.swing.JTable tb_servico1;
private javax.swing.JTable tb_tbPreco;
private javax.swing.JTextField tf_DescontoConvenio;
private javax.swing.JTextField tf_nomeConvenio;
private javax.swing.JTextField tf_nomeServico;
private javax.swing.JTextField tf_tolerancia;
private javax.swing.JTextField tf_valor;
// End of variables declaration//GEN-END:variables
}
| 51.569767 | 179 | 0.656009 |
ef2bc347b920a6c2a03f6fdabe8bfa8b10202785 | 2,692 | /*
* Copyright (c) 2021, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package io.ballerina.stdlib.email.testutils;
import com.icegreen.greenmail.user.GreenMailUser;
import com.icegreen.greenmail.util.GreenMail;
import com.icegreen.greenmail.util.ServerSetupTest;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
/**
* Test class for email receive using POP3S with least number of parameters.
*
* @since slbeta
*/
public class PopSimpleEmailReceiveTest {
private static GreenMailUser user;
private static final String USER_PASSWORD = "abcdef123";
private static final String USER_NAME = "hascode";
private static final String EMAIL_USER_ADDRESS = "hascode@localhost";
private static final String EMAIL_FROM = "someone@localhost.com";
private static final String EMAIL_SUBJECT = "Test E-Mail";
private static final String EMAIL_TEXT = "This is a test e-mail.";
private static GreenMail mailServer;
public static Object startSimplePopServer() {
startServer();
return null;
}
public static Object stopSimplePopServer() {
mailServer.stop();
return null;
}
public static Object sendEmailSimplePopServer() throws MessagingException {
sendEmail();
return null;
}
private static void startServer() {
mailServer = new GreenMail(ServerSetupTest.POP3);
mailServer.start();
user = mailServer.setUser(EMAIL_USER_ADDRESS, USER_NAME, USER_PASSWORD);
mailServer.setUser(EMAIL_USER_ADDRESS, USER_NAME, USER_PASSWORD);
}
private static void sendEmail() throws MessagingException {
MimeMessage message = new MimeMessage((Session) null);
message.setFrom(new InternetAddress(EMAIL_FROM));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(EMAIL_USER_ADDRESS));
message.setSubject(EMAIL_SUBJECT);
message.setText(EMAIL_TEXT);
user.deliver(message);
}
}
| 34.075949 | 96 | 0.726597 |
223d4fbc2f17ac125be7e846cf9641f391dfa4c5 | 377 | package com.sky.signal.stat.util;
/**
* Created by ChenHu <chenhu1008@me.com> on 2020/3/25.
*/
/**
* 人口类别分类器接口,通过传入 出现天数 和 一天在指定基站停留的时间,返回人员类别,可能为
* 常住人口、旅游商务人口、流动人口、其他 等等。
*/
public interface PersonClassification {
/**
* 分类
* @param days 出现天数
* @param seconds 一天在指定基站停留的时间(秒)
* @return 类别
*/
int classify(Long days, Double seconds );
}
| 18.85 | 54 | 0.6313 |
5cf143f17dafcfa5b019aeac310b83ef5857b0aa | 7,099 | package com.cloupia.feature.infinidat.reports.device.pools.actions;
import org.apache.log4j.Logger;
import com.cloupia.feature.infinidat.constants.INFINIDATConstants;
import com.cloupia.feature.infinidat.device.functions.INFINIDATFunctions;
import com.cloupia.model.cIM.ConfigTableAction;
import com.cloupia.model.cIM.ReportContext;
import com.cloupia.service.cIM.inframgr.forms.wizard.Page;
import com.cloupia.service.cIM.inframgr.forms.wizard.PageIf;
import com.cloupia.service.cIM.inframgr.forms.wizard.WizardSession;
import com.cloupia.service.cIM.inframgr.reports.simplified.CloupiaPageAction;
import com.roporter.feature.format.myFormat;
public class INFINIDATDeletePoolFormAction extends CloupiaPageAction {
private static Logger logger = Logger.getLogger(INFINIDATDeletePoolFormAction.class);
private static final String formId = "infinidat.pool.delete.report.action.form.DeletePool";
private static final String ACTION_ID = "infinidat.pool.delete.report.form.action.DeletePool";
private static final String ACTION_LABEL = "Delete";
private static final String ACTION_DESCRIPTION = "Delete Pool";
@Override
public String getActionId() {
return ACTION_ID;
}
@Override
public String getFormId() {
return formId;
}
@Override
public String getLabel() {
return ACTION_LABEL;
}
@Override
public String getTitle() {
return ACTION_LABEL;
}
@Override
public String getDescription() {
return ACTION_DESCRIPTION;
}
@Override
public int getActionType() {
return ConfigTableAction.ACTION_TYPE_POPUP_FORM;
}
@Override
public boolean isSelectionRequired() {
return true;
}
@Override
public boolean isDoubleClickAction() {
return false;
}
@Override
public boolean isDrilldownAction() {
return false;
}
@Override
public void definePage(Page page, ReportContext context) {
page.bind(formId,INFINIDATDeletePoolForm.class);
}
@Override
public void loadDataToPage(Page page, ReportContext context, WizardSession session) throws Exception {
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG){logger.info( "----#### INFINIDATDeletePoolFormAction:loadDataToPage ####----" );}
String elements[] = context.getId().split(INFINIDATConstants.REPORT_DATA_SEPARATOR);
String id = "0";
String accName = "";
if(elements.length == 2) {
accName = elements[0];
id = elements[1];
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG1){logger.info( "----#### INFINIDATDeletePoolFormAction:loadDataToPage ####---- ID: " + id );}
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG1){logger.info( "----#### INFINIDATDeletePoolFormAction:loadDataToPage ####---- ACCNAME: " + accName );}
}
INFINIDATDeletePoolForm form = new INFINIDATDeletePoolForm();
form.setMessage("Delete the selected Pool?");
session.getSessionAttributes().put(formId,form);
page.marshallFromSession(formId);
}
@Override
public int validatePageData(Page page, ReportContext context, WizardSession session) throws Exception {
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePage ####----" );}
String elements[] = context.getId().split(INFINIDATConstants.REPORT_DATA_SEPARATOR);
String id = "0";
String accName = "";
if(elements.length == 2) {
accName = elements[0];
id = elements[1];
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG1){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- ID: " + id );}
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG1){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- ACCNAME: " + accName );}
}
INFINIDATFunctions func = new INFINIDATFunctions();
func.setCredential(INFINIDATFunctions.getDeviceCredentials(accName));
func.setAccountName(accName);
String result = func.deletePool(id);
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- RESULT: " + result );}
if(result != null) {
String results[] = result.split("\\|");
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG1){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- LENGTH: " + results.length );}
if(results.length > 0) {
if(results[0].split(":")[1].trim().equals("SUCCESS")) {
String pid = results[1].split(":")[1].trim();
String name = results[2].split(":")[1].trim();
String vcount = results[3].split(":")[1].trim();
String fcount = results[7].split(":")[1].trim();
String pcapacity = results[16].split(":")[1].trim();
String vcapacity = results[17].split(":")[1].trim();
String code = results[results.length-1].split(":")[1].trim();
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG2){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- NAME: " + name );}
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG2){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- ID: " + pid );}
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG2){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- VCOUNT: " + vcount );}
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG2){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- FCOUNT: " + fcount );}
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG2){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- VCAPACITY: " + vcapacity );}
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG2){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- PCAPACITY: " + pcapacity );}
if(INFINIDATConstants.DEBUG_POOLS && INFINIDATConstants.DEBUG2){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- CODE: " + code );}
page.setPageMessage("Pool " + name + " with ID: " + pid + " has been deleted successfully. Removing " + vcount + " volumes & " + fcount + " Filesystems. Returning " + myFormat.humanReadableFromString(pcapacity, true) + " space." );
func.refreshPools();
page.setRefreshInSeconds(10);
return PageIf.STATUS_OK;
} else {
page.setPageMessage(results[2].split(":")[1]);
if(INFINIDATConstants.DEBUG_ERRORS){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- WE RECEIVED A NON SUCCESSFUL MESSAGE" );}
return PageIf.STATUS_ERROR;
}
} else {
if(INFINIDATConstants.DEBUG_ERRORS){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- RESULT LENGTH != 1" );}
}
} else {
if(INFINIDATConstants.DEBUG_ERRORS){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- RESULT == NULL" );}
}
page.setPageMessage( "Pool deletion failed!" );
if(INFINIDATConstants.DEBUG_ERRORS){logger.info( "----#### INFINIDATDeletePoolFormAction:validatePageData ####---- ERROR!!!!" );}
return PageIf.STATUS_ERROR;
}
}
| 50.707143 | 238 | 0.721369 |
12385da8ca97d0be75693143b54275f416d25770 | 1,025 | package com.github.dc.menu.config;
import com.github.mybatis.crud.config.MyBatisSqlSessionFactoryConfig;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* <p>
* 默认实现mapper自动配置
* </p>
*
* @author wangpeiyuan
* @date 2021/4/18 11:38
*/
@Configuration
@AutoConfigureAfter(MyBatisSqlSessionFactoryConfig.class)
public class DCMenuMapperScannerAutoConfiguration {
@Bean
@ConditionalOnMissingBean(name = "dcMenuMapperScannerAutoConfiguration")
public MapperScannerConfigurer dcMenuMapperScannerAutoConfiguration() {
MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
mapperScannerConfigurer.setBasePackage("com.github.dc.menu.mapper");
return mapperScannerConfigurer;
}
}
| 34.166667 | 88 | 0.805854 |
4b2c557a43f7e06415012398c9b777282ef366e8 | 900 | package es.upm.miw.apaw_practice.adapters.mongodb.library.daos;
import es.upm.miw.apaw_practice.TestConfig;
import es.upm.miw.apaw_practice.adapters.mongodb.library.entities.BookEntity;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
@TestConfig
public class BookEntityRepositoryIT {
@Autowired
private BookRepository bookRepository;
@Test
void testFindByISBN(){
assertTrue(this.bookRepository.findByISBN("9787111636623").isPresent());
BookEntity book=this.bookRepository.findByISBN("9787111636623").get();
assertEquals("2",book.getId());
assertEquals("python",book.getTitle());
assertEquals("Alex",book.getAuthor());
assertEquals(true,book.getState());
}
}
| 34.615385 | 80 | 0.754444 |
e44f63f147d746a1af041b24b13bf781e46fe5f8 | 14,116 | /**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library 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 Lesser General Public License for more
* details.
*/
package com.github.rotty3000.baseline.linter.builder;
import aQute.bnd.differ.Baseline.Info;
import aQute.bnd.service.diff.Delta;
import aQute.bnd.service.diff.Diff;
import aQute.bnd.service.diff.Type;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IField;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.IMethod;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.IType;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
/**
* @author Raymond Augé
*/
public class DiffMarker {
public DiffMarker(IJavaProject javaProject) {
this.javaProject = javaProject;
}
public void deleteMarkers(IFile file) {
try {
file.deleteMarkers(
LinterConstants.MARKER_TYPE, false, IResource.DEPTH_ZERO);
}
catch (CoreException ce) {
ce.printStackTrace();
}
}
public void deleteMarkers(IProject project) {
try {
project.deleteMarkers(
LinterConstants.MARKER_TYPE, true, IResource.DEPTH_INFINITE);
}
catch (CoreException ce) {
ce.printStackTrace();
}
}
public void doAccess(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
String delta = diff.getDelta().toString();
StringBuffer sb = new StringBuffer();
sb.append(delta.substring(0, 1));
sb.append(delta.substring(1).toLowerCase());
sb.append(" ");
sb.append(diff.getName());
sb.append("! Change package version to ");
sb.append(info.suggestedVersion);
if (diff.getType() == Type.CLASS) {
doType2(file, parentDiff.getName(), info, sb.toString());
}
else {
System.out.println(
String.format(
"%s %s %s", diff.getDelta(), diff.getType(),
diff.getName()));
}
}
public void doAnnotated(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
IType type = javaProject.findType(parentDiff.getName());
ISourceRange range = type.getNameRange();
for (IAnnotation annotation : type.getAnnotations()) {
String diffName = diff.getName();
String elementName = annotation.getElementName();
int posDiff = diffName.lastIndexOf(".") + 1;
int posElement = elementName.lastIndexOf(".") + 1;
diffName = diffName.substring(posDiff);
elementName = elementName.substring(posElement);
if (elementName.equals(diffName)) {
range = annotation.getNameRange();
break;
}
}
int lineNumber = getLineNumber(type, range.getOffset());
IResource resource = type.getResource();
String delta = diff.getDelta().toString().toLowerCase();
addRangeMarker(
(IFile)resource,
"Member annotation " + delta + "! Change package version to " +
info.suggestedVersion, range, lineNumber,
IMarker.SEVERITY_ERROR);
}
public void doAnnotation(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
doType1(file, diff, info, "Annotation ");
}
public void doClass(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
doType1(file, diff, info, "Class ");
}
// public void doClassVersion(
// IFile file, Diff diff, Diff parentDiff, Info info)
// throws Exception {
//
// if ((parentDiff.getDelta() == Delta.ADDED) ||
// (diff.getDelta() != Delta.ADDED)) {
//
// return;
// }
//
// System.out.println(
// String.format(
// "%s %s %s", diff.getDelta(), diff.getType(), diff.getName()));
// }
public void doConstant(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
System.out.println(
String.format(
"%s %s %s", diff.getDelta(), diff.getType(), diff.getName()));
}
// public void doDeprecated(IFile file, Diff diff, Diff parentDiff, Info info)
// throws Exception {
//
// if ((parentDiff.getDelta() == Delta.ADDED) ||
// (diff.getDelta() != Delta.ADDED)) {
//
// return;
// }
//
// System.out.println(
// String.format(
// "%s %s %s", diff.getDelta(), diff.getType(), diff.getName()));
// }
public void doEnum(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
doType1(file, diff, info, "Enum ");
}
public void doExtends(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
doType2(
file, parentDiff.getName(), info,
"Extends " + diff.getDelta().toString().toLowerCase() +
"! Change package version to " + info.suggestedVersion);
}
public void doField(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
IType type = javaProject.findType(parentDiff.getName());
ISourceRange range = type.getNameRange();
for (IField field : type.getFields()) {
String name = diff.getName().split("\\s", 2)[1].trim();
if (field.getElementName().equals(name)) {
range = field.getNameRange();
break;
}
}
int lineNumber = getLineNumber(type, range.getOffset());
IResource resource = type.getResource();
addRangeMarker(
(IFile)resource,
"Field " + diff.getDelta().toString().toLowerCase() +
"! Change package version to " + info.suggestedVersion,
range, lineNumber, IMarker.SEVERITY_ERROR);
}
public void doImplements(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
IType type = javaProject.findType(parentDiff.getName());
if (type.getSuperInterfaceNames().length <= 0) {
return;
}
doType2(
file, parentDiff.getName(), info,
"Implements " + diff.getDelta().toString().toLowerCase() +
"! Change package version to " + info.suggestedVersion);
}
public void doInterface(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
doType1(file, diff, info, "Interface ");
}
public void doMethod(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
IType type = javaProject.findType(parentDiff.getName());
String methodName = diff.getName();
String[] parts = methodName.substring(
0, methodName.length() - 1).split("\\(", 2);
String[] args = parts[1].split(",");
if ((args.length == 1) && (args[0].length() == 0)) {
args = new String[0];
}
IMethod method = type.getMethod(parts[0], args);
if (!method.exists()) {
return;
}
ISourceRange nameRange = method.getNameRange();
int lineNumber = getLineNumber(
type, nameRange.getOffset());
IResource resource = type.getResource();
addRangeMarker(
(IFile)resource,
"Method " + diff.getDelta().toString().toLowerCase() +
"! Change package version to " + info.suggestedVersion,
nameRange, lineNumber, IMarker.SEVERITY_ERROR);
}
public void doPackage(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
String message = null;
if (diff.getDelta() == Delta.ADDED) {
message = "Missing package version (set > 0.0.0)";
}
if (message == null) {
return;
}
IPackageFragment packageFragment = (IPackageFragment)JavaCore.create(
file.getParent());
for (ICompilationUnit compilationUnit :
packageFragment.getCompilationUnits()) {
if (compilationUnit.getElementName().equals("package-info.java")) {
continue;
}
addLineMarker(
(IFile)compilationUnit.getResource(), message, 1,
IMarker.SEVERITY_ERROR);
}
}
public void doParameter(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
IType type = javaProject.findType(parentDiff.getName());
String methodName = diff.getName();
String[] parts = methodName.substring(
0, methodName.length() - 1).split("\\(", 2);
String[] args = parts[1].split(",");
if ((args.length == 1) && (args[0].length() == 0)) {
args = new String[0];
}
IMethod method = type.getMethod(parts[0], args);
if (!method.exists()) {
return;
}
ISourceRange nameRange = method.getNameRange();
int lineNumber = getLineNumber(
type, nameRange.getOffset());
IResource resource = type.getResource();
addRangeMarker(
(IFile)resource,
"Parameter " + diff.getDelta().toString().toLowerCase() +
"! Change package version to " + info.suggestedVersion,
nameRange, lineNumber, IMarker.SEVERITY_ERROR);
}
public void doProperty(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
System.out.println(
String.format(
"%s %s %s", diff.getDelta(), diff.getType(), diff.getName()));
}
public void doReturn(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
doType2(
file, parentDiff.getName(), info,
"Return " + diff.getDelta().toString().toLowerCase() +
"! Change package version to " + info.suggestedVersion);
}
public void doVersion(IFile file, Diff diff, Diff parentDiff, Info info)
throws Exception {
if ((parentDiff.getDelta() == Delta.ADDED) ||
(diff.getDelta() != Delta.ADDED)) {
return;
}
// System.out.println(
// String.format(
// "%s %s %s", diff.getDelta(), diff.getType(), diff.getName()));
}
protected void addLineMarker(
IFile file, String message, int lineNumber, int severity) {
try {
IMarker marker = file.createMarker(LinterConstants.MARKER_TYPE);
marker.setAttribute(IMarker.MESSAGE, message);
marker.setAttribute(IMarker.SEVERITY, severity);
if (lineNumber == -1) {
lineNumber = 1;
}
marker.setAttribute(IMarker.LINE_NUMBER, lineNumber);
}
catch (CoreException e) {
//ignore
}
}
protected void addRangeMarker(
final IFile file, String message, ISourceRange sourceRange,
int lineNumber, int severity) {
try {
IMarker[] markers = file.findMarkers(
LinterConstants.MARKER_TYPE, true, IResource.DEPTH_INFINITE);
for (IMarker marker : markers) {
if (marker.getAttribute(IMarker.MESSAGE).equals(message) &&
marker.getAttribute(IMarker.LINE_NUMBER).equals(
lineNumber)) {
return;
}
}
final Map<String, Object> attributes = new HashMap<>();
attributes.put(IMarker.MESSAGE, message);
attributes.put(IMarker.SEVERITY, severity);
attributes.put(IMarker.CHAR_START, sourceRange.getOffset());
attributes.put(
IMarker.CHAR_END,
sourceRange.getOffset() + sourceRange.getLength());
if (lineNumber > 0) {
attributes.put(IMarker.LINE_NUMBER, lineNumber);
}
IWorkspaceRunnable runnable = new IWorkspaceRunnable() {
@Override
public void run(IProgressMonitor monitor) throws CoreException {
IMarker marker= file.createMarker(
LinterConstants.MARKER_TYPE);
marker.setAttributes(attributes);
}
};
file.getWorkspace().run(
runnable, null, IWorkspace.AVOID_UPDATE, null);
}
catch (CoreException e) {
//ignore
}
}
protected int getLineNumber(IType type, int position)
throws IOException, JavaModelException {
String head = type.getCompilationUnit().getSource().substring(
0, position);
BufferedReader bufferedReader = new BufferedReader(
new StringReader(head));
int lineNumber = 0;
while (bufferedReader.readLine() != null) {
lineNumber++;
}
return lineNumber;
}
private void doType1(IFile file, Diff diff, Info info, String message)
throws Exception {
doType2(
file, diff.getName(), info,
message + diff.getDelta().toString().toLowerCase() +
"! Change package version to " + info.suggestedVersion);
}
private void doType2(
IFile file, String typeName, Info info, String message)
throws Exception {
IType type = javaProject.findType(typeName);
ISourceRange nameRange = type.getNameRange();
int lineNumber = getLineNumber(type, nameRange.getOffset());
addRangeMarker(
(IFile)type.getResource(), message, nameRange, lineNumber,
IMarker.SEVERITY_ERROR);
}
private IJavaProject javaProject;
} | 24.984071 | 80 | 0.682488 |
2ecc02336bcddd78f1621fddedf7377b6c463463 | 2,588 | /**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.transport.failover;
import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.artemis.jms.server.embedded.EmbeddedJMS;
import org.apache.activemq.broker.region.policy.PolicyEntry;
import org.apache.activemq.broker.region.policy.PolicyMap;
import org.junit.Test;
public class FailoverRedeliveryTransactionTest extends FailoverTransactionTest {
@Override
public void configureConnectionFactory(ActiveMQConnectionFactory factory) {
super.configureConnectionFactory(factory);
factory.setTransactedIndividualAck(true);
}
@Override
public EmbeddedJMS createBroker() throws Exception {
EmbeddedJMS brokerService = super.createBroker();
PolicyMap policyMap = new PolicyMap();
PolicyEntry defaultEntry = new PolicyEntry();
defaultEntry.setPersistJMSRedelivered(true);
policyMap.setDefaultEntry(defaultEntry);
//revisit: do we support sth like persistJMSRedelivered?
//brokerService.setDestinationPolicy(policyMap);
return brokerService;
}
// no point rerunning these
@Override
@Test
public void testFailoverProducerCloseBeforeTransaction() throws Exception {
}
@Override
public void testFailoverCommitReplyLost() throws Exception {
}
@Override
public void testFailoverCommitReplyLostWithDestinationPathSeparator() throws Exception {
}
@Override
public void testFailoverSendReplyLost() throws Exception {
}
@Override
public void testFailoverConnectionSendReplyLost() throws Exception {
}
@Override
public void testFailoverProducerCloseBeforeTransactionFailWhenDisabled() throws Exception {
}
@Override
public void testFailoverMultipleProducerCloseBeforeTransaction() throws Exception {
}
}
| 34.506667 | 94 | 0.768934 |
6d2062a8509f83d133b830a87c6cb710a1f6b204 | 4,933 | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.isis.core.runtime.persistence.objectstore.transaction;
import java.util.Iterator;
import org.apache.isis.core.commons.internal.base._Strings;
import org.apache.isis.core.metamodel.adapter.oid.Oid;
import org.apache.isis.core.metamodel.adapter.oid.Oid.Factory;
import org.apache.isis.core.metamodel.adapter.oid.RootOid;
import org.apache.isis.core.metamodel.spec.ObjectSpecId;
import org.apache.isis.core.metamodel.specloader.SpecificationLoader;
import org.apache.isis.core.runtime.persistence.adapter.PojoAdapter;
import lombok.val;
public class PojoAdapterBuilder {
private PojoAdapterBuilder(){
}
private Object pojo = new Object();
private SpecificationLoader specificationLoader;
private ObjectSpecId objectSpecId = ObjectSpecId.of("CUS");
private String identifier = "1";
// only used if type is AGGREGATED
private String aggregatedId = "firstName";
private Type type = Type.ROOT;
private Persistence persistence = Persistence.PERSISTENT;
public enum Persistence {
PERSISTENT {
@Override
RootOid createOid(ObjectSpecId objectSpecId, String identifier) {
return Factory.root(objectSpecId, identifier);
}
},
VALUE {
@Override
RootOid createOid(ObjectSpecId objectSpecId, String identifier) {
return null;
}
};
abstract RootOid createOid(ObjectSpecId objectSpecId, String identifier);
}
public static enum Type {
ROOT {
@Override
Oid oidFor(RootOid rootOid, ObjectSpecId objectSpecId, String unused) {
return rootOid;
}
}, COLLECTION {
@Override
Oid oidFor(RootOid rootOid, ObjectSpecId objectSpecId, String collectionId) {
return Oid.Factory.parentedForTesting(rootOid, collectionId);
}
}, VALUE {
@Override
Oid oidFor(RootOid rootOid, ObjectSpecId objectSpecId, String unused) {
return null;
}
};
abstract Oid oidFor(RootOid rootOid, ObjectSpecId objectSpecId, String supplementalId);
}
public static PojoAdapterBuilder create() {
return new PojoAdapterBuilder();
}
public PojoAdapterBuilder withIdentifier(String identifier) {
this.identifier = identifier;
return this;
}
public PojoAdapterBuilder withObjectType(String objectType) {
this.objectSpecId = ObjectSpecId.of(objectType);
return this;
}
public PojoAdapterBuilder withPojo(Object pojo) {
this.pojo = pojo;
return this;
}
//test only
public PojoAdapterBuilder withOid(String oidAndTitle) {
final Iterator<String> iterator = _Strings.splitThenStream(oidAndTitle, "|").iterator();
if(!iterator.hasNext()) { return this; }
withObjectType(iterator.next());
if(!iterator.hasNext()) { return this; }
withIdentifier(iterator.next());
return this;
}
/**
* A Persistence of VALUE implies a Type of VALUE also
*/
public PojoAdapterBuilder with(Persistence persistence) {
this.persistence = persistence;
if(persistence == Persistence.VALUE) {
this.type = Type.VALUE;
}
return this;
}
/**
* A Type of VALUE implies a Persistence of VALUE also.
*/
public PojoAdapterBuilder with(Type type) {
this.type = type;
if(type == Type.VALUE) {
this.persistence = Persistence.VALUE;
}
return this;
}
public PojoAdapterBuilder with(SpecificationLoader specificationLoader) {
this.specificationLoader = specificationLoader;
return this;
}
public PojoAdapter build() {
val rootOid = persistence.createOid(objectSpecId, identifier);
val oid = type.oidFor(rootOid, objectSpecId, aggregatedId);
val pojoAdapter = PojoAdapter.of(pojo, oid, specificationLoader);
return pojoAdapter;
}
}
| 31.825806 | 97 | 0.661869 |
1b15125e279fa3fca0643c0eec2d63b5cea30baf | 2,564 | /**
* The long data type is a 64-bit two's complement integer.
* The signed long has a minimum value of -2^63 and a maximum value of 2^63-1.
* In Java SE 8 and later, you can use the long data type to represent an unsigned 64-bit long,
* which has a minimum value of 0 and a maximum value of 2^64-1.
* The unsigned long has a minimum value of 0 and maximum value of 2^64-1.
* Use this data type when you need a range of values wider than those provided by int.
*/
public class Bullseye {
private final long r;
private final long t;
private final long result;
Bullseye(long radius, long total) throws Exception {
r = radius;
t = total;
/**
* because n must satisfy
* 2*n*n + (2*r-1)*n <= t
* so 2*n*n < t --> n < sqrt(t)/2
*/
result = binarySearch(1, (long) Math.sqrt(t / 2.0));
}
/**
* if f(n) <= t && f(n+1) > t, n is the answer
* if f(n) > t, n is too large, return +1
* if f(n+1) < t, n is too small, return -1
*/
private int compareTo(long n) {
/**
* ret1 = t - (2*n*n + (2*r-1)*n)
*/
long ret1 = t + n - 2 * n * n; // n < sqrt(t/2), so n*n is safe
if (ret1 < 0) return +1;
if (ret1 / n < 2 * r) return +1; // r*n may exceed long type range
ret1 -= 2 * r * n;
/**
* ret2 = t - (2*(n+1)*(n+1) + (2*r-1)*(n+1))
* ret2 = ret1 - (4*n+2*r+1)
*/
long ret2 = ret1 - 1 - 4 * n;
if (ret2 < 0) return 0;
ret2 -= 2 * r;
if (ret2 < 0) return 0;
return -1;
}
private long binarySearch(long lo, long hi) throws Exception {
if (lo > hi) throw new Exception("Invalid binary search boundary");
long mid = (lo + hi) / 2;
if (compareTo(mid) < 0) return binarySearch(mid + 1, hi);
else if (compareTo(mid) > 0) return binarySearch(lo, mid - 1);
else return mid;
}
public String toString() {
return Long.toString(result);
}
public static void main(String[] args) throws Exception {
if (args.length == 0)
throw new IllegalArgumentException("Require input file name");
Scanner sc = new Scanner(new FileReader(args[0]));
String outFilename = args[0].replaceFirst("[.][^.]+$", "").concat(".out");
PrintWriter pw = new PrintWriter(new FileWriter(outFilename));
int caseCnt = sc.nextInt();
for (int caseNum = 0; caseNum < caseCnt; caseNum++) {
pw.print("Case #" + (caseNum + 1) + ": ");
long r = sc.nextLong();
long t = sc.nextLong();
Bullseye bull = new Bullseye(r, t);
pw.println(bull);
}
pw.flush();
pw.close();
sc.close();
}
} | 32.05 | 95 | 0.575663 |
e0326e14608c56664ff057b88954309499549977 | 3,847 | /*
* Copyright (c) 2017 Uber Technologies, 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.uber.nullaway.testdata;
import com.facebook.infer.annotation.Initializer;
import javax.annotation.Nullable;
/** Created by msridhar on 3/7/17. */
public class CheckFieldInitPositiveCases {
static class T1 {
Object f;
// BUG: Diagnostic contains: initializer method does not guarantee @NonNull field f is
// initialized
T1() {}
}
static class T2 {
Object f, g;
// BUG: Diagnostic contains: initializer method does not guarantee @NonNull fields f, g are
// initialized
T2() {}
}
static class T3 {
// BUG: Diagnostic contains: @NonNull field f not initialized
Object f;
}
static class T4 {
// BUG: Diagnostic contains: assigning @Nullable expression to @NonNull field
Object f = null;
@Nullable
static Object returnNull() {
return null;
}
// BUG: Diagnostic contains: assigning @Nullable expression to @NonNull field
Object g = returnNull();
}
static class T5 {
Object f;
// BUG: Diagnostic contains: initializer method does not guarantee @NonNull field f is
// initialized
T5(boolean b) {
if (b) {
this.f = new Object();
}
}
}
static class T6 {
Object f;
T6() {
// to test detection of this() call
this(false);
}
// BUG: Diagnostic contains: initializer method does not guarantee @NonNull field f is
// initialized
T6(boolean b) {}
}
static class T7 {
Object f;
Object g;
// BUG: Diagnostic contains: initializer method does not guarantee @NonNull field f is
// initialized
T7(boolean b) {
if (b) {
init();
}
g = new Object();
}
// BUG: Diagnostic contains: initializer method does not guarantee @NonNull field g is
// initialized
T7() {
init();
init2();
}
private void init() {
f = new Object();
}
public void init2() {
g = new Object();
}
}
static class T8 {
Object f;
@Initializer
// BUG: Diagnostic contains: initializer method does not guarantee @NonNull field f is
// initialized
public void init() {}
}
static class T9 {
// BUG: Diagnostic contains: @NonNull static field f not initialized
static Object f;
static {
}
}
static class T10 {
// BUG: Diagnostic contains: @NonNull static field f not initialized
static Object f;
static {
}
@Initializer
static void init() {}
}
static class T11 {
// BUG: Diagnostic contains: @NonNull static field f not initialized
static Object f;
static {
}
@Initializer
static void init(Object f) {
f = new Object(); // Wrong f
}
}
}
| 22.497076 | 95 | 0.652197 |
3ea788c109e085f1c5db849618122bff111eafc2 | 633 | package com.dungeonstory.backend.data.enums;
import com.dungeonstory.backend.Labels;
public enum Condition implements I18nEnum {
BLINDED,
CHARMED,
CURSED,
DEAFENED,
FRIGHTENED,
GRAPPLED,
INCAPACITATED,
INVISIBLE,
MUTED,
PARALYZED,
PETRIFIED,
POISONED,
PRONE,
RESTRAINED,
SLEEP,
STUNNED,
UNCONSCIOUS;
private Condition() {
}
@Override
public String getName() {
return Labels.getInstance().getMessage(getKey(name(), "name"));
}
@Override
public String toString() {
return getName();
}
}
| 15.825 | 71 | 0.595577 |
8dc6416708e31efff4179e7d3afa78776567dfaf | 6,053 | package com.sct.application.authorization.controller;
import com.sct.application.authorization.controller.entity.UserLoginStatus;
import com.sct.application.authorization.properties.ILoginProperties;
import com.sct.application.authorization.support.session.CustomSessionRegistry;
import com.sct.commons.utils.JsonUtils;
import com.sct.commons.web.core.response.HttpResultEntity;
import com.sct.service.core.web.controller.WebConstants;
import com.sct.service.oauth2.core.constants.Oauth2Constants;
import com.sct.service.oauth2.core.util.OAuth20AuthenticationUtil;
import com.sct.service.users.security.SecurityUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.security.Principal;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;
/**
* 用户使用oauth2.0登录认证后,使用token查询登录用户信息
*/
@RestController
public class UserOauth20AuthorizationController extends BaseLoginController {
private static Logger logger = LoggerFactory.getLogger(UserOauth20AuthorizationController.class);
@Autowired
private ILoginProperties iLoginProperties;
@Autowired
private SessionRegistry sessionRegistry;
/**
* 依据登录用户id查询
*/
@Qualifier("authorityUserDetailsService")
@Autowired
private UserDetailsService userDetailsService;
@Autowired
private CustomSessionRegistry customSessionRegistry;
private void logout(final HttpServletRequest request) {
request.getSession().invalidate();
}
@GetMapping(path = {"/" + Oauth2Constants.Oauth2_ResourceServer_Context_Path + "/user/online/count"}, produces = WebConstants.WEB_PRODUCES)
@ResponseBody
public HttpEntity<?> online(final HttpServletRequest request,
final HttpServletResponse response, Principal principal) {
String path = "/" + Oauth2Constants.Oauth2_ResourceServer_Context_Path + "/user/online/count";
try {
if (principal == null) {
logout(request);
throw new AuthenticationServiceException(String.format("%s Missing [%s]", path, "Authentication Principal"));
}
Map<String, Integer> map = new HashMap<>();
int size = customSessionRegistry.online();
map.put("count", size);
return new ResponseEntity<>(map, HttpStatus.OK);
} catch (Exception e) {
logger.error("{} response error : code={} txt={} error:", path, HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage(), e);
return new ResponseEntity<>(HttpResultEntity.of(HttpResultEntity.Code.FAILURE, e.getMessage()),
HttpStatus.INTERNAL_SERVER_ERROR);
}
}
@GetMapping(path = {"/" + Oauth2Constants.Oauth2_ResourceServer_Context_Path + "/user/info"}, produces = WebConstants.WEB_PRODUCES)
public HttpEntity<?> user(final HttpServletRequest request,
final HttpServletResponse response, Principal principal) {
String path = "/" + Oauth2Constants.Oauth2_ResourceServer_Context_Path + "/user/info";
logger.info(String.format(path));
try {
if (principal == null) {
logout(request);
logger.info(String.format("%s Missing [%s]", path, "Authentication"));
throw new AuthenticationServiceException(String.format("Missing [%s]", "Authentication"));
}
String userId = OAuth20AuthenticationUtil.findOAuth20UserId(principal);
String loginTime = OAuth20AuthenticationUtil.findOAuth20TokenCreateTime(principal);
logger.debug("User userId is [{}]", userId);
UserLoginStatus userLoginStatus = null;
try {
UserDetails userDetails = userDetailsService.loadUserByUsername(userId);
if (userDetails != null && userDetails instanceof SecurityUser) {
userLoginStatus = UserLoginStatus.of();
assembleUserLoginStatus(userLoginStatus, (SecurityUser) userDetails);
userLoginStatus.setLoginTime(loginTime);
}
} catch (RuntimeException e) {
logger.error(String.format("UserProfileAuthorizationController.getCurrentUser(%s) Exception:%s", principal, e.getMessage()), e);
throw new RuntimeException("Failed to retrieve user profile", e);
}
if (userLoginStatus == null) {
logger.info(String.format("%s Failed to retrieve user profile.", path));
throw new RuntimeException("Failed to retrieve user profile.");
}
logger.debug("Final user profile is [{}]", JsonUtils.toJson(userLoginStatus));
return new ResponseEntity<>(userLoginStatus, HttpStatus.OK);
} catch (Exception e) {
logger.error("{} response error : code={} txt={} error:", path, HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage(), e);
return new ResponseEntity<>(HttpResultEntity.of(HttpResultEntity.Code.FAILURE, e.getMessage()),
HttpStatus.INTERNAL_SERVER_ERROR);
}
}
protected LocalDateTime getLoginTime(Object object) {
return LocalDateTime.now();
}
}
| 47.289063 | 144 | 0.701305 |
c8fe030b46ba222b857aee6f5e3d1c4f487e6886 | 113 | package org.jrd.backend.communication;
public interface JrdAgent {
String submitRequest(String request);
}
| 16.142857 | 41 | 0.778761 |
bab43c6f39aa2893db3c091e8439f78351b450c2 | 519 | package domainapp.dom.syncengine;
public interface SyncAble {
// implementing https://unterwaditzer.net/2016/sync-algorithm.html
/**
* unique identifier of the instance
* @return
*/
String getUniqueId();
/**
* sets unique identifier of the instance
*/
void setUniqueId(final String id);
/**
* identifier (hash, timestamp, ...) of the "contents" of the mutable instance, unique to the state of the single instance * @return
*/
String getETag();
}
| 21.625 | 140 | 0.633911 |
e3747bb04b8cdca981f8673fc804bf4d57b10c11 | 4,440 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.arrow.adapter.jdbc;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
import java.sql.Types;
import org.apache.arrow.util.Preconditions;
/**
* This class represents the information about a JDBC ResultSet Field that is
* needed to construct an {@link org.apache.arrow.vector.types.pojo.ArrowType}.
* Currently, this is:
* <ul>
* <li>The JDBC {@link java.sql.Types} type.</li>
* <li>The field's precision (used for {@link java.sql.Types#DECIMAL} and {@link java.sql.Types#NUMERIC} types)</li>
* <li>The field's scale (used for {@link java.sql.Types#DECIMAL} and {@link java.sql.Types#NUMERIC} types)</li>
* </ul>
*/
public class JdbcFieldInfo {
private final int jdbcType;
private final int precision;
private final int scale;
/**
* Builds a <code>JdbcFieldInfo</code> using only the {@link java.sql.Types} type. Do not use this constructor
* if the field type is {@link java.sql.Types#DECIMAL} or {@link java.sql.Types#NUMERIC}; the precision and
* scale will be set to <code>0</code>.
*
* @param jdbcType The {@link java.sql.Types} type.
* @throws IllegalArgumentException if jdbcType is {@link java.sql.Types#DECIMAL} or {@link java.sql.Types#NUMERIC}.
*/
public JdbcFieldInfo(int jdbcType) {
Preconditions.checkArgument(
(jdbcType != Types.DECIMAL && jdbcType != Types.NUMERIC),
"DECIMAL and NUMERIC types require a precision and scale; please use another constructor.");
this.jdbcType = jdbcType;
this.precision = 0;
this.scale = 0;
}
/**
* Builds a <code>JdbcFieldInfo</code> from the {@link java.sql.Types} type, precision, and scale.
* Use this constructor for {@link java.sql.Types#DECIMAL} and {@link java.sql.Types#NUMERIC} types.
*
* @param jdbcType The {@link java.sql.Types} type.
* @param precision The field's numeric precision.
* @param scale The field's numeric scale.
*/
public JdbcFieldInfo(int jdbcType, int precision, int scale) {
this.jdbcType = jdbcType;
this.precision = precision;
this.scale = scale;
}
/**
* Builds a <code>JdbcFieldInfo</code> from the corresponding {@link java.sql.ResultSetMetaData} column.
*
* @param rsmd The {@link java.sql.ResultSetMetaData} to get the field information from.
* @param column The column to get the field information for (on a 1-based index).
* @throws SQLException If the column information cannot be retrieved.
* @throws NullPointerException if <code>rsmd</code> is <code>null</code>.
* @throws IllegalArgumentException if <code>column</code> is out of bounds.
*/
public JdbcFieldInfo(ResultSetMetaData rsmd, int column) throws SQLException {
Preconditions.checkNotNull(rsmd, "ResultSetMetaData cannot be null.");
Preconditions.checkArgument(column > 0, "ResultSetMetaData columns have indices starting at 1.");
Preconditions.checkArgument(
column <= rsmd.getColumnCount(),
"The index must be within the number of columns (1 to %s, inclusive)", rsmd.getColumnCount());
this.jdbcType = rsmd.getColumnType(column);
this.precision = rsmd.getPrecision(column);
this.scale = rsmd.getScale(column);
}
/**
* The {@link java.sql.Types} type.
*/
public int getJdbcType() {
return jdbcType;
}
/**
* The numeric precision, for {@link java.sql.Types#NUMERIC} and {@link java.sql.Types#DECIMAL} types.
*/
public int getPrecision() {
return precision;
}
/**
* The numeric scale, for {@link java.sql.Types#NUMERIC} and {@link java.sql.Types#DECIMAL} types.
*/
public int getScale() {
return scale;
}
}
| 38.608696 | 118 | 0.705405 |
4597d4266c13ea833cf6b1210eef7a823c0153fb | 770 | package com.fw.beans;
import java.util.ArrayList;
import java.util.List;
/**
*
*
* @author Narendra Gurjar
*
*/
public class UserDashBoardBean {
private List<LoadAndBidRequestBean> dashboard;
private List<UserLoadRequestBean> bidDashboard;
public UserDashBoardBean() {
dashboard = new ArrayList<LoadAndBidRequestBean>();
bidDashboard = new ArrayList<UserLoadRequestBean>();
}
public List<LoadAndBidRequestBean> getDashboard() {
return dashboard;
}
public void setDashboard(List<LoadAndBidRequestBean> dashboard) {
this.dashboard = dashboard;
}
public List<UserLoadRequestBean> getBidDashboard() {
return bidDashboard;
}
public void setBidDashboard(List<UserLoadRequestBean> bidDashboard) {
this.bidDashboard = bidDashboard;
}
}
| 18.780488 | 70 | 0.757143 |
3454ef278cb094199b53d9db68b3593d2063923c | 888 | package com.ibm.webapi.apis;
import javax.enterprise.context.ApplicationScoped;
import javax.json.Json;
import javax.json.JsonObject;
import com.ibm.webapi.business.Article;
import com.ibm.webapi.business.CoreArticle;
@ApplicationScoped
public class ArticleAsJson {
public ArticleAsJson() {}
public JsonObject createJsonCoreArticle(CoreArticle article) {
JsonObject output = Json.createObjectBuilder().add("id", article.id).add("title", article.title).add("url", article.url)
.add("author", article.author).build();
return output;
}
public JsonObject createJsonArticle(Article article) {
JsonObject output = Json.createObjectBuilder().add("id", article.id).add("title", article.title).add("url", article.url)
.add("authorName", article.authorName).add("authorBlog", article.authorBlog).add("authorTwitter", article.authorTwitter).build();
return output;
}
} | 34.153846 | 133 | 0.759009 |
f8a3f700b398873fb5b6b5a412e1661f81dce82c | 3,097 | /*
* Licensed to the Warcraft4J Project under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The Warcraft4J Project licenses
* this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package nl.salp.warcraft4j.battlenet.guice;
import com.google.inject.AbstractModule;
import com.google.inject.Provider;
import nl.salp.warcraft4j.battlenet.BattlenetApiConfig;
import nl.salp.warcraft4j.battlenet.api.BattlenetApi;
import nl.salp.warcraft4j.battlenet.api.BattlenetFileApi;
import nl.salp.warcraft4j.battlenet.api.JacksonJsonApiResultParser;
import nl.salp.warcraft4j.battlenet.api.wow.WowBattlenetApi;
import nl.salp.warcraft4j.battlenet.api.wow.WowBattlenetApiImpl;
import nl.salp.warcraft4j.battlenet.api.JsonApiResultParser;
import java.util.HashMap;
import java.util.Map;
/**
* Guice module with JSON file bindings.
*
* @author Barre Dijkstra
*/
public class BattlenetApiTestModule extends AbstractModule {
/** The location of the Battle.NET API config file. */
private final String configFile;
/**
* Create a new Guice Battle.NET API module instance using the default config file location.
*/
public BattlenetApiTestModule() {
this.configFile = null;
}
/**
* Create a new Guice Battle.NET API module instance.
*
* @param configFile The location of the Battle.NET API config file.
*/
public BattlenetApiTestModule(String configFile) {
this.configFile = configFile;
}
@Override
protected void configure() {
bind(BattlenetApiConfig.class).toProvider(new BattlenetApiConfigFileProvider(this.configFile));
bind(JsonApiResultParser.class).toInstance(new JacksonJsonApiResultParser(true));
bind(WowBattlenetApi.class).to(WowBattlenetApiImpl.class);
bind(BattlenetApi.class).toProvider(new FileApiProvider());
}
/**
* Provider for {@link BattlenetFileApi} that maps all methods to test JSON files.
*/
private static class FileApiProvider implements Provider<BattlenetFileApi> {
@Override
public BattlenetFileApi get() {
Map<String, String> jsonFiles = new HashMap<>();
jsonFiles.put("/wow/character", "/json/character/character_all.json");
jsonFiles.put("/wow/item", "/json/item/item-finkles_lava_dredger.json");
jsonFiles.put("/wow/item/set", "/json/item/itemset-deep_earth_vestments.json");
return new BattlenetFileApi(jsonFiles);
}
}
} | 38.234568 | 103 | 0.727801 |
a0fad326dd12e9d3b0d58190f0b36b9c54bb92bb | 1,784 | package com.andbase.demo.activity;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import com.ab.activity.AbActivity;
import com.ab.fragment.AbAlertDialogFragment.AbDialogOnClickListener;
import com.ab.fragment.AbDialogFragment;
import com.ab.fragment.AbDialogFragment.AbDialogOnLoadListener;
import com.ab.fragment.AbLoadDialogFragment;
import com.ab.fragment.AbRefreshDialogFragment;
import com.ab.http.AbHttpListener;
import com.ab.util.AbDialogUtil;
import com.ab.util.AbToastUtil;
import com.ab.view.titlebar.AbTitleBar;
import com.andbase.R;
import com.andbase.global.MyApplication;
import com.andbase.web.NetworkWeb;
/**
* 名称:DemoAbActivity
* 描述:AbActivity基本用法
*
* @author 还如一梦中
* @date 2011-12-13
* @version
*/
public class DemoAbActivity extends AbActivity {
private MyApplication application;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setAbContentView(R.layout.ab_activity);
AbTitleBar mAbTitleBar = this.getTitleBar();
mAbTitleBar.setTitleText(R.string.ab_name);
mAbTitleBar.setLogo(R.drawable.button_selector_back);
mAbTitleBar.setTitleBarBackground(R.drawable.top_bg);
mAbTitleBar.setTitleTextMargin(10, 0, 0, 0);
mAbTitleBar.setLogoLine(R.drawable.line);
application = (MyApplication) abApplication;
Button btn1 = (Button) this.findViewById(R.id.btn1);
btn1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(DemoAbActivity.this,
TitleBarActivity.class);
startActivity(intent);
}
});
}
}
| 26.626866 | 69 | 0.788117 |
ade293541a6cc7e099ab2061920bb0197bd46497 | 414 | package com.mikedeejay2.mikedeejay2lib.gui;
/**
* Simple Interface for constructing GUIs upon calling the {@link GUIConstructor#get()} method.
*
* @author Mikedeejay2
*/
@FunctionalInterface
public interface GUIConstructor
{
/**
* Get a newly constructed {@link GUIContainer}. Constructed when this method is called.
*
* @return A new {@link GUIContainer}
*/
GUIContainer get();
}
| 23 | 95 | 0.695652 |
2fae45118da4d4cca2d6bf5b0a597f545dd3c84f | 465 | package org.nhindirect.stagent;
public class NHINDAgentAccessor
{
public static void bindAddresses(NHINDAgent agent, IncomingMessage message)
{
if (agent instanceof DefaultNHINDAgent)
((DefaultNHINDAgent)agent).bindAddresses(message);
}
public static void bindAddresses(NHINDAgent agent, OutgoingMessage message)
{
if (agent instanceof DefaultNHINDAgent)
((DefaultNHINDAgent)agent).bindAddresses(message);
}
}
| 25.833333 | 79 | 0.731183 |
3219179114c39b516fb076064826e3f9cad468fb | 4,633 | package hudson.plugins.dry;
import static org.junit.Assert.*;
import hudson.util.FormValidation;
import org.junit.Test;
/**
* Tests the class {@link ThresholdValidation}.
*
* @author Ulli Hafner
*/
public class ThresholdValidationTest {
private static final String WRONG_VALUE_FOR_NORMAL_THRESHOLD = "Wrong value for normal threshold";
private static final String WRONG_VALUE_FOR_HIGH_THRESHOLD = "Wrong value for high threshold";
private static final String RESULT_IS_NOT_VALID = "Result is not valid";
/**
* Verifies valid values.
*/
@Test
public void testValid() {
ThresholdValidation validation = new ThresholdValidation();
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.OK, validation.validateHigh("50", "25").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.OK, validation.validateHigh("50", "49").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.OK, validation.validateNormal("50", "25").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.OK, validation.validateNormal("50", "49").kind);
}
/**
* Verifies invalid values.
*/
@Test
public void testInvalid() {
ThresholdValidation validation = new ThresholdValidation();
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.ERROR, validation.validateHigh("50", "50").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.ERROR, validation.validateNormal("50", "50").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.ERROR, validation.validateHigh("50", "-1").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.ERROR, validation.validateNormal("50", "-1").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.ERROR, validation.validateHigh("50", "").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.ERROR, validation.validateNormal("50", "").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.ERROR, validation.validateHigh("50", "500").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.ERROR, validation.validateNormal("50", "500").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.ERROR, validation.validateHigh("", "500").kind);
assertEquals(RESULT_IS_NOT_VALID, FormValidation.Kind.ERROR, validation.validateNormal("", "500").kind);
}
/**
* Verifies that the getters return the default values for illegal thresholds.
*/
@Test
public void testGetters() {
ThresholdValidation validation = new ThresholdValidation();
assertEquals(WRONG_VALUE_FOR_HIGH_THRESHOLD, 2, validation.getHighThreshold(1, 2));
assertEquals(WRONG_VALUE_FOR_HIGH_THRESHOLD, 20, validation.getHighThreshold(1, 20));
assertEquals(WRONG_VALUE_FOR_HIGH_THRESHOLD, 10, validation.getHighThreshold(5, 10));
assertEquals(WRONG_VALUE_FOR_HIGH_THRESHOLD, 10, validation.getHighThreshold(9, 10));
assertEquals(WRONG_VALUE_FOR_HIGH_THRESHOLD,
ThresholdValidation.DEFAULT_HIGH_THRESHOLD, validation.getHighThreshold(10, 10));
assertEquals(WRONG_VALUE_FOR_HIGH_THRESHOLD,
ThresholdValidation.DEFAULT_HIGH_THRESHOLD, validation.getHighThreshold(0, 10));
assertEquals(WRONG_VALUE_FOR_HIGH_THRESHOLD,
ThresholdValidation.DEFAULT_HIGH_THRESHOLD, validation.getHighThreshold(-1, 10));
assertEquals(WRONG_VALUE_FOR_HIGH_THRESHOLD,
ThresholdValidation.DEFAULT_HIGH_THRESHOLD, validation.getHighThreshold(5, 0));
assertEquals(WRONG_VALUE_FOR_NORMAL_THRESHOLD, 1, validation.getNormalThreshold(1, 2));
assertEquals(WRONG_VALUE_FOR_NORMAL_THRESHOLD, 1, validation.getNormalThreshold(1, 20));
assertEquals(WRONG_VALUE_FOR_NORMAL_THRESHOLD, 5, validation.getNormalThreshold(5, 10));
assertEquals(WRONG_VALUE_FOR_NORMAL_THRESHOLD, 9, validation.getNormalThreshold(9, 10));
assertEquals(WRONG_VALUE_FOR_NORMAL_THRESHOLD,
ThresholdValidation.DEFAULT_NORMAL_THRESHOLD, validation.getNormalThreshold(10, 10));
assertEquals(WRONG_VALUE_FOR_NORMAL_THRESHOLD,
ThresholdValidation.DEFAULT_NORMAL_THRESHOLD, validation.getNormalThreshold(0, 10));
assertEquals(WRONG_VALUE_FOR_NORMAL_THRESHOLD,
ThresholdValidation.DEFAULT_NORMAL_THRESHOLD, validation.getNormalThreshold(-1, 10));
assertEquals(WRONG_VALUE_FOR_NORMAL_THRESHOLD,
ThresholdValidation.DEFAULT_NORMAL_THRESHOLD, validation.getNormalThreshold(5, 0));
}
}
| 49.817204 | 114 | 0.738398 |
93794425ec204b4834ecc09eb5325c59d448d589 | 876 | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.appcontainers.generated;
import com.azure.core.util.Context;
/** Samples for Certificates Get. */
public final class CertificatesGetSamples {
/*
* x-ms-original-file: specification/app/resource-manager/Microsoft.App/preview/2022-01-01-preview/examples/Certificate_Get.json
*/
/**
* Sample code: Get Certificate.
*
* @param manager Entry point to ContainerAppsApiManager.
*/
public static void getCertificate(com.azure.resourcemanager.appcontainers.ContainerAppsApiManager manager) {
manager
.certificates()
.getWithResponse("examplerg", "testcontainerenv", "certificate-firendly-name", Context.NONE);
}
}
| 35.04 | 132 | 0.719178 |
c4bcbfb12cdebaabea0c9ce812a6182d1093765d | 2,210 | package de.hpi.bp2013n1.anonymizer;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertThat;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.when;
import java.sql.Connection;
import java.sql.SQLException;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
import de.hpi.bp2013n1.anonymizer.PseudonymizeStrategy.PseudonymsTableProxy;
import de.hpi.bp2013n1.anonymizer.TransformationStrategy.RuleValidationException;
import de.hpi.bp2013n1.anonymizer.shared.Rule;
import de.hpi.bp2013n1.anonymizer.shared.TransformationKeyNotFoundException;
public class PseudonymizeStrategyTest {
private Connection odb;
private Connection tdb;
private PseudonymizeStrategy sut;
@Before
public void setUp() throws Exception {
odb = mock(Connection.class, Mockito.RETURNS_MOCKS);
tdb = mock(Connection.class, Mockito.RETURNS_MOCKS);
sut = spy(new PseudonymizeStrategy(null, odb, tdb));
}
@Test
public void testIsRuleValid() throws RuleValidationException {
assertThat(sut.isRuleValid(new Rule(), java.sql.Types.BLOB, 0, true),
is(false));
Rule tooLongPrefixRule = new Rule(null, "", "FOO");
assertThat(sut.isRuleValid(tooLongPrefixRule , java.sql.Types.CHAR, 1, false),
is(false));
Rule prefixRule = new Rule(null, "", "P");
assertThat(sut.isRuleValid(prefixRule, java.sql.Types.INTEGER, 11, true),
is(false));
}
@Test
public void testTransform() throws SQLException, TransformationKeyNotFoundException {
PseudonymsTableProxy tableStub = mock(PseudonymsTableProxy.class);
doReturn(tableStub).when(sut).getPseudonymsTableFor(any(Rule.class));
when(tableStub.fetchOneString("foo")).thenReturn("bar");
ResultSetRowReader rowReaderMock = mock(ResultSetRowReader.class);
assertThat(sut.transform((Object) "foo",
mock(Rule.class), rowReaderMock),
contains("bar"));
when(tableStub.fetchOneString("1")).thenReturn("2");
assertThat(sut.transform(new Integer(1), mock(Rule.class), rowReaderMock),
contains("2"));
}
}
| 34.53125 | 86 | 0.775566 |
1404fb78873d6aeda3fb67281ffbbe24b2817935 | 4,618 | package com.customfabs.animation;
import android.animation.Animator;
import android.graphics.Point;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.RelativeLayout;
import com.customfabs.FloatingActionMenu;
/**
* An abstract class that is a prototype for the actual animation handlers
*/
public abstract class MenuAnimationHandler {
// There are only two distinct animations at the moment.
protected enum ActionType {OPENING, CLOSING}
protected FloatingActionMenu menu;
public MenuAnimationHandler() {
}
public void setMenu(FloatingActionMenu menu) {
this.menu = menu;
}
/**
* Starts the opening animation
* Should be overriden by children
* @param center
*/
public void animateMenuOpening(Point center) {
if(menu == null) {
throw new NullPointerException("MenuAnimationHandler cannot animate without a valid FloatingActionMenu.");
}
}
/**
* Ends the opening animation
* Should be overriden by children
* @param center
*/
public void animateMenuClosing(Point center) {
if(menu == null) {
throw new NullPointerException("MenuAnimationHandler cannot animate without a valid FloatingActionMenu.");
}
}
/**
* Restores the specified sub action view to its final state, according to the current actionType
* Should be called after an animation finishes.
* @param subActionItem
* @param actionType
*/
protected void restoreSubActionViewAfterAnimation(FloatingActionMenu.Item subActionItem, ActionType actionType) {
ViewGroup.LayoutParams params = subActionItem.view.getLayoutParams();
subActionItem.view.setTranslationX(0);
subActionItem.view.setTranslationY(0);
subActionItem.view.setRotation(0);
subActionItem.view.setScaleX(1);
subActionItem.view.setScaleY(1);
subActionItem.view.setAlpha(1);
if(actionType == ActionType.OPENING) {
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) params;
// ViewGroup.LayoutParams lp = params;
if(menu.isSystemOverlay()) {
WindowManager.LayoutParams overlayParams = (WindowManager.LayoutParams) menu.getOverlayContainer().getLayoutParams();
lp.setMargins(subActionItem.x - overlayParams.x, subActionItem.y - overlayParams.y, 0, 0);
}
else {
lp.setMargins(subActionItem.x, subActionItem.y, 0, 0);
}
subActionItem.view.setLayoutParams(lp);
}
else if(actionType == ActionType.CLOSING) {
Point center = menu.getActionViewCenter();
FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) params;
if(menu.isSystemOverlay()) {
WindowManager.LayoutParams overlayParams = (WindowManager.LayoutParams) menu.getOverlayContainer().getLayoutParams();
lp.setMargins(center.x - overlayParams.x - subActionItem.width / 2, center.y - overlayParams.y - subActionItem.height / 2, 0, 0);
}
else {
lp.setMargins(center.x - subActionItem.width / 2, center.y - subActionItem.height / 2, 0, 0);
}
subActionItem.view.setLayoutParams(lp);
menu.removeViewFromCurrentContainer(subActionItem.view);
if(menu.isSystemOverlay()) {
// When all the views are removed from the overlay container,
// we also need to detach it
if (menu.getOverlayContainer().getChildCount() == 0) {
menu.detachOverlayContainer();
}
}
}
}
/**
* A special animation listener that is intended to listen the last of the sequential animations.
* Changes the animating property of children.
*/
public class LastAnimationListener implements Animator.AnimatorListener {
@Override
public void onAnimationStart(Animator animation) {
setAnimating(true);
}
@Override
public void onAnimationEnd(Animator animation) {
setAnimating(false);
}
@Override
public void onAnimationCancel(Animator animation) {
setAnimating(false);
}
@Override
public void onAnimationRepeat(Animator animation) {
setAnimating(true);
}
}
public abstract boolean isAnimating();
protected abstract void setAnimating(boolean animating);
}
| 35.251908 | 145 | 0.6466 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.