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
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.listFromComputeNode
public PagedList<NodeFile> listFromComputeNode(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { """ Lists all of the files in task directories on the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node whose files you want to list. @param recursive Whether to list children of a directory. @param fileListFromComputeNodeOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;NodeFile&gt; object if successful. """ ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> response = listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions).toBlocking().single(); return new PagedList<NodeFile>(response.body()) { @Override public Page<NodeFile> nextPage(String nextPageLink) { FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; if (fileListFromComputeNodeOptions != null) { fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); } return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<NodeFile> listFromComputeNode(final String poolId, final String nodeId, final Boolean recursive, final FileListFromComputeNodeOptions fileListFromComputeNodeOptions) { ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> response = listFromComputeNodeSinglePageAsync(poolId, nodeId, recursive, fileListFromComputeNodeOptions).toBlocking().single(); return new PagedList<NodeFile>(response.body()) { @Override public Page<NodeFile> nextPage(String nextPageLink) { FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions = null; if (fileListFromComputeNodeOptions != null) { fileListFromComputeNodeNextOptions = new FileListFromComputeNodeNextOptions(); fileListFromComputeNodeNextOptions.withClientRequestId(fileListFromComputeNodeOptions.clientRequestId()); fileListFromComputeNodeNextOptions.withReturnClientRequestId(fileListFromComputeNodeOptions.returnClientRequestId()); fileListFromComputeNodeNextOptions.withOcpDate(fileListFromComputeNodeOptions.ocpDate()); } return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "NodeFile", ">", "listFromComputeNode", "(", "final", "String", "poolId", ",", "final", "String", "nodeId", ",", "final", "Boolean", "recursive", ",", "final", "FileListFromComputeNodeOptions", "fileListFromComputeNodeOptions", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">", ",", "FileListFromComputeNodeHeaders", ">", "response", "=", "listFromComputeNodeSinglePageAsync", "(", "poolId", ",", "nodeId", ",", "recursive", ",", "fileListFromComputeNodeOptions", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ";", "return", "new", "PagedList", "<", "NodeFile", ">", "(", "response", ".", "body", "(", ")", ")", "{", "@", "Override", "public", "Page", "<", "NodeFile", ">", "nextPage", "(", "String", "nextPageLink", ")", "{", "FileListFromComputeNodeNextOptions", "fileListFromComputeNodeNextOptions", "=", "null", ";", "if", "(", "fileListFromComputeNodeOptions", "!=", "null", ")", "{", "fileListFromComputeNodeNextOptions", "=", "new", "FileListFromComputeNodeNextOptions", "(", ")", ";", "fileListFromComputeNodeNextOptions", ".", "withClientRequestId", "(", "fileListFromComputeNodeOptions", ".", "clientRequestId", "(", ")", ")", ";", "fileListFromComputeNodeNextOptions", ".", "withReturnClientRequestId", "(", "fileListFromComputeNodeOptions", ".", "returnClientRequestId", "(", ")", ")", ";", "fileListFromComputeNodeNextOptions", ".", "withOcpDate", "(", "fileListFromComputeNodeOptions", ".", "ocpDate", "(", ")", ")", ";", "}", "return", "listFromComputeNodeNextSinglePageAsync", "(", "nextPageLink", ",", "fileListFromComputeNodeNextOptions", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}", "}", ";", "}" ]
Lists all of the files in task directories on the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node whose files you want to list. @param recursive Whether to list children of a directory. @param fileListFromComputeNodeOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;NodeFile&gt; object if successful.
[ "Lists", "all", "of", "the", "files", "in", "task", "directories", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2049-L2064
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.importAccessControlEntries
public void importAccessControlEntries(CmsResource resource, List<CmsAccessControlEntry> acEntries) throws CmsException { """ Writes a list of access control entries as new access control entries of a given resource.<p> Already existing access control entries of this resource are removed before.<p> @param resource the resource to attach the control entries to @param acEntries a list of <code>{@link CmsAccessControlEntry}</code> objects @throws CmsException if something goes wrong """ m_securityManager.importAccessControlEntries(m_context, resource, acEntries); }
java
public void importAccessControlEntries(CmsResource resource, List<CmsAccessControlEntry> acEntries) throws CmsException { m_securityManager.importAccessControlEntries(m_context, resource, acEntries); }
[ "public", "void", "importAccessControlEntries", "(", "CmsResource", "resource", ",", "List", "<", "CmsAccessControlEntry", ">", "acEntries", ")", "throws", "CmsException", "{", "m_securityManager", ".", "importAccessControlEntries", "(", "m_context", ",", "resource", ",", "acEntries", ")", ";", "}" ]
Writes a list of access control entries as new access control entries of a given resource.<p> Already existing access control entries of this resource are removed before.<p> @param resource the resource to attach the control entries to @param acEntries a list of <code>{@link CmsAccessControlEntry}</code> objects @throws CmsException if something goes wrong
[ "Writes", "a", "list", "of", "access", "control", "entries", "as", "new", "access", "control", "entries", "of", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1964-L1968
wigforss/Ka-Web
servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java
SystemPropertiesSetter.loadConfiguration
private SystemProperties loadConfiguration(String propertiesConfig, ServletContext context) throws IllegalStateException { """ Loads and returns the configuration. @param propertiesConfig Location of the configuration XML file. @param context Servlet Context to read configuration from. @return the configuration object. @throws IllegalStateException If configuration could not be read due to missing file or invalid XML content in the configuration file. """ InputStream inStream = null; try { inStream = getStreamForLocation(propertiesConfig, context); JAXBContext jaxb = JAXBContext.newInstance(SystemProperties.class.getPackage().getName()); return (SystemProperties) jaxb.createUnmarshaller().unmarshal(inStream); } catch (FileNotFoundException e) { throw new IllegalStateException("Could not find configuration file: " + propertiesConfig, e); } catch (JAXBException e) { throw new IllegalStateException("Error while reading file: " + propertiesConfig, e); } finally { if (inStream != null) { try { inStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }
java
private SystemProperties loadConfiguration(String propertiesConfig, ServletContext context) throws IllegalStateException{ InputStream inStream = null; try { inStream = getStreamForLocation(propertiesConfig, context); JAXBContext jaxb = JAXBContext.newInstance(SystemProperties.class.getPackage().getName()); return (SystemProperties) jaxb.createUnmarshaller().unmarshal(inStream); } catch (FileNotFoundException e) { throw new IllegalStateException("Could not find configuration file: " + propertiesConfig, e); } catch (JAXBException e) { throw new IllegalStateException("Error while reading file: " + propertiesConfig, e); } finally { if (inStream != null) { try { inStream.close(); } catch (IOException e) { e.printStackTrace(); } } } }
[ "private", "SystemProperties", "loadConfiguration", "(", "String", "propertiesConfig", ",", "ServletContext", "context", ")", "throws", "IllegalStateException", "{", "InputStream", "inStream", "=", "null", ";", "try", "{", "inStream", "=", "getStreamForLocation", "(", "propertiesConfig", ",", "context", ")", ";", "JAXBContext", "jaxb", "=", "JAXBContext", ".", "newInstance", "(", "SystemProperties", ".", "class", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ")", ";", "return", "(", "SystemProperties", ")", "jaxb", ".", "createUnmarshaller", "(", ")", ".", "unmarshal", "(", "inStream", ")", ";", "}", "catch", "(", "FileNotFoundException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Could not find configuration file: \"", "+", "propertiesConfig", ",", "e", ")", ";", "}", "catch", "(", "JAXBException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error while reading file: \"", "+", "propertiesConfig", ",", "e", ")", ";", "}", "finally", "{", "if", "(", "inStream", "!=", "null", ")", "{", "try", "{", "inStream", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "}", "}" ]
Loads and returns the configuration. @param propertiesConfig Location of the configuration XML file. @param context Servlet Context to read configuration from. @return the configuration object. @throws IllegalStateException If configuration could not be read due to missing file or invalid XML content in the configuration file.
[ "Loads", "and", "returns", "the", "configuration", "." ]
train
https://github.com/wigforss/Ka-Web/blob/bb6d8eacbefdeb7c8c6bb6135e55939d968fa433/servlet/src/main/java/org/kasource/web/servlet/listener/properties/SystemPropertiesSetter.java#L110-L130
VoltDB/voltdb
src/frontend/org/voltdb/RealVoltDB.java
RealVoltDB.recoverPartitions
private AbstractTopology recoverPartitions(AbstractTopology topology, String haGroup, Set<Integer> recoverPartitions) { """ recover the partition assignment from one of lost hosts in the same placement group for rejoin Use the placement group of the recovering host to find a matched host from the lost nodes in the topology If the partition count from the lost node is the same as the site count of the recovering host, The partitions on the lost node will be placed on the recovering host. Partition group layout will be maintained. Topology will be updated on ZK if successful @param topology The topology from ZK, which contains the partition assignments for live or lost hosts @param haGroup The placement group of the recovering host @param recoverPartitions the partition placement to be recovered on this host @return A list of partitions if recover effort is a success. """ long version = topology.version; if (!recoverPartitions.isEmpty()) { // In rejoin case, partition list from the rejoining node could be out of range if the rejoining // host is a previously elastic removed node or some other used nodes, if out of range, do not restore if (Collections.max(recoverPartitions) > Collections.max(m_cartographer.getPartitions())) { recoverPartitions.clear(); } } AbstractTopology recoveredTopo = AbstractTopology.mutateRecoverTopology(topology, m_messenger.getLiveHostIds(), m_messenger.getHostId(), haGroup, recoverPartitions); if (recoveredTopo == null) { return null; } List<Integer> partitions = Lists.newArrayList(recoveredTopo.getPartitionIdList(m_messenger.getHostId())); if (partitions != null && partitions.size() == m_catalogContext.getNodeSettings().getLocalSitesCount()) { TopologyZKUtils.updateTopologyToZK(m_messenger.getZK(), recoveredTopo); } if (version < recoveredTopo.version && !recoverPartitions.isEmpty()) { consoleLog.info("Partition placement layout has been restored for rejoining."); } return recoveredTopo; }
java
private AbstractTopology recoverPartitions(AbstractTopology topology, String haGroup, Set<Integer> recoverPartitions) { long version = topology.version; if (!recoverPartitions.isEmpty()) { // In rejoin case, partition list from the rejoining node could be out of range if the rejoining // host is a previously elastic removed node or some other used nodes, if out of range, do not restore if (Collections.max(recoverPartitions) > Collections.max(m_cartographer.getPartitions())) { recoverPartitions.clear(); } } AbstractTopology recoveredTopo = AbstractTopology.mutateRecoverTopology(topology, m_messenger.getLiveHostIds(), m_messenger.getHostId(), haGroup, recoverPartitions); if (recoveredTopo == null) { return null; } List<Integer> partitions = Lists.newArrayList(recoveredTopo.getPartitionIdList(m_messenger.getHostId())); if (partitions != null && partitions.size() == m_catalogContext.getNodeSettings().getLocalSitesCount()) { TopologyZKUtils.updateTopologyToZK(m_messenger.getZK(), recoveredTopo); } if (version < recoveredTopo.version && !recoverPartitions.isEmpty()) { consoleLog.info("Partition placement layout has been restored for rejoining."); } return recoveredTopo; }
[ "private", "AbstractTopology", "recoverPartitions", "(", "AbstractTopology", "topology", ",", "String", "haGroup", ",", "Set", "<", "Integer", ">", "recoverPartitions", ")", "{", "long", "version", "=", "topology", ".", "version", ";", "if", "(", "!", "recoverPartitions", ".", "isEmpty", "(", ")", ")", "{", "// In rejoin case, partition list from the rejoining node could be out of range if the rejoining", "// host is a previously elastic removed node or some other used nodes, if out of range, do not restore", "if", "(", "Collections", ".", "max", "(", "recoverPartitions", ")", ">", "Collections", ".", "max", "(", "m_cartographer", ".", "getPartitions", "(", ")", ")", ")", "{", "recoverPartitions", ".", "clear", "(", ")", ";", "}", "}", "AbstractTopology", "recoveredTopo", "=", "AbstractTopology", ".", "mutateRecoverTopology", "(", "topology", ",", "m_messenger", ".", "getLiveHostIds", "(", ")", ",", "m_messenger", ".", "getHostId", "(", ")", ",", "haGroup", ",", "recoverPartitions", ")", ";", "if", "(", "recoveredTopo", "==", "null", ")", "{", "return", "null", ";", "}", "List", "<", "Integer", ">", "partitions", "=", "Lists", ".", "newArrayList", "(", "recoveredTopo", ".", "getPartitionIdList", "(", "m_messenger", ".", "getHostId", "(", ")", ")", ")", ";", "if", "(", "partitions", "!=", "null", "&&", "partitions", ".", "size", "(", ")", "==", "m_catalogContext", ".", "getNodeSettings", "(", ")", ".", "getLocalSitesCount", "(", ")", ")", "{", "TopologyZKUtils", ".", "updateTopologyToZK", "(", "m_messenger", ".", "getZK", "(", ")", ",", "recoveredTopo", ")", ";", "}", "if", "(", "version", "<", "recoveredTopo", ".", "version", "&&", "!", "recoverPartitions", ".", "isEmpty", "(", ")", ")", "{", "consoleLog", ".", "info", "(", "\"Partition placement layout has been restored for rejoining.\"", ")", ";", "}", "return", "recoveredTopo", ";", "}" ]
recover the partition assignment from one of lost hosts in the same placement group for rejoin Use the placement group of the recovering host to find a matched host from the lost nodes in the topology If the partition count from the lost node is the same as the site count of the recovering host, The partitions on the lost node will be placed on the recovering host. Partition group layout will be maintained. Topology will be updated on ZK if successful @param topology The topology from ZK, which contains the partition assignments for live or lost hosts @param haGroup The placement group of the recovering host @param recoverPartitions the partition placement to be recovered on this host @return A list of partitions if recover effort is a success.
[ "recover", "the", "partition", "assignment", "from", "one", "of", "lost", "hosts", "in", "the", "same", "placement", "group", "for", "rejoin", "Use", "the", "placement", "group", "of", "the", "recovering", "host", "to", "find", "a", "matched", "host", "from", "the", "lost", "nodes", "in", "the", "topology", "If", "the", "partition", "count", "from", "the", "lost", "node", "is", "the", "same", "as", "the", "site", "count", "of", "the", "recovering", "host", "The", "partitions", "on", "the", "lost", "node", "will", "be", "placed", "on", "the", "recovering", "host", ".", "Partition", "group", "layout", "will", "be", "maintained", ".", "Topology", "will", "be", "updated", "on", "ZK", "if", "successful" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/RealVoltDB.java#L1704-L1730
alkacon/opencms-core
src/org/opencms/ade/contenteditor/CmsContentService.java
CmsContentService.getContentDocument
private CmsXmlContent getContentDocument(CmsFile file, boolean fromCache) throws CmsXmlException { """ Returns the XML content document.<p> @param file the resource file @param fromCache <code>true</code> to use the cached document @return the content document @throws CmsXmlException if reading the XML fails """ CmsXmlContent content = null; if (fromCache) { content = getSessionCache().getCacheXmlContent(file.getStructureId()); } if (content == null) { content = CmsXmlContentFactory.unmarshal(getCmsObject(), file); getSessionCache().setCacheXmlContent(file.getStructureId(), content); } return content; }
java
private CmsXmlContent getContentDocument(CmsFile file, boolean fromCache) throws CmsXmlException { CmsXmlContent content = null; if (fromCache) { content = getSessionCache().getCacheXmlContent(file.getStructureId()); } if (content == null) { content = CmsXmlContentFactory.unmarshal(getCmsObject(), file); getSessionCache().setCacheXmlContent(file.getStructureId(), content); } return content; }
[ "private", "CmsXmlContent", "getContentDocument", "(", "CmsFile", "file", ",", "boolean", "fromCache", ")", "throws", "CmsXmlException", "{", "CmsXmlContent", "content", "=", "null", ";", "if", "(", "fromCache", ")", "{", "content", "=", "getSessionCache", "(", ")", ".", "getCacheXmlContent", "(", "file", ".", "getStructureId", "(", ")", ")", ";", "}", "if", "(", "content", "==", "null", ")", "{", "content", "=", "CmsXmlContentFactory", ".", "unmarshal", "(", "getCmsObject", "(", ")", ",", "file", ")", ";", "getSessionCache", "(", ")", ".", "setCacheXmlContent", "(", "file", ".", "getStructureId", "(", ")", ",", "content", ")", ";", "}", "return", "content", ";", "}" ]
Returns the XML content document.<p> @param file the resource file @param fromCache <code>true</code> to use the cached document @return the content document @throws CmsXmlException if reading the XML fails
[ "Returns", "the", "XML", "content", "document", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/CmsContentService.java#L1762-L1773
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/BaseBo.java
BaseBo.setAttribute
public BaseBo setAttribute(String attrName, Object value, boolean triggerChange) { """ Set a BO's attribute. @param attrName @param value @param triggerChange if set to {@code true} {@link #triggerChange(String)} will be called @return @since 0.7.1 """ Lock lock = lockForWrite(); try { if (value == null) { attributes.remove(attrName); } else { attributes.put(attrName, value); } if (triggerChange) { triggerChange(attrName); } markDirty(); return this; } finally { lock.unlock(); } }
java
public BaseBo setAttribute(String attrName, Object value, boolean triggerChange) { Lock lock = lockForWrite(); try { if (value == null) { attributes.remove(attrName); } else { attributes.put(attrName, value); } if (triggerChange) { triggerChange(attrName); } markDirty(); return this; } finally { lock.unlock(); } }
[ "public", "BaseBo", "setAttribute", "(", "String", "attrName", ",", "Object", "value", ",", "boolean", "triggerChange", ")", "{", "Lock", "lock", "=", "lockForWrite", "(", ")", ";", "try", "{", "if", "(", "value", "==", "null", ")", "{", "attributes", ".", "remove", "(", "attrName", ")", ";", "}", "else", "{", "attributes", ".", "put", "(", "attrName", ",", "value", ")", ";", "}", "if", "(", "triggerChange", ")", "{", "triggerChange", "(", "attrName", ")", ";", "}", "markDirty", "(", ")", ";", "return", "this", ";", "}", "finally", "{", "lock", ".", "unlock", "(", ")", ";", "}", "}" ]
Set a BO's attribute. @param attrName @param value @param triggerChange if set to {@code true} {@link #triggerChange(String)} will be called @return @since 0.7.1
[ "Set", "a", "BO", "s", "attribute", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/BaseBo.java#L321-L337
FasterXML/woodstox
src/main/java/com/ctc/wstx/io/BranchingReaderSource.java
BranchingReaderSource.startBranch
public void startBranch(TextBuffer tb, int startOffset, boolean convertLFs) { """ /* //////////////////////////////////////////////// Branching methods; used mostly to make a copy of parsed internal subsets. //////////////////////////////////////////////// """ mBranchBuffer = tb; mBranchStartOffset = startOffset; mConvertLFs = convertLFs; mGotCR = false; }
java
public void startBranch(TextBuffer tb, int startOffset, boolean convertLFs) { mBranchBuffer = tb; mBranchStartOffset = startOffset; mConvertLFs = convertLFs; mGotCR = false; }
[ "public", "void", "startBranch", "(", "TextBuffer", "tb", ",", "int", "startOffset", ",", "boolean", "convertLFs", ")", "{", "mBranchBuffer", "=", "tb", ";", "mBranchStartOffset", "=", "startOffset", ";", "mConvertLFs", "=", "convertLFs", ";", "mGotCR", "=", "false", ";", "}" ]
/* //////////////////////////////////////////////// Branching methods; used mostly to make a copy of parsed internal subsets. ////////////////////////////////////////////////
[ "/", "*", "////////////////////////////////////////////////", "Branching", "methods", ";", "used", "mostly", "to", "make", "a", "copy", "of", "parsed", "internal", "subsets", ".", "////////////////////////////////////////////////" ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/io/BranchingReaderSource.java#L85-L92
ModeShape/modeshape
modeshape-jcr/src/main/java/org/modeshape/jcr/query/validate/ImmutableSchemata.java
ImmutableSchemata.createBuilder
public static Builder createBuilder( ExecutionContext context, NodeTypes nodeTypes ) { """ Obtain a new instance for building Schemata objects. @param context the execution context that this schemata should use @param nodeTypes the node types that this schemata should use @return the new builder; never null @throws IllegalArgumentException if the context is null """ CheckArg.isNotNull(context, "context"); CheckArg.isNotNull(nodeTypes, "nodeTypes"); return new Builder(context, nodeTypes); }
java
public static Builder createBuilder( ExecutionContext context, NodeTypes nodeTypes ) { CheckArg.isNotNull(context, "context"); CheckArg.isNotNull(nodeTypes, "nodeTypes"); return new Builder(context, nodeTypes); }
[ "public", "static", "Builder", "createBuilder", "(", "ExecutionContext", "context", ",", "NodeTypes", "nodeTypes", ")", "{", "CheckArg", ".", "isNotNull", "(", "context", ",", "\"context\"", ")", ";", "CheckArg", ".", "isNotNull", "(", "nodeTypes", ",", "\"nodeTypes\"", ")", ";", "return", "new", "Builder", "(", "context", ",", "nodeTypes", ")", ";", "}" ]
Obtain a new instance for building Schemata objects. @param context the execution context that this schemata should use @param nodeTypes the node types that this schemata should use @return the new builder; never null @throws IllegalArgumentException if the context is null
[ "Obtain", "a", "new", "instance", "for", "building", "Schemata", "objects", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/query/validate/ImmutableSchemata.java#L65-L70
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/ParseBigDecimal.java
ParseBigDecimal.fixSymbols
private static String fixSymbols(final String s, final DecimalFormatSymbols symbols) { """ Fixes the symbols in the input String (currently only decimal separator and grouping separator) so that the String can be parsed as a BigDecimal. @param s the String to fix @param symbols the decimal format symbols @return the fixed String """ final char groupingSeparator = symbols.getGroupingSeparator(); final char decimalSeparator = symbols.getDecimalSeparator(); return s.replace(String.valueOf(groupingSeparator), "").replace(decimalSeparator, DEFAULT_DECIMAL_SEPARATOR); }
java
private static String fixSymbols(final String s, final DecimalFormatSymbols symbols) { final char groupingSeparator = symbols.getGroupingSeparator(); final char decimalSeparator = symbols.getDecimalSeparator(); return s.replace(String.valueOf(groupingSeparator), "").replace(decimalSeparator, DEFAULT_DECIMAL_SEPARATOR); }
[ "private", "static", "String", "fixSymbols", "(", "final", "String", "s", ",", "final", "DecimalFormatSymbols", "symbols", ")", "{", "final", "char", "groupingSeparator", "=", "symbols", ".", "getGroupingSeparator", "(", ")", ";", "final", "char", "decimalSeparator", "=", "symbols", ".", "getDecimalSeparator", "(", ")", ";", "return", "s", ".", "replace", "(", "String", ".", "valueOf", "(", "groupingSeparator", ")", ",", "\"\"", ")", ".", "replace", "(", "decimalSeparator", ",", "DEFAULT_DECIMAL_SEPARATOR", ")", ";", "}" ]
Fixes the symbols in the input String (currently only decimal separator and grouping separator) so that the String can be parsed as a BigDecimal. @param s the String to fix @param symbols the decimal format symbols @return the fixed String
[ "Fixes", "the", "symbols", "in", "the", "input", "String", "(", "currently", "only", "decimal", "separator", "and", "grouping", "separator", ")", "so", "that", "the", "String", "can", "be", "parsed", "as", "a", "BigDecimal", "." ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/ParseBigDecimal.java#L153-L157
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java
XMLCharHelper.isInvalidXMLNameChar
public static boolean isInvalidXMLNameChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c) { """ Check if the passed character is invalid for an element or attribute name after the first position @param eXMLVersion XML version to be used. May not be <code>null</code>. @param c char to check @return <code>true</code> if the char is invalid """ switch (eXMLVersion) { case XML_10: return INVALID_NAME_CHAR_XML10.get (c); case XML_11: return INVALID_NAME_CHAR_XML11.get (c); case HTML: return INVALID_CHAR_HTML.get (c); default: throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!"); } }
java
public static boolean isInvalidXMLNameChar (@Nonnull final EXMLSerializeVersion eXMLVersion, final int c) { switch (eXMLVersion) { case XML_10: return INVALID_NAME_CHAR_XML10.get (c); case XML_11: return INVALID_NAME_CHAR_XML11.get (c); case HTML: return INVALID_CHAR_HTML.get (c); default: throw new IllegalArgumentException ("Unsupported XML version " + eXMLVersion + "!"); } }
[ "public", "static", "boolean", "isInvalidXMLNameChar", "(", "@", "Nonnull", "final", "EXMLSerializeVersion", "eXMLVersion", ",", "final", "int", "c", ")", "{", "switch", "(", "eXMLVersion", ")", "{", "case", "XML_10", ":", "return", "INVALID_NAME_CHAR_XML10", ".", "get", "(", "c", ")", ";", "case", "XML_11", ":", "return", "INVALID_NAME_CHAR_XML11", ".", "get", "(", "c", ")", ";", "case", "HTML", ":", "return", "INVALID_CHAR_HTML", ".", "get", "(", "c", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Unsupported XML version \"", "+", "eXMLVersion", "+", "\"!\"", ")", ";", "}", "}" ]
Check if the passed character is invalid for an element or attribute name after the first position @param eXMLVersion XML version to be used. May not be <code>null</code>. @param c char to check @return <code>true</code> if the char is invalid
[ "Check", "if", "the", "passed", "character", "is", "invalid", "for", "an", "element", "or", "attribute", "name", "after", "the", "first", "position" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/serialize/write/XMLCharHelper.java#L668-L681
qspin/qtaste
plugins_src/javagui-fx/src/main/java/com/qspin/qtaste/javaguifx/server/ComponentCommander.java
ComponentCommander.lookForComponent
protected Component lookForComponent(String name, ObservableList<Node> components) { """ Browses recursively the components in order to find components with the name. @param name the component's name. @param components components to browse. @return the first component with the name. """ for (int i = 0; i < components.size() && !mFindWithEqual; i++) { //String componentName = ComponentNamer.getInstance().getNameForComponent(components[c]); Node c = components.get(i); checkName(name, c); if (!mFindWithEqual) { if (c instanceof Parent) { Component result = lookForComponent(name, ((Parent) c).getChildrenUnmodifiable()); if (result != null) { return result; } } } } return null; }
java
protected Component lookForComponent(String name, ObservableList<Node> components) { for (int i = 0; i < components.size() && !mFindWithEqual; i++) { //String componentName = ComponentNamer.getInstance().getNameForComponent(components[c]); Node c = components.get(i); checkName(name, c); if (!mFindWithEqual) { if (c instanceof Parent) { Component result = lookForComponent(name, ((Parent) c).getChildrenUnmodifiable()); if (result != null) { return result; } } } } return null; }
[ "protected", "Component", "lookForComponent", "(", "String", "name", ",", "ObservableList", "<", "Node", ">", "components", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "components", ".", "size", "(", ")", "&&", "!", "mFindWithEqual", ";", "i", "++", ")", "{", "//String componentName = ComponentNamer.getInstance().getNameForComponent(components[c]);", "Node", "c", "=", "components", ".", "get", "(", "i", ")", ";", "checkName", "(", "name", ",", "c", ")", ";", "if", "(", "!", "mFindWithEqual", ")", "{", "if", "(", "c", "instanceof", "Parent", ")", "{", "Component", "result", "=", "lookForComponent", "(", "name", ",", "(", "(", "Parent", ")", "c", ")", ".", "getChildrenUnmodifiable", "(", ")", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "}", "}", "}", "return", "null", ";", "}" ]
Browses recursively the components in order to find components with the name. @param name the component's name. @param components components to browse. @return the first component with the name.
[ "Browses", "recursively", "the", "components", "in", "order", "to", "find", "components", "with", "the", "name", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/plugins_src/javagui-fx/src/main/java/com/qspin/qtaste/javaguifx/server/ComponentCommander.java#L105-L120
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/EntityManagerFactoryImpl.java
EntityManagerFactoryImpl.configurePersistenceUnit
private void configurePersistenceUnit(String persistenceUnit, Map props) { """ One time initialization for persistence unit metadata. @param persistenceUnit Persistence Unit/ Comma separated persistence units """ // Invoke Persistence unit MetaData if (persistenceUnit == null) { throw new KunderaException("Persistence unit name should not be null"); } if (logger.isInfoEnabled()) { logger.info("Loading Persistence Unit MetaData For Persistence Unit(s) {}.", persistenceUnit); } String[] persistenceUnits = persistenceUnit.split(Constants.PERSISTENCE_UNIT_SEPARATOR); new PersistenceUnitConfiguration(props, kunderaMetadata, persistenceUnits).configure(); }
java
private void configurePersistenceUnit(String persistenceUnit, Map props) { // Invoke Persistence unit MetaData if (persistenceUnit == null) { throw new KunderaException("Persistence unit name should not be null"); } if (logger.isInfoEnabled()) { logger.info("Loading Persistence Unit MetaData For Persistence Unit(s) {}.", persistenceUnit); } String[] persistenceUnits = persistenceUnit.split(Constants.PERSISTENCE_UNIT_SEPARATOR); new PersistenceUnitConfiguration(props, kunderaMetadata, persistenceUnits).configure(); }
[ "private", "void", "configurePersistenceUnit", "(", "String", "persistenceUnit", ",", "Map", "props", ")", "{", "// Invoke Persistence unit MetaData\r", "if", "(", "persistenceUnit", "==", "null", ")", "{", "throw", "new", "KunderaException", "(", "\"Persistence unit name should not be null\"", ")", ";", "}", "if", "(", "logger", ".", "isInfoEnabled", "(", ")", ")", "{", "logger", ".", "info", "(", "\"Loading Persistence Unit MetaData For Persistence Unit(s) {}.\"", ",", "persistenceUnit", ")", ";", "}", "String", "[", "]", "persistenceUnits", "=", "persistenceUnit", ".", "split", "(", "Constants", ".", "PERSISTENCE_UNIT_SEPARATOR", ")", ";", "new", "PersistenceUnitConfiguration", "(", "props", ",", "kunderaMetadata", ",", "persistenceUnits", ")", ".", "configure", "(", ")", ";", "}" ]
One time initialization for persistence unit metadata. @param persistenceUnit Persistence Unit/ Comma separated persistence units
[ "One", "time", "initialization", "for", "persistence", "unit", "metadata", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/EntityManagerFactoryImpl.java#L645-L660
GoSimpleLLC/nbvcxz
src/main/java/me/gosimple/nbvcxz/Nbvcxz.java
Nbvcxz.createBruteForceMatch
private static Match createBruteForceMatch(final String password, final Configuration configuration, final int index) { """ Creates a brute force match for a portion of the password. @param password the password to create brute match for @param configuration the configuration @param index the index of the password part that needs a {@code BruteForceMatch} @return a {@code Match} object """ return new BruteForceMatch(password.charAt(index), configuration, index); }
java
private static Match createBruteForceMatch(final String password, final Configuration configuration, final int index) { return new BruteForceMatch(password.charAt(index), configuration, index); }
[ "private", "static", "Match", "createBruteForceMatch", "(", "final", "String", "password", ",", "final", "Configuration", "configuration", ",", "final", "int", "index", ")", "{", "return", "new", "BruteForceMatch", "(", "password", ".", "charAt", "(", "index", ")", ",", "configuration", ",", "index", ")", ";", "}" ]
Creates a brute force match for a portion of the password. @param password the password to create brute match for @param configuration the configuration @param index the index of the password part that needs a {@code BruteForceMatch} @return a {@code Match} object
[ "Creates", "a", "brute", "force", "match", "for", "a", "portion", "of", "the", "password", "." ]
train
https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/Nbvcxz.java#L54-L57
alkacon/opencms-core
src/org/opencms/util/CmsHtml2TextConverter.java
CmsHtml2TextConverter.setIndentation
private void setIndentation(int length, boolean open) { """ Sets the indentation.<p> @param length the indentation length @param open if the indentation should be added or reduced """ if (open) { m_indent += length; } else { m_indent -= length; if (m_indent < 0) { m_indent = 0; } } }
java
private void setIndentation(int length, boolean open) { if (open) { m_indent += length; } else { m_indent -= length; if (m_indent < 0) { m_indent = 0; } } }
[ "private", "void", "setIndentation", "(", "int", "length", ",", "boolean", "open", ")", "{", "if", "(", "open", ")", "{", "m_indent", "+=", "length", ";", "}", "else", "{", "m_indent", "-=", "length", ";", "if", "(", "m_indent", "<", "0", ")", "{", "m_indent", "=", "0", ";", "}", "}", "}" ]
Sets the indentation.<p> @param length the indentation length @param open if the indentation should be added or reduced
[ "Sets", "the", "indentation", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsHtml2TextConverter.java#L340-L350
docker-java/docker-java
src/main/java/com/github/dockerjava/core/util/FiltersBuilder.java
FiltersBuilder.withLabels
public FiltersBuilder withLabels(Map<String, String> labels) { """ Filter by labels @param labels {@link Map} of labels that contains label keys and values """ withFilter("label", labelsMapToList(labels).toArray(new String[labels.size()])); return this; }
java
public FiltersBuilder withLabels(Map<String, String> labels) { withFilter("label", labelsMapToList(labels).toArray(new String[labels.size()])); return this; }
[ "public", "FiltersBuilder", "withLabels", "(", "Map", "<", "String", ",", "String", ">", "labels", ")", "{", "withFilter", "(", "\"label\"", ",", "labelsMapToList", "(", "labels", ")", ".", "toArray", "(", "new", "String", "[", "labels", ".", "size", "(", ")", "]", ")", ")", ";", "return", "this", ";", "}" ]
Filter by labels @param labels {@link Map} of labels that contains label keys and values
[ "Filter", "by", "labels" ]
train
https://github.com/docker-java/docker-java/blob/c5c89327108abdc50aa41d7711d4743b8bac75fe/src/main/java/com/github/dockerjava/core/util/FiltersBuilder.java#L84-L87
Metatavu/edelphi
edelphi/src/main/java/fi/metatavu/edelphi/query/AbstractQueryPageHandler.java
AbstractQueryPageHandler.renderComments
protected void renderComments(PageRequestContext requestContext, QueryPage queryPage, QueryReply queryReply, boolean commentable, boolean viewDiscussion) { """ Renders comment list and comment editor @param requestContext request context @param queryPage query page @param queryReply query reply @param commentable whether to render comment editor @param viewDiscussion whether to render comment list """ Query query = queryPage.getQuerySection().getQuery(); Panel panel = ResourceUtils.getResourcePanel(query); RequiredQueryFragment queryFragment = new RequiredQueryFragment("comments"); queryFragment.addAttribute("panelId", panel.getId().toString()); queryFragment.addAttribute("queryId", query.getId().toString()); queryFragment.addAttribute("pageId", queryPage.getId().toString()); if (queryReply != null) { queryFragment.addAttribute("queryReplyId", queryReply.getId().toString()); } queryFragment.addAttribute("queryPageCommentable", commentable ? "true" : "false"); queryFragment.addAttribute("queryViewDiscussion", viewDiscussion ? "true" : "false"); addRequiredFragment(requestContext, queryFragment); }
java
protected void renderComments(PageRequestContext requestContext, QueryPage queryPage, QueryReply queryReply, boolean commentable, boolean viewDiscussion) { Query query = queryPage.getQuerySection().getQuery(); Panel panel = ResourceUtils.getResourcePanel(query); RequiredQueryFragment queryFragment = new RequiredQueryFragment("comments"); queryFragment.addAttribute("panelId", panel.getId().toString()); queryFragment.addAttribute("queryId", query.getId().toString()); queryFragment.addAttribute("pageId", queryPage.getId().toString()); if (queryReply != null) { queryFragment.addAttribute("queryReplyId", queryReply.getId().toString()); } queryFragment.addAttribute("queryPageCommentable", commentable ? "true" : "false"); queryFragment.addAttribute("queryViewDiscussion", viewDiscussion ? "true" : "false"); addRequiredFragment(requestContext, queryFragment); }
[ "protected", "void", "renderComments", "(", "PageRequestContext", "requestContext", ",", "QueryPage", "queryPage", ",", "QueryReply", "queryReply", ",", "boolean", "commentable", ",", "boolean", "viewDiscussion", ")", "{", "Query", "query", "=", "queryPage", ".", "getQuerySection", "(", ")", ".", "getQuery", "(", ")", ";", "Panel", "panel", "=", "ResourceUtils", ".", "getResourcePanel", "(", "query", ")", ";", "RequiredQueryFragment", "queryFragment", "=", "new", "RequiredQueryFragment", "(", "\"comments\"", ")", ";", "queryFragment", ".", "addAttribute", "(", "\"panelId\"", ",", "panel", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ";", "queryFragment", ".", "addAttribute", "(", "\"queryId\"", ",", "query", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ";", "queryFragment", ".", "addAttribute", "(", "\"pageId\"", ",", "queryPage", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ";", "if", "(", "queryReply", "!=", "null", ")", "{", "queryFragment", ".", "addAttribute", "(", "\"queryReplyId\"", ",", "queryReply", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ";", "}", "queryFragment", ".", "addAttribute", "(", "\"queryPageCommentable\"", ",", "commentable", "?", "\"true\"", ":", "\"false\"", ")", ";", "queryFragment", ".", "addAttribute", "(", "\"queryViewDiscussion\"", ",", "viewDiscussion", "?", "\"true\"", ":", "\"false\"", ")", ";", "addRequiredFragment", "(", "requestContext", ",", "queryFragment", ")", ";", "}" ]
Renders comment list and comment editor @param requestContext request context @param queryPage query page @param queryReply query reply @param commentable whether to render comment editor @param viewDiscussion whether to render comment list
[ "Renders", "comment", "list", "and", "comment", "editor" ]
train
https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/query/AbstractQueryPageHandler.java#L141-L157
sporniket/core
sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java
XmlStringTools.appendClosingTag
public static StringBuffer appendClosingTag(StringBuffer buffer, String tag) { """ Add a closing tag to a StringBuffer. If the buffer is null, a new one is created. @param buffer StringBuffer to fill @param tag the tag to close @return the buffer """ StringBuffer _buffer = initStringBufferIfNecessary(buffer); return doAppendClosingTag(_buffer, tag); }
java
public static StringBuffer appendClosingTag(StringBuffer buffer, String tag) { StringBuffer _buffer = initStringBufferIfNecessary(buffer); return doAppendClosingTag(_buffer, tag); }
[ "public", "static", "StringBuffer", "appendClosingTag", "(", "StringBuffer", "buffer", ",", "String", "tag", ")", "{", "StringBuffer", "_buffer", "=", "initStringBufferIfNecessary", "(", "buffer", ")", ";", "return", "doAppendClosingTag", "(", "_buffer", ",", "tag", ")", ";", "}" ]
Add a closing tag to a StringBuffer. If the buffer is null, a new one is created. @param buffer StringBuffer to fill @param tag the tag to close @return the buffer
[ "Add", "a", "closing", "tag", "to", "a", "StringBuffer", "." ]
train
https://github.com/sporniket/core/blob/3480ebd72a07422fcc09971be2607ee25efb2c26/sporniket-core-ml/src/main/java/com/sporniket/libre/lang/xml/XmlStringTools.java#L318-L322
eldur/jwbf
src/main/java/net/sourceforge/jwbf/mediawiki/actions/queries/ReviewedPagesTitles.java
ReviewedPagesTitles.generateRequest
private HttpAction generateRequest(int[] namespace, String rpstart, String rpend) { """ generates the next MediaWiki-request (GetMethod) and adds it to msgs. @param namespace the namespace(s) that will be searched for links, as a string of numbers separated by '|'; if null, this parameter is omitted @param rpstart Start listing at this page id @param rpend Stop listing at this page id """ RequestBuilder requestBuilder = new ApiRequestBuilder() // .action("query") // .formatXml() // .param("list", "reviewedpages") // .param("rplimit", LIMIT) // ; if (namespace != null) { String rpnamespace = MediaWiki.urlEncode(MWAction.createNsString(namespace)); requestBuilder.param("rpnamespace", rpnamespace); } if (rpstart.length() > 0) { requestBuilder.param("rpstart", rpstart); } if (rpend.length() > 0) { requestBuilder.param("rpend", rpend); } return requestBuilder.buildGet(); }
java
private HttpAction generateRequest(int[] namespace, String rpstart, String rpend) { RequestBuilder requestBuilder = new ApiRequestBuilder() // .action("query") // .formatXml() // .param("list", "reviewedpages") // .param("rplimit", LIMIT) // ; if (namespace != null) { String rpnamespace = MediaWiki.urlEncode(MWAction.createNsString(namespace)); requestBuilder.param("rpnamespace", rpnamespace); } if (rpstart.length() > 0) { requestBuilder.param("rpstart", rpstart); } if (rpend.length() > 0) { requestBuilder.param("rpend", rpend); } return requestBuilder.buildGet(); }
[ "private", "HttpAction", "generateRequest", "(", "int", "[", "]", "namespace", ",", "String", "rpstart", ",", "String", "rpend", ")", "{", "RequestBuilder", "requestBuilder", "=", "new", "ApiRequestBuilder", "(", ")", "//", ".", "action", "(", "\"query\"", ")", "//", ".", "formatXml", "(", ")", "//", ".", "param", "(", "\"list\"", ",", "\"reviewedpages\"", ")", "//", ".", "param", "(", "\"rplimit\"", ",", "LIMIT", ")", "//", ";", "if", "(", "namespace", "!=", "null", ")", "{", "String", "rpnamespace", "=", "MediaWiki", ".", "urlEncode", "(", "MWAction", ".", "createNsString", "(", "namespace", ")", ")", ";", "requestBuilder", ".", "param", "(", "\"rpnamespace\"", ",", "rpnamespace", ")", ";", "}", "if", "(", "rpstart", ".", "length", "(", ")", ">", "0", ")", "{", "requestBuilder", ".", "param", "(", "\"rpstart\"", ",", "rpstart", ")", ";", "}", "if", "(", "rpend", ".", "length", "(", ")", ">", "0", ")", "{", "requestBuilder", ".", "param", "(", "\"rpend\"", ",", "rpend", ")", ";", "}", "return", "requestBuilder", ".", "buildGet", "(", ")", ";", "}" ]
generates the next MediaWiki-request (GetMethod) and adds it to msgs. @param namespace the namespace(s) that will be searched for links, as a string of numbers separated by '|'; if null, this parameter is omitted @param rpstart Start listing at this page id @param rpend Stop listing at this page id
[ "generates", "the", "next", "MediaWiki", "-", "request", "(", "GetMethod", ")", "and", "adds", "it", "to", "msgs", "." ]
train
https://github.com/eldur/jwbf/blob/ee17ea2fa5a26f17c8332a094b2db86dd596d1ff/src/main/java/net/sourceforge/jwbf/mediawiki/actions/queries/ReviewedPagesTitles.java#L59-L80
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.photos_addTag
public boolean photos_addTag(Long photoId, CharSequence tagText, Double xPct, Double yPct) throws FacebookException, IOException { """ Adds a tag to a photo. @param photoId The photo id of the photo to be tagged. @param xPct The horizontal position of the tag, as a percentage from 0 to 100, from the left of the photo. @param yPct The list of photos from which to extract photo tags. @param tagText The text of the tag. @return whether the tag was successfully added. """ return photos_addTag(photoId, xPct, yPct, null, tagText); }
java
public boolean photos_addTag(Long photoId, CharSequence tagText, Double xPct, Double yPct) throws FacebookException, IOException { return photos_addTag(photoId, xPct, yPct, null, tagText); }
[ "public", "boolean", "photos_addTag", "(", "Long", "photoId", ",", "CharSequence", "tagText", ",", "Double", "xPct", ",", "Double", "yPct", ")", "throws", "FacebookException", ",", "IOException", "{", "return", "photos_addTag", "(", "photoId", ",", "xPct", ",", "yPct", ",", "null", ",", "tagText", ")", ";", "}" ]
Adds a tag to a photo. @param photoId The photo id of the photo to be tagged. @param xPct The horizontal position of the tag, as a percentage from 0 to 100, from the left of the photo. @param yPct The list of photos from which to extract photo tags. @param tagText The text of the tag. @return whether the tag was successfully added.
[ "Adds", "a", "tag", "to", "a", "photo", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L1044-L1047
minio/minio-java
api/src/main/java/io/minio/MinioClient.java
MinioClient.executeDelete
private HttpResponse executeDelete(String bucketName, String objectName, Map<String,String> queryParamMap) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { """ Executes DELETE method for given request parameters. @param bucketName Bucket name. @param objectName Object name in the bucket. @param queryParamMap Map of HTTP query parameters of the request. """ HttpResponse response = execute(Method.DELETE, getRegion(bucketName), bucketName, objectName, null, queryParamMap, null, 0); response.body().close(); return response; }
java
private HttpResponse executeDelete(String bucketName, String objectName, Map<String,String> queryParamMap) throws InvalidBucketNameException, NoSuchAlgorithmException, InsufficientDataException, IOException, InvalidKeyException, NoResponseException, XmlPullParserException, ErrorResponseException, InternalException { HttpResponse response = execute(Method.DELETE, getRegion(bucketName), bucketName, objectName, null, queryParamMap, null, 0); response.body().close(); return response; }
[ "private", "HttpResponse", "executeDelete", "(", "String", "bucketName", ",", "String", "objectName", ",", "Map", "<", "String", ",", "String", ">", "queryParamMap", ")", "throws", "InvalidBucketNameException", ",", "NoSuchAlgorithmException", ",", "InsufficientDataException", ",", "IOException", ",", "InvalidKeyException", ",", "NoResponseException", ",", "XmlPullParserException", ",", "ErrorResponseException", ",", "InternalException", "{", "HttpResponse", "response", "=", "execute", "(", "Method", ".", "DELETE", ",", "getRegion", "(", "bucketName", ")", ",", "bucketName", ",", "objectName", ",", "null", ",", "queryParamMap", ",", "null", ",", "0", ")", ";", "response", ".", "body", "(", ")", ".", "close", "(", ")", ";", "return", "response", ";", "}" ]
Executes DELETE method for given request parameters. @param bucketName Bucket name. @param objectName Object name in the bucket. @param queryParamMap Map of HTTP query parameters of the request.
[ "Executes", "DELETE", "method", "for", "given", "request", "parameters", "." ]
train
https://github.com/minio/minio-java/blob/b2028f56403c89ce2d5900ae813bc1314c87bc7f/api/src/main/java/io/minio/MinioClient.java#L1343-L1351
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamUtils.java
BamUtils.checkBamOrCramFile
public static void checkBamOrCramFile(InputStream is, String bamFileName, boolean checkSort) throws IOException { """ Check if the file is a sorted binary bam file. @param is Bam InputStream @param bamFileName Bam FileName @param checkSort @throws IOException """ SamReaderFactory srf = SamReaderFactory.make(); srf.validationStringency(ValidationStringency.LENIENT); SamReader reader = srf.open(SamInputResource.of(is)); SAMFileHeader fileHeader = reader.getFileHeader(); SAMFileHeader.SortOrder sortOrder = fileHeader.getSortOrder(); reader.close(); if (reader.type().equals(SamReader.Type.SAM_TYPE)) { throw new IOException("Expected binary SAM file. File " + bamFileName + " is not binary."); } if (checkSort) { switch (sortOrder) { case coordinate: break; case queryname: case unsorted: default: throw new IOException("Expected sorted file. File '" + bamFileName + "' is not sorted by coordinates(" + sortOrder.name() + ")"); } } }
java
public static void checkBamOrCramFile(InputStream is, String bamFileName, boolean checkSort) throws IOException { SamReaderFactory srf = SamReaderFactory.make(); srf.validationStringency(ValidationStringency.LENIENT); SamReader reader = srf.open(SamInputResource.of(is)); SAMFileHeader fileHeader = reader.getFileHeader(); SAMFileHeader.SortOrder sortOrder = fileHeader.getSortOrder(); reader.close(); if (reader.type().equals(SamReader.Type.SAM_TYPE)) { throw new IOException("Expected binary SAM file. File " + bamFileName + " is not binary."); } if (checkSort) { switch (sortOrder) { case coordinate: break; case queryname: case unsorted: default: throw new IOException("Expected sorted file. File '" + bamFileName + "' is not sorted by coordinates(" + sortOrder.name() + ")"); } } }
[ "public", "static", "void", "checkBamOrCramFile", "(", "InputStream", "is", ",", "String", "bamFileName", ",", "boolean", "checkSort", ")", "throws", "IOException", "{", "SamReaderFactory", "srf", "=", "SamReaderFactory", ".", "make", "(", ")", ";", "srf", ".", "validationStringency", "(", "ValidationStringency", ".", "LENIENT", ")", ";", "SamReader", "reader", "=", "srf", ".", "open", "(", "SamInputResource", ".", "of", "(", "is", ")", ")", ";", "SAMFileHeader", "fileHeader", "=", "reader", ".", "getFileHeader", "(", ")", ";", "SAMFileHeader", ".", "SortOrder", "sortOrder", "=", "fileHeader", ".", "getSortOrder", "(", ")", ";", "reader", ".", "close", "(", ")", ";", "if", "(", "reader", ".", "type", "(", ")", ".", "equals", "(", "SamReader", ".", "Type", ".", "SAM_TYPE", ")", ")", "{", "throw", "new", "IOException", "(", "\"Expected binary SAM file. File \"", "+", "bamFileName", "+", "\" is not binary.\"", ")", ";", "}", "if", "(", "checkSort", ")", "{", "switch", "(", "sortOrder", ")", "{", "case", "coordinate", ":", "break", ";", "case", "queryname", ":", "case", "unsorted", ":", "default", ":", "throw", "new", "IOException", "(", "\"Expected sorted file. File '\"", "+", "bamFileName", "+", "\"' is not sorted by coordinates(\"", "+", "sortOrder", ".", "name", "(", ")", "+", "\")\"", ")", ";", "}", "}", "}" ]
Check if the file is a sorted binary bam file. @param is Bam InputStream @param bamFileName Bam FileName @param checkSort @throws IOException
[ "Check", "if", "the", "file", "is", "a", "sorted", "binary", "bam", "file", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/alignment/BamUtils.java#L134-L158
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.drawWarped
public void drawWarped(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { """ Draw the image in a warper rectangle. The effects this can have are many and varied, might be interesting though. @param x1 The top left corner x coordinate @param y1 The top left corner y coordinate @param x2 The top right corner x coordinate @param y2 The top right corner y coordinate @param x3 The bottom right corner x coordinate @param y3 The bottom right corner y coordinate @param x4 The bottom left corner x coordinate @param y4 The bottom left corner y coordinate """ Color.white.bind(); texture.bind(); GL.glTranslatef(x1, y1, 0); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glBegin(SGL.GL_QUADS); init(); GL.glTexCoord2f(textureOffsetX, textureOffsetY); GL.glVertex3f(0, 0, 0); GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); GL.glVertex3f(x2 - x1, y2 - y1, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY + textureHeight); GL.glVertex3f(x3 - x1, y3 - y1, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY); GL.glVertex3f(x4 - x1, y4 - y1, 0); GL.glEnd(); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(-angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glTranslatef(-x1, -y1, 0); }
java
public void drawWarped(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4) { Color.white.bind(); texture.bind(); GL.glTranslatef(x1, y1, 0); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glBegin(SGL.GL_QUADS); init(); GL.glTexCoord2f(textureOffsetX, textureOffsetY); GL.glVertex3f(0, 0, 0); GL.glTexCoord2f(textureOffsetX, textureOffsetY + textureHeight); GL.glVertex3f(x2 - x1, y2 - y1, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY + textureHeight); GL.glVertex3f(x3 - x1, y3 - y1, 0); GL.glTexCoord2f(textureOffsetX + textureWidth, textureOffsetY); GL.glVertex3f(x4 - x1, y4 - y1, 0); GL.glEnd(); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(-angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glTranslatef(-x1, -y1, 0); }
[ "public", "void", "drawWarped", "(", "float", "x1", ",", "float", "y1", ",", "float", "x2", ",", "float", "y2", ",", "float", "x3", ",", "float", "y3", ",", "float", "x4", ",", "float", "y4", ")", "{", "Color", ".", "white", ".", "bind", "(", ")", ";", "texture", ".", "bind", "(", ")", ";", "GL", ".", "glTranslatef", "(", "x1", ",", "y1", ",", "0", ")", ";", "if", "(", "angle", "!=", "0", ")", "{", "GL", ".", "glTranslatef", "(", "centerX", ",", "centerY", ",", "0.0f", ")", ";", "GL", ".", "glRotatef", "(", "angle", ",", "0.0f", ",", "0.0f", ",", "1.0f", ")", ";", "GL", ".", "glTranslatef", "(", "-", "centerX", ",", "-", "centerY", ",", "0.0f", ")", ";", "}", "GL", ".", "glBegin", "(", "SGL", ".", "GL_QUADS", ")", ";", "init", "(", ")", ";", "GL", ".", "glTexCoord2f", "(", "textureOffsetX", ",", "textureOffsetY", ")", ";", "GL", ".", "glVertex3f", "(", "0", ",", "0", ",", "0", ")", ";", "GL", ".", "glTexCoord2f", "(", "textureOffsetX", ",", "textureOffsetY", "+", "textureHeight", ")", ";", "GL", ".", "glVertex3f", "(", "x2", "-", "x1", ",", "y2", "-", "y1", ",", "0", ")", ";", "GL", ".", "glTexCoord2f", "(", "textureOffsetX", "+", "textureWidth", ",", "textureOffsetY", "+", "textureHeight", ")", ";", "GL", ".", "glVertex3f", "(", "x3", "-", "x1", ",", "y3", "-", "y1", ",", "0", ")", ";", "GL", ".", "glTexCoord2f", "(", "textureOffsetX", "+", "textureWidth", ",", "textureOffsetY", ")", ";", "GL", ".", "glVertex3f", "(", "x4", "-", "x1", ",", "y4", "-", "y1", ",", "0", ")", ";", "GL", ".", "glEnd", "(", ")", ";", "if", "(", "angle", "!=", "0", ")", "{", "GL", ".", "glTranslatef", "(", "centerX", ",", "centerY", ",", "0.0f", ")", ";", "GL", ".", "glRotatef", "(", "-", "angle", ",", "0.0f", ",", "0.0f", ",", "1.0f", ")", ";", "GL", ".", "glTranslatef", "(", "-", "centerX", ",", "-", "centerY", ",", "0.0f", ")", ";", "}", "GL", ".", "glTranslatef", "(", "-", "x1", ",", "-", "y1", ",", "0", ")", ";", "}" ]
Draw the image in a warper rectangle. The effects this can have are many and varied, might be interesting though. @param x1 The top left corner x coordinate @param y1 The top left corner y coordinate @param x2 The top right corner x coordinate @param y2 The top right corner y coordinate @param x3 The bottom right corner x coordinate @param y3 The bottom right corner y coordinate @param x4 The bottom left corner x coordinate @param y4 The bottom left corner y coordinate
[ "Draw", "the", "image", "in", "a", "warper", "rectangle", ".", "The", "effects", "this", "can", "have", "are", "many", "and", "varied", "might", "be", "interesting", "though", "." ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L1139-L1170
Netflix/zuul
zuul-core/src/main/java/com/netflix/netty/common/HttpRequestReadTimeoutHandler.java
HttpRequestReadTimeoutHandler.addLast
public static void addLast(ChannelPipeline pipeline, long timeout, TimeUnit unit, BasicCounter httpRequestReadTimeoutCounter) { """ Factory which ensures that this handler is added to the pipeline using the correct name. @param timeout @param unit """ HttpRequestReadTimeoutHandler handler = new HttpRequestReadTimeoutHandler(timeout, unit, httpRequestReadTimeoutCounter); pipeline.addLast(HANDLER_NAME, handler); }
java
public static void addLast(ChannelPipeline pipeline, long timeout, TimeUnit unit, BasicCounter httpRequestReadTimeoutCounter) { HttpRequestReadTimeoutHandler handler = new HttpRequestReadTimeoutHandler(timeout, unit, httpRequestReadTimeoutCounter); pipeline.addLast(HANDLER_NAME, handler); }
[ "public", "static", "void", "addLast", "(", "ChannelPipeline", "pipeline", ",", "long", "timeout", ",", "TimeUnit", "unit", ",", "BasicCounter", "httpRequestReadTimeoutCounter", ")", "{", "HttpRequestReadTimeoutHandler", "handler", "=", "new", "HttpRequestReadTimeoutHandler", "(", "timeout", ",", "unit", ",", "httpRequestReadTimeoutCounter", ")", ";", "pipeline", ".", "addLast", "(", "HANDLER_NAME", ",", "handler", ")", ";", "}" ]
Factory which ensures that this handler is added to the pipeline using the correct name. @param timeout @param unit
[ "Factory", "which", "ensures", "that", "this", "handler", "is", "added", "to", "the", "pipeline", "using", "the", "correct", "name", "." ]
train
https://github.com/Netflix/zuul/blob/01bc777cf05e3522d37c9ed902ae13eb38a19692/zuul-core/src/main/java/com/netflix/netty/common/HttpRequestReadTimeoutHandler.java#L63-L67
javers/javers
javers-core/src/main/java/org/javers/core/JaversBuilder.java
JaversBuilder.registerCustomComparator
public <T> JaversBuilder registerCustomComparator(CustomPropertyComparator<T, ?> comparator, Class<T> customType) { """ Registers a custom property comparator for a given Custom Type. <br/><br/> Custom comparators are used by diff algorithm to calculate property-to-property diff and also collection-to-collection diff. <br/><br/> Internally, given type is mapped as {@link CustomType}. @param <T> Custom Type @see CustomType @see CustomPropertyComparator """ registerType(new CustomDefinition(customType, comparator)); bindComponent(comparator, new CustomToNativeAppenderAdapter(comparator, customType)); return this; }
java
public <T> JaversBuilder registerCustomComparator(CustomPropertyComparator<T, ?> comparator, Class<T> customType){ registerType(new CustomDefinition(customType, comparator)); bindComponent(comparator, new CustomToNativeAppenderAdapter(comparator, customType)); return this; }
[ "public", "<", "T", ">", "JaversBuilder", "registerCustomComparator", "(", "CustomPropertyComparator", "<", "T", ",", "?", ">", "comparator", ",", "Class", "<", "T", ">", "customType", ")", "{", "registerType", "(", "new", "CustomDefinition", "(", "customType", ",", "comparator", ")", ")", ";", "bindComponent", "(", "comparator", ",", "new", "CustomToNativeAppenderAdapter", "(", "comparator", ",", "customType", ")", ")", ";", "return", "this", ";", "}" ]
Registers a custom property comparator for a given Custom Type. <br/><br/> Custom comparators are used by diff algorithm to calculate property-to-property diff and also collection-to-collection diff. <br/><br/> Internally, given type is mapped as {@link CustomType}. @param <T> Custom Type @see CustomType @see CustomPropertyComparator
[ "Registers", "a", "custom", "property", "comparator", "for", "a", "given", "Custom", "Type", ".", "<br", "/", ">", "<br", "/", ">" ]
train
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/JaversBuilder.java#L633-L637
pressgang-ccms/PressGangCCMSBuilder
src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java
DocBookBuilder.addToZip
protected void addToZip(final String path, final String file, BuildData buildData) throws BuildProcessingException { """ Adds a file to the files ZIP. @param path The path to add the file to. @param file The file to add to the ZIP. @param buildData Information and data structures for the build. """ try { buildData.getOutputFiles().put(path, file.getBytes(ENCODING)); } catch (UnsupportedEncodingException e) { /* UTF-8 is a valid format so this should exception should never get thrown */ throw new BuildProcessingException(e); } }
java
protected void addToZip(final String path, final String file, BuildData buildData) throws BuildProcessingException { try { buildData.getOutputFiles().put(path, file.getBytes(ENCODING)); } catch (UnsupportedEncodingException e) { /* UTF-8 is a valid format so this should exception should never get thrown */ throw new BuildProcessingException(e); } }
[ "protected", "void", "addToZip", "(", "final", "String", "path", ",", "final", "String", "file", ",", "BuildData", "buildData", ")", "throws", "BuildProcessingException", "{", "try", "{", "buildData", ".", "getOutputFiles", "(", ")", ".", "put", "(", "path", ",", "file", ".", "getBytes", "(", "ENCODING", ")", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "/* UTF-8 is a valid format so this should exception should never get thrown */", "throw", "new", "BuildProcessingException", "(", "e", ")", ";", "}", "}" ]
Adds a file to the files ZIP. @param path The path to add the file to. @param file The file to add to the ZIP. @param buildData Information and data structures for the build.
[ "Adds", "a", "file", "to", "the", "files", "ZIP", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSBuilder/blob/5436d36ba1b3c5baa246b270e5fc350e6778bce8/src/main/java/org/jboss/pressgang/ccms/contentspec/builder/DocBookBuilder.java#L3897-L3904
UrielCh/ovh-java-sdk
ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java
ApiOvhHostingweb.moduleList_GET
public ArrayList<Long> moduleList_GET(Boolean active, OvhBranchEnum branch, Boolean latest) throws IOException { """ IDs of all modules available REST: GET /hosting/web/moduleList @param branch [required] Filter the value of branch property (=) @param active [required] Filter the value of active property (=) @param latest [required] Filter the value of latest property (=) """ String qPath = "/hosting/web/moduleList"; StringBuilder sb = path(qPath); query(sb, "active", active); query(sb, "branch", branch); query(sb, "latest", latest); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
java
public ArrayList<Long> moduleList_GET(Boolean active, OvhBranchEnum branch, Boolean latest) throws IOException { String qPath = "/hosting/web/moduleList"; StringBuilder sb = path(qPath); query(sb, "active", active); query(sb, "branch", branch); query(sb, "latest", latest); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, t3); }
[ "public", "ArrayList", "<", "Long", ">", "moduleList_GET", "(", "Boolean", "active", ",", "OvhBranchEnum", "branch", ",", "Boolean", "latest", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/hosting/web/moduleList\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"active\"", ",", "active", ")", ";", "query", "(", "sb", ",", "\"branch\"", ",", "branch", ")", ";", "query", "(", "sb", ",", "\"latest\"", ",", "latest", ")", ";", "String", "resp", "=", "execN", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "t3", ")", ";", "}" ]
IDs of all modules available REST: GET /hosting/web/moduleList @param branch [required] Filter the value of branch property (=) @param active [required] Filter the value of active property (=) @param latest [required] Filter the value of latest property (=)
[ "IDs", "of", "all", "modules", "available" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-hostingweb/src/main/java/net/minidev/ovh/api/ApiOvhHostingweb.java#L2306-L2314
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/datatypes/SyntaxDE.java
SyntaxDE.initData
private void initData(String x, int minsize, int maxsize) { """ < @internal @brief contains the value of the DE in human readable format """ content = null; setContent(x, minsize, maxsize); }
java
private void initData(String x, int minsize, int maxsize) { content = null; setContent(x, minsize, maxsize); }
[ "private", "void", "initData", "(", "String", "x", ",", "int", "minsize", ",", "int", "maxsize", ")", "{", "content", "=", "null", ";", "setContent", "(", "x", ",", "minsize", ",", "maxsize", ")", ";", "}" ]
< @internal @brief contains the value of the DE in human readable format
[ "<" ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/datatypes/SyntaxDE.java#L158-L161
javalite/activejdbc
javalite-common/src/main/java/org/javalite/http/Request.java
Request.getInputStream
public InputStream getInputStream() { """ Returns input stream to read server response from. @return input stream to read server response from. """ try { return connection.getInputStream(); }catch(SocketTimeoutException e){ throw new HttpException("Failed URL: " + url + ", waited for: " + connection.getConnectTimeout() + " milliseconds", e); }catch (Exception e) { throw new HttpException("Failed URL: " + url, e); } }
java
public InputStream getInputStream() { try { return connection.getInputStream(); }catch(SocketTimeoutException e){ throw new HttpException("Failed URL: " + url + ", waited for: " + connection.getConnectTimeout() + " milliseconds", e); }catch (Exception e) { throw new HttpException("Failed URL: " + url, e); } }
[ "public", "InputStream", "getInputStream", "(", ")", "{", "try", "{", "return", "connection", ".", "getInputStream", "(", ")", ";", "}", "catch", "(", "SocketTimeoutException", "e", ")", "{", "throw", "new", "HttpException", "(", "\"Failed URL: \"", "+", "url", "+", "\", waited for: \"", "+", "connection", ".", "getConnectTimeout", "(", ")", "+", "\" milliseconds\"", ",", "e", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "HttpException", "(", "\"Failed URL: \"", "+", "url", ",", "e", ")", ";", "}", "}" ]
Returns input stream to read server response from. @return input stream to read server response from.
[ "Returns", "input", "stream", "to", "read", "server", "response", "from", "." ]
train
https://github.com/javalite/activejdbc/blob/ffcf5457cace19622a8f71e856cbbbe9e7dd5fcc/javalite-common/src/main/java/org/javalite/http/Request.java#L82-L91
windup/windup
config/api/src/main/java/org/jboss/windup/config/AbstractRuleProvider.java
AbstractRuleProvider.enhanceRuleMetadata
public static void enhanceRuleMetadata(RuleProvider provider, Rule rule) { """ Specify additional meta-data to individual {@link Rule} instances originating from the corresponding {@link RuleProvider} instance. """ if (rule instanceof Context) { Context context = (Context) rule; if (!context.containsKey(RuleMetadataType.ORIGIN)) context.put(RuleMetadataType.ORIGIN, provider.getMetadata().getOrigin()); if (!context.containsKey(RuleMetadataType.RULE_PROVIDER)) context.put(RuleMetadataType.RULE_PROVIDER, provider); if (!context.containsKey(RuleMetadataType.TAGS)) context.put(RuleMetadataType.TAGS, provider.getMetadata().getTags()); } }
java
public static void enhanceRuleMetadata(RuleProvider provider, Rule rule) { if (rule instanceof Context) { Context context = (Context) rule; if (!context.containsKey(RuleMetadataType.ORIGIN)) context.put(RuleMetadataType.ORIGIN, provider.getMetadata().getOrigin()); if (!context.containsKey(RuleMetadataType.RULE_PROVIDER)) context.put(RuleMetadataType.RULE_PROVIDER, provider); if (!context.containsKey(RuleMetadataType.TAGS)) context.put(RuleMetadataType.TAGS, provider.getMetadata().getTags()); } }
[ "public", "static", "void", "enhanceRuleMetadata", "(", "RuleProvider", "provider", ",", "Rule", "rule", ")", "{", "if", "(", "rule", "instanceof", "Context", ")", "{", "Context", "context", "=", "(", "Context", ")", "rule", ";", "if", "(", "!", "context", ".", "containsKey", "(", "RuleMetadataType", ".", "ORIGIN", ")", ")", "context", ".", "put", "(", "RuleMetadataType", ".", "ORIGIN", ",", "provider", ".", "getMetadata", "(", ")", ".", "getOrigin", "(", ")", ")", ";", "if", "(", "!", "context", ".", "containsKey", "(", "RuleMetadataType", ".", "RULE_PROVIDER", ")", ")", "context", ".", "put", "(", "RuleMetadataType", ".", "RULE_PROVIDER", ",", "provider", ")", ";", "if", "(", "!", "context", ".", "containsKey", "(", "RuleMetadataType", ".", "TAGS", ")", ")", "context", ".", "put", "(", "RuleMetadataType", ".", "TAGS", ",", "provider", ".", "getMetadata", "(", ")", ".", "getTags", "(", ")", ")", ";", "}", "}" ]
Specify additional meta-data to individual {@link Rule} instances originating from the corresponding {@link RuleProvider} instance.
[ "Specify", "additional", "meta", "-", "data", "to", "individual", "{" ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/config/api/src/main/java/org/jboss/windup/config/AbstractRuleProvider.java#L84-L96
kite-sdk/kite
kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/SchemaValidationUtil.java
SchemaValidationUtil.hasErrors
private static boolean hasErrors(Symbol symbol) { """ Returns true if the Parser contains any Error symbol, indicating that it may fail for some inputs. """ switch(symbol.kind) { case ALTERNATIVE: return hasErrors(symbol, ((Symbol.Alternative) symbol).symbols); case EXPLICIT_ACTION: return false; case IMPLICIT_ACTION: return symbol instanceof Symbol.ErrorAction; case REPEATER: Symbol.Repeater r = (Symbol.Repeater) symbol; return hasErrors(r.end) || hasErrors(symbol, r.production); case ROOT: case SEQUENCE: return hasErrors(symbol, symbol.production); case TERMINAL: return false; default: throw new RuntimeException("unknown symbol kind: " + symbol.kind); } }
java
private static boolean hasErrors(Symbol symbol) { switch(symbol.kind) { case ALTERNATIVE: return hasErrors(symbol, ((Symbol.Alternative) symbol).symbols); case EXPLICIT_ACTION: return false; case IMPLICIT_ACTION: return symbol instanceof Symbol.ErrorAction; case REPEATER: Symbol.Repeater r = (Symbol.Repeater) symbol; return hasErrors(r.end) || hasErrors(symbol, r.production); case ROOT: case SEQUENCE: return hasErrors(symbol, symbol.production); case TERMINAL: return false; default: throw new RuntimeException("unknown symbol kind: " + symbol.kind); } }
[ "private", "static", "boolean", "hasErrors", "(", "Symbol", "symbol", ")", "{", "switch", "(", "symbol", ".", "kind", ")", "{", "case", "ALTERNATIVE", ":", "return", "hasErrors", "(", "symbol", ",", "(", "(", "Symbol", ".", "Alternative", ")", "symbol", ")", ".", "symbols", ")", ";", "case", "EXPLICIT_ACTION", ":", "return", "false", ";", "case", "IMPLICIT_ACTION", ":", "return", "symbol", "instanceof", "Symbol", ".", "ErrorAction", ";", "case", "REPEATER", ":", "Symbol", ".", "Repeater", "r", "=", "(", "Symbol", ".", "Repeater", ")", "symbol", ";", "return", "hasErrors", "(", "r", ".", "end", ")", "||", "hasErrors", "(", "symbol", ",", "r", ".", "production", ")", ";", "case", "ROOT", ":", "case", "SEQUENCE", ":", "return", "hasErrors", "(", "symbol", ",", "symbol", ".", "production", ")", ";", "case", "TERMINAL", ":", "return", "false", ";", "default", ":", "throw", "new", "RuntimeException", "(", "\"unknown symbol kind: \"", "+", "symbol", ".", "kind", ")", ";", "}", "}" ]
Returns true if the Parser contains any Error symbol, indicating that it may fail for some inputs.
[ "Returns", "true", "if", "the", "Parser", "contains", "any", "Error", "symbol", "indicating", "that", "it", "may", "fail", "for", "some", "inputs", "." ]
train
https://github.com/kite-sdk/kite/blob/72bfb4b1a881af85808cd7f14bc3e15160a1e811/kite-data/kite-data-core/src/main/java/org/kitesdk/data/spi/SchemaValidationUtil.java#L39-L58
spring-projects/spring-boot
spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java
Bindable.mapOf
public static <K, V> Bindable<Map<K, V>> mapOf(Class<K> keyType, Class<V> valueType) { """ Create a new {@link Bindable} {@link Map} of the specified key and value type. @param <K> the key type @param <V> the value type @param keyType the map key type @param valueType the map value type @return a {@link Bindable} instance """ return of(ResolvableType.forClassWithGenerics(Map.class, keyType, valueType)); }
java
public static <K, V> Bindable<Map<K, V>> mapOf(Class<K> keyType, Class<V> valueType) { return of(ResolvableType.forClassWithGenerics(Map.class, keyType, valueType)); }
[ "public", "static", "<", "K", ",", "V", ">", "Bindable", "<", "Map", "<", "K", ",", "V", ">", ">", "mapOf", "(", "Class", "<", "K", ">", "keyType", ",", "Class", "<", "V", ">", "valueType", ")", "{", "return", "of", "(", "ResolvableType", ".", "forClassWithGenerics", "(", "Map", ".", "class", ",", "keyType", ",", "valueType", ")", ")", ";", "}" ]
Create a new {@link Bindable} {@link Map} of the specified key and value type. @param <K> the key type @param <V> the value type @param keyType the map key type @param valueType the map value type @return a {@link Bindable} instance
[ "Create", "a", "new", "{" ]
train
https://github.com/spring-projects/spring-boot/blob/0b27f7c70e164b2b1a96477f1d9c1acba56790c1/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/Bindable.java#L235-L237
eclipse/xtext-extras
org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java
AbstractXbaseSemanticSequencer.sequence_XRelationalExpression
protected void sequence_XRelationalExpression(ISerializationContext context, XInstanceOfExpression semanticObject) { """ Contexts: XExpression returns XInstanceOfExpression XAssignment returns XInstanceOfExpression XAssignment.XBinaryOperation_1_1_0_0_0 returns XInstanceOfExpression XOrExpression returns XInstanceOfExpression XOrExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XAndExpression returns XInstanceOfExpression XAndExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XEqualityExpression returns XInstanceOfExpression XEqualityExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XRelationalExpression returns XInstanceOfExpression XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XInstanceOfExpression XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XInstanceOfExpression XOtherOperatorExpression returns XInstanceOfExpression XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XAdditiveExpression returns XInstanceOfExpression XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XMultiplicativeExpression returns XInstanceOfExpression XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XUnaryOperation returns XInstanceOfExpression XCastedExpression returns XInstanceOfExpression XCastedExpression.XCastedExpression_1_0_0_0 returns XInstanceOfExpression XPostfixOperation returns XInstanceOfExpression XPostfixOperation.XPostfixOperation_1_0_0 returns XInstanceOfExpression XMemberFeatureCall returns XInstanceOfExpression XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XInstanceOfExpression XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XInstanceOfExpression XPrimaryExpression returns XInstanceOfExpression XParenthesizedExpression returns XInstanceOfExpression XExpressionOrVarDeclaration returns XInstanceOfExpression Constraint: (expression=XRelationalExpression_XInstanceOfExpression_1_0_0_0_0 type=JvmTypeReference) """ if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__EXPRESSION) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__EXPRESSION)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__TYPE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__TYPE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0(), semanticObject.getExpression()); feeder.accept(grammarAccess.getXRelationalExpressionAccess().getTypeJvmTypeReferenceParserRuleCall_1_0_1_0(), semanticObject.getType()); feeder.finish(); }
java
protected void sequence_XRelationalExpression(ISerializationContext context, XInstanceOfExpression semanticObject) { if (errorAcceptor != null) { if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__EXPRESSION) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__EXPRESSION)); if (transientValues.isValueTransient(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__TYPE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, XbasePackage.Literals.XINSTANCE_OF_EXPRESSION__TYPE)); } SequenceFeeder feeder = createSequencerFeeder(context, semanticObject); feeder.accept(grammarAccess.getXRelationalExpressionAccess().getXInstanceOfExpressionExpressionAction_1_0_0_0_0(), semanticObject.getExpression()); feeder.accept(grammarAccess.getXRelationalExpressionAccess().getTypeJvmTypeReferenceParserRuleCall_1_0_1_0(), semanticObject.getType()); feeder.finish(); }
[ "protected", "void", "sequence_XRelationalExpression", "(", "ISerializationContext", "context", ",", "XInstanceOfExpression", "semanticObject", ")", "{", "if", "(", "errorAcceptor", "!=", "null", ")", "{", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XINSTANCE_OF_EXPRESSION__EXPRESSION", ")", "==", "ValueTransient", ".", "YES", ")", "errorAcceptor", ".", "accept", "(", "diagnosticProvider", ".", "createFeatureValueMissing", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XINSTANCE_OF_EXPRESSION__EXPRESSION", ")", ")", ";", "if", "(", "transientValues", ".", "isValueTransient", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XINSTANCE_OF_EXPRESSION__TYPE", ")", "==", "ValueTransient", ".", "YES", ")", "errorAcceptor", ".", "accept", "(", "diagnosticProvider", ".", "createFeatureValueMissing", "(", "semanticObject", ",", "XbasePackage", ".", "Literals", ".", "XINSTANCE_OF_EXPRESSION__TYPE", ")", ")", ";", "}", "SequenceFeeder", "feeder", "=", "createSequencerFeeder", "(", "context", ",", "semanticObject", ")", ";", "feeder", ".", "accept", "(", "grammarAccess", ".", "getXRelationalExpressionAccess", "(", ")", ".", "getXInstanceOfExpressionExpressionAction_1_0_0_0_0", "(", ")", ",", "semanticObject", ".", "getExpression", "(", ")", ")", ";", "feeder", ".", "accept", "(", "grammarAccess", ".", "getXRelationalExpressionAccess", "(", ")", ".", "getTypeJvmTypeReferenceParserRuleCall_1_0_1_0", "(", ")", ",", "semanticObject", ".", "getType", "(", ")", ")", ";", "feeder", ".", "finish", "(", ")", ";", "}" ]
Contexts: XExpression returns XInstanceOfExpression XAssignment returns XInstanceOfExpression XAssignment.XBinaryOperation_1_1_0_0_0 returns XInstanceOfExpression XOrExpression returns XInstanceOfExpression XOrExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XAndExpression returns XInstanceOfExpression XAndExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XEqualityExpression returns XInstanceOfExpression XEqualityExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XRelationalExpression returns XInstanceOfExpression XRelationalExpression.XInstanceOfExpression_1_0_0_0_0 returns XInstanceOfExpression XRelationalExpression.XBinaryOperation_1_1_0_0_0 returns XInstanceOfExpression XOtherOperatorExpression returns XInstanceOfExpression XOtherOperatorExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XAdditiveExpression returns XInstanceOfExpression XAdditiveExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XMultiplicativeExpression returns XInstanceOfExpression XMultiplicativeExpression.XBinaryOperation_1_0_0_0 returns XInstanceOfExpression XUnaryOperation returns XInstanceOfExpression XCastedExpression returns XInstanceOfExpression XCastedExpression.XCastedExpression_1_0_0_0 returns XInstanceOfExpression XPostfixOperation returns XInstanceOfExpression XPostfixOperation.XPostfixOperation_1_0_0 returns XInstanceOfExpression XMemberFeatureCall returns XInstanceOfExpression XMemberFeatureCall.XAssignment_1_0_0_0_0 returns XInstanceOfExpression XMemberFeatureCall.XMemberFeatureCall_1_1_0_0_0 returns XInstanceOfExpression XPrimaryExpression returns XInstanceOfExpression XParenthesizedExpression returns XInstanceOfExpression XExpressionOrVarDeclaration returns XInstanceOfExpression Constraint: (expression=XRelationalExpression_XInstanceOfExpression_1_0_0_0_0 type=JvmTypeReference)
[ "Contexts", ":", "XExpression", "returns", "XInstanceOfExpression", "XAssignment", "returns", "XInstanceOfExpression", "XAssignment", ".", "XBinaryOperation_1_1_0_0_0", "returns", "XInstanceOfExpression", "XOrExpression", "returns", "XInstanceOfExpression", "XOrExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XInstanceOfExpression", "XAndExpression", "returns", "XInstanceOfExpression", "XAndExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XInstanceOfExpression", "XEqualityExpression", "returns", "XInstanceOfExpression", "XEqualityExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XInstanceOfExpression", "XRelationalExpression", "returns", "XInstanceOfExpression", "XRelationalExpression", ".", "XInstanceOfExpression_1_0_0_0_0", "returns", "XInstanceOfExpression", "XRelationalExpression", ".", "XBinaryOperation_1_1_0_0_0", "returns", "XInstanceOfExpression", "XOtherOperatorExpression", "returns", "XInstanceOfExpression", "XOtherOperatorExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XInstanceOfExpression", "XAdditiveExpression", "returns", "XInstanceOfExpression", "XAdditiveExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XInstanceOfExpression", "XMultiplicativeExpression", "returns", "XInstanceOfExpression", "XMultiplicativeExpression", ".", "XBinaryOperation_1_0_0_0", "returns", "XInstanceOfExpression", "XUnaryOperation", "returns", "XInstanceOfExpression", "XCastedExpression", "returns", "XInstanceOfExpression", "XCastedExpression", ".", "XCastedExpression_1_0_0_0", "returns", "XInstanceOfExpression", "XPostfixOperation", "returns", "XInstanceOfExpression", "XPostfixOperation", ".", "XPostfixOperation_1_0_0", "returns", "XInstanceOfExpression", "XMemberFeatureCall", "returns", "XInstanceOfExpression", "XMemberFeatureCall", ".", "XAssignment_1_0_0_0_0", "returns", "XInstanceOfExpression", "XMemberFeatureCall", ".", "XMemberFeatureCall_1_1_0_0_0", "returns", "XInstanceOfExpression", "XPrimaryExpression", "returns", "XInstanceOfExpression", "XParenthesizedExpression", "returns", "XInstanceOfExpression", "XExpressionOrVarDeclaration", "returns", "XInstanceOfExpression" ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src-gen/org/eclipse/xtext/xbase/serializer/AbstractXbaseSemanticSequencer.java#L1303-L1314
hmsonline/storm-cassandra
src/main/java/com/hmsonline/storm/cassandra/bolt/mapper/DelimitedColumnsMapper.java
DelimitedColumnsMapper.mapToValues
@Override public List<Values> mapToValues(String rowKey, Map<String, String> columns, Tuple input) { """ Given a set of columns, maps to values to emit. @param columns @return """ List<Values> values = new ArrayList<Values>(); String delimVal = columns.get(this.columnKeyField); if (delimVal != null) { String[] vals = delimVal.split(this.delimiter); for (String val : vals) { if (this.isDrpc) { values.add(new Values(input.getValue(0), rowKey, val)); } else { values.add(new Values(rowKey, val)); } } } return values; }
java
@Override public List<Values> mapToValues(String rowKey, Map<String, String> columns, Tuple input) { List<Values> values = new ArrayList<Values>(); String delimVal = columns.get(this.columnKeyField); if (delimVal != null) { String[] vals = delimVal.split(this.delimiter); for (String val : vals) { if (this.isDrpc) { values.add(new Values(input.getValue(0), rowKey, val)); } else { values.add(new Values(rowKey, val)); } } } return values; }
[ "@", "Override", "public", "List", "<", "Values", ">", "mapToValues", "(", "String", "rowKey", ",", "Map", "<", "String", ",", "String", ">", "columns", ",", "Tuple", "input", ")", "{", "List", "<", "Values", ">", "values", "=", "new", "ArrayList", "<", "Values", ">", "(", ")", ";", "String", "delimVal", "=", "columns", ".", "get", "(", "this", ".", "columnKeyField", ")", ";", "if", "(", "delimVal", "!=", "null", ")", "{", "String", "[", "]", "vals", "=", "delimVal", ".", "split", "(", "this", ".", "delimiter", ")", ";", "for", "(", "String", "val", ":", "vals", ")", "{", "if", "(", "this", ".", "isDrpc", ")", "{", "values", ".", "add", "(", "new", "Values", "(", "input", ".", "getValue", "(", "0", ")", ",", "rowKey", ",", "val", ")", ")", ";", "}", "else", "{", "values", ".", "add", "(", "new", "Values", "(", "rowKey", ",", "val", ")", ")", ";", "}", "}", "}", "return", "values", ";", "}" ]
Given a set of columns, maps to values to emit. @param columns @return
[ "Given", "a", "set", "of", "columns", "maps", "to", "values", "to", "emit", "." ]
train
https://github.com/hmsonline/storm-cassandra/blob/94303fad18f4692224187867144921904e35b001/src/main/java/com/hmsonline/storm/cassandra/bolt/mapper/DelimitedColumnsMapper.java#L110-L125
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java
JobOperations.getTaskCounts
public TaskCounts getTaskCounts(String jobId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { """ Gets the task counts for the specified job. Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. @param jobId The ID of the job. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException thrown if the request is rejected by server @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. @return the TaskCounts object if successful. """ JobGetTaskCountsOptions options = new JobGetTaskCountsOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); return this.parentBatchClient.protocolLayer().jobs().getTaskCounts(jobId, options); }
java
public TaskCounts getTaskCounts(String jobId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { JobGetTaskCountsOptions options = new JobGetTaskCountsOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); return this.parentBatchClient.protocolLayer().jobs().getTaskCounts(jobId, options); }
[ "public", "TaskCounts", "getTaskCounts", "(", "String", "jobId", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", "{", "JobGetTaskCountsOptions", "options", "=", "new", "JobGetTaskCountsOptions", "(", ")", ";", "BehaviorManager", "bhMgr", "=", "new", "BehaviorManager", "(", "this", ".", "customBehaviors", "(", ")", ",", "additionalBehaviors", ")", ";", "bhMgr", ".", "applyRequestBehaviors", "(", "options", ")", ";", "return", "this", ".", "parentBatchClient", ".", "protocolLayer", "(", ")", ".", "jobs", "(", ")", ".", "getTaskCounts", "(", "jobId", ",", "options", ")", ";", "}" ]
Gets the task counts for the specified job. Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. @param jobId The ID of the job. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException thrown if the request is rejected by server @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. @return the TaskCounts object if successful.
[ "Gets", "the", "task", "counts", "for", "the", "specified", "job", ".", "Task", "counts", "provide", "a", "count", "of", "the", "tasks", "by", "active", "running", "or", "completed", "task", "state", "and", "a", "count", "of", "tasks", "which", "succeeded", "or", "failed", ".", "Tasks", "in", "the", "preparing", "state", "are", "counted", "as", "running", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L619-L625
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/NotesApi.java
NotesApi.getIssueNote
public Note getIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId) throws GitLabApiException { """ Get the specified issues's note. @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param issueIid the issue IID to get the notes for @param noteId the ID of the Note to get @return a Note instance for the specified IDs @throws GitLabApiException if any exception occurs """ Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId); return (response.readEntity(Note.class)); }
java
public Note getIssueNote(Object projectIdOrPath, Integer issueIid, Integer noteId) throws GitLabApiException { Response response = get(Response.Status.OK, getDefaultPerPageParam(), "projects", getProjectIdOrPath(projectIdOrPath), "issues", issueIid, "notes", noteId); return (response.readEntity(Note.class)); }
[ "public", "Note", "getIssueNote", "(", "Object", "projectIdOrPath", ",", "Integer", "issueIid", ",", "Integer", "noteId", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "getDefaultPerPageParam", "(", ")", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"issues\"", ",", "issueIid", ",", "\"notes\"", ",", "noteId", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Note", ".", "class", ")", ")", ";", "}" ]
Get the specified issues's note. @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param issueIid the issue IID to get the notes for @param noteId the ID of the Note to get @return a Note instance for the specified IDs @throws GitLabApiException if any exception occurs
[ "Get", "the", "specified", "issues", "s", "note", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/NotesApi.java#L140-L144
Multifarious/MacroManager
src/main/java/com/fasterxml/mama/Cluster.java
Cluster.shutdownWork
public void shutdownWork(String workUnit, boolean doLog /*true*/ ) { """ Shuts down a work unit by removing the claim in ZK and calling the listener. """ if (doLog) { LOG.info("Shutting down {}: {}...", config.workUnitName, workUnit); } myWorkUnits.remove(workUnit); claimedForHandoff.remove(workUnit); balancingPolicy.onShutdownWork(workUnit); try { listener.shutdownWork(workUnit); } finally { ZKUtils.deleteAtomic(zk, workUnitClaimPath(workUnit), myNodeID); } }
java
public void shutdownWork(String workUnit, boolean doLog /*true*/ ) { if (doLog) { LOG.info("Shutting down {}: {}...", config.workUnitName, workUnit); } myWorkUnits.remove(workUnit); claimedForHandoff.remove(workUnit); balancingPolicy.onShutdownWork(workUnit); try { listener.shutdownWork(workUnit); } finally { ZKUtils.deleteAtomic(zk, workUnitClaimPath(workUnit), myNodeID); } }
[ "public", "void", "shutdownWork", "(", "String", "workUnit", ",", "boolean", "doLog", "/*true*/", ")", "{", "if", "(", "doLog", ")", "{", "LOG", ".", "info", "(", "\"Shutting down {}: {}...\"", ",", "config", ".", "workUnitName", ",", "workUnit", ")", ";", "}", "myWorkUnits", ".", "remove", "(", "workUnit", ")", ";", "claimedForHandoff", ".", "remove", "(", "workUnit", ")", ";", "balancingPolicy", ".", "onShutdownWork", "(", "workUnit", ")", ";", "try", "{", "listener", ".", "shutdownWork", "(", "workUnit", ")", ";", "}", "finally", "{", "ZKUtils", ".", "deleteAtomic", "(", "zk", ",", "workUnitClaimPath", "(", "workUnit", ")", ",", "myNodeID", ")", ";", "}", "}" ]
Shuts down a work unit by removing the claim in ZK and calling the listener.
[ "Shuts", "down", "a", "work", "unit", "by", "removing", "the", "claim", "in", "ZK", "and", "calling", "the", "listener", "." ]
train
https://github.com/Multifarious/MacroManager/blob/559785839981f460aaeba3c3fddff7fb667d9581/src/main/java/com/fasterxml/mama/Cluster.java#L742-L754
sniffy/sniffy
sniffy-core/src/main/java/io/sniffy/LegacySpy.java
LegacySpy.expectAtLeast
@Deprecated public C expectAtLeast(int allowedStatements, Query query) { """ Alias for {@link #expectBetween(int, int, Threads, Query)} with arguments {@code allowedStatements}, {@link Integer#MAX_VALUE}, {@link Threads#CURRENT}, {@code queryType} @since 2.2 """ return expect(SqlQueries.minQueries(allowedStatements).type(adapter(query))); }
java
@Deprecated public C expectAtLeast(int allowedStatements, Query query) { return expect(SqlQueries.minQueries(allowedStatements).type(adapter(query))); }
[ "@", "Deprecated", "public", "C", "expectAtLeast", "(", "int", "allowedStatements", ",", "Query", "query", ")", "{", "return", "expect", "(", "SqlQueries", ".", "minQueries", "(", "allowedStatements", ")", ".", "type", "(", "adapter", "(", "query", ")", ")", ")", ";", "}" ]
Alias for {@link #expectBetween(int, int, Threads, Query)} with arguments {@code allowedStatements}, {@link Integer#MAX_VALUE}, {@link Threads#CURRENT}, {@code queryType} @since 2.2
[ "Alias", "for", "{" ]
train
https://github.com/sniffy/sniffy/blob/7bdddb9593e6b6e9fe5c7c87519f864acbc3a5c0/sniffy-core/src/main/java/io/sniffy/LegacySpy.java#L512-L515
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/processor/AbstractEntityFieldProcessor.java
AbstractEntityFieldProcessor.populateIdAccessorMethods
protected final void populateIdAccessorMethods(EntityMetadata metadata, Class<?> clazz, Field f) { """ Populates @Id accesser methods like, getId and setId of clazz to metadata. @param metadata the metadata @param clazz the clazz @param f the f """ try { BeanInfo info = Introspector.getBeanInfo(clazz); for (PropertyDescriptor descriptor : info.getPropertyDescriptors()) { if (descriptor.getName().equals(f.getName())) { metadata.setReadIdentifierMethod(descriptor.getReadMethod()); metadata.setWriteIdentifierMethod(descriptor.getWriteMethod()); return; } } } catch (IntrospectionException e) { throw new RuntimeException(e); } }
java
protected final void populateIdAccessorMethods(EntityMetadata metadata, Class<?> clazz, Field f) { try { BeanInfo info = Introspector.getBeanInfo(clazz); for (PropertyDescriptor descriptor : info.getPropertyDescriptors()) { if (descriptor.getName().equals(f.getName())) { metadata.setReadIdentifierMethod(descriptor.getReadMethod()); metadata.setWriteIdentifierMethod(descriptor.getWriteMethod()); return; } } } catch (IntrospectionException e) { throw new RuntimeException(e); } }
[ "protected", "final", "void", "populateIdAccessorMethods", "(", "EntityMetadata", "metadata", ",", "Class", "<", "?", ">", "clazz", ",", "Field", "f", ")", "{", "try", "{", "BeanInfo", "info", "=", "Introspector", ".", "getBeanInfo", "(", "clazz", ")", ";", "for", "(", "PropertyDescriptor", "descriptor", ":", "info", ".", "getPropertyDescriptors", "(", ")", ")", "{", "if", "(", "descriptor", ".", "getName", "(", ")", ".", "equals", "(", "f", ".", "getName", "(", ")", ")", ")", "{", "metadata", ".", "setReadIdentifierMethod", "(", "descriptor", ".", "getReadMethod", "(", ")", ")", ";", "metadata", ".", "setWriteIdentifierMethod", "(", "descriptor", ".", "getWriteMethod", "(", ")", ")", ";", "return", ";", "}", "}", "}", "catch", "(", "IntrospectionException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Populates @Id accesser methods like, getId and setId of clazz to metadata. @param metadata the metadata @param clazz the clazz @param f the f
[ "Populates", "@Id", "accesser", "methods", "like", "getId", "and", "setId", "of", "clazz", "to", "metadata", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/processor/AbstractEntityFieldProcessor.java#L141-L161
monitorjbl/excel-streaming-reader
src/main/java/com/monitorjbl/xlsx/sst/BufferedStringsTable.java
BufferedStringsTable.parseCT_RElt
private void parseCT_RElt(XMLEventReader xmlEventReader, StringBuilder buf) throws XMLStreamException { """ Parses a {@code <r>} Rich Text Run. Returns just the text and drops the formatting. See <a href="https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.run.aspx">xmlschema type {@code CT_RElt}</a>. """ // Precondition: pointing to <r>; Post condition: pointing to </r> XMLEvent xmlEvent; while((xmlEvent = xmlEventReader.nextTag()).isStartElement()) { switch(xmlEvent.asStartElement().getName().getLocalPart()) { case "t": // Text buf.append(xmlEventReader.getElementText()); break; case "rPr": // Run Properties skipElement(xmlEventReader); break; default: throw new IllegalArgumentException(xmlEvent.asStartElement().getName().getLocalPart()); } } }
java
private void parseCT_RElt(XMLEventReader xmlEventReader, StringBuilder buf) throws XMLStreamException { // Precondition: pointing to <r>; Post condition: pointing to </r> XMLEvent xmlEvent; while((xmlEvent = xmlEventReader.nextTag()).isStartElement()) { switch(xmlEvent.asStartElement().getName().getLocalPart()) { case "t": // Text buf.append(xmlEventReader.getElementText()); break; case "rPr": // Run Properties skipElement(xmlEventReader); break; default: throw new IllegalArgumentException(xmlEvent.asStartElement().getName().getLocalPart()); } } }
[ "private", "void", "parseCT_RElt", "(", "XMLEventReader", "xmlEventReader", ",", "StringBuilder", "buf", ")", "throws", "XMLStreamException", "{", "// Precondition: pointing to <r>; Post condition: pointing to </r>", "XMLEvent", "xmlEvent", ";", "while", "(", "(", "xmlEvent", "=", "xmlEventReader", ".", "nextTag", "(", ")", ")", ".", "isStartElement", "(", ")", ")", "{", "switch", "(", "xmlEvent", ".", "asStartElement", "(", ")", ".", "getName", "(", ")", ".", "getLocalPart", "(", ")", ")", "{", "case", "\"t\"", ":", "// Text", "buf", ".", "append", "(", "xmlEventReader", ".", "getElementText", "(", ")", ")", ";", "break", ";", "case", "\"rPr\"", ":", "// Run Properties", "skipElement", "(", "xmlEventReader", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "xmlEvent", ".", "asStartElement", "(", ")", ".", "getName", "(", ")", ".", "getLocalPart", "(", ")", ")", ";", "}", "}", "}" ]
Parses a {@code <r>} Rich Text Run. Returns just the text and drops the formatting. See <a href="https://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.run.aspx">xmlschema type {@code CT_RElt}</a>.
[ "Parses", "a", "{" ]
train
https://github.com/monitorjbl/excel-streaming-reader/blob/4e95c9aaaecf33685a09f8c267af3a578ba5e070/src/main/java/com/monitorjbl/xlsx/sst/BufferedStringsTable.java#L84-L99
Impetus/Kundera
src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/service/HBaseReader.java
HBaseReader.scanResults
private List<HBaseDataWrapper> scanResults(final String tableName, List<HBaseDataWrapper> results) throws IOException { """ Scan results. @param tableName the table name @param results the results @return the list @throws IOException Signals that an I/O exception has occurred. """ if (fetchSize == null) { for (Result result : scanner) { HBaseDataWrapper data = new HBaseDataWrapper(tableName, result.getRow()); data.setColumns(result.listCells()); results.add(data); } scanner = null; resultsIter = null; } return results; }
java
private List<HBaseDataWrapper> scanResults(final String tableName, List<HBaseDataWrapper> results) throws IOException { if (fetchSize == null) { for (Result result : scanner) { HBaseDataWrapper data = new HBaseDataWrapper(tableName, result.getRow()); data.setColumns(result.listCells()); results.add(data); } scanner = null; resultsIter = null; } return results; }
[ "private", "List", "<", "HBaseDataWrapper", ">", "scanResults", "(", "final", "String", "tableName", ",", "List", "<", "HBaseDataWrapper", ">", "results", ")", "throws", "IOException", "{", "if", "(", "fetchSize", "==", "null", ")", "{", "for", "(", "Result", "result", ":", "scanner", ")", "{", "HBaseDataWrapper", "data", "=", "new", "HBaseDataWrapper", "(", "tableName", ",", "result", ".", "getRow", "(", ")", ")", ";", "data", ".", "setColumns", "(", "result", ".", "listCells", "(", ")", ")", ";", "results", ".", "add", "(", "data", ")", ";", "}", "scanner", "=", "null", ";", "resultsIter", "=", "null", ";", "}", "return", "results", ";", "}" ]
Scan results. @param tableName the table name @param results the results @return the list @throws IOException Signals that an I/O exception has occurred.
[ "Scan", "results", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-hbase/kundera-hbase-v2/src/main/java/com/impetus/client/hbase/service/HBaseReader.java#L148-L164
charithe/kafka-junit
src/main/java/com/github/charithe/kafka/KafkaHelper.java
KafkaHelper.produceStrings
public void produceStrings(String topic, String... values) { """ Convenience method to produce a set of strings to the specified topic @param topic Topic to produce to @param values Values produce """ try (KafkaProducer<String, String> producer = createStringProducer()) { Map<String, String> data = Arrays.stream(values) .collect(Collectors.toMap(k -> String.valueOf(k.hashCode()), Function.identity())); produce(topic, producer, data); } }
java
public void produceStrings(String topic, String... values) { try (KafkaProducer<String, String> producer = createStringProducer()) { Map<String, String> data = Arrays.stream(values) .collect(Collectors.toMap(k -> String.valueOf(k.hashCode()), Function.identity())); produce(topic, producer, data); } }
[ "public", "void", "produceStrings", "(", "String", "topic", ",", "String", "...", "values", ")", "{", "try", "(", "KafkaProducer", "<", "String", ",", "String", ">", "producer", "=", "createStringProducer", "(", ")", ")", "{", "Map", "<", "String", ",", "String", ">", "data", "=", "Arrays", ".", "stream", "(", "values", ")", ".", "collect", "(", "Collectors", ".", "toMap", "(", "k", "->", "String", ".", "valueOf", "(", "k", ".", "hashCode", "(", ")", ")", ",", "Function", ".", "identity", "(", ")", ")", ")", ";", "produce", "(", "topic", ",", "producer", ",", "data", ")", ";", "}", "}" ]
Convenience method to produce a set of strings to the specified topic @param topic Topic to produce to @param values Values produce
[ "Convenience", "method", "to", "produce", "a", "set", "of", "strings", "to", "the", "specified", "topic" ]
train
https://github.com/charithe/kafka-junit/blob/b808b3d1dec8105346d316f92f68950f36aeb871/src/main/java/com/github/charithe/kafka/KafkaHelper.java#L190-L196
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java
SyncAgentsInner.beginCreateOrUpdate
public SyncAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { """ Creates or updates a sync agent. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server on which the sync agent is hosted. @param syncAgentName The name of the sync agent. @param syncDatabaseId ARM resource id of the sync database in the sync agent. @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 SyncAgentInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).toBlocking().single().body(); }
java
public SyncAgentInner beginCreateOrUpdate(String resourceGroupName, String serverName, String syncAgentName, String syncDatabaseId) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, syncAgentName, syncDatabaseId).toBlocking().single().body(); }
[ "public", "SyncAgentInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "syncAgentName", ",", "String", "syncDatabaseId", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "syncAgentName", ",", "syncDatabaseId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates a sync agent. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server on which the sync agent is hosted. @param syncAgentName The name of the sync agent. @param syncDatabaseId ARM resource id of the sync database in the sync agent. @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 SyncAgentInner object if successful.
[ "Creates", "or", "updates", "a", "sync", "agent", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncAgentsInner.java#L460-L462
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/SnippetsApi.java
SnippetsApi.createSnippet
public Snippet createSnippet(String title, String fileName, String content) throws GitLabApiException { """ Create a new Snippet. @param title the title of the snippet @param fileName the file name of the snippet @param content the content of the snippet @return the created Snippet @throws GitLabApiException if any exception occurs """ GitLabApiForm formData = new GitLabApiForm() .withParam("title", title, true) .withParam("file_name", fileName, true) .withParam("content", content, true); Response response = post(Response.Status.CREATED, formData, "snippets"); return (response.readEntity(Snippet.class)); }
java
public Snippet createSnippet(String title, String fileName, String content) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("title", title, true) .withParam("file_name", fileName, true) .withParam("content", content, true); Response response = post(Response.Status.CREATED, formData, "snippets"); return (response.readEntity(Snippet.class)); }
[ "public", "Snippet", "createSnippet", "(", "String", "title", ",", "String", "fileName", ",", "String", "content", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", ")", ".", "withParam", "(", "\"title\"", ",", "title", ",", "true", ")", ".", "withParam", "(", "\"file_name\"", ",", "fileName", ",", "true", ")", ".", "withParam", "(", "\"content\"", ",", "content", ",", "true", ")", ";", "Response", "response", "=", "post", "(", "Response", ".", "Status", ".", "CREATED", ",", "formData", ",", "\"snippets\"", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Snippet", ".", "class", ")", ")", ";", "}" ]
Create a new Snippet. @param title the title of the snippet @param fileName the file name of the snippet @param content the content of the snippet @return the created Snippet @throws GitLabApiException if any exception occurs
[ "Create", "a", "new", "Snippet", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/SnippetsApi.java#L169-L176
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.accessRestriction_ip_POST
public void accessRestriction_ip_POST(String ip, OvhIpRestrictionRuleEnum rule, Boolean warning) throws IOException { """ Add an IP access restriction REST: POST /me/accessRestriction/ip @param rule [required] Accept or deny IP access @param warning [required] Send an email if someone try to access with this IP address @param ip [required] An IP range where we will apply the rule """ String qPath = "/me/accessRestriction/ip"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ip", ip); addBody(o, "rule", rule); addBody(o, "warning", warning); exec(qPath, "POST", sb.toString(), o); }
java
public void accessRestriction_ip_POST(String ip, OvhIpRestrictionRuleEnum rule, Boolean warning) throws IOException { String qPath = "/me/accessRestriction/ip"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ip", ip); addBody(o, "rule", rule); addBody(o, "warning", warning); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "accessRestriction_ip_POST", "(", "String", "ip", ",", "OvhIpRestrictionRuleEnum", "rule", ",", "Boolean", "warning", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/accessRestriction/ip\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"ip\"", ",", "ip", ")", ";", "addBody", "(", "o", ",", "\"rule\"", ",", "rule", ")", ";", "addBody", "(", "o", ",", "\"warning\"", ",", "warning", ")", ";", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "}" ]
Add an IP access restriction REST: POST /me/accessRestriction/ip @param rule [required] Accept or deny IP access @param warning [required] Send an email if someone try to access with this IP address @param ip [required] An IP range where we will apply the rule
[ "Add", "an", "IP", "access", "restriction" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4077-L4085
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/WikisApi.java
WikisApi.deletePage
public void deletePage(Object projectIdOrPath, String slug) throws GitLabApiException { """ Deletes an existing project wiki page. This is an idempotent function and deleting a non-existent page does not cause an error. <pre><code>GitLab Endpoint: DELETE /projects/:id/wikis/:slug</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param slug the slug of the project's wiki page @throws GitLabApiException if any exception occurs """ delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "wikis", slug); }
java
public void deletePage(Object projectIdOrPath, String slug) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "wikis", slug); }
[ "public", "void", "deletePage", "(", "Object", "projectIdOrPath", ",", "String", "slug", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"wikis\"", ",", "slug", ")", ";", "}" ]
Deletes an existing project wiki page. This is an idempotent function and deleting a non-existent page does not cause an error. <pre><code>GitLab Endpoint: DELETE /projects/:id/wikis/:slug</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param slug the slug of the project's wiki page @throws GitLabApiException if any exception occurs
[ "Deletes", "an", "existing", "project", "wiki", "page", ".", "This", "is", "an", "idempotent", "function", "and", "deleting", "a", "non", "-", "existent", "page", "does", "not", "cause", "an", "error", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/WikisApi.java#L167-L169
molgenis/molgenis
molgenis-data-security/src/main/java/org/molgenis/data/security/auth/GroupService.java
GroupService.addMember
@RunAsSystem public void addMember(final Group group, final User user, final Role role) { """ Add member to group. User can only be added to a role that belongs to the group. The user can only have a single role within the group @param group group to add the user to in the given role @param user user to be added in the given role to the given group @param role role in which the given user is to be added to given group """ ArrayList<Role> groupRoles = newArrayList(group.getRoles()); Collection<RoleMembership> memberships = roleMembershipService.getMemberships(groupRoles); boolean isGroupRole = groupRoles.stream().anyMatch(gr -> gr.getName().equals(role.getName())); if (!isGroupRole) { throw new NotAValidGroupRoleException(role, group); } boolean isMember = memberships.stream().parallel().anyMatch(m -> m.getUser().equals(user)); if (isMember) { throw new IsAlreadyMemberException(user, group); } roleMembershipService.addUserToRole(user, role); }
java
@RunAsSystem public void addMember(final Group group, final User user, final Role role) { ArrayList<Role> groupRoles = newArrayList(group.getRoles()); Collection<RoleMembership> memberships = roleMembershipService.getMemberships(groupRoles); boolean isGroupRole = groupRoles.stream().anyMatch(gr -> gr.getName().equals(role.getName())); if (!isGroupRole) { throw new NotAValidGroupRoleException(role, group); } boolean isMember = memberships.stream().parallel().anyMatch(m -> m.getUser().equals(user)); if (isMember) { throw new IsAlreadyMemberException(user, group); } roleMembershipService.addUserToRole(user, role); }
[ "@", "RunAsSystem", "public", "void", "addMember", "(", "final", "Group", "group", ",", "final", "User", "user", ",", "final", "Role", "role", ")", "{", "ArrayList", "<", "Role", ">", "groupRoles", "=", "newArrayList", "(", "group", ".", "getRoles", "(", ")", ")", ";", "Collection", "<", "RoleMembership", ">", "memberships", "=", "roleMembershipService", ".", "getMemberships", "(", "groupRoles", ")", ";", "boolean", "isGroupRole", "=", "groupRoles", ".", "stream", "(", ")", ".", "anyMatch", "(", "gr", "->", "gr", ".", "getName", "(", ")", ".", "equals", "(", "role", ".", "getName", "(", ")", ")", ")", ";", "if", "(", "!", "isGroupRole", ")", "{", "throw", "new", "NotAValidGroupRoleException", "(", "role", ",", "group", ")", ";", "}", "boolean", "isMember", "=", "memberships", ".", "stream", "(", ")", ".", "parallel", "(", ")", ".", "anyMatch", "(", "m", "->", "m", ".", "getUser", "(", ")", ".", "equals", "(", "user", ")", ")", ";", "if", "(", "isMember", ")", "{", "throw", "new", "IsAlreadyMemberException", "(", "user", ",", "group", ")", ";", "}", "roleMembershipService", ".", "addUserToRole", "(", "user", ",", "role", ")", ";", "}" ]
Add member to group. User can only be added to a role that belongs to the group. The user can only have a single role within the group @param group group to add the user to in the given role @param user user to be added in the given role to the given group @param role role in which the given user is to be added to given group
[ "Add", "member", "to", "group", ".", "User", "can", "only", "be", "added", "to", "a", "role", "that", "belongs", "to", "the", "group", ".", "The", "user", "can", "only", "have", "a", "single", "role", "within", "the", "group" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-security/src/main/java/org/molgenis/data/security/auth/GroupService.java#L153-L170
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
MP3FileID3Controller.setFrameData
public void setFrameData(String id, byte[] data) { """ Set the data of the frame specified by the id (id3v2 only). The id should be one of the static strings specified in ID3v2Frames class. @param id the id of the frame to set the data for @param data the data to set """ if (allow(ID3V2)) { id3v2.updateFrameData(id, data); } }
java
public void setFrameData(String id, byte[] data) { if (allow(ID3V2)) { id3v2.updateFrameData(id, data); } }
[ "public", "void", "setFrameData", "(", "String", "id", ",", "byte", "[", "]", "data", ")", "{", "if", "(", "allow", "(", "ID3V2", ")", ")", "{", "id3v2", ".", "updateFrameData", "(", "id", ",", "data", ")", ";", "}", "}" ]
Set the data of the frame specified by the id (id3v2 only). The id should be one of the static strings specified in ID3v2Frames class. @param id the id of the frame to set the data for @param data the data to set
[ "Set", "the", "data", "of", "the", "frame", "specified", "by", "the", "id", "(", "id3v2", "only", ")", ".", "The", "id", "should", "be", "one", "of", "the", "static", "strings", "specified", "in", "ID3v2Frames", "class", "." ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L379-L385
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.createRemoteEnvironment
public static StreamExecutionEnvironment createRemoteEnvironment( String host, int port, String... jarFiles) { """ Creates a {@link RemoteStreamEnvironment}. The remote environment sends (parts of) the program to a cluster for execution. Note that all file paths used in the program must be accessible from the cluster. The execution will use no parallelism, unless the parallelism is set explicitly via {@link #setParallelism}. @param host The host name or address of the master (JobManager), where the program should be executed. @param port The port of the master (JobManager), where the program should be executed. @param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses user-defined functions, user-defined input formats, or any libraries, those must be provided in the JAR files. @return A remote environment that executes the program on a cluster. """ return new RemoteStreamEnvironment(host, port, jarFiles); }
java
public static StreamExecutionEnvironment createRemoteEnvironment( String host, int port, String... jarFiles) { return new RemoteStreamEnvironment(host, port, jarFiles); }
[ "public", "static", "StreamExecutionEnvironment", "createRemoteEnvironment", "(", "String", "host", ",", "int", "port", ",", "String", "...", "jarFiles", ")", "{", "return", "new", "RemoteStreamEnvironment", "(", "host", ",", "port", ",", "jarFiles", ")", ";", "}" ]
Creates a {@link RemoteStreamEnvironment}. The remote environment sends (parts of) the program to a cluster for execution. Note that all file paths used in the program must be accessible from the cluster. The execution will use no parallelism, unless the parallelism is set explicitly via {@link #setParallelism}. @param host The host name or address of the master (JobManager), where the program should be executed. @param port The port of the master (JobManager), where the program should be executed. @param jarFiles The JAR files with code that needs to be shipped to the cluster. If the program uses user-defined functions, user-defined input formats, or any libraries, those must be provided in the JAR files. @return A remote environment that executes the program on a cluster.
[ "Creates", "a", "{", "@link", "RemoteStreamEnvironment", "}", ".", "The", "remote", "environment", "sends", "(", "parts", "of", ")", "the", "program", "to", "a", "cluster", "for", "execution", ".", "Note", "that", "all", "file", "paths", "used", "in", "the", "program", "must", "be", "accessible", "from", "the", "cluster", ".", "The", "execution", "will", "use", "no", "parallelism", "unless", "the", "parallelism", "is", "set", "explicitly", "via", "{", "@link", "#setParallelism", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1682-L1685
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/security/DefaultBackendSecurity.java
DefaultBackendSecurity.parseBeSecurity
public BackendSecuritySpec parseBeSecurity() throws BackendSecurityParserException { """ Parses the beSecurity configuration file. @throws BackendSecurityParserException If an error occurs in attempting to parse the beSecurity configuration file. """ try { BackendSecurityDeserializer bsd = new BackendSecurityDeserializer(m_encoding, m_validate); return bsd.deserialize(m_beSecurityPath); } catch (Throwable th) { throw new BackendSecurityParserException("[DefaultBackendSecurity] " + "An error has occured in parsing the backend security " + "configuration file located at \"" + m_beSecurityPath + "\". " + "The underlying error was a " + th.getClass().getName() + "The message was \"" + th.getMessage() + "\"."); } }
java
public BackendSecuritySpec parseBeSecurity() throws BackendSecurityParserException { try { BackendSecurityDeserializer bsd = new BackendSecurityDeserializer(m_encoding, m_validate); return bsd.deserialize(m_beSecurityPath); } catch (Throwable th) { throw new BackendSecurityParserException("[DefaultBackendSecurity] " + "An error has occured in parsing the backend security " + "configuration file located at \"" + m_beSecurityPath + "\". " + "The underlying error was a " + th.getClass().getName() + "The message was \"" + th.getMessage() + "\"."); } }
[ "public", "BackendSecuritySpec", "parseBeSecurity", "(", ")", "throws", "BackendSecurityParserException", "{", "try", "{", "BackendSecurityDeserializer", "bsd", "=", "new", "BackendSecurityDeserializer", "(", "m_encoding", ",", "m_validate", ")", ";", "return", "bsd", ".", "deserialize", "(", "m_beSecurityPath", ")", ";", "}", "catch", "(", "Throwable", "th", ")", "{", "throw", "new", "BackendSecurityParserException", "(", "\"[DefaultBackendSecurity] \"", "+", "\"An error has occured in parsing the backend security \"", "+", "\"configuration file located at \\\"\"", "+", "m_beSecurityPath", "+", "\"\\\". \"", "+", "\"The underlying error was a \"", "+", "th", ".", "getClass", "(", ")", ".", "getName", "(", ")", "+", "\"The message was \\\"\"", "+", "th", ".", "getMessage", "(", ")", "+", "\"\\\".\"", ")", ";", "}", "}" ]
Parses the beSecurity configuration file. @throws BackendSecurityParserException If an error occurs in attempting to parse the beSecurity configuration file.
[ "Parses", "the", "beSecurity", "configuration", "file", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/security/DefaultBackendSecurity.java#L139-L158
Whiley/WhileyCompiler
src/main/java/wyil/check/FlowTypeCheck.java
FlowTypeCheck.checkSkip
private Environment checkSkip(Stmt.Skip stmt, Environment environment, EnclosingScope scope) { """ Type check a <code>skip</code> statement, which has no effect on the environment. @param stmt Statement to type check @param environment Determines the type of all variables immediately going into this block @return """ return environment; }
java
private Environment checkSkip(Stmt.Skip stmt, Environment environment, EnclosingScope scope) { return environment; }
[ "private", "Environment", "checkSkip", "(", "Stmt", ".", "Skip", "stmt", ",", "Environment", "environment", ",", "EnclosingScope", "scope", ")", "{", "return", "environment", ";", "}" ]
Type check a <code>skip</code> statement, which has no effect on the environment. @param stmt Statement to type check @param environment Determines the type of all variables immediately going into this block @return
[ "Type", "check", "a", "<code", ">", "skip<", "/", "code", ">", "statement", "which", "has", "no", "effect", "on", "the", "environment", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L633-L635
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java
ExecutionGraph.constructExecutionGraph
private void constructExecutionGraph(final JobGraph jobGraph, final InstanceManager instanceManager) throws GraphConversionException { """ Sets up an execution graph from a job graph. @param jobGraph the job graph to create the execution graph from @param instanceManager the instance manager @throws GraphConversionException thrown if the job graph is not valid and no execution graph can be constructed from it """ // Clean up temporary data structures final HashMap<AbstractJobVertex, ExecutionVertex> temporaryVertexMap = new HashMap<AbstractJobVertex, ExecutionVertex>(); final HashMap<AbstractJobVertex, ExecutionGroupVertex> temporaryGroupVertexMap = new HashMap<AbstractJobVertex, ExecutionGroupVertex>(); // Initially, create only one execution stage that contains all group vertices final ExecutionStage initialExecutionStage = new ExecutionStage(this, 0); this.stages.add(initialExecutionStage); // Convert job vertices to execution vertices and initialize them final AbstractJobVertex[] all = jobGraph.getAllJobVertices(); for (int i = 0; i < all.length; i++) { final ExecutionVertex createdVertex = createVertex(all[i], instanceManager, initialExecutionStage, jobGraph.getJobConfiguration()); temporaryVertexMap.put(all[i], createdVertex); temporaryGroupVertexMap.put(all[i], createdVertex.getGroupVertex()); } // Create initial edges between the vertices createInitialGroupEdges(temporaryVertexMap); // Now that an initial graph is built, apply the user settings applyUserDefinedSettings(temporaryGroupVertexMap); // Calculate the connection IDs calculateConnectionIDs(); // Finally, construct the execution pipelines reconstructExecutionPipelines(); }
java
private void constructExecutionGraph(final JobGraph jobGraph, final InstanceManager instanceManager) throws GraphConversionException { // Clean up temporary data structures final HashMap<AbstractJobVertex, ExecutionVertex> temporaryVertexMap = new HashMap<AbstractJobVertex, ExecutionVertex>(); final HashMap<AbstractJobVertex, ExecutionGroupVertex> temporaryGroupVertexMap = new HashMap<AbstractJobVertex, ExecutionGroupVertex>(); // Initially, create only one execution stage that contains all group vertices final ExecutionStage initialExecutionStage = new ExecutionStage(this, 0); this.stages.add(initialExecutionStage); // Convert job vertices to execution vertices and initialize them final AbstractJobVertex[] all = jobGraph.getAllJobVertices(); for (int i = 0; i < all.length; i++) { final ExecutionVertex createdVertex = createVertex(all[i], instanceManager, initialExecutionStage, jobGraph.getJobConfiguration()); temporaryVertexMap.put(all[i], createdVertex); temporaryGroupVertexMap.put(all[i], createdVertex.getGroupVertex()); } // Create initial edges between the vertices createInitialGroupEdges(temporaryVertexMap); // Now that an initial graph is built, apply the user settings applyUserDefinedSettings(temporaryGroupVertexMap); // Calculate the connection IDs calculateConnectionIDs(); // Finally, construct the execution pipelines reconstructExecutionPipelines(); }
[ "private", "void", "constructExecutionGraph", "(", "final", "JobGraph", "jobGraph", ",", "final", "InstanceManager", "instanceManager", ")", "throws", "GraphConversionException", "{", "// Clean up temporary data structures", "final", "HashMap", "<", "AbstractJobVertex", ",", "ExecutionVertex", ">", "temporaryVertexMap", "=", "new", "HashMap", "<", "AbstractJobVertex", ",", "ExecutionVertex", ">", "(", ")", ";", "final", "HashMap", "<", "AbstractJobVertex", ",", "ExecutionGroupVertex", ">", "temporaryGroupVertexMap", "=", "new", "HashMap", "<", "AbstractJobVertex", ",", "ExecutionGroupVertex", ">", "(", ")", ";", "// Initially, create only one execution stage that contains all group vertices", "final", "ExecutionStage", "initialExecutionStage", "=", "new", "ExecutionStage", "(", "this", ",", "0", ")", ";", "this", ".", "stages", ".", "add", "(", "initialExecutionStage", ")", ";", "// Convert job vertices to execution vertices and initialize them", "final", "AbstractJobVertex", "[", "]", "all", "=", "jobGraph", ".", "getAllJobVertices", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "all", ".", "length", ";", "i", "++", ")", "{", "final", "ExecutionVertex", "createdVertex", "=", "createVertex", "(", "all", "[", "i", "]", ",", "instanceManager", ",", "initialExecutionStage", ",", "jobGraph", ".", "getJobConfiguration", "(", ")", ")", ";", "temporaryVertexMap", ".", "put", "(", "all", "[", "i", "]", ",", "createdVertex", ")", ";", "temporaryGroupVertexMap", ".", "put", "(", "all", "[", "i", "]", ",", "createdVertex", ".", "getGroupVertex", "(", ")", ")", ";", "}", "// Create initial edges between the vertices", "createInitialGroupEdges", "(", "temporaryVertexMap", ")", ";", "// Now that an initial graph is built, apply the user settings", "applyUserDefinedSettings", "(", "temporaryGroupVertexMap", ")", ";", "// Calculate the connection IDs", "calculateConnectionIDs", "(", ")", ";", "// Finally, construct the execution pipelines", "reconstructExecutionPipelines", "(", ")", ";", "}" ]
Sets up an execution graph from a job graph. @param jobGraph the job graph to create the execution graph from @param instanceManager the instance manager @throws GraphConversionException thrown if the job graph is not valid and no execution graph can be constructed from it
[ "Sets", "up", "an", "execution", "graph", "from", "a", "job", "graph", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/executiongraph/ExecutionGraph.java#L261-L292
networknt/light-4j
client/src/main/java/com/networknt/client/oauth/OauthHelper.java
OauthHelper.getTokenResult
public static Result<TokenResponse> getTokenResult(TokenRequest tokenRequest, String envTag) { """ Get an access token from the token service. A Result of TokenResponse will be returned if the invocation is successfully. Otherwise, a Result of Status will be returned. @param tokenRequest token request constructed from the client.yml token section. @param envTag the environment tag from the server.yml for service lookup. @return Result of TokenResponse or error Status. """ final AtomicReference<Result<TokenResponse>> reference = new AtomicReference<>(); final Http2Client client = Http2Client.getInstance(); final CountDownLatch latch = new CountDownLatch(1); final ClientConnection connection; try { if(tokenRequest.getServerUrl() != null) { connection = client.connect(new URI(tokenRequest.getServerUrl()), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, tokenRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get(); } else if(tokenRequest.getServiceId() != null) { Cluster cluster = SingletonServiceFactory.getBean(Cluster.class); String url = cluster.serviceToUrl("https", tokenRequest.getServiceId(), envTag, null); connection = client.connect(new URI(url), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, tokenRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get(); } else { // both server_url and serviceId are empty in the config. logger.error("Error: both server_url and serviceId are not configured in client.yml for " + tokenRequest.getClass()); throw new ClientException("both server_url and serviceId are not configured in client.yml for " + tokenRequest.getClass()); } } catch (Exception e) { logger.error("cannot establish connection:", e); return Failure.of(new Status(ESTABLISH_CONNECTION_ERROR, tokenRequest.getServerUrl() != null? tokenRequest.getServerUrl() : tokenRequest.getServiceId())); } try { IClientRequestComposable requestComposer = ClientRequestComposerProvider.getInstance().getComposer(ClientRequestComposerProvider.ClientRequestComposers.CLIENT_CREDENTIAL_REQUEST_COMPOSER); connection.getIoThread().execute(new TokenRequestAction(tokenRequest, requestComposer, connection, reference, latch)); latch.await(4, TimeUnit.SECONDS); } catch (Exception e) { logger.error("IOException: ", e); return Failure.of(new Status(FAIL_TO_SEND_REQUEST)); } finally { IoUtils.safeClose(connection); } //if reference.get() is null at this point, mostly likely couldn't get token within latch.await() timeout. return reference.get() == null ? Failure.of(new Status(GET_TOKEN_TIMEOUT)) : reference.get(); }
java
public static Result<TokenResponse> getTokenResult(TokenRequest tokenRequest, String envTag) { final AtomicReference<Result<TokenResponse>> reference = new AtomicReference<>(); final Http2Client client = Http2Client.getInstance(); final CountDownLatch latch = new CountDownLatch(1); final ClientConnection connection; try { if(tokenRequest.getServerUrl() != null) { connection = client.connect(new URI(tokenRequest.getServerUrl()), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, tokenRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get(); } else if(tokenRequest.getServiceId() != null) { Cluster cluster = SingletonServiceFactory.getBean(Cluster.class); String url = cluster.serviceToUrl("https", tokenRequest.getServiceId(), envTag, null); connection = client.connect(new URI(url), Http2Client.WORKER, Http2Client.SSL, Http2Client.BUFFER_POOL, tokenRequest.enableHttp2 ? OptionMap.create(UndertowOptions.ENABLE_HTTP2, true): OptionMap.EMPTY).get(); } else { // both server_url and serviceId are empty in the config. logger.error("Error: both server_url and serviceId are not configured in client.yml for " + tokenRequest.getClass()); throw new ClientException("both server_url and serviceId are not configured in client.yml for " + tokenRequest.getClass()); } } catch (Exception e) { logger.error("cannot establish connection:", e); return Failure.of(new Status(ESTABLISH_CONNECTION_ERROR, tokenRequest.getServerUrl() != null? tokenRequest.getServerUrl() : tokenRequest.getServiceId())); } try { IClientRequestComposable requestComposer = ClientRequestComposerProvider.getInstance().getComposer(ClientRequestComposerProvider.ClientRequestComposers.CLIENT_CREDENTIAL_REQUEST_COMPOSER); connection.getIoThread().execute(new TokenRequestAction(tokenRequest, requestComposer, connection, reference, latch)); latch.await(4, TimeUnit.SECONDS); } catch (Exception e) { logger.error("IOException: ", e); return Failure.of(new Status(FAIL_TO_SEND_REQUEST)); } finally { IoUtils.safeClose(connection); } //if reference.get() is null at this point, mostly likely couldn't get token within latch.await() timeout. return reference.get() == null ? Failure.of(new Status(GET_TOKEN_TIMEOUT)) : reference.get(); }
[ "public", "static", "Result", "<", "TokenResponse", ">", "getTokenResult", "(", "TokenRequest", "tokenRequest", ",", "String", "envTag", ")", "{", "final", "AtomicReference", "<", "Result", "<", "TokenResponse", ">", ">", "reference", "=", "new", "AtomicReference", "<>", "(", ")", ";", "final", "Http2Client", "client", "=", "Http2Client", ".", "getInstance", "(", ")", ";", "final", "CountDownLatch", "latch", "=", "new", "CountDownLatch", "(", "1", ")", ";", "final", "ClientConnection", "connection", ";", "try", "{", "if", "(", "tokenRequest", ".", "getServerUrl", "(", ")", "!=", "null", ")", "{", "connection", "=", "client", ".", "connect", "(", "new", "URI", "(", "tokenRequest", ".", "getServerUrl", "(", ")", ")", ",", "Http2Client", ".", "WORKER", ",", "Http2Client", ".", "SSL", ",", "Http2Client", ".", "BUFFER_POOL", ",", "tokenRequest", ".", "enableHttp2", "?", "OptionMap", ".", "create", "(", "UndertowOptions", ".", "ENABLE_HTTP2", ",", "true", ")", ":", "OptionMap", ".", "EMPTY", ")", ".", "get", "(", ")", ";", "}", "else", "if", "(", "tokenRequest", ".", "getServiceId", "(", ")", "!=", "null", ")", "{", "Cluster", "cluster", "=", "SingletonServiceFactory", ".", "getBean", "(", "Cluster", ".", "class", ")", ";", "String", "url", "=", "cluster", ".", "serviceToUrl", "(", "\"https\"", ",", "tokenRequest", ".", "getServiceId", "(", ")", ",", "envTag", ",", "null", ")", ";", "connection", "=", "client", ".", "connect", "(", "new", "URI", "(", "url", ")", ",", "Http2Client", ".", "WORKER", ",", "Http2Client", ".", "SSL", ",", "Http2Client", ".", "BUFFER_POOL", ",", "tokenRequest", ".", "enableHttp2", "?", "OptionMap", ".", "create", "(", "UndertowOptions", ".", "ENABLE_HTTP2", ",", "true", ")", ":", "OptionMap", ".", "EMPTY", ")", ".", "get", "(", ")", ";", "}", "else", "{", "// both server_url and serviceId are empty in the config.", "logger", ".", "error", "(", "\"Error: both server_url and serviceId are not configured in client.yml for \"", "+", "tokenRequest", ".", "getClass", "(", ")", ")", ";", "throw", "new", "ClientException", "(", "\"both server_url and serviceId are not configured in client.yml for \"", "+", "tokenRequest", ".", "getClass", "(", ")", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"cannot establish connection:\"", ",", "e", ")", ";", "return", "Failure", ".", "of", "(", "new", "Status", "(", "ESTABLISH_CONNECTION_ERROR", ",", "tokenRequest", ".", "getServerUrl", "(", ")", "!=", "null", "?", "tokenRequest", ".", "getServerUrl", "(", ")", ":", "tokenRequest", ".", "getServiceId", "(", ")", ")", ")", ";", "}", "try", "{", "IClientRequestComposable", "requestComposer", "=", "ClientRequestComposerProvider", ".", "getInstance", "(", ")", ".", "getComposer", "(", "ClientRequestComposerProvider", ".", "ClientRequestComposers", ".", "CLIENT_CREDENTIAL_REQUEST_COMPOSER", ")", ";", "connection", ".", "getIoThread", "(", ")", ".", "execute", "(", "new", "TokenRequestAction", "(", "tokenRequest", ",", "requestComposer", ",", "connection", ",", "reference", ",", "latch", ")", ")", ";", "latch", ".", "await", "(", "4", ",", "TimeUnit", ".", "SECONDS", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "logger", ".", "error", "(", "\"IOException: \"", ",", "e", ")", ";", "return", "Failure", ".", "of", "(", "new", "Status", "(", "FAIL_TO_SEND_REQUEST", ")", ")", ";", "}", "finally", "{", "IoUtils", ".", "safeClose", "(", "connection", ")", ";", "}", "//if reference.get() is null at this point, mostly likely couldn't get token within latch.await() timeout.", "return", "reference", ".", "get", "(", ")", "==", "null", "?", "Failure", ".", "of", "(", "new", "Status", "(", "GET_TOKEN_TIMEOUT", ")", ")", ":", "reference", ".", "get", "(", ")", ";", "}" ]
Get an access token from the token service. A Result of TokenResponse will be returned if the invocation is successfully. Otherwise, a Result of Status will be returned. @param tokenRequest token request constructed from the client.yml token section. @param envTag the environment tag from the server.yml for service lookup. @return Result of TokenResponse or error Status.
[ "Get", "an", "access", "token", "from", "the", "token", "service", ".", "A", "Result", "of", "TokenResponse", "will", "be", "returned", "if", "the", "invocation", "is", "successfully", ".", "Otherwise", "a", "Result", "of", "Status", "will", "be", "returned", "." ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/client/src/main/java/com/networknt/client/oauth/OauthHelper.java#L105-L142
matthewhorridge/binaryowl
src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java
BinaryOWLMetadata.setByteArrayAttribute
public void setByteArrayAttribute(String name, byte [] value) { """ Sets the byte [] value for the specified attribute name. This parameter will be copied so that modifications to the passed in parameter are not reflected in the storage of the parameter in this metadata object. @param name The name of the attribute. Not null. @param value The value of the attribute to set. @throws NullPointerException if the name parameter is null or if the value parameter is null. """ byte [] copy = new byte[value.length]; System.arraycopy(value, 0, copy, 0, value.length); setValue(byteArrayAttributes, name, ByteBuffer.wrap(copy)); }
java
public void setByteArrayAttribute(String name, byte [] value) { byte [] copy = new byte[value.length]; System.arraycopy(value, 0, copy, 0, value.length); setValue(byteArrayAttributes, name, ByteBuffer.wrap(copy)); }
[ "public", "void", "setByteArrayAttribute", "(", "String", "name", ",", "byte", "[", "]", "value", ")", "{", "byte", "[", "]", "copy", "=", "new", "byte", "[", "value", ".", "length", "]", ";", "System", ".", "arraycopy", "(", "value", ",", "0", ",", "copy", ",", "0", ",", "value", ".", "length", ")", ";", "setValue", "(", "byteArrayAttributes", ",", "name", ",", "ByteBuffer", ".", "wrap", "(", "copy", ")", ")", ";", "}" ]
Sets the byte [] value for the specified attribute name. This parameter will be copied so that modifications to the passed in parameter are not reflected in the storage of the parameter in this metadata object. @param name The name of the attribute. Not null. @param value The value of the attribute to set. @throws NullPointerException if the name parameter is null or if the value parameter is null.
[ "Sets", "the", "byte", "[]", "value", "for", "the", "specified", "attribute", "name", ".", "This", "parameter", "will", "be", "copied", "so", "that", "modifications", "to", "the", "passed", "in", "parameter", "are", "not", "reflected", "in", "the", "storage", "of", "the", "parameter", "in", "this", "metadata", "object", "." ]
train
https://github.com/matthewhorridge/binaryowl/blob/7fccfe804120f86b38ca855ddbb569a81a042257/src/main/java/org/semanticweb/binaryowl/BinaryOWLMetadata.java#L412-L416
Azure/azure-sdk-for-java
containerinstance/resource-manager/v2017_12_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2017_12_01_preview/implementation/ContainerLogsInner.java
ContainerLogsInner.listAsync
public Observable<LogsInner> listAsync(String resourceGroupName, String containerGroupName, String containerName, Integer tail) { """ Get the logs for a specified container instance. Get the logs for a specified container instance in a specified resource group and container group. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerName The name of the container instance. @param tail The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LogsInner object """ return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, tail).map(new Func1<ServiceResponse<LogsInner>, LogsInner>() { @Override public LogsInner call(ServiceResponse<LogsInner> response) { return response.body(); } }); }
java
public Observable<LogsInner> listAsync(String resourceGroupName, String containerGroupName, String containerName, Integer tail) { return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, tail).map(new Func1<ServiceResponse<LogsInner>, LogsInner>() { @Override public LogsInner call(ServiceResponse<LogsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LogsInner", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "containerGroupName", ",", "String", "containerName", ",", "Integer", "tail", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "containerGroupName", ",", "containerName", ",", "tail", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "LogsInner", ">", ",", "LogsInner", ">", "(", ")", "{", "@", "Override", "public", "LogsInner", "call", "(", "ServiceResponse", "<", "LogsInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Get the logs for a specified container instance. Get the logs for a specified container instance in a specified resource group and container group. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerName The name of the container instance. @param tail The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LogsInner object
[ "Get", "the", "logs", "for", "a", "specified", "container", "instance", ".", "Get", "the", "logs", "for", "a", "specified", "container", "instance", "in", "a", "specified", "resource", "group", "and", "container", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2017_12_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2017_12_01_preview/implementation/ContainerLogsInner.java#L195-L202
wildfly/wildfly-core
protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java
FutureManagementChannel.setChannel
protected boolean setChannel(final Channel newChannel) { """ Set the channel. This will return whether the channel could be set successfully or not. @param newChannel the channel @return whether the operation succeeded or not """ if(newChannel == null) { return false; } synchronized (lock) { if(state != State.OPEN || channel != null) { return false; } this.channel = newChannel; this.channel.addCloseHandler(new CloseHandler<Channel>() { @Override public void handleClose(final Channel closed, final IOException exception) { synchronized (lock) { if(FutureManagementChannel.this.channel == closed) { FutureManagementChannel.this.channel = null; } lock.notifyAll(); } } }); lock.notifyAll(); return true; } }
java
protected boolean setChannel(final Channel newChannel) { if(newChannel == null) { return false; } synchronized (lock) { if(state != State.OPEN || channel != null) { return false; } this.channel = newChannel; this.channel.addCloseHandler(new CloseHandler<Channel>() { @Override public void handleClose(final Channel closed, final IOException exception) { synchronized (lock) { if(FutureManagementChannel.this.channel == closed) { FutureManagementChannel.this.channel = null; } lock.notifyAll(); } } }); lock.notifyAll(); return true; } }
[ "protected", "boolean", "setChannel", "(", "final", "Channel", "newChannel", ")", "{", "if", "(", "newChannel", "==", "null", ")", "{", "return", "false", ";", "}", "synchronized", "(", "lock", ")", "{", "if", "(", "state", "!=", "State", ".", "OPEN", "||", "channel", "!=", "null", ")", "{", "return", "false", ";", "}", "this", ".", "channel", "=", "newChannel", ";", "this", ".", "channel", ".", "addCloseHandler", "(", "new", "CloseHandler", "<", "Channel", ">", "(", ")", "{", "@", "Override", "public", "void", "handleClose", "(", "final", "Channel", "closed", ",", "final", "IOException", "exception", ")", "{", "synchronized", "(", "lock", ")", "{", "if", "(", "FutureManagementChannel", ".", "this", ".", "channel", "==", "closed", ")", "{", "FutureManagementChannel", ".", "this", ".", "channel", "=", "null", ";", "}", "lock", ".", "notifyAll", "(", ")", ";", "}", "}", "}", ")", ";", "lock", ".", "notifyAll", "(", ")", ";", "return", "true", ";", "}", "}" ]
Set the channel. This will return whether the channel could be set successfully or not. @param newChannel the channel @return whether the operation succeeded or not
[ "Set", "the", "channel", ".", "This", "will", "return", "whether", "the", "channel", "could", "be", "set", "successfully", "or", "not", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/protocol/src/main/java/org/jboss/as/protocol/mgmt/FutureManagementChannel.java#L186-L209
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java
JobOperations.listJobs
public PagedList<CloudJob> listJobs(DetailLevel detailLevel) throws BatchErrorException, IOException { """ Lists the {@link CloudJob jobs} in the Batch account. @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. @return A list of {@link CloudJob} objects. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ return listJobs(detailLevel, null); }
java
public PagedList<CloudJob> listJobs(DetailLevel detailLevel) throws BatchErrorException, IOException { return listJobs(detailLevel, null); }
[ "public", "PagedList", "<", "CloudJob", ">", "listJobs", "(", "DetailLevel", "detailLevel", ")", "throws", "BatchErrorException", ",", "IOException", "{", "return", "listJobs", "(", "detailLevel", ",", "null", ")", ";", "}" ]
Lists the {@link CloudJob jobs} in the Batch account. @param detailLevel A {@link DetailLevel} used for filtering the list and for controlling which properties are retrieved from the service. @return A list of {@link CloudJob} objects. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Lists", "the", "{", "@link", "CloudJob", "jobs", "}", "in", "the", "Batch", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L170-L172
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java
FhirContext.getResourceDefinition
public RuntimeResourceDefinition getResourceDefinition(String theResourceName) throws DataFormatException { """ Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed for extending the core library. <p> Note that this method is case insensitive! </p> @throws DataFormatException If the resource name is not known """ validateInitialized(); Validate.notBlank(theResourceName, "theResourceName must not be blank"); String resourceName = theResourceName.toLowerCase(); RuntimeResourceDefinition retVal = myNameToResourceDefinition.get(resourceName); if (retVal == null) { Class<? extends IBaseResource> clazz = myNameToResourceType.get(resourceName.toLowerCase()); if (clazz == null) { // *********************************************************************** // Multiple spots in HAPI FHIR and Smile CDR depend on DataFormatException // being thrown by this method, don't change that. // *********************************************************************** throw new DataFormatException(createUnknownResourceNameError(theResourceName, myVersion.getVersion())); } if (IBaseResource.class.isAssignableFrom(clazz)) { retVal = scanResourceType(clazz); } } return retVal; }
java
public RuntimeResourceDefinition getResourceDefinition(String theResourceName) throws DataFormatException { validateInitialized(); Validate.notBlank(theResourceName, "theResourceName must not be blank"); String resourceName = theResourceName.toLowerCase(); RuntimeResourceDefinition retVal = myNameToResourceDefinition.get(resourceName); if (retVal == null) { Class<? extends IBaseResource> clazz = myNameToResourceType.get(resourceName.toLowerCase()); if (clazz == null) { // *********************************************************************** // Multiple spots in HAPI FHIR and Smile CDR depend on DataFormatException // being thrown by this method, don't change that. // *********************************************************************** throw new DataFormatException(createUnknownResourceNameError(theResourceName, myVersion.getVersion())); } if (IBaseResource.class.isAssignableFrom(clazz)) { retVal = scanResourceType(clazz); } } return retVal; }
[ "public", "RuntimeResourceDefinition", "getResourceDefinition", "(", "String", "theResourceName", ")", "throws", "DataFormatException", "{", "validateInitialized", "(", ")", ";", "Validate", ".", "notBlank", "(", "theResourceName", ",", "\"theResourceName must not be blank\"", ")", ";", "String", "resourceName", "=", "theResourceName", ".", "toLowerCase", "(", ")", ";", "RuntimeResourceDefinition", "retVal", "=", "myNameToResourceDefinition", ".", "get", "(", "resourceName", ")", ";", "if", "(", "retVal", "==", "null", ")", "{", "Class", "<", "?", "extends", "IBaseResource", ">", "clazz", "=", "myNameToResourceType", ".", "get", "(", "resourceName", ".", "toLowerCase", "(", ")", ")", ";", "if", "(", "clazz", "==", "null", ")", "{", "// ***********************************************************************", "// Multiple spots in HAPI FHIR and Smile CDR depend on DataFormatException", "// being thrown by this method, don't change that.", "// ***********************************************************************", "throw", "new", "DataFormatException", "(", "createUnknownResourceNameError", "(", "theResourceName", ",", "myVersion", ".", "getVersion", "(", ")", ")", ")", ";", "}", "if", "(", "IBaseResource", ".", "class", ".", "isAssignableFrom", "(", "clazz", ")", ")", "{", "retVal", "=", "scanResourceType", "(", "clazz", ")", ";", "}", "}", "return", "retVal", ";", "}" ]
Returns the scanned runtime model for the given type. This is an advanced feature which is generally only needed for extending the core library. <p> Note that this method is case insensitive! </p> @throws DataFormatException If the resource name is not known
[ "Returns", "the", "scanned", "runtime", "model", "for", "the", "given", "type", ".", "This", "is", "an", "advanced", "feature", "which", "is", "generally", "only", "needed", "for", "extending", "the", "core", "library", ".", "<p", ">", "Note", "that", "this", "method", "is", "case", "insensitive!", "<", "/", "p", ">" ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/context/FhirContext.java#L445-L467
burberius/eve-esi
src/main/java/net/troja/eve/esi/api/FleetsApi.java
FleetsApi.deleteFleetsFleetIdMembersMemberId
public void deleteFleetsFleetIdMembersMemberId(Long fleetId, Integer memberId, String datasource, String token) throws ApiException { """ Kick fleet member Kick a fleet member --- SSO Scope: esi-fleets.write_fleet.v1 @param fleetId ID for a fleet (required) @param memberId The character ID of a member in this fleet (required) @param datasource The server name you would like data from (optional, default to tranquility) @param token Access token to use if unable to set a header (optional) @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ deleteFleetsFleetIdMembersMemberIdWithHttpInfo(fleetId, memberId, datasource, token); }
java
public void deleteFleetsFleetIdMembersMemberId(Long fleetId, Integer memberId, String datasource, String token) throws ApiException { deleteFleetsFleetIdMembersMemberIdWithHttpInfo(fleetId, memberId, datasource, token); }
[ "public", "void", "deleteFleetsFleetIdMembersMemberId", "(", "Long", "fleetId", ",", "Integer", "memberId", ",", "String", "datasource", ",", "String", "token", ")", "throws", "ApiException", "{", "deleteFleetsFleetIdMembersMemberIdWithHttpInfo", "(", "fleetId", ",", "memberId", ",", "datasource", ",", "token", ")", ";", "}" ]
Kick fleet member Kick a fleet member --- SSO Scope: esi-fleets.write_fleet.v1 @param fleetId ID for a fleet (required) @param memberId The character ID of a member in this fleet (required) @param datasource The server name you would like data from (optional, default to tranquility) @param token Access token to use if unable to set a header (optional) @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Kick", "fleet", "member", "Kick", "a", "fleet", "member", "---", "SSO", "Scope", ":", "esi", "-", "fleets", ".", "write_fleet", ".", "v1" ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/FleetsApi.java#L161-L164
alkacon/opencms-core
src/org/opencms/util/CmsStringUtil.java
CmsStringUtil.getLongValue
public static long getLongValue(String value, long defaultValue, String key) { """ Returns the Long (long) value for the given String value.<p> All parse errors are caught and the given default value is returned in this case.<p> @param value the value to parse as long @param defaultValue the default value in case of parsing errors @param key a key to be included in the debug output in case of parse errors @return the long value for the given parameter value String """ long result; try { result = Long.valueOf(value).longValue(); } catch (Exception e) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.ERR_UNABLE_TO_PARSE_INT_2, value, key)); } result = defaultValue; } return result; }
java
public static long getLongValue(String value, long defaultValue, String key) { long result; try { result = Long.valueOf(value).longValue(); } catch (Exception e) { if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.ERR_UNABLE_TO_PARSE_INT_2, value, key)); } result = defaultValue; } return result; }
[ "public", "static", "long", "getLongValue", "(", "String", "value", ",", "long", "defaultValue", ",", "String", "key", ")", "{", "long", "result", ";", "try", "{", "result", "=", "Long", ".", "valueOf", "(", "value", ")", ".", "longValue", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "Messages", ".", "get", "(", ")", ".", "getBundle", "(", ")", ".", "key", "(", "Messages", ".", "ERR_UNABLE_TO_PARSE_INT_2", ",", "value", ",", "key", ")", ")", ";", "}", "result", "=", "defaultValue", ";", "}", "return", "result", ";", "}" ]
Returns the Long (long) value for the given String value.<p> All parse errors are caught and the given default value is returned in this case.<p> @param value the value to parse as long @param defaultValue the default value in case of parsing errors @param key a key to be included in the debug output in case of parse errors @return the long value for the given parameter value String
[ "Returns", "the", "Long", "(", "long", ")", "value", "for", "the", "given", "String", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsStringUtil.java#L942-L954
milaboratory/milib
src/main/java/com/milaboratory/core/Range.java
Range.intersectionWithTouch
public Range intersectionWithTouch(Range other) { """ Returns intersection range with {@code other} range. @param other other range @return intersection range with {@code other} range or null if ranges not intersects """ if (!intersectsWithOrTouches(other)) return null; return new Range(Math.max(lower, other.lower), Math.min(upper, other.upper), reversed && other.reversed); }
java
public Range intersectionWithTouch(Range other) { if (!intersectsWithOrTouches(other)) return null; return new Range(Math.max(lower, other.lower), Math.min(upper, other.upper), reversed && other.reversed); }
[ "public", "Range", "intersectionWithTouch", "(", "Range", "other", ")", "{", "if", "(", "!", "intersectsWithOrTouches", "(", "other", ")", ")", "return", "null", ";", "return", "new", "Range", "(", "Math", ".", "max", "(", "lower", ",", "other", ".", "lower", ")", ",", "Math", ".", "min", "(", "upper", ",", "other", ".", "upper", ")", ",", "reversed", "&&", "other", ".", "reversed", ")", ";", "}" ]
Returns intersection range with {@code other} range. @param other other range @return intersection range with {@code other} range or null if ranges not intersects
[ "Returns", "intersection", "range", "with", "{", "@code", "other", "}", "range", "." ]
train
https://github.com/milaboratory/milib/blob/2349b3dccdd3c7948643760e570238d6e30d5a34/src/main/java/com/milaboratory/core/Range.java#L246-L251
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/GridTable.java
GridTable.addNewBookmark
public int addNewBookmark(Object bookmark, int iHandleType) { """ Here is a bookmark for a brand new record, add it to the end of the list. @param bookmark The bookmark (usually a DataRecord) of the record to add. @param iHandleType The type of bookmark to add. @return the index of the new entry. """ if (bookmark == null) return -1; if (iHandleType != DBConstants.DATA_SOURCE_HANDLE) { // The only thing that I know for sure is the bookmark is correct. DataRecord dataRecord = new DataRecord(null); dataRecord.setHandle(bookmark, iHandleType); bookmark = dataRecord; } int iIndexAdded = m_iEndOfFileIndex; if (m_iEndOfFileIndex == -1) { // End of file has not been reached - add this record to the "Add" buffer. // Add code here } else { // Update the record cached at this location m_gridBuffer.addElement(m_iEndOfFileIndex, bookmark, m_gridList); m_iEndOfFileIndex++; } return iIndexAdded; }
java
public int addNewBookmark(Object bookmark, int iHandleType) { if (bookmark == null) return -1; if (iHandleType != DBConstants.DATA_SOURCE_HANDLE) { // The only thing that I know for sure is the bookmark is correct. DataRecord dataRecord = new DataRecord(null); dataRecord.setHandle(bookmark, iHandleType); bookmark = dataRecord; } int iIndexAdded = m_iEndOfFileIndex; if (m_iEndOfFileIndex == -1) { // End of file has not been reached - add this record to the "Add" buffer. // Add code here } else { // Update the record cached at this location m_gridBuffer.addElement(m_iEndOfFileIndex, bookmark, m_gridList); m_iEndOfFileIndex++; } return iIndexAdded; }
[ "public", "int", "addNewBookmark", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "{", "if", "(", "bookmark", "==", "null", ")", "return", "-", "1", ";", "if", "(", "iHandleType", "!=", "DBConstants", ".", "DATA_SOURCE_HANDLE", ")", "{", "// The only thing that I know for sure is the bookmark is correct.", "DataRecord", "dataRecord", "=", "new", "DataRecord", "(", "null", ")", ";", "dataRecord", ".", "setHandle", "(", "bookmark", ",", "iHandleType", ")", ";", "bookmark", "=", "dataRecord", ";", "}", "int", "iIndexAdded", "=", "m_iEndOfFileIndex", ";", "if", "(", "m_iEndOfFileIndex", "==", "-", "1", ")", "{", "// End of file has not been reached - add this record to the \"Add\" buffer.", "// Add code here", "}", "else", "{", "// Update the record cached at this location", "m_gridBuffer", ".", "addElement", "(", "m_iEndOfFileIndex", ",", "bookmark", ",", "m_gridList", ")", ";", "m_iEndOfFileIndex", "++", ";", "}", "return", "iIndexAdded", ";", "}" ]
Here is a bookmark for a brand new record, add it to the end of the list. @param bookmark The bookmark (usually a DataRecord) of the record to add. @param iHandleType The type of bookmark to add. @return the index of the new entry.
[ "Here", "is", "a", "bookmark", "for", "a", "brand", "new", "record", "add", "it", "to", "the", "end", "of", "the", "list", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/GridTable.java#L665-L688
psamsotha/jersey-properties
src/main/java/com/github/psamsotha/jersey/properties/JerseyPropertiesFeature.java
JerseyPropertiesFeature.addUserProvidersToMap
private void addUserProvidersToMap(Map<String, String> propertiesMap) { """ Add user defined {@code PropertiesProvider} to global properties. @param propertiesMap the global properties map. """ if (userDefinedProviders.length != 0) { for (PropertiesProvider provider : userDefinedProviders) { propertiesMap.putAll(provider.getProperties()); } } }
java
private void addUserProvidersToMap(Map<String, String> propertiesMap) { if (userDefinedProviders.length != 0) { for (PropertiesProvider provider : userDefinedProviders) { propertiesMap.putAll(provider.getProperties()); } } }
[ "private", "void", "addUserProvidersToMap", "(", "Map", "<", "String", ",", "String", ">", "propertiesMap", ")", "{", "if", "(", "userDefinedProviders", ".", "length", "!=", "0", ")", "{", "for", "(", "PropertiesProvider", "provider", ":", "userDefinedProviders", ")", "{", "propertiesMap", ".", "putAll", "(", "provider", ".", "getProperties", "(", ")", ")", ";", "}", "}", "}" ]
Add user defined {@code PropertiesProvider} to global properties. @param propertiesMap the global properties map.
[ "Add", "user", "defined", "{", "@code", "PropertiesProvider", "}", "to", "global", "properties", "." ]
train
https://github.com/psamsotha/jersey-properties/blob/97ea8c5d31189c64688ca60bf3995239fce8830b/src/main/java/com/github/psamsotha/jersey/properties/JerseyPropertiesFeature.java#L125-L131
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java
ApplicationActivityEvent.addApplicationStarterParticipant
public void addApplicationStarterParticipant(String userId, String altUserId, String userName, String networkId) { """ Add an Application Starter Active Participant to this message @param userId The Active Participant's User ID @param altUserId The Active Participant's Alternate UserID @param userName The Active Participant's UserName @param networkId The Active Participant's Network Access Point ID """ addActiveParticipant( userId, altUserId, userName, true, Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.ApplicationLauncher()), networkId); }
java
public void addApplicationStarterParticipant(String userId, String altUserId, String userName, String networkId) { addActiveParticipant( userId, altUserId, userName, true, Collections.singletonList(new DICOMActiveParticipantRoleIdCodes.ApplicationLauncher()), networkId); }
[ "public", "void", "addApplicationStarterParticipant", "(", "String", "userId", ",", "String", "altUserId", ",", "String", "userName", ",", "String", "networkId", ")", "{", "addActiveParticipant", "(", "userId", ",", "altUserId", ",", "userName", ",", "true", ",", "Collections", ".", "singletonList", "(", "new", "DICOMActiveParticipantRoleIdCodes", ".", "ApplicationLauncher", "(", ")", ")", ",", "networkId", ")", ";", "}" ]
Add an Application Starter Active Participant to this message @param userId The Active Participant's User ID @param altUserId The Active Participant's Alternate UserID @param userName The Active Participant's UserName @param networkId The Active Participant's Network Access Point ID
[ "Add", "an", "Application", "Starter", "Active", "Participant", "to", "this", "message" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/dicom/ApplicationActivityEvent.java#L73-L82
vakinge/jeesuite-libs
jeesuite-mybatis/src/main/java/com/jeesuite/mybatis/plugin/cache/EntityCacheHelper.java
EntityCacheHelper.queryTryCache
public static <T> T queryTryCache(Class<? extends BaseEntity> entityClass,String key,Callable<T> dataCaller) { """ 查询并缓存结果(默认缓存一天) @param entityClass 实体类class (用户组装实际的缓存key) @param key 缓存的key(和entityClass一起组成真实的缓存key。<br>如entityClass=UserEntity.class,key=findlist,实际的key为:UserEntity.findlist) @param dataCaller 缓存不存在数据加载源 @return """ return queryTryCache(entityClass, key, CacheHandler.defaultCacheExpire, dataCaller); }
java
public static <T> T queryTryCache(Class<? extends BaseEntity> entityClass,String key,Callable<T> dataCaller){ return queryTryCache(entityClass, key, CacheHandler.defaultCacheExpire, dataCaller); }
[ "public", "static", "<", "T", ">", "T", "queryTryCache", "(", "Class", "<", "?", "extends", "BaseEntity", ">", "entityClass", ",", "String", "key", ",", "Callable", "<", "T", ">", "dataCaller", ")", "{", "return", "queryTryCache", "(", "entityClass", ",", "key", ",", "CacheHandler", ".", "defaultCacheExpire", ",", "dataCaller", ")", ";", "}" ]
查询并缓存结果(默认缓存一天) @param entityClass 实体类class (用户组装实际的缓存key) @param key 缓存的key(和entityClass一起组成真实的缓存key。<br>如entityClass=UserEntity.class,key=findlist,实际的key为:UserEntity.findlist) @param dataCaller 缓存不存在数据加载源 @return
[ "查询并缓存结果", "(", "默认缓存一天", ")" ]
train
https://github.com/vakinge/jeesuite-libs/blob/c48fe2c7fbd294892cf4030dbec96e744dd3e386/jeesuite-mybatis/src/main/java/com/jeesuite/mybatis/plugin/cache/EntityCacheHelper.java#L33-L35
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java
RenameFileExtensions.moveFile
public static boolean moveFile(final File srcFile, final File destDir) throws IOException, FileIsADirectoryException { """ Moves the given source file to the destination Directory. @param srcFile The source file. @param destDir The destination directory. @return true if the file was moved otherwise false. @throws IOException Signals that an I/O exception has occurred. @throws FileIsADirectoryException the file is A directory exception """ return RenameFileExtensions.renameFile(srcFile, destDir, true); }
java
public static boolean moveFile(final File srcFile, final File destDir) throws IOException, FileIsADirectoryException { return RenameFileExtensions.renameFile(srcFile, destDir, true); }
[ "public", "static", "boolean", "moveFile", "(", "final", "File", "srcFile", ",", "final", "File", "destDir", ")", "throws", "IOException", ",", "FileIsADirectoryException", "{", "return", "RenameFileExtensions", ".", "renameFile", "(", "srcFile", ",", "destDir", ",", "true", ")", ";", "}" ]
Moves the given source file to the destination Directory. @param srcFile The source file. @param destDir The destination directory. @return true if the file was moved otherwise false. @throws IOException Signals that an I/O exception has occurred. @throws FileIsADirectoryException the file is A directory exception
[ "Moves", "the", "given", "source", "file", "to", "the", "destination", "Directory", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/rename/RenameFileExtensions.java#L266-L270
alkacon/opencms-core
src/org/opencms/ade/detailpage/CmsDetailPageUtil.java
CmsDetailPageUtil.lookupPage
public static CmsResource lookupPage(CmsObject cms, String uri) throws CmsException { """ Looks up a page by URI (which may be a detail page URI, or a normal VFS uri).<p> @param cms the current CMS context @param uri the detail page or VFS uri @return the resource with the given uri @throws CmsException if something goes wrong """ try { CmsResource res = cms.readResource(uri); return res; } catch (CmsVfsResourceNotFoundException e) { String detailName = CmsResource.getName(uri).replaceAll("/$", ""); CmsUUID detailId = cms.readIdForUrlName(detailName); if (detailId != null) { return cms.readResource(detailId); } throw new CmsVfsResourceNotFoundException( org.opencms.db.generic.Messages.get().container( org.opencms.db.generic.Messages.ERR_READ_RESOURCE_1, uri)); } }
java
public static CmsResource lookupPage(CmsObject cms, String uri) throws CmsException { try { CmsResource res = cms.readResource(uri); return res; } catch (CmsVfsResourceNotFoundException e) { String detailName = CmsResource.getName(uri).replaceAll("/$", ""); CmsUUID detailId = cms.readIdForUrlName(detailName); if (detailId != null) { return cms.readResource(detailId); } throw new CmsVfsResourceNotFoundException( org.opencms.db.generic.Messages.get().container( org.opencms.db.generic.Messages.ERR_READ_RESOURCE_1, uri)); } }
[ "public", "static", "CmsResource", "lookupPage", "(", "CmsObject", "cms", ",", "String", "uri", ")", "throws", "CmsException", "{", "try", "{", "CmsResource", "res", "=", "cms", ".", "readResource", "(", "uri", ")", ";", "return", "res", ";", "}", "catch", "(", "CmsVfsResourceNotFoundException", "e", ")", "{", "String", "detailName", "=", "CmsResource", ".", "getName", "(", "uri", ")", ".", "replaceAll", "(", "\"/$\"", ",", "\"\"", ")", ";", "CmsUUID", "detailId", "=", "cms", ".", "readIdForUrlName", "(", "detailName", ")", ";", "if", "(", "detailId", "!=", "null", ")", "{", "return", "cms", ".", "readResource", "(", "detailId", ")", ";", "}", "throw", "new", "CmsVfsResourceNotFoundException", "(", "org", ".", "opencms", ".", "db", ".", "generic", ".", "Messages", ".", "get", "(", ")", ".", "container", "(", "org", ".", "opencms", ".", "db", ".", "generic", ".", "Messages", ".", "ERR_READ_RESOURCE_1", ",", "uri", ")", ")", ";", "}", "}" ]
Looks up a page by URI (which may be a detail page URI, or a normal VFS uri).<p> @param cms the current CMS context @param uri the detail page or VFS uri @return the resource with the given uri @throws CmsException if something goes wrong
[ "Looks", "up", "a", "page", "by", "URI", "(", "which", "may", "be", "a", "detail", "page", "URI", "or", "a", "normal", "VFS", "uri", ")", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/detailpage/CmsDetailPageUtil.java#L123-L139
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java
JMapperCache.getMapper
public static <D,S> IJMapper<D, S> getMapper(final Class<D> destination,final Class<S> source,final ChooseConfig chooseConfig) { """ Returns an instance of JMapper from cache if exists, in alternative a new instance. <br>The configuration evaluated is the one received in input. @param destination the Destination Class @param source the Source Class @param chooseConfig the configuration to load @param <D> Destination class @param <S> Source Class @return the mapper instance """ return getMapper(destination,source,chooseConfig,undefinedXML()); }
java
public static <D,S> IJMapper<D, S> getMapper(final Class<D> destination,final Class<S> source,final ChooseConfig chooseConfig) { return getMapper(destination,source,chooseConfig,undefinedXML()); }
[ "public", "static", "<", "D", ",", "S", ">", "IJMapper", "<", "D", ",", "S", ">", "getMapper", "(", "final", "Class", "<", "D", ">", "destination", ",", "final", "Class", "<", "S", ">", "source", ",", "final", "ChooseConfig", "chooseConfig", ")", "{", "return", "getMapper", "(", "destination", ",", "source", ",", "chooseConfig", ",", "undefinedXML", "(", ")", ")", ";", "}" ]
Returns an instance of JMapper from cache if exists, in alternative a new instance. <br>The configuration evaluated is the one received in input. @param destination the Destination Class @param source the Source Class @param chooseConfig the configuration to load @param <D> Destination class @param <S> Source Class @return the mapper instance
[ "Returns", "an", "instance", "of", "JMapper", "from", "cache", "if", "exists", "in", "alternative", "a", "new", "instance", ".", "<br", ">", "The", "configuration", "evaluated", "is", "the", "one", "received", "in", "input", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/cache/JMapperCache.java#L73-L75
ujmp/universal-java-matrix-package
ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java
Ginv.swapPivot
public static void swapPivot(Matrix source, long diag, Matrix s, Matrix t) { """ Swap the matrices so that the largest value is on the pivot @param source the matrix to modify @param diag the position on the diagonal @param s the matrix s @param t the matrix t """ // get swap row and col long swapRow = diag; long swapCol = diag; double maxValue = Math.abs(source.getAsDouble(diag, diag)); long rows = source.getRowCount(); long cols = source.getColumnCount(); double abs = 0; for (long row = diag; row < rows; row++) { for (long col = diag; col < cols; col++) { abs = Math.abs(source.getAsDouble(row, col)); if (abs > maxValue) { maxValue = abs; swapRow = row; swapCol = col; } } } // swap rows and columns if (swapRow != diag) { swapRows(source, swapRow, diag); swapRows(t, swapRow, diag); } if (swapCol != diag) { swapCols(source, swapCol, diag); swapCols(s, swapCol, diag); } }
java
public static void swapPivot(Matrix source, long diag, Matrix s, Matrix t) { // get swap row and col long swapRow = diag; long swapCol = diag; double maxValue = Math.abs(source.getAsDouble(diag, diag)); long rows = source.getRowCount(); long cols = source.getColumnCount(); double abs = 0; for (long row = diag; row < rows; row++) { for (long col = diag; col < cols; col++) { abs = Math.abs(source.getAsDouble(row, col)); if (abs > maxValue) { maxValue = abs; swapRow = row; swapCol = col; } } } // swap rows and columns if (swapRow != diag) { swapRows(source, swapRow, diag); swapRows(t, swapRow, diag); } if (swapCol != diag) { swapCols(source, swapCol, diag); swapCols(s, swapCol, diag); } }
[ "public", "static", "void", "swapPivot", "(", "Matrix", "source", ",", "long", "diag", ",", "Matrix", "s", ",", "Matrix", "t", ")", "{", "// get swap row and col", "long", "swapRow", "=", "diag", ";", "long", "swapCol", "=", "diag", ";", "double", "maxValue", "=", "Math", ".", "abs", "(", "source", ".", "getAsDouble", "(", "diag", ",", "diag", ")", ")", ";", "long", "rows", "=", "source", ".", "getRowCount", "(", ")", ";", "long", "cols", "=", "source", ".", "getColumnCount", "(", ")", ";", "double", "abs", "=", "0", ";", "for", "(", "long", "row", "=", "diag", ";", "row", "<", "rows", ";", "row", "++", ")", "{", "for", "(", "long", "col", "=", "diag", ";", "col", "<", "cols", ";", "col", "++", ")", "{", "abs", "=", "Math", ".", "abs", "(", "source", ".", "getAsDouble", "(", "row", ",", "col", ")", ")", ";", "if", "(", "abs", ">", "maxValue", ")", "{", "maxValue", "=", "abs", ";", "swapRow", "=", "row", ";", "swapCol", "=", "col", ";", "}", "}", "}", "// swap rows and columns", "if", "(", "swapRow", "!=", "diag", ")", "{", "swapRows", "(", "source", ",", "swapRow", ",", "diag", ")", ";", "swapRows", "(", "t", ",", "swapRow", ",", "diag", ")", ";", "}", "if", "(", "swapCol", "!=", "diag", ")", "{", "swapCols", "(", "source", ",", "swapCol", ",", "diag", ")", ";", "swapCols", "(", "s", ",", "swapCol", ",", "diag", ")", ";", "}", "}" ]
Swap the matrices so that the largest value is on the pivot @param source the matrix to modify @param diag the position on the diagonal @param s the matrix s @param t the matrix t
[ "Swap", "the", "matrices", "so", "that", "the", "largest", "value", "is", "on", "the", "pivot" ]
train
https://github.com/ujmp/universal-java-matrix-package/blob/b7e1d293adeadaf35d208ffe8884028d6c06b63b/ujmp-core/src/main/java/org/ujmp/core/doublematrix/calculation/general/decomposition/Ginv.java#L732-L761
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java
ManagedBackupShortTermRetentionPoliciesInner.createOrUpdate
public ManagedBackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { """ Updates a managed database's short term retention policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. @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 ManagedBackupShortTermRetentionPolicyInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().last().body(); }
java
public ManagedBackupShortTermRetentionPolicyInner createOrUpdate(String resourceGroupName, String managedInstanceName, String databaseName, Integer retentionDays) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, managedInstanceName, databaseName, retentionDays).toBlocking().last().body(); }
[ "public", "ManagedBackupShortTermRetentionPolicyInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "managedInstanceName", ",", "String", "databaseName", ",", "Integer", "retentionDays", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "managedInstanceName", ",", "databaseName", ",", "retentionDays", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Updates a managed database's short term retention policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param managedInstanceName The name of the managed instance. @param databaseName The name of the database. @param retentionDays The backup retention period in days. This is how many days Point-in-Time Restore will be supported. @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 ManagedBackupShortTermRetentionPolicyInner object if successful.
[ "Updates", "a", "managed", "database", "s", "short", "term", "retention", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ManagedBackupShortTermRetentionPoliciesInner.java#L278-L280
burberius/eve-esi
src/main/java/net/troja/eve/esi/api/FactionWarfareApi.java
FactionWarfareApi.getFwLeaderboards
public FactionWarfareLeaderboardResponse getFwLeaderboards(String datasource, String ifNoneMatch) throws ApiException { """ List of the top factions in faction warfare Top 4 leaderboard of factions for kills and victory points separated by total, last week and yesterday --- This route expires daily at 11:05 @param datasource The server name you would like data from (optional, default to tranquility) @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional) @return FactionWarfareLeaderboardResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<FactionWarfareLeaderboardResponse> resp = getFwLeaderboardsWithHttpInfo(datasource, ifNoneMatch); return resp.getData(); }
java
public FactionWarfareLeaderboardResponse getFwLeaderboards(String datasource, String ifNoneMatch) throws ApiException { ApiResponse<FactionWarfareLeaderboardResponse> resp = getFwLeaderboardsWithHttpInfo(datasource, ifNoneMatch); return resp.getData(); }
[ "public", "FactionWarfareLeaderboardResponse", "getFwLeaderboards", "(", "String", "datasource", ",", "String", "ifNoneMatch", ")", "throws", "ApiException", "{", "ApiResponse", "<", "FactionWarfareLeaderboardResponse", ">", "resp", "=", "getFwLeaderboardsWithHttpInfo", "(", "datasource", ",", "ifNoneMatch", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
List of the top factions in faction warfare Top 4 leaderboard of factions for kills and victory points separated by total, last week and yesterday --- This route expires daily at 11:05 @param datasource The server name you would like data from (optional, default to tranquility) @param ifNoneMatch ETag from a previous request. A 304 will be returned if this matches the current ETag (optional) @return FactionWarfareLeaderboardResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "List", "of", "the", "top", "factions", "in", "faction", "warfare", "Top", "4", "leaderboard", "of", "factions", "for", "kills", "and", "victory", "points", "separated", "by", "total", "last", "week", "and", "yesterday", "---", "This", "route", "expires", "daily", "at", "11", ":", "05" ]
train
https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/FactionWarfareApi.java#L468-L472
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/AbstractJUnit4InitMethodNotRun.java
AbstractJUnit4InitMethodNotRun.matchMethod
@Override public Description matchMethod(MethodTree methodTree, VisitorState state) { """ Matches if all of the following conditions are true: 1) The method matches {@link #methodMatcher()}, (looks like setUp() or tearDown(), and none of the overrides in the hierarchy of the method have the appropriate @Before or @After annotations) 2) The method is not annotated with @Test 3) The enclosing class has an @RunWith annotation and does not extend TestCase. This marks that the test is intended to run with JUnit 4. """ boolean matches = allOf( methodMatcher(), not(hasAnnotationOnAnyOverriddenMethod(JUNIT_TEST)), enclosingClass(isJUnit4TestClass)) .matches(methodTree, state); if (!matches) { return Description.NO_MATCH; } // For each annotationReplacement, replace the first annotation that matches. If any of them // matches, don't try and do the rest of the work. Description description; for (AnnotationReplacements replacement : annotationReplacements()) { description = tryToReplaceAnnotation( methodTree, state, replacement.badAnnotation, replacement.goodAnnotation); if (description != null) { return description; } } // Search for another @Before annotation on the method and replace the import // if we find one String correctAnnotation = correctAnnotation(); String unqualifiedClassName = getUnqualifiedClassName(correctAnnotation); for (AnnotationTree annotationNode : methodTree.getModifiers().getAnnotations()) { Symbol annoSymbol = ASTHelpers.getSymbol(annotationNode); if (annoSymbol.getSimpleName().contentEquals(unqualifiedClassName)) { SuggestedFix.Builder suggestedFix = SuggestedFix.builder() .removeImport(annoSymbol.getQualifiedName().toString()) .addImport(correctAnnotation); makeProtectedPublic(methodTree, state, suggestedFix); return describeMatch(annotationNode, suggestedFix.build()); } } // Add correctAnnotation() to the unannotated method // (and convert protected to public if it is) SuggestedFix.Builder suggestedFix = SuggestedFix.builder().addImport(correctAnnotation); makeProtectedPublic(methodTree, state, suggestedFix); suggestedFix.prefixWith(methodTree, "@" + unqualifiedClassName + "\n"); return describeMatch(methodTree, suggestedFix.build()); }
java
@Override public Description matchMethod(MethodTree methodTree, VisitorState state) { boolean matches = allOf( methodMatcher(), not(hasAnnotationOnAnyOverriddenMethod(JUNIT_TEST)), enclosingClass(isJUnit4TestClass)) .matches(methodTree, state); if (!matches) { return Description.NO_MATCH; } // For each annotationReplacement, replace the first annotation that matches. If any of them // matches, don't try and do the rest of the work. Description description; for (AnnotationReplacements replacement : annotationReplacements()) { description = tryToReplaceAnnotation( methodTree, state, replacement.badAnnotation, replacement.goodAnnotation); if (description != null) { return description; } } // Search for another @Before annotation on the method and replace the import // if we find one String correctAnnotation = correctAnnotation(); String unqualifiedClassName = getUnqualifiedClassName(correctAnnotation); for (AnnotationTree annotationNode : methodTree.getModifiers().getAnnotations()) { Symbol annoSymbol = ASTHelpers.getSymbol(annotationNode); if (annoSymbol.getSimpleName().contentEquals(unqualifiedClassName)) { SuggestedFix.Builder suggestedFix = SuggestedFix.builder() .removeImport(annoSymbol.getQualifiedName().toString()) .addImport(correctAnnotation); makeProtectedPublic(methodTree, state, suggestedFix); return describeMatch(annotationNode, suggestedFix.build()); } } // Add correctAnnotation() to the unannotated method // (and convert protected to public if it is) SuggestedFix.Builder suggestedFix = SuggestedFix.builder().addImport(correctAnnotation); makeProtectedPublic(methodTree, state, suggestedFix); suggestedFix.prefixWith(methodTree, "@" + unqualifiedClassName + "\n"); return describeMatch(methodTree, suggestedFix.build()); }
[ "@", "Override", "public", "Description", "matchMethod", "(", "MethodTree", "methodTree", ",", "VisitorState", "state", ")", "{", "boolean", "matches", "=", "allOf", "(", "methodMatcher", "(", ")", ",", "not", "(", "hasAnnotationOnAnyOverriddenMethod", "(", "JUNIT_TEST", ")", ")", ",", "enclosingClass", "(", "isJUnit4TestClass", ")", ")", ".", "matches", "(", "methodTree", ",", "state", ")", ";", "if", "(", "!", "matches", ")", "{", "return", "Description", ".", "NO_MATCH", ";", "}", "// For each annotationReplacement, replace the first annotation that matches. If any of them", "// matches, don't try and do the rest of the work.", "Description", "description", ";", "for", "(", "AnnotationReplacements", "replacement", ":", "annotationReplacements", "(", ")", ")", "{", "description", "=", "tryToReplaceAnnotation", "(", "methodTree", ",", "state", ",", "replacement", ".", "badAnnotation", ",", "replacement", ".", "goodAnnotation", ")", ";", "if", "(", "description", "!=", "null", ")", "{", "return", "description", ";", "}", "}", "// Search for another @Before annotation on the method and replace the import", "// if we find one", "String", "correctAnnotation", "=", "correctAnnotation", "(", ")", ";", "String", "unqualifiedClassName", "=", "getUnqualifiedClassName", "(", "correctAnnotation", ")", ";", "for", "(", "AnnotationTree", "annotationNode", ":", "methodTree", ".", "getModifiers", "(", ")", ".", "getAnnotations", "(", ")", ")", "{", "Symbol", "annoSymbol", "=", "ASTHelpers", ".", "getSymbol", "(", "annotationNode", ")", ";", "if", "(", "annoSymbol", ".", "getSimpleName", "(", ")", ".", "contentEquals", "(", "unqualifiedClassName", ")", ")", "{", "SuggestedFix", ".", "Builder", "suggestedFix", "=", "SuggestedFix", ".", "builder", "(", ")", ".", "removeImport", "(", "annoSymbol", ".", "getQualifiedName", "(", ")", ".", "toString", "(", ")", ")", ".", "addImport", "(", "correctAnnotation", ")", ";", "makeProtectedPublic", "(", "methodTree", ",", "state", ",", "suggestedFix", ")", ";", "return", "describeMatch", "(", "annotationNode", ",", "suggestedFix", ".", "build", "(", ")", ")", ";", "}", "}", "// Add correctAnnotation() to the unannotated method", "// (and convert protected to public if it is)", "SuggestedFix", ".", "Builder", "suggestedFix", "=", "SuggestedFix", ".", "builder", "(", ")", ".", "addImport", "(", "correctAnnotation", ")", ";", "makeProtectedPublic", "(", "methodTree", ",", "state", ",", "suggestedFix", ")", ";", "suggestedFix", ".", "prefixWith", "(", "methodTree", ",", "\"@\"", "+", "unqualifiedClassName", "+", "\"\\n\"", ")", ";", "return", "describeMatch", "(", "methodTree", ",", "suggestedFix", ".", "build", "(", ")", ")", ";", "}" ]
Matches if all of the following conditions are true: 1) The method matches {@link #methodMatcher()}, (looks like setUp() or tearDown(), and none of the overrides in the hierarchy of the method have the appropriate @Before or @After annotations) 2) The method is not annotated with @Test 3) The enclosing class has an @RunWith annotation and does not extend TestCase. This marks that the test is intended to run with JUnit 4.
[ "Matches", "if", "all", "of", "the", "following", "conditions", "are", "true", ":", "1", ")", "The", "method", "matches", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/AbstractJUnit4InitMethodNotRun.java#L84-L130
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java
SyncMembersInner.beginCreateOrUpdate
public SyncMemberInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { """ Creates or updates a sync member. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group on which the sync member is hosted. @param syncMemberName The name of the sync member. @param parameters The requested sync member resource state. @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 SyncMemberInner object if successful. """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().single().body(); }
java
public SyncMemberInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName, String syncGroupName, String syncMemberName, SyncMemberInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, syncGroupName, syncMemberName, parameters).toBlocking().single().body(); }
[ "public", "SyncMemberInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "syncGroupName", ",", "String", "syncMemberName", ",", "SyncMemberInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", "syncGroupName", ",", "syncMemberName", ",", "parameters", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates a sync member. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database on which the sync group is hosted. @param syncGroupName The name of the sync group on which the sync member is hosted. @param syncMemberName The name of the sync member. @param parameters The requested sync member resource state. @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 SyncMemberInner object if successful.
[ "Creates", "or", "updates", "a", "sync", "member", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/SyncMembersInner.java#L339-L341
dihedron/dihedron-commons
src/main/java/org/dihedron/core/url/URLFactory.java
URLFactory.makeURL
public static URL makeURL(String specification) throws MalformedURLException { """ Returns an URL object for the given URL specification. @param specification the URL specification. @return an URL object; if the URL is of "classpath://" type, it will return an URL whose connection will be opened by a specialised stream handler. @throws MalformedURLException """ logger.trace("retrieving URL for specification: '{}'", specification); if(specification.startsWith("classpath:")) { logger.trace("URL is of type 'classpath'"); return new URL(null, specification, new ClassPathURLStreamHandler()); } logger.trace("URL is of normal type"); return new URL(specification); }
java
public static URL makeURL(String specification) throws MalformedURLException { logger.trace("retrieving URL for specification: '{}'", specification); if(specification.startsWith("classpath:")) { logger.trace("URL is of type 'classpath'"); return new URL(null, specification, new ClassPathURLStreamHandler()); } logger.trace("URL is of normal type"); return new URL(specification); }
[ "public", "static", "URL", "makeURL", "(", "String", "specification", ")", "throws", "MalformedURLException", "{", "logger", ".", "trace", "(", "\"retrieving URL for specification: '{}'\"", ",", "specification", ")", ";", "if", "(", "specification", ".", "startsWith", "(", "\"classpath:\"", ")", ")", "{", "logger", ".", "trace", "(", "\"URL is of type 'classpath'\"", ")", ";", "return", "new", "URL", "(", "null", ",", "specification", ",", "new", "ClassPathURLStreamHandler", "(", ")", ")", ";", "}", "logger", ".", "trace", "(", "\"URL is of normal type\"", ")", ";", "return", "new", "URL", "(", "specification", ")", ";", "}" ]
Returns an URL object for the given URL specification. @param specification the URL specification. @return an URL object; if the URL is of "classpath://" type, it will return an URL whose connection will be opened by a specialised stream handler. @throws MalformedURLException
[ "Returns", "an", "URL", "object", "for", "the", "given", "URL", "specification", "." ]
train
https://github.com/dihedron/dihedron-commons/blob/a5194cdaa0d6417ef4aade6ea407a1cad6e8458e/src/main/java/org/dihedron/core/url/URLFactory.java#L40-L48
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_DELETE
public void billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_DELETE(String billingAccount, String serviceName, Long conditionId) throws IOException { """ Delete the given condition REST: DELETE /telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param conditionId [required] """ String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_DELETE(String billingAccount, String serviceName, Long conditionId) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_DELETE", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "conditionId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "billingAccount", ",", "serviceName", ",", "conditionId", ")", ";", "exec", "(", "qPath", ",", "\"DELETE\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "}" ]
Delete the given condition REST: DELETE /telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param conditionId [required]
[ "Delete", "the", "given", "condition" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3355-L3359
Bedework/bw-util
bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java
XmlUtil.getAttrVal
public static String getAttrVal(final Element el, final String name) throws SAXException { """ Return the value of the named attribute of the given element. @param el Element @param name String name of desired attribute @return String attribute value or null @throws SAXException """ Attr at = el.getAttributeNode(name); if (at == null) { return null; } return at.getValue(); }
java
public static String getAttrVal(final Element el, final String name) throws SAXException { Attr at = el.getAttributeNode(name); if (at == null) { return null; } return at.getValue(); }
[ "public", "static", "String", "getAttrVal", "(", "final", "Element", "el", ",", "final", "String", "name", ")", "throws", "SAXException", "{", "Attr", "at", "=", "el", ".", "getAttributeNode", "(", "name", ")", ";", "if", "(", "at", "==", "null", ")", "{", "return", "null", ";", "}", "return", "at", ".", "getValue", "(", ")", ";", "}" ]
Return the value of the named attribute of the given element. @param el Element @param name String name of desired attribute @return String attribute value or null @throws SAXException
[ "Return", "the", "value", "of", "the", "named", "attribute", "of", "the", "given", "element", "." ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlUtil.java#L218-L226
line/armeria
core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedHttpServiceFactory.java
AnnotatedHttpServiceFactory.consumableMediaTypes
private static List<MediaType> consumableMediaTypes(Method method, Class<?> clazz) { """ Returns the list of {@link MediaType}s specified by {@link Consumes} annotation. """ List<Consumes> consumes = findAll(method, Consumes.class); List<ConsumeType> consumeTypes = findAll(method, ConsumeType.class); if (consumes.isEmpty() && consumeTypes.isEmpty()) { consumes = findAll(clazz, Consumes.class); consumeTypes = findAll(clazz, ConsumeType.class); } final List<MediaType> types = Stream.concat(consumes.stream().map(Consumes::value), consumeTypes.stream().map(ConsumeType::value)) .map(MediaType::parse) .collect(toImmutableList()); return ensureUniqueTypes(types, Consumes.class); }
java
private static List<MediaType> consumableMediaTypes(Method method, Class<?> clazz) { List<Consumes> consumes = findAll(method, Consumes.class); List<ConsumeType> consumeTypes = findAll(method, ConsumeType.class); if (consumes.isEmpty() && consumeTypes.isEmpty()) { consumes = findAll(clazz, Consumes.class); consumeTypes = findAll(clazz, ConsumeType.class); } final List<MediaType> types = Stream.concat(consumes.stream().map(Consumes::value), consumeTypes.stream().map(ConsumeType::value)) .map(MediaType::parse) .collect(toImmutableList()); return ensureUniqueTypes(types, Consumes.class); }
[ "private", "static", "List", "<", "MediaType", ">", "consumableMediaTypes", "(", "Method", "method", ",", "Class", "<", "?", ">", "clazz", ")", "{", "List", "<", "Consumes", ">", "consumes", "=", "findAll", "(", "method", ",", "Consumes", ".", "class", ")", ";", "List", "<", "ConsumeType", ">", "consumeTypes", "=", "findAll", "(", "method", ",", "ConsumeType", ".", "class", ")", ";", "if", "(", "consumes", ".", "isEmpty", "(", ")", "&&", "consumeTypes", ".", "isEmpty", "(", ")", ")", "{", "consumes", "=", "findAll", "(", "clazz", ",", "Consumes", ".", "class", ")", ";", "consumeTypes", "=", "findAll", "(", "clazz", ",", "ConsumeType", ".", "class", ")", ";", "}", "final", "List", "<", "MediaType", ">", "types", "=", "Stream", ".", "concat", "(", "consumes", ".", "stream", "(", ")", ".", "map", "(", "Consumes", "::", "value", ")", ",", "consumeTypes", ".", "stream", "(", ")", ".", "map", "(", "ConsumeType", "::", "value", ")", ")", ".", "map", "(", "MediaType", "::", "parse", ")", ".", "collect", "(", "toImmutableList", "(", ")", ")", ";", "return", "ensureUniqueTypes", "(", "types", ",", "Consumes", ".", "class", ")", ";", "}" ]
Returns the list of {@link MediaType}s specified by {@link Consumes} annotation.
[ "Returns", "the", "list", "of", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/internal/annotation/AnnotatedHttpServiceFactory.java#L450-L465
leancloud/java-sdk-all
android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/pay/GetProductDetailsApi.java
GetProductDetailsApi.onConnect
@Override public void onConnect(int rst, HuaweiApiClient client) { """ Huawei Api Client 连接回调 @param rst 结果码 @param client HuaweiApiClient 实例 """ HMSAgentLog.d("onConnect:" + rst); if (client == null || !ApiClientMgr.INST.isConnect(client)) { HMSAgentLog.e("client not connted"); onProductDetailResult(rst, null); return; } // 调用HMS-SDK getOrderDetail 接口 PendingResult<ProductDetailResult> checkPayResult = HuaweiPay.HuaweiPayApi.getProductDetails(client, productDetailReq); checkPayResult.setResultCallback(new ResultCallback<ProductDetailResult>() { @Override public void onResult(ProductDetailResult result) { if (result == null) { HMSAgentLog.e("result is null"); onProductDetailResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null); return; } Status status = result.getStatus(); if (status == null) { HMSAgentLog.e("status is null"); onProductDetailResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null); return; } int rstCode = status.getStatusCode(); HMSAgentLog.d("status=" + status); // 需要重试的错误码,并且可以重试 if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID || rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) { retryTimes--; connect(); } else { onProductDetailResult(rstCode, result); } } }); }
java
@Override public void onConnect(int rst, HuaweiApiClient client) { HMSAgentLog.d("onConnect:" + rst); if (client == null || !ApiClientMgr.INST.isConnect(client)) { HMSAgentLog.e("client not connted"); onProductDetailResult(rst, null); return; } // 调用HMS-SDK getOrderDetail 接口 PendingResult<ProductDetailResult> checkPayResult = HuaweiPay.HuaweiPayApi.getProductDetails(client, productDetailReq); checkPayResult.setResultCallback(new ResultCallback<ProductDetailResult>() { @Override public void onResult(ProductDetailResult result) { if (result == null) { HMSAgentLog.e("result is null"); onProductDetailResult(HMSAgent.AgentResultCode.RESULT_IS_NULL, null); return; } Status status = result.getStatus(); if (status == null) { HMSAgentLog.e("status is null"); onProductDetailResult(HMSAgent.AgentResultCode.STATUS_IS_NULL, null); return; } int rstCode = status.getStatusCode(); HMSAgentLog.d("status=" + status); // 需要重试的错误码,并且可以重试 if ((rstCode == CommonCode.ErrorCode.SESSION_INVALID || rstCode == CommonCode.ErrorCode.CLIENT_API_INVALID) && retryTimes > 0) { retryTimes--; connect(); } else { onProductDetailResult(rstCode, result); } } }); }
[ "@", "Override", "public", "void", "onConnect", "(", "int", "rst", ",", "HuaweiApiClient", "client", ")", "{", "HMSAgentLog", ".", "d", "(", "\"onConnect:\"", "+", "rst", ")", ";", "if", "(", "client", "==", "null", "||", "!", "ApiClientMgr", ".", "INST", ".", "isConnect", "(", "client", ")", ")", "{", "HMSAgentLog", ".", "e", "(", "\"client not connted\"", ")", ";", "onProductDetailResult", "(", "rst", ",", "null", ")", ";", "return", ";", "}", "// 调用HMS-SDK getOrderDetail 接口\r", "PendingResult", "<", "ProductDetailResult", ">", "checkPayResult", "=", "HuaweiPay", ".", "HuaweiPayApi", ".", "getProductDetails", "(", "client", ",", "productDetailReq", ")", ";", "checkPayResult", ".", "setResultCallback", "(", "new", "ResultCallback", "<", "ProductDetailResult", ">", "(", ")", "{", "@", "Override", "public", "void", "onResult", "(", "ProductDetailResult", "result", ")", "{", "if", "(", "result", "==", "null", ")", "{", "HMSAgentLog", ".", "e", "(", "\"result is null\"", ")", ";", "onProductDetailResult", "(", "HMSAgent", ".", "AgentResultCode", ".", "RESULT_IS_NULL", ",", "null", ")", ";", "return", ";", "}", "Status", "status", "=", "result", ".", "getStatus", "(", ")", ";", "if", "(", "status", "==", "null", ")", "{", "HMSAgentLog", ".", "e", "(", "\"status is null\"", ")", ";", "onProductDetailResult", "(", "HMSAgent", ".", "AgentResultCode", ".", "STATUS_IS_NULL", ",", "null", ")", ";", "return", ";", "}", "int", "rstCode", "=", "status", ".", "getStatusCode", "(", ")", ";", "HMSAgentLog", ".", "d", "(", "\"status=\"", "+", "status", ")", ";", "// 需要重试的错误码,并且可以重试\r", "if", "(", "(", "rstCode", "==", "CommonCode", ".", "ErrorCode", ".", "SESSION_INVALID", "||", "rstCode", "==", "CommonCode", ".", "ErrorCode", ".", "CLIENT_API_INVALID", ")", "&&", "retryTimes", ">", "0", ")", "{", "retryTimes", "--", ";", "connect", "(", ")", ";", "}", "else", "{", "onProductDetailResult", "(", "rstCode", ",", "result", ")", ";", "}", "}", "}", ")", ";", "}" ]
Huawei Api Client 连接回调 @param rst 结果码 @param client HuaweiApiClient 实例
[ "Huawei", "Api", "Client", "连接回调" ]
train
https://github.com/leancloud/java-sdk-all/blob/323f8e7ee38051b1350790e5192304768c5c9f5f/android-sdk/huawei-hmsagent/src/main/java/com/huawei/android/hms/agent/pay/GetProductDetailsApi.java#L52-L94
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/AppEventsLogger.java
AppEventsLogger.newLogger
public static AppEventsLogger newLogger(Context context, String applicationId) { """ Build an AppEventsLogger instance to log events that are attributed to the application but not to any particular Session. @param context Used to access the attributionId for non-authenticated users. @param applicationId Explicitly specified Facebook applicationId to log events against. If null, the default app ID specified in the package metadata will be used. @return AppEventsLogger instance to invoke log* methods on. """ return new AppEventsLogger(context, applicationId, null); }
java
public static AppEventsLogger newLogger(Context context, String applicationId) { return new AppEventsLogger(context, applicationId, null); }
[ "public", "static", "AppEventsLogger", "newLogger", "(", "Context", "context", ",", "String", "applicationId", ")", "{", "return", "new", "AppEventsLogger", "(", "context", ",", "applicationId", ",", "null", ")", ";", "}" ]
Build an AppEventsLogger instance to log events that are attributed to the application but not to any particular Session. @param context Used to access the attributionId for non-authenticated users. @param applicationId Explicitly specified Facebook applicationId to log events against. If null, the default app ID specified in the package metadata will be used. @return AppEventsLogger instance to invoke log* methods on.
[ "Build", "an", "AppEventsLogger", "instance", "to", "log", "events", "that", "are", "attributed", "to", "the", "application", "but", "not", "to", "any", "particular", "Session", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/AppEventsLogger.java#L385-L387
greese/dasein-util
src/main/java/org/dasein/util/ConcurrentCache.java
ConcurrentCache.getOrLoad
public V getOrLoad(K key, CacheLoader<V> loader) { """ Retrieves the value for the specified key. If no value is present, this method will attempt to load a value and place it into the cache. This method appears atomic in accordance with the contract of a @{link ConcurrentMap}, but any required loading will actually occur outside of a synchronous block, thus allowing for other operations on the cache while a load is in process. In the rare instance that two loads occur simultaneously, the result of the first completed load will be stored in the cache and the second will be discarded. As a result, the return value of both calls will be the item loaded from the first load to complete. @param key the key being sought @param loader a loader to load a new value if a value is missing @return the value matching the specified key or <code>null</code> if no object exists in the system matching the desired key """ V item; // synchronized( this ) { if( containsKey(key) ) { return get(key); } //} item = loader.load(); if( item != null ) { putIfAbsent(key, item); return get(key); } else { return null; } }
java
public V getOrLoad(K key, CacheLoader<V> loader) { V item; // synchronized( this ) { if( containsKey(key) ) { return get(key); } //} item = loader.load(); if( item != null ) { putIfAbsent(key, item); return get(key); } else { return null; } }
[ "public", "V", "getOrLoad", "(", "K", "key", ",", "CacheLoader", "<", "V", ">", "loader", ")", "{", "V", "item", ";", "// synchronized( this ) {", "if", "(", "containsKey", "(", "key", ")", ")", "{", "return", "get", "(", "key", ")", ";", "}", "//}", "item", "=", "loader", ".", "load", "(", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "putIfAbsent", "(", "key", ",", "item", ")", ";", "return", "get", "(", "key", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Retrieves the value for the specified key. If no value is present, this method will attempt to load a value and place it into the cache. This method appears atomic in accordance with the contract of a @{link ConcurrentMap}, but any required loading will actually occur outside of a synchronous block, thus allowing for other operations on the cache while a load is in process. In the rare instance that two loads occur simultaneously, the result of the first completed load will be stored in the cache and the second will be discarded. As a result, the return value of both calls will be the item loaded from the first load to complete. @param key the key being sought @param loader a loader to load a new value if a value is missing @return the value matching the specified key or <code>null</code> if no object exists in the system matching the desired key
[ "Retrieves", "the", "value", "for", "the", "specified", "key", ".", "If", "no", "value", "is", "present", "this", "method", "will", "attempt", "to", "load", "a", "value", "and", "place", "it", "into", "the", "cache", ".", "This", "method", "appears", "atomic", "in", "accordance", "with", "the", "contract", "of", "a" ]
train
https://github.com/greese/dasein-util/blob/648606dcb4bd382e3287a6c897a32e65d553dc47/src/main/java/org/dasein/util/ConcurrentCache.java#L226-L242
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/interceptions/BinaryInterceptorAdapter.java
BinaryInterceptorAdapter.apply
@Override public R apply(T1 first, T2 second) { """ Executes a function in the nested interceptor context. @param first @param second @return the result of the inner function """ interceptor.before(first, second); try { return inner.apply(first, second); } finally { interceptor.after(first, second); } }
java
@Override public R apply(T1 first, T2 second) { interceptor.before(first, second); try { return inner.apply(first, second); } finally { interceptor.after(first, second); } }
[ "@", "Override", "public", "R", "apply", "(", "T1", "first", ",", "T2", "second", ")", "{", "interceptor", ".", "before", "(", "first", ",", "second", ")", ";", "try", "{", "return", "inner", ".", "apply", "(", "first", ",", "second", ")", ";", "}", "finally", "{", "interceptor", ".", "after", "(", "first", ",", "second", ")", ";", "}", "}" ]
Executes a function in the nested interceptor context. @param first @param second @return the result of the inner function
[ "Executes", "a", "function", "in", "the", "nested", "interceptor", "context", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/interceptions/BinaryInterceptorAdapter.java#L33-L41
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.writeConfigFile
public static void writeConfigFile(String fileName, Class<?>[] classes, boolean sortClasses) throws SQLException, IOException { """ Writes a configuration fileName in the raw directory with the configuration for classes. @param sortClasses Set to true to sort the classes by name before the file is generated. """ File rawDir = findRawDir(new File(".")); if (rawDir == null) { System.err.println("Could not find " + RAW_DIR_NAME + " directory which is typically in the " + RESOURCE_DIR_NAME + " directory"); } else { File configFile = new File(rawDir, fileName); writeConfigFile(configFile, classes, sortClasses); } }
java
public static void writeConfigFile(String fileName, Class<?>[] classes, boolean sortClasses) throws SQLException, IOException { File rawDir = findRawDir(new File(".")); if (rawDir == null) { System.err.println("Could not find " + RAW_DIR_NAME + " directory which is typically in the " + RESOURCE_DIR_NAME + " directory"); } else { File configFile = new File(rawDir, fileName); writeConfigFile(configFile, classes, sortClasses); } }
[ "public", "static", "void", "writeConfigFile", "(", "String", "fileName", ",", "Class", "<", "?", ">", "[", "]", "classes", ",", "boolean", "sortClasses", ")", "throws", "SQLException", ",", "IOException", "{", "File", "rawDir", "=", "findRawDir", "(", "new", "File", "(", "\".\"", ")", ")", ";", "if", "(", "rawDir", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"Could not find \"", "+", "RAW_DIR_NAME", "+", "\" directory which is typically in the \"", "+", "RESOURCE_DIR_NAME", "+", "\" directory\"", ")", ";", "}", "else", "{", "File", "configFile", "=", "new", "File", "(", "rawDir", ",", "fileName", ")", ";", "writeConfigFile", "(", "configFile", ",", "classes", ",", "sortClasses", ")", ";", "}", "}" ]
Writes a configuration fileName in the raw directory with the configuration for classes. @param sortClasses Set to true to sort the classes by name before the file is generated.
[ "Writes", "a", "configuration", "fileName", "in", "the", "raw", "directory", "with", "the", "configuration", "for", "classes", "." ]
train
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L134-L144
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/IssuesApi.java
IssuesApi.createIssue
public Issue createIssue(Object projectIdOrPath, String title, String description) throws GitLabApiException { """ Create an issue for the project. <pre><code>GitLab Endpoint: POST /projects/:id/issues</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param title the title of an issue, required @param description the description of an issue, optional @return an instance of Issue @throws GitLabApiException if any exception occurs """ return (createIssue(projectIdOrPath, title, description, null, null, null, null, null, null, null, null)); }
java
public Issue createIssue(Object projectIdOrPath, String title, String description) throws GitLabApiException { return (createIssue(projectIdOrPath, title, description, null, null, null, null, null, null, null, null)); }
[ "public", "Issue", "createIssue", "(", "Object", "projectIdOrPath", ",", "String", "title", ",", "String", "description", ")", "throws", "GitLabApiException", "{", "return", "(", "createIssue", "(", "projectIdOrPath", ",", "title", ",", "description", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ",", "null", ")", ")", ";", "}" ]
Create an issue for the project. <pre><code>GitLab Endpoint: POST /projects/:id/issues</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param title the title of an issue, required @param description the description of an issue, optional @return an instance of Issue @throws GitLabApiException if any exception occurs
[ "Create", "an", "issue", "for", "the", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/IssuesApi.java#L327-L329
Bedework/bw-util
bw-util-timezones/src/main/java/org/bedework/util/timezones/DateTimeUtil.java
DateTimeUtil.isoDateTime
public static String isoDateTime(final Date val, final TimeZone tz) { """ Turn Date into "yyyyMMddTHHmmss" for a given timezone @param val date @param tz TimeZone @return String "yyyyMMddTHHmmss" """ synchronized (isoDateTimeTZFormat) { isoDateTimeTZFormat.setTimeZone(tz); return isoDateTimeTZFormat.format(val); } }
java
public static String isoDateTime(final Date val, final TimeZone tz) { synchronized (isoDateTimeTZFormat) { isoDateTimeTZFormat.setTimeZone(tz); return isoDateTimeTZFormat.format(val); } }
[ "public", "static", "String", "isoDateTime", "(", "final", "Date", "val", ",", "final", "TimeZone", "tz", ")", "{", "synchronized", "(", "isoDateTimeTZFormat", ")", "{", "isoDateTimeTZFormat", ".", "setTimeZone", "(", "tz", ")", ";", "return", "isoDateTimeTZFormat", ".", "format", "(", "val", ")", ";", "}", "}" ]
Turn Date into "yyyyMMddTHHmmss" for a given timezone @param val date @param tz TimeZone @return String "yyyyMMddTHHmmss"
[ "Turn", "Date", "into", "yyyyMMddTHHmmss", "for", "a", "given", "timezone" ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-timezones/src/main/java/org/bedework/util/timezones/DateTimeUtil.java#L188-L193
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldTracker.java
TldTracker.setTrackerLocation
public void setTrackerLocation( int x0 , int y0 , int x1 , int y1 ) { """ Used to set the location of the track without changing any appearance history. Move the track region but keep the same aspect ratio as it had before So scale the region and re-center it """ int width = x1-x0; int height = y1-y0; // change change in scale double scale = (width/targetRegion.getWidth() + height/targetRegion.getHeight())/2.0; // new center location double centerX = (x0+x1)/2.0; double centerY = (y0+y1)/2.0; targetRegion.p0.x = centerX-scale*targetRegion.getWidth()/2.0; targetRegion.p1.x = targetRegion.p0.x + scale*targetRegion.getWidth(); targetRegion.p0.y = centerY-scale*targetRegion.getHeight()/2.0; targetRegion.p1.y = targetRegion.p0.y + scale*targetRegion.getHeight(); }
java
public void setTrackerLocation( int x0 , int y0 , int x1 , int y1 ) { int width = x1-x0; int height = y1-y0; // change change in scale double scale = (width/targetRegion.getWidth() + height/targetRegion.getHeight())/2.0; // new center location double centerX = (x0+x1)/2.0; double centerY = (y0+y1)/2.0; targetRegion.p0.x = centerX-scale*targetRegion.getWidth()/2.0; targetRegion.p1.x = targetRegion.p0.x + scale*targetRegion.getWidth(); targetRegion.p0.y = centerY-scale*targetRegion.getHeight()/2.0; targetRegion.p1.y = targetRegion.p0.y + scale*targetRegion.getHeight(); }
[ "public", "void", "setTrackerLocation", "(", "int", "x0", ",", "int", "y0", ",", "int", "x1", ",", "int", "y1", ")", "{", "int", "width", "=", "x1", "-", "x0", ";", "int", "height", "=", "y1", "-", "y0", ";", "// change change in scale", "double", "scale", "=", "(", "width", "/", "targetRegion", ".", "getWidth", "(", ")", "+", "height", "/", "targetRegion", ".", "getHeight", "(", ")", ")", "/", "2.0", ";", "// new center location", "double", "centerX", "=", "(", "x0", "+", "x1", ")", "/", "2.0", ";", "double", "centerY", "=", "(", "y0", "+", "y1", ")", "/", "2.0", ";", "targetRegion", ".", "p0", ".", "x", "=", "centerX", "-", "scale", "*", "targetRegion", ".", "getWidth", "(", ")", "/", "2.0", ";", "targetRegion", ".", "p1", ".", "x", "=", "targetRegion", ".", "p0", ".", "x", "+", "scale", "*", "targetRegion", ".", "getWidth", "(", ")", ";", "targetRegion", ".", "p0", ".", "y", "=", "centerY", "-", "scale", "*", "targetRegion", ".", "getHeight", "(", ")", "/", "2.0", ";", "targetRegion", ".", "p1", ".", "y", "=", "targetRegion", ".", "p0", ".", "y", "+", "scale", "*", "targetRegion", ".", "getHeight", "(", ")", ";", "}" ]
Used to set the location of the track without changing any appearance history. Move the track region but keep the same aspect ratio as it had before So scale the region and re-center it
[ "Used", "to", "set", "the", "location", "of", "the", "track", "without", "changing", "any", "appearance", "history", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldTracker.java#L183-L199
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/gremlin/GremlinExpressionFactory.java
GremlinExpressionFactory.generateAdjacentVerticesExpression
public GroovyExpression generateAdjacentVerticesExpression(GroovyExpression parent, AtlasEdgeDirection dir) { """ Generates an expression that gets the vertices adjacent to the vertex in 'parent' in the specified direction. @param parent @param dir @return """ return new FunctionCallExpression(TraversalStepType.FLAT_MAP_TO_ELEMENTS, parent, getGremlinFunctionName(dir)); }
java
public GroovyExpression generateAdjacentVerticesExpression(GroovyExpression parent, AtlasEdgeDirection dir) { return new FunctionCallExpression(TraversalStepType.FLAT_MAP_TO_ELEMENTS, parent, getGremlinFunctionName(dir)); }
[ "public", "GroovyExpression", "generateAdjacentVerticesExpression", "(", "GroovyExpression", "parent", ",", "AtlasEdgeDirection", "dir", ")", "{", "return", "new", "FunctionCallExpression", "(", "TraversalStepType", ".", "FLAT_MAP_TO_ELEMENTS", ",", "parent", ",", "getGremlinFunctionName", "(", "dir", ")", ")", ";", "}" ]
Generates an expression that gets the vertices adjacent to the vertex in 'parent' in the specified direction. @param parent @param dir @return
[ "Generates", "an", "expression", "that", "gets", "the", "vertices", "adjacent", "to", "the", "vertex", "in", "parent", "in", "the", "specified", "direction", "." ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/gremlin/GremlinExpressionFactory.java#L464-L466
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/converters/VariantContextConverter.java
VariantContextConverter.getReferenceBase
protected static String getReferenceBase(String chromosome, int from, int to, Map<Integer, Character> referenceAlleles) { """ Get bases from reference sequence. @param chromosome Chromosome @param from Start ( inclusive) position @param to End (exclusive) position @param referenceAlleles Reference alleles @return String Reference sequence of length to - from """ int length = to - from; if (length < 0) { throw new IllegalStateException( "Sequence length is negative: chromosome " + chromosome + " from " + from + " to " + to); } StringBuilder sb = new StringBuilder(length); for (int i = from; i < to; i++) { sb.append(referenceAlleles.getOrDefault(i, 'N')); } return sb.toString(); // return StringUtils.repeat('N', length); // current return default base TODO load reference sequence }
java
protected static String getReferenceBase(String chromosome, int from, int to, Map<Integer, Character> referenceAlleles) { int length = to - from; if (length < 0) { throw new IllegalStateException( "Sequence length is negative: chromosome " + chromosome + " from " + from + " to " + to); } StringBuilder sb = new StringBuilder(length); for (int i = from; i < to; i++) { sb.append(referenceAlleles.getOrDefault(i, 'N')); } return sb.toString(); // return StringUtils.repeat('N', length); // current return default base TODO load reference sequence }
[ "protected", "static", "String", "getReferenceBase", "(", "String", "chromosome", ",", "int", "from", ",", "int", "to", ",", "Map", "<", "Integer", ",", "Character", ">", "referenceAlleles", ")", "{", "int", "length", "=", "to", "-", "from", ";", "if", "(", "length", "<", "0", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Sequence length is negative: chromosome \"", "+", "chromosome", "+", "\" from \"", "+", "from", "+", "\" to \"", "+", "to", ")", ";", "}", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "length", ")", ";", "for", "(", "int", "i", "=", "from", ";", "i", "<", "to", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "referenceAlleles", ".", "getOrDefault", "(", "i", ",", "'", "'", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "// return StringUtils.repeat('N', length); // current return default base TODO load reference sequence", "}" ]
Get bases from reference sequence. @param chromosome Chromosome @param from Start ( inclusive) position @param to End (exclusive) position @param referenceAlleles Reference alleles @return String Reference sequence of length to - from
[ "Get", "bases", "from", "reference", "sequence", "." ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/converters/VariantContextConverter.java#L148-L160
virgo47/javasimon
core/src/main/java/org/javasimon/utils/SystemDebugCallback.java
SystemDebugCallback.onManagerWarning
@Override public void onManagerWarning(String warning, Exception cause) { """ Warning and stack trace are print out to the error output. Either cause or warning (or both) should be provided otherwise the method does nothing. <p/> {@inheritDoc} """ if (warning != null) { System.err.println(DEBUG_PREFIX + "Simon warning: " + warning); } if (cause != null) { System.err.print(DEBUG_PREFIX); cause.printStackTrace(); } }
java
@Override public void onManagerWarning(String warning, Exception cause) { if (warning != null) { System.err.println(DEBUG_PREFIX + "Simon warning: " + warning); } if (cause != null) { System.err.print(DEBUG_PREFIX); cause.printStackTrace(); } }
[ "@", "Override", "public", "void", "onManagerWarning", "(", "String", "warning", ",", "Exception", "cause", ")", "{", "if", "(", "warning", "!=", "null", ")", "{", "System", ".", "err", ".", "println", "(", "DEBUG_PREFIX", "+", "\"Simon warning: \"", "+", "warning", ")", ";", "}", "if", "(", "cause", "!=", "null", ")", "{", "System", ".", "err", ".", "print", "(", "DEBUG_PREFIX", ")", ";", "cause", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Warning and stack trace are print out to the error output. Either cause or warning (or both) should be provided otherwise the method does nothing. <p/> {@inheritDoc}
[ "Warning", "and", "stack", "trace", "are", "print", "out", "to", "the", "error", "output", ".", "Either", "cause", "or", "warning", "(", "or", "both", ")", "should", "be", "provided", "otherwise", "the", "method", "does", "nothing", ".", "<p", "/", ">", "{" ]
train
https://github.com/virgo47/javasimon/blob/17dfaa93cded9ce8ef64a134b28ccbf4d0284d2f/core/src/main/java/org/javasimon/utils/SystemDebugCallback.java#L79-L88
Alluxio/alluxio
core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java
UnderFileSystemBlockStore.getBlockReader
public BlockReader getBlockReader(final long sessionId, long blockId, long offset) throws BlockDoesNotExistException, IOException { """ Creates a block reader that reads from UFS and optionally caches the block to the Alluxio block store. @param sessionId the client session ID that requested this read @param blockId the ID of the block to read @param offset the read offset within the block (NOT the file) @return the block reader instance @throws BlockDoesNotExistException if the UFS block does not exist in the {@link UnderFileSystemBlockStore} """ final BlockInfo blockInfo; try (LockResource lr = new LockResource(mLock)) { blockInfo = getBlockInfo(sessionId, blockId); BlockReader blockReader = blockInfo.getBlockReader(); if (blockReader != null) { return blockReader; } } BlockReader reader = UnderFileSystemBlockReader.create(blockInfo.getMeta(), offset, mLocalBlockStore, mUfsManager, mUfsInstreamManager); blockInfo.setBlockReader(reader); return reader; }
java
public BlockReader getBlockReader(final long sessionId, long blockId, long offset) throws BlockDoesNotExistException, IOException { final BlockInfo blockInfo; try (LockResource lr = new LockResource(mLock)) { blockInfo = getBlockInfo(sessionId, blockId); BlockReader blockReader = blockInfo.getBlockReader(); if (blockReader != null) { return blockReader; } } BlockReader reader = UnderFileSystemBlockReader.create(blockInfo.getMeta(), offset, mLocalBlockStore, mUfsManager, mUfsInstreamManager); blockInfo.setBlockReader(reader); return reader; }
[ "public", "BlockReader", "getBlockReader", "(", "final", "long", "sessionId", ",", "long", "blockId", ",", "long", "offset", ")", "throws", "BlockDoesNotExistException", ",", "IOException", "{", "final", "BlockInfo", "blockInfo", ";", "try", "(", "LockResource", "lr", "=", "new", "LockResource", "(", "mLock", ")", ")", "{", "blockInfo", "=", "getBlockInfo", "(", "sessionId", ",", "blockId", ")", ";", "BlockReader", "blockReader", "=", "blockInfo", ".", "getBlockReader", "(", ")", ";", "if", "(", "blockReader", "!=", "null", ")", "{", "return", "blockReader", ";", "}", "}", "BlockReader", "reader", "=", "UnderFileSystemBlockReader", ".", "create", "(", "blockInfo", ".", "getMeta", "(", ")", ",", "offset", ",", "mLocalBlockStore", ",", "mUfsManager", ",", "mUfsInstreamManager", ")", ";", "blockInfo", ".", "setBlockReader", "(", "reader", ")", ";", "return", "reader", ";", "}" ]
Creates a block reader that reads from UFS and optionally caches the block to the Alluxio block store. @param sessionId the client session ID that requested this read @param blockId the ID of the block to read @param offset the read offset within the block (NOT the file) @return the block reader instance @throws BlockDoesNotExistException if the UFS block does not exist in the {@link UnderFileSystemBlockStore}
[ "Creates", "a", "block", "reader", "that", "reads", "from", "UFS", "and", "optionally", "caches", "the", "block", "to", "the", "Alluxio", "block", "store", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/worker/src/main/java/alluxio/worker/block/UnderFileSystemBlockStore.java#L231-L246
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java
StorageTreeFactory.buildConverterPlugin
private TreeBuilder<ResourceMeta> buildConverterPlugin(TreeBuilder<ResourceMeta> builder, String pluginType, String path, String selector, Map<String, String> config) { """ Append a converter plugin to the tree builder @param builder builder @param pluginType converter plugin type @param path path @param selector metadata selector @param config plugin config data @return builder """ StorageConverterPlugin converterPlugin = loadPlugin( pluginType, config, storageConverterPluginProviderService ); //convert tree under the subpath if specified, AND matching the selector if specified return builder.convert( new StorageConverterPluginAdapter(pluginType,converterPlugin), null != path ? PathUtil.asPath(path.trim()) : null, null != selector ? PathUtil.<ResourceMeta>resourceSelector(selector) : null ); }
java
private TreeBuilder<ResourceMeta> buildConverterPlugin(TreeBuilder<ResourceMeta> builder, String pluginType, String path, String selector, Map<String, String> config) { StorageConverterPlugin converterPlugin = loadPlugin( pluginType, config, storageConverterPluginProviderService ); //convert tree under the subpath if specified, AND matching the selector if specified return builder.convert( new StorageConverterPluginAdapter(pluginType,converterPlugin), null != path ? PathUtil.asPath(path.trim()) : null, null != selector ? PathUtil.<ResourceMeta>resourceSelector(selector) : null ); }
[ "private", "TreeBuilder", "<", "ResourceMeta", ">", "buildConverterPlugin", "(", "TreeBuilder", "<", "ResourceMeta", ">", "builder", ",", "String", "pluginType", ",", "String", "path", ",", "String", "selector", ",", "Map", "<", "String", ",", "String", ">", "config", ")", "{", "StorageConverterPlugin", "converterPlugin", "=", "loadPlugin", "(", "pluginType", ",", "config", ",", "storageConverterPluginProviderService", ")", ";", "//convert tree under the subpath if specified, AND matching the selector if specified", "return", "builder", ".", "convert", "(", "new", "StorageConverterPluginAdapter", "(", "pluginType", ",", "converterPlugin", ")", ",", "null", "!=", "path", "?", "PathUtil", ".", "asPath", "(", "path", ".", "trim", "(", ")", ")", ":", "null", ",", "null", "!=", "selector", "?", "PathUtil", ".", "<", "ResourceMeta", ">", "resourceSelector", "(", "selector", ")", ":", "null", ")", ";", "}" ]
Append a converter plugin to the tree builder @param builder builder @param pluginType converter plugin type @param path path @param selector metadata selector @param config plugin config data @return builder
[ "Append", "a", "converter", "plugin", "to", "the", "tree", "builder" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java#L240-L253
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/FileUtil.java
FileUtil.validateFileSize
public static boolean validateFileSize(final FileItemWrap newFile, final long maxFileSize) { """ Checks if the file item size is within the supplied max file size. @param newFile the file to be checked, if null then return false otherwise validate @param maxFileSize max file size in bytes, if zero or negative return true, otherwise validate @return {@code true} if file size is valid. """ // If newFile to validate is null, then return false if (newFile == null) { return false; } // If maxFileSize to validate is zero or negative, then assume newFile is valid if (maxFileSize < 1) { return true; } return (newFile.getSize() <= maxFileSize); }
java
public static boolean validateFileSize(final FileItemWrap newFile, final long maxFileSize) { // If newFile to validate is null, then return false if (newFile == null) { return false; } // If maxFileSize to validate is zero or negative, then assume newFile is valid if (maxFileSize < 1) { return true; } return (newFile.getSize() <= maxFileSize); }
[ "public", "static", "boolean", "validateFileSize", "(", "final", "FileItemWrap", "newFile", ",", "final", "long", "maxFileSize", ")", "{", "// If newFile to validate is null, then return false", "if", "(", "newFile", "==", "null", ")", "{", "return", "false", ";", "}", "// If maxFileSize to validate is zero or negative, then assume newFile is valid", "if", "(", "maxFileSize", "<", "1", ")", "{", "return", "true", ";", "}", "return", "(", "newFile", ".", "getSize", "(", ")", "<=", "maxFileSize", ")", ";", "}" ]
Checks if the file item size is within the supplied max file size. @param newFile the file to be checked, if null then return false otherwise validate @param maxFileSize max file size in bytes, if zero or negative return true, otherwise validate @return {@code true} if file size is valid.
[ "Checks", "if", "the", "file", "item", "size", "is", "within", "the", "supplied", "max", "file", "size", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/FileUtil.java#L118-L129
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuStringUtil.java
GosuStringUtil.getPrechomp
public static String getPrechomp(String str, String sep) { """ <p>Remove and return everything before the first value of a supplied String from another String.</p> @param str the String to chomp from, must not be null @param sep the String to chomp, must not be null @return String prechomped @throws NullPointerException if str or sep is <code>null</code> @deprecated Use {@link #substringBefore(String,String)} instead (although this doesn't include the separator). Method will be removed in Commons Lang 3.0. """ int idx = str.indexOf(sep); if (idx == -1) { return EMPTY; } return str.substring(0, idx + sep.length()); }
java
public static String getPrechomp(String str, String sep) { int idx = str.indexOf(sep); if (idx == -1) { return EMPTY; } return str.substring(0, idx + sep.length()); }
[ "public", "static", "String", "getPrechomp", "(", "String", "str", ",", "String", "sep", ")", "{", "int", "idx", "=", "str", ".", "indexOf", "(", "sep", ")", ";", "if", "(", "idx", "==", "-", "1", ")", "{", "return", "EMPTY", ";", "}", "return", "str", ".", "substring", "(", "0", ",", "idx", "+", "sep", ".", "length", "(", ")", ")", ";", "}" ]
<p>Remove and return everything before the first value of a supplied String from another String.</p> @param str the String to chomp from, must not be null @param sep the String to chomp, must not be null @return String prechomped @throws NullPointerException if str or sep is <code>null</code> @deprecated Use {@link #substringBefore(String,String)} instead (although this doesn't include the separator). Method will be removed in Commons Lang 3.0.
[ "<p", ">", "Remove", "and", "return", "everything", "before", "the", "first", "value", "of", "a", "supplied", "String", "from", "another", "String", ".", "<", "/", "p", ">" ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuStringUtil.java#L4090-L4096
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java
Director.resolveExistingAssetsFromDirectoryRepo
public boolean resolveExistingAssetsFromDirectoryRepo(Collection<String> featureNames, File repoDir, boolean isOverwrite) throws InstallException { """ Resolves existing assets from a specified directory @param featureNames Collection of feature names to resolve @param repoDir Repository directory to obtain features from @param isOverwrite If features should be overwritten with fresh ones @return @throws InstallException """ return getResolveDirector().resolveExistingAssetsFromDirectoryRepo(featureNames, repoDir, isOverwrite); }
java
public boolean resolveExistingAssetsFromDirectoryRepo(Collection<String> featureNames, File repoDir, boolean isOverwrite) throws InstallException { return getResolveDirector().resolveExistingAssetsFromDirectoryRepo(featureNames, repoDir, isOverwrite); }
[ "public", "boolean", "resolveExistingAssetsFromDirectoryRepo", "(", "Collection", "<", "String", ">", "featureNames", ",", "File", "repoDir", ",", "boolean", "isOverwrite", ")", "throws", "InstallException", "{", "return", "getResolveDirector", "(", ")", ".", "resolveExistingAssetsFromDirectoryRepo", "(", "featureNames", ",", "repoDir", ",", "isOverwrite", ")", ";", "}" ]
Resolves existing assets from a specified directory @param featureNames Collection of feature names to resolve @param repoDir Repository directory to obtain features from @param isOverwrite If features should be overwritten with fresh ones @return @throws InstallException
[ "Resolves", "existing", "assets", "from", "a", "specified", "directory" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/Director.java#L1811-L1813
Alluxio/alluxio
core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java
UfsJournalFile.decodeLogFile
@Nullable static UfsJournalFile decodeLogFile(UfsJournal journal, String filename) { """ Decodes a checkpoint or a log file name into a {@link UfsJournalFile}. @param journal the UFS journal instance @param filename the filename @return the instance of {@link UfsJournalFile}, null if the file invalid """ URI location = URIUtils.appendPathOrDie(journal.getLogDir(), filename); try { String[] parts = filename.split("-"); // There can be temporary files in logs directory. Skip them. if (parts.length != 2) { return null; } long start = Long.decode(parts[0]); long end = Long.decode(parts[1]); return UfsJournalFile.createLogFile(location, start, end); } catch (IllegalStateException e) { LOG.error("Illegal journal file {}.", location); throw e; } catch (NumberFormatException e) { // There can be temporary files (e.g. created for rename). return null; } }
java
@Nullable static UfsJournalFile decodeLogFile(UfsJournal journal, String filename) { URI location = URIUtils.appendPathOrDie(journal.getLogDir(), filename); try { String[] parts = filename.split("-"); // There can be temporary files in logs directory. Skip them. if (parts.length != 2) { return null; } long start = Long.decode(parts[0]); long end = Long.decode(parts[1]); return UfsJournalFile.createLogFile(location, start, end); } catch (IllegalStateException e) { LOG.error("Illegal journal file {}.", location); throw e; } catch (NumberFormatException e) { // There can be temporary files (e.g. created for rename). return null; } }
[ "@", "Nullable", "static", "UfsJournalFile", "decodeLogFile", "(", "UfsJournal", "journal", ",", "String", "filename", ")", "{", "URI", "location", "=", "URIUtils", ".", "appendPathOrDie", "(", "journal", ".", "getLogDir", "(", ")", ",", "filename", ")", ";", "try", "{", "String", "[", "]", "parts", "=", "filename", ".", "split", "(", "\"-\"", ")", ";", "// There can be temporary files in logs directory. Skip them.", "if", "(", "parts", ".", "length", "!=", "2", ")", "{", "return", "null", ";", "}", "long", "start", "=", "Long", ".", "decode", "(", "parts", "[", "0", "]", ")", ";", "long", "end", "=", "Long", ".", "decode", "(", "parts", "[", "1", "]", ")", ";", "return", "UfsJournalFile", ".", "createLogFile", "(", "location", ",", "start", ",", "end", ")", ";", "}", "catch", "(", "IllegalStateException", "e", ")", "{", "LOG", ".", "error", "(", "\"Illegal journal file {}.\"", ",", "location", ")", ";", "throw", "e", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "// There can be temporary files (e.g. created for rename).", "return", "null", ";", "}", "}" ]
Decodes a checkpoint or a log file name into a {@link UfsJournalFile}. @param journal the UFS journal instance @param filename the filename @return the instance of {@link UfsJournalFile}, null if the file invalid
[ "Decodes", "a", "checkpoint", "or", "a", "log", "file", "name", "into", "a", "{", "@link", "UfsJournalFile", "}", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/common/src/main/java/alluxio/master/journal/ufs/UfsJournalFile.java#L150-L170
geomajas/geomajas-project-client-gwt2
impl/src/main/java/org/geomajas/gwt2/client/map/feature/JsonFeatureFactory.java
JsonFeatureFactory.createCollection
public FeatureCollection createCollection(JSONObject jsonObject, FeaturesSupported layer) { """ Create a feature collection for this layer. @param jsonObject @param layer the layer (optional) @return the feature """ FeatureCollection dto = new FeatureCollection(layer); String type = JsonService.getStringValue(jsonObject, "type"); if ("FeatureCollection".equals(type)) { JSONArray features = JsonService.getChildArray(jsonObject, "features"); for (int i = 0; i < features.size(); i++) { dto.getFeatures().add(createFeature((JSONObject) features.get(i), layer)); } } else if ("Feature".equals(type)) { dto.getFeatures().add(createFeature(jsonObject, layer)); } return dto; }
java
public FeatureCollection createCollection(JSONObject jsonObject, FeaturesSupported layer) { FeatureCollection dto = new FeatureCollection(layer); String type = JsonService.getStringValue(jsonObject, "type"); if ("FeatureCollection".equals(type)) { JSONArray features = JsonService.getChildArray(jsonObject, "features"); for (int i = 0; i < features.size(); i++) { dto.getFeatures().add(createFeature((JSONObject) features.get(i), layer)); } } else if ("Feature".equals(type)) { dto.getFeatures().add(createFeature(jsonObject, layer)); } return dto; }
[ "public", "FeatureCollection", "createCollection", "(", "JSONObject", "jsonObject", ",", "FeaturesSupported", "layer", ")", "{", "FeatureCollection", "dto", "=", "new", "FeatureCollection", "(", "layer", ")", ";", "String", "type", "=", "JsonService", ".", "getStringValue", "(", "jsonObject", ",", "\"type\"", ")", ";", "if", "(", "\"FeatureCollection\"", ".", "equals", "(", "type", ")", ")", "{", "JSONArray", "features", "=", "JsonService", ".", "getChildArray", "(", "jsonObject", ",", "\"features\"", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "features", ".", "size", "(", ")", ";", "i", "++", ")", "{", "dto", ".", "getFeatures", "(", ")", ".", "add", "(", "createFeature", "(", "(", "JSONObject", ")", "features", ".", "get", "(", "i", ")", ",", "layer", ")", ")", ";", "}", "}", "else", "if", "(", "\"Feature\"", ".", "equals", "(", "type", ")", ")", "{", "dto", ".", "getFeatures", "(", ")", ".", "add", "(", "createFeature", "(", "jsonObject", ",", "layer", ")", ")", ";", "}", "return", "dto", ";", "}" ]
Create a feature collection for this layer. @param jsonObject @param layer the layer (optional) @return the feature
[ "Create", "a", "feature", "collection", "for", "this", "layer", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/map/feature/JsonFeatureFactory.java#L44-L56
code4everything/util
src/main/java/com/zhazhapan/util/office/MsWordUtils.java
MsWordUtils.appendImage
public static void appendImage(XWPFRun run, String imagePath, int pictureType, int width, int height) throws IOException, InvalidFormatException { """ 添加一张图片 @param run {@link XWPFRun} @param imagePath 图片路径 @param pictureType 图片类型 @param width 宽度 @param height 长度 @throws IOException 异常 @throws InvalidFormatException 异常 """ InputStream input = new FileInputStream(imagePath); run.addPicture(input, pictureType, imagePath, Units.toEMU(width), Units.toEMU(height)); }
java
public static void appendImage(XWPFRun run, String imagePath, int pictureType, int width, int height) throws IOException, InvalidFormatException { InputStream input = new FileInputStream(imagePath); run.addPicture(input, pictureType, imagePath, Units.toEMU(width), Units.toEMU(height)); }
[ "public", "static", "void", "appendImage", "(", "XWPFRun", "run", ",", "String", "imagePath", ",", "int", "pictureType", ",", "int", "width", ",", "int", "height", ")", "throws", "IOException", ",", "InvalidFormatException", "{", "InputStream", "input", "=", "new", "FileInputStream", "(", "imagePath", ")", ";", "run", ".", "addPicture", "(", "input", ",", "pictureType", ",", "imagePath", ",", "Units", ".", "toEMU", "(", "width", ")", ",", "Units", ".", "toEMU", "(", "height", ")", ")", ";", "}" ]
添加一张图片 @param run {@link XWPFRun} @param imagePath 图片路径 @param pictureType 图片类型 @param width 宽度 @param height 长度 @throws IOException 异常 @throws InvalidFormatException 异常
[ "添加一张图片" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/office/MsWordUtils.java#L73-L77
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteConnectionPool.java
SQLiteConnectionPool.acquireConnection
public SQLiteConnection acquireConnection(String sql, int connectionFlags, CancellationSignal cancellationSignal) { """ Acquires a connection from the pool. <p> The caller must call {@link #releaseConnection} to release the connection back to the pool when it is finished. Failure to do so will result in much unpleasantness. </p> @param sql If not null, try to find a connection that already has the specified SQL statement in its prepared statement cache. @param connectionFlags The connection request flags. @param cancellationSignal A signal to cancel the operation in progress, or null if none. @return The connection that was acquired, never null. @throws IllegalStateException if the pool has been closed. @throws SQLiteException if a database error occurs. @throws OperationCanceledException if the operation was canceled. """ return waitForConnection(sql, connectionFlags, cancellationSignal); }
java
public SQLiteConnection acquireConnection(String sql, int connectionFlags, CancellationSignal cancellationSignal) { return waitForConnection(sql, connectionFlags, cancellationSignal); }
[ "public", "SQLiteConnection", "acquireConnection", "(", "String", "sql", ",", "int", "connectionFlags", ",", "CancellationSignal", "cancellationSignal", ")", "{", "return", "waitForConnection", "(", "sql", ",", "connectionFlags", ",", "cancellationSignal", ")", ";", "}" ]
Acquires a connection from the pool. <p> The caller must call {@link #releaseConnection} to release the connection back to the pool when it is finished. Failure to do so will result in much unpleasantness. </p> @param sql If not null, try to find a connection that already has the specified SQL statement in its prepared statement cache. @param connectionFlags The connection request flags. @param cancellationSignal A signal to cancel the operation in progress, or null if none. @return The connection that was acquired, never null. @throws IllegalStateException if the pool has been closed. @throws SQLiteException if a database error occurs. @throws OperationCanceledException if the operation was canceled.
[ "Acquires", "a", "connection", "from", "the", "pool", ".", "<p", ">", "The", "caller", "must", "call", "{", "@link", "#releaseConnection", "}", "to", "release", "the", "connection", "back", "to", "the", "pool", "when", "it", "is", "finished", ".", "Failure", "to", "do", "so", "will", "result", "in", "much", "unpleasantness", ".", "<", "/", "p", ">" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/sqlite/SQLiteConnectionPool.java#L349-L352
cdapio/tigon
tigon-flow/src/main/java/co/cask/tigon/internal/app/SchemaFinder.java
SchemaFinder.checkSchema
public static boolean checkSchema(Set<Schema> output, Set<Schema> input) { """ Given two schema's checks if there exists compatibility or equality. @param output Set of output {@link Schema}. @param input Set of input {@link Schema}. @return true if and only if they are equal or compatible with constraints """ return findSchema(output, input) != null; }
java
public static boolean checkSchema(Set<Schema> output, Set<Schema> input) { return findSchema(output, input) != null; }
[ "public", "static", "boolean", "checkSchema", "(", "Set", "<", "Schema", ">", "output", ",", "Set", "<", "Schema", ">", "input", ")", "{", "return", "findSchema", "(", "output", ",", "input", ")", "!=", "null", ";", "}" ]
Given two schema's checks if there exists compatibility or equality. @param output Set of output {@link Schema}. @param input Set of input {@link Schema}. @return true if and only if they are equal or compatible with constraints
[ "Given", "two", "schema", "s", "checks", "if", "there", "exists", "compatibility", "or", "equality", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/SchemaFinder.java#L37-L39
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java
DataSet.setOutcome
@Override public void setOutcome(int example, int label) { """ Sets the outcome of a particular example @param example the example to transform @param label the label of the outcome """ if (example > numExamples()) throw new IllegalArgumentException("No example at " + example); if (label > numOutcomes() || label < 0) throw new IllegalArgumentException("Illegal label"); INDArray outcome = FeatureUtil.toOutcomeVector(label, numOutcomes()); getLabels().putRow(example, outcome); }
java
@Override public void setOutcome(int example, int label) { if (example > numExamples()) throw new IllegalArgumentException("No example at " + example); if (label > numOutcomes() || label < 0) throw new IllegalArgumentException("Illegal label"); INDArray outcome = FeatureUtil.toOutcomeVector(label, numOutcomes()); getLabels().putRow(example, outcome); }
[ "@", "Override", "public", "void", "setOutcome", "(", "int", "example", ",", "int", "label", ")", "{", "if", "(", "example", ">", "numExamples", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"No example at \"", "+", "example", ")", ";", "if", "(", "label", ">", "numOutcomes", "(", ")", "||", "label", "<", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Illegal label\"", ")", ";", "INDArray", "outcome", "=", "FeatureUtil", ".", "toOutcomeVector", "(", "label", ",", "numOutcomes", "(", ")", ")", ";", "getLabels", "(", ")", ".", "putRow", "(", "example", ",", "outcome", ")", ";", "}" ]
Sets the outcome of a particular example @param example the example to transform @param label the label of the outcome
[ "Sets", "the", "outcome", "of", "a", "particular", "example" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/DataSet.java#L624-L633
cloudendpoints/endpoints-management-java
endpoints-control/src/main/java/com/google/api/control/aggregator/CheckAggregationOptions.java
CheckAggregationOptions.createCache
@Nullable public <T> Cache<String, T> createCache(ConcurrentLinkedDeque<T> out) { """ Creates a {@link Cache} configured by this instance. @param <T> the type of the instance being cached @param out a concurrent {@code Deque} to which previously cached items are added as they expire @return a {@link Cache} corresponding to this instance's values or {@code null} unless {@link #numEntries} is positive. """ return createCache(out, Ticker.systemTicker()); }
java
@Nullable public <T> Cache<String, T> createCache(ConcurrentLinkedDeque<T> out) { return createCache(out, Ticker.systemTicker()); }
[ "@", "Nullable", "public", "<", "T", ">", "Cache", "<", "String", ",", "T", ">", "createCache", "(", "ConcurrentLinkedDeque", "<", "T", ">", "out", ")", "{", "return", "createCache", "(", "out", ",", "Ticker", ".", "systemTicker", "(", ")", ")", ";", "}" ]
Creates a {@link Cache} configured by this instance. @param <T> the type of the instance being cached @param out a concurrent {@code Deque} to which previously cached items are added as they expire @return a {@link Cache} corresponding to this instance's values or {@code null} unless {@link #numEntries} is positive.
[ "Creates", "a", "{", "@link", "Cache", "}", "configured", "by", "this", "instance", "." ]
train
https://github.com/cloudendpoints/endpoints-management-java/blob/5bbf20ddadbbd51b890049e3c338c28abe2c9f94/endpoints-control/src/main/java/com/google/api/control/aggregator/CheckAggregationOptions.java#L124-L127
xdcrafts/flower
flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java
MapDotApi.dotGetStringUnsafe
public static String dotGetStringUnsafe(final Map map, final String pathString) { """ Get string value by path. @param map subject @param pathString nodes to walk in map @return value """ return dotGetUnsafe(map, String.class, pathString); }
java
public static String dotGetStringUnsafe(final Map map, final String pathString) { return dotGetUnsafe(map, String.class, pathString); }
[ "public", "static", "String", "dotGetStringUnsafe", "(", "final", "Map", "map", ",", "final", "String", "pathString", ")", "{", "return", "dotGetUnsafe", "(", "map", ",", "String", ".", "class", ",", "pathString", ")", ";", "}" ]
Get string value by path. @param map subject @param pathString nodes to walk in map @return value
[ "Get", "string", "value", "by", "path", "." ]
train
https://github.com/xdcrafts/flower/blob/96a8e49102fea434bd383a3c7852f0ee9545f999/flower-tools/src/main/java/com/github/xdcrafts/flower/tools/map/MapDotApi.java#L156-L158