repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java
HtmlButtonRendererBase.findNestingForm
protected FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext) { return RendererUtils.findNestingForm(uiComponent, facesContext); }
java
protected FormInfo findNestingForm(UIComponent uiComponent, FacesContext facesContext) { return RendererUtils.findNestingForm(uiComponent, facesContext); }
[ "protected", "FormInfo", "findNestingForm", "(", "UIComponent", "uiComponent", ",", "FacesContext", "facesContext", ")", "{", "return", "RendererUtils", ".", "findNestingForm", "(", "uiComponent", ",", "facesContext", ")", ";", "}" ]
find nesting form<br /> need to be overrideable to deal with dummyForm stuff in tomahawk.
[ "find", "nesting", "form<br", "/", ">", "need", "to", "be", "overrideable", "to", "deal", "with", "dummyForm", "stuff", "in", "tomahawk", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/renderkit/html/HtmlButtonRendererBase.java#L644-L647
Wikidata/Wikidata-Toolkit
wdtk-storage/src/main/java/org/wikidata/wdtk/storage/datastructures/CountBitsArray.java
CountBitsArray.countBits
public long countBits(boolean bit, long position) { updateCount(); int blockNumber = (int) (position / this.blockSize); long mark = ((long) blockNumber) * this.blockSize; long trueValues = 0; if (blockNumber > 0) { trueValues = this.countArray[blockNumber - 1]; } for (long index = mark; index <= position; index++) { trueValues += this.bitVector.getBit(index) ? 1 : 0; } return bit ? trueValues : ((position + 1) - trueValues); }
java
public long countBits(boolean bit, long position) { updateCount(); int blockNumber = (int) (position / this.blockSize); long mark = ((long) blockNumber) * this.blockSize; long trueValues = 0; if (blockNumber > 0) { trueValues = this.countArray[blockNumber - 1]; } for (long index = mark; index <= position; index++) { trueValues += this.bitVector.getBit(index) ? 1 : 0; } return bit ? trueValues : ((position + 1) - trueValues); }
[ "public", "long", "countBits", "(", "boolean", "bit", ",", "long", "position", ")", "{", "updateCount", "(", ")", ";", "int", "blockNumber", "=", "(", "int", ")", "(", "position", "/", "this", ".", "blockSize", ")", ";", "long", "mark", "=", "(", "("...
Returns the number of occurrences of <i>bit</i> up to <i>position</i>. @return number of occurrences of <i>bit</i> up to <i>position</i>
[ "Returns", "the", "number", "of", "occurrences", "of", "<i", ">", "bit<", "/", "i", ">", "up", "to", "<i", ">", "position<", "/", "i", ">", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-storage/src/main/java/org/wikidata/wdtk/storage/datastructures/CountBitsArray.java#L98-L110
hawkular/hawkular-apm
client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java
FragmentBuilder.nodeMatches
protected boolean nodeMatches(Node node, Class<? extends Node> cls, String uri) { if (node.getClass() == cls) { return uri == null || NodeUtil.isOriginalURI(node, uri); } return false; }
java
protected boolean nodeMatches(Node node, Class<? extends Node> cls, String uri) { if (node.getClass() == cls) { return uri == null || NodeUtil.isOriginalURI(node, uri); } return false; }
[ "protected", "boolean", "nodeMatches", "(", "Node", "node", ",", "Class", "<", "?", "extends", "Node", ">", "cls", ",", "String", "uri", ")", "{", "if", "(", "node", ".", "getClass", "(", ")", "==", "cls", ")", "{", "return", "uri", "==", "null", "...
This method determines whether the supplied node matches the specified class and optional URI. @param node The node @param cls The class @param uri The optional URI @return Whether the node is of the correct type and matches the optional URI
[ "This", "method", "determines", "whether", "the", "supplied", "node", "matches", "the", "specified", "class", "and", "optional", "URI", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/collector/src/main/java/org/hawkular/apm/client/collector/internal/FragmentBuilder.java#L348-L354
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java
AttributedString.getIterator
public AttributedCharacterIterator getIterator(Attribute[] attributes, int beginIndex, int endIndex) { return new AttributedStringIterator(attributes, beginIndex, endIndex); }
java
public AttributedCharacterIterator getIterator(Attribute[] attributes, int beginIndex, int endIndex) { return new AttributedStringIterator(attributes, beginIndex, endIndex); }
[ "public", "AttributedCharacterIterator", "getIterator", "(", "Attribute", "[", "]", "attributes", ",", "int", "beginIndex", ",", "int", "endIndex", ")", "{", "return", "new", "AttributedStringIterator", "(", "attributes", ",", "beginIndex", ",", "endIndex", ")", "...
Creates an AttributedCharacterIterator instance that provides access to selected contents of this string. Information about attributes not listed in attributes that the implementor may have need not be made accessible through the iterator. If the list is null, all available attribute information should be made accessible. @param attributes a list of attributes that the client is interested in @param beginIndex the index of the first character @param endIndex the index of the character following the last character @return an iterator providing access to the text and its attributes @exception IllegalArgumentException if beginIndex is less then 0, endIndex is greater than the length of the string, or beginIndex is greater than endIndex.
[ "Creates", "an", "AttributedCharacterIterator", "instance", "that", "provides", "access", "to", "selected", "contents", "of", "this", "string", ".", "Information", "about", "attributes", "not", "listed", "in", "attributes", "that", "the", "implementor", "may", "have...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/AttributedString.java#L582-L584
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/query/resultspartitioner/ResultsPartitionsFactory.java
ResultsPartitionsFactory.get
public static ArrayList<ResultsPartition> get(CaptureSearchResults results, WaybackRequest wbRequest) { return get(results, wbRequest, null); }
java
public static ArrayList<ResultsPartition> get(CaptureSearchResults results, WaybackRequest wbRequest) { return get(results, wbRequest, null); }
[ "public", "static", "ArrayList", "<", "ResultsPartition", ">", "get", "(", "CaptureSearchResults", "results", ",", "WaybackRequest", "wbRequest", ")", "{", "return", "get", "(", "results", ",", "wbRequest", ",", "null", ")", ";", "}" ]
Determine the correct ResultsPartitioner to use given the SearchResults search range, and use that to break the SearchResults into partitions. @param results @param wbRequest @return ArrayList of ResultsPartition objects
[ "Determine", "the", "correct", "ResultsPartitioner", "to", "use", "given", "the", "SearchResults", "search", "range", "and", "use", "that", "to", "break", "the", "SearchResults", "into", "partitions", "." ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/query/resultspartitioner/ResultsPartitionsFactory.java#L54-L57
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.updateSecretAsync
public Observable<SecretBundle> updateSecretAsync(String vaultBaseUrl, String secretName, String secretVersion, String contentType, SecretAttributes secretAttributes, Map<String, String> tags) { return updateSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion, contentType, secretAttributes, tags).map(new Func1<ServiceResponse<SecretBundle>, SecretBundle>() { @Override public SecretBundle call(ServiceResponse<SecretBundle> response) { return response.body(); } }); }
java
public Observable<SecretBundle> updateSecretAsync(String vaultBaseUrl, String secretName, String secretVersion, String contentType, SecretAttributes secretAttributes, Map<String, String> tags) { return updateSecretWithServiceResponseAsync(vaultBaseUrl, secretName, secretVersion, contentType, secretAttributes, tags).map(new Func1<ServiceResponse<SecretBundle>, SecretBundle>() { @Override public SecretBundle call(ServiceResponse<SecretBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SecretBundle", ">", "updateSecretAsync", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ",", "String", "secretVersion", ",", "String", "contentType", ",", "SecretAttributes", "secretAttributes", ",", "Map", "<", "String", "...
Updates the attributes associated with a specified secret in a given key vault. The UPDATE operation changes specified attributes of an existing stored secret. Attributes that are not specified in the request are left unchanged. The value of a secret itself cannot be changed. This operation requires the secrets/set permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @param secretVersion The version of the secret. @param contentType Type of the secret value such as a password. @param secretAttributes The secret management attributes. @param tags Application specific metadata in the form of key-value pairs. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SecretBundle object
[ "Updates", "the", "attributes", "associated", "with", "a", "specified", "secret", "in", "a", "given", "key", "vault", ".", "The", "UPDATE", "operation", "changes", "specified", "attributes", "of", "an", "existing", "stored", "secret", ".", "Attributes", "that", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3753-L3760
jamesdbloom/mockserver
mockserver-core/src/main/java/org/mockserver/model/HttpResponse.java
HttpResponse.withCookie
public HttpResponse withCookie(String name, String value) { this.cookies.withEntry(name, value); return this; }
java
public HttpResponse withCookie(String name, String value) { this.cookies.withEntry(name, value); return this; }
[ "public", "HttpResponse", "withCookie", "(", "String", "name", ",", "String", "value", ")", "{", "this", ".", "cookies", ".", "withEntry", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Add cookie to return as Set-Cookie header @param name the cookies name @param value the cookies value
[ "Add", "cookie", "to", "return", "as", "Set", "-", "Cookie", "header" ]
train
https://github.com/jamesdbloom/mockserver/blob/8b84fdd877e57b4eb780c9f8c8b1d65bcb448025/mockserver-core/src/main/java/org/mockserver/model/HttpResponse.java#L351-L354
jeremiehuchet/nominatim-java-api
src/main/java/fr/dudie/nominatim/client/request/QueryParameterAnnotationHandler.java
QueryParameterAnnotationHandler.getValue
private static Object getValue(final Object o, final Field f) { try { f.setAccessible(true); return f.get(o); } catch (final IllegalArgumentException e) { LOGGER.error("failure accessing field value {}", new Object[] { f.getName(), e }); } catch (final IllegalAccessException e) { LOGGER.error("failure accessing field value {}", new Object[] { f.getName(), e }); } return null; }
java
private static Object getValue(final Object o, final Field f) { try { f.setAccessible(true); return f.get(o); } catch (final IllegalArgumentException e) { LOGGER.error("failure accessing field value {}", new Object[] { f.getName(), e }); } catch (final IllegalAccessException e) { LOGGER.error("failure accessing field value {}", new Object[] { f.getName(), e }); } return null; }
[ "private", "static", "Object", "getValue", "(", "final", "Object", "o", ",", "final", "Field", "f", ")", "{", "try", "{", "f", ".", "setAccessible", "(", "true", ")", ";", "return", "f", ".", "get", "(", "o", ")", ";", "}", "catch", "(", "final", ...
Gets a field value regardless of reflection errors. @param o the object instance @param f the field @return the field value or null if a reflection error occurred
[ "Gets", "a", "field", "value", "regardless", "of", "reflection", "errors", "." ]
train
https://github.com/jeremiehuchet/nominatim-java-api/blob/faf3ff1003a9989eb5cc48f449b3a22c567843bf/src/main/java/fr/dudie/nominatim/client/request/QueryParameterAnnotationHandler.java#L149-L159
gturri/aXMLRPC
src/main/java/de/timroes/axmlrpc/XMLRPCClient.java
XMLRPCClient.setCustomHttpHeader
public void setCustomHttpHeader(String headerName, String headerValue) { if(CONTENT_TYPE.equals(headerName) || HOST.equals(headerName) || CONTENT_LENGTH.equals(headerName)) { throw new XMLRPCRuntimeException("You cannot modify the Host, Content-Type or Content-Length header."); } httpParameters.put(headerName, headerValue); }
java
public void setCustomHttpHeader(String headerName, String headerValue) { if(CONTENT_TYPE.equals(headerName) || HOST.equals(headerName) || CONTENT_LENGTH.equals(headerName)) { throw new XMLRPCRuntimeException("You cannot modify the Host, Content-Type or Content-Length header."); } httpParameters.put(headerName, headerValue); }
[ "public", "void", "setCustomHttpHeader", "(", "String", "headerName", ",", "String", "headerValue", ")", "{", "if", "(", "CONTENT_TYPE", ".", "equals", "(", "headerName", ")", "||", "HOST", ".", "equals", "(", "headerName", ")", "||", "CONTENT_LENGTH", ".", ...
Set a HTTP header field to a custom value. You cannot modify the Host or Content-Type field that way. If the field already exists, the old value is overwritten. @param headerName The name of the header field. @param headerValue The new value of the header field.
[ "Set", "a", "HTTP", "header", "field", "to", "a", "custom", "value", ".", "You", "cannot", "modify", "the", "Host", "or", "Content", "-", "Type", "field", "that", "way", ".", "If", "the", "field", "already", "exists", "the", "old", "value", "is", "over...
train
https://github.com/gturri/aXMLRPC/blob/8ca6f95f7eb3a28efaef3569d53adddeb32b6bda/src/main/java/de/timroes/axmlrpc/XMLRPCClient.java#L344-L350
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/MarkerManager.java
MarkerManager.getMarker
@Deprecated public static Marker getMarker(final String name, final Marker parent) { return getMarker(name).addParents(parent); }
java
@Deprecated public static Marker getMarker(final String name, final Marker parent) { return getMarker(name).addParents(parent); }
[ "@", "Deprecated", "public", "static", "Marker", "getMarker", "(", "final", "String", "name", ",", "final", "Marker", "parent", ")", "{", "return", "getMarker", "(", "name", ")", ".", "addParents", "(", "parent", ")", ";", "}" ]
Retrieves or creates a Marker with the specified parent. @param name The name of the Marker. @param parent The parent Marker. @return The Marker with the specified name. @throws IllegalArgumentException if any argument is {@code null} @deprecated Use the Marker add or set methods to add parent Markers. Will be removed by final GA release.
[ "Retrieves", "or", "creates", "a", "Marker", "with", "the", "specified", "parent", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/MarkerManager.java#L98-L101
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.pressText
public static void pressText(Image srcImage, ImageOutputStream destImageStream, String pressText, Color color, Font font, int x, int y, float alpha) throws IORuntimeException { writeJpg(pressText(srcImage, pressText, color, font, x, y, alpha), destImageStream); }
java
public static void pressText(Image srcImage, ImageOutputStream destImageStream, String pressText, Color color, Font font, int x, int y, float alpha) throws IORuntimeException { writeJpg(pressText(srcImage, pressText, color, font, x, y, alpha), destImageStream); }
[ "public", "static", "void", "pressText", "(", "Image", "srcImage", ",", "ImageOutputStream", "destImageStream", ",", "String", "pressText", ",", "Color", "color", ",", "Font", "font", ",", "int", "x", ",", "int", "y", ",", "float", "alpha", ")", "throws", ...
给图片添加文字水印<br> 此方法并不关闭流 @param srcImage 源图像 @param destImageStream 目标图像流 @param pressText 水印文字 @param color 水印的字体颜色 @param font {@link Font} 字体相关信息,如果默认则为{@code null} @param x 修正值。 默认在中间,偏移量相对于中间偏移 @param y 修正值。 默认在中间,偏移量相对于中间偏移 @param alpha 透明度:alpha 必须是范围 [0.0, 1.0] 之内(包含边界值)的一个浮点数字 @throws IORuntimeException IO异常
[ "给图片添加文字水印<br", ">", "此方法并不关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L844-L846
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.intersectCircleCircle
public static boolean intersectCircleCircle(float aX, float aY, float radiusSquaredA, float bX, float bY, float radiusSquaredB, Vector3f intersectionCenterAndHL) { float dX = bX - aX, dY = bY - aY; float distSquared = dX * dX + dY * dY; float h = 0.5f + (radiusSquaredA - radiusSquaredB) / distSquared; float r_i = (float) Math.sqrt(radiusSquaredA - h * h * distSquared); if (r_i >= 0.0f) { intersectionCenterAndHL.x = aX + h * dX; intersectionCenterAndHL.y = aY + h * dY; intersectionCenterAndHL.z = r_i; return true; } return false; }
java
public static boolean intersectCircleCircle(float aX, float aY, float radiusSquaredA, float bX, float bY, float radiusSquaredB, Vector3f intersectionCenterAndHL) { float dX = bX - aX, dY = bY - aY; float distSquared = dX * dX + dY * dY; float h = 0.5f + (radiusSquaredA - radiusSquaredB) / distSquared; float r_i = (float) Math.sqrt(radiusSquaredA - h * h * distSquared); if (r_i >= 0.0f) { intersectionCenterAndHL.x = aX + h * dX; intersectionCenterAndHL.y = aY + h * dY; intersectionCenterAndHL.z = r_i; return true; } return false; }
[ "public", "static", "boolean", "intersectCircleCircle", "(", "float", "aX", ",", "float", "aY", ",", "float", "radiusSquaredA", ",", "float", "bX", ",", "float", "bY", ",", "float", "radiusSquaredB", ",", "Vector3f", "intersectionCenterAndHL", ")", "{", "float",...
Test whether the one circle with center <code>(aX, aY)</code> and square radius <code>radiusSquaredA</code> intersects the other circle with center <code>(bX, bY)</code> and square radius <code>radiusSquaredB</code>, and store the center of the line segment of intersection in the <code>(x, y)</code> components of the supplied vector and the half-length of that line segment in the z component. <p> This method returns <code>false</code> when one circle contains the other circle. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a> @param aX the x coordinate of the first circle's center @param aY the y coordinate of the first circle's center @param radiusSquaredA the square of the first circle's radius @param bX the x coordinate of the second circle's center @param bY the y coordinate of the second circle's center @param radiusSquaredB the square of the second circle's radius @param intersectionCenterAndHL will hold the center of the circle of intersection in the <code>(x, y, z)</code> components and the radius in the w component @return <code>true</code> iff both circles intersect; <code>false</code> otherwise
[ "Test", "whether", "the", "one", "circle", "with", "center", "<code", ">", "(", "aX", "aY", ")", "<", "/", "code", ">", "and", "square", "radius", "<code", ">", "radiusSquaredA<", "/", "code", ">", "intersects", "the", "other", "circle", "with", "center"...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L3721-L3733
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/preview/CmsImagePreviewHandler.java
CmsImagePreviewHandler.getPreviewScaleParam
public String getPreviewScaleParam(int imageHeight, int imageWidth) { int maxHeight = m_previewDialog.getPreviewHeight() - 4; int maxWidth = m_previewDialog.getDialogWidth() - 10; if (m_croppingParam != null) { return m_croppingParam.getRestrictedSizeScaleParam(maxHeight, maxWidth); } if ((imageHeight <= maxHeight) && (imageWidth <= maxWidth)) { return ""; // dummy parameter, doesn't actually do anything } CmsCroppingParamBean restricted = new CmsCroppingParamBean(); restricted.setTargetHeight(imageHeight > maxHeight ? maxHeight : imageHeight); restricted.setTargetWidth(imageWidth > maxWidth ? maxWidth : imageWidth); return restricted.toString(); }
java
public String getPreviewScaleParam(int imageHeight, int imageWidth) { int maxHeight = m_previewDialog.getPreviewHeight() - 4; int maxWidth = m_previewDialog.getDialogWidth() - 10; if (m_croppingParam != null) { return m_croppingParam.getRestrictedSizeScaleParam(maxHeight, maxWidth); } if ((imageHeight <= maxHeight) && (imageWidth <= maxWidth)) { return ""; // dummy parameter, doesn't actually do anything } CmsCroppingParamBean restricted = new CmsCroppingParamBean(); restricted.setTargetHeight(imageHeight > maxHeight ? maxHeight : imageHeight); restricted.setTargetWidth(imageWidth > maxWidth ? maxWidth : imageWidth); return restricted.toString(); }
[ "public", "String", "getPreviewScaleParam", "(", "int", "imageHeight", ",", "int", "imageWidth", ")", "{", "int", "maxHeight", "=", "m_previewDialog", ".", "getPreviewHeight", "(", ")", "-", "4", ";", "int", "maxWidth", "=", "m_previewDialog", ".", "getDialogWid...
Returns the cropping parameter.<p> @param imageHeight the original image height @param imageWidth the original image width @return the cropping parameter
[ "Returns", "the", "cropping", "parameter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/preview/CmsImagePreviewHandler.java#L240-L254
yavijava/yavijava
src/main/java/com/vmware/vim25/mo/IoFilterManager.java
IoFilterManager.queryIoFilterIssues
public IoFilterQueryIssueResult queryIoFilterIssues(String filterId, ComputeResource compRes) throws RemoteException, RuntimeFault { return getVimService().queryIoFilterIssues(getMOR(), filterId, compRes.getMOR()); }
java
public IoFilterQueryIssueResult queryIoFilterIssues(String filterId, ComputeResource compRes) throws RemoteException, RuntimeFault { return getVimService().queryIoFilterIssues(getMOR(), filterId, compRes.getMOR()); }
[ "public", "IoFilterQueryIssueResult", "queryIoFilterIssues", "(", "String", "filterId", ",", "ComputeResource", "compRes", ")", "throws", "RemoteException", ",", "RuntimeFault", "{", "return", "getVimService", "(", ")", ".", "queryIoFilterIssues", "(", "getMOR", "(", ...
Return the issues that occured during the last installation/uninstallation/upgrade operation of an IO Filter on a compute resource @param filterId - ID of the filter. @param compRes - The compute resource. "compRes" must be a cluster. @return IoFilterQueryIssueResult - Result for QueryIoFilterIssues. Filters that are installed on the compute resource. @throws RemoteException @throws RuntimeFault - Thrown if any type of runtime fault is thrown that is not covered by the other faults; for example, a communication error.
[ "Return", "the", "issues", "that", "occured", "during", "the", "last", "installation", "/", "uninstallation", "/", "upgrade", "operation", "of", "an", "IO", "Filter", "on", "a", "compute", "resource" ]
train
https://github.com/yavijava/yavijava/blob/27fd2c5826115782d5eeb934f86e3e39240179cd/src/main/java/com/vmware/vim25/mo/IoFilterManager.java#L124-L127
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Snappy.java
Snappy.validateChecksum
static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int length) { final int actualChecksum = calculateChecksum(data, offset, length); if (actualChecksum != expectedChecksum) { throw new DecompressionException( "mismatching checksum: " + Integer.toHexString(actualChecksum) + " (expected: " + Integer.toHexString(expectedChecksum) + ')'); } }
java
static void validateChecksum(int expectedChecksum, ByteBuf data, int offset, int length) { final int actualChecksum = calculateChecksum(data, offset, length); if (actualChecksum != expectedChecksum) { throw new DecompressionException( "mismatching checksum: " + Integer.toHexString(actualChecksum) + " (expected: " + Integer.toHexString(expectedChecksum) + ')'); } }
[ "static", "void", "validateChecksum", "(", "int", "expectedChecksum", ",", "ByteBuf", "data", ",", "int", "offset", ",", "int", "length", ")", "{", "final", "int", "actualChecksum", "=", "calculateChecksum", "(", "data", ",", "offset", ",", "length", ")", ";...
Computes the CRC32C checksum of the supplied data, performs the "mask" operation on the computed checksum, and then compares the resulting masked checksum to the supplied checksum. @param expectedChecksum The checksum decoded from the stream to compare against @param data The input data to calculate the CRC32C checksum of @throws DecompressionException If the calculated and supplied checksums do not match
[ "Computes", "the", "CRC32C", "checksum", "of", "the", "supplied", "data", "performs", "the", "mask", "operation", "on", "the", "computed", "checksum", "and", "then", "compares", "the", "resulting", "masked", "checksum", "to", "the", "supplied", "checksum", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Snappy.java#L638-L645
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java
EscapedFunctions2.sqllcase
public static void sqllcase(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { singleArgumentFunctionCall(buf, "lower(", "lcase", parsedArgs); }
java
public static void sqllcase(StringBuilder buf, List<? extends CharSequence> parsedArgs) throws SQLException { singleArgumentFunctionCall(buf, "lower(", "lcase", parsedArgs); }
[ "public", "static", "void", "sqllcase", "(", "StringBuilder", "buf", ",", "List", "<", "?", "extends", "CharSequence", ">", "parsedArgs", ")", "throws", "SQLException", "{", "singleArgumentFunctionCall", "(", "buf", ",", "\"lower(\"", ",", "\"lcase\"", ",", "par...
lcase to lower translation @param buf The buffer to append into @param parsedArgs arguments @throws SQLException if something wrong happens
[ "lcase", "to", "lower", "translation" ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions2.java#L183-L185
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/buffer/Buffer.java
Buffer.assignToNew
void assignToNew(String fileName, PageFormatter fmtr) { internalLock.writeLock().lock(); try { flush(); fmtr.format(this); blk = contents.append(fileName); pins = 0; isNew = true; lastLsn = LogSeqNum.DEFAULT_VALUE; } finally { internalLock.writeLock().unlock(); } }
java
void assignToNew(String fileName, PageFormatter fmtr) { internalLock.writeLock().lock(); try { flush(); fmtr.format(this); blk = contents.append(fileName); pins = 0; isNew = true; lastLsn = LogSeqNum.DEFAULT_VALUE; } finally { internalLock.writeLock().unlock(); } }
[ "void", "assignToNew", "(", "String", "fileName", ",", "PageFormatter", "fmtr", ")", "{", "internalLock", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", "flush", "(", ")", ";", "fmtr", ".", "format", "(", "this", ")", ";", "blk",...
Initializes the buffer's page according to the specified formatter, and appends the page to the specified file. If the buffer was dirty, then the contents of the previous page are first written to disk. @param filename the name of the file @param fmtr a page formatter, used to initialize the page
[ "Initializes", "the", "buffer", "s", "page", "according", "to", "the", "specified", "formatter", "and", "appends", "the", "page", "to", "the", "specified", "file", ".", "If", "the", "buffer", "was", "dirty", "then", "the", "contents", "of", "the", "previous"...
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/buffer/Buffer.java#L309-L321
fcrepo3/fcrepo
fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/utility/validate/remote/RemoteObjectSource.java
RemoteObjectSource.getContentModelInfo
@Override public ContentModelInfo getContentModelInfo(String pid) throws ObjectSourceException, InvalidContentModelException { try { ObjectInfo object = getValidationObject(pid); if (object == null) { return null; } DatastreamInfo dsInfo = object.getDatastreamInfo(DS_COMPOSITE_MODEL); if (dsInfo == null) { throw new InvalidContentModelException(pid, "Content model has no '" + DS_COMPOSITE_MODEL + "' datastream."); } if (!DS_COMPOSITE_MODEL_FORMAT.equals(dsInfo.getFormatUri())) { throw new InvalidContentModelException(pid, "Datastream '" + DS_COMPOSITE_MODEL + "' has incorrect format URI: '" + dsInfo.getFormatUri() + "'."); } MIMETypedStream ds = apia.getDatastreamDissemination(pid, DS_COMPOSITE_MODEL, null); DsCompositeModelDoc model = new DsCompositeModelDoc(pid, org.fcrepo.server.utilities.TypeUtility .convertDataHandlerToBytes(ds .getStream())); return new BasicContentModelInfo(object, model.getTypeModels()); } catch (Exception e) { throw new ObjectSourceException("Problem fetching '" + DS_COMPOSITE_MODEL + "' datastream for pid='" + pid + "'", e); } }
java
@Override public ContentModelInfo getContentModelInfo(String pid) throws ObjectSourceException, InvalidContentModelException { try { ObjectInfo object = getValidationObject(pid); if (object == null) { return null; } DatastreamInfo dsInfo = object.getDatastreamInfo(DS_COMPOSITE_MODEL); if (dsInfo == null) { throw new InvalidContentModelException(pid, "Content model has no '" + DS_COMPOSITE_MODEL + "' datastream."); } if (!DS_COMPOSITE_MODEL_FORMAT.equals(dsInfo.getFormatUri())) { throw new InvalidContentModelException(pid, "Datastream '" + DS_COMPOSITE_MODEL + "' has incorrect format URI: '" + dsInfo.getFormatUri() + "'."); } MIMETypedStream ds = apia.getDatastreamDissemination(pid, DS_COMPOSITE_MODEL, null); DsCompositeModelDoc model = new DsCompositeModelDoc(pid, org.fcrepo.server.utilities.TypeUtility .convertDataHandlerToBytes(ds .getStream())); return new BasicContentModelInfo(object, model.getTypeModels()); } catch (Exception e) { throw new ObjectSourceException("Problem fetching '" + DS_COMPOSITE_MODEL + "' datastream for pid='" + pid + "'", e); } }
[ "@", "Override", "public", "ContentModelInfo", "getContentModelInfo", "(", "String", "pid", ")", "throws", "ObjectSourceException", ",", "InvalidContentModelException", "{", "try", "{", "ObjectInfo", "object", "=", "getValidationObject", "(", "pid", ")", ";", "if", ...
A content model must exist as an object. If must have a (@link DS_COMPOSITE_MODEL} datastream.
[ "A", "content", "model", "must", "exist", "as", "an", "object", ".", "If", "must", "have", "a", "(" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-client/fcrepo-client-admin/src/main/java/org/fcrepo/client/utility/validate/remote/RemoteObjectSource.java#L108-L149
alkacon/opencms-core
src/org/opencms/db/CmsSelectQuery.java
CmsSelectQuery.setOrdering
public void setOrdering(String ordering) { if (ordering != null) { m_ordering = new CmsSimpleQueryFragment(ordering, Collections.<Object> emptyList()); } else { m_ordering = null; } }
java
public void setOrdering(String ordering) { if (ordering != null) { m_ordering = new CmsSimpleQueryFragment(ordering, Collections.<Object> emptyList()); } else { m_ordering = null; } }
[ "public", "void", "setOrdering", "(", "String", "ordering", ")", "{", "if", "(", "ordering", "!=", "null", ")", "{", "m_ordering", "=", "new", "CmsSimpleQueryFragment", "(", "ordering", ",", "Collections", ".", "<", "Object", ">", "emptyList", "(", ")", ")...
Sets the SQL used for the ORDER BY clause.<p> @param ordering the SQL used for the ORDER BY clause
[ "Sets", "the", "SQL", "used", "for", "the", "ORDER", "BY", "clause", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSelectQuery.java#L208-L215
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java
Http2ConnectionHandler.onConnectionError
protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound, Throwable cause, Http2Exception http2Ex) { if (http2Ex == null) { http2Ex = new Http2Exception(INTERNAL_ERROR, cause.getMessage(), cause); } ChannelPromise promise = ctx.newPromise(); ChannelFuture future = goAway(ctx, http2Ex, ctx.newPromise()); if (http2Ex.shutdownHint() == Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN) { doGracefulShutdown(ctx, future, promise); } else { future.addListener(new ClosingChannelFutureListener(ctx, promise)); } }
java
protected void onConnectionError(ChannelHandlerContext ctx, boolean outbound, Throwable cause, Http2Exception http2Ex) { if (http2Ex == null) { http2Ex = new Http2Exception(INTERNAL_ERROR, cause.getMessage(), cause); } ChannelPromise promise = ctx.newPromise(); ChannelFuture future = goAway(ctx, http2Ex, ctx.newPromise()); if (http2Ex.shutdownHint() == Http2Exception.ShutdownHint.GRACEFUL_SHUTDOWN) { doGracefulShutdown(ctx, future, promise); } else { future.addListener(new ClosingChannelFutureListener(ctx, promise)); } }
[ "protected", "void", "onConnectionError", "(", "ChannelHandlerContext", "ctx", ",", "boolean", "outbound", ",", "Throwable", "cause", ",", "Http2Exception", "http2Ex", ")", "{", "if", "(", "http2Ex", "==", "null", ")", "{", "http2Ex", "=", "new", "Http2Exception...
Handler for a connection error. Sends a GO_AWAY frame to the remote endpoint. Once all streams are closed, the connection is shut down. @param ctx the channel context @param outbound {@code true} if the error was caused by an outbound operation. @param cause the exception that was caught @param http2Ex the {@link Http2Exception} that is embedded in the causality chain. This may be {@code null} if it's an unknown exception.
[ "Handler", "for", "a", "connection", "error", ".", "Sends", "a", "GO_AWAY", "frame", "to", "the", "remote", "endpoint", ".", "Once", "all", "streams", "are", "closed", "the", "connection", "is", "shut", "down", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ConnectionHandler.java#L657-L670
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java
GeometryUtilities.getPointPositionAgainstLine
public static int getPointPositionAgainstLine( Coordinate point, Coordinate lineStart, Coordinate lineEnd ) { double value = (lineEnd.x - lineStart.x) * (point.y - lineStart.y) - (point.x - lineStart.x) * (lineEnd.y - lineStart.y); if (value > 0) { return 1; } else if (value < 0) { return -1; } else { return 0; } }
java
public static int getPointPositionAgainstLine( Coordinate point, Coordinate lineStart, Coordinate lineEnd ) { double value = (lineEnd.x - lineStart.x) * (point.y - lineStart.y) - (point.x - lineStart.x) * (lineEnd.y - lineStart.y); if (value > 0) { return 1; } else if (value < 0) { return -1; } else { return 0; } }
[ "public", "static", "int", "getPointPositionAgainstLine", "(", "Coordinate", "point", ",", "Coordinate", "lineStart", ",", "Coordinate", "lineEnd", ")", "{", "double", "value", "=", "(", "lineEnd", ".", "x", "-", "lineStart", ".", "x", ")", "*", "(", "point"...
Get the position of a point (left, right, on line) for a given line. @param point the point to check. @param lineStart the start coordinate of the line. @param lineEnd the end coordinate of the line. @return 1 if the point is left of the line, -1 if it is right, 0 if it is on the line.
[ "Get", "the", "position", "of", "a", "point", "(", "left", "right", "on", "line", ")", "for", "a", "given", "line", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L944-L953
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java
OdsElements.flushTables
public void flushTables(final XMLUtil util, final ZipUTF8Writer writer) throws IOException { this.contentElement.flushTables(util, writer); }
java
public void flushTables(final XMLUtil util, final ZipUTF8Writer writer) throws IOException { this.contentElement.flushTables(util, writer); }
[ "public", "void", "flushTables", "(", "final", "XMLUtil", "util", ",", "final", "ZipUTF8Writer", "writer", ")", "throws", "IOException", "{", "this", ".", "contentElement", ".", "flushTables", "(", "util", ",", "writer", ")", ";", "}" ]
Flush the tables @param util the util @param writer the stream to write @throws IOException when write fails
[ "Flush", "the", "tables" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/OdsElements.java#L280-L282
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/support/Characters.java
Characters.of
public static Characters of(String chars) { return StringUtils.isEmpty(chars) ? Characters.NONE : new Characters(false, chars.toCharArray()); }
java
public static Characters of(String chars) { return StringUtils.isEmpty(chars) ? Characters.NONE : new Characters(false, chars.toCharArray()); }
[ "public", "static", "Characters", "of", "(", "String", "chars", ")", "{", "return", "StringUtils", ".", "isEmpty", "(", "chars", ")", "?", "Characters", ".", "NONE", ":", "new", "Characters", "(", "false", ",", "chars", ".", "toCharArray", "(", ")", ")",...
Creates a new Characters instance containing only the given chars. @param chars the chars @return a new Characters object
[ "Creates", "a", "new", "Characters", "instance", "containing", "only", "the", "given", "chars", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/Characters.java#L257-L259
litsec/swedish-eid-shibboleth-base
shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/service/impl/AuthnContextServiceImpl.java
AuthnContextServiceImpl.addAuthnContextClassContext
protected void addAuthnContextClassContext(ProfileRequestContext<?, ?> context, AuthnContextClassContext authnContextClassContext) throws ExternalAutenticationErrorCodeException { AuthenticationContext authnContext = authenticationContextLookupStrategy.apply(context); if (authnContext == null) { log.error("No AuthenticationContext available [{}]", this.getLogString(context)); throw new ExternalAutenticationErrorCodeException(AuthnEventIds.INVALID_AUTHN_CTX, "Missing AuthenticationContext"); } authnContext.addSubcontext(authnContextClassContext, true); }
java
protected void addAuthnContextClassContext(ProfileRequestContext<?, ?> context, AuthnContextClassContext authnContextClassContext) throws ExternalAutenticationErrorCodeException { AuthenticationContext authnContext = authenticationContextLookupStrategy.apply(context); if (authnContext == null) { log.error("No AuthenticationContext available [{}]", this.getLogString(context)); throw new ExternalAutenticationErrorCodeException(AuthnEventIds.INVALID_AUTHN_CTX, "Missing AuthenticationContext"); } authnContext.addSubcontext(authnContextClassContext, true); }
[ "protected", "void", "addAuthnContextClassContext", "(", "ProfileRequestContext", "<", "?", ",", "?", ">", "context", ",", "AuthnContextClassContext", "authnContextClassContext", ")", "throws", "ExternalAutenticationErrorCodeException", "{", "AuthenticationContext", "authnConte...
Adds the supplied {@code AuthnContextClassContext} to the request context @param context the request context @param authnContextClassContext the context to add @throws ExternalAutenticationErrorCodeException if no context exists
[ "Adds", "the", "supplied", "{", "@code", "AuthnContextClassContext", "}", "to", "the", "request", "context" ]
train
https://github.com/litsec/swedish-eid-shibboleth-base/blob/aaaa467ff61f07d7dfa31627fb36851a37da6804/shibboleth-base/shibboleth-extensions/src/main/java/se/litsec/shibboleth/idp/authn/service/impl/AuthnContextServiceImpl.java#L136-L144
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/SegmentKeyCache.java
SegmentKeyCache.get
CacheBucketOffset get(UUID keyHash, int generation) { CacheEntry entry; synchronized (this) { // First, check the tail cache. CacheBucketOffset tailOffset = this.tailOffsets.get(keyHash); if (tailOffset != null) { return tailOffset; } entry = this.cacheEntries.get(getHashGroup(keyHash)); } // Check the Cache Entry. if (entry != null) { Long r = entry.get(keyHash, generation); if (r != null) { return CacheBucketOffset.decode(r); } } return null; }
java
CacheBucketOffset get(UUID keyHash, int generation) { CacheEntry entry; synchronized (this) { // First, check the tail cache. CacheBucketOffset tailOffset = this.tailOffsets.get(keyHash); if (tailOffset != null) { return tailOffset; } entry = this.cacheEntries.get(getHashGroup(keyHash)); } // Check the Cache Entry. if (entry != null) { Long r = entry.get(keyHash, generation); if (r != null) { return CacheBucketOffset.decode(r); } } return null; }
[ "CacheBucketOffset", "get", "(", "UUID", "keyHash", ",", "int", "generation", ")", "{", "CacheEntry", "entry", ";", "synchronized", "(", "this", ")", "{", "// First, check the tail cache.", "CacheBucketOffset", "tailOffset", "=", "this", ".", "tailOffsets", ".", "...
Looks up a cached offset for the given Key Hash. @param keyHash A UUID representing the Key Hash to look up. @return A {@link CacheBucketOffset} representing the sought result.
[ "Looks", "up", "a", "cached", "offset", "for", "the", "given", "Key", "Hash", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/SegmentKeyCache.java#L211-L232
beanshell/beanshell
src/main/java/bsh/BshArray.java
BshArray.setIndex
@SuppressWarnings("unchecked") public static void setIndex(Object array, int index, Object val) throws ReflectError, UtilTargetError { try { val = Primitive.unwrap(val); if ( array instanceof List ) ((List<Object>) array).set(index, val); else Array.set(array, index, val); } catch( IllegalArgumentException e1 ) { // fabricated array store exception throw new UtilTargetError( new ArrayStoreException( e1.getMessage() ) ); } catch( IndexOutOfBoundsException e1 ) { int len = array instanceof List ? ((List<?>) array).size() : Array.getLength(array); throw new UtilTargetError("Index " + index + " out-of-bounds for length " + len, e1); } }
java
@SuppressWarnings("unchecked") public static void setIndex(Object array, int index, Object val) throws ReflectError, UtilTargetError { try { val = Primitive.unwrap(val); if ( array instanceof List ) ((List<Object>) array).set(index, val); else Array.set(array, index, val); } catch( IllegalArgumentException e1 ) { // fabricated array store exception throw new UtilTargetError( new ArrayStoreException( e1.getMessage() ) ); } catch( IndexOutOfBoundsException e1 ) { int len = array instanceof List ? ((List<?>) array).size() : Array.getLength(array); throw new UtilTargetError("Index " + index + " out-of-bounds for length " + len, e1); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "void", "setIndex", "(", "Object", "array", ",", "int", "index", ",", "Object", "val", ")", "throws", "ReflectError", ",", "UtilTargetError", "{", "try", "{", "val", "=", "Primitive", "....
Set element value of array or list at index. Array.set for array or List.set for list. @param array to set value for. @param index of the element to set @param val the value to set @throws UtilTargetError wrapped target exceptions
[ "Set", "element", "value", "of", "array", "or", "list", "at", "index", ".", "Array", ".", "set", "for", "array", "or", "List", ".", "set", "for", "list", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/BshArray.java#L58-L79
jamesagnew/hapi-fhir
hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/validation/InstanceValidator.java
InstanceValidator.start
private void start(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, StructureDefinition profile, NodeStack stack) throws FHIRException { // profile is valid, and matches the resource name if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), profile.hasSnapshot(), "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) { validateElement(errors, profile, profile.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); checkDeclaredProfiles(errors, resource, element, stack); // specific known special validations if (element.getResourceType().equals("Bundle")) validateBundle(errors, element, stack); if (element.getResourceType().equals("Observation")) validateObservation(errors, element, stack); } }
java
private void start(List<ValidationMessage> errors, WrapperElement resource, WrapperElement element, StructureDefinition profile, NodeStack stack) throws FHIRException { // profile is valid, and matches the resource name if (rule(errors, IssueType.STRUCTURE, element.line(), element.col(), stack.getLiteralPath(), profile.hasSnapshot(), "StructureDefinition has no snapshot - validation is against the snapshot, so it must be provided")) { validateElement(errors, profile, profile.getSnapshot().getElement().get(0), null, null, resource, element, element.getName(), stack, false); checkDeclaredProfiles(errors, resource, element, stack); // specific known special validations if (element.getResourceType().equals("Bundle")) validateBundle(errors, element, stack); if (element.getResourceType().equals("Observation")) validateObservation(errors, element, stack); } }
[ "private", "void", "start", "(", "List", "<", "ValidationMessage", ">", "errors", ",", "WrapperElement", "resource", ",", "WrapperElement", "element", ",", "StructureDefinition", "profile", ",", "NodeStack", "stack", ")", "throws", "FHIRException", "{", "// profile ...
the instance validator had no issues against the base resource profile
[ "the", "instance", "validator", "had", "no", "issues", "against", "the", "base", "resource", "profile" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/validation/InstanceValidator.java#L1251-L1265
jenkinsci/jenkins
core/src/main/java/hudson/security/ACL.java
ACL.hasPermission
public final boolean hasPermission(@Nonnull Permission p) { Authentication a = Jenkins.getAuthentication(); if (a == SYSTEM) { return true; } return hasPermission(a, p); }
java
public final boolean hasPermission(@Nonnull Permission p) { Authentication a = Jenkins.getAuthentication(); if (a == SYSTEM) { return true; } return hasPermission(a, p); }
[ "public", "final", "boolean", "hasPermission", "(", "@", "Nonnull", "Permission", "p", ")", "{", "Authentication", "a", "=", "Jenkins", ".", "getAuthentication", "(", ")", ";", "if", "(", "a", "==", "SYSTEM", ")", "{", "return", "true", ";", "}", "return...
Checks if the current security principal has this permission. @return false if the user doesn't have the permission.
[ "Checks", "if", "the", "current", "security", "principal", "has", "this", "permission", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/security/ACL.java#L82-L88
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java
CommsUtils.getRuntimeDoubleProperty
public static double getRuntimeDoubleProperty(String property, String defaultValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRuntimeDoubleProperty", new Object[] {property, defaultValue}); // Note that we parse the default value outside of the try / catch so that if we muck // up then we blow up. Customer settable properties however, we do not want to blow if they // screw up. double runtimeProp = Double.parseDouble(defaultValue); try { runtimeProp = Double.parseDouble(RuntimeInfo.getPropertyWithMsg(property, defaultValue)); } catch (NumberFormatException e) { FFDCFilter.processException(e, CLASS_NAME + ".getRuntimeDoubleProperty", CommsConstants.COMMSUTILS_GETRUNTIMEDOUBLE_01); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "NumberFormatException: ", e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRuntimeDoubleProperty", ""+runtimeProp); return runtimeProp; }
java
public static double getRuntimeDoubleProperty(String property, String defaultValue) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRuntimeDoubleProperty", new Object[] {property, defaultValue}); // Note that we parse the default value outside of the try / catch so that if we muck // up then we blow up. Customer settable properties however, we do not want to blow if they // screw up. double runtimeProp = Double.parseDouble(defaultValue); try { runtimeProp = Double.parseDouble(RuntimeInfo.getPropertyWithMsg(property, defaultValue)); } catch (NumberFormatException e) { FFDCFilter.processException(e, CLASS_NAME + ".getRuntimeDoubleProperty", CommsConstants.COMMSUTILS_GETRUNTIMEDOUBLE_01); if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(tc, "NumberFormatException: ", e); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRuntimeDoubleProperty", ""+runtimeProp); return runtimeProp; }
[ "public", "static", "double", "getRuntimeDoubleProperty", "(", "String", "property", ",", "String", "defaultValue", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "en...
This method will get a runtime property from the sib.properties file and will convert the value (if set) to an double. If the property in the file was set to something that was not parseable as an double, then the default value will be returned. @param property The property key used to look up in the file. @param defaultValue The default value if the property is not in the file. @return Returns the property value.
[ "This", "method", "will", "get", "a", "runtime", "property", "from", "the", "sib", ".", "properties", "file", "and", "will", "convert", "the", "value", "(", "if", "set", ")", "to", "an", "double", ".", "If", "the", "property", "in", "the", "file", "was...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/common/CommsUtils.java#L131-L154
alkacon/opencms-core
src-modules/org/opencms/workplace/list/A_CmsListAction.java
A_CmsListAction.defaultConfirmationHtml
public static String defaultConfirmationHtml(String confId, String confText) { StringBuffer html = new StringBuffer(1024); html.append("<div class='hide' id='conf"); html.append(confId); html.append("'>"); html.append(CmsStringUtil.isEmptyOrWhitespaceOnly(confText) ? "null" : confText); html.append("</div>\n"); return html.toString(); }
java
public static String defaultConfirmationHtml(String confId, String confText) { StringBuffer html = new StringBuffer(1024); html.append("<div class='hide' id='conf"); html.append(confId); html.append("'>"); html.append(CmsStringUtil.isEmptyOrWhitespaceOnly(confText) ? "null" : confText); html.append("</div>\n"); return html.toString(); }
[ "public", "static", "String", "defaultConfirmationHtml", "(", "String", "confId", ",", "String", "confText", ")", "{", "StringBuffer", "html", "=", "new", "StringBuffer", "(", "1024", ")", ";", "html", ".", "append", "(", "\"<div class='hide' id='conf\"", ")", "...
Generates html for the confirmation message when having one confirmation message for several actions.<p> @param confId the id of the confirmation message @param confText the confirmation message @return html code
[ "Generates", "html", "for", "the", "confirmation", "message", "when", "having", "one", "confirmation", "message", "for", "several", "actions", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/list/A_CmsListAction.java#L74-L83
code4everything/util
src/main/java/com/zhazhapan/util/ThreadPool.java
ThreadPool.init
public static void init(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit timeUnit) { ThreadPool.corePoolSize = corePoolSize; ThreadPool.maximumPoolSize = maximumPoolSize; ThreadPool.keepAliveTime = keepAliveTime; ThreadPool.timeUnit = timeUnit; init(); }
java
public static void init(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit timeUnit) { ThreadPool.corePoolSize = corePoolSize; ThreadPool.maximumPoolSize = maximumPoolSize; ThreadPool.keepAliveTime = keepAliveTime; ThreadPool.timeUnit = timeUnit; init(); }
[ "public", "static", "void", "init", "(", "int", "corePoolSize", ",", "int", "maximumPoolSize", ",", "long", "keepAliveTime", ",", "TimeUnit", "timeUnit", ")", "{", "ThreadPool", ".", "corePoolSize", "=", "corePoolSize", ";", "ThreadPool", ".", "maximumPoolSize", ...
初始化线程池 @param corePoolSize 初始Size @param maximumPoolSize 最大Size @param keepAliveTime 存活时长 @param timeUnit 时间单位
[ "初始化线程池" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/ThreadPool.java#L62-L68
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/crf/CRFFeatureExporter.java
CRFFeatureExporter.printFeatures
public void printFeatures(String exportFile, int[][][][] docsData, int[][] labels) { try { PrintWriter pw = IOUtils.getPrintWriter(exportFile); for (int i = 0; i < docsData.length; i++) { for (int j = 0; j < docsData[i].length; j++) { StringBuilder sb = new StringBuilder(); int label = labels[i][j]; sb.append(classifier.classIndex.get(label)); for (int k = 0; k < docsData[i][j].length; k++) { for (int m = 0; m < docsData[i][j][k].length; m++) { String feat = classifier.featureIndex.get(docsData[i][j][k][m]); feat = ubPrefixFeatureString(feat); sb.append(delimiter); sb.append(feat); } } pw.println(sb.toString()); } pw.println(); } pw.close(); } catch (IOException ex) { throw new RuntimeException(ex); } }
java
public void printFeatures(String exportFile, int[][][][] docsData, int[][] labels) { try { PrintWriter pw = IOUtils.getPrintWriter(exportFile); for (int i = 0; i < docsData.length; i++) { for (int j = 0; j < docsData[i].length; j++) { StringBuilder sb = new StringBuilder(); int label = labels[i][j]; sb.append(classifier.classIndex.get(label)); for (int k = 0; k < docsData[i][j].length; k++) { for (int m = 0; m < docsData[i][j][k].length; m++) { String feat = classifier.featureIndex.get(docsData[i][j][k][m]); feat = ubPrefixFeatureString(feat); sb.append(delimiter); sb.append(feat); } } pw.println(sb.toString()); } pw.println(); } pw.close(); } catch (IOException ex) { throw new RuntimeException(ex); } }
[ "public", "void", "printFeatures", "(", "String", "exportFile", ",", "int", "[", "]", "[", "]", "[", "]", "[", "]", "docsData", ",", "int", "[", "]", "[", "]", "labels", ")", "{", "try", "{", "PrintWriter", "pw", "=", "IOUtils", ".", "getPrintWriter"...
Output features that have already been converted into features (using documentToDataAndLabels) in format suitable for CRFSuite Format is with one line per token using the following format label feat1 feat2 ... (where each space is actually a tab) Each document is separated by an empty line @param exportFile file to export the features to @param docsData array of document features @param labels correct labels indexed by document, and position within document
[ "Output", "features", "that", "have", "already", "been", "converted", "into", "features", "(", "using", "documentToDataAndLabels", ")", "in", "format", "suitable", "for", "CRFSuite", "Format", "is", "with", "one", "line", "per", "token", "using", "the", "followi...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/crf/CRFFeatureExporter.java#L107-L131
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/geometry/ExampleImageStitching.java
ExampleImageStitching.stitch
public static <T extends ImageGray<T>> void stitch( BufferedImage imageA , BufferedImage imageB , Class<T> imageType ) { T inputA = ConvertBufferedImage.convertFromSingle(imageA, null, imageType); T inputB = ConvertBufferedImage.convertFromSingle(imageB, null, imageType); // Detect using the standard SURF feature descriptor and describer DetectDescribePoint detDesc = FactoryDetectDescribe.surfStable( new ConfigFastHessian(1, 2, 200, 1, 9, 4, 4), null,null, imageType); ScoreAssociation<BrightFeature> scorer = FactoryAssociation.scoreEuclidean(BrightFeature.class,true); AssociateDescription<BrightFeature> associate = FactoryAssociation.greedy(scorer,2,true); // fit the images using a homography. This works well for rotations and distant objects. ModelMatcher<Homography2D_F64,AssociatedPair> modelMatcher = FactoryMultiViewRobust.homographyRansac(null,new ConfigRansac(60,3)); Homography2D_F64 H = computeTransform(inputA, inputB, detDesc, associate, modelMatcher); renderStitching(imageA,imageB,H); }
java
public static <T extends ImageGray<T>> void stitch( BufferedImage imageA , BufferedImage imageB , Class<T> imageType ) { T inputA = ConvertBufferedImage.convertFromSingle(imageA, null, imageType); T inputB = ConvertBufferedImage.convertFromSingle(imageB, null, imageType); // Detect using the standard SURF feature descriptor and describer DetectDescribePoint detDesc = FactoryDetectDescribe.surfStable( new ConfigFastHessian(1, 2, 200, 1, 9, 4, 4), null,null, imageType); ScoreAssociation<BrightFeature> scorer = FactoryAssociation.scoreEuclidean(BrightFeature.class,true); AssociateDescription<BrightFeature> associate = FactoryAssociation.greedy(scorer,2,true); // fit the images using a homography. This works well for rotations and distant objects. ModelMatcher<Homography2D_F64,AssociatedPair> modelMatcher = FactoryMultiViewRobust.homographyRansac(null,new ConfigRansac(60,3)); Homography2D_F64 H = computeTransform(inputA, inputB, detDesc, associate, modelMatcher); renderStitching(imageA,imageB,H); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ">", "void", "stitch", "(", "BufferedImage", "imageA", ",", "BufferedImage", "imageB", ",", "Class", "<", "T", ">", "imageType", ")", "{", "T", "inputA", "=", "ConvertBufferedImage", ".",...
Given two input images create and display an image where the two have been overlayed on top of each other.
[ "Given", "two", "input", "images", "create", "and", "display", "an", "image", "where", "the", "two", "have", "been", "overlayed", "on", "top", "of", "each", "other", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/geometry/ExampleImageStitching.java#L144-L163
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java
VariableInterpreter.getVariable
public static Object getVariable(PageContext pc, Collection collection, String var) throws PageException { StringList list = parse(pc, new ParserString(var), false); if (list == null) throw new InterpreterException("invalid variable declaration [" + var + "]"); while (list.hasNextNext()) { collection = Caster.toCollection(collection.get(KeyImpl.init(list.next()))); } return collection.get(KeyImpl.init(list.next())); }
java
public static Object getVariable(PageContext pc, Collection collection, String var) throws PageException { StringList list = parse(pc, new ParserString(var), false); if (list == null) throw new InterpreterException("invalid variable declaration [" + var + "]"); while (list.hasNextNext()) { collection = Caster.toCollection(collection.get(KeyImpl.init(list.next()))); } return collection.get(KeyImpl.init(list.next())); }
[ "public", "static", "Object", "getVariable", "(", "PageContext", "pc", ",", "Collection", "collection", ",", "String", "var", ")", "throws", "PageException", "{", "StringList", "list", "=", "parse", "(", "pc", ",", "new", "ParserString", "(", "var", ")", ","...
reads a subelement from a struct @param pc @param collection @param var @return matching Object @throws PageException
[ "reads", "a", "subelement", "from", "a", "struct" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java#L58-L66
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ListUtil.java
ListUtil.listFind
public static int listFind(String list, String value, String delimiter) { Array arr = listToArrayTrim(list, delimiter); int len = arr.size(); for (int i = 1; i <= len; i++) { if (arr.get(i, "").equals(value)) return i - 1; } return -1; }
java
public static int listFind(String list, String value, String delimiter) { Array arr = listToArrayTrim(list, delimiter); int len = arr.size(); for (int i = 1; i <= len; i++) { if (arr.get(i, "").equals(value)) return i - 1; } return -1; }
[ "public", "static", "int", "listFind", "(", "String", "list", ",", "String", "value", ",", "String", "delimiter", ")", "{", "Array", "arr", "=", "listToArrayTrim", "(", "list", ",", "delimiter", ")", ";", "int", "len", "=", "arr", ".", "size", "(", ")"...
finds a value inside a list, do not case sensitive @param list list to search @param value value to find @param delimiter delimiter of the list @return position in list or 0
[ "finds", "a", "value", "inside", "a", "list", "do", "not", "case", "sensitive" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ListUtil.java#L729-L737
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java
XMLAssert.assertXMLIdentical
public static void assertXMLIdentical(String msg, Diff diff, boolean assertion) { if (assertion != diff.identical()) { fail(getFailMessage(msg, diff)); } }
java
public static void assertXMLIdentical(String msg, Diff diff, boolean assertion) { if (assertion != diff.identical()) { fail(getFailMessage(msg, diff)); } }
[ "public", "static", "void", "assertXMLIdentical", "(", "String", "msg", ",", "Diff", "diff", ",", "boolean", "assertion", ")", "{", "if", "(", "assertion", "!=", "diff", ".", "identical", "(", ")", ")", "{", "fail", "(", "getFailMessage", "(", "msg", ","...
Assert that the result of an XML comparison is or is not identical @param msg Message to display if assertion fails @param diff the result of an XML comparison @param assertion true if asserting that result is identical
[ "Assert", "that", "the", "result", "of", "an", "XML", "comparison", "is", "or", "is", "not", "identical" ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L156-L160
fabric8io/kubernetes-client
kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesResourceUtil.java
KubernetesResourceUtil.isValidLabelOrAnnotation
public static boolean isValidLabelOrAnnotation(Map<String, String> map) { for(Map.Entry<String, String> entry : map.entrySet()) { if(!(isValidName(entry.getKey()) && isValidName(entry.getValue()))) { return false; } } return true; }
java
public static boolean isValidLabelOrAnnotation(Map<String, String> map) { for(Map.Entry<String, String> entry : map.entrySet()) { if(!(isValidName(entry.getKey()) && isValidName(entry.getValue()))) { return false; } } return true; }
[ "public", "static", "boolean", "isValidLabelOrAnnotation", "(", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "String", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "...
Validates labels/annotations of Kubernetes resources @param map Label/Annotation of resource @return returns a boolean value inidicating whether it's valid or not
[ "Validates", "labels", "/", "annotations", "of", "Kubernetes", "resources" ]
train
https://github.com/fabric8io/kubernetes-client/blob/141668a882ed8e902c045a5cd0a80f14bd17d132/kubernetes-client/src/main/java/io/fabric8/kubernetes/client/utils/KubernetesResourceUtil.java#L270-L277
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.importCertificateAsync
public Observable<CertificateBundle> importCertificateAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) { return importCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, base64EncodedCertificate, password, certificatePolicy, certificateAttributes, tags).map(new Func1<ServiceResponse<CertificateBundle>, CertificateBundle>() { @Override public CertificateBundle call(ServiceResponse<CertificateBundle> response) { return response.body(); } }); }
java
public Observable<CertificateBundle> importCertificateAsync(String vaultBaseUrl, String certificateName, String base64EncodedCertificate, String password, CertificatePolicy certificatePolicy, CertificateAttributes certificateAttributes, Map<String, String> tags) { return importCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, base64EncodedCertificate, password, certificatePolicy, certificateAttributes, tags).map(new Func1<ServiceResponse<CertificateBundle>, CertificateBundle>() { @Override public CertificateBundle call(ServiceResponse<CertificateBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CertificateBundle", ">", "importCertificateAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "String", "base64EncodedCertificate", ",", "String", "password", ",", "CertificatePolicy", "certificatePolicy", ",", "Cer...
Imports a certificate into a specified key vault. Imports an existing valid certificate, containing a private key, into Azure Key Vault. The certificate to be imported can be in either PFX or PEM format. If the certificate is in PEM format the PEM file must contain the key as well as x509 certificates. This operation requires the certificates/import permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param base64EncodedCertificate Base64 encoded representation of the certificate object to import. This certificate needs to contain the private key. @param password If the private key in base64EncodedCertificate is encrypted, the password used for encryption. @param certificatePolicy The management policy for the certificate. @param certificateAttributes The attributes of the certificate (optional). @param tags Application specific metadata in the form of key-value pairs. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificateBundle object
[ "Imports", "a", "certificate", "into", "a", "specified", "key", "vault", ".", "Imports", "an", "existing", "valid", "certificate", "containing", "a", "private", "key", "into", "Azure", "Key", "Vault", ".", "The", "certificate", "to", "be", "imported", "can", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L6823-L6830
OpenLiberty/open-liberty
dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java
RepositoryResolver.reportErrors
private void reportErrors() throws RepositoryResolutionException { if (resourcesWrongProduct.isEmpty() && missingTopLevelRequirements.isEmpty() && missingRequirements.isEmpty()) { // Everything went fine! return; } Set<ProductRequirementInformation> missingProductInformation = new HashSet<>(); for (ApplicableToProduct esa : resourcesWrongProduct) { missingRequirements.add(new MissingRequirement(esa.getAppliesTo(), (RepositoryResource) esa)); missingProductInformation.addAll(ProductRequirementInformation.createFromAppliesTo(esa.getAppliesTo())); } List<String> missingRequirementNames = new ArrayList<>(); for (MissingRequirement req : missingRequirements) { missingRequirementNames.add(req.getRequirementName()); } throw new RepositoryResolutionException(null, missingTopLevelRequirements, missingRequirementNames, missingProductInformation, missingRequirements); }
java
private void reportErrors() throws RepositoryResolutionException { if (resourcesWrongProduct.isEmpty() && missingTopLevelRequirements.isEmpty() && missingRequirements.isEmpty()) { // Everything went fine! return; } Set<ProductRequirementInformation> missingProductInformation = new HashSet<>(); for (ApplicableToProduct esa : resourcesWrongProduct) { missingRequirements.add(new MissingRequirement(esa.getAppliesTo(), (RepositoryResource) esa)); missingProductInformation.addAll(ProductRequirementInformation.createFromAppliesTo(esa.getAppliesTo())); } List<String> missingRequirementNames = new ArrayList<>(); for (MissingRequirement req : missingRequirements) { missingRequirementNames.add(req.getRequirementName()); } throw new RepositoryResolutionException(null, missingTopLevelRequirements, missingRequirementNames, missingProductInformation, missingRequirements); }
[ "private", "void", "reportErrors", "(", ")", "throws", "RepositoryResolutionException", "{", "if", "(", "resourcesWrongProduct", ".", "isEmpty", "(", ")", "&&", "missingTopLevelRequirements", ".", "isEmpty", "(", ")", "&&", "missingRequirements", ".", "isEmpty", "("...
If any errors occurred during resolution, throw a {@link RepositoryResolutionException}
[ "If", "any", "errors", "occurred", "during", "resolution", "throw", "a", "{" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.resolver/src/com/ibm/ws/repository/resolver/RepositoryResolver.java#L774-L793
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.removeEntry
public static void removeEntry(final File zip, final String path) { operateInPlace(zip, new InPlaceAction() { public boolean act(File tmpFile) { removeEntry(zip, path, tmpFile); return true; } }); }
java
public static void removeEntry(final File zip, final String path) { operateInPlace(zip, new InPlaceAction() { public boolean act(File tmpFile) { removeEntry(zip, path, tmpFile); return true; } }); }
[ "public", "static", "void", "removeEntry", "(", "final", "File", "zip", ",", "final", "String", "path", ")", "{", "operateInPlace", "(", "zip", ",", "new", "InPlaceAction", "(", ")", "{", "public", "boolean", "act", "(", "File", "tmpFile", ")", "{", "rem...
Changes an existing ZIP file: removes entry with a given path. @param zip an existing ZIP file @param path path of the entry to remove @since 1.7
[ "Changes", "an", "existing", "ZIP", "file", ":", "removes", "entry", "with", "a", "given", "path", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2283-L2290
h2oai/h2o-3
h2o-core/src/main/java/water/Value.java
Value.read_lock
boolean read_lock() { while( true ) { // Repeat, in case racing GETs are bumping the counter int old = _rwlock.get(); if( old == -1 ) return false; // Write-locked; no new replications. Read fails to read *this* value assert old >= 0; // Not negative if( RW_CAS(old,old+1,"rlock+") ) return true; } }
java
boolean read_lock() { while( true ) { // Repeat, in case racing GETs are bumping the counter int old = _rwlock.get(); if( old == -1 ) return false; // Write-locked; no new replications. Read fails to read *this* value assert old >= 0; // Not negative if( RW_CAS(old,old+1,"rlock+") ) return true; } }
[ "boolean", "read_lock", "(", ")", "{", "while", "(", "true", ")", "{", "// Repeat, in case racing GETs are bumping the counter", "int", "old", "=", "_rwlock", ".", "get", "(", ")", ";", "if", "(", "old", "==", "-", "1", ")", "return", "false", ";", "// Wri...
Bump the read lock, once per pending-GET or pending-Invalidate
[ "Bump", "the", "read", "lock", "once", "per", "pending", "-", "GET", "or", "pending", "-", "Invalidate" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/Value.java#L468-L475
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/TokenCachingStrategy.java
TokenCachingStrategy.putSource
public static void putSource(Bundle bundle, AccessTokenSource value) { Validate.notNull(bundle, "bundle"); bundle.putSerializable(TOKEN_SOURCE_KEY, value); }
java
public static void putSource(Bundle bundle, AccessTokenSource value) { Validate.notNull(bundle, "bundle"); bundle.putSerializable(TOKEN_SOURCE_KEY, value); }
[ "public", "static", "void", "putSource", "(", "Bundle", "bundle", ",", "AccessTokenSource", "value", ")", "{", "Validate", ".", "notNull", "(", "bundle", ",", "\"bundle\"", ")", ";", "bundle", ".", "putSerializable", "(", "TOKEN_SOURCE_KEY", ",", "value", ")",...
Puts the enum indicating the source of the token into a Bundle. @param bundle A Bundle in which the enum should be stored. @param value enum indicating the source of the token @throws NullPointerException if the passed in Bundle is null
[ "Puts", "the", "enum", "indicating", "the", "source", "of", "the", "token", "into", "a", "Bundle", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/TokenCachingStrategy.java#L328-L331
jboss/jboss-el-api_spec
src/main/java/javax/el/BeanNameELResolver.java
BeanNameELResolver.isReadOnly
@Override public boolean isReadOnly(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException(); } if (base == null && property instanceof String) { if (beanNameResolver.isNameResolved((String) property)) { context.setPropertyResolved(true); return beanNameResolver.isReadOnly((String) property); } } return false; }
java
@Override public boolean isReadOnly(ELContext context, Object base, Object property) { if (context == null) { throw new NullPointerException(); } if (base == null && property instanceof String) { if (beanNameResolver.isNameResolved((String) property)) { context.setPropertyResolved(true); return beanNameResolver.isReadOnly((String) property); } } return false; }
[ "@", "Override", "public", "boolean", "isReadOnly", "(", "ELContext", "context", ",", "Object", "base", ",", "Object", "property", ")", "{", "if", "(", "context", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "if", "...
If the base is null and the property is a name resolvable by the BeanNameResolver, attempts to determine if the bean is writable. <p>If the name is resolvable by the BeanNameResolver, the <code>propertyResolved</code> property of the <code>ELContext</code> object must be set to <code>true</code> by the resolver, before returning. If this property is not <code>true</code> after this method is called, the caller can safely assume no value has been set.</p> @param context The context of this evaluation. @param base <code>null</code> @param property The name of the bean. @return If the <code>propertyResolved</code> property of <code>ELContext</code> was set to <code>true</code>, then <code>true</code> if the property is read-only or <code>false</code> if not; otherwise undefined. @throws NullPointerException if context is <code>null</code>. @throws ELException if an exception was thrown while performing the property or variable resolution. The thrown exception must be included as the cause property of this exception, if available.
[ "If", "the", "base", "is", "null", "and", "the", "property", "is", "a", "name", "resolvable", "by", "the", "BeanNameResolver", "attempts", "to", "determine", "if", "the", "bean", "is", "writable", "." ]
train
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/BeanNameELResolver.java#L219-L232
facebookarchive/hadoop-20
src/core/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java
MetricsRecordImpl.setTag
public void setTag(String tagName, long tagValue) { tagTable.put(tagName, Long.valueOf(tagValue)); }
java
public void setTag(String tagName, long tagValue) { tagTable.put(tagName, Long.valueOf(tagValue)); }
[ "public", "void", "setTag", "(", "String", "tagName", ",", "long", "tagValue", ")", "{", "tagTable", ".", "put", "(", "tagName", ",", "Long", ".", "valueOf", "(", "tagValue", ")", ")", ";", "}" ]
Sets the named tag to the specified value. @param tagName name of the tag @param tagValue new value of the tag @throws MetricsException if the tagName conflicts with the configuration
[ "Sets", "the", "named", "tag", "to", "the", "specified", "value", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/MetricsRecordImpl.java#L90-L92
messagebird/java-rest-api
api/src/main/java/com/messagebird/MessageBirdClient.java
MessageBirdClient.requestLookupHlr
public LookupHlr requestLookupHlr(final BigInteger phoneNumber, final String reference) throws UnauthorizedException, GeneralException { if (phoneNumber == null) { throw new IllegalArgumentException("Phonenumber must be specified."); } if (reference == null) { throw new IllegalArgumentException("Reference must be specified."); } final LookupHlr lookupHlr = new LookupHlr(); lookupHlr.setPhoneNumber(phoneNumber); lookupHlr.setReference(reference); return this.requestLookupHlr(lookupHlr); }
java
public LookupHlr requestLookupHlr(final BigInteger phoneNumber, final String reference) throws UnauthorizedException, GeneralException { if (phoneNumber == null) { throw new IllegalArgumentException("Phonenumber must be specified."); } if (reference == null) { throw new IllegalArgumentException("Reference must be specified."); } final LookupHlr lookupHlr = new LookupHlr(); lookupHlr.setPhoneNumber(phoneNumber); lookupHlr.setReference(reference); return this.requestLookupHlr(lookupHlr); }
[ "public", "LookupHlr", "requestLookupHlr", "(", "final", "BigInteger", "phoneNumber", ",", "final", "String", "reference", ")", "throws", "UnauthorizedException", ",", "GeneralException", "{", "if", "(", "phoneNumber", "==", "null", ")", "{", "throw", "new", "Ille...
Request a Lookup HLR (lookup) @param phoneNumber phone number is for request hlr @param reference reference for request hlr @return lookupHlr @throws UnauthorizedException if client is unauthorized @throws GeneralException general exception
[ "Request", "a", "Lookup", "HLR", "(", "lookup", ")" ]
train
https://github.com/messagebird/java-rest-api/blob/f92cd93afff413e6dc12aa6e41e69f26cbae8941/api/src/main/java/com/messagebird/MessageBirdClient.java#L486-L497
jenkinsci/jenkins
core/src/main/java/jenkins/model/Jenkins.java
Jenkins.doCheckDisplayName
public FormValidation doCheckDisplayName(@QueryParameter String displayName, @QueryParameter String jobName) { displayName = displayName.trim(); if(LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Current job name is " + jobName); } if(!isNameUnique(displayName, jobName)) { return FormValidation.warning(Messages.Jenkins_CheckDisplayName_NameNotUniqueWarning(displayName)); } else if(!isDisplayNameUnique(displayName, jobName)){ return FormValidation.warning(Messages.Jenkins_CheckDisplayName_DisplayNameNotUniqueWarning(displayName)); } else { return FormValidation.ok(); } }
java
public FormValidation doCheckDisplayName(@QueryParameter String displayName, @QueryParameter String jobName) { displayName = displayName.trim(); if(LOGGER.isLoggable(Level.FINE)) { LOGGER.log(Level.FINE, "Current job name is " + jobName); } if(!isNameUnique(displayName, jobName)) { return FormValidation.warning(Messages.Jenkins_CheckDisplayName_NameNotUniqueWarning(displayName)); } else if(!isDisplayNameUnique(displayName, jobName)){ return FormValidation.warning(Messages.Jenkins_CheckDisplayName_DisplayNameNotUniqueWarning(displayName)); } else { return FormValidation.ok(); } }
[ "public", "FormValidation", "doCheckDisplayName", "(", "@", "QueryParameter", "String", "displayName", ",", "@", "QueryParameter", "String", "jobName", ")", "{", "displayName", "=", "displayName", ".", "trim", "(", ")", ";", "if", "(", "LOGGER", ".", "isLoggable...
Checks to see if the candidate displayName collides with any existing display names or project names @param displayName The display name to test @param jobName The name of the job the user is configuring
[ "Checks", "to", "see", "if", "the", "candidate", "displayName", "collides", "with", "any", "existing", "display", "names", "or", "project", "names" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Jenkins.java#L4825-L4842
TestFX/Monocle
src/main/java/com/sun/glass/ui/monocle/IntSet.java
IntSet.difference
void difference(IntSet dest, IntSet compared) { int i = 0; int j = 0; while (i < size && j < compared.size) { int a = elements[i]; int b = compared.elements[j]; if (a < b) { // our set has a value that is not in "compared" dest.addInt(a); i ++; } else if (a > b) { // "compared" has a value that is not in our set. j ++; } else { // the sets match at this index. i ++; j ++; } } // anything left in our set is part of the delta and belongs in "dest". while (i < size) { dest.addInt(elements[i]); i ++; } }
java
void difference(IntSet dest, IntSet compared) { int i = 0; int j = 0; while (i < size && j < compared.size) { int a = elements[i]; int b = compared.elements[j]; if (a < b) { // our set has a value that is not in "compared" dest.addInt(a); i ++; } else if (a > b) { // "compared" has a value that is not in our set. j ++; } else { // the sets match at this index. i ++; j ++; } } // anything left in our set is part of the delta and belongs in "dest". while (i < size) { dest.addInt(elements[i]); i ++; } }
[ "void", "difference", "(", "IntSet", "dest", ",", "IntSet", "compared", ")", "{", "int", "i", "=", "0", ";", "int", "j", "=", "0", ";", "while", "(", "i", "<", "size", "&&", "j", "<", "compared", ".", "size", ")", "{", "int", "a", "=", "element...
Adds to the set "dest" values that in this set but are not in the set "compared".
[ "Adds", "to", "the", "set", "dest", "values", "that", "in", "this", "set", "but", "are", "not", "in", "the", "set", "compared", "." ]
train
https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/IntSet.java#L86-L110
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/JarPluginProviderLoader.java
JarPluginProviderLoader.extractDependentLibs
protected Collection<File> extractDependentLibs(final File cachedir) throws IOException { final Attributes attributes = getMainAttributes(); if (null == attributes) { debug("no manifest attributes"); return null; } final ArrayList<File> files = new ArrayList<File>(); final String libs = attributes.getValue(RUNDECK_PLUGIN_LIBS); if (null != libs) { debug("jar libs listed: " + libs + " for file: " + pluginJar); if (!cachedir.isDirectory()) { if (!cachedir.mkdirs()) { debug("Failed to create cachedJar dir for dependent libs: " + cachedir); } } final String[] libsarr = libs.split(" "); extractJarContents(libsarr, cachedir); for (final String s : libsarr) { File libFile = new File(cachedir, s); libFile.deleteOnExit(); files.add(libFile); } } else { debug("no jar libs listed in manifest: " + pluginJar); } return files; }
java
protected Collection<File> extractDependentLibs(final File cachedir) throws IOException { final Attributes attributes = getMainAttributes(); if (null == attributes) { debug("no manifest attributes"); return null; } final ArrayList<File> files = new ArrayList<File>(); final String libs = attributes.getValue(RUNDECK_PLUGIN_LIBS); if (null != libs) { debug("jar libs listed: " + libs + " for file: " + pluginJar); if (!cachedir.isDirectory()) { if (!cachedir.mkdirs()) { debug("Failed to create cachedJar dir for dependent libs: " + cachedir); } } final String[] libsarr = libs.split(" "); extractJarContents(libsarr, cachedir); for (final String s : libsarr) { File libFile = new File(cachedir, s); libFile.deleteOnExit(); files.add(libFile); } } else { debug("no jar libs listed in manifest: " + pluginJar); } return files; }
[ "protected", "Collection", "<", "File", ">", "extractDependentLibs", "(", "final", "File", "cachedir", ")", "throws", "IOException", "{", "final", "Attributes", "attributes", "=", "getMainAttributes", "(", ")", ";", "if", "(", "null", "==", "attributes", ")", ...
Extract the dependent libs and return the extracted jar files @return the collection of extracted files
[ "Extract", "the", "dependent", "libs", "and", "return", "the", "extracted", "jar", "files" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/JarPluginProviderLoader.java#L492-L519
marvinlabs/android-intents
library/src/main/java/com/marvinlabs/intents/MediaIntents.java
MediaIntents.newPlayMediaIntent
public static Intent newPlayMediaIntent(String url, String type) { return newPlayMediaIntent(Uri.parse(url), type); }
java
public static Intent newPlayMediaIntent(String url, String type) { return newPlayMediaIntent(Uri.parse(url), type); }
[ "public", "static", "Intent", "newPlayMediaIntent", "(", "String", "url", ",", "String", "type", ")", "{", "return", "newPlayMediaIntent", "(", "Uri", ".", "parse", "(", "url", ")", ",", "type", ")", ";", "}" ]
Open the media player to play the given media @param url The URL of the media to play. @param type The mime type @return the intent
[ "Open", "the", "media", "player", "to", "play", "the", "given", "media" ]
train
https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/MediaIntents.java#L149-L151
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/SliderThumbPainter.java
SliderThumbPainter.paintDiscrete
private void paintDiscrete(Graphics2D g, JComponent c, int width, int height) { boolean useToolBarColors = isInToolBar(c); Shape s; if (isFocused) { s = shapeGenerator.createSliderThumbDiscrete(0, 0, width, height, CornerSize.SLIDER_OUTER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.OUTER_FOCUS, useToolBarColors)); g.fill(s); s = shapeGenerator.createSliderThumbDiscrete(1, 1, width - 2, height - 2, CornerSize.SLIDER_INNER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.INNER_FOCUS, useToolBarColors)); g.fill(s); } s = shapeGenerator.createSliderThumbDiscrete(2, 2, width - 4, height - 4, CornerSize.SLIDER_BORDER); if (!isFocused) { dropShadow.fill(g, s); } g.setPaint(getCommonBorderPaint(s, type)); g.fill(s); s = shapeGenerator.createSliderThumbDiscrete(3, 3, width - 6, height - 6, CornerSize.SLIDER_INTERIOR); g.setPaint(getCommonInteriorPaint(s, type)); g.fill(s); }
java
private void paintDiscrete(Graphics2D g, JComponent c, int width, int height) { boolean useToolBarColors = isInToolBar(c); Shape s; if (isFocused) { s = shapeGenerator.createSliderThumbDiscrete(0, 0, width, height, CornerSize.SLIDER_OUTER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.OUTER_FOCUS, useToolBarColors)); g.fill(s); s = shapeGenerator.createSliderThumbDiscrete(1, 1, width - 2, height - 2, CornerSize.SLIDER_INNER_FOCUS); g.setPaint(getFocusPaint(s, FocusType.INNER_FOCUS, useToolBarColors)); g.fill(s); } s = shapeGenerator.createSliderThumbDiscrete(2, 2, width - 4, height - 4, CornerSize.SLIDER_BORDER); if (!isFocused) { dropShadow.fill(g, s); } g.setPaint(getCommonBorderPaint(s, type)); g.fill(s); s = shapeGenerator.createSliderThumbDiscrete(3, 3, width - 6, height - 6, CornerSize.SLIDER_INTERIOR); g.setPaint(getCommonInteriorPaint(s, type)); g.fill(s); }
[ "private", "void", "paintDiscrete", "(", "Graphics2D", "g", ",", "JComponent", "c", ",", "int", "width", ",", "int", "height", ")", "{", "boolean", "useToolBarColors", "=", "isInToolBar", "(", "c", ")", ";", "Shape", "s", ";", "if", "(", "isFocused", ")"...
DOCUMENT ME! @param g DOCUMENT ME! @param c DOCUMENT ME! @param width DOCUMENT ME! @param height DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/SliderThumbPainter.java#L164-L189
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Filtering.java
Filtering.takeLast
public static <E> Iterator<E> takeLast(int howMany, Iterable<E> from) { dbc.precondition(from != null, "cannot call last with a null iterable"); return takeLast(howMany, from.iterator()); }
java
public static <E> Iterator<E> takeLast(int howMany, Iterable<E> from) { dbc.precondition(from != null, "cannot call last with a null iterable"); return takeLast(howMany, from.iterator()); }
[ "public", "static", "<", "E", ">", "Iterator", "<", "E", ">", "takeLast", "(", "int", "howMany", ",", "Iterable", "<", "E", ">", "from", ")", "{", "dbc", ".", "precondition", "(", "from", "!=", "null", ",", "\"cannot call last with a null iterable\"", ")",...
Creates an iterator yielding last n elements from the source iterable. Consuming the resulting iterator yields an IllegalArgumentException if not enough elements can be fetched. E.g: <code>takeLast(2, [1, 2, 3]) -> [2, 3]</code> @param <E> the iterable element type @param howMany number of elements to be yielded @param from the source iterable @return the resulting iterator
[ "Creates", "an", "iterator", "yielding", "last", "n", "elements", "from", "the", "source", "iterable", ".", "Consuming", "the", "resulting", "iterator", "yields", "an", "IllegalArgumentException", "if", "not", "enough", "elements", "can", "be", "fetched", ".", "...
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Filtering.java#L82-L85
marklogic/marklogic-contentpump
mlcp/src/main/java/com/marklogic/contentpump/LocalJobRunner.java
LocalJobRunner.assignThreads
private int assignThreads(int splitIndex, int splitCount) { if (threadsPerSplit > 0) { return threadsPerSplit; } if (splitCount == 1) { return threadCount; } if (splitCount * minThreads > threadCount) { return minThreads; } if (splitIndex % threadCount < threadCount % splitCount) { return threadCount / splitCount + 1; } else { return threadCount / splitCount; } }
java
private int assignThreads(int splitIndex, int splitCount) { if (threadsPerSplit > 0) { return threadsPerSplit; } if (splitCount == 1) { return threadCount; } if (splitCount * minThreads > threadCount) { return minThreads; } if (splitIndex % threadCount < threadCount % splitCount) { return threadCount / splitCount + 1; } else { return threadCount / splitCount; } }
[ "private", "int", "assignThreads", "(", "int", "splitIndex", ",", "int", "splitCount", ")", "{", "if", "(", "threadsPerSplit", ">", "0", ")", "{", "return", "threadsPerSplit", ";", "}", "if", "(", "splitCount", "==", "1", ")", "{", "return", "threadCount",...
Assign thread count for a given split @param splitIndex split index @param splitCount @return
[ "Assign", "thread", "count", "for", "a", "given", "split" ]
train
https://github.com/marklogic/marklogic-contentpump/blob/4c41e4a953301f81a4c655efb2a847603dee8afc/mlcp/src/main/java/com/marklogic/contentpump/LocalJobRunner.java#L306-L321
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.saveRewriteAliases
public void saveRewriteAliases(CmsDbContext dbc, String siteRoot, List<CmsRewriteAlias> newAliases) throws CmsException { CmsRewriteAliasFilter filter = new CmsRewriteAliasFilter().setSiteRoot(siteRoot); getVfsDriver(dbc).deleteRewriteAliases(dbc, filter); getVfsDriver(dbc).insertRewriteAliases(dbc, newAliases); }
java
public void saveRewriteAliases(CmsDbContext dbc, String siteRoot, List<CmsRewriteAlias> newAliases) throws CmsException { CmsRewriteAliasFilter filter = new CmsRewriteAliasFilter().setSiteRoot(siteRoot); getVfsDriver(dbc).deleteRewriteAliases(dbc, filter); getVfsDriver(dbc).insertRewriteAliases(dbc, newAliases); }
[ "public", "void", "saveRewriteAliases", "(", "CmsDbContext", "dbc", ",", "String", "siteRoot", ",", "List", "<", "CmsRewriteAlias", ">", "newAliases", ")", "throws", "CmsException", "{", "CmsRewriteAliasFilter", "filter", "=", "new", "CmsRewriteAliasFilter", "(", ")...
Replaces the complete list of rewrite aliases for a given site root.<p> @param dbc the current database context @param siteRoot the site root for which the rewrite aliases should be replaced @param newAliases the new aliases for the given site root @throws CmsException if something goes wrong
[ "Replaces", "the", "complete", "list", "of", "rewrite", "aliases", "for", "a", "given", "site", "root", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L8793-L8799
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java
ExpressRouteCircuitsInner.getPeeringStatsAsync
public Observable<ExpressRouteCircuitStatsInner> getPeeringStatsAsync(String resourceGroupName, String circuitName, String peeringName) { return getPeeringStatsWithServiceResponseAsync(resourceGroupName, circuitName, peeringName).map(new Func1<ServiceResponse<ExpressRouteCircuitStatsInner>, ExpressRouteCircuitStatsInner>() { @Override public ExpressRouteCircuitStatsInner call(ServiceResponse<ExpressRouteCircuitStatsInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCircuitStatsInner> getPeeringStatsAsync(String resourceGroupName, String circuitName, String peeringName) { return getPeeringStatsWithServiceResponseAsync(resourceGroupName, circuitName, peeringName).map(new Func1<ServiceResponse<ExpressRouteCircuitStatsInner>, ExpressRouteCircuitStatsInner>() { @Override public ExpressRouteCircuitStatsInner call(ServiceResponse<ExpressRouteCircuitStatsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCircuitStatsInner", ">", "getPeeringStatsAsync", "(", "String", "resourceGroupName", ",", "String", "circuitName", ",", "String", "peeringName", ")", "{", "return", "getPeeringStatsWithServiceResponseAsync", "(", "resourceGroupName", ...
Gets all stats from an express route circuit in a resource group. @param resourceGroupName The name of the resource group. @param circuitName The name of the express route circuit. @param peeringName The name of the peering. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteCircuitStatsInner object
[ "Gets", "all", "stats", "from", "an", "express", "route", "circuit", "in", "a", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/ExpressRouteCircuitsInner.java#L1528-L1535
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java
PageFlowUtils.getSharedFlow
public static SharedFlowController getSharedFlow( String sharedFlowClassName, HttpServletRequest request, ServletContext servletContext ) { StorageHandler sh = Handlers.get( servletContext ).getStorageHandler(); HttpServletRequest unwrappedRequest = unwrapMultipart( request ); RequestContext rc = new RequestContext( unwrappedRequest, null ); String attrName = ScopedServletUtils.getScopedSessionAttrName(InternalConstants.SHARED_FLOW_ATTR_PREFIX + sharedFlowClassName, request); SharedFlowController sf = (SharedFlowController) sh.getAttribute(rc, attrName); if (sf != null) { sf.reinitializeIfNecessary(request, null, servletContext); } return sf; }
java
public static SharedFlowController getSharedFlow( String sharedFlowClassName, HttpServletRequest request, ServletContext servletContext ) { StorageHandler sh = Handlers.get( servletContext ).getStorageHandler(); HttpServletRequest unwrappedRequest = unwrapMultipart( request ); RequestContext rc = new RequestContext( unwrappedRequest, null ); String attrName = ScopedServletUtils.getScopedSessionAttrName(InternalConstants.SHARED_FLOW_ATTR_PREFIX + sharedFlowClassName, request); SharedFlowController sf = (SharedFlowController) sh.getAttribute(rc, attrName); if (sf != null) { sf.reinitializeIfNecessary(request, null, servletContext); } return sf; }
[ "public", "static", "SharedFlowController", "getSharedFlow", "(", "String", "sharedFlowClassName", ",", "HttpServletRequest", "request", ",", "ServletContext", "servletContext", ")", "{", "StorageHandler", "sh", "=", "Handlers", ".", "get", "(", "servletContext", ")", ...
Get the shared flow with the given class name. @param sharedFlowClassName the class name of the shared flow to retrieve. @param request the current HttpServletRequest. @return the {@link SharedFlowController} of the given class name which is stored in the user session.
[ "Get", "the", "shared", "flow", "with", "the", "given", "class", "name", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L374-L387
morimekta/utils
io-util/src/main/java/net/morimekta/util/io/IOUtils.java
IOUtils.readString
public static String readString(Reader is, String term) throws IOException { CharArrayWriter baos = new CharArrayWriter(); int ch_int; char last = term.charAt(term.length() - 1); while ((ch_int = is.read()) >= 0) { final char ch = (char) ch_int; baos.write(ch); if (ch == last && baos.size() >= term.length()) { String tmp = baos.toString(); if (tmp.substring(tmp.length() - term.length()) .equals(term)) { return tmp.substring(0, tmp.length() - term.length()); } } } return baos.toString(); }
java
public static String readString(Reader is, String term) throws IOException { CharArrayWriter baos = new CharArrayWriter(); int ch_int; char last = term.charAt(term.length() - 1); while ((ch_int = is.read()) >= 0) { final char ch = (char) ch_int; baos.write(ch); if (ch == last && baos.size() >= term.length()) { String tmp = baos.toString(); if (tmp.substring(tmp.length() - term.length()) .equals(term)) { return tmp.substring(0, tmp.length() - term.length()); } } } return baos.toString(); }
[ "public", "static", "String", "readString", "(", "Reader", "is", ",", "String", "term", ")", "throws", "IOException", "{", "CharArrayWriter", "baos", "=", "new", "CharArrayWriter", "(", ")", ";", "int", "ch_int", ";", "char", "last", "=", "term", ".", "cha...
Read next string from input stream. @param is The reader to read characters from. @param term Terminator character. @return The string up until, but not including the terminator. @throws IOException when unable to read from stream.
[ "Read", "next", "string", "from", "input", "stream", "." ]
train
https://github.com/morimekta/utils/blob/dc987485902f1a7d58169c89c61db97425a6226d/io-util/src/main/java/net/morimekta/util/io/IOUtils.java#L218-L236
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRanges.java
PluralRanges.isExplicit
@Deprecated public boolean isExplicit(StandardPlural start, StandardPlural end) { return matrix.get(start, end) != null; }
java
@Deprecated public boolean isExplicit(StandardPlural start, StandardPlural end) { return matrix.get(start, end) != null; }
[ "@", "Deprecated", "public", "boolean", "isExplicit", "(", "StandardPlural", "start", ",", "StandardPlural", "end", ")", "{", "return", "matrix", ".", "get", "(", "start", ",", "end", ")", "!=", "null", ";", "}" ]
Returns whether the appropriate plural category for a range from start to end is explicitly in the data (vs given an implicit value). See also {@link #get}. @param start plural category for the start of the range @param end plural category for the end of the range @return whether the value for (start,end) is explicit or not. @deprecated This API is ICU internal only. @hide draft / provisional / internal are hidden on Android
[ "Returns", "whether", "the", "appropriate", "plural", "category", "for", "a", "range", "from", "start", "to", "end", "is", "explicitly", "in", "the", "data", "(", "vs", "given", "an", "implicit", "value", ")", ".", "See", "also", "{", "@link", "#get", "}...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRanges.java#L262-L265
wcm-io/wcm-io-wcm
commons/src/main/java/io/wcm/wcm/commons/caching/CacheHeader.java
CacheHeader.isNotModified
public static boolean isNotModified(@NotNull ModificationDateProvider dateProvider, @NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws IOException { boolean isAuthor = WCMMode.fromRequest(request) != WCMMode.DISABLED; return isNotModified(dateProvider, request, response, isAuthor); }
java
public static boolean isNotModified(@NotNull ModificationDateProvider dateProvider, @NotNull SlingHttpServletRequest request, @NotNull SlingHttpServletResponse response) throws IOException { boolean isAuthor = WCMMode.fromRequest(request) != WCMMode.DISABLED; return isNotModified(dateProvider, request, response, isAuthor); }
[ "public", "static", "boolean", "isNotModified", "(", "@", "NotNull", "ModificationDateProvider", "dateProvider", ",", "@", "NotNull", "SlingHttpServletRequest", "request", ",", "@", "NotNull", "SlingHttpServletResponse", "response", ")", "throws", "IOException", "{", "b...
Compares the "If-Modified-Since header" of the incoming request with the last modification date of an aggregated resource. If the resource was not modified since the client retrieved the resource, a 304-redirect is send to the response (and the method returns true). If the resource has changed (or the client didn't) supply the "If-Modified-Since" header a "Last-Modified" header is set so future requests can be cached. <p> Expires header is automatically set on author instance, and not set on publish instance. </p> @param dateProvider abstraction layer that calculates the last-modification time of an aggregated resource @param request Request @param response Response @return true if the method send a 304 redirect, so that the caller shouldn't write any output to the response stream @throws IOException I/O exception
[ "Compares", "the", "If", "-", "Modified", "-", "Since", "header", "of", "the", "incoming", "request", "with", "the", "last", "modification", "date", "of", "an", "aggregated", "resource", ".", "If", "the", "resource", "was", "not", "modified", "since", "the",...
train
https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/caching/CacheHeader.java#L139-L143
ehcache/ehcache3
impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java
CacheConfigurationBuilder.withResourcePools
public CacheConfigurationBuilder<K, V> withResourcePools(ResourcePoolsBuilder resourcePoolsBuilder) { return withResourcePools(requireNonNull(resourcePoolsBuilder, "Null resource pools builder").build()); }
java
public CacheConfigurationBuilder<K, V> withResourcePools(ResourcePoolsBuilder resourcePoolsBuilder) { return withResourcePools(requireNonNull(resourcePoolsBuilder, "Null resource pools builder").build()); }
[ "public", "CacheConfigurationBuilder", "<", "K", ",", "V", ">", "withResourcePools", "(", "ResourcePoolsBuilder", "resourcePoolsBuilder", ")", "{", "return", "withResourcePools", "(", "requireNonNull", "(", "resourcePoolsBuilder", ",", "\"Null resource pools builder\"", ")"...
Convenience method to add a {@link ResourcePools} through a {@link ResourcePoolsBuilder} to the returned builder. @param resourcePoolsBuilder the builder providing the resource pool @return a new builder with the added resource pools @see #withResourcePools(ResourcePools)
[ "Convenience", "method", "to", "add", "a", "{", "@link", "ResourcePools", "}", "through", "a", "{", "@link", "ResourcePoolsBuilder", "}", "to", "the", "returned", "builder", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheConfigurationBuilder.java#L284-L286
mojohaus/webstart
webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractJnlpMojo.java
AbstractJnlpMojo.prepareExtensions
private void prepareExtensions() throws MojoExecutionException { List<String> includes = new ArrayList<>(); for ( JnlpExtension extension : jnlpExtensions ) { // Check extensions (mandatory name, title and vendor and at least one include) checkExtension( extension ); for ( String o : extension.getIncludes() ) { includes.add( o.trim() ); } if ( StringUtils.isEmpty( extension.getOutputFile() ) ) { String name = extension.getName() + ".jnlp"; verboseLog( "Jnlp extension output file name not specified. Using default output file name: " + name + "." ); extension.setOutputFile( name ); } } // copy all includes libs fro extensions to be exclude from the mojo // treatments (extensions by nature are already signed) if ( dependencies == null ) { dependencies = new Dependencies(); } if ( dependencies.getExcludes() == null ) { dependencies.setExcludes( new ArrayList<String>() ); } dependencies.getExcludes().addAll( includes ); }
java
private void prepareExtensions() throws MojoExecutionException { List<String> includes = new ArrayList<>(); for ( JnlpExtension extension : jnlpExtensions ) { // Check extensions (mandatory name, title and vendor and at least one include) checkExtension( extension ); for ( String o : extension.getIncludes() ) { includes.add( o.trim() ); } if ( StringUtils.isEmpty( extension.getOutputFile() ) ) { String name = extension.getName() + ".jnlp"; verboseLog( "Jnlp extension output file name not specified. Using default output file name: " + name + "." ); extension.setOutputFile( name ); } } // copy all includes libs fro extensions to be exclude from the mojo // treatments (extensions by nature are already signed) if ( dependencies == null ) { dependencies = new Dependencies(); } if ( dependencies.getExcludes() == null ) { dependencies.setExcludes( new ArrayList<String>() ); } dependencies.getExcludes().addAll( includes ); }
[ "private", "void", "prepareExtensions", "(", ")", "throws", "MojoExecutionException", "{", "List", "<", "String", ">", "includes", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "JnlpExtension", "extension", ":", "jnlpExtensions", ")", "{", "// Chec...
Prepare extensions. <p> Copy all includes of all extensions as to be excluded. @throws MojoExecutionException if could not prepare extensions
[ "Prepare", "extensions", ".", "<p", ">", "Copy", "all", "includes", "of", "all", "extensions", "as", "to", "be", "excluded", "." ]
train
https://github.com/mojohaus/webstart/blob/38fdd1d21f063f21716cfcd61ebeabd963487576/webstart-maven-plugin/src/main/java/org/codehaus/mojo/webstart/AbstractJnlpMojo.java#L887-L923
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201902/adjustmentservice/GetAllTrafficAdjustments.java
GetAllTrafficAdjustments.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the AdjustmentService. AdjustmentServiceInterface adjustmentService = adManagerServices.get(session, AdjustmentServiceInterface.class); // Create a statement to get all forecast adjustments. StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get forecast adjustments by statement. TrafficForecastAdjustmentPage page = adjustmentService.getTrafficAdjustmentsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (TrafficForecastAdjustment adjustment : page.getResults()) { System.out.printf( "%d) Forecast adjustment with ID %d containing %d adjustment segments was found.%n", i++, adjustment.getId(), adjustment.getForecastAdjustmentSegments() != null ? adjustment.getForecastAdjustmentSegments().length : 0); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the AdjustmentService. AdjustmentServiceInterface adjustmentService = adManagerServices.get(session, AdjustmentServiceInterface.class); // Create a statement to get all forecast adjustments. StatementBuilder statementBuilder = new StatementBuilder().orderBy("id ASC").limit(StatementBuilder.SUGGESTED_PAGE_LIMIT); // Default for total result set size. int totalResultSetSize = 0; do { // Get forecast adjustments by statement. TrafficForecastAdjustmentPage page = adjustmentService.getTrafficAdjustmentsByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (TrafficForecastAdjustment adjustment : page.getResults()) { System.out.printf( "%d) Forecast adjustment with ID %d containing %d adjustment segments was found.%n", i++, adjustment.getId(), adjustment.getForecastAdjustmentSegments() != null ? adjustment.getForecastAdjustmentSegments().length : 0); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "// Get the AdjustmentService.", "AdjustmentServiceInterface", "adjustmentService", "=", "adManagerServices", ".",...
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201902/adjustmentservice/GetAllTrafficAdjustments.java#L51-L87
m-m-m/util
nls/src/main/java/net/sf/mmm/util/nls/base/AbstractNlsFormatterManager.java
AbstractNlsFormatterManager.getSubFormatter
protected NlsFormatterPlugin<?> getSubFormatter(String formatType, CharSequenceScanner scanner) { String formatStyle = scanner.readWhile(NO_EXPRESSION); return getFormatter(formatType, formatStyle); }
java
protected NlsFormatterPlugin<?> getSubFormatter(String formatType, CharSequenceScanner scanner) { String formatStyle = scanner.readWhile(NO_EXPRESSION); return getFormatter(formatType, formatStyle); }
[ "protected", "NlsFormatterPlugin", "<", "?", ">", "getSubFormatter", "(", "String", "formatType", ",", "CharSequenceScanner", "scanner", ")", "{", "String", "formatStyle", "=", "scanner", ".", "readWhile", "(", "NO_EXPRESSION", ")", ";", "return", "getFormatter", ...
This method is like {@link #getFormatter(String, String)} but reads the {@link AbstractNlsFormatterPlugin#getStyle() style} from the given scanner. @param formatType is the type to be formatted. @param scanner is the current {@link CharSequenceScanner} for parsing the style defining details of formatting. @return the according {@link NlsFormatter}.
[ "This", "method", "is", "like", "{", "@link", "#getFormatter", "(", "String", "String", ")", "}", "but", "reads", "the", "{", "@link", "AbstractNlsFormatterPlugin#getStyle", "()", "style", "}", "from", "the", "given", "scanner", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/nls/src/main/java/net/sf/mmm/util/nls/base/AbstractNlsFormatterManager.java#L130-L134
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.copyObject
public void copyObject(String bucketName, String objectName, String destBucketName) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, InvalidArgumentException { copyObject(bucketName, objectName, destBucketName, null, null, null); }
java
public void copyObject(String bucketName, String objectName, String destBucketName) throws InvalidKeyException, InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, NoResponseException, ErrorResponseException, InternalException, IOException, XmlPullParserException, InvalidArgumentException { copyObject(bucketName, objectName, destBucketName, null, null, null); }
[ "public", "void", "copyObject", "(", "String", "bucketName", ",", "String", "objectName", ",", "String", "destBucketName", ")", "throws", "InvalidKeyException", ",", "InvalidBucketNameException", ",", "NoSuchAlgorithmException", ",", "InsufficientDataException", ",", "NoR...
Copy a source object into a new destination object with same object name. </p> <b>Example:</b><br> <pre> {@code minioClient.copyObject("my-bucketname", "my-objectname", "my-destbucketname");} </pre> @param bucketName Bucket name where the object to be copied exists. @param objectName Object name source to be copied. @param destBucketName Bucket name where the object will be copied to. @throws InvalidKeyException upon an invalid access key or secret key @throws InvalidBucketNameException upon invalid bucket name is given @throws NoSuchAlgorithmException upon requested algorithm was not found during signature calculation @throws InsufficientDataException upon getting EOFException while reading given InputStream even before reading given length @throws NoResponseException upon no response from server @throws ErrorResponseException upon unsuccessful execution @throws InternalException upon internal library error @throws IOException upon connection error @throws XmlPullParserException upon parsing response xml @throws InvalidArgumentException upon invalid value is passed to a method.
[ "Copy", "a", "source", "object", "into", "a", "new", "destination", "object", "with", "same", "object", "name", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L2008-L2014
eclipse/hawkbit
hawkbit-security-core/src/main/java/org/eclipse/hawkbit/util/IpUtil.java
IpUtil.getClientIpFromRequest
public static URI getClientIpFromRequest(final HttpServletRequest request, final HawkbitSecurityProperties securityProperties) { return getClientIpFromRequest(request, securityProperties.getClients().getRemoteIpHeader(), securityProperties.getClients().isTrackRemoteIp()); }
java
public static URI getClientIpFromRequest(final HttpServletRequest request, final HawkbitSecurityProperties securityProperties) { return getClientIpFromRequest(request, securityProperties.getClients().getRemoteIpHeader(), securityProperties.getClients().isTrackRemoteIp()); }
[ "public", "static", "URI", "getClientIpFromRequest", "(", "final", "HttpServletRequest", "request", ",", "final", "HawkbitSecurityProperties", "securityProperties", ")", "{", "return", "getClientIpFromRequest", "(", "request", ",", "securityProperties", ".", "getClients", ...
Retrieves the string based IP address from a given {@link HttpServletRequest} by either the {@link HttpHeaders#X_FORWARDED_FOR} or by the {@link HttpServletRequest#getRemoteAddr()} methods. @param request the {@link HttpServletRequest} to determine the IP address where this request has been sent from @param securityProperties hawkBit security properties. @return the {@link URI} based IP address from the client which sent the request
[ "Retrieves", "the", "string", "based", "IP", "address", "from", "a", "given", "{", "@link", "HttpServletRequest", "}", "by", "either", "the", "{", "@link", "HttpHeaders#X_FORWARDED_FOR", "}", "or", "by", "the", "{", "@link", "HttpServletRequest#getRemoteAddr", "()...
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-security-core/src/main/java/org/eclipse/hawkbit/util/IpUtil.java#L56-L61
jMetal/jMetal
jmetal-exec/src/main/java/org/uma/jmetal/runner/multiobjective/SMPSORPWithOneReferencePointRunner.java
SMPSORPWithOneReferencePointRunner.main
public static void main(String[] args) throws JMetalException { DoubleProblem problem; Algorithm<List<DoubleSolution>> algorithm; MutationOperator<DoubleSolution> mutation; String problemName; if (args.length == 1) { problemName = args[0]; } else { problemName = "org.uma.jmetal.problem.multiobjective.zdt.ZDT1"; } problem = (DoubleProblem) ProblemUtils.<DoubleSolution>loadProblem(problemName); List<List<Double>> referencePoints; referencePoints = new ArrayList<>(); referencePoints.add(Arrays.asList(0.2, 0.8)); double mutationProbability = 1.0 / problem.getNumberOfVariables(); double mutationDistributionIndex = 20.0; mutation = new PolynomialMutation(mutationProbability, mutationDistributionIndex); int maxIterations = 250; int swarmSize = 100; List<ArchiveWithReferencePoint<DoubleSolution>> archivesWithReferencePoints = new ArrayList<>(); for (int i = 0; i < referencePoints.size(); i++) { archivesWithReferencePoints.add( new CrowdingDistanceArchiveWithReferencePoint<DoubleSolution>( swarmSize / referencePoints.size(), referencePoints.get(i))); } algorithm = new SMPSORP(problem, swarmSize, archivesWithReferencePoints, referencePoints, mutation, maxIterations, 0.0, 1.0, 0.0, 1.0, 2.5, 1.5, 2.5, 1.5, 0.1, 0.1, -1.0, -1.0, new SequentialSolutionListEvaluator<>()); AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm) .execute(); List<DoubleSolution> population = algorithm.getResult(); long computingTime = algorithmRunner.getComputingTime(); JMetalLogger.logger.info("Total execution time: " + computingTime + "ms"); new SolutionListOutput(population) .setSeparator("\t") .setVarFileOutputContext(new DefaultFileOutputContext("VAR.tsv")) .setFunFileOutputContext(new DefaultFileOutputContext("FUN.tsv")) .print(); System.exit(0); }
java
public static void main(String[] args) throws JMetalException { DoubleProblem problem; Algorithm<List<DoubleSolution>> algorithm; MutationOperator<DoubleSolution> mutation; String problemName; if (args.length == 1) { problemName = args[0]; } else { problemName = "org.uma.jmetal.problem.multiobjective.zdt.ZDT1"; } problem = (DoubleProblem) ProblemUtils.<DoubleSolution>loadProblem(problemName); List<List<Double>> referencePoints; referencePoints = new ArrayList<>(); referencePoints.add(Arrays.asList(0.2, 0.8)); double mutationProbability = 1.0 / problem.getNumberOfVariables(); double mutationDistributionIndex = 20.0; mutation = new PolynomialMutation(mutationProbability, mutationDistributionIndex); int maxIterations = 250; int swarmSize = 100; List<ArchiveWithReferencePoint<DoubleSolution>> archivesWithReferencePoints = new ArrayList<>(); for (int i = 0; i < referencePoints.size(); i++) { archivesWithReferencePoints.add( new CrowdingDistanceArchiveWithReferencePoint<DoubleSolution>( swarmSize / referencePoints.size(), referencePoints.get(i))); } algorithm = new SMPSORP(problem, swarmSize, archivesWithReferencePoints, referencePoints, mutation, maxIterations, 0.0, 1.0, 0.0, 1.0, 2.5, 1.5, 2.5, 1.5, 0.1, 0.1, -1.0, -1.0, new SequentialSolutionListEvaluator<>()); AlgorithmRunner algorithmRunner = new AlgorithmRunner.Executor(algorithm) .execute(); List<DoubleSolution> population = algorithm.getResult(); long computingTime = algorithmRunner.getComputingTime(); JMetalLogger.logger.info("Total execution time: " + computingTime + "ms"); new SolutionListOutput(population) .setSeparator("\t") .setVarFileOutputContext(new DefaultFileOutputContext("VAR.tsv")) .setFunFileOutputContext(new DefaultFileOutputContext("FUN.tsv")) .print(); System.exit(0); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "JMetalException", "{", "DoubleProblem", "problem", ";", "Algorithm", "<", "List", "<", "DoubleSolution", ">", ">", "algorithm", ";", "MutationOperator", "<", "DoubleSolution", ...
Program to run the SMPSORP algorithm with one reference point. SMPSORP is described in "Extending the Speed-constrained Multi-Objective PSO (SMPSO) With Reference Point Based Preference * Articulation. Antonio J. Nebro, Juan J. Durillo, José García-Nieto, Cristóbal Barba-González, * Javier Del Ser, Carlos A. Coello Coello, Antonio Benítez-Hidalgo, José F. Aldana-Montes. * Parallel Problem Solving from Nature -- PPSN XV. Lecture Notes In Computer Science, Vol. 11101, * pp. 298-310. 2018 @author Antonio J. Nebro
[ "Program", "to", "run", "the", "SMPSORP", "algorithm", "with", "one", "reference", "point", ".", "SMPSORP", "is", "described", "in", "Extending", "the", "Speed", "-", "constrained", "Multi", "-", "Objective", "PSO", "(", "SMPSO", ")", "With", "Reference", "P...
train
https://github.com/jMetal/jMetal/blob/bc981e6aede275d26c5216c9a01227d9675b0cf7/jmetal-exec/src/main/java/org/uma/jmetal/runner/multiobjective/SMPSORPWithOneReferencePointRunner.java#L34-L95
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDate.java
LocalDate.withYear
public LocalDate withYear(int year) { if (this.year == year) { return this; } YEAR.checkValidValue(year); return resolvePreviousValid(year, month, day); }
java
public LocalDate withYear(int year) { if (this.year == year) { return this; } YEAR.checkValidValue(year); return resolvePreviousValid(year, month, day); }
[ "public", "LocalDate", "withYear", "(", "int", "year", ")", "{", "if", "(", "this", ".", "year", "==", "year", ")", "{", "return", "this", ";", "}", "YEAR", ".", "checkValidValue", "(", "year", ")", ";", "return", "resolvePreviousValid", "(", "year", "...
Returns a copy of this {@code LocalDate} with the year altered. <p> If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. <p> This instance is immutable and unaffected by this method call. @param year the year to set in the result, from MIN_YEAR to MAX_YEAR @return a {@code LocalDate} based on this date with the requested year, not null @throws DateTimeException if the year value is invalid
[ "Returns", "a", "copy", "of", "this", "{", "@code", "LocalDate", "}", "with", "the", "year", "altered", ".", "<p", ">", "If", "the", "day", "-", "of", "-", "month", "is", "invalid", "for", "the", "year", "it", "will", "be", "changed", "to", "the", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDate.java#L1050-L1056
gilberto-torrezan/gwt-views
src/main/java/com/github/gilbertotorrezan/gwtviews/client/URLToken.java
URLToken.getParameterAsDouble
public double getParameterAsDouble(String name, double defaultValue){ String value = parameters.get(name); if (value == null || value.isEmpty()){ return defaultValue; } try { return Double.parseDouble(value); } catch (Exception e) { return defaultValue; } }
java
public double getParameterAsDouble(String name, double defaultValue){ String value = parameters.get(name); if (value == null || value.isEmpty()){ return defaultValue; } try { return Double.parseDouble(value); } catch (Exception e) { return defaultValue; } }
[ "public", "double", "getParameterAsDouble", "(", "String", "name", ",", "double", "defaultValue", ")", "{", "String", "value", "=", "parameters", ".", "get", "(", "name", ")", ";", "if", "(", "value", "==", "null", "||", "value", ".", "isEmpty", "(", ")"...
Gets a double parameter extracted from the History token. For example, if the token is: <pre>{@code tokenId&param1=0.1 }</pre>the call to <code>getParameterAsBoolean("param1", 0)</code> will return <code>0.1</code>. @param name The name of the parameter @param defaultValue The value to be returned when the parameter is <code>null</code> or not parseable to double @return The boolean value of the parameter, or <code>defaultValue</code> if not parseable. When the token is something like <pre>{@code tokenId&param1&param2 }</pre> with a name without a explicit value, the default value is returned.
[ "Gets", "a", "double", "parameter", "extracted", "from", "the", "History", "token", ".", "For", "example", "if", "the", "token", "is", ":", "<pre", ">", "{", "@code", "tokenId&param1", "=", "0", ".", "1", "}", "<", "/", "pre", ">", "the", "call", "to...
train
https://github.com/gilberto-torrezan/gwt-views/blob/c6511435d14b5aa93a722b0e861230d0ae2159e5/src/main/java/com/github/gilbertotorrezan/gwtviews/client/URLToken.java#L251-L261
versionone/VersionOne.SDK.Java.ObjectModel
src/main/java/com/versionone/om/V1InstanceCreator.java
V1InstanceCreator.changeSet
public ChangeSet changeSet(String name, String reference) { return changeSet(name, reference, null); }
java
public ChangeSet changeSet(String name, String reference) { return changeSet(name, reference, null); }
[ "public", "ChangeSet", "changeSet", "(", "String", "name", ",", "String", "reference", ")", "{", "return", "changeSet", "(", "name", ",", "reference", ",", "null", ")", ";", "}" ]
Create a new ChangeSet with a name and reference. @param name Initial name. @param reference Reference value. @return A newly minted ChangeSet that exists in the VersionOne system.
[ "Create", "a", "new", "ChangeSet", "with", "a", "name", "and", "reference", "." ]
train
https://github.com/versionone/VersionOne.SDK.Java.ObjectModel/blob/59d35b67c849299631bca45ee94143237eb2ae1a/src/main/java/com/versionone/om/V1InstanceCreator.java#L929-L931
davidcarboni/cryptolite-java
src/main/java/com/github/davidcarboni/cryptolite/Crypto.java
Crypto.initCipher
private void initCipher(Cipher cipher, int mode, SecretKey key, byte[] iv) { // Initialise the cipher: IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); try { cipher.init(mode, key, ivParameterSpec); } catch (InvalidKeyException e) { // This is likely to be an invalid key size, so explain what just happened and signpost how to fix it. String message; if (StringUtils.containsIgnoreCase(e.getMessage(), "illegal key size")) { message = "It looks like your JVM doesn't allow you to use strong 256-bit AES keys. " + "You can "; } else { message = "Invalid key for " + CIPHER_NAME + ". NB: If the root cause of this exception is an Illegal key size, " + "you can "; } throw new IllegalArgumentException(message + "either use Keys.useStandardKeys() to limit key size to 128-bits, or install the " + "'Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files' " + "in your JVM to use 256-bit keys.", e); } catch (InvalidAlgorithmParameterException e) { throw new IllegalArgumentException( "Invalid parameter passed to initialise cipher for encryption: zero IvParameterSpec containing " + cipher.getBlockSize() + " bytes.", e); } }
java
private void initCipher(Cipher cipher, int mode, SecretKey key, byte[] iv) { // Initialise the cipher: IvParameterSpec ivParameterSpec = new IvParameterSpec(iv); try { cipher.init(mode, key, ivParameterSpec); } catch (InvalidKeyException e) { // This is likely to be an invalid key size, so explain what just happened and signpost how to fix it. String message; if (StringUtils.containsIgnoreCase(e.getMessage(), "illegal key size")) { message = "It looks like your JVM doesn't allow you to use strong 256-bit AES keys. " + "You can "; } else { message = "Invalid key for " + CIPHER_NAME + ". NB: If the root cause of this exception is an Illegal key size, " + "you can "; } throw new IllegalArgumentException(message + "either use Keys.useStandardKeys() to limit key size to 128-bits, or install the " + "'Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files' " + "in your JVM to use 256-bit keys.", e); } catch (InvalidAlgorithmParameterException e) { throw new IllegalArgumentException( "Invalid parameter passed to initialise cipher for encryption: zero IvParameterSpec containing " + cipher.getBlockSize() + " bytes.", e); } }
[ "private", "void", "initCipher", "(", "Cipher", "cipher", ",", "int", "mode", ",", "SecretKey", "key", ",", "byte", "[", "]", "iv", ")", "{", "// Initialise the cipher:\r", "IvParameterSpec", "ivParameterSpec", "=", "new", "IvParameterSpec", "(", "iv", ")", ";...
This method returns a {@link Cipher} instance, for {@value #CIPHER_ALGORITHM} in {@value #CIPHER_MODE} mode, with padding {@value #CIPHER_PADDING}. <p> It then initialises the {@link Cipher} in either {@link Cipher#ENCRYPT_MODE} or {@link Cipher#DECRYPT_MODE}), as specified by the mode parameter, with the given {@link SecretKey}. @param mode One of {@link Cipher#ENCRYPT_MODE} or {@link Cipher#DECRYPT_MODE}). @param key The {@link SecretKey} to be used with the {@link Cipher}. @param iv The initialisation vector to use. @throws IllegalArgumentException If the given key is not a valid {@value #CIPHER_ALGORITHM} key.
[ "This", "method", "returns", "a", "{", "@link", "Cipher", "}", "instance", "for", "{", "@value", "#CIPHER_ALGORITHM", "}", "in", "{", "@value", "#CIPHER_MODE", "}", "mode", "with", "padding", "{", "@value", "#CIPHER_PADDING", "}", ".", "<p", ">", "It", "th...
train
https://github.com/davidcarboni/cryptolite-java/blob/e67954181a04ffc9beb1d9abca1421195fcf9764/src/main/java/com/github/davidcarboni/cryptolite/Crypto.java#L626-L651
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java
AllClassesFrameWriter.addContents
protected void addContents(Iterable<? extends Element> classlist, boolean wantFrames, Content content) { for (Element element : classlist) { TypeElement typeElement = (TypeElement)element; if (!utils.isCoreClass(typeElement)) { continue; } Content label = interfaceName(typeElement, false); Content linkContent; if (wantFrames) { linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.ALL_CLASSES_FRAME, typeElement).label(label).target("classFrame")); } else { linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, typeElement).label(label)); } Content li = HtmlTree.LI(linkContent); content.addContent(li); } }
java
protected void addContents(Iterable<? extends Element> classlist, boolean wantFrames, Content content) { for (Element element : classlist) { TypeElement typeElement = (TypeElement)element; if (!utils.isCoreClass(typeElement)) { continue; } Content label = interfaceName(typeElement, false); Content linkContent; if (wantFrames) { linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.ALL_CLASSES_FRAME, typeElement).label(label).target("classFrame")); } else { linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, typeElement).label(label)); } Content li = HtmlTree.LI(linkContent); content.addContent(li); } }
[ "protected", "void", "addContents", "(", "Iterable", "<", "?", "extends", "Element", ">", "classlist", ",", "boolean", "wantFrames", ",", "Content", "content", ")", "{", "for", "(", "Element", "element", ":", "classlist", ")", "{", "TypeElement", "typeElement"...
Given a list of classes, generate links for each class or interface. If the class kind is interface, print it in the italics font. Also all links should target the right-hand frame. If clicked on any class name in this page, appropriate class page should get opened in the right-hand frame. @param classlist Sorted list of classes. @param wantFrames True if we want frames. @param content HtmlTree content to which the links will be added
[ "Given", "a", "list", "of", "classes", "generate", "links", "for", "each", "class", "or", "interface", ".", "If", "the", "class", "kind", "is", "interface", "print", "it", "in", "the", "italics", "font", ".", "Also", "all", "links", "should", "target", "...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/AllClassesFrameWriter.java#L154-L172
apache/incubator-atlas
client/src/main/java/org/apache/atlas/AtlasClient.java
AtlasClient.getEntity
public Referenceable getEntity(String guid) throws AtlasServiceException { JSONObject jsonResponse = callAPIWithBodyAndParams(API.GET_ENTITY, null, guid); try { String entityInstanceDefinition = jsonResponse.getString(AtlasClient.DEFINITION); return InstanceSerialization.fromJsonReferenceable(entityInstanceDefinition, true); } catch (JSONException e) { throw new AtlasServiceException(API.GET_ENTITY, e); } }
java
public Referenceable getEntity(String guid) throws AtlasServiceException { JSONObject jsonResponse = callAPIWithBodyAndParams(API.GET_ENTITY, null, guid); try { String entityInstanceDefinition = jsonResponse.getString(AtlasClient.DEFINITION); return InstanceSerialization.fromJsonReferenceable(entityInstanceDefinition, true); } catch (JSONException e) { throw new AtlasServiceException(API.GET_ENTITY, e); } }
[ "public", "Referenceable", "getEntity", "(", "String", "guid", ")", "throws", "AtlasServiceException", "{", "JSONObject", "jsonResponse", "=", "callAPIWithBodyAndParams", "(", "API", ".", "GET_ENTITY", ",", "null", ",", "guid", ")", ";", "try", "{", "String", "e...
Get an entity given the entity id @param guid entity id @return result object @throws AtlasServiceException
[ "Get", "an", "entity", "given", "the", "entity", "id" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/client/src/main/java/org/apache/atlas/AtlasClient.java#L637-L645
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/serialize/SerializerUtils.java
SerializerUtils.addAttributes
public static void addAttributes(SerializationHandler handler, int src) throws TransformerException { TransformerImpl transformer = (TransformerImpl) handler.getTransformer(); DTM dtm = transformer.getXPathContext().getDTM(src); for (int node = dtm.getFirstAttribute(src); DTM.NULL != node; node = dtm.getNextAttribute(node)) { addAttribute(handler, node); } }
java
public static void addAttributes(SerializationHandler handler, int src) throws TransformerException { TransformerImpl transformer = (TransformerImpl) handler.getTransformer(); DTM dtm = transformer.getXPathContext().getDTM(src); for (int node = dtm.getFirstAttribute(src); DTM.NULL != node; node = dtm.getNextAttribute(node)) { addAttribute(handler, node); } }
[ "public", "static", "void", "addAttributes", "(", "SerializationHandler", "handler", ",", "int", "src", ")", "throws", "TransformerException", "{", "TransformerImpl", "transformer", "=", "(", "TransformerImpl", ")", "handler", ".", "getTransformer", "(", ")", ";", ...
Copy DOM attributes to the result element. @param src Source node with the attributes @throws TransformerException
[ "Copy", "DOM", "attributes", "to", "the", "result", "element", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/serialize/SerializerUtils.java#L93-L107
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.deleteSecretAsync
public Observable<DeletedSecretBundle> deleteSecretAsync(String vaultBaseUrl, String secretName) { return deleteSecretWithServiceResponseAsync(vaultBaseUrl, secretName).map(new Func1<ServiceResponse<DeletedSecretBundle>, DeletedSecretBundle>() { @Override public DeletedSecretBundle call(ServiceResponse<DeletedSecretBundle> response) { return response.body(); } }); }
java
public Observable<DeletedSecretBundle> deleteSecretAsync(String vaultBaseUrl, String secretName) { return deleteSecretWithServiceResponseAsync(vaultBaseUrl, secretName).map(new Func1<ServiceResponse<DeletedSecretBundle>, DeletedSecretBundle>() { @Override public DeletedSecretBundle call(ServiceResponse<DeletedSecretBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DeletedSecretBundle", ">", "deleteSecretAsync", "(", "String", "vaultBaseUrl", ",", "String", "secretName", ")", "{", "return", "deleteSecretWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "secretName", ")", ".", "map", "(", "new", ...
Deletes a secret from a specified key vault. The DELETE operation applies to any secret stored in Azure Key Vault. DELETE cannot be applied to an individual version of a secret. This operation requires the secrets/delete permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DeletedSecretBundle object
[ "Deletes", "a", "secret", "from", "a", "specified", "key", "vault", ".", "The", "DELETE", "operation", "applies", "to", "any", "secret", "stored", "in", "Azure", "Key", "Vault", ".", "DELETE", "cannot", "be", "applied", "to", "an", "individual", "version", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3558-L3565
udoprog/ffwd-client-java
src/main/java/eu/toolchain/ffwd/FastForward.java
FastForward.setup
public static FastForward setup(InetAddress addr, int port) throws SocketException { final DatagramSocket socket = new DatagramSocket(); return new FastForward(addr, port, socket); }
java
public static FastForward setup(InetAddress addr, int port) throws SocketException { final DatagramSocket socket = new DatagramSocket(); return new FastForward(addr, port, socket); }
[ "public", "static", "FastForward", "setup", "(", "InetAddress", "addr", ",", "int", "port", ")", "throws", "SocketException", "{", "final", "DatagramSocket", "socket", "=", "new", "DatagramSocket", "(", ")", ";", "return", "new", "FastForward", "(", "addr", ",...
Initialization method for a FastForward client. @return A new instance of a FastForward client. @throws SocketException If a datagram socket cannot be created.
[ "Initialization", "method", "for", "a", "FastForward", "client", "." ]
train
https://github.com/udoprog/ffwd-client-java/blob/b4161d2b138e3edb8fa9420cc3cc653d5764cf5b/src/main/java/eu/toolchain/ffwd/FastForward.java#L40-L43
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContent.java
CmsXmlContent.ensureParentValues
private void ensureParentValues(CmsObject cms, String valuePath, Locale locale) { if (valuePath.contains("/")) { String parentPath = valuePath.substring(0, valuePath.lastIndexOf("/")); if (!hasValue(parentPath, locale)) { ensureParentValues(cms, parentPath, locale); int index = CmsXmlUtils.getXpathIndexInt(parentPath) - 1; addValue(cms, parentPath, locale, index); } } }
java
private void ensureParentValues(CmsObject cms, String valuePath, Locale locale) { if (valuePath.contains("/")) { String parentPath = valuePath.substring(0, valuePath.lastIndexOf("/")); if (!hasValue(parentPath, locale)) { ensureParentValues(cms, parentPath, locale); int index = CmsXmlUtils.getXpathIndexInt(parentPath) - 1; addValue(cms, parentPath, locale, index); } } }
[ "private", "void", "ensureParentValues", "(", "CmsObject", "cms", ",", "String", "valuePath", ",", "Locale", "locale", ")", "{", "if", "(", "valuePath", ".", "contains", "(", "\"/\"", ")", ")", "{", "String", "parentPath", "=", "valuePath", ".", "substring",...
Ensures the parent values to the given path are created.<p> @param cms the cms context @param valuePath the value path @param locale the content locale
[ "Ensures", "the", "parent", "values", "to", "the", "given", "path", "are", "created", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContent.java#L1074-L1084
phax/ph-oton
ph-oton-security/src/main/java/com/helger/photon/security/login/LoggedInUserManager.java
LoggedInUserManager.loginUser
@Nonnull public ELoginResult loginUser (@Nullable final String sLoginName, @Nullable final String sPlainTextPassword, @Nullable final Iterable <String> aRequiredRoleIDs) { // Try to resolve the user final IUser aUser = PhotonSecurityManager.getUserMgr ().getUserOfLoginName (sLoginName); if (aUser == null) { AuditHelper.onAuditExecuteFailure ("login", sLoginName, "no-such-loginname"); return ELoginResult.USER_NOT_EXISTING; } return loginUser (aUser, sPlainTextPassword, aRequiredRoleIDs); }
java
@Nonnull public ELoginResult loginUser (@Nullable final String sLoginName, @Nullable final String sPlainTextPassword, @Nullable final Iterable <String> aRequiredRoleIDs) { // Try to resolve the user final IUser aUser = PhotonSecurityManager.getUserMgr ().getUserOfLoginName (sLoginName); if (aUser == null) { AuditHelper.onAuditExecuteFailure ("login", sLoginName, "no-such-loginname"); return ELoginResult.USER_NOT_EXISTING; } return loginUser (aUser, sPlainTextPassword, aRequiredRoleIDs); }
[ "@", "Nonnull", "public", "ELoginResult", "loginUser", "(", "@", "Nullable", "final", "String", "sLoginName", ",", "@", "Nullable", "final", "String", "sPlainTextPassword", ",", "@", "Nullable", "final", "Iterable", "<", "String", ">", "aRequiredRoleIDs", ")", "...
Login the passed user and require a set of certain roles, the used needs to have to login here. @param sLoginName Login name of the user to log-in. May be <code>null</code>. @param sPlainTextPassword Plain text password to use. May be <code>null</code>. @param aRequiredRoleIDs A set of required role IDs, the user needs to have. May be <code>null</code>. @return Never <code>null</code> login status.
[ "Login", "the", "passed", "user", "and", "require", "a", "set", "of", "certain", "roles", "the", "used", "needs", "to", "have", "to", "login", "here", "." ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-security/src/main/java/com/helger/photon/security/login/LoggedInUserManager.java#L335-L348
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.registry/src/com/ibm/ws/security/wim/registry/util/TypeMappings.java
TypeMappings.getInputMapping
@FFDCIgnore(Exception.class) private String getInputMapping(String inputVirtualRealm, String inputProperty, String inputDefaultProperty) { String methodName = "getInputMapping"; // initialize the return value String returnValue = null; RealmConfig realmConfig = mappingUtils.getCoreConfiguration().getRealmConfig(inputVirtualRealm); if (realmConfig != null) { try { returnValue = realmConfig.getURMapInputPropertyInRealm(inputProperty); if ((returnValue == null) || (returnValue.equals(""))) { returnValue = inputDefaultProperty; } } catch (Exception toCatch) { returnValue = inputDefaultProperty; if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " " + toCatch.getMessage(), toCatch); } } } else { returnValue = inputDefaultProperty; } return returnValue; }
java
@FFDCIgnore(Exception.class) private String getInputMapping(String inputVirtualRealm, String inputProperty, String inputDefaultProperty) { String methodName = "getInputMapping"; // initialize the return value String returnValue = null; RealmConfig realmConfig = mappingUtils.getCoreConfiguration().getRealmConfig(inputVirtualRealm); if (realmConfig != null) { try { returnValue = realmConfig.getURMapInputPropertyInRealm(inputProperty); if ((returnValue == null) || (returnValue.equals(""))) { returnValue = inputDefaultProperty; } } catch (Exception toCatch) { returnValue = inputDefaultProperty; if (tc.isDebugEnabled()) { Tr.debug(tc, methodName + " " + toCatch.getMessage(), toCatch); } } } else { returnValue = inputDefaultProperty; } return returnValue; }
[ "@", "FFDCIgnore", "(", "Exception", ".", "class", ")", "private", "String", "getInputMapping", "(", "String", "inputVirtualRealm", ",", "String", "inputProperty", ",", "String", "inputDefaultProperty", ")", "{", "String", "methodName", "=", "\"getInputMapping\"", "...
Get the WIM input property that maps to the UserRegistry input property. @param inputVirtualRealm Virtual realm to find the mappings. @param inputProperty String representing the input UserRegistry property. @return String representing the input WIM property. @pre inputVirtualRealm != null @pre inputVirtualRealm != empty @pre inputProperty != null @pre inputProperty != "" @pre inputDefaultProperty != null @pre inputDefaultProperty != "" @post $return != "" @post $return != null
[ "Get", "the", "WIM", "input", "property", "that", "maps", "to", "the", "UserRegistry", "input", "property", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.registry/src/com/ibm/ws/security/wim/registry/util/TypeMappings.java#L304-L327
SonarSource/sonarqube
sonar-core/src/main/java/org/sonar/core/util/Protobuf.java
Protobuf.read
public static <MSG extends Message> MSG read(File file, Parser<MSG> parser) { InputStream input = null; try { input = new BufferedInputStream(new FileInputStream(file)); return parser.parseFrom(input); } catch (Exception e) { throw ContextException.of("Unable to read message", e).addContext("file", file); } finally { IOUtils.closeQuietly(input); } }
java
public static <MSG extends Message> MSG read(File file, Parser<MSG> parser) { InputStream input = null; try { input = new BufferedInputStream(new FileInputStream(file)); return parser.parseFrom(input); } catch (Exception e) { throw ContextException.of("Unable to read message", e).addContext("file", file); } finally { IOUtils.closeQuietly(input); } }
[ "public", "static", "<", "MSG", "extends", "Message", ">", "MSG", "read", "(", "File", "file", ",", "Parser", "<", "MSG", ">", "parser", ")", "{", "InputStream", "input", "=", "null", ";", "try", "{", "input", "=", "new", "BufferedInputStream", "(", "n...
Returns the message contained in {@code file}. Throws an unchecked exception if the file does not exist, is empty or does not contain message with the expected type.
[ "Returns", "the", "message", "contained", "in", "{" ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/util/Protobuf.java#L47-L57
UrielCh/ovh-java-sdk
ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java
ApiOvhRouter.serviceName_privateLink_peerServiceName_GET
public OvhPrivateLink serviceName_privateLink_peerServiceName_GET(String serviceName, String peerServiceName) throws IOException { String qPath = "/router/{serviceName}/privateLink/{peerServiceName}"; StringBuilder sb = path(qPath, serviceName, peerServiceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrivateLink.class); }
java
public OvhPrivateLink serviceName_privateLink_peerServiceName_GET(String serviceName, String peerServiceName) throws IOException { String qPath = "/router/{serviceName}/privateLink/{peerServiceName}"; StringBuilder sb = path(qPath, serviceName, peerServiceName); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhPrivateLink.class); }
[ "public", "OvhPrivateLink", "serviceName_privateLink_peerServiceName_GET", "(", "String", "serviceName", ",", "String", "peerServiceName", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/router/{serviceName}/privateLink/{peerServiceName}\"", ";", "StringBuilder", ...
Get this object properties REST: GET /router/{serviceName}/privateLink/{peerServiceName} @param serviceName [required] The internal name of your Router offer @param peerServiceName [required] Service name of the other side of this link
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java#L316-L321
alkacon/opencms-core
src/org/opencms/db/CmsUserSettings.java
CmsUserSettings.getStartGallery
public String getStartGallery(String galleryType, CmsObject cms) { String startGallerySetting = getStartGallery(galleryType); String pathSetting = null; // if a custom path to the gallery is selected if ((startGallerySetting != null) && !startGallerySetting.equals(CmsWorkplace.INPUT_NONE)) { String sitePath = cms.getRequestContext().removeSiteRoot(startGallerySetting); if (cms.existsResource(sitePath)) { pathSetting = startGallerySetting; } else { pathSetting = CmsWorkplace.INPUT_DEFAULT; } // global default settings } else if (startGallerySetting == null) { pathSetting = CmsWorkplace.INPUT_DEFAULT; } return pathSetting; }
java
public String getStartGallery(String galleryType, CmsObject cms) { String startGallerySetting = getStartGallery(galleryType); String pathSetting = null; // if a custom path to the gallery is selected if ((startGallerySetting != null) && !startGallerySetting.equals(CmsWorkplace.INPUT_NONE)) { String sitePath = cms.getRequestContext().removeSiteRoot(startGallerySetting); if (cms.existsResource(sitePath)) { pathSetting = startGallerySetting; } else { pathSetting = CmsWorkplace.INPUT_DEFAULT; } // global default settings } else if (startGallerySetting == null) { pathSetting = CmsWorkplace.INPUT_DEFAULT; } return pathSetting; }
[ "public", "String", "getStartGallery", "(", "String", "galleryType", ",", "CmsObject", "cms", ")", "{", "String", "startGallerySetting", "=", "getStartGallery", "(", "galleryType", ")", ";", "String", "pathSetting", "=", "null", ";", "// if a custom path to the galler...
Returns the root site path to the start gallery of the user or the constant CmsPreferences.INPUT_DEFAULT.<p> @param galleryType the type of the gallery @param cms Cms object @return the root site path to the start gallery or the default key, null if "not set"
[ "Returns", "the", "root", "site", "path", "to", "the", "start", "gallery", "of", "the", "user", "or", "the", "constant", "CmsPreferences", ".", "INPUT_DEFAULT", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsUserSettings.java#L811-L829
haifengl/smile
plot/src/main/java/smile/plot/Graphics.java
Graphics.drawTextBaseRatio
public void drawTextBaseRatio(String label, double horizontalReference, double verticalReference, double[] coord) { drawTextBaseRatio(label, horizontalReference, verticalReference, 0.0, coord); }
java
public void drawTextBaseRatio(String label, double horizontalReference, double verticalReference, double[] coord) { drawTextBaseRatio(label, horizontalReference, verticalReference, 0.0, coord); }
[ "public", "void", "drawTextBaseRatio", "(", "String", "label", ",", "double", "horizontalReference", ",", "double", "verticalReference", ",", "double", "[", "]", "coord", ")", "{", "drawTextBaseRatio", "(", "label", ",", "horizontalReference", ",", "verticalReferenc...
Draw a string with given reference point. (0.5, 0.5) is center, (0, 0) is lower left, (0, 1) is upper left, etc. The logical coordinates are proportional to the base coordinates.
[ "Draw", "a", "string", "with", "given", "reference", "point", ".", "(", "0", ".", "5", "0", ".", "5", ")", "is", "center", "(", "0", "0", ")", "is", "lower", "left", "(", "0", "1", ")", "is", "upper", "left", "etc", ".", "The", "logical", "coor...
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/plot/Graphics.java#L264-L266
moparisthebest/beehive
beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java
TreeElement.updateName
protected void updateName(TreeElement parentNode, int index) { setName(getNodeName(parentNode, index)); TreeElement[] children = getChildren(); for (int i = 0; i < children.length; i++) { children[i].updateName(this, i); } }
java
protected void updateName(TreeElement parentNode, int index) { setName(getNodeName(parentNode, index)); TreeElement[] children = getChildren(); for (int i = 0; i < children.length; i++) { children[i].updateName(this, i); } }
[ "protected", "void", "updateName", "(", "TreeElement", "parentNode", ",", "int", "index", ")", "{", "setName", "(", "getNodeName", "(", "parentNode", ",", "index", ")", ")", ";", "TreeElement", "[", "]", "children", "=", "getChildren", "(", ")", ";", "for"...
This method will update the name of this node and all of the children node. The name of a node reflects it's position in the tree. @param parentNode The parent node of this node. @param index the index position of this node within the parent node.
[ "This", "method", "will", "update", "the", "name", "of", "this", "node", "and", "all", "of", "the", "children", "node", ".", "The", "name", "of", "a", "node", "reflects", "it", "s", "position", "in", "the", "tree", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/tree/TreeElement.java#L731-L738
pawelprazak/java-extended
guava/src/main/java/com/bluecatcode/common/io/Closeables.java
Closeables.closeableFrom
public static Closeable closeableFrom(@WillNotClose @Nullable final Statement statement) { return closeableFrom(statement, Statement::close); }
java
public static Closeable closeableFrom(@WillNotClose @Nullable final Statement statement) { return closeableFrom(statement, Statement::close); }
[ "public", "static", "Closeable", "closeableFrom", "(", "@", "WillNotClose", "@", "Nullable", "final", "Statement", "statement", ")", "{", "return", "closeableFrom", "(", "statement", ",", "Statement", "::", "close", ")", ";", "}" ]
Provides {@link Closeable} interface for {@link Statement} @param statement the statement to decorate @return a closeable decorated statement
[ "Provides", "{", "@link", "Closeable", "}", "interface", "for", "{", "@link", "Statement", "}" ]
train
https://github.com/pawelprazak/java-extended/blob/ce1a556a95cbbf7c950a03662938bc02622de69b/guava/src/main/java/com/bluecatcode/common/io/Closeables.java#L48-L50
alibaba/otter
shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java
ZkClientx.createPersistentSequential
public String createPersistentSequential(String path, Object data) throws ZkInterruptedException, IllegalArgumentException, ZkException, RuntimeException { return create(path, data, CreateMode.PERSISTENT_SEQUENTIAL); }
java
public String createPersistentSequential(String path, Object data) throws ZkInterruptedException, IllegalArgumentException, ZkException, RuntimeException { return create(path, data, CreateMode.PERSISTENT_SEQUENTIAL); }
[ "public", "String", "createPersistentSequential", "(", "String", "path", ",", "Object", "data", ")", "throws", "ZkInterruptedException", ",", "IllegalArgumentException", ",", "ZkException", ",", "RuntimeException", "{", "return", "create", "(", "path", ",", "data", ...
Create a persistent, sequental node. @param path @param data @return create node's path @throws ZkInterruptedException if operation was interrupted, or a required reconnection got interrupted @throws IllegalArgumentException if called from anything except the ZooKeeper event thread @throws ZkException if any ZooKeeper exception occurred @throws RuntimeException if any other exception occurs
[ "Create", "a", "persistent", "sequental", "node", "." ]
train
https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/shared/common/src/main/java/com/alibaba/otter/shared/common/utils/zookeeper/ZkClientx.java#L364-L368
Azure/azure-sdk-for-java
postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/ServerSecurityAlertPoliciesInner.java
ServerSecurityAlertPoliciesInner.beginCreateOrUpdateAsync
public Observable<ServerSecurityAlertPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerSecurityAlertPolicyInner>, ServerSecurityAlertPolicyInner>() { @Override public ServerSecurityAlertPolicyInner call(ServiceResponse<ServerSecurityAlertPolicyInner> response) { return response.body(); } }); }
java
public Observable<ServerSecurityAlertPolicyInner> beginCreateOrUpdateAsync(String resourceGroupName, String serverName, ServerSecurityAlertPolicyInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerSecurityAlertPolicyInner>, ServerSecurityAlertPolicyInner>() { @Override public ServerSecurityAlertPolicyInner call(ServiceResponse<ServerSecurityAlertPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerSecurityAlertPolicyInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "ServerSecurityAlertPolicyInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync",...
Creates or updates a threat detection policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param parameters The server security alert policy. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerSecurityAlertPolicyInner object
[ "Creates", "or", "updates", "a", "threat", "detection", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/postgresql/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/postgresql/v2017_12_01/implementation/ServerSecurityAlertPoliciesInner.java#L274-L281
OpenLiberty/open-liberty
dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/utils/URBridgeEntity.java
URBridgeEntity.getUniqueId
public String getUniqueId(boolean setAttr) throws Exception { String uniqueName = null; String uniqueId = null; if (entity.getIdentifier().isSet(uniqueIdProp)) { uniqueId = (String) entity.getIdentifier().get(uniqueIdProp); return uniqueId; } uniqueName = (String) entity.getIdentifier().get(securityNameProp); if ((uniqueId == null) && (uniqueName == null)) { throw new WIMApplicationException(WIMMessageKey.REQUIRED_IDENTIFIERS_MISSING, Tr.formatMessage(tc, WIMMessageKey.REQUIRED_IDENTIFIERS_MISSING)); } // Get the attribute value. If it's part of the DN we must strip it out. // ZZZZ uniqueName = stripRDN(uniqueName); uniqueId = getUniqueIdForEntity(uniqueName); if (setAttr) { // Set the attribute in the WIM entity. entity.getIdentifier().set(uniqueIdProp, uniqueId); } return uniqueId; }
java
public String getUniqueId(boolean setAttr) throws Exception { String uniqueName = null; String uniqueId = null; if (entity.getIdentifier().isSet(uniqueIdProp)) { uniqueId = (String) entity.getIdentifier().get(uniqueIdProp); return uniqueId; } uniqueName = (String) entity.getIdentifier().get(securityNameProp); if ((uniqueId == null) && (uniqueName == null)) { throw new WIMApplicationException(WIMMessageKey.REQUIRED_IDENTIFIERS_MISSING, Tr.formatMessage(tc, WIMMessageKey.REQUIRED_IDENTIFIERS_MISSING)); } // Get the attribute value. If it's part of the DN we must strip it out. // ZZZZ uniqueName = stripRDN(uniqueName); uniqueId = getUniqueIdForEntity(uniqueName); if (setAttr) { // Set the attribute in the WIM entity. entity.getIdentifier().set(uniqueIdProp, uniqueId); } return uniqueId; }
[ "public", "String", "getUniqueId", "(", "boolean", "setAttr", ")", "throws", "Exception", "{", "String", "uniqueName", "=", "null", ";", "String", "uniqueId", "=", "null", ";", "if", "(", "entity", ".", "getIdentifier", "(", ")", ".", "isSet", "(", "unique...
Returns the uniqueId of a user or a group. @param setAttr a boolean indicating whether to actually set the attribute in the entity or just perform a lookup. @return the user or group's uniqueId. @throws Exception identifier values are missing or the underlying registry threw an error.
[ "Returns", "the", "uniqueId", "of", "a", "user", "or", "a", "group", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.wim.core/src/com/ibm/ws/security/wim/adapter/urbridge/utils/URBridgeEntity.java#L206-L229
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsManagedConnectionFactoryImpl.java
JmsManagedConnectionFactoryImpl.instantiateConnection
JmsConnectionImpl instantiateConnection(JmsJcaConnection jcaConnection, Map<String, String> _passThruProps) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConnection", jcaConnection); JmsConnectionImpl jmsConnection = new JmsConnectionImpl(jcaConnection, isManaged(), _passThruProps); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConnection", jmsConnection); return jmsConnection; }
java
JmsConnectionImpl instantiateConnection(JmsJcaConnection jcaConnection, Map<String, String> _passThruProps) throws JMSException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "instantiateConnection", jcaConnection); JmsConnectionImpl jmsConnection = new JmsConnectionImpl(jcaConnection, isManaged(), _passThruProps); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "instantiateConnection", jmsConnection); return jmsConnection; }
[ "JmsConnectionImpl", "instantiateConnection", "(", "JmsJcaConnection", "jcaConnection", ",", "Map", "<", "String", ",", "String", ">", "_passThruProps", ")", "throws", "JMSException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc"...
This method is used to create a JMS Connection object.<p> This method is overriden by subclasses so that the appropriate connection type is returned whenever this method is called (e.g. from within createConnection()).
[ "This", "method", "is", "used", "to", "create", "a", "JMS", "Connection", "object", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsManagedConnectionFactoryImpl.java#L346-L353
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java
Parameters.getPositiveIntegerList
public List<Integer> getPositiveIntegerList(final String param) { return getList(param, new StringToInteger(), new IsPositive<Integer>(), "positive integer"); }
java
public List<Integer> getPositiveIntegerList(final String param) { return getList(param, new StringToInteger(), new IsPositive<Integer>(), "positive integer"); }
[ "public", "List", "<", "Integer", ">", "getPositiveIntegerList", "(", "final", "String", "param", ")", "{", "return", "getList", "(", "param", ",", "new", "StringToInteger", "(", ")", ",", "new", "IsPositive", "<", "Integer", ">", "(", ")", ",", "\"positiv...
Gets a parameter whose value is a (possibly empty) list of positive integers.
[ "Gets", "a", "parameter", "whose", "value", "is", "a", "(", "possibly", "empty", ")", "list", "of", "positive", "integers", "." ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L678-L681
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BaseField.java
BaseField.setupTablePopup
public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Rec record, int iQueryKeySeq, int iDisplayFieldSeq, boolean bIncludeBlankOption, boolean bIncludeFormButton) { String keyAreaName = null; if (iQueryKeySeq != -1) if (this.getRecord().getKeyArea(iQueryKeySeq) != null) keyAreaName = this.getRecord().getKeyArea(iQueryKeySeq).getKeyName(); String displayFieldName = null; if (iDisplayFieldSeq != -1) displayFieldName = record.getField(iDisplayFieldSeq).getFieldName(); return this.setupTablePopup(itsLocation, targetScreen, converter, iDisplayFieldDesc, record, keyAreaName, displayFieldName, bIncludeBlankOption, bIncludeFormButton); }
java
public ScreenComponent setupTablePopup(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, Rec record, int iQueryKeySeq, int iDisplayFieldSeq, boolean bIncludeBlankOption, boolean bIncludeFormButton) { String keyAreaName = null; if (iQueryKeySeq != -1) if (this.getRecord().getKeyArea(iQueryKeySeq) != null) keyAreaName = this.getRecord().getKeyArea(iQueryKeySeq).getKeyName(); String displayFieldName = null; if (iDisplayFieldSeq != -1) displayFieldName = record.getField(iDisplayFieldSeq).getFieldName(); return this.setupTablePopup(itsLocation, targetScreen, converter, iDisplayFieldDesc, record, keyAreaName, displayFieldName, bIncludeBlankOption, bIncludeFormButton); }
[ "public", "ScreenComponent", "setupTablePopup", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "Convert", "converter", ",", "int", "iDisplayFieldDesc", ",", "Rec", "record", ",", "int", "iQueryKeySeq", ",", "int", "iDisplayFieldSeq", ","...
Add a popup for the table tied to this field. Key must be the first and primary and only key. @param record Record to display in a popup @param iQueryKeySeq Order to display the record (-1 = Primary field) @param iDisplayFieldSeq Description field for the popup (-1 = second field) @param bIncludeBlankOption Include a blank option in the popup? @return Return the component or ScreenField that is created for this field.
[ "Add", "a", "popup", "for", "the", "table", "tied", "to", "this", "field", ".", "Key", "must", "be", "the", "first", "and", "primary", "and", "only", "key", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseField.java#L1206-L1216
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/GrailsHibernateQueryUtils.java
GrailsHibernateQueryUtils.addOrderPossiblyNested
private static void addOrderPossiblyNested(Criteria c, PersistentEntity entity, String sort, String order, boolean ignoreCase) { int firstDotPos = sort.indexOf("."); if (firstDotPos == -1) { addOrder(c, sort, order, ignoreCase); } else { // nested property String sortHead = sort.substring(0, firstDotPos); String sortTail = sort.substring(firstDotPos + 1); PersistentProperty property = entity.getPropertyByName(sortHead); if (property instanceof Embedded) { // embedded objects cannot reference entities (at time of writing), so no more recursion needed addOrder(c, sort, order, ignoreCase); } else if (property instanceof Association) { Association a = (Association) property; Criteria subCriteria = c.createCriteria(sortHead); PersistentEntity associatedEntity = a.getAssociatedEntity(); Class<?> propertyTargetClass = associatedEntity.getJavaClass(); cacheCriteriaByMapping(propertyTargetClass, subCriteria); addOrderPossiblyNested(subCriteria, associatedEntity, sortTail, order, ignoreCase); // Recurse on nested sort } } }
java
private static void addOrderPossiblyNested(Criteria c, PersistentEntity entity, String sort, String order, boolean ignoreCase) { int firstDotPos = sort.indexOf("."); if (firstDotPos == -1) { addOrder(c, sort, order, ignoreCase); } else { // nested property String sortHead = sort.substring(0, firstDotPos); String sortTail = sort.substring(firstDotPos + 1); PersistentProperty property = entity.getPropertyByName(sortHead); if (property instanceof Embedded) { // embedded objects cannot reference entities (at time of writing), so no more recursion needed addOrder(c, sort, order, ignoreCase); } else if (property instanceof Association) { Association a = (Association) property; Criteria subCriteria = c.createCriteria(sortHead); PersistentEntity associatedEntity = a.getAssociatedEntity(); Class<?> propertyTargetClass = associatedEntity.getJavaClass(); cacheCriteriaByMapping(propertyTargetClass, subCriteria); addOrderPossiblyNested(subCriteria, associatedEntity, sortTail, order, ignoreCase); // Recurse on nested sort } } }
[ "private", "static", "void", "addOrderPossiblyNested", "(", "Criteria", "c", ",", "PersistentEntity", "entity", ",", "String", "sort", ",", "String", "order", ",", "boolean", "ignoreCase", ")", "{", "int", "firstDotPos", "=", "sort", ".", "indexOf", "(", "\".\...
Add order to criteria, creating necessary subCriteria if nested sort property (ie. sort:'nested.property').
[ "Add", "order", "to", "criteria", "creating", "necessary", "subCriteria", "if", "nested", "sort", "property", "(", "ie", ".", "sort", ":", "nested", ".", "property", ")", "." ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/query/GrailsHibernateQueryUtils.java#L242-L262
alkacon/opencms-core
src/org/opencms/ui/apps/resourcetypes/CmsNewResourceTypeDialog.java
CmsNewResourceTypeDialog.addResourceToModule
private void addResourceToModule(String resourcePath, CmsModule module) { List<String> currentRessources = Lists.newArrayList(module.getResources()); for (String resource : currentRessources) { if (resourcePath.startsWith(resource)) { return; } } currentRessources.add(resourcePath); module.setResources(currentRessources); }
java
private void addResourceToModule(String resourcePath, CmsModule module) { List<String> currentRessources = Lists.newArrayList(module.getResources()); for (String resource : currentRessources) { if (resourcePath.startsWith(resource)) { return; } } currentRessources.add(resourcePath); module.setResources(currentRessources); }
[ "private", "void", "addResourceToModule", "(", "String", "resourcePath", ",", "CmsModule", "module", ")", "{", "List", "<", "String", ">", "currentRessources", "=", "Lists", ".", "newArrayList", "(", "module", ".", "getResources", "(", ")", ")", ";", "for", ...
Adds the given resource to the module if necessary.<p> @param resourcePath to be added @param module module
[ "Adds", "the", "given", "resource", "to", "the", "module", "if", "necessary", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/resourcetypes/CmsNewResourceTypeDialog.java#L530-L540
jnr/jnr-x86asm
src/main/java/jnr/x86asm/Asm.java
Asm.mmword_ptr
public static final Mem mmword_ptr(Register base, Register index, int shift, long disp) { return _ptr_build(base, index, shift, disp, SIZE_QWORD); }
java
public static final Mem mmword_ptr(Register base, Register index, int shift, long disp) { return _ptr_build(base, index, shift, disp, SIZE_QWORD); }
[ "public", "static", "final", "Mem", "mmword_ptr", "(", "Register", "base", ",", "Register", "index", ",", "int", "shift", ",", "long", "disp", ")", "{", "return", "_ptr_build", "(", "base", ",", "index", ",", "shift", ",", "disp", ",", "SIZE_QWORD", ")",...
Create mmword (8 Bytes) pointer operand). ! ! @note This constructor is provided only for convenience for mmx programming.
[ "Create", "mmword", "(", "8", "Bytes", ")", "pointer", "operand", ")", ".", "!", "!" ]
train
https://github.com/jnr/jnr-x86asm/blob/fdcf68fb3dae49e607a49e33399e3dad1ada5536/src/main/java/jnr/x86asm/Asm.java#L587-L589
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/alias/AliasFactory.java
AliasFactory.createAliasForExpr
@SuppressWarnings("unchecked") public <A> A createAliasForExpr(Class<A> cl, Expression<? extends A> expr) { try { return (A) proxyCache.get(Pair.<Class<?>, Expression<?>>of(cl, expr)); } catch (ExecutionException e) { throw new QueryException(e); } }
java
@SuppressWarnings("unchecked") public <A> A createAliasForExpr(Class<A> cl, Expression<? extends A> expr) { try { return (A) proxyCache.get(Pair.<Class<?>, Expression<?>>of(cl, expr)); } catch (ExecutionException e) { throw new QueryException(e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "A", ">", "A", "createAliasForExpr", "(", "Class", "<", "A", ">", "cl", ",", "Expression", "<", "?", "extends", "A", ">", "expr", ")", "{", "try", "{", "return", "(", "A", ")", "proxy...
Create an alias instance for the given class and Expression @param <A> @param cl type for alias @param expr underlying expression @return alias instance
[ "Create", "an", "alias", "instance", "for", "the", "given", "class", "and", "Expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/alias/AliasFactory.java#L79-L86
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Img.java
Img.getRemoteBufferedImage
@Override public BufferedImage getRemoteBufferedImage(){ DirectColorModel cm = new DirectColorModel(32, 0x00ff0000, // Red 0x0000ff00, // Green 0x000000ff, // Blue 0xff000000 // Alpha ); DataBufferInt buffer = new DataBufferInt(getData(), numValues()); WritableRaster raster = Raster.createPackedRaster(buffer, getWidth(), getHeight(), getWidth(), cm.getMasks(), null); BufferedImage bimg = new BufferedImage(cm, raster, false, null); return bimg; }
java
@Override public BufferedImage getRemoteBufferedImage(){ DirectColorModel cm = new DirectColorModel(32, 0x00ff0000, // Red 0x0000ff00, // Green 0x000000ff, // Blue 0xff000000 // Alpha ); DataBufferInt buffer = new DataBufferInt(getData(), numValues()); WritableRaster raster = Raster.createPackedRaster(buffer, getWidth(), getHeight(), getWidth(), cm.getMasks(), null); BufferedImage bimg = new BufferedImage(cm, raster, false, null); return bimg; }
[ "@", "Override", "public", "BufferedImage", "getRemoteBufferedImage", "(", ")", "{", "DirectColorModel", "cm", "=", "new", "DirectColorModel", "(", "32", ",", "0x00ff0000", ",", "// Red", "0x0000ff00", ",", "// Green", "0x000000ff", ",", "// Blue", "0xff000000", "...
Creates a BufferedImage that shares the data of this Img. Changes in this Img are reflected in the created BufferedImage and vice versa. The created BufferedImage uses an ARGB DirectColorModel with an underlying DataBufferInt (similar to {@link BufferedImage#TYPE_INT_ARGB}) @return BufferedImage sharing this Img's data. @see #createRemoteImg(BufferedImage) @see #toBufferedImage() @since 1.0
[ "Creates", "a", "BufferedImage", "that", "shares", "the", "data", "of", "this", "Img", ".", "Changes", "in", "this", "Img", "are", "reflected", "in", "the", "created", "BufferedImage", "and", "vice", "versa", ".", "The", "created", "BufferedImage", "uses", "...
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/Img.java#L513-L525
percolate/caffeine
caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java
ViewUtils.setText
public static void setText(Activity context, int field, String text) { View view = context.findViewById(field); if (view instanceof TextView) { ((TextView) view).setText(text); } else { Log.e("Caffeine", "ViewUtils.setText() given a field that is not a TextView"); } }
java
public static void setText(Activity context, int field, String text) { View view = context.findViewById(field); if (view instanceof TextView) { ((TextView) view).setText(text); } else { Log.e("Caffeine", "ViewUtils.setText() given a field that is not a TextView"); } }
[ "public", "static", "void", "setText", "(", "Activity", "context", ",", "int", "field", ",", "String", "text", ")", "{", "View", "view", "=", "context", ".", "findViewById", "(", "field", ")", ";", "if", "(", "view", "instanceof", "TextView", ")", "{", ...
Method used to set text for a TextView. @param context The current Context or Activity that this method is called from. @param field R.id.xxxx value for the text field. @param text Text to place in the text field.
[ "Method", "used", "to", "set", "text", "for", "a", "TextView", "." ]
train
https://github.com/percolate/caffeine/blob/e2265cab474a6397f4d75b1ed928c356a7b9672e/caffeine/src/main/java/com/percolate/caffeine/ViewUtils.java#L201-L208
unbescape/unbescape
src/main/java/org/unbescape/html/HtmlEscape.java
HtmlEscape.escapeHtml4
public static void escapeHtml4(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeHtml(text, offset, len, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT); }
java
public static void escapeHtml4(final char[] text, final int offset, final int len, final Writer writer) throws IOException { escapeHtml(text, offset, len, writer, HtmlEscapeType.HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL, HtmlEscapeLevel.LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeHtml4", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeHtml", "(", "text", ",", "offset", "...
<p> Perform an HTML 4 level 2 (result is ASCII) <strong>escape</strong> operation on a <tt>char[]</tt> input. </p> <p> <em>Level 2</em> means this method will escape: </p> <ul> <li>The five markup-significant characters: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt></li> <li>All non ASCII characters.</li> </ul> <p> This escape will be performed by replacing those chars by the corresponding HTML 4 Named Character References (e.g. <tt>'&amp;acute;'</tt>) when such NCR exists for the replaced character, and replacing by a decimal character reference (e.g. <tt>'&amp;#8345;'</tt>) when there there is no NCR for the replaced character. </p> <p> This method calls {@link #escapeHtml(char[], int, int, java.io.Writer, HtmlEscapeType, HtmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.html.HtmlEscapeType#HTML4_NAMED_REFERENCES_DEFAULT_TO_DECIMAL}</li> <li><tt>level</tt>: {@link org.unbescape.html.HtmlEscapeLevel#LEVEL_2_ALL_NON_ASCII_PLUS_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be escaped. @param offset the position in <tt>text</tt> at which the escape operation should start. @param len the number of characters in <tt>text</tt> that should be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "an", "HTML", "4", "level", "2", "(", "result", "is", "ASCII", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L957-L961
alkacon/opencms-core
src/org/opencms/ade/galleries/A_CmsTreeTabDataPreloader.java
A_CmsTreeTabDataPreloader.getCommonAncestorPath
private String getCommonAncestorPath(String rootPath1, String rootPath2) { if (rootPath1 == null) { return rootPath2; } if (rootPath2 == null) { return rootPath1; } rootPath1 = CmsStringUtil.joinPaths("/", rootPath1, "/"); rootPath2 = CmsStringUtil.joinPaths("/", rootPath2, "/"); int minLength = Math.min(rootPath1.length(), rootPath2.length()); int i; for (i = 0; i < minLength; i++) { char char1 = rootPath1.charAt(i); char char2 = rootPath2.charAt(i); if (char1 != char2) { break; } } String result = rootPath1.substring(0, i); if ("/".equals(result)) { return result; } int slashIndex = result.lastIndexOf('/'); result = result.substring(0, slashIndex); return result; }
java
private String getCommonAncestorPath(String rootPath1, String rootPath2) { if (rootPath1 == null) { return rootPath2; } if (rootPath2 == null) { return rootPath1; } rootPath1 = CmsStringUtil.joinPaths("/", rootPath1, "/"); rootPath2 = CmsStringUtil.joinPaths("/", rootPath2, "/"); int minLength = Math.min(rootPath1.length(), rootPath2.length()); int i; for (i = 0; i < minLength; i++) { char char1 = rootPath1.charAt(i); char char2 = rootPath2.charAt(i); if (char1 != char2) { break; } } String result = rootPath1.substring(0, i); if ("/".equals(result)) { return result; } int slashIndex = result.lastIndexOf('/'); result = result.substring(0, slashIndex); return result; }
[ "private", "String", "getCommonAncestorPath", "(", "String", "rootPath1", ",", "String", "rootPath2", ")", "{", "if", "(", "rootPath1", "==", "null", ")", "{", "return", "rootPath2", ";", "}", "if", "(", "rootPath2", "==", "null", ")", "{", "return", "root...
Gets the common ancestor of two paths.<p> @param rootPath1 the first path @param rootPath2 the second path @return the common ancestor path
[ "Gets", "the", "common", "ancestor", "of", "two", "paths", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/galleries/A_CmsTreeTabDataPreloader.java#L270-L296
codescape/bitvunit
bitvunit-core/src/main/java/de/codescape/bitvunit/util/html/HtmlPageUtil.java
HtmlPageUtil.toHtmlPage
public static HtmlPage toHtmlPage(InputStream inputStream) { try { return toHtmlPage(IOUtils.toString(inputStream)); } catch (IOException e) { throw new RuntimeException("Error creating HtmlPage from InputStream.", e); } }
java
public static HtmlPage toHtmlPage(InputStream inputStream) { try { return toHtmlPage(IOUtils.toString(inputStream)); } catch (IOException e) { throw new RuntimeException("Error creating HtmlPage from InputStream.", e); } }
[ "public", "static", "HtmlPage", "toHtmlPage", "(", "InputStream", "inputStream", ")", "{", "try", "{", "return", "toHtmlPage", "(", "IOUtils", ".", "toString", "(", "inputStream", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "ne...
Creates a {@link HtmlPage} from a given {@link InputStream} that reads the HTML code for that page. @param inputStream {@link InputStream} that reads the HTML code @return {@link HtmlPage} for this {@link InputStream}
[ "Creates", "a", "{", "@link", "HtmlPage", "}", "from", "a", "given", "{", "@link", "InputStream", "}", "that", "reads", "the", "HTML", "code", "for", "that", "page", "." ]
train
https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/util/html/HtmlPageUtil.java#L47-L53
dodie/scott
scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java
ScottClassTransformer.calculateTransformationParameters
private InstrumentationActions calculateTransformationParameters(byte[] classfileBuffer, Configuration configuration) { DiscoveryClassVisitor discoveryClassVisitor = new DiscoveryClassVisitor(configuration); new ClassReader(classfileBuffer).accept(discoveryClassVisitor, 0); return discoveryClassVisitor.getTransformationParameters().build(); }
java
private InstrumentationActions calculateTransformationParameters(byte[] classfileBuffer, Configuration configuration) { DiscoveryClassVisitor discoveryClassVisitor = new DiscoveryClassVisitor(configuration); new ClassReader(classfileBuffer).accept(discoveryClassVisitor, 0); return discoveryClassVisitor.getTransformationParameters().build(); }
[ "private", "InstrumentationActions", "calculateTransformationParameters", "(", "byte", "[", "]", "classfileBuffer", ",", "Configuration", "configuration", ")", "{", "DiscoveryClassVisitor", "discoveryClassVisitor", "=", "new", "DiscoveryClassVisitor", "(", "configuration", ")...
Based on the structure of the class and the supplied configuration, determine the concrete instrumentation actions for the class. @param classfileBuffer class to be analyzed @param configuration configuration settings @return instrumentation actions to be applied
[ "Based", "on", "the", "structure", "of", "the", "class", "and", "the", "supplied", "configuration", "determine", "the", "concrete", "instrumentation", "actions", "for", "the", "class", "." ]
train
https://github.com/dodie/scott/blob/fd6b492584d3ae7e072871ff2b094cce6041fc99/scott/src/main/java/hu/advancedweb/scott/instrumentation/transformation/ScottClassTransformer.java#L40-L44
facebook/SoLoader
java/com/facebook/soloader/SysUtil.java
SysUtil.findAbiScore
public static int findAbiScore(String[] supportedAbis, String abi) { for (int i = 0; i < supportedAbis.length; ++i) { if (supportedAbis[i] != null && abi.equals(supportedAbis[i])) { return i; } } return -1; }
java
public static int findAbiScore(String[] supportedAbis, String abi) { for (int i = 0; i < supportedAbis.length; ++i) { if (supportedAbis[i] != null && abi.equals(supportedAbis[i])) { return i; } } return -1; }
[ "public", "static", "int", "findAbiScore", "(", "String", "[", "]", "supportedAbis", ",", "String", "abi", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "supportedAbis", ".", "length", ";", "++", "i", ")", "{", "if", "(", "supportedAbis"...
Determine how preferred a given ABI is on this system. @param supportedAbis ABIs on this system @param abi ABI of a shared library we might want to unpack @return -1 if not supported or an integer, smaller being more preferred
[ "Determine", "how", "preferred", "a", "given", "ABI", "is", "on", "this", "system", "." ]
train
https://github.com/facebook/SoLoader/blob/263af31d2960b2c0d0afe79d80197165a543be86/java/com/facebook/soloader/SysUtil.java#L45-L53