repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java
ExcelSaxUtil.formatCellContent
public static String formatCellContent(String value, int numFmtIndex, String numFmtString) { if (null != numFmtString) { try { value = new DataFormatter().formatRawCellContents(Double.parseDouble(value), numFmtIndex, numFmtString); } catch (NumberFormatException e) { // ignore } } return value; }
java
public static String formatCellContent(String value, int numFmtIndex, String numFmtString) { if (null != numFmtString) { try { value = new DataFormatter().formatRawCellContents(Double.parseDouble(value), numFmtIndex, numFmtString); } catch (NumberFormatException e) { // ignore } } return value; }
[ "public", "static", "String", "formatCellContent", "(", "String", "value", ",", "int", "numFmtIndex", ",", "String", "numFmtString", ")", "{", "if", "(", "null", "!=", "numFmtString", ")", "{", "try", "{", "value", "=", "new", "DataFormatter", "(", ")", "....
格式化数字或日期值 @param value 值 @param numFmtIndex 数字格式索引 @param numFmtString 数字格式名 @return 格式化后的值
[ "格式化数字或日期值" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/ExcelSaxUtil.java#L85-L94
badamowicz/sonar-hla
sonar-hla-maven-plugin/src/main/java/com/github/badamowicz/sonar/hla/plugin/helper/LogHelper.java
LogHelper.logCSV
public static void logCSV(String csvData, final Logger log) { log.info(""); log.info("**** Here we go with CSV:"); log.info(""); log.info(csvData); log.info(""); log.info("**** End of CSV data. Have a nice day!"); log.info(""); LogHelper.moo(log); }
java
public static void logCSV(String csvData, final Logger log) { log.info(""); log.info("**** Here we go with CSV:"); log.info(""); log.info(csvData); log.info(""); log.info("**** End of CSV data. Have a nice day!"); log.info(""); LogHelper.moo(log); }
[ "public", "static", "void", "logCSV", "(", "String", "csvData", ",", "final", "Logger", "log", ")", "{", "log", ".", "info", "(", "\"\"", ")", ";", "log", ".", "info", "(", "\"**** Here we go with CSV:\"", ")", ";", "log", ".", "info", "(", "\"\"", ")"...
Log CSV data with some additional information. @param csvData A string expected to contain CSV data. Actually no checks are done if this is really CSV. @param log A {@link Logger} which will be used for output.
[ "Log", "CSV", "data", "with", "some", "additional", "information", "." ]
train
https://github.com/badamowicz/sonar-hla/blob/21bd8a853d81966b47e96b518430abbc07ccd5f3/sonar-hla-maven-plugin/src/main/java/com/github/badamowicz/sonar/hla/plugin/helper/LogHelper.java#L73-L83
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_mailingList_name_DELETE
public OvhTaskMl domain_mailingList_name_DELETE(String domain, String name) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}"; StringBuilder sb = path(qPath, domain, name); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTaskMl.class); }
java
public OvhTaskMl domain_mailingList_name_DELETE(String domain, String name) throws IOException { String qPath = "/email/domain/{domain}/mailingList/{name}"; StringBuilder sb = path(qPath, domain, name); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTaskMl.class); }
[ "public", "OvhTaskMl", "domain_mailingList_name_DELETE", "(", "String", "domain", ",", "String", "name", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/mailingList/{name}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ...
Delete existing Mailing list REST: DELETE /email/domain/{domain}/mailingList/{name} @param domain [required] Name of your domain name @param name [required] Name of mailing list
[ "Delete", "existing", "Mailing", "list" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L1554-L1559
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/RaidUtils.java
RaidUtils.sourcePathFromParityPath
public static Path sourcePathFromParityPath(Path parityPath, FileSystem fs) throws IOException { String parityPathStr = parityPath.toUri().getPath(); for (Codec codec : Codec.getCodecs()) { String prefix = codec.getParityPrefix(); if (parityPathStr.startsWith(prefix)) { // Remove the prefix to get the source file. String src = parityPathStr.replaceFirst(prefix, Path.SEPARATOR); Path srcPath = new Path(src); if (fs.exists(srcPath)) { return srcPath; } } } return null; }
java
public static Path sourcePathFromParityPath(Path parityPath, FileSystem fs) throws IOException { String parityPathStr = parityPath.toUri().getPath(); for (Codec codec : Codec.getCodecs()) { String prefix = codec.getParityPrefix(); if (parityPathStr.startsWith(prefix)) { // Remove the prefix to get the source file. String src = parityPathStr.replaceFirst(prefix, Path.SEPARATOR); Path srcPath = new Path(src); if (fs.exists(srcPath)) { return srcPath; } } } return null; }
[ "public", "static", "Path", "sourcePathFromParityPath", "(", "Path", "parityPath", ",", "FileSystem", "fs", ")", "throws", "IOException", "{", "String", "parityPathStr", "=", "parityPath", ".", "toUri", "(", ")", ".", "getPath", "(", ")", ";", "for", "(", "C...
returns the source file corresponding to a parity file @throws IOException
[ "returns", "the", "source", "file", "corresponding", "to", "a", "parity", "file" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/RaidUtils.java#L375-L390
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/proxy/SessionHolder.java
SessionHolder.doProcess
public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties) throws RemoteException { String strCommand = this.getProperty(REMOTE_COMMAND, properties); if (GET_REMOTE_TABLE.equals(strCommand)) { String strName = this.getNextStringParam(in, NAME, properties); RemoteTable remoteTable = ((RemoteSession)m_remoteObject).getRemoteTable(strName); // First, see if this is in my list already? String strID = this.find(remoteTable); if (strID == null) strID = this.add(new TableHolder(this, remoteTable)); this.setReturnString(out, strID); } else if (SETUP_REMOTE_SESSION_FILTER.equals(strCommand)) { org.jbundle.thin.base.message.BaseMessageFilter filter = (org.jbundle.thin.base.message.BaseMessageFilter)this.getNextObjectParam(in, FILTER, properties); filter = ((RemoteSession)m_remoteObject).setupRemoteSessionFilter(filter); this.setReturnObject(out, filter); } else super.doProcess(in, out, properties); }
java
public void doProcess(InputStream in, PrintWriter out, Map<String, Object> properties) throws RemoteException { String strCommand = this.getProperty(REMOTE_COMMAND, properties); if (GET_REMOTE_TABLE.equals(strCommand)) { String strName = this.getNextStringParam(in, NAME, properties); RemoteTable remoteTable = ((RemoteSession)m_remoteObject).getRemoteTable(strName); // First, see if this is in my list already? String strID = this.find(remoteTable); if (strID == null) strID = this.add(new TableHolder(this, remoteTable)); this.setReturnString(out, strID); } else if (SETUP_REMOTE_SESSION_FILTER.equals(strCommand)) { org.jbundle.thin.base.message.BaseMessageFilter filter = (org.jbundle.thin.base.message.BaseMessageFilter)this.getNextObjectParam(in, FILTER, properties); filter = ((RemoteSession)m_remoteObject).setupRemoteSessionFilter(filter); this.setReturnObject(out, filter); } else super.doProcess(in, out, properties); }
[ "public", "void", "doProcess", "(", "InputStream", "in", ",", "PrintWriter", "out", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "RemoteException", "{", "String", "strCommand", "=", "this", ".", "getProperty", "(", "REMOTE_COMMAN...
Handle the command send from my client peer. @param in The (optional) Inputstream to get the params from. @param out The stream to write the results.
[ "Handle", "the", "command", "send", "from", "my", "client", "peer", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/SessionHolder.java#L60-L82
Azure/azure-sdk-for-java
mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java
SpatialAnchorsAccountsInner.regenerateKeys
public SpatialAnchorsAccountKeysInner regenerateKeys(String resourceGroupName, String spatialAnchorsAccountName, Integer serial) { return regenerateKeysWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, serial).toBlocking().single().body(); }
java
public SpatialAnchorsAccountKeysInner regenerateKeys(String resourceGroupName, String spatialAnchorsAccountName, Integer serial) { return regenerateKeysWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName, serial).toBlocking().single().body(); }
[ "public", "SpatialAnchorsAccountKeysInner", "regenerateKeys", "(", "String", "resourceGroupName", ",", "String", "spatialAnchorsAccountName", ",", "Integer", "serial", ")", "{", "return", "regenerateKeysWithServiceResponseAsync", "(", "resourceGroupName", ",", "spatialAnchorsAc...
Regenerate 1 Key of a Spatial Anchors Account. @param resourceGroupName Name of an Azure resource group. @param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account. @param serial serial of key to be regenerated @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SpatialAnchorsAccountKeysInner object if successful.
[ "Regenerate", "1", "Key", "of", "a", "Spatial", "Anchors", "Account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java#L874-L876
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.getMethodByName
public static Method getMethodByName(Class<?> clazz, boolean ignoreCase, String methodName) throws SecurityException { if (null == clazz || StrUtil.isBlank(methodName)) { return null; } final Method[] methods = getMethods(clazz); if (ArrayUtil.isNotEmpty(methods)) { for (Method method : methods) { if (StrUtil.equals(methodName, method.getName(), ignoreCase)) { return method; } } } return null; }
java
public static Method getMethodByName(Class<?> clazz, boolean ignoreCase, String methodName) throws SecurityException { if (null == clazz || StrUtil.isBlank(methodName)) { return null; } final Method[] methods = getMethods(clazz); if (ArrayUtil.isNotEmpty(methods)) { for (Method method : methods) { if (StrUtil.equals(methodName, method.getName(), ignoreCase)) { return method; } } } return null; }
[ "public", "static", "Method", "getMethodByName", "(", "Class", "<", "?", ">", "clazz", ",", "boolean", "ignoreCase", ",", "String", "methodName", ")", "throws", "SecurityException", "{", "if", "(", "null", "==", "clazz", "||", "StrUtil", ".", "isBlank", "(",...
按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code>null</code> <p> 此方法只检查方法名是否一致,并不检查参数的一致性。 </p> @param clazz 类,如果为{@code null}返回{@code null} @param ignoreCase 是否忽略大小写 @param methodName 方法名,如果为空字符串返回{@code null} @return 方法 @throws SecurityException 无权访问抛出异常 @since 4.3.2
[ "按照方法名查找指定方法名的方法,只返回匹配到的第一个方法,如果找不到对应的方法则返回<code", ">", "null<", "/", "code", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L516-L530
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java
TimeZoneFormat.parseShortZoneID
private static String parseShortZoneID(String text, ParsePosition pos) { String resolvedID = null; if (SHORT_ZONE_ID_TRIE == null) { synchronized (TimeZoneFormat.class) { if (SHORT_ZONE_ID_TRIE == null) { // Build short zone ID trie TextTrieMap<String> trie = new TextTrieMap<String>(true); Set<String> canonicalIDs = TimeZone.getAvailableIDs(SystemTimeZoneType.CANONICAL, null, null); for (String id : canonicalIDs) { String shortID = ZoneMeta.getShortID(id); if (shortID != null) { trie.put(shortID, id); } } // Canonical list does not contain Etc/Unknown trie.put(UNKNOWN_SHORT_ZONE_ID, UNKNOWN_ZONE_ID); SHORT_ZONE_ID_TRIE = trie; } } } int[] matchLen = new int[] {0}; Iterator<String> itr = SHORT_ZONE_ID_TRIE.get(text, pos.getIndex(), matchLen); if (itr != null) { resolvedID = itr.next(); pos.setIndex(pos.getIndex() + matchLen[0]); } else { pos.setErrorIndex(pos.getIndex()); } return resolvedID; }
java
private static String parseShortZoneID(String text, ParsePosition pos) { String resolvedID = null; if (SHORT_ZONE_ID_TRIE == null) { synchronized (TimeZoneFormat.class) { if (SHORT_ZONE_ID_TRIE == null) { // Build short zone ID trie TextTrieMap<String> trie = new TextTrieMap<String>(true); Set<String> canonicalIDs = TimeZone.getAvailableIDs(SystemTimeZoneType.CANONICAL, null, null); for (String id : canonicalIDs) { String shortID = ZoneMeta.getShortID(id); if (shortID != null) { trie.put(shortID, id); } } // Canonical list does not contain Etc/Unknown trie.put(UNKNOWN_SHORT_ZONE_ID, UNKNOWN_ZONE_ID); SHORT_ZONE_ID_TRIE = trie; } } } int[] matchLen = new int[] {0}; Iterator<String> itr = SHORT_ZONE_ID_TRIE.get(text, pos.getIndex(), matchLen); if (itr != null) { resolvedID = itr.next(); pos.setIndex(pos.getIndex() + matchLen[0]); } else { pos.setErrorIndex(pos.getIndex()); } return resolvedID; }
[ "private", "static", "String", "parseShortZoneID", "(", "String", "text", ",", "ParsePosition", "pos", ")", "{", "String", "resolvedID", "=", "null", ";", "if", "(", "SHORT_ZONE_ID_TRIE", "==", "null", ")", "{", "synchronized", "(", "TimeZoneFormat", ".", "cla...
Parse a short zone ID. @param text the text contains a time zone ID string at the position. @param pos the position. @return The zone ID for the parsed short zone ID.
[ "Parse", "a", "short", "zone", "ID", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2966-L2997
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.writeConfigFile
public static void writeConfigFile(String fileName, boolean sortClasses) throws SQLException, IOException { List<Class<?>> classList = new ArrayList<Class<?>>(); findAnnotatedClasses(classList, new File("."), 0); writeConfigFile(fileName, classList.toArray(new Class[classList.size()]), sortClasses); }
java
public static void writeConfigFile(String fileName, boolean sortClasses) throws SQLException, IOException { List<Class<?>> classList = new ArrayList<Class<?>>(); findAnnotatedClasses(classList, new File("."), 0); writeConfigFile(fileName, classList.toArray(new Class[classList.size()]), sortClasses); }
[ "public", "static", "void", "writeConfigFile", "(", "String", "fileName", ",", "boolean", "sortClasses", ")", "throws", "SQLException", ",", "IOException", "{", "List", "<", "Class", "<", "?", ">", ">", "classList", "=", "new", "ArrayList", "<", "Class", "<"...
Finds the annotated classes in the current directory or below and writes a configuration file to the file-name in the raw folder. @param sortClasses Set to true to sort the classes by name before the file is generated.
[ "Finds", "the", "annotated", "classes", "in", "the", "current", "directory", "or", "below", "and", "writes", "a", "configuration", "file", "to", "the", "file", "-", "name", "in", "the", "raw", "folder", "." ]
train
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L115-L119
aws/aws-sdk-java
aws-java-sdk-discovery/src/main/java/com/amazonaws/services/applicationdiscovery/model/StartContinuousExportResult.java
StartContinuousExportResult.withSchemaStorageConfig
public StartContinuousExportResult withSchemaStorageConfig(java.util.Map<String, String> schemaStorageConfig) { setSchemaStorageConfig(schemaStorageConfig); return this; }
java
public StartContinuousExportResult withSchemaStorageConfig(java.util.Map<String, String> schemaStorageConfig) { setSchemaStorageConfig(schemaStorageConfig); return this; }
[ "public", "StartContinuousExportResult", "withSchemaStorageConfig", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "schemaStorageConfig", ")", "{", "setSchemaStorageConfig", "(", "schemaStorageConfig", ")", ";", "return", "this", ";", "}" ]
<p> A dictionary which describes how the data is stored. </p> <ul> <li> <p> <code>databaseName</code> - the name of the Glue database used to store the schema. </p> </li> </ul> @param schemaStorageConfig A dictionary which describes how the data is stored.</p> <ul> <li> <p> <code>databaseName</code> - the name of the Glue database used to store the schema. </p> </li> @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "dictionary", "which", "describes", "how", "the", "data", "is", "stored", ".", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<p", ">", "<code", ">", "databaseName<", "/", "code", ">", "-", "the", "name", "of", "the", "Glue", "databas...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-discovery/src/main/java/com/amazonaws/services/applicationdiscovery/model/StartContinuousExportResult.java#L312-L315
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/FailoverStrategyLoader.java
FailoverStrategyLoader.loadFailoverStrategy
public static FailoverStrategy.Factory loadFailoverStrategy(Configuration config, @Nullable Logger logger) { final String strategyParam = config.getString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY); if (StringUtils.isNullOrWhitespaceOnly(strategyParam)) { if (logger != null) { logger.warn("Null config value for {} ; using default failover strategy (full restarts).", JobManagerOptions.EXECUTION_FAILOVER_STRATEGY.key()); } return new RestartAllStrategy.Factory(); } else { switch (strategyParam.toLowerCase()) { case FULL_RESTART_STRATEGY_NAME: return new RestartAllStrategy.Factory(); case PIPELINED_REGION_RESTART_STRATEGY_NAME: return new RestartPipelinedRegionStrategy.Factory(); case INDIVIDUAL_RESTART_STRATEGY_NAME: return new RestartIndividualStrategy.Factory(); default: // we could interpret the parameter as a factory class name and instantiate that // for now we simply do not support this throw new IllegalConfigurationException("Unknown failover strategy: " + strategyParam); } } }
java
public static FailoverStrategy.Factory loadFailoverStrategy(Configuration config, @Nullable Logger logger) { final String strategyParam = config.getString(JobManagerOptions.EXECUTION_FAILOVER_STRATEGY); if (StringUtils.isNullOrWhitespaceOnly(strategyParam)) { if (logger != null) { logger.warn("Null config value for {} ; using default failover strategy (full restarts).", JobManagerOptions.EXECUTION_FAILOVER_STRATEGY.key()); } return new RestartAllStrategy.Factory(); } else { switch (strategyParam.toLowerCase()) { case FULL_RESTART_STRATEGY_NAME: return new RestartAllStrategy.Factory(); case PIPELINED_REGION_RESTART_STRATEGY_NAME: return new RestartPipelinedRegionStrategy.Factory(); case INDIVIDUAL_RESTART_STRATEGY_NAME: return new RestartIndividualStrategy.Factory(); default: // we could interpret the parameter as a factory class name and instantiate that // for now we simply do not support this throw new IllegalConfigurationException("Unknown failover strategy: " + strategyParam); } } }
[ "public", "static", "FailoverStrategy", ".", "Factory", "loadFailoverStrategy", "(", "Configuration", "config", ",", "@", "Nullable", "Logger", "logger", ")", "{", "final", "String", "strategyParam", "=", "config", ".", "getString", "(", "JobManagerOptions", ".", ...
Loads a FailoverStrategy Factory from the given configuration.
[ "Loads", "a", "FailoverStrategy", "Factory", "from", "the", "given", "configuration", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/failover/FailoverStrategyLoader.java#L49-L77
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/StatementDML.java
StatementDML.voltGetStatementXML
@Override VoltXMLElement voltGetStatementXML(Session session) throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException { VoltXMLElement xml; switch (type) { case StatementTypes.INSERT : xml = new VoltXMLElement("insert"); assert(insertExpression != null || queryExpression != null); if (queryExpression == null) { if (insertExpression.nodes.length > 1) { throw new org.hsqldb_voltpatches.HSQLInterface.HSQLParseException( "VoltDB does not support multiple rows in the INSERT statement VALUES clause. Use separate INSERT statements."); } voltAppendTargetColumns(session, insertColumnMap, insertExpression.nodes[0].nodes, xml); } else { voltAppendTargetColumns(session, insertColumnMap, null, xml); VoltXMLElement child = voltGetXMLExpression(queryExpression, parameters, session); xml.children.add(child); } break; case StatementTypes.UPDATE_CURSOR : case StatementTypes.UPDATE_WHERE : xml = new VoltXMLElement("update"); voltAppendTargetColumns(session, updateColumnMap, updateExpressions, xml); voltAppendChildScans(session, xml); voltAppendCondition(session, xml); break; case StatementTypes.DELETE_CURSOR : case StatementTypes.DELETE_WHERE : xml = new VoltXMLElement("delete"); // DELETE has no target columns voltAppendChildScans(session, xml); voltAppendCondition(session, xml); voltAppendSortAndSlice(session, xml); break; case StatementTypes.MIGRATE_WHERE : xml = new VoltXMLElement("migrate"); voltAppendChildScans(session, xml); voltAppendCondition(session, xml); break; default: throw new org.hsqldb_voltpatches.HSQLInterface.HSQLParseException( "VoltDB does not support DML statements of type " + type); } voltAppendParameters(session, xml, parameters); xml.attributes.put("table", targetTable.getName().name); return xml; }
java
@Override VoltXMLElement voltGetStatementXML(Session session) throws org.hsqldb_voltpatches.HSQLInterface.HSQLParseException { VoltXMLElement xml; switch (type) { case StatementTypes.INSERT : xml = new VoltXMLElement("insert"); assert(insertExpression != null || queryExpression != null); if (queryExpression == null) { if (insertExpression.nodes.length > 1) { throw new org.hsqldb_voltpatches.HSQLInterface.HSQLParseException( "VoltDB does not support multiple rows in the INSERT statement VALUES clause. Use separate INSERT statements."); } voltAppendTargetColumns(session, insertColumnMap, insertExpression.nodes[0].nodes, xml); } else { voltAppendTargetColumns(session, insertColumnMap, null, xml); VoltXMLElement child = voltGetXMLExpression(queryExpression, parameters, session); xml.children.add(child); } break; case StatementTypes.UPDATE_CURSOR : case StatementTypes.UPDATE_WHERE : xml = new VoltXMLElement("update"); voltAppendTargetColumns(session, updateColumnMap, updateExpressions, xml); voltAppendChildScans(session, xml); voltAppendCondition(session, xml); break; case StatementTypes.DELETE_CURSOR : case StatementTypes.DELETE_WHERE : xml = new VoltXMLElement("delete"); // DELETE has no target columns voltAppendChildScans(session, xml); voltAppendCondition(session, xml); voltAppendSortAndSlice(session, xml); break; case StatementTypes.MIGRATE_WHERE : xml = new VoltXMLElement("migrate"); voltAppendChildScans(session, xml); voltAppendCondition(session, xml); break; default: throw new org.hsqldb_voltpatches.HSQLInterface.HSQLParseException( "VoltDB does not support DML statements of type " + type); } voltAppendParameters(session, xml, parameters); xml.attributes.put("table", targetTable.getName().name); return xml; }
[ "@", "Override", "VoltXMLElement", "voltGetStatementXML", "(", "Session", "session", ")", "throws", "org", ".", "hsqldb_voltpatches", ".", "HSQLInterface", ".", "HSQLParseException", "{", "VoltXMLElement", "xml", ";", "switch", "(", "type", ")", "{", "case", "Stat...
VoltDB added method to get a non-catalog-dependent representation of this HSQLDB object. @param session The current Session object may be needed to resolve some names. @return XML, correctly indented, representing this object. @throws HSQLParseException
[ "VoltDB", "added", "method", "to", "get", "a", "non", "-", "catalog", "-", "dependent", "representation", "of", "this", "HSQLDB", "object", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/StatementDML.java#L1395-L1451
wanglinsong/th-lipermi
src/main/java/net/sf/lipermi/handler/CallProxy.java
CallProxy.invoke
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return connectionHandler.remoteInvocation(proxy, method, args); }
java
@Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { return connectionHandler.remoteInvocation(proxy, method, args); }
[ "@", "Override", "public", "Object", "invoke", "(", "Object", "proxy", ",", "Method", "method", ",", "Object", "[", "]", "args", ")", "throws", "Throwable", "{", "return", "connectionHandler", ".", "remoteInvocation", "(", "proxy", ",", "method", ",", "args"...
Delegates call to this proxy to it's ConnectionHandler @throws java.lang.Throwable any error
[ "Delegates", "call", "to", "this", "proxy", "to", "it", "s", "ConnectionHandler" ]
train
https://github.com/wanglinsong/th-lipermi/blob/5fa9ab1d7085b5133dc37ce3ba201d44a7bf25f0/src/main/java/net/sf/lipermi/handler/CallProxy.java#L58-L61
OpenLiberty/open-liberty
dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java
PartitionedStepControllerImpl.validatePlanNumberOfPartitions
private void validatePlanNumberOfPartitions(PartitionPlanDescriptor currentPlan) { int numPreviousPartitions = getTopLevelStepInstance().getPartitionPlanSize(); int numCurrentPartitions = currentPlan.getNumPartitionsInPlan(); if (logger.isLoggable(Level.FINE)) { logger.fine("For step: " + getStepName() + ", previous num partitions = " + numPreviousPartitions + ", and current num partitions = " + numCurrentPartitions); } if (executionType == ExecutionType.RESTART_NORMAL) { if (numPreviousPartitions == EntityConstants.PARTITION_PLAN_SIZE_UNINITIALIZED) { logger.fine("For step: " + getStepName() + ", previous num partitions has not been initialized, so don't validate the current plan size against it"); } else if (numCurrentPartitions != numPreviousPartitions) { throw new IllegalArgumentException("Partition not configured for override, and previous execution used " + numPreviousPartitions + " number of partitions, while current plan uses a different number: " + numCurrentPartitions); } } if (numCurrentPartitions < 1) { throw new IllegalArgumentException("Partition plan size is calculated as " + numCurrentPartitions + ", but at least one partition is needed."); } }
java
private void validatePlanNumberOfPartitions(PartitionPlanDescriptor currentPlan) { int numPreviousPartitions = getTopLevelStepInstance().getPartitionPlanSize(); int numCurrentPartitions = currentPlan.getNumPartitionsInPlan(); if (logger.isLoggable(Level.FINE)) { logger.fine("For step: " + getStepName() + ", previous num partitions = " + numPreviousPartitions + ", and current num partitions = " + numCurrentPartitions); } if (executionType == ExecutionType.RESTART_NORMAL) { if (numPreviousPartitions == EntityConstants.PARTITION_PLAN_SIZE_UNINITIALIZED) { logger.fine("For step: " + getStepName() + ", previous num partitions has not been initialized, so don't validate the current plan size against it"); } else if (numCurrentPartitions != numPreviousPartitions) { throw new IllegalArgumentException("Partition not configured for override, and previous execution used " + numPreviousPartitions + " number of partitions, while current plan uses a different number: " + numCurrentPartitions); } } if (numCurrentPartitions < 1) { throw new IllegalArgumentException("Partition plan size is calculated as " + numCurrentPartitions + ", but at least one partition is needed."); } }
[ "private", "void", "validatePlanNumberOfPartitions", "(", "PartitionPlanDescriptor", "currentPlan", ")", "{", "int", "numPreviousPartitions", "=", "getTopLevelStepInstance", "(", ")", ".", "getPartitionPlanSize", "(", ")", ";", "int", "numCurrentPartitions", "=", "current...
Verify the number of partitions in the plan makes sense. @throws IllegalArgumentException if it doesn't make sense.
[ "Verify", "the", "number", "of", "partitions", "in", "the", "plan", "makes", "sense", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.jbatch.container/src/com/ibm/jbatch/container/controller/impl/PartitionedStepControllerImpl.java#L465-L486
weld/core
impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java
WeldConfiguration.processKeyValue
private void processKeyValue(Map<ConfigurationKey, Object> properties, ConfigurationKey key, Object value) { if (value instanceof String) { value = key.convertValue((String) value); } if (key.isValidValue(value)) { Object previous = properties.put(key, value); if (previous != null && !previous.equals(value)) { throw ConfigurationLogger.LOG.configurationKeyHasDifferentValues(key.get(), previous, value); } } else { throw ConfigurationLogger.LOG.invalidConfigurationPropertyValue(value, key.get()); } }
java
private void processKeyValue(Map<ConfigurationKey, Object> properties, ConfigurationKey key, Object value) { if (value instanceof String) { value = key.convertValue((String) value); } if (key.isValidValue(value)) { Object previous = properties.put(key, value); if (previous != null && !previous.equals(value)) { throw ConfigurationLogger.LOG.configurationKeyHasDifferentValues(key.get(), previous, value); } } else { throw ConfigurationLogger.LOG.invalidConfigurationPropertyValue(value, key.get()); } }
[ "private", "void", "processKeyValue", "(", "Map", "<", "ConfigurationKey", ",", "Object", ">", "properties", ",", "ConfigurationKey", "key", ",", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "String", ")", "{", "value", "=", "key", ".", "...
Process the given key and value. First validate the value and check if there's no different value for the same key in the same source - invalid and different values are treated as a deployment problem. @param properties @param key @param value
[ "Process", "the", "given", "key", "and", "value", ".", "First", "validate", "the", "value", "and", "check", "if", "there", "s", "no", "different", "value", "for", "the", "same", "key", "in", "the", "same", "source", "-", "invalid", "and", "different", "v...
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/config/WeldConfiguration.java#L427-L439
killbilling/recurly-java-library
src/main/java/com/ning/billing/recurly/RecurlyClient.java
RecurlyClient.refundInvoice
public Invoice refundInvoice(final String invoiceId, final InvoiceRefund refundOptions) { return doPOST(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/refund", refundOptions, Invoice.class); }
java
public Invoice refundInvoice(final String invoiceId, final InvoiceRefund refundOptions) { return doPOST(Invoices.INVOICES_RESOURCE + "/" + invoiceId + "/refund", refundOptions, Invoice.class); }
[ "public", "Invoice", "refundInvoice", "(", "final", "String", "invoiceId", ",", "final", "InvoiceRefund", "refundOptions", ")", "{", "return", "doPOST", "(", "Invoices", ".", "INVOICES_RESOURCE", "+", "\"/\"", "+", "invoiceId", "+", "\"/refund\"", ",", "refundOpti...
Refund an invoice given some options <p/> Returns the refunded invoice @param invoiceId The id of the invoice to refund @param refundOptions The options for the refund @return the refunded invoice
[ "Refund", "an", "invoice", "given", "some", "options", "<p", "/", ">", "Returns", "the", "refunded", "invoice" ]
train
https://github.com/killbilling/recurly-java-library/blob/5e05eedd91885a51e1aa8293bd41139d082cf7f4/src/main/java/com/ning/billing/recurly/RecurlyClient.java#L1167-L1169
denisneuling/cctrl.jar
cctrl-api-client/src/main/java/com/cloudcontrolled/api/client/support/CloudControlClientSupport.java
CloudControlClientSupport.toBase64
protected String toBase64(String user, String password) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(user); stringBuffer.append(":"); stringBuffer.append(password); return Base64Utility.encode(stringBuffer.toString().getBytes()); }
java
protected String toBase64(String user, String password) { StringBuffer stringBuffer = new StringBuffer(); stringBuffer.append(user); stringBuffer.append(":"); stringBuffer.append(password); return Base64Utility.encode(stringBuffer.toString().getBytes()); }
[ "protected", "String", "toBase64", "(", "String", "user", ",", "String", "password", ")", "{", "StringBuffer", "stringBuffer", "=", "new", "StringBuffer", "(", ")", ";", "stringBuffer", ".", "append", "(", "user", ")", ";", "stringBuffer", ".", "append", "("...
<p> toBase64. </p> @param user a {@link java.lang.String} object. @param password a {@link java.lang.String} object. @return a {@link java.lang.String} object.
[ "<p", ">", "toBase64", ".", "<", "/", "p", ">" ]
train
https://github.com/denisneuling/cctrl.jar/blob/37450d824f4dc5ecbcc81c61e48f1ec876ca2de8/cctrl-api-client/src/main/java/com/cloudcontrolled/api/client/support/CloudControlClientSupport.java#L167-L173
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/style/Color.java
Color.setColor
public void setColor(float red, float green, float blue, float opacity) { setColor(red, green, blue); setOpacity(opacity); }
java
public void setColor(float red, float green, float blue, float opacity) { setColor(red, green, blue); setOpacity(opacity); }
[ "public", "void", "setColor", "(", "float", "red", ",", "float", "green", ",", "float", "blue", ",", "float", "opacity", ")", "{", "setColor", "(", "red", ",", "green", ",", "blue", ")", ";", "setOpacity", "(", "opacity", ")", ";", "}" ]
Set the color with arithmetic RGB values @param red red float color inclusively between 0.0 and 1.0 @param green green float color inclusively between 0.0 and 1.0 @param blue blue float color inclusively between 0.0 and 1.0 @param opacity opacity float inclusively between 0.0 and 1.0
[ "Set", "the", "color", "with", "arithmetic", "RGB", "values" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/style/Color.java#L409-L412
rjeschke/txtmark
src/main/java/com/github/rjeschke/txtmark/Emitter.java
Emitter.checkHtml
private int checkHtml(final StringBuilder out, final String in, final int start) { final StringBuilder temp = new StringBuilder(); int pos; // Check for auto links temp.setLength(0); pos = Utils.readUntil(temp, in, start + 1, ':', ' ', '>', '\n'); if (pos != -1 && in.charAt(pos) == ':' && HTML.isLinkPrefix(temp.toString())) { pos = Utils.readUntil(temp, in, pos, '>'); if (pos != -1) { final String link = temp.toString(); this.config.decorator.openLink(out); out.append(" href=\""); Utils.appendValue(out, link, 0, link.length()); out.append("\">"); Utils.appendValue(out, link, 0, link.length()); this.config.decorator.closeLink(out); return pos; } } // Check for mailto auto link temp.setLength(0); pos = Utils.readUntil(temp, in, start + 1, '@', ' ', '>', '\n'); if (pos != -1 && in.charAt(pos) == '@') { pos = Utils.readUntil(temp, in, pos, '>'); if (pos != -1) { final String link = temp.toString(); this.config.decorator.openLink(out); out.append(" href=\""); Utils.appendMailto(out, "mailto:", 0, 7); Utils.appendMailto(out, link, 0, link.length()); out.append("\">"); Utils.appendMailto(out, link, 0, link.length()); this.config.decorator.closeLink(out); return pos; } } // Check for inline html if (start + 2 < in.length()) { temp.setLength(0); return Utils.readXML(out, in, start, this.config.safeMode); } return -1; }
java
private int checkHtml(final StringBuilder out, final String in, final int start) { final StringBuilder temp = new StringBuilder(); int pos; // Check for auto links temp.setLength(0); pos = Utils.readUntil(temp, in, start + 1, ':', ' ', '>', '\n'); if (pos != -1 && in.charAt(pos) == ':' && HTML.isLinkPrefix(temp.toString())) { pos = Utils.readUntil(temp, in, pos, '>'); if (pos != -1) { final String link = temp.toString(); this.config.decorator.openLink(out); out.append(" href=\""); Utils.appendValue(out, link, 0, link.length()); out.append("\">"); Utils.appendValue(out, link, 0, link.length()); this.config.decorator.closeLink(out); return pos; } } // Check for mailto auto link temp.setLength(0); pos = Utils.readUntil(temp, in, start + 1, '@', ' ', '>', '\n'); if (pos != -1 && in.charAt(pos) == '@') { pos = Utils.readUntil(temp, in, pos, '>'); if (pos != -1) { final String link = temp.toString(); this.config.decorator.openLink(out); out.append(" href=\""); Utils.appendMailto(out, "mailto:", 0, 7); Utils.appendMailto(out, link, 0, link.length()); out.append("\">"); Utils.appendMailto(out, link, 0, link.length()); this.config.decorator.closeLink(out); return pos; } } // Check for inline html if (start + 2 < in.length()) { temp.setLength(0); return Utils.readXML(out, in, start, this.config.safeMode); } return -1; }
[ "private", "int", "checkHtml", "(", "final", "StringBuilder", "out", ",", "final", "String", "in", ",", "final", "int", "start", ")", "{", "final", "StringBuilder", "temp", "=", "new", "StringBuilder", "(", ")", ";", "int", "pos", ";", "// Check for auto lin...
Check if there is a valid HTML tag here. This method also transforms auto links and mailto auto links. @param out The StringBuilder to write to. @param in Input String. @param start Starting position. @return The new position or -1 if nothing valid has been found.
[ "Check", "if", "there", "is", "a", "valid", "HTML", "tag", "here", ".", "This", "method", "also", "transforms", "auto", "links", "and", "mailto", "auto", "links", "." ]
train
https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Emitter.java#L409-L461
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java
HttpHeaders.setHeader
@Deprecated public static void setHeader(HttpMessage message, String name, Iterable<?> values) { message.headers().set(name, values); }
java
@Deprecated public static void setHeader(HttpMessage message, String name, Iterable<?> values) { message.headers().set(name, values); }
[ "@", "Deprecated", "public", "static", "void", "setHeader", "(", "HttpMessage", "message", ",", "String", "name", ",", "Iterable", "<", "?", ">", "values", ")", "{", "message", ".", "headers", "(", ")", ".", "set", "(", "name", ",", "values", ")", ";",...
@deprecated Use {@link #set(CharSequence, Iterable)} instead. @see #setHeader(HttpMessage, CharSequence, Iterable)
[ "@deprecated", "Use", "{", "@link", "#set", "(", "CharSequence", "Iterable", ")", "}", "instead", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java#L624-L627
logic-ng/LogicNG
src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java
FormulaStringRepresentation.naryOperator
protected String naryOperator(final NAryOperator operator, final String opString) { final StringBuilder sb = new StringBuilder(); int count = 0; final int size = operator.numberOfOperands(); Formula last = null; for (final Formula op : operator) { if (++count == size) { last = op; } else { sb.append(operator.type().precedence() < op.type().precedence() ? this.toString(op) : this.bracket(op)); sb.append(opString); } } if (last != null) { sb.append(operator.type().precedence() < last.type().precedence() ? this.toString(last) : this.bracket(last)); } return sb.toString(); }
java
protected String naryOperator(final NAryOperator operator, final String opString) { final StringBuilder sb = new StringBuilder(); int count = 0; final int size = operator.numberOfOperands(); Formula last = null; for (final Formula op : operator) { if (++count == size) { last = op; } else { sb.append(operator.type().precedence() < op.type().precedence() ? this.toString(op) : this.bracket(op)); sb.append(opString); } } if (last != null) { sb.append(operator.type().precedence() < last.type().precedence() ? this.toString(last) : this.bracket(last)); } return sb.toString(); }
[ "protected", "String", "naryOperator", "(", "final", "NAryOperator", "operator", ",", "final", "String", "opString", ")", "{", "final", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "int", "count", "=", "0", ";", "final", "int", "size", ...
Returns the string representation of an n-ary operator. @param operator the n-ary operator @param opString the operator string @return the string representation
[ "Returns", "the", "string", "representation", "of", "an", "n", "-", "ary", "operator", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/formulas/printer/FormulaStringRepresentation.java#L113-L130
auth0/java-jwt
lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java
CryptoHelper.verifySignatureFor
@Deprecated boolean verifySignatureFor(String algorithm, byte[] secretBytes, byte[] contentBytes, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException { return MessageDigest.isEqual(createSignatureFor(algorithm, secretBytes, contentBytes), signatureBytes); }
java
@Deprecated boolean verifySignatureFor(String algorithm, byte[] secretBytes, byte[] contentBytes, byte[] signatureBytes) throws NoSuchAlgorithmException, InvalidKeyException { return MessageDigest.isEqual(createSignatureFor(algorithm, secretBytes, contentBytes), signatureBytes); }
[ "@", "Deprecated", "boolean", "verifySignatureFor", "(", "String", "algorithm", ",", "byte", "[", "]", "secretBytes", ",", "byte", "[", "]", "contentBytes", ",", "byte", "[", "]", "signatureBytes", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeyExcepti...
Verify signature. @param algorithm algorithm name. @param secretBytes algorithm secret. @param contentBytes the content to which the signature applies. @param signatureBytes JWT signature. @return true if signature is valid. @throws NoSuchAlgorithmException if the algorithm is not supported. @throws InvalidKeyException if the given key is inappropriate for initializing the specified algorithm. @deprecated rather use corresponding method which takes header and payload as separate inputs
[ "Verify", "signature", "." ]
train
https://github.com/auth0/java-jwt/blob/890538970a9699b7251a4bfe4f26e8d7605ad530/lib/src/main/java/com/auth0/jwt/algorithms/CryptoHelper.java#L141-L144
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/linear/kernelized/KernelSGD.java
KernelSGD.setErrorTolerance
public void setErrorTolerance(double errorTolerance) { if(errorTolerance < 0 || errorTolerance > 1 || Double.isNaN(errorTolerance)) throw new IllegalArgumentException("Error tolerance must be in [0, 1], not " + errorTolerance); this.errorTolerance = errorTolerance; }
java
public void setErrorTolerance(double errorTolerance) { if(errorTolerance < 0 || errorTolerance > 1 || Double.isNaN(errorTolerance)) throw new IllegalArgumentException("Error tolerance must be in [0, 1], not " + errorTolerance); this.errorTolerance = errorTolerance; }
[ "public", "void", "setErrorTolerance", "(", "double", "errorTolerance", ")", "{", "if", "(", "errorTolerance", "<", "0", "||", "errorTolerance", ">", "1", "||", "Double", ".", "isNaN", "(", "errorTolerance", ")", ")", "throw", "new", "IllegalArgumentException", ...
Sets the error tolerance used for certain {@link #setBudgetStrategy(jsat.distributions.kernels.KernelPoint.BudgetStrategy) budget strategies} @param errorTolerance the error tolerance in [0, 1]
[ "Sets", "the", "error", "tolerance", "used", "for", "certain", "{" ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/linear/kernelized/KernelSGD.java#L198-L203
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201811/creativetemplateservice/GetSystemDefinedCreativeTemplates.java
GetSystemDefinedCreativeTemplates.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { CreativeTemplateServiceInterface creativeTemplateService = adManagerServices.get(session, CreativeTemplateServiceInterface.class); // Create a statement to select creative templates. StatementBuilder statementBuilder = new StatementBuilder() .where("type = :type") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("type", CreativeTemplateType.SYSTEM_DEFINED.toString()); // Retrieve a small amount of creative templates at a time, paging through // until all creative templates have been retrieved. int totalResultSetSize = 0; do { CreativeTemplatePage page = creativeTemplateService.getCreativeTemplatesByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each creative template. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (CreativeTemplate creativeTemplate : page.getResults()) { System.out.printf( "%d) Creative template with ID %d and name '%s' was found.%n", i++, creativeTemplate.getId(), creativeTemplate.getName()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { CreativeTemplateServiceInterface creativeTemplateService = adManagerServices.get(session, CreativeTemplateServiceInterface.class); // Create a statement to select creative templates. StatementBuilder statementBuilder = new StatementBuilder() .where("type = :type") .orderBy("id ASC") .limit(StatementBuilder.SUGGESTED_PAGE_LIMIT) .withBindVariableValue("type", CreativeTemplateType.SYSTEM_DEFINED.toString()); // Retrieve a small amount of creative templates at a time, paging through // until all creative templates have been retrieved. int totalResultSetSize = 0; do { CreativeTemplatePage page = creativeTemplateService.getCreativeTemplatesByStatement(statementBuilder.toStatement()); if (page.getResults() != null) { // Print out some information for each creative template. totalResultSetSize = page.getTotalResultSetSize(); int i = page.getStartIndex(); for (CreativeTemplate creativeTemplate : page.getResults()) { System.out.printf( "%d) Creative template with ID %d and name '%s' was found.%n", i++, creativeTemplate.getId(), creativeTemplate.getName()); } } statementBuilder.increaseOffsetBy(StatementBuilder.SUGGESTED_PAGE_LIMIT); } while (statementBuilder.getOffset() < totalResultSetSize); System.out.printf("Number of results found: %d%n", totalResultSetSize); }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "CreativeTemplateServiceInterface", "creativeTemplateService", "=", "adManagerServices", ".", "get", "(", "ses...
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201811/creativetemplateservice/GetSystemDefinedCreativeTemplates.java#L52-L87
rollbar/rollbar-java
rollbar-android/src/main/java/com/rollbar/android/Rollbar.java
Rollbar.log
public void log(Throwable error, String description) { log(error, null, description, null); }
java
public void log(Throwable error, String description) { log(error, null, description, null); }
[ "public", "void", "log", "(", "Throwable", "error", ",", "String", "description", ")", "{", "log", "(", "error", ",", "null", ",", "description", ",", "null", ")", ";", "}" ]
Record an error with human readable description at the default level returned by {@link com.rollbar.notifier.Rollbar#level}. @param error the error. @param description human readable description of error.
[ "Record", "an", "error", "with", "human", "readable", "description", "at", "the", "default", "level", "returned", "by", "{", "@link", "com", ".", "rollbar", ".", "notifier", ".", "Rollbar#level", "}", "." ]
train
https://github.com/rollbar/rollbar-java/blob/5eb4537d1363722b51cfcce55b427cbd8489f17b/rollbar-android/src/main/java/com/rollbar/android/Rollbar.java#L679-L681
OpenLiberty/open-liberty
dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java
LifecycleCallbackHelper.doPostConstruct
@SuppressWarnings("rawtypes") public void doPostConstruct(Class clazz, List<LifecycleCallback> postConstructs) throws InjectionException { mainClassName = clazz.getName(); doPostConstruct(clazz, postConstructs, null); }
java
@SuppressWarnings("rawtypes") public void doPostConstruct(Class clazz, List<LifecycleCallback> postConstructs) throws InjectionException { mainClassName = clazz.getName(); doPostConstruct(clazz, postConstructs, null); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "void", "doPostConstruct", "(", "Class", "clazz", ",", "List", "<", "LifecycleCallback", ">", "postConstructs", ")", "throws", "InjectionException", "{", "mainClassName", "=", "clazz", ".", "getName", "(...
Processes the PostConstruct callback method for the application main class @param clazz the application main class object @param postConstructs a list of PostConstruct metadata in the application client module @throws InjectionException
[ "Processes", "the", "PostConstruct", "callback", "method", "for", "the", "application", "main", "class" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.clientcontainer/src/com/ibm/ws/clientcontainer/internal/LifecycleCallbackHelper.java#L47-L51
osglworks/java-tool
src/main/java/org/osgl/util/IO.java
IO.readContentAsString
public static String readContentAsString(URL url, String encoding) { try { return readContentAsString(url.openStream(), encoding); } catch (IOException e) { throw E.ioException(e); } }
java
public static String readContentAsString(URL url, String encoding) { try { return readContentAsString(url.openStream(), encoding); } catch (IOException e) { throw E.ioException(e); } }
[ "public", "static", "String", "readContentAsString", "(", "URL", "url", ",", "String", "encoding", ")", "{", "try", "{", "return", "readContentAsString", "(", "url", ".", "openStream", "(", ")", ",", "encoding", ")", ";", "}", "catch", "(", "IOException", ...
Read file content to a String @param url The url resource to read @param encoding encoding used to read the file into string content @return The String content
[ "Read", "file", "content", "to", "a", "String" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/IO.java#L1525-L1531
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/source/PartitionedFileSourceBase.java
PartitionedFileSourceBase.getLowWaterMark
private long getLowWaterMark(Iterable<WorkUnitState> previousStates, String lowWaterMark) { long lowWaterMarkValue = retriever.getWatermarkFromString(lowWaterMark); // Find the max HWM from the previous states, this is the new current LWM for (WorkUnitState previousState : previousStates) { if (previousState.getWorkingState().equals(WorkUnitState.WorkingState.COMMITTED)) { long previousHighWaterMark = previousState.getWorkunit().getHighWaterMark(); if (previousHighWaterMark > lowWaterMarkValue) { lowWaterMarkValue = previousHighWaterMark; } } } return lowWaterMarkValue + getRetriever().getWatermarkIncrementMs(); }
java
private long getLowWaterMark(Iterable<WorkUnitState> previousStates, String lowWaterMark) { long lowWaterMarkValue = retriever.getWatermarkFromString(lowWaterMark); // Find the max HWM from the previous states, this is the new current LWM for (WorkUnitState previousState : previousStates) { if (previousState.getWorkingState().equals(WorkUnitState.WorkingState.COMMITTED)) { long previousHighWaterMark = previousState.getWorkunit().getHighWaterMark(); if (previousHighWaterMark > lowWaterMarkValue) { lowWaterMarkValue = previousHighWaterMark; } } } return lowWaterMarkValue + getRetriever().getWatermarkIncrementMs(); }
[ "private", "long", "getLowWaterMark", "(", "Iterable", "<", "WorkUnitState", ">", "previousStates", ",", "String", "lowWaterMark", ")", "{", "long", "lowWaterMarkValue", "=", "retriever", ".", "getWatermarkFromString", "(", "lowWaterMark", ")", ";", "// Find the max H...
Gets the LWM for this job runs. The new LWM is the HWM of the previous run + 1 unit (day,hour,minute..etc). If there was no previous execution then it is set to the given lowWaterMark + 1 unit.
[ "Gets", "the", "LWM", "for", "this", "job", "runs", ".", "The", "new", "LWM", "is", "the", "HWM", "of", "the", "previous", "run", "+", "1", "unit", "(", "day", "hour", "minute", "..", "etc", ")", ".", "If", "there", "was", "no", "previous", "execut...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/PartitionedFileSourceBase.java#L354-L369
apptik/JustJson
json-core/src/main/java/io/apptik/json/JsonArray.java
JsonArray.put
public JsonArray put(int index, Object value) throws JsonException { checkIfFrozen(); while (values.size() <= index) { values.add(JSON_NULL); } values.set(index, wrap(value)); return this; }
java
public JsonArray put(int index, Object value) throws JsonException { checkIfFrozen(); while (values.size() <= index) { values.add(JSON_NULL); } values.set(index, wrap(value)); return this; }
[ "public", "JsonArray", "put", "(", "int", "index", ",", "Object", "value", ")", "throws", "JsonException", "{", "checkIfFrozen", "(", ")", ";", "while", "(", "values", ".", "size", "(", ")", "<=", "index", ")", "{", "values", ".", "add", "(", "JSON_NUL...
Sets the value at {@code index} to {@code value}, null padding this array to the required length if necessary. If a value already exists at {@code index}, it will be replaced. @param value a {@link JsonObject}, {@link JsonArray}, String, Boolean, Integer, Long, Double, or {@code null}. May not be {@link Double#isNaN() NaNs} or {@link Double#isInfinite() infinities}. @return this array.
[ "Sets", "the", "value", "at", "{", "@code", "index", "}", "to", "{", "@code", "value", "}", "null", "padding", "this", "array", "to", "the", "required", "length", "if", "necessary", ".", "If", "a", "value", "already", "exists", "at", "{", "@code", "ind...
train
https://github.com/apptik/JustJson/blob/c90f0dd7f84df26da4749be8cd9b026fff499a79/json-core/src/main/java/io/apptik/json/JsonArray.java#L222-L229
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.andNot
public StructuredQueryDefinition andNot(StructuredQueryDefinition positive, StructuredQueryDefinition negative) { checkQuery(positive); checkQuery(negative); return new AndNotQuery(positive, negative); }
java
public StructuredQueryDefinition andNot(StructuredQueryDefinition positive, StructuredQueryDefinition negative) { checkQuery(positive); checkQuery(negative); return new AndNotQuery(positive, negative); }
[ "public", "StructuredQueryDefinition", "andNot", "(", "StructuredQueryDefinition", "positive", ",", "StructuredQueryDefinition", "negative", ")", "{", "checkQuery", "(", "positive", ")", ";", "checkQuery", "(", "negative", ")", ";", "return", "new", "AndNotQuery", "("...
Defines an AND NOT query combining a positive and negative query. You can use an AND or OR query over a list of query definitions as the positive or negative query. @param positive the positive query definition @param negative the negative query definition @return the StructuredQueryDefinition for the AND NOT query
[ "Defines", "an", "AND", "NOT", "query", "combining", "a", "positive", "and", "negative", "query", ".", "You", "can", "use", "an", "AND", "or", "OR", "query", "over", "a", "list", "of", "query", "definitions", "as", "the", "positive", "or", "negative", "q...
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L346-L350
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java
CommonExpectations.ltpaCookieExists
public static Expectations ltpaCookieExists(String testAction, WebClient webClient) { Expectations expectations = new Expectations(); expectations.addExpectation(new CookieExpectation(testAction, webClient, JwtFatConstants.LTPA_COOKIE_NAME, ".+")); return expectations; }
java
public static Expectations ltpaCookieExists(String testAction, WebClient webClient) { Expectations expectations = new Expectations(); expectations.addExpectation(new CookieExpectation(testAction, webClient, JwtFatConstants.LTPA_COOKIE_NAME, ".+")); return expectations; }
[ "public", "static", "Expectations", "ltpaCookieExists", "(", "String", "testAction", ",", "WebClient", "webClient", ")", "{", "Expectations", "expectations", "=", "new", "Expectations", "(", ")", ";", "expectations", ".", "addExpectation", "(", "new", "CookieExpecta...
Sets expectations that will check: <ol> <li>The provided WebClient contains an LTPA cookie with a non-empty value </ol>
[ "Sets", "expectations", "that", "will", "check", ":", "<ol", ">", "<li", ">", "The", "provided", "WebClient", "contains", "an", "LTPA", "cookie", "with", "a", "non", "-", "empty", "value", "<", "/", "ol", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwtsso_fat/fat/src/com/ibm/ws/security/jwtsso/fat/utils/CommonExpectations.java#L94-L98
joelittlejohn/jsonschema2pojo
jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/RequiredRule.java
RequiredRule.apply
@Override public JDocCommentable apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) { if (node.asBoolean()) { generatableType.javadoc().append("\n(Required)"); if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && generatableType instanceof JFieldVar) { ((JFieldVar) generatableType).annotate(NotNull.class); } if (ruleFactory.getGenerationConfig().isIncludeJsr305Annotations() && generatableType instanceof JFieldVar) { ((JFieldVar) generatableType).annotate(Nonnull.class); } } else { if (ruleFactory.getGenerationConfig().isIncludeJsr305Annotations() && generatableType instanceof JFieldVar) { ((JFieldVar) generatableType).annotate(Nullable.class); } } return generatableType; }
java
@Override public JDocCommentable apply(String nodeName, JsonNode node, JsonNode parent, JDocCommentable generatableType, Schema schema) { if (node.asBoolean()) { generatableType.javadoc().append("\n(Required)"); if (ruleFactory.getGenerationConfig().isIncludeJsr303Annotations() && generatableType instanceof JFieldVar) { ((JFieldVar) generatableType).annotate(NotNull.class); } if (ruleFactory.getGenerationConfig().isIncludeJsr305Annotations() && generatableType instanceof JFieldVar) { ((JFieldVar) generatableType).annotate(Nonnull.class); } } else { if (ruleFactory.getGenerationConfig().isIncludeJsr305Annotations() && generatableType instanceof JFieldVar) { ((JFieldVar) generatableType).annotate(Nullable.class); } } return generatableType; }
[ "@", "Override", "public", "JDocCommentable", "apply", "(", "String", "nodeName", ",", "JsonNode", "node", ",", "JsonNode", "parent", ",", "JDocCommentable", "generatableType", ",", "Schema", "schema", ")", "{", "if", "(", "node", ".", "asBoolean", "(", ")", ...
Applies this schema rule to take the required code generation steps. <p> The required rule simply adds a note to the JavaDoc comment to mark a property as required. @param nodeName the name of the schema node for which this "required" rule has been added @param node the "required" node, having a value <code>true</code> or <code>false</code> @param parent the parent node @param generatableType the class or method which may be marked as "required" @return the JavaDoc comment attached to the generatableType, which <em>may</em> have an added not to mark this construct as required.
[ "Applies", "this", "schema", "rule", "to", "take", "the", "required", "code", "generation", "steps", ".", "<p", ">", "The", "required", "rule", "simply", "adds", "a", "note", "to", "the", "JavaDoc", "comment", "to", "mark", "a", "property", "as", "required...
train
https://github.com/joelittlejohn/jsonschema2pojo/blob/0552b80db93214eb186e4ae45b40866cc1e7eb84/jsonschema2pojo-core/src/main/java/org/jsonschema2pojo/rules/RequiredRule.java#L63-L86
signalapp/curve25519-java
common/src/main/java/org/whispersystems/curve25519/java/fe_mul121666.java
fe_mul121666.fe_mul121666
public static void fe_mul121666(int[] h,int[] f) { int f0 = f[0]; int f1 = f[1]; int f2 = f[2]; int f3 = f[3]; int f4 = f[4]; int f5 = f[5]; int f6 = f[6]; int f7 = f[7]; int f8 = f[8]; int f9 = f[9]; long h0 = f0 * (long) 121666; long h1 = f1 * (long) 121666; long h2 = f2 * (long) 121666; long h3 = f3 * (long) 121666; long h4 = f4 * (long) 121666; long h5 = f5 * (long) 121666; long h6 = f6 * (long) 121666; long h7 = f7 * (long) 121666; long h8 = f8 * (long) 121666; long h9 = f9 * (long) 121666; long carry0; long carry1; long carry2; long carry3; long carry4; long carry5; long carry6; long carry7; long carry8; long carry9; carry9 = (h9 + (long) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25; carry1 = (h1 + (long) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25; carry3 = (h3 + (long) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25; carry5 = (h5 + (long) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25; carry7 = (h7 + (long) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25; carry0 = (h0 + (long) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26; carry2 = (h2 + (long) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26; carry4 = (h4 + (long) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26; carry6 = (h6 + (long) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26; carry8 = (h8 + (long) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26; h[0] = (int)h0; h[1] = (int)h1; h[2] = (int)h2; h[3] = (int)h3; h[4] = (int)h4; h[5] = (int)h5; h[6] = (int)h6; h[7] = (int)h7; h[8] = (int)h8; h[9] = (int)h9; }
java
public static void fe_mul121666(int[] h,int[] f) { int f0 = f[0]; int f1 = f[1]; int f2 = f[2]; int f3 = f[3]; int f4 = f[4]; int f5 = f[5]; int f6 = f[6]; int f7 = f[7]; int f8 = f[8]; int f9 = f[9]; long h0 = f0 * (long) 121666; long h1 = f1 * (long) 121666; long h2 = f2 * (long) 121666; long h3 = f3 * (long) 121666; long h4 = f4 * (long) 121666; long h5 = f5 * (long) 121666; long h6 = f6 * (long) 121666; long h7 = f7 * (long) 121666; long h8 = f8 * (long) 121666; long h9 = f9 * (long) 121666; long carry0; long carry1; long carry2; long carry3; long carry4; long carry5; long carry6; long carry7; long carry8; long carry9; carry9 = (h9 + (long) (1<<24)) >> 25; h0 += carry9 * 19; h9 -= carry9 << 25; carry1 = (h1 + (long) (1<<24)) >> 25; h2 += carry1; h1 -= carry1 << 25; carry3 = (h3 + (long) (1<<24)) >> 25; h4 += carry3; h3 -= carry3 << 25; carry5 = (h5 + (long) (1<<24)) >> 25; h6 += carry5; h5 -= carry5 << 25; carry7 = (h7 + (long) (1<<24)) >> 25; h8 += carry7; h7 -= carry7 << 25; carry0 = (h0 + (long) (1<<25)) >> 26; h1 += carry0; h0 -= carry0 << 26; carry2 = (h2 + (long) (1<<25)) >> 26; h3 += carry2; h2 -= carry2 << 26; carry4 = (h4 + (long) (1<<25)) >> 26; h5 += carry4; h4 -= carry4 << 26; carry6 = (h6 + (long) (1<<25)) >> 26; h7 += carry6; h6 -= carry6 << 26; carry8 = (h8 + (long) (1<<25)) >> 26; h9 += carry8; h8 -= carry8 << 26; h[0] = (int)h0; h[1] = (int)h1; h[2] = (int)h2; h[3] = (int)h3; h[4] = (int)h4; h[5] = (int)h5; h[6] = (int)h6; h[7] = (int)h7; h[8] = (int)h8; h[9] = (int)h9; }
[ "public", "static", "void", "fe_mul121666", "(", "int", "[", "]", "h", ",", "int", "[", "]", "f", ")", "{", "int", "f0", "=", "f", "[", "0", "]", ";", "int", "f1", "=", "f", "[", "1", "]", ";", "int", "f2", "=", "f", "[", "2", "]", ";", ...
/* h = f * 121666 Can overlap h with f. Preconditions: |f| bounded by 1.1*2^26,1.1*2^25,1.1*2^26,1.1*2^25,etc. Postconditions: |h| bounded by 1.1*2^25,1.1*2^24,1.1*2^25,1.1*2^24,etc.
[ "/", "*", "h", "=", "f", "*", "121666", "Can", "overlap", "h", "with", "f", "." ]
train
https://github.com/signalapp/curve25519-java/blob/70fae57d6dccff7e78a46203c534314b07dfdd98/common/src/main/java/org/whispersystems/curve25519/java/fe_mul121666.java#L19-L74
googleapis/google-http-java-client
google-http-client/src/main/java/com/google/api/client/http/GenericUrl.java
GenericUrl.addQueryParams
static void addQueryParams(Set<Entry<String, Object>> entrySet, StringBuilder buf) { // (similar to UrlEncodedContent) boolean first = true; for (Map.Entry<String, Object> nameValueEntry : entrySet) { Object value = nameValueEntry.getValue(); if (value != null) { String name = CharEscapers.escapeUriQuery(nameValueEntry.getKey()); if (value instanceof Collection<?>) { Collection<?> collectionValue = (Collection<?>) value; for (Object repeatedValue : collectionValue) { first = appendParam(first, buf, name, repeatedValue); } } else { first = appendParam(first, buf, name, value); } } } }
java
static void addQueryParams(Set<Entry<String, Object>> entrySet, StringBuilder buf) { // (similar to UrlEncodedContent) boolean first = true; for (Map.Entry<String, Object> nameValueEntry : entrySet) { Object value = nameValueEntry.getValue(); if (value != null) { String name = CharEscapers.escapeUriQuery(nameValueEntry.getKey()); if (value instanceof Collection<?>) { Collection<?> collectionValue = (Collection<?>) value; for (Object repeatedValue : collectionValue) { first = appendParam(first, buf, name, repeatedValue); } } else { first = appendParam(first, buf, name, value); } } } }
[ "static", "void", "addQueryParams", "(", "Set", "<", "Entry", "<", "String", ",", "Object", ">", ">", "entrySet", ",", "StringBuilder", "buf", ")", "{", "// (similar to UrlEncodedContent)", "boolean", "first", "=", "true", ";", "for", "(", "Map", ".", "Entry...
Adds query parameters from the provided entrySet into the buffer.
[ "Adds", "query", "parameters", "from", "the", "provided", "entrySet", "into", "the", "buffer", "." ]
train
https://github.com/googleapis/google-http-java-client/blob/0988ae4e0f26a80f579b6adb2b276dd8254928de/google-http-client/src/main/java/com/google/api/client/http/GenericUrl.java#L541-L558
thymeleaf/thymeleaf
src/main/java/org/thymeleaf/util/NumberUtils.java
NumberUtils.formatCurrency
public static String formatCurrency(final Number target, final Locale locale) { Validate.notNull(locale, "Locale cannot be null"); if (target == null) { return null; } NumberFormat format = NumberFormat.getCurrencyInstance(locale); return format.format(target); }
java
public static String formatCurrency(final Number target, final Locale locale) { Validate.notNull(locale, "Locale cannot be null"); if (target == null) { return null; } NumberFormat format = NumberFormat.getCurrencyInstance(locale); return format.format(target); }
[ "public", "static", "String", "formatCurrency", "(", "final", "Number", "target", ",", "final", "Locale", "locale", ")", "{", "Validate", ".", "notNull", "(", "locale", ",", "\"Locale cannot be null\"", ")", ";", "if", "(", "target", "==", "null", ")", "{", ...
Formats a number as a currency value according to the specified locale. @param target The number to format. @param locale Locale to use for formatting. @return The number formatted as a currency, or {@code null} if the number given is {@code null}.
[ "Formats", "a", "number", "as", "a", "currency", "value", "according", "to", "the", "specified", "locale", "." ]
train
https://github.com/thymeleaf/thymeleaf/blob/2b0e6d6d7571fbe638904b5fd222fc9e77188879/src/main/java/org/thymeleaf/util/NumberUtils.java#L279-L290
Erudika/para
para-server/src/main/java/com/erudika/para/security/SecurityUtils.java
SecurityUtils.checkImplicitAppPermissions
public static boolean checkImplicitAppPermissions(App app, ParaObject object) { if (app != null && object != null) { return isNotAnApp(object.getType()) || app.getId().equals(object.getId()) || app.isRootApp(); } return false; }
java
public static boolean checkImplicitAppPermissions(App app, ParaObject object) { if (app != null && object != null) { return isNotAnApp(object.getType()) || app.getId().equals(object.getId()) || app.isRootApp(); } return false; }
[ "public", "static", "boolean", "checkImplicitAppPermissions", "(", "App", "app", ",", "ParaObject", "object", ")", "{", "if", "(", "app", "!=", "null", "&&", "object", "!=", "null", ")", "{", "return", "isNotAnApp", "(", "object", ".", "getType", "(", ")",...
An app can edit itself or delete itself. It can't read, edit, overwrite or delete other apps, unless it is the root app. @param app an app @param object another object @return true if app passes the check
[ "An", "app", "can", "edit", "itself", "or", "delete", "itself", ".", "It", "can", "t", "read", "edit", "overwrite", "or", "delete", "other", "apps", "unless", "it", "is", "the", "root", "app", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/SecurityUtils.java#L169-L174
liferay/com-liferay-commerce
commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java
CommerceAccountPersistenceImpl.findAll
@Override public List<CommerceAccount> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceAccount> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceAccount", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce accounts. @return the commerce accounts
[ "Returns", "all", "the", "commerce", "accounts", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-account-service/src/main/java/com/liferay/commerce/account/service/persistence/impl/CommerceAccountPersistenceImpl.java#L2744-L2747
logic-ng/LogicNG
src/main/java/org/logicng/solvers/MiniSat.java
MiniSat.miniSat
public static MiniSat miniSat(final FormulaFactory f) { return new MiniSat(f, SolverStyle.MINISAT, new MiniSatConfig.Builder().build(), null); }
java
public static MiniSat miniSat(final FormulaFactory f) { return new MiniSat(f, SolverStyle.MINISAT, new MiniSatConfig.Builder().build(), null); }
[ "public", "static", "MiniSat", "miniSat", "(", "final", "FormulaFactory", "f", ")", "{", "return", "new", "MiniSat", "(", "f", ",", "SolverStyle", ".", "MINISAT", ",", "new", "MiniSatConfig", ".", "Builder", "(", ")", ".", "build", "(", ")", ",", "null",...
Returns a new MiniSat solver. @param f the formula factory @return the solver
[ "Returns", "a", "new", "MiniSat", "solver", "." ]
train
https://github.com/logic-ng/LogicNG/blob/bb9eb88a768be4be8e02a76cfc4a59e6c3fb7f2e/src/main/java/org/logicng/solvers/MiniSat.java#L131-L133
samskivert/samskivert
src/main/java/com/samskivert/util/CheapIntMap.java
CheapIntMap.put
public void put (int key, Object value) { int size = _keys.length, start = key % size, iidx = -1; for (int ii = 0; ii < size; ii++) { int idx = (ii + start) % size; if (_keys[idx] == key) { _values[idx] = value; return; } else if (iidx == -1 && _keys[idx] == -1) { iidx = idx; } } if (iidx != -1) { _keys[iidx] = key; _values[iidx] = value; return; } // they booched it! String errmsg = "You fool! You've filled up your cheap int map! " + "[keys=" + StringUtil.toString(_keys) + ", values=" + StringUtil.toString(_values) + "]"; throw new RuntimeException(errmsg); }
java
public void put (int key, Object value) { int size = _keys.length, start = key % size, iidx = -1; for (int ii = 0; ii < size; ii++) { int idx = (ii + start) % size; if (_keys[idx] == key) { _values[idx] = value; return; } else if (iidx == -1 && _keys[idx] == -1) { iidx = idx; } } if (iidx != -1) { _keys[iidx] = key; _values[iidx] = value; return; } // they booched it! String errmsg = "You fool! You've filled up your cheap int map! " + "[keys=" + StringUtil.toString(_keys) + ", values=" + StringUtil.toString(_values) + "]"; throw new RuntimeException(errmsg); }
[ "public", "void", "put", "(", "int", "key", ",", "Object", "value", ")", "{", "int", "size", "=", "_keys", ".", "length", ",", "start", "=", "key", "%", "size", ",", "iidx", "=", "-", "1", ";", "for", "(", "int", "ii", "=", "0", ";", "ii", "<...
Inserts the specified value into the map. <em>Note:</em> the key must be a positive integer.
[ "Inserts", "the", "specified", "value", "into", "the", "map", ".", "<em", ">", "Note", ":", "<", "/", "em", ">", "the", "key", "must", "be", "a", "positive", "integer", "." ]
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/CheapIntMap.java#L30-L54
groupon/robo-remote
RoboRemoteServerCommon/src/main/com/groupon/roboremote/roboremoteservercommon/NanoHTTPD.java
NanoHTTPD.encodeUri
private String encodeUri( String uri ) { String newUri = ""; StringTokenizer st = new StringTokenizer( uri, "/ ", true ); while ( st.hasMoreTokens()) { String tok = st.nextToken(); if ( tok.equals( "/" )) newUri += "/"; else if ( tok.equals( " " )) newUri += "%20"; else { newUri += URLEncoder.encode( tok ); // For Java 1.4 you'll want to use this instead: // try { newUri += URLEncoder.encode( tok, "UTF-8" ); } catch ( java.io.UnsupportedEncodingException uee ) {} } } return newUri; }
java
private String encodeUri( String uri ) { String newUri = ""; StringTokenizer st = new StringTokenizer( uri, "/ ", true ); while ( st.hasMoreTokens()) { String tok = st.nextToken(); if ( tok.equals( "/" )) newUri += "/"; else if ( tok.equals( " " )) newUri += "%20"; else { newUri += URLEncoder.encode( tok ); // For Java 1.4 you'll want to use this instead: // try { newUri += URLEncoder.encode( tok, "UTF-8" ); } catch ( java.io.UnsupportedEncodingException uee ) {} } } return newUri; }
[ "private", "String", "encodeUri", "(", "String", "uri", ")", "{", "String", "newUri", "=", "\"\"", ";", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "uri", ",", "\"/ \"", ",", "true", ")", ";", "while", "(", "st", ".", "hasMoreTokens", "(...
URL-encodes everything between "/"-characters. Encodes spaces as '%20' instead of '+'.
[ "URL", "-", "encodes", "everything", "between", "/", "-", "characters", ".", "Encodes", "spaces", "as", "%20", "instead", "of", "+", "." ]
train
https://github.com/groupon/robo-remote/blob/12d242faad50bf90f98657ca9a0c0c3ae1993f07/RoboRemoteServerCommon/src/main/com/groupon/roboremote/roboremoteservercommon/NanoHTTPD.java#L803-L822
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java
PredictionsImpl.predictImageUrlWithServiceResponseAsync
public Observable<ServiceResponse<ImagePrediction>> predictImageUrlWithServiceResponseAsync(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final UUID iterationId = predictImageUrlOptionalParameter != null ? predictImageUrlOptionalParameter.iterationId() : null; final String application = predictImageUrlOptionalParameter != null ? predictImageUrlOptionalParameter.application() : null; final String url = predictImageUrlOptionalParameter != null ? predictImageUrlOptionalParameter.url() : null; return predictImageUrlWithServiceResponseAsync(projectId, iterationId, application, url); }
java
public Observable<ServiceResponse<ImagePrediction>> predictImageUrlWithServiceResponseAsync(UUID projectId, PredictImageUrlOptionalParameter predictImageUrlOptionalParameter) { if (projectId == null) { throw new IllegalArgumentException("Parameter projectId is required and cannot be null."); } if (this.client.apiKey() == null) { throw new IllegalArgumentException("Parameter this.client.apiKey() is required and cannot be null."); } final UUID iterationId = predictImageUrlOptionalParameter != null ? predictImageUrlOptionalParameter.iterationId() : null; final String application = predictImageUrlOptionalParameter != null ? predictImageUrlOptionalParameter.application() : null; final String url = predictImageUrlOptionalParameter != null ? predictImageUrlOptionalParameter.url() : null; return predictImageUrlWithServiceResponseAsync(projectId, iterationId, application, url); }
[ "public", "Observable", "<", "ServiceResponse", "<", "ImagePrediction", ">", ">", "predictImageUrlWithServiceResponseAsync", "(", "UUID", "projectId", ",", "PredictImageUrlOptionalParameter", "predictImageUrlOptionalParameter", ")", "{", "if", "(", "projectId", "==", "null"...
Predict an image url and saves the result. @param projectId The project id @param predictImageUrlOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ImagePrediction object
[ "Predict", "an", "image", "url", "and", "saves", "the", "result", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L667-L679
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/security/CredentialReference.java
CredentialReference.getAttributeBuilder
public static ObjectTypeAttributeDefinition.Builder getAttributeBuilder(boolean allowNull, boolean referenceCredentialStore) { AttributeDefinition csAttr = referenceCredentialStore ? credentialStoreAttributeWithCapabilityReference : credentialStoreAttribute; return getAttributeBuilder(CREDENTIAL_REFERENCE, CREDENTIAL_REFERENCE, allowNull, csAttr); }
java
public static ObjectTypeAttributeDefinition.Builder getAttributeBuilder(boolean allowNull, boolean referenceCredentialStore) { AttributeDefinition csAttr = referenceCredentialStore ? credentialStoreAttributeWithCapabilityReference : credentialStoreAttribute; return getAttributeBuilder(CREDENTIAL_REFERENCE, CREDENTIAL_REFERENCE, allowNull, csAttr); }
[ "public", "static", "ObjectTypeAttributeDefinition", ".", "Builder", "getAttributeBuilder", "(", "boolean", "allowNull", ",", "boolean", "referenceCredentialStore", ")", "{", "AttributeDefinition", "csAttr", "=", "referenceCredentialStore", "?", "credentialStoreAttributeWithCap...
Gets an attribute builder for a credential-reference attribute with the standard {@code credential-reference} attribute name, a configurable setting as to whether the attribute is required, and optionally configured to {@link org.jboss.as.controller.AbstractAttributeDefinitionBuilder#setCapabilityReference(String) register a requirement} for a {@link #CREDENTIAL_STORE_CAPABILITY credential store capability}. If a requirement is registered, the dependent capability will be the single capability registered by the resource that uses this attribute definition. The resource must expose one and only one capability in order to use this facility. @param allowNull whether the attribute is required @param referenceCredentialStore {@code true} if the {@code store} field in the attribute should register a requirement for a credential store capability. @return an {@link ObjectTypeAttributeDefinition.Builder} which can be used to build an attribute definition
[ "Gets", "an", "attribute", "builder", "for", "a", "credential", "-", "reference", "attribute", "with", "the", "standard", "{", "@code", "credential", "-", "reference", "}", "attribute", "name", "a", "configurable", "setting", "as", "to", "whether", "the", "att...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/security/CredentialReference.java#L186-L189
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/rest/RESTServlet.java
RESTServlet.getTenant
private Tenant getTenant(Map<String, String> variableMap) { String tenantName = variableMap.get("tenant"); if (Utils.isEmpty(tenantName)) { tenantName = TenantService.instance().getDefaultTenantName(); } Tenant tenant = TenantService.instance().getTenant(tenantName); if (tenant == null) { throw new NotFoundException("Unknown tenant: " + tenantName); } return tenant; }
java
private Tenant getTenant(Map<String, String> variableMap) { String tenantName = variableMap.get("tenant"); if (Utils.isEmpty(tenantName)) { tenantName = TenantService.instance().getDefaultTenantName(); } Tenant tenant = TenantService.instance().getTenant(tenantName); if (tenant == null) { throw new NotFoundException("Unknown tenant: " + tenantName); } return tenant; }
[ "private", "Tenant", "getTenant", "(", "Map", "<", "String", ",", "String", ">", "variableMap", ")", "{", "String", "tenantName", "=", "variableMap", ".", "get", "(", "\"tenant\"", ")", ";", "if", "(", "Utils", ".", "isEmpty", "(", "tenantName", ")", ")"...
Get the Tenant context for this command and multi-tenant configuration options.
[ "Get", "the", "Tenant", "context", "for", "this", "command", "and", "multi", "-", "tenant", "configuration", "options", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/rest/RESTServlet.java#L214-L224
apache/groovy
src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
ClassNodeUtils.getField
public static FieldNode getField(ClassNode classNode, String fieldName) { ClassNode node = classNode; Set<String> visited = new HashSet<String>(); while (node != null) { FieldNode fn = node.getDeclaredField(fieldName); if (fn != null) return fn; ClassNode[] interfaces = node.getInterfaces(); for (ClassNode iNode : interfaces) { if (visited.contains(iNode.getName())) continue; FieldNode ifn = getField(iNode, fieldName); visited.add(iNode.getName()); if (ifn != null) return ifn; } node = node.getSuperClass(); } return null; }
java
public static FieldNode getField(ClassNode classNode, String fieldName) { ClassNode node = classNode; Set<String> visited = new HashSet<String>(); while (node != null) { FieldNode fn = node.getDeclaredField(fieldName); if (fn != null) return fn; ClassNode[] interfaces = node.getInterfaces(); for (ClassNode iNode : interfaces) { if (visited.contains(iNode.getName())) continue; FieldNode ifn = getField(iNode, fieldName); visited.add(iNode.getName()); if (ifn != null) return ifn; } node = node.getSuperClass(); } return null; }
[ "public", "static", "FieldNode", "getField", "(", "ClassNode", "classNode", ",", "String", "fieldName", ")", "{", "ClassNode", "node", "=", "classNode", ";", "Set", "<", "String", ">", "visited", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", ...
Return the (potentially inherited) field of the classnode. @param classNode the classnode @param fieldName the name of the field @return the field or null if not found
[ "Return", "the", "(", "potentially", "inherited", ")", "field", "of", "the", "classnode", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L396-L412
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/ServerBlobAuditingPoliciesInner.java
ServerBlobAuditingPoliciesInner.createOrUpdateAsync
public Observable<ServerBlobAuditingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerBlobAuditingPolicyInner>, ServerBlobAuditingPolicyInner>() { @Override public ServerBlobAuditingPolicyInner call(ServiceResponse<ServerBlobAuditingPolicyInner> response) { return response.body(); } }); }
java
public Observable<ServerBlobAuditingPolicyInner> createOrUpdateAsync(String resourceGroupName, String serverName, ServerBlobAuditingPolicyInner parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerBlobAuditingPolicyInner>, ServerBlobAuditingPolicyInner>() { @Override public ServerBlobAuditingPolicyInner call(ServiceResponse<ServerBlobAuditingPolicyInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerBlobAuditingPolicyInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "ServerBlobAuditingPolicyInner", "parameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "r...
Creates or updates a server's blob auditing policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param parameters Properties of blob auditing policy @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "server", "s", "blob", "auditing", "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/ServerBlobAuditingPoliciesInner.java#L196-L203
jbundle/jbundle
app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/MergeData.java
MergeData.mergeSourceData
public void mergeSourceData(Record recSource, Record recDest, boolean bFound) { for (int iFieldSeq = 0; iFieldSeq < recSource.getFieldCount(); iFieldSeq++) { BaseField fldSource = recSource.getField(iFieldSeq); BaseField fldDest = recDest.getField(fldSource.getFieldName()); if (fldDest != null) if (!fldSource.isNull()) fldDest.moveFieldToThis(fldSource); } }
java
public void mergeSourceData(Record recSource, Record recDest, boolean bFound) { for (int iFieldSeq = 0; iFieldSeq < recSource.getFieldCount(); iFieldSeq++) { BaseField fldSource = recSource.getField(iFieldSeq); BaseField fldDest = recDest.getField(fldSource.getFieldName()); if (fldDest != null) if (!fldSource.isNull()) fldDest.moveFieldToThis(fldSource); } }
[ "public", "void", "mergeSourceData", "(", "Record", "recSource", ",", "Record", "recDest", ",", "boolean", "bFound", ")", "{", "for", "(", "int", "iFieldSeq", "=", "0", ";", "iFieldSeq", "<", "recSource", ".", "getFieldCount", "(", ")", ";", "iFieldSeq", "...
Merge this source record with the destination record. @param recSource @param recDest.
[ "Merge", "this", "source", "record", "with", "the", "destination", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/data/importfix/base/MergeData.java#L122-L132
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/ConnectApi.java
ConnectApi.getEventLog
public ConnectLog getEventLog(String accountId, String logId) throws ApiException { return getEventLog(accountId, logId, null); }
java
public ConnectLog getEventLog(String accountId, String logId) throws ApiException { return getEventLog(accountId, logId, null); }
[ "public", "ConnectLog", "getEventLog", "(", "String", "accountId", ",", "String", "logId", ")", "throws", "ApiException", "{", "return", "getEventLog", "(", "accountId", ",", "logId", ",", "null", ")", ";", "}" ]
Get the specified Connect log entry. Retrieves the specified Connect log entry for your account. ###### Note: The &#x60;enableLog&#x60; setting in the Connect configuration must be set to true to enable logging. If logging is not enabled, then no log entries are recorded. @param accountId The external account number (int) or account ID Guid. (required) @param logId The ID of the connect log entry (required) @return ConnectLog
[ "Get", "the", "specified", "Connect", "log", "entry", ".", "Retrieves", "the", "specified", "Connect", "log", "entry", "for", "your", "account", ".", "######", "Note", ":", "The", "&#x60", ";", "enableLog&#x60", ";", "setting", "in", "the", "Connect", "confi...
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/ConnectApi.java#L349-L351
seancfoley/IPAddress
IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSegment.java
IPAddressSegment.isMaskCompatibleWithRange
public boolean isMaskCompatibleWithRange(int maskValue, Integer segmentPrefixLength) throws PrefixLenException { if(!isMultiple()) { return true; } return super.isMaskCompatibleWithRange(maskValue, segmentPrefixLength, getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets()); }
java
public boolean isMaskCompatibleWithRange(int maskValue, Integer segmentPrefixLength) throws PrefixLenException { if(!isMultiple()) { return true; } return super.isMaskCompatibleWithRange(maskValue, segmentPrefixLength, getNetwork().getPrefixConfiguration().allPrefixedAddressesAreSubnets()); }
[ "public", "boolean", "isMaskCompatibleWithRange", "(", "int", "maskValue", ",", "Integer", "segmentPrefixLength", ")", "throws", "PrefixLenException", "{", "if", "(", "!", "isMultiple", "(", ")", ")", "{", "return", "true", ";", "}", "return", "super", ".", "i...
Check that the range resulting from the mask is contiguous, otherwise we cannot represent it. For instance, for the range 0 to 3 (bits are 00 to 11), if we mask all 4 numbers from 0 to 3 with 2 (ie bits are 10), then we are left with 1 and 3. 2 is not included. So we cannot represent 1 and 3 as a contiguous range. The underlying rule is that mask bits that are 0 must be above the resulting range in each segment. Any bit in the mask that is 0 must not fall below any bit in the masked segment range that is different between low and high. Any network mask must eliminate the entire segment range. Any host mask is fine. @param maskValue @param segmentPrefixLength @return @throws PrefixLenException
[ "Check", "that", "the", "range", "resulting", "from", "the", "mask", "is", "contiguous", "otherwise", "we", "cannot", "represent", "it", "." ]
train
https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddressSegment.java#L320-L325
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/rri/ReflectiveRandomIndexing.java
ReflectiveRandomIndexing.processIntDocument
private void processIntDocument(IntegerVector docVector, int[] document) { // Make one pass through the document to build the document vector. for (int termIndex : document) { IntegerVector reflectiveVector = termToReflectiveSemantics.get(indexToTerm[termIndex]); // Lock on the term's vector to prevent another thread from updating // it concurrently synchronized(reflectiveVector) { VectorMath.add(reflectiveVector, docVector); } } }
java
private void processIntDocument(IntegerVector docVector, int[] document) { // Make one pass through the document to build the document vector. for (int termIndex : document) { IntegerVector reflectiveVector = termToReflectiveSemantics.get(indexToTerm[termIndex]); // Lock on the term's vector to prevent another thread from updating // it concurrently synchronized(reflectiveVector) { VectorMath.add(reflectiveVector, docVector); } } }
[ "private", "void", "processIntDocument", "(", "IntegerVector", "docVector", ",", "int", "[", "]", "document", ")", "{", "// Make one pass through the document to build the document vector.", "for", "(", "int", "termIndex", ":", "document", ")", "{", "IntegerVector", "re...
Processes the compressed version of a document where each integer indicates that token's index, adding the document's vector to the reflective semantic vector each time a term occurs in the document. @param docVector the vector of the document that is being processed @param document the document to be processed where each {@code int} is a term index @return the number of contexts present in this document
[ "Processes", "the", "compressed", "version", "of", "a", "document", "where", "each", "integer", "indicates", "that", "token", "s", "index", "adding", "the", "document", "s", "vector", "to", "the", "reflective", "semantic", "vector", "each", "time", "a", "term"...
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/rri/ReflectiveRandomIndexing.java#L538-L550
calimero-project/calimero-core
src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java
TranslatorTypes.createTranslator
public static DPTXlator createTranslator(final int mainNumber, final int subNumber, final byte... data) throws KNXException { final MainType type = map.get(mainNumber); if (type == null) throw new KNXException("no DPT translator available for main number " + mainNumber); final boolean withSub = subNumber != 0; final String id = withSub ? String.format("%d.%03d", mainNumber, subNumber) : type.getSubTypes().keySet().iterator().next(); final DPTXlator t = type.createTranslator(id); t.setAppendUnit(withSub); if (data.length > 0) t.setData(data); return t; }
java
public static DPTXlator createTranslator(final int mainNumber, final int subNumber, final byte... data) throws KNXException { final MainType type = map.get(mainNumber); if (type == null) throw new KNXException("no DPT translator available for main number " + mainNumber); final boolean withSub = subNumber != 0; final String id = withSub ? String.format("%d.%03d", mainNumber, subNumber) : type.getSubTypes().keySet().iterator().next(); final DPTXlator t = type.createTranslator(id); t.setAppendUnit(withSub); if (data.length > 0) t.setData(data); return t; }
[ "public", "static", "DPTXlator", "createTranslator", "(", "final", "int", "mainNumber", ",", "final", "int", "subNumber", ",", "final", "byte", "...", "data", ")", "throws", "KNXException", "{", "final", "MainType", "type", "=", "map", ".", "get", "(", "main...
Creates a DPT translator for the given datapoint type main/sub number. @param mainNumber datapoint type main number, 0 &lt; mainNumber @param subNumber datapoint type sub number selecting a particular kind of value translation; use 0 to request any type ID of that translator (in that case, appending the physical unit for string values is disabled) @param data (optional) KNX datapoint data to set in the created translator for translation @return the new {@link DPTXlator} object @throws KNXException if no matching DPT translator is available or creation failed (see {@link MainType#createTranslator(String)})
[ "Creates", "a", "DPT", "translator", "for", "the", "given", "datapoint", "type", "main", "/", "sub", "number", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java#L588-L603
google/closure-compiler
src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java
TypeTransformationParser.validTemplateTypeOfExpression
private boolean validTemplateTypeOfExpression(Node expr) { // The expression must have three children. The templateTypeOf keyword, a // templatized type and an index if (!checkParameterCount(expr, Keywords.TEMPLATETYPEOF)) { return false; } // The parameter must be a valid type expression if (!validTypeTransformationExpression(getCallArgument(expr, 0))) { warnInvalidInside(Keywords.TEMPLATETYPEOF.name, expr); return false; } if (!getCallArgument(expr, 1).isNumber()) { warnInvalid("index", expr); warnInvalidInside(Keywords.TEMPLATETYPEOF.name, expr); return false; } double index = getCallArgument(expr, 1).getDouble(); if (index < 0 || index % 1 != 0) { warnInvalid("index", expr); warnInvalidInside(Keywords.TEMPLATETYPEOF.name, expr); return false; } return true; }
java
private boolean validTemplateTypeOfExpression(Node expr) { // The expression must have three children. The templateTypeOf keyword, a // templatized type and an index if (!checkParameterCount(expr, Keywords.TEMPLATETYPEOF)) { return false; } // The parameter must be a valid type expression if (!validTypeTransformationExpression(getCallArgument(expr, 0))) { warnInvalidInside(Keywords.TEMPLATETYPEOF.name, expr); return false; } if (!getCallArgument(expr, 1).isNumber()) { warnInvalid("index", expr); warnInvalidInside(Keywords.TEMPLATETYPEOF.name, expr); return false; } double index = getCallArgument(expr, 1).getDouble(); if (index < 0 || index % 1 != 0) { warnInvalid("index", expr); warnInvalidInside(Keywords.TEMPLATETYPEOF.name, expr); return false; } return true; }
[ "private", "boolean", "validTemplateTypeOfExpression", "(", "Node", "expr", ")", "{", "// The expression must have three children. The templateTypeOf keyword, a", "// templatized type and an index", "if", "(", "!", "checkParameterCount", "(", "expr", ",", "Keywords", ".", "TEMP...
A template type of expression must be of the form templateTypeOf(TTLExp, index)
[ "A", "template", "type", "of", "expression", "must", "be", "of", "the", "form", "templateTypeOf", "(", "TTLExp", "index", ")" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java#L382-L405
lucee/Lucee
core/src/main/java/lucee/runtime/net/mail/MailUtil.java
MailUtil.parseEmail
public static InternetAddress parseEmail(Object value, InternetAddress defaultValue) { String str = Caster.toString(value, ""); if (str.indexOf('@') > -1) { try { str = fixIDN(str); InternetAddress addr = new InternetAddress(str); // fixIDN( addr ); return addr; } catch (AddressException ex) {} } return defaultValue; }
java
public static InternetAddress parseEmail(Object value, InternetAddress defaultValue) { String str = Caster.toString(value, ""); if (str.indexOf('@') > -1) { try { str = fixIDN(str); InternetAddress addr = new InternetAddress(str); // fixIDN( addr ); return addr; } catch (AddressException ex) {} } return defaultValue; }
[ "public", "static", "InternetAddress", "parseEmail", "(", "Object", "value", ",", "InternetAddress", "defaultValue", ")", "{", "String", "str", "=", "Caster", ".", "toString", "(", "value", ",", "\"\"", ")", ";", "if", "(", "str", ".", "indexOf", "(", "'",...
returns an InternetAddress object or null if the parsing fails. to be be used in multiple places. @param value @return
[ "returns", "an", "InternetAddress", "object", "or", "null", "if", "the", "parsing", "fails", ".", "to", "be", "be", "used", "in", "multiple", "places", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/mail/MailUtil.java#L184-L196
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/PersistenceBrokerFactoryDefaultImpl.java
PersistenceBrokerFactoryDefaultImpl.createPool
private GenericKeyedObjectPool createPool() { GenericKeyedObjectPool.Config conf = poolConfig.getKeyedObjectPoolConfig(); if (log.isDebugEnabled()) log.debug("PersistenceBroker pool will be setup with the following configuration " + ToStringBuilder.reflectionToString(conf, ToStringStyle.MULTI_LINE_STYLE)); GenericKeyedObjectPool pool = new GenericKeyedObjectPool(null, conf); pool.setFactory(new PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory(this, pool)); return pool; }
java
private GenericKeyedObjectPool createPool() { GenericKeyedObjectPool.Config conf = poolConfig.getKeyedObjectPoolConfig(); if (log.isDebugEnabled()) log.debug("PersistenceBroker pool will be setup with the following configuration " + ToStringBuilder.reflectionToString(conf, ToStringStyle.MULTI_LINE_STYLE)); GenericKeyedObjectPool pool = new GenericKeyedObjectPool(null, conf); pool.setFactory(new PersistenceBrokerFactoryDefaultImpl.PBKeyedPoolableObjectFactory(this, pool)); return pool; }
[ "private", "GenericKeyedObjectPool", "createPool", "(", ")", "{", "GenericKeyedObjectPool", ".", "Config", "conf", "=", "poolConfig", ".", "getKeyedObjectPoolConfig", "(", ")", ";", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "log", ".", "debug", "...
Create the {@link org.apache.commons.pool.KeyedObjectPool}, pooling the {@link PersistenceBroker} instances - override this method to implement your own pool and {@link org.apache.commons.pool.KeyedPoolableObjectFactory}.
[ "Create", "the", "{" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/PersistenceBrokerFactoryDefaultImpl.java#L216-L225
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/CQLTranslator.java
CQLTranslator.buildSetClause
public void buildSetClause(EntityMetadata m, StringBuilder builder, String property, Object value) { builder = ensureCase(builder, property, false); builder.append(EQ_CLAUSE); if (m.isCounterColumnType()) { builder = ensureCase(builder, property, false); builder.append(INCR_COUNTER); builder.append(value); } else { appendValue(builder, value.getClass(), value, false, false); } builder.append(COMMA_STR); }
java
public void buildSetClause(EntityMetadata m, StringBuilder builder, String property, Object value) { builder = ensureCase(builder, property, false); builder.append(EQ_CLAUSE); if (m.isCounterColumnType()) { builder = ensureCase(builder, property, false); builder.append(INCR_COUNTER); builder.append(value); } else { appendValue(builder, value.getClass(), value, false, false); } builder.append(COMMA_STR); }
[ "public", "void", "buildSetClause", "(", "EntityMetadata", "m", ",", "StringBuilder", "builder", ",", "String", "property", ",", "Object", "value", ")", "{", "builder", "=", "ensureCase", "(", "builder", ",", "property", ",", "false", ")", ";", "builder", "....
Builds set clause for a given field. @param m the m @param builder the builder @param property the property @param value the value
[ "Builds", "set", "clause", "for", "a", "given", "field", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/CQLTranslator.java#L973-L990
infinispan/infinispan
core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java
AtomicMapLookup.removeAtomicMap
public static <MK> void removeAtomicMap(Cache<MK, ?> cache, MK key) { // This removes any entry from the cache but includes special handling for fine-grained maps FineGrainedAtomicMapProxyImpl.removeMap((Cache<Object, Object>) cache, key); }
java
public static <MK> void removeAtomicMap(Cache<MK, ?> cache, MK key) { // This removes any entry from the cache but includes special handling for fine-grained maps FineGrainedAtomicMapProxyImpl.removeMap((Cache<Object, Object>) cache, key); }
[ "public", "static", "<", "MK", ">", "void", "removeAtomicMap", "(", "Cache", "<", "MK", ",", "?", ">", "cache", ",", "MK", "key", ")", "{", "// This removes any entry from the cache but includes special handling for fine-grained maps", "FineGrainedAtomicMapProxyImpl", "."...
Removes the atomic map associated with the given key from the underlying cache. @param cache underlying cache @param key key under which the atomic map exists @param <MK> key param of the cache
[ "Removes", "the", "atomic", "map", "associated", "with", "the", "given", "key", "from", "the", "underlying", "cache", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/atomic/AtomicMapLookup.java#L131-L134
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/BarcodeCodabar.java
BarcodeCodabar.getBarsCodabar
public static byte[] getBarsCodabar(String text) { text = text.toUpperCase(); int len = text.length(); if (len < 2) throw new IllegalArgumentException("Codabar must have at least a start and stop character."); if (CHARS.indexOf(text.charAt(0)) < START_STOP_IDX || CHARS.indexOf(text.charAt(len - 1)) < START_STOP_IDX) throw new IllegalArgumentException("Codabar must have one of 'ABCD' as start/stop character."); byte bars[] = new byte[text.length() * 8 - 1]; for (int k = 0; k < len; ++k) { int idx = CHARS.indexOf(text.charAt(k)); if (idx >= START_STOP_IDX && k > 0 && k < len - 1) throw new IllegalArgumentException("In codabar, start/stop characters are only allowed at the extremes."); if (idx < 0) throw new IllegalArgumentException("The character '" + text.charAt(k) + "' is illegal in codabar."); System.arraycopy(BARS[idx], 0, bars, k * 8, 7); } return bars; }
java
public static byte[] getBarsCodabar(String text) { text = text.toUpperCase(); int len = text.length(); if (len < 2) throw new IllegalArgumentException("Codabar must have at least a start and stop character."); if (CHARS.indexOf(text.charAt(0)) < START_STOP_IDX || CHARS.indexOf(text.charAt(len - 1)) < START_STOP_IDX) throw new IllegalArgumentException("Codabar must have one of 'ABCD' as start/stop character."); byte bars[] = new byte[text.length() * 8 - 1]; for (int k = 0; k < len; ++k) { int idx = CHARS.indexOf(text.charAt(k)); if (idx >= START_STOP_IDX && k > 0 && k < len - 1) throw new IllegalArgumentException("In codabar, start/stop characters are only allowed at the extremes."); if (idx < 0) throw new IllegalArgumentException("The character '" + text.charAt(k) + "' is illegal in codabar."); System.arraycopy(BARS[idx], 0, bars, k * 8, 7); } return bars; }
[ "public", "static", "byte", "[", "]", "getBarsCodabar", "(", "String", "text", ")", "{", "text", "=", "text", ".", "toUpperCase", "(", ")", ";", "int", "len", "=", "text", ".", "length", "(", ")", ";", "if", "(", "len", "<", "2", ")", "throw", "n...
Creates the bars. @param text the text to create the bars @return the bars
[ "Creates", "the", "bars", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BarcodeCodabar.java#L134-L151
JM-Lab/utils-elasticsearch
src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchDelete.java
JMElasticsearchDelete.deleteDoc
public DeleteResponse deleteDoc(String index, String type, String id) { return deleteQuery(esClient.prepareDelete(index, type, id)); }
java
public DeleteResponse deleteDoc(String index, String type, String id) { return deleteQuery(esClient.prepareDelete(index, type, id)); }
[ "public", "DeleteResponse", "deleteDoc", "(", "String", "index", ",", "String", "type", ",", "String", "id", ")", "{", "return", "deleteQuery", "(", "esClient", ".", "prepareDelete", "(", "index", ",", "type", ",", "id", ")", ")", ";", "}" ]
Delete doc delete response. @param index the index @param type the type @param id the id @return the delete response
[ "Delete", "doc", "delete", "response", "." ]
train
https://github.com/JM-Lab/utils-elasticsearch/blob/6ccec90e1e51d65d2af5efbb6d7b9f9bad90e638/src/main/java/kr/jm/utils/elasticsearch/JMElasticsearchDelete.java#L58-L60
zxing/zxing
core/src/main/java/com/google/zxing/common/BitMatrix.java
BitMatrix.parse
public static BitMatrix parse(boolean[][] image) { int height = image.length; int width = image[0].length; BitMatrix bits = new BitMatrix(width, height); for (int i = 0; i < height; i++) { boolean[] imageI = image[i]; for (int j = 0; j < width; j++) { if (imageI[j]) { bits.set(j, i); } } } return bits; }
java
public static BitMatrix parse(boolean[][] image) { int height = image.length; int width = image[0].length; BitMatrix bits = new BitMatrix(width, height); for (int i = 0; i < height; i++) { boolean[] imageI = image[i]; for (int j = 0; j < width; j++) { if (imageI[j]) { bits.set(j, i); } } } return bits; }
[ "public", "static", "BitMatrix", "parse", "(", "boolean", "[", "]", "[", "]", "image", ")", "{", "int", "height", "=", "image", ".", "length", ";", "int", "width", "=", "image", "[", "0", "]", ".", "length", ";", "BitMatrix", "bits", "=", "new", "B...
Interprets a 2D array of booleans as a {@code BitMatrix}, where "true" means an "on" bit. @param image bits of the image, as a row-major 2D array. Elements are arrays representing rows @return {@code BitMatrix} representation of image
[ "Interprets", "a", "2D", "array", "of", "booleans", "as", "a", "{", "@code", "BitMatrix", "}", "where", "true", "means", "an", "on", "bit", "." ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/common/BitMatrix.java#L81-L94
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java
Uris.getParametersFromMap
private static Iterable<String> getParametersFromMap(final Map<String, String> paramMap, final boolean strict) { return Iterables.transform(paramMap.entrySet(), new Function<Map.Entry<String, String>, String>() { @Override public String apply(final Map.Entry<String, String> input) { return input == null ? null : ENTRY_JOINER.join(UriEscaper.escapeQueryParam(input.getKey(), strict), UriEscaper.escapeQueryParam(input.getValue(), strict)); } }); }
java
private static Iterable<String> getParametersFromMap(final Map<String, String> paramMap, final boolean strict) { return Iterables.transform(paramMap.entrySet(), new Function<Map.Entry<String, String>, String>() { @Override public String apply(final Map.Entry<String, String> input) { return input == null ? null : ENTRY_JOINER.join(UriEscaper.escapeQueryParam(input.getKey(), strict), UriEscaper.escapeQueryParam(input.getValue(), strict)); } }); }
[ "private", "static", "Iterable", "<", "String", ">", "getParametersFromMap", "(", "final", "Map", "<", "String", ",", "String", ">", "paramMap", ",", "final", "boolean", "strict", ")", "{", "return", "Iterables", ".", "transform", "(", "paramMap", ".", "entr...
/* Returns a set of parameters for the given map - escaping the values as needed
[ "/", "*", "Returns", "a", "set", "of", "parameters", "for", "the", "given", "map", "-", "escaping", "the", "values", "as", "needed" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/thirdparty/Uris.java#L357-L364
glyptodon/guacamole-client
guacamole/src/main/java/org/apache/guacamole/tunnel/StreamInterceptingFilter.java
StreamInterceptingFilter.interceptStream
public void interceptStream(int index, T stream) throws GuacamoleException { InterceptedStream<T> interceptedStream; String indexString = Integer.toString(index); // Atomically verify tunnel is open and add the given stream synchronized (tunnel) { // Do nothing if tunnel is not open if (!tunnel.isOpen()) return; // Wrap stream interceptedStream = new InterceptedStream<T>(indexString, stream); // Replace any existing stream streams.put(interceptedStream); } // Produce/consume all stream data handleInterceptedStream(interceptedStream); // Wait for stream to close streams.waitFor(interceptedStream); // Throw any asynchronously-provided exception if (interceptedStream.hasStreamError()) throw interceptedStream.getStreamError(); }
java
public void interceptStream(int index, T stream) throws GuacamoleException { InterceptedStream<T> interceptedStream; String indexString = Integer.toString(index); // Atomically verify tunnel is open and add the given stream synchronized (tunnel) { // Do nothing if tunnel is not open if (!tunnel.isOpen()) return; // Wrap stream interceptedStream = new InterceptedStream<T>(indexString, stream); // Replace any existing stream streams.put(interceptedStream); } // Produce/consume all stream data handleInterceptedStream(interceptedStream); // Wait for stream to close streams.waitFor(interceptedStream); // Throw any asynchronously-provided exception if (interceptedStream.hasStreamError()) throw interceptedStream.getStreamError(); }
[ "public", "void", "interceptStream", "(", "int", "index", ",", "T", "stream", ")", "throws", "GuacamoleException", "{", "InterceptedStream", "<", "T", ">", "interceptedStream", ";", "String", "indexString", "=", "Integer", ".", "toString", "(", "index", ")", "...
Intercept the stream having the given index, producing or consuming its data as appropriate. The given stream object will automatically be closed when the stream ends. If there is no stream having the given index, then the stream object will be closed immediately. This function will block until all data has been handled and the stream is ended. @param index The index of the stream to intercept. @param stream The stream object which will produce or consume all data for the stream having the given index. @throws GuacamoleException If an error occurs while intercepting the stream, or if the stream itself reports an error.
[ "Intercept", "the", "stream", "having", "the", "given", "index", "producing", "or", "consuming", "its", "data", "as", "appropriate", ".", "The", "given", "stream", "object", "will", "automatically", "be", "closed", "when", "the", "stream", "ends", ".", "If", ...
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole/src/main/java/org/apache/guacamole/tunnel/StreamInterceptingFilter.java#L185-L215
czyzby/gdx-lml
kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/asset/Disposables.java
Disposables.gracefullyDisposeOf
public static void gracefullyDisposeOf(final Map<?, ? extends Disposable> disposables) { if (disposables != null) { for (final Disposable disposable : disposables.values()) { gracefullyDisposeOf(disposable); } } }
java
public static void gracefullyDisposeOf(final Map<?, ? extends Disposable> disposables) { if (disposables != null) { for (final Disposable disposable : disposables.values()) { gracefullyDisposeOf(disposable); } } }
[ "public", "static", "void", "gracefullyDisposeOf", "(", "final", "Map", "<", "?", ",", "?", "extends", "Disposable", ">", "disposables", ")", "{", "if", "(", "disposables", "!=", "null", ")", "{", "for", "(", "final", "Disposable", "disposable", ":", "disp...
Performs null checks and disposes of assets. Ignores exceptions. @param disposables its values will be disposed of (if they exist). Can be null.
[ "Performs", "null", "checks", "and", "disposes", "of", "assets", ".", "Ignores", "exceptions", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/asset/Disposables.java#L119-L125
phax/ph-commons
ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java
PDTHelper.getWeekDays
public static int getWeekDays (@Nonnull final LocalDate aStartDate, @Nonnull final LocalDate aEndDate) { ValueEnforcer.notNull (aStartDate, "StartDate"); ValueEnforcer.notNull (aEndDate, "EndDate"); final boolean bFlip = aStartDate.isAfter (aEndDate); LocalDate aCurDate = bFlip ? aEndDate : aStartDate; final LocalDate aRealEndDate = bFlip ? aStartDate : aEndDate; int ret = 0; while (!aRealEndDate.isBefore (aCurDate)) { if (!isWeekend (aCurDate)) ret++; aCurDate = aCurDate.plusDays (1); } return bFlip ? -1 * ret : ret; }
java
public static int getWeekDays (@Nonnull final LocalDate aStartDate, @Nonnull final LocalDate aEndDate) { ValueEnforcer.notNull (aStartDate, "StartDate"); ValueEnforcer.notNull (aEndDate, "EndDate"); final boolean bFlip = aStartDate.isAfter (aEndDate); LocalDate aCurDate = bFlip ? aEndDate : aStartDate; final LocalDate aRealEndDate = bFlip ? aStartDate : aEndDate; int ret = 0; while (!aRealEndDate.isBefore (aCurDate)) { if (!isWeekend (aCurDate)) ret++; aCurDate = aCurDate.plusDays (1); } return bFlip ? -1 * ret : ret; }
[ "public", "static", "int", "getWeekDays", "(", "@", "Nonnull", "final", "LocalDate", "aStartDate", ",", "@", "Nonnull", "final", "LocalDate", "aEndDate", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aStartDate", ",", "\"StartDate\"", ")", ";", "ValueEnforcer...
Count all non-weekend days in the range. Does not consider holidays! @param aStartDate start date @param aEndDate end date @return days not counting Saturdays and Sundays. If start date is after end date, the value will be negative! If start date equals end date the return will be 1 if it is a week day.
[ "Count", "all", "non", "-", "weekend", "days", "in", "the", "range", ".", "Does", "not", "consider", "holidays!" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-datetime/src/main/java/com/helger/datetime/util/PDTHelper.java#L148-L165
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/CollectionUtils.java
CollectionUtils.loadCollection
public static <T> void loadCollection(File file, Class<T> itemClass, Collection<T> collection) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, IOException { Constructor<T> itemConstructor = itemClass.getConstructor(String.class); BufferedReader in = new BufferedReader(new FileReader(file)); String line = in.readLine(); while (line != null && line.length() > 0) { T t = itemConstructor.newInstance(line); collection.add(t); line = in.readLine(); } in.close(); }
java
public static <T> void loadCollection(File file, Class<T> itemClass, Collection<T> collection) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException, IOException { Constructor<T> itemConstructor = itemClass.getConstructor(String.class); BufferedReader in = new BufferedReader(new FileReader(file)); String line = in.readLine(); while (line != null && line.length() > 0) { T t = itemConstructor.newInstance(line); collection.add(t); line = in.readLine(); } in.close(); }
[ "public", "static", "<", "T", ">", "void", "loadCollection", "(", "File", "file", ",", "Class", "<", "T", ">", "itemClass", ",", "Collection", "<", "T", ">", "collection", ")", "throws", "NoSuchMethodException", ",", "InstantiationException", ",", "IllegalAcce...
Adds the items from the file to the collection. @param <T> The type of the items. @param file The file from which items should be loaded. @param itemClass The class of the items (must have a constructor that accepts a String). @param collection The collection to which items should be added.
[ "Adds", "the", "items", "from", "the", "file", "to", "the", "collection", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/CollectionUtils.java#L195-L206
geomajas/geomajas-project-client-gwt2
impl/src/main/java/org/geomajas/gwt2/client/map/render/dom/container/HtmlImageImpl.java
HtmlImageImpl.onLoadingDone
public void onLoadingDone(Callback<String, String> onLoadingDone, int nrRetries) { ImageReloader reloader = new ImageReloader(getSrc(), onLoadingDone, nrRetries); asImage().addLoadHandler(reloader); asImage().addErrorHandler(reloader); }
java
public void onLoadingDone(Callback<String, String> onLoadingDone, int nrRetries) { ImageReloader reloader = new ImageReloader(getSrc(), onLoadingDone, nrRetries); asImage().addLoadHandler(reloader); asImage().addErrorHandler(reloader); }
[ "public", "void", "onLoadingDone", "(", "Callback", "<", "String", ",", "String", ">", "onLoadingDone", ",", "int", "nrRetries", ")", "{", "ImageReloader", "reloader", "=", "new", "ImageReloader", "(", "getSrc", "(", ")", ",", "onLoadingDone", ",", "nrRetries"...
Apply a call-back that is executed when the image is done loading. This image is done loading when it has either loaded successfully or when 5 attempts have failed. In any case, the callback's execute method will be invoked, thereby indicating success or failure. @param onLoadingDone The call-back to be executed when loading has finished. The boolean value indicates whether or not it was successful while loading. Both the success and failure type expect a String. This is used to pass along the image URL. @param nrRetries Total number of retries should loading fail. Default is 0.
[ "Apply", "a", "call", "-", "back", "that", "is", "executed", "when", "the", "image", "is", "done", "loading", ".", "This", "image", "is", "done", "loading", "when", "it", "has", "either", "loaded", "successfully", "or", "when", "5", "attempts", "have", "...
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/map/render/dom/container/HtmlImageImpl.java#L177-L181
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java
SideEffectConstructor.sawOpcode
@Override public void sawOpcode(int seen) { int pc = 0; try { stack.precomputation(this); switch (state) { case SAW_NOTHING: pc = sawOpcodeAfterNothing(seen); break; case SAW_CTOR: if ((seen == Const.POP) || (seen == Const.RETURN)) { bugReporter.reportBug(new BugInstance(this, BugType.SEC_SIDE_EFFECT_CONSTRUCTOR.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); } state = State.SAW_NOTHING; break; } } finally { TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); TernaryPatcher.post(stack, seen); if ((pc != 0) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(Integer.valueOf(pc)); } } }
java
@Override public void sawOpcode(int seen) { int pc = 0; try { stack.precomputation(this); switch (state) { case SAW_NOTHING: pc = sawOpcodeAfterNothing(seen); break; case SAW_CTOR: if ((seen == Const.POP) || (seen == Const.RETURN)) { bugReporter.reportBug(new BugInstance(this, BugType.SEC_SIDE_EFFECT_CONSTRUCTOR.name(), NORMAL_PRIORITY).addClass(this).addMethod(this) .addSourceLine(this)); } state = State.SAW_NOTHING; break; } } finally { TernaryPatcher.pre(stack, seen); stack.sawOpcode(this, seen); TernaryPatcher.post(stack, seen); if ((pc != 0) && (stack.getStackDepth() > 0)) { OpcodeStack.Item item = stack.getStackItem(0); item.setUserValue(Integer.valueOf(pc)); } } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "int", "pc", "=", "0", ";", "try", "{", "stack", ".", "precomputation", "(", "this", ")", ";", "switch", "(", "state", ")", "{", "case", "SAW_NOTHING", ":", "pc", "=", "s...
overrides the visitor to look for constructors who's value is popped off the stack, and not assigned before the pop of the value, or if a return is issued with that object still on the stack. @param seen the opcode of the currently parse opcode
[ "overrides", "the", "visitor", "to", "look", "for", "constructors", "who", "s", "value", "is", "popped", "off", "the", "stack", "and", "not", "assigned", "before", "the", "pop", "of", "the", "value", "or", "if", "a", "return", "is", "issued", "with", "th...
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SideEffectConstructor.java#L96-L124
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/Index.java
Index.saveSynonym
public JSONObject saveSynonym(String objectID, JSONObject content) throws AlgoliaException { return saveSynonym(objectID, content, false); }
java
public JSONObject saveSynonym(String objectID, JSONObject content) throws AlgoliaException { return saveSynonym(objectID, content, false); }
[ "public", "JSONObject", "saveSynonym", "(", "String", "objectID", ",", "JSONObject", "content", ")", "throws", "AlgoliaException", "{", "return", "saveSynonym", "(", "objectID", ",", "content", ",", "false", ")", ";", "}" ]
Update one synonym @param objectID The objectId of the synonym to save @param content The new content of this synonym
[ "Update", "one", "synonym" ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/Index.java#L1665-L1667
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/TagsApi.java
TagsApi.getClusterPhotos
public Photos getClusterPhotos(String tag, String clusterId) throws JinxException { JinxUtils.validateParams(tag, clusterId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.tags.getClusterPhotos"); params.put("tag", tag); params.put("cluster_id", clusterId); return jinx.flickrGet(params, Photos.class, false); }
java
public Photos getClusterPhotos(String tag, String clusterId) throws JinxException { JinxUtils.validateParams(tag, clusterId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.tags.getClusterPhotos"); params.put("tag", tag); params.put("cluster_id", clusterId); return jinx.flickrGet(params, Photos.class, false); }
[ "public", "Photos", "getClusterPhotos", "(", "String", "tag", ",", "String", "clusterId", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "tag", ",", "clusterId", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "="...
Returns the first 24 photos for a given tag cluster This method does not require authentication. @param tag the tag that the cluster belongs to. Required. @param clusterId top three tags for the cluster, separated by dashes. Required. @return first 24 photos for a given tag cluster. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.tags.getClusterPhotos.html">flickr.tags.getClusterPhotos</a>
[ "Returns", "the", "first", "24", "photos", "for", "a", "given", "tag", "cluster" ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/TagsApi.java#L63-L70
williamwebb/alogger
BillingHelper/src/main/java/com/jug6ernaut/billing/Security.java
Security.verify
public static boolean verify(PublicKey publicKey, String signedData, String signature) { Signature sig; try { sig = Signature.getInstance(SIGNATURE_ALGORITHM); sig.initVerify(publicKey); sig.update(signedData.getBytes()); if (!sig.verify(Base64.decode(signature))) { Log.e(TAG, "Signature verification failed."); return false; } return true; } catch (NoSuchAlgorithmException e) { Log.e(TAG, "NoSuchAlgorithmException."); } catch (InvalidKeyException e) { Log.e(TAG, "Invalid key specification."); } catch (SignatureException e) { Log.e(TAG, "Signature exception."); } catch (Base64DecoderException e) { Log.e(TAG, "Base64 decoding failed."); } return false; }
java
public static boolean verify(PublicKey publicKey, String signedData, String signature) { Signature sig; try { sig = Signature.getInstance(SIGNATURE_ALGORITHM); sig.initVerify(publicKey); sig.update(signedData.getBytes()); if (!sig.verify(Base64.decode(signature))) { Log.e(TAG, "Signature verification failed."); return false; } return true; } catch (NoSuchAlgorithmException e) { Log.e(TAG, "NoSuchAlgorithmException."); } catch (InvalidKeyException e) { Log.e(TAG, "Invalid key specification."); } catch (SignatureException e) { Log.e(TAG, "Signature exception."); } catch (Base64DecoderException e) { Log.e(TAG, "Base64 decoding failed."); } return false; }
[ "public", "static", "boolean", "verify", "(", "PublicKey", "publicKey", ",", "String", "signedData", ",", "String", "signature", ")", "{", "Signature", "sig", ";", "try", "{", "sig", "=", "Signature", ".", "getInstance", "(", "SIGNATURE_ALGORITHM", ")", ";", ...
Verifies that the signature from the server matches the computed signature on the data. Returns true if the data is correctly signed. @param publicKey public key associated with the developer account @param signedData signed data from server @param signature server signature @return true if the data and signature match
[ "Verifies", "that", "the", "signature", "from", "the", "server", "matches", "the", "computed", "signature", "on", "the", "data", ".", "Returns", "true", "if", "the", "data", "is", "correctly", "signed", "." ]
train
https://github.com/williamwebb/alogger/blob/61fca49e0b8d9c3a76c40da8883ac354b240351e/BillingHelper/src/main/java/com/jug6ernaut/billing/Security.java#L92-L113
hyperledger/fabric-sdk-java
src/main/java/org/hyperledger/fabric/sdk/Channel.java
Channel.queryBlockByTransactionID
public BlockInfo queryBlockByTransactionID(Collection<Peer> peers, String txID, User userContext) throws InvalidArgumentException, ProposalException { checkChannelState(); checkPeers(peers); User.userContextCheck(userContext); if (txID == null) { throw new InvalidArgumentException("TxID parameter is null."); } try { logger.debug("queryBlockByTransactionID with txID " + txID + " \n " + " on channel " + name); QuerySCCRequest querySCCRequest = new QuerySCCRequest(userContext); querySCCRequest.setFcn(QuerySCCRequest.GETBLOCKBYTXID); querySCCRequest.setArgs(name, txID); ProposalResponse proposalResponse = sendProposalSerially(querySCCRequest, peers); return new BlockInfo(Block.parseFrom(proposalResponse.getProposalResponse().getResponse().getPayload())); } catch (InvalidProtocolBufferException e) { throw new ProposalException(e); } }
java
public BlockInfo queryBlockByTransactionID(Collection<Peer> peers, String txID, User userContext) throws InvalidArgumentException, ProposalException { checkChannelState(); checkPeers(peers); User.userContextCheck(userContext); if (txID == null) { throw new InvalidArgumentException("TxID parameter is null."); } try { logger.debug("queryBlockByTransactionID with txID " + txID + " \n " + " on channel " + name); QuerySCCRequest querySCCRequest = new QuerySCCRequest(userContext); querySCCRequest.setFcn(QuerySCCRequest.GETBLOCKBYTXID); querySCCRequest.setArgs(name, txID); ProposalResponse proposalResponse = sendProposalSerially(querySCCRequest, peers); return new BlockInfo(Block.parseFrom(proposalResponse.getProposalResponse().getResponse().getPayload())); } catch (InvalidProtocolBufferException e) { throw new ProposalException(e); } }
[ "public", "BlockInfo", "queryBlockByTransactionID", "(", "Collection", "<", "Peer", ">", "peers", ",", "String", "txID", ",", "User", "userContext", ")", "throws", "InvalidArgumentException", ",", "ProposalException", "{", "checkChannelState", "(", ")", ";", "checkP...
query a peer in this channel for a Block by a TransactionID contained in the block @param peers the peer to try to send the request to @param txID the transactionID to query on @param userContext the user context. @return the {@link BlockInfo} for the Block containing the transaction @throws InvalidArgumentException @throws ProposalException
[ "query", "a", "peer", "in", "this", "channel", "for", "a", "Block", "by", "a", "TransactionID", "contained", "in", "the", "block" ]
train
https://github.com/hyperledger/fabric-sdk-java/blob/4a2d7b3408b8b0a1ed812aa36942c438159c37a0/src/main/java/org/hyperledger/fabric/sdk/Channel.java#L3033-L3057
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
SerializedFormBuilder.buildMethodDescription
public void buildMethodDescription(XMLNode node, Content methodsContentTree) { methodWriter.addMemberDescription((MethodDoc) currentMember, methodsContentTree); }
java
public void buildMethodDescription(XMLNode node, Content methodsContentTree) { methodWriter.addMemberDescription((MethodDoc) currentMember, methodsContentTree); }
[ "public", "void", "buildMethodDescription", "(", "XMLNode", "node", ",", "Content", "methodsContentTree", ")", "{", "methodWriter", ".", "addMemberDescription", "(", "(", "MethodDoc", ")", "currentMember", ",", "methodsContentTree", ")", ";", "}" ]
Build method description. @param node the XML element that specifies which components to document @param methodsContentTree content tree to which the documentation will be added
[ "Build", "method", "description", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java#L341-L343
powermock/powermock
powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java
PowerMock.mockStaticPartialStrict
public static synchronized void mockStaticPartialStrict(Class<?> clazz, String... methodNames) { mockStaticStrict(clazz, Whitebox.getMethods(clazz, methodNames)); }
java
public static synchronized void mockStaticPartialStrict(Class<?> clazz, String... methodNames) { mockStaticStrict(clazz, Whitebox.getMethods(clazz, methodNames)); }
[ "public", "static", "synchronized", "void", "mockStaticPartialStrict", "(", "Class", "<", "?", ">", "clazz", ",", "String", "...", "methodNames", ")", "{", "mockStaticStrict", "(", "clazz", ",", "Whitebox", ".", "getMethods", "(", "clazz", ",", "methodNames", ...
A utility method that may be used to mock several <b>static</b> methods (strict) in an easy way (by just passing in the method names of the method you wish to mock). Note that you cannot uniquely specify a method to mock using this method if there are several methods with the same name in {@code type}. This method will mock ALL methods that match the supplied name regardless of parameter types and signature. If this is the case you should fall-back on using the {@link #mockStaticStrict(Class, Method...)} method instead. @param clazz The class that contains the static methods that should be mocked. @param methodNames The names of the methods that should be mocked. If {@code null}, then this method will have the same effect as just calling {@link #mockStatic(Class, Method...)} with the second parameter as {@code new Method[0]} (i.e. all methods in that class will be mocked).
[ "A", "utility", "method", "that", "may", "be", "used", "to", "mock", "several", "<b", ">", "static<", "/", "b", ">", "methods", "(", "strict", ")", "in", "an", "easy", "way", "(", "by", "just", "passing", "in", "the", "method", "names", "of", "the", ...
train
https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-api/powermock-api-easymock/src/main/java/org/powermock/api/easymock/PowerMock.java#L591-L593
JDBDT/jdbdt
src/main/java/org/jdbdt/DB.java
DB.logSnapshot
void logSnapshot(CallInfo callInfo, DataSet data) { if (isEnabled(Option.LOG_SNAPSHOTS)) { log.write(callInfo, data); } }
java
void logSnapshot(CallInfo callInfo, DataSet data) { if (isEnabled(Option.LOG_SNAPSHOTS)) { log.write(callInfo, data); } }
[ "void", "logSnapshot", "(", "CallInfo", "callInfo", ",", "DataSet", "data", ")", "{", "if", "(", "isEnabled", "(", "Option", ".", "LOG_SNAPSHOTS", ")", ")", "{", "log", ".", "write", "(", "callInfo", ",", "data", ")", ";", "}", "}" ]
Log query result. @param callInfo Call info. @param data Data set.
[ "Log", "query", "result", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DB.java#L479-L483
infinispan/infinispan
lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/impl/InfinispanConfigurationParser.java
InfinispanConfigurationParser.parseFile
public ConfigurationBuilderHolder parseFile(String filename, String transportOverrideResource, ServiceManager serviceManager) throws IOException { ClassLoaderService classLoaderService = serviceManager.requestService(ClassLoaderService.class); try { return parseFile(classLoaderService, filename, transportOverrideResource); } finally { serviceManager.releaseService(ClassLoaderService.class); } }
java
public ConfigurationBuilderHolder parseFile(String filename, String transportOverrideResource, ServiceManager serviceManager) throws IOException { ClassLoaderService classLoaderService = serviceManager.requestService(ClassLoaderService.class); try { return parseFile(classLoaderService, filename, transportOverrideResource); } finally { serviceManager.releaseService(ClassLoaderService.class); } }
[ "public", "ConfigurationBuilderHolder", "parseFile", "(", "String", "filename", ",", "String", "transportOverrideResource", ",", "ServiceManager", "serviceManager", ")", "throws", "IOException", "{", "ClassLoaderService", "classLoaderService", "=", "serviceManager", ".", "r...
Resolves an Infinispan configuration file but using the Hibernate Search classloader. The returned Infinispan configuration template also overrides Infinispan's runtime classloader to the one of Hibernate Search. @param filename Infinispan configuration resource name @param transportOverrideResource An alternative JGroups configuration file to be injected @param serviceManager the ServiceManager to load resources @return @throws IOException
[ "Resolves", "an", "Infinispan", "configuration", "file", "but", "using", "the", "Hibernate", "Search", "classloader", ".", "The", "returned", "Infinispan", "configuration", "template", "also", "overrides", "Infinispan", "s", "runtime", "classloader", "to", "the", "o...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/directory-provider/src/main/java/org/infinispan/hibernate/search/impl/InfinispanConfigurationParser.java#L44-L51
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Parameters.java
Parameters.setDictionary
@NonNull public Parameters setDictionary(@NonNull String name, Dictionary value) { return setValue(name, value); }
java
@NonNull public Parameters setDictionary(@NonNull String name, Dictionary value) { return setValue(name, value); }
[ "@", "NonNull", "public", "Parameters", "setDictionary", "(", "@", "NonNull", "String", "name", ",", "Dictionary", "value", ")", "{", "return", "setValue", "(", "name", ",", "value", ")", ";", "}" ]
Set the Dictionary value to the query parameter referenced by the given name. A query parameter is defined by using the Expression's parameter(String name) function. @param name The parameter name. @param value The Dictionary value. @return The self object.
[ "Set", "the", "Dictionary", "value", "to", "the", "query", "parameter", "referenced", "by", "the", "given", "name", ".", "A", "query", "parameter", "is", "defined", "by", "using", "the", "Expression", "s", "parameter", "(", "String", "name", ")", "function",...
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L196-L199
graphhopper/graphhopper
api/src/main/java/com/graphhopper/util/shapes/BBox.java
BBox.parseTwoPoints
public static BBox parseTwoPoints(String objectAsString) { String[] splittedObject = objectAsString.split(","); if (splittedObject.length != 4) throw new IllegalArgumentException("BBox should have 4 parts but was " + objectAsString); double minLat = Double.parseDouble(splittedObject[0]); double minLon = Double.parseDouble(splittedObject[1]); double maxLat = Double.parseDouble(splittedObject[2]); double maxLon = Double.parseDouble(splittedObject[3]); if (minLat > maxLat) { double tmp = minLat; minLat = maxLat; maxLat = tmp; } if (minLon > maxLon) { double tmp = minLon; minLon = maxLon; maxLon = tmp; } return new BBox(minLon, maxLon, minLat, maxLat); }
java
public static BBox parseTwoPoints(String objectAsString) { String[] splittedObject = objectAsString.split(","); if (splittedObject.length != 4) throw new IllegalArgumentException("BBox should have 4 parts but was " + objectAsString); double minLat = Double.parseDouble(splittedObject[0]); double minLon = Double.parseDouble(splittedObject[1]); double maxLat = Double.parseDouble(splittedObject[2]); double maxLon = Double.parseDouble(splittedObject[3]); if (minLat > maxLat) { double tmp = minLat; minLat = maxLat; maxLat = tmp; } if (minLon > maxLon) { double tmp = minLon; minLon = maxLon; maxLon = tmp; } return new BBox(minLon, maxLon, minLat, maxLat); }
[ "public", "static", "BBox", "parseTwoPoints", "(", "String", "objectAsString", ")", "{", "String", "[", "]", "splittedObject", "=", "objectAsString", ".", "split", "(", "\",\"", ")", ";", "if", "(", "splittedObject", ".", "length", "!=", "4", ")", "throw", ...
This method creates a BBox out of a string in format lat1,lon1,lat2,lon2
[ "This", "method", "creates", "a", "BBox", "out", "of", "a", "string", "in", "format", "lat1", "lon1", "lat2", "lon2" ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/api/src/main/java/com/graphhopper/util/shapes/BBox.java#L304-L329
elki-project/elki
elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/projection/TSNE.java
TSNE.sqDist
protected double sqDist(double[] v1, double[] v2) { assert (v1.length == v2.length) : "Lengths do not agree: " + v1.length + " " + v2.length; double sum = 0; for(int i = 0; i < v1.length; i++) { final double diff = v1[i] - v2[i]; sum += diff * diff; } ++projectedDistances; return sum; }
java
protected double sqDist(double[] v1, double[] v2) { assert (v1.length == v2.length) : "Lengths do not agree: " + v1.length + " " + v2.length; double sum = 0; for(int i = 0; i < v1.length; i++) { final double diff = v1[i] - v2[i]; sum += diff * diff; } ++projectedDistances; return sum; }
[ "protected", "double", "sqDist", "(", "double", "[", "]", "v1", ",", "double", "[", "]", "v2", ")", "{", "assert", "(", "v1", ".", "length", "==", "v2", ".", "length", ")", ":", "\"Lengths do not agree: \"", "+", "v1", ".", "length", "+", "\" \"", "+...
Squared distance, in projection space. @param v1 First vector @param v2 Second vector @return Squared distance
[ "Squared", "distance", "in", "projection", "space", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/projection/TSNE.java#L296-L305
WASdev/tool.accelerate.core
liberty-starter-application/src/main/java/com/ibm/liberty/starter/build/maven/DomUtil.java
DomUtil.getChildNode
public static Node getChildNode(Node parentNode, String name, String value){ List<Node> matchingChildren = getChildren(parentNode, name, value); return (matchingChildren.size() > 0) ? matchingChildren.get(0) : null; }
java
public static Node getChildNode(Node parentNode, String name, String value){ List<Node> matchingChildren = getChildren(parentNode, name, value); return (matchingChildren.size() > 0) ? matchingChildren.get(0) : null; }
[ "public", "static", "Node", "getChildNode", "(", "Node", "parentNode", ",", "String", "name", ",", "String", "value", ")", "{", "List", "<", "Node", ">", "matchingChildren", "=", "getChildren", "(", "parentNode", ",", "name", ",", "value", ")", ";", "retur...
Get the matching child node @param parentNode - the parent node @param name - name of child node to match @param value - value of child node to match, specify null to not match value @return the child node if a match was found, null otherwise
[ "Get", "the", "matching", "child", "node" ]
train
https://github.com/WASdev/tool.accelerate.core/blob/6511da654a69a25a76573eb76eefff349d9c4d80/liberty-starter-application/src/main/java/com/ibm/liberty/starter/build/maven/DomUtil.java#L50-L53
l0s/fernet-java8
fernet-aws-secrets-manager-rotator/src/main/java/com/macasaet/fernet/aws/secretsmanager/rotation/SecretsManager.java
SecretsManager.putSecretValue
public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); }
java
public void putSecretValue(final String secretId, final String clientRequestToken, final Key key, final Stage stage) { putSecretValue(secretId, clientRequestToken, singletonList(key), stage); }
[ "public", "void", "putSecretValue", "(", "final", "String", "secretId", ",", "final", "String", "clientRequestToken", ",", "final", "Key", "key", ",", "final", "Stage", "stage", ")", "{", "putSecretValue", "(", "secretId", ",", "clientRequestToken", ",", "single...
Store a single Fernet key in a secret. This requires the permission <code>secretsmanager:PutSecretValue</code> @param secretId the ARN of the secret @param clientRequestToken the secret version identifier @param key the key to store in the secret @param stage the stage with which to tag the version
[ "Store", "a", "single", "Fernet", "key", "in", "a", "secret", ".", "This", "requires", "the", "permission", "<code", ">", "secretsmanager", ":", "PutSecretValue<", "/", "code", ">" ]
train
https://github.com/l0s/fernet-java8/blob/427244bc1af605ffca0ac2469d66b297ea9f77b3/fernet-aws-secrets-manager-rotator/src/main/java/com/macasaet/fernet/aws/secretsmanager/rotation/SecretsManager.java#L147-L149
jglobus/JGlobus
myproxy/src/main/java/org/globus/myproxy/MyProxy.java
MyProxy.opensslHash
protected static String opensslHash(X509Certificate cert) { try { return openssl_X509_NAME_hash(cert.getSubjectX500Principal()); } catch (Exception e) { throw new Error("MD5 isn't available!", e); } }
java
protected static String opensslHash(X509Certificate cert) { try { return openssl_X509_NAME_hash(cert.getSubjectX500Principal()); } catch (Exception e) { throw new Error("MD5 isn't available!", e); } }
[ "protected", "static", "String", "opensslHash", "(", "X509Certificate", "cert", ")", "{", "try", "{", "return", "openssl_X509_NAME_hash", "(", "cert", ".", "getSubjectX500Principal", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", ...
/* the following methods are based off code to compute the subject name hash from: http://blog.piefox.com/2008/10/javaopenssl-ca-generation.html
[ "/", "*", "the", "following", "methods", "are", "based", "off", "code", "to", "compute", "the", "subject", "name", "hash", "from", ":", "http", ":", "//", "blog", ".", "piefox", ".", "com", "/", "2008", "/", "10", "/", "javaopenssl", "-", "ca", "-", ...
train
https://github.com/jglobus/JGlobus/blob/e14f6f6636544fd84298f9cec749d626ea971930/myproxy/src/main/java/org/globus/myproxy/MyProxy.java#L1497-L1504
OpenLiberty/open-liberty
dev/com.ibm.ws.jsfContainer_fat_2.2/fat/src/com/ibm/ws/jsf/container/fat/JSFUtils.java
JSFUtils.createHttpUrl
public static URL createHttpUrl(LibertyServer server, String contextRoot, String path) throws Exception { URL result = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/" + contextRoot + "/" + path); return result; }
java
public static URL createHttpUrl(LibertyServer server, String contextRoot, String path) throws Exception { URL result = new URL("http://" + server.getHostname() + ":" + server.getHttpDefaultPort() + "/" + contextRoot + "/" + path); return result; }
[ "public", "static", "URL", "createHttpUrl", "(", "LibertyServer", "server", ",", "String", "contextRoot", ",", "String", "path", ")", "throws", "Exception", "{", "URL", "result", "=", "new", "URL", "(", "\"http://\"", "+", "server", ".", "getHostname", "(", ...
Construct a URL for a test case so a request can be made. @param server - The server that is under test, this is used to get the port and host name. @param contextRoot - The context root of the application @param path - Additional path information for the request. @return - A fully formed URL. @throws Exception
[ "Construct", "a", "URL", "for", "a", "test", "case", "so", "a", "request", "can", "be", "made", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsfContainer_fat_2.2/fat/src/com/ibm/ws/jsf/container/fat/JSFUtils.java#L36-L41
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java
ProcessGroovyMethods.leftShift
public static OutputStream leftShift(Process self, byte[] value) throws IOException { return IOGroovyMethods.leftShift(self.getOutputStream(), value); }
java
public static OutputStream leftShift(Process self, byte[] value) throws IOException { return IOGroovyMethods.leftShift(self.getOutputStream(), value); }
[ "public", "static", "OutputStream", "leftShift", "(", "Process", "self", ",", "byte", "[", "]", "value", ")", "throws", "IOException", "{", "return", "IOGroovyMethods", ".", "leftShift", "(", "self", ".", "getOutputStream", "(", ")", ",", "value", ")", ";", ...
Overloads the left shift operator to provide an append mechanism to pipe into a Process @param self a Process instance @param value data to append @return an OutputStream @throws java.io.IOException if an IOException occurs. @since 1.0
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "append", "mechanism", "to", "pipe", "into", "a", "Process" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L128-L130
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/ClassHelper.java
ClassHelper.newInstance
public static Object newInstance(String className, Class[] types, Object[] args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException { return newInstance(getClass(className), types, args); }
java
public static Object newInstance(String className, Class[] types, Object[] args) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException { return newInstance(getClass(className), types, args); }
[ "public", "static", "Object", "newInstance", "(", "String", "className", ",", "Class", "[", "]", "types", ",", "Object", "[", "]", "args", ")", "throws", "InstantiationException", ",", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTarget...
Returns a new instance of the class with the given qualified name using the constructor with the specified signature. @param className The qualified name of the class to instantiate @param types The parameter types @param args The arguments @return The instance
[ "Returns", "a", "new", "instance", "of", "the", "class", "with", "the", "given", "qualified", "name", "using", "the", "constructor", "with", "the", "specified", "signature", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ClassHelper.java#L301-L310
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/TableBucketReader.java
TableBucketReader.findAllExisting
CompletableFuture<List<ResultT>> findAllExisting(long bucketOffset, TimeoutTimer timer) { val result = new HashMap<HashedArray, ResultT>(); // This handler ensures that items are only added once (per key) and only if they are not deleted. Since the items // are processed in descending version order, the first time we encounter its key is its latest value. BiConsumer<ResultT, Long> handler = (item, offset) -> { TableKey key = getKey(item); HashedArray indexedKey = new HashedArray(key.getKey()); if (!result.containsKey(indexedKey)) { result.put(indexedKey, key.getVersion() == TableKey.NOT_EXISTS ? null : item); } }; return findAll(bucketOffset, handler, timer) .thenApply(v -> result.values().stream().filter(Objects::nonNull).collect(Collectors.toList())); }
java
CompletableFuture<List<ResultT>> findAllExisting(long bucketOffset, TimeoutTimer timer) { val result = new HashMap<HashedArray, ResultT>(); // This handler ensures that items are only added once (per key) and only if they are not deleted. Since the items // are processed in descending version order, the first time we encounter its key is its latest value. BiConsumer<ResultT, Long> handler = (item, offset) -> { TableKey key = getKey(item); HashedArray indexedKey = new HashedArray(key.getKey()); if (!result.containsKey(indexedKey)) { result.put(indexedKey, key.getVersion() == TableKey.NOT_EXISTS ? null : item); } }; return findAll(bucketOffset, handler, timer) .thenApply(v -> result.values().stream().filter(Objects::nonNull).collect(Collectors.toList())); }
[ "CompletableFuture", "<", "List", "<", "ResultT", ">", ">", "findAllExisting", "(", "long", "bucketOffset", ",", "TimeoutTimer", "timer", ")", "{", "val", "result", "=", "new", "HashMap", "<", "HashedArray", ",", "ResultT", ">", "(", ")", ";", "// This handl...
Locates all {@link ResultT} instances in a TableBucket. @param bucketOffset The current segment offset of the Table Bucket we are looking into. @param timer A {@link TimeoutTimer} for the operation. @return A CompletableFuture that, when completed, will contain a List with the desired result items. This list will exclude all {@link ResultT} items that are marked as deleted.
[ "Locates", "all", "{", "@link", "ResultT", "}", "instances", "in", "a", "TableBucket", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/tables/TableBucketReader.java#L92-L106
eclipse/xtext-core
org.eclipse.xtext.util/src/org/eclipse/xtext/util/JavaStringConverter.java
JavaStringConverter.convertToJavaString
public String convertToJavaString(String input, boolean useUnicode) { int length = input.length(); StringBuilder result = new StringBuilder(length + 4); for (int i = 0; i < length; i++) { escapeAndAppendTo(input.charAt(i), useUnicode, result); } return result.toString(); }
java
public String convertToJavaString(String input, boolean useUnicode) { int length = input.length(); StringBuilder result = new StringBuilder(length + 4); for (int i = 0; i < length; i++) { escapeAndAppendTo(input.charAt(i), useUnicode, result); } return result.toString(); }
[ "public", "String", "convertToJavaString", "(", "String", "input", ",", "boolean", "useUnicode", ")", "{", "int", "length", "=", "input", ".", "length", "(", ")", ";", "StringBuilder", "result", "=", "new", "StringBuilder", "(", "length", "+", "4", ")", ";...
Escapes control characters with a preceding backslash. Optionally encodes special chars as unicode escape sequence. The resulting string is safe to be put into a Java string literal between the quotes.
[ "Escapes", "control", "characters", "with", "a", "preceding", "backslash", ".", "Optionally", "encodes", "special", "chars", "as", "unicode", "escape", "sequence", ".", "The", "resulting", "string", "is", "safe", "to", "be", "put", "into", "a", "Java", "string...
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.util/src/org/eclipse/xtext/util/JavaStringConverter.java#L181-L188
QSFT/Doradus
doradus-common/src/main/java/com/dell/doradus/common/Utils.java
Utils.base64FromBinary
public static String base64FromBinary(byte[] value, int offset, int length) throws IllegalArgumentException { return DatatypeConverter.printBase64Binary(Arrays.copyOfRange(value, offset, offset + length)); }
java
public static String base64FromBinary(byte[] value, int offset, int length) throws IllegalArgumentException { return DatatypeConverter.printBase64Binary(Arrays.copyOfRange(value, offset, offset + length)); }
[ "public", "static", "String", "base64FromBinary", "(", "byte", "[", "]", "value", ",", "int", "offset", ",", "int", "length", ")", "throws", "IllegalArgumentException", "{", "return", "DatatypeConverter", ".", "printBase64Binary", "(", "Arrays", ".", "copyOfRange"...
Convert (encode) the given binary value, beginning at the given offset and consisting of the given length, using Base64. @param value A binary value. @param offset Zero-based index where data begins. @param length Number of bytes to encode. @return Base64-encoded value. @throws IllegalArgumentException If the given value is null.
[ "Convert", "(", "encode", ")", "the", "given", "binary", "value", "beginning", "at", "the", "given", "offset", "and", "consisting", "of", "the", "given", "length", "using", "Base64", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-common/src/main/java/com/dell/doradus/common/Utils.java#L189-L191
cloudant/sync-android
cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java
DatabaseImpl.insertLocalDocument
public LocalDocument insertLocalDocument(final String docId, final DocumentBody body) throws DocumentException { Misc.checkState(this.isOpen(), "Database is closed"); CouchUtils.validateDocumentId(docId); Misc.checkNotNull(body, "Input document body"); try { return get(queue.submit(new InsertLocalDocumentCallable(docId, body))); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Failed to insert local document", e); throw new DocumentException("Cannot insert local document", e); } }
java
public LocalDocument insertLocalDocument(final String docId, final DocumentBody body) throws DocumentException { Misc.checkState(this.isOpen(), "Database is closed"); CouchUtils.validateDocumentId(docId); Misc.checkNotNull(body, "Input document body"); try { return get(queue.submit(new InsertLocalDocumentCallable(docId, body))); } catch (ExecutionException e) { logger.log(Level.SEVERE, "Failed to insert local document", e); throw new DocumentException("Cannot insert local document", e); } }
[ "public", "LocalDocument", "insertLocalDocument", "(", "final", "String", "docId", ",", "final", "DocumentBody", "body", ")", "throws", "DocumentException", "{", "Misc", ".", "checkState", "(", "this", ".", "isOpen", "(", ")", ",", "\"Database is closed\"", ")", ...
<p>Inserts a local document with an ID and body. Replacing the current local document of the same ID if one is present. </p> <p>Local documents are not replicated between DocumentStores.</p> @param docId The document ID for the document @param body JSON body for the document @return {@code DocumentRevision} of the newly created document @throws DocumentException if there is an error inserting the local document into the database
[ "<p", ">", "Inserts", "a", "local", "document", "with", "an", "ID", "and", "body", ".", "Replacing", "the", "current", "local", "document", "of", "the", "same", "ID", "if", "one", "is", "present", ".", "<", "/", "p", ">" ]
train
https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java#L453-L464
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/OrientedBox3f.java
OrientedBox3f.setFirstAxis
@Override public void setFirstAxis(double x, double y, double z) { setFirstAxis(x, y, z, getFirstAxisExtent()); }
java
@Override public void setFirstAxis(double x, double y, double z) { setFirstAxis(x, y, z, getFirstAxisExtent()); }
[ "@", "Override", "public", "void", "setFirstAxis", "(", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "setFirstAxis", "(", "x", ",", "y", ",", "z", ",", "getFirstAxisExtent", "(", ")", ")", ";", "}" ]
Set the first axis of the box. The third axis is updated to be perpendicular to the two other axis. @param x @param y @param z
[ "Set", "the", "first", "axis", "of", "the", "box", ".", "The", "third", "axis", "is", "updated", "to", "be", "perpendicular", "to", "the", "two", "other", "axis", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/OrientedBox3f.java#L426-L429
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.project_serviceName_instance_group_GET
public ArrayList<OvhInstanceGroup> project_serviceName_instance_group_GET(String serviceName, String region) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/group"; StringBuilder sb = path(qPath, serviceName); query(sb, "region", region); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t23); }
java
public ArrayList<OvhInstanceGroup> project_serviceName_instance_group_GET(String serviceName, String region) throws IOException { String qPath = "/cloud/project/{serviceName}/instance/group"; StringBuilder sb = path(qPath, serviceName); query(sb, "region", region); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t23); }
[ "public", "ArrayList", "<", "OvhInstanceGroup", ">", "project_serviceName_instance_group_GET", "(", "String", "serviceName", ",", "String", "region", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/cloud/project/{serviceName}/instance/group\"", ";", "StringBu...
Get the detail of a group REST: GET /cloud/project/{serviceName}/instance/group @param region [required] Instance region @param serviceName [required] Project id
[ "Get", "the", "detail", "of", "a", "group" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2116-L2122
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/filemgr/FileManagerImpl.java
FileManagerImpl.add_new_block_to_freelist
private void add_new_block_to_freelist(long addr, int size, int ql_index) { Block block = new Block(); block.address = addr; block.size = size; add_block_to_freelist(block, ql_index); free_blocks++; free_words += size; }
java
private void add_new_block_to_freelist(long addr, int size, int ql_index) { Block block = new Block(); block.address = addr; block.size = size; add_block_to_freelist(block, ql_index); free_blocks++; free_words += size; }
[ "private", "void", "add_new_block_to_freelist", "(", "long", "addr", ",", "int", "size", ",", "int", "ql_index", ")", "{", "Block", "block", "=", "new", "Block", "(", ")", ";", "block", ".", "address", "=", "addr", ";", "block", ".", "size", "=", "size...
/* Add a new block to the beginning of a free list data structure, increment counters
[ "/", "*", "Add", "a", "new", "block", "to", "the", "beginning", "of", "a", "free", "list", "data", "structure", "increment", "counters" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/persistent/filemgr/FileManagerImpl.java#L1139-L1148
meertensinstituut/mtas
src/main/java/mtas/analysis/parser/MtasBasicParser.java
MtasBasicParser.addAndEncodeVariable
private String addAndEncodeVariable(String originalValue, String newVariable, String newVariableName, boolean encode) { return addAndEncode(originalValue, newVariable, newVariableName, encode); }
java
private String addAndEncodeVariable(String originalValue, String newVariable, String newVariableName, boolean encode) { return addAndEncode(originalValue, newVariable, newVariableName, encode); }
[ "private", "String", "addAndEncodeVariable", "(", "String", "originalValue", ",", "String", "newVariable", ",", "String", "newVariableName", ",", "boolean", "encode", ")", "{", "return", "addAndEncode", "(", "originalValue", ",", "newVariable", ",", "newVariableName",...
Adds the and encode variable. @param originalValue the original value @param newVariable the new variable @param newVariableName the new variable name @param encode the encode @return the string
[ "Adds", "the", "and", "encode", "variable", "." ]
train
https://github.com/meertensinstituut/mtas/blob/f02ae730848616bd88b553efa7f9eddc32818e64/src/main/java/mtas/analysis/parser/MtasBasicParser.java#L1018-L1021
visallo/vertexium
core/src/main/java/org/vertexium/ElementBuilder.java
ElementBuilder.setProperty
public ElementBuilder<T> setProperty(String name, Object value, Metadata metadata, Visibility visibility) { return addPropertyValue(ElementMutation.DEFAULT_KEY, name, value, metadata, visibility); }
java
public ElementBuilder<T> setProperty(String name, Object value, Metadata metadata, Visibility visibility) { return addPropertyValue(ElementMutation.DEFAULT_KEY, name, value, metadata, visibility); }
[ "public", "ElementBuilder", "<", "T", ">", "setProperty", "(", "String", "name", ",", "Object", "value", ",", "Metadata", "metadata", ",", "Visibility", "visibility", ")", "{", "return", "addPropertyValue", "(", "ElementMutation", ".", "DEFAULT_KEY", ",", "name"...
Sets or updates a property value. The property key will be set to a constant. This is a convenience method which allows treating the multi-valued nature of properties as only containing a single value. Care must be taken when using this method because properties are not only uniquely identified by just key and name but also visibility so adding properties with the same name and different visibility strings is still permitted. <p> The added property will also be indexed in the configured search provider. The type of the value will determine how it gets indexed. @param name The name of the property. @param value The value of the property. @param metadata The metadata to assign to this property. @param visibility The visibility to give this property.
[ "Sets", "or", "updates", "a", "property", "value", ".", "The", "property", "key", "will", "be", "set", "to", "a", "constant", ".", "This", "is", "a", "convenience", "method", "which", "allows", "treating", "the", "multi", "-", "valued", "nature", "of", "...
train
https://github.com/visallo/vertexium/blob/bb132b5425ac168957667164e1409b78adbea769/core/src/main/java/org/vertexium/ElementBuilder.java#L61-L63
cdk/cdk
display/renderextra/src/main/java/org/openscience/cdk/renderer/generators/HighlightGenerator.java
HighlightGenerator.createPalette
public static Palette createPalette(final Color color, final Color... colors) { Color[] cs = new Color[colors.length + 1]; cs[0] = color; System.arraycopy(colors, 0, cs, 1, colors.length); return new FixedPalette(cs); }
java
public static Palette createPalette(final Color color, final Color... colors) { Color[] cs = new Color[colors.length + 1]; cs[0] = color; System.arraycopy(colors, 0, cs, 1, colors.length); return new FixedPalette(cs); }
[ "public", "static", "Palette", "createPalette", "(", "final", "Color", "color", ",", "final", "Color", "...", "colors", ")", "{", "Color", "[", "]", "cs", "=", "new", "Color", "[", "colors", ".", "length", "+", "1", "]", ";", "cs", "[", "0", "]", "...
Create a palette which uses the provided colors. @param colors colors to use in the palette @return a palette to use in highlighting
[ "Create", "a", "palette", "which", "uses", "the", "provided", "colors", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderextra/src/main/java/org/openscience/cdk/renderer/generators/HighlightGenerator.java#L250-L255
alkacon/opencms-core
src/org/opencms/jsp/CmsJspActionElement.java
CmsJspActionElement.getMessages
public CmsMessages getMessages(String bundleName, String language) { return getMessages(bundleName, language, "", "", null); }
java
public CmsMessages getMessages(String bundleName, String language) { return getMessages(bundleName, language, "", "", null); }
[ "public", "CmsMessages", "getMessages", "(", "String", "bundleName", ",", "String", "language", ")", "{", "return", "getMessages", "(", "bundleName", ",", "language", ",", "\"\"", ",", "\"\"", ",", "null", ")", ";", "}" ]
Generates an initialized instance of {@link CmsMessages} for convenient access to localized resource bundles.<p> @param bundleName the name of the ResourceBundle to use @param language language identifier for the locale of the bundle @return CmsMessages a message bundle initialized with the provided values
[ "Generates", "an", "initialized", "instance", "of", "{", "@link", "CmsMessages", "}", "for", "convenient", "access", "to", "localized", "resource", "bundles", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspActionElement.java#L286-L289
bitcoinj/bitcoinj
core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java
KeyChainGroup.mergeActiveKeyChains
public final void mergeActiveKeyChains(KeyChainGroup from, long keyRotationTimeSecs) { checkArgument(isEncrypted() == from.isEncrypted(), "encrypted and non-encrypted keychains cannot be mixed"); for (DeterministicKeyChain chain : from.getActiveKeyChains(keyRotationTimeSecs)) addAndActivateHDChain(chain); }
java
public final void mergeActiveKeyChains(KeyChainGroup from, long keyRotationTimeSecs) { checkArgument(isEncrypted() == from.isEncrypted(), "encrypted and non-encrypted keychains cannot be mixed"); for (DeterministicKeyChain chain : from.getActiveKeyChains(keyRotationTimeSecs)) addAndActivateHDChain(chain); }
[ "public", "final", "void", "mergeActiveKeyChains", "(", "KeyChainGroup", "from", ",", "long", "keyRotationTimeSecs", ")", "{", "checkArgument", "(", "isEncrypted", "(", ")", "==", "from", ".", "isEncrypted", "(", ")", ",", "\"encrypted and non-encrypted keychains cann...
Merge all active chains from the given keychain group into this keychain group.
[ "Merge", "all", "active", "chains", "from", "the", "given", "keychain", "group", "into", "this", "keychain", "group", "." ]
train
https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/wallet/KeyChainGroup.java#L435-L439
ggrandes/packer
src/main/java/org/javastack/packer/Packer.java
Packer.getString
public String getString() { final int len = getVInt(); final byte[] utf = new byte[len]; System.arraycopy(buf, bufPosition, utf, 0, utf.length); bufPosition += utf.length; return new String(utf, 0, len, charsetUTF8); }
java
public String getString() { final int len = getVInt(); final byte[] utf = new byte[len]; System.arraycopy(buf, bufPosition, utf, 0, utf.length); bufPosition += utf.length; return new String(utf, 0, len, charsetUTF8); }
[ "public", "String", "getString", "(", ")", "{", "final", "int", "len", "=", "getVInt", "(", ")", ";", "final", "byte", "[", "]", "utf", "=", "new", "byte", "[", "len", "]", ";", "System", ".", "arraycopy", "(", "buf", ",", "bufPosition", ",", "utf"...
Get String stored in UTF-8 format (encoded as: VInt-Length + bytes) @return @see #putString(String)
[ "Get", "String", "stored", "in", "UTF", "-", "8", "format", "(", "encoded", "as", ":", "VInt", "-", "Length", "+", "bytes", ")" ]
train
https://github.com/ggrandes/packer/blob/0b37b286a3d0555050eb2e65419dd74f8d8d3e78/src/main/java/org/javastack/packer/Packer.java#L1093-L1099
nleva/CDIEndpoint
CDIEndpoint/src/main/java/ru/sendto/websocket/WebsocketEventService.java
WebsocketEventService.onMessage
@OnMessage public void onMessage(Dto msg, Session session) { try { messageBus.fire(session); messagePayloadBus.fire(msg); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage(), e); } }
java
@OnMessage public void onMessage(Dto msg, Session session) { try { messageBus.fire(session); messagePayloadBus.fire(msg); } catch (Exception e) { log.log(Level.SEVERE, e.getMessage(), e); } }
[ "@", "OnMessage", "public", "void", "onMessage", "(", "Dto", "msg", ",", "Session", "session", ")", "{", "try", "{", "messageBus", ".", "fire", "(", "session", ")", ";", "messagePayloadBus", ".", "fire", "(", "msg", ")", ";", "}", "catch", "(", "Except...
Событие прихода нового сообщения. Десериализует данные, получает текущие атрибуты сессии и проксирует запрос в сервисы. @param msg - сообщение. @param session - сессия вебсокета.
[ "Событие", "прихода", "нового", "сообщения", ".", "Десериализует", "данные", "получает", "текущие", "атрибуты", "сессии", "и", "проксирует", "запрос", "в", "сервисы", "." ]
train
https://github.com/nleva/CDIEndpoint/blob/765f6d9fd94820f84e8be80b7234bd8c9657744e/CDIEndpoint/src/main/java/ru/sendto/websocket/WebsocketEventService.java#L119-L129
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java
IoUtil.copy
public static long copy(ReadableByteChannel in, WritableByteChannel out, int bufferSize, StreamProgress streamProgress) throws IORuntimeException { Assert.notNull(in, "InputStream is null !"); Assert.notNull(out, "OutputStream is null !"); ByteBuffer byteBuffer = ByteBuffer.allocate(bufferSize <= 0 ? DEFAULT_BUFFER_SIZE : bufferSize); long size = 0; if (null != streamProgress) { streamProgress.start(); } try { while (in.read(byteBuffer) != EOF) { byteBuffer.flip();// 写转读 size += out.write(byteBuffer); byteBuffer.clear(); if (null != streamProgress) { streamProgress.progress(size); } } } catch (IOException e) { throw new IORuntimeException(e); } if (null != streamProgress) { streamProgress.finish(); } return size; }
java
public static long copy(ReadableByteChannel in, WritableByteChannel out, int bufferSize, StreamProgress streamProgress) throws IORuntimeException { Assert.notNull(in, "InputStream is null !"); Assert.notNull(out, "OutputStream is null !"); ByteBuffer byteBuffer = ByteBuffer.allocate(bufferSize <= 0 ? DEFAULT_BUFFER_SIZE : bufferSize); long size = 0; if (null != streamProgress) { streamProgress.start(); } try { while (in.read(byteBuffer) != EOF) { byteBuffer.flip();// 写转读 size += out.write(byteBuffer); byteBuffer.clear(); if (null != streamProgress) { streamProgress.progress(size); } } } catch (IOException e) { throw new IORuntimeException(e); } if (null != streamProgress) { streamProgress.finish(); } return size; }
[ "public", "static", "long", "copy", "(", "ReadableByteChannel", "in", ",", "WritableByteChannel", "out", ",", "int", "bufferSize", ",", "StreamProgress", "streamProgress", ")", "throws", "IORuntimeException", "{", "Assert", ".", "notNull", "(", "in", ",", "\"Input...
拷贝流,使用NIO,不会关闭流 @param in {@link ReadableByteChannel} @param out {@link WritableByteChannel} @param bufferSize 缓冲大小,如果小于等于0,使用默认 @param streamProgress {@link StreamProgress}进度处理器 @return 拷贝的字节数 @throws IORuntimeException IO异常
[ "拷贝流,使用NIO,不会关闭流" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/IoUtil.java#L264-L290
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/date/GosuDateUtil.java
GosuDateUtil.addSeconds
public static Date addSeconds(Date date, int iSeconds) { Calendar dateTime = dateToCalendar(date); dateTime.add(Calendar.SECOND, iSeconds); return dateTime.getTime(); }
java
public static Date addSeconds(Date date, int iSeconds) { Calendar dateTime = dateToCalendar(date); dateTime.add(Calendar.SECOND, iSeconds); return dateTime.getTime(); }
[ "public", "static", "Date", "addSeconds", "(", "Date", "date", ",", "int", "iSeconds", ")", "{", "Calendar", "dateTime", "=", "dateToCalendar", "(", "date", ")", ";", "dateTime", ".", "add", "(", "Calendar", ".", "SECOND", ",", "iSeconds", ")", ";", "ret...
Adds the specified (signed) amount of seconds to the given date. For example, to subtract 5 seconds from the current time of the date, you can achieve it by calling: <code>addSeconds(Date, -5)</code>. @param date The time. @param iSeconds The amount of seconds to add. @return A new date with the seconds added.
[ "Adds", "the", "specified", "(", "signed", ")", "amount", "of", "seconds", "to", "the", "given", "date", ".", "For", "example", "to", "subtract", "5", "seconds", "from", "the", "current", "time", "of", "the", "date", "you", "can", "achieve", "it", "by", ...
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/date/GosuDateUtil.java#L28-L32
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/ConvolutionLayer.java
ConvolutionLayer.preOutput4d
protected Pair<INDArray, INDArray> preOutput4d(boolean training, boolean forBackprop, LayerWorkspaceMgr workspaceMgr) { return preOutput(training, forBackprop, workspaceMgr); }
java
protected Pair<INDArray, INDArray> preOutput4d(boolean training, boolean forBackprop, LayerWorkspaceMgr workspaceMgr) { return preOutput(training, forBackprop, workspaceMgr); }
[ "protected", "Pair", "<", "INDArray", ",", "INDArray", ">", "preOutput4d", "(", "boolean", "training", ",", "boolean", "forBackprop", ",", "LayerWorkspaceMgr", "workspaceMgr", ")", "{", "return", "preOutput", "(", "training", ",", "forBackprop", ",", "workspaceMgr...
preOutput4d: Used so that ConvolutionLayer subclasses (such as Convolution1DLayer) can maintain their standard non-4d preOutput method, while overriding this to return 4d activations (for use in backprop) without modifying the public API
[ "preOutput4d", ":", "Used", "so", "that", "ConvolutionLayer", "subclasses", "(", "such", "as", "Convolution1DLayer", ")", "can", "maintain", "their", "standard", "non", "-", "4d", "preOutput", "method", "while", "overriding", "this", "to", "return", "4d", "activ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/convolution/ConvolutionLayer.java#L259-L261
deeplearning4j/deeplearning4j
datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java
SparkUtils.readObjectFromFile
public static <T> T readObjectFromFile(String path, Class<T> type, SparkContext sc) throws IOException { return readObjectFromFile(path, type, sc.hadoopConfiguration()); }
java
public static <T> T readObjectFromFile(String path, Class<T> type, SparkContext sc) throws IOException { return readObjectFromFile(path, type, sc.hadoopConfiguration()); }
[ "public", "static", "<", "T", ">", "T", "readObjectFromFile", "(", "String", "path", ",", "Class", "<", "T", ">", "type", ",", "SparkContext", "sc", ")", "throws", "IOException", "{", "return", "readObjectFromFile", "(", "path", ",", "type", ",", "sc", "...
Read an object from HDFS (or local) using default Java object serialization @param path File to read @param type Class of the object to read @param sc Spark context @param <T> Type of the object to read
[ "Read", "an", "object", "from", "HDFS", "(", "or", "local", ")", "using", "default", "Java", "object", "serialization" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-spark/src/main/java/org/datavec/spark/transform/utils/SparkUtils.java#L194-L196