repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
apiman/apiman
common/util/src/main/java/io/apiman/common/util/ReflectionUtils.java
ReflectionUtils.findSetter
public static Method findSetter(Class<?> onClass, Class<?> targetClass) { Method[] methods = onClass.getMethods(); for (Method method : methods) { Class<?>[] ptypes = method.getParameterTypes(); if (method.getName().startsWith("set") && ptypes.length == 1 && ptypes[0] == targetClass) { //$NON-NLS-1$ return method; } } return null; }
java
public static Method findSetter(Class<?> onClass, Class<?> targetClass) { Method[] methods = onClass.getMethods(); for (Method method : methods) { Class<?>[] ptypes = method.getParameterTypes(); if (method.getName().startsWith("set") && ptypes.length == 1 && ptypes[0] == targetClass) { //$NON-NLS-1$ return method; } } return null; }
[ "public", "static", "Method", "findSetter", "(", "Class", "<", "?", ">", "onClass", ",", "Class", "<", "?", ">", "targetClass", ")", "{", "Method", "[", "]", "methods", "=", "onClass", ".", "getMethods", "(", ")", ";", "for", "(", "Method", "method", ...
Squishy way to find a setter method. @param onClass, targetClass
[ "Squishy", "way", "to", "find", "a", "setter", "method", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/util/src/main/java/io/apiman/common/util/ReflectionUtils.java#L73-L82
LMAX-Exchange/disruptor
src/main/java/com/lmax/disruptor/RingBuffer.java
RingBuffer.createMultiProducer
public static <E> RingBuffer<E> createMultiProducer( EventFactory<E> factory, int bufferSize, WaitStrategy waitStrategy) { MultiProducerSequencer sequencer = new MultiProducerSequencer(bufferSize, waitStrategy); return new RingBuffer<E>(factory, sequencer); }
java
public static <E> RingBuffer<E> createMultiProducer( EventFactory<E> factory, int bufferSize, WaitStrategy waitStrategy) { MultiProducerSequencer sequencer = new MultiProducerSequencer(bufferSize, waitStrategy); return new RingBuffer<E>(factory, sequencer); }
[ "public", "static", "<", "E", ">", "RingBuffer", "<", "E", ">", "createMultiProducer", "(", "EventFactory", "<", "E", ">", "factory", ",", "int", "bufferSize", ",", "WaitStrategy", "waitStrategy", ")", "{", "MultiProducerSequencer", "sequencer", "=", "new", "M...
Create a new multiple producer RingBuffer with the specified wait strategy. @param <E> Class of the event stored in the ring buffer. @param factory used to create the events within the ring buffer. @param bufferSize number of elements to create within the ring buffer. @param waitStrategy used to determine how to wait for new elements to become available. @return a constructed ring buffer. @throws IllegalArgumentException if bufferSize is less than 1 or not a power of 2 @see MultiProducerSequencer
[ "Create", "a", "new", "multiple", "producer", "RingBuffer", "with", "the", "specified", "wait", "strategy", "." ]
train
https://github.com/LMAX-Exchange/disruptor/blob/4266d00c5250190313446fdd7c8aa7a4edb5c818/src/main/java/com/lmax/disruptor/RingBuffer.java#L133-L141
JoeKerouac/utils
src/main/java/com/joe/utils/reflect/ClassUtils.java
ClassUtils.loadClass
@SuppressWarnings("unchecked") public static <T> Class<T> loadClass(String className, ClassLoader loader) { Assert.notNull(className, "className不能为null"); Assert.notNull(loader, "loader不能为null"); switch (className) { case "boolean": return (Class<T>) boolean.class; case "byte": return (Class<T>) byte.class; case "char": return (Class<T>) char.class; case "short": return (Class<T>) short.class; case "int": return (Class<T>) int.class; case "long": return (Class<T>) long.class; case "double": return (Class<T>) double.class; case "float": return (Class<T>) float.class; default: try { return (Class<T>) loader.loadClass(className); } catch (ClassNotFoundException e) { throw new ReflectException("找不到指定class:" + className, e); } } }
java
@SuppressWarnings("unchecked") public static <T> Class<T> loadClass(String className, ClassLoader loader) { Assert.notNull(className, "className不能为null"); Assert.notNull(loader, "loader不能为null"); switch (className) { case "boolean": return (Class<T>) boolean.class; case "byte": return (Class<T>) byte.class; case "char": return (Class<T>) char.class; case "short": return (Class<T>) short.class; case "int": return (Class<T>) int.class; case "long": return (Class<T>) long.class; case "double": return (Class<T>) double.class; case "float": return (Class<T>) float.class; default: try { return (Class<T>) loader.loadClass(className); } catch (ClassNotFoundException e) { throw new ReflectException("找不到指定class:" + className, e); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "Class", "<", "T", ">", "loadClass", "(", "String", "className", ",", "ClassLoader", "loader", ")", "{", "Assert", ".", "notNull", "(", "className", ",", "\"className不能为nu...
使用指定ClassLoader加载class @param className class名字 @param loader 加载class的ClassLoader @param <T> class实际类型 @return class
[ "使用指定ClassLoader加载class" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/reflect/ClassUtils.java#L78-L106
googleapis/google-cloud-java
google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java
Value.bytesArray
public static Value bytesArray(@Nullable Iterable<ByteArray> v) { return new BytesArrayImpl(v == null, v == null ? null : immutableCopyOf(v)); }
java
public static Value bytesArray(@Nullable Iterable<ByteArray> v) { return new BytesArrayImpl(v == null, v == null ? null : immutableCopyOf(v)); }
[ "public", "static", "Value", "bytesArray", "(", "@", "Nullable", "Iterable", "<", "ByteArray", ">", "v", ")", "{", "return", "new", "BytesArrayImpl", "(", "v", "==", "null", ",", "v", "==", "null", "?", "null", ":", "immutableCopyOf", "(", "v", ")", ")...
Returns an {@code ARRAY<BYTES>} value. @param v the source of element values. This may be {@code null} to produce a value for which {@code isNull()} is {@code true}. Individual elements may also be {@code null}.
[ "Returns", "an", "{", "@code", "ARRAY<BYTES", ">", "}", "value", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-spanner/src/main/java/com/google/cloud/spanner/Value.java#L302-L304
OpenLiberty/open-liberty
dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/cache/internal/ZipFileDataStore.java
ZipFileDataStore.addLast
public ZipFileData addLast(ZipFileData newLastData, int maximumSize) { String newLastPath = newLastData.path; Cell dupCell = cells.get(newLastPath); if ( dupCell != null ) { throw new IllegalArgumentException("Path [ " + newLastPath + " ] is already stored"); } int size = size(); if ( (maximumSize == -1) || (size < maximumSize) ) { @SuppressWarnings("unused") ZipFileData oldLastData = addLast(newLastData); return null; } Cell oldFirstCell = anchor.next; ZipFileData oldFirstData = oldFirstCell.data; String oldFirstPath = oldFirstData.path; if ( oldFirstCell != cells.remove(oldFirstPath) ) { throw new IllegalStateException("Bad cell alignment on path [ " + oldFirstPath + " ]"); } oldFirstCell.data = newLastData; cells.put(newLastPath, oldFirstCell); if ( size != 1 ) { oldFirstCell.excise(); oldFirstCell.putBetween(anchor.prev, anchor); } return oldFirstData; }
java
public ZipFileData addLast(ZipFileData newLastData, int maximumSize) { String newLastPath = newLastData.path; Cell dupCell = cells.get(newLastPath); if ( dupCell != null ) { throw new IllegalArgumentException("Path [ " + newLastPath + " ] is already stored"); } int size = size(); if ( (maximumSize == -1) || (size < maximumSize) ) { @SuppressWarnings("unused") ZipFileData oldLastData = addLast(newLastData); return null; } Cell oldFirstCell = anchor.next; ZipFileData oldFirstData = oldFirstCell.data; String oldFirstPath = oldFirstData.path; if ( oldFirstCell != cells.remove(oldFirstPath) ) { throw new IllegalStateException("Bad cell alignment on path [ " + oldFirstPath + " ]"); } oldFirstCell.data = newLastData; cells.put(newLastPath, oldFirstCell); if ( size != 1 ) { oldFirstCell.excise(); oldFirstCell.putBetween(anchor.prev, anchor); } return oldFirstData; }
[ "public", "ZipFileData", "addLast", "(", "ZipFileData", "newLastData", ",", "int", "maximumSize", ")", "{", "String", "newLastPath", "=", "newLastData", ".", "path", ";", "Cell", "dupCell", "=", "cells", ".", "get", "(", "newLastPath", ")", ";", "if", "(", ...
Add data as the last data of the store. If the addition pushes a cell out of the list, answer the data of the cell which was removed. Throw an exception if the path of the new data is already stored. @param newLastData The new data to add as the last data of the store. @param maximumSize The maximum size of the store. '-1' to allow the store to grow indefinitely. @return Data which was removed from the store. Null if the store maximum size has not yet been reached.
[ "Add", "data", "as", "the", "last", "data", "of", "the", "store", ".", "If", "the", "addition", "pushes", "a", "cell", "out", "of", "the", "list", "answer", "the", "data", "of", "the", "cell", "which", "was", "removed", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.artifact.zip/src/com/ibm/ws/artifact/zip/cache/internal/ZipFileDataStore.java#L325-L358
atomix/atomix
utils/src/main/java/io/atomix/utils/time/Versioned.java
Versioned.valueOrElse
public static <U> U valueOrElse(Versioned<U> versioned, U defaultValue) { return versioned == null ? defaultValue : versioned.value(); }
java
public static <U> U valueOrElse(Versioned<U> versioned, U defaultValue) { return versioned == null ? defaultValue : versioned.value(); }
[ "public", "static", "<", "U", ">", "U", "valueOrElse", "(", "Versioned", "<", "U", ">", "versioned", ",", "U", "defaultValue", ")", "{", "return", "versioned", "==", "null", "?", "defaultValue", ":", "versioned", ".", "value", "(", ")", ";", "}" ]
Returns the value of the specified Versioned object if non-null or else returns a default value. @param versioned versioned object @param defaultValue default value to return if versioned object is null @param <U> type of the versioned value @return versioned value or default value if versioned object is null
[ "Returns", "the", "value", "of", "the", "specified", "Versioned", "object", "if", "non", "-", "null", "or", "else", "returns", "a", "default", "value", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/utils/src/main/java/io/atomix/utils/time/Versioned.java#L114-L116
voldemort/voldemort
src/java/voldemort/utils/RebalanceUtils.java
RebalanceUtils.printBatchTaskLog
public static void printBatchTaskLog(int batchId, int taskId, Logger logger, String message) { logger.info("[Rebalance batch/task id " + batchId + "/" + taskId + "] " + message); }
java
public static void printBatchTaskLog(int batchId, int taskId, Logger logger, String message) { logger.info("[Rebalance batch/task id " + batchId + "/" + taskId + "] " + message); }
[ "public", "static", "void", "printBatchTaskLog", "(", "int", "batchId", ",", "int", "taskId", ",", "Logger", "logger", ",", "String", "message", ")", "{", "logger", ".", "info", "(", "\"[Rebalance batch/task id \"", "+", "batchId", "+", "\"/\"", "+", "taskId",...
Print log to the following logger ( Info level ) @param batchId @param taskId @param logger @param message
[ "Print", "log", "to", "the", "following", "logger", "(", "Info", "level", ")" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/RebalanceUtils.java#L464-L466
alkacon/opencms-core
src/org/opencms/xml/CmsXmlContentDefinition.java
CmsXmlContentDefinition.validateAttribute
protected static String validateAttribute(Element element, String attributeName, String requiredValue) throws CmsXmlException { Attribute attribute = element.attribute(attributeName); if (attribute == null) { throw new CmsXmlException( Messages.get().container(Messages.ERR_EL_MISSING_ATTRIBUTE_2, element.getUniquePath(), attributeName)); } String value = attribute.getValue(); if (requiredValue == null) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(value) || !value.equals(value.trim())) { throw new CmsXmlException( Messages.get().container( Messages.ERR_EL_BAD_ATTRIBUTE_WS_3, element.getUniquePath(), attributeName, value)); } } else { if (!requiredValue.equals(value)) { throw new CmsXmlException( Messages.get().container( Messages.ERR_EL_BAD_ATTRIBUTE_VALUE_4, new Object[] {element.getUniquePath(), attributeName, requiredValue, value})); } } return value; }
java
protected static String validateAttribute(Element element, String attributeName, String requiredValue) throws CmsXmlException { Attribute attribute = element.attribute(attributeName); if (attribute == null) { throw new CmsXmlException( Messages.get().container(Messages.ERR_EL_MISSING_ATTRIBUTE_2, element.getUniquePath(), attributeName)); } String value = attribute.getValue(); if (requiredValue == null) { if (CmsStringUtil.isEmptyOrWhitespaceOnly(value) || !value.equals(value.trim())) { throw new CmsXmlException( Messages.get().container( Messages.ERR_EL_BAD_ATTRIBUTE_WS_3, element.getUniquePath(), attributeName, value)); } } else { if (!requiredValue.equals(value)) { throw new CmsXmlException( Messages.get().container( Messages.ERR_EL_BAD_ATTRIBUTE_VALUE_4, new Object[] {element.getUniquePath(), attributeName, requiredValue, value})); } } return value; }
[ "protected", "static", "String", "validateAttribute", "(", "Element", "element", ",", "String", "attributeName", ",", "String", "requiredValue", ")", "throws", "CmsXmlException", "{", "Attribute", "attribute", "=", "element", ".", "attribute", "(", "attributeName", ...
Validates if a given attribute exists at the given element with an (optional) specified value.<p> If the required value is not <code>null</code>, the attribute must have exactly this value set.<p> If no value is required, some simple validation is performed on the attribute value, like a check that the value does not have leading or trailing white spaces.<p> @param element the element to validate @param attributeName the attribute to check for @param requiredValue the required value of the attribute, or <code>null</code> if any value is allowed @return the value of the attribute @throws CmsXmlException if the element does not have the required attribute set, or if the validation fails
[ "Validates", "if", "a", "given", "attribute", "exists", "at", "the", "given", "element", "with", "an", "(", "optional", ")", "specified", "value", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/CmsXmlContentDefinition.java#L555-L583
brettwooldridge/SansOrm
src/main/java/com/zaxxer/sansorm/SqlClosureElf.java
SqlClosureElf.executeUpdate
public static int executeUpdate(final String sql, final Object... args) { return SqlClosure.sqlExecute(c -> executeUpdate(c, sql, args)); }
java
public static int executeUpdate(final String sql, final Object... args) { return SqlClosure.sqlExecute(c -> executeUpdate(c, sql, args)); }
[ "public", "static", "int", "executeUpdate", "(", "final", "String", "sql", ",", "final", "Object", "...", "args", ")", "{", "return", "SqlClosure", ".", "sqlExecute", "(", "c", "->", "executeUpdate", "(", "c", ",", "sql", ",", "args", ")", ")", ";", "}...
Executes an update or insert statement. @param sql The SQL to execute. @param args The query parameters used @return the number of rows updated
[ "Executes", "an", "update", "or", "insert", "statement", "." ]
train
https://github.com/brettwooldridge/SansOrm/blob/ab22721db79c5f20c0e8483f09eda2844d596557/src/main/java/com/zaxxer/sansorm/SqlClosureElf.java#L153-L156
Azure/azure-sdk-for-java
storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/StorageAccountsInner.java
StorageAccountsInner.beginFailover
public void beginFailover(String resourceGroupName, String accountName) { beginFailoverWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
java
public void beginFailover(String resourceGroupName, String accountName) { beginFailoverWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body(); }
[ "public", "void", "beginFailover", "(", "String", "resourceGroupName", ",", "String", "accountName", ")", "{", "beginFailoverWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "b...
Failover request can be triggered for a storage account in case of availability issues. The failover occurs from the storage account's primary cluster to secondary cluster for RA-GRS accounts. The secondary cluster will become primary after failover. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @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
[ "Failover", "request", "can", "be", "triggered", "for", "a", "storage", "account", "in", "case", "of", "availability", "issues", ".", "The", "failover", "occurs", "from", "the", "storage", "account", "s", "primary", "cluster", "to", "secondary", "cluster", "fo...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_11_01/src/main/java/com/microsoft/azure/management/storage/v2018_11_01/implementation/StorageAccountsInner.java#L1353-L1355
j256/ormlite-android
src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java
OrmLiteConfigUtil.writeConfigFile
public static void writeConfigFile(File configFile, Class<?>[] classes, boolean sortClasses) throws SQLException, IOException { System.out.println("Writing configurations to " + configFile.getAbsolutePath()); writeConfigFile(new FileOutputStream(configFile), classes, sortClasses); }
java
public static void writeConfigFile(File configFile, Class<?>[] classes, boolean sortClasses) throws SQLException, IOException { System.out.println("Writing configurations to " + configFile.getAbsolutePath()); writeConfigFile(new FileOutputStream(configFile), classes, sortClasses); }
[ "public", "static", "void", "writeConfigFile", "(", "File", "configFile", ",", "Class", "<", "?", ">", "[", "]", "classes", ",", "boolean", "sortClasses", ")", "throws", "SQLException", ",", "IOException", "{", "System", ".", "out", ".", "println", "(", "\...
Write a configuration file with the configuration for classes. @param sortClasses Set to true to sort the classes by name before the file is generated.
[ "Write", "a", "configuration", "file", "with", "the", "configuration", "for", "classes", "." ]
train
https://github.com/j256/ormlite-android/blob/e82327a868ae242f994730fe2389f79684d7bcab/src/main/java/com/j256/ormlite/android/apptools/OrmLiteConfigUtil.java#L196-L200
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java
BackendConnection.getConnections
public List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize) throws SQLException { if (stateHandler.isInTransaction()) { return getConnectionsWithTransaction(connectionMode, dataSourceName, connectionSize); } else { return getConnectionsWithoutTransaction(connectionMode, dataSourceName, connectionSize); } }
java
public List<Connection> getConnections(final ConnectionMode connectionMode, final String dataSourceName, final int connectionSize) throws SQLException { if (stateHandler.isInTransaction()) { return getConnectionsWithTransaction(connectionMode, dataSourceName, connectionSize); } else { return getConnectionsWithoutTransaction(connectionMode, dataSourceName, connectionSize); } }
[ "public", "List", "<", "Connection", ">", "getConnections", "(", "final", "ConnectionMode", "connectionMode", ",", "final", "String", "dataSourceName", ",", "final", "int", "connectionSize", ")", "throws", "SQLException", "{", "if", "(", "stateHandler", ".", "isIn...
Get connections of current thread datasource. @param connectionMode connection mode @param dataSourceName data source name @param connectionSize size of connections to be get @return connections @throws SQLException SQL exception
[ "Get", "connections", "of", "current", "thread", "datasource", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/connection/BackendConnection.java#L137-L143
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java
PyExpressionGenerator._generate
@SuppressWarnings("static-method") protected XExpression _generate(SarlContinueExpression continueStatement, IAppendable it, IExtraLanguageGeneratorContext context) { if (context.getExpectedExpressionType() == null) { it.append("continue"); //$NON-NLS-1$ } else { it.append("return ").append(toDefaultValue(context.getExpectedExpressionType().toJavaCompliantTypeReference())); //$NON-NLS-1$ } return continueStatement; }
java
@SuppressWarnings("static-method") protected XExpression _generate(SarlContinueExpression continueStatement, IAppendable it, IExtraLanguageGeneratorContext context) { if (context.getExpectedExpressionType() == null) { it.append("continue"); //$NON-NLS-1$ } else { it.append("return ").append(toDefaultValue(context.getExpectedExpressionType().toJavaCompliantTypeReference())); //$NON-NLS-1$ } return continueStatement; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "XExpression", "_generate", "(", "SarlContinueExpression", "continueStatement", ",", "IAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "if", "(", "context", ".", "getExpe...
Generate the given object. @param continueStatement the continue statement. @param it the target for the generated content. @param context the context. @return the statement.
[ "Generate", "the", "given", "object", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyExpressionGenerator.java#L382-L390
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.createFlowVariable
public FlowVariable createFlowVariable(final Flow flow, final String id, final Class type) { val opt = Arrays.stream(flow.getVariables()).filter(v -> v.getName().equalsIgnoreCase(id)).findFirst(); if (opt.isPresent()) { return opt.get(); } val flowVar = new FlowVariable(id, new BeanFactoryVariableValueFactory(type, applicationContext.getAutowireCapableBeanFactory())); flow.addVariable(flowVar); return flowVar; }
java
public FlowVariable createFlowVariable(final Flow flow, final String id, final Class type) { val opt = Arrays.stream(flow.getVariables()).filter(v -> v.getName().equalsIgnoreCase(id)).findFirst(); if (opt.isPresent()) { return opt.get(); } val flowVar = new FlowVariable(id, new BeanFactoryVariableValueFactory(type, applicationContext.getAutowireCapableBeanFactory())); flow.addVariable(flowVar); return flowVar; }
[ "public", "FlowVariable", "createFlowVariable", "(", "final", "Flow", "flow", ",", "final", "String", "id", ",", "final", "Class", "type", ")", "{", "val", "opt", "=", "Arrays", ".", "stream", "(", "flow", ".", "getVariables", "(", ")", ")", ".", "filter...
Create flow variable flow variable. @param flow the flow @param id the id @param type the type @return the flow variable
[ "Create", "flow", "variable", "flow", "variable", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L591-L599
nlalevee/jsourcemap
jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java
SourceMapGenerator.addMapping
public void addMapping(Mapping aArgs) { Position generated = aArgs.generated; Position original = aArgs.original; String source = aArgs.source; String name = aArgs.name; if (source != null && !this._sources.has(source)) { _sources.add(source, false); } if (name != null && !this._names.has(name)) { _names.add(name, false); } _mappings.add(new Mapping(generated, original, source, name)); }
java
public void addMapping(Mapping aArgs) { Position generated = aArgs.generated; Position original = aArgs.original; String source = aArgs.source; String name = aArgs.name; if (source != null && !this._sources.has(source)) { _sources.add(source, false); } if (name != null && !this._names.has(name)) { _names.add(name, false); } _mappings.add(new Mapping(generated, original, source, name)); }
[ "public", "void", "addMapping", "(", "Mapping", "aArgs", ")", "{", "Position", "generated", "=", "aArgs", ".", "generated", ";", "Position", "original", "=", "aArgs", ".", "original", ";", "String", "source", "=", "aArgs", ".", "source", ";", "String", "na...
Add a single mapping from original source line and column to the generated source's line and column for this source map being created. The mapping object should have the following properties: <ul> <li>generated: An object with the generated line and column positions.</li> <li>original: An object with the original line and column positions.</li> <li>source: The original source file (relative to the sourceRoot).</li> <li>name: An optional original token name for this mapping.</li> </ul>
[ "Add", "a", "single", "mapping", "from", "original", "source", "line", "and", "column", "to", "the", "generated", "source", "s", "line", "and", "column", "for", "this", "source", "map", "being", "created", ".", "The", "mapping", "object", "should", "have", ...
train
https://github.com/nlalevee/jsourcemap/blob/361a99c73d51c11afa5579dd83d477c4d0345599/jsourcemap/src/java/org/hibnet/jsourcemap/SourceMapGenerator.java#L93-L106
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/query/CountOptions.java
CountOptions.maxTime
public CountOptions maxTime(final long maxTime, final TimeUnit timeUnit) { notNull("timeUnit", timeUnit); options.maxTime(maxTime, timeUnit); return this; }
java
public CountOptions maxTime(final long maxTime, final TimeUnit timeUnit) { notNull("timeUnit", timeUnit); options.maxTime(maxTime, timeUnit); return this; }
[ "public", "CountOptions", "maxTime", "(", "final", "long", "maxTime", ",", "final", "TimeUnit", "timeUnit", ")", "{", "notNull", "(", "\"timeUnit\"", ",", "timeUnit", ")", ";", "options", ".", "maxTime", "(", "maxTime", ",", "timeUnit", ")", ";", "return", ...
Sets the maximum execution time on the server for this operation. @param maxTime the max time @param timeUnit the time unit, which may not be null @return this
[ "Sets", "the", "maximum", "execution", "time", "on", "the", "server", "for", "this", "operation", "." ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/query/CountOptions.java#L164-L168
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.freefax_new_GET
public OvhOrder freefax_new_GET(OvhQuantityEnum quantity) throws IOException { String qPath = "/order/freefax/new"; StringBuilder sb = path(qPath); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder freefax_new_GET(OvhQuantityEnum quantity) throws IOException { String qPath = "/order/freefax/new"; StringBuilder sb = path(qPath); query(sb, "quantity", quantity); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "freefax_new_GET", "(", "OvhQuantityEnum", "quantity", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/freefax/new\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"quantit...
Get prices and contracts information REST: GET /order/freefax/new @param quantity [required] Fax quantity possibilities to purchase
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1011-L1017
pmlopes/yoke
framework/src/main/java/com/jetdrone/vertx/yoke/middleware/Static.java
Static.sendFile
private void sendFile(final YokeRequest request, final String file, final FileProps props) { // write content type String contentType = MimeType.getMime(file); String charset = MimeType.getCharset(contentType); request.response().setContentType(contentType, charset); request.response().putHeader("Content-Length", Long.toString(props.size())); // head support if (HttpMethod.HEAD.equals(request.method())) { request.response().end(); } else { request.response().sendFile(file); } }
java
private void sendFile(final YokeRequest request, final String file, final FileProps props) { // write content type String contentType = MimeType.getMime(file); String charset = MimeType.getCharset(contentType); request.response().setContentType(contentType, charset); request.response().putHeader("Content-Length", Long.toString(props.size())); // head support if (HttpMethod.HEAD.equals(request.method())) { request.response().end(); } else { request.response().sendFile(file); } }
[ "private", "void", "sendFile", "(", "final", "YokeRequest", "request", ",", "final", "String", "file", ",", "final", "FileProps", "props", ")", "{", "// write content type", "String", "contentType", "=", "MimeType", ".", "getMime", "(", "file", ")", ";", "Stri...
Write a file into the response body @param request @param file @param props
[ "Write", "a", "file", "into", "the", "response", "body" ]
train
https://github.com/pmlopes/yoke/blob/fe8a64036f09fb745f0644faddd46162d64faf3c/framework/src/main/java/com/jetdrone/vertx/yoke/middleware/Static.java#L175-L188
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/domain/controller/operations/SyncServerGroupOperationHandler.java
SyncServerGroupOperationHandler.createRegistry
@Override Transformers.ResourceIgnoredTransformationRegistry createRegistry(OperationContext context, Resource remote, Set<String> remoteExtensions) { final ReadMasterDomainModelUtil.RequiredConfigurationHolder rc = new ReadMasterDomainModelUtil.RequiredConfigurationHolder(); final PathElement host = PathElement.pathElement(HOST, localHostName); final Resource hostModel = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS.append(host)); final Resource original = this.originalModel; // Process the required using the remote model to include content which may not be available locally ReadMasterDomainModelUtil.processHostModel(rc, remote, hostModel, parameters.getExtensionRegistry()); // Process the original ReadMasterDomainModelUtil.processHostModel(rc, original, original.getChild(host), parameters.getExtensionRegistry()); final Transformers.ResourceIgnoredTransformationRegistry delegate = new Transformers.ResourceIgnoredTransformationRegistry() { @Override public boolean isResourceTransformationIgnored(PathAddress address) { return parameters.getIgnoredResourceRegistry().isResourceExcluded(address); } }; return ReadMasterDomainModelUtil.createServerIgnoredRegistry(rc, delegate); }
java
@Override Transformers.ResourceIgnoredTransformationRegistry createRegistry(OperationContext context, Resource remote, Set<String> remoteExtensions) { final ReadMasterDomainModelUtil.RequiredConfigurationHolder rc = new ReadMasterDomainModelUtil.RequiredConfigurationHolder(); final PathElement host = PathElement.pathElement(HOST, localHostName); final Resource hostModel = context.readResourceFromRoot(PathAddress.EMPTY_ADDRESS.append(host)); final Resource original = this.originalModel; // Process the required using the remote model to include content which may not be available locally ReadMasterDomainModelUtil.processHostModel(rc, remote, hostModel, parameters.getExtensionRegistry()); // Process the original ReadMasterDomainModelUtil.processHostModel(rc, original, original.getChild(host), parameters.getExtensionRegistry()); final Transformers.ResourceIgnoredTransformationRegistry delegate = new Transformers.ResourceIgnoredTransformationRegistry() { @Override public boolean isResourceTransformationIgnored(PathAddress address) { return parameters.getIgnoredResourceRegistry().isResourceExcluded(address); } }; return ReadMasterDomainModelUtil.createServerIgnoredRegistry(rc, delegate); }
[ "@", "Override", "Transformers", ".", "ResourceIgnoredTransformationRegistry", "createRegistry", "(", "OperationContext", "context", ",", "Resource", "remote", ",", "Set", "<", "String", ">", "remoteExtensions", ")", "{", "final", "ReadMasterDomainModelUtil", ".", "Requ...
For the local model we include both the original as well as the remote model. The diff will automatically remove not used configuration. @param context the operation context @param remote the remote model @param remoteExtensions the extension registry @return
[ "For", "the", "local", "model", "we", "include", "both", "the", "original", "as", "well", "as", "the", "remote", "model", ".", "The", "diff", "will", "automatically", "remove", "not", "used", "configuration", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/domain/controller/operations/SyncServerGroupOperationHandler.java#L68-L88
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.dedicated_server_serviceName_ipMigration_GET
public ArrayList<String> dedicated_server_serviceName_ipMigration_GET(String serviceName, String ip, String token) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/ipMigration"; StringBuilder sb = path(qPath, serviceName); query(sb, "ip", ip); query(sb, "token", token); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> dedicated_server_serviceName_ipMigration_GET(String serviceName, String ip, String token) throws IOException { String qPath = "/order/dedicated/server/{serviceName}/ipMigration"; StringBuilder sb = path(qPath, serviceName); query(sb, "ip", ip); query(sb, "token", token); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "dedicated_server_serviceName_ipMigration_GET", "(", "String", "serviceName", ",", "String", "ip", ",", "String", "token", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/dedicated/server/{serviceName}/ipMigr...
Get allowed durations for 'ipMigration' option REST: GET /order/dedicated/server/{serviceName}/ipMigration @param ip [required] The IP to move to this server @param token [required] IP migration token @param serviceName [required] The internal name of your dedicated server
[ "Get", "allowed", "durations", "for", "ipMigration", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L2554-L2561
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/content/documentlists/ViewUrl.java
ViewUrl.getViewDocumentsUrl
public static MozuUrl getViewDocumentsUrl(String documentListName, String filter, Boolean includeInactive, Integer pageSize, String responseFields, String sortBy, Integer startIndex, String viewName) { UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/views/{viewName}/documents?filter={filter}&sortBy={sortBy}&pageSize={pageSize}&startIndex={startIndex}&includeInactive={includeInactive}&responseFields={responseFields}"); formatter.formatUrl("documentListName", documentListName); formatter.formatUrl("filter", filter); formatter.formatUrl("includeInactive", includeInactive); formatter.formatUrl("pageSize", pageSize); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("sortBy", sortBy); formatter.formatUrl("startIndex", startIndex); formatter.formatUrl("viewName", viewName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getViewDocumentsUrl(String documentListName, String filter, Boolean includeInactive, Integer pageSize, String responseFields, String sortBy, Integer startIndex, String viewName) { UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/views/{viewName}/documents?filter={filter}&sortBy={sortBy}&pageSize={pageSize}&startIndex={startIndex}&includeInactive={includeInactive}&responseFields={responseFields}"); formatter.formatUrl("documentListName", documentListName); formatter.formatUrl("filter", filter); formatter.formatUrl("includeInactive", includeInactive); formatter.formatUrl("pageSize", pageSize); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("sortBy", sortBy); formatter.formatUrl("startIndex", startIndex); formatter.formatUrl("viewName", viewName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getViewDocumentsUrl", "(", "String", "documentListName", ",", "String", "filter", ",", "Boolean", "includeInactive", ",", "Integer", "pageSize", ",", "String", "responseFields", ",", "String", "sortBy", ",", "Integer", "startIndex", "...
Get Resource Url for GetViewDocuments @param documentListName Name of content documentListName to delete @param filter A set of filter expressions representing the search parameters for a query. This parameter is optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for a list of supported filters. @param includeInactive Include inactive content. @param pageSize When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with this parameter set to 25, to get the 51st through the 75th items, set startIndex to 50. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param sortBy The element to sort the results by and the channel in which the results appear. Either ascending (a-z) or descending (z-a) channel. Optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for more information. @param startIndex When creating paged results from a query, this value indicates the zero-based offset in the complete result set where the returned entities begin. For example, with pageSize set to 25, to get the 51st through the 75th items, set this parameter to 50. @param viewName The name for a view. Views are used to render data in , such as document and entity lists. Each view includes a schema, format, name, ID, and associated data types to render. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetViewDocuments" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/content/documentlists/ViewUrl.java#L28-L40
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.getAndCheckActionImport
public static ActionImport getAndCheckActionImport(EntityDataModel entityDataModel, String actionImportName) { ActionImport actionImport = entityDataModel.getEntityContainer().getActionImport(actionImportName); if (actionImport == null) { throw new ODataSystemException("Action import not found in the entity data model: " + actionImportName); } return actionImport; }
java
public static ActionImport getAndCheckActionImport(EntityDataModel entityDataModel, String actionImportName) { ActionImport actionImport = entityDataModel.getEntityContainer().getActionImport(actionImportName); if (actionImport == null) { throw new ODataSystemException("Action import not found in the entity data model: " + actionImportName); } return actionImport; }
[ "public", "static", "ActionImport", "getAndCheckActionImport", "(", "EntityDataModel", "entityDataModel", ",", "String", "actionImportName", ")", "{", "ActionImport", "actionImport", "=", "entityDataModel", ".", "getEntityContainer", "(", ")", ".", "getActionImport", "(",...
Gets the action import by the specified name, throw an exception if no action import with the specified name exists. @param entityDataModel The entity data model. @param actionImportName The name of action import. @return The instance of action import.
[ "Gets", "the", "action", "import", "by", "the", "specified", "name", "throw", "an", "exception", "if", "no", "action", "import", "with", "the", "specified", "name", "exists", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L631-L638
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/extractor/AbstractCodeElementExtractor.java
AbstractCodeElementExtractor.findAction
protected static Action findAction(EObject grammarComponent, String assignmentName) { for (final Action action : GrammarUtil.containedActions(grammarComponent)) { if (GrammarUtil.isAssignedAction(action)) { if (Objects.equals(assignmentName, action.getFeature())) { return action; } } } return null; }
java
protected static Action findAction(EObject grammarComponent, String assignmentName) { for (final Action action : GrammarUtil.containedActions(grammarComponent)) { if (GrammarUtil.isAssignedAction(action)) { if (Objects.equals(assignmentName, action.getFeature())) { return action; } } } return null; }
[ "protected", "static", "Action", "findAction", "(", "EObject", "grammarComponent", ",", "String", "assignmentName", ")", "{", "for", "(", "final", "Action", "action", ":", "GrammarUtil", ".", "containedActions", "(", "grammarComponent", ")", ")", "{", "if", "(",...
Replies the assignment component with the given nazme in the given grammar component. @param grammarComponent the component to explore. @param assignmentName the name of the assignment to search for. @return the assignment component.
[ "Replies", "the", "assignment", "component", "with", "the", "given", "nazme", "in", "the", "given", "grammar", "component", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/extractor/AbstractCodeElementExtractor.java#L112-L121
j-easy/easy-random
easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java
ReflectionUtils.getAnnotation
public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationType) { return field.getAnnotation(annotationType) == null ? getAnnotationFromReadMethod(getReadMethod(field).orElse(null), annotationType) : field.getAnnotation(annotationType); }
java
public static <T extends Annotation> T getAnnotation(Field field, Class<T> annotationType) { return field.getAnnotation(annotationType) == null ? getAnnotationFromReadMethod(getReadMethod(field).orElse(null), annotationType) : field.getAnnotation(annotationType); }
[ "public", "static", "<", "T", "extends", "Annotation", ">", "T", "getAnnotation", "(", "Field", "field", ",", "Class", "<", "T", ">", "annotationType", ")", "{", "return", "field", ".", "getAnnotation", "(", "annotationType", ")", "==", "null", "?", "getAn...
Looks for given annotationType on given field or read method for field. @param field field to check @param annotationType Type of annotation you're looking for. @param <T> the actual type of annotation @return given annotation if field or read method has this annotation or null.
[ "Looks", "for", "given", "annotationType", "on", "given", "field", "or", "read", "method", "for", "field", "." ]
train
https://github.com/j-easy/easy-random/blob/816b0d6a74c7288af111e70ae1b0b57d7fe3b59d/easy-random-core/src/main/java/org/jeasy/random/util/ReflectionUtils.java#L407-L410
seedstack/i18n-addon
rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java
AbstractI18nRestIT.httpGet
protected Response httpGet(String path, int statusCode) { return httpRequest(statusCode, null).get(baseURL + PATH_PREFIX + path); }
java
protected Response httpGet(String path, int statusCode) { return httpRequest(statusCode, null).get(baseURL + PATH_PREFIX + path); }
[ "protected", "Response", "httpGet", "(", "String", "path", ",", "int", "statusCode", ")", "{", "return", "httpRequest", "(", "statusCode", ",", "null", ")", ".", "get", "(", "baseURL", "+", "PATH_PREFIX", "+", "path", ")", ";", "}" ]
Gets the resource at the path and expect the given status code. @param path the resource URI @return the http response
[ "Gets", "the", "resource", "at", "the", "path", "and", "expect", "the", "given", "status", "code", "." ]
train
https://github.com/seedstack/i18n-addon/blob/1e65101d8554623f09bda2497b0151fd10a16615/rest/src/it/java/org/seedstack/i18n/shared/AbstractI18nRestIT.java#L59-L61
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
Assert.checkBetween
public static Number checkBetween(Number value, Number min, Number max) { notNull(value); notNull(min); notNull(max); double valueDouble = value.doubleValue(); double minDouble = min.doubleValue(); double maxDouble = max.doubleValue(); if (valueDouble < minDouble || valueDouble > maxDouble) { throw new IllegalArgumentException(StrUtil.format("Length must be between {} and {}.", min, max)); } return value; }
java
public static Number checkBetween(Number value, Number min, Number max) { notNull(value); notNull(min); notNull(max); double valueDouble = value.doubleValue(); double minDouble = min.doubleValue(); double maxDouble = max.doubleValue(); if (valueDouble < minDouble || valueDouble > maxDouble) { throw new IllegalArgumentException(StrUtil.format("Length must be between {} and {}.", min, max)); } return value; }
[ "public", "static", "Number", "checkBetween", "(", "Number", "value", ",", "Number", "min", ",", "Number", "max", ")", "{", "notNull", "(", "value", ")", ";", "notNull", "(", "min", ")", ";", "notNull", "(", "max", ")", ";", "double", "valueDouble", "=...
检查值是否在指定范围内 @param value 值 @param min 最小值(包含) @param max 最大值(包含) @return 检查后的长度值 @since 4.1.10
[ "检查值是否在指定范围内" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L622-L633
googleads/googleads-java-lib
examples/adwords_axis/src/main/java/adwords/axis/v201809/advancedoperations/AddResponsiveDisplayAd.java
AddResponsiveDisplayAd.uploadImage
private static long uploadImage(MediaServiceInterface mediaService, String url) throws IOException { // Create image. Image image = new Image(); image.setType(MediaMediaType.IMAGE); image.setData(com.google.api.ads.common.lib.utils.Media.getMediaDataFromUrl(url)); // Upload image. Image uploadedImage = (Image) mediaService.upload(new Media[] {image})[0]; return uploadedImage.getMediaId(); }
java
private static long uploadImage(MediaServiceInterface mediaService, String url) throws IOException { // Create image. Image image = new Image(); image.setType(MediaMediaType.IMAGE); image.setData(com.google.api.ads.common.lib.utils.Media.getMediaDataFromUrl(url)); // Upload image. Image uploadedImage = (Image) mediaService.upload(new Media[] {image})[0]; return uploadedImage.getMediaId(); }
[ "private", "static", "long", "uploadImage", "(", "MediaServiceInterface", "mediaService", ",", "String", "url", ")", "throws", "IOException", "{", "// Create image.", "Image", "image", "=", "new", "Image", "(", ")", ";", "image", ".", "setType", "(", "MediaMedia...
Uploads the image from the specified {@code url} via {@code MediaService}. @return the {@code mediaId} of the uploaded image.
[ "Uploads", "the", "image", "from", "the", "specified", "{", "@code", "url", "}", "via", "{", "@code", "MediaService", "}", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/adwords_axis/src/main/java/adwords/axis/v201809/advancedoperations/AddResponsiveDisplayAd.java#L241-L251
micronaut-projects/micronaut-core
cli/src/main/groovy/io/micronaut/cli/util/NameUtils.java
NameUtils.getClassName
public static String getClassName(String logicalName, String trailingName) { if (isBlank(logicalName)) { throw new IllegalArgumentException("Argument [logicalName] cannot be null or blank"); } String className = logicalName.substring(0, 1).toUpperCase(Locale.ENGLISH) + logicalName.substring(1); if (trailingName != null) { className = className + trailingName; } return className; }
java
public static String getClassName(String logicalName, String trailingName) { if (isBlank(logicalName)) { throw new IllegalArgumentException("Argument [logicalName] cannot be null or blank"); } String className = logicalName.substring(0, 1).toUpperCase(Locale.ENGLISH) + logicalName.substring(1); if (trailingName != null) { className = className + trailingName; } return className; }
[ "public", "static", "String", "getClassName", "(", "String", "logicalName", ",", "String", "trailingName", ")", "{", "if", "(", "isBlank", "(", "logicalName", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Argument [logicalName] cannot be null or b...
Returns the class name for the given logical name and trailing name. For example "person" and "Controller" would evaluate to "PersonController". @param logicalName The logical name @param trailingName The trailing name @return The class name
[ "Returns", "the", "class", "name", "for", "the", "given", "logical", "name", "and", "trailing", "name", ".", "For", "example", "person", "and", "Controller", "would", "evaluate", "to", "PersonController", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/cli/src/main/groovy/io/micronaut/cli/util/NameUtils.java#L92-L102
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/authorization/providers/PoliciesCache.java
PoliciesCache.fromSourceProvider
public static PoliciesCache fromSourceProvider( final SourceProvider provider, final Set<Attribute> forcedContext ) { return new PoliciesCache(provider, forcedContext); }
java
public static PoliciesCache fromSourceProvider( final SourceProvider provider, final Set<Attribute> forcedContext ) { return new PoliciesCache(provider, forcedContext); }
[ "public", "static", "PoliciesCache", "fromSourceProvider", "(", "final", "SourceProvider", "provider", ",", "final", "Set", "<", "Attribute", ">", "forcedContext", ")", "{", "return", "new", "PoliciesCache", "(", "provider", ",", "forcedContext", ")", ";", "}" ]
Create from a provider with a forced context @param provider source provider @param forcedContext forced context @return policies cache
[ "Create", "from", "a", "provider", "with", "a", "forced", "context" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/authorization/providers/PoliciesCache.java#L175-L181
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.writeDouble
public static void writeDouble(double num, DataOutput out) throws IOException { writeLong(Double.doubleToLongBits(num), out); }
java
public static void writeDouble(double num, DataOutput out) throws IOException { writeLong(Double.doubleToLongBits(num), out); }
[ "public", "static", "void", "writeDouble", "(", "double", "num", ",", "DataOutput", "out", ")", "throws", "IOException", "{", "writeLong", "(", "Double", ".", "doubleToLongBits", "(", "num", ")", ",", "out", ")", ";", "}" ]
Writes a double to an output stream @param num the double to be written @param out the output stream
[ "Writes", "a", "double", "to", "an", "output", "stream" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L548-L550
att/AAF
authz/authz-core/src/main/java/com/att/cssa/rserv/Route.java
Route.contentRelatedTo
public String contentRelatedTo(HttpCode<TRANS, ?> code) { StringBuilder sb = new StringBuilder(path); sb.append(' '); content.relatedTo(code, sb); return sb.toString(); }
java
public String contentRelatedTo(HttpCode<TRANS, ?> code) { StringBuilder sb = new StringBuilder(path); sb.append(' '); content.relatedTo(code, sb); return sb.toString(); }
[ "public", "String", "contentRelatedTo", "(", "HttpCode", "<", "TRANS", ",", "?", ">", "code", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "path", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ";", "content", ".", "relatedTo"...
contentRelatedTo (For reporting) list routes that will end up at a specific Code @return
[ "contentRelatedTo", "(", "For", "reporting", ")", "list", "routes", "that", "will", "end", "up", "at", "a", "specific", "Code" ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-core/src/main/java/com/att/cssa/rserv/Route.java#L117-L122
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java
JBBPMapper.setFieldValue
private static void setFieldValue(final Object classInstance, final Field classField, final JBBPAbstractField binField, final Object value) { try { classField.set(classInstance, value); } catch (IllegalArgumentException ex) { throw new JBBPMapperException("Can't set value to a mapping field", binField, classInstance.getClass(), classField, ex); } catch (IllegalAccessException ex) { throw new JBBPMapperException("Can't get access to a mapping field", binField, classInstance.getClass(), classField, ex); } }
java
private static void setFieldValue(final Object classInstance, final Field classField, final JBBPAbstractField binField, final Object value) { try { classField.set(classInstance, value); } catch (IllegalArgumentException ex) { throw new JBBPMapperException("Can't set value to a mapping field", binField, classInstance.getClass(), classField, ex); } catch (IllegalAccessException ex) { throw new JBBPMapperException("Can't get access to a mapping field", binField, classInstance.getClass(), classField, ex); } }
[ "private", "static", "void", "setFieldValue", "(", "final", "Object", "classInstance", ",", "final", "Field", "classField", ",", "final", "JBBPAbstractField", "binField", ",", "final", "Object", "value", ")", "{", "try", "{", "classField", ".", "set", "(", "cl...
Set a value to a field of a class instance. Can't be used for static fields! @param classInstance a class instance @param classField a mapping class field which should be set by the value, must not be null @param binField a parsed bin field which value will be set, can be null @param value a value to be set to the class field
[ "Set", "a", "value", "to", "a", "field", "of", "a", "class", "instance", ".", "Can", "t", "be", "used", "for", "static", "fields!" ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/mapper/JBBPMapper.java#L471-L479
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/VecmathUtil.java
VecmathUtil.newUnitVector
static Vector2d newUnitVector(final IAtom atom, final IBond bond) { return newUnitVector(atom.getPoint2d(), bond.getOther(atom).getPoint2d()); }
java
static Vector2d newUnitVector(final IAtom atom, final IBond bond) { return newUnitVector(atom.getPoint2d(), bond.getOther(atom).getPoint2d()); }
[ "static", "Vector2d", "newUnitVector", "(", "final", "IAtom", "atom", ",", "final", "IBond", "bond", ")", "{", "return", "newUnitVector", "(", "atom", ".", "getPoint2d", "(", ")", ",", "bond", ".", "getOther", "(", "atom", ")", ".", "getPoint2d", "(", ")...
Create a unit vector for a bond with the start point being the specified atom. @param atom start of vector @param bond the bond used to create the vector @return unit vector
[ "Create", "a", "unit", "vector", "for", "a", "bond", "with", "the", "start", "point", "being", "the", "specified", "atom", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/generators/standard/VecmathUtil.java#L93-L95
unic/neba
core/src/main/java/io/neba/core/resourcemodels/mapping/FieldValueMappingCallback.java
FieldValueMappingCallback.resolvePropertyTypedValue
private <T> T resolvePropertyTypedValue(FieldData field, Class<T> propertyType) { if (field.isAbsolute() || field.isRelative()) { return resolvePropertyTypedValueFromForeignResource(field, propertyType); } if (this.properties == null) { throw new IllegalStateException("Tried to map the property " + field + " even though the resource has no properties."); } return this.properties.get(field.path, propertyType); }
java
private <T> T resolvePropertyTypedValue(FieldData field, Class<T> propertyType) { if (field.isAbsolute() || field.isRelative()) { return resolvePropertyTypedValueFromForeignResource(field, propertyType); } if (this.properties == null) { throw new IllegalStateException("Tried to map the property " + field + " even though the resource has no properties."); } return this.properties.get(field.path, propertyType); }
[ "private", "<", "T", ">", "T", "resolvePropertyTypedValue", "(", "FieldData", "field", ",", "Class", "<", "T", ">", "propertyType", ")", "{", "if", "(", "field", ".", "isAbsolute", "(", ")", "||", "field", ".", "isRelative", "(", ")", ")", "{", "return...
Resolves a field's value using the field's {@link FieldValueMappingCallback.FieldData#path}. {@link FieldData#isRelative() relative} or {@link FieldData#isAbsolute() absolute} paths are interpreted as references to the properties of another resource and are resolved via {@link #resolvePropertyTypedValueFromForeignResource(FieldData, Class)}. <br /> Ignores all {@link FieldValueMappingCallback.FieldData#metaData meta data} except for the field path as the desired return type is explicitly specified. @return the resolved value, or <code>null</code>.
[ "Resolves", "a", "field", "s", "value", "using", "the", "field", "s", "{", "@link", "FieldValueMappingCallback", ".", "FieldData#path", "}", ".", "{", "@link", "FieldData#isRelative", "()", "relative", "}", "or", "{", "@link", "FieldData#isAbsolute", "()", "abso...
train
https://github.com/unic/neba/blob/4d762e60112a1fcb850926a56a9843d5aa424c4b/core/src/main/java/io/neba/core/resourcemodels/mapping/FieldValueMappingCallback.java#L391-L400
liferay/com-liferay-commerce
commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java
CommerceWishListPersistenceImpl.findByU_LtC
@Override public List<CommerceWishList> findByU_LtC(long userId, Date createDate, int start, int end) { return findByU_LtC(userId, createDate, start, end, null); }
java
@Override public List<CommerceWishList> findByU_LtC(long userId, Date createDate, int start, int end) { return findByU_LtC(userId, createDate, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceWishList", ">", "findByU_LtC", "(", "long", "userId", ",", "Date", "createDate", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByU_LtC", "(", "userId", ",", "createDate", ",", "start", ","...
Returns a range of all the commerce wish lists where userId = &#63; and createDate &lt; &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceWishListModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param userId the user ID @param createDate the create date @param start the lower bound of the range of commerce wish lists @param end the upper bound of the range of commerce wish lists (not inclusive) @return the range of matching commerce wish lists
[ "Returns", "a", "range", "of", "all", "the", "commerce", "wish", "lists", "where", "userId", "=", "&#63", ";", "and", "createDate", "&lt", ";", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java#L3088-L3092
atomix/copycat
server/src/main/java/io/atomix/copycat/server/storage/SegmentFile.java
SegmentFile.createSegmentFile
static File createSegmentFile(String name, File directory, long id, long version) { return new File(directory, String.format("%s-%d-%d.log", Assert.notNull(name, "name"), id, version)); }
java
static File createSegmentFile(String name, File directory, long id, long version) { return new File(directory, String.format("%s-%d-%d.log", Assert.notNull(name, "name"), id, version)); }
[ "static", "File", "createSegmentFile", "(", "String", "name", ",", "File", "directory", ",", "long", "id", ",", "long", "version", ")", "{", "return", "new", "File", "(", "directory", ",", "String", ".", "format", "(", "\"%s-%d-%d.log\"", ",", "Assert", "....
Creates a segment file for the given directory, log name, segment ID, and segment version.
[ "Creates", "a", "segment", "file", "for", "the", "given", "directory", "log", "name", "segment", "ID", "and", "segment", "version", "." ]
train
https://github.com/atomix/copycat/blob/c90b88ccd5c63d6ea0b49fb77c25e2f3272a7b10/server/src/main/java/io/atomix/copycat/server/storage/SegmentFile.java#L66-L68
pryzach/midao
midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java
MappingUtils.objectExtends
public static boolean objectExtends(Object object, String superClassName) { AssertUtils.assertNotNull(object); boolean result = false; Class superClass = object.getClass().getSuperclass(); if (superClass.getName().equals(superClassName) == true) { result = true; } return result; }
java
public static boolean objectExtends(Object object, String superClassName) { AssertUtils.assertNotNull(object); boolean result = false; Class superClass = object.getClass().getSuperclass(); if (superClass.getName().equals(superClassName) == true) { result = true; } return result; }
[ "public", "static", "boolean", "objectExtends", "(", "Object", "object", ",", "String", "superClassName", ")", "{", "AssertUtils", ".", "assertNotNull", "(", "object", ")", ";", "boolean", "result", "=", "false", ";", "Class", "superClass", "=", "object", ".",...
Checks if Instance extends specified Class {@link Class#isAssignableFrom(Class)} is not used as Class might not be available and String representation can only be used @param object Instance which would be checked @param superClassName Class with which it would be checked @return true if Instance extends specified Parent
[ "Checks", "if", "Instance", "extends", "specified", "Class", "{", "@link", "Class#isAssignableFrom", "(", "Class", ")", "}", "is", "not", "used", "as", "Class", "might", "not", "be", "available", "and", "String", "representation", "can", "only", "be", "used" ]
train
https://github.com/pryzach/midao/blob/ed9048ed2c792a4794a2116a25779dfb84cd9447/midao-jdbc-core/src/main/java/org/midao/jdbc/core/handlers/utils/MappingUtils.java#L357-L369
Stratio/deep-spark
deep-commons/src/main/java/com/stratio/deep/commons/utils/Utils.java
Utils.findGetter
@SuppressWarnings("unchecked") public static Method findGetter(String propertyName, Class entityClass) { Method getter; String getterName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); try { getter = entityClass.getMethod(getterName); } catch (NoSuchMethodException e) { // let's try with scala setter name try { getter = entityClass.getMethod(propertyName + "_$eq"); } catch (NoSuchMethodException e1) { throw new DeepIOException(e1); } } return getter; }
java
@SuppressWarnings("unchecked") public static Method findGetter(String propertyName, Class entityClass) { Method getter; String getterName = "get" + propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1); try { getter = entityClass.getMethod(getterName); } catch (NoSuchMethodException e) { // let's try with scala setter name try { getter = entityClass.getMethod(propertyName + "_$eq"); } catch (NoSuchMethodException e1) { throw new DeepIOException(e1); } } return getter; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "Method", "findGetter", "(", "String", "propertyName", ",", "Class", "entityClass", ")", "{", "Method", "getter", ";", "String", "getterName", "=", "\"get\"", "+", "propertyName", ".", "subs...
Resolves the getter name for the property whose name is 'propertyName' whose type is 'valueType' in the entity bean whose class is 'entityClass'. If we don't find a setter following Java's naming conventions, before throwing an exception we try to resolve the setter following Scala's naming conventions. @param propertyName the field name of the property whose getter we want to resolve. @param entityClass the bean class object in which we want to search for the getter. @return the resolved getter.
[ "Resolves", "the", "getter", "name", "for", "the", "property", "whose", "name", "is", "propertyName", "whose", "type", "is", "valueType", "in", "the", "entity", "bean", "whose", "class", "is", "entityClass", ".", "If", "we", "don", "t", "find", "a", "sette...
train
https://github.com/Stratio/deep-spark/blob/b9621c9b7a6d996f80fce1d073d696a157bed095/deep-commons/src/main/java/com/stratio/deep/commons/utils/Utils.java#L267-L285
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/webapp/PerfWritingHttpServletResponse.java
PerfWritingHttpServletResponse.writePerfStats
public void writePerfStats() { if (hasWritten) { return; } // call timeEnd only if it's not already called, so as // not to change its value. long elapsed = PerfStats.getTotal(perfStat); if (elapsed <= 0) { elapsed = PerfStats.timeEnd(perfStat); } if (perfStatsHeader != null) { httpResponse.setHeader(perfStatsHeader, PerfStats.getAllStats(outputFormat)); } if (perfCookie && requestURI != null) { Cookie cookie = new Cookie("wb_total_perf", String.valueOf(elapsed)); cookie.setMaxAge(expireTimeout); //cookie.setDomain(domainName); cookie.setPath(requestURI); try { httpResponse.addCookie(cookie); } catch (IllegalArgumentException ex) { Logger logger = Logger.getLogger(getClass().getName()); logger.warning("addCookie failed for " + cookie + " (path=\"" + requestURI + "\"): " + ex.getMessage()); } } hasWritten = true; }
java
public void writePerfStats() { if (hasWritten) { return; } // call timeEnd only if it's not already called, so as // not to change its value. long elapsed = PerfStats.getTotal(perfStat); if (elapsed <= 0) { elapsed = PerfStats.timeEnd(perfStat); } if (perfStatsHeader != null) { httpResponse.setHeader(perfStatsHeader, PerfStats.getAllStats(outputFormat)); } if (perfCookie && requestURI != null) { Cookie cookie = new Cookie("wb_total_perf", String.valueOf(elapsed)); cookie.setMaxAge(expireTimeout); //cookie.setDomain(domainName); cookie.setPath(requestURI); try { httpResponse.addCookie(cookie); } catch (IllegalArgumentException ex) { Logger logger = Logger.getLogger(getClass().getName()); logger.warning("addCookie failed for " + cookie + " (path=\"" + requestURI + "\"): " + ex.getMessage()); } } hasWritten = true; }
[ "public", "void", "writePerfStats", "(", ")", "{", "if", "(", "hasWritten", ")", "{", "return", ";", "}", "// call timeEnd only if it's not already called, so as", "// not to change its value. ", "long", "elapsed", "=", "PerfStats", ".", "getTotal", "(", "perfStat", "...
Write performance metrics to HTTP header field and Cookie. You don't need to call this method explicitly. It is called implicitly by calls to {@link #sendError(int)}, {@link #sendRedirect(String)}, {@link #getWriter()} or {@link #getOutputStream()}. 2014-11-17 Now it doesn't call {@code timeEnd} for {@code perfStat}. Be sure to call {@code endNow()} explicitly.
[ "Write", "performance", "metrics", "to", "HTTP", "header", "field", "and", "Cookie", ".", "You", "don", "t", "need", "to", "call", "this", "method", "explicitly", ".", "It", "is", "called", "implicitly", "by", "calls", "to", "{" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/webapp/PerfWritingHttpServletResponse.java#L68-L99
Stratio/stratio-connector-commons
connector-commons/src/main/java/com/stratio/connector/commons/connection/Connection.java
Connection.getSessionObject
public <T> T getSessionObject(Class<T> type, String name) { T value = (T) session.get(name); if (logger.isDebugEnabled()) { logger.debug("Recovering object [" + name + "] from session with value [" + value + "]"); } return value; }
java
public <T> T getSessionObject(Class<T> type, String name) { T value = (T) session.get(name); if (logger.isDebugEnabled()) { logger.debug("Recovering object [" + name + "] from session with value [" + value + "]"); } return value; }
[ "public", "<", "T", ">", "T", "getSessionObject", "(", "Class", "<", "T", ">", "type", ",", "String", "name", ")", "{", "T", "value", "=", "(", "T", ")", "session", ".", "get", "(", "name", ")", ";", "if", "(", "logger", ".", "isDebugEnabled", "(...
Recovered a object from the session. @param type the object type. @param name the object name. @param <T> the object type. @return the object.
[ "Recovered", "a", "object", "from", "the", "session", "." ]
train
https://github.com/Stratio/stratio-connector-commons/blob/d7cc66cb9591344a13055962e87a91f01c3707d1/connector-commons/src/main/java/com/stratio/connector/commons/connection/Connection.java#L65-L72
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.checkRadioList
protected boolean checkRadioList(PageElement pageElement, String value) throws FailureException { try { final List<WebElement> radioButtons = Context.waitUntil(ExpectedConditions.presenceOfAllElementsLocatedBy(Utilities.getLocator(pageElement))); for (final WebElement button : radioButtons) { if (button.getAttribute(VALUE).equalsIgnoreCase(value) && button.isSelected()) { return true; } } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, pageElement.getPage().getCallBack()); } return false; }
java
protected boolean checkRadioList(PageElement pageElement, String value) throws FailureException { try { final List<WebElement> radioButtons = Context.waitUntil(ExpectedConditions.presenceOfAllElementsLocatedBy(Utilities.getLocator(pageElement))); for (final WebElement button : radioButtons) { if (button.getAttribute(VALUE).equalsIgnoreCase(value) && button.isSelected()) { return true; } } } catch (final Exception e) { new Result.Failure<>(e.getMessage(), Messages.getMessage(Messages.FAIL_MESSAGE_UNABLE_TO_FIND_ELEMENT), true, pageElement.getPage().getCallBack()); } return false; }
[ "protected", "boolean", "checkRadioList", "(", "PageElement", "pageElement", ",", "String", "value", ")", "throws", "FailureException", "{", "try", "{", "final", "List", "<", "WebElement", ">", "radioButtons", "=", "Context", ".", "waitUntil", "(", "ExpectedCondit...
Checks that given value is matching the selected radio list button. @param pageElement The page element @param value The value to check the selection from @return true if the given value is selected, false otherwise. @throws FailureException if the scenario encounters a functional error
[ "Checks", "that", "given", "value", "is", "matching", "the", "selected", "radio", "list", "button", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L631-L643
Pi4J/pi4j
pi4j-device/src/main/java/com/pi4j/component/servo/impl/RPIServoBlasterProvider.java
RPIServoBlasterProvider.getServoDriver
@Override public synchronized ServoDriver getServoDriver(Pin servoPin) throws IOException { List<Pin> servoPins = getDefinedServoPins(); int index = servoPins.indexOf(servoPin); if (index < 0) { throw new IllegalArgumentException("Servo driver cannot drive pin " + servoPin); } RPIServoBlasterServoDriver driver = allocatedDrivers.get(servoPin); if (driver == null) { driver = new RPIServoBlasterServoDriver(servoPin, index, PIN_MAP.get(servoPin), this); ensureWriterIsCreated(); } return driver; }
java
@Override public synchronized ServoDriver getServoDriver(Pin servoPin) throws IOException { List<Pin> servoPins = getDefinedServoPins(); int index = servoPins.indexOf(servoPin); if (index < 0) { throw new IllegalArgumentException("Servo driver cannot drive pin " + servoPin); } RPIServoBlasterServoDriver driver = allocatedDrivers.get(servoPin); if (driver == null) { driver = new RPIServoBlasterServoDriver(servoPin, index, PIN_MAP.get(servoPin), this); ensureWriterIsCreated(); } return driver; }
[ "@", "Override", "public", "synchronized", "ServoDriver", "getServoDriver", "(", "Pin", "servoPin", ")", "throws", "IOException", "{", "List", "<", "Pin", ">", "servoPins", "=", "getDefinedServoPins", "(", ")", ";", "int", "index", "=", "servoPins", ".", "inde...
Returns new instance of {@link RPIServoBlasterServoDriver}. @param servoPin servo pin. @return instance of {@link RPIServoBlasterServoDriver}.
[ "Returns", "new", "instance", "of", "{", "@link", "RPIServoBlasterServoDriver", "}", "." ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-device/src/main/java/com/pi4j/component/servo/impl/RPIServoBlasterProvider.java#L249-L264
mediathekview/MServer
src/main/java/mServer/tool/MserverDatumZeit.java
MserverDatumZeit.formatTime
public static String formatTime(String dateValue, FastDateFormat sdf) { try { return FDF_OUT_TIME.format(sdf.parse(dateValue)); } catch (ParseException ex) { LOG.debug(String.format("Fehler beim Parsen des Datums %s: %s", dateValue, ex.getMessage())); } return ""; }
java
public static String formatTime(String dateValue, FastDateFormat sdf) { try { return FDF_OUT_TIME.format(sdf.parse(dateValue)); } catch (ParseException ex) { LOG.debug(String.format("Fehler beim Parsen des Datums %s: %s", dateValue, ex.getMessage())); } return ""; }
[ "public", "static", "String", "formatTime", "(", "String", "dateValue", ",", "FastDateFormat", "sdf", ")", "{", "try", "{", "return", "FDF_OUT_TIME", ".", "format", "(", "sdf", ".", "parse", "(", "dateValue", ")", ")", ";", "}", "catch", "(", "ParseExcepti...
formats a datetime string to the time format used in DatenFilm @param dateValue the datetime value @param sdf the format of dateValue @return the formatted time string
[ "formats", "a", "datetime", "string", "to", "the", "time", "format", "used", "in", "DatenFilm" ]
train
https://github.com/mediathekview/MServer/blob/ba8d03e6a1a303db3807a1327f553f1decd30388/src/main/java/mServer/tool/MserverDatumZeit.java#L98-L106
BigBadaboom/androidsvg
androidsvg/src/main/java/com/caverock/androidsvg/SVG.java
SVG.renderToCanvas
@SuppressWarnings({"WeakerAccess", "unused"}) public void renderToCanvas(Canvas canvas, RectF viewPort) { RenderOptions renderOptions = new RenderOptions(); if (viewPort != null) { renderOptions.viewPort(viewPort.left, viewPort.top, viewPort.width(), viewPort.height()); } else { renderOptions.viewPort(0f, 0f, (float) canvas.getWidth(), (float) canvas.getHeight()); } SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, this.renderDPI); renderer.renderDocument(this, renderOptions); }
java
@SuppressWarnings({"WeakerAccess", "unused"}) public void renderToCanvas(Canvas canvas, RectF viewPort) { RenderOptions renderOptions = new RenderOptions(); if (viewPort != null) { renderOptions.viewPort(viewPort.left, viewPort.top, viewPort.width(), viewPort.height()); } else { renderOptions.viewPort(0f, 0f, (float) canvas.getWidth(), (float) canvas.getHeight()); } SVGAndroidRenderer renderer = new SVGAndroidRenderer(canvas, this.renderDPI); renderer.renderDocument(this, renderOptions); }
[ "@", "SuppressWarnings", "(", "{", "\"WeakerAccess\"", ",", "\"unused\"", "}", ")", "public", "void", "renderToCanvas", "(", "Canvas", "canvas", ",", "RectF", "viewPort", ")", "{", "RenderOptions", "renderOptions", "=", "new", "RenderOptions", "(", ")", ";", "...
Renders this SVG document to a Canvas object. @param canvas the canvas to which the document should be rendered. @param viewPort the bounds of the area on the canvas you want the SVG rendered, or null for the whole canvas.
[ "Renders", "this", "SVG", "document", "to", "a", "Canvas", "object", "." ]
train
https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SVG.java#L504-L518
JetBrains/xodus
compress/src/main/java/jetbrains/exodus/util/CompressBackupUtil.java
CompressBackupUtil.tar
public static void tar(@NotNull File source, @NotNull File dest) throws IOException { if (!source.exists()) { throw new IllegalArgumentException("No source file or folder exists: " + source.getAbsolutePath()); } if (dest.exists()) { throw new IllegalArgumentException("Destination refers to existing file or folder: " + dest.getAbsolutePath()); } try (TarArchiveOutputStream tarOut = new TarArchiveOutputStream(new GZIPOutputStream( new BufferedOutputStream(new FileOutputStream(dest)), 0x1000))) { doTar("", source, tarOut); } catch (IOException e) { IOUtil.deleteFile(dest); // operation filed, let's remove the destination archive throw e; } }
java
public static void tar(@NotNull File source, @NotNull File dest) throws IOException { if (!source.exists()) { throw new IllegalArgumentException("No source file or folder exists: " + source.getAbsolutePath()); } if (dest.exists()) { throw new IllegalArgumentException("Destination refers to existing file or folder: " + dest.getAbsolutePath()); } try (TarArchiveOutputStream tarOut = new TarArchiveOutputStream(new GZIPOutputStream( new BufferedOutputStream(new FileOutputStream(dest)), 0x1000))) { doTar("", source, tarOut); } catch (IOException e) { IOUtil.deleteFile(dest); // operation filed, let's remove the destination archive throw e; } }
[ "public", "static", "void", "tar", "(", "@", "NotNull", "File", "source", ",", "@", "NotNull", "File", "dest", ")", "throws", "IOException", "{", "if", "(", "!", "source", ".", "exists", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "("...
Compresses the content of source and stores newly created archive in dest. In case source is a directory, it will be compressed recursively. @param source file or folder to be archived. Should exist on method call. @param dest path to the archive to be created. Should not exist on method call. @throws IOException in case of any issues with underlying store. @throws FileNotFoundException in case source does not exist.
[ "Compresses", "the", "content", "of", "source", "and", "stores", "newly", "created", "archive", "in", "dest", ".", "In", "case", "source", "is", "a", "directory", "it", "will", "be", "compressed", "recursively", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/compress/src/main/java/jetbrains/exodus/util/CompressBackupUtil.java#L188-L203
nextreports/nextreports-engine
src/ro/nextreports/engine/util/DateUtil.java
DateUtil.addWeeks
public static Date addWeeks(Date d, int weeks) { Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.add(Calendar.WEEK_OF_YEAR, weeks); return cal.getTime(); }
java
public static Date addWeeks(Date d, int weeks) { Calendar cal = Calendar.getInstance(); cal.setTime(d); cal.add(Calendar.WEEK_OF_YEAR, weeks); return cal.getTime(); }
[ "public", "static", "Date", "addWeeks", "(", "Date", "d", ",", "int", "weeks", ")", "{", "Calendar", "cal", "=", "Calendar", ".", "getInstance", "(", ")", ";", "cal", ".", "setTime", "(", "d", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "WEE...
Add weeks to a date @param d date @param weeks weeks @return new date
[ "Add", "weeks", "to", "a", "date" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/DateUtil.java#L496-L501
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listMultiRoleMetricDefinitionsWithServiceResponseAsync
public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMultiRoleMetricDefinitionsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listMultiRoleMetricDefinitionsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMultiRoleMetricDefinitionsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> listMultiRoleMetricDefinitionsWithServiceResponseAsync(final String resourceGroupName, final String name) { return listMultiRoleMetricDefinitionsSinglePageAsync(resourceGroupName, name) .concatMap(new Func1<ServiceResponse<Page<ResourceMetricDefinitionInner>>, Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<ResourceMetricDefinitionInner>>> call(ServiceResponse<Page<ResourceMetricDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listMultiRoleMetricDefinitionsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "ResourceMetricDefinitionInner", ">", ">", ">", "listMultiRoleMetricDefinitionsWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ")", "{", "return", "...
Get metric definitions for a multi-role pool of an App Service Environment. Get metric definitions for a multi-role pool of an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;ResourceMetricDefinitionInner&gt; object
[ "Get", "metric", "definitions", "for", "a", "multi", "-", "role", "pool", "of", "an", "App", "Service", "Environment", ".", "Get", "metric", "definitions", "for", "a", "multi", "-", "role", "pool", "of", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L3024-L3036
alkacon/opencms-core
src/org/opencms/ui/components/CmsBasicDialog.java
CmsBasicDialog.displayResourceInfo
public void displayResourceInfo(List<CmsResource> resources, String messageKey) { m_infoResources = Lists.newArrayList(resources); if (m_infoComponent != null) { m_mainPanel.removeComponent(m_infoComponent); m_infoComponent = null; } if ((resources != null) && !resources.isEmpty()) { if (resources.size() == 1) { m_infoComponent = new CmsResourceInfo(resources.get(0)); m_mainPanel.addComponent(m_infoComponent, 0); } else { m_infoComponent = createResourceListPanel( messageKey == null ? null : Messages.get().getBundle(A_CmsUI.get().getLocale()).key(messageKey), resources); m_mainPanel.addComponent(m_infoComponent, 0); m_mainPanel.setExpandRatio(m_infoComponent, 1); // reset expand ratio of the content panel m_contentPanel.setSizeUndefined(); m_contentPanel.setWidth("100%"); m_mainPanel.setExpandRatio(m_contentPanel, 0); } } }
java
public void displayResourceInfo(List<CmsResource> resources, String messageKey) { m_infoResources = Lists.newArrayList(resources); if (m_infoComponent != null) { m_mainPanel.removeComponent(m_infoComponent); m_infoComponent = null; } if ((resources != null) && !resources.isEmpty()) { if (resources.size() == 1) { m_infoComponent = new CmsResourceInfo(resources.get(0)); m_mainPanel.addComponent(m_infoComponent, 0); } else { m_infoComponent = createResourceListPanel( messageKey == null ? null : Messages.get().getBundle(A_CmsUI.get().getLocale()).key(messageKey), resources); m_mainPanel.addComponent(m_infoComponent, 0); m_mainPanel.setExpandRatio(m_infoComponent, 1); // reset expand ratio of the content panel m_contentPanel.setSizeUndefined(); m_contentPanel.setWidth("100%"); m_mainPanel.setExpandRatio(m_contentPanel, 0); } } }
[ "public", "void", "displayResourceInfo", "(", "List", "<", "CmsResource", ">", "resources", ",", "String", "messageKey", ")", "{", "m_infoResources", "=", "Lists", ".", "newArrayList", "(", "resources", ")", ";", "if", "(", "m_infoComponent", "!=", "null", ")"...
Display the resource indos panel with panel message.<p> @param resources to show info for @param messageKey of the panel
[ "Display", "the", "resource", "indos", "panel", "with", "panel", "message", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/CmsBasicDialog.java#L289-L314
jenkinsci/sectioned-view-plugin
src/main/java/hudson/plugins/sectioned_view/SectionedView.java
SectionedView.submit
@Override protected void submit(StaplerRequest req) throws ServletException, FormException { initSections(); try { sections.rebuildHetero(req, req.getSubmittedForm(), Hudson .getInstance().<SectionedViewSection, Descriptor<SectionedViewSection>>getDescriptorList(SectionedViewSection.class), "sections"); } catch (IOException e) { throw new FormException("Error rebuilding list of sections.", e, "sections"); } }
java
@Override protected void submit(StaplerRequest req) throws ServletException, FormException { initSections(); try { sections.rebuildHetero(req, req.getSubmittedForm(), Hudson .getInstance().<SectionedViewSection, Descriptor<SectionedViewSection>>getDescriptorList(SectionedViewSection.class), "sections"); } catch (IOException e) { throw new FormException("Error rebuilding list of sections.", e, "sections"); } }
[ "@", "Override", "protected", "void", "submit", "(", "StaplerRequest", "req", ")", "throws", "ServletException", ",", "FormException", "{", "initSections", "(", ")", ";", "try", "{", "sections", ".", "rebuildHetero", "(", "req", ",", "req", ".", "getSubmittedF...
Handles the configuration submission. Load view-specific properties here.
[ "Handles", "the", "configuration", "submission", "." ]
train
https://github.com/jenkinsci/sectioned-view-plugin/blob/dc8a23c018c4c329b8e75e91cea2b7f466ce0320/src/main/java/hudson/plugins/sectioned_view/SectionedView.java#L149-L159
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java
InstanceFailoverGroupsInner.beginForceFailoverAllowDataLossAsync
public Observable<InstanceFailoverGroupInner> beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<InstanceFailoverGroupInner>, InstanceFailoverGroupInner>() { @Override public InstanceFailoverGroupInner call(ServiceResponse<InstanceFailoverGroupInner> response) { return response.body(); } }); }
java
public Observable<InstanceFailoverGroupInner> beginForceFailoverAllowDataLossAsync(String resourceGroupName, String locationName, String failoverGroupName) { return beginForceFailoverAllowDataLossWithServiceResponseAsync(resourceGroupName, locationName, failoverGroupName).map(new Func1<ServiceResponse<InstanceFailoverGroupInner>, InstanceFailoverGroupInner>() { @Override public InstanceFailoverGroupInner call(ServiceResponse<InstanceFailoverGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "InstanceFailoverGroupInner", ">", "beginForceFailoverAllowDataLossAsync", "(", "String", "resourceGroupName", ",", "String", "locationName", ",", "String", "failoverGroupName", ")", "{", "return", "beginForceFailoverAllowDataLossWithServiceResponseAs...
Fails over from the current primary managed instance to this managed instance. This operation might result in data loss. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param locationName The name of the region where the resource is located. @param failoverGroupName The name of the failover group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the InstanceFailoverGroupInner object
[ "Fails", "over", "from", "the", "current", "primary", "managed", "instance", "to", "this", "managed", "instance", ".", "This", "operation", "might", "result", "in", "data", "loss", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/InstanceFailoverGroupsInner.java#L967-L974
kaazing/gateway
transport/bio/src/main/java/org/kaazing/gateway/transport/bio/AbstractBioConnector.java
AbstractBioConnector.connectInternal
protected <F extends ConnectFuture> ConnectFuture connectInternal(final ResourceAddress remoteAddress, final IoHandler handler, final IoSessionInitializer<F> initializer) { ConnectFuture future; final String nextProtocol = remoteAddress.getOption(ResourceAddress.NEXT_PROTOCOL); ResourceAddress transport = remoteAddress.getTransport(); if (transport != null) { BridgeConnector connector = bridgeServiceFactory.newBridgeConnector(transport); future = connector.connect(transport, handler, new IoSessionInitializer<F>() { @Override public void initializeSession(IoSession session, F future) { REMOTE_ADDRESS.set(session, remoteAddress); setLocalAddressFromSocketAddress(session, getTransportName(), nextProtocol); if (initializer != null) { initializer.initializeSession(session, future); } } }); } else { T socketAddress = socketAddressFactory.createSocketAddress(remoteAddress); future = connector.connect(socketAddress, new IoSessionInitializer<F>() { @Override public void initializeSession(IoSession session, F future) { // connectors don't need lookup so set this directly on the session session.setAttribute(BridgeConnectHandler.DELEGATE_KEY, handler); REMOTE_ADDRESS.set(session, remoteAddress); setLocalAddressFromSocketAddress(session, getTransportName(), nextProtocol); if (initializer != null) { initializer.initializeSession(session, future); } } }); } return future; }
java
protected <F extends ConnectFuture> ConnectFuture connectInternal(final ResourceAddress remoteAddress, final IoHandler handler, final IoSessionInitializer<F> initializer) { ConnectFuture future; final String nextProtocol = remoteAddress.getOption(ResourceAddress.NEXT_PROTOCOL); ResourceAddress transport = remoteAddress.getTransport(); if (transport != null) { BridgeConnector connector = bridgeServiceFactory.newBridgeConnector(transport); future = connector.connect(transport, handler, new IoSessionInitializer<F>() { @Override public void initializeSession(IoSession session, F future) { REMOTE_ADDRESS.set(session, remoteAddress); setLocalAddressFromSocketAddress(session, getTransportName(), nextProtocol); if (initializer != null) { initializer.initializeSession(session, future); } } }); } else { T socketAddress = socketAddressFactory.createSocketAddress(remoteAddress); future = connector.connect(socketAddress, new IoSessionInitializer<F>() { @Override public void initializeSession(IoSession session, F future) { // connectors don't need lookup so set this directly on the session session.setAttribute(BridgeConnectHandler.DELEGATE_KEY, handler); REMOTE_ADDRESS.set(session, remoteAddress); setLocalAddressFromSocketAddress(session, getTransportName(), nextProtocol); if (initializer != null) { initializer.initializeSession(session, future); } } }); } return future; }
[ "protected", "<", "F", "extends", "ConnectFuture", ">", "ConnectFuture", "connectInternal", "(", "final", "ResourceAddress", "remoteAddress", ",", "final", "IoHandler", "handler", ",", "final", "IoSessionInitializer", "<", "F", ">", "initializer", ")", "{", "Connect...
THIS IS A BUG IN JAVA, should not need two methods just to capture the type
[ "THIS", "IS", "A", "BUG", "IN", "JAVA", "should", "not", "need", "two", "methods", "just", "to", "capture", "the", "type" ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/transport/bio/src/main/java/org/kaazing/gateway/transport/bio/AbstractBioConnector.java#L110-L151
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/BinaryImageOps.java
BinaryImageOps.relabel
public static void relabel(GrayS32 input , int labels[] ) { if( BoofConcurrency.USE_CONCURRENT ) { ImplBinaryImageOps_MT.relabel(input, labels); } else { ImplBinaryImageOps.relabel(input, labels); } }
java
public static void relabel(GrayS32 input , int labels[] ) { if( BoofConcurrency.USE_CONCURRENT ) { ImplBinaryImageOps_MT.relabel(input, labels); } else { ImplBinaryImageOps.relabel(input, labels); } }
[ "public", "static", "void", "relabel", "(", "GrayS32", "input", ",", "int", "labels", "[", "]", ")", "{", "if", "(", "BoofConcurrency", ".", "USE_CONCURRENT", ")", "{", "ImplBinaryImageOps_MT", ".", "relabel", "(", "input", ",", "labels", ")", ";", "}", ...
Used to change the labels in a labeled binary image. @param input Labeled binary image. @param labels Look up table where the indexes are the current label and the value are its new value.
[ "Used", "to", "change", "the", "labels", "in", "a", "labeled", "binary", "image", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/filter/binary/BinaryImageOps.java#L509-L515
facebookarchive/hadoop-20
src/core/org/apache/hadoop/io/IOUtils.java
IOUtils.copyBytes
public static void copyBytes(InputStream in, OutputStream out, Configuration conf) throws IOException { copyBytes(in, out, conf.getInt("io.file.buffer.size", 4096), true); }
java
public static void copyBytes(InputStream in, OutputStream out, Configuration conf) throws IOException { copyBytes(in, out, conf.getInt("io.file.buffer.size", 4096), true); }
[ "public", "static", "void", "copyBytes", "(", "InputStream", "in", ",", "OutputStream", "out", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "copyBytes", "(", "in", ",", "out", ",", "conf", ".", "getInt", "(", "\"io.file.buffer.size\"", ",",...
Copies from one stream to another. <strong>closes the input and output streams at the end</strong>. @param in InputStrem to read from @param out OutputStream to write to @param conf the Configuration object
[ "Copies", "from", "one", "stream", "to", "another", ".", "<strong", ">", "closes", "the", "input", "and", "output", "streams", "at", "the", "end<", "/", "strong", ">", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/IOUtils.java#L155-L158
goldmansachs/gs-collections
collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java
ListIterate.forEachWithIndex
public static <T> void forEachWithIndex(List<T> list, int from, int to, ObjectIntProcedure<? super T> objectIntProcedure) { ListIterate.rangeCheck(from, to, list.size()); if (list instanceof RandomAccess) { RandomAccessListIterate.forEachWithIndex(list, from, to, objectIntProcedure); } else { if (from <= to) { ListIterator<T> iterator = list.listIterator(from); for (int i = from; i <= to; i++) { objectIntProcedure.value(iterator.next(), i); } } else { ListIterator<T> iterator = list.listIterator(from + 1); for (int i = from; i >= to; i--) { objectIntProcedure.value(iterator.previous(), i); } } } }
java
public static <T> void forEachWithIndex(List<T> list, int from, int to, ObjectIntProcedure<? super T> objectIntProcedure) { ListIterate.rangeCheck(from, to, list.size()); if (list instanceof RandomAccess) { RandomAccessListIterate.forEachWithIndex(list, from, to, objectIntProcedure); } else { if (from <= to) { ListIterator<T> iterator = list.listIterator(from); for (int i = from; i <= to; i++) { objectIntProcedure.value(iterator.next(), i); } } else { ListIterator<T> iterator = list.listIterator(from + 1); for (int i = from; i >= to; i--) { objectIntProcedure.value(iterator.previous(), i); } } } }
[ "public", "static", "<", "T", ">", "void", "forEachWithIndex", "(", "List", "<", "T", ">", "list", ",", "int", "from", ",", "int", "to", ",", "ObjectIntProcedure", "<", "?", "super", "T", ">", "objectIntProcedure", ")", "{", "ListIterate", ".", "rangeChe...
Iterates over the section of the list covered by the specified indexes. The indexes are both inclusive. If the from is less than the to, the list is iterated in forward order. If the from is greater than the to, then the list is iterated in the reverse order. The index passed into the ObjectIntProcedure is the actual index of the range. <p> <pre>e.g. MutableList<People> people = FastList.newListWith(ted, mary, bob, sally); ListIterate.forEachWithIndex(people, 0, 1, new ObjectIntProcedure<Person>() { public void value(Person person, int index) { LOGGER.info(person.getName() + " at index: " + index); } }); </pre> <p> This code would output ted and mary's names.
[ "Iterates", "over", "the", "section", "of", "the", "list", "covered", "by", "the", "specified", "indexes", ".", "The", "indexes", "are", "both", "inclusive", ".", "If", "the", "from", "is", "less", "than", "the", "to", "the", "list", "is", "iterated", "i...
train
https://github.com/goldmansachs/gs-collections/blob/fa8bf3e103689efa18bca2ab70203e71cde34b52/collections/src/main/java/com/gs/collections/impl/utility/ListIterate.java#L754-L781
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readTask
private void readTask(String projectIdentifier, Map<String, Task> map, Document.Projects.Project.Task task) { Task parentTask = map.get(getParentOutlineNumber(task.getOutlineNumber())); Task mpxjTask = parentTask.addTask(); TimeUnit units = task.getBaseDurationTimeUnit(); mpxjTask.setCost(task.getActualCost()); mpxjTask.setDuration(getDuration(units, task.getActualDuration())); mpxjTask.setFinish(task.getActualFinishDate()); mpxjTask.setStart(task.getActualStartDate()); mpxjTask.setBaselineDuration(getDuration(units, task.getBaseDuration())); mpxjTask.setBaselineFinish(task.getBaseFinishDate()); mpxjTask.setBaselineCost(task.getBaselineCost()); // task.getBaselineFinishDate() // task.getBaselineFinishTemplateOffset() // task.getBaselineStartDate() // task.getBaselineStartTemplateOffset() mpxjTask.setBaselineStart(task.getBaseStartDate()); // task.getCallouts() mpxjTask.setPercentageComplete(task.getComplete()); mpxjTask.setDeadline(task.getDeadlineDate()); // task.getDeadlineTemplateOffset() // task.getHyperlinks() // task.getMarkerID() mpxjTask.setName(task.getName()); mpxjTask.setNotes(task.getNote()); mpxjTask.setPriority(task.getPriority()); // task.getRecalcBase1() // task.getRecalcBase2() mpxjTask.setType(task.getSchedulingType()); // task.getStyleProject() // task.getTemplateOffset() // task.getValidatedByProject() if (task.isIsMilestone()) { mpxjTask.setMilestone(true); mpxjTask.setDuration(Duration.getInstance(0, TimeUnit.HOURS)); mpxjTask.setBaselineDuration(Duration.getInstance(0, TimeUnit.HOURS)); } String taskIdentifier = projectIdentifier + "." + task.getID(); m_taskIdMap.put(task.getID(), mpxjTask); mpxjTask.setGUID(UUID.nameUUIDFromBytes(taskIdentifier.getBytes())); map.put(task.getOutlineNumber(), mpxjTask); for (Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment : task.getResourceAssignments().getResourceAssignment()) { readResourceAssignment(mpxjTask, assignment); } }
java
private void readTask(String projectIdentifier, Map<String, Task> map, Document.Projects.Project.Task task) { Task parentTask = map.get(getParentOutlineNumber(task.getOutlineNumber())); Task mpxjTask = parentTask.addTask(); TimeUnit units = task.getBaseDurationTimeUnit(); mpxjTask.setCost(task.getActualCost()); mpxjTask.setDuration(getDuration(units, task.getActualDuration())); mpxjTask.setFinish(task.getActualFinishDate()); mpxjTask.setStart(task.getActualStartDate()); mpxjTask.setBaselineDuration(getDuration(units, task.getBaseDuration())); mpxjTask.setBaselineFinish(task.getBaseFinishDate()); mpxjTask.setBaselineCost(task.getBaselineCost()); // task.getBaselineFinishDate() // task.getBaselineFinishTemplateOffset() // task.getBaselineStartDate() // task.getBaselineStartTemplateOffset() mpxjTask.setBaselineStart(task.getBaseStartDate()); // task.getCallouts() mpxjTask.setPercentageComplete(task.getComplete()); mpxjTask.setDeadline(task.getDeadlineDate()); // task.getDeadlineTemplateOffset() // task.getHyperlinks() // task.getMarkerID() mpxjTask.setName(task.getName()); mpxjTask.setNotes(task.getNote()); mpxjTask.setPriority(task.getPriority()); // task.getRecalcBase1() // task.getRecalcBase2() mpxjTask.setType(task.getSchedulingType()); // task.getStyleProject() // task.getTemplateOffset() // task.getValidatedByProject() if (task.isIsMilestone()) { mpxjTask.setMilestone(true); mpxjTask.setDuration(Duration.getInstance(0, TimeUnit.HOURS)); mpxjTask.setBaselineDuration(Duration.getInstance(0, TimeUnit.HOURS)); } String taskIdentifier = projectIdentifier + "." + task.getID(); m_taskIdMap.put(task.getID(), mpxjTask); mpxjTask.setGUID(UUID.nameUUIDFromBytes(taskIdentifier.getBytes())); map.put(task.getOutlineNumber(), mpxjTask); for (Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment : task.getResourceAssignments().getResourceAssignment()) { readResourceAssignment(mpxjTask, assignment); } }
[ "private", "void", "readTask", "(", "String", "projectIdentifier", ",", "Map", "<", "String", ",", "Task", ">", "map", ",", "Document", ".", "Projects", ".", "Project", ".", "Task", "task", ")", "{", "Task", "parentTask", "=", "map", ".", "get", "(", "...
Read a task from a ConceptDraw PROJECT file. @param projectIdentifier parent project identifier @param map outline number to task map @param task ConceptDraw PROJECT task
[ "Read", "a", "task", "from", "a", "ConceptDraw", "PROJECT", "file", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L406-L458
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java
QPath.makeChildPath
public static QPath makeChildPath(final QPath parent, final QName name, final int itemIndex) { QPathEntry[] parentEntries = parent.getEntries(); QPathEntry[] names = new QPathEntry[parentEntries.length + 1]; int index = 0; for (QPathEntry pname : parentEntries) { names[index++] = pname; } names[index] = new QPathEntry(name.getNamespace(), name.getName(), itemIndex); QPath path = new QPath(names); return path; }
java
public static QPath makeChildPath(final QPath parent, final QName name, final int itemIndex) { QPathEntry[] parentEntries = parent.getEntries(); QPathEntry[] names = new QPathEntry[parentEntries.length + 1]; int index = 0; for (QPathEntry pname : parentEntries) { names[index++] = pname; } names[index] = new QPathEntry(name.getNamespace(), name.getName(), itemIndex); QPath path = new QPath(names); return path; }
[ "public", "static", "QPath", "makeChildPath", "(", "final", "QPath", "parent", ",", "final", "QName", "name", ",", "final", "int", "itemIndex", ")", "{", "QPathEntry", "[", "]", "parentEntries", "=", "parent", ".", "getEntries", "(", ")", ";", "QPathEntry", ...
Make child path using QName and Item index. <br> @param parent - parent QPath @param name - Item QName @param itemIndex - Item index @return new QPath
[ "Make", "child", "path", "using", "QName", "and", "Item", "index", ".", "<br", ">" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/QPath.java#L425-L439
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyHunting_serviceName_timeConditions_conditions_GET
public ArrayList<Long> billingAccount_easyHunting_serviceName_timeConditions_conditions_GET(String billingAccount, String serviceName, OvhTimeConditionsPolicyEnum policy) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions"; StringBuilder sb = path(qPath, billingAccount, serviceName); query(sb, "policy", policy); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> billingAccount_easyHunting_serviceName_timeConditions_conditions_GET(String billingAccount, String serviceName, OvhTimeConditionsPolicyEnum policy) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions"; StringBuilder sb = path(qPath, billingAccount, serviceName); query(sb, "policy", policy); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "billingAccount_easyHunting_serviceName_timeConditions_conditions_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhTimeConditionsPolicyEnum", "policy", ")", "throws", "IOException", "{", "String", "qPath", ...
Time conditions checked when a call is received REST: GET /telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions @param policy [required] Filter the value of policy property (=) @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Time", "conditions", "checked", "when", "a", "call", "is", "received" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3369-L3375
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java
BpmnParse.createActivityOnScope
public ActivityImpl createActivityOnScope(Element activityElement, ScopeImpl scopeElement) { String id = activityElement.attribute("id"); LOG.parsingElement("activity", id); ActivityImpl activity = scopeElement.createActivity(id); activity.setProperty("name", activityElement.attribute("name")); activity.setProperty("documentation", parseDocumentation(activityElement)); activity.setProperty("default", activityElement.attribute("default")); activity.getProperties().set(BpmnProperties.TYPE, activityElement.getTagName()); activity.setProperty("line", activityElement.getLine()); setActivityAsyncDelegates(activity); activity.setProperty(PROPERTYNAME_JOB_PRIORITY, parsePriority(activityElement, PROPERTYNAME_JOB_PRIORITY)); if (isCompensationHandler(activityElement)) { activity.setProperty(PROPERTYNAME_IS_FOR_COMPENSATION, true); } return activity; }
java
public ActivityImpl createActivityOnScope(Element activityElement, ScopeImpl scopeElement) { String id = activityElement.attribute("id"); LOG.parsingElement("activity", id); ActivityImpl activity = scopeElement.createActivity(id); activity.setProperty("name", activityElement.attribute("name")); activity.setProperty("documentation", parseDocumentation(activityElement)); activity.setProperty("default", activityElement.attribute("default")); activity.getProperties().set(BpmnProperties.TYPE, activityElement.getTagName()); activity.setProperty("line", activityElement.getLine()); setActivityAsyncDelegates(activity); activity.setProperty(PROPERTYNAME_JOB_PRIORITY, parsePriority(activityElement, PROPERTYNAME_JOB_PRIORITY)); if (isCompensationHandler(activityElement)) { activity.setProperty(PROPERTYNAME_IS_FOR_COMPENSATION, true); } return activity; }
[ "public", "ActivityImpl", "createActivityOnScope", "(", "Element", "activityElement", ",", "ScopeImpl", "scopeElement", ")", "{", "String", "id", "=", "activityElement", ".", "attribute", "(", "\"id\"", ")", ";", "LOG", ".", "parsingElement", "(", "\"activity\"", ...
Parses the generic information of an activity element (id, name, documentation, etc.), and creates a new {@link ActivityImpl} on the given scope element.
[ "Parses", "the", "generic", "information", "of", "an", "activity", "element", "(", "id", "name", "documentation", "etc", ".", ")", "and", "creates", "a", "new", "{" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParse.java#L1770-L1789
inkstand-io/scribble
scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java
XMLContentHandler.endElement
@Override public void endElement(final String uri, final String localName, final String qName) throws SAXException { LOG.trace("endElement uri={} localName={} qName={}", uri, localName, qName); if (this.isNotInkstandNamespace(uri)) { return; } switch (localName) { case "rootNode": LOG.debug("Closing rootNode"); this.nodeStack.pop(); break; case "node": LOG.debug("Closing node"); this.nodeStack.pop(); break; case "mixin": LOG.debug("Closing mixin"); break; case "property": this.endElementProperty(); break; default: break; } }
java
@Override public void endElement(final String uri, final String localName, final String qName) throws SAXException { LOG.trace("endElement uri={} localName={} qName={}", uri, localName, qName); if (this.isNotInkstandNamespace(uri)) { return; } switch (localName) { case "rootNode": LOG.debug("Closing rootNode"); this.nodeStack.pop(); break; case "node": LOG.debug("Closing node"); this.nodeStack.pop(); break; case "mixin": LOG.debug("Closing mixin"); break; case "property": this.endElementProperty(); break; default: break; } }
[ "@", "Override", "public", "void", "endElement", "(", "final", "String", "uri", ",", "final", "String", "localName", ",", "final", "String", "qName", ")", "throws", "SAXException", "{", "LOG", ".", "trace", "(", "\"endElement uri={} localName={} qName={}\"", ",", ...
Depending on the element, which has to be in the correct namespace, the method adds a property to the node or removes completed nodes from the node stack.
[ "Depending", "on", "the", "element", "which", "has", "to", "be", "in", "the", "correct", "namespace", "the", "method", "adds", "a", "property", "to", "the", "node", "or", "removes", "completed", "nodes", "from", "the", "node", "stack", "." ]
train
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-jcr/src/main/java/io/inkstand/scribble/jcr/rules/util/XMLContentHandler.java#L194-L219
looly/hutool
hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java
ThreadUtil.newThread
public static Thread newThread(Runnable runnable, String name) { final Thread t = newThread(runnable, name, false); if (t.getPriority() != Thread.NORM_PRIORITY) { t.setPriority(Thread.NORM_PRIORITY); } return t; }
java
public static Thread newThread(Runnable runnable, String name) { final Thread t = newThread(runnable, name, false); if (t.getPriority() != Thread.NORM_PRIORITY) { t.setPriority(Thread.NORM_PRIORITY); } return t; }
[ "public", "static", "Thread", "newThread", "(", "Runnable", "runnable", ",", "String", "name", ")", "{", "final", "Thread", "t", "=", "newThread", "(", "runnable", ",", "name", ",", "false", ")", ";", "if", "(", "t", ".", "getPriority", "(", ")", "!=",...
创建新线程,非守护线程,正常优先级,线程组与当前线程的线程组一致 @param runnable {@link Runnable} @param name 线程名 @return {@link Thread} @since 3.1.2
[ "创建新线程,非守护线程,正常优先级,线程组与当前线程的线程组一致" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/thread/ThreadUtil.java#L179-L185
http-builder-ng/http-builder-ng
http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java
HttpBuilder.patchAsync
public CompletableFuture<Object> patchAsync(final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> patch(configuration), getExecutor()); }
java
public CompletableFuture<Object> patchAsync(final Consumer<HttpConfig> configuration) { return CompletableFuture.supplyAsync(() -> patch(configuration), getExecutor()); }
[ "public", "CompletableFuture", "<", "Object", ">", "patchAsync", "(", "final", "Consumer", "<", "HttpConfig", ">", "configuration", ")", "{", "return", "CompletableFuture", ".", "supplyAsync", "(", "(", ")", "->", "patch", "(", "configuration", ")", ",", "getE...
Executes an asynchronous PATCH request on the configured URI (asynchronous alias to `patch(Consumer)`), with additional configuration provided by the configuration function. This method is generally used for Java-specific configuration. [source,java] ---- HttpBuilder http = HttpBuilder.configure(config -> { config.getRequest().setUri("http://localhost:10101"); }); CompletableFuture<Object> future = http.patchAsync(config -> { config.getRequest().getUri().setPath("/foo"); }); Object result = future.get(); ---- The `configuration` function allows additional configuration for this request based on the {@link HttpConfig} interface. @param configuration the additional configuration closure (delegated to {@link HttpConfig}) @return the resulting content wrapped in a {@link CompletableFuture}
[ "Executes", "an", "asynchronous", "PATCH", "request", "on", "the", "configured", "URI", "(", "asynchronous", "alias", "to", "patch", "(", "Consumer", ")", ")", "with", "additional", "configuration", "provided", "by", "the", "configuration", "function", "." ]
train
https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/HttpBuilder.java#L1691-L1693
vznet/mongo-jackson-mapper
src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java
JacksonDBCollection.findOne
public T findOne(DBObject query, DBObject fields) { return findOne(query, fields, getReadPreference()); }
java
public T findOne(DBObject query, DBObject fields) { return findOne(query, fields, getReadPreference()); }
[ "public", "T", "findOne", "(", "DBObject", "query", ",", "DBObject", "fields", ")", "{", "return", "findOne", "(", "query", ",", "fields", ",", "getReadPreference", "(", ")", ")", ";", "}" ]
Returns a single object from this collection matching the query. @param query the query object @param fields the fields to return @return the object found, or <code>null</code> if no such object exists
[ "Returns", "a", "single", "object", "from", "this", "collection", "matching", "the", "query", "." ]
train
https://github.com/vznet/mongo-jackson-mapper/blob/ecd189aefa89636cddf70fb383f5d676be347976/src/main/java/net/vz/mongodb/jackson/JacksonDBCollection.java#L902-L904
apache/flink
flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java
PatternStream.flatSelect
public <L, R> SingleOutputStreamOperator<R> flatSelect( final OutputTag<L> timedOutPartialMatchesTag, final PatternFlatTimeoutFunction<T, L> patternFlatTimeoutFunction, final TypeInformation<R> outTypeInfo, final PatternFlatSelectFunction<T, R> patternFlatSelectFunction) { final PatternProcessFunction<T, R> processFunction = fromFlatSelect(builder.clean(patternFlatSelectFunction)) .withTimeoutHandler(timedOutPartialMatchesTag, builder.clean(patternFlatTimeoutFunction)) .build(); return process(processFunction, outTypeInfo); }
java
public <L, R> SingleOutputStreamOperator<R> flatSelect( final OutputTag<L> timedOutPartialMatchesTag, final PatternFlatTimeoutFunction<T, L> patternFlatTimeoutFunction, final TypeInformation<R> outTypeInfo, final PatternFlatSelectFunction<T, R> patternFlatSelectFunction) { final PatternProcessFunction<T, R> processFunction = fromFlatSelect(builder.clean(patternFlatSelectFunction)) .withTimeoutHandler(timedOutPartialMatchesTag, builder.clean(patternFlatTimeoutFunction)) .build(); return process(processFunction, outTypeInfo); }
[ "public", "<", "L", ",", "R", ">", "SingleOutputStreamOperator", "<", "R", ">", "flatSelect", "(", "final", "OutputTag", "<", "L", ">", "timedOutPartialMatchesTag", ",", "final", "PatternFlatTimeoutFunction", "<", "T", ",", "L", ">", "patternFlatTimeoutFunction", ...
Applies a flat select function to the detected pattern sequence. For each pattern sequence the provided {@link PatternFlatSelectFunction} is called. The pattern select function can produce exactly one resulting element. <p>Applies a timeout function to a partial pattern sequence which has timed out. For each partial pattern sequence the provided {@link PatternFlatTimeoutFunction} is called. The pattern timeout function can produce exactly one resulting element. <p>You can get the stream of timed-out data resulting from the {@link SingleOutputStreamOperator#getSideOutput(OutputTag)} on the {@link SingleOutputStreamOperator} resulting from the select operation with the same {@link OutputTag}. @param timedOutPartialMatchesTag {@link OutputTag} that identifies side output with timed out patterns @param patternFlatTimeoutFunction The pattern timeout function which is called for each partial pattern sequence which has timed out. @param patternFlatSelectFunction The pattern select function which is called for each detected pattern sequence. @param outTypeInfo Explicit specification of output type. @param <L> Type of the resulting timeout elements @param <R> Type of the resulting elements @return {@link DataStream} which contains the resulting elements with the resulting timeout elements in a side output.
[ "Applies", "a", "flat", "select", "function", "to", "the", "detected", "pattern", "sequence", ".", "For", "each", "pattern", "sequence", "the", "provided", "{", "@link", "PatternFlatSelectFunction", "}", "is", "called", ".", "The", "pattern", "select", "function...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/PatternStream.java#L440-L452
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java
SimpleCompareFileExtensions.compareFilesByContent
public static boolean compareFilesByContent(final File sourceFile, final File fileToCompare) { return CompareFileExtensions .compareFiles(sourceFile, fileToCompare, true, true, true, true, true, false) .getContentEquality(); }
java
public static boolean compareFilesByContent(final File sourceFile, final File fileToCompare) { return CompareFileExtensions .compareFiles(sourceFile, fileToCompare, true, true, true, true, true, false) .getContentEquality(); }
[ "public", "static", "boolean", "compareFilesByContent", "(", "final", "File", "sourceFile", ",", "final", "File", "fileToCompare", ")", "{", "return", "CompareFileExtensions", ".", "compareFiles", "(", "sourceFile", ",", "fileToCompare", ",", "true", ",", "true", ...
Compare files by content. @param sourceFile the source file @param fileToCompare the file to compare @return true if the content are equal, otherwise false.
[ "Compare", "files", "by", "content", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/compare/SimpleCompareFileExtensions.java#L131-L136
mgormley/pacaya
src/main/java/edu/jhu/pacaya/autodiff/StochasticGradientApproximation.java
StochasticGradientApproximation.getGradDotDirApprox
public static double getGradDotDirApprox(Function fn, IntDoubleVector x, IntDoubleVector d) { return getGradDotDirApprox(fn, x, d, getEpsilon(x, d)); }
java
public static double getGradDotDirApprox(Function fn, IntDoubleVector x, IntDoubleVector d) { return getGradDotDirApprox(fn, x, d, getEpsilon(x, d)); }
[ "public", "static", "double", "getGradDotDirApprox", "(", "Function", "fn", ",", "IntDoubleVector", "x", ",", "IntDoubleVector", "d", ")", "{", "return", "getGradDotDirApprox", "(", "fn", ",", "x", ",", "d", ",", "getEpsilon", "(", "x", ",", "d", ")", ")",...
Compute f'(x)^T d = ( L(x + c * d) - L(x - c * d) ) / (2c) @param fn Function, f. @param x Point at which to evaluate the gradient, x. @param d Random direction, d. @param c Epsilon constant. @return
[ "Compute", "f", "(", "x", ")", "^T", "d", "=", "(", "L", "(", "x", "+", "c", "*", "d", ")", "-", "L", "(", "x", "-", "c", "*", "d", ")", ")", "/", "(", "2c", ")" ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/autodiff/StochasticGradientApproximation.java#L86-L88
stripe/stripe-java
src/main/java/com/stripe/model/File.java
File.create
public static File create(FileCreateParams params, RequestOptions options) throws StripeException { checkNullTypedParams(classUrl(File.class, Stripe.getUploadBase()), params); return create(params.toMap(), options); }
java
public static File create(FileCreateParams params, RequestOptions options) throws StripeException { checkNullTypedParams(classUrl(File.class, Stripe.getUploadBase()), params); return create(params.toMap(), options); }
[ "public", "static", "File", "create", "(", "FileCreateParams", "params", ",", "RequestOptions", "options", ")", "throws", "StripeException", "{", "checkNullTypedParams", "(", "classUrl", "(", "File", ".", "class", ",", "Stripe", ".", "getUploadBase", "(", ")", "...
To upload a file to Stripe, you’ll need to send a request of type {@code multipart/form-data}. The request should contain the file you would like to upload, as well as the parameters for creating a file.
[ "To", "upload", "a", "file", "to", "Stripe", "you’ll", "need", "to", "send", "a", "request", "of", "type", "{" ]
train
https://github.com/stripe/stripe-java/blob/acfa8becef3e73bfe3e9d8880bea3f3f30dadeac/src/main/java/com/stripe/model/File.java#L93-L97
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/StringUtils.java
StringUtils.printToFileLn
public static void printToFileLn(File file, String message, boolean append) { PrintWriter pw = null; try { Writer fw = new FileWriter(file, append); pw = new PrintWriter(fw); pw.println(message); } catch (Exception e) { System.err.println("Exception: in printToFileLn " + file.getAbsolutePath() + ' ' + message); e.printStackTrace(); } finally { if (pw != null) { pw.flush(); pw.close(); } } }
java
public static void printToFileLn(File file, String message, boolean append) { PrintWriter pw = null; try { Writer fw = new FileWriter(file, append); pw = new PrintWriter(fw); pw.println(message); } catch (Exception e) { System.err.println("Exception: in printToFileLn " + file.getAbsolutePath() + ' ' + message); e.printStackTrace(); } finally { if (pw != null) { pw.flush(); pw.close(); } } }
[ "public", "static", "void", "printToFileLn", "(", "File", "file", ",", "String", "message", ",", "boolean", "append", ")", "{", "PrintWriter", "pw", "=", "null", ";", "try", "{", "Writer", "fw", "=", "new", "FileWriter", "(", "file", ",", "append", ")", ...
Prints to a file. If the file already exists, appends if <code>append=true</code>, and overwrites if <code>append=false</code>.
[ "Prints", "to", "a", "file", ".", "If", "the", "file", "already", "exists", "appends", "if", "<code", ">", "append", "=", "true<", "/", "code", ">", "and", "overwrites", "if", "<code", ">", "append", "=", "false<", "/", "code", ">", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/StringUtils.java#L909-L924
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/TimedMessage.java
TimedMessage.addMessage
public void addMessage(String message, int x, int y, long time) { messages.add(new MessageData(message, x, y, time)); hasMessage = true; }
java
public void addMessage(String message, int x, int y, long time) { messages.add(new MessageData(message, x, y, time)); hasMessage = true; }
[ "public", "void", "addMessage", "(", "String", "message", ",", "int", "x", ",", "int", "y", ",", "long", "time", ")", "{", "messages", ".", "add", "(", "new", "MessageData", "(", "message", ",", "x", ",", "y", ",", "time", ")", ")", ";", "hasMessag...
Add a timed message. @param message The message string. @param x The horizontal location. @param y The vertical location. @param time The remaining time.
[ "Add", "a", "timed", "message", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/TimedMessage.java#L69-L73
apache/incubator-gobblin
gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/restore/LKGRestorePolicy.java
LKGRestorePolicy.isRestorable
private boolean isRestorable(HivePartitionDataset dataset, HivePartitionVersion version) throws IOException { if (version.getLocation().toString().equalsIgnoreCase(dataset.getLocation().toString())) { return false; } FileSystem fs = ProxyUtils.getOwnerFs(new State(this.state), version.getOwner()); if (!HadoopUtils.hasContent(fs, version.getLocation())) { return false; } return true; }
java
private boolean isRestorable(HivePartitionDataset dataset, HivePartitionVersion version) throws IOException { if (version.getLocation().toString().equalsIgnoreCase(dataset.getLocation().toString())) { return false; } FileSystem fs = ProxyUtils.getOwnerFs(new State(this.state), version.getOwner()); if (!HadoopUtils.hasContent(fs, version.getLocation())) { return false; } return true; }
[ "private", "boolean", "isRestorable", "(", "HivePartitionDataset", "dataset", ",", "HivePartitionVersion", "version", ")", "throws", "IOException", "{", "if", "(", "version", ".", "getLocation", "(", ")", ".", "toString", "(", ")", ".", "equalsIgnoreCase", "(", ...
A version is called restorable if it can be used to restore dataset. If a version is pointing to same data location as of the dataset, then it can't be used for restoring If a version is pointing to an empty data location, then it can't be used for restoring
[ "A", "version", "is", "called", "restorable", "if", "it", "can", "be", "used", "to", "restore", "dataset", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/restore/LKGRestorePolicy.java#L81-L91
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/ocr/AipOcr.java
AipOcr.tableResultGet
public JSONObject tableResultGet(String requestId, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("request_id", requestId); if (options != null) { request.addBody(options); } request.setUri(OcrConsts.TABLE_RESULT_GET); postOperation(request); return requestServer(request); }
java
public JSONObject tableResultGet(String requestId, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("request_id", requestId); if (options != null) { request.addBody(options); } request.setUri(OcrConsts.TABLE_RESULT_GET); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "tableResultGet", "(", "String", "requestId", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "request...
表格识别结果接口 获取表格文字识别结果 @param requestId - 发送表格文字识别请求时返回的request id @param options - 可选参数对象,key: value都为string类型 options - options列表: result_type 期望获取结果的类型,取值为“excel”时返回xls文件的地址,取值为“json”时返回json格式的字符串,默认为”excel” @return JSONObject
[ "表格识别结果接口", "获取表格文字识别结果" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/ocr/AipOcr.java#L929-L940
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseIfStatement
private Stmt.IfElse parseIfStatement(EnclosingScope scope) { int start = index; // An if statement begins with the keyword "if", followed by an // expression representing the condition. match(If); // NOTE: expression terminated by ':' Expr c = parseLogicalExpression(scope, true); // The a colon to signal the start of a block. match(Colon); matchEndLine(); int end = index; // First, parse the true branch, which is required Stmt.Block tblk = parseBlock(scope, scope.isInLoop()); // Second, attempt to parse the false branch, which is optional. Stmt.Block fblk = null; if (tryAndMatchAtIndent(true, scope.getIndent(), Else) != null) { int if_start = index; if (tryAndMatch(true, If) != null) { // This is an if-chain, so backtrack and parse a complete If index = if_start; fblk = new Stmt.Block(parseIfStatement(scope)); } else { match(Colon); matchEndLine(); fblk = parseBlock(scope, scope.isInLoop()); } } Stmt.IfElse stmt; if(fblk == null) { stmt = new Stmt.IfElse(c, tblk); } else { stmt = new Stmt.IfElse(c, tblk, fblk); } // Done! return annotateSourceLocation(stmt, start, end-1); }
java
private Stmt.IfElse parseIfStatement(EnclosingScope scope) { int start = index; // An if statement begins with the keyword "if", followed by an // expression representing the condition. match(If); // NOTE: expression terminated by ':' Expr c = parseLogicalExpression(scope, true); // The a colon to signal the start of a block. match(Colon); matchEndLine(); int end = index; // First, parse the true branch, which is required Stmt.Block tblk = parseBlock(scope, scope.isInLoop()); // Second, attempt to parse the false branch, which is optional. Stmt.Block fblk = null; if (tryAndMatchAtIndent(true, scope.getIndent(), Else) != null) { int if_start = index; if (tryAndMatch(true, If) != null) { // This is an if-chain, so backtrack and parse a complete If index = if_start; fblk = new Stmt.Block(parseIfStatement(scope)); } else { match(Colon); matchEndLine(); fblk = parseBlock(scope, scope.isInLoop()); } } Stmt.IfElse stmt; if(fblk == null) { stmt = new Stmt.IfElse(c, tblk); } else { stmt = new Stmt.IfElse(c, tblk, fblk); } // Done! return annotateSourceLocation(stmt, start, end-1); }
[ "private", "Stmt", ".", "IfElse", "parseIfStatement", "(", "EnclosingScope", "scope", ")", "{", "int", "start", "=", "index", ";", "// An if statement begins with the keyword \"if\", followed by an", "// expression representing the condition.", "match", "(", "If", ")", ";",...
Parse a classical if-else statement, which is has the form: <pre> "if" Expr ':' NewLine Block ["else" ':' NewLine Block] </pre> The first expression is referred to as the <i>condition</i>, while the first block is referred to as the <i>true branch</i>. The optional second block is referred to as the <i>false branch</i>. @see wyc.lang.Stmt.IfElse @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @return
[ "Parse", "a", "classical", "if", "-", "else", "statement", "which", "is", "has", "the", "form", ":" ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L1125-L1162
openengsb/openengsb
components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java
AbstractEDBService.addModifiedObjectsToEntityManager
private void addModifiedObjectsToEntityManager(List<JPAObject> modified, Long timestamp) { for (JPAObject update : modified) { update.setTimestamp(timestamp); entityManager.persist(update); } }
java
private void addModifiedObjectsToEntityManager(List<JPAObject> modified, Long timestamp) { for (JPAObject update : modified) { update.setTimestamp(timestamp); entityManager.persist(update); } }
[ "private", "void", "addModifiedObjectsToEntityManager", "(", "List", "<", "JPAObject", ">", "modified", ",", "Long", "timestamp", ")", "{", "for", "(", "JPAObject", "update", ":", "modified", ")", "{", "update", ".", "setTimestamp", "(", "timestamp", ")", ";",...
Updates all modified EDBObjects with the timestamp and persist them through the entity manager.
[ "Updates", "all", "modified", "EDBObjects", "with", "the", "timestamp", "and", "persist", "them", "through", "the", "entity", "manager", "." ]
train
https://github.com/openengsb/openengsb/blob/d39058000707f617cd405629f9bc7f17da7b414a/components/edb/src/main/java/org/openengsb/core/edb/jpa/internal/AbstractEDBService.java#L125-L130
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java
GeneratorNodeExtensions.appendNewLineIfNotEmpty
public CompositeGeneratorNode appendNewLineIfNotEmpty(final CompositeGeneratorNode parent) { List<IGeneratorNode> _children = parent.getChildren(); String _lineDelimiter = this.wsConfig.getLineDelimiter(); NewLineNode _newLineNode = new NewLineNode(_lineDelimiter, true); _children.add(_newLineNode); return parent; }
java
public CompositeGeneratorNode appendNewLineIfNotEmpty(final CompositeGeneratorNode parent) { List<IGeneratorNode> _children = parent.getChildren(); String _lineDelimiter = this.wsConfig.getLineDelimiter(); NewLineNode _newLineNode = new NewLineNode(_lineDelimiter, true); _children.add(_newLineNode); return parent; }
[ "public", "CompositeGeneratorNode", "appendNewLineIfNotEmpty", "(", "final", "CompositeGeneratorNode", "parent", ")", "{", "List", "<", "IGeneratorNode", ">", "_children", "=", "parent", ".", "getChildren", "(", ")", ";", "String", "_lineDelimiter", "=", "this", "."...
Appends a line separator node that will only be effective if the current line contains non-whitespace text. @return the given parent node
[ "Appends", "a", "line", "separator", "node", "that", "will", "only", "be", "effective", "if", "the", "current", "line", "contains", "non", "-", "whitespace", "text", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java#L121-L127
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/rendertheme/rule/RenderTheme.java
RenderTheme.matchClosedWay
public void matchClosedWay(RenderCallback renderCallback, final RenderContext renderContext, PolylineContainer way) { matchWay(renderCallback, renderContext, Closed.YES, way); }
java
public void matchClosedWay(RenderCallback renderCallback, final RenderContext renderContext, PolylineContainer way) { matchWay(renderCallback, renderContext, Closed.YES, way); }
[ "public", "void", "matchClosedWay", "(", "RenderCallback", "renderCallback", ",", "final", "RenderContext", "renderContext", ",", "PolylineContainer", "way", ")", "{", "matchWay", "(", "renderCallback", ",", "renderContext", ",", "Closed", ".", "YES", ",", "way", ...
Matches a closed way with the given parameters against this RenderTheme. @param renderCallback the callback implementation which will be executed on each match. @param renderContext @param way
[ "Matches", "a", "closed", "way", "with", "the", "given", "parameters", "against", "this", "RenderTheme", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/rendertheme/rule/RenderTheme.java#L111-L113
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/AbstractCommand.java
AbstractCommand.createMenuItem
public final JMenuItem createMenuItem(MenuFactory menuFactory, CommandButtonConfigurer buttonConfigurer) { return createMenuItem(getDefaultFaceDescriptorId(), menuFactory, buttonConfigurer); }
java
public final JMenuItem createMenuItem(MenuFactory menuFactory, CommandButtonConfigurer buttonConfigurer) { return createMenuItem(getDefaultFaceDescriptorId(), menuFactory, buttonConfigurer); }
[ "public", "final", "JMenuItem", "createMenuItem", "(", "MenuFactory", "menuFactory", ",", "CommandButtonConfigurer", "buttonConfigurer", ")", "{", "return", "createMenuItem", "(", "getDefaultFaceDescriptorId", "(", ")", ",", "menuFactory", ",", "buttonConfigurer", ")", ...
Create a menuItem using the default faceDescriptorId. @see #createMenuItem(String, MenuFactory, CommandButtonConfigurer)
[ "Create", "a", "menuItem", "using", "the", "default", "faceDescriptorId", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/AbstractCommand.java#L831-L833
spring-projects/spring-social
spring-social-web/src/main/java/org/springframework/social/connect/web/ConnectController.java
ConnectController.connectionStatusRedirect
protected RedirectView connectionStatusRedirect(String providerId, NativeWebRequest request) { HttpServletRequest servletRequest = request.getNativeRequest(HttpServletRequest.class); String path = connectionStatusUrlPath + providerId + getPathExtension(servletRequest); if (prependServletPath(servletRequest)) { path = servletRequest.getServletPath() + path; } return new RedirectView(path, true); }
java
protected RedirectView connectionStatusRedirect(String providerId, NativeWebRequest request) { HttpServletRequest servletRequest = request.getNativeRequest(HttpServletRequest.class); String path = connectionStatusUrlPath + providerId + getPathExtension(servletRequest); if (prependServletPath(servletRequest)) { path = servletRequest.getServletPath() + path; } return new RedirectView(path, true); }
[ "protected", "RedirectView", "connectionStatusRedirect", "(", "String", "providerId", ",", "NativeWebRequest", "request", ")", "{", "HttpServletRequest", "servletRequest", "=", "request", ".", "getNativeRequest", "(", "HttpServletRequest", ".", "class", ")", ";", "Strin...
Returns a RedirectView with the URL to redirect to after a connection is created or deleted. Defaults to "/connect/{providerId}" relative to DispatcherServlet's path. May be overridden to handle custom redirection needs. @param providerId the ID of the provider for which a connection was created or deleted. @param request the NativeWebRequest used to access the servlet path when constructing the redirect path. @return a RedirectView to the page to be displayed after a connection is created or deleted
[ "Returns", "a", "RedirectView", "with", "the", "URL", "to", "redirect", "to", "after", "a", "connection", "is", "created", "or", "deleted", ".", "Defaults", "to", "/", "connect", "/", "{", "providerId", "}", "relative", "to", "DispatcherServlet", "s", "path"...
train
https://github.com/spring-projects/spring-social/blob/e41cfecb288022b83c79413b58f52511c3c9d4fc/spring-social-web/src/main/java/org/springframework/social/connect/web/ConnectController.java#L400-L407
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/fit/MapColumnFixture.java
MapColumnFixture.getParameter
private String getParameter(String paramKey, String defaultValue) { String paramValue = defaultValue; if (StringUtils.isNotBlank(paramKey) && args != null && args.length > 0) { for (String arg : args) { String[] parameter = arg.split("="); if (parameter != null && parameter.length == 2 && paramKey.equals(parameter[0])) { paramValue = parameter[1]; break; } } } return paramValue; }
java
private String getParameter(String paramKey, String defaultValue) { String paramValue = defaultValue; if (StringUtils.isNotBlank(paramKey) && args != null && args.length > 0) { for (String arg : args) { String[] parameter = arg.split("="); if (parameter != null && parameter.length == 2 && paramKey.equals(parameter[0])) { paramValue = parameter[1]; break; } } } return paramValue; }
[ "private", "String", "getParameter", "(", "String", "paramKey", ",", "String", "defaultValue", ")", "{", "String", "paramValue", "=", "defaultValue", ";", "if", "(", "StringUtils", ".", "isNotBlank", "(", "paramKey", ")", "&&", "args", "!=", "null", "&&", "a...
Gets fixture parameter value by parameter key match. Parameter should be defined in format <parameterKey>=<parameterValue>. @param paramKey parameter key @param defaultValue default parameter value @return the fixture parameter value
[ "Gets", "fixture", "parameter", "value", "by", "parameter", "key", "match", ".", "Parameter", "should", "be", "defined", "in", "format", "<parameterKey", ">", "=", "<parameterValue", ">", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/fit/MapColumnFixture.java#L457-L469
actorapp/actor-platform
actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java
MarkdownParser.findCodeBlockEnd
private int findCodeBlockEnd(TextCursor cursor, int blockStart) { int offset = blockStart + 3; int index; while ((index = cursor.text.indexOf(CODE_BLOCK, offset)) >= 0) { if (isGoodAnchor(cursor.text, index + 3)) { return index + 3; } offset = index + 1; } return -1; }
java
private int findCodeBlockEnd(TextCursor cursor, int blockStart) { int offset = blockStart + 3; int index; while ((index = cursor.text.indexOf(CODE_BLOCK, offset)) >= 0) { if (isGoodAnchor(cursor.text, index + 3)) { return index + 3; } offset = index + 1; } return -1; }
[ "private", "int", "findCodeBlockEnd", "(", "TextCursor", "cursor", ",", "int", "blockStart", ")", "{", "int", "offset", "=", "blockStart", "+", "3", ";", "int", "index", ";", "while", "(", "(", "index", "=", "cursor", ".", "text", ".", "indexOf", "(", ...
Searching for valid code block end @param cursor text cursor @param blockStart start of expected code block @return code block end, -1 if not found
[ "Searching", "for", "valid", "code", "block", "end" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/runtime/runtime-shared/src/main/java/im/actor/runtime/markdown/MarkdownParser.java#L252-L262
aNNiMON/Lightweight-Stream-API
stream/src/main/java/com/annimon/stream/LongStream.java
LongStream.peek
@NotNull public LongStream peek(@NotNull final LongConsumer action) { return new LongStream(params, new LongPeek(iterator, action)); }
java
@NotNull public LongStream peek(@NotNull final LongConsumer action) { return new LongStream(params, new LongPeek(iterator, action)); }
[ "@", "NotNull", "public", "LongStream", "peek", "(", "@", "NotNull", "final", "LongConsumer", "action", ")", "{", "return", "new", "LongStream", "(", "params", ",", "new", "LongPeek", "(", "iterator", ",", "action", ")", ")", ";", "}" ]
Performs provided action on each element. <p>This is an intermediate operation. @param action the action to be performed on each element @return the new stream
[ "Performs", "provided", "action", "on", "each", "element", "." ]
train
https://github.com/aNNiMON/Lightweight-Stream-API/blob/f29fd57208c20252a4549b084d55ed082c3e58f0/stream/src/main/java/com/annimon/stream/LongStream.java#L657-L660
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaBindTexture
public static int cudaBindTexture(long offset[], textureReference texref, Pointer devPtr, cudaChannelFormatDesc desc, long size) { return checkResult(cudaBindTextureNative(offset, texref, devPtr, desc, size)); }
java
public static int cudaBindTexture(long offset[], textureReference texref, Pointer devPtr, cudaChannelFormatDesc desc, long size) { return checkResult(cudaBindTextureNative(offset, texref, devPtr, desc, size)); }
[ "public", "static", "int", "cudaBindTexture", "(", "long", "offset", "[", "]", ",", "textureReference", "texref", ",", "Pointer", "devPtr", ",", "cudaChannelFormatDesc", "desc", ",", "long", "size", ")", "{", "return", "checkResult", "(", "cudaBindTextureNative", ...
[C++ API] Binds a memory area to a texture <pre> template < class T, int dim, enum cudaTextureReadMode readMode > cudaError_t cudaBindTexture ( size_t* offset, const texture < T, dim, readMode > & tex, const void* devPtr, const cudaChannelFormatDesc& desc, size_t size = UINT_MAX ) [inline] </pre> <div> <p>[C++ API] Binds a memory area to a texture Binds <tt>size</tt> bytes of the memory area pointed to by <tt>devPtr</tt> to texture reference <tt>tex</tt>. <tt>desc</tt> describes how the memory is interpreted when fetching values from the texture. The <tt>offset</tt> parameter is an optional byte offset as with the low-level cudaBindTexture() function. Any memory previously bound to <tt>tex</tt> is unbound. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param offset Offset in bytes @param texref Texture to bind @param devPtr Memory area on device @param desc Channel format @param size Size of the memory area pointed to by devPtr @param offset Offset in bytes @param tex Texture to bind @param devPtr Memory area on device @param size Size of the memory area pointed to by devPtr @param offset Offset in bytes @param tex Texture to bind @param devPtr Memory area on device @param desc Channel format @param size Size of the memory area pointed to by devPtr @return cudaSuccess, cudaErrorInvalidValue, cudaErrorInvalidDevicePointer, cudaErrorInvalidTexture @see JCuda#cudaCreateChannelDesc @see JCuda#cudaGetChannelDesc @see JCuda#cudaGetTextureReference @see JCuda#cudaBindTexture @see JCuda#cudaBindTexture @see JCuda#cudaBindTexture2D @see JCuda#cudaBindTexture2D @see JCuda#cudaBindTextureToArray @see JCuda#cudaBindTextureToArray @see JCuda#cudaUnbindTexture @see JCuda#cudaGetTextureAlignmentOffset
[ "[", "C", "++", "API", "]", "Binds", "a", "memory", "area", "to", "a", "texture" ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L9053-L9056
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.writeAsciiString
public static void writeAsciiString(AsciiString s, ByteBuffer buf) { short length=(short)(s != null? s.length() : -1); buf.putShort(length); if(s != null) buf.put(s.chars()); }
java
public static void writeAsciiString(AsciiString s, ByteBuffer buf) { short length=(short)(s != null? s.length() : -1); buf.putShort(length); if(s != null) buf.put(s.chars()); }
[ "public", "static", "void", "writeAsciiString", "(", "AsciiString", "s", ",", "ByteBuffer", "buf", ")", "{", "short", "length", "=", "(", "short", ")", "(", "s", "!=", "null", "?", "s", ".", "length", "(", ")", ":", "-", "1", ")", ";", "buf", ".", ...
Writes an AsciiString to buf. The length of the string is written first, followed by the chars (as single-byte values). @param s the string @param buf the buffer
[ "Writes", "an", "AsciiString", "to", "buf", ".", "The", "length", "of", "the", "string", "is", "written", "first", "followed", "by", "the", "chars", "(", "as", "single", "-", "byte", "values", ")", "." ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L695-L700
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.recoverDeletedSasDefinition
public SasDefinitionBundle recoverDeletedSasDefinition(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) { return recoverDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).toBlocking().single().body(); }
java
public SasDefinitionBundle recoverDeletedSasDefinition(String vaultBaseUrl, String storageAccountName, String sasDefinitionName) { return recoverDeletedSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName).toBlocking().single().body(); }
[ "public", "SasDefinitionBundle", "recoverDeletedSasDefinition", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "String", "sasDefinitionName", ")", "{", "return", "recoverDeletedSasDefinitionWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "storageA...
Recovers the deleted SAS definition. Recovers the deleted SAS definition for the specified storage account. This operation can only be performed on a soft-delete enabled vault. This operation requires the storage/recover permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param sasDefinitionName The name of the SAS definition. @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SasDefinitionBundle object if successful.
[ "Recovers", "the", "deleted", "SAS", "definition", ".", "Recovers", "the", "deleted", "SAS", "definition", "for", "the", "specified", "storage", "account", ".", "This", "operation", "can", "only", "be", "performed", "on", "a", "soft", "-", "delete", "enabled",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L10975-L10977
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.toCompoundCurveFromOptions
public CompoundCurve toCompoundCurveFromOptions( MultiPolylineOptions multiPolylineOptions, boolean hasZ, boolean hasM) { CompoundCurve compoundCurve = new CompoundCurve(hasZ, hasM); for (PolylineOptions polyline : multiPolylineOptions .getPolylineOptions()) { LineString lineString = toLineString(polyline); compoundCurve.addLineString(lineString); } return compoundCurve; }
java
public CompoundCurve toCompoundCurveFromOptions( MultiPolylineOptions multiPolylineOptions, boolean hasZ, boolean hasM) { CompoundCurve compoundCurve = new CompoundCurve(hasZ, hasM); for (PolylineOptions polyline : multiPolylineOptions .getPolylineOptions()) { LineString lineString = toLineString(polyline); compoundCurve.addLineString(lineString); } return compoundCurve; }
[ "public", "CompoundCurve", "toCompoundCurveFromOptions", "(", "MultiPolylineOptions", "multiPolylineOptions", ",", "boolean", "hasZ", ",", "boolean", "hasM", ")", "{", "CompoundCurve", "compoundCurve", "=", "new", "CompoundCurve", "(", "hasZ", ",", "hasM", ")", ";", ...
Convert a {@link MultiPolylineOptions} to a {@link CompoundCurve} @param multiPolylineOptions multi polyline options @param hasZ has z flag @param hasM has m flag @return compound curve
[ "Convert", "a", "{", "@link", "MultiPolylineOptions", "}", "to", "a", "{", "@link", "CompoundCurve", "}" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L969-L982
medallia/Word2VecJava
src/main/java/com/medallia/word2vec/util/IO.java
IO.copyAndCloseBoth
public static long copyAndCloseBoth(InputStream input, OutputStream output) throws IOException { try (InputStream inputStream = input) { return copyAndCloseOutput(inputStream, output); } }
java
public static long copyAndCloseBoth(InputStream input, OutputStream output) throws IOException { try (InputStream inputStream = input) { return copyAndCloseOutput(inputStream, output); } }
[ "public", "static", "long", "copyAndCloseBoth", "(", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "try", "(", "InputStream", "inputStream", "=", "input", ")", "{", "return", "copyAndCloseOutput", "(", "inputStream", ","...
Copy input to output and close both the input and output streams before returning
[ "Copy", "input", "to", "output", "and", "close", "both", "the", "input", "and", "output", "streams", "before", "returning" ]
train
https://github.com/medallia/Word2VecJava/blob/eb31fbb99ac6bbab82d7f807b3e2240edca50eb7/src/main/java/com/medallia/word2vec/util/IO.java#L58-L62
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.missingConstructorException
private static NoSuchBeingException missingConstructorException(Class<?> clazz, Object... arguments) { Type[] types = new Type[arguments.length]; for(int i = 0; i < arguments.length; ++i) { types[i] = arguments[i].getClass(); } return new NoSuchBeingException("Missing constructor(%s) for |%s|.", Arrays.toString(types), clazz); }
java
private static NoSuchBeingException missingConstructorException(Class<?> clazz, Object... arguments) { Type[] types = new Type[arguments.length]; for(int i = 0; i < arguments.length; ++i) { types[i] = arguments[i].getClass(); } return new NoSuchBeingException("Missing constructor(%s) for |%s|.", Arrays.toString(types), clazz); }
[ "private", "static", "NoSuchBeingException", "missingConstructorException", "(", "Class", "<", "?", ">", "clazz", ",", "Object", "...", "arguments", ")", "{", "Type", "[", "]", "types", "=", "new", "Type", "[", "arguments", ".", "length", "]", ";", "for", ...
Helper for missing constructor exception. @param clazz constructor class, @param arguments constructor arguments. @return formatted exception.
[ "Helper", "for", "missing", "constructor", "exception", "." ]
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L1406-L1413
JM-Lab/utils-java9
src/main/java/kr/jm/utils/helper/JMJson.java
JMJson.withBytes
public static <T> T withBytes(byte[] bytes, Class<T> c) { try { return jsonMapper.readValue(bytes, c); } catch (Exception e) { return JMExceptionManager.handleExceptionAndReturnNull(log, e, "withBytes", new String(bytes)); } }
java
public static <T> T withBytes(byte[] bytes, Class<T> c) { try { return jsonMapper.readValue(bytes, c); } catch (Exception e) { return JMExceptionManager.handleExceptionAndReturnNull(log, e, "withBytes", new String(bytes)); } }
[ "public", "static", "<", "T", ">", "T", "withBytes", "(", "byte", "[", "]", "bytes", ",", "Class", "<", "T", ">", "c", ")", "{", "try", "{", "return", "jsonMapper", ".", "readValue", "(", "bytes", ",", "c", ")", ";", "}", "catch", "(", "Exception...
With bytes t. @param <T> the type parameter @param bytes the bytes @param c the c @return the t
[ "With", "bytes", "t", "." ]
train
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/helper/JMJson.java#L142-L149
real-logic/agrona
agrona/src/main/java/org/agrona/concurrent/status/CountersManager.java
CountersManager.newCounter
public AtomicCounter newCounter(final String label, final int typeId, final Consumer<MutableDirectBuffer> keyFunc) { return new AtomicCounter(valuesBuffer, allocate(label, typeId, keyFunc), this); }
java
public AtomicCounter newCounter(final String label, final int typeId, final Consumer<MutableDirectBuffer> keyFunc) { return new AtomicCounter(valuesBuffer, allocate(label, typeId, keyFunc), this); }
[ "public", "AtomicCounter", "newCounter", "(", "final", "String", "label", ",", "final", "int", "typeId", ",", "final", "Consumer", "<", "MutableDirectBuffer", ">", "keyFunc", ")", "{", "return", "new", "AtomicCounter", "(", "valuesBuffer", ",", "allocate", "(", ...
Allocate a counter record and wrap it with a new {@link AtomicCounter} for use. @param label to describe the counter. @param typeId for the type of counter. @param keyFunc for setting the key value for the counter. @return a newly allocated {@link AtomicCounter}
[ "Allocate", "a", "counter", "record", "and", "wrap", "it", "with", "a", "new", "{", "@link", "AtomicCounter", "}", "for", "use", "." ]
train
https://github.com/real-logic/agrona/blob/d1ea76e6e3598cd6a0d34879687652ef123f639b/agrona/src/main/java/org/agrona/concurrent/status/CountersManager.java#L320-L323
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java
SocketBindingJBossASClient.addSocketBinding
public void addSocketBinding(String socketBindingGroupName, String socketBindingName, int port) throws Exception { addSocketBinding(socketBindingGroupName, socketBindingName, null, port); }
java
public void addSocketBinding(String socketBindingGroupName, String socketBindingName, int port) throws Exception { addSocketBinding(socketBindingGroupName, socketBindingName, null, port); }
[ "public", "void", "addSocketBinding", "(", "String", "socketBindingGroupName", ",", "String", "socketBindingName", ",", "int", "port", ")", "throws", "Exception", "{", "addSocketBinding", "(", "socketBindingGroupName", ",", "socketBindingName", ",", "null", ",", "port...
Adds a socket binding with the given name in the named socket binding group. If a socket binding with the given name already exists, this method does nothing. @param socketBindingGroupName the name of the socket binding group in which to create the named socket binding @param socketBindingName the name of the socket binding to be created with the given port @param port the port number @throws Exception any error
[ "Adds", "a", "socket", "binding", "with", "the", "given", "name", "in", "the", "named", "socket", "binding", "group", ".", "If", "a", "socket", "binding", "with", "the", "given", "name", "already", "exists", "this", "method", "does", "nothing", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java#L116-L118
arakelian/more-commons
src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java
XmlStreamReaderUtils.createXMLStreamException
public static XMLStreamException createXMLStreamException( final String message, final XMLStreamReader reader, final Throwable cause) { final XMLStreamException exception = new XMLStreamException(message, reader.getLocation(), null); exception.initCause(cause); return exception; }
java
public static XMLStreamException createXMLStreamException( final String message, final XMLStreamReader reader, final Throwable cause) { final XMLStreamException exception = new XMLStreamException(message, reader.getLocation(), null); exception.initCause(cause); return exception; }
[ "public", "static", "XMLStreamException", "createXMLStreamException", "(", "final", "String", "message", ",", "final", "XMLStreamReader", "reader", ",", "final", "Throwable", "cause", ")", "{", "final", "XMLStreamException", "exception", "=", "new", "XMLStreamException"...
Returns new instance of <code>XMLStreamException</code> with given cause @param message exception message @param reader parser @param cause underlying cause @return <code>XMLStreamException</code> with given cause
[ "Returns", "new", "instance", "of", "<code", ">", "XMLStreamException<", "/", "code", ">", "with", "given", "cause" ]
train
https://github.com/arakelian/more-commons/blob/83c607044f64a7f6c005a67866c0ef7cb68d6e29/src/main/java/com/arakelian/core/utils/XmlStreamReaderUtils.java#L465-L472
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java
ClassUtil.getClassPaths
public static Set<String> getClassPaths(String packageName, boolean isDecode) { String packagePath = packageName.replace(StrUtil.DOT, StrUtil.SLASH); Enumeration<URL> resources; try { resources = getClassLoader().getResources(packagePath); } catch (IOException e) { throw new UtilException(e, "Loading classPath [{}] error!", packagePath); } final Set<String> paths = new HashSet<String>(); String path; while (resources.hasMoreElements()) { path = resources.nextElement().getPath(); paths.add(isDecode ? URLUtil.decode(path, CharsetUtil.systemCharsetName()) : path); } return paths; }
java
public static Set<String> getClassPaths(String packageName, boolean isDecode) { String packagePath = packageName.replace(StrUtil.DOT, StrUtil.SLASH); Enumeration<URL> resources; try { resources = getClassLoader().getResources(packagePath); } catch (IOException e) { throw new UtilException(e, "Loading classPath [{}] error!", packagePath); } final Set<String> paths = new HashSet<String>(); String path; while (resources.hasMoreElements()) { path = resources.nextElement().getPath(); paths.add(isDecode ? URLUtil.decode(path, CharsetUtil.systemCharsetName()) : path); } return paths; }
[ "public", "static", "Set", "<", "String", ">", "getClassPaths", "(", "String", "packageName", ",", "boolean", "isDecode", ")", "{", "String", "packagePath", "=", "packageName", ".", "replace", "(", "StrUtil", ".", "DOT", ",", "StrUtil", ".", "SLASH", ")", ...
获得ClassPath @param packageName 包名称 @param isDecode 是否解码路径中的特殊字符(例如空格和中文) @return ClassPath路径字符串集合 @since 4.0.11
[ "获得ClassPath" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ClassUtil.java#L419-L434
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/framework/Domain.java
Domain.chooseValue
public Object chooseValue(String vcf) throws IllegalValueChoiceFunction { if (!valueChoiceFunctions.containsKey(this.getClass())) throw new Error ("No value choice function defined for domains fo type " + this.getClass().getSimpleName()); HashMap<String,ValueChoiceFunction> vcfs = valueChoiceFunctions.get(this.getClass()); if (vcfs == null) throw new Error ("No value choice function defined for domains of type " + this.getClass().getSimpleName()); ValueChoiceFunction vcfunc = vcfs.get(vcf); if (vcfunc == null) throw new IllegalValueChoiceFunction(vcf, this.getClass().getSimpleName()); return vcfunc.getValue(this); }
java
public Object chooseValue(String vcf) throws IllegalValueChoiceFunction { if (!valueChoiceFunctions.containsKey(this.getClass())) throw new Error ("No value choice function defined for domains fo type " + this.getClass().getSimpleName()); HashMap<String,ValueChoiceFunction> vcfs = valueChoiceFunctions.get(this.getClass()); if (vcfs == null) throw new Error ("No value choice function defined for domains of type " + this.getClass().getSimpleName()); ValueChoiceFunction vcfunc = vcfs.get(vcf); if (vcfunc == null) throw new IllegalValueChoiceFunction(vcf, this.getClass().getSimpleName()); return vcfunc.getValue(this); }
[ "public", "Object", "chooseValue", "(", "String", "vcf", ")", "throws", "IllegalValueChoiceFunction", "{", "if", "(", "!", "valueChoiceFunctions", ".", "containsKey", "(", "this", ".", "getClass", "(", ")", ")", ")", "throw", "new", "Error", "(", "\"No value c...
Choose a value from this {@link Domain} according to the given {@link ValueChoiceFunction} identifier. @param vcf A {@link ValueChoiceFunction} function identifier. @return A value chosen according to the given {@link ValueChoiceFunction}. @throws IllegalValueChoiceFunction
[ "Choose", "a", "value", "from", "this", "{" ]
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/framework/Domain.java#L82-L89
auth0/auth0-java
src/main/java/com/auth0/client/mgmt/GuardianEntity.java
GuardianEntity.resetSNSFactorProvider
public Request<SNSFactorProvider> resetSNSFactorProvider() { return updateSNSFactorProvider(new SNSFactorProvider(null, null, null, null, null)); }
java
public Request<SNSFactorProvider> resetSNSFactorProvider() { return updateSNSFactorProvider(new SNSFactorProvider(null, null, null, null, null)); }
[ "public", "Request", "<", "SNSFactorProvider", ">", "resetSNSFactorProvider", "(", ")", "{", "return", "updateSNSFactorProvider", "(", "new", "SNSFactorProvider", "(", "null", ",", "null", ",", "null", ",", "null", ",", "null", ")", ")", ";", "}" ]
Reset Guardian's SNS push-notification Factor Provider to the defaults. A token with scope update:guardian_factors is needed. @return a Request to execute. @see <a href="https://auth0.com/docs/api/management/v2#!/Guardian/put_sns">Management API2 docs</a>
[ "Reset", "Guardian", "s", "SNS", "push", "-", "notification", "Factor", "Provider", "to", "the", "defaults", ".", "A", "token", "with", "scope", "update", ":", "guardian_factors", "is", "needed", "." ]
train
https://github.com/auth0/auth0-java/blob/b7bc099ee9c6cde5a87c4ecfebc6d811aeb1027c/src/main/java/com/auth0/client/mgmt/GuardianEntity.java#L253-L255
azkaban/azkaban
azkaban-web-server/src/main/java/azkaban/webapp/servlet/LoginAbstractAzkabanServlet.java
LoginAbstractAzkabanServlet.filterProjectByPermission
protected Project filterProjectByPermission(final Project project, final User user, final Permission.Type type, final Map<String, Object> ret) { if (project == null) { if (ret != null) { ret.put("error", "Project 'null' not found."); } } else if (!hasPermission(project, user, type)) { if (ret != null) { ret.put("error", "User '" + user.getUserId() + "' doesn't have " + type.name() + " permissions on " + project.getName()); } } else { return project; } return null; }
java
protected Project filterProjectByPermission(final Project project, final User user, final Permission.Type type, final Map<String, Object> ret) { if (project == null) { if (ret != null) { ret.put("error", "Project 'null' not found."); } } else if (!hasPermission(project, user, type)) { if (ret != null) { ret.put("error", "User '" + user.getUserId() + "' doesn't have " + type.name() + " permissions on " + project.getName()); } } else { return project; } return null; }
[ "protected", "Project", "filterProjectByPermission", "(", "final", "Project", "project", ",", "final", "User", "user", ",", "final", "Permission", ".", "Type", "type", ",", "final", "Map", "<", "String", ",", "Object", ">", "ret", ")", "{", "if", "(", "pro...
Filter Project based on user authorization @param project project @param user user @param type permission allowance @param ret return map for holding messages @return authorized project itself or null if the project is not authorized
[ "Filter", "Project", "based", "on", "user", "authorization" ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-web-server/src/main/java/azkaban/webapp/servlet/LoginAbstractAzkabanServlet.java#L420-L437
JOML-CI/JOML
src/org/joml/Vector2f.java
Vector2f.set
public Vector2f set(int index, FloatBuffer buffer) { MemUtil.INSTANCE.get(this, index, buffer); return this; }
java
public Vector2f set(int index, FloatBuffer buffer) { MemUtil.INSTANCE.get(this, index, buffer); return this; }
[ "public", "Vector2f", "set", "(", "int", "index", ",", "FloatBuffer", "buffer", ")", "{", "MemUtil", ".", "INSTANCE", ".", "get", "(", "this", ",", "index", ",", "buffer", ")", ";", "return", "this", ";", "}" ]
Read this vector from the supplied {@link FloatBuffer} starting at the specified absolute buffer position/index. <p> This method will not increment the position of the given FloatBuffer. @param index the absolute position into the FloatBuffer @param buffer values will be read in <code>x, y</code> order @return this
[ "Read", "this", "vector", "from", "the", "supplied", "{", "@link", "FloatBuffer", "}", "starting", "at", "the", "specified", "absolute", "buffer", "position", "/", "index", ".", "<p", ">", "This", "method", "will", "not", "increment", "the", "position", "of"...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Vector2f.java#L328-L331
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SubCountHandler.java
SubCountHandler.init
public void init(Record record, Record recordMain, String iMainFilesField, BaseField fieldMain, String fsToCount, boolean bRecountOnSelect, boolean bVerifyOnEOF, boolean bResetOnBreak) // Init this field override for other value { super.init(record); this.fsToCount = fsToCount; if (fieldMain != null) m_fldMain = fieldMain; else if (recordMain != null) m_fldMain = recordMain.getField(iMainFilesField); if (m_fldMain != null) if ((m_fldMain.getRecord() == null) || (m_fldMain.getRecord().getEditMode() == DBConstants.EDIT_NONE) || (m_fldMain.getRecord().getEditMode() == DBConstants.EDIT_ADD)) this.resetCount(); // Set in main file's field if the record is not current. m_dOldValue = 0; m_bRecountOnSelect = bRecountOnSelect; m_bVerifyOnEOF = bVerifyOnEOF; m_bResetOnBreak = bResetOnBreak; m_dTotalToVerify = 0; m_bEOFHit = true; // In case this is a maint screen (grid screens start by requery/set this to false) }
java
public void init(Record record, Record recordMain, String iMainFilesField, BaseField fieldMain, String fsToCount, boolean bRecountOnSelect, boolean bVerifyOnEOF, boolean bResetOnBreak) // Init this field override for other value { super.init(record); this.fsToCount = fsToCount; if (fieldMain != null) m_fldMain = fieldMain; else if (recordMain != null) m_fldMain = recordMain.getField(iMainFilesField); if (m_fldMain != null) if ((m_fldMain.getRecord() == null) || (m_fldMain.getRecord().getEditMode() == DBConstants.EDIT_NONE) || (m_fldMain.getRecord().getEditMode() == DBConstants.EDIT_ADD)) this.resetCount(); // Set in main file's field if the record is not current. m_dOldValue = 0; m_bRecountOnSelect = bRecountOnSelect; m_bVerifyOnEOF = bVerifyOnEOF; m_bResetOnBreak = bResetOnBreak; m_dTotalToVerify = 0; m_bEOFHit = true; // In case this is a maint screen (grid screens start by requery/set this to false) }
[ "public", "void", "init", "(", "Record", "record", ",", "Record", "recordMain", ",", "String", "iMainFilesField", ",", "BaseField", "fieldMain", ",", "String", "fsToCount", ",", "boolean", "bRecountOnSelect", ",", "boolean", "bVerifyOnEOF", ",", "boolean", "bReset...
Constructor for counting the value of a field in this record. @param fieldMain The field to receive the count. @param ifsToCount The field in this record to add up. @param bVerifyOnEOF Verify the total on End of File (true default). @param bRecountOnSelect Recount the total each time a file select is called (False default). @param bResetOnBreak Reset the counter on a control break?
[ "Constructor", "for", "counting", "the", "value", "of", "a", "field", "in", "this", "record", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SubCountHandler.java#L127-L144
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.completeConference
public ApiSuccessResponse completeConference(String id, CompleteConferenceData completeConferenceData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = completeConferenceWithHttpInfo(id, completeConferenceData); return resp.getData(); }
java
public ApiSuccessResponse completeConference(String id, CompleteConferenceData completeConferenceData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = completeConferenceWithHttpInfo(id, completeConferenceData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "completeConference", "(", "String", "id", ",", "CompleteConferenceData", "completeConferenceData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "completeConferenceWithHttpInfo", "(", "id", ...
Complete a conference Complete a previously initiated two-step conference identified by the provided IDs. Once completed, the two separate calls are brought together so that all three parties are participating in the same call. @param id The connection ID of the consult call (established). (required) @param completeConferenceData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Complete", "a", "conference", "Complete", "a", "previously", "initiated", "two", "-", "step", "conference", "identified", "by", "the", "provided", "IDs", ".", "Once", "completed", "the", "two", "separate", "calls", "are", "brought", "together", "so", "that", ...
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L947-L950
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java
Instance.detachDisk
public Operation detachDisk(String deviceName, OperationOption... options) { return compute.detachDisk(getInstanceId(), deviceName, options); }
java
public Operation detachDisk(String deviceName, OperationOption... options) { return compute.detachDisk(getInstanceId(), deviceName, options); }
[ "public", "Operation", "detachDisk", "(", "String", "deviceName", ",", "OperationOption", "...", "options", ")", "{", "return", "compute", ".", "detachDisk", "(", "getInstanceId", "(", ")", ",", "deviceName", ",", "options", ")", ";", "}" ]
Detaches a disk from this instance. @return a zone operation if the detach request was issued correctly, {@code null} if the instance was not found @throws ComputeException upon failure
[ "Detaches", "a", "disk", "from", "this", "instance", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/Instance.java#L291-L293
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WHorizontalRuleRenderer.java
WHorizontalRuleRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("hr"); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendEnd(); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("hr"); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendEnd(); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "xml", ".", "appendTagOpen", ...
Paints the given WHorizontalRule. @param component the WHorizontalRule to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WHorizontalRule", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WHorizontalRuleRenderer.java#L23-L29
Stratio/bdt
src/main/java/com/stratio/qa/specs/DatabaseSpec.java
DatabaseSpec.indexElasticsearchDocument
@When("^I index a document in the index named '(.+?)' using the mapping named '(.+?)' with key '(.+?)' and value '(.+?)'$") public void indexElasticsearchDocument(String indexName, String mappingName, String key, String value) throws Exception { ArrayList<XContentBuilder> mappingsource = new ArrayList<XContentBuilder>(); XContentBuilder builder = jsonBuilder().startObject().field(key, value).endObject(); mappingsource.add(builder); commonspec.getElasticSearchClient().createMapping(indexName, mappingName, mappingsource); }
java
@When("^I index a document in the index named '(.+?)' using the mapping named '(.+?)' with key '(.+?)' and value '(.+?)'$") public void indexElasticsearchDocument(String indexName, String mappingName, String key, String value) throws Exception { ArrayList<XContentBuilder> mappingsource = new ArrayList<XContentBuilder>(); XContentBuilder builder = jsonBuilder().startObject().field(key, value).endObject(); mappingsource.add(builder); commonspec.getElasticSearchClient().createMapping(indexName, mappingName, mappingsource); }
[ "@", "When", "(", "\"^I index a document in the index named '(.+?)' using the mapping named '(.+?)' with key '(.+?)' and value '(.+?)'$\"", ")", "public", "void", "indexElasticsearchDocument", "(", "String", "indexName", ",", "String", "mappingName", ",", "String", "key", ",", "S...
Index a document within a mapping type. @param indexName @param mappingName @param key @param value @throws Exception
[ "Index", "a", "document", "within", "a", "mapping", "type", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/DatabaseSpec.java#L556-L562
jamesagnew/hapi-fhir
hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java
JsonParser.extractAndWriteExtensionsAsDirectChild
private void extractAndWriteExtensionsAsDirectChild(IBase theElement, JsonLikeWriter theEventWriter, BaseRuntimeElementDefinition<?> theElementDef, RuntimeResourceDefinition theResDef, IBaseResource theResource, CompositeChildElement theChildElem, CompositeChildElement theParent, EncodeContext theEncodeContext) throws IOException { List<HeldExtension> extensions = new ArrayList<>(0); List<HeldExtension> modifierExtensions = new ArrayList<>(0); // Undeclared extensions extractUndeclaredExtensions(theElement, extensions, modifierExtensions, theChildElem, theParent); // Declared extensions if (theElementDef != null) { extractDeclaredExtensions(theElement, theElementDef, extensions, modifierExtensions, theChildElem); } // Write the extensions writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions, theEncodeContext); }
java
private void extractAndWriteExtensionsAsDirectChild(IBase theElement, JsonLikeWriter theEventWriter, BaseRuntimeElementDefinition<?> theElementDef, RuntimeResourceDefinition theResDef, IBaseResource theResource, CompositeChildElement theChildElem, CompositeChildElement theParent, EncodeContext theEncodeContext) throws IOException { List<HeldExtension> extensions = new ArrayList<>(0); List<HeldExtension> modifierExtensions = new ArrayList<>(0); // Undeclared extensions extractUndeclaredExtensions(theElement, extensions, modifierExtensions, theChildElem, theParent); // Declared extensions if (theElementDef != null) { extractDeclaredExtensions(theElement, theElementDef, extensions, modifierExtensions, theChildElem); } // Write the extensions writeExtensionsAsDirectChild(theResource, theEventWriter, theResDef, extensions, modifierExtensions, theEncodeContext); }
[ "private", "void", "extractAndWriteExtensionsAsDirectChild", "(", "IBase", "theElement", ",", "JsonLikeWriter", "theEventWriter", ",", "BaseRuntimeElementDefinition", "<", "?", ">", "theElementDef", ",", "RuntimeResourceDefinition", "theResDef", ",", "IBaseResource", "theReso...
This is useful only for the two cases where extensions are encoded as direct children (e.g. not in some object called _name): resource extensions, and extension extensions
[ "This", "is", "useful", "only", "for", "the", "two", "cases", "where", "extensions", "are", "encoded", "as", "direct", "children", "(", "e", ".", "g", ".", "not", "in", "some", "object", "called", "_name", ")", ":", "resource", "extensions", "and", "exte...
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/JsonParser.java#L743-L758