_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q154400
HttpHeaders.getAsList
train
private <T> List<T> getAsList(T passedValue) { if (passedValue == null) { return null; } List<T> result = new ArrayList<T>(); result.add(passedValue); return result; }
java
{ "resource": "" }
q154401
HttpHeaders.getFirstHeaderStringValue
train
public String getFirstHeaderStringValue(String name) { Object value = get(name.toLowerCase(Locale.US)); if (value == null) { return null; } Class<? extends Object> valueClass = value.getClass(); if (value instanceof Iterable<?> || valueClass.isArray()) { for (Object repeatedValue : Types...
java
{ "resource": "" }
q154402
HttpHeaders.getHeaderStringValues
train
public List<String> getHeaderStringValues(String name) { Object value = get(name.toLowerCase(Locale.US)); if (value == null) { return Collections.emptyList(); } Class<? extends Object> valueClass = value.getClass(); if (value instanceof Iterable<?> || valueClass.isArray()) { List<String>...
java
{ "resource": "" }
q154403
HttpHeaders.parseHeader
train
void parseHeader(String headerName, String headerValue, ParseHeaderState state) { List<Type> context = state.context; ClassInfo classInfo = state.classInfo; ArrayValueMap arrayValueMap = state.arrayValueMap; StringBuilder logger = state.logger; if (logger != null) { logger.append(headerName +...
java
{ "resource": "" }
q154404
GenericUrl.buildAuthority
train
public final String buildAuthority() { // scheme, [user info], host, [port] StringBuilder buf = new StringBuilder(); buf.append(Preconditions.checkNotNull(scheme)); buf.append("://"); if (userInfo != null) { buf.append(CharEscapers.escapeUriUserInfo(userInfo)).append('@'); } buf.append...
java
{ "resource": "" }
q154405
GenericUrl.buildRelativeUrl
train
public final String buildRelativeUrl() { StringBuilder buf = new StringBuilder(); if (pathParts != null) { appendRawPathFromParts(buf); } addQueryParams(entrySet(), buf); // URL fragment String fragment = this.fragment; if (fragment != null) { buf.append('#').append(URI_FRAGMENT...
java
{ "resource": "" }
q154406
GenericUrl.getFirst
train
public Object getFirst(String name) { Object value = get(name); if (value instanceof Collection<?>) { @SuppressWarnings("unchecked") Collection<Object> collectionValue = (Collection<Object>) value; Iterator<Object> iterator = collectionValue.iterator(); return iterator.hasNext() ? iterat...
java
{ "resource": "" }
q154407
GenericUrl.getAll
train
public Collection<Object> getAll(String name) { Object value = get(name); if (value == null) { return Collections.emptySet(); } if (value instanceof Collection<?>) { @SuppressWarnings("unchecked") Collection<Object> collectionValue = (Collection<Object>) value; return Collections...
java
{ "resource": "" }
q154408
GenericUrl.toPathParts
train
public static List<String> toPathParts(String encodedPath) { if (encodedPath == null || encodedPath.length() == 0) { return null; } List<String> result = new ArrayList<String>(); int cur = 0; boolean notDone = true; while (notDone) { int slash = encodedPath.indexOf('/', cur); n...
java
{ "resource": "" }
q154409
GenericUrl.addQueryParams
train
static void addQueryParams(Set<Entry<String, Object>> entrySet, StringBuilder buf) { // (similar to UrlEncodedContent) boolean first = true; for (Map.Entry<String, Object> nameValueEntry : entrySet) { Object value = nameValueEntry.getValue(); if (value != null) { String name = CharEscape...
java
{ "resource": "" }
q154410
Xml.parseAttributeOrTextContent
train
private static void parseAttributeOrTextContent( String stringValue, Field field, Type valueType, List<Type> context, Object destination, GenericXml genericXml, Map<String, Object> destinationMap, String name) { if (field != null || genericXml != null || destinationMa...
java
{ "resource": "" }
q154411
Xml.setValue
train
private static void setValue( Object value, Field field, Object destination, GenericXml genericXml, Map<String, Object> destinationMap, String name) { if (field != null) { FieldInfo.setFieldValue(field, destination, value); } else if (genericXml != null) { generic...
java
{ "resource": "" }
q154412
Xml.parseElement
train
public static void parseElement( XmlPullParser parser, Object destination, XmlNamespaceDictionary namespaceDictionary, CustomizeParser customizeParser) throws IOException, XmlPullParserException { ArrayList<Type> context = new ArrayList<Type>(); if (destination != null) { con...
java
{ "resource": "" }
q154413
Xml.parseNamespacesForElement
train
private static void parseNamespacesForElement( XmlPullParser parser, XmlNamespaceDictionary namespaceDictionary) throws XmlPullParserException { int eventType = parser.getEventType(); Preconditions.checkState( eventType == XmlPullParser.START_TAG, "expected start of XML element, but ...
java
{ "resource": "" }
q154414
BetaDetector.getSuperclass
train
private JavaClass getSuperclass(JavaClass javaClass) { try { return javaClass.getSuperClass(); } catch (ClassNotFoundException e) { bugReporter.reportMissingClass(e); return null; } }
java
{ "resource": "" }
q154415
XmlNamespaceDictionary.set
train
public synchronized XmlNamespaceDictionary set(String alias, String uri) { String previousUri = null; String previousAlias = null; if (uri == null) { if (alias != null) { previousUri = namespaceAliasToUriMap.remove(alias); } } else if (alias == null) { previousAlias = namespace...
java
{ "resource": "" }
q154416
XmlNamespaceDictionary.getNamespaceUriForAliasHandlingUnknown
train
String getNamespaceUriForAliasHandlingUnknown(boolean errorOnUnknown, String alias) { String result = getUriForAlias(alias); if (result == null) { Preconditions.checkArgument( !errorOnUnknown, "unrecognized alias: %s", alias.length() == 0 ? "(default)" : alias); return "http://unknown/" + ...
java
{ "resource": "" }
q154417
XmlNamespaceDictionary.getNamespaceAliasForUriErrorOnUnknown
train
String getNamespaceAliasForUriErrorOnUnknown(String namespaceUri) { String result = getAliasForUri(namespaceUri); Preconditions.checkArgument( result != null, "invalid XML: no alias declared for namesapce <%s>; " + "work-around by setting XML namepace directly by calling the set meth...
java
{ "resource": "" }
q154418
JsonWebSignature.verifySignature
train
public final boolean verifySignature(PublicKey publicKey) throws GeneralSecurityException { Signature signatureAlg = null; String algorithm = getHeader().getAlgorithm(); if ("RS256".equals(algorithm)) { signatureAlg = SecurityUtils.getSha256WithRsaSignatureAlgorithm(); } else { return false;...
java
{ "resource": "" }
q154419
DateTime.appendInt
train
private static void appendInt(StringBuilder sb, int num, int numDigits) { if (num < 0) { sb.append('-'); num = -num; } int x = num; while (x > 0) { x /= 10; numDigits--; } for (int i = 0; i < numDigits; i++) { sb.append('0'); } if (num != 0) { sb.appen...
java
{ "resource": "" }
q154420
PemReader.readNextSection
train
public Section readNextSection(String titleToLookFor) throws IOException { String title = null; StringBuilder keyBuilder = null; while (true) { String line = reader.readLine(); if (line == null) { Preconditions.checkArgument(title == null, "missing end tag (%s)", title); return n...
java
{ "resource": "" }
q154421
PemReader.readFirstSectionAndClose
train
public static Section readFirstSectionAndClose(Reader reader, String titleToLookFor) throws IOException { PemReader pemReader = new PemReader(reader); try { return pemReader.readNextSection(titleToLookFor); } finally { pemReader.close(); } }
java
{ "resource": "" }
q154422
FieldInfo.of
train
public static FieldInfo of(Enum<?> enumValue) { try { FieldInfo result = FieldInfo.of(enumValue.getClass().getField(enumValue.name())); Preconditions.checkArgument( result != null, "enum constant missing @Value or @NullValue annotation: %s", enumValue); return result; } catch (NoSuch...
java
{ "resource": "" }
q154423
FieldInfo.of
train
public static FieldInfo of(Field field) { if (field == null) { return null; } synchronized (CACHE) { FieldInfo fieldInfo = CACHE.get(field); boolean isEnumContant = field.isEnumConstant(); if (fieldInfo == null && (isEnumContant || !Modifier.isStatic(field.getModifiers()))) { ...
java
{ "resource": "" }
q154424
FieldInfo.settersMethodForField
train
private Method[] settersMethodForField(Field field) { List<Method> methods = new ArrayList<>(); for (Method method : field.getDeclaringClass().getDeclaredMethods()) { if (Ascii.toLowerCase(method.getName()).equals("set" + Ascii.toLowerCase(field.getName())) && method.getParameterTypes().length =...
java
{ "resource": "" }
q154425
FieldInfo.setValue
train
public void setValue(Object obj, Object value) { if (setters.length > 0) { for (Method method : setters) { if (value == null || method.getParameterTypes()[0].isAssignableFrom(value.getClass())) { try { method.invoke(obj, value); return; } catch (IllegalAcces...
java
{ "resource": "" }
q154426
FieldInfo.getFieldValue
train
public static Object getFieldValue(Field field, Object obj) { try { return field.get(obj); } catch (IllegalAccessException e) { throw new IllegalArgumentException(e); } }
java
{ "resource": "" }
q154427
FieldInfo.setFieldValue
train
public static void setFieldValue(Field field, Object obj, Object value) { if (Modifier.isFinal(field.getModifiers())) { Object finalValue = getFieldValue(field, obj); if (value == null ? finalValue != null : !value.equals(finalValue)) { throw new IllegalArgumentException( "expected f...
java
{ "resource": "" }
q154428
FileDataStoreFactory.setPermissionsToOwnerOnly
train
static void setPermissionsToOwnerOnly(File file) throws IOException { // Disable access by other users if O/S allows it and set file permissions to readable and // writable by user. Use reflection since JDK 1.5 will not have these methods try { Method setReadable = File.class.getMethod("setReadable", ...
java
{ "resource": "" }
q154429
Data.isNull
train
public static boolean isNull(Object object) { // don't call nullOf because will throw IllegalArgumentException if cannot create instance return object != null && object == NULL_CACHE.get(object.getClass()); }
java
{ "resource": "" }
q154430
Data.mapOf
train
public static Map<String, Object> mapOf(Object data) { if (data == null || isNull(data)) { return Collections.emptyMap(); } if (data instanceof Map<?, ?>) { @SuppressWarnings("unchecked") Map<String, Object> result = (Map<String, Object>) data; return result; } Map<String, Ob...
java
{ "resource": "" }
q154431
Data.parsePrimitiveValue
train
public static Object parsePrimitiveValue(Type type, String stringValue) { Class<?> primitiveClass = type instanceof Class<?> ? (Class<?>) type : null; if (type == null || primitiveClass != null) { if (primitiveClass == Void.class) { return null; } if (stringValue == null || p...
java
{ "resource": "" }
q154432
Data.newCollectionInstance
train
public static Collection<Object> newCollectionInstance(Type type) { if (type instanceof WildcardType) { type = Types.getBound((WildcardType) type); } if (type instanceof ParameterizedType) { type = ((ParameterizedType) type).getRawType(); } Class<?> collectionClass = type instanceof Clas...
java
{ "resource": "" }
q154433
Data.newMapInstance
train
public static Map<String, Object> newMapInstance(Class<?> mapClass) { if (mapClass == null || mapClass.isAssignableFrom(ArrayMap.class)) { return ArrayMap.create(); } if (mapClass.isAssignableFrom(TreeMap.class)) { return new TreeMap<String, Object>(); } @SuppressWarnings("unchecked") ...
java
{ "resource": "" }
q154434
OpenCensusUtils.propagateTracingContext
train
public static void propagateTracingContext(Span span, HttpHeaders headers) { Preconditions.checkArgument(span != null, "span should not be null."); Preconditions.checkArgument(headers != null, "headers should not be null."); if (propagationTextFormat != null && propagationTextFormatSetter != null) { i...
java
{ "resource": "" }
q154435
HttpRequestFactory.buildRequest
train
public HttpRequest buildRequest(String requestMethod, GenericUrl url, HttpContent content) throws IOException { HttpRequest request = transport.buildRequest(); if (initializer != null) { initializer.initialize(request); } request.setRequestMethod(requestMethod); if (url != null) { ...
java
{ "resource": "" }
q154436
HttpResponse.getContent
train
public InputStream getContent() throws IOException { if (!contentRead) { InputStream lowLevelResponseContent = this.response.getContent(); if (lowLevelResponseContent != null) { // Flag used to indicate if an exception is thrown before the content is successfully // processed. bo...
java
{ "resource": "" }
q154437
HttpResponse.download
train
public void download(OutputStream outputStream) throws IOException { InputStream inputStream = getContent(); IOUtils.copy(inputStream, outputStream); }
java
{ "resource": "" }
q154438
SecurityUtils.loadKeyStore
train
public static void loadKeyStore(KeyStore keyStore, InputStream keyStream, String storePass) throws IOException, GeneralSecurityException { try { keyStore.load(keyStream, storePass.toCharArray()); } finally { keyStream.close(); } }
java
{ "resource": "" }
q154439
SecurityUtils.getPrivateKey
train
public static PrivateKey getPrivateKey(KeyStore keyStore, String alias, String keyPass) throws GeneralSecurityException { return (PrivateKey) keyStore.getKey(alias, keyPass.toCharArray()); }
java
{ "resource": "" }
q154440
SecurityUtils.loadPrivateKeyFromKeyStore
train
public static PrivateKey loadPrivateKeyFromKeyStore( KeyStore keyStore, InputStream keyStream, String storePass, String alias, String keyPass) throws IOException, GeneralSecurityException { loadKeyStore(keyStore, keyStream, storePass); return getPrivateKey(keyStore, alias, keyPass); }
java
{ "resource": "" }
q154441
SecurityUtils.sign
train
public static byte[] sign( Signature signatureAlgorithm, PrivateKey privateKey, byte[] contentBytes) throws InvalidKeyException, SignatureException { signatureAlgorithm.initSign(privateKey); signatureAlgorithm.update(contentBytes); return signatureAlgorithm.sign(); }
java
{ "resource": "" }
q154442
SecurityUtils.verify
train
public static boolean verify( Signature signatureAlgorithm, PublicKey publicKey, byte[] signatureBytes, byte[] contentBytes) throws InvalidKeyException, SignatureException { signatureAlgorithm.initVerify(publicKey); signatureAlgorithm.update(contentBytes); // SignatureException may be thrown if ...
java
{ "resource": "" }
q154443
SecurityUtils.verify
train
public static X509Certificate verify( Signature signatureAlgorithm, X509TrustManager trustManager, List<String> certChainBase64, byte[] signatureBytes, byte[] contentBytes) throws InvalidKeyException, SignatureException { CertificateFactory certificateFactory; try { cer...
java
{ "resource": "" }
q154444
StringUtils.getBytesUtf8
train
public static byte[] getBytesUtf8(String string) { if (string == null) { return null; } return string.getBytes(StandardCharsets.UTF_8); }
java
{ "resource": "" }
q154445
IOUtils.copy
train
public static void copy(InputStream inputStream, OutputStream outputStream) throws IOException { copy(inputStream, outputStream, true); }
java
{ "resource": "" }
q154446
IOUtils.copy
train
public static void copy( InputStream inputStream, OutputStream outputStream, boolean closeInputStream) throws IOException { try { ByteStreams.copy(inputStream, outputStream); } finally { if (closeInputStream) { inputStream.close(); } } }
java
{ "resource": "" }
q154447
IOUtils.serialize
train
public static byte[] serialize(Object value) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream(); serialize(value, out); return out.toByteArray(); }
java
{ "resource": "" }
q154448
IOUtils.serialize
train
public static void serialize(Object value, OutputStream outputStream) throws IOException { try { new ObjectOutputStream(outputStream).writeObject(value); } finally { outputStream.close(); } }
java
{ "resource": "" }
q154449
IOUtils.deserialize
train
public static <S extends Serializable> S deserialize(byte[] bytes) throws IOException { if (bytes == null) { return null; } return deserialize(new ByteArrayInputStream(bytes)); }
java
{ "resource": "" }
q154450
IOUtils.deserialize
train
@SuppressWarnings("unchecked") public static <S extends Serializable> S deserialize(InputStream inputStream) throws IOException { try { return (S) new ObjectInputStream(inputStream).readObject(); } catch (ClassNotFoundException exception) { IOException ioe = new IOException("Failed to deserialize ...
java
{ "resource": "" }
q154451
ArrayMap.set
train
public final V set(int index, V value) { int size = this.size; if (index < 0 || index >= size) { throw new IndexOutOfBoundsException(); } int valueDataIndex = 1 + (index << 1); V result = valueAtDataIndex(valueDataIndex); this.data[valueDataIndex] = value; return result; }
java
{ "resource": "" }
q154452
ArrayMap.put
train
@Override public final V put(K key, V value) { int index = getIndexOfKey(key); if (index == -1) { index = this.size; } return set(index, key, value); }
java
{ "resource": "" }
q154453
ArrayMap.ensureCapacity
train
public final void ensureCapacity(int minCapacity) { if (minCapacity < 0) { throw new IndexOutOfBoundsException(); } Object[] data = this.data; int minDataCapacity = minCapacity << 1; int oldDataCapacity = data == null ? 0 : data.length; if (minDataCapacity > oldDataCapacity) { int ne...
java
{ "resource": "" }
q154454
ClassInfo.of
train
public static ClassInfo of(Class<?> underlyingClass, boolean ignoreCase) { if (underlyingClass == null) { return null; } final Map<Class<?>, ClassInfo> cache = ignoreCase ? CACHE_IGNORE_CASE : CACHE; ClassInfo classInfo; synchronized (cache) { classInfo = cache.get(underlyingClass); ...
java
{ "resource": "" }
q154455
TagGroup.submitTag
train
public void submitTag() { final TagView inputTag = getInputTag(); if (inputTag != null && inputTag.isInputAvailable()) { inputTag.endInput(); if (mOnTagChangeListener != null) { mOnTagChangeListener.onAppend(TagGroup.this, inputTag.getText().toString()); ...
java
{ "resource": "" }
q154456
TagGroup.getInputTag
train
protected TagView getInputTag() { if (isAppendMode) { final int inputTagIndex = getChildCount() - 1; final TagView inputTag = getTagAt(inputTagIndex); if (inputTag != null && inputTag.mState == TagView.STATE_INPUT) { return inputTag; } else { ...
java
{ "resource": "" }
q154457
TagGroup.getInputTagText
train
public String getInputTagText() { final TagView inputTagView = getInputTag(); if (inputTagView != null) { return inputTagView.getText().toString(); } return null; }
java
{ "resource": "" }
q154458
TagGroup.getLastNormalTagView
train
protected TagView getLastNormalTagView() { final int lastNormalTagIndex = isAppendMode ? getChildCount() - 2 : getChildCount() - 1; TagView lastNormalTagView = getTagAt(lastNormalTagIndex); return lastNormalTagView; }
java
{ "resource": "" }
q154459
TagGroup.getTags
train
public String[] getTags() { final int count = getChildCount(); final List<String> tagList = new ArrayList<>(); for (int i = 0; i < count; i++) { final TagView tagView = getTagAt(i); if (tagView.mState == TagView.STATE_NORMAL) { tagList.add(tagView.getText(...
java
{ "resource": "" }
q154460
TagGroup.setTags
train
public void setTags(String... tags) { removeAllViews(); for (final String tag : tags) { appendTag(tag); } if (isAppendMode) { appendInputTag(); } }
java
{ "resource": "" }
q154461
TagGroup.getCheckedTagIndex
train
protected int getCheckedTagIndex() { final int count = getChildCount(); for (int i = 0; i < count; i++) { final TagView tag = getTagAt(i); if (tag.isChecked) { return i; } } return -1; }
java
{ "resource": "" }
q154462
TagGroup.appendInputTag
train
protected void appendInputTag(String tag) { final TagView previousInputTag = getInputTag(); if (previousInputTag != null) { throw new IllegalStateException("Already has a INPUT tag in group."); } final TagView newInputTag = new TagView(getContext(), TagView.STATE_INPUT, tag)...
java
{ "resource": "" }
q154463
TagGroup.appendTag
train
protected void appendTag(CharSequence tag) { final TagView newTag = new TagView(getContext(), TagView.STATE_NORMAL, tag); newTag.setOnClickListener(mInternalTagClickListener); addView(newTag); }
java
{ "resource": "" }
q154464
Configuration.getEmbeddingDirectory
train
public File getEmbeddingDirectory() { return new File(getReportDirectory().getAbsolutePath(), ReportBuilder.BASE_DIRECTORY + File.separatorChar + Configuration.EMBEDDINGS_DIRECTORY); }
java
{ "resource": "" }
q154465
Configuration.setTagsToExcludeFromChart
train
public void setTagsToExcludeFromChart(String... patterns) { for (String pattern : patterns) { try { tagsToExcludeFromChart.add(Pattern.compile(pattern)); } catch (PatternSyntaxException e) { throw new ValidationException(e); } } }
java
{ "resource": "" }
q154466
StatusCounter.incrementFor
train
public void incrementFor(Status status) { final int statusCounter = getValueFor(status) + 1; this.counter.put(status, statusCounter); size++; if (finalStatus == Status.PASSED && status != Status.PASSED) { finalStatus = Status.FAILED; } }
java
{ "resource": "" }
q154467
Feature.setMetaData
train
public void setMetaData(int jsonFileNo, Configuration configuration) { for (Element element : elements) { element.setMetaData(this); if (element.isScenario()) { scenarios.add(element); } } reportFileName = calculateReportFileName(jsonFileNo);...
java
{ "resource": "" }
q154468
Trends.addBuild
train
public void addBuild(String buildNumber, Reportable reportable) { buildNumbers = (String[]) ArrayUtils.add(buildNumbers, buildNumber); passedFeatures = ArrayUtils.add(passedFeatures, reportable.getPassedFeatures()); failedFeatures = ArrayUtils.add(failedFeatures, reportable.getFailedFeatures()...
java
{ "resource": "" }
q154469
Trends.limitItems
train
public void limitItems(int limit) { buildNumbers = copyLastElements(buildNumbers, limit); passedFeatures = copyLastElements(passedFeatures, limit); failedFeatures = copyLastElements(failedFeatures, limit); totalFeatures = copyLastElements(totalFeatures, limit); passedScenarios ...
java
{ "resource": "" }
q154470
Trends.fillMissingSteps
train
private void fillMissingSteps() { // correct only pending and undefined steps passedFeatures = fillMissingArray(passedFeatures); passedScenarios = fillMissingArray(passedScenarios); passedSteps = fillMissingArray(passedSteps); skippedSteps = fillMissingArray(skippedSteps); ...
java
{ "resource": "" }
q154471
Trends.fillMissingDurations
train
private void fillMissingDurations() { long[] extendedArray = new long[buildNumbers.length]; Arrays.fill(extendedArray, -1); System.arraycopy(durations, 0, extendedArray, buildNumbers.length - durations.length, durations.length); durations = extendedArray; }
java
{ "resource": "" }
q154472
ReportParser.parseJsonFiles
train
public List<Feature> parseJsonFiles(List<String> jsonFiles) { if (jsonFiles.isEmpty()) { throw new ValidationException("None report file was added!"); } List<Feature> featureResults = new ArrayList<>(); for (int i = 0; i < jsonFiles.size(); i++) { String jsonFile...
java
{ "resource": "" }
q154473
ReportParser.parseForFeature
train
private Feature[] parseForFeature(String jsonFile) { try (Reader reader = new InputStreamReader(new FileInputStream(jsonFile), StandardCharsets.UTF_8)) { Feature[] features = mapper.readValue(reader, Feature[].class); if (ArrayUtils.isEmpty(features)) { LOG.log(Level.INFO...
java
{ "resource": "" }
q154474
ReportParser.parseClassificationsFiles
train
public void parseClassificationsFiles(List<String> propertiesFiles) { if (isNotEmpty(propertiesFiles)) { for (String propertyFile : propertiesFiles) { if (StringUtils.isNotEmpty(propertyFile)) { processClassificationFile(propertyFile); } ...
java
{ "resource": "" }
q154475
Util.formatAsPercentage
train
public static String formatAsPercentage(int value, int total) { // value '1F' is to force floating conversion instead of loosing decimal part float average = total == 0 ? 0 : 1F * value / total; return PERCENT_FORMATTER.format(average); }
java
{ "resource": "" }
q154476
Util.toValidFileName
train
public static String toValidFileName(String fileName) { // adds MAX_VALUE to eliminate minus character which might be returned by hashCode() return Long.toString((long) fileName.hashCode() + Integer.MAX_VALUE); }
java
{ "resource": "" }
q154477
ReportBuilder.generateReports
train
public Reportable generateReports() { Trends trends = null; try { // first copy static resources so ErrorPage is displayed properly copyStaticResources(); // create directory for embeddings before files are generated createEmbeddingsDirectory(); ...
java
{ "resource": "" }
q154478
Bufferer.buffer
train
Geometry buffer(Geometry geometry, double distance, SpatialReference sr, double densify_dist, int max_vertex_in_complete_circle, ProgressTracker progress_tracker) { if (geometry == null) throw new IllegalArgumentException(); if (densify_dist < 0) throw new IllegalArgumentException(); if (geometry.is...
java
{ "resource": "" }
q154479
SimpleRasterizer.setup
train
public void setup(int width, int height, ScanCallback callback) { width_ = width; height_ = height; ySortedEdges_ = null; activeEdgesTable_ = null; numEdges_ = 0; callback_ = callback; if (scanBuffer_ == null) scanBuffer_ = new int[128 * 3]; startAddingEdges(); }
java
{ "resource": "" }
q154480
SimpleRasterizer.addTriangle
train
public final void addTriangle(double x1, double y1, double x2, double y2, double x3, double y3) { addEdge(x1, y1, x2, y2); addEdge(x2, y2, x3, y3); addEdge(x1, y1, x3, y3); }
java
{ "resource": "" }
q154481
SimpleRasterizer.addRing
train
public final void addRing(double xy[]) { for (int i = 2; i < xy.length; i += 2) { addEdge(xy[i-2], xy[i - 1], xy[i], xy[i + 1]); } }
java
{ "resource": "" }
q154482
SimpleRasterizer.startAddingEdges
train
public final void startAddingEdges() { if (numEdges_ > 0) { for (int i = 0; i < height_; i++) { for (Edge e = ySortedEdges_[i]; e != null;) { Edge p = e; e = e.next; p.next = null; } ySortedEdges_[i] = null; } activeEdgesTable_ = null; } minY_ = height_; maxY_ = -1; ...
java
{ "resource": "" }
q154483
SimpleRasterizer.addEdge
train
public final void addEdge(double x1, double y1, double x2, double y2) { if (y1 == y2) return; int dir = 1; if (y1 > y2) { double temp; temp = x1; x1 = x2; x2 = temp; temp = y1; y1 = y2; y2 = temp; dir = -1; } if (y2 < 0 || y1 >= height_) return; if (x1 < 0 && x2 < 0) { x1 = -1...
java
{ "resource": "" }
q154484
Line.intersectionWithEnvelope2D
train
int intersectionWithEnvelope2D(Envelope2D clipEnv2D, boolean includeEnvBoundary, double[] segParams, double[] envelopeDistances) { Point2D p1 = getStartXY(); Point2D p2 = getEndXY(); // includeEnvBoundary xxx ??? int modified = clipEnv2D.clipLine(p1, p2, 0, segParams, envelopeDistances); return mo...
java
{ "resource": "" }
q154485
Line._side
train
int _side(double ptX, double ptY) { Point2D v1 = new Point2D(ptX, ptY); v1.sub(getStartXY()); Point2D v2 = new Point2D(); v2.sub(getEndXY(), getStartXY()); double cross = v2.crossProduct(v1); double crossError = 4 * NumberUtils.doubleEps() * (Math.abs(v2.x * v1.y) + Math.abs(v2.y * v1.x)); return cros...
java
{ "resource": "" }
q154486
Line._isIntersectingHelper
train
static boolean _isIntersectingHelper(Line line1, Line line2) { int s11 = line1._side(line2.m_xStart, line2.m_yStart); int s12 = line1._side(line2.m_xEnd, line2.m_yEnd); if (s11 < 0 && s12 < 0 || s11 > 0 && s12 > 0) return false;// no intersection. The line2 lies to one side of an // infinite line passin...
java
{ "resource": "" }
q154487
GeometryEngine.geometryToJson
train
public static String geometryToJson(int wkid, Geometry geometry) { return GeometryEngine.geometryToJson( wkid > 0 ? SpatialReference.create(wkid) : null, geometry); }
java
{ "resource": "" }
q154488
GeometryEngine.geometryToJson
train
public static String geometryToJson(SpatialReference spatialReference, Geometry geometry) { OperatorExportToJson exporter = (OperatorExportToJson) factory .getOperator(Operator.Type.ExportToJson); return exporter.execute(spatialReference, geometry); }
java
{ "resource": "" }
q154489
GeometryEngine.geometryFromEsriShape
train
public static Geometry geometryFromEsriShape(byte[] esriShapeBuffer, Geometry.Type geometryType) { OperatorImportFromESRIShape op = (OperatorImportFromESRIShape) factory .getOperator(Operator.Type.ImportFromESRIShape); return op .execute( ShapeImportFlags.ShapeImportNonTrusted, geometryType, ...
java
{ "resource": "" }
q154490
GeometryEngine.geometryToEsriShape
train
public static byte[] geometryToEsriShape(Geometry geometry) { if (geometry == null) throw new IllegalArgumentException(); OperatorExportToESRIShape op = (OperatorExportToESRIShape) factory .getOperator(Operator.Type.ExportToESRIShape); return op.execute(0, geometry).array(); }
java
{ "resource": "" }
q154491
GeometryEngine.geometryFromWkt
train
public static Geometry geometryFromWkt(String wkt, int importFlags, Geometry.Type geometryType) { OperatorImportFromWkt op = (OperatorImportFromWkt) factory .getOperator(Operator.Type.ImportFromWkt); return op.execute(importFlags, geometryType, wkt, null); }
java
{ "resource": "" }
q154492
GeometryEngine.geometryToWkt
train
public static String geometryToWkt(Geometry geometry, int exportFlags) { OperatorExportToWkt op = (OperatorExportToWkt) factory .getOperator(Operator.Type.ExportToWkt); return op.execute(exportFlags, geometry, null); }
java
{ "resource": "" }
q154493
GeometryEngine.union
train
public static Geometry union(Geometry[] geometries, SpatialReference spatialReference) { OperatorUnion op = (OperatorUnion) factory .getOperator(Operator.Type.Union); SimpleGeometryCursor inputGeometries = new SimpleGeometryCursor( geometries); GeometryCursor result = op.execute(inputGeometries, spati...
java
{ "resource": "" }
q154494
GeometryEngine.difference
train
public static Geometry difference(Geometry geometry1, Geometry substractor, SpatialReference spatialReference) { OperatorDifference op = (OperatorDifference) factory .getOperator(Operator.Type.Difference); Geometry result = op.execute(geometry1, substractor, spatialReference, null); return result; }
java
{ "resource": "" }
q154495
GeometryEngine.symmetricDifference
train
public static Geometry symmetricDifference(Geometry leftGeometry, Geometry rightGeometry, SpatialReference spatialReference) { OperatorSymmetricDifference op = (OperatorSymmetricDifference) factory .getOperator(Operator.Type.SymmetricDifference); Geometry result = op.execute(leftGeometry, rightGeometry, ...
java
{ "resource": "" }
q154496
GeometryEngine.disjoint
train
public static boolean disjoint(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference) { OperatorDisjoint op = (OperatorDisjoint) factory .getOperator(Operator.Type.Disjoint); boolean result = op.execute(geometry1, geometry2, spatialReference, null); return result; }
java
{ "resource": "" }
q154497
GeometryEngine.intersect
train
static Geometry[] intersect(Geometry[] inputGeometries, Geometry geometry, SpatialReference spatialReference) { OperatorIntersection op = (OperatorIntersection) factory .getOperator(Operator.Type.Intersection); SimpleGeometryCursor inputGeometriesCursor = new SimpleGeometryCursor( inputGeometries); Sim...
java
{ "resource": "" }
q154498
GeometryEngine.intersect
train
public static Geometry intersect(Geometry geometry1, Geometry intersector, SpatialReference spatialReference) { OperatorIntersection op = (OperatorIntersection) factory .getOperator(Operator.Type.Intersection); Geometry result = op.execute(geometry1, intersector, spatialReference, null); return result;...
java
{ "resource": "" }
q154499
GeometryEngine.within
train
public static boolean within(Geometry geometry1, Geometry geometry2, SpatialReference spatialReference) { OperatorWithin op = (OperatorWithin) factory .getOperator(Operator.Type.Within); boolean result = op.execute(geometry1, geometry2, spatialReference, null); return result; }
java
{ "resource": "" }