_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q2900
PJsonArray.getString
train
@Override public final String getString(final int i) { String val = this.array.optString(i, null); if (val == null) { throw new ObjectMissingException(this, "[" + i + "]"); } return val; }
java
{ "resource": "" }
q2901
PJsonArray.getBool
train
@Override public final boolean getBool(final int i) { try { return this.array.getBoolean(i); } catch (JSONException e) { throw new ObjectMissingException(this, "[" + i + "]"); } }
java
{ "resource": "" }
q2902
PAbstractObject.getString
train
@Override public final String getString(final String key) { String result = optString(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
{ "resource": "" }
q2903
PAbstractObject.optString
train
@Override public final String optString(final String key, final String defaultValue) { String result = optString(key); return result == null ? defaultValue : result; }
java
{ "resource": "" }
q2904
PAbstractObject.getInt
train
@Override public final int getInt(final String key) { Integer result = optInt(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
{ "resource": "" }
q2905
PAbstractObject.optInt
train
@Override public final Integer optInt(final String key, final Integer defaultValue) { Integer result = optInt(key); return result == null ? defaultValue : result; }
java
{ "resource": "" }
q2906
PAbstractObject.getLong
train
@Override public final long getLong(final String key) { Long result = optLong(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
{ "resource": "" }
q2907
PAbstractObject.optLong
train
@Override public final long optLong(final String key, final long defaultValue) { Long result = optLong(key); return result == null ? defaultValue : result; }
java
{ "resource": "" }
q2908
PAbstractObject.getDouble
train
@Override public final double getDouble(final String key) { Double result = optDouble(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
{ "resource": "" }
q2909
PAbstractObject.optDouble
train
@Override public final Double optDouble(final String key, final Double defaultValue) { Double result = optDouble(key); return result == null ? defaultValue : result; }
java
{ "resource": "" }
q2910
PAbstractObject.getFloat
train
@Override public final float getFloat(final String key) { Float result = optFloat(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
{ "resource": "" }
q2911
PAbstractObject.optFloat
train
@Override public final Float optFloat(final String key, final Float defaultValue) { Float result = optFloat(key); return result == null ? defaultValue : result; }
java
{ "resource": "" }
q2912
PAbstractObject.getBool
train
@Override public final boolean getBool(final String key) { Boolean result = optBool(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
{ "resource": "" }
q2913
PAbstractObject.optBool
train
@Override public final Boolean optBool(final String key, final Boolean defaultValue) { Boolean result = optBool(key); return result == null ? defaultValue : result; }
java
{ "resource": "" }
q2914
PAbstractObject.getObject
train
@Override public final PObject getObject(final String key) { PObject result = optObject(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
{ "resource": "" }
q2915
PAbstractObject.getArray
train
@Override public final PArray getArray(final String key) { PArray result = optArray(key); if (result == null) { throw new ObjectMissingException(this, key); } return result; }
java
{ "resource": "" }
q2916
AccessAssertionPersister.unmarshal
train
public AccessAssertion unmarshal(final JSONObject encodedAssertion) { final String className; try { className = encodedAssertion.getString(JSON_CLASS_NAME); final Class<?> assertionClass = Thread.currentThread().getContextClassLoader().loadClass(className); ...
java
{ "resource": "" }
q2917
AccessAssertionPersister.marshal
train
public JSONObject marshal(final AccessAssertion assertion) { final JSONObject jsonObject = assertion.marshal(); if (jsonObject.has(JSON_CLASS_NAME)) { throw new AssertionError("The toJson method in AccessAssertion: '" + assertion.getClass() + "' d...
java
{ "resource": "" }
q2918
AddHeadersProcessor.createFactoryWrapper
train
public static MfClientHttpRequestFactory createFactoryWrapper( final MfClientHttpRequestFactory requestFactory, final UriMatchers matchers, final Map<String, List<String>> headers) { return new AbstractMfClientHttpRequestFactoryWrapper(requestFactory, matchers, false) { @Over...
java
{ "resource": "" }
q2919
AddHeadersProcessor.setHeaders
train
@SuppressWarnings("unchecked") public void setHeaders(final Map<String, Object> headers) { this.headers.clear(); for (Map.Entry<String, Object> entry: headers.entrySet()) { if (entry.getValue() instanceof List) { List value = (List) entry.getValue(); // ve...
java
{ "resource": "" }
q2920
ProcessorUtils.writeProcessorOutputToValues
train
public static void writeProcessorOutputToValues( final Object output, final Processor<?, ?> processor, final Values values) { Map<String, String> mapper = processor.getOutputMapperBiMap(); if (mapper == null) { mapper = Collections.emptyMap(); } ...
java
{ "resource": "" }
q2921
ProcessorUtils.getInputValueName
train
public static String getInputValueName( @Nullable final String inputPrefix, @Nonnull final BiMap<String, String> inputMapper, @Nonnull final String field) { String name = inputMapper == null ? null : inputMapper.inverse().get(field); if (name == null) { if...
java
{ "resource": "" }
q2922
ProcessorUtils.getOutputValueName
train
public static String getOutputValueName( @Nullable final String outputPrefix, @Nonnull final Map<String, String> outputMapper, @Nonnull final Field field) { String name = outputMapper.get(field.getName()); if (name == null) { name = field.getName(); ...
java
{ "resource": "" }
q2923
MapfishMapContext.rectangleDoubleToDimension
train
public static Dimension rectangleDoubleToDimension(final Rectangle2D.Double rectangle) { return new Dimension( (int) Math.round(rectangle.width), (int) Math.round(rectangle.height)); }
java
{ "resource": "" }
q2924
MapfishMapContext.getRotatedBounds
train
public MapBounds getRotatedBounds(final Rectangle2D.Double paintAreaPrecise, final Rectangle paintArea) { final MapBounds rotatedBounds = this.getRotatedBounds(); if (rotatedBounds instanceof CenterScaleMapBounds) { return rotatedBounds; } final ReferencedEnvelope envelope ...
java
{ "resource": "" }
q2925
MapfishMapContext.getRotatedBoundsAdjustedForPreciseRotatedMapSize
train
public MapBounds getRotatedBoundsAdjustedForPreciseRotatedMapSize() { Rectangle2D.Double paintAreaPrecise = getRotatedMapSizePrecise(); Rectangle paintArea = new Rectangle(MapfishMapContext.rectangleDoubleToDimension(paintAreaPrecise)); return getRotatedBounds(paintAreaPrecise, paintArea); }
java
{ "resource": "" }
q2926
Main.runMain
train
@VisibleForTesting public static void runMain(final String[] args) throws Exception { final CliHelpDefinition helpCli = new CliHelpDefinition(); try { Args.parse(helpCli, args); if (helpCli.help) { printUsage(0); return; } ...
java
{ "resource": "" }
q2927
CoverageTask.call
train
public GridCoverage2D call() { try { BufferedImage coverageImage = this.tiledLayer.createBufferedImage( this.tilePreparationInfo.getImageWidth(), this.tilePreparationInfo.getImageHeight()); Graphics2D graphics = coverageImage.createGraphics(); ...
java
{ "resource": "" }
q2928
ThreadPoolJobManager.shutdown
train
@PreDestroy public final void shutdown() { this.timer.shutdownNow(); this.executor.shutdownNow(); if (this.cleanUpTimer != null) { this.cleanUpTimer.shutdownNow(); } }
java
{ "resource": "" }
q2929
ThreadPoolJobManager.isAbandoned
train
private boolean isAbandoned(final SubmittedPrintJob printJob) { final long duration = ThreadPoolJobManager.this.jobQueue.timeSinceLastStatusCheck( printJob.getEntry().getReferenceId()); final boolean abandoned = duration > TimeUnit.SECONDS.toMillis(ThreadPoolJobManager.th...
java
{ "resource": "" }
q2930
ThreadPoolJobManager.isAcceptingNewJobs
train
private boolean isAcceptingNewJobs() { if (this.requestedToStop) { return false; } else if (new File(this.workingDirectories.getWorking(), "stop").exists()) { LOGGER.info("The print has been requested to stop"); this.requestedToStop = true; notifyIfStopped...
java
{ "resource": "" }
q2931
ThreadPoolJobManager.notifyIfStopped
train
private void notifyIfStopped() { if (isAcceptingNewJobs() || !this.runningTasksFutures.isEmpty()) { return; } final File stoppedFile = new File(this.workingDirectories.getWorking(), "stopped"); try { LOGGER.info("The print has finished processing jobs and can now ...
java
{ "resource": "" }
q2932
AreaOfInterest.postConstruct
train
public void postConstruct() { parseGeometry(); Assert.isTrue(this.polygon != null, "Polygon is null. 'area' string is: '" + this.area + "'"); Assert.isTrue(this.display != null, "'display' is null"); Assert.isTrue(this.style == null || this.display == AoiDisplay.RENDER, ...
java
{ "resource": "" }
q2933
AreaOfInterest.areaToFeatureCollection
train
public SimpleFeatureCollection areaToFeatureCollection( @Nonnull final MapAttribute.MapAttributeValues mapAttributes) { Assert.isTrue(mapAttributes.areaOfInterest == this, "map attributes passed in does not contain this area of interest object"); final SimpleFeatureTyp...
java
{ "resource": "" }
q2934
AreaOfInterest.copy
train
public AreaOfInterest copy() { AreaOfInterest aoi = new AreaOfInterest(); aoi.display = this.display; aoi.area = this.area; aoi.polygon = this.polygon; aoi.style = this.style; aoi.renderAsSvg = this.renderAsSvg; return aoi; }
java
{ "resource": "" }
q2935
ProcessorDependencyGraphFactory.fillProcessorAttributes
train
public static void fillProcessorAttributes( final List<Processor> processors, final Map<String, Attribute> initialAttributes) { Map<String, Attribute> currentAttributes = new HashMap<>(initialAttributes); for (Processor processor: processors) { if (processor instanceo...
java
{ "resource": "" }
q2936
OneOfTracker.checkAllGroupsSatisfied
train
public void checkAllGroupsSatisfied(final String currentPath) { StringBuilder errors = new StringBuilder(); for (OneOfGroup group: this.mapping.values()) { if (group.satisfiedBy.isEmpty()) { errors.append("\n"); errors.append("\t* The OneOf choice: ").append...
java
{ "resource": "" }
q2937
LoggingMetricsConfigurator.addMetricsAppenderToLogback
train
@PostConstruct public final void addMetricsAppenderToLogback() { final LoggerContext factory = (LoggerContext) LoggerFactory.getILoggerFactory(); final Logger root = factory.getLogger(Logger.ROOT_LOGGER_NAME); final InstrumentedAppender metrics = new InstrumentedAppender(this.metricRegistry...
java
{ "resource": "" }
q2938
RequiresTracker.checkAllRequirementsSatisfied
train
public void checkAllRequirementsSatisfied(final String currentPath) { StringBuilder errors = new StringBuilder(); for (Field field: this.dependantsInJson) { final Collection<String> requirements = this.dependantToRequirementsMap.get(field); if (!requirements.isEmpty()) { ...
java
{ "resource": "" }
q2939
Configuration.printClientConfig
train
public final void printClientConfig(final JSONWriter json) throws JSONException { json.key("layouts"); json.array(); final Map<String, Template> accessibleTemplates = getTemplates(); accessibleTemplates.entrySet().stream().sorted(Comparator.comparing(Map.Entry::getKey)) ....
java
{ "resource": "" }
q2940
Configuration.getTemplate
train
public final Template getTemplate(final String name) { final Template template = this.templates.get(name); if (template != null) { this.accessAssertion.assertAccess("Configuration", this); template.assertAccessible(name); } else { throw new IllegalArgumentExce...
java
{ "resource": "" }
q2941
Configuration.getDefaultStyle
train
@Nonnull public final Style getDefaultStyle(@Nonnull final String geometryType) { String normalizedGeomName = GEOMETRY_NAME_ALIASES.get(geometryType.toLowerCase()); if (normalizedGeomName == null) { normalizedGeomName = geometryType.toLowerCase(); } Style style = this.def...
java
{ "resource": "" }
q2942
Configuration.setDefaultStyle
train
public final void setDefaultStyle(final Map<String, Style> defaultStyle) { this.defaultStyle = new HashMap<>(defaultStyle.size()); for (Map.Entry<String, Style> entry: defaultStyle.entrySet()) { String normalizedName = GEOMETRY_NAME_ALIASES.get(entry.getKey().toLowerCase()); if ...
java
{ "resource": "" }
q2943
Configuration.validate
train
public final List<Throwable> validate() { List<Throwable> validationErrors = new ArrayList<>(); this.accessAssertion.validate(validationErrors, this); for (String jdbcDriver: this.jdbcDrivers) { try { Class.forName(jdbcDriver); } catch (ClassNotFoundExcep...
java
{ "resource": "" }
q2944
ProcessorGraphNode.addDependency
train
public void addDependency(final ProcessorGraphNode node) { Assert.isTrue(node != this, "A processor can't depends on himself"); this.dependencies.add(node); node.addRequirement(this); }
java
{ "resource": "" }
q2945
ProcessorGraphNode.getOutputMapper
train
@Nonnull public BiMap<String, String> getOutputMapper() { final BiMap<String, String> outputMapper = this.processor.getOutputMapperBiMap(); if (outputMapper == null) { return HashBiMap.create(); } return outputMapper; }
java
{ "resource": "" }
q2946
ProcessorGraphNode.getInputMapper
train
@Nonnull public BiMap<String, String> getInputMapper() { final BiMap<String, String> inputMapper = this.processor.getInputMapperBiMap(); if (inputMapper == null) { return HashBiMap.create(); } return inputMapper; }
java
{ "resource": "" }
q2947
ProcessorGraphNode.getAllProcessors
train
public Set<? extends Processor<?, ?>> getAllProcessors() { IdentityHashMap<Processor<?, ?>, Void> all = new IdentityHashMap<>(); all.put(this.getProcessor(), null); for (ProcessorGraphNode<?, ?> dependency: this.dependencies) { for (Processor<?, ?> p: dependency.getAllProcessors()) {...
java
{ "resource": "" }
q2948
BaseMapServlet.findReplacement
train
public static String findReplacement(final String variableName, final Date date) { if (variableName.equalsIgnoreCase("date")) { return cleanUpName(DateFormat.getDateInstance().format(date)); } else if (variableName.equalsIgnoreCase("datetime")) { return cleanUpName(DateFormat.get...
java
{ "resource": "" }
q2949
BaseMapServlet.error
train
protected static void error( final HttpServletResponse httpServletResponse, final String message, final HttpStatus code) { try { httpServletResponse.setContentType("text/plain"); httpServletResponse.setStatus(code.value()); setNoCache(httpServletResponse); ...
java
{ "resource": "" }
q2950
BaseMapServlet.error
train
protected final void error(final HttpServletResponse httpServletResponse, final Throwable e) { httpServletResponse.setContentType("text/plain"); httpServletResponse.setStatus(HttpStatus.INTERNAL_SERVER_ERROR.value()); try (PrintWriter out = httpServletResponse.getWriter()) { out.prin...
java
{ "resource": "" }
q2951
BaseMapServlet.getBaseUrl
train
protected final StringBuilder getBaseUrl(final HttpServletRequest httpServletRequest) { StringBuilder baseURL = new StringBuilder(); if (httpServletRequest.getContextPath() != null && !httpServletRequest.getContextPath().isEmpty()) { baseURL.append(httpServletRequest.getContextPath()); ...
java
{ "resource": "" }
q2952
ScalebarGraphic.getSize
train
@VisibleForTesting protected static Dimension getSize( final ScalebarAttributeValues scalebarParams, final ScaleBarRenderSettings settings, final Dimension maxLabelSize) { final float width; final float height; if (scalebarParams.getOrientation().isHorizontal()) { ...
java
{ "resource": "" }
q2953
ScalebarGraphic.getMaxLabelSize
train
@VisibleForTesting protected static Dimension getMaxLabelSize(final ScaleBarRenderSettings settings) { float maxLabelHeight = 0.0f; float maxLabelWidth = 0.0f; for (final Label label: settings.getLabels()) { maxLabelHeight = Math.max(maxLabelHeight, label.getHeight()); ...
java
{ "resource": "" }
q2954
ScalebarGraphic.createLabelText
train
@VisibleForTesting protected static String createLabelText( final DistanceUnit scaleUnit, final double value, final DistanceUnit intervalUnit) { double scaledValue = scaleUnit.convertTo(value, intervalUnit); // assume that there is no interval smaller then 0.0001 scaledValue = M...
java
{ "resource": "" }
q2955
ScalebarGraphic.getNearestNiceValue
train
@VisibleForTesting protected static double getNearestNiceValue( final double value, final DistanceUnit scaleUnit, final boolean lockUnits) { DistanceUnit bestUnit = bestUnit(scaleUnit, value, lockUnits); double factor = scaleUnit.convertTo(1.0, bestUnit); // nearest power of 10 ...
java
{ "resource": "" }
q2956
ScalebarGraphic.getBarSize
train
@VisibleForTesting protected static int getBarSize(final ScaleBarRenderSettings settings) { if (settings.getParams().barSize != null) { return settings.getParams().barSize; } else { if (settings.getParams().getOrientation().isHorizontal()) { return settings.ge...
java
{ "resource": "" }
q2957
ScalebarGraphic.getLabelDistance
train
@VisibleForTesting protected static int getLabelDistance(final ScaleBarRenderSettings settings) { if (settings.getParams().labelDistance != null) { return settings.getParams().labelDistance; } else { if (settings.getParams().getOrientation().isHorizontal()) { ...
java
{ "resource": "" }
q2958
ScalebarGraphic.render
train
public final URI render( final MapfishMapContext mapContext, final ScalebarAttributeValues scalebarParams, final File tempFolder, final Template template) throws IOException, ParserConfigurationException { final double dpi = mapContext.getDPI(); ...
java
{ "resource": "" }
q2959
MapPrinter.parseSpec
train
public static PJsonObject parseSpec(final String spec) { final JSONObject jsonSpec; try { jsonSpec = new JSONObject(spec); } catch (JSONException e) { throw new RuntimeException("Cannot parse the spec file: " + spec, e); } return new PJsonObject(jsonSpec, ...
java
{ "resource": "" }
q2960
MapPrinter.getOutputFormat
train
public final OutputFormat getOutputFormat(final PJsonObject specJson) { final String format = specJson.getString(MapPrinterServlet.JSON_OUTPUT_FORMAT); final boolean mapExport = this.configuration.getTemplate(specJson.getString(Constants.JSON_LAYOUT_KEY)).isMapExport(); final Str...
java
{ "resource": "" }
q2961
MapPrinter.print
train
public final Processor.ExecutionContext print( final String jobId, final PJsonObject specJson, final OutputStream out) throws Exception { final OutputFormat format = getOutputFormat(specJson); final File taskDirectory = this.workingDirectories.getTaskDirectory(); try { ...
java
{ "resource": "" }
q2962
MapPrinter.getOutputFormatsNames
train
public final Set<String> getOutputFormatsNames() { SortedSet<String> formats = new TreeSet<>(); for (String formatBeanName: this.outputFormat.keySet()) { int endingIndex = formatBeanName.indexOf(MAP_OUTPUT_FORMAT_BEAN_NAME_ENDING); if (endingIndex < 0) { endingInd...
java
{ "resource": "" }
q2963
MapBounds.getNearestScale
train
public Scale getNearestScale( final ZoomLevels zoomLevels, final double tolerance, final ZoomLevelSnapStrategy zoomLevelSnapStrategy, final boolean geodetic, final Rectangle paintArea, final double dpi) { final Scale scale = getScale(paint...
java
{ "resource": "" }
q2964
HibernateJobQueue.init
train
@PostConstruct public final void init() { this.cleanUpTimer = Executors.newScheduledThreadPool(1, timerTask -> { final Thread thread = new Thread(timerTask, "Clean up old job records"); thread.setDaemon(true); return thread; }); this.cleanUpTimer.scheduleA...
java
{ "resource": "" }
q2965
ParserUtils.getAllAttributes
train
public static Collection<Field> getAllAttributes(final Class<?> classToInspect) { Set<Field> allFields = new HashSet<>(); getAllAttributes(classToInspect, allFields, Function.identity(), field -> true); return allFields; }
java
{ "resource": "" }
q2966
ParserUtils.getAttributes
train
public static Collection<Field> getAttributes( final Class<?> classToInspect, final Predicate<Field> filter) { Set<Field> allFields = new HashSet<>(); getAllAttributes(classToInspect, allFields, Function.identity(), filter); return allFields; }
java
{ "resource": "" }
q2967
NorthArrowGraphic.createRaster
train
private static URI createRaster( final Dimension targetSize, final RasterReference rasterReference, final Double rotation, final Color backgroundColor, final File workingDir) throws IOException { final File path = File.createTempFile("north-arrow-", ".png", workingDir); ...
java
{ "resource": "" }
q2968
NorthArrowGraphic.createSvg
train
private static URI createSvg( final Dimension targetSize, final RasterReference rasterReference, final Double rotation, final Color backgroundColor, final File workingDir) throws IOException { // load SVG graphic final SVGElement svgRoot = parseSvg(rasterR...
java
{ "resource": "" }
q2969
NorthArrowGraphic.embedSvgGraphic
train
private static void embedSvgGraphic( final SVGElement svgRoot, final SVGElement newSvgRoot, final Document newDocument, final Dimension targetSize, final Double rotation) { final String originalWidth = svgRoot.getAttributeNS(null, "width"); final String originalHeight...
java
{ "resource": "" }
q2970
JasperReportBuilder.setDirectory
train
public void setDirectory(final String directory) { this.directory = new File(this.configuration.getDirectory(), directory); if (!this.directory.exists()) { throw new IllegalArgumentException(String.format( "Directory does not exist: %s.\n" + "C...
java
{ "resource": "" }
q2971
CreateMapPagesProcessor.setAttribute
train
public void setAttribute(final String name, final Attribute attribute) { if (name.equals(MAP_KEY)) { this.mapAttribute = (MapAttribute) attribute; } }
java
{ "resource": "" }
q2972
CreateMapPagesProcessor.getAttributes
train
public Map<String, Attribute> getAttributes() { Map<String, Attribute> result = new HashMap<>(); DataSourceAttribute datasourceAttribute = new DataSourceAttribute(); Map<String, Attribute> dsResult = new HashMap<>(); dsResult.put(MAP_KEY, this.mapAttribute); datasourceAttribute.s...
java
{ "resource": "" }
q2973
Template.printClientConfig
train
public final void printClientConfig(final JSONWriter json) throws JSONException { json.key("attributes"); json.array(); for (Map.Entry<String, Attribute> entry: this.attributes.entrySet()) { Attribute attribute = entry.getValue(); if (attribute.getClass().getAnnotation(In...
java
{ "resource": "" }
q2974
Template.setAttributes
train
public final void setAttributes(final Map<String, Attribute> attributes) { for (Map.Entry<String, Attribute> entry: attributes.entrySet()) { Object attribute = entry.getValue(); if (!(attribute instanceof Attribute)) { final String msg = "Attribute...
java
{ "resource": "" }
q2975
Template.getProcessorGraph
train
public final ProcessorDependencyGraph getProcessorGraph() { if (this.processorGraph == null) { synchronized (this) { if (this.processorGraph == null) { final Map<String, Class<?>> attcls = new HashMap<>(); for (Map.Entry<String, Attribute> attr...
java
{ "resource": "" }
q2976
Template.getStyle
train
@SuppressWarnings("unchecked") @Nonnull public final java.util.Optional<Style> getStyle(final String styleName) { final String styleRef = this.styles.get(styleName); Optional<Style> style; if (styleRef != null) { style = (Optional<Style>) this.styleParser ...
java
{ "resource": "" }
q2977
JvmMetricsConfigurator.init
train
@PostConstruct public void init() { this.metricRegistry.register(name("gc"), new GarbageCollectorMetricSet()); this.metricRegistry.register(name("memory"), new MemoryUsageGaugeSet()); this.metricRegistry.register(name("thread-states"), new ThreadStatesGaugeSet()); this.metricRegistry...
java
{ "resource": "" }
q2978
WmsLayerParam.postConstruct
train
public void postConstruct() throws URISyntaxException { WmsVersion.lookup(this.version); Assert.isTrue(validateBaseUrl(), "invalid baseURL"); Assert.isTrue(this.layers.length > 0, "There must be at least one layer defined for a WMS request" + " to make sense"); // OpenL...
java
{ "resource": "" }
q2979
TileCacheInformation.createBufferedImage
train
@Nonnull public BufferedImage createBufferedImage(final int imageWidth, final int imageHeight) { return new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_4BYTE_ABGR); }
java
{ "resource": "" }
q2980
PDFConfig.setKeywords
train
public void setKeywords(final List<String> keywords) { StringBuilder builder = new StringBuilder(); for (String keyword: keywords) { if (builder.length() > 0) { builder.append(','); } builder.append(keyword.trim()); } this.keywords = Op...
java
{ "resource": "" }
q2981
S3ReportStorage.getKey
train
protected String getKey(final String ref, final String filename, final String extension) { return prefix + ref + "/" + filename + "." + extension; }
java
{ "resource": "" }
q2982
TableProcessor.tryConvert
train
private Object tryConvert( final MfClientHttpRequestFactory clientHttpRequestFactory, final Object rowValue) throws URISyntaxException, IOException { if (this.converters.isEmpty()) { return rowValue; } String value = String.valueOf(rowValue); for (Tab...
java
{ "resource": "" }
q2983
PJsonObject.optInt
train
@Override public final Integer optInt(final String key) { final int result = this.obj.optInt(key, Integer.MIN_VALUE); return result == Integer.MIN_VALUE ? null : result; }
java
{ "resource": "" }
q2984
PJsonObject.optDouble
train
@Override public final Double optDouble(final String key) { double result = this.obj.optDouble(key, Double.NaN); if (Double.isNaN(result)) { return null; } return result; }
java
{ "resource": "" }
q2985
PJsonObject.optBool
train
@Override public final Boolean optBool(final String key) { if (this.obj.optString(key, null) == null) { return null; } else { return this.obj.optBoolean(key); } }
java
{ "resource": "" }
q2986
PJsonObject.optJSONObject
train
public final PJsonObject optJSONObject(final String key) { final JSONObject val = this.obj.optJSONObject(key); return val != null ? new PJsonObject(this, val, key) : null; }
java
{ "resource": "" }
q2987
PJsonObject.getJSONArray
train
public final PJsonArray getJSONArray(final String key) { final JSONArray val = this.obj.optJSONArray(key); if (val == null) { throw new ObjectMissingException(this, key); } return new PJsonArray(this, val, key); }
java
{ "resource": "" }
q2988
PJsonObject.optJSONArray
train
public final PJsonArray optJSONArray(final String key, final PJsonArray defaultValue) { PJsonArray result = optJSONArray(key); return result != null ? result : defaultValue; }
java
{ "resource": "" }
q2989
PJsonObject.has
train
@Override public final boolean has(final String key) { String result = this.obj.optString(key, null); return result != null; }
java
{ "resource": "" }
q2990
DataSourceProcessor.setAttributes
train
public void setAttributes(final Map<String, Attribute> attributes) { this.internalAttributes = attributes; this.allAttributes.putAll(attributes); }
java
{ "resource": "" }
q2991
DataSourceProcessor.setAttribute
train
public void setAttribute(final String name, final Attribute attribute) { if (name.equals("datasource")) { this.allAttributes.putAll(((DataSourceAttribute) attribute).getAttributes()); } else if (this.copyAttributes.contains(name)) { this.allAttributes.put(name, attribute); ...
java
{ "resource": "" }
q2992
SmtpConfig.getBody
train
@Nonnull public String getBody() { if (body == null) { return storage == null ? DEFAULT_BODY : DEFAULT_BODY_STORAGE; } else { return body; } }
java
{ "resource": "" }
q2993
TilePreparationTask.isTileVisible
train
private boolean isTileVisible(final ReferencedEnvelope tileBounds) { if (FloatingPointUtil.equals(this.transformer.getRotation(), 0.0)) { return true; } final GeometryFactory gfac = new GeometryFactory(); final Optional<Geometry> rotatedMapBounds = getRotatedMapBounds(gfac);...
java
{ "resource": "" }
q2994
MapfishJsonStyleVersion1.getStyleRules
train
private List<Rule> getStyleRules(final String styleProperty) { final List<Rule> styleRules = new ArrayList<>(this.json.size()); for (Iterator<String> iterator = this.json.keys(); iterator.hasNext(); ) { String styleKey = iterator.next(); if (styleKey.equals(JSON_STYLE_PROPERTY) ...
java
{ "resource": "" }
q2995
ForwardHeadersProcessor.setHeaders
train
public void setHeaders(final Set<String> names) { // transform to lower-case because header names should be case-insensitive Set<String> lowerCaseNames = new HashSet<>(); for (String name: names) { lowerCaseNames.add(name.toLowerCase()); } this.headerNames = lowerCase...
java
{ "resource": "" }
q2996
OsmLayerParam.convertToMultiMap
train
public static Multimap<String, String> convertToMultiMap(final PObject objectParams) { Multimap<String, String> params = HashMultimap.create(); if (objectParams != null) { Iterator<String> customParamsIter = objectParams.keys(); while (customParamsIter.hasNext()) { ...
java
{ "resource": "" }
q2997
OsmLayerParam.getMaxExtent
train
public Envelope getMaxExtent() { final int minX = 0; final int maxX = 1; final int minY = 2; final int maxY = 3; return new Envelope(this.maxExtent[minX], this.maxExtent[minY], this.maxExtent[maxX], this.maxExtent[maxY]); }
java
{ "resource": "" }
q2998
ServletMapPrinterFactory.setConfigurationFiles
train
public final void setConfigurationFiles(final Map<String, String> configurationFiles) throws URISyntaxException { this.configurationFiles.clear(); this.configurationFileLastModifiedTimes.clear(); for (Map.Entry<String, String> entry: configurationFiles.entrySet()) { if (!...
java
{ "resource": "" }
q2999
ZoomToFeatures.copy
train
public final ZoomToFeatures copy() { ZoomToFeatures obj = new ZoomToFeatures(); obj.zoomType = this.zoomType; obj.minScale = this.minScale; obj.minMargin = this.minMargin; return obj; }
java
{ "resource": "" }