repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
wildfly/wildfly-core
cli/src/main/java/org/jboss/as/cli/handlers/WindowsFilenameTabCompleter.java
WindowsFilenameTabCompleter.completeCandidates
@Override void completeCandidates(CommandContext ctx, String buffer, int cursor, List<String> candidates) { """ The only supported syntax at command execution is fully quoted, e.g.: "c:\Program Files\..." or not quoted at all. Completion supports only these 2 syntaxes. """ if (candidates.isEmpty()) { if (buffer.startsWith("\"") && buffer.length() >= 2) { // Quotes are added back by super class. buffer = buffer.substring(1); } if (buffer.length() == 2 && buffer.endsWith(":")) { candidates.add(buffer + File.separator); } } }
java
@Override void completeCandidates(CommandContext ctx, String buffer, int cursor, List<String> candidates) { if (candidates.isEmpty()) { if (buffer.startsWith("\"") && buffer.length() >= 2) { // Quotes are added back by super class. buffer = buffer.substring(1); } if (buffer.length() == 2 && buffer.endsWith(":")) { candidates.add(buffer + File.separator); } } }
[ "@", "Override", "void", "completeCandidates", "(", "CommandContext", "ctx", ",", "String", "buffer", ",", "int", "cursor", ",", "List", "<", "String", ">", "candidates", ")", "{", "if", "(", "candidates", ".", "isEmpty", "(", ")", ")", "{", "if", "(", ...
The only supported syntax at command execution is fully quoted, e.g.: "c:\Program Files\..." or not quoted at all. Completion supports only these 2 syntaxes.
[ "The", "only", "supported", "syntax", "at", "command", "execution", "is", "fully", "quoted", "e", ".", "g", ".", ":", "c", ":", "\\", "Program", "Files", "\\", "...", "or", "not", "quoted", "at", "all", ".", "Completion", "supports", "only", "these", "...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/cli/src/main/java/org/jboss/as/cli/handlers/WindowsFilenameTabCompleter.java#L44-L55
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionValue.java
ExpressionValue.voltMutateToBigintType
public static boolean voltMutateToBigintType(Expression maybeConstantNode, Expression parent, int childIndex) { """ Given a ExpressionValue that is a VARBINARY constant, convert it to a BIGINT constant. Returns true for a successful conversion and false otherwise. For more details on how the conversion is performed, see BinaryData.toLong(). @param parent Reference of parent expression @param childIndex Index of this node in parent @return true for a successful conversion and false otherwise. """ if (maybeConstantNode.opType == OpTypes.VALUE && maybeConstantNode.dataType != null && maybeConstantNode.dataType.isBinaryType()) { ExpressionValue exprVal = (ExpressionValue)maybeConstantNode; if (exprVal.valueData == null) { return false; } BinaryData data = (BinaryData)exprVal.valueData; parent.nodes[childIndex] = new ExpressionValue(data.toLong(), Type.SQL_BIGINT); return true; } return false; }
java
public static boolean voltMutateToBigintType(Expression maybeConstantNode, Expression parent, int childIndex) { if (maybeConstantNode.opType == OpTypes.VALUE && maybeConstantNode.dataType != null && maybeConstantNode.dataType.isBinaryType()) { ExpressionValue exprVal = (ExpressionValue)maybeConstantNode; if (exprVal.valueData == null) { return false; } BinaryData data = (BinaryData)exprVal.valueData; parent.nodes[childIndex] = new ExpressionValue(data.toLong(), Type.SQL_BIGINT); return true; } return false; }
[ "public", "static", "boolean", "voltMutateToBigintType", "(", "Expression", "maybeConstantNode", ",", "Expression", "parent", ",", "int", "childIndex", ")", "{", "if", "(", "maybeConstantNode", ".", "opType", "==", "OpTypes", ".", "VALUE", "&&", "maybeConstantNode",...
Given a ExpressionValue that is a VARBINARY constant, convert it to a BIGINT constant. Returns true for a successful conversion and false otherwise. For more details on how the conversion is performed, see BinaryData.toLong(). @param parent Reference of parent expression @param childIndex Index of this node in parent @return true for a successful conversion and false otherwise.
[ "Given", "a", "ExpressionValue", "that", "is", "a", "VARBINARY", "constant", "convert", "it", "to", "a", "BIGINT", "constant", ".", "Returns", "true", "for", "a", "successful", "conversion", "and", "false", "otherwise", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ExpressionValue.java#L116-L131
Coveros/selenified
src/main/java/com/coveros/selenified/services/HTTP.java
HTTP.writeJsonDataRequest
private void writeJsonDataRequest(HttpURLConnection connection, Request request) { """ Pushes request data to the open http connection @param connection - the open connection of the http call @param request - the parameters to be passed to the endpoint for the service call """ try (OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream())) { wr.write(request.getJsonPayload().toString()); wr.flush(); } catch (IOException e) { log.error(e); } }
java
private void writeJsonDataRequest(HttpURLConnection connection, Request request) { try (OutputStreamWriter wr = new OutputStreamWriter(connection.getOutputStream())) { wr.write(request.getJsonPayload().toString()); wr.flush(); } catch (IOException e) { log.error(e); } }
[ "private", "void", "writeJsonDataRequest", "(", "HttpURLConnection", "connection", ",", "Request", "request", ")", "{", "try", "(", "OutputStreamWriter", "wr", "=", "new", "OutputStreamWriter", "(", "connection", ".", "getOutputStream", "(", ")", ")", ")", "{", ...
Pushes request data to the open http connection @param connection - the open connection of the http call @param request - the parameters to be passed to the endpoint for the service call
[ "Pushes", "request", "data", "to", "the", "open", "http", "connection" ]
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/services/HTTP.java#L343-L350
roboconf/roboconf-platform
core/roboconf-core/src/main/java/net/roboconf/core/utils/IconUtils.java
IconUtils.findIcon
public static File findIcon( File rootDirectory ) { """ Finds an icon from a root directory (for an application and/or template). @param rootDirectory a root directory @return an existing file, or null if no icon was found """ File result = null; File[] imageFiles = new File( rootDirectory, Constants.PROJECT_DIR_DESC ).listFiles( new ImgeFileFilter()); if( imageFiles != null ) { // A single image? Take it... if( imageFiles.length == 1 ) { result = imageFiles[ 0 ]; } // Otherwise, find the "application." file else for( File f : imageFiles ) { if( f.getName().toLowerCase().startsWith( "application." )) result = f; } } return result; }
java
public static File findIcon( File rootDirectory ) { File result = null; File[] imageFiles = new File( rootDirectory, Constants.PROJECT_DIR_DESC ).listFiles( new ImgeFileFilter()); if( imageFiles != null ) { // A single image? Take it... if( imageFiles.length == 1 ) { result = imageFiles[ 0 ]; } // Otherwise, find the "application." file else for( File f : imageFiles ) { if( f.getName().toLowerCase().startsWith( "application." )) result = f; } } return result; }
[ "public", "static", "File", "findIcon", "(", "File", "rootDirectory", ")", "{", "File", "result", "=", "null", ";", "File", "[", "]", "imageFiles", "=", "new", "File", "(", "rootDirectory", ",", "Constants", ".", "PROJECT_DIR_DESC", ")", ".", "listFiles", ...
Finds an icon from a root directory (for an application and/or template). @param rootDirectory a root directory @return an existing file, or null if no icon was found
[ "Finds", "an", "icon", "from", "a", "root", "directory", "(", "for", "an", "application", "and", "/", "or", "template", ")", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-core/src/main/java/net/roboconf/core/utils/IconUtils.java#L202-L221
MenoData/Time4J
base/src/main/java/net/time4j/format/expert/ChronoFormatter.java
ChronoFormatter.ofStyle
public static <T extends LocalizedPatternSupport> ChronoFormatter<T> ofStyle( DisplayMode style, Locale locale, Chronology<T> chronology ) { """ /*[deutsch] <p>Konstruiert einen stilbasierten Formatierer f&uuml;r allgemeine Chronologien. </p> @param <T> generic chronological type @param style format style @param locale format locale @param chronology chronology with format pattern support @return new {@code ChronoFormatter}-instance @throws UnsupportedOperationException if given style is not supported @see DisplayMode @since 3.10/4.7 """ if (LocalizedPatternSupport.class.isAssignableFrom(chronology.getChronoType())) { Builder<T> builder = new Builder<>(chronology, locale); builder.addProcessor(new StyleProcessor<>(style, style)); return builder.build(); // Compiler will not accept the Moment-chronology! // } else if (chronology.equals(Moment.axis())) { // throw new UnsupportedOperationException("Timezone required, use 'ofMomentStyle()' instead."); } else { throw new UnsupportedOperationException("Localized format patterns not available: " + chronology); } }
java
public static <T extends LocalizedPatternSupport> ChronoFormatter<T> ofStyle( DisplayMode style, Locale locale, Chronology<T> chronology ) { if (LocalizedPatternSupport.class.isAssignableFrom(chronology.getChronoType())) { Builder<T> builder = new Builder<>(chronology, locale); builder.addProcessor(new StyleProcessor<>(style, style)); return builder.build(); // Compiler will not accept the Moment-chronology! // } else if (chronology.equals(Moment.axis())) { // throw new UnsupportedOperationException("Timezone required, use 'ofMomentStyle()' instead."); } else { throw new UnsupportedOperationException("Localized format patterns not available: " + chronology); } }
[ "public", "static", "<", "T", "extends", "LocalizedPatternSupport", ">", "ChronoFormatter", "<", "T", ">", "ofStyle", "(", "DisplayMode", "style", ",", "Locale", "locale", ",", "Chronology", "<", "T", ">", "chronology", ")", "{", "if", "(", "LocalizedPatternSu...
/*[deutsch] <p>Konstruiert einen stilbasierten Formatierer f&uuml;r allgemeine Chronologien. </p> @param <T> generic chronological type @param style format style @param locale format locale @param chronology chronology with format pattern support @return new {@code ChronoFormatter}-instance @throws UnsupportedOperationException if given style is not supported @see DisplayMode @since 3.10/4.7
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Konstruiert", "einen", "stilbasierten", "Formatierer", "f&uuml", ";", "r", "allgemeine", "Chronologien", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/format/expert/ChronoFormatter.java#L2641-L2658
JodaOrg/joda-money
src/main/java/org/joda/money/CurrencyUnitDataProvider.java
CurrencyUnitDataProvider.registerCurrency
protected final void registerCurrency(String currencyCode, int numericCurrencyCode, int decimalPlaces) { """ Registers a currency allowing it to be used. <p> This method is called by {@link #registerCurrencies()} to perform the actual creation of a currency. @param currencyCode the currency code, not null @param numericCurrencyCode the numeric currency code, -1 if none @param decimalPlaces the number of decimal places that the currency normally has, from 0 to 3, or -1 for a pseudo-currency """ CurrencyUnit.registerCurrency(currencyCode, numericCurrencyCode, decimalPlaces, true); }
java
protected final void registerCurrency(String currencyCode, int numericCurrencyCode, int decimalPlaces) { CurrencyUnit.registerCurrency(currencyCode, numericCurrencyCode, decimalPlaces, true); }
[ "protected", "final", "void", "registerCurrency", "(", "String", "currencyCode", ",", "int", "numericCurrencyCode", ",", "int", "decimalPlaces", ")", "{", "CurrencyUnit", ".", "registerCurrency", "(", "currencyCode", ",", "numericCurrencyCode", ",", "decimalPlaces", "...
Registers a currency allowing it to be used. <p> This method is called by {@link #registerCurrencies()} to perform the actual creation of a currency. @param currencyCode the currency code, not null @param numericCurrencyCode the numeric currency code, -1 if none @param decimalPlaces the number of decimal places that the currency normally has, from 0 to 3, or -1 for a pseudo-currency
[ "Registers", "a", "currency", "allowing", "it", "to", "be", "used", ".", "<p", ">", "This", "method", "is", "called", "by", "{", "@link", "#registerCurrencies", "()", "}", "to", "perform", "the", "actual", "creation", "of", "a", "currency", "." ]
train
https://github.com/JodaOrg/joda-money/blob/e1f2de75aa36610a695358696c8a88a18ca66cde/src/main/java/org/joda/money/CurrencyUnitDataProvider.java#L41-L43
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMessageBox.java
WMessageBox.addMessage
public void addMessage(final boolean encode, final String msg, final Serializable... args) { """ Adds a message to the message box. @param encode true to encode the message text, false to leave it unencoded. @param msg the text of the message to add, using {@link MessageFormat} syntax. @param args optional arguments for the message format string. """ MessageModel model = getOrCreateComponentModel(); model.messages.add(new Duplet<>(I18nUtilities.asMessage(msg, args), encode)); // Potential for leaking memory here MemoryUtil.checkSize(model.messages.size(), this.getClass().getSimpleName()); }
java
public void addMessage(final boolean encode, final String msg, final Serializable... args) { MessageModel model = getOrCreateComponentModel(); model.messages.add(new Duplet<>(I18nUtilities.asMessage(msg, args), encode)); // Potential for leaking memory here MemoryUtil.checkSize(model.messages.size(), this.getClass().getSimpleName()); }
[ "public", "void", "addMessage", "(", "final", "boolean", "encode", ",", "final", "String", "msg", ",", "final", "Serializable", "...", "args", ")", "{", "MessageModel", "model", "=", "getOrCreateComponentModel", "(", ")", ";", "model", ".", "messages", ".", ...
Adds a message to the message box. @param encode true to encode the message text, false to leave it unencoded. @param msg the text of the message to add, using {@link MessageFormat} syntax. @param args optional arguments for the message format string.
[ "Adds", "a", "message", "to", "the", "message", "box", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WMessageBox.java#L203-L208
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/RunningJobImpl.java
RunningJobImpl.onJobFailure
private synchronized void onJobFailure(final JobStatusProto jobStatusProto) { """ Inform the client of a failed job. @param jobStatusProto status of the failed job """ assert jobStatusProto.getState() == ReefServiceProtos.State.FAILED; final String id = this.jobId; final Optional<byte[]> data = jobStatusProto.hasException() ? Optional.of(jobStatusProto.getException().toByteArray()) : Optional.<byte[]>empty(); final Optional<Throwable> cause = this.exceptionCodec.fromBytes(data); final String message; if (cause.isPresent() && cause.get().getMessage() != null) { message = cause.get().getMessage(); } else { message = "No Message sent by the Job in exception " + cause.get(); LOG.log(Level.WARNING, message, cause.get()); } final Optional<String> description = Optional.of(message); final FailedJob failedJob = new FailedJob(id, message, description, cause, data); this.failedJobEventHandler.onNext(failedJob); }
java
private synchronized void onJobFailure(final JobStatusProto jobStatusProto) { assert jobStatusProto.getState() == ReefServiceProtos.State.FAILED; final String id = this.jobId; final Optional<byte[]> data = jobStatusProto.hasException() ? Optional.of(jobStatusProto.getException().toByteArray()) : Optional.<byte[]>empty(); final Optional<Throwable> cause = this.exceptionCodec.fromBytes(data); final String message; if (cause.isPresent() && cause.get().getMessage() != null) { message = cause.get().getMessage(); } else { message = "No Message sent by the Job in exception " + cause.get(); LOG.log(Level.WARNING, message, cause.get()); } final Optional<String> description = Optional.of(message); final FailedJob failedJob = new FailedJob(id, message, description, cause, data); this.failedJobEventHandler.onNext(failedJob); }
[ "private", "synchronized", "void", "onJobFailure", "(", "final", "JobStatusProto", "jobStatusProto", ")", "{", "assert", "jobStatusProto", ".", "getState", "(", ")", "==", "ReefServiceProtos", ".", "State", ".", "FAILED", ";", "final", "String", "id", "=", "this...
Inform the client of a failed job. @param jobStatusProto status of the failed job
[ "Inform", "the", "client", "of", "a", "failed", "job", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/RunningJobImpl.java#L146-L166
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/ManagedDatabasesInner.java
ManagedDatabasesInner.beginCompleteRestore
public void beginCompleteRestore(String locationName, UUID operationId, String lastBackupName) { """ Completes the restore operation on a managed database. @param locationName The name of the region where the resource is located. @param operationId Management operation id that this request tries to complete. @param lastBackupName The last backup name to apply @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).toBlocking().single().body(); }
java
public void beginCompleteRestore(String locationName, UUID operationId, String lastBackupName) { beginCompleteRestoreWithServiceResponseAsync(locationName, operationId, lastBackupName).toBlocking().single().body(); }
[ "public", "void", "beginCompleteRestore", "(", "String", "locationName", ",", "UUID", "operationId", ",", "String", "lastBackupName", ")", "{", "beginCompleteRestoreWithServiceResponseAsync", "(", "locationName", ",", "operationId", ",", "lastBackupName", ")", ".", "toB...
Completes the restore operation on a managed database. @param locationName The name of the region where the resource is located. @param operationId Management operation id that this request tries to complete. @param lastBackupName The last backup name to apply @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Completes", "the", "restore", "operation", "on", "a", "managed", "database", "." ]
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/ManagedDatabasesInner.java#L202-L204
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-api/src/main/java/org/xwiki/classloader/internal/ResourceLoader.java
ResourceLoader.findResource
public URL findResource(URL source, String name) { """ Fined resource with given name at the given source URL. If the URL points to a directory, the name is the file path relative to this directory. If the URL points to a JAR file, the name identifies an entry in that JAR file. If the URL points to a JAR file, the resource is not found in that JAR file, and the JAR file has Class-Path attribute, the JAR files identified in the Class-Path are also searched for the resource. @param source the source URL @param name the resource name @return URL of the resource, or null if not found """ return findResource(source, name, new HashSet<>(), null); }
java
public URL findResource(URL source, String name) { return findResource(source, name, new HashSet<>(), null); }
[ "public", "URL", "findResource", "(", "URL", "source", ",", "String", "name", ")", "{", "return", "findResource", "(", "source", ",", "name", ",", "new", "HashSet", "<>", "(", ")", ",", "null", ")", ";", "}" ]
Fined resource with given name at the given source URL. If the URL points to a directory, the name is the file path relative to this directory. If the URL points to a JAR file, the name identifies an entry in that JAR file. If the URL points to a JAR file, the resource is not found in that JAR file, and the JAR file has Class-Path attribute, the JAR files identified in the Class-Path are also searched for the resource. @param source the source URL @param name the resource name @return URL of the resource, or null if not found
[ "Fined", "resource", "with", "given", "name", "at", "the", "given", "source", "URL", ".", "If", "the", "URL", "points", "to", "a", "directory", "the", "name", "is", "the", "file", "path", "relative", "to", "this", "directory", ".", "If", "the", "URL", ...
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-classloader/xwiki-commons-classloader-api/src/main/java/org/xwiki/classloader/internal/ResourceLoader.java#L267-L270
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/AntRunAction.java
AntRunAction.loadBuildPropertyFile
private void loadBuildPropertyFile(Project project, TestContext context) { """ Loads build properties from file resource and adds them to ANT project. @param project @param context """ if (StringUtils.hasText(propertyFilePath)) { String propertyFileResource = context.replaceDynamicContentInString(propertyFilePath); log.info("Reading build property file: " + propertyFileResource); Properties fileProperties; try { fileProperties = PropertiesLoaderUtils.loadProperties(new PathMatchingResourcePatternResolver().getResource(propertyFileResource)); for (Entry<Object, Object> entry : fileProperties.entrySet()) { String propertyValue = entry.getValue() != null ? context.replaceDynamicContentInString(entry.getValue().toString()) : ""; if (log.isDebugEnabled()) { log.debug("Set build property from file resource: " + entry.getKey() + "=" + propertyValue); } project.setProperty(entry.getKey().toString(), propertyValue); } } catch (IOException e) { throw new CitrusRuntimeException("Failed to read build property file", e); } } }
java
private void loadBuildPropertyFile(Project project, TestContext context) { if (StringUtils.hasText(propertyFilePath)) { String propertyFileResource = context.replaceDynamicContentInString(propertyFilePath); log.info("Reading build property file: " + propertyFileResource); Properties fileProperties; try { fileProperties = PropertiesLoaderUtils.loadProperties(new PathMatchingResourcePatternResolver().getResource(propertyFileResource)); for (Entry<Object, Object> entry : fileProperties.entrySet()) { String propertyValue = entry.getValue() != null ? context.replaceDynamicContentInString(entry.getValue().toString()) : ""; if (log.isDebugEnabled()) { log.debug("Set build property from file resource: " + entry.getKey() + "=" + propertyValue); } project.setProperty(entry.getKey().toString(), propertyValue); } } catch (IOException e) { throw new CitrusRuntimeException("Failed to read build property file", e); } } }
[ "private", "void", "loadBuildPropertyFile", "(", "Project", "project", ",", "TestContext", "context", ")", "{", "if", "(", "StringUtils", ".", "hasText", "(", "propertyFilePath", ")", ")", "{", "String", "propertyFileResource", "=", "context", ".", "replaceDynamic...
Loads build properties from file resource and adds them to ANT project. @param project @param context
[ "Loads", "build", "properties", "from", "file", "resource", "and", "adds", "them", "to", "ANT", "project", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/AntRunAction.java#L149-L169
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/transform/TypeAdapterAwareSQLTransform.java
TypeAdapterAwareSQLTransform.generateWriteParam2ContentValues
@Override public void generateWriteParam2ContentValues(Builder methodBuilder, SQLiteModelMethod method, String paramName, TypeName paramTypeName, ModelProperty property) { """ /* (non-Javadoc) @see com.abubusoft.kripton.processor.sqlite.transform.AbstractSQLTransform#generateWriteParam2ContentValues(com.squareup.javapoet.MethodSpec.Builder, com.abubusoft.kripton.processor.sqlite.model.SQLiteModelMethod, java.lang.String, com.squareup.javapoet.TypeName, com.abubusoft.kripton.processor.core.ModelProperty) """ if (property != null && property.hasTypeAdapter()) { methodBuilder.addCode(WRITE_COSTANT + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER, SQLTypeAdapterUtils.class, property.typeAdapter.getAdapterTypeName(), paramName); } else if (method.hasAdapterForParam(paramName)) { methodBuilder.addCode(WRITE_COSTANT + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER, SQLTypeAdapterUtils.class, method.getAdapterForParam(paramName), paramName); } else { methodBuilder.addCode(WRITE_COSTANT + "$L", paramName); } }
java
@Override public void generateWriteParam2ContentValues(Builder methodBuilder, SQLiteModelMethod method, String paramName, TypeName paramTypeName, ModelProperty property) { if (property != null && property.hasTypeAdapter()) { methodBuilder.addCode(WRITE_COSTANT + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER, SQLTypeAdapterUtils.class, property.typeAdapter.getAdapterTypeName(), paramName); } else if (method.hasAdapterForParam(paramName)) { methodBuilder.addCode(WRITE_COSTANT + PRE_TYPE_ADAPTER_TO_DATA + "$L" + POST_TYPE_ADAPTER, SQLTypeAdapterUtils.class, method.getAdapterForParam(paramName), paramName); } else { methodBuilder.addCode(WRITE_COSTANT + "$L", paramName); } }
[ "@", "Override", "public", "void", "generateWriteParam2ContentValues", "(", "Builder", "methodBuilder", ",", "SQLiteModelMethod", "method", ",", "String", "paramName", ",", "TypeName", "paramTypeName", ",", "ModelProperty", "property", ")", "{", "if", "(", "property",...
/* (non-Javadoc) @see com.abubusoft.kripton.processor.sqlite.transform.AbstractSQLTransform#generateWriteParam2ContentValues(com.squareup.javapoet.MethodSpec.Builder, com.abubusoft.kripton.processor.sqlite.model.SQLiteModelMethod, java.lang.String, com.squareup.javapoet.TypeName, com.abubusoft.kripton.processor.core.ModelProperty)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/transform/TypeAdapterAwareSQLTransform.java#L29-L38
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java
PacketParserUtils.parseStanza
public static Stanza parseStanza(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws Exception { """ Tries to parse and return either a Message, IQ or Presence stanza. connection is optional and is used to return feature-not-implemented errors for unknown IQ stanzas. @param parser @param outerXmlEnvironment the outer XML environment (optional). @return a stanza which is either a Message, IQ or Presence. @throws Exception """ ParserUtils.assertAtStartTag(parser); final String name = parser.getName(); switch (name) { case Message.ELEMENT: return parseMessage(parser, outerXmlEnvironment); case IQ.IQ_ELEMENT: return parseIQ(parser, outerXmlEnvironment); case Presence.ELEMENT: return parsePresence(parser, outerXmlEnvironment); default: throw new IllegalArgumentException("Can only parse message, iq or presence, not " + name); } }
java
public static Stanza parseStanza(XmlPullParser parser, XmlEnvironment outerXmlEnvironment) throws Exception { ParserUtils.assertAtStartTag(parser); final String name = parser.getName(); switch (name) { case Message.ELEMENT: return parseMessage(parser, outerXmlEnvironment); case IQ.IQ_ELEMENT: return parseIQ(parser, outerXmlEnvironment); case Presence.ELEMENT: return parsePresence(parser, outerXmlEnvironment); default: throw new IllegalArgumentException("Can only parse message, iq or presence, not " + name); } }
[ "public", "static", "Stanza", "parseStanza", "(", "XmlPullParser", "parser", ",", "XmlEnvironment", "outerXmlEnvironment", ")", "throws", "Exception", "{", "ParserUtils", ".", "assertAtStartTag", "(", "parser", ")", ";", "final", "String", "name", "=", "parser", "...
Tries to parse and return either a Message, IQ or Presence stanza. connection is optional and is used to return feature-not-implemented errors for unknown IQ stanzas. @param parser @param outerXmlEnvironment the outer XML environment (optional). @return a stanza which is either a Message, IQ or Presence. @throws Exception
[ "Tries", "to", "parse", "and", "return", "either", "a", "Message", "IQ", "or", "Presence", "stanza", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/PacketParserUtils.java#L154-L167
Cornutum/tcases
tcases-openapi/src/main/java/org/cornutum/tcases/openapi/TcasesOpenApi.java
TcasesOpenApi.getRequestInputModel
public static SystemInputDef getRequestInputModel( OpenAPI api, ModelOptions options) { """ Returns a {@link SystemInputDef system input definition} for the API requests defined by the given OpenAPI specification. Returns null if the given spec defines no API requests to model. """ RequestInputModeller inputModeller = new RequestInputModeller( options); return inputModeller.getRequestInputModel( api); }
java
public static SystemInputDef getRequestInputModel( OpenAPI api, ModelOptions options) { RequestInputModeller inputModeller = new RequestInputModeller( options); return inputModeller.getRequestInputModel( api); }
[ "public", "static", "SystemInputDef", "getRequestInputModel", "(", "OpenAPI", "api", ",", "ModelOptions", "options", ")", "{", "RequestInputModeller", "inputModeller", "=", "new", "RequestInputModeller", "(", "options", ")", ";", "return", "inputModeller", ".", "getRe...
Returns a {@link SystemInputDef system input definition} for the API requests defined by the given OpenAPI specification. Returns null if the given spec defines no API requests to model.
[ "Returns", "a", "{" ]
train
https://github.com/Cornutum/tcases/blob/21e15cf107fa149620c40f4bda1829c1224fcfb1/tcases-openapi/src/main/java/org/cornutum/tcases/openapi/TcasesOpenApi.java#L41-L45
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.createConversation
public void createConversation(@NonNull final ConversationCreate request, @Nullable Callback<ComapiResult<ConversationDetails>> callback) { """ Returns observable to create a conversation. @param request Request with conversation details to create. @param callback Callback to deliver new session instance. """ adapter.adapt(createConversation(request), callback); }
java
public void createConversation(@NonNull final ConversationCreate request, @Nullable Callback<ComapiResult<ConversationDetails>> callback) { adapter.adapt(createConversation(request), callback); }
[ "public", "void", "createConversation", "(", "@", "NonNull", "final", "ConversationCreate", "request", ",", "@", "Nullable", "Callback", "<", "ComapiResult", "<", "ConversationDetails", ">", ">", "callback", ")", "{", "adapter", ".", "adapt", "(", "createConversat...
Returns observable to create a conversation. @param request Request with conversation details to create. @param callback Callback to deliver new session instance.
[ "Returns", "observable", "to", "create", "a", "conversation", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L433-L435
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java
CudaZeroHandler.synchronizeThreadDevice
@Override public void synchronizeThreadDevice(Long threadId, Integer deviceId, AllocationPoint point) { """ This method causes memory synchronization on host side. Viable only for Device-dependant MemoryHandlers @param threadId @param deviceId @param point """ // we synchronize only if this AllocationPoint was used within device context, so for multiple consequent syncs only first one will be issued flowController.synchronizeToHost(point); }
java
@Override public void synchronizeThreadDevice(Long threadId, Integer deviceId, AllocationPoint point) { // we synchronize only if this AllocationPoint was used within device context, so for multiple consequent syncs only first one will be issued flowController.synchronizeToHost(point); }
[ "@", "Override", "public", "void", "synchronizeThreadDevice", "(", "Long", "threadId", ",", "Integer", "deviceId", ",", "AllocationPoint", "point", ")", "{", "// we synchronize only if this AllocationPoint was used within device context, so for multiple consequent syncs only first on...
This method causes memory synchronization on host side. Viable only for Device-dependant MemoryHandlers @param threadId @param deviceId @param point
[ "This", "method", "causes", "memory", "synchronization", "on", "host", "side", ".", "Viable", "only", "for", "Device", "-", "dependant", "MemoryHandlers" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/handler/impl/CudaZeroHandler.java#L1289-L1293
Quickhull3d/quickhull3d
src/main/java/com/github/quickhull3d/Face.java
Face.areaSquared
public double areaSquared(HalfEdge hedge0, HalfEdge hedge1) { """ return the squared area of the triangle defined by the half edge hedge0 and the point at the head of hedge1. @param hedge0 @param hedge1 @return """ Point3d p0 = hedge0.tail().pnt; Point3d p1 = hedge0.head().pnt; Point3d p2 = hedge1.head().pnt; double dx1 = p1.x - p0.x; double dy1 = p1.y - p0.y; double dz1 = p1.z - p0.z; double dx2 = p2.x - p0.x; double dy2 = p2.y - p0.y; double dz2 = p2.z - p0.z; double x = dy1 * dz2 - dz1 * dy2; double y = dz1 * dx2 - dx1 * dz2; double z = dx1 * dy2 - dy1 * dx2; return x * x + y * y + z * z; }
java
public double areaSquared(HalfEdge hedge0, HalfEdge hedge1) { Point3d p0 = hedge0.tail().pnt; Point3d p1 = hedge0.head().pnt; Point3d p2 = hedge1.head().pnt; double dx1 = p1.x - p0.x; double dy1 = p1.y - p0.y; double dz1 = p1.z - p0.z; double dx2 = p2.x - p0.x; double dy2 = p2.y - p0.y; double dz2 = p2.z - p0.z; double x = dy1 * dz2 - dz1 * dy2; double y = dz1 * dx2 - dx1 * dz2; double z = dx1 * dy2 - dy1 * dx2; return x * x + y * y + z * z; }
[ "public", "double", "areaSquared", "(", "HalfEdge", "hedge0", ",", "HalfEdge", "hedge1", ")", "{", "Point3d", "p0", "=", "hedge0", ".", "tail", "(", ")", ".", "pnt", ";", "Point3d", "p1", "=", "hedge0", ".", "head", "(", ")", ".", "pnt", ";", "Point3...
return the squared area of the triangle defined by the half edge hedge0 and the point at the head of hedge1. @param hedge0 @param hedge1 @return
[ "return", "the", "squared", "area", "of", "the", "triangle", "defined", "by", "the", "half", "edge", "hedge0", "and", "the", "point", "at", "the", "head", "of", "hedge1", "." ]
train
https://github.com/Quickhull3d/quickhull3d/blob/3f80953b86c46385e84730e5d2a1745cbfa12703/src/main/java/com/github/quickhull3d/Face.java#L408-L426
hdbeukel/james-core
src/main/java/org/jamesframework/core/subset/neigh/adv/MultiDeletionNeighbourhood.java
MultiDeletionNeighbourhood.getRandomMove
@Override public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) { """ <p> Generates a move for the given subset solution that deselects a random subset of currently selected IDs. Possible fixed IDs are not considered to be deselected. The maximum number of deletions \(k\) and minimum allowed subset size are respected. If no items can be removed, <code>null</code> is returned. </p> <p> Note that first, a random number of deletions is picked (uniformly distributed) from the valid range and then, a random subset of this size is sampled from the currently selected IDs, to be removed (again, all possible subsets are uniformly distributed, within the fixed size). Because the amount of possible moves increases with the number of performed deletions, the probability of generating each specific move thus decreases with the number of deletions. In other words, randomly generated moves are <b>not</b> uniformly distributed across different numbers of performed deletions, but each specific move performing fewer deletions is more likely to be selected than each specific move performing more deletions. </p> @param solution solution for which a random multi deletion move is generated @param rnd source of randomness used to generate random move @return random multi deletion move, <code>null</code> if no items can be removed """ // get set of candidate IDs for deletion (fixed IDs are discarded) Set<Integer> delCandidates = getRemoveCandidates(solution); // compute maximum number of deletions int curMaxDel = maxDeletions(delCandidates, solution); // return null if no removals are possible if(curMaxDel == 0){ return null; } // pick number of deletions (in [1, curMaxDel]) int numDel = rnd.nextInt(curMaxDel) + 1; // pick random IDs to remove from selection Set<Integer> del = SetUtilities.getRandomSubset(delCandidates, numDel, rnd); // create and return move return new GeneralSubsetMove(Collections.emptySet(), del); }
java
@Override public SubsetMove getRandomMove(SubsetSolution solution, Random rnd) { // get set of candidate IDs for deletion (fixed IDs are discarded) Set<Integer> delCandidates = getRemoveCandidates(solution); // compute maximum number of deletions int curMaxDel = maxDeletions(delCandidates, solution); // return null if no removals are possible if(curMaxDel == 0){ return null; } // pick number of deletions (in [1, curMaxDel]) int numDel = rnd.nextInt(curMaxDel) + 1; // pick random IDs to remove from selection Set<Integer> del = SetUtilities.getRandomSubset(delCandidates, numDel, rnd); // create and return move return new GeneralSubsetMove(Collections.emptySet(), del); }
[ "@", "Override", "public", "SubsetMove", "getRandomMove", "(", "SubsetSolution", "solution", ",", "Random", "rnd", ")", "{", "// get set of candidate IDs for deletion (fixed IDs are discarded)", "Set", "<", "Integer", ">", "delCandidates", "=", "getRemoveCandidates", "(", ...
<p> Generates a move for the given subset solution that deselects a random subset of currently selected IDs. Possible fixed IDs are not considered to be deselected. The maximum number of deletions \(k\) and minimum allowed subset size are respected. If no items can be removed, <code>null</code> is returned. </p> <p> Note that first, a random number of deletions is picked (uniformly distributed) from the valid range and then, a random subset of this size is sampled from the currently selected IDs, to be removed (again, all possible subsets are uniformly distributed, within the fixed size). Because the amount of possible moves increases with the number of performed deletions, the probability of generating each specific move thus decreases with the number of deletions. In other words, randomly generated moves are <b>not</b> uniformly distributed across different numbers of performed deletions, but each specific move performing fewer deletions is more likely to be selected than each specific move performing more deletions. </p> @param solution solution for which a random multi deletion move is generated @param rnd source of randomness used to generate random move @return random multi deletion move, <code>null</code> if no items can be removed
[ "<p", ">", "Generates", "a", "move", "for", "the", "given", "subset", "solution", "that", "deselects", "a", "random", "subset", "of", "currently", "selected", "IDs", ".", "Possible", "fixed", "IDs", "are", "not", "considered", "to", "be", "deselected", ".", ...
train
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/adv/MultiDeletionNeighbourhood.java#L166-L182
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/CharSetUtils.java
CharSetUtils.containsAny
public static boolean containsAny(final String str, final String... set) { """ <p>Takes an argument in set-syntax, see evaluateSet, and identifies whether any of the characters are present in the specified string.</p> <pre> CharSetUtils.containsAny(null, *) = false CharSetUtils.containsAny("", *) = false CharSetUtils.containsAny(*, null) = false CharSetUtils.containsAny(*, "") = false CharSetUtils.containsAny("hello", "k-p") = true CharSetUtils.containsAny("hello", "a-d") = false </pre> @see CharSet#getInstance(java.lang.String...) for set-syntax. @param str String to look for characters in, may be null @param set String[] set of characters to identify, may be null @return whether or not the characters in the set are in the primary string @since 3.2 """ if (StringUtils.isEmpty(str) || deepEmpty(set)) { return false; } final CharSet chars = CharSet.getInstance(set); for (final char c : str.toCharArray()) { if (chars.contains(c)) { return true; } } return false; }
java
public static boolean containsAny(final String str, final String... set) { if (StringUtils.isEmpty(str) || deepEmpty(set)) { return false; } final CharSet chars = CharSet.getInstance(set); for (final char c : str.toCharArray()) { if (chars.contains(c)) { return true; } } return false; }
[ "public", "static", "boolean", "containsAny", "(", "final", "String", "str", ",", "final", "String", "...", "set", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "str", ")", "||", "deepEmpty", "(", "set", ")", ")", "{", "return", "false", ";"...
<p>Takes an argument in set-syntax, see evaluateSet, and identifies whether any of the characters are present in the specified string.</p> <pre> CharSetUtils.containsAny(null, *) = false CharSetUtils.containsAny("", *) = false CharSetUtils.containsAny(*, null) = false CharSetUtils.containsAny(*, "") = false CharSetUtils.containsAny("hello", "k-p") = true CharSetUtils.containsAny("hello", "a-d") = false </pre> @see CharSet#getInstance(java.lang.String...) for set-syntax. @param str String to look for characters in, may be null @param set String[] set of characters to identify, may be null @return whether or not the characters in the set are in the primary string @since 3.2
[ "<p", ">", "Takes", "an", "argument", "in", "set", "-", "syntax", "see", "evaluateSet", "and", "identifies", "whether", "any", "of", "the", "characters", "are", "present", "in", "the", "specified", "string", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/CharSetUtils.java#L117-L128
NICTA/nicta-ner
conll2003-evaluation/src/main/java/org/t3as/ner/conll2003/ConllReader.java
ConllReader.readDoc
private Collection<Sentence> readDoc() throws IOException { """ /* -DOCSTART- -X- O O CRICKET NNP I-NP O - : O O LEICESTERSHIRE NNP I-NP I-ORG TAKE NNP I-NP O OVER IN I-PP O AT NNP I-NP O TOP NNP I-NP O AFTER NNP I-NP O INNINGS NNP I-NP O VICTORY NN I-NP O . . O O LONDON NNP I-NP I-LOC 1996-08-30 CD I-NP O West NNP I-NP I-MISC [...] . . O O -DOCSTART- -X- O O CRICKET NNP I-NP O [...] """ final Collection<Sentence> sentences = new ArrayList<>(); StringBuilder sentence = new StringBuilder(); Collection<ConllToken> tokens = new ArrayList<>(); int tokenStartIndex = 0; for (String line; (line = r.readLine()) != null; ) { // empty line means end-of-sentence if (line.isEmpty()) { // if we have an empty line and something in the actual sentence then add it if (sentence.length() > 0) { sentences.add(new Sentence(sentence.toString(), tokens)); sentence = new StringBuilder(); tokens = new ArrayList<>(); tokenStartIndex = 0; } } else { // this assumes there is ever only a single space between token and classifiers final String[] parts = SPACES.split(line); switch (parts[0]) { case "-DOCSTART-": // we use DOCSTART as the end of the current doc, also throw away the following empty line r.readLine(); // no need to think about a current sentence, the previous empty line will have saved it return sentences; default: if (sentence.length() > 0) sentence.append(" "); sentence.append(parts[0]); tokens.add(new ConllToken(tokenStartIndex, parts[0], parts[1] + " " + parts[2], parts[3])); tokenStartIndex += parts[0].length() + 1; // add 1 for the space between tokens } } } // if we run out of data in the file if (sentence.length() > 0) sentences.add(new Sentence(sentence.toString(), tokens)); return sentences; }
java
private Collection<Sentence> readDoc() throws IOException { final Collection<Sentence> sentences = new ArrayList<>(); StringBuilder sentence = new StringBuilder(); Collection<ConllToken> tokens = new ArrayList<>(); int tokenStartIndex = 0; for (String line; (line = r.readLine()) != null; ) { // empty line means end-of-sentence if (line.isEmpty()) { // if we have an empty line and something in the actual sentence then add it if (sentence.length() > 0) { sentences.add(new Sentence(sentence.toString(), tokens)); sentence = new StringBuilder(); tokens = new ArrayList<>(); tokenStartIndex = 0; } } else { // this assumes there is ever only a single space between token and classifiers final String[] parts = SPACES.split(line); switch (parts[0]) { case "-DOCSTART-": // we use DOCSTART as the end of the current doc, also throw away the following empty line r.readLine(); // no need to think about a current sentence, the previous empty line will have saved it return sentences; default: if (sentence.length() > 0) sentence.append(" "); sentence.append(parts[0]); tokens.add(new ConllToken(tokenStartIndex, parts[0], parts[1] + " " + parts[2], parts[3])); tokenStartIndex += parts[0].length() + 1; // add 1 for the space between tokens } } } // if we run out of data in the file if (sentence.length() > 0) sentences.add(new Sentence(sentence.toString(), tokens)); return sentences; }
[ "private", "Collection", "<", "Sentence", ">", "readDoc", "(", ")", "throws", "IOException", "{", "final", "Collection", "<", "Sentence", ">", "sentences", "=", "new", "ArrayList", "<>", "(", ")", ";", "StringBuilder", "sentence", "=", "new", "StringBuilder", ...
/* -DOCSTART- -X- O O CRICKET NNP I-NP O - : O O LEICESTERSHIRE NNP I-NP I-ORG TAKE NNP I-NP O OVER IN I-PP O AT NNP I-NP O TOP NNP I-NP O AFTER NNP I-NP O INNINGS NNP I-NP O VICTORY NN I-NP O . . O O LONDON NNP I-NP I-LOC 1996-08-30 CD I-NP O West NNP I-NP I-MISC [...] . . O O -DOCSTART- -X- O O CRICKET NNP I-NP O [...]
[ "/", "*", "-", "DOCSTART", "-", "-", "X", "-", "O", "O" ]
train
https://github.com/NICTA/nicta-ner/blob/c2156a0e299004e586926777a995b7795f35ff1c/conll2003-evaluation/src/main/java/org/t3as/ner/conll2003/ConllReader.java#L88-L126
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/plan/AbstractServerGroupRolloutTask.java
AbstractServerGroupRolloutTask.recordPreparedOperation
protected void recordPreparedOperation(final ServerIdentity identity, final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> prepared) { """ Record a prepared operation. @param identity the server identity @param prepared the prepared operation """ final ModelNode preparedResult = prepared.getPreparedResult(); // Hmm do the server results need to get translated as well as the host one? // final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult); updatePolicy.recordServerResult(identity, preparedResult); executor.recordPreparedOperation(prepared); }
java
protected void recordPreparedOperation(final ServerIdentity identity, final TransactionalProtocolClient.PreparedOperation<ServerTaskExecutor.ServerOperation> prepared) { final ModelNode preparedResult = prepared.getPreparedResult(); // Hmm do the server results need to get translated as well as the host one? // final ModelNode transformedResult = prepared.getOperation().transformResult(preparedResult); updatePolicy.recordServerResult(identity, preparedResult); executor.recordPreparedOperation(prepared); }
[ "protected", "void", "recordPreparedOperation", "(", "final", "ServerIdentity", "identity", ",", "final", "TransactionalProtocolClient", ".", "PreparedOperation", "<", "ServerTaskExecutor", ".", "ServerOperation", ">", "prepared", ")", "{", "final", "ModelNode", "prepared...
Record a prepared operation. @param identity the server identity @param prepared the prepared operation
[ "Record", "a", "prepared", "operation", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/plan/AbstractServerGroupRolloutTask.java#L97-L103
tvesalainen/util
security/src/main/java/org/vesalainen/net/ssl/SSLSocketChannel.java
SSLSocketChannel.open
public static SSLSocketChannel open(String peer, int port, SSLContext sslContext) throws IOException { """ Creates connection to a named peer using given SSLContext. Connection is in client mode but can be changed before read/write. @param peer @param port @param sslContext @return @throws IOException """ SSLEngine engine = sslContext.createSSLEngine(peer, port); engine.setUseClientMode(true); SSLParameters sslParameters = engine.getSSLParameters(); SNIServerName hostName = new SNIHostName(peer); List<SNIServerName> list = new ArrayList<>(); list.add(hostName); sslParameters.setServerNames(list); engine.setSSLParameters(sslParameters); InetSocketAddress address = new InetSocketAddress(peer, port); SocketChannel socketChannel = SocketChannel.open(address); SSLSocketChannel sslSocketChannel = new SSLSocketChannel(socketChannel, engine, null, false); return sslSocketChannel; }
java
public static SSLSocketChannel open(String peer, int port, SSLContext sslContext) throws IOException { SSLEngine engine = sslContext.createSSLEngine(peer, port); engine.setUseClientMode(true); SSLParameters sslParameters = engine.getSSLParameters(); SNIServerName hostName = new SNIHostName(peer); List<SNIServerName> list = new ArrayList<>(); list.add(hostName); sslParameters.setServerNames(list); engine.setSSLParameters(sslParameters); InetSocketAddress address = new InetSocketAddress(peer, port); SocketChannel socketChannel = SocketChannel.open(address); SSLSocketChannel sslSocketChannel = new SSLSocketChannel(socketChannel, engine, null, false); return sslSocketChannel; }
[ "public", "static", "SSLSocketChannel", "open", "(", "String", "peer", ",", "int", "port", ",", "SSLContext", "sslContext", ")", "throws", "IOException", "{", "SSLEngine", "engine", "=", "sslContext", ".", "createSSLEngine", "(", "peer", ",", "port", ")", ";",...
Creates connection to a named peer using given SSLContext. Connection is in client mode but can be changed before read/write. @param peer @param port @param sslContext @return @throws IOException
[ "Creates", "connection", "to", "a", "named", "peer", "using", "given", "SSLContext", ".", "Connection", "is", "in", "client", "mode", "but", "can", "be", "changed", "before", "read", "/", "write", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/security/src/main/java/org/vesalainen/net/ssl/SSLSocketChannel.java#L81-L95
jxnet/Jxnet
jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/HandlerConfigurer.java
HandlerConfigurer.decodeRawBuffer
public Packet decodeRawBuffer(long address, int length) { """ Decode buffer. @param address memory address. @param length length. @return returns {@link Packet}. """ return processPacket(Memories.wrap(address, length, memoryProperties.getCheckBounds())); }
java
public Packet decodeRawBuffer(long address, int length) { return processPacket(Memories.wrap(address, length, memoryProperties.getCheckBounds())); }
[ "public", "Packet", "decodeRawBuffer", "(", "long", "address", ",", "int", "length", ")", "{", "return", "processPacket", "(", "Memories", ".", "wrap", "(", "address", ",", "length", ",", "memoryProperties", ".", "getCheckBounds", "(", ")", ")", ")", ";", ...
Decode buffer. @param address memory address. @param length length. @return returns {@link Packet}.
[ "Decode", "buffer", "." ]
train
https://github.com/jxnet/Jxnet/blob/3ef28eb83c149ff134df1841d12bcbea3d8fe163/jxnet-spring-boot-autoconfigure/src/main/java/com/ardikars/jxnet/spring/boot/autoconfigure/HandlerConfigurer.java#L77-L79
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java
ComponentFinder.findParent
public static Component findParent(final Component childComponent, final Class<? extends Component> parentClass) { """ Finds the first parent of the given childComponent from the given parentClass. @param childComponent the child component @param parentClass the parent class @return the component """ return findParent(childComponent, parentClass, true); }
java
public static Component findParent(final Component childComponent, final Class<? extends Component> parentClass) { return findParent(childComponent, parentClass, true); }
[ "public", "static", "Component", "findParent", "(", "final", "Component", "childComponent", ",", "final", "Class", "<", "?", "extends", "Component", ">", "parentClass", ")", "{", "return", "findParent", "(", "childComponent", ",", "parentClass", ",", "true", ")"...
Finds the first parent of the given childComponent from the given parentClass. @param childComponent the child component @param parentClass the parent class @return the component
[ "Finds", "the", "first", "parent", "of", "the", "given", "childComponent", "from", "the", "given", "parentClass", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java#L93-L97
salesforce/Argus
ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/NamespaceService.java
NamespaceService.updateNamespace
public Namespace updateNamespace(BigInteger id, Namespace namespace) throws IOException, TokenExpiredException { """ Updates a new namespace. @param id The ID of the namespace to update. @param namespace The namespace to update. @return The updated namespace. @throws IOException If the server cannot be reached. @throws TokenExpiredException If the token sent along with the request has expired """ String requestUrl = RESOURCE + "/" + id.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, namespace); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Namespace.class); }
java
public Namespace updateNamespace(BigInteger id, Namespace namespace) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + id.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, namespace); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Namespace.class); }
[ "public", "Namespace", "updateNamespace", "(", "BigInteger", "id", ",", "Namespace", "namespace", ")", "throws", "IOException", ",", "TokenExpiredException", "{", "String", "requestUrl", "=", "RESOURCE", "+", "\"/\"", "+", "id", ".", "toString", "(", ")", ";", ...
Updates a new namespace. @param id The ID of the namespace to update. @param namespace The namespace to update. @return The updated namespace. @throws IOException If the server cannot be reached. @throws TokenExpiredException If the token sent along with the request has expired
[ "Updates", "a", "new", "namespace", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/NamespaceService.java#L113-L119
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java
StringIterate.reverseForEach
@Deprecated public static void reverseForEach(String string, CodePointProcedure procedure) { """ For each int code point in the {@code string} in reverse order, execute the {@link CodePointProcedure}. @deprecated since 7.0. Use {@link #reverseForEachCodePoint(String, CodePointProcedure)} instead. """ StringIterate.reverseForEachCodePoint(string, procedure); }
java
@Deprecated public static void reverseForEach(String string, CodePointProcedure procedure) { StringIterate.reverseForEachCodePoint(string, procedure); }
[ "@", "Deprecated", "public", "static", "void", "reverseForEach", "(", "String", "string", ",", "CodePointProcedure", "procedure", ")", "{", "StringIterate", ".", "reverseForEachCodePoint", "(", "string", ",", "procedure", ")", ";", "}" ]
For each int code point in the {@code string} in reverse order, execute the {@link CodePointProcedure}. @deprecated since 7.0. Use {@link #reverseForEachCodePoint(String, CodePointProcedure)} instead.
[ "For", "each", "int", "code", "point", "in", "the", "{", "@code", "string", "}", "in", "reverse", "order", "execute", "the", "{", "@link", "CodePointProcedure", "}", "." ]
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/StringIterate.java#L425-L429
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteGatewaysInner.java
ExpressRouteGatewaysInner.getByResourceGroupAsync
public Observable<ExpressRouteGatewayInner> getByResourceGroupAsync(String resourceGroupName, String expressRouteGatewayName) { """ Fetches the details of a ExpressRoute gateway in a resource group. @param resourceGroupName The name of the resource group. @param expressRouteGatewayName The name of the ExpressRoute gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteGatewayInner object """ return getByResourceGroupWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName).map(new Func1<ServiceResponse<ExpressRouteGatewayInner>, ExpressRouteGatewayInner>() { @Override public ExpressRouteGatewayInner call(ServiceResponse<ExpressRouteGatewayInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteGatewayInner> getByResourceGroupAsync(String resourceGroupName, String expressRouteGatewayName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, expressRouteGatewayName).map(new Func1<ServiceResponse<ExpressRouteGatewayInner>, ExpressRouteGatewayInner>() { @Override public ExpressRouteGatewayInner call(ServiceResponse<ExpressRouteGatewayInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteGatewayInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "expressRouteGatewayName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "expressRouteG...
Fetches the details of a ExpressRoute gateway in a resource group. @param resourceGroupName The name of the resource group. @param expressRouteGatewayName The name of the ExpressRoute gateway. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ExpressRouteGatewayInner object
[ "Fetches", "the", "details", "of", "a", "ExpressRoute", "gateway", "in", "a", "resource", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteGatewaysInner.java#L462-L469
looly/hutool
hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java
FileUtil.readString
public static String readString(String path, String charsetName) throws IORuntimeException { """ 读取文件内容 @param path 文件路径 @param charsetName 字符集 @return 内容 @throws IORuntimeException IO异常 """ return readString(file(path), charsetName); }
java
public static String readString(String path, String charsetName) throws IORuntimeException { return readString(file(path), charsetName); }
[ "public", "static", "String", "readString", "(", "String", "path", ",", "String", "charsetName", ")", "throws", "IORuntimeException", "{", "return", "readString", "(", "file", "(", "path", ")", ",", "charsetName", ")", ";", "}" ]
读取文件内容 @param path 文件路径 @param charsetName 字符集 @return 内容 @throws IORuntimeException IO异常
[ "读取文件内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2114-L2116
isisaddons-legacy/isis-module-docx
dom/src/main/java/org/isisaddons/module/docx/dom/DocxService.java
DocxService.loadPackage
@Programmatic public WordprocessingMLPackage loadPackage(final InputStream docxTemplate) throws LoadTemplateException { """ Load and return an in-memory representation of a docx. <p> This is public API because building the in-memory structure can be quite slow. Thus, clients can use this method to cache the in-memory structure, and pass in to either {@link #merge(String, WordprocessingMLPackage, OutputStream, MatchingPolicy)} or {@link #merge(org.w3c.dom.Document, org.docx4j.openpackaging.packages.WordprocessingMLPackage, java.io.OutputStream, org.isisaddons.module.docx.dom.DocxService.MatchingPolicy, org.isisaddons.module.docx.dom.DocxService.OutputType)} """ final WordprocessingMLPackage docxPkg; try { docxPkg = WordprocessingMLPackage.load(docxTemplate); } catch (final Docx4JException ex) { throw new LoadTemplateException("Unable to load docx template from input stream", ex); } return docxPkg; }
java
@Programmatic public WordprocessingMLPackage loadPackage(final InputStream docxTemplate) throws LoadTemplateException { final WordprocessingMLPackage docxPkg; try { docxPkg = WordprocessingMLPackage.load(docxTemplate); } catch (final Docx4JException ex) { throw new LoadTemplateException("Unable to load docx template from input stream", ex); } return docxPkg; }
[ "@", "Programmatic", "public", "WordprocessingMLPackage", "loadPackage", "(", "final", "InputStream", "docxTemplate", ")", "throws", "LoadTemplateException", "{", "final", "WordprocessingMLPackage", "docxPkg", ";", "try", "{", "docxPkg", "=", "WordprocessingMLPackage", "....
Load and return an in-memory representation of a docx. <p> This is public API because building the in-memory structure can be quite slow. Thus, clients can use this method to cache the in-memory structure, and pass in to either {@link #merge(String, WordprocessingMLPackage, OutputStream, MatchingPolicy)} or {@link #merge(org.w3c.dom.Document, org.docx4j.openpackaging.packages.WordprocessingMLPackage, java.io.OutputStream, org.isisaddons.module.docx.dom.DocxService.MatchingPolicy, org.isisaddons.module.docx.dom.DocxService.OutputType)}
[ "Load", "and", "return", "an", "in", "-", "memory", "representation", "of", "a", "docx", "." ]
train
https://github.com/isisaddons-legacy/isis-module-docx/blob/f2cabcc42fff46c593c2ecbb0bda1d2364bf3c2a/dom/src/main/java/org/isisaddons/module/docx/dom/DocxService.java#L104-L113
amzn/ion-java
src/com/amazon/ion/Timestamp.java
Timestamp.forDateZ
public static Timestamp forDateZ(Date date) { """ Converts a {@link Date} to a Timestamp in UTC representing the same point in time. <p> The resulting Timestamp will be precise to the millisecond. @return a new Timestamp instance, in UTC, precise to the millisecond; {@code null} if {@code date} is {@code null} """ if (date == null) return null; long millis = date.getTime(); return new Timestamp(millis, UTC_OFFSET); }
java
public static Timestamp forDateZ(Date date) { if (date == null) return null; long millis = date.getTime(); return new Timestamp(millis, UTC_OFFSET); }
[ "public", "static", "Timestamp", "forDateZ", "(", "Date", "date", ")", "{", "if", "(", "date", "==", "null", ")", "return", "null", ";", "long", "millis", "=", "date", ".", "getTime", "(", ")", ";", "return", "new", "Timestamp", "(", "millis", ",", "...
Converts a {@link Date} to a Timestamp in UTC representing the same point in time. <p> The resulting Timestamp will be precise to the millisecond. @return a new Timestamp instance, in UTC, precise to the millisecond; {@code null} if {@code date} is {@code null}
[ "Converts", "a", "{", "@link", "Date", "}", "to", "a", "Timestamp", "in", "UTC", "representing", "the", "same", "point", "in", "time", ".", "<p", ">", "The", "resulting", "Timestamp", "will", "be", "precise", "to", "the", "millisecond", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/Timestamp.java#L1415-L1420
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/Timing.java
Timing.report
public long report(String str, PrintStream stream) { """ Print elapsed time (without stopping timer). @param str Additional prefix string to be printed @param stream PrintStream on which to write output @return Number of milliseconds elapsed """ long elapsed = this.report(); stream.println(str + " Time elapsed: " + (elapsed) + " ms"); return elapsed; }
java
public long report(String str, PrintStream stream) { long elapsed = this.report(); stream.println(str + " Time elapsed: " + (elapsed) + " ms"); return elapsed; }
[ "public", "long", "report", "(", "String", "str", ",", "PrintStream", "stream", ")", "{", "long", "elapsed", "=", "this", ".", "report", "(", ")", ";", "stream", ".", "println", "(", "str", "+", "\" Time elapsed: \"", "+", "(", "elapsed", ")", "+", "\"...
Print elapsed time (without stopping timer). @param str Additional prefix string to be printed @param stream PrintStream on which to write output @return Number of milliseconds elapsed
[ "Print", "elapsed", "time", "(", "without", "stopping", "timer", ")", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Timing.java#L66-L70
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java
NodeServiceImpl.find
@Override public FedoraResource find(final FedoraSession session, final String path) { """ Retrieve an existing Fedora resource at the given path @param session a JCR session @param path a JCR path @return Fedora resource at the given path """ final Session jcrSession = getJcrSession(session); try { return new FedoraResourceImpl(jcrSession.getNode(path)); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } }
java
@Override public FedoraResource find(final FedoraSession session, final String path) { final Session jcrSession = getJcrSession(session); try { return new FedoraResourceImpl(jcrSession.getNode(path)); } catch (final RepositoryException e) { throw new RepositoryRuntimeException(e); } }
[ "@", "Override", "public", "FedoraResource", "find", "(", "final", "FedoraSession", "session", ",", "final", "String", "path", ")", "{", "final", "Session", "jcrSession", "=", "getJcrSession", "(", "session", ")", ";", "try", "{", "return", "new", "FedoraResou...
Retrieve an existing Fedora resource at the given path @param session a JCR session @param path a JCR path @return Fedora resource at the given path
[ "Retrieve", "an", "existing", "Fedora", "resource", "at", "the", "given", "path" ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/NodeServiceImpl.java#L75-L83
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java
CPSpecificationOptionPersistenceImpl.findByUUID_G
@Override public CPSpecificationOption findByUUID_G(String uuid, long groupId) throws NoSuchCPSpecificationOptionException { """ Returns the cp specification option where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPSpecificationOptionException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp specification option @throws NoSuchCPSpecificationOptionException if a matching cp specification option could not be found """ CPSpecificationOption cpSpecificationOption = fetchByUUID_G(uuid, groupId); if (cpSpecificationOption == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPSpecificationOptionException(msg.toString()); } return cpSpecificationOption; }
java
@Override public CPSpecificationOption findByUUID_G(String uuid, long groupId) throws NoSuchCPSpecificationOptionException { CPSpecificationOption cpSpecificationOption = fetchByUUID_G(uuid, groupId); if (cpSpecificationOption == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCPSpecificationOptionException(msg.toString()); } return cpSpecificationOption; }
[ "@", "Override", "public", "CPSpecificationOption", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCPSpecificationOptionException", "{", "CPSpecificationOption", "cpSpecificationOption", "=", "fetchByUUID_G", "(", "uuid", ",", "groupI...
Returns the cp specification option where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCPSpecificationOptionException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching cp specification option @throws NoSuchCPSpecificationOptionException if a matching cp specification option could not be found
[ "Returns", "the", "cp", "specification", "option", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCPSpecificationOptionException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPSpecificationOptionPersistenceImpl.java#L670-L697
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java
DocEnv.makeAnnotationTypeElementDoc
protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) { """ Create the AnnotationTypeElementDoc for a MethodSymbol. Should be called only on symbols representing annotation type elements. """ AnnotationTypeElementDocImpl result = (AnnotationTypeElementDocImpl)methodMap.get(meth); if (result != null) { if (treePath != null) result.setTreePath(treePath); } else { result = new AnnotationTypeElementDocImpl(this, meth, treePath); methodMap.put(meth, result); } }
java
protected void makeAnnotationTypeElementDoc(MethodSymbol meth, TreePath treePath) { AnnotationTypeElementDocImpl result = (AnnotationTypeElementDocImpl)methodMap.get(meth); if (result != null) { if (treePath != null) result.setTreePath(treePath); } else { result = new AnnotationTypeElementDocImpl(this, meth, treePath); methodMap.put(meth, result); } }
[ "protected", "void", "makeAnnotationTypeElementDoc", "(", "MethodSymbol", "meth", ",", "TreePath", "treePath", ")", "{", "AnnotationTypeElementDocImpl", "result", "=", "(", "AnnotationTypeElementDocImpl", ")", "methodMap", ".", "get", "(", "meth", ")", ";", "if", "(...
Create the AnnotationTypeElementDoc for a MethodSymbol. Should be called only on symbols representing annotation type elements.
[ "Create", "the", "AnnotationTypeElementDoc", "for", "a", "MethodSymbol", ".", "Should", "be", "called", "only", "on", "symbols", "representing", "annotation", "type", "elements", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/DocEnv.java#L715-L725
roboconf/roboconf-platform
miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/validation/ProjectValidator.java
ProjectValidator.validateProject
public static ProjectValidationResult validateProject( File appDirectory ) { """ Validates a project. <p> Whereas {@link #validateProject(File, boolean)}, this method tries to guess whether the project is a recipe one or not. It assumes that if the project has neither a descriptor file, nor instances, then it can be considered as a recipe project </p> @param appDirectory the application's directory (must exist) @return a non-null list of errors, with the resolved location (sorted by error code) """ // Determine whether the project is a recipe one. // Since a Roboconf project is not mandatory a Maven project, // we cannot rely on the POM. But we make the hypothesis that // if the project has neither a descriptor file, nor instances, // then it can be considered as a recipe project. // If there is a POM that indicates it is (or not) a recipe // project, then errors will appear during the Maven build. File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); boolean isRecipe = ! new File( appDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ).exists() && (! instancesDir.isDirectory() || Utils.listAllFiles( instancesDir ).isEmpty()); // Validate the project then return validateProject( appDirectory, isRecipe ); }
java
public static ProjectValidationResult validateProject( File appDirectory ) { // Determine whether the project is a recipe one. // Since a Roboconf project is not mandatory a Maven project, // we cannot rely on the POM. But we make the hypothesis that // if the project has neither a descriptor file, nor instances, // then it can be considered as a recipe project. // If there is a POM that indicates it is (or not) a recipe // project, then errors will appear during the Maven build. File instancesDir = new File( appDirectory, Constants.PROJECT_DIR_INSTANCES ); boolean isRecipe = ! new File( appDirectory, Constants.PROJECT_DIR_DESC + "/" + Constants.PROJECT_FILE_DESCRIPTOR ).exists() && (! instancesDir.isDirectory() || Utils.listAllFiles( instancesDir ).isEmpty()); // Validate the project then return validateProject( appDirectory, isRecipe ); }
[ "public", "static", "ProjectValidationResult", "validateProject", "(", "File", "appDirectory", ")", "{", "// Determine whether the project is a recipe one.", "// Since a Roboconf project is not mandatory a Maven project,", "// we cannot rely on the POM. But we make the hypothesis that", "// ...
Validates a project. <p> Whereas {@link #validateProject(File, boolean)}, this method tries to guess whether the project is a recipe one or not. It assumes that if the project has neither a descriptor file, nor instances, then it can be considered as a recipe project </p> @param appDirectory the application's directory (must exist) @return a non-null list of errors, with the resolved location (sorted by error code)
[ "Validates", "a", "project", ".", "<p", ">", "Whereas", "{", "@link", "#validateProject", "(", "File", "boolean", ")", "}", "this", "method", "tries", "to", "guess", "whether", "the", "project", "is", "a", "recipe", "one", "or", "not", ".", "It", "assume...
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/miscellaneous/roboconf-tooling-core/src/main/java/net/roboconf/tooling/core/validation/ProjectValidator.java#L70-L88
groupe-sii/ogham
ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java
JavaMailSender.setFrom
private void setFrom(Email email, MimeMessage mimeMsg) throws MessagingException, AddressException, UnsupportedEncodingException { """ Set the sender address on the mime message. @param email the source email @param mimeMsg the mime message to fill @throws MessagingException when the email address is not valid @throws AddressException when the email address is not valid @throws UnsupportedEncodingException when the email address is not valid """ if (email.getFrom() == null) { throw new IllegalArgumentException("The sender address has not been set"); } mimeMsg.setFrom(toInternetAddress(email.getFrom())); }
java
private void setFrom(Email email, MimeMessage mimeMsg) throws MessagingException, AddressException, UnsupportedEncodingException { if (email.getFrom() == null) { throw new IllegalArgumentException("The sender address has not been set"); } mimeMsg.setFrom(toInternetAddress(email.getFrom())); }
[ "private", "void", "setFrom", "(", "Email", "email", ",", "MimeMessage", "mimeMsg", ")", "throws", "MessagingException", ",", "AddressException", ",", "UnsupportedEncodingException", "{", "if", "(", "email", ".", "getFrom", "(", ")", "==", "null", ")", "{", "t...
Set the sender address on the mime message. @param email the source email @param mimeMsg the mime message to fill @throws MessagingException when the email address is not valid @throws AddressException when the email address is not valid @throws UnsupportedEncodingException when the email address is not valid
[ "Set", "the", "sender", "address", "on", "the", "mime", "message", "." ]
train
https://github.com/groupe-sii/ogham/blob/e273b845604add74b5a25dfd931cb3c166b1008f/ogham-email-javamail/src/main/java/fr/sii/ogham/email/sender/impl/JavaMailSender.java#L144-L149
zaproxy/zaproxy
src/org/parosproxy/paros/view/WorkbenchPanel.java
WorkbenchPanel.getTabbedWork
public TabbedPanel2 getTabbedWork() { """ Gets the tabbed panel that has the {@link PanelType#WORK WORK} panels. <p> Direct access/manipulation of the tabbed panel is discouraged, the changes done to it might be lost while changing layouts. @return the tabbed panel of the {@code work} panels, never {@code null} @see #addPanel(AbstractPanel, PanelType) """ if (tabbedWork == null) { tabbedWork = new TabbedPanel2(); tabbedWork.setPreferredSize(new Dimension(600, 400)); tabbedWork.setName("tabbedWork"); tabbedWork.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } return tabbedWork; }
java
public TabbedPanel2 getTabbedWork() { if (tabbedWork == null) { tabbedWork = new TabbedPanel2(); tabbedWork.setPreferredSize(new Dimension(600, 400)); tabbedWork.setName("tabbedWork"); tabbedWork.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); } return tabbedWork; }
[ "public", "TabbedPanel2", "getTabbedWork", "(", ")", "{", "if", "(", "tabbedWork", "==", "null", ")", "{", "tabbedWork", "=", "new", "TabbedPanel2", "(", ")", ";", "tabbedWork", ".", "setPreferredSize", "(", "new", "Dimension", "(", "600", ",", "400", ")",...
Gets the tabbed panel that has the {@link PanelType#WORK WORK} panels. <p> Direct access/manipulation of the tabbed panel is discouraged, the changes done to it might be lost while changing layouts. @return the tabbed panel of the {@code work} panels, never {@code null} @see #addPanel(AbstractPanel, PanelType)
[ "Gets", "the", "tabbed", "panel", "that", "has", "the", "{", "@link", "PanelType#WORK", "WORK", "}", "panels", ".", "<p", ">", "Direct", "access", "/", "manipulation", "of", "the", "tabbed", "panel", "is", "discouraged", "the", "changes", "done", "to", "it...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/WorkbenchPanel.java#L738-L746
Bedework/bw-util
bw-util-xml/src/main/java/org/bedework/util/xml/XmlEmit.java
XmlEmit.setProperty
public void setProperty(final String name, final String val) { """ Allows applications to provide parameters to methods using this object class, <p>For example, a parameter "full" with value "true" might indicate a full XML dump is required. @param name @param val """ if (props == null) { props = new Properties(); } props.setProperty(name, val); }
java
public void setProperty(final String name, final String val) { if (props == null) { props = new Properties(); } props.setProperty(name, val); }
[ "public", "void", "setProperty", "(", "final", "String", "name", ",", "final", "String", "val", ")", "{", "if", "(", "props", "==", "null", ")", "{", "props", "=", "new", "Properties", "(", ")", ";", "}", "props", ".", "setProperty", "(", "name", ","...
Allows applications to provide parameters to methods using this object class, <p>For example, a parameter "full" with value "true" might indicate a full XML dump is required. @param name @param val
[ "Allows", "applications", "to", "provide", "parameters", "to", "methods", "using", "this", "object", "class" ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-xml/src/main/java/org/bedework/util/xml/XmlEmit.java#L141-L147
mgormley/pacaya
src/main/java/edu/jhu/pacaya/parse/dep/DepIoChart.java
DepIoChart.checkCell
private void checkCell(int start, int end) { """ Checks that start \in [0, n-1] and end \in [1, n], where nplus is the sentence length plus 1. """ if (start > nplus - 1 || end > nplus || start < 0 || end < 1) { throw new IllegalStateException(String.format("Invalid cell: start=%d end=%d", start, end)); } }
java
private void checkCell(int start, int end) { if (start > nplus - 1 || end > nplus || start < 0 || end < 1) { throw new IllegalStateException(String.format("Invalid cell: start=%d end=%d", start, end)); } }
[ "private", "void", "checkCell", "(", "int", "start", ",", "int", "end", ")", "{", "if", "(", "start", ">", "nplus", "-", "1", "||", "end", ">", "nplus", "||", "start", "<", "0", "||", "end", "<", "1", ")", "{", "throw", "new", "IllegalStateExceptio...
Checks that start \in [0, n-1] and end \in [1, n], where nplus is the sentence length plus 1.
[ "Checks", "that", "start", "\\", "in", "[", "0", "n", "-", "1", "]", "and", "end", "\\", "in", "[", "1", "n", "]", "where", "nplus", "is", "the", "sentence", "length", "plus", "1", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/dep/DepIoChart.java#L57-L61
lets-blade/blade
src/main/java/com/blade/kit/StringKit.java
StringKit.alignLeft
public static String alignLeft(Object o, int width, char c) { """ Fill a certain number of special characters on the right side of the string @param o objects that can be to String @param width number of characters @param c characters @return new characters """ if (null == o) return null; String s = o.toString(); int length = s.length(); if (length >= width) return s; return s + dup(c, width - length); }
java
public static String alignLeft(Object o, int width, char c) { if (null == o) return null; String s = o.toString(); int length = s.length(); if (length >= width) return s; return s + dup(c, width - length); }
[ "public", "static", "String", "alignLeft", "(", "Object", "o", ",", "int", "width", ",", "char", "c", ")", "{", "if", "(", "null", "==", "o", ")", "return", "null", ";", "String", "s", "=", "o", ".", "toString", "(", ")", ";", "int", "length", "=...
Fill a certain number of special characters on the right side of the string @param o objects that can be to String @param width number of characters @param c characters @return new characters
[ "Fill", "a", "certain", "number", "of", "special", "characters", "on", "the", "right", "side", "of", "the", "string" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/StringKit.java#L206-L214
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/OverrideHelper.java
OverrideHelper.getResolvedFeatures
public ResolvedFeatures getResolvedFeatures(JvmTypeReference contextType) { """ Returns the resolved features that are defined in the given <code>context type</code> and its supertypes. Considers private methods of super types, too. @param contextType the context type. Has to be contained in a resource. @return the resolved features. """ ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, contextType.eResource().getResourceSet()); return getResolvedFeatures(owner.toLightweightTypeReference(contextType)); }
java
public ResolvedFeatures getResolvedFeatures(JvmTypeReference contextType) { ITypeReferenceOwner owner = new StandardTypeReferenceOwner(services, contextType.eResource().getResourceSet()); return getResolvedFeatures(owner.toLightweightTypeReference(contextType)); }
[ "public", "ResolvedFeatures", "getResolvedFeatures", "(", "JvmTypeReference", "contextType", ")", "{", "ITypeReferenceOwner", "owner", "=", "new", "StandardTypeReferenceOwner", "(", "services", ",", "contextType", ".", "eResource", "(", ")", ".", "getResourceSet", "(", ...
Returns the resolved features that are defined in the given <code>context type</code> and its supertypes. Considers private methods of super types, too. @param contextType the context type. Has to be contained in a resource. @return the resolved features.
[ "Returns", "the", "resolved", "features", "that", "are", "defined", "in", "the", "given", "<code", ">", "context", "type<", "/", "code", ">", "and", "its", "supertypes", ".", "Considers", "private", "methods", "of", "super", "types", "too", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/override/OverrideHelper.java#L211-L214
phax/ph-commons
ph-xml/src/main/java/com/helger/xml/xpath/XPathHelper.java
XPathHelper.createNewXPathExpression
@Nonnull public static XPathExpression createNewXPathExpression (@Nonnull final XPath aXPath, @Nonnull @Nonempty final String sXPath) { """ Create a new XPath expression for evaluation. @param aXPath The pre-created XPath object. May not be <code>null</code>. @param sXPath The main XPath string to be evaluated @return The {@link XPathExpression} object to be used. @throws IllegalArgumentException if the XPath cannot be compiled """ ValueEnforcer.notNull (aXPath, "XPath"); ValueEnforcer.notNull (sXPath, "XPathExpression"); try { return aXPath.compile (sXPath); } catch (final XPathExpressionException ex) { throw new IllegalArgumentException ("Failed to compile XPath expression '" + sXPath + "'", ex); } }
java
@Nonnull public static XPathExpression createNewXPathExpression (@Nonnull final XPath aXPath, @Nonnull @Nonempty final String sXPath) { ValueEnforcer.notNull (aXPath, "XPath"); ValueEnforcer.notNull (sXPath, "XPathExpression"); try { return aXPath.compile (sXPath); } catch (final XPathExpressionException ex) { throw new IllegalArgumentException ("Failed to compile XPath expression '" + sXPath + "'", ex); } }
[ "@", "Nonnull", "public", "static", "XPathExpression", "createNewXPathExpression", "(", "@", "Nonnull", "final", "XPath", "aXPath", ",", "@", "Nonnull", "@", "Nonempty", "final", "String", "sXPath", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aXPath", ",", ...
Create a new XPath expression for evaluation. @param aXPath The pre-created XPath object. May not be <code>null</code>. @param sXPath The main XPath string to be evaluated @return The {@link XPathExpression} object to be used. @throws IllegalArgumentException if the XPath cannot be compiled
[ "Create", "a", "new", "XPath", "expression", "for", "evaluation", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-xml/src/main/java/com/helger/xml/xpath/XPathHelper.java#L414-L429
Azure/azure-sdk-for-java
notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java
NotificationHubsInner.createOrUpdateAuthorizationRule
public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, SharedAccessAuthorizationRuleProperties properties) { """ Creates/Updates an authorization rule for a NotificationHub. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @param authorizationRuleName Authorization Rule Name. @param properties Properties of the Namespace AuthorizationRules. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SharedAccessAuthorizationRuleResourceInner object if successful. """ return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, properties).toBlocking().single().body(); }
java
public SharedAccessAuthorizationRuleResourceInner createOrUpdateAuthorizationRule(String resourceGroupName, String namespaceName, String notificationHubName, String authorizationRuleName, SharedAccessAuthorizationRuleProperties properties) { return createOrUpdateAuthorizationRuleWithServiceResponseAsync(resourceGroupName, namespaceName, notificationHubName, authorizationRuleName, properties).toBlocking().single().body(); }
[ "public", "SharedAccessAuthorizationRuleResourceInner", "createOrUpdateAuthorizationRule", "(", "String", "resourceGroupName", ",", "String", "namespaceName", ",", "String", "notificationHubName", ",", "String", "authorizationRuleName", ",", "SharedAccessAuthorizationRuleProperties",...
Creates/Updates an authorization rule for a NotificationHub. @param resourceGroupName The name of the resource group. @param namespaceName The namespace name. @param notificationHubName The notification hub name. @param authorizationRuleName Authorization Rule Name. @param properties Properties of the Namespace AuthorizationRules. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SharedAccessAuthorizationRuleResourceInner object if successful.
[ "Creates", "/", "Updates", "an", "authorization", "rule", "for", "a", "NotificationHub", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/notificationhubs/resource-manager/v2017_04_01/src/main/java/com/microsoft/azure/management/notificationhubs/v2017_04_01/implementation/NotificationHubsInner.java#L901-L903
playn/playn
core/src/playn/core/json/JsonParser.java
JsonParser.stringChar
private char stringChar() throws JsonParserException { """ Advances a character, throwing if it is illegal in the context of a JSON string. """ int c = advanceChar(); if (c == -1) throw createParseException(null, "String was not terminated before end of input", true); if (c < 32) throw createParseException(null, "Strings may not contain control characters: 0x" + Integer.toString(c, 16), false); return (char)c; }
java
private char stringChar() throws JsonParserException { int c = advanceChar(); if (c == -1) throw createParseException(null, "String was not terminated before end of input", true); if (c < 32) throw createParseException(null, "Strings may not contain control characters: 0x" + Integer.toString(c, 16), false); return (char)c; }
[ "private", "char", "stringChar", "(", ")", "throws", "JsonParserException", "{", "int", "c", "=", "advanceChar", "(", ")", ";", "if", "(", "c", "==", "-", "1", ")", "throw", "createParseException", "(", "null", ",", "\"String was not terminated before end of inp...
Advances a character, throwing if it is illegal in the context of a JSON string.
[ "Advances", "a", "character", "throwing", "if", "it", "is", "illegal", "in", "the", "context", "of", "a", "JSON", "string", "." ]
train
https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonParser.java#L373-L381
Quickhull3d/quickhull3d
src/main/java/com/github/quickhull3d/QuickHull3D.java
QuickHull3D.build
public void build(double[] coords, int nump) throws IllegalArgumentException { """ Constructs the convex hull of a set of points whose coordinates are given by an array of doubles. @param coords x, y, and z coordinates of each input point. The length of this array must be at least three times <code>nump</code>. @param nump number of input points @throws IllegalArgumentException the number of input points is less than four or greater than 1/3 the length of <code>coords</code>, or the points appear to be coincident, colinear, or coplanar. """ if (nump < 4) { throw new IllegalArgumentException("Less than four input points specified"); } if (coords.length / 3 < nump) { throw new IllegalArgumentException("Coordinate array too small for specified number of points"); } initBuffers(nump); setPoints(coords, nump); buildHull(); }
java
public void build(double[] coords, int nump) throws IllegalArgumentException { if (nump < 4) { throw new IllegalArgumentException("Less than four input points specified"); } if (coords.length / 3 < nump) { throw new IllegalArgumentException("Coordinate array too small for specified number of points"); } initBuffers(nump); setPoints(coords, nump); buildHull(); }
[ "public", "void", "build", "(", "double", "[", "]", "coords", ",", "int", "nump", ")", "throws", "IllegalArgumentException", "{", "if", "(", "nump", "<", "4", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Less than four input points specified\"", ...
Constructs the convex hull of a set of points whose coordinates are given by an array of doubles. @param coords x, y, and z coordinates of each input point. The length of this array must be at least three times <code>nump</code>. @param nump number of input points @throws IllegalArgumentException the number of input points is less than four or greater than 1/3 the length of <code>coords</code>, or the points appear to be coincident, colinear, or coplanar.
[ "Constructs", "the", "convex", "hull", "of", "a", "set", "of", "points", "whose", "coordinates", "are", "given", "by", "an", "array", "of", "doubles", "." ]
train
https://github.com/Quickhull3d/quickhull3d/blob/3f80953b86c46385e84730e5d2a1745cbfa12703/src/main/java/com/github/quickhull3d/QuickHull3D.java#L462-L472
zackpollard/JavaTelegramBot-API
core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java
TelegramBot.startUpdates
public boolean startUpdates(boolean getPreviousUpdates) { """ Use this method to start the update thread which will begin retrieving messages from the API and firing the relevant events for you to process the data @param getPreviousUpdates Whether you want to retrieve any updates that haven't been processed before, but were created prior to calling the startUpdates method @return True if the updater was started, otherwise False """ if(updateManager == null) updateManager = new RequestUpdatesManager(this, getPreviousUpdates); if(!updateManager.isRunning()) { updateManager.startUpdates(); return true; } return false; }
java
public boolean startUpdates(boolean getPreviousUpdates) { if(updateManager == null) updateManager = new RequestUpdatesManager(this, getPreviousUpdates); if(!updateManager.isRunning()) { updateManager.startUpdates(); return true; } return false; }
[ "public", "boolean", "startUpdates", "(", "boolean", "getPreviousUpdates", ")", "{", "if", "(", "updateManager", "==", "null", ")", "updateManager", "=", "new", "RequestUpdatesManager", "(", "this", ",", "getPreviousUpdates", ")", ";", "if", "(", "!", "updateMan...
Use this method to start the update thread which will begin retrieving messages from the API and firing the relevant events for you to process the data @param getPreviousUpdates Whether you want to retrieve any updates that haven't been processed before, but were created prior to calling the startUpdates method @return True if the updater was started, otherwise False
[ "Use", "this", "method", "to", "start", "the", "update", "thread", "which", "will", "begin", "retrieving", "messages", "from", "the", "API", "and", "firing", "the", "relevant", "events", "for", "you", "to", "process", "the", "data" ]
train
https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/TelegramBot.java#L1166-L1177
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java
CommercePriceEntryPersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { """ Removes all the commerce price entries where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID """ for (CommercePriceEntry commercePriceEntry : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commercePriceEntry); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CommercePriceEntry commercePriceEntry : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(commercePriceEntry); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CommercePriceEntry", "commercePriceEntry", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ",", "...
Removes all the commerce price entries where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "commerce", "price", "entries", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceEntryPersistenceImpl.java#L1407-L1413
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java
CellUtil.getOrCreateCell
public static Cell getOrCreateCell(Row row, int cellIndex) { """ 获取已有行或创建新行 @param row Excel表的行 @param cellIndex 列号 @return {@link Row} @since 4.0.2 """ Cell cell = row.getCell(cellIndex); if (null == cell) { cell = row.createCell(cellIndex); } return cell; }
java
public static Cell getOrCreateCell(Row row, int cellIndex) { Cell cell = row.getCell(cellIndex); if (null == cell) { cell = row.createCell(cellIndex); } return cell; }
[ "public", "static", "Cell", "getOrCreateCell", "(", "Row", "row", ",", "int", "cellIndex", ")", "{", "Cell", "cell", "=", "row", ".", "getCell", "(", "cellIndex", ")", ";", "if", "(", "null", "==", "cell", ")", "{", "cell", "=", "row", ".", "createCe...
获取已有行或创建新行 @param row Excel表的行 @param cellIndex 列号 @return {@link Row} @since 4.0.2
[ "获取已有行或创建新行" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/cell/CellUtil.java#L165-L171
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.leftShift
public static Number leftShift(Number self, Number operand) { """ Implementation of the left shift operator for integral types. Non integral Number types throw UnsupportedOperationException. @param self a Number object @param operand the shift distance by which to left shift the number @return the resulting number @since 1.5.0 """ return NumberMath.leftShift(self, operand); }
java
public static Number leftShift(Number self, Number operand) { return NumberMath.leftShift(self, operand); }
[ "public", "static", "Number", "leftShift", "(", "Number", "self", ",", "Number", "operand", ")", "{", "return", "NumberMath", ".", "leftShift", "(", "self", ",", "operand", ")", ";", "}" ]
Implementation of the left shift operator for integral types. Non integral Number types throw UnsupportedOperationException. @param self a Number object @param operand the shift distance by which to left shift the number @return the resulting number @since 1.5.0
[ "Implementation", "of", "the", "left", "shift", "operator", "for", "integral", "types", ".", "Non", "integral", "Number", "types", "throw", "UnsupportedOperationException", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13569-L13571
aws/aws-sdk-java
aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateFunctionDefinitionRequest.java
CreateFunctionDefinitionRequest.withTags
public CreateFunctionDefinitionRequest withTags(java.util.Map<String, String> tags) { """ Tag(s) to add to the new resource @param tags Tag(s) to add to the new resource @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public CreateFunctionDefinitionRequest withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "CreateFunctionDefinitionRequest", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
Tag(s) to add to the new resource @param tags Tag(s) to add to the new resource @return Returns a reference to this object so that method calls can be chained together.
[ "Tag", "(", "s", ")", "to", "add", "to", "the", "new", "resource" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-greengrass/src/main/java/com/amazonaws/services/greengrass/model/CreateFunctionDefinitionRequest.java#L168-L171
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/servlet/RendererRequestUtils.java
RendererRequestUtils.setRequestDebuggable
public static void setRequestDebuggable(HttpServletRequest req, JawrConfig jawrConfig) { """ Determines whether to override the debug settings. Sets the debugOverride status on ThreadLocalJawrContext @param req the request @param jawrConfig the jawr config """ // make sure we have set an overrideKey // make sure the overrideKey exists in the request // lastly, make sure the keys match if (jawrConfig.getDebugOverrideKey().length() > 0 && null != req.getParameter(JawrConstant.OVERRIDE_KEY_PARAMETER_NAME) && jawrConfig .getDebugOverrideKey().equals(req.getParameter(JawrConstant.OVERRIDE_KEY_PARAMETER_NAME))) { ThreadLocalJawrContext.setDebugOverriden(true); } else { ThreadLocalJawrContext.setDebugOverriden(false); } // Inherit the debuggable property of the session if the session is a // debuggable one inheritSessionDebugProperty(req); }
java
public static void setRequestDebuggable(HttpServletRequest req, JawrConfig jawrConfig) { // make sure we have set an overrideKey // make sure the overrideKey exists in the request // lastly, make sure the keys match if (jawrConfig.getDebugOverrideKey().length() > 0 && null != req.getParameter(JawrConstant.OVERRIDE_KEY_PARAMETER_NAME) && jawrConfig .getDebugOverrideKey().equals(req.getParameter(JawrConstant.OVERRIDE_KEY_PARAMETER_NAME))) { ThreadLocalJawrContext.setDebugOverriden(true); } else { ThreadLocalJawrContext.setDebugOverriden(false); } // Inherit the debuggable property of the session if the session is a // debuggable one inheritSessionDebugProperty(req); }
[ "public", "static", "void", "setRequestDebuggable", "(", "HttpServletRequest", "req", ",", "JawrConfig", "jawrConfig", ")", "{", "// make sure we have set an overrideKey", "// make sure the overrideKey exists in the request", "// lastly, make sure the keys match", "if", "(", "jawrC...
Determines whether to override the debug settings. Sets the debugOverride status on ThreadLocalJawrContext @param req the request @param jawrConfig the jawr config
[ "Determines", "whether", "to", "override", "the", "debug", "settings", ".", "Sets", "the", "debugOverride", "status", "on", "ThreadLocalJawrContext" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/servlet/RendererRequestUtils.java#L257-L274
jhy/jsoup
src/main/java/org/jsoup/safety/Whitelist.java
Whitelist.isSafeAttribute
protected boolean isSafeAttribute(String tagName, Element el, Attribute attr) { """ Test if the supplied attribute is allowed by this whitelist for this tag @param tagName tag to consider allowing the attribute in @param el element under test, to confirm protocol @param attr attribute under test @return true if allowed """ TagName tag = TagName.valueOf(tagName); AttributeKey key = AttributeKey.valueOf(attr.getKey()); Set<AttributeKey> okSet = attributes.get(tag); if (okSet != null && okSet.contains(key)) { if (protocols.containsKey(tag)) { Map<AttributeKey, Set<Protocol>> attrProts = protocols.get(tag); // ok if not defined protocol; otherwise test return !attrProts.containsKey(key) || testValidProtocol(el, attr, attrProts.get(key)); } else { // attribute found, no protocols defined, so OK return true; } } // might be an enforced attribute? Map<AttributeKey, AttributeValue> enforcedSet = enforcedAttributes.get(tag); if (enforcedSet != null) { Attributes expect = getEnforcedAttributes(tagName); String attrKey = attr.getKey(); if (expect.hasKeyIgnoreCase(attrKey)) { return expect.getIgnoreCase(attrKey).equals(attr.getValue()); } } // no attributes defined for tag, try :all tag return !tagName.equals(":all") && isSafeAttribute(":all", el, attr); }
java
protected boolean isSafeAttribute(String tagName, Element el, Attribute attr) { TagName tag = TagName.valueOf(tagName); AttributeKey key = AttributeKey.valueOf(attr.getKey()); Set<AttributeKey> okSet = attributes.get(tag); if (okSet != null && okSet.contains(key)) { if (protocols.containsKey(tag)) { Map<AttributeKey, Set<Protocol>> attrProts = protocols.get(tag); // ok if not defined protocol; otherwise test return !attrProts.containsKey(key) || testValidProtocol(el, attr, attrProts.get(key)); } else { // attribute found, no protocols defined, so OK return true; } } // might be an enforced attribute? Map<AttributeKey, AttributeValue> enforcedSet = enforcedAttributes.get(tag); if (enforcedSet != null) { Attributes expect = getEnforcedAttributes(tagName); String attrKey = attr.getKey(); if (expect.hasKeyIgnoreCase(attrKey)) { return expect.getIgnoreCase(attrKey).equals(attr.getValue()); } } // no attributes defined for tag, try :all tag return !tagName.equals(":all") && isSafeAttribute(":all", el, attr); }
[ "protected", "boolean", "isSafeAttribute", "(", "String", "tagName", ",", "Element", "el", ",", "Attribute", "attr", ")", "{", "TagName", "tag", "=", "TagName", ".", "valueOf", "(", "tagName", ")", ";", "AttributeKey", "key", "=", "AttributeKey", ".", "value...
Test if the supplied attribute is allowed by this whitelist for this tag @param tagName tag to consider allowing the attribute in @param el element under test, to confirm protocol @param attr attribute under test @return true if allowed
[ "Test", "if", "the", "supplied", "attribute", "is", "allowed", "by", "this", "whitelist", "for", "this", "tag" ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/safety/Whitelist.java#L496-L521
bazaarvoice/emodb
common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java
EmoUriComponent.decodePathSegment
public static void decodePathSegment(List<PathSegment> segments, String segment, boolean decode) { """ Decode the path segment and add it to the list of path segments. @param segments mutable list of path segments. @param segment path segment to be decoded. @param decode {@code true} if the path segment should be in a decoded form. """ int colon = segment.indexOf(';'); if (colon != -1) { segments.add(new PathSegmentImpl( (colon == 0) ? "" : segment.substring(0, colon), decode, decodeMatrix(segment, decode))); } else { segments.add(new PathSegmentImpl( segment, decode)); } }
java
public static void decodePathSegment(List<PathSegment> segments, String segment, boolean decode) { int colon = segment.indexOf(';'); if (colon != -1) { segments.add(new PathSegmentImpl( (colon == 0) ? "" : segment.substring(0, colon), decode, decodeMatrix(segment, decode))); } else { segments.add(new PathSegmentImpl( segment, decode)); } }
[ "public", "static", "void", "decodePathSegment", "(", "List", "<", "PathSegment", ">", "segments", ",", "String", "segment", ",", "boolean", "decode", ")", "{", "int", "colon", "=", "segment", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "colon", ...
Decode the path segment and add it to the list of path segments. @param segments mutable list of path segments. @param segment path segment to be decoded. @param decode {@code true} if the path segment should be in a decoded form.
[ "Decode", "the", "path", "segment", "and", "add", "it", "to", "the", "list", "of", "path", "segments", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/common/client/src/main/java/com/bazaarvoice/emodb/client/uri/EmoUriComponent.java#L648-L660
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java
TagletManager.getCustomTaglets
public List<Taglet> getCustomTaglets(Element e) { """ Returns the custom tags for a given element. @param e the element to get custom tags for @return the array of <code>Taglet</code>s that can appear in the given element. """ switch (e.getKind()) { case CONSTRUCTOR: return getConstructorCustomTaglets(); case METHOD: return getMethodCustomTaglets(); case ENUM_CONSTANT: case FIELD: return getFieldCustomTaglets(); case ANNOTATION_TYPE: case INTERFACE: case CLASS: case ENUM: return getTypeCustomTaglets(); case MODULE: return getModuleCustomTaglets(); case PACKAGE: return getPackageCustomTaglets(); case OTHER: return getOverviewCustomTaglets(); default: throw new AssertionError("unknown element: " + e + " ,kind: " + e.getKind()); } }
java
public List<Taglet> getCustomTaglets(Element e) { switch (e.getKind()) { case CONSTRUCTOR: return getConstructorCustomTaglets(); case METHOD: return getMethodCustomTaglets(); case ENUM_CONSTANT: case FIELD: return getFieldCustomTaglets(); case ANNOTATION_TYPE: case INTERFACE: case CLASS: case ENUM: return getTypeCustomTaglets(); case MODULE: return getModuleCustomTaglets(); case PACKAGE: return getPackageCustomTaglets(); case OTHER: return getOverviewCustomTaglets(); default: throw new AssertionError("unknown element: " + e + " ,kind: " + e.getKind()); } }
[ "public", "List", "<", "Taglet", ">", "getCustomTaglets", "(", "Element", "e", ")", "{", "switch", "(", "e", ".", "getKind", "(", ")", ")", "{", "case", "CONSTRUCTOR", ":", "return", "getConstructorCustomTaglets", "(", ")", ";", "case", "METHOD", ":", "r...
Returns the custom tags for a given element. @param e the element to get custom tags for @return the array of <code>Taglet</code>s that can appear in the given element.
[ "Returns", "the", "custom", "tags", "for", "a", "given", "element", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/taglets/TagletManager.java#L581-L604
Impetus/Kundera
src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBSchemaManager.java
CouchDBSchemaManager.dropDatabase
private void dropDatabase() throws IOException, ClientProtocolException, URISyntaxException { """ Drop database. @throws IOException Signals that an I/O exception has occurred. @throws ClientProtocolException the client protocol exception @throws URISyntaxException the URI syntax exception """ HttpResponse delRes = null; try { URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(), CouchDBConstants.URL_SEPARATOR + databaseName.toLowerCase(), null, null); HttpDelete delete = new HttpDelete(uri); delRes = httpClient.execute(httpHost, delete, CouchDBUtils.getContext(httpHost)); } finally { CouchDBUtils.closeContent(delRes); } }
java
private void dropDatabase() throws IOException, ClientProtocolException, URISyntaxException { HttpResponse delRes = null; try { URI uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(), CouchDBConstants.URL_SEPARATOR + databaseName.toLowerCase(), null, null); HttpDelete delete = new HttpDelete(uri); delRes = httpClient.execute(httpHost, delete, CouchDBUtils.getContext(httpHost)); } finally { CouchDBUtils.closeContent(delRes); } }
[ "private", "void", "dropDatabase", "(", ")", "throws", "IOException", ",", "ClientProtocolException", ",", "URISyntaxException", "{", "HttpResponse", "delRes", "=", "null", ";", "try", "{", "URI", "uri", "=", "new", "URI", "(", "CouchDBConstants", ".", "PROTOCOL...
Drop database. @throws IOException Signals that an I/O exception has occurred. @throws ClientProtocolException the client protocol exception @throws URISyntaxException the URI syntax exception
[ "Drop", "database", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-couchdb/src/main/java/com/impetus/client/couchdb/CouchDBSchemaManager.java#L749-L763
spring-projects/spring-social-facebook
spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java
FqlResult.getObject
public <T> T getObject(String fieldName, FqlResultMapper<T> mapper) { """ Returns the value of the identified field as an object mapped by a given {@link FqlResultMapper}. @param fieldName the name of the field @param mapper an {@link FqlResultMapper} used to map the object date into a specific type. @param <T> the Java type to bind the Facebook object to @return the value of the field as an object of a type the same as the parameterized type of the given {@link FqlResultMapper}. @throws FqlException if the value of the field is not a nested object. """ if (!hasValue(fieldName)) { return null; } try { @SuppressWarnings("unchecked") Map<String, Object> value = (Map<String, Object>) resultMap.get(fieldName); return mapper.mapObject(new FqlResult(value)); } catch (ClassCastException e) { throw new FqlException("Field '" + fieldName +"' is not an object.", e); } }
java
public <T> T getObject(String fieldName, FqlResultMapper<T> mapper) { if (!hasValue(fieldName)) { return null; } try { @SuppressWarnings("unchecked") Map<String, Object> value = (Map<String, Object>) resultMap.get(fieldName); return mapper.mapObject(new FqlResult(value)); } catch (ClassCastException e) { throw new FqlException("Field '" + fieldName +"' is not an object.", e); } }
[ "public", "<", "T", ">", "T", "getObject", "(", "String", "fieldName", ",", "FqlResultMapper", "<", "T", ">", "mapper", ")", "{", "if", "(", "!", "hasValue", "(", "fieldName", ")", ")", "{", "return", "null", ";", "}", "try", "{", "@", "SuppressWarni...
Returns the value of the identified field as an object mapped by a given {@link FqlResultMapper}. @param fieldName the name of the field @param mapper an {@link FqlResultMapper} used to map the object date into a specific type. @param <T> the Java type to bind the Facebook object to @return the value of the field as an object of a type the same as the parameterized type of the given {@link FqlResultMapper}. @throws FqlException if the value of the field is not a nested object.
[ "Returns", "the", "value", "of", "the", "identified", "field", "as", "an", "object", "mapped", "by", "a", "given", "{" ]
train
https://github.com/spring-projects/spring-social-facebook/blob/ae2234d94367eaa3adbba251ec7790d5ba7ffa41/spring-social-facebook/src/main/java/org/springframework/social/facebook/api/FqlResult.java#L136-L147
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java
TmdbTV.getTVChanges
public ResultList<ChangeKeyItem> getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException { """ Get the changes for a specific TV show id. @param tvID @param startDate @param endDate @return @throws com.omertron.themoviedbapi.MovieDbException """ return getMediaChanges(tvID, startDate, endDate); }
java
public ResultList<ChangeKeyItem> getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException { return getMediaChanges(tvID, startDate, endDate); }
[ "public", "ResultList", "<", "ChangeKeyItem", ">", "getTVChanges", "(", "int", "tvID", ",", "String", "startDate", ",", "String", "endDate", ")", "throws", "MovieDbException", "{", "return", "getMediaChanges", "(", "tvID", ",", "startDate", ",", "endDate", ")", ...
Get the changes for a specific TV show id. @param tvID @param startDate @param endDate @return @throws com.omertron.themoviedbapi.MovieDbException
[ "Get", "the", "changes", "for", "a", "specific", "TV", "show", "id", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbTV.java#L148-L150
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
AbstractTreeWriter.addTree
protected void addTree(SortedSet<ClassDoc> list, String heading, HtmlTree div) { """ Add the heading for the tree depending upon tree type if it's a Class Tree or Interface tree. @param list List of classes which are at the most base level, all the other classes in this run will derive from these classes @param heading heading for the tree @param div the content tree to which the tree will be added """ if (!list.isEmpty()) { ClassDoc firstClassDoc = list.first(); Content headingContent = getResource(heading); Content sectionHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, headingContent); HtmlTree htmlTree; if (configuration.allowTag(HtmlTag.SECTION)) { htmlTree = HtmlTree.SECTION(sectionHeading); } else { div.addContent(sectionHeading); htmlTree = div; } addLevelInfo(!firstClassDoc.isInterface()? firstClassDoc : null, list, list == classtree.baseEnums(), htmlTree); if (configuration.allowTag(HtmlTag.SECTION)) { div.addContent(htmlTree); } } }
java
protected void addTree(SortedSet<ClassDoc> list, String heading, HtmlTree div) { if (!list.isEmpty()) { ClassDoc firstClassDoc = list.first(); Content headingContent = getResource(heading); Content sectionHeading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING, true, headingContent); HtmlTree htmlTree; if (configuration.allowTag(HtmlTag.SECTION)) { htmlTree = HtmlTree.SECTION(sectionHeading); } else { div.addContent(sectionHeading); htmlTree = div; } addLevelInfo(!firstClassDoc.isInterface()? firstClassDoc : null, list, list == classtree.baseEnums(), htmlTree); if (configuration.allowTag(HtmlTag.SECTION)) { div.addContent(htmlTree); } } }
[ "protected", "void", "addTree", "(", "SortedSet", "<", "ClassDoc", ">", "list", ",", "String", "heading", ",", "HtmlTree", "div", ")", "{", "if", "(", "!", "list", ".", "isEmpty", "(", ")", ")", "{", "ClassDoc", "firstClassDoc", "=", "list", ".", "firs...
Add the heading for the tree depending upon tree type if it's a Class Tree or Interface tree. @param list List of classes which are at the most base level, all the other classes in this run will derive from these classes @param heading heading for the tree @param div the content tree to which the tree will be added
[ "Add", "the", "heading", "for", "the", "tree", "depending", "upon", "tree", "type", "if", "it", "s", "a", "Class", "Tree", "or", "Interface", "tree", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java#L110-L129
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Dispatching.java
Dispatching.curry
public static <T> BooleanSupplier curry(Predicate<T> predicate, T value) { """ Partial application of the parameter to a predicate. @param <T> the predicate parameter type @param predicate the predicate to be curried @param value the value to be curried @return the curried proposition """ dbc.precondition(predicate != null, "cannot bind parameter of a null predicate"); return () -> predicate.test(value); }
java
public static <T> BooleanSupplier curry(Predicate<T> predicate, T value) { dbc.precondition(predicate != null, "cannot bind parameter of a null predicate"); return () -> predicate.test(value); }
[ "public", "static", "<", "T", ">", "BooleanSupplier", "curry", "(", "Predicate", "<", "T", ">", "predicate", ",", "T", "value", ")", "{", "dbc", ".", "precondition", "(", "predicate", "!=", "null", ",", "\"cannot bind parameter of a null predicate\"", ")", ";"...
Partial application of the parameter to a predicate. @param <T> the predicate parameter type @param predicate the predicate to be curried @param value the value to be curried @return the curried proposition
[ "Partial", "application", "of", "the", "parameter", "to", "a", "predicate", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Dispatching.java#L77-L80
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.leftShift
public static Appendable leftShift(Appendable self, Object value) throws IOException { """ Overloads the leftShift operator for Appendable to allow an object to be appended using Groovy's default representation for the object. @param self an Appendable @param value an Object whose default representation will be appended to the Appendable @return the Appendable on which this operation was invoked @throws IOException if an I/O error occurs. @since 2.1.0 """ InvokerHelper.append(self, value); return self; }
java
public static Appendable leftShift(Appendable self, Object value) throws IOException { InvokerHelper.append(self, value); return self; }
[ "public", "static", "Appendable", "leftShift", "(", "Appendable", "self", ",", "Object", "value", ")", "throws", "IOException", "{", "InvokerHelper", ".", "append", "(", "self", ",", "value", ")", ";", "return", "self", ";", "}" ]
Overloads the leftShift operator for Appendable to allow an object to be appended using Groovy's default representation for the object. @param self an Appendable @param value an Object whose default representation will be appended to the Appendable @return the Appendable on which this operation was invoked @throws IOException if an I/O error occurs. @since 2.1.0
[ "Overloads", "the", "leftShift", "operator", "for", "Appendable", "to", "allow", "an", "object", "to", "be", "appended", "using", "Groovy", "s", "default", "representation", "for", "the", "object", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L107-L110
optimatika/ojAlgo-finance
src/main/java/org/ojalgo/finance/FinanceUtils.java
FinanceUtils.toGrowthRateFromAnnualReturn
public static double toGrowthRateFromAnnualReturn(double annualReturn, CalendarDateUnit growthRateUnit) { """ GrowthRate = ln(1.0 + InterestRate) / GrowthRateUnitsPerYear @param annualReturn Annualised return (percentage per year) @param growthRateUnit A growth rate unit @return A growth rate per unit (day, week, month, year...) """ double tmpAnnualGrowthRate = PrimitiveMath.LOG1P.invoke(annualReturn); double tmpYearsPerGrowthRateUnit = CalendarDateUnit.YEAR.convert(growthRateUnit); return tmpAnnualGrowthRate * tmpYearsPerGrowthRateUnit; }
java
public static double toGrowthRateFromAnnualReturn(double annualReturn, CalendarDateUnit growthRateUnit) { double tmpAnnualGrowthRate = PrimitiveMath.LOG1P.invoke(annualReturn); double tmpYearsPerGrowthRateUnit = CalendarDateUnit.YEAR.convert(growthRateUnit); return tmpAnnualGrowthRate * tmpYearsPerGrowthRateUnit; }
[ "public", "static", "double", "toGrowthRateFromAnnualReturn", "(", "double", "annualReturn", ",", "CalendarDateUnit", "growthRateUnit", ")", "{", "double", "tmpAnnualGrowthRate", "=", "PrimitiveMath", ".", "LOG1P", ".", "invoke", "(", "annualReturn", ")", ";", "double...
GrowthRate = ln(1.0 + InterestRate) / GrowthRateUnitsPerYear @param annualReturn Annualised return (percentage per year) @param growthRateUnit A growth rate unit @return A growth rate per unit (day, week, month, year...)
[ "GrowthRate", "=", "ln", "(", "1", ".", "0", "+", "InterestRate", ")", "/", "GrowthRateUnitsPerYear" ]
train
https://github.com/optimatika/ojAlgo-finance/blob/c8d3f7e1894d4263b7334bca3f4c060e466f8b15/src/main/java/org/ojalgo/finance/FinanceUtils.java#L457-L461
OpenLiberty/open-liberty
dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/utils/FatStringUtils.java
FatStringUtils.extractRegexGroup
public static String extractRegexGroup(String fromContent, String regex) throws Exception { """ Extracts the first matching group in the provided content, if the regex includes at least one group. An exception is thrown if the regex does not include a group, or if a matching group cannot be found in the content. """ return extractRegexGroup(fromContent, regex, 1); }
java
public static String extractRegexGroup(String fromContent, String regex) throws Exception { return extractRegexGroup(fromContent, regex, 1); }
[ "public", "static", "String", "extractRegexGroup", "(", "String", "fromContent", ",", "String", "regex", ")", "throws", "Exception", "{", "return", "extractRegexGroup", "(", "fromContent", ",", "regex", ",", "1", ")", ";", "}" ]
Extracts the first matching group in the provided content, if the regex includes at least one group. An exception is thrown if the regex does not include a group, or if a matching group cannot be found in the content.
[ "Extracts", "the", "first", "matching", "group", "in", "the", "provided", "content", "if", "the", "regex", "includes", "at", "least", "one", "group", ".", "An", "exception", "is", "thrown", "if", "the", "regex", "does", "not", "include", "a", "group", "or"...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.fat.common/src/com/ibm/ws/security/fat/common/utils/FatStringUtils.java#L22-L24
threerings/nenya
core/src/main/java/com/threerings/media/image/TransformedMirage.java
TransformedMirage.computeTransformedBounds
protected void computeTransformedBounds () { """ Compute the bounds of the base Mirage after it has been transformed. """ int w = _base.getWidth(); int h = _base.getHeight(); Point[] points = new Point[] { new Point(0, 0), new Point(w, 0), new Point(0, h), new Point(w, h) }; _transform.transform(points, 0, points, 0, 4); int minX, minY, maxX, maxY; minX = minY = Integer.MAX_VALUE; maxX = maxY = Integer.MIN_VALUE; for (int ii=0; ii < 4; ii++) { minX = Math.min(minX, points[ii].x); maxX = Math.max(maxX, points[ii].x); minY = Math.min(minY, points[ii].y); maxY = Math.max(maxY, points[ii].y); } _bounds = new Rectangle(minX, minY, maxX - minX, maxY - minY); }
java
protected void computeTransformedBounds () { int w = _base.getWidth(); int h = _base.getHeight(); Point[] points = new Point[] { new Point(0, 0), new Point(w, 0), new Point(0, h), new Point(w, h) }; _transform.transform(points, 0, points, 0, 4); int minX, minY, maxX, maxY; minX = minY = Integer.MAX_VALUE; maxX = maxY = Integer.MIN_VALUE; for (int ii=0; ii < 4; ii++) { minX = Math.min(minX, points[ii].x); maxX = Math.max(maxX, points[ii].x); minY = Math.min(minY, points[ii].y); maxY = Math.max(maxY, points[ii].y); } _bounds = new Rectangle(minX, minY, maxX - minX, maxY - minY); }
[ "protected", "void", "computeTransformedBounds", "(", ")", "{", "int", "w", "=", "_base", ".", "getWidth", "(", ")", ";", "int", "h", "=", "_base", ".", "getHeight", "(", ")", ";", "Point", "[", "]", "points", "=", "new", "Point", "[", "]", "{", "n...
Compute the bounds of the base Mirage after it has been transformed.
[ "Compute", "the", "bounds", "of", "the", "base", "Mirage", "after", "it", "has", "been", "transformed", "." ]
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/image/TransformedMirage.java#L122-L140
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java
PublicIPAddressesInner.updateTagsAsync
public Observable<PublicIPAddressInner> updateTagsAsync(String resourceGroupName, String publicIpAddressName) { """ Updates public IP address tags. @param resourceGroupName The name of the resource group. @param publicIpAddressName The name of the public IP address. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpAddressName).map(new Func1<ServiceResponse<PublicIPAddressInner>, PublicIPAddressInner>() { @Override public PublicIPAddressInner call(ServiceResponse<PublicIPAddressInner> response) { return response.body(); } }); }
java
public Observable<PublicIPAddressInner> updateTagsAsync(String resourceGroupName, String publicIpAddressName) { return updateTagsWithServiceResponseAsync(resourceGroupName, publicIpAddressName).map(new Func1<ServiceResponse<PublicIPAddressInner>, PublicIPAddressInner>() { @Override public PublicIPAddressInner call(ServiceResponse<PublicIPAddressInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PublicIPAddressInner", ">", "updateTagsAsync", "(", "String", "resourceGroupName", ",", "String", "publicIpAddressName", ")", "{", "return", "updateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "publicIpAddressName", ")", ".", ...
Updates public IP address tags. @param resourceGroupName The name of the resource group. @param publicIpAddressName The name of the public IP address. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "public", "IP", "address", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java#L656-L663
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscalepolicy.java
autoscalepolicy.get
public static autoscalepolicy get(nitro_service service, String name) throws Exception { """ Use this API to fetch autoscalepolicy resource of given name . """ autoscalepolicy obj = new autoscalepolicy(); obj.set_name(name); autoscalepolicy response = (autoscalepolicy) obj.get_resource(service); return response; }
java
public static autoscalepolicy get(nitro_service service, String name) throws Exception{ autoscalepolicy obj = new autoscalepolicy(); obj.set_name(name); autoscalepolicy response = (autoscalepolicy) obj.get_resource(service); return response; }
[ "public", "static", "autoscalepolicy", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "autoscalepolicy", "obj", "=", "new", "autoscalepolicy", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "aut...
Use this API to fetch autoscalepolicy resource of given name .
[ "Use", "this", "API", "to", "fetch", "autoscalepolicy", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/autoscale/autoscalepolicy.java#L443-L448
ops4j/org.ops4j.pax.logging
pax-logging-service/src/main/java/org/apache/log4j/Category.java
Category.l7dlog
public void l7dlog(Priority priority, String key, Throwable t) { """ Log a localized message. The user supplied parameter <code>key</code> is replaced by its localized version from the resource bundle. @see #setResourceBundle @since 0.8.4 """ if (repository.isDisabled(priority.level)) { return; } if (priority.isGreaterOrEqual(this.getEffectiveLevel())) { String msg = getResourceBundleString(key); // if message corresponding to 'key' could not be found in the // resource bundle, then default to 'key'. if (msg == null) { msg = key; } forcedLog(FQCN, priority, msg, t); } }
java
public void l7dlog(Priority priority, String key, Throwable t) { if (repository.isDisabled(priority.level)) { return; } if (priority.isGreaterOrEqual(this.getEffectiveLevel())) { String msg = getResourceBundleString(key); // if message corresponding to 'key' could not be found in the // resource bundle, then default to 'key'. if (msg == null) { msg = key; } forcedLog(FQCN, priority, msg, t); } }
[ "public", "void", "l7dlog", "(", "Priority", "priority", ",", "String", "key", ",", "Throwable", "t", ")", "{", "if", "(", "repository", ".", "isDisabled", "(", "priority", ".", "level", ")", ")", "{", "return", ";", "}", "if", "(", "priority", ".", ...
Log a localized message. The user supplied parameter <code>key</code> is replaced by its localized version from the resource bundle. @see #setResourceBundle @since 0.8.4
[ "Log", "a", "localized", "message", ".", "The", "user", "supplied", "parameter", "<code", ">", "key<", "/", "code", ">", "is", "replaced", "by", "its", "localized", "version", "from", "the", "resource", "bundle", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-service/src/main/java/org/apache/log4j/Category.java#L652-L665
Alluxio/alluxio
core/server/master/src/main/java/alluxio/master/file/meta/InodeLockList.java
InodeLockList.lockRootEdge
public void lockRootEdge(LockMode mode) { """ Locks the root edge in the specified mode. @param mode the mode to lock in """ Preconditions.checkState(mEntries.isEmpty()); mEntries.add(new EdgeEntry(mInodeLockManager.lockEdge(ROOT_EDGE, mode), ROOT_EDGE)); mLockMode = mode; }
java
public void lockRootEdge(LockMode mode) { Preconditions.checkState(mEntries.isEmpty()); mEntries.add(new EdgeEntry(mInodeLockManager.lockEdge(ROOT_EDGE, mode), ROOT_EDGE)); mLockMode = mode; }
[ "public", "void", "lockRootEdge", "(", "LockMode", "mode", ")", "{", "Preconditions", ".", "checkState", "(", "mEntries", ".", "isEmpty", "(", ")", ")", ";", "mEntries", ".", "add", "(", "new", "EdgeEntry", "(", "mInodeLockManager", ".", "lockEdge", "(", "...
Locks the root edge in the specified mode. @param mode the mode to lock in
[ "Locks", "the", "root", "edge", "in", "the", "specified", "mode", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/server/master/src/main/java/alluxio/master/file/meta/InodeLockList.java#L137-L142
alkacon/opencms-core
src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java
CmsXMLSearchConfigurationParser.parseSortOption
private I_CmsSearchConfigurationSortOption parseSortOption(final String pathPrefix) { """ Returns the configuration of a single sort option, or <code>null</code> if the XML cannot be read. @param pathPrefix The XML path to the root node of the sort option's configuration. @return The configuration of a single sort option, or <code>null</code> if the XML cannot be read. """ try { final String solrValue = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_SORTOPTION_SOLRVALUE); String paramValue = parseOptionalStringValue(pathPrefix + XML_ELEMENT_SORTOPTION_PARAMVALUE); paramValue = (paramValue == null) ? solrValue : paramValue; String label = parseOptionalStringValue(pathPrefix + XML_ELEMENT_SORTOPTION_LABEL); label = (label == null) ? paramValue : label; return new CmsSearchConfigurationSortOption(label, paramValue, solrValue); } catch (final Exception e) { LOG.error( Messages.get().getBundle().key( Messages.ERR_SORT_OPTION_NOT_PARSABLE_1, XML_ELEMENT_SORTOPTION_SOLRVALUE), e); return null; } }
java
private I_CmsSearchConfigurationSortOption parseSortOption(final String pathPrefix) { try { final String solrValue = parseMandatoryStringValue(pathPrefix + XML_ELEMENT_SORTOPTION_SOLRVALUE); String paramValue = parseOptionalStringValue(pathPrefix + XML_ELEMENT_SORTOPTION_PARAMVALUE); paramValue = (paramValue == null) ? solrValue : paramValue; String label = parseOptionalStringValue(pathPrefix + XML_ELEMENT_SORTOPTION_LABEL); label = (label == null) ? paramValue : label; return new CmsSearchConfigurationSortOption(label, paramValue, solrValue); } catch (final Exception e) { LOG.error( Messages.get().getBundle().key( Messages.ERR_SORT_OPTION_NOT_PARSABLE_1, XML_ELEMENT_SORTOPTION_SOLRVALUE), e); return null; } }
[ "private", "I_CmsSearchConfigurationSortOption", "parseSortOption", "(", "final", "String", "pathPrefix", ")", "{", "try", "{", "final", "String", "solrValue", "=", "parseMandatoryStringValue", "(", "pathPrefix", "+", "XML_ELEMENT_SORTOPTION_SOLRVALUE", ")", ";", "String"...
Returns the configuration of a single sort option, or <code>null</code> if the XML cannot be read. @param pathPrefix The XML path to the root node of the sort option's configuration. @return The configuration of a single sort option, or <code>null</code> if the XML cannot be read.
[ "Returns", "the", "configuration", "of", "a", "single", "sort", "option", "or", "<code", ">", "null<", "/", "code", ">", "if", "the", "XML", "cannot", "be", "read", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/search/config/parser/CmsXMLSearchConfigurationParser.java#L855-L872
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.updateInstancesAsync
public Observable<OperationStatusResponseInner> updateInstancesAsync(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) { """ Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceIds The virtual machine scale set instance ids. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request """ return updateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
java
public Observable<OperationStatusResponseInner> updateInstancesAsync(String resourceGroupName, String vmScaleSetName, List<String> instanceIds) { return updateInstancesWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceIds).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() { @Override public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "OperationStatusResponseInner", ">", "updateInstancesAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "List", "<", "String", ">", "instanceIds", ")", "{", "return", "updateInstancesWithServiceResponseAsync", "(...
Upgrades one or more virtual machines to the latest SKU set in the VM scale set model. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceIds The virtual machine scale set instance ids. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Upgrades", "one", "or", "more", "virtual", "machines", "to", "the", "latest", "SKU", "set", "in", "the", "VM", "scale", "set", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L2741-L2748
mcaserta/spring-crypto-utils
src/main/java/com/springcryptoutils/core/certificate/CertificateRegistryByAliasImpl.java
CertificateRegistryByAliasImpl.get
public Certificate get(KeyStoreChooser keyStoreChooser, CertificateChooserByAlias certificateChooserByAlias) { """ Returns the selected certificate or null if not found. @param keyStoreChooser the keystore chooser @param certificateChooserByAlias the certificate chooser by alias @return the selected certificate or null if not found """ CacheCert cacheCert = new CacheCert(keyStoreChooser.getKeyStoreName(), certificateChooserByAlias.getAlias()); Certificate retrievedCertificate = cache.get(cacheCert); if (retrievedCertificate != null) { return retrievedCertificate; } KeyStore keyStore = keyStoreRegistry.get(keyStoreChooser); if (keyStore != null) { CertificateFactoryBean factory = new CertificateFactoryBean(); factory.setKeystore(keyStore); factory.setAlias(certificateChooserByAlias.getAlias()); try { factory.afterPropertiesSet(); Certificate certificate = (Certificate) factory.getObject(); if (certificate != null) { cache.put(cacheCert, certificate); } return certificate; } catch (Exception e) { throw new CertificateException("error initializing the certificate factory bean", e); } } return null; }
java
public Certificate get(KeyStoreChooser keyStoreChooser, CertificateChooserByAlias certificateChooserByAlias) { CacheCert cacheCert = new CacheCert(keyStoreChooser.getKeyStoreName(), certificateChooserByAlias.getAlias()); Certificate retrievedCertificate = cache.get(cacheCert); if (retrievedCertificate != null) { return retrievedCertificate; } KeyStore keyStore = keyStoreRegistry.get(keyStoreChooser); if (keyStore != null) { CertificateFactoryBean factory = new CertificateFactoryBean(); factory.setKeystore(keyStore); factory.setAlias(certificateChooserByAlias.getAlias()); try { factory.afterPropertiesSet(); Certificate certificate = (Certificate) factory.getObject(); if (certificate != null) { cache.put(cacheCert, certificate); } return certificate; } catch (Exception e) { throw new CertificateException("error initializing the certificate factory bean", e); } } return null; }
[ "public", "Certificate", "get", "(", "KeyStoreChooser", "keyStoreChooser", ",", "CertificateChooserByAlias", "certificateChooserByAlias", ")", "{", "CacheCert", "cacheCert", "=", "new", "CacheCert", "(", "keyStoreChooser", ".", "getKeyStoreName", "(", ")", ",", "certifi...
Returns the selected certificate or null if not found. @param keyStoreChooser the keystore chooser @param certificateChooserByAlias the certificate chooser by alias @return the selected certificate or null if not found
[ "Returns", "the", "selected", "certificate", "or", "null", "if", "not", "found", "." ]
train
https://github.com/mcaserta/spring-crypto-utils/blob/1dbf6211542fb1e3f9297941d691e7e89cc72c46/src/main/java/com/springcryptoutils/core/certificate/CertificateRegistryByAliasImpl.java#L50-L78
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/QuickSelect.java
QuickSelect.select
public static double select(final double[] arr, int lo, int hi, final int pivot) { """ Gets the 0-based kth order statistic from the array. Warning! This changes the ordering of elements in the given array! @param arr The array to be re-arranged. @param lo The lowest 0-based index to be considered. @param hi The highest 0-based index to be considered. @param pivot The 0-based smallest value to pivot on. @return The value of the smallest (n)th element where n is 0-based. """ while (hi > lo) { final int j = partition(arr, lo, hi); if (j == pivot) { return arr[pivot]; } if (j > pivot) { hi = j - 1; } else { lo = j + 1; } } return arr[pivot]; }
java
public static double select(final double[] arr, int lo, int hi, final int pivot) { while (hi > lo) { final int j = partition(arr, lo, hi); if (j == pivot) { return arr[pivot]; } if (j > pivot) { hi = j - 1; } else { lo = j + 1; } } return arr[pivot]; }
[ "public", "static", "double", "select", "(", "final", "double", "[", "]", "arr", ",", "int", "lo", ",", "int", "hi", ",", "final", "int", "pivot", ")", "{", "while", "(", "hi", ">", "lo", ")", "{", "final", "int", "j", "=", "partition", "(", "arr...
Gets the 0-based kth order statistic from the array. Warning! This changes the ordering of elements in the given array! @param arr The array to be re-arranged. @param lo The lowest 0-based index to be considered. @param hi The highest 0-based index to be considered. @param pivot The 0-based smallest value to pivot on. @return The value of the smallest (n)th element where n is 0-based.
[ "Gets", "the", "0", "-", "based", "kth", "order", "statistic", "from", "the", "array", ".", "Warning!", "This", "changes", "the", "ordering", "of", "elements", "in", "the", "given", "array!" ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/QuickSelect.java#L136-L150
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.decomposeMetricCamera
public static void decomposeMetricCamera(DMatrixRMaj cameraMatrix, DMatrixRMaj K, Se3_F64 worldToView) { """ <p> Decomposes a metric camera matrix P=K*[R|T], where A is an upper triangular camera calibration matrix, R is a rotation matrix, and T is a translation vector. <ul> <li> NOTE: There are multiple valid solutions to this problem and only one solution is returned. <li> NOTE: The camera center will be on the plane at infinity. </ul> </p> @param cameraMatrix Input: Camera matrix, 3 by 4 @param K Output: Camera calibration matrix, 3 by 3. @param worldToView Output: The rotation and translation. """ DMatrixRMaj A = new DMatrixRMaj(3,3); CommonOps_DDRM.extract(cameraMatrix, 0, 3, 0, 3, A, 0, 0); worldToView.T.set(cameraMatrix.get(0,3),cameraMatrix.get(1,3),cameraMatrix.get(2,3)); QRDecomposition<DMatrixRMaj> qr = DecompositionFactory_DDRM.qr(3, 3); // Need to do an RQ decomposition, but we only have QR // by permuting the rows in KR we can get the desired result DMatrixRMaj Pv = SpecializedOps_DDRM.pivotMatrix(null,new int[]{2,1,0},3,false); DMatrixRMaj A_p = new DMatrixRMaj(3,3); CommonOps_DDRM.mult(Pv,A,A_p); CommonOps_DDRM.transpose(A_p); if( !qr.decompose(A_p) ) throw new RuntimeException("QR decomposition failed! Bad input?"); // extract the rotation qr.getQ(A,false); CommonOps_DDRM.multTransB(Pv,A,worldToView.R); // extract the calibration matrix qr.getR(K,false); CommonOps_DDRM.multTransB(Pv,K,A); CommonOps_DDRM.mult(A,Pv,K); // there are four solutions, massage it so that it's the correct one. // each of these row/column negations produces the same camera matrix for (int i = 0; i < 3; i++) { if( K.get(i,i) < 0) { CommonOps_DDRM.scaleCol(-1,K,i); CommonOps_DDRM.scaleRow(-1,worldToView.R,i); } } // rotation matrices have det() == 1 if( CommonOps_DDRM.det(worldToView.R) < 0 ) { CommonOps_DDRM.scale(-1,worldToView.R); worldToView.T.scale(-1); } // make sure it's a proper camera matrix CommonOps_DDRM.divide(K,K.get(2,2)); // could do a very fast triangule inverse. EJML doesn't have one for upper triangle, yet. if( !CommonOps_DDRM.invert(K,A) ) throw new RuntimeException("Inverse failed! Bad input?"); GeometryMath_F64.mult(A, worldToView.T, worldToView.T); }
java
public static void decomposeMetricCamera(DMatrixRMaj cameraMatrix, DMatrixRMaj K, Se3_F64 worldToView) { DMatrixRMaj A = new DMatrixRMaj(3,3); CommonOps_DDRM.extract(cameraMatrix, 0, 3, 0, 3, A, 0, 0); worldToView.T.set(cameraMatrix.get(0,3),cameraMatrix.get(1,3),cameraMatrix.get(2,3)); QRDecomposition<DMatrixRMaj> qr = DecompositionFactory_DDRM.qr(3, 3); // Need to do an RQ decomposition, but we only have QR // by permuting the rows in KR we can get the desired result DMatrixRMaj Pv = SpecializedOps_DDRM.pivotMatrix(null,new int[]{2,1,0},3,false); DMatrixRMaj A_p = new DMatrixRMaj(3,3); CommonOps_DDRM.mult(Pv,A,A_p); CommonOps_DDRM.transpose(A_p); if( !qr.decompose(A_p) ) throw new RuntimeException("QR decomposition failed! Bad input?"); // extract the rotation qr.getQ(A,false); CommonOps_DDRM.multTransB(Pv,A,worldToView.R); // extract the calibration matrix qr.getR(K,false); CommonOps_DDRM.multTransB(Pv,K,A); CommonOps_DDRM.mult(A,Pv,K); // there are four solutions, massage it so that it's the correct one. // each of these row/column negations produces the same camera matrix for (int i = 0; i < 3; i++) { if( K.get(i,i) < 0) { CommonOps_DDRM.scaleCol(-1,K,i); CommonOps_DDRM.scaleRow(-1,worldToView.R,i); } } // rotation matrices have det() == 1 if( CommonOps_DDRM.det(worldToView.R) < 0 ) { CommonOps_DDRM.scale(-1,worldToView.R); worldToView.T.scale(-1); } // make sure it's a proper camera matrix CommonOps_DDRM.divide(K,K.get(2,2)); // could do a very fast triangule inverse. EJML doesn't have one for upper triangle, yet. if( !CommonOps_DDRM.invert(K,A) ) throw new RuntimeException("Inverse failed! Bad input?"); GeometryMath_F64.mult(A, worldToView.T, worldToView.T); }
[ "public", "static", "void", "decomposeMetricCamera", "(", "DMatrixRMaj", "cameraMatrix", ",", "DMatrixRMaj", "K", ",", "Se3_F64", "worldToView", ")", "{", "DMatrixRMaj", "A", "=", "new", "DMatrixRMaj", "(", "3", ",", "3", ")", ";", "CommonOps_DDRM", ".", "extr...
<p> Decomposes a metric camera matrix P=K*[R|T], where A is an upper triangular camera calibration matrix, R is a rotation matrix, and T is a translation vector. <ul> <li> NOTE: There are multiple valid solutions to this problem and only one solution is returned. <li> NOTE: The camera center will be on the plane at infinity. </ul> </p> @param cameraMatrix Input: Camera matrix, 3 by 4 @param K Output: Camera calibration matrix, 3 by 3. @param worldToView Output: The rotation and translation.
[ "<p", ">", "Decomposes", "a", "metric", "camera", "matrix", "P", "=", "K", "*", "[", "R|T", "]", "where", "A", "is", "an", "upper", "triangular", "camera", "calibration", "matrix", "R", "is", "a", "rotation", "matrix", "and", "T", "is", "a", "translati...
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L1073-L1121
kaazing/gateway
resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java
URIUtils.buildURIAsString
public static String buildURIAsString(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { """ Helper method for building URI as String @param scheme @param userInfo @param host @param port @param path @param query @param fragment @return @throws URISyntaxException """ URI helperURI; try { helperURI = new URI(scheme, userInfo, host, port, path, query, fragment); } catch (URISyntaxException e) { return NetworkInterfaceURI.buildURIToString(scheme, userInfo, host, port, path, query, fragment); } return helperURI.toString(); }
java
public static String buildURIAsString(String scheme, String userInfo, String host, int port, String path, String query, String fragment) throws URISyntaxException { URI helperURI; try { helperURI = new URI(scheme, userInfo, host, port, path, query, fragment); } catch (URISyntaxException e) { return NetworkInterfaceURI.buildURIToString(scheme, userInfo, host, port, path, query, fragment); } return helperURI.toString(); }
[ "public", "static", "String", "buildURIAsString", "(", "String", "scheme", ",", "String", "userInfo", ",", "String", "host", ",", "int", "port", ",", "String", "path", ",", "String", "query", ",", "String", "fragment", ")", "throws", "URISyntaxException", "{",...
Helper method for building URI as String @param scheme @param userInfo @param host @param port @param path @param query @param fragment @return @throws URISyntaxException
[ "Helper", "method", "for", "building", "URI", "as", "String" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/resource.address/spi/src/main/java/org/kaazing/gateway/resource/address/uri/URIUtils.java#L245-L254
Ellzord/JALSE
src/main/java/jalse/entities/Entities.java
Entities.walkEntities
public static Stream<Entity> walkEntities(final EntityContainer container, final int maxDepth) { """ A lazy-walked stream of entities (recursive and breadth-first). The entire stream will not be loaded until it is iterated through. @param container Entity container. @param maxDepth Maximum depth of the walk. @return Lazy-walked recursive stream of entities. """ final EntityTreeWalker walker = new EntityTreeWalker(container, maxDepth, e -> EntityVisitResult.CONTINUE); final Iterator<Entity> iterator = new Iterator<Entity>() { @Override public boolean hasNext() { return walker.isWalking(); } @Override public Entity next() { return walker.walk(); } }; final int characteristics = Spliterator.CONCURRENT | Spliterator.NONNULL | Spliterator.DISTINCT; return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, characteristics), false); }
java
public static Stream<Entity> walkEntities(final EntityContainer container, final int maxDepth) { final EntityTreeWalker walker = new EntityTreeWalker(container, maxDepth, e -> EntityVisitResult.CONTINUE); final Iterator<Entity> iterator = new Iterator<Entity>() { @Override public boolean hasNext() { return walker.isWalking(); } @Override public Entity next() { return walker.walk(); } }; final int characteristics = Spliterator.CONCURRENT | Spliterator.NONNULL | Spliterator.DISTINCT; return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator, characteristics), false); }
[ "public", "static", "Stream", "<", "Entity", ">", "walkEntities", "(", "final", "EntityContainer", "container", ",", "final", "int", "maxDepth", ")", "{", "final", "EntityTreeWalker", "walker", "=", "new", "EntityTreeWalker", "(", "container", ",", "maxDepth", "...
A lazy-walked stream of entities (recursive and breadth-first). The entire stream will not be loaded until it is iterated through. @param container Entity container. @param maxDepth Maximum depth of the walk. @return Lazy-walked recursive stream of entities.
[ "A", "lazy", "-", "walked", "stream", "of", "entities", "(", "recursive", "and", "breadth", "-", "first", ")", ".", "The", "entire", "stream", "will", "not", "be", "loaded", "until", "it", "is", "iterated", "through", "." ]
train
https://github.com/Ellzord/JALSE/blob/43fc6572de9b16eb8474aa21a88b6b2d11291615/src/main/java/jalse/entities/Entities.java#L470-L487
Impetus/Kundera
src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java
MongoDBClient.executeQuery
public List executeQuery(String jsonClause, EntityMetadata entityMetadata) { """ Execute query. @param jsonClause the json clause @param entityMetadata the entity metadata @return the list """ List entities = new ArrayList(); try { DBCursor cursor = parseAndScroll(jsonClause, entityMetadata.getTableName()); while (cursor.hasNext()) { DBObject fetchedDocument = cursor.next(); populateEntity(entityMetadata, entities, fetchedDocument); } return entities; } catch (JSONParseException jex) { entities = executeNativeQuery(jsonClause, entityMetadata); List result = new ArrayList(); if (entities.size() > 0 && (entities.get(0) instanceof EnhanceEntity)) { for (Object obj : entities) { result.add(((EnhanceEntity) obj).getEntity()); } return result; } return entities; } }
java
public List executeQuery(String jsonClause, EntityMetadata entityMetadata) { List entities = new ArrayList(); try { DBCursor cursor = parseAndScroll(jsonClause, entityMetadata.getTableName()); while (cursor.hasNext()) { DBObject fetchedDocument = cursor.next(); populateEntity(entityMetadata, entities, fetchedDocument); } return entities; } catch (JSONParseException jex) { entities = executeNativeQuery(jsonClause, entityMetadata); List result = new ArrayList(); if (entities.size() > 0 && (entities.get(0) instanceof EnhanceEntity)) { for (Object obj : entities) { result.add(((EnhanceEntity) obj).getEntity()); } return result; } return entities; } }
[ "public", "List", "executeQuery", "(", "String", "jsonClause", ",", "EntityMetadata", "entityMetadata", ")", "{", "List", "entities", "=", "new", "ArrayList", "(", ")", ";", "try", "{", "DBCursor", "cursor", "=", "parseAndScroll", "(", "jsonClause", ",", "enti...
Execute query. @param jsonClause the json clause @param entityMetadata the entity metadata @return the list
[ "Execute", "query", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/MongoDBClient.java#L1628-L1658
alkacon/opencms-core
src/org/opencms/xml/A_CmsXmlDocument.java
A_CmsXmlDocument.getBookmark
protected I_CmsXmlContentValue getBookmark(String path, Locale locale) { """ Returns the bookmarked value for the given name.<p> @param path the lookup path to use for the bookmark @param locale the locale to get the bookmark for @return the bookmarked value """ return m_bookmarks.get(getBookmarkName(path, locale)); }
java
protected I_CmsXmlContentValue getBookmark(String path, Locale locale) { return m_bookmarks.get(getBookmarkName(path, locale)); }
[ "protected", "I_CmsXmlContentValue", "getBookmark", "(", "String", "path", ",", "Locale", "locale", ")", "{", "return", "m_bookmarks", ".", "get", "(", "getBookmarkName", "(", "path", ",", "locale", ")", ")", ";", "}" ]
Returns the bookmarked value for the given name.<p> @param path the lookup path to use for the bookmark @param locale the locale to get the bookmark for @return the bookmarked value
[ "Returns", "the", "bookmarked", "value", "for", "the", "given", "name", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/A_CmsXmlDocument.java#L804-L807
opensourceBIM/BIMserver
PluginBase/src/org/bimserver/shared/GuidCompressor.java
GuidCompressor.getGuidFromCompressedString
public static boolean getGuidFromCompressedString(String string, Guid guid) throws InvalidGuidException { """ Reconstructs a Guid-object form an compressed String representation of a GUID @param string compressed String representation of a GUID, 22 character long @param guid contains the reconstructed Guid as a result of this method @return true if no error occurred """ char[][] str = new char[6][5]; int len, i, j, m; long[][] num = new long[6][1]; len = string.length(); if (len != 22) throw new InvalidGuidException(string, "Length must be 22 (is: " + string.length() + ")"); j = 0; m = 2; for (i = 0; i < 6; i++) { for(int k = 0; k<m; k++){ str[i][k] = string.charAt(j+k); } str[i][m]= '\0'; j = j + m; m = 4; } for (i = 0; i < 6; i++) { if (!cv_from_64 (num[i], str[i])) { throw new InvalidGuidException(string); } } guid.Data1= (long) (num[0][0] * 16777216 + num[1][0]); // 16-13. bytes guid.Data2= (int) (num[2][0] / 256); // 12-11. bytes guid.Data3= (int) ((num[2][0] % 256) * 256 + num[3][0] / 65536); // 10-09. bytes guid.Data4[0] = (char) ((num[3][0] / 256) % 256); // 08. byte guid.Data4[1] = (char) (num[3][0] % 256); // 07. byte guid.Data4[2] = (char) (num[4][0] / 65536); // 06. byte guid.Data4[3] = (char) ((num[4][0] / 256) % 256); // 05. byte guid.Data4[4] = (char) (num[4][0] % 256); // 04. byte guid.Data4[5] = (char) (num[5][0] / 65536); // 03. byte guid.Data4[6] = (char) ((num[5][0] / 256) % 256); // 02. byte guid.Data4[7] = (char) (num[5][0] % 256); // 01. byte return true; }
java
public static boolean getGuidFromCompressedString(String string, Guid guid) throws InvalidGuidException { char[][] str = new char[6][5]; int len, i, j, m; long[][] num = new long[6][1]; len = string.length(); if (len != 22) throw new InvalidGuidException(string, "Length must be 22 (is: " + string.length() + ")"); j = 0; m = 2; for (i = 0; i < 6; i++) { for(int k = 0; k<m; k++){ str[i][k] = string.charAt(j+k); } str[i][m]= '\0'; j = j + m; m = 4; } for (i = 0; i < 6; i++) { if (!cv_from_64 (num[i], str[i])) { throw new InvalidGuidException(string); } } guid.Data1= (long) (num[0][0] * 16777216 + num[1][0]); // 16-13. bytes guid.Data2= (int) (num[2][0] / 256); // 12-11. bytes guid.Data3= (int) ((num[2][0] % 256) * 256 + num[3][0] / 65536); // 10-09. bytes guid.Data4[0] = (char) ((num[3][0] / 256) % 256); // 08. byte guid.Data4[1] = (char) (num[3][0] % 256); // 07. byte guid.Data4[2] = (char) (num[4][0] / 65536); // 06. byte guid.Data4[3] = (char) ((num[4][0] / 256) % 256); // 05. byte guid.Data4[4] = (char) (num[4][0] % 256); // 04. byte guid.Data4[5] = (char) (num[5][0] / 65536); // 03. byte guid.Data4[6] = (char) ((num[5][0] / 256) % 256); // 02. byte guid.Data4[7] = (char) (num[5][0] % 256); // 01. byte return true; }
[ "public", "static", "boolean", "getGuidFromCompressedString", "(", "String", "string", ",", "Guid", "guid", ")", "throws", "InvalidGuidException", "{", "char", "[", "]", "[", "]", "str", "=", "new", "char", "[", "6", "]", "[", "5", "]", ";", "int", "len"...
Reconstructs a Guid-object form an compressed String representation of a GUID @param string compressed String representation of a GUID, 22 character long @param guid contains the reconstructed Guid as a result of this method @return true if no error occurred
[ "Reconstructs", "a", "Guid", "-", "object", "form", "an", "compressed", "String", "representation", "of", "a", "GUID" ]
train
https://github.com/opensourceBIM/BIMserver/blob/116803c3047d1b32217366757cee1bb3880fda63/PluginBase/src/org/bimserver/shared/GuidCompressor.java#L203-L244
dustin/java-memcached-client
src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java
OperationImpl.getStatusForErrorCode
protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl) throws IOException { """ Get the OperationStatus object for the given error code. @param errCode the error code @return the status to return, or null if this is an exceptional case """ if(errCode == SUCCESS) { return STATUS_OK; } else { StatusCode statusCode = StatusCode.fromBinaryCode(errCode); errorMsg = errPl.clone(); switch (errCode) { case ERR_NOT_FOUND: return new CASOperationStatus(false, new String(errPl), CASResponse.NOT_FOUND, statusCode); case ERR_EXISTS: return new CASOperationStatus(false, new String(errPl), CASResponse.EXISTS, statusCode); case ERR_NOT_STORED: return new CASOperationStatus(false, new String(errPl), CASResponse.NOT_FOUND, statusCode); case ERR_INTERNAL: handleError(OperationErrorType.SERVER, new String(errPl)); case ERR_2BIG: case ERR_INVAL: case ERR_DELTA_BADVAL: case ERR_NOT_MY_VBUCKET: case ERR_UNKNOWN_COMMAND: case ERR_NO_MEM: case ERR_NOT_SUPPORTED: case ERR_BUSY: case ERR_TEMP_FAIL: return new OperationStatus(false, new String(errPl), statusCode); default: return null; } } }
java
protected OperationStatus getStatusForErrorCode(int errCode, byte[] errPl) throws IOException { if(errCode == SUCCESS) { return STATUS_OK; } else { StatusCode statusCode = StatusCode.fromBinaryCode(errCode); errorMsg = errPl.clone(); switch (errCode) { case ERR_NOT_FOUND: return new CASOperationStatus(false, new String(errPl), CASResponse.NOT_FOUND, statusCode); case ERR_EXISTS: return new CASOperationStatus(false, new String(errPl), CASResponse.EXISTS, statusCode); case ERR_NOT_STORED: return new CASOperationStatus(false, new String(errPl), CASResponse.NOT_FOUND, statusCode); case ERR_INTERNAL: handleError(OperationErrorType.SERVER, new String(errPl)); case ERR_2BIG: case ERR_INVAL: case ERR_DELTA_BADVAL: case ERR_NOT_MY_VBUCKET: case ERR_UNKNOWN_COMMAND: case ERR_NO_MEM: case ERR_NOT_SUPPORTED: case ERR_BUSY: case ERR_TEMP_FAIL: return new OperationStatus(false, new String(errPl), statusCode); default: return null; } } }
[ "protected", "OperationStatus", "getStatusForErrorCode", "(", "int", "errCode", ",", "byte", "[", "]", "errPl", ")", "throws", "IOException", "{", "if", "(", "errCode", "==", "SUCCESS", ")", "{", "return", "STATUS_OK", ";", "}", "else", "{", "StatusCode", "s...
Get the OperationStatus object for the given error code. @param errCode the error code @return the status to return, or null if this is an exceptional case
[ "Get", "the", "OperationStatus", "object", "for", "the", "given", "error", "code", "." ]
train
https://github.com/dustin/java-memcached-client/blob/c232307ad8e0c7ccc926e495dd7d5aad2d713318/src/main/java/net/spy/memcached/protocol/binary/OperationImpl.java#L223-L258
graphhopper/graphhopper
core/src/main/java/com/graphhopper/storage/BaseGraph.java
BaseGraph.copyProperties
EdgeIteratorState copyProperties(EdgeIteratorState from, CommonEdgeIterator to) { """ This method copies the properties of one {@link EdgeIteratorState} to another. @return the updated iterator the properties where copied to. """ boolean reverse = from.get(REVERSE_STATE); if (to.reverse) reverse = !reverse; // in case reverse is true we have to swap the nodes to store flags correctly in its "storage direction" int nodeA = reverse ? from.getAdjNode() : from.getBaseNode(); int nodeB = reverse ? from.getBaseNode() : from.getAdjNode(); long edgePointer = edgeAccess.toPointer(to.getEdge()); int linkA = reverse ? edgeAccess.getLinkB(edgePointer) : edgeAccess.getLinkA(edgePointer); int linkB = reverse ? edgeAccess.getLinkA(edgePointer) : edgeAccess.getLinkB(edgePointer); edgeAccess.writeEdge(to.getEdge(), nodeA, nodeB, linkA, linkB); edgeAccess.writeFlags(edgePointer, from.getFlags()); // copy the rest with higher level API to.setDistance(from.getDistance()). setName(from.getName()). setWayGeometry(from.fetchWayGeometry(0)); if (E_ADDITIONAL >= 0) to.setAdditionalField(from.getAdditionalField()); return to; }
java
EdgeIteratorState copyProperties(EdgeIteratorState from, CommonEdgeIterator to) { boolean reverse = from.get(REVERSE_STATE); if (to.reverse) reverse = !reverse; // in case reverse is true we have to swap the nodes to store flags correctly in its "storage direction" int nodeA = reverse ? from.getAdjNode() : from.getBaseNode(); int nodeB = reverse ? from.getBaseNode() : from.getAdjNode(); long edgePointer = edgeAccess.toPointer(to.getEdge()); int linkA = reverse ? edgeAccess.getLinkB(edgePointer) : edgeAccess.getLinkA(edgePointer); int linkB = reverse ? edgeAccess.getLinkA(edgePointer) : edgeAccess.getLinkB(edgePointer); edgeAccess.writeEdge(to.getEdge(), nodeA, nodeB, linkA, linkB); edgeAccess.writeFlags(edgePointer, from.getFlags()); // copy the rest with higher level API to.setDistance(from.getDistance()). setName(from.getName()). setWayGeometry(from.fetchWayGeometry(0)); if (E_ADDITIONAL >= 0) to.setAdditionalField(from.getAdditionalField()); return to; }
[ "EdgeIteratorState", "copyProperties", "(", "EdgeIteratorState", "from", ",", "CommonEdgeIterator", "to", ")", "{", "boolean", "reverse", "=", "from", ".", "get", "(", "REVERSE_STATE", ")", ";", "if", "(", "to", ".", "reverse", ")", "reverse", "=", "!", "rev...
This method copies the properties of one {@link EdgeIteratorState} to another. @return the updated iterator the properties where copied to.
[ "This", "method", "copies", "the", "properties", "of", "one", "{", "@link", "EdgeIteratorState", "}", "to", "another", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/storage/BaseGraph.java#L475-L496
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java
PhotosApi.getFavorites
public Favorites getFavorites(String photoId, int page, int perPage) throws JinxException { """ Returns the list of people who have favorited a given photo. <br> This method does not require authentication. @param photoId Required. The id of the photo to fetch information for. @param page page of results to return. If this argument is zero, it defaults to 1. @param perPage number of people to return per page. If this argument is zero, it defaults to 10. The maximum allowed value is 50. @return object containing limited information about the photo, and a list of people who have favorited the photo. @throws JinxException if required parameters are null or empty, or if there are errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.getFavorites.html">flickr.photos.getFavorites</a> """ JinxUtils.validateParams(photoId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.getFavorites"); params.put("photo_id", photoId); if (page > 0) { params.put("page", Integer.toString(page)); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } return jinx.flickrGet(params, Favorites.class); }
java
public Favorites getFavorites(String photoId, int page, int perPage) throws JinxException { JinxUtils.validateParams(photoId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.getFavorites"); params.put("photo_id", photoId); if (page > 0) { params.put("page", Integer.toString(page)); } if (perPage > 0) { params.put("per_page", Integer.toString(perPage)); } return jinx.flickrGet(params, Favorites.class); }
[ "public", "Favorites", "getFavorites", "(", "String", "photoId", ",", "int", "page", ",", "int", "perPage", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photoId", ")", ";", "Map", "<", "String", ",", "String", ">", "params",...
Returns the list of people who have favorited a given photo. <br> This method does not require authentication. @param photoId Required. The id of the photo to fetch information for. @param page page of results to return. If this argument is zero, it defaults to 1. @param perPage number of people to return per page. If this argument is zero, it defaults to 10. The maximum allowed value is 50. @return object containing limited information about the photo, and a list of people who have favorited the photo. @throws JinxException if required parameters are null or empty, or if there are errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.getFavorites.html">flickr.photos.getFavorites</a>
[ "Returns", "the", "list", "of", "people", "who", "have", "favorited", "a", "given", "photo", ".", "<br", ">", "This", "method", "does", "not", "require", "authentication", "." ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosApi.java#L305-L317
cdk/cdk
tool/sdg/src/main/java/org/openscience/cdk/layout/StructureDiagramGenerator.java
StructureDiagramGenerator.getOtherBondAtom
public IAtom getOtherBondAtom(IAtom atom, IBond bond) { """ Returns the other atom of the bond. Expects bond to have only two atoms. Returns null if the given atom is not part of the given bond. @param atom the atom we already have @param bond the bond @return the other atom of the bond """ if (!bond.contains(atom)) return null; if (bond.getBegin().equals(atom)) return bond.getEnd(); else return bond.getBegin(); }
java
public IAtom getOtherBondAtom(IAtom atom, IBond bond) { if (!bond.contains(atom)) return null; if (bond.getBegin().equals(atom)) return bond.getEnd(); else return bond.getBegin(); }
[ "public", "IAtom", "getOtherBondAtom", "(", "IAtom", "atom", ",", "IBond", "bond", ")", "{", "if", "(", "!", "bond", ".", "contains", "(", "atom", ")", ")", "return", "null", ";", "if", "(", "bond", ".", "getBegin", "(", ")", ".", "equals", "(", "a...
Returns the other atom of the bond. Expects bond to have only two atoms. Returns null if the given atom is not part of the given bond. @param atom the atom we already have @param bond the bond @return the other atom of the bond
[ "Returns", "the", "other", "atom", "of", "the", "bond", ".", "Expects", "bond", "to", "have", "only", "two", "atoms", ".", "Returns", "null", "if", "the", "given", "atom", "is", "not", "part", "of", "the", "given", "bond", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/tool/sdg/src/main/java/org/openscience/cdk/layout/StructureDiagramGenerator.java#L2176-L2182
GoogleCloudPlatform/bigdata-interop
bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/FederatedBigQueryOutputFormat.java
FederatedBigQueryOutputFormat.createCommitter
@Override public OutputCommitter createCommitter(TaskAttemptContext context) throws IOException { """ Wraps the delegate's committer in a {@link FederatedBigQueryOutputCommitter}. """ Configuration conf = context.getConfiguration(); OutputCommitter delegateCommitter = getDelegate(conf).getOutputCommitter(context); OutputCommitter committer = new FederatedBigQueryOutputCommitter(context, delegateCommitter); return committer; }
java
@Override public OutputCommitter createCommitter(TaskAttemptContext context) throws IOException { Configuration conf = context.getConfiguration(); OutputCommitter delegateCommitter = getDelegate(conf).getOutputCommitter(context); OutputCommitter committer = new FederatedBigQueryOutputCommitter(context, delegateCommitter); return committer; }
[ "@", "Override", "public", "OutputCommitter", "createCommitter", "(", "TaskAttemptContext", "context", ")", "throws", "IOException", "{", "Configuration", "conf", "=", "context", ".", "getConfiguration", "(", ")", ";", "OutputCommitter", "delegateCommitter", "=", "get...
Wraps the delegate's committer in a {@link FederatedBigQueryOutputCommitter}.
[ "Wraps", "the", "delegate", "s", "committer", "in", "a", "{" ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/bigquery/src/main/java/com/google/cloud/hadoop/io/bigquery/output/FederatedBigQueryOutputFormat.java#L31-L37
FXMisc/WellBehavedFX
src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java
InputMapTemplate.installOverride
public static <S, N extends Node, E extends Event> void installOverride(InputMapTemplate<S, E> imt, S target, Function<? super S, ? extends N> getNode) { """ Instantiates the input map and installs it into the node via {@link Nodes#addInputMap(Node, InputMap)} """ Nodes.addInputMap(getNode.apply(target), imt.instantiate(target)); }
java
public static <S, N extends Node, E extends Event> void installOverride(InputMapTemplate<S, E> imt, S target, Function<? super S, ? extends N> getNode) { Nodes.addInputMap(getNode.apply(target), imt.instantiate(target)); }
[ "public", "static", "<", "S", ",", "N", "extends", "Node", ",", "E", "extends", "Event", ">", "void", "installOverride", "(", "InputMapTemplate", "<", "S", ",", "E", ">", "imt", ",", "S", "target", ",", "Function", "<", "?", "super", "S", ",", "?", ...
Instantiates the input map and installs it into the node via {@link Nodes#addInputMap(Node, InputMap)}
[ "Instantiates", "the", "input", "map", "and", "installs", "it", "into", "the", "node", "via", "{" ]
train
https://github.com/FXMisc/WellBehavedFX/blob/ca889734481f5439655ca8deb6f742964b5654b0/src/main/java/org/fxmisc/wellbehaved/event/template/InputMapTemplate.java#L378-L380
apache/reef
lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/REEFLauncher.java
REEFLauncher.getREEFLauncher
private static REEFLauncher getREEFLauncher(final String clockConfigPath) { """ Instantiate REEF Launcher. This method is called from REEFLauncher.main(). @param clockConfigPath Path to the local file that contains serialized configuration of a REEF component to launch (can be either Driver or Evaluator). @return An instance of the configured REEFLauncher object. """ try { final Configuration clockArgConfig = TANG.newConfigurationBuilder() .bindNamedParameter(ClockConfigurationPath.class, clockConfigPath) .build(); return TANG.newInjector(clockArgConfig).getInstance(REEFLauncher.class); } catch (final BindException ex) { throw fatal("Error in parsing the command line", ex); } catch (final InjectionException ex) { throw fatal("Unable to instantiate REEFLauncher.", ex); } }
java
private static REEFLauncher getREEFLauncher(final String clockConfigPath) { try { final Configuration clockArgConfig = TANG.newConfigurationBuilder() .bindNamedParameter(ClockConfigurationPath.class, clockConfigPath) .build(); return TANG.newInjector(clockArgConfig).getInstance(REEFLauncher.class); } catch (final BindException ex) { throw fatal("Error in parsing the command line", ex); } catch (final InjectionException ex) { throw fatal("Unable to instantiate REEFLauncher.", ex); } }
[ "private", "static", "REEFLauncher", "getREEFLauncher", "(", "final", "String", "clockConfigPath", ")", "{", "try", "{", "final", "Configuration", "clockArgConfig", "=", "TANG", ".", "newConfigurationBuilder", "(", ")", ".", "bindNamedParameter", "(", "ClockConfigurat...
Instantiate REEF Launcher. This method is called from REEFLauncher.main(). @param clockConfigPath Path to the local file that contains serialized configuration of a REEF component to launch (can be either Driver or Evaluator). @return An instance of the configured REEFLauncher object.
[ "Instantiate", "REEF", "Launcher", ".", "This", "method", "is", "called", "from", "REEFLauncher", ".", "main", "()", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/REEFLauncher.java#L97-L112
pravega/pravega
common/src/main/java/io/pravega/common/util/BitConverter.java
BitConverter.readLong
public static long readLong(ArrayView source, int position) { """ Reads a 64-bit long from the given ArrayView starting at the given position. @param source The ArrayView to read from. @param position The position in the ArrayView to start reading at. @return The read number. """ return (long) (source.get(position) & 0xFF) << 56 | (long) (source.get(position + 1) & 0xFF) << 48 | (long) (source.get(position + 2) & 0xFF) << 40 | (long) (source.get(position + 3) & 0xFF) << 32 | (long) (source.get(position + 4) & 0xFF) << 24 | (source.get(position + 5) & 0xFF) << 16 | (source.get(position + 6) & 0xFF) << 8 | (source.get(position + 7) & 0xFF); }
java
public static long readLong(ArrayView source, int position) { return (long) (source.get(position) & 0xFF) << 56 | (long) (source.get(position + 1) & 0xFF) << 48 | (long) (source.get(position + 2) & 0xFF) << 40 | (long) (source.get(position + 3) & 0xFF) << 32 | (long) (source.get(position + 4) & 0xFF) << 24 | (source.get(position + 5) & 0xFF) << 16 | (source.get(position + 6) & 0xFF) << 8 | (source.get(position + 7) & 0xFF); }
[ "public", "static", "long", "readLong", "(", "ArrayView", "source", ",", "int", "position", ")", "{", "return", "(", "long", ")", "(", "source", ".", "get", "(", "position", ")", "&", "0xFF", ")", "<<", "56", "|", "(", "long", ")", "(", "source", "...
Reads a 64-bit long from the given ArrayView starting at the given position. @param source The ArrayView to read from. @param position The position in the ArrayView to start reading at. @return The read number.
[ "Reads", "a", "64", "-", "bit", "long", "from", "the", "given", "ArrayView", "starting", "at", "the", "given", "position", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/BitConverter.java#L242-L251
alipay/sofa-rpc
core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java
AbstractCluster.filterChain
protected SofaResponse filterChain(ProviderInfo providerInfo, SofaRequest request) throws SofaRpcException { """ 发起调用链 @param providerInfo 服务端信息 @param request 请求对象 @return 执行后返回的响应 @throws SofaRpcException 请求RPC异常 """ RpcInternalContext context = RpcInternalContext.getContext(); context.setProviderInfo(providerInfo); return filterChain.invoke(request); }
java
protected SofaResponse filterChain(ProviderInfo providerInfo, SofaRequest request) throws SofaRpcException { RpcInternalContext context = RpcInternalContext.getContext(); context.setProviderInfo(providerInfo); return filterChain.invoke(request); }
[ "protected", "SofaResponse", "filterChain", "(", "ProviderInfo", "providerInfo", ",", "SofaRequest", "request", ")", "throws", "SofaRpcException", "{", "RpcInternalContext", "context", "=", "RpcInternalContext", ".", "getContext", "(", ")", ";", "context", ".", "setPr...
发起调用链 @param providerInfo 服务端信息 @param request 请求对象 @return 执行后返回的响应 @throws SofaRpcException 请求RPC异常
[ "发起调用链" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core-impl/client/src/main/java/com/alipay/sofa/rpc/client/AbstractCluster.java#L475-L479
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java
CompiledFEELSemanticMappings.add
public static Object add(Object left, Object right) { """ FEEL spec Table 45 Delegates to {@link InfixOpNode} except evaluationcontext """ return InfixOpNode.add(left, right, null); }
java
public static Object add(Object left, Object right) { return InfixOpNode.add(left, right, null); }
[ "public", "static", "Object", "add", "(", "Object", "left", ",", "Object", "right", ")", "{", "return", "InfixOpNode", ".", "add", "(", "left", ",", "right", ",", "null", ")", ";", "}" ]
FEEL spec Table 45 Delegates to {@link InfixOpNode} except evaluationcontext
[ "FEEL", "spec", "Table", "45", "Delegates", "to", "{" ]
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/codegen/feel11/CompiledFEELSemanticMappings.java#L298-L300
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java
ConstraintAdapter.getDirection
protected ConversionDirectionType getDirection(Conversion conv, Pathway pathway) { """ Gets the direction of the Control chain the the Interaction. @param conv controlled conversion @param pathway the container pathway @return the direction of the conversion related to the catalysis """ Set<StepDirection> dirs = new HashSet<StepDirection>(); // find the direction in the pathway step for (PathwayStep step : conv.getStepProcessOf()) { if (step.getPathwayOrderOf().equals(pathway) && step instanceof BiochemicalPathwayStep) { StepDirection dir = ((BiochemicalPathwayStep) step).getStepDirection(); if (dir != null) dirs.add(dir); } } if (dirs.size() > 1) return ConversionDirectionType.REVERSIBLE; else if (!dirs.isEmpty()) return convertStepDirection(dirs.iterator().next()); return getDirection(conv); }
java
protected ConversionDirectionType getDirection(Conversion conv, Pathway pathway) { Set<StepDirection> dirs = new HashSet<StepDirection>(); // find the direction in the pathway step for (PathwayStep step : conv.getStepProcessOf()) { if (step.getPathwayOrderOf().equals(pathway) && step instanceof BiochemicalPathwayStep) { StepDirection dir = ((BiochemicalPathwayStep) step).getStepDirection(); if (dir != null) dirs.add(dir); } } if (dirs.size() > 1) return ConversionDirectionType.REVERSIBLE; else if (!dirs.isEmpty()) return convertStepDirection(dirs.iterator().next()); return getDirection(conv); }
[ "protected", "ConversionDirectionType", "getDirection", "(", "Conversion", "conv", ",", "Pathway", "pathway", ")", "{", "Set", "<", "StepDirection", ">", "dirs", "=", "new", "HashSet", "<", "StepDirection", ">", "(", ")", ";", "// find the direction in the pathway s...
Gets the direction of the Control chain the the Interaction. @param conv controlled conversion @param pathway the container pathway @return the direction of the conversion related to the catalysis
[ "Gets", "the", "direction", "of", "the", "Control", "chain", "the", "the", "Interaction", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/constraint/ConstraintAdapter.java#L180-L198
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/util/Option.java
Option.findTemplate
private static Option findTemplate(String name, Option[] templates) { """ Searches an array of option templates and returns an option matching the supplied name or null if no match is found. @param name The name of the option to search for @param templates An array of option templates in which to search @return An Option object matching the supplied option name or null if no match is found """ boolean listAllowed = false; Option listOption = null; for (int i = 0; i < templates.length; i++) { if (templates[i].getName().equals(name)) { return templates[i]; } if (Type.LIST.equals(templates[i].getType())) { listAllowed = true; listOption = templates[i]; } } if (listAllowed) { return listOption; } return null; }
java
private static Option findTemplate(String name, Option[] templates) { boolean listAllowed = false; Option listOption = null; for (int i = 0; i < templates.length; i++) { if (templates[i].getName().equals(name)) { return templates[i]; } if (Type.LIST.equals(templates[i].getType())) { listAllowed = true; listOption = templates[i]; } } if (listAllowed) { return listOption; } return null; }
[ "private", "static", "Option", "findTemplate", "(", "String", "name", ",", "Option", "[", "]", "templates", ")", "{", "boolean", "listAllowed", "=", "false", ";", "Option", "listOption", "=", "null", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<"...
Searches an array of option templates and returns an option matching the supplied name or null if no match is found. @param name The name of the option to search for @param templates An array of option templates in which to search @return An Option object matching the supplied option name or null if no match is found
[ "Searches", "an", "array", "of", "option", "templates", "and", "returns", "an", "option", "matching", "the", "supplied", "name", "or", "null", "if", "no", "match", "is", "found", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/util/Option.java#L234-L251
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Collectors.java
Collectors.groupingByConcurrent
public static <T, K> Collector<T, ?, ConcurrentMap<K, List<T>>> groupingByConcurrent(Function<? super T, ? extends K> classifier) { """ Returns a concurrent {@code Collector} implementing a "group by" operation on input elements of type {@code T}, grouping elements according to a classification function. <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and {@link Collector.Characteristics#UNORDERED unordered} Collector. <p>The classification function maps elements to some key type {@code K}. The collector produces a {@code ConcurrentMap<K, List<T>>} whose keys are the values resulting from applying the classification function to the input elements, and whose corresponding values are {@code List}s containing the input elements which map to the associated key under the classification function. <p>There are no guarantees on the type, mutability, or serializability of the {@code Map} or {@code List} objects returned, or of the thread-safety of the {@code List} objects returned. @implSpec This produces a result similar to: <pre>{@code groupingByConcurrent(classifier, toList()); }</pre> @param <T> the type of the input elements @param <K> the type of the keys @param classifier a classifier function mapping input elements to keys @return a concurrent, unordered {@code Collector} implementing the group-by operation @see #groupingBy(Function) @see #groupingByConcurrent(Function, Collector) @see #groupingByConcurrent(Function, Supplier, Collector) """ return groupingByConcurrent(classifier, ConcurrentHashMap::new, toList()); }
java
public static <T, K> Collector<T, ?, ConcurrentMap<K, List<T>>> groupingByConcurrent(Function<? super T, ? extends K> classifier) { return groupingByConcurrent(classifier, ConcurrentHashMap::new, toList()); }
[ "public", "static", "<", "T", ",", "K", ">", "Collector", "<", "T", ",", "?", ",", "ConcurrentMap", "<", "K", ",", "List", "<", "T", ">", ">", ">", "groupingByConcurrent", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "K", ">", "c...
Returns a concurrent {@code Collector} implementing a "group by" operation on input elements of type {@code T}, grouping elements according to a classification function. <p>This is a {@link Collector.Characteristics#CONCURRENT concurrent} and {@link Collector.Characteristics#UNORDERED unordered} Collector. <p>The classification function maps elements to some key type {@code K}. The collector produces a {@code ConcurrentMap<K, List<T>>} whose keys are the values resulting from applying the classification function to the input elements, and whose corresponding values are {@code List}s containing the input elements which map to the associated key under the classification function. <p>There are no guarantees on the type, mutability, or serializability of the {@code Map} or {@code List} objects returned, or of the thread-safety of the {@code List} objects returned. @implSpec This produces a result similar to: <pre>{@code groupingByConcurrent(classifier, toList()); }</pre> @param <T> the type of the input elements @param <K> the type of the keys @param classifier a classifier function mapping input elements to keys @return a concurrent, unordered {@code Collector} implementing the group-by operation @see #groupingBy(Function) @see #groupingByConcurrent(Function, Collector) @see #groupingByConcurrent(Function, Supplier, Collector)
[ "Returns", "a", "concurrent", "{", "@code", "Collector", "}", "implementing", "a", "group", "by", "operation", "on", "input", "elements", "of", "type", "{", "@code", "T", "}", "grouping", "elements", "according", "to", "a", "classification", "function", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Collectors.java#L964-L968
alkacon/opencms-core
src/org/opencms/db/oracle/CmsUserDriver.java
CmsUserDriver.getOutputStreamFromBlob
public static OutputStream getOutputStreamFromBlob(ResultSet res, String name) throws SQLException { """ Generates an Output stream that writes to a blob, also truncating the existing blob if required.<p> Apparently Oracle requires some non-standard handling here.<p> @param res the result set where the blob is located in @param name the name of the database column where the blob is located @return an Output stream from a blob @throws SQLException if something goes wring """ Blob blob = res.getBlob(name); blob.truncate(0); return blob.setBinaryStream(0L); }
java
public static OutputStream getOutputStreamFromBlob(ResultSet res, String name) throws SQLException { Blob blob = res.getBlob(name); blob.truncate(0); return blob.setBinaryStream(0L); }
[ "public", "static", "OutputStream", "getOutputStreamFromBlob", "(", "ResultSet", "res", ",", "String", "name", ")", "throws", "SQLException", "{", "Blob", "blob", "=", "res", ".", "getBlob", "(", "name", ")", ";", "blob", ".", "truncate", "(", "0", ")", ";...
Generates an Output stream that writes to a blob, also truncating the existing blob if required.<p> Apparently Oracle requires some non-standard handling here.<p> @param res the result set where the blob is located in @param name the name of the database column where the blob is located @return an Output stream from a blob @throws SQLException if something goes wring
[ "Generates", "an", "Output", "stream", "that", "writes", "to", "a", "blob", "also", "truncating", "the", "existing", "blob", "if", "required", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/oracle/CmsUserDriver.java#L71-L76
apache/reef
lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/storage/StorageKeyCloudBlobProvider.java
StorageKeyCloudBlobProvider.getCloudBlobClient
@Override public CloudBlobClient getCloudBlobClient() throws IOException { """ Returns an instance of {@link CloudBlobClient} based on available authentication mechanism. @return an instance of {@link CloudBlobClient}. @throws IOException """ String connectionString = String.format(AZURE_STORAGE_CONNECTION_STRING_FORMAT, this.azureStorageAccountName, this.azureStorageAccountKey); try { return CloudStorageAccount.parse(connectionString).createCloudBlobClient(); } catch (URISyntaxException | InvalidKeyException e) { throw new IOException("Failed to create a Cloud Storage Account.", e); } }
java
@Override public CloudBlobClient getCloudBlobClient() throws IOException { String connectionString = String.format(AZURE_STORAGE_CONNECTION_STRING_FORMAT, this.azureStorageAccountName, this.azureStorageAccountKey); try { return CloudStorageAccount.parse(connectionString).createCloudBlobClient(); } catch (URISyntaxException | InvalidKeyException e) { throw new IOException("Failed to create a Cloud Storage Account.", e); } }
[ "@", "Override", "public", "CloudBlobClient", "getCloudBlobClient", "(", ")", "throws", "IOException", "{", "String", "connectionString", "=", "String", ".", "format", "(", "AZURE_STORAGE_CONNECTION_STRING_FORMAT", ",", "this", ".", "azureStorageAccountName", ",", "this...
Returns an instance of {@link CloudBlobClient} based on available authentication mechanism. @return an instance of {@link CloudBlobClient}. @throws IOException
[ "Returns", "an", "instance", "of", "{" ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-runtime-azbatch/src/main/java/org/apache/reef/runtime/azbatch/util/storage/StorageKeyCloudBlobProvider.java#L62-L71
pac4j/pac4j
pac4j-config/src/main/java/org/pac4j/config/ldaptive/LdaptiveAuthenticatorBuilder.java
LdaptiveAuthenticatorBuilder.newBlockingConnectionPool
public static ConnectionPool newBlockingConnectionPool(final AbstractLdapProperties l) { """ New blocking connection pool connection pool. @param l the l @return the connection pool """ final DefaultConnectionFactory bindCf = newConnectionFactory(l); final PoolConfig pc = newPoolConfig(l); final BlockingConnectionPool cp = new BlockingConnectionPool(pc, bindCf); cp.setBlockWaitTime(newDuration(l.getBlockWaitTime())); cp.setPoolConfig(pc); final IdlePruneStrategy strategy = new IdlePruneStrategy(); strategy.setIdleTime(newDuration(l.getIdleTime())); strategy.setPrunePeriod(newDuration(l.getPrunePeriod())); cp.setPruneStrategy(strategy); cp.setValidator(new SearchValidator()); cp.setFailFastInitialize(l.isFailFast()); if (CommonHelper.isNotBlank(l.getPoolPassivator())) { final AbstractLdapProperties.LdapConnectionPoolPassivator pass = AbstractLdapProperties.LdapConnectionPoolPassivator.valueOf(l.getPoolPassivator().toUpperCase()); switch (pass) { case CLOSE: cp.setPassivator(new ClosePassivator()); break; case BIND: LOGGER.debug("Creating a bind passivator instance for the connection pool"); final BindRequest bindRequest = new BindRequest(); bindRequest.setDn(l.getBindDn()); bindRequest.setCredential(new Credential(l.getBindCredential())); cp.setPassivator(new BindPassivator(bindRequest)); break; default: break; } } LOGGER.debug("Initializing ldap connection pool for {} and bindDn {}", l.getLdapUrl(), l.getBindDn()); cp.initialize(); return cp; }
java
public static ConnectionPool newBlockingConnectionPool(final AbstractLdapProperties l) { final DefaultConnectionFactory bindCf = newConnectionFactory(l); final PoolConfig pc = newPoolConfig(l); final BlockingConnectionPool cp = new BlockingConnectionPool(pc, bindCf); cp.setBlockWaitTime(newDuration(l.getBlockWaitTime())); cp.setPoolConfig(pc); final IdlePruneStrategy strategy = new IdlePruneStrategy(); strategy.setIdleTime(newDuration(l.getIdleTime())); strategy.setPrunePeriod(newDuration(l.getPrunePeriod())); cp.setPruneStrategy(strategy); cp.setValidator(new SearchValidator()); cp.setFailFastInitialize(l.isFailFast()); if (CommonHelper.isNotBlank(l.getPoolPassivator())) { final AbstractLdapProperties.LdapConnectionPoolPassivator pass = AbstractLdapProperties.LdapConnectionPoolPassivator.valueOf(l.getPoolPassivator().toUpperCase()); switch (pass) { case CLOSE: cp.setPassivator(new ClosePassivator()); break; case BIND: LOGGER.debug("Creating a bind passivator instance for the connection pool"); final BindRequest bindRequest = new BindRequest(); bindRequest.setDn(l.getBindDn()); bindRequest.setCredential(new Credential(l.getBindCredential())); cp.setPassivator(new BindPassivator(bindRequest)); break; default: break; } } LOGGER.debug("Initializing ldap connection pool for {} and bindDn {}", l.getLdapUrl(), l.getBindDn()); cp.initialize(); return cp; }
[ "public", "static", "ConnectionPool", "newBlockingConnectionPool", "(", "final", "AbstractLdapProperties", "l", ")", "{", "final", "DefaultConnectionFactory", "bindCf", "=", "newConnectionFactory", "(", "l", ")", ";", "final", "PoolConfig", "pc", "=", "newPoolConfig", ...
New blocking connection pool connection pool. @param l the l @return the connection pool
[ "New", "blocking", "connection", "pool", "connection", "pool", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-config/src/main/java/org/pac4j/config/ldaptive/LdaptiveAuthenticatorBuilder.java#L281-L319
Netflix/Hystrix
hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandMetrics.java
HystrixCommandMetrics.getInstance
public static HystrixCommandMetrics getInstance(HystrixCommandKey key, HystrixCommandGroupKey commandGroup, HystrixCommandProperties properties) { """ Get or create the {@link HystrixCommandMetrics} instance for a given {@link HystrixCommandKey}. <p> This is thread-safe and ensures only 1 {@link HystrixCommandMetrics} per {@link HystrixCommandKey}. @param key {@link HystrixCommandKey} of {@link HystrixCommand} instance requesting the {@link HystrixCommandMetrics} @param commandGroup Pass-thru to {@link HystrixCommandMetrics} instance on first time when constructed @param properties Pass-thru to {@link HystrixCommandMetrics} instance on first time when constructed @return {@link HystrixCommandMetrics} """ return getInstance(key, commandGroup, null, properties); }
java
public static HystrixCommandMetrics getInstance(HystrixCommandKey key, HystrixCommandGroupKey commandGroup, HystrixCommandProperties properties) { return getInstance(key, commandGroup, null, properties); }
[ "public", "static", "HystrixCommandMetrics", "getInstance", "(", "HystrixCommandKey", "key", ",", "HystrixCommandGroupKey", "commandGroup", ",", "HystrixCommandProperties", "properties", ")", "{", "return", "getInstance", "(", "key", ",", "commandGroup", ",", "null", ",...
Get or create the {@link HystrixCommandMetrics} instance for a given {@link HystrixCommandKey}. <p> This is thread-safe and ensures only 1 {@link HystrixCommandMetrics} per {@link HystrixCommandKey}. @param key {@link HystrixCommandKey} of {@link HystrixCommand} instance requesting the {@link HystrixCommandMetrics} @param commandGroup Pass-thru to {@link HystrixCommandMetrics} instance on first time when constructed @param properties Pass-thru to {@link HystrixCommandMetrics} instance on first time when constructed @return {@link HystrixCommandMetrics}
[ "Get", "or", "create", "the", "{", "@link", "HystrixCommandMetrics", "}", "instance", "for", "a", "given", "{", "@link", "HystrixCommandKey", "}", ".", "<p", ">", "This", "is", "thread", "-", "safe", "and", "ensures", "only", "1", "{", "@link", "HystrixCom...
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-core/src/main/java/com/netflix/hystrix/HystrixCommandMetrics.java#L100-L102
apereo/cas
support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/DelegatedClientNavigationController.java
DelegatedClientNavigationController.redirectResponseToFlow
@RequestMapping(value = ENDPOINT_RESPONSE, method = { """ Redirect response to flow. Receives the CAS, OAuth, OIDC, etc. callback response, adjust it to work with the login webflow, and redirects the requests to the login webflow endpoint. @param clientName the path-based parameter that provider the pac4j client name @param request the request @param response the response @return the view """RequestMethod.GET, RequestMethod.POST}) public View redirectResponseToFlow(@PathVariable("clientName") final String clientName, final HttpServletRequest request, final HttpServletResponse response) { return buildRedirectViewBackToFlow(clientName, request); }
java
@RequestMapping(value = ENDPOINT_RESPONSE, method = {RequestMethod.GET, RequestMethod.POST}) public View redirectResponseToFlow(@PathVariable("clientName") final String clientName, final HttpServletRequest request, final HttpServletResponse response) { return buildRedirectViewBackToFlow(clientName, request); }
[ "@", "RequestMapping", "(", "value", "=", "ENDPOINT_RESPONSE", ",", "method", "=", "{", "RequestMethod", ".", "GET", ",", "RequestMethod", ".", "POST", "}", ")", "public", "View", "redirectResponseToFlow", "(", "@", "PathVariable", "(", "\"clientName\"", ")", ...
Redirect response to flow. Receives the CAS, OAuth, OIDC, etc. callback response, adjust it to work with the login webflow, and redirects the requests to the login webflow endpoint. @param clientName the path-based parameter that provider the pac4j client name @param request the request @param response the response @return the view
[ "Redirect", "response", "to", "flow", ".", "Receives", "the", "CAS", "OAuth", "OIDC", "etc", ".", "callback", "response", "adjust", "it", "to", "work", "with", "the", "login", "webflow", "and", "redirects", "the", "requests", "to", "the", "login", "webflow",...
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-pac4j-webflow/src/main/java/org/apereo/cas/web/DelegatedClientNavigationController.java#L106-L110
lucee/Lucee
core/src/main/java/lucee/runtime/converter/WDDXConverter.java
WDDXConverter._serializeStruct
private String _serializeStruct(Struct struct, Set<Object> done) throws ConverterException { """ serialize a Struct @param struct Struct to serialize @param done @return serialized struct @throws ConverterException """ StringBuilder sb = new StringBuilder(goIn() + "<struct>"); Iterator<Key> it = struct.keyIterator(); deep++; while (it.hasNext()) { Key key = it.next(); sb.append(goIn() + "<var name=" + del + XMLUtil.escapeXMLString(key.toString()) + del + ">"); sb.append(_serialize(struct.get(key, null), done)); sb.append(goIn() + "</var>"); } deep--; sb.append(goIn() + "</struct>"); return sb.toString(); }
java
private String _serializeStruct(Struct struct, Set<Object> done) throws ConverterException { StringBuilder sb = new StringBuilder(goIn() + "<struct>"); Iterator<Key> it = struct.keyIterator(); deep++; while (it.hasNext()) { Key key = it.next(); sb.append(goIn() + "<var name=" + del + XMLUtil.escapeXMLString(key.toString()) + del + ">"); sb.append(_serialize(struct.get(key, null), done)); sb.append(goIn() + "</var>"); } deep--; sb.append(goIn() + "</struct>"); return sb.toString(); }
[ "private", "String", "_serializeStruct", "(", "Struct", "struct", ",", "Set", "<", "Object", ">", "done", ")", "throws", "ConverterException", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "goIn", "(", ")", "+", "\"<struct>\"", ")", ";", "Ite...
serialize a Struct @param struct Struct to serialize @param done @return serialized struct @throws ConverterException
[ "serialize", "a", "Struct" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/WDDXConverter.java#L271-L287
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/log/LogImpl.java
LogImpl.setDebugPatterns
public void setDebugPatterns(String patterns) { """ Set debug patterns. @param patterns comma separated string of patterns """ _patterns=patterns; if (patterns!=null && patterns.length()>0) { _debugPatterns = new ArrayList(); StringTokenizer tok = new StringTokenizer(patterns,", \t"); while (tok.hasMoreTokens()) { String pattern = tok.nextToken(); _debugPatterns.add(pattern); } } else _debugPatterns = null; }
java
public void setDebugPatterns(String patterns) { _patterns=patterns; if (patterns!=null && patterns.length()>0) { _debugPatterns = new ArrayList(); StringTokenizer tok = new StringTokenizer(patterns,", \t"); while (tok.hasMoreTokens()) { String pattern = tok.nextToken(); _debugPatterns.add(pattern); } } else _debugPatterns = null; }
[ "public", "void", "setDebugPatterns", "(", "String", "patterns", ")", "{", "_patterns", "=", "patterns", ";", "if", "(", "patterns", "!=", "null", "&&", "patterns", ".", "length", "(", ")", ">", "0", ")", "{", "_debugPatterns", "=", "new", "ArrayList", "...
Set debug patterns. @param patterns comma separated string of patterns
[ "Set", "debug", "patterns", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/log/LogImpl.java#L479-L495
amaembo/streamex
src/main/java/one/util/streamex/LongStreamEx.java
LongStreamEx.rangeClosed
public static LongStreamEx rangeClosed(long startInclusive, long endInclusive, long step) { """ Returns a sequential ordered {@code LongStreamEx} from {@code startInclusive} (inclusive) to {@code endInclusive} (inclusive) by the specified incremental step. The negative step values are also supported. In this case the {@code startInclusive} should be greater than {@code endInclusive}. <p> Note that depending on the step value the {@code endInclusive} bound may still not be reached. For example {@code LongStreamEx.rangeClosed(0, 5, 2)} will yield the stream of three numbers: 0L, 2L and 4L. @param startInclusive the (inclusive) initial value @param endInclusive the inclusive upper bound @param step the non-zero value which designates the difference between the consecutive values of the resulting stream. @return a sequential {@code LongStreamEx} for the range of {@code long} elements @throws IllegalArgumentException if step is zero @see LongStreamEx#rangeClosed(long, long) @since 0.4.0 """ if (step == 0) throw new IllegalArgumentException("step = 0"); if (step == 1) return seq(LongStream.rangeClosed(startInclusive, endInclusive)); if (step == -1) { // Handled specially as number of elements can exceed // Long.MAX_VALUE long sum = endInclusive + startInclusive; return seq(LongStream.rangeClosed(endInclusive, startInclusive).map(x -> sum - x)); } if ((endInclusive > startInclusive ^ step > 0) || endInclusive == startInclusive) return empty(); long limit = (endInclusive - startInclusive) * Long.signum(step); limit = Long.divideUnsigned(limit, Math.abs(step)); return seq(LongStream.rangeClosed(0, limit).map(x -> x * step + startInclusive)); }
java
public static LongStreamEx rangeClosed(long startInclusive, long endInclusive, long step) { if (step == 0) throw new IllegalArgumentException("step = 0"); if (step == 1) return seq(LongStream.rangeClosed(startInclusive, endInclusive)); if (step == -1) { // Handled specially as number of elements can exceed // Long.MAX_VALUE long sum = endInclusive + startInclusive; return seq(LongStream.rangeClosed(endInclusive, startInclusive).map(x -> sum - x)); } if ((endInclusive > startInclusive ^ step > 0) || endInclusive == startInclusive) return empty(); long limit = (endInclusive - startInclusive) * Long.signum(step); limit = Long.divideUnsigned(limit, Math.abs(step)); return seq(LongStream.rangeClosed(0, limit).map(x -> x * step + startInclusive)); }
[ "public", "static", "LongStreamEx", "rangeClosed", "(", "long", "startInclusive", ",", "long", "endInclusive", ",", "long", "step", ")", "{", "if", "(", "step", "==", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"step = 0\"", ")", ";", "if", ...
Returns a sequential ordered {@code LongStreamEx} from {@code startInclusive} (inclusive) to {@code endInclusive} (inclusive) by the specified incremental step. The negative step values are also supported. In this case the {@code startInclusive} should be greater than {@code endInclusive}. <p> Note that depending on the step value the {@code endInclusive} bound may still not be reached. For example {@code LongStreamEx.rangeClosed(0, 5, 2)} will yield the stream of three numbers: 0L, 2L and 4L. @param startInclusive the (inclusive) initial value @param endInclusive the inclusive upper bound @param step the non-zero value which designates the difference between the consecutive values of the resulting stream. @return a sequential {@code LongStreamEx} for the range of {@code long} elements @throws IllegalArgumentException if step is zero @see LongStreamEx#rangeClosed(long, long) @since 0.4.0
[ "Returns", "a", "sequential", "ordered", "{", "@code", "LongStreamEx", "}", "from", "{", "@code", "startInclusive", "}", "(", "inclusive", ")", "to", "{", "@code", "endInclusive", "}", "(", "inclusive", ")", "by", "the", "specified", "incremental", "step", "...
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L2006-L2022
apache/incubator-gobblin
gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/workunit/packer/KafkaWorkUnitPacker.java
KafkaWorkUnitPacker.setWorkUnitEstSizes
public double setWorkUnitEstSizes(Map<String, List<WorkUnit>> workUnitsByTopic) { """ Calculate the total size of the workUnits and set the estimated size for each workUnit @param workUnitsByTopic @return the total size of the input workUnits """ double totalEstDataSize = 0; for (List<WorkUnit> workUnitsForTopic : workUnitsByTopic.values()) { for (WorkUnit workUnit : workUnitsForTopic) { setWorkUnitEstSize(workUnit); totalEstDataSize += getWorkUnitEstSize(workUnit); } } return totalEstDataSize; }
java
public double setWorkUnitEstSizes(Map<String, List<WorkUnit>> workUnitsByTopic) { double totalEstDataSize = 0; for (List<WorkUnit> workUnitsForTopic : workUnitsByTopic.values()) { for (WorkUnit workUnit : workUnitsForTopic) { setWorkUnitEstSize(workUnit); totalEstDataSize += getWorkUnitEstSize(workUnit); } } return totalEstDataSize; }
[ "public", "double", "setWorkUnitEstSizes", "(", "Map", "<", "String", ",", "List", "<", "WorkUnit", ">", ">", "workUnitsByTopic", ")", "{", "double", "totalEstDataSize", "=", "0", ";", "for", "(", "List", "<", "WorkUnit", ">", "workUnitsForTopic", ":", "work...
Calculate the total size of the workUnits and set the estimated size for each workUnit @param workUnitsByTopic @return the total size of the input workUnits
[ "Calculate", "the", "total", "size", "of", "the", "workUnits", "and", "set", "the", "estimated", "size", "for", "each", "workUnit" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-kafka-common/src/main/java/org/apache/gobblin/source/extractor/extract/kafka/workunit/packer/KafkaWorkUnitPacker.java#L370-L379
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/pool/HikariPool.java
HikariPool.initializeHouseKeepingExecutorService
private ScheduledExecutorService initializeHouseKeepingExecutorService() { """ Create/initialize the Housekeeping service {@link ScheduledExecutorService}. If the user specified an Executor to be used in the {@link HikariConfig}, then we use that. If no Executor was specified (typical), then create an Executor and configure it. @return either the user specified {@link ScheduledExecutorService}, or the one we created """ if (config.getScheduledExecutor() == null) { final ThreadFactory threadFactory = Optional.ofNullable(config.getThreadFactory()).orElseGet(() -> new DefaultThreadFactory(poolName + " housekeeper", true)); final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1, threadFactory, new ThreadPoolExecutor.DiscardPolicy()); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); executor.setRemoveOnCancelPolicy(true); return executor; } else { return config.getScheduledExecutor(); } }
java
private ScheduledExecutorService initializeHouseKeepingExecutorService() { if (config.getScheduledExecutor() == null) { final ThreadFactory threadFactory = Optional.ofNullable(config.getThreadFactory()).orElseGet(() -> new DefaultThreadFactory(poolName + " housekeeper", true)); final ScheduledThreadPoolExecutor executor = new ScheduledThreadPoolExecutor(1, threadFactory, new ThreadPoolExecutor.DiscardPolicy()); executor.setExecuteExistingDelayedTasksAfterShutdownPolicy(false); executor.setRemoveOnCancelPolicy(true); return executor; } else { return config.getScheduledExecutor(); } }
[ "private", "ScheduledExecutorService", "initializeHouseKeepingExecutorService", "(", ")", "{", "if", "(", "config", ".", "getScheduledExecutor", "(", ")", "==", "null", ")", "{", "final", "ThreadFactory", "threadFactory", "=", "Optional", ".", "ofNullable", "(", "co...
Create/initialize the Housekeeping service {@link ScheduledExecutorService}. If the user specified an Executor to be used in the {@link HikariConfig}, then we use that. If no Executor was specified (typical), then create an Executor and configure it. @return either the user specified {@link ScheduledExecutorService}, or the one we created
[ "Create", "/", "initialize", "the", "Housekeeping", "service", "{", "@link", "ScheduledExecutorService", "}", ".", "If", "the", "user", "specified", "an", "Executor", "to", "be", "used", "in", "the", "{", "@link", "HikariConfig", "}", "then", "we", "use", "t...
train
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/pool/HikariPool.java#L631-L643