repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
networknt/light-4j
resource/src/main/java/com/networknt/resource/ResourceHelpers.java
ResourceHelpers.addProvidersToPathHandler
public static void addProvidersToPathHandler(PathResourceProvider[] pathResourceProviders, PathHandler pathHandler) { """ Helper to add given PathResourceProviders to a PathHandler. @param pathResourceProviders List of instances of classes implementing PathResourceProvider. @param pathHandler The handler that will have these handlers added to it. """ if (pathResourceProviders != null && pathResourceProviders.length > 0) { for (PathResourceProvider pathResourceProvider : pathResourceProviders) { if (pathResourceProvider.isPrefixPath()) { pathHandler.addPrefixPath(pathResourceProvider.getPath(), new ResourceHandler(pathResourceProvider.getResourceManager())); } else { pathHandler.addExactPath(pathResourceProvider.getPath(), new ResourceHandler(pathResourceProvider.getResourceManager())); } } } }
java
public static void addProvidersToPathHandler(PathResourceProvider[] pathResourceProviders, PathHandler pathHandler) { if (pathResourceProviders != null && pathResourceProviders.length > 0) { for (PathResourceProvider pathResourceProvider : pathResourceProviders) { if (pathResourceProvider.isPrefixPath()) { pathHandler.addPrefixPath(pathResourceProvider.getPath(), new ResourceHandler(pathResourceProvider.getResourceManager())); } else { pathHandler.addExactPath(pathResourceProvider.getPath(), new ResourceHandler(pathResourceProvider.getResourceManager())); } } } }
[ "public", "static", "void", "addProvidersToPathHandler", "(", "PathResourceProvider", "[", "]", "pathResourceProviders", ",", "PathHandler", "pathHandler", ")", "{", "if", "(", "pathResourceProviders", "!=", "null", "&&", "pathResourceProviders", ".", "length", ">", "...
Helper to add given PathResourceProviders to a PathHandler. @param pathResourceProviders List of instances of classes implementing PathResourceProvider. @param pathHandler The handler that will have these handlers added to it.
[ "Helper", "to", "add", "given", "PathResourceProviders", "to", "a", "PathHandler", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/resource/src/main/java/com/networknt/resource/ResourceHelpers.java#L38-L48
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/NativeAppCallAttachmentStore.java
NativeAppCallAttachmentStore.cleanupAttachmentsForCall
public void cleanupAttachmentsForCall(Context context, UUID callId) { """ Removes any temporary files associated with a particular native app call. @param context the Context the call is being made from @param callId the unique ID of the call """ File dir = getAttachmentsDirectoryForCall(callId, false); Utility.deleteDirectory(dir); }
java
public void cleanupAttachmentsForCall(Context context, UUID callId) { File dir = getAttachmentsDirectoryForCall(callId, false); Utility.deleteDirectory(dir); }
[ "public", "void", "cleanupAttachmentsForCall", "(", "Context", "context", ",", "UUID", "callId", ")", "{", "File", "dir", "=", "getAttachmentsDirectoryForCall", "(", "callId", ",", "false", ")", ";", "Utility", ".", "deleteDirectory", "(", "dir", ")", ";", "}"...
Removes any temporary files associated with a particular native app call. @param context the Context the call is being made from @param callId the unique ID of the call
[ "Removes", "any", "temporary", "files", "associated", "with", "a", "particular", "native", "app", "call", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/NativeAppCallAttachmentStore.java#L164-L167
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java
JsApiMessageImpl.getJmsUserPropertyMap
final JsMsgMap getJmsUserPropertyMap() { """ Helper method used by the main Message Property methods to obtain the JMS-valid Property items in the form of a map. <p> The method has package level visibility as it is used by JsJmsMessageImpl and JsSdoMessageimpl. @return A JsMsgMap containing the Message Property name-value pairs. """ if (jmsUserPropertyMap == null) { List<String> keys = (List<String>) getApi().getField(JsApiAccess.JMSPROPERTY_NAME); List<Object> values = (List<Object>) getApi().getField(JsApiAccess.JMSPROPERTY_VALUE); jmsUserPropertyMap = new JsMsgMap(keys, values); } return jmsUserPropertyMap; }
java
final JsMsgMap getJmsUserPropertyMap() { if (jmsUserPropertyMap == null) { List<String> keys = (List<String>) getApi().getField(JsApiAccess.JMSPROPERTY_NAME); List<Object> values = (List<Object>) getApi().getField(JsApiAccess.JMSPROPERTY_VALUE); jmsUserPropertyMap = new JsMsgMap(keys, values); } return jmsUserPropertyMap; }
[ "final", "JsMsgMap", "getJmsUserPropertyMap", "(", ")", "{", "if", "(", "jmsUserPropertyMap", "==", "null", ")", "{", "List", "<", "String", ">", "keys", "=", "(", "List", "<", "String", ">", ")", "getApi", "(", ")", ".", "getField", "(", "JsApiAccess", ...
Helper method used by the main Message Property methods to obtain the JMS-valid Property items in the form of a map. <p> The method has package level visibility as it is used by JsJmsMessageImpl and JsSdoMessageimpl. @return A JsMsgMap containing the Message Property name-value pairs.
[ "Helper", "method", "used", "by", "the", "main", "Message", "Property", "methods", "to", "obtain", "the", "JMS", "-", "valid", "Property", "items", "in", "the", "form", "of", "a", "map", ".", "<p", ">", "The", "method", "has", "package", "level", "visibi...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsApiMessageImpl.java#L815-L822
lightbend/config
config/src/main/java/com/typesafe/config/ConfigFactory.java
ConfigFactory.parseResourcesAnySyntax
public static Config parseResourcesAnySyntax(ClassLoader loader, String resourceBasename) { """ Like {@link #parseResourcesAnySyntax(ClassLoader,String,ConfigParseOptions)} but always uses default parse options. @param loader will be used to load resources @param resourceBasename a resource name as in {@link java.lang.ClassLoader#getResource}, with or without extension @return the parsed configuration """ return parseResourcesAnySyntax(loader, resourceBasename, ConfigParseOptions.defaults()); }
java
public static Config parseResourcesAnySyntax(ClassLoader loader, String resourceBasename) { return parseResourcesAnySyntax(loader, resourceBasename, ConfigParseOptions.defaults()); }
[ "public", "static", "Config", "parseResourcesAnySyntax", "(", "ClassLoader", "loader", ",", "String", "resourceBasename", ")", "{", "return", "parseResourcesAnySyntax", "(", "loader", ",", "resourceBasename", ",", "ConfigParseOptions", ".", "defaults", "(", ")", ")", ...
Like {@link #parseResourcesAnySyntax(ClassLoader,String,ConfigParseOptions)} but always uses default parse options. @param loader will be used to load resources @param resourceBasename a resource name as in {@link java.lang.ClassLoader#getResource}, with or without extension @return the parsed configuration
[ "Like", "{", "@link", "#parseResourcesAnySyntax", "(", "ClassLoader", "String", "ConfigParseOptions", ")", "}", "but", "always", "uses", "default", "parse", "options", "." ]
train
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigFactory.java#L993-L995
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java
LoadJobConfiguration.of
public static LoadJobConfiguration of(TableId destinationTable, String sourceUri) { """ Returns a BigQuery Load Job Configuration for the given destination table and source URI. """ return of(destinationTable, ImmutableList.of(sourceUri)); }
java
public static LoadJobConfiguration of(TableId destinationTable, String sourceUri) { return of(destinationTable, ImmutableList.of(sourceUri)); }
[ "public", "static", "LoadJobConfiguration", "of", "(", "TableId", "destinationTable", ",", "String", "sourceUri", ")", "{", "return", "of", "(", "destinationTable", ",", "ImmutableList", ".", "of", "(", "sourceUri", ")", ")", ";", "}" ]
Returns a BigQuery Load Job Configuration for the given destination table and source URI.
[ "Returns", "a", "BigQuery", "Load", "Job", "Configuration", "for", "the", "given", "destination", "table", "and", "source", "URI", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/LoadJobConfiguration.java#L537-L539
openskynetwork/java-adsb
src/main/java/org/opensky/libadsb/PositionDecoder.java
PositionDecoder.decodePosition
public Position decodePosition(SurfacePositionV0Msg msg, Position reference) { """ Shortcut for live decoding; no reasonableness check on distance to receiver @param reference used for reasonableness test and to decide which of the four resulting positions of the CPR algorithm is the right one @param msg airborne position message @return WGS84 coordinates with latitude and longitude in dec degrees, and altitude in meters. altitude might be null if unavailable On error, the returned position is null. Check the .isReasonable() flag before using the position. """ return decodePosition(System.currentTimeMillis()/1000.0, msg, reference); }
java
public Position decodePosition(SurfacePositionV0Msg msg, Position reference) { return decodePosition(System.currentTimeMillis()/1000.0, msg, reference); }
[ "public", "Position", "decodePosition", "(", "SurfacePositionV0Msg", "msg", ",", "Position", "reference", ")", "{", "return", "decodePosition", "(", "System", ".", "currentTimeMillis", "(", ")", "/", "1000.0", ",", "msg", ",", "reference", ")", ";", "}" ]
Shortcut for live decoding; no reasonableness check on distance to receiver @param reference used for reasonableness test and to decide which of the four resulting positions of the CPR algorithm is the right one @param msg airborne position message @return WGS84 coordinates with latitude and longitude in dec degrees, and altitude in meters. altitude might be null if unavailable On error, the returned position is null. Check the .isReasonable() flag before using the position.
[ "Shortcut", "for", "live", "decoding", ";", "no", "reasonableness", "check", "on", "distance", "to", "receiver" ]
train
https://github.com/openskynetwork/java-adsb/blob/01d497d3e74ad10063ab443ab583e9c8653a8b8d/src/main/java/org/opensky/libadsb/PositionDecoder.java#L461-L463
googleapis/google-cloud-java
google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java
SecurityCenterClient.createFinding
public final Finding createFinding(SourceName parent, String findingId, Finding finding) { """ Creates a finding. The corresponding source must exist for finding creation to succeed. <p>Sample code: <pre><code> try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]"); String findingId = ""; Finding finding = Finding.newBuilder().build(); Finding response = securityCenterClient.createFinding(parent, findingId, finding); } </code></pre> @param parent Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]". @param findingId Unique identifier provided by the client within the parent scope. It must be alphanumeric and less than or equal to 32 characters and greater than 0 characters in length. @param finding The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ CreateFindingRequest request = CreateFindingRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFindingId(findingId) .setFinding(finding) .build(); return createFinding(request); }
java
public final Finding createFinding(SourceName parent, String findingId, Finding finding) { CreateFindingRequest request = CreateFindingRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setFindingId(findingId) .setFinding(finding) .build(); return createFinding(request); }
[ "public", "final", "Finding", "createFinding", "(", "SourceName", "parent", ",", "String", "findingId", ",", "Finding", "finding", ")", "{", "CreateFindingRequest", "request", "=", "CreateFindingRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent...
Creates a finding. The corresponding source must exist for finding creation to succeed. <p>Sample code: <pre><code> try (SecurityCenterClient securityCenterClient = SecurityCenterClient.create()) { SourceName parent = SourceName.of("[ORGANIZATION]", "[SOURCE]"); String findingId = ""; Finding finding = Finding.newBuilder().build(); Finding response = securityCenterClient.createFinding(parent, findingId, finding); } </code></pre> @param parent Resource name of the new finding's parent. Its format should be "organizations/[organization_id]/sources/[source_id]". @param findingId Unique identifier provided by the client within the parent scope. It must be alphanumeric and less than or equal to 32 characters and greater than 0 characters in length. @param finding The Finding being created. The name and security_marks will be ignored as they are both output only fields on this resource. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "finding", ".", "The", "corresponding", "source", "must", "exist", "for", "finding", "creation", "to", "succeed", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-securitycenter/src/main/java/com/google/cloud/securitycenter/v1/SecurityCenterClient.java#L311-L320
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.updateProjectMember
public GitlabProjectMember updateProjectMember(Integer projectId, Integer userId, GitlabAccessLevel accessLevel) throws IOException { """ Updates a project member. @param projectId the project id @param userId the user id @param accessLevel the updated access level for the specified user @return GitLabProjectMember with updated access level on success @throws IOException on Gitlab API call error """ return updateProjectMember(projectId, userId, accessLevel, null); }
java
public GitlabProjectMember updateProjectMember(Integer projectId, Integer userId, GitlabAccessLevel accessLevel) throws IOException { return updateProjectMember(projectId, userId, accessLevel, null); }
[ "public", "GitlabProjectMember", "updateProjectMember", "(", "Integer", "projectId", ",", "Integer", "userId", ",", "GitlabAccessLevel", "accessLevel", ")", "throws", "IOException", "{", "return", "updateProjectMember", "(", "projectId", ",", "userId", ",", "accessLevel...
Updates a project member. @param projectId the project id @param userId the user id @param accessLevel the updated access level for the specified user @return GitLabProjectMember with updated access level on success @throws IOException on Gitlab API call error
[ "Updates", "a", "project", "member", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3082-L3084
alkacon/opencms-core
src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java
CmsDefaultXmlContentHandler.initValidationRules
protected void initValidationRules(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException { """ Initializes the validation rules this content handler.<p> OpenCms always performs XML schema validation for all XML contents. However, for most projects in the real world a more fine-grained control over the validation process is required. For these cases, individual validation rules can be defined for the appinfo node.<p> @param root the "validationrules" element from the appinfo node of the XML content definition @param contentDefinition the content definition the validation rules belong to @throws CmsXmlException if something goes wrong """ List<Element> elements = new ArrayList<Element>(CmsXmlGenericWrapper.elements(root, APPINFO_RULE)); elements.addAll(CmsXmlGenericWrapper.elements(root, APPINFO_VALIDATIONRULE)); Iterator<Element> i = elements.iterator(); while (i.hasNext()) { // iterate all "rule" or "validationrule" elements in the "validationrules" node Element element = i.next(); String elementName = element.attributeValue(APPINFO_ATTR_ELEMENT); String regex = element.attributeValue(APPINFO_ATTR_REGEX); String type = element.attributeValue(APPINFO_ATTR_TYPE); if (type != null) { type = type.toLowerCase(); } String message = element.attributeValue(APPINFO_ATTR_MESSAGE); if ((elementName != null) && (regex != null)) { // add a validation rule for the element addValidationRule( contentDefinition, elementName, regex, message, APPINFO_ATTR_TYPE_WARNING.equals(type)); } } }
java
protected void initValidationRules(Element root, CmsXmlContentDefinition contentDefinition) throws CmsXmlException { List<Element> elements = new ArrayList<Element>(CmsXmlGenericWrapper.elements(root, APPINFO_RULE)); elements.addAll(CmsXmlGenericWrapper.elements(root, APPINFO_VALIDATIONRULE)); Iterator<Element> i = elements.iterator(); while (i.hasNext()) { // iterate all "rule" or "validationrule" elements in the "validationrules" node Element element = i.next(); String elementName = element.attributeValue(APPINFO_ATTR_ELEMENT); String regex = element.attributeValue(APPINFO_ATTR_REGEX); String type = element.attributeValue(APPINFO_ATTR_TYPE); if (type != null) { type = type.toLowerCase(); } String message = element.attributeValue(APPINFO_ATTR_MESSAGE); if ((elementName != null) && (regex != null)) { // add a validation rule for the element addValidationRule( contentDefinition, elementName, regex, message, APPINFO_ATTR_TYPE_WARNING.equals(type)); } } }
[ "protected", "void", "initValidationRules", "(", "Element", "root", ",", "CmsXmlContentDefinition", "contentDefinition", ")", "throws", "CmsXmlException", "{", "List", "<", "Element", ">", "elements", "=", "new", "ArrayList", "<", "Element", ">", "(", "CmsXmlGeneric...
Initializes the validation rules this content handler.<p> OpenCms always performs XML schema validation for all XML contents. However, for most projects in the real world a more fine-grained control over the validation process is required. For these cases, individual validation rules can be defined for the appinfo node.<p> @param root the "validationrules" element from the appinfo node of the XML content definition @param contentDefinition the content definition the validation rules belong to @throws CmsXmlException if something goes wrong
[ "Initializes", "the", "validation", "rules", "this", "content", "handler", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsDefaultXmlContentHandler.java#L3194-L3219
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java
IntegrationAccountsInner.getCallbackUrl
public CallbackUrlInner getCallbackUrl(String resourceGroupName, String integrationAccountName, GetCallbackUrlParameters parameters) { """ Gets the integration account callback URL. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param parameters The callback URL parameters. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CallbackUrlInner object if successful. """ return getCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, parameters).toBlocking().single().body(); }
java
public CallbackUrlInner getCallbackUrl(String resourceGroupName, String integrationAccountName, GetCallbackUrlParameters parameters) { return getCallbackUrlWithServiceResponseAsync(resourceGroupName, integrationAccountName, parameters).toBlocking().single().body(); }
[ "public", "CallbackUrlInner", "getCallbackUrl", "(", "String", "resourceGroupName", ",", "String", "integrationAccountName", ",", "GetCallbackUrlParameters", "parameters", ")", "{", "return", "getCallbackUrlWithServiceResponseAsync", "(", "resourceGroupName", ",", "integrationA...
Gets the integration account callback URL. @param resourceGroupName The resource group name. @param integrationAccountName The integration account name. @param parameters The callback URL parameters. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the CallbackUrlInner object if successful.
[ "Gets", "the", "integration", "account", "callback", "URL", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/IntegrationAccountsInner.java#L938-L940
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/MultiVertexGeometryImpl.java
MultiVertexGeometryImpl.setAttributeStreamRef
public void setAttributeStreamRef(int semantics, AttributeStreamBase stream) { """ Sets a reference to the given AttributeStream of the Geometry. Once the buffer has been obtained, the vertices of the Geometry can be manipulated directly. The AttributeStream parameters are not checked for the size. <br> If the attribute is missing, it will be added. <br> Note, that this method does not change the vertex count in the Geometry. <br> The stream can have more elements, than the Geometry point count, but only necessary part will be saved when exporting to a ESRI shape or other format. @param semantics Semantics of the attribute to assign the stream to. @param stream The input AttributeStream that will be assigned by reference. If one changes the stream later through the reference, one has to call NotifyStreamChanged. \exception Throws invalid_argument exception if the input stream type does not match that of the semantics persistence. """ // int test1 = VertexDescription.getPersistence(semantics); // int test2 = stream.getPersistence(); if ((stream != null) && VertexDescription.getPersistence(semantics) != stream .getPersistence())// input stream has wrong persistence throw new IllegalArgumentException(); // Do not check for the stream size here to allow several streams to be // attached before the point count is changed. addAttribute(semantics); int attributeIndex = m_description.getAttributeIndex(semantics); if (m_vertexAttributes == null) m_vertexAttributes = new AttributeStreamBase[m_description .getAttributeCount()]; m_vertexAttributes[attributeIndex] = stream; notifyModified(DirtyFlags.DirtyAll); }
java
public void setAttributeStreamRef(int semantics, AttributeStreamBase stream) { // int test1 = VertexDescription.getPersistence(semantics); // int test2 = stream.getPersistence(); if ((stream != null) && VertexDescription.getPersistence(semantics) != stream .getPersistence())// input stream has wrong persistence throw new IllegalArgumentException(); // Do not check for the stream size here to allow several streams to be // attached before the point count is changed. addAttribute(semantics); int attributeIndex = m_description.getAttributeIndex(semantics); if (m_vertexAttributes == null) m_vertexAttributes = new AttributeStreamBase[m_description .getAttributeCount()]; m_vertexAttributes[attributeIndex] = stream; notifyModified(DirtyFlags.DirtyAll); }
[ "public", "void", "setAttributeStreamRef", "(", "int", "semantics", ",", "AttributeStreamBase", "stream", ")", "{", "// int test1 = VertexDescription.getPersistence(semantics);", "// int test2 = stream.getPersistence();", "if", "(", "(", "stream", "!=", "null", ")", "&&", "...
Sets a reference to the given AttributeStream of the Geometry. Once the buffer has been obtained, the vertices of the Geometry can be manipulated directly. The AttributeStream parameters are not checked for the size. <br> If the attribute is missing, it will be added. <br> Note, that this method does not change the vertex count in the Geometry. <br> The stream can have more elements, than the Geometry point count, but only necessary part will be saved when exporting to a ESRI shape or other format. @param semantics Semantics of the attribute to assign the stream to. @param stream The input AttributeStream that will be assigned by reference. If one changes the stream later through the reference, one has to call NotifyStreamChanged. \exception Throws invalid_argument exception if the input stream type does not match that of the semantics persistence.
[ "Sets", "a", "reference", "to", "the", "given", "AttributeStream", "of", "the", "Geometry", ".", "Once", "the", "buffer", "has", "been", "obtained", "the", "vertices", "of", "the", "Geometry", "can", "be", "manipulated", "directly", ".", "The", "AttributeStrea...
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/MultiVertexGeometryImpl.java#L404-L423
wuman/orientdb-android
core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerNew.java
OMMapManagerNew.mapNew
private OMMapBufferEntry mapNew(final OFileMMap file, final long beginOffset) throws IOException { """ This method maps new part of file if not all file content is mapped. @param file that will be mapped. @param beginOffset position in file from what mapping should be applied. @return mapped entry. @throws IOException is thrown if mapping is unsuccessfully. """ return new OMMapBufferEntry(file, file.map(beginOffset, file.getFileSize() - (int) beginOffset), beginOffset, file.getFileSize() - (int) beginOffset); }
java
private OMMapBufferEntry mapNew(final OFileMMap file, final long beginOffset) throws IOException { return new OMMapBufferEntry(file, file.map(beginOffset, file.getFileSize() - (int) beginOffset), beginOffset, file.getFileSize() - (int) beginOffset); }
[ "private", "OMMapBufferEntry", "mapNew", "(", "final", "OFileMMap", "file", ",", "final", "long", "beginOffset", ")", "throws", "IOException", "{", "return", "new", "OMMapBufferEntry", "(", "file", ",", "file", ".", "map", "(", "beginOffset", ",", "file", ".",...
This method maps new part of file if not all file content is mapped. @param file that will be mapped. @param beginOffset position in file from what mapping should be applied. @return mapped entry. @throws IOException is thrown if mapping is unsuccessfully.
[ "This", "method", "maps", "new", "part", "of", "file", "if", "not", "all", "file", "content", "is", "mapped", "." ]
train
https://github.com/wuman/orientdb-android/blob/ff9b17e4349f26168b2d0c4facb1a18cbfbe8cf0/core/src/main/java/com/orientechnologies/orient/core/storage/fs/OMMapManagerNew.java#L328-L331
dvasilen/Hive-XML-SerDe
src/main/java/com/ibm/spss/hive/serde2/xml/processor/java/JavaXmlProcessor.java
JavaXmlProcessor.populateMap
@SuppressWarnings( { """ Given the node populates the map @param map the map @param node the node """"unchecked", "rawtypes"}) private void populateMap(Map map, Node node) { Map.Entry entry = getMapEntry(node); if (entry != null) { map.put(entry.getKey(), entry.getValue()); } }
java
@SuppressWarnings({"unchecked", "rawtypes"}) private void populateMap(Map map, Node node) { Map.Entry entry = getMapEntry(node); if (entry != null) { map.put(entry.getKey(), entry.getValue()); } }
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "private", "void", "populateMap", "(", "Map", "map", ",", "Node", "node", ")", "{", "Map", ".", "Entry", "entry", "=", "getMapEntry", "(", "node", ")", ";", "if", "(", "...
Given the node populates the map @param map the map @param node the node
[ "Given", "the", "node", "populates", "the", "map" ]
train
https://github.com/dvasilen/Hive-XML-SerDe/blob/2a7a184b2cfaeb63008529a9851cd72edb8025d9/src/main/java/com/ibm/spss/hive/serde2/xml/processor/java/JavaXmlProcessor.java#L385-L391
Wolfgang-Schuetzelhofer/jcypher
src/main/java/iot/jcypher/query/values/JcValue.java
JcValue.asNumber
public JcNumber asNumber() { """ <div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div> <div color='red' style="font-size:18px;color:red"><i>return the receiver as a JcNumber</i></div> <br/> """ JcNumber ret = new JcNumber(null, this, null); QueryRecorder.recordInvocationConditional(this, "asNumber", ret); return ret; }
java
public JcNumber asNumber() { JcNumber ret = new JcNumber(null, this, null); QueryRecorder.recordInvocationConditional(this, "asNumber", ret); return ret; }
[ "public", "JcNumber", "asNumber", "(", ")", "{", "JcNumber", "ret", "=", "new", "JcNumber", "(", "null", ",", "this", ",", "null", ")", ";", "QueryRecorder", ".", "recordInvocationConditional", "(", "this", ",", "\"asNumber\"", ",", "ret", ")", ";", "retur...
<div color='red' style="font-size:24px;color:red"><b><i><u>JCYPHER</u></i></b></div> <div color='red' style="font-size:18px;color:red"><i>return the receiver as a JcNumber</i></div> <br/>
[ "<div", "color", "=", "red", "style", "=", "font", "-", "size", ":", "24px", ";", "color", ":", "red", ">", "<b", ">", "<i", ">", "<u", ">", "JCYPHER<", "/", "u", ">", "<", "/", "i", ">", "<", "/", "b", ">", "<", "/", "div", ">", "<div", ...
train
https://github.com/Wolfgang-Schuetzelhofer/jcypher/blob/0f36914b4d6993a004cc235bb18dd3e02a59d253/src/main/java/iot/jcypher/query/values/JcValue.java#L59-L63
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java
ID3v2Tag.setTextFrame
public void setTextFrame(String id, String data) { """ Set the data contained in a text frame. This includes all frames with an id that starts with 'T' but excludes "TXXX". If an improper id is passed, then nothing will happen. @param id the id of the frame to set the data for @param data the data for the frame """ if ((id.charAt(0) == 'T') && !id.equals(ID3v2Frames.USER_DEFINED_TEXT_INFO)) { try { byte[] b = new byte[data.length() + 1]; b[0] = 0; System.arraycopy(data.getBytes(ENC_TYPE), 0, b, 1, data.length()); updateFrameData(id, b); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } }
java
public void setTextFrame(String id, String data) { if ((id.charAt(0) == 'T') && !id.equals(ID3v2Frames.USER_DEFINED_TEXT_INFO)) { try { byte[] b = new byte[data.length() + 1]; b[0] = 0; System.arraycopy(data.getBytes(ENC_TYPE), 0, b, 1, data.length()); updateFrameData(id, b); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } } }
[ "public", "void", "setTextFrame", "(", "String", "id", ",", "String", "data", ")", "{", "if", "(", "(", "id", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "&&", "!", "id", ".", "equals", "(", "ID3v2Frames", ".", "USER_DEFINED_TEXT_INFO", ")", ...
Set the data contained in a text frame. This includes all frames with an id that starts with 'T' but excludes "TXXX". If an improper id is passed, then nothing will happen. @param id the id of the frame to set the data for @param data the data for the frame
[ "Set", "the", "data", "contained", "in", "a", "text", "frame", ".", "This", "includes", "all", "frames", "with", "an", "id", "that", "starts", "with", "T", "but", "excludes", "TXXX", ".", "If", "an", "improper", "id", "is", "passed", "then", "nothing", ...
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/ID3v2Tag.java#L299-L317
VoltDB/voltdb
third_party/java/src/org/HdrHistogram_voltpatches/SynchronizedHistogram.java
SynchronizedHistogram.decodeFromCompressedByteBuffer
public static SynchronizedHistogram decodeFromCompressedByteBuffer(final ByteBuffer buffer, final long minBarForHighestTrackableValue) throws DataFormatException { """ Construct a new histogram by decoding it from a compressed form in a ByteBuffer. @param buffer The buffer to decode from @param minBarForHighestTrackableValue Force highestTrackableValue to be set at least this high @return The newly constructed histogram @throws DataFormatException on error parsing/decompressing the buffer """ return decodeFromCompressedByteBuffer(buffer, SynchronizedHistogram.class, minBarForHighestTrackableValue); }
java
public static SynchronizedHistogram decodeFromCompressedByteBuffer(final ByteBuffer buffer, final long minBarForHighestTrackableValue) throws DataFormatException { return decodeFromCompressedByteBuffer(buffer, SynchronizedHistogram.class, minBarForHighestTrackableValue); }
[ "public", "static", "SynchronizedHistogram", "decodeFromCompressedByteBuffer", "(", "final", "ByteBuffer", "buffer", ",", "final", "long", "minBarForHighestTrackableValue", ")", "throws", "DataFormatException", "{", "return", "decodeFromCompressedByteBuffer", "(", "buffer", "...
Construct a new histogram by decoding it from a compressed form in a ByteBuffer. @param buffer The buffer to decode from @param minBarForHighestTrackableValue Force highestTrackableValue to be set at least this high @return The newly constructed histogram @throws DataFormatException on error parsing/decompressing the buffer
[ "Construct", "a", "new", "histogram", "by", "decoding", "it", "from", "a", "compressed", "form", "in", "a", "ByteBuffer", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/SynchronizedHistogram.java#L115-L118
SeaCloudsEU/SeaCloudsPlatform
discoverer/src/main/java/eu/seaclouds/platform/discoverer/core/OfferingManager.java
OfferingManager.getOffering
public Offering getOffering(String offeringName) { """ Get an offering @param offeringName the name of the offering @return the offering identified by offeringId """ BasicDBObject query = new BasicDBObject("offering_name", offeringName); FindIterable<Document> cursor = this.offeringsCollection.find(query); return Offering.fromDB(cursor.first()); }
java
public Offering getOffering(String offeringName) { BasicDBObject query = new BasicDBObject("offering_name", offeringName); FindIterable<Document> cursor = this.offeringsCollection.find(query); return Offering.fromDB(cursor.first()); }
[ "public", "Offering", "getOffering", "(", "String", "offeringName", ")", "{", "BasicDBObject", "query", "=", "new", "BasicDBObject", "(", "\"offering_name\"", ",", "offeringName", ")", ";", "FindIterable", "<", "Document", ">", "cursor", "=", "this", ".", "offer...
Get an offering @param offeringName the name of the offering @return the offering identified by offeringId
[ "Get", "an", "offering" ]
train
https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/discoverer/src/main/java/eu/seaclouds/platform/discoverer/core/OfferingManager.java#L53-L58
jenkinsci/jenkins
core/src/main/java/hudson/util/ClasspathBuilder.java
ClasspathBuilder.addAll
public ClasspathBuilder addAll(FilePath base, String glob) throws IOException, InterruptedException { """ Adds all the files that matches the given glob in the directory. @see FilePath#list(String) """ for(FilePath item : base.list(glob)) add(item); return this; } /** * Returns the string representation of the classpath. */ @Override public String toString() { return Util.join(args,File.pathSeparator); } }
java
public ClasspathBuilder addAll(FilePath base, String glob) throws IOException, InterruptedException { for(FilePath item : base.list(glob)) add(item); return this; } /** * Returns the string representation of the classpath. */ @Override public String toString() { return Util.join(args,File.pathSeparator); } }
[ "public", "ClasspathBuilder", "addAll", "(", "FilePath", "base", ",", "String", "glob", ")", "throws", "IOException", ",", "InterruptedException", "{", "for", "(", "FilePath", "item", ":", "base", ".", "list", "(", "glob", ")", ")", "add", "(", "item", ")"...
Adds all the files that matches the given glob in the directory. @see FilePath#list(String)
[ "Adds", "all", "the", "files", "that", "matches", "the", "given", "glob", "in", "the", "directory", "." ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/ClasspathBuilder.java#L57-L70
nextreports/nextreports-server
src/ro/nextreports/server/pivot/DefaultPivotModel.java
DefaultPivotModel.acceptValue
private boolean acceptValue(int row, Map<Integer, Object> filter) { """ /* @SuppressWarnings("unchecked") private Set<Object> getUniqueValues2(PivotField field, Map<Integer, Object> filter) { return new TreeSet<Object>((List<Object>) getValues2(field, filter).get(filter)); } """ boolean accept = true; Set<Integer> keys = filter.keySet(); for (int index : keys) { if (!filter.get(index).equals(dataSource.getValueAt(row, fields.get(index)))) { // System.out.println(" + " + filter.get(j)); // System.out.println(" - " + dataSource.getValueAt(i, // fields.get(j))); return false; } } return accept; }
java
private boolean acceptValue(int row, Map<Integer, Object> filter) { boolean accept = true; Set<Integer> keys = filter.keySet(); for (int index : keys) { if (!filter.get(index).equals(dataSource.getValueAt(row, fields.get(index)))) { // System.out.println(" + " + filter.get(j)); // System.out.println(" - " + dataSource.getValueAt(i, // fields.get(j))); return false; } } return accept; }
[ "private", "boolean", "acceptValue", "(", "int", "row", ",", "Map", "<", "Integer", ",", "Object", ">", "filter", ")", "{", "boolean", "accept", "=", "true", ";", "Set", "<", "Integer", ">", "keys", "=", "filter", ".", "keySet", "(", ")", ";", "for",...
/* @SuppressWarnings("unchecked") private Set<Object> getUniqueValues2(PivotField field, Map<Integer, Object> filter) { return new TreeSet<Object>((List<Object>) getValues2(field, filter).get(filter)); }
[ "/", "*" ]
train
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/pivot/DefaultPivotModel.java#L387-L400
line/armeria
core/src/main/java/com/linecorp/armeria/common/util/InetAddressPredicates.java
InetAddressPredicates.ofCidr
public static Predicate<InetAddress> ofCidr(String cidr) { """ Returns a {@link Predicate} which returns {@code true} if the given {@link InetAddress} is in the range of a <a href="https://tools.ietf.org/html/rfc4632">Classless Inter-domain Routing (CIDR)</a> block. @param cidr the CIDR notation of an address block, e.g. {@code 10.0.0.0/8}, {@code 192.168.1.0/24}, {@code 1080:0:0:0:8:800:200C:4100/120} """ requireNonNull(cidr, "cidr"); final int delim = cidr.indexOf('/'); checkArgument(delim >= 0, "Invalid CIDR notation: %s", cidr); final InetAddress baseAddress; try { baseAddress = InetAddress.getByName(cidr.substring(0, delim)); } catch (UnknownHostException e) { throw new IllegalArgumentException("Invalid CIDR notation: " + cidr, e); } final String subnetMask = cidr.substring(delim + 1); checkArgument(!subnetMask.isEmpty(), "Invalid CIDR notation: %s", cidr); final int maskBits; if (NetUtil.isValidIpV4Address(subnetMask)) { maskBits = toMaskBits(subnetMask); return ofCidr(baseAddress, maskBits, maskBits + 96); } try { maskBits = Integer.parseInt(subnetMask); } catch (Exception e) { throw new IllegalArgumentException("Invalid CIDR notation: " + cidr, e); } return ofCidr(baseAddress, maskBits, maskBits); }
java
public static Predicate<InetAddress> ofCidr(String cidr) { requireNonNull(cidr, "cidr"); final int delim = cidr.indexOf('/'); checkArgument(delim >= 0, "Invalid CIDR notation: %s", cidr); final InetAddress baseAddress; try { baseAddress = InetAddress.getByName(cidr.substring(0, delim)); } catch (UnknownHostException e) { throw new IllegalArgumentException("Invalid CIDR notation: " + cidr, e); } final String subnetMask = cidr.substring(delim + 1); checkArgument(!subnetMask.isEmpty(), "Invalid CIDR notation: %s", cidr); final int maskBits; if (NetUtil.isValidIpV4Address(subnetMask)) { maskBits = toMaskBits(subnetMask); return ofCidr(baseAddress, maskBits, maskBits + 96); } try { maskBits = Integer.parseInt(subnetMask); } catch (Exception e) { throw new IllegalArgumentException("Invalid CIDR notation: " + cidr, e); } return ofCidr(baseAddress, maskBits, maskBits); }
[ "public", "static", "Predicate", "<", "InetAddress", ">", "ofCidr", "(", "String", "cidr", ")", "{", "requireNonNull", "(", "cidr", ",", "\"cidr\"", ")", ";", "final", "int", "delim", "=", "cidr", ".", "indexOf", "(", "'", "'", ")", ";", "checkArgument",...
Returns a {@link Predicate} which returns {@code true} if the given {@link InetAddress} is in the range of a <a href="https://tools.ietf.org/html/rfc4632">Classless Inter-domain Routing (CIDR)</a> block. @param cidr the CIDR notation of an address block, e.g. {@code 10.0.0.0/8}, {@code 192.168.1.0/24}, {@code 1080:0:0:0:8:800:200C:4100/120}
[ "Returns", "a", "{", "@link", "Predicate", "}", "which", "returns", "{", "@code", "true", "}", "if", "the", "given", "{", "@link", "InetAddress", "}", "is", "in", "the", "range", "of", "a", "<a", "href", "=", "https", ":", "//", "tools", ".", "ietf",...
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/util/InetAddressPredicates.java#L130-L159
CenturyLinkCloud/mdw
mdw-hub/src/com/centurylink/mdw/hub/servlet/SoapServlet.java
SoapServlet.createSoapFaultResponse
protected String createSoapFaultResponse(String code, String message) throws SOAPException, TransformerException { """ Original API (Defaults to using MessageFactory.newInstance(), i.e. SOAP 1.1) @param code @param message @return Soap fault as string @throws SOAPException @throws TransformerException """ return createSoapFaultResponse(SOAPConstants.SOAP_1_1_PROTOCOL, code, message); }
java
protected String createSoapFaultResponse(String code, String message) throws SOAPException, TransformerException { return createSoapFaultResponse(SOAPConstants.SOAP_1_1_PROTOCOL, code, message); }
[ "protected", "String", "createSoapFaultResponse", "(", "String", "code", ",", "String", "message", ")", "throws", "SOAPException", ",", "TransformerException", "{", "return", "createSoapFaultResponse", "(", "SOAPConstants", ".", "SOAP_1_1_PROTOCOL", ",", "code", ",", ...
Original API (Defaults to using MessageFactory.newInstance(), i.e. SOAP 1.1) @param code @param message @return Soap fault as string @throws SOAPException @throws TransformerException
[ "Original", "API", "(", "Defaults", "to", "using", "MessageFactory", ".", "newInstance", "()", "i", ".", "e", ".", "SOAP", "1", ".", "1", ")" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-hub/src/com/centurylink/mdw/hub/servlet/SoapServlet.java#L391-L394
kohsuke/com4j
runtime/src/main/java/com4j/COM4J.java
COM4J.createInstance
public static<T extends Com4jObject> T createInstance( Class<T> primaryInterface, String clsid ) throws ComException { """ Creates a new COM object of the given CLSID and returns it in a wrapped interface. @param primaryInterface The created COM object is returned as this interface. Must be non-null. Passing in {@link Com4jObject} allows the caller to create a new instance without knowing its primary interface. @param clsid The CLSID of the COM object in the "<tt>{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}</tt>" format, or the ProgID of the object (like "Microsoft.XMLParser.1.0") @param <T> the type of the return value and the type parameter of the class object of primaryInterface @return non-null valid object. @throws ComException if the instantiation fails. """ // create instance return createInstance(primaryInterface,clsid,CLSCTX.ALL); }
java
public static<T extends Com4jObject> T createInstance( Class<T> primaryInterface, String clsid ) throws ComException { // create instance return createInstance(primaryInterface,clsid,CLSCTX.ALL); }
[ "public", "static", "<", "T", "extends", "Com4jObject", ">", "T", "createInstance", "(", "Class", "<", "T", ">", "primaryInterface", ",", "String", "clsid", ")", "throws", "ComException", "{", "// create instance", "return", "createInstance", "(", "primaryInterfac...
Creates a new COM object of the given CLSID and returns it in a wrapped interface. @param primaryInterface The created COM object is returned as this interface. Must be non-null. Passing in {@link Com4jObject} allows the caller to create a new instance without knowing its primary interface. @param clsid The CLSID of the COM object in the "<tt>{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}</tt>" format, or the ProgID of the object (like "Microsoft.XMLParser.1.0") @param <T> the type of the return value and the type parameter of the class object of primaryInterface @return non-null valid object. @throws ComException if the instantiation fails.
[ "Creates", "a", "new", "COM", "object", "of", "the", "given", "CLSID", "and", "returns", "it", "in", "a", "wrapped", "interface", "." ]
train
https://github.com/kohsuke/com4j/blob/1e690b805fb0e4e9ef61560e20a56335aecb0b24/runtime/src/main/java/com4j/COM4J.java#L70-L75
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByState
public Iterable<DUser> queryByState(java.lang.Integer state) { """ query-by method for field state @param state the specified attribute @return an Iterable of DUsers for the specified state """ return queryByField(null, DUserMapper.Field.STATE.getFieldName(), state); }
java
public Iterable<DUser> queryByState(java.lang.Integer state) { return queryByField(null, DUserMapper.Field.STATE.getFieldName(), state); }
[ "public", "Iterable", "<", "DUser", ">", "queryByState", "(", "java", ".", "lang", ".", "Integer", "state", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "STATE", ".", "getFieldName", "(", ")", ",", "state", ")",...
query-by method for field state @param state the specified attribute @return an Iterable of DUsers for the specified state
[ "query", "-", "by", "method", "for", "field", "state" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L232-L234
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/ie/crf/FactorTable.java
FactorTable.conditionalLogProbGivenPrevious
public double conditionalLogProbGivenPrevious(int[] given, int of) { """ Computes the probability of the tag OF being at the end of the table given that the previous tag sequence in table is GIVEN. given is at the beginning, of is at the end. @return the probability of the tag OF being at the end of the table """ if (given.length != windowSize - 1) { throw new IllegalArgumentException("conditionalLogProbGivenPrevious requires given one less than clique size (" + windowSize + ") but was " + Arrays.toString(given)); } // Note: other similar methods could be optimized like this one, but this is the one the CRF uses.... /* int startIndex = indicesFront(given); int numCellsToSum = SloppyMath.intPow(numClasses, windowSize - given.length); double z = ArrayMath.logSum(table, startIndex, startIndex + numCellsToSum); int i = indexOf(given, of); System.err.printf("startIndex is %d, numCellsToSum is %d, i is %d (of is %d)%n", startIndex, numCellsToSum, i, of); */ int startIndex = indicesFront(given); double z = ArrayMath.logSum(table, startIndex, startIndex + numClasses); int i = startIndex + of; // System.err.printf("startIndex is %d, numCellsToSum is %d, i is %d (of is %d)%n", startIndex, numClasses, i, of); return table[i] - z; }
java
public double conditionalLogProbGivenPrevious(int[] given, int of) { if (given.length != windowSize - 1) { throw new IllegalArgumentException("conditionalLogProbGivenPrevious requires given one less than clique size (" + windowSize + ") but was " + Arrays.toString(given)); } // Note: other similar methods could be optimized like this one, but this is the one the CRF uses.... /* int startIndex = indicesFront(given); int numCellsToSum = SloppyMath.intPow(numClasses, windowSize - given.length); double z = ArrayMath.logSum(table, startIndex, startIndex + numCellsToSum); int i = indexOf(given, of); System.err.printf("startIndex is %d, numCellsToSum is %d, i is %d (of is %d)%n", startIndex, numCellsToSum, i, of); */ int startIndex = indicesFront(given); double z = ArrayMath.logSum(table, startIndex, startIndex + numClasses); int i = startIndex + of; // System.err.printf("startIndex is %d, numCellsToSum is %d, i is %d (of is %d)%n", startIndex, numClasses, i, of); return table[i] - z; }
[ "public", "double", "conditionalLogProbGivenPrevious", "(", "int", "[", "]", "given", ",", "int", "of", ")", "{", "if", "(", "given", ".", "length", "!=", "windowSize", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"conditionalLogProbG...
Computes the probability of the tag OF being at the end of the table given that the previous tag sequence in table is GIVEN. given is at the beginning, of is at the end. @return the probability of the tag OF being at the end of the table
[ "Computes", "the", "probability", "of", "the", "tag", "OF", "being", "at", "the", "end", "of", "the", "table", "given", "that", "the", "previous", "tag", "sequence", "in", "table", "is", "GIVEN", ".", "given", "is", "at", "the", "beginning", "of", "is", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/ie/crf/FactorTable.java#L213-L232
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java
HttpRequestFactory.buildPostRequest
public HttpRequest buildPostRequest(GenericUrl url, HttpContent content) throws IOException { """ Builds a {@code POST} request for the given URL and content. @param url HTTP request URL or {@code null} for none @param content HTTP request content or {@code null} for none @return new HTTP request """ return buildRequest(HttpMethods.POST, url, content); }
java
public HttpRequest buildPostRequest(GenericUrl url, HttpContent content) throws IOException { return buildRequest(HttpMethods.POST, url, content); }
[ "public", "HttpRequest", "buildPostRequest", "(", "GenericUrl", "url", ",", "HttpContent", "content", ")", "throws", "IOException", "{", "return", "buildRequest", "(", "HttpMethods", ".", "POST", ",", "url", ",", "content", ")", ";", "}" ]
Builds a {@code POST} request for the given URL and content. @param url HTTP request URL or {@code null} for none @param content HTTP request content or {@code null} for none @return new HTTP request
[ "Builds", "a", "{", "@code", "POST", "}", "request", "for", "the", "given", "URL", "and", "content", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/HttpRequestFactory.java#L127-L129
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java
ValueMap.withMap
public ValueMap withMap(String key, Map<String, ?> val) { """ Sets the value of the specified key in the current ValueMap to the given value. """ super.put(key, val); return this; }
java
public ValueMap withMap(String key, Map<String, ?> val) { super.put(key, val); return this; }
[ "public", "ValueMap", "withMap", "(", "String", "key", ",", "Map", "<", "String", ",", "?", ">", "val", ")", "{", "super", ".", "put", "(", "key", ",", "val", ")", ";", "return", "this", ";", "}" ]
Sets the value of the specified key in the current ValueMap to the given value.
[ "Sets", "the", "value", "of", "the", "specified", "key", "in", "the", "current", "ValueMap", "to", "the", "given", "value", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/document/utils/ValueMap.java#L177-L180
knowm/XChange
xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java
CexIOAdapters.adaptTrades
public static Trades adaptTrades(CexIOTrade[] cexioTrades, CurrencyPair currencyPair) { """ Adapts a CexIOTrade[] to a Trades Object @param cexioTrades The CexIO trade data returned by API @param currencyPair trade currencies @return The trades """ List<Trade> tradesList = new ArrayList<>(); long lastTradeId = 0; for (CexIOTrade trade : cexioTrades) { long tradeId = trade.getTid(); if (tradeId > lastTradeId) { lastTradeId = tradeId; } // Date is reversed order. Insert at index 0 instead of appending tradesList.add(0, adaptTrade(trade, currencyPair)); } return new Trades(tradesList, lastTradeId, TradeSortType.SortByID); }
java
public static Trades adaptTrades(CexIOTrade[] cexioTrades, CurrencyPair currencyPair) { List<Trade> tradesList = new ArrayList<>(); long lastTradeId = 0; for (CexIOTrade trade : cexioTrades) { long tradeId = trade.getTid(); if (tradeId > lastTradeId) { lastTradeId = tradeId; } // Date is reversed order. Insert at index 0 instead of appending tradesList.add(0, adaptTrade(trade, currencyPair)); } return new Trades(tradesList, lastTradeId, TradeSortType.SortByID); }
[ "public", "static", "Trades", "adaptTrades", "(", "CexIOTrade", "[", "]", "cexioTrades", ",", "CurrencyPair", "currencyPair", ")", "{", "List", "<", "Trade", ">", "tradesList", "=", "new", "ArrayList", "<>", "(", ")", ";", "long", "lastTradeId", "=", "0", ...
Adapts a CexIOTrade[] to a Trades Object @param cexioTrades The CexIO trade data returned by API @param currencyPair trade currencies @return The trades
[ "Adapts", "a", "CexIOTrade", "[]", "to", "a", "Trades", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-cexio/src/main/java/org/knowm/xchange/cexio/CexIOAdapters.java#L62-L75
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java
FastDateFormat.getDateInstance
public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone, final Locale locale) { """ 获得 {@link FastDateFormat} 实例<br> 支持缓存 @param style date style: FULL, LONG, MEDIUM, or SHORT @param timeZone 时区{@link TimeZone} @param locale {@link Locale} 日期地理位置 @return 本地化 {@link FastDateFormat} """ return cache.getDateInstance(style, timeZone, locale); }
java
public static FastDateFormat getDateInstance(final int style, final TimeZone timeZone, final Locale locale) { return cache.getDateInstance(style, timeZone, locale); }
[ "public", "static", "FastDateFormat", "getDateInstance", "(", "final", "int", "style", ",", "final", "TimeZone", "timeZone", ",", "final", "Locale", "locale", ")", "{", "return", "cache", ".", "getDateInstance", "(", "style", ",", "timeZone", ",", "locale", ")...
获得 {@link FastDateFormat} 实例<br> 支持缓存 @param style date style: FULL, LONG, MEDIUM, or SHORT @param timeZone 时区{@link TimeZone} @param locale {@link Locale} 日期地理位置 @return 本地化 {@link FastDateFormat}
[ "获得", "{", "@link", "FastDateFormat", "}", "实例<br", ">", "支持缓存" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FastDateFormat.java#L158-L160
elki-project/elki
elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/QuickSelect.java
QuickSelect.bestPivot
private static final int bestPivot(int rank, int m1, int m2, int m3, int m4, int m5) { """ Choose the best pivot for the given rank. @param rank Rank @param m1 Pivot candidate @param m2 Pivot candidate @param m3 Pivot candidate @param m4 Pivot candidate @param m5 Pivot candidate @return Best pivot candidate """ if(rank < m1) { return m1; } if(rank > m5) { return m5; } if(rank < m2) { return m2; } if(rank > m4) { return m4; } return m3; }
java
private static final int bestPivot(int rank, int m1, int m2, int m3, int m4, int m5) { if(rank < m1) { return m1; } if(rank > m5) { return m5; } if(rank < m2) { return m2; } if(rank > m4) { return m4; } return m3; }
[ "private", "static", "final", "int", "bestPivot", "(", "int", "rank", ",", "int", "m1", ",", "int", "m2", ",", "int", "m3", ",", "int", "m4", ",", "int", "m5", ")", "{", "if", "(", "rank", "<", "m1", ")", "{", "return", "m1", ";", "}", "if", ...
Choose the best pivot for the given rank. @param rank Rank @param m1 Pivot candidate @param m2 Pivot candidate @param m3 Pivot candidate @param m4 Pivot candidate @param m5 Pivot candidate @return Best pivot candidate
[ "Choose", "the", "best", "pivot", "for", "the", "given", "rank", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-util/src/main/java/de/lmu/ifi/dbs/elki/utilities/datastructures/QuickSelect.java#L69-L83
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/encode/MaskConverter.java
MaskConverter.setString
public int setString(String strValue, boolean bDisplayOption, int iMoveMode) { """ Convert and move string to this field. @param strString the state to set the data to. @param bDisplayOption Display the data on the screen if true. @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code (or NORMAL_RETURN). """ if ((strValue == null) || (strValue.length() == 0)) return super.setString(strValue, bDisplayOption, iMoveMode); // Don't trip change or display if (strValue.charAt(0) == FILLER) return DBConstants.NORMAL_RETURN; return super.setString(strValue, bDisplayOption, iMoveMode); }
java
public int setString(String strValue, boolean bDisplayOption, int iMoveMode) { if ((strValue == null) || (strValue.length() == 0)) return super.setString(strValue, bDisplayOption, iMoveMode); // Don't trip change or display if (strValue.charAt(0) == FILLER) return DBConstants.NORMAL_RETURN; return super.setString(strValue, bDisplayOption, iMoveMode); }
[ "public", "int", "setString", "(", "String", "strValue", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "if", "(", "(", "strValue", "==", "null", ")", "||", "(", "strValue", ".", "length", "(", ")", "==", "0", ")", ")", "return", ...
Convert and move string to this field. @param strString the state to set the data to. @param bDisplayOption Display the data on the screen if true. @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code (or NORMAL_RETURN).
[ "Convert", "and", "move", "string", "to", "this", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/encode/MaskConverter.java#L83-L90
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java
MarkdownParser.setOutlineDepthRange
public void setOutlineDepthRange(IntegerRange level) { """ Change the level at which the titles may appear in the outline. @param level the level, at least 1. """ if (level == null) { this.outlineDepthRange = new IntegerRange(DEFAULT_OUTLINE_TOP_LEVEL, DEFAULT_OUTLINE_TOP_LEVEL); } else { this.outlineDepthRange = level; } }
java
public void setOutlineDepthRange(IntegerRange level) { if (level == null) { this.outlineDepthRange = new IntegerRange(DEFAULT_OUTLINE_TOP_LEVEL, DEFAULT_OUTLINE_TOP_LEVEL); } else { this.outlineDepthRange = level; } }
[ "public", "void", "setOutlineDepthRange", "(", "IntegerRange", "level", ")", "{", "if", "(", "level", "==", "null", ")", "{", "this", ".", "outlineDepthRange", "=", "new", "IntegerRange", "(", "DEFAULT_OUTLINE_TOP_LEVEL", ",", "DEFAULT_OUTLINE_TOP_LEVEL", ")", ";"...
Change the level at which the titles may appear in the outline. @param level the level, at least 1.
[ "Change", "the", "level", "at", "which", "the", "titles", "may", "appear", "in", "the", "outline", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L420-L426
Netflix/ribbon
ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/http/LoadBalancingHttpClient.java
LoadBalancingHttpClient.submitToServerInURI
private Observable<HttpClientResponse<O>> submitToServerInURI( HttpClientRequest<I> request, IClientConfig requestConfig, ClientConfig config, RetryHandler errorHandler, ExecutionContext<HttpClientRequest<I>> context) { """ Submits the request to the server indicated in the URI @param request @param requestConfig @param config @param errorHandler @param context @return """ // First, determine server from the URI URI uri; try { uri = new URI(request.getUri()); } catch (URISyntaxException e) { return Observable.error(e); } String host = uri.getHost(); if (host == null) { return null; } int port = uri.getPort(); if (port < 0) { if (Optional.ofNullable(clientConfig.get(IClientConfigKey.Keys.IsSecure)).orElse(false)) { port = 443; } else { port = 80; } } return LoadBalancerCommand.<HttpClientResponse<O>>builder() .withRetryHandler(errorHandler) .withLoadBalancerContext(lbContext) .withListeners(listeners) .withExecutionContext(context) .withServer(new Server(host, port)) .build() .submit(this.requestToOperation(request, getRxClientConfig(requestConfig, config))); }
java
private Observable<HttpClientResponse<O>> submitToServerInURI( HttpClientRequest<I> request, IClientConfig requestConfig, ClientConfig config, RetryHandler errorHandler, ExecutionContext<HttpClientRequest<I>> context) { // First, determine server from the URI URI uri; try { uri = new URI(request.getUri()); } catch (URISyntaxException e) { return Observable.error(e); } String host = uri.getHost(); if (host == null) { return null; } int port = uri.getPort(); if (port < 0) { if (Optional.ofNullable(clientConfig.get(IClientConfigKey.Keys.IsSecure)).orElse(false)) { port = 443; } else { port = 80; } } return LoadBalancerCommand.<HttpClientResponse<O>>builder() .withRetryHandler(errorHandler) .withLoadBalancerContext(lbContext) .withListeners(listeners) .withExecutionContext(context) .withServer(new Server(host, port)) .build() .submit(this.requestToOperation(request, getRxClientConfig(requestConfig, config))); }
[ "private", "Observable", "<", "HttpClientResponse", "<", "O", ">", ">", "submitToServerInURI", "(", "HttpClientRequest", "<", "I", ">", "request", ",", "IClientConfig", "requestConfig", ",", "ClientConfig", "config", ",", "RetryHandler", "errorHandler", ",", "Execut...
Submits the request to the server indicated in the URI @param request @param requestConfig @param config @param errorHandler @param context @return
[ "Submits", "the", "request", "to", "the", "server", "indicated", "in", "the", "URI" ]
train
https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-transport/src/main/java/com/netflix/ribbon/transport/netty/http/LoadBalancingHttpClient.java#L443-L474
tango-controls/JTango
client/src/main/java/fr/soleil/tango/clientapi/util/TypeConversionUtil.java
TypeConversionUtil.castToArray
public static <T> Object castToArray(final Class<T> type, final Object val) throws DevFailed { """ Convert an array of primitives or Objects like double[][] or Double[] into the requested type. 2D array will be converted to a 1D array @param <T> @param type the componant type @param val @return @throws DevFailed """ Object result = null; final Object array1D = val; if (val == null || type.isAssignableFrom(val.getClass())) { result = val; } else { LOGGER.debug("converting {} to {}", val.getClass().getCanonicalName(), type.getCanonicalName()); final Class<?> typeConv = Array.newInstance(type, 0).getClass(); final Transmorph transmorph = new Transmorph(creatConv()); try { result = transmorph.convert(array1D, typeConv); } catch (final ConverterException e) { LOGGER.error("convertion error", e); throw DevFailedUtils.newDevFailed(e); } } return result; }
java
public static <T> Object castToArray(final Class<T> type, final Object val) throws DevFailed { Object result = null; final Object array1D = val; if (val == null || type.isAssignableFrom(val.getClass())) { result = val; } else { LOGGER.debug("converting {} to {}", val.getClass().getCanonicalName(), type.getCanonicalName()); final Class<?> typeConv = Array.newInstance(type, 0).getClass(); final Transmorph transmorph = new Transmorph(creatConv()); try { result = transmorph.convert(array1D, typeConv); } catch (final ConverterException e) { LOGGER.error("convertion error", e); throw DevFailedUtils.newDevFailed(e); } } return result; }
[ "public", "static", "<", "T", ">", "Object", "castToArray", "(", "final", "Class", "<", "T", ">", "type", ",", "final", "Object", "val", ")", "throws", "DevFailed", "{", "Object", "result", "=", "null", ";", "final", "Object", "array1D", "=", "val", ";...
Convert an array of primitives or Objects like double[][] or Double[] into the requested type. 2D array will be converted to a 1D array @param <T> @param type the componant type @param val @return @throws DevFailed
[ "Convert", "an", "array", "of", "primitives", "or", "Objects", "like", "double", "[]", "[]", "or", "Double", "[]", "into", "the", "requested", "type", ".", "2D", "array", "will", "be", "converted", "to", "a", "1D", "array" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/fr/soleil/tango/clientapi/util/TypeConversionUtil.java#L65-L82
threerings/gwt-utils
src/main/java/com/threerings/gwt/ui/Bindings.java
Bindings.bindVisible
public static void bindVisible (final Value<Boolean> value, final Thunk thunk) { """ Binds the visible state of a to-be-created widget to the supplied boolean value. The supplied thunk will be called to create the widget (and add it to the appropriate parent) the first time the value transitions to true, at which point the visiblity of the created widget will be bound to subsequent changes of the value. """ Preconditions.checkNotNull(thunk, "thunk"); value.addListenerAndTrigger(new Value.Listener<Boolean>() { public void valueChanged (Boolean visible) { if (visible) { value.removeListener(this); bindVisible(value, thunk.createWidget()); } } }); }
java
public static void bindVisible (final Value<Boolean> value, final Thunk thunk) { Preconditions.checkNotNull(thunk, "thunk"); value.addListenerAndTrigger(new Value.Listener<Boolean>() { public void valueChanged (Boolean visible) { if (visible) { value.removeListener(this); bindVisible(value, thunk.createWidget()); } } }); }
[ "public", "static", "void", "bindVisible", "(", "final", "Value", "<", "Boolean", ">", "value", ",", "final", "Thunk", "thunk", ")", "{", "Preconditions", ".", "checkNotNull", "(", "thunk", ",", "\"thunk\"", ")", ";", "value", ".", "addListenerAndTrigger", "...
Binds the visible state of a to-be-created widget to the supplied boolean value. The supplied thunk will be called to create the widget (and add it to the appropriate parent) the first time the value transitions to true, at which point the visiblity of the created widget will be bound to subsequent changes of the value.
[ "Binds", "the", "visible", "state", "of", "a", "to", "-", "be", "-", "created", "widget", "to", "the", "supplied", "boolean", "value", ".", "The", "supplied", "thunk", "will", "be", "called", "to", "create", "the", "widget", "(", "and", "add", "it", "t...
train
https://github.com/threerings/gwt-utils/blob/31b31a23b667f2a9c683160d77646db259f2aae5/src/main/java/com/threerings/gwt/ui/Bindings.java#L90-L101
Azure/azure-sdk-for-java
datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java
FilesInner.createOrUpdate
public ProjectFileInner createOrUpdate(String groupName, String serviceName, String projectName, String fileName, ProjectFileInner parameters) { """ Create a file resource. The PUT method creates a new file or updates an existing one. @param groupName Name of the resource group @param serviceName Name of the service @param projectName Name of the project @param fileName Name of the File @param parameters Information about the file @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ProjectFileInner object if successful. """ return createOrUpdateWithServiceResponseAsync(groupName, serviceName, projectName, fileName, parameters).toBlocking().single().body(); }
java
public ProjectFileInner createOrUpdate(String groupName, String serviceName, String projectName, String fileName, ProjectFileInner parameters) { return createOrUpdateWithServiceResponseAsync(groupName, serviceName, projectName, fileName, parameters).toBlocking().single().body(); }
[ "public", "ProjectFileInner", "createOrUpdate", "(", "String", "groupName", ",", "String", "serviceName", ",", "String", "projectName", ",", "String", "fileName", ",", "ProjectFileInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "...
Create a file resource. The PUT method creates a new file or updates an existing one. @param groupName Name of the resource group @param serviceName Name of the service @param projectName Name of the project @param fileName Name of the File @param parameters Information about the file @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ProjectFileInner object if successful.
[ "Create", "a", "file", "resource", ".", "The", "PUT", "method", "creates", "a", "new", "file", "or", "updates", "an", "existing", "one", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2018_07_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2018_07_15_preview/implementation/FilesInner.java#L354-L356
beangle/beangle3
orm/hibernate/src/main/java/org/beangle/orm/hibernate/tool/HbmGenerator.java
HbmGenerator.findAnnotation
private <T extends Annotation> T findAnnotation(Class<?> cls, Class<T> annotationClass, String name) { """ find annotation on specified member @param cls @param annotationClass @param name @return """ Class<?> curr = cls; T ann = null; while (ann == null && curr != null && !curr.equals(Object.class)) { ann = findAnnotationLocal(curr, annotationClass, name); curr = curr.getSuperclass(); } return ann; }
java
private <T extends Annotation> T findAnnotation(Class<?> cls, Class<T> annotationClass, String name) { Class<?> curr = cls; T ann = null; while (ann == null && curr != null && !curr.equals(Object.class)) { ann = findAnnotationLocal(curr, annotationClass, name); curr = curr.getSuperclass(); } return ann; }
[ "private", "<", "T", "extends", "Annotation", ">", "T", "findAnnotation", "(", "Class", "<", "?", ">", "cls", ",", "Class", "<", "T", ">", "annotationClass", ",", "String", "name", ")", "{", "Class", "<", "?", ">", "curr", "=", "cls", ";", "T", "an...
find annotation on specified member @param cls @param annotationClass @param name @return
[ "find", "annotation", "on", "specified", "member" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/orm/hibernate/src/main/java/org/beangle/orm/hibernate/tool/HbmGenerator.java#L106-L114
apache/flink
flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java
PojoSerializerSnapshot.newPojoSerializerIsCompatibleWithReconfiguredSerializer
private static <T> boolean newPojoSerializerIsCompatibleWithReconfiguredSerializer( PojoSerializer<T> newPojoSerializer, IntermediateCompatibilityResult<T> fieldSerializerCompatibility, IntermediateCompatibilityResult<T> preExistingRegistrationsCompatibility, LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> registeredSubclassSerializerSnapshots, LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> nonRegisteredSubclassSerializerSnapshots) { """ Checks if the new {@link PojoSerializer} is compatible with a reconfigured instance. """ return newPojoHasDifferentSubclassRegistrationOrder(registeredSubclassSerializerSnapshots, newPojoSerializer) || previousSerializerHasNonRegisteredSubclasses(nonRegisteredSubclassSerializerSnapshots) || fieldSerializerCompatibility.isCompatibleWithReconfiguredSerializer() || preExistingRegistrationsCompatibility.isCompatibleWithReconfiguredSerializer(); }
java
private static <T> boolean newPojoSerializerIsCompatibleWithReconfiguredSerializer( PojoSerializer<T> newPojoSerializer, IntermediateCompatibilityResult<T> fieldSerializerCompatibility, IntermediateCompatibilityResult<T> preExistingRegistrationsCompatibility, LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> registeredSubclassSerializerSnapshots, LinkedOptionalMap<Class<?>, TypeSerializerSnapshot<?>> nonRegisteredSubclassSerializerSnapshots) { return newPojoHasDifferentSubclassRegistrationOrder(registeredSubclassSerializerSnapshots, newPojoSerializer) || previousSerializerHasNonRegisteredSubclasses(nonRegisteredSubclassSerializerSnapshots) || fieldSerializerCompatibility.isCompatibleWithReconfiguredSerializer() || preExistingRegistrationsCompatibility.isCompatibleWithReconfiguredSerializer(); }
[ "private", "static", "<", "T", ">", "boolean", "newPojoSerializerIsCompatibleWithReconfiguredSerializer", "(", "PojoSerializer", "<", "T", ">", "newPojoSerializer", ",", "IntermediateCompatibilityResult", "<", "T", ">", "fieldSerializerCompatibility", ",", "IntermediateCompat...
Checks if the new {@link PojoSerializer} is compatible with a reconfigured instance.
[ "Checks", "if", "the", "new", "{" ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/api/java/typeutils/runtime/PojoSerializerSnapshot.java#L358-L368
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlSelectBuilder.java
SqlSelectBuilder.getNameParameterOfType
public static String getNameParameterOfType(ModelMethod method, TypeName parameter) { """ Gets the name parameter of type. @param method the method @param parameter the parameter @return the name parameter of type """ for (Pair<String, TypeName> item : method.getParameters()) { if (item.value1.equals(parameter)) { return item.value0; } } return null; }
java
public static String getNameParameterOfType(ModelMethod method, TypeName parameter) { for (Pair<String, TypeName> item : method.getParameters()) { if (item.value1.equals(parameter)) { return item.value0; } } return null; }
[ "public", "static", "String", "getNameParameterOfType", "(", "ModelMethod", "method", ",", "TypeName", "parameter", ")", "{", "for", "(", "Pair", "<", "String", ",", "TypeName", ">", "item", ":", "method", ".", "getParameters", "(", ")", ")", "{", "if", "(...
Gets the name parameter of type. @param method the method @param parameter the parameter @return the name parameter of type
[ "Gets", "the", "name", "parameter", "of", "type", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlSelectBuilder.java#L69-L77
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/ui/SeaGlassProgressBarUI.java
SeaGlassProgressBarUI.getPreferredInnerVertical
protected Dimension getPreferredInnerVertical() { """ Overwritten to fix a very strange issue on Java 7 in BasicProgressBarUI The super method does exactly the same thing but has vertDim == null We with the same code in our overwritten method get a correct vertDim? Why? I don't know, but it fixes the issue. As a small modification I adjusted only the default hardcoded values to 19/150. """ Dimension vertDim = (Dimension)DefaultLookup.get(progressBar, this, "ProgressBar.vertictalSize"); if (vertDim == null) { vertDim = new Dimension(19, 150); } return vertDim; }
java
protected Dimension getPreferredInnerVertical() { Dimension vertDim = (Dimension)DefaultLookup.get(progressBar, this, "ProgressBar.vertictalSize"); if (vertDim == null) { vertDim = new Dimension(19, 150); } return vertDim; }
[ "protected", "Dimension", "getPreferredInnerVertical", "(", ")", "{", "Dimension", "vertDim", "=", "(", "Dimension", ")", "DefaultLookup", ".", "get", "(", "progressBar", ",", "this", ",", "\"ProgressBar.vertictalSize\"", ")", ";", "if", "(", "vertDim", "==", "n...
Overwritten to fix a very strange issue on Java 7 in BasicProgressBarUI The super method does exactly the same thing but has vertDim == null We with the same code in our overwritten method get a correct vertDim? Why? I don't know, but it fixes the issue. As a small modification I adjusted only the default hardcoded values to 19/150.
[ "Overwritten", "to", "fix", "a", "very", "strange", "issue", "on", "Java", "7", "in", "BasicProgressBarUI", "The", "super", "method", "does", "exactly", "the", "same", "thing", "but", "has", "vertDim", "==", "null", "We", "with", "the", "same", "code", "in...
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/ui/SeaGlassProgressBarUI.java#L146-L153
apache/incubator-heron
heron/scheduler-core/src/java/org/apache/heron/scheduler/client/HttpServiceSchedulerClient.java
HttpServiceSchedulerClient.requestSchedulerService
protected boolean requestSchedulerService(Command command, byte[] data) { """ Send payload to target HTTP connection to request a service @param data the byte[] to send @return true if got OK response successfully """ String endpoint = getCommandEndpoint(schedulerHttpEndpoint, command); final HttpURLConnection connection = NetworkUtils.getHttpConnection(endpoint); if (connection == null) { LOG.severe("Scheduler not found."); return false; } // now, we have a valid connection try { // send the actual http request if (!NetworkUtils.sendHttpPostRequest(connection, NetworkUtils.URL_ENCODE_TYPE, data)) { LOG.log(Level.SEVERE, "Failed to send http request to scheduler"); return false; } // receive the response for manage topology Common.StatusCode statusCode; LOG.fine("Receiving response from scheduler..."); try { statusCode = Scheduler.SchedulerResponse.newBuilder() .mergeFrom(NetworkUtils.readHttpResponse(connection)) .build().getStatus().getStatus(); } catch (InvalidProtocolBufferException e) { LOG.log(Level.SEVERE, "Failed to parse response", e); return false; } if (!statusCode.equals(Common.StatusCode.OK)) { LOG.severe("Received not OK response from scheduler"); return false; } } finally { connection.disconnect(); } return true; }
java
protected boolean requestSchedulerService(Command command, byte[] data) { String endpoint = getCommandEndpoint(schedulerHttpEndpoint, command); final HttpURLConnection connection = NetworkUtils.getHttpConnection(endpoint); if (connection == null) { LOG.severe("Scheduler not found."); return false; } // now, we have a valid connection try { // send the actual http request if (!NetworkUtils.sendHttpPostRequest(connection, NetworkUtils.URL_ENCODE_TYPE, data)) { LOG.log(Level.SEVERE, "Failed to send http request to scheduler"); return false; } // receive the response for manage topology Common.StatusCode statusCode; LOG.fine("Receiving response from scheduler..."); try { statusCode = Scheduler.SchedulerResponse.newBuilder() .mergeFrom(NetworkUtils.readHttpResponse(connection)) .build().getStatus().getStatus(); } catch (InvalidProtocolBufferException e) { LOG.log(Level.SEVERE, "Failed to parse response", e); return false; } if (!statusCode.equals(Common.StatusCode.OK)) { LOG.severe("Received not OK response from scheduler"); return false; } } finally { connection.disconnect(); } return true; }
[ "protected", "boolean", "requestSchedulerService", "(", "Command", "command", ",", "byte", "[", "]", "data", ")", "{", "String", "endpoint", "=", "getCommandEndpoint", "(", "schedulerHttpEndpoint", ",", "command", ")", ";", "final", "HttpURLConnection", "connection"...
Send payload to target HTTP connection to request a service @param data the byte[] to send @return true if got OK response successfully
[ "Send", "payload", "to", "target", "HTTP", "connection", "to", "request", "a", "service" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/client/HttpServiceSchedulerClient.java#L74-L112
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java
ConfigurationAbstractImpl.getClass
public Class getClass(String key, Class defaultValue, Class assignable) { """ Returns the class specified by the value for the specified key. If no value for this key is found in the configuration, no class of this name can be found or the specified class is not assignable <code>assignable defaultValue</code> is returned. @param key the key @param defaultValue the default Value @param assignable a classe and/or interface the specified class must extend/implement. @return the value for the key, or <code>defaultValue</code> """ return getClass(key, defaultValue, new Class[]{assignable}); }
java
public Class getClass(String key, Class defaultValue, Class assignable) { return getClass(key, defaultValue, new Class[]{assignable}); }
[ "public", "Class", "getClass", "(", "String", "key", ",", "Class", "defaultValue", ",", "Class", "assignable", ")", "{", "return", "getClass", "(", "key", ",", "defaultValue", ",", "new", "Class", "[", "]", "{", "assignable", "}", ")", ";", "}" ]
Returns the class specified by the value for the specified key. If no value for this key is found in the configuration, no class of this name can be found or the specified class is not assignable <code>assignable defaultValue</code> is returned. @param key the key @param defaultValue the default Value @param assignable a classe and/or interface the specified class must extend/implement. @return the value for the key, or <code>defaultValue</code>
[ "Returns", "the", "class", "specified", "by", "the", "value", "for", "the", "specified", "key", ".", "If", "no", "value", "for", "this", "key", "is", "found", "in", "the", "configuration", "no", "class", "of", "this", "name", "can", "be", "found", "or", ...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/configuration/impl/ConfigurationAbstractImpl.java#L386-L389
liferay/com-liferay-commerce
commerce-payment-api/src/main/java/com/liferay/commerce/payment/model/CommercePaymentMethodGroupRelWrapper.java
CommercePaymentMethodGroupRelWrapper.getName
@Override public String getName(String languageId, boolean useDefault) { """ Returns the localized name of this commerce payment method group rel in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized name of this commerce payment method group rel """ return _commercePaymentMethodGroupRel.getName(languageId, useDefault); }
java
@Override public String getName(String languageId, boolean useDefault) { return _commercePaymentMethodGroupRel.getName(languageId, useDefault); }
[ "@", "Override", "public", "String", "getName", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_commercePaymentMethodGroupRel", ".", "getName", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized name of this commerce payment method group rel in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized name of this commerce payment method group rel
[ "Returns", "the", "localized", "name", "of", "this", "commerce", "payment", "method", "group", "rel", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-payment-api/src/main/java/com/liferay/commerce/payment/model/CommercePaymentMethodGroupRelWrapper.java#L403-L406
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/dataformats/json/jackson/MultiLineStringSerializer.java
MultiLineStringSerializer.writeShapeSpecificSerialization
@Override public void writeShapeSpecificSerialization(MultiLineString value, JsonGenerator jgen, SerializerProvider provider) throws IOException { """ Method that can be called to ask implementation to serialize values of type this serializer handles. @param value Value to serialize; can not be null. @param jgen Generator used to output resulting Json content @param provider Provider that can be used to get serializers for serializing Objects value contains, if any. @throws java.io.IOException If serialization failed. """ jgen.writeFieldName( "type"); jgen.writeString( "MultiLineString"); jgen.writeArrayFieldStart( "coordinates"); // set beanproperty to null since we are not serializing a real property JsonSerializer<Object> ser = provider.findValueSerializer(Double.class, null); for (int i = 0; i < value.getNumGeometries(); i++) { LineString ml = (LineString) value.getGeometryN(i); jgen.writeStartArray(); for (int j = 0; j < ml.getNumPoints(); j++) { Point point = ml.getPointN(j); jgen.writeStartArray(); ser.serialize( point.getX(), jgen, provider); ser.serialize( point.getY(), jgen, provider); jgen.writeEndArray(); } jgen.writeEndArray(); } jgen.writeEndArray(); }
java
@Override public void writeShapeSpecificSerialization(MultiLineString value, JsonGenerator jgen, SerializerProvider provider) throws IOException { jgen.writeFieldName( "type"); jgen.writeString( "MultiLineString"); jgen.writeArrayFieldStart( "coordinates"); // set beanproperty to null since we are not serializing a real property JsonSerializer<Object> ser = provider.findValueSerializer(Double.class, null); for (int i = 0; i < value.getNumGeometries(); i++) { LineString ml = (LineString) value.getGeometryN(i); jgen.writeStartArray(); for (int j = 0; j < ml.getNumPoints(); j++) { Point point = ml.getPointN(j); jgen.writeStartArray(); ser.serialize( point.getX(), jgen, provider); ser.serialize( point.getY(), jgen, provider); jgen.writeEndArray(); } jgen.writeEndArray(); } jgen.writeEndArray(); }
[ "@", "Override", "public", "void", "writeShapeSpecificSerialization", "(", "MultiLineString", "value", ",", "JsonGenerator", "jgen", ",", "SerializerProvider", "provider", ")", "throws", "IOException", "{", "jgen", ".", "writeFieldName", "(", "\"type\"", ")", ";", "...
Method that can be called to ask implementation to serialize values of type this serializer handles. @param value Value to serialize; can not be null. @param jgen Generator used to output resulting Json content @param provider Provider that can be used to get serializers for serializing Objects value contains, if any. @throws java.io.IOException If serialization failed.
[ "Method", "that", "can", "be", "called", "to", "ask", "implementation", "to", "serialize", "values", "of", "type", "this", "serializer", "handles", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/dataformats/json/jackson/MultiLineStringSerializer.java#L61-L82
Labs64/swid-generator
src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java
DefaultSwidProcessor.setSoftwareLicensor
public DefaultSwidProcessor setSoftwareLicensor(final String softwareLicensorName, final String softwareLicensorRegId) { """ Identifies the licensor of the software (tag: software_licensor). @param softwareLicensorName software licensor name @param softwareLicensorRegId software licensor registration ID @return a reference to this object. """ swidTag.setSoftwareLicensor( new EntityComplexType( new Token(softwareLicensorName, idGenerator.nextId()), new RegistrationId(softwareLicensorRegId, idGenerator.nextId()), idGenerator.nextId())); return this; }
java
public DefaultSwidProcessor setSoftwareLicensor(final String softwareLicensorName, final String softwareLicensorRegId) { swidTag.setSoftwareLicensor( new EntityComplexType( new Token(softwareLicensorName, idGenerator.nextId()), new RegistrationId(softwareLicensorRegId, idGenerator.nextId()), idGenerator.nextId())); return this; }
[ "public", "DefaultSwidProcessor", "setSoftwareLicensor", "(", "final", "String", "softwareLicensorName", ",", "final", "String", "softwareLicensorRegId", ")", "{", "swidTag", ".", "setSoftwareLicensor", "(", "new", "EntityComplexType", "(", "new", "Token", "(", "softwar...
Identifies the licensor of the software (tag: software_licensor). @param softwareLicensorName software licensor name @param softwareLicensorRegId software licensor registration ID @return a reference to this object.
[ "Identifies", "the", "licensor", "of", "the", "software", "(", "tag", ":", "software_licensor", ")", "." ]
train
https://github.com/Labs64/swid-generator/blob/cf78d2469469a09701bce7c5f966ac6de2b7c613/src/main/java/com/labs64/utils/swid/processor/DefaultSwidProcessor.java#L155-L163
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java
DiagonalMatrix.setRow
public void setRow(int row, double[] values) { """ {@inheritDoc} Note that any values are not on the diagonal are ignored. """ checkIndices(row, values.length - 1); values[row] = values[row]; }
java
public void setRow(int row, double[] values) { checkIndices(row, values.length - 1); values[row] = values[row]; }
[ "public", "void", "setRow", "(", "int", "row", ",", "double", "[", "]", "values", ")", "{", "checkIndices", "(", "row", ",", "values", ".", "length", "-", "1", ")", ";", "values", "[", "row", "]", "=", "values", "[", "row", "]", ";", "}" ]
{@inheritDoc} Note that any values are not on the diagonal are ignored.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/matrix/DiagonalMatrix.java#L187-L191
ops4j/org.ops4j.base
ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java
ResourceManager.getBaseResources
public static Resources getBaseResources( String baseName, ClassLoader classLoader ) { """ Retrieve resource with specified basename. @param baseName the basename @param classLoader the classLoader to load resources from @return the Resources """ synchronized( ResourceManager.class ) { Resources resources = getCachedResource( baseName ); if( null == resources ) { resources = new Resources( baseName, classLoader ); putCachedResource( baseName, resources ); } return resources; } }
java
public static Resources getBaseResources( String baseName, ClassLoader classLoader ) { synchronized( ResourceManager.class ) { Resources resources = getCachedResource( baseName ); if( null == resources ) { resources = new Resources( baseName, classLoader ); putCachedResource( baseName, resources ); } return resources; } }
[ "public", "static", "Resources", "getBaseResources", "(", "String", "baseName", ",", "ClassLoader", "classLoader", ")", "{", "synchronized", "(", "ResourceManager", ".", "class", ")", "{", "Resources", "resources", "=", "getCachedResource", "(", "baseName", ")", "...
Retrieve resource with specified basename. @param baseName the basename @param classLoader the classLoader to load resources from @return the Resources
[ "Retrieve", "resource", "with", "specified", "basename", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util/src/main/java/org/ops4j/util/i18n/ResourceManager.java#L72-L85
OpenTSDB/opentsdb
src/uid/UniqueId.java
UniqueId.getUsedUIDs
public static Deferred<Map<String, Long>> getUsedUIDs(final TSDB tsdb, final byte[][] kinds) { """ Returns a map of max UIDs from storage for the given list of UID types @param tsdb The TSDB to which we belong @param kinds A list of qualifiers to fetch @return A map with the "kind" as the key and the maximum assigned UID as the value @since 2.0 """ /** * Returns a map with 0 if the max ID row hasn't been initialized yet, * otherwise the map has actual data */ final class GetCB implements Callback<Map<String, Long>, ArrayList<KeyValue>> { @Override public Map<String, Long> call(final ArrayList<KeyValue> row) throws Exception { final Map<String, Long> results = new HashMap<String, Long>(3); if (row == null || row.isEmpty()) { // it could be the case that this is the first time the TSD has run // and the user hasn't put any metrics in, so log and return 0s LOG.info("Could not find the UID assignment row"); for (final byte[] kind : kinds) { results.put(new String(kind, CHARSET), 0L); } return results; } for (final KeyValue column : row) { results.put(new String(column.qualifier(), CHARSET), Bytes.getLong(column.value())); } // if the user is starting with a fresh UID table, we need to account // for missing columns for (final byte[] kind : kinds) { if (results.get(new String(kind, CHARSET)) == null) { results.put(new String(kind, CHARSET), 0L); } } return results; } } final GetRequest get = new GetRequest(tsdb.uidTable(), MAXID_ROW); get.family(ID_FAMILY); get.qualifiers(kinds); return tsdb.getClient().get(get).addCallback(new GetCB()); }
java
public static Deferred<Map<String, Long>> getUsedUIDs(final TSDB tsdb, final byte[][] kinds) { /** * Returns a map with 0 if the max ID row hasn't been initialized yet, * otherwise the map has actual data */ final class GetCB implements Callback<Map<String, Long>, ArrayList<KeyValue>> { @Override public Map<String, Long> call(final ArrayList<KeyValue> row) throws Exception { final Map<String, Long> results = new HashMap<String, Long>(3); if (row == null || row.isEmpty()) { // it could be the case that this is the first time the TSD has run // and the user hasn't put any metrics in, so log and return 0s LOG.info("Could not find the UID assignment row"); for (final byte[] kind : kinds) { results.put(new String(kind, CHARSET), 0L); } return results; } for (final KeyValue column : row) { results.put(new String(column.qualifier(), CHARSET), Bytes.getLong(column.value())); } // if the user is starting with a fresh UID table, we need to account // for missing columns for (final byte[] kind : kinds) { if (results.get(new String(kind, CHARSET)) == null) { results.put(new String(kind, CHARSET), 0L); } } return results; } } final GetRequest get = new GetRequest(tsdb.uidTable(), MAXID_ROW); get.family(ID_FAMILY); get.qualifiers(kinds); return tsdb.getClient().get(get).addCallback(new GetCB()); }
[ "public", "static", "Deferred", "<", "Map", "<", "String", ",", "Long", ">", ">", "getUsedUIDs", "(", "final", "TSDB", "tsdb", ",", "final", "byte", "[", "]", "[", "]", "kinds", ")", "{", "/**\n * Returns a map with 0 if the max ID row hasn't been initialized ...
Returns a map of max UIDs from storage for the given list of UID types @param tsdb The TSDB to which we belong @param kinds A list of qualifiers to fetch @return A map with the "kind" as the key and the maximum assigned UID as the value @since 2.0
[ "Returns", "a", "map", "of", "max", "UIDs", "from", "storage", "for", "the", "given", "list", "of", "UID", "types" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/uid/UniqueId.java#L1700-L1746
WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor
SurveyorCore/src/main/java/org/wwarn/surveyor/client/mvp/view/filter/FilterViewUI.java
FilterViewUI.isSubsetContainedIn
protected boolean isSubsetContainedIn(Set<String> selectedListItems, Set<String> distinctFacetValues) { """ check if *any* of items in selectedListItems is present in distinctFacetValues @param selectedListItems @param distinctFacetValues @return """ boolean isPresent = false; for (String selectedListItem : selectedListItems) { isPresent = distinctFacetValues.contains(selectedListItem); } return isPresent; }
java
protected boolean isSubsetContainedIn(Set<String> selectedListItems, Set<String> distinctFacetValues) { boolean isPresent = false; for (String selectedListItem : selectedListItems) { isPresent = distinctFacetValues.contains(selectedListItem); } return isPresent; }
[ "protected", "boolean", "isSubsetContainedIn", "(", "Set", "<", "String", ">", "selectedListItems", ",", "Set", "<", "String", ">", "distinctFacetValues", ")", "{", "boolean", "isPresent", "=", "false", ";", "for", "(", "String", "selectedListItem", ":", "select...
check if *any* of items in selectedListItems is present in distinctFacetValues @param selectedListItems @param distinctFacetValues @return
[ "check", "if", "*", "any", "*", "of", "items", "in", "selectedListItems", "is", "present", "in", "distinctFacetValues" ]
train
https://github.com/WorldwideAntimalarialResistanceNetwork/WWARN-Maps-Surveyor/blob/224280bcd6e8045bda6b673584caf0aea5e4c841/SurveyorCore/src/main/java/org/wwarn/surveyor/client/mvp/view/filter/FilterViewUI.java#L290-L296
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java
CPDefinitionPersistenceImpl.findByCompanyId
@Override public List<CPDefinition> findByCompanyId(long companyId, int start, int end) { """ Returns a range of all the cp definitions where companyId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param companyId the company ID @param start the lower bound of the range of cp definitions @param end the upper bound of the range of cp definitions (not inclusive) @return the range of matching cp definitions """ return findByCompanyId(companyId, start, end, null); }
java
@Override public List<CPDefinition> findByCompanyId(long companyId, int start, int end) { return findByCompanyId(companyId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPDefinition", ">", "findByCompanyId", "(", "long", "companyId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCompanyId", "(", "companyId", ",", "start", ",", "end", ",", "null", ")", ";", "}...
Returns a range of all the cp definitions where companyId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param companyId the company ID @param start the lower bound of the range of cp definitions @param end the upper bound of the range of cp definitions (not inclusive) @return the range of matching cp definitions
[ "Returns", "a", "range", "of", "all", "the", "cp", "definitions", "where", "companyId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionPersistenceImpl.java#L2030-L2033
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/color/ColorHsv.java
ColorHsv.rgbToHsv
public static <T extends ImageGray<T>> void rgbToHsv(Planar<T> rgb , Planar<T> hsv ) { """ Converts an image from RGB into HSV. Pixels must have a value within the range of [0,1]. @param rgb (Input) Image in RGB format @param hsv (Output) Image in HSV format """ hsv.reshape(rgb.width,rgb.height,3); if( hsv.getBandType() == GrayF32.class ) { if(BoofConcurrency.USE_CONCURRENT ) { ImplColorHsv_MT.rgbToHsv_F32((Planar<GrayF32>)rgb,(Planar<GrayF32>)hsv); } else { ImplColorHsv.rgbToHsv_F32((Planar<GrayF32>)rgb,(Planar<GrayF32>)hsv); } } else { throw new IllegalArgumentException("Unsupported band type "+hsv.getBandType().getSimpleName()); } }
java
public static <T extends ImageGray<T>> void rgbToHsv(Planar<T> rgb , Planar<T> hsv ) { hsv.reshape(rgb.width,rgb.height,3); if( hsv.getBandType() == GrayF32.class ) { if(BoofConcurrency.USE_CONCURRENT ) { ImplColorHsv_MT.rgbToHsv_F32((Planar<GrayF32>)rgb,(Planar<GrayF32>)hsv); } else { ImplColorHsv.rgbToHsv_F32((Planar<GrayF32>)rgb,(Planar<GrayF32>)hsv); } } else { throw new IllegalArgumentException("Unsupported band type "+hsv.getBandType().getSimpleName()); } }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ">", "void", "rgbToHsv", "(", "Planar", "<", "T", ">", "rgb", ",", "Planar", "<", "T", ">", "hsv", ")", "{", "hsv", ".", "reshape", "(", "rgb", ".", "width", ",", "rgb", ".", ...
Converts an image from RGB into HSV. Pixels must have a value within the range of [0,1]. @param rgb (Input) Image in RGB format @param hsv (Output) Image in HSV format
[ "Converts", "an", "image", "from", "RGB", "into", "HSV", ".", "Pixels", "must", "have", "a", "value", "within", "the", "range", "of", "[", "0", "1", "]", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/color/ColorHsv.java#L306-L319
jblas-project/jblas
src/main/java/org/jblas/util/SanityChecks.java
SanityChecks.checkVectorAddition
public static void checkVectorAddition() { """ Check whether vector addition works. This is pure Java code and should work. """ DoubleMatrix x = new DoubleMatrix(3, 1, 1.0, 2.0, 3.0); DoubleMatrix y = new DoubleMatrix(3, 1, 4.0, 5.0, 6.0); DoubleMatrix z = new DoubleMatrix(3, 1, 5.0, 7.0, 9.0); check("checking vector addition", x.add(y).equals(z)); }
java
public static void checkVectorAddition() { DoubleMatrix x = new DoubleMatrix(3, 1, 1.0, 2.0, 3.0); DoubleMatrix y = new DoubleMatrix(3, 1, 4.0, 5.0, 6.0); DoubleMatrix z = new DoubleMatrix(3, 1, 5.0, 7.0, 9.0); check("checking vector addition", x.add(y).equals(z)); }
[ "public", "static", "void", "checkVectorAddition", "(", ")", "{", "DoubleMatrix", "x", "=", "new", "DoubleMatrix", "(", "3", ",", "1", ",", "1.0", ",", "2.0", ",", "3.0", ")", ";", "DoubleMatrix", "y", "=", "new", "DoubleMatrix", "(", "3", ",", "1", ...
Check whether vector addition works. This is pure Java code and should work.
[ "Check", "whether", "vector", "addition", "works", ".", "This", "is", "pure", "Java", "code", "and", "should", "work", "." ]
train
https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/SanityChecks.java#L64-L70
ReactiveX/RxNetty
rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/ws/server/WebSocketHandshaker.java
WebSocketHandshaker.selectSubprotocol
protected static String selectSubprotocol(String requestedSubprotocols, String[] supportedSubProtocols) { """ <b>This is copied from {@link WebSocketServerHandshaker}</b> Selects the first matching supported sub protocol @param requestedSubprotocols CSV of protocols to be supported. e.g. "chat, superchat" @return First matching supported sub protocol. Null if not found. """ if (requestedSubprotocols == null || supportedSubProtocols.length == 0) { return null; } String[] requestedSubprotocolArray = requestedSubprotocols.split(","); for (String p: requestedSubprotocolArray) { String requestedSubprotocol = p.trim(); for (String supportedSubprotocol: supportedSubProtocols) { if (WebSocketServerHandshaker.SUB_PROTOCOL_WILDCARD.equals(supportedSubprotocol) || requestedSubprotocol.equals(supportedSubprotocol)) { return requestedSubprotocol; } } } // No match found return null; }
java
protected static String selectSubprotocol(String requestedSubprotocols, String[] supportedSubProtocols) { if (requestedSubprotocols == null || supportedSubProtocols.length == 0) { return null; } String[] requestedSubprotocolArray = requestedSubprotocols.split(","); for (String p: requestedSubprotocolArray) { String requestedSubprotocol = p.trim(); for (String supportedSubprotocol: supportedSubProtocols) { if (WebSocketServerHandshaker.SUB_PROTOCOL_WILDCARD.equals(supportedSubprotocol) || requestedSubprotocol.equals(supportedSubprotocol)) { return requestedSubprotocol; } } } // No match found return null; }
[ "protected", "static", "String", "selectSubprotocol", "(", "String", "requestedSubprotocols", ",", "String", "[", "]", "supportedSubProtocols", ")", "{", "if", "(", "requestedSubprotocols", "==", "null", "||", "supportedSubProtocols", ".", "length", "==", "0", ")", ...
<b>This is copied from {@link WebSocketServerHandshaker}</b> Selects the first matching supported sub protocol @param requestedSubprotocols CSV of protocols to be supported. e.g. "chat, superchat" @return First matching supported sub protocol. Null if not found.
[ "<b", ">", "This", "is", "copied", "from", "{", "@link", "WebSocketServerHandshaker", "}", "<", "/", "b", ">" ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/ws/server/WebSocketHandshaker.java#L71-L91
alkacon/opencms-core
src/org/opencms/ui/apps/modules/CmsModuleApp.java
CmsModuleApp.openReport
public void openReport(String newState, A_CmsReportThread thread, String label) { """ Changes to a new sub-view and stores a report to be displayed by that subview.<p< @param newState the new state @param thread the report thread which should be displayed in the sub view @param label the label to display for the report """ setReport(newState, thread); m_labels.put(thread, label); openSubView(newState, true); }
java
public void openReport(String newState, A_CmsReportThread thread, String label) { setReport(newState, thread); m_labels.put(thread, label); openSubView(newState, true); }
[ "public", "void", "openReport", "(", "String", "newState", ",", "A_CmsReportThread", "thread", ",", "String", "label", ")", "{", "setReport", "(", "newState", ",", "thread", ")", ";", "m_labels", ".", "put", "(", "thread", ",", "label", ")", ";", "openSubV...
Changes to a new sub-view and stores a report to be displayed by that subview.<p< @param newState the new state @param thread the report thread which should be displayed in the sub view @param label the label to display for the report
[ "Changes", "to", "a", "new", "sub", "-", "view", "and", "stores", "a", "report", "to", "be", "displayed", "by", "that", "subview", ".", "<p<" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/modules/CmsModuleApp.java#L667-L672
Impetus/Kundera
src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClient.java
DSClient.getCompoundKey
private Object getCompoundKey(Attribute attribute, Object entity) throws InstantiationException, IllegalAccessException { """ Gets the compound key. @param attribute the attribute @param entity the entity @return the compound key @throws InstantiationException the instantiation exception @throws IllegalAccessException the illegal access exception """ Object compoundKeyObject = null; if (entity != null) { compoundKeyObject = PropertyAccessorHelper.getObject(entity, (Field) attribute.getJavaMember()); if (compoundKeyObject == null) { compoundKeyObject = ((AbstractAttribute) attribute).getBindableJavaType().newInstance(); } } return compoundKeyObject; }
java
private Object getCompoundKey(Attribute attribute, Object entity) throws InstantiationException, IllegalAccessException { Object compoundKeyObject = null; if (entity != null) { compoundKeyObject = PropertyAccessorHelper.getObject(entity, (Field) attribute.getJavaMember()); if (compoundKeyObject == null) { compoundKeyObject = ((AbstractAttribute) attribute).getBindableJavaType().newInstance(); } } return compoundKeyObject; }
[ "private", "Object", "getCompoundKey", "(", "Attribute", "attribute", ",", "Object", "entity", ")", "throws", "InstantiationException", ",", "IllegalAccessException", "{", "Object", "compoundKeyObject", "=", "null", ";", "if", "(", "entity", "!=", "null", ")", "{"...
Gets the compound key. @param attribute the attribute @param entity the entity @return the compound key @throws InstantiationException the instantiation exception @throws IllegalAccessException the illegal access exception
[ "Gets", "the", "compound", "key", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClient.java#L1030-L1041
landawn/AbacusUtil
src/com/landawn/abacus/util/StringUtil.java
StringUtil.replacePattern
public static String replacePattern(final String source, final String regex, final String replacement) { """ Replaces each substring of the source String that matches the given regular expression with the given replacement using the {@link Pattern#DOTALL} option. DOTALL is also know as single-line mode in Perl. This call is also equivalent to: <ul> <li>{@code source.replaceAll(&quot;(?s)&quot; + regex, replacement)}</li> <li> {@code Pattern.compile(regex, Pattern.DOTALL).filter(source).replaceAll(replacement)} </li> </ul> @param source the source string @param regex the regular expression to which this string is to be matched @param replacement the string to be substituted for each match @return The resulting {@code String} @see String#replaceAll(String, String) @see Pattern#DOTALL @since 3.2 """ return Pattern.compile(regex, Pattern.DOTALL).matcher(source).replaceAll(replacement); }
java
public static String replacePattern(final String source, final String regex, final String replacement) { return Pattern.compile(regex, Pattern.DOTALL).matcher(source).replaceAll(replacement); }
[ "public", "static", "String", "replacePattern", "(", "final", "String", "source", ",", "final", "String", "regex", ",", "final", "String", "replacement", ")", "{", "return", "Pattern", ".", "compile", "(", "regex", ",", "Pattern", ".", "DOTALL", ")", ".", ...
Replaces each substring of the source String that matches the given regular expression with the given replacement using the {@link Pattern#DOTALL} option. DOTALL is also know as single-line mode in Perl. This call is also equivalent to: <ul> <li>{@code source.replaceAll(&quot;(?s)&quot; + regex, replacement)}</li> <li> {@code Pattern.compile(regex, Pattern.DOTALL).filter(source).replaceAll(replacement)} </li> </ul> @param source the source string @param regex the regular expression to which this string is to be matched @param replacement the string to be substituted for each match @return The resulting {@code String} @see String#replaceAll(String, String) @see Pattern#DOTALL @since 3.2
[ "Replaces", "each", "substring", "of", "the", "source", "String", "that", "matches", "the", "given", "regular", "expression", "with", "the", "given", "replacement", "using", "the", "{", "@link", "Pattern#DOTALL", "}", "option", ".", "DOTALL", "is", "also", "kn...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/StringUtil.java#L1111-L1113
google/closure-templates
java/src/com/google/template/soy/jbcsrc/ProtoUtils.java
ProtoUtils.getHasserMethod
private static MethodRef getHasserMethod(FieldDescriptor descriptor) { """ Returns the {@link MethodRef} for the generated hasser method. """ TypeInfo message = messageRuntimeType(descriptor.getContainingType()); return MethodRef.createInstanceMethod( message, new Method("has" + getFieldName(descriptor, true), Type.BOOLEAN_TYPE, NO_METHOD_ARGS)) .asCheap(); }
java
private static MethodRef getHasserMethod(FieldDescriptor descriptor) { TypeInfo message = messageRuntimeType(descriptor.getContainingType()); return MethodRef.createInstanceMethod( message, new Method("has" + getFieldName(descriptor, true), Type.BOOLEAN_TYPE, NO_METHOD_ARGS)) .asCheap(); }
[ "private", "static", "MethodRef", "getHasserMethod", "(", "FieldDescriptor", "descriptor", ")", "{", "TypeInfo", "message", "=", "messageRuntimeType", "(", "descriptor", ".", "getContainingType", "(", ")", ")", ";", "return", "MethodRef", ".", "createInstanceMethod", ...
Returns the {@link MethodRef} for the generated hasser method.
[ "Returns", "the", "{" ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/ProtoUtils.java#L1223-L1229
stephenc/redmine-java-api
src/main/java/org/redmine/ta/internal/Transport.java
Transport.getChildEntries
public <T> List<T> getChildEntries(Class<?> parentClass, String parentId, Class<T> classs) throws RedmineException { """ Delivers a list of a child entries. @param classs target class. """ final EntityConfig<T> config = getConfig(classs); final URI uri = getURIConfigurator().getChildObjectsURI(parentClass, parentId, classs); HttpGet http = new HttpGet(uri); String response = getCommunicator().sendRequest(http); final JSONObject responseObject; try { responseObject = RedmineJSONParser.getResponse(response); return JsonInput.getListNotNull(responseObject, config.multiObjectName, config.parser); } catch (JSONException e) { throw new RedmineFormatException("Bad categories response " + response, e); } }
java
public <T> List<T> getChildEntries(Class<?> parentClass, String parentId, Class<T> classs) throws RedmineException { final EntityConfig<T> config = getConfig(classs); final URI uri = getURIConfigurator().getChildObjectsURI(parentClass, parentId, classs); HttpGet http = new HttpGet(uri); String response = getCommunicator().sendRequest(http); final JSONObject responseObject; try { responseObject = RedmineJSONParser.getResponse(response); return JsonInput.getListNotNull(responseObject, config.multiObjectName, config.parser); } catch (JSONException e) { throw new RedmineFormatException("Bad categories response " + response, e); } }
[ "public", "<", "T", ">", "List", "<", "T", ">", "getChildEntries", "(", "Class", "<", "?", ">", "parentClass", ",", "String", "parentId", ",", "Class", "<", "T", ">", "classs", ")", "throws", "RedmineException", "{", "final", "EntityConfig", "<", "T", ...
Delivers a list of a child entries. @param classs target class.
[ "Delivers", "a", "list", "of", "a", "child", "entries", "." ]
train
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/Transport.java#L416-L432
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlEngine.java
BeetlEngine.createGroupTemplate
private static GroupTemplate createGroupTemplate(ResourceLoader loader) { """ 创建自定义的模板组 {@link GroupTemplate},配置文件使用全局默认<br> 此时自定义的配置文件可在ClassPath中放入beetl.properties配置 @param loader {@link ResourceLoader},资源加载器 @return {@link GroupTemplate} @since 3.2.0 """ try { return createGroupTemplate(loader, Configuration.defaultConfiguration()); } catch (IOException e) { throw new IORuntimeException(e); } }
java
private static GroupTemplate createGroupTemplate(ResourceLoader loader) { try { return createGroupTemplate(loader, Configuration.defaultConfiguration()); } catch (IOException e) { throw new IORuntimeException(e); } }
[ "private", "static", "GroupTemplate", "createGroupTemplate", "(", "ResourceLoader", "loader", ")", "{", "try", "{", "return", "createGroupTemplate", "(", "loader", ",", "Configuration", ".", "defaultConfiguration", "(", ")", ")", ";", "}", "catch", "(", "IOExcepti...
创建自定义的模板组 {@link GroupTemplate},配置文件使用全局默认<br> 此时自定义的配置文件可在ClassPath中放入beetl.properties配置 @param loader {@link ResourceLoader},资源加载器 @return {@link GroupTemplate} @since 3.2.0
[ "创建自定义的模板组", "{", "@link", "GroupTemplate", "}", ",配置文件使用全局默认<br", ">", "此时自定义的配置文件可在ClassPath中放入beetl", ".", "properties配置" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/template/engine/beetl/BeetlEngine.java#L96-L102
OpenLiberty/open-liberty
dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ConnectionManager.java
ConnectionManager.matchBranchCoupling
protected boolean matchBranchCoupling(int couplingType1, int couplingType2, ManagedConnectionFactory managedConnectionFactory) { """ May be called if couplingType indicates LOOSE or TIGHT or is UNSET """ final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); boolean matched = true; if (isJDBC && couplingType1 != couplingType2) { // ResourceRefInfo.BRANCH_COUPLING_UNSET can default to BRANCH_COUPLING_TIGHT or BRANCH_COUPLING_LOOSE if (couplingType1 == ResourceRefInfo.BRANCH_COUPLING_UNSET) couplingType1 = ((WSManagedConnectionFactory) managedConnectionFactory).getDefaultBranchCoupling(); else if (couplingType2 == ResourceRefInfo.BRANCH_COUPLING_UNSET) couplingType2 = ((WSManagedConnectionFactory) managedConnectionFactory).getDefaultBranchCoupling(); matched = couplingType1 == couplingType2; } if (isTraceOn && tc.isDebugEnabled()) { Tr.debug(this, tc, "Match coupling request for " + couplingType1 + " and " + couplingType2 + " match is " + matched); } return matched; }
java
protected boolean matchBranchCoupling(int couplingType1, int couplingType2, ManagedConnectionFactory managedConnectionFactory) { final boolean isTraceOn = TraceComponent.isAnyTracingEnabled(); boolean matched = true; if (isJDBC && couplingType1 != couplingType2) { // ResourceRefInfo.BRANCH_COUPLING_UNSET can default to BRANCH_COUPLING_TIGHT or BRANCH_COUPLING_LOOSE if (couplingType1 == ResourceRefInfo.BRANCH_COUPLING_UNSET) couplingType1 = ((WSManagedConnectionFactory) managedConnectionFactory).getDefaultBranchCoupling(); else if (couplingType2 == ResourceRefInfo.BRANCH_COUPLING_UNSET) couplingType2 = ((WSManagedConnectionFactory) managedConnectionFactory).getDefaultBranchCoupling(); matched = couplingType1 == couplingType2; } if (isTraceOn && tc.isDebugEnabled()) { Tr.debug(this, tc, "Match coupling request for " + couplingType1 + " and " + couplingType2 + " match is " + matched); } return matched; }
[ "protected", "boolean", "matchBranchCoupling", "(", "int", "couplingType1", ",", "int", "couplingType2", ",", "ManagedConnectionFactory", "managedConnectionFactory", ")", "{", "final", "boolean", "isTraceOn", "=", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ...
May be called if couplingType indicates LOOSE or TIGHT or is UNSET
[ "May", "be", "called", "if", "couplingType", "indicates", "LOOSE", "or", "TIGHT", "or", "is", "UNSET" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jca.cm/src/com/ibm/ejs/j2c/ConnectionManager.java#L1601-L1616
sebastiangraf/jSCSI
bundles/commons/src/main/java/org/jscsi/parser/scsi/SCSICommandDescriptorBlockParser.java
SCSICommandDescriptorBlockParser.createReadWriteMessage
private static final ByteBuffer createReadWriteMessage (final byte opCode, final int logicalBlockAddress, final short transferLength) { """ Creates the Command Descriptor Block for a given Operation Message. @param opCode The Operation Code. @param logicalBlockAddress The Logical Block Address to begin the read operation. @param transferLength The transfer length field specifies the number of contiguous logical blocks of data to be transferred. A transfer length of zero indicates that 256 logical blocks shall be transferred. Any other value indicates the number of logical blocks that shall be transferred. @return A <code>ByteBuffer</code> object with the above data. """ ByteBuffer cdb = ByteBuffer.allocate(DEFAULT_CDB_LENGTH); // operation code cdb.put(opCode); // logical block address cdb.position(LOGICAL_BLOCK_ADDRESS_OFFSET); cdb.putInt(logicalBlockAddress); // set transfer length cdb.position(TRANSFER_LENGTH_OFFSET); cdb.putShort(transferLength); cdb.rewind(); return cdb; }
java
private static final ByteBuffer createReadWriteMessage (final byte opCode, final int logicalBlockAddress, final short transferLength) { ByteBuffer cdb = ByteBuffer.allocate(DEFAULT_CDB_LENGTH); // operation code cdb.put(opCode); // logical block address cdb.position(LOGICAL_BLOCK_ADDRESS_OFFSET); cdb.putInt(logicalBlockAddress); // set transfer length cdb.position(TRANSFER_LENGTH_OFFSET); cdb.putShort(transferLength); cdb.rewind(); return cdb; }
[ "private", "static", "final", "ByteBuffer", "createReadWriteMessage", "(", "final", "byte", "opCode", ",", "final", "int", "logicalBlockAddress", ",", "final", "short", "transferLength", ")", "{", "ByteBuffer", "cdb", "=", "ByteBuffer", ".", "allocate", "(", "DEFA...
Creates the Command Descriptor Block for a given Operation Message. @param opCode The Operation Code. @param logicalBlockAddress The Logical Block Address to begin the read operation. @param transferLength The transfer length field specifies the number of contiguous logical blocks of data to be transferred. A transfer length of zero indicates that 256 logical blocks shall be transferred. Any other value indicates the number of logical blocks that shall be transferred. @return A <code>ByteBuffer</code> object with the above data.
[ "Creates", "the", "Command", "Descriptor", "Block", "for", "a", "given", "Operation", "Message", "." ]
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/commons/src/main/java/org/jscsi/parser/scsi/SCSICommandDescriptorBlockParser.java#L346-L363
ArcBees/gwtquery
gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java
WidgetsUtils.replaceOrAppend
private static void replaceOrAppend(Element oldElement, Element newElement) { """ If the <code>oldElement</code> is a td, th, li tags, the new element will replaced its content. In other cases, the <code>oldElement</code> will be replaced by the <code>newElement</code> and the old element classes will be copied to the new element. """ assert oldElement != null && newElement != null; if (matchesTags(oldElement, appendingTags)) { GQuery.$(oldElement).html("").append(newElement); } else { GQuery.$(oldElement).replaceWith(newElement); // copy class String c = oldElement.getClassName(); if (!c.isEmpty()) { newElement.addClassName(c); } // copy id newElement.setId(oldElement.getId()); // ensure no duplicate id oldElement.setId(""); } }
java
private static void replaceOrAppend(Element oldElement, Element newElement) { assert oldElement != null && newElement != null; if (matchesTags(oldElement, appendingTags)) { GQuery.$(oldElement).html("").append(newElement); } else { GQuery.$(oldElement).replaceWith(newElement); // copy class String c = oldElement.getClassName(); if (!c.isEmpty()) { newElement.addClassName(c); } // copy id newElement.setId(oldElement.getId()); // ensure no duplicate id oldElement.setId(""); } }
[ "private", "static", "void", "replaceOrAppend", "(", "Element", "oldElement", ",", "Element", "newElement", ")", "{", "assert", "oldElement", "!=", "null", "&&", "newElement", "!=", "null", ";", "if", "(", "matchesTags", "(", "oldElement", ",", "appendingTags", ...
If the <code>oldElement</code> is a td, th, li tags, the new element will replaced its content. In other cases, the <code>oldElement</code> will be replaced by the <code>newElement</code> and the old element classes will be copied to the new element.
[ "If", "the", "<code", ">", "oldElement<", "/", "code", ">", "is", "a", "td", "th", "li", "tags", "the", "new", "element", "will", "replaced", "its", "content", ".", "In", "other", "cases", "the", "<code", ">", "oldElement<", "/", "code", ">", "will", ...
train
https://github.com/ArcBees/gwtquery/blob/93e02bc8eb030081061c56134ebee1f585981107/gwtquery-core/src/main/java/com/google/gwt/query/client/plugins/widgets/WidgetsUtils.java#L128-L146
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/RequestXmlFactory.java
RequestXmlFactory.convertToXmlByteArray
public static byte[] convertToXmlByteArray(List<PartETag> partETags) { """ Converts the specified list of PartETags to an XML fragment that can be sent to the CompleteMultipartUpload operation of Amazon S3. @param partETags The list of part ETags containing the data to include in the new XML fragment. @return A byte array containing the data """ XmlWriter xml = new XmlWriter(); xml.start("CompleteMultipartUpload"); if (partETags != null) { List<PartETag> sortedPartETags = new ArrayList<PartETag>(partETags); Collections.sort(sortedPartETags, new Comparator<PartETag>() { public int compare(PartETag tag1, PartETag tag2) { if (tag1.getPartNumber() < tag2.getPartNumber()) return -1; if (tag1.getPartNumber() > tag2.getPartNumber()) return 1; return 0; } }); for (PartETag partEtag : sortedPartETags) { xml.start("Part"); xml.start("PartNumber").value(Integer.toString(partEtag.getPartNumber())).end(); xml.start("ETag").value(partEtag.getETag()).end(); xml.end(); } } xml.end(); return xml.getBytes(); }
java
public static byte[] convertToXmlByteArray(List<PartETag> partETags) { XmlWriter xml = new XmlWriter(); xml.start("CompleteMultipartUpload"); if (partETags != null) { List<PartETag> sortedPartETags = new ArrayList<PartETag>(partETags); Collections.sort(sortedPartETags, new Comparator<PartETag>() { public int compare(PartETag tag1, PartETag tag2) { if (tag1.getPartNumber() < tag2.getPartNumber()) return -1; if (tag1.getPartNumber() > tag2.getPartNumber()) return 1; return 0; } }); for (PartETag partEtag : sortedPartETags) { xml.start("Part"); xml.start("PartNumber").value(Integer.toString(partEtag.getPartNumber())).end(); xml.start("ETag").value(partEtag.getETag()).end(); xml.end(); } } xml.end(); return xml.getBytes(); }
[ "public", "static", "byte", "[", "]", "convertToXmlByteArray", "(", "List", "<", "PartETag", ">", "partETags", ")", "{", "XmlWriter", "xml", "=", "new", "XmlWriter", "(", ")", ";", "xml", ".", "start", "(", "\"CompleteMultipartUpload\"", ")", ";", "if", "(...
Converts the specified list of PartETags to an XML fragment that can be sent to the CompleteMultipartUpload operation of Amazon S3. @param partETags The list of part ETags containing the data to include in the new XML fragment. @return A byte array containing the data
[ "Converts", "the", "specified", "list", "of", "PartETags", "to", "an", "XML", "fragment", "that", "can", "be", "sent", "to", "the", "CompleteMultipartUpload", "operation", "of", "Amazon", "S3", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/RequestXmlFactory.java#L56-L79
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/ConcurrencyUtil.java
ConcurrencyUtil.setMax
public static <E> void setMax(E obj, AtomicLongFieldUpdater<E> updater, long value) { """ Atomically sets the max value. If the current value is larger than the provided value, the call is ignored. So it will not happen that a smaller value will overwrite a larger value. """ for (; ; ) { long current = updater.get(obj); if (current >= value) { return; } if (updater.compareAndSet(obj, current, value)) { return; } } }
java
public static <E> void setMax(E obj, AtomicLongFieldUpdater<E> updater, long value) { for (; ; ) { long current = updater.get(obj); if (current >= value) { return; } if (updater.compareAndSet(obj, current, value)) { return; } } }
[ "public", "static", "<", "E", ">", "void", "setMax", "(", "E", "obj", ",", "AtomicLongFieldUpdater", "<", "E", ">", "updater", ",", "long", "value", ")", "{", "for", "(", ";", ";", ")", "{", "long", "current", "=", "updater", ".", "get", "(", "obj"...
Atomically sets the max value. If the current value is larger than the provided value, the call is ignored. So it will not happen that a smaller value will overwrite a larger value.
[ "Atomically", "sets", "the", "max", "value", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/ConcurrencyUtil.java#L56-L67
jaxio/javaee-lab
javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java
GenericRepository.findProperty
@Transactional public <T> List<T> findProperty(Class<T> propertyType, E entity, SearchParameters sp, Attribute<?, ?>... attributes) { """ /* Find a list of E property. @param propertyType type of the property @param entity a sample entity whose non-null properties may be used as search hints @param sp carries additional search information @param attributes the list of attributes to the property @return the entities property matching the search. """ return findProperty(propertyType, entity, sp, newArrayList(attributes)); }
java
@Transactional public <T> List<T> findProperty(Class<T> propertyType, E entity, SearchParameters sp, Attribute<?, ?>... attributes) { return findProperty(propertyType, entity, sp, newArrayList(attributes)); }
[ "@", "Transactional", "public", "<", "T", ">", "List", "<", "T", ">", "findProperty", "(", "Class", "<", "T", ">", "propertyType", ",", "E", "entity", ",", "SearchParameters", "sp", ",", "Attribute", "<", "?", ",", "?", ">", "...", "attributes", ")", ...
/* Find a list of E property. @param propertyType type of the property @param entity a sample entity whose non-null properties may be used as search hints @param sp carries additional search information @param attributes the list of attributes to the property @return the entities property matching the search.
[ "/", "*", "Find", "a", "list", "of", "E", "property", "." ]
train
https://github.com/jaxio/javaee-lab/blob/61238b967952446d81cc68424a4e809093a77fcf/javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java#L258-L261
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java
OLAPService.getStatistics
public UNode getStatistics(ApplicationDefinition appDef, String shard, Map<String, String> paramMap) { """ Get detailed shard statistics for the given shard. This command is mostly used for development and diagnostics. @param appDef {@link ApplicationDefinition} of application to query. @param shard Name of shard to query. @param paramMap Map of statistic option key/value pairs. @return Root of statistics information as a {@link UNode} tree. """ checkServiceState(); CubeSearcher searcher = m_olap.getSearcher(appDef, shard); String file = paramMap.get("file"); if(file != null) { return OlapStatistics.getFileData(searcher, file); } String sort = paramMap.get("sort"); boolean memStats = !"false".equals(paramMap.get("mem")); return OlapStatistics.getStatistics(searcher, sort, memStats); }
java
public UNode getStatistics(ApplicationDefinition appDef, String shard, Map<String, String> paramMap) { checkServiceState(); CubeSearcher searcher = m_olap.getSearcher(appDef, shard); String file = paramMap.get("file"); if(file != null) { return OlapStatistics.getFileData(searcher, file); } String sort = paramMap.get("sort"); boolean memStats = !"false".equals(paramMap.get("mem")); return OlapStatistics.getStatistics(searcher, sort, memStats); }
[ "public", "UNode", "getStatistics", "(", "ApplicationDefinition", "appDef", ",", "String", "shard", ",", "Map", "<", "String", ",", "String", ">", "paramMap", ")", "{", "checkServiceState", "(", ")", ";", "CubeSearcher", "searcher", "=", "m_olap", ".", "getSea...
Get detailed shard statistics for the given shard. This command is mostly used for development and diagnostics. @param appDef {@link ApplicationDefinition} of application to query. @param shard Name of shard to query. @param paramMap Map of statistic option key/value pairs. @return Root of statistics information as a {@link UNode} tree.
[ "Get", "detailed", "shard", "statistics", "for", "the", "given", "shard", ".", "This", "command", "is", "mostly", "used", "for", "development", "and", "diagnostics", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/olap/OLAPService.java#L306-L316
CenturyLinkCloud/mdw
mdw-services/src/com/centurylink/mdw/services/event/EventServicesImpl.java
EventServicesImpl.getWorkTransitionInstance
public TransitionInstance getWorkTransitionInstance(Long pId) throws DataAccessException, ProcessException { """ Returns the WorkTransitionVO based on the passed in params @param pId @return WorkTransitionINstance """ TransitionInstance wti; TransactionWrapper transaction = null; EngineDataAccessDB edao = new EngineDataAccessDB(); try { transaction = edao.startTransaction(); wti = edao.getWorkTransitionInstance(pId); } catch (SQLException e) { throw new ProcessException(0, "Failed to get work transition instance", e); } finally { edao.stopTransaction(transaction); } return wti; }
java
public TransitionInstance getWorkTransitionInstance(Long pId) throws DataAccessException, ProcessException { TransitionInstance wti; TransactionWrapper transaction = null; EngineDataAccessDB edao = new EngineDataAccessDB(); try { transaction = edao.startTransaction(); wti = edao.getWorkTransitionInstance(pId); } catch (SQLException e) { throw new ProcessException(0, "Failed to get work transition instance", e); } finally { edao.stopTransaction(transaction); } return wti; }
[ "public", "TransitionInstance", "getWorkTransitionInstance", "(", "Long", "pId", ")", "throws", "DataAccessException", ",", "ProcessException", "{", "TransitionInstance", "wti", ";", "TransactionWrapper", "transaction", "=", "null", ";", "EngineDataAccessDB", "edao", "=",...
Returns the WorkTransitionVO based on the passed in params @param pId @return WorkTransitionINstance
[ "Returns", "the", "WorkTransitionVO", "based", "on", "the", "passed", "in", "params" ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-services/src/com/centurylink/mdw/services/event/EventServicesImpl.java#L463-L477
mozilla/rhino
src/org/mozilla/javascript/ScriptableObject.java
ScriptableObject.putConstProperty
public static void putConstProperty(Scriptable obj, String name, Object value) { """ Puts a named property in an object or in an object in its prototype chain. <p> Searches for the named property in the prototype chain. If it is found, the value of the property in <code>obj</code> is changed through a call to {@link Scriptable#put(String, Scriptable, Object)} on the prototype passing <code>obj</code> as the <code>start</code> argument. This allows the prototype to veto the property setting in case the prototype defines the property with [[ReadOnly]] attribute. If the property is not found, it is added in <code>obj</code>. @param obj a JavaScript object @param name a property name @param value any JavaScript value accepted by Scriptable.put @since 1.5R2 """ Scriptable base = getBase(obj, name); if (base == null) base = obj; if (base instanceof ConstProperties) ((ConstProperties)base).putConst(name, obj, value); }
java
public static void putConstProperty(Scriptable obj, String name, Object value) { Scriptable base = getBase(obj, name); if (base == null) base = obj; if (base instanceof ConstProperties) ((ConstProperties)base).putConst(name, obj, value); }
[ "public", "static", "void", "putConstProperty", "(", "Scriptable", "obj", ",", "String", "name", ",", "Object", "value", ")", "{", "Scriptable", "base", "=", "getBase", "(", "obj", ",", "name", ")", ";", "if", "(", "base", "==", "null", ")", "base", "=...
Puts a named property in an object or in an object in its prototype chain. <p> Searches for the named property in the prototype chain. If it is found, the value of the property in <code>obj</code> is changed through a call to {@link Scriptable#put(String, Scriptable, Object)} on the prototype passing <code>obj</code> as the <code>start</code> argument. This allows the prototype to veto the property setting in case the prototype defines the property with [[ReadOnly]] attribute. If the property is not found, it is added in <code>obj</code>. @param obj a JavaScript object @param name a property name @param value any JavaScript value accepted by Scriptable.put @since 1.5R2
[ "Puts", "a", "named", "property", "in", "an", "object", "or", "in", "an", "object", "in", "its", "prototype", "chain", ".", "<p", ">", "Searches", "for", "the", "named", "property", "in", "the", "prototype", "chain", ".", "If", "it", "is", "found", "th...
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/ScriptableObject.java#L2536-L2543
GumTreeDiff/gumtree
core/src/main/java/com/github/gumtreediff/utils/SequenceAlgorithms.java
SequenceAlgorithms.longestCommonSubsequenceWithTypeAndLabel
public static List<int[]> longestCommonSubsequenceWithTypeAndLabel(List<ITree> s0, List<ITree> s1) { """ Returns the longest common subsequence between the two list of nodes. This version use type and label to ensure equality. @see ITree#hasSameTypeAndLabel(ITree) @return a list of size 2 int arrays that corresponds to match of index in sequence 1 to index in sequence 2. """ int[][] lengths = new int[s0.size() + 1][s1.size() + 1]; for (int i = 0; i < s0.size(); i++) for (int j = 0; j < s1.size(); j++) if (s0.get(i).hasSameTypeAndLabel(s1.get(j))) lengths[i + 1][j + 1] = lengths[i][j] + 1; else lengths[i + 1][j + 1] = Math.max(lengths[i + 1][j], lengths[i][j + 1]); return extractIndexes(lengths, s0.size(), s1.size()); }
java
public static List<int[]> longestCommonSubsequenceWithTypeAndLabel(List<ITree> s0, List<ITree> s1) { int[][] lengths = new int[s0.size() + 1][s1.size() + 1]; for (int i = 0; i < s0.size(); i++) for (int j = 0; j < s1.size(); j++) if (s0.get(i).hasSameTypeAndLabel(s1.get(j))) lengths[i + 1][j + 1] = lengths[i][j] + 1; else lengths[i + 1][j + 1] = Math.max(lengths[i + 1][j], lengths[i][j + 1]); return extractIndexes(lengths, s0.size(), s1.size()); }
[ "public", "static", "List", "<", "int", "[", "]", ">", "longestCommonSubsequenceWithTypeAndLabel", "(", "List", "<", "ITree", ">", "s0", ",", "List", "<", "ITree", ">", "s1", ")", "{", "int", "[", "]", "[", "]", "lengths", "=", "new", "int", "[", "s0...
Returns the longest common subsequence between the two list of nodes. This version use type and label to ensure equality. @see ITree#hasSameTypeAndLabel(ITree) @return a list of size 2 int arrays that corresponds to match of index in sequence 1 to index in sequence 2.
[ "Returns", "the", "longest", "common", "subsequence", "between", "the", "two", "list", "of", "nodes", ".", "This", "version", "use", "type", "and", "label", "to", "ensure", "equality", "." ]
train
https://github.com/GumTreeDiff/gumtree/blob/a772d4d652af44bff22c38a234ddffbfbd365a37/core/src/main/java/com/github/gumtreediff/utils/SequenceAlgorithms.java#L111-L121
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java
Logger.entering
public void entering(String sourceClass, String sourceMethod, Object params[]) { """ Log a method entry, with an array of parameters. <p> This is a convenience method that can be used to log entry to a method. A LogRecord with message "ENTRY" (followed by a format {N} indicator for each entry in the parameter array), log level FINER, and the given sourceMethod, sourceClass, and parameters is logged. <p> @param sourceClass name of class that issued the logging request @param sourceMethod name of method that is being entered @param params array of parameters to the method being entered """ if (Level.FINER.intValue() < levelValue) { return; } String msg = "ENTRY"; if (params == null ) { logp(Level.FINER, sourceClass, sourceMethod, msg); return; } for (int i = 0; i < params.length; i++) { msg = msg + " {" + i + "}"; } logp(Level.FINER, sourceClass, sourceMethod, msg, params); }
java
public void entering(String sourceClass, String sourceMethod, Object params[]) { if (Level.FINER.intValue() < levelValue) { return; } String msg = "ENTRY"; if (params == null ) { logp(Level.FINER, sourceClass, sourceMethod, msg); return; } for (int i = 0; i < params.length; i++) { msg = msg + " {" + i + "}"; } logp(Level.FINER, sourceClass, sourceMethod, msg, params); }
[ "public", "void", "entering", "(", "String", "sourceClass", ",", "String", "sourceMethod", ",", "Object", "params", "[", "]", ")", "{", "if", "(", "Level", ".", "FINER", ".", "intValue", "(", ")", "<", "levelValue", ")", "{", "return", ";", "}", "Strin...
Log a method entry, with an array of parameters. <p> This is a convenience method that can be used to log entry to a method. A LogRecord with message "ENTRY" (followed by a format {N} indicator for each entry in the parameter array), log level FINER, and the given sourceMethod, sourceClass, and parameters is logged. <p> @param sourceClass name of class that issued the logging request @param sourceMethod name of method that is being entered @param params array of parameters to the method being entered
[ "Log", "a", "method", "entry", "with", "an", "array", "of", "parameters", ".", "<p", ">", "This", "is", "a", "convenience", "method", "that", "can", "be", "used", "to", "log", "entry", "to", "a", "method", ".", "A", "LogRecord", "with", "message", "ENT...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L1066-L1079
sagiegurari/fax4j
src/main/java/org/fax4j/util/IOHelper.java
IOHelper.createWriter
public static Writer createWriter(OutputStream outputStream,String encoding) { """ This function creates and returns a new writer for the provided output stream. @param outputStream The output stream @param encoding The encoding used by the writer (null for default system encoding) @return The writer """ //get encoding String updatedEncoding=IOHelper.getEncodingToUse(encoding); //create writer Writer writer=null; try { writer=new OutputStreamWriter(outputStream,updatedEncoding); } catch(UnsupportedEncodingException exception) { throw new FaxException("Unable to create writer, unsupported encoding: "+encoding,exception); } return writer; }
java
public static Writer createWriter(OutputStream outputStream,String encoding) { //get encoding String updatedEncoding=IOHelper.getEncodingToUse(encoding); //create writer Writer writer=null; try { writer=new OutputStreamWriter(outputStream,updatedEncoding); } catch(UnsupportedEncodingException exception) { throw new FaxException("Unable to create writer, unsupported encoding: "+encoding,exception); } return writer; }
[ "public", "static", "Writer", "createWriter", "(", "OutputStream", "outputStream", ",", "String", "encoding", ")", "{", "//get encoding", "String", "updatedEncoding", "=", "IOHelper", ".", "getEncodingToUse", "(", "encoding", ")", ";", "//create writer", "Writer", "...
This function creates and returns a new writer for the provided output stream. @param outputStream The output stream @param encoding The encoding used by the writer (null for default system encoding) @return The writer
[ "This", "function", "creates", "and", "returns", "a", "new", "writer", "for", "the", "provided", "output", "stream", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/util/IOHelper.java#L264-L281
xvik/generics-resolver
src/main/java/ru/vyarus/java/generics/resolver/util/walk/AssignabilityTypesVisitor.java
AssignabilityTypesVisitor.checkLowerBounds
private boolean checkLowerBounds(final Type one, final Type two) { """ Check lower bounded wildcard cases. Method is not called if upper bounds are not assignable. <p> When left is not lower bound - compatibility will be checked by type walker and when compatible always assignable. For example, String compatible (and assignable) with ? super String and Integer is not compatible with ? super Number (and not assignable). <p> Wen right is not lower bound, when left is then it will be never assignable. For example, ? super String is not assignable to String. <p> When both lower wildcards: lower bounds must be from one hierarchy and left type should be lower. For example, ? super Integer and ? super BigInteger are not assignable in spite of the fact that they share some common types. ? super Number is more specific then ? super Integer (super inverse meaning). @param one first type @param two second type @return true when left is assignable to right, false otherwise """ final boolean res; // ? super Object is impossible here due to types cleanup in tree walker if (notLowerBounded(one)) { // walker will check compatibility, and compatible type is always assignable to lower bounded wildcard // e.g. Number assignable to ? super Number, but Integer not assignable to ? super Number res = true; } else if (notLowerBounded(two)) { // lower bound could not be assigned to anything else (only opposite way is possible) // for example, List<? super String> is not assignable to List<String>, but // List<String> is assignable to List<? super String> (previous condition) res = false; } else { // left type's bound must be lower: not a mistake! left (super inversion)! res = TypeUtils.isMoreSpecific( ((WildcardType) two).getLowerBounds()[0], ((WildcardType) one).getLowerBounds()[0]); } return res; }
java
private boolean checkLowerBounds(final Type one, final Type two) { final boolean res; // ? super Object is impossible here due to types cleanup in tree walker if (notLowerBounded(one)) { // walker will check compatibility, and compatible type is always assignable to lower bounded wildcard // e.g. Number assignable to ? super Number, but Integer not assignable to ? super Number res = true; } else if (notLowerBounded(two)) { // lower bound could not be assigned to anything else (only opposite way is possible) // for example, List<? super String> is not assignable to List<String>, but // List<String> is assignable to List<? super String> (previous condition) res = false; } else { // left type's bound must be lower: not a mistake! left (super inversion)! res = TypeUtils.isMoreSpecific( ((WildcardType) two).getLowerBounds()[0], ((WildcardType) one).getLowerBounds()[0]); } return res; }
[ "private", "boolean", "checkLowerBounds", "(", "final", "Type", "one", ",", "final", "Type", "two", ")", "{", "final", "boolean", "res", ";", "// ? super Object is impossible here due to types cleanup in tree walker", "if", "(", "notLowerBounded", "(", "one", ")", ")"...
Check lower bounded wildcard cases. Method is not called if upper bounds are not assignable. <p> When left is not lower bound - compatibility will be checked by type walker and when compatible always assignable. For example, String compatible (and assignable) with ? super String and Integer is not compatible with ? super Number (and not assignable). <p> Wen right is not lower bound, when left is then it will be never assignable. For example, ? super String is not assignable to String. <p> When both lower wildcards: lower bounds must be from one hierarchy and left type should be lower. For example, ? super Integer and ? super BigInteger are not assignable in spite of the fact that they share some common types. ? super Number is more specific then ? super Integer (super inverse meaning). @param one first type @param two second type @return true when left is assignable to right, false otherwise
[ "Check", "lower", "bounded", "wildcard", "cases", ".", "Method", "is", "not", "called", "if", "upper", "bounds", "are", "not", "assignable", ".", "<p", ">", "When", "left", "is", "not", "lower", "bound", "-", "compatibility", "will", "be", "checked", "by",...
train
https://github.com/xvik/generics-resolver/blob/d7d9d2783265df1178230e8f0b7cb6d853b67a7b/src/main/java/ru/vyarus/java/generics/resolver/util/walk/AssignabilityTypesVisitor.java#L75-L94
craterdog/java-general-utilities
src/main/java/craterdog/utils/ByteUtils.java
ByteUtils.bytesToLong
static public long bytesToLong(byte[] buffer, int index) { """ This function converts the bytes in a byte array at the specified index to its corresponding long value. @param buffer The byte array containing the long. @param index The index for the first byte in the byte array. @return The corresponding long value. """ int length = buffer.length - index; if (length > 8) length = 8; long l = 0; for (int i = 0; i < length; i++) { l |= ((buffer[index + length - i - 1] & 0xFFL) << (i * 8)); } return l; }
java
static public long bytesToLong(byte[] buffer, int index) { int length = buffer.length - index; if (length > 8) length = 8; long l = 0; for (int i = 0; i < length; i++) { l |= ((buffer[index + length - i - 1] & 0xFFL) << (i * 8)); } return l; }
[ "static", "public", "long", "bytesToLong", "(", "byte", "[", "]", "buffer", ",", "int", "index", ")", "{", "int", "length", "=", "buffer", ".", "length", "-", "index", ";", "if", "(", "length", ">", "8", ")", "length", "=", "8", ";", "long", "l", ...
This function converts the bytes in a byte array at the specified index to its corresponding long value. @param buffer The byte array containing the long. @param index The index for the first byte in the byte array. @return The corresponding long value.
[ "This", "function", "converts", "the", "bytes", "in", "a", "byte", "array", "at", "the", "specified", "index", "to", "its", "corresponding", "long", "value", "." ]
train
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L309-L317
paypal/SeLion
client/src/main/java/com/paypal/selion/configuration/ListenerInfo.java
ListenerInfo.getBooleanValFromVMArg
static boolean getBooleanValFromVMArg(String vmArgValue, boolean defaultStateWhenNotDefined) { """ Returns boolean value of the JVM argument when defined, else returns the {@code defaultStateWhenNotDefined}. @param vmArgValue The VM argument name. @param defaultStateWhenNotDefined A boolean to indicate default state of the listener. """ String sysProperty = System.getProperty(vmArgValue); boolean flag = defaultStateWhenNotDefined; if ((sysProperty != null) && (!sysProperty.isEmpty())) { flag = Boolean.parseBoolean(sysProperty); } return flag; }
java
static boolean getBooleanValFromVMArg(String vmArgValue, boolean defaultStateWhenNotDefined) { String sysProperty = System.getProperty(vmArgValue); boolean flag = defaultStateWhenNotDefined; if ((sysProperty != null) && (!sysProperty.isEmpty())) { flag = Boolean.parseBoolean(sysProperty); } return flag; }
[ "static", "boolean", "getBooleanValFromVMArg", "(", "String", "vmArgValue", ",", "boolean", "defaultStateWhenNotDefined", ")", "{", "String", "sysProperty", "=", "System", ".", "getProperty", "(", "vmArgValue", ")", ";", "boolean", "flag", "=", "defaultStateWhenNotDef...
Returns boolean value of the JVM argument when defined, else returns the {@code defaultStateWhenNotDefined}. @param vmArgValue The VM argument name. @param defaultStateWhenNotDefined A boolean to indicate default state of the listener.
[ "Returns", "boolean", "value", "of", "the", "JVM", "argument", "when", "defined", "else", "returns", "the", "{", "@code", "defaultStateWhenNotDefined", "}", "." ]
train
https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/client/src/main/java/com/paypal/selion/configuration/ListenerInfo.java#L95-L102
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationBinary.java
EvaluationBinary.falseNegativeRate
public double falseNegativeRate(Integer classLabel, double edgeCase) { """ Returns the false negative rate for a given label @param classLabel the label @param edgeCase What to output in case of 0/0 @return fnr as a double """ double fnCount = falseNegatives(classLabel); double tpCount = truePositives(classLabel); return EvaluationUtils.falseNegativeRate((long) fnCount, (long) tpCount, edgeCase); }
java
public double falseNegativeRate(Integer classLabel, double edgeCase) { double fnCount = falseNegatives(classLabel); double tpCount = truePositives(classLabel); return EvaluationUtils.falseNegativeRate((long) fnCount, (long) tpCount, edgeCase); }
[ "public", "double", "falseNegativeRate", "(", "Integer", "classLabel", ",", "double", "edgeCase", ")", "{", "double", "fnCount", "=", "falseNegatives", "(", "classLabel", ")", ";", "double", "tpCount", "=", "truePositives", "(", "classLabel", ")", ";", "return",...
Returns the false negative rate for a given label @param classLabel the label @param edgeCase What to output in case of 0/0 @return fnr as a double
[ "Returns", "the", "false", "negative", "rate", "for", "a", "given", "label" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/evaluation/classification/EvaluationBinary.java#L495-L500
pac4j/pac4j
pac4j-saml/src/main/java/org/pac4j/saml/util/SAML2Utils.java
SAML2Utils.urisEqualAfterPortNormalization
public static boolean urisEqualAfterPortNormalization(final URI uri1, final URI uri2) { """ Compares two URIs for equality, ignoring default port numbers for selected protocols. By default, {@link URI#equals(Object)} doesn't take into account default port numbers, so http://server:80/resource is a different URI than http://server/resource. And URLs should not be used for comparison, as written here: http://stackoverflow.com/questions/3771081/proper-way-to-check-for-url-equality @param uri1 URI 1 to be compared. @param uri2 URI 2 to be compared. @return True if both URIs are equal. """ if (uri1 == null && uri2 == null) { return true; } if (uri1 == null || uri2 == null) { return false; } try { URI normalizedUri1 = normalizePortNumbersInUri(uri1); URI normalizedUri2 = normalizePortNumbersInUri(uri2); boolean eq = normalizedUri1.equals(normalizedUri2); return eq; } catch (URISyntaxException use) { logger.error("Cannot compare 2 URIs.", use); return false; } }
java
public static boolean urisEqualAfterPortNormalization(final URI uri1, final URI uri2) { if (uri1 == null && uri2 == null) { return true; } if (uri1 == null || uri2 == null) { return false; } try { URI normalizedUri1 = normalizePortNumbersInUri(uri1); URI normalizedUri2 = normalizePortNumbersInUri(uri2); boolean eq = normalizedUri1.equals(normalizedUri2); return eq; } catch (URISyntaxException use) { logger.error("Cannot compare 2 URIs.", use); return false; } }
[ "public", "static", "boolean", "urisEqualAfterPortNormalization", "(", "final", "URI", "uri1", ",", "final", "URI", "uri2", ")", "{", "if", "(", "uri1", "==", "null", "&&", "uri2", "==", "null", ")", "{", "return", "true", ";", "}", "if", "(", "uri1", ...
Compares two URIs for equality, ignoring default port numbers for selected protocols. By default, {@link URI#equals(Object)} doesn't take into account default port numbers, so http://server:80/resource is a different URI than http://server/resource. And URLs should not be used for comparison, as written here: http://stackoverflow.com/questions/3771081/proper-way-to-check-for-url-equality @param uri1 URI 1 to be compared. @param uri2 URI 2 to be compared. @return True if both URIs are equal.
[ "Compares", "two", "URIs", "for", "equality", "ignoring", "default", "port", "numbers", "for", "selected", "protocols", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-saml/src/main/java/org/pac4j/saml/util/SAML2Utils.java#L49-L66
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java
MediaServicesInner.regenerateKey
public RegenerateKeyOutputInner regenerateKey(String resourceGroupName, String mediaServiceName, KeyType keyType) { """ Regenerates a primary or secondary key for a Media Service. @param resourceGroupName Name of the resource group within the Azure subscription. @param mediaServiceName Name of the Media Service. @param keyType The keyType indicating which key you want to regenerate, Primary or Secondary. Possible values include: 'Primary', 'Secondary' @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RegenerateKeyOutputInner object if successful. """ return regenerateKeyWithServiceResponseAsync(resourceGroupName, mediaServiceName, keyType).toBlocking().single().body(); }
java
public RegenerateKeyOutputInner regenerateKey(String resourceGroupName, String mediaServiceName, KeyType keyType) { return regenerateKeyWithServiceResponseAsync(resourceGroupName, mediaServiceName, keyType).toBlocking().single().body(); }
[ "public", "RegenerateKeyOutputInner", "regenerateKey", "(", "String", "resourceGroupName", ",", "String", "mediaServiceName", ",", "KeyType", "keyType", ")", "{", "return", "regenerateKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "mediaServiceName", ",", "key...
Regenerates a primary or secondary key for a Media Service. @param resourceGroupName Name of the resource group within the Azure subscription. @param mediaServiceName Name of the Media Service. @param keyType The keyType indicating which key you want to regenerate, Primary or Secondary. Possible values include: 'Primary', 'Secondary' @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the RegenerateKeyOutputInner object if successful.
[ "Regenerates", "a", "primary", "or", "secondary", "key", "for", "a", "Media", "Service", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2015_10_01/src/main/java/com/microsoft/azure/management/mediaservices/v2015_10_01/implementation/MediaServicesInner.java#L647-L649
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/index/btree/BTreeDir.java
BTreeDir.makeNewRoot
public void makeNewRoot(DirEntry e) { """ Creates a new root block for the B-tree. The new root will have two children: the old root, and the specified block. Since the root must always be in block 0 of the file, the contents of block 0 will get transferred to a new block (serving as the old root). @param e the directory entry to be added as a child of the new root """ // makes sure it is opening the root block if (currentPage.currentBlk().number() != 0) { currentPage.close(); currentPage = new BTreePage(new BlockId(currentPage.currentBlk().fileName(), 0), NUM_FLAGS, schema, tx); } SearchKey firstKey = getKey(currentPage, 0, keyType.length()); long level = getLevelFlag(currentPage); // transfer all records to the new block long newBlkNum = currentPage.split(0, new long[] { level }); DirEntry oldRootEntry = new DirEntry(firstKey, newBlkNum); insert(oldRootEntry); insert(e); setLevelFlag(currentPage, level + 1); }
java
public void makeNewRoot(DirEntry e) { // makes sure it is opening the root block if (currentPage.currentBlk().number() != 0) { currentPage.close(); currentPage = new BTreePage(new BlockId(currentPage.currentBlk().fileName(), 0), NUM_FLAGS, schema, tx); } SearchKey firstKey = getKey(currentPage, 0, keyType.length()); long level = getLevelFlag(currentPage); // transfer all records to the new block long newBlkNum = currentPage.split(0, new long[] { level }); DirEntry oldRootEntry = new DirEntry(firstKey, newBlkNum); insert(oldRootEntry); insert(e); setLevelFlag(currentPage, level + 1); }
[ "public", "void", "makeNewRoot", "(", "DirEntry", "e", ")", "{", "// makes sure it is opening the root block\r", "if", "(", "currentPage", ".", "currentBlk", "(", ")", ".", "number", "(", ")", "!=", "0", ")", "{", "currentPage", ".", "close", "(", ")", ";", ...
Creates a new root block for the B-tree. The new root will have two children: the old root, and the specified block. Since the root must always be in block 0 of the file, the contents of block 0 will get transferred to a new block (serving as the old root). @param e the directory entry to be added as a child of the new root
[ "Creates", "a", "new", "root", "block", "for", "the", "B", "-", "tree", ".", "The", "new", "root", "will", "have", "two", "children", ":", "the", "old", "root", "and", "the", "specified", "block", ".", "Since", "the", "root", "must", "always", "be", ...
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/index/btree/BTreeDir.java#L186-L202
stripe/stripe-android
stripe/src/main/java/com/stripe/android/model/SourceParams.java
SourceParams.setMetaData
@NonNull public SourceParams setMetaData(@NonNull Map<String, String> metaData) { """ Set custom metadata on the parameters. @param metaData @return {@code this}, for chaining purposes """ mMetaData = metaData; return this; }
java
@NonNull public SourceParams setMetaData(@NonNull Map<String, String> metaData) { mMetaData = metaData; return this; }
[ "@", "NonNull", "public", "SourceParams", "setMetaData", "(", "@", "NonNull", "Map", "<", "String", ",", "String", ">", "metaData", ")", "{", "mMetaData", "=", "metaData", ";", "return", "this", ";", "}" ]
Set custom metadata on the parameters. @param metaData @return {@code this}, for chaining purposes
[ "Set", "custom", "metadata", "on", "the", "parameters", "." ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/model/SourceParams.java#L805-L809
Netflix/conductor
grpc-server/src/main/java/com/netflix/conductor/grpc/server/service/GRPCHelper.java
GRPCHelper.optionalOr
String optionalOr(@Nonnull String str, String defaults) { """ Check if a given non-null String instance is "missing" according to ProtoBuf's missing field rules. If the String is missing, the given default value will be returned. Otherwise, the string itself will be returned. @param str the input String @param defaults the default value for the string @return 'str' if it is not empty according to ProtoBuf rules; 'defaults' otherwise """ return str.isEmpty() ? defaults : str; }
java
String optionalOr(@Nonnull String str, String defaults) { return str.isEmpty() ? defaults : str; }
[ "String", "optionalOr", "(", "@", "Nonnull", "String", "str", ",", "String", "defaults", ")", "{", "return", "str", ".", "isEmpty", "(", ")", "?", "defaults", ":", "str", ";", "}" ]
Check if a given non-null String instance is "missing" according to ProtoBuf's missing field rules. If the String is missing, the given default value will be returned. Otherwise, the string itself will be returned. @param str the input String @param defaults the default value for the string @return 'str' if it is not empty according to ProtoBuf rules; 'defaults' otherwise
[ "Check", "if", "a", "given", "non", "-", "null", "String", "instance", "is", "missing", "according", "to", "ProtoBuf", "s", "missing", "field", "rules", ".", "If", "the", "String", "is", "missing", "the", "given", "default", "value", "will", "be", "returne...
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/grpc-server/src/main/java/com/netflix/conductor/grpc/server/service/GRPCHelper.java#L123-L125
jenkinsci/gmaven
gmaven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java
MojoSupport.resolveArtifact
protected Artifact resolveArtifact(final Artifact artifact, final boolean transitive) throws MojoExecutionException { """ Resolves the Artifact from the remote repository if necessary. If no version is specified, it will be retrieved from the dependency list or from the DependencyManagement section of the pom. @param artifact The artifact to be resolved; must not be null @param transitive True to resolve the artifact transitively @return The resolved artifact; never null @throws MojoExecutionException Failed to resolve artifact """ assert artifact != null; try { if (transitive) { artifactResolver.resolveTransitively( Collections.singleton(artifact), project.getArtifact(), project.getRemoteArtifactRepositories(), artifactRepository, artifactMetadataSource); } else { artifactResolver.resolve( artifact, project.getRemoteArtifactRepositories(), artifactRepository); } } catch (ArtifactResolutionException e) { throw new MojoExecutionException("Unable to resolve artifact", e); } catch (ArtifactNotFoundException e) { throw new MojoExecutionException("Unable to find artifact", e); } return artifact; }
java
protected Artifact resolveArtifact(final Artifact artifact, final boolean transitive) throws MojoExecutionException { assert artifact != null; try { if (transitive) { artifactResolver.resolveTransitively( Collections.singleton(artifact), project.getArtifact(), project.getRemoteArtifactRepositories(), artifactRepository, artifactMetadataSource); } else { artifactResolver.resolve( artifact, project.getRemoteArtifactRepositories(), artifactRepository); } } catch (ArtifactResolutionException e) { throw new MojoExecutionException("Unable to resolve artifact", e); } catch (ArtifactNotFoundException e) { throw new MojoExecutionException("Unable to find artifact", e); } return artifact; }
[ "protected", "Artifact", "resolveArtifact", "(", "final", "Artifact", "artifact", ",", "final", "boolean", "transitive", ")", "throws", "MojoExecutionException", "{", "assert", "artifact", "!=", "null", ";", "try", "{", "if", "(", "transitive", ")", "{", "artifa...
Resolves the Artifact from the remote repository if necessary. If no version is specified, it will be retrieved from the dependency list or from the DependencyManagement section of the pom. @param artifact The artifact to be resolved; must not be null @param transitive True to resolve the artifact transitively @return The resolved artifact; never null @throws MojoExecutionException Failed to resolve artifact
[ "Resolves", "the", "Artifact", "from", "the", "remote", "repository", "if", "necessary", ".", "If", "no", "version", "is", "specified", "it", "will", "be", "retrieved", "from", "the", "dependency", "list", "or", "from", "the", "DependencyManagement", "section", ...
train
https://github.com/jenkinsci/gmaven/blob/80d5f6657e15b3e05ffbb82128ed8bb280836e10/gmaven-plugin/src/main/java/org/codehaus/gmaven/plugin/MojoSupport.java#L255-L282
baratine/baratine
web/src/main/java/com/caucho/v5/http/dispatch/InvocationManager.java
InvocationManager.buildInvocation
public I buildInvocation(Object protocolKey, I invocation) throws ConfigException { """ Builds the invocation, saving its value keyed by the protocol key. @param protocolKey protocol-specific key to save the invocation in @param invocation the invocation to build. """ Objects.requireNonNull(invocation); invocation = buildInvocation(invocation); // XXX: see if can remove this, and rely on the invocation cache existing LruCache<Object,I> invocationCache = _invocationCache; if (invocationCache != null) { I oldInvocation; oldInvocation = invocationCache.get(protocolKey); // server/10r2 if (oldInvocation != null && ! oldInvocation.isModified()) { return oldInvocation; } if (invocation.getURLLength() < _maxURLLength) { invocationCache.put(protocolKey, invocation); } } return invocation; }
java
public I buildInvocation(Object protocolKey, I invocation) throws ConfigException { Objects.requireNonNull(invocation); invocation = buildInvocation(invocation); // XXX: see if can remove this, and rely on the invocation cache existing LruCache<Object,I> invocationCache = _invocationCache; if (invocationCache != null) { I oldInvocation; oldInvocation = invocationCache.get(protocolKey); // server/10r2 if (oldInvocation != null && ! oldInvocation.isModified()) { return oldInvocation; } if (invocation.getURLLength() < _maxURLLength) { invocationCache.put(protocolKey, invocation); } } return invocation; }
[ "public", "I", "buildInvocation", "(", "Object", "protocolKey", ",", "I", "invocation", ")", "throws", "ConfigException", "{", "Objects", ".", "requireNonNull", "(", "invocation", ")", ";", "invocation", "=", "buildInvocation", "(", "invocation", ")", ";", "// X...
Builds the invocation, saving its value keyed by the protocol key. @param protocolKey protocol-specific key to save the invocation in @param invocation the invocation to build.
[ "Builds", "the", "invocation", "saving", "its", "value", "keyed", "by", "the", "protocol", "key", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/dispatch/InvocationManager.java#L157-L182
aoindustries/aocode-public
src/main/java/com/aoindustries/servlet/http/Includer.java
Includer.setLocation
public static void setLocation(HttpServletRequest request, HttpServletResponse response, String location) { """ Sets a Location header. When not in an included page, calls setHeader directly. When inside of an include will set request attribute so outermost include can call setHeader. """ if(request.getAttribute(IS_INCLUDED_REQUEST_ATTRIBUTE_NAME) == null) { // Not included, setHeader directly response.setHeader("Location", location); } else { // Is included, set attribute so top level tag can perform actual setHeader call request.setAttribute(LOCATION_REQUEST_ATTRIBUTE_NAME, location); } }
java
public static void setLocation(HttpServletRequest request, HttpServletResponse response, String location) { if(request.getAttribute(IS_INCLUDED_REQUEST_ATTRIBUTE_NAME) == null) { // Not included, setHeader directly response.setHeader("Location", location); } else { // Is included, set attribute so top level tag can perform actual setHeader call request.setAttribute(LOCATION_REQUEST_ATTRIBUTE_NAME, location); } }
[ "public", "static", "void", "setLocation", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "String", "location", ")", "{", "if", "(", "request", ".", "getAttribute", "(", "IS_INCLUDED_REQUEST_ATTRIBUTE_NAME", ")", "==", "null", ")"...
Sets a Location header. When not in an included page, calls setHeader directly. When inside of an include will set request attribute so outermost include can call setHeader.
[ "Sets", "a", "Location", "header", ".", "When", "not", "in", "an", "included", "page", "calls", "setHeader", "directly", ".", "When", "inside", "of", "an", "include", "will", "set", "request", "attribute", "so", "outermost", "include", "can", "call", "setHea...
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/http/Includer.java#L127-L135
gsi-upm/Shanks
shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/Scenario3DPortrayal.java
Scenario3DPortrayal.situateDevice
public void situateDevice(Device d, double x, double y, double z) { """ To place a device in the simulation @param d @param x @param y @param z """ devices.setObjectLocation(d, new Double3D(x, y, z)); }
java
public void situateDevice(Device d, double x, double y, double z) { devices.setObjectLocation(d, new Double3D(x, y, z)); }
[ "public", "void", "situateDevice", "(", "Device", "d", ",", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "devices", ".", "setObjectLocation", "(", "d", ",", "new", "Double3D", "(", "x", ",", "y", ",", "z", ")", ")", ";", "}" ]
To place a device in the simulation @param d @param x @param y @param z
[ "To", "place", "a", "device", "in", "the", "simulation" ]
train
https://github.com/gsi-upm/Shanks/blob/35d87a81c22731f4f83bbd0571c9c6d466bd16be/shanks-core/src/main/java/es/upm/dit/gsi/shanks/model/scenario/portrayal/Scenario3DPortrayal.java#L181-L183
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/PippoSettings.java
PippoSettings.getInteger
public int getInteger(String name, int defaultValue) { """ Returns the integer value for the specified name. If the name does not exist or the value for the name can not be interpreted as an integer, the defaultValue is returned. @param name @param defaultValue @return name value or defaultValue """ try { String value = getString(name, null); if (!StringUtils.isNullOrEmpty(value)) { return Integer.parseInt(value.trim()); } } catch (NumberFormatException e) { log.warn("Failed to parse integer for " + name + USING_DEFAULT_OF + defaultValue); } return defaultValue; }
java
public int getInteger(String name, int defaultValue) { try { String value = getString(name, null); if (!StringUtils.isNullOrEmpty(value)) { return Integer.parseInt(value.trim()); } } catch (NumberFormatException e) { log.warn("Failed to parse integer for " + name + USING_DEFAULT_OF + defaultValue); } return defaultValue; }
[ "public", "int", "getInteger", "(", "String", "name", ",", "int", "defaultValue", ")", "{", "try", "{", "String", "value", "=", "getString", "(", "name", ",", "null", ")", ";", "if", "(", "!", "StringUtils", ".", "isNullOrEmpty", "(", "value", ")", ")"...
Returns the integer value for the specified name. If the name does not exist or the value for the name can not be interpreted as an integer, the defaultValue is returned. @param name @param defaultValue @return name value or defaultValue
[ "Returns", "the", "integer", "value", "for", "the", "specified", "name", ".", "If", "the", "name", "does", "not", "exist", "or", "the", "value", "for", "the", "name", "can", "not", "be", "interpreted", "as", "an", "integer", "the", "defaultValue", "is", ...
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/PippoSettings.java#L495-L507
aws/aws-cloudtrail-processing-library
src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/factory/EventReaderFactory.java
EventReaderFactory.createReader
public EventReader createReader() { """ Create an instance of an {@link EventReader}. @return the {@link EventReader}. """ return new EventReader(eventsProcessor, sourceFilter, eventFilter, progressReporter, exceptionHandler, sqsManager, s3Manager, config); }
java
public EventReader createReader() { return new EventReader(eventsProcessor, sourceFilter, eventFilter, progressReporter, exceptionHandler, sqsManager, s3Manager, config); }
[ "public", "EventReader", "createReader", "(", ")", "{", "return", "new", "EventReader", "(", "eventsProcessor", ",", "sourceFilter", ",", "eventFilter", ",", "progressReporter", ",", "exceptionHandler", ",", "sqsManager", ",", "s3Manager", ",", "config", ")", ";",...
Create an instance of an {@link EventReader}. @return the {@link EventReader}.
[ "Create", "an", "instance", "of", "an", "{", "@link", "EventReader", "}", "." ]
train
https://github.com/aws/aws-cloudtrail-processing-library/blob/411315808d8d3dc6b45e4182212e3e04d82e3782/src/main/java/com/amazonaws/services/cloudtrail/processinglibrary/factory/EventReaderFactory.java#L130-L132
alexa/alexa-skills-kit-sdk-for-java
ask-sdk-core/src/com/amazon/ask/attributes/AttributesManager.java
AttributesManager.setPersistentAttributes
public void setPersistentAttributes(Map<String, Object> persistentAttributes) { """ Sets persistent attributes. The attributes set using this method will replace any existing persistent attributes, but the changes will not be persisted back until {@link #savePersistentAttributes()} is called. Use this method when bulk replacing attributes is desired. An exception is thrown if this method is called when a {@link PersistenceAdapter} is not configured on the SDK. @param persistentAttributes persistent attributes to set @throws IllegalStateException if no {@link PersistenceAdapter} is configured """ if (persistenceAdapter == null) { throw new IllegalStateException("Attempting to set persistence attributes without configured persistence adapter"); } this.persistentAttributes = persistentAttributes; persistenceAttributesSet = true; }
java
public void setPersistentAttributes(Map<String, Object> persistentAttributes) { if (persistenceAdapter == null) { throw new IllegalStateException("Attempting to set persistence attributes without configured persistence adapter"); } this.persistentAttributes = persistentAttributes; persistenceAttributesSet = true; }
[ "public", "void", "setPersistentAttributes", "(", "Map", "<", "String", ",", "Object", ">", "persistentAttributes", ")", "{", "if", "(", "persistenceAdapter", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Attempting to set persistence attrib...
Sets persistent attributes. The attributes set using this method will replace any existing persistent attributes, but the changes will not be persisted back until {@link #savePersistentAttributes()} is called. Use this method when bulk replacing attributes is desired. An exception is thrown if this method is called when a {@link PersistenceAdapter} is not configured on the SDK. @param persistentAttributes persistent attributes to set @throws IllegalStateException if no {@link PersistenceAdapter} is configured
[ "Sets", "persistent", "attributes", ".", "The", "attributes", "set", "using", "this", "method", "will", "replace", "any", "existing", "persistent", "attributes", "but", "the", "changes", "will", "not", "be", "persisted", "back", "until", "{", "@link", "#savePers...
train
https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/attributes/AttributesManager.java#L149-L155
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelV1ServerState.java
PaymentChannelV1ServerState.provideRefundTransaction
public synchronized byte[] provideRefundTransaction(Transaction refundTx, byte[] clientMultiSigPubKey) throws VerificationException { """ Called when the client provides the refund transaction. The refund transaction must have one input from the multisig contract (that we don't have yet) and one output that the client creates to themselves. This object will later be modified when we start getting paid. @param refundTx The refund transaction, this object will be mutated when payment is incremented. @param clientMultiSigPubKey The client's pubkey which is required for the multisig output @return Our signature that makes the refund transaction valid @throws VerificationException If the transaction isnt valid or did not meet the requirements of a refund transaction. """ checkNotNull(refundTx); checkNotNull(clientMultiSigPubKey); stateMachine.checkState(State.WAITING_FOR_REFUND_TRANSACTION); log.info("Provided with refund transaction: {}", refundTx); // Do a few very basic syntax sanity checks. refundTx.verify(); // Verify that the refund transaction has a single input (that we can fill to sign the multisig output). if (refundTx.getInputs().size() != 1) throw new VerificationException("Refund transaction does not have exactly one input"); // Verify that the refund transaction has a time lock on it and a sequence number that does not disable lock time. if (refundTx.getInput(0).getSequenceNumber() == TransactionInput.NO_SEQUENCE) throw new VerificationException("Refund transaction's input's sequence number disables lock time"); if (refundTx.getLockTime() < minExpireTime) throw new VerificationException("Refund transaction has a lock time too soon"); // Verify the transaction has one output (we don't care about its contents, its up to the client) // Note that because we sign with SIGHASH_NONE|SIGHASH_ANYOENCANPAY the client can later add more outputs and // inputs, but we will need only one output later to create the paying transactions if (refundTx.getOutputs().size() != 1) throw new VerificationException("Refund transaction does not have exactly one output"); refundTransactionUnlockTimeSecs = refundTx.getLockTime(); // Sign the refund tx with the scriptPubKey and return the signature. We don't have the spending transaction // so do the steps individually. clientKey = ECKey.fromPublicOnly(clientMultiSigPubKey); Script multisigPubKey = ScriptBuilder.createMultiSigOutputScript(2, ImmutableList.of(clientKey, serverKey)); // We are really only signing the fact that the transaction has a proper lock time and don't care about anything // else, so we sign SIGHASH_NONE and SIGHASH_ANYONECANPAY. TransactionSignature sig = refundTx.calculateSignature(0, serverKey, multisigPubKey, Transaction.SigHash.NONE, true); log.info("Signed refund transaction."); this.clientOutput = refundTx.getOutput(0); stateMachine.transition(State.WAITING_FOR_MULTISIG_CONTRACT); return sig.encodeToBitcoin(); }
java
public synchronized byte[] provideRefundTransaction(Transaction refundTx, byte[] clientMultiSigPubKey) throws VerificationException { checkNotNull(refundTx); checkNotNull(clientMultiSigPubKey); stateMachine.checkState(State.WAITING_FOR_REFUND_TRANSACTION); log.info("Provided with refund transaction: {}", refundTx); // Do a few very basic syntax sanity checks. refundTx.verify(); // Verify that the refund transaction has a single input (that we can fill to sign the multisig output). if (refundTx.getInputs().size() != 1) throw new VerificationException("Refund transaction does not have exactly one input"); // Verify that the refund transaction has a time lock on it and a sequence number that does not disable lock time. if (refundTx.getInput(0).getSequenceNumber() == TransactionInput.NO_SEQUENCE) throw new VerificationException("Refund transaction's input's sequence number disables lock time"); if (refundTx.getLockTime() < minExpireTime) throw new VerificationException("Refund transaction has a lock time too soon"); // Verify the transaction has one output (we don't care about its contents, its up to the client) // Note that because we sign with SIGHASH_NONE|SIGHASH_ANYOENCANPAY the client can later add more outputs and // inputs, but we will need only one output later to create the paying transactions if (refundTx.getOutputs().size() != 1) throw new VerificationException("Refund transaction does not have exactly one output"); refundTransactionUnlockTimeSecs = refundTx.getLockTime(); // Sign the refund tx with the scriptPubKey and return the signature. We don't have the spending transaction // so do the steps individually. clientKey = ECKey.fromPublicOnly(clientMultiSigPubKey); Script multisigPubKey = ScriptBuilder.createMultiSigOutputScript(2, ImmutableList.of(clientKey, serverKey)); // We are really only signing the fact that the transaction has a proper lock time and don't care about anything // else, so we sign SIGHASH_NONE and SIGHASH_ANYONECANPAY. TransactionSignature sig = refundTx.calculateSignature(0, serverKey, multisigPubKey, Transaction.SigHash.NONE, true); log.info("Signed refund transaction."); this.clientOutput = refundTx.getOutput(0); stateMachine.transition(State.WAITING_FOR_MULTISIG_CONTRACT); return sig.encodeToBitcoin(); }
[ "public", "synchronized", "byte", "[", "]", "provideRefundTransaction", "(", "Transaction", "refundTx", ",", "byte", "[", "]", "clientMultiSigPubKey", ")", "throws", "VerificationException", "{", "checkNotNull", "(", "refundTx", ")", ";", "checkNotNull", "(", "clien...
Called when the client provides the refund transaction. The refund transaction must have one input from the multisig contract (that we don't have yet) and one output that the client creates to themselves. This object will later be modified when we start getting paid. @param refundTx The refund transaction, this object will be mutated when payment is incremented. @param clientMultiSigPubKey The client's pubkey which is required for the multisig output @return Our signature that makes the refund transaction valid @throws VerificationException If the transaction isnt valid or did not meet the requirements of a refund transaction.
[ "Called", "when", "the", "client", "provides", "the", "refund", "transaction", ".", "The", "refund", "transaction", "must", "have", "one", "input", "from", "the", "multisig", "contract", "(", "that", "we", "don", "t", "have", "yet", ")", "and", "one", "out...
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/protocols/channels/PaymentChannelV1ServerState.java#L124-L158
finmath/finmath-lib
src/main/java6/net/finmath/marketdata/model/curves/HazardCurve.java
HazardCurve.createHazardCurveFromSurvivalProbabilities
public static HazardCurve createHazardCurveFromSurvivalProbabilities( String name, double[] times, double[] givenSurvivalProbabilities, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) { """ Create a hazard curve from given times and given survival probabilities using given interpolation and extrapolation methods. @param name The name of this hazard curve. @param times Array of times as doubles. @param givenSurvivalProbabilities Array of corresponding survival probabilities. @param interpolationMethod The interpolation method used for the curve. @param extrapolationMethod The extrapolation method used for the curve. @param interpolationEntity The entity interpolated/extrapolated. @return A new discount factor object. """ boolean[] isParameter = new boolean[times.length]; for(int timeIndex=0; timeIndex<times.length;timeIndex++) { isParameter[timeIndex] = times[timeIndex] > 0; } return createHazardCurveFromSurvivalProbabilities(name, times, givenSurvivalProbabilities, isParameter, interpolationMethod, extrapolationMethod, interpolationEntity); }
java
public static HazardCurve createHazardCurveFromSurvivalProbabilities( String name, double[] times, double[] givenSurvivalProbabilities, InterpolationMethod interpolationMethod, ExtrapolationMethod extrapolationMethod, InterpolationEntity interpolationEntity) { boolean[] isParameter = new boolean[times.length]; for(int timeIndex=0; timeIndex<times.length;timeIndex++) { isParameter[timeIndex] = times[timeIndex] > 0; } return createHazardCurveFromSurvivalProbabilities(name, times, givenSurvivalProbabilities, isParameter, interpolationMethod, extrapolationMethod, interpolationEntity); }
[ "public", "static", "HazardCurve", "createHazardCurveFromSurvivalProbabilities", "(", "String", "name", ",", "double", "[", "]", "times", ",", "double", "[", "]", "givenSurvivalProbabilities", ",", "InterpolationMethod", "interpolationMethod", ",", "ExtrapolationMethod", ...
Create a hazard curve from given times and given survival probabilities using given interpolation and extrapolation methods. @param name The name of this hazard curve. @param times Array of times as doubles. @param givenSurvivalProbabilities Array of corresponding survival probabilities. @param interpolationMethod The interpolation method used for the curve. @param extrapolationMethod The extrapolation method used for the curve. @param interpolationEntity The entity interpolated/extrapolated. @return A new discount factor object.
[ "Create", "a", "hazard", "curve", "from", "given", "times", "and", "given", "survival", "probabilities", "using", "given", "interpolation", "and", "extrapolation", "methods", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/marketdata/model/curves/HazardCurve.java#L129-L142
lessthanoptimal/ejml
main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QRDecompositionHouseholderTran_ZDRM.java
QRDecompositionHouseholderTran_ZDRM.getQ
@Override public ZMatrixRMaj getQ(ZMatrixRMaj Q , boolean compact ) { """ Computes the Q matrix from the information stored in the QR matrix. This operation requires about 4(m<sup>2</sup>n-mn<sup>2</sup>+n<sup>3</sup>/3) flops. @param Q The orthogonal Q matrix. """ if( compact ) Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,minLength); else Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,numRows); // Unlike applyQ() this takes advantage of zeros in the identity matrix // by not multiplying across all rows. for( int j = minLength-1; j >= 0; j-- ) { int diagIndex = (j*numRows+j)*2; double realBefore = QR.data[diagIndex]; double imagBefore = QR.data[diagIndex+1]; QR.data[diagIndex] = 1; QR.data[diagIndex+1] = 0; QrHelperFunctions_ZDRM.rank1UpdateMultR(Q, QR.data, j * numRows, gammas[j], j, j, numRows, v); QR.data[diagIndex] = realBefore; QR.data[diagIndex+1] = imagBefore; } return Q; }
java
@Override public ZMatrixRMaj getQ(ZMatrixRMaj Q , boolean compact ) { if( compact ) Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,minLength); else Q = UtilDecompositons_ZDRM.checkIdentity(Q,numRows,numRows); // Unlike applyQ() this takes advantage of zeros in the identity matrix // by not multiplying across all rows. for( int j = minLength-1; j >= 0; j-- ) { int diagIndex = (j*numRows+j)*2; double realBefore = QR.data[diagIndex]; double imagBefore = QR.data[diagIndex+1]; QR.data[diagIndex] = 1; QR.data[diagIndex+1] = 0; QrHelperFunctions_ZDRM.rank1UpdateMultR(Q, QR.data, j * numRows, gammas[j], j, j, numRows, v); QR.data[diagIndex] = realBefore; QR.data[diagIndex+1] = imagBefore; } return Q; }
[ "@", "Override", "public", "ZMatrixRMaj", "getQ", "(", "ZMatrixRMaj", "Q", ",", "boolean", "compact", ")", "{", "if", "(", "compact", ")", "Q", "=", "UtilDecompositons_ZDRM", ".", "checkIdentity", "(", "Q", ",", "numRows", ",", "minLength", ")", ";", "else...
Computes the Q matrix from the information stored in the QR matrix. This operation requires about 4(m<sup>2</sup>n-mn<sup>2</sup>+n<sup>3</sup>/3) flops. @param Q The orthogonal Q matrix.
[ "Computes", "the", "Q", "matrix", "from", "the", "information", "stored", "in", "the", "QR", "matrix", ".", "This", "operation", "requires", "about", "4", "(", "m<sup", ">", "2<", "/", "sup", ">", "n", "-", "mn<sup", ">", "2<", "/", "sup", ">", "+", ...
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-zdense/src/org/ejml/dense/row/decompose/qr/QRDecompositionHouseholderTran_ZDRM.java#L100-L124
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuStringUtil.java
GosuStringUtil.substringBetween
public static String substringBetween(String str, String tag) { """ <p>Gets the String that is nested in between two instances of the same String.</p> <p>A <code>null</code> input String returns <code>null</code>. A <code>null</code> tag returns <code>null</code>.</p> <pre> GosuStringUtil.substringBetween(null, *) = null GosuStringUtil.substringBetween("", "") = "" GosuStringUtil.substringBetween("", "tag") = null GosuStringUtil.substringBetween("tagabctag", null) = null GosuStringUtil.substringBetween("tagabctag", "") = "" GosuStringUtil.substringBetween("tagabctag", "tag") = "abc" </pre> @param str the String containing the substring, may be null @param tag the String before and after the substring, may be null @return the substring, <code>null</code> if no match @since 2.0 """ return substringBetween(str, tag, tag); }
java
public static String substringBetween(String str, String tag) { return substringBetween(str, tag, tag); }
[ "public", "static", "String", "substringBetween", "(", "String", "str", ",", "String", "tag", ")", "{", "return", "substringBetween", "(", "str", ",", "tag", ",", "tag", ")", ";", "}" ]
<p>Gets the String that is nested in between two instances of the same String.</p> <p>A <code>null</code> input String returns <code>null</code>. A <code>null</code> tag returns <code>null</code>.</p> <pre> GosuStringUtil.substringBetween(null, *) = null GosuStringUtil.substringBetween("", "") = "" GosuStringUtil.substringBetween("", "tag") = null GosuStringUtil.substringBetween("tagabctag", null) = null GosuStringUtil.substringBetween("tagabctag", "") = "" GosuStringUtil.substringBetween("tagabctag", "tag") = "abc" </pre> @param str the String containing the substring, may be null @param tag the String before and after the substring, may be null @return the substring, <code>null</code> if no match @since 2.0
[ "<p", ">", "Gets", "the", "String", "that", "is", "nested", "in", "between", "two", "instances", "of", "the", "same", "String", ".", "<", "/", "p", ">" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L1899-L1901
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/Utils.java
Utils.dumpClass
public static void dumpClass(String file, byte[] bytes) { """ Dump some bytes into the specified file. @param file full filename for where to dump the stuff (e.g. c:/temp/Foo.class) @param bytes the bytes to write to the file """ File f = new File(file); try { FileOutputStream fos = new FileOutputStream(f); fos.write(bytes); fos.flush(); fos.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
java
public static void dumpClass(String file, byte[] bytes) { File f = new File(file); try { FileOutputStream fos = new FileOutputStream(f); fos.write(bytes); fos.flush(); fos.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }
[ "public", "static", "void", "dumpClass", "(", "String", "file", ",", "byte", "[", "]", "bytes", ")", "{", "File", "f", "=", "new", "File", "(", "file", ")", ";", "try", "{", "FileOutputStream", "fos", "=", "new", "FileOutputStream", "(", "f", ")", ";...
Dump some bytes into the specified file. @param file full filename for where to dump the stuff (e.g. c:/temp/Foo.class) @param bytes the bytes to write to the file
[ "Dump", "some", "bytes", "into", "the", "specified", "file", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/Utils.java#L1200-L1211
ben-manes/caffeine
caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java
BoundedLocalCache.afterRead
void afterRead(Node<K, V> node, long now, boolean recordHit) { """ Performs the post-processing work required after a read. @param node the entry in the page replacement policy @param now the current time, in nanoseconds @param recordHit if the hit count should be incremented """ if (recordHit) { statsCounter().recordHits(1); } boolean delayable = skipReadBuffer() || (readBuffer.offer(node) != Buffer.FULL); if (shouldDrainBuffers(delayable)) { scheduleDrainBuffers(); } refreshIfNeeded(node, now); }
java
void afterRead(Node<K, V> node, long now, boolean recordHit) { if (recordHit) { statsCounter().recordHits(1); } boolean delayable = skipReadBuffer() || (readBuffer.offer(node) != Buffer.FULL); if (shouldDrainBuffers(delayable)) { scheduleDrainBuffers(); } refreshIfNeeded(node, now); }
[ "void", "afterRead", "(", "Node", "<", "K", ",", "V", ">", "node", ",", "long", "now", ",", "boolean", "recordHit", ")", "{", "if", "(", "recordHit", ")", "{", "statsCounter", "(", ")", ".", "recordHits", "(", "1", ")", ";", "}", "boolean", "delaya...
Performs the post-processing work required after a read. @param node the entry in the page replacement policy @param now the current time, in nanoseconds @param recordHit if the hit count should be incremented
[ "Performs", "the", "post", "-", "processing", "work", "required", "after", "a", "read", "." ]
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java#L1106-L1116
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WFieldLayoutRenderer.java
WFieldLayoutRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WFieldLayout. @param component the WFieldLayout to paint. @param renderContext the RenderContext to paint to. """ WFieldLayout fieldLayout = (WFieldLayout) component; XmlStringBuilder xml = renderContext.getWriter(); int labelWidth = fieldLayout.getLabelWidth(); String title = fieldLayout.getTitle(); xml.appendTagOpen("ui:fieldlayout"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", fieldLayout.isHidden(), "true"); xml.appendOptionalAttribute("labelWidth", labelWidth > 0, labelWidth); xml.appendAttribute("layout", fieldLayout.getLayoutType()); xml.appendOptionalAttribute("title", title); // Ordered layout if (fieldLayout.isOrdered()) { xml.appendAttribute("ordered", fieldLayout.getOrderedOffset()); } xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(fieldLayout, renderContext); // Paint Fields paintChildren(fieldLayout, renderContext); xml.appendEndTag("ui:fieldlayout"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WFieldLayout fieldLayout = (WFieldLayout) component; XmlStringBuilder xml = renderContext.getWriter(); int labelWidth = fieldLayout.getLabelWidth(); String title = fieldLayout.getTitle(); xml.appendTagOpen("ui:fieldlayout"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", fieldLayout.isHidden(), "true"); xml.appendOptionalAttribute("labelWidth", labelWidth > 0, labelWidth); xml.appendAttribute("layout", fieldLayout.getLayoutType()); xml.appendOptionalAttribute("title", title); // Ordered layout if (fieldLayout.isOrdered()) { xml.appendAttribute("ordered", fieldLayout.getOrderedOffset()); } xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(fieldLayout, renderContext); // Paint Fields paintChildren(fieldLayout, renderContext); xml.appendEndTag("ui:fieldlayout"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WFieldLayout", "fieldLayout", "=", "(", "WFieldLayout", ")", "component", ";", "XmlStringBuilder", "xml", "=", ...
Paints the given WFieldLayout. @param component the WFieldLayout to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WFieldLayout", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WFieldLayoutRenderer.java#L23-L51
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.listKeysAsync
public Observable<Page<SharedAccessSignatureAuthorizationRuleInner>> listKeysAsync(final String resourceGroupName, final String resourceName) { """ Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SharedAccessSignatureAuthorizationRuleInner&gt; object """ return listKeysWithServiceResponseAsync(resourceGroupName, resourceName) .map(new Func1<ServiceResponse<Page<SharedAccessSignatureAuthorizationRuleInner>>, Page<SharedAccessSignatureAuthorizationRuleInner>>() { @Override public Page<SharedAccessSignatureAuthorizationRuleInner> call(ServiceResponse<Page<SharedAccessSignatureAuthorizationRuleInner>> response) { return response.body(); } }); }
java
public Observable<Page<SharedAccessSignatureAuthorizationRuleInner>> listKeysAsync(final String resourceGroupName, final String resourceName) { return listKeysWithServiceResponseAsync(resourceGroupName, resourceName) .map(new Func1<ServiceResponse<Page<SharedAccessSignatureAuthorizationRuleInner>>, Page<SharedAccessSignatureAuthorizationRuleInner>>() { @Override public Page<SharedAccessSignatureAuthorizationRuleInner> call(ServiceResponse<Page<SharedAccessSignatureAuthorizationRuleInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "SharedAccessSignatureAuthorizationRuleInner", ">", ">", "listKeysAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "resourceName", ")", "{", "return", "listKeysWithServiceResponseAsync", "(", "resourceG...
Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. Get the security metadata for an IoT hub. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-security. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SharedAccessSignatureAuthorizationRuleInner&gt; object
[ "Get", "the", "security", "metadata", "for", "an", "IoT", "hub", ".", "For", "more", "information", "see", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com", "/", "azure", "/", "iot", "-", "hub", "/", "iot", "-", "hub", "-", "devguide", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L2882-L2890
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource_hw.java
xen_health_resource_hw.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ xen_health_resource_hw_responses result = (xen_health_resource_hw_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_hw_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_resource_hw_response_array); } xen_health_resource_hw[] result_xen_health_resource_hw = new xen_health_resource_hw[result.xen_health_resource_hw_response_array.length]; for(int i = 0; i < result.xen_health_resource_hw_response_array.length; i++) { result_xen_health_resource_hw[i] = result.xen_health_resource_hw_response_array[i].xen_health_resource_hw[0]; } return result_xen_health_resource_hw; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_resource_hw_responses result = (xen_health_resource_hw_responses) service.get_payload_formatter().string_to_resource(xen_health_resource_hw_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_resource_hw_response_array); } xen_health_resource_hw[] result_xen_health_resource_hw = new xen_health_resource_hw[result.xen_health_resource_hw_response_array.length]; for(int i = 0; i < result.xen_health_resource_hw_response_array.length; i++) { result_xen_health_resource_hw[i] = result.xen_health_resource_hw_response_array[i].xen_health_resource_hw[0]; } return result_xen_health_resource_hw; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_health_resource_hw_responses", "result", "=", "(", "xen_health_resource_hw_responses", ")", "service", ".",...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_resource_hw.java#L173-L190
lucee/Lucee
core/src/main/java/lucee/runtime/converter/WDDXConverter.java
WDDXConverter._deserializeQueryField
private void _deserializeQueryField(Query query, Element field) throws PageException, ConverterException { """ deserilize a single Field of a query WDDX Object @param query @param field @throws ConverterException @throws PageException """ String name = field.getAttribute("name"); NodeList list = field.getChildNodes(); int len = list.getLength(); int count = 0; for (int i = 0; i < len; i++) { Node node = list.item(i); if (node instanceof Element) { query.setAt(KeyImpl.init(name), ++count, _deserialize((Element) node)); } } }
java
private void _deserializeQueryField(Query query, Element field) throws PageException, ConverterException { String name = field.getAttribute("name"); NodeList list = field.getChildNodes(); int len = list.getLength(); int count = 0; for (int i = 0; i < len; i++) { Node node = list.item(i); if (node instanceof Element) { query.setAt(KeyImpl.init(name), ++count, _deserialize((Element) node)); } } }
[ "private", "void", "_deserializeQueryField", "(", "Query", "query", ",", "Element", "field", ")", "throws", "PageException", ",", "ConverterException", "{", "String", "name", "=", "field", ".", "getAttribute", "(", "\"name\"", ")", ";", "NodeList", "list", "=", ...
deserilize a single Field of a query WDDX Object @param query @param field @throws ConverterException @throws PageException
[ "deserilize", "a", "single", "Field", "of", "a", "query", "WDDX", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/WDDXConverter.java#L702-L714
jpelzer/pelzer-util
src/main/java/com/pelzer/util/StringMan.java
StringMan.detokenize
public static String detokenize(String[] values, String delimiter) { """ Converts a string array into a single string with values delimited by the specified delimiter. """ return concat(values, delimiter, 0, values.length - 1); }
java
public static String detokenize(String[] values, String delimiter) { return concat(values, delimiter, 0, values.length - 1); }
[ "public", "static", "String", "detokenize", "(", "String", "[", "]", "values", ",", "String", "delimiter", ")", "{", "return", "concat", "(", "values", ",", "delimiter", ",", "0", ",", "values", ".", "length", "-", "1", ")", ";", "}" ]
Converts a string array into a single string with values delimited by the specified delimiter.
[ "Converts", "a", "string", "array", "into", "a", "single", "string", "with", "values", "delimited", "by", "the", "specified", "delimiter", "." ]
train
https://github.com/jpelzer/pelzer-util/blob/ec14f2573fd977d1442dba5d1507a264f5ea9aa6/src/main/java/com/pelzer/util/StringMan.java#L466-L468
io7m/jaffirm
com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Preconditions.java
Preconditions.checkPreconditionI
public static int checkPreconditionI( final int value, final boolean condition, final IntFunction<String> describer) { """ An {@code int} specialized version of {@link #checkPrecondition(Object, boolean, Function)}. @param value The value @param condition The predicate @param describer The describer for the predicate @return value @throws PreconditionViolationException If the predicate is false """ return innerCheckI(value, condition, describer); }
java
public static int checkPreconditionI( final int value, final boolean condition, final IntFunction<String> describer) { return innerCheckI(value, condition, describer); }
[ "public", "static", "int", "checkPreconditionI", "(", "final", "int", "value", ",", "final", "boolean", "condition", ",", "final", "IntFunction", "<", "String", ">", "describer", ")", "{", "return", "innerCheckI", "(", "value", ",", "condition", ",", "describe...
An {@code int} specialized version of {@link #checkPrecondition(Object, boolean, Function)}. @param value The value @param condition The predicate @param describer The describer for the predicate @return value @throws PreconditionViolationException If the predicate is false
[ "An", "{", "@code", "int", "}", "specialized", "version", "of", "{", "@link", "#checkPrecondition", "(", "Object", "boolean", "Function", ")", "}", "." ]
train
https://github.com/io7m/jaffirm/blob/c97d246242d381e48832838737418cfe4cb57b4d/com.io7m.jaffirm.core/src/main/java/com/io7m/jaffirm/core/Preconditions.java#L407-L413
andygibson/datafactory
src/main/java/org/fluttercode/datafactory/impl/DataFactory.java
DataFactory.getRandomWord
public String getRandomWord(final int minLength, final int maxLength) { """ Returns a valid word based on the length range passed in. The length will always be between the min and max length range inclusive. @param minLength minimum length of the word @param maxLength maximum length of the word @return a word of a length between min and max length """ validateMinMaxParams(minLength, maxLength); // special case if we need a single char if (maxLength == 1) { if (chance(50)) { return "a"; } return "I"; } // start from random pos and find the first word of the right size String[] words = contentDataValues.getWords(); int pos = random.nextInt(words.length); for (int i = 0; i < words.length; i++) { int idx = (i + pos) % words.length; String test = words[idx]; if (test.length() >= minLength && test.length() <= maxLength) { return test; } } // we haven't a word for this length so generate one return getRandomChars(minLength, maxLength); }
java
public String getRandomWord(final int minLength, final int maxLength) { validateMinMaxParams(minLength, maxLength); // special case if we need a single char if (maxLength == 1) { if (chance(50)) { return "a"; } return "I"; } // start from random pos and find the first word of the right size String[] words = contentDataValues.getWords(); int pos = random.nextInt(words.length); for (int i = 0; i < words.length; i++) { int idx = (i + pos) % words.length; String test = words[idx]; if (test.length() >= minLength && test.length() <= maxLength) { return test; } } // we haven't a word for this length so generate one return getRandomChars(minLength, maxLength); }
[ "public", "String", "getRandomWord", "(", "final", "int", "minLength", ",", "final", "int", "maxLength", ")", "{", "validateMinMaxParams", "(", "minLength", ",", "maxLength", ")", ";", "// special case if we need a single char\r", "if", "(", "maxLength", "==", "1", ...
Returns a valid word based on the length range passed in. The length will always be between the min and max length range inclusive. @param minLength minimum length of the word @param maxLength maximum length of the word @return a word of a length between min and max length
[ "Returns", "a", "valid", "word", "based", "on", "the", "length", "range", "passed", "in", ".", "The", "length", "will", "always", "be", "between", "the", "min", "and", "max", "length", "range", "inclusive", "." ]
train
https://github.com/andygibson/datafactory/blob/f748beb93844dea2ad6174715be3b70df0448a9c/src/main/java/org/fluttercode/datafactory/impl/DataFactory.java#L521-L545
resilience4j/resilience4j
resilience4j-metrics/src/main/java/io/github/resilience4j/metrics/BulkheadMetrics.java
BulkheadMetrics.ofBulkheadRegistry
public static BulkheadMetrics ofBulkheadRegistry(String prefix, BulkheadRegistry bulkheadRegistry) { """ Creates a new instance BulkheadMetrics {@link BulkheadMetrics} with specified metrics names prefix and a {@link BulkheadRegistry} as a source. @param prefix the prefix of metrics names @param bulkheadRegistry the registry of bulkheads """ return new BulkheadMetrics(prefix, bulkheadRegistry.getAllBulkheads()); }
java
public static BulkheadMetrics ofBulkheadRegistry(String prefix, BulkheadRegistry bulkheadRegistry) { return new BulkheadMetrics(prefix, bulkheadRegistry.getAllBulkheads()); }
[ "public", "static", "BulkheadMetrics", "ofBulkheadRegistry", "(", "String", "prefix", ",", "BulkheadRegistry", "bulkheadRegistry", ")", "{", "return", "new", "BulkheadMetrics", "(", "prefix", ",", "bulkheadRegistry", ".", "getAllBulkheads", "(", ")", ")", ";", "}" ]
Creates a new instance BulkheadMetrics {@link BulkheadMetrics} with specified metrics names prefix and a {@link BulkheadRegistry} as a source. @param prefix the prefix of metrics names @param bulkheadRegistry the registry of bulkheads
[ "Creates", "a", "new", "instance", "BulkheadMetrics", "{", "@link", "BulkheadMetrics", "}", "with", "specified", "metrics", "names", "prefix", "and", "a", "{", "@link", "BulkheadRegistry", "}", "as", "a", "source", "." ]
train
https://github.com/resilience4j/resilience4j/blob/fa843d30f531c00f0c3dc218b65a7f2bb51af336/resilience4j-metrics/src/main/java/io/github/resilience4j/metrics/BulkheadMetrics.java#L65-L67