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
infinispan/infinispan
core/src/main/java/org/infinispan/configuration/global/SerializationConfigurationBuilder.java
SerializationConfigurationBuilder.addAdvancedExternalizer
public <T> SerializationConfigurationBuilder addAdvancedExternalizer(int id, AdvancedExternalizer<T> advancedExternalizer) { AdvancedExternalizer<?> ext = advancedExternalizers.get(id); if (ext != null) throw new CacheConfigurationException(String.format( "Duplicate externalizer id found! Externalizer id=%d for %s is shared by another externalizer (%s)", id, advancedExternalizer.getClass().getName(), ext.getClass().getName())); advancedExternalizers.put(id, advancedExternalizer); return this; }
java
public <T> SerializationConfigurationBuilder addAdvancedExternalizer(int id, AdvancedExternalizer<T> advancedExternalizer) { AdvancedExternalizer<?> ext = advancedExternalizers.get(id); if (ext != null) throw new CacheConfigurationException(String.format( "Duplicate externalizer id found! Externalizer id=%d for %s is shared by another externalizer (%s)", id, advancedExternalizer.getClass().getName(), ext.getClass().getName())); advancedExternalizers.put(id, advancedExternalizer); return this; }
[ "public", "<", "T", ">", "SerializationConfigurationBuilder", "addAdvancedExternalizer", "(", "int", "id", ",", "AdvancedExternalizer", "<", "T", ">", "advancedExternalizer", ")", "{", "AdvancedExternalizer", "<", "?", ">", "ext", "=", "advancedExternalizers", ".", "get", "(", "id", ")", ";", "if", "(", "ext", "!=", "null", ")", "throw", "new", "CacheConfigurationException", "(", "String", ".", "format", "(", "\"Duplicate externalizer id found! Externalizer id=%d for %s is shared by another externalizer (%s)\"", ",", "id", ",", "advancedExternalizer", ".", "getClass", "(", ")", ".", "getName", "(", ")", ",", "ext", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ")", ";", "advancedExternalizers", ".", "put", "(", "id", ",", "advancedExternalizer", ")", ";", "return", "this", ";", "}" ]
Helper method that allows for quick registration of an {@link AdvancedExternalizer} implementation alongside its corresponding identifier. Remember that the identifier needs to a be positive number, including 0, and cannot clash with other identifiers in the system. @param id @param advancedExternalizer
[ "Helper", "method", "that", "allows", "for", "quick", "registration", "of", "an", "{", "@link", "AdvancedExternalizer", "}", "implementation", "alongside", "its", "corresponding", "identifier", ".", "Remember", "that", "the", "identifier", "needs", "to", "a", "be", "positive", "number", "including", "0", "and", "cannot", "clash", "with", "other", "identifiers", "in", "the", "system", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/configuration/global/SerializationConfigurationBuilder.java#L77-L86
wwadge/bonecp
bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java
MemorizeTransactionProxy.memorize
protected static PreparedStatement memorize(final PreparedStatement target, final ConnectionHandle connectionHandle) { return (PreparedStatement) Proxy.newProxyInstance( PreparedStatementProxy.class.getClassLoader(), new Class[] {PreparedStatementProxy.class}, new MemorizeTransactionProxy(target, connectionHandle)); }
java
protected static PreparedStatement memorize(final PreparedStatement target, final ConnectionHandle connectionHandle) { return (PreparedStatement) Proxy.newProxyInstance( PreparedStatementProxy.class.getClassLoader(), new Class[] {PreparedStatementProxy.class}, new MemorizeTransactionProxy(target, connectionHandle)); }
[ "protected", "static", "PreparedStatement", "memorize", "(", "final", "PreparedStatement", "target", ",", "final", "ConnectionHandle", "connectionHandle", ")", "{", "return", "(", "PreparedStatement", ")", "Proxy", ".", "newProxyInstance", "(", "PreparedStatementProxy", ".", "class", ".", "getClassLoader", "(", ")", ",", "new", "Class", "[", "]", "{", "PreparedStatementProxy", ".", "class", "}", ",", "new", "MemorizeTransactionProxy", "(", "target", ",", "connectionHandle", ")", ")", ";", "}" ]
Wrap PreparedStatement with a proxy. @param target statement handle @param connectionHandle originating bonecp connection @return Proxy to a Preparedstatement.
[ "Wrap", "PreparedStatement", "with", "a", "proxy", "." ]
train
https://github.com/wwadge/bonecp/blob/74bc3287025fc137ca28909f0f7693edae37a15d/bonecp/src/main/java/com/jolbox/bonecp/MemorizeTransactionProxy.java#L104-L109
netheosgithub/pcs_api
java/src/main/java/net/netheos/pcsapi/utils/PcsUtils.java
PcsUtils.randomString
public static String randomString( char[] values, int len ) { Random rnd = new SecureRandom(); StringBuilder sb = new StringBuilder( len ); for ( int i = 0; i < len; i++ ) { sb.append( values[ rnd.nextInt( values.length )] ); } return sb.toString(); }
java
public static String randomString( char[] values, int len ) { Random rnd = new SecureRandom(); StringBuilder sb = new StringBuilder( len ); for ( int i = 0; i < len; i++ ) { sb.append( values[ rnd.nextInt( values.length )] ); } return sb.toString(); }
[ "public", "static", "String", "randomString", "(", "char", "[", "]", "values", ",", "int", "len", ")", "{", "Random", "rnd", "=", "new", "SecureRandom", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "len", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "sb", ".", "append", "(", "values", "[", "rnd", ".", "nextInt", "(", "values", ".", "length", ")", "]", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}" ]
Generate a random String @param values The characters list to use in the randomization @param len The number of characters in the output String @return The randomized String
[ "Generate", "a", "random", "String" ]
train
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/utils/PcsUtils.java#L242-L250
apache/flink
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/util/KeySelectorUtil.java
KeySelectorUtil.getBaseRowSelector
public static BaseRowKeySelector getBaseRowSelector(int[] keyFields, BaseRowTypeInfo rowType) { if (keyFields.length > 0) { InternalType[] inputFieldTypes = rowType.getInternalTypes(); String[] inputFieldNames = rowType.getFieldNames(); InternalType[] keyFieldTypes = new InternalType[keyFields.length]; String[] keyFieldNames = new String[keyFields.length]; for (int i = 0; i < keyFields.length; ++i) { keyFieldTypes[i] = inputFieldTypes[keyFields[i]]; keyFieldNames[i] = inputFieldNames[keyFields[i]]; } RowType returnType = new RowType(keyFieldTypes, keyFieldNames); RowType inputType = new RowType(inputFieldTypes, rowType.getFieldNames()); GeneratedProjection generatedProjection = ProjectionCodeGenerator.generateProjection( CodeGeneratorContext.apply(new TableConfig()), "KeyProjection", inputType, returnType, keyFields); BaseRowTypeInfo keyRowType = returnType.toTypeInfo(); // check if type implements proper equals/hashCode TypeCheckUtils.validateEqualsHashCode("grouping", keyRowType); return new BinaryRowKeySelector(keyRowType, generatedProjection); } else { return NullBinaryRowKeySelector.INSTANCE; } }
java
public static BaseRowKeySelector getBaseRowSelector(int[] keyFields, BaseRowTypeInfo rowType) { if (keyFields.length > 0) { InternalType[] inputFieldTypes = rowType.getInternalTypes(); String[] inputFieldNames = rowType.getFieldNames(); InternalType[] keyFieldTypes = new InternalType[keyFields.length]; String[] keyFieldNames = new String[keyFields.length]; for (int i = 0; i < keyFields.length; ++i) { keyFieldTypes[i] = inputFieldTypes[keyFields[i]]; keyFieldNames[i] = inputFieldNames[keyFields[i]]; } RowType returnType = new RowType(keyFieldTypes, keyFieldNames); RowType inputType = new RowType(inputFieldTypes, rowType.getFieldNames()); GeneratedProjection generatedProjection = ProjectionCodeGenerator.generateProjection( CodeGeneratorContext.apply(new TableConfig()), "KeyProjection", inputType, returnType, keyFields); BaseRowTypeInfo keyRowType = returnType.toTypeInfo(); // check if type implements proper equals/hashCode TypeCheckUtils.validateEqualsHashCode("grouping", keyRowType); return new BinaryRowKeySelector(keyRowType, generatedProjection); } else { return NullBinaryRowKeySelector.INSTANCE; } }
[ "public", "static", "BaseRowKeySelector", "getBaseRowSelector", "(", "int", "[", "]", "keyFields", ",", "BaseRowTypeInfo", "rowType", ")", "{", "if", "(", "keyFields", ".", "length", ">", "0", ")", "{", "InternalType", "[", "]", "inputFieldTypes", "=", "rowType", ".", "getInternalTypes", "(", ")", ";", "String", "[", "]", "inputFieldNames", "=", "rowType", ".", "getFieldNames", "(", ")", ";", "InternalType", "[", "]", "keyFieldTypes", "=", "new", "InternalType", "[", "keyFields", ".", "length", "]", ";", "String", "[", "]", "keyFieldNames", "=", "new", "String", "[", "keyFields", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "keyFields", ".", "length", ";", "++", "i", ")", "{", "keyFieldTypes", "[", "i", "]", "=", "inputFieldTypes", "[", "keyFields", "[", "i", "]", "]", ";", "keyFieldNames", "[", "i", "]", "=", "inputFieldNames", "[", "keyFields", "[", "i", "]", "]", ";", "}", "RowType", "returnType", "=", "new", "RowType", "(", "keyFieldTypes", ",", "keyFieldNames", ")", ";", "RowType", "inputType", "=", "new", "RowType", "(", "inputFieldTypes", ",", "rowType", ".", "getFieldNames", "(", ")", ")", ";", "GeneratedProjection", "generatedProjection", "=", "ProjectionCodeGenerator", ".", "generateProjection", "(", "CodeGeneratorContext", ".", "apply", "(", "new", "TableConfig", "(", ")", ")", ",", "\"KeyProjection\"", ",", "inputType", ",", "returnType", ",", "keyFields", ")", ";", "BaseRowTypeInfo", "keyRowType", "=", "returnType", ".", "toTypeInfo", "(", ")", ";", "// check if type implements proper equals/hashCode", "TypeCheckUtils", ".", "validateEqualsHashCode", "(", "\"grouping\"", ",", "keyRowType", ")", ";", "return", "new", "BinaryRowKeySelector", "(", "keyRowType", ",", "generatedProjection", ")", ";", "}", "else", "{", "return", "NullBinaryRowKeySelector", ".", "INSTANCE", ";", "}", "}" ]
Create a BaseRowKeySelector to extract keys from DataStream which type is BaseRowTypeInfo. @param keyFields key fields @param rowType type of DataStream to extract keys @return the BaseRowKeySelector to extract keys from DataStream which type is BaseRowTypeInfo.
[ "Create", "a", "BaseRowKeySelector", "to", "extract", "keys", "from", "DataStream", "which", "type", "is", "BaseRowTypeInfo", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/plan/util/KeySelectorUtil.java#L45-L69
jenkinsci/java-client-api
jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java
JenkinsServer.enableJob
public JenkinsServer enableJob(String jobName, boolean crumbFlag) throws IOException { client.post("/job/" + EncodingUtils.encode(jobName) + "/enable", crumbFlag); return this; }
java
public JenkinsServer enableJob(String jobName, boolean crumbFlag) throws IOException { client.post("/job/" + EncodingUtils.encode(jobName) + "/enable", crumbFlag); return this; }
[ "public", "JenkinsServer", "enableJob", "(", "String", "jobName", ",", "boolean", "crumbFlag", ")", "throws", "IOException", "{", "client", ".", "post", "(", "\"/job/\"", "+", "EncodingUtils", ".", "encode", "(", "jobName", ")", "+", "\"/enable\"", ",", "crumbFlag", ")", ";", "return", "this", ";", "}" ]
Enable a job from Jenkins. @param jobName The name of the job to be deleted. @param crumbFlag <code>true</code> to add <b>crumbIssuer</b> <code>false</code> otherwise. @throws IOException In case of an failure.
[ "Enable", "a", "job", "from", "Jenkins", "." ]
train
https://github.com/jenkinsci/java-client-api/blob/c4f5953d3d4dda92cd946ad3bf2b811524c32da9/jenkins-client/src/main/java/com/offbytwo/jenkins/JenkinsServer.java#L773-L776
ologolo/streamline-api
src/org/daisy/streamline/api/tasks/ReadWriteTask.java
ReadWriteTask.execute
public ModifiableFileSet execute(FileSet input, BaseFolder output) throws InternalTaskException { try { AnnotatedFile f = execute(input.getManifest(), Files.createTempFile(output.getPath(), "file", ".tmp").toFile()); return DefaultFileSet.with(output, f).build(); } catch (IOException e) { throw new InternalTaskException(e); } }
java
public ModifiableFileSet execute(FileSet input, BaseFolder output) throws InternalTaskException { try { AnnotatedFile f = execute(input.getManifest(), Files.createTempFile(output.getPath(), "file", ".tmp").toFile()); return DefaultFileSet.with(output, f).build(); } catch (IOException e) { throw new InternalTaskException(e); } }
[ "public", "ModifiableFileSet", "execute", "(", "FileSet", "input", ",", "BaseFolder", "output", ")", "throws", "InternalTaskException", "{", "try", "{", "AnnotatedFile", "f", "=", "execute", "(", "input", ".", "getManifest", "(", ")", ",", "Files", ".", "createTempFile", "(", "output", ".", "getPath", "(", ")", ",", "\"file\"", ",", "\".tmp\"", ")", ".", "toFile", "(", ")", ")", ";", "return", "DefaultFileSet", ".", "with", "(", "output", ",", "f", ")", ".", "build", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "InternalTaskException", "(", "e", ")", ";", "}", "}" ]
<p>Apply the task to <code>input</code> and place the result in <code>output</code>.</p> <p>Note: Resources in the input file set that are not modified, but should be included in the output file set, should preferably keep their locations in the input file set for performance reasons. This may not always be possible, depending on the processing requirements in the implementation of this method.</p> @param input input file set @param output output location @return the output file set @throws InternalTaskException throws InternalTaskException if something goes wrong.
[ "<p", ">", "Apply", "the", "task", "to", "<code", ">", "input<", "/", "code", ">", "and", "place", "the", "result", "in", "<code", ">", "output<", "/", "code", ">", ".", "<", "/", "p", ">", "<p", ">", "Note", ":", "Resources", "in", "the", "input", "file", "set", "that", "are", "not", "modified", "but", "should", "be", "included", "in", "the", "output", "file", "set", "should", "preferably", "keep", "their", "locations", "in", "the", "input", "file", "set", "for", "performance", "reasons", ".", "This", "may", "not", "always", "be", "possible", "depending", "on", "the", "processing", "requirements", "in", "the", "implementation", "of", "this", "method", ".", "<", "/", "p", ">" ]
train
https://github.com/ologolo/streamline-api/blob/4934b6da1de06e364ae90d6ea9b0929500da9cdb/src/org/daisy/streamline/api/tasks/ReadWriteTask.java#L60-L67
lessthanoptimal/BoofCV
examples/src/main/java/boofcv/examples/imageprocessing/ExamplePlanarImages.java
ExamplePlanarImages.independent
public static void independent( BufferedImage input ) { // convert the BufferedImage into a Planar Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class); // declare the output blurred image Planar<GrayU8> blurred = image.createSameShape(); // Apply Gaussian blur to each band in the image for( int i = 0; i < image.getNumBands(); i++ ) { // note that the generalized version of BlurImageOps is not being used, but the type // specific version. BlurImageOps.gaussian(image.getBand(i),blurred.getBand(i),-1,5,null); } // Declare the BufferedImage manually to ensure that the color bands have the same ordering on input // and output BufferedImage output = new BufferedImage(image.width,image.height,input.getType()); ConvertBufferedImage.convertTo(blurred, output,true); gui.addImage(input,"Input"); gui.addImage(output,"Gaussian Blur"); }
java
public static void independent( BufferedImage input ) { // convert the BufferedImage into a Planar Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class); // declare the output blurred image Planar<GrayU8> blurred = image.createSameShape(); // Apply Gaussian blur to each band in the image for( int i = 0; i < image.getNumBands(); i++ ) { // note that the generalized version of BlurImageOps is not being used, but the type // specific version. BlurImageOps.gaussian(image.getBand(i),blurred.getBand(i),-1,5,null); } // Declare the BufferedImage manually to ensure that the color bands have the same ordering on input // and output BufferedImage output = new BufferedImage(image.width,image.height,input.getType()); ConvertBufferedImage.convertTo(blurred, output,true); gui.addImage(input,"Input"); gui.addImage(output,"Gaussian Blur"); }
[ "public", "static", "void", "independent", "(", "BufferedImage", "input", ")", "{", "// convert the BufferedImage into a Planar", "Planar", "<", "GrayU8", ">", "image", "=", "ConvertBufferedImage", ".", "convertFromPlanar", "(", "input", ",", "null", ",", "true", ",", "GrayU8", ".", "class", ")", ";", "// declare the output blurred image", "Planar", "<", "GrayU8", ">", "blurred", "=", "image", ".", "createSameShape", "(", ")", ";", "// Apply Gaussian blur to each band in the image", "for", "(", "int", "i", "=", "0", ";", "i", "<", "image", ".", "getNumBands", "(", ")", ";", "i", "++", ")", "{", "// note that the generalized version of BlurImageOps is not being used, but the type", "// specific version.", "BlurImageOps", ".", "gaussian", "(", "image", ".", "getBand", "(", "i", ")", ",", "blurred", ".", "getBand", "(", "i", ")", ",", "-", "1", ",", "5", ",", "null", ")", ";", "}", "// Declare the BufferedImage manually to ensure that the color bands have the same ordering on input", "// and output", "BufferedImage", "output", "=", "new", "BufferedImage", "(", "image", ".", "width", ",", "image", ".", "height", ",", "input", ".", "getType", "(", ")", ")", ";", "ConvertBufferedImage", ".", "convertTo", "(", "blurred", ",", "output", ",", "true", ")", ";", "gui", ".", "addImage", "(", "input", ",", "\"Input\"", ")", ";", "gui", ".", "addImage", "(", "output", ",", "\"Gaussian Blur\"", ")", ";", "}" ]
Many operations designed to only work on {@link ImageGray} can be applied to a Planar image by feeding in each band one at a time.
[ "Many", "operations", "designed", "to", "only", "work", "on", "{" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/examples/src/main/java/boofcv/examples/imageprocessing/ExamplePlanarImages.java#L60-L81
ops4j/org.ops4j.base
ops4j-base-monitors/src/main/java/org/ops4j/monitors/stream/StreamMonitorRouter.java
StreamMonitorRouter.notifyUpdate
public void notifyUpdate( URL resource, int expected, int count ) { synchronized( m_Monitors ) { for( StreamMonitor monitor : m_Monitors ) { monitor.notifyUpdate( resource, expected, count ); } } }
java
public void notifyUpdate( URL resource, int expected, int count ) { synchronized( m_Monitors ) { for( StreamMonitor monitor : m_Monitors ) { monitor.notifyUpdate( resource, expected, count ); } } }
[ "public", "void", "notifyUpdate", "(", "URL", "resource", ",", "int", "expected", ",", "int", "count", ")", "{", "synchronized", "(", "m_Monitors", ")", "{", "for", "(", "StreamMonitor", "monitor", ":", "m_Monitors", ")", "{", "monitor", ".", "notifyUpdate", "(", "resource", ",", "expected", ",", "count", ")", ";", "}", "}", "}" ]
Notify all subscribing monitors of a updated event. @param resource the url of the updated resource @param expected the size in bytes of the download @param count the progress in bytes
[ "Notify", "all", "subscribing", "monitors", "of", "a", "updated", "event", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-monitors/src/main/java/org/ops4j/monitors/stream/StreamMonitorRouter.java#L54-L63
youngmonkeys/ezyfox-sfs2x
src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/ServerRoomEventHandler.java
ServerRoomEventHandler.notifyHandlers
private void notifyHandlers(Room sfsRoom, User sfsUser) { ApiRoom apiRoom = AgentUtil.getRoomAgent(sfsRoom); ApiUser apiUser = AgentUtil.getUserAgent(sfsUser); for(RoomHandlerClass handler : handlers) { Object userAgent = checkUserAgent(handler, apiUser); if(!checkHandler(handler, apiRoom, userAgent)) continue; Object instance = handler.newInstance(); callHandleMethod(handler.getHandleMethod(), instance, apiRoom, userAgent); } }
java
private void notifyHandlers(Room sfsRoom, User sfsUser) { ApiRoom apiRoom = AgentUtil.getRoomAgent(sfsRoom); ApiUser apiUser = AgentUtil.getUserAgent(sfsUser); for(RoomHandlerClass handler : handlers) { Object userAgent = checkUserAgent(handler, apiUser); if(!checkHandler(handler, apiRoom, userAgent)) continue; Object instance = handler.newInstance(); callHandleMethod(handler.getHandleMethod(), instance, apiRoom, userAgent); } }
[ "private", "void", "notifyHandlers", "(", "Room", "sfsRoom", ",", "User", "sfsUser", ")", "{", "ApiRoom", "apiRoom", "=", "AgentUtil", ".", "getRoomAgent", "(", "sfsRoom", ")", ";", "ApiUser", "apiUser", "=", "AgentUtil", ".", "getUserAgent", "(", "sfsUser", ")", ";", "for", "(", "RoomHandlerClass", "handler", ":", "handlers", ")", "{", "Object", "userAgent", "=", "checkUserAgent", "(", "handler", ",", "apiUser", ")", ";", "if", "(", "!", "checkHandler", "(", "handler", ",", "apiRoom", ",", "userAgent", ")", ")", "continue", ";", "Object", "instance", "=", "handler", ".", "newInstance", "(", ")", ";", "callHandleMethod", "(", "handler", ".", "getHandleMethod", "(", ")", ",", "instance", ",", "apiRoom", ",", "userAgent", ")", ";", "}", "}" ]
Propagate event to handlers @param sfsRoom smartfox room object @param sfsUser smartfox user object
[ "Propagate", "event", "to", "handlers" ]
train
https://github.com/youngmonkeys/ezyfox-sfs2x/blob/7e004033a3b551c3ae970a0c8f45db7b1ec144de/src/main/java/com/tvd12/ezyfox/sfs2x/serverhandler/ServerRoomEventHandler.java#L72-L83
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.setStrokingColor
public void setStrokingColor (final double g) throws IOException { if (_isOutsideOneInterval (g)) { throw new IllegalArgumentException ("Parameter must be within 0..1, but is " + g); } writeOperand ((float) g); writeOperator ((byte) 'G'); }
java
public void setStrokingColor (final double g) throws IOException { if (_isOutsideOneInterval (g)) { throw new IllegalArgumentException ("Parameter must be within 0..1, but is " + g); } writeOperand ((float) g); writeOperator ((byte) 'G'); }
[ "public", "void", "setStrokingColor", "(", "final", "double", "g", ")", "throws", "IOException", "{", "if", "(", "_isOutsideOneInterval", "(", "g", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter must be within 0..1, but is \"", "+", "g", ")", ";", "}", "writeOperand", "(", "(", "float", ")", "g", ")", ";", "writeOperator", "(", "(", "byte", ")", "'", "'", ")", ";", "}" ]
Set the stroking color in the DeviceGray color space. Range is 0..1. @param g The gray value. @throws IOException If an IO error occurs while writing to the stream. @throws IllegalArgumentException If the parameter is invalid.
[ "Set", "the", "stroking", "color", "in", "the", "DeviceGray", "color", "space", ".", "Range", "is", "0", "..", "1", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L861-L869
wildfly/wildfly-core
host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java
IgnoredNonAffectedServerGroupsUtil.ignoreOperation
public boolean ignoreOperation(final Resource domainResource, final Collection<ServerConfigInfo> serverConfigs, final PathAddress pathAddress) { if (pathAddress.size() == 0) { return false; } boolean ignore = ignoreResourceInternal(domainResource, serverConfigs, pathAddress); return ignore; }
java
public boolean ignoreOperation(final Resource domainResource, final Collection<ServerConfigInfo> serverConfigs, final PathAddress pathAddress) { if (pathAddress.size() == 0) { return false; } boolean ignore = ignoreResourceInternal(domainResource, serverConfigs, pathAddress); return ignore; }
[ "public", "boolean", "ignoreOperation", "(", "final", "Resource", "domainResource", ",", "final", "Collection", "<", "ServerConfigInfo", ">", "serverConfigs", ",", "final", "PathAddress", "pathAddress", ")", "{", "if", "(", "pathAddress", ".", "size", "(", ")", "==", "0", ")", "{", "return", "false", ";", "}", "boolean", "ignore", "=", "ignoreResourceInternal", "(", "domainResource", ",", "serverConfigs", ",", "pathAddress", ")", ";", "return", "ignore", ";", "}" ]
For the DC to check whether an operation should be ignored on the slave, if the slave is set up to ignore config not relevant to it @param domainResource the domain root resource @param serverConfigs the server configs the slave is known to have @param pathAddress the address of the operation to check if should be ignored or not
[ "For", "the", "DC", "to", "check", "whether", "an", "operation", "should", "be", "ignored", "on", "the", "slave", "if", "the", "slave", "is", "set", "up", "to", "ignore", "config", "not", "relevant", "to", "it" ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/host-controller/src/main/java/org/jboss/as/host/controller/IgnoredNonAffectedServerGroupsUtil.java#L128-L134
landawn/AbacusUtil
src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java
PoolablePreparedStatement.setRowId
@Override public void setRowId(int parameterIndex, RowId x) throws SQLException { internalStmt.setRowId(parameterIndex, x); }
java
@Override public void setRowId(int parameterIndex, RowId x) throws SQLException { internalStmt.setRowId(parameterIndex, x); }
[ "@", "Override", "public", "void", "setRowId", "(", "int", "parameterIndex", ",", "RowId", "x", ")", "throws", "SQLException", "{", "internalStmt", ".", "setRowId", "(", "parameterIndex", ",", "x", ")", ";", "}" ]
Method setRowId. @param parameterIndex @param x @throws SQLException @see java.sql.PreparedStatement#setRowId(int, RowId)
[ "Method", "setRowId", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L952-L955
Impetus/Kundera
src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClientUtilities.java
DSClientUtilities.setFieldValue
private static void setFieldValue(Object entity, Field member, Object retVal) { if (member != null && retVal != null && entity != null) { PropertyAccessorHelper.set(entity, member, retVal); } }
java
private static void setFieldValue(Object entity, Field member, Object retVal) { if (member != null && retVal != null && entity != null) { PropertyAccessorHelper.set(entity, member, retVal); } }
[ "private", "static", "void", "setFieldValue", "(", "Object", "entity", ",", "Field", "member", ",", "Object", "retVal", ")", "{", "if", "(", "member", "!=", "null", "&&", "retVal", "!=", "null", "&&", "entity", "!=", "null", ")", "{", "PropertyAccessorHelper", ".", "set", "(", "entity", ",", "member", ",", "retVal", ")", ";", "}", "}" ]
Sets the field value. @param entity the entity @param member the member @param retVal the ret val
[ "Sets", "the", "field", "value", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-ds-driver/src/main/java/com/impetus/kundera/client/cassandra/dsdriver/DSClientUtilities.java#L790-L796
smartsheet-platform/smartsheet-java-sdk
src/main/java/com/smartsheet/api/internal/RowAttachmentResourcesImpl.java
RowAttachmentResourcesImpl.attachFile
public Attachment attachFile(long sheetId, long rowId, InputStream inputStream, String contentType, long contentLength, String attachmentName) throws SmartsheetException { Util.throwIfNull(inputStream, contentType); return super.attachFile("sheets/" + sheetId + "/rows/" + rowId + "/attachments", inputStream, contentType, contentLength, attachmentName); }
java
public Attachment attachFile(long sheetId, long rowId, InputStream inputStream, String contentType, long contentLength, String attachmentName) throws SmartsheetException { Util.throwIfNull(inputStream, contentType); return super.attachFile("sheets/" + sheetId + "/rows/" + rowId + "/attachments", inputStream, contentType, contentLength, attachmentName); }
[ "public", "Attachment", "attachFile", "(", "long", "sheetId", ",", "long", "rowId", ",", "InputStream", "inputStream", ",", "String", "contentType", ",", "long", "contentLength", ",", "String", "attachmentName", ")", "throws", "SmartsheetException", "{", "Util", ".", "throwIfNull", "(", "inputStream", ",", "contentType", ")", ";", "return", "super", ".", "attachFile", "(", "\"sheets/\"", "+", "sheetId", "+", "\"/rows/\"", "+", "rowId", "+", "\"/attachments\"", ",", "inputStream", ",", "contentType", ",", "contentLength", ",", "attachmentName", ")", ";", "}" ]
Attach file for simple upload. @param sheetId the sheet id @param rowId the row id @param contentType the content type @param contentLength the content length @param attachmentName the name of the attachment @return the attachment @throws FileNotFoundException the file not found exception @throws SmartsheetException the smartsheet exception @throws UnsupportedEncodingException the unsupported encoding exception
[ "Attach", "file", "for", "simple", "upload", "." ]
train
https://github.com/smartsheet-platform/smartsheet-java-sdk/blob/f60e264412076271f83b65889ef9b891fad83df8/src/main/java/com/smartsheet/api/internal/RowAttachmentResourcesImpl.java#L135-L139
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java
LongTermRetentionBackupsInner.listByServerWithServiceResponseAsync
public Observable<ServiceResponse<Page<LongTermRetentionBackupInner>>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { return listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) .concatMap(new Func1<ServiceResponse<Page<LongTermRetentionBackupInner>>, Observable<ServiceResponse<Page<LongTermRetentionBackupInner>>>>() { @Override public Observable<ServiceResponse<Page<LongTermRetentionBackupInner>>> call(ServiceResponse<Page<LongTermRetentionBackupInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<LongTermRetentionBackupInner>>> listByServerWithServiceResponseAsync(final String locationName, final String longTermRetentionServerName, final Boolean onlyLatestPerDatabase, final LongTermRetentionDatabaseState databaseState) { return listByServerSinglePageAsync(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState) .concatMap(new Func1<ServiceResponse<Page<LongTermRetentionBackupInner>>, Observable<ServiceResponse<Page<LongTermRetentionBackupInner>>>>() { @Override public Observable<ServiceResponse<Page<LongTermRetentionBackupInner>>> call(ServiceResponse<Page<LongTermRetentionBackupInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listByServerNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "LongTermRetentionBackupInner", ">", ">", ">", "listByServerWithServiceResponseAsync", "(", "final", "String", "locationName", ",", "final", "String", "longTermRetentionServerName", ",", "final", "Boolean", "onlyLatestPerDatabase", ",", "final", "LongTermRetentionDatabaseState", "databaseState", ")", "{", "return", "listByServerSinglePageAsync", "(", "locationName", ",", "longTermRetentionServerName", ",", "onlyLatestPerDatabase", ",", "databaseState", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "LongTermRetentionBackupInner", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "LongTermRetentionBackupInner", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "LongTermRetentionBackupInner", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "LongTermRetentionBackupInner", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "listByServerNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
Lists the long term retention backups for a given server. @param locationName The location of the database @param longTermRetentionServerName the String value @param onlyLatestPerDatabase Whether or not to only get the latest backup for each database. @param databaseState Whether to query against just live databases, just deleted databases, or all databases. Possible values include: 'All', 'Live', 'Deleted' @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;LongTermRetentionBackupInner&gt; object
[ "Lists", "the", "long", "term", "retention", "backups", "for", "a", "given", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/LongTermRetentionBackupsInner.java#L1077-L1089
OpenLiberty/open-liberty
dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventEngineImpl.java
EventEngineImpl.checkTopicPublishPermission
void checkTopicPublishPermission(String topic) { SecurityManager sm = System.getSecurityManager(); if (sm == null) return; sm.checkPermission(new TopicPermission(topic, PUBLISH)); }
java
void checkTopicPublishPermission(String topic) { SecurityManager sm = System.getSecurityManager(); if (sm == null) return; sm.checkPermission(new TopicPermission(topic, PUBLISH)); }
[ "void", "checkTopicPublishPermission", "(", "String", "topic", ")", "{", "SecurityManager", "sm", "=", "System", ".", "getSecurityManager", "(", ")", ";", "if", "(", "sm", "==", "null", ")", "return", ";", "sm", ".", "checkPermission", "(", "new", "TopicPermission", "(", "topic", ",", "PUBLISH", ")", ")", ";", "}" ]
Check if the caller has permission to publish events to the specified topic. @param topic the topic the event is being published to
[ "Check", "if", "the", "caller", "has", "permission", "to", "publish", "events", "to", "the", "specified", "topic", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.event/src/com/ibm/ws/event/internal/EventEngineImpl.java#L323-L329
Waikato/jclasslocator
src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java
ClassLocator.main
public static void main(String[] args) { List<String> list; List<String> packages; int i; StringTokenizer tok; if ((args.length == 1) && (args[0].equals("packages"))) { list = getSingleton().findPackages(); for (i = 0; i < list.size(); i++) System.out.println(list.get(i)); } else if (args.length == 2) { // packages packages = new ArrayList<>(); tok = new StringTokenizer(args[1], ","); while (tok.hasMoreTokens()) packages.add(tok.nextToken()); // search list = getSingleton().findNames( args[0], packages.toArray(new String[packages.size()])); // print result, if any System.out.println( "Searching for '" + args[0] + "' in '" + args[1] + "':\n" + " " + list.size() + " found."); for (i = 0; i < list.size(); i++) System.out.println(" " + (i+1) + ". " + list.get(i)); } else { System.out.println("\nUsage:"); System.out.println( ClassLocator.class.getName() + " packages"); System.out.println("\tlists all packages in the classpath"); System.out.println( ClassLocator.class.getName() + " <classname> <packagename(s)>"); System.out.println("\tlists classes derived from/implementing 'classname' that"); System.out.println("\tcan be found in 'packagename(s)' (comma-separated list)"); System.out.println(); System.exit(1); } }
java
public static void main(String[] args) { List<String> list; List<String> packages; int i; StringTokenizer tok; if ((args.length == 1) && (args[0].equals("packages"))) { list = getSingleton().findPackages(); for (i = 0; i < list.size(); i++) System.out.println(list.get(i)); } else if (args.length == 2) { // packages packages = new ArrayList<>(); tok = new StringTokenizer(args[1], ","); while (tok.hasMoreTokens()) packages.add(tok.nextToken()); // search list = getSingleton().findNames( args[0], packages.toArray(new String[packages.size()])); // print result, if any System.out.println( "Searching for '" + args[0] + "' in '" + args[1] + "':\n" + " " + list.size() + " found."); for (i = 0; i < list.size(); i++) System.out.println(" " + (i+1) + ". " + list.get(i)); } else { System.out.println("\nUsage:"); System.out.println( ClassLocator.class.getName() + " packages"); System.out.println("\tlists all packages in the classpath"); System.out.println( ClassLocator.class.getName() + " <classname> <packagename(s)>"); System.out.println("\tlists classes derived from/implementing 'classname' that"); System.out.println("\tcan be found in 'packagename(s)' (comma-separated list)"); System.out.println(); System.exit(1); } }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "List", "<", "String", ">", "list", ";", "List", "<", "String", ">", "packages", ";", "int", "i", ";", "StringTokenizer", "tok", ";", "if", "(", "(", "args", ".", "length", "==", "1", ")", "&&", "(", "args", "[", "0", "]", ".", "equals", "(", "\"packages\"", ")", ")", ")", "{", "list", "=", "getSingleton", "(", ")", ".", "findPackages", "(", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "System", ".", "out", ".", "println", "(", "list", ".", "get", "(", "i", ")", ")", ";", "}", "else", "if", "(", "args", ".", "length", "==", "2", ")", "{", "// packages", "packages", "=", "new", "ArrayList", "<>", "(", ")", ";", "tok", "=", "new", "StringTokenizer", "(", "args", "[", "1", "]", ",", "\",\"", ")", ";", "while", "(", "tok", ".", "hasMoreTokens", "(", ")", ")", "packages", ".", "add", "(", "tok", ".", "nextToken", "(", ")", ")", ";", "// search", "list", "=", "getSingleton", "(", ")", ".", "findNames", "(", "args", "[", "0", "]", ",", "packages", ".", "toArray", "(", "new", "String", "[", "packages", ".", "size", "(", ")", "]", ")", ")", ";", "// print result, if any", "System", ".", "out", ".", "println", "(", "\"Searching for '\"", "+", "args", "[", "0", "]", "+", "\"' in '\"", "+", "args", "[", "1", "]", "+", "\"':\\n\"", "+", "\" \"", "+", "list", ".", "size", "(", ")", "+", "\" found.\"", ")", ";", "for", "(", "i", "=", "0", ";", "i", "<", "list", ".", "size", "(", ")", ";", "i", "++", ")", "System", ".", "out", ".", "println", "(", "\" \"", "+", "(", "i", "+", "1", ")", "+", "\". \"", "+", "list", ".", "get", "(", "i", ")", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "\"\\nUsage:\"", ")", ";", "System", ".", "out", ".", "println", "(", "ClassLocator", ".", "class", ".", "getName", "(", ")", "+", "\" packages\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\\tlists all packages in the classpath\"", ")", ";", "System", ".", "out", ".", "println", "(", "ClassLocator", ".", "class", ".", "getName", "(", ")", "+", "\" <classname> <packagename(s)>\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\\tlists classes derived from/implementing 'classname' that\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"\\tcan be found in 'packagename(s)' (comma-separated list)\"", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "}" ]
Possible calls: <ul> <li> adams.core.ClassLocator &lt;packages&gt;<br> Prints all the packages in the current classpath </li> <li> adams.core.ClassLocator &lt;classname&gt; &lt;packagename(s)&gt;<br> Prints the classes it found. </li> </ul> @param args the commandline arguments
[ "Possible", "calls", ":", "<ul", ">", "<li", ">", "adams", ".", "core", ".", "ClassLocator", "&lt", ";", "packages&gt", ";", "<br", ">", "Prints", "all", "the", "packages", "in", "the", "current", "classpath", "<", "/", "li", ">", "<li", ">", "adams", ".", "core", ".", "ClassLocator", "&lt", ";", "classname&gt", ";", "&lt", ";", "packagename", "(", "s", ")", "&gt", ";", "<br", ">", "Prints", "the", "classes", "it", "found", ".", "<", "/", "li", ">", "<", "/", "ul", ">" ]
train
https://github.com/Waikato/jclasslocator/blob/c899072fff607a56ee7f8c2d01fbeb15157ad144/src/main/java/nz/ac/waikato/cms/locator/ClassLocator.java#L722-L764
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java
UsersInner.createOrUpdateAsync
public Observable<UserInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, String userName, UserInner user) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() { @Override public UserInner call(ServiceResponse<UserInner> response) { return response.body(); } }); }
java
public Observable<UserInner> createOrUpdateAsync(String resourceGroupName, String labAccountName, String labName, String userName, UserInner user) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, userName, user).map(new Func1<ServiceResponse<UserInner>, UserInner>() { @Override public UserInner call(ServiceResponse<UserInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "UserInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "String", "userName", ",", "UserInner", "user", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "labAccountName", ",", "labName", ",", "userName", ",", "user", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "UserInner", ">", ",", "UserInner", ">", "(", ")", "{", "@", "Override", "public", "UserInner", "call", "(", "ServiceResponse", "<", "UserInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Create or replace an existing User. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param userName The name of the user. @param user The User registered to a lab @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UserInner object
[ "Create", "or", "replace", "an", "existing", "User", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/UsersInner.java#L617-L624
GoogleCloudPlatform/bigdata-interop
gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PrefixMappedItemCache.java
PrefixMappedItemCache.putList
public synchronized void putList( String bucket, @Nullable String objectNamePrefix, List<GoogleCloudStorageItemInfo> items) { // Give all entries the same creation time so they expire at the same time. long creationTime = ticker.read(); PrefixKey key = new PrefixKey(bucket, objectNamePrefix); // The list being inserted is always fresher than any child lists. getPrefixSubMap(itemMap, key).clear(); getPrefixSubMap(prefixMap, key).clear(); // Populate the maps. prefixMap.put(key, new CacheValue<Object>(null, creationTime)); for (GoogleCloudStorageItemInfo item : items) { StorageResourceId itemId = item.getResourceId(); PrefixKey itemKey = new PrefixKey(itemId.getBucketName(), itemId.getObjectName()); CacheValue<GoogleCloudStorageItemInfo> itemValue = new CacheValue<GoogleCloudStorageItemInfo>(item, creationTime); itemMap.put(itemKey, itemValue); } }
java
public synchronized void putList( String bucket, @Nullable String objectNamePrefix, List<GoogleCloudStorageItemInfo> items) { // Give all entries the same creation time so they expire at the same time. long creationTime = ticker.read(); PrefixKey key = new PrefixKey(bucket, objectNamePrefix); // The list being inserted is always fresher than any child lists. getPrefixSubMap(itemMap, key).clear(); getPrefixSubMap(prefixMap, key).clear(); // Populate the maps. prefixMap.put(key, new CacheValue<Object>(null, creationTime)); for (GoogleCloudStorageItemInfo item : items) { StorageResourceId itemId = item.getResourceId(); PrefixKey itemKey = new PrefixKey(itemId.getBucketName(), itemId.getObjectName()); CacheValue<GoogleCloudStorageItemInfo> itemValue = new CacheValue<GoogleCloudStorageItemInfo>(item, creationTime); itemMap.put(itemKey, itemValue); } }
[ "public", "synchronized", "void", "putList", "(", "String", "bucket", ",", "@", "Nullable", "String", "objectNamePrefix", ",", "List", "<", "GoogleCloudStorageItemInfo", ">", "items", ")", "{", "// Give all entries the same creation time so they expire at the same time.", "long", "creationTime", "=", "ticker", ".", "read", "(", ")", ";", "PrefixKey", "key", "=", "new", "PrefixKey", "(", "bucket", ",", "objectNamePrefix", ")", ";", "// The list being inserted is always fresher than any child lists.", "getPrefixSubMap", "(", "itemMap", ",", "key", ")", ".", "clear", "(", ")", ";", "getPrefixSubMap", "(", "prefixMap", ",", "key", ")", ".", "clear", "(", ")", ";", "// Populate the maps.", "prefixMap", ".", "put", "(", "key", ",", "new", "CacheValue", "<", "Object", ">", "(", "null", ",", "creationTime", ")", ")", ";", "for", "(", "GoogleCloudStorageItemInfo", "item", ":", "items", ")", "{", "StorageResourceId", "itemId", "=", "item", ".", "getResourceId", "(", ")", ";", "PrefixKey", "itemKey", "=", "new", "PrefixKey", "(", "itemId", ".", "getBucketName", "(", ")", ",", "itemId", ".", "getObjectName", "(", ")", ")", ";", "CacheValue", "<", "GoogleCloudStorageItemInfo", ">", "itemValue", "=", "new", "CacheValue", "<", "GoogleCloudStorageItemInfo", ">", "(", "item", ",", "creationTime", ")", ";", "itemMap", ".", "put", "(", "itemKey", ",", "itemValue", ")", ";", "}", "}" ]
Inserts a list entry and the given items into the cache. If a list entry under the same bucket/objectNamePrefix is present, its expiration time is reset. If an item with the same resource id is present, it is overwritten by the new item. @param bucket the bucket to index the items by. @param objectNamePrefix the object name prefix to index the items by. If this is null, it will be converted to empty string. @param items the list of items to insert.
[ "Inserts", "a", "list", "entry", "and", "the", "given", "items", "into", "the", "cache", ".", "If", "a", "list", "entry", "under", "the", "same", "bucket", "/", "objectNamePrefix", "is", "present", "its", "expiration", "time", "is", "reset", ".", "If", "an", "item", "with", "the", "same", "resource", "id", "is", "present", "it", "is", "overwritten", "by", "the", "new", "item", "." ]
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcsio/src/main/java/com/google/cloud/hadoop/gcsio/PrefixMappedItemCache.java#L164-L183
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/util/SequentialWriter.java
SequentialWriter.writeAtMost
private int writeAtMost(ByteBuffer data, int offset, int length) { if (current >= bufferOffset + buffer.length) reBuffer(); assert current < bufferOffset + buffer.length : String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset); int toCopy = Math.min(length, buffer.length - bufferCursor()); // copy bytes from external buffer ByteBufferUtil.arrayCopy(data, offset, buffer, bufferCursor(), toCopy); assert current <= bufferOffset + buffer.length : String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset); validBufferBytes = Math.max(validBufferBytes, bufferCursor() + toCopy); current += toCopy; return toCopy; }
java
private int writeAtMost(ByteBuffer data, int offset, int length) { if (current >= bufferOffset + buffer.length) reBuffer(); assert current < bufferOffset + buffer.length : String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset); int toCopy = Math.min(length, buffer.length - bufferCursor()); // copy bytes from external buffer ByteBufferUtil.arrayCopy(data, offset, buffer, bufferCursor(), toCopy); assert current <= bufferOffset + buffer.length : String.format("File (%s) offset %d, buffer offset %d.", getPath(), current, bufferOffset); validBufferBytes = Math.max(validBufferBytes, bufferCursor() + toCopy); current += toCopy; return toCopy; }
[ "private", "int", "writeAtMost", "(", "ByteBuffer", "data", ",", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "current", ">=", "bufferOffset", "+", "buffer", ".", "length", ")", "reBuffer", "(", ")", ";", "assert", "current", "<", "bufferOffset", "+", "buffer", ".", "length", ":", "String", ".", "format", "(", "\"File (%s) offset %d, buffer offset %d.\"", ",", "getPath", "(", ")", ",", "current", ",", "bufferOffset", ")", ";", "int", "toCopy", "=", "Math", ".", "min", "(", "length", ",", "buffer", ".", "length", "-", "bufferCursor", "(", ")", ")", ";", "// copy bytes from external buffer", "ByteBufferUtil", ".", "arrayCopy", "(", "data", ",", "offset", ",", "buffer", ",", "bufferCursor", "(", ")", ",", "toCopy", ")", ";", "assert", "current", "<=", "bufferOffset", "+", "buffer", ".", "length", ":", "String", ".", "format", "(", "\"File (%s) offset %d, buffer offset %d.\"", ",", "getPath", "(", ")", ",", "current", ",", "bufferOffset", ")", ";", "validBufferBytes", "=", "Math", ".", "max", "(", "validBufferBytes", ",", "bufferCursor", "(", ")", "+", "toCopy", ")", ";", "current", "+=", "toCopy", ";", "return", "toCopy", ";", "}" ]
/* Write at most "length" bytes from "data" starting at position "offset", and return the number of bytes written. caller is responsible for setting isDirty.
[ "/", "*", "Write", "at", "most", "length", "bytes", "from", "data", "starting", "at", "position", "offset", "and", "return", "the", "number", "of", "bytes", "written", ".", "caller", "is", "responsible", "for", "setting", "isDirty", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/util/SequentialWriter.java#L187-L208
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.deleteCustomEntityRole
public OperationStatus deleteCustomEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { return deleteCustomEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
java
public OperationStatus deleteCustomEntityRole(UUID appId, String versionId, UUID entityId, UUID roleId) { return deleteCustomEntityRoleWithServiceResponseAsync(appId, versionId, entityId, roleId).toBlocking().single().body(); }
[ "public", "OperationStatus", "deleteCustomEntityRole", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ",", "UUID", "roleId", ")", "{", "return", "deleteCustomEntityRoleWithServiceResponseAsync", "(", "appId", ",", "versionId", ",", "entityId", ",", "roleId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Delete an entity role. @param appId The application ID. @param versionId The version ID. @param entityId The entity ID. @param roleId The entity role Id. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatus object if successful.
[ "Delete", "an", "entity", "role", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L13868-L13870
javalite/activeweb
javalite-async/src/main/java/org/javalite/async/Async.java
Async.getBatchReceiver
public BatchReceiver getBatchReceiver(String queueName, long timeout){ try { return new BatchReceiver((Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName), timeout, consumerConnection); } catch (Exception e) { throw new AsyncException(e); } }
java
public BatchReceiver getBatchReceiver(String queueName, long timeout){ try { return new BatchReceiver((Queue) jmsServer.lookup(QUEUE_NAMESPACE + queueName), timeout, consumerConnection); } catch (Exception e) { throw new AsyncException(e); } }
[ "public", "BatchReceiver", "getBatchReceiver", "(", "String", "queueName", ",", "long", "timeout", ")", "{", "try", "{", "return", "new", "BatchReceiver", "(", "(", "Queue", ")", "jmsServer", ".", "lookup", "(", "QUEUE_NAMESPACE", "+", "queueName", ")", ",", "timeout", ",", "consumerConnection", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "AsyncException", "(", "e", ")", ";", "}", "}" ]
Generate a {@link BatchReceiver} to receive and process stored messages. This method ALWAYS works in the context of a transaction. @param queueName name of queue @param timeout timeout to wait. @return instance of {@link BatchReceiver}.
[ "Generate", "a", "{", "@link", "BatchReceiver", "}", "to", "receive", "and", "process", "stored", "messages", ".", "This", "method", "ALWAYS", "works", "in", "the", "context", "of", "a", "transaction", "." ]
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/javalite-async/src/main/java/org/javalite/async/Async.java#L528-L534
deeplearning4j/deeplearning4j
datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/recordreader/BaseImageRecordReader.java
BaseImageRecordReader.initialize
public void initialize(Configuration conf, InputSplit split, ImageTransform imageTransform) throws IOException, InterruptedException { this.imageLoader = null; this.imageTransform = imageTransform; initialize(conf, split); }
java
public void initialize(Configuration conf, InputSplit split, ImageTransform imageTransform) throws IOException, InterruptedException { this.imageLoader = null; this.imageTransform = imageTransform; initialize(conf, split); }
[ "public", "void", "initialize", "(", "Configuration", "conf", ",", "InputSplit", "split", ",", "ImageTransform", "imageTransform", ")", "throws", "IOException", ",", "InterruptedException", "{", "this", ".", "imageLoader", "=", "null", ";", "this", ".", "imageTransform", "=", "imageTransform", ";", "initialize", "(", "conf", ",", "split", ")", ";", "}" ]
Called once at initialization. @param conf a configuration for initialization @param split the split that defines the range of records to read @param imageTransform the image transform to use to transform images while loading them @throws java.io.IOException @throws InterruptedException
[ "Called", "once", "at", "initialization", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-data/datavec-data-image/src/main/java/org/datavec/image/recordreader/BaseImageRecordReader.java#L211-L216
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/reflect/RecursiveObjectReader.java
RecursiveObjectReader.hasProperty
public static boolean hasProperty(Object obj, String name) { if (obj == null || name == null) return false; String[] names = name.split("\\."); if (names == null || names.length == 0) return false; return performHasProperty(obj, names, 0); }
java
public static boolean hasProperty(Object obj, String name) { if (obj == null || name == null) return false; String[] names = name.split("\\."); if (names == null || names.length == 0) return false; return performHasProperty(obj, names, 0); }
[ "public", "static", "boolean", "hasProperty", "(", "Object", "obj", ",", "String", "name", ")", "{", "if", "(", "obj", "==", "null", "||", "name", "==", "null", ")", "return", "false", ";", "String", "[", "]", "names", "=", "name", ".", "split", "(", "\"\\\\.\"", ")", ";", "if", "(", "names", "==", "null", "||", "names", ".", "length", "==", "0", ")", "return", "false", ";", "return", "performHasProperty", "(", "obj", ",", "names", ",", "0", ")", ";", "}" ]
Checks recursively if object or its subobjects has a property with specified name. The object can be a user defined object, map or array. The property name correspondently must be object property, map key or array index. @param obj an object to introspect. @param name a name of the property to check. @return true if the object has the property and false if it doesn't.
[ "Checks", "recursively", "if", "object", "or", "its", "subobjects", "has", "a", "property", "with", "specified", "name", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/RecursiveObjectReader.java#L41-L50
comapi/comapi-sdk-android
COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java
InternalService.deleteConversation
public void deleteConversation(@NonNull final String conversationId, final String eTag, @Nullable Callback<ComapiResult<Void>> callback) { adapter.adapt(deleteConversation(conversationId, eTag), callback); }
java
public void deleteConversation(@NonNull final String conversationId, final String eTag, @Nullable Callback<ComapiResult<Void>> callback) { adapter.adapt(deleteConversation(conversationId, eTag), callback); }
[ "public", "void", "deleteConversation", "(", "@", "NonNull", "final", "String", "conversationId", ",", "final", "String", "eTag", ",", "@", "Nullable", "Callback", "<", "ComapiResult", "<", "Void", ">", ">", "callback", ")", "{", "adapter", ".", "adapt", "(", "deleteConversation", "(", "conversationId", ",", "eTag", ")", ",", "callback", ")", ";", "}" ]
Returns observable to create a conversation. @param conversationId ID of a conversation to delete. @param eTag ETag for server to check if local version of the data is the same as the one the server side. @param callback Callback to deliver new session instance.
[ "Returns", "observable", "to", "create", "a", "conversation", "." ]
train
https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/network/InternalService.java#L464-L466
alkacon/opencms-core
src/org/opencms/loader/CmsTemplateContextManager.java
CmsTemplateContextManager.shouldShowType
public boolean shouldShowType(String contextKey, String typeName) { Map<String, CmsDefaultSet<String>> allowedContextMap = safeGetAllowedContextMap(); CmsDefaultSet<String> allowedContexts = allowedContextMap.get(typeName); if (allowedContexts == null) { return true; } return allowedContexts.contains(contextKey); }
java
public boolean shouldShowType(String contextKey, String typeName) { Map<String, CmsDefaultSet<String>> allowedContextMap = safeGetAllowedContextMap(); CmsDefaultSet<String> allowedContexts = allowedContextMap.get(typeName); if (allowedContexts == null) { return true; } return allowedContexts.contains(contextKey); }
[ "public", "boolean", "shouldShowType", "(", "String", "contextKey", ",", "String", "typeName", ")", "{", "Map", "<", "String", ",", "CmsDefaultSet", "<", "String", ">", ">", "allowedContextMap", "=", "safeGetAllowedContextMap", "(", ")", ";", "CmsDefaultSet", "<", "String", ">", "allowedContexts", "=", "allowedContextMap", ".", "get", "(", "typeName", ")", ";", "if", "(", "allowedContexts", "==", "null", ")", "{", "return", "true", ";", "}", "return", "allowedContexts", ".", "contains", "(", "contextKey", ")", ";", "}" ]
Helper method to check whether a given type should not be shown in a context.<p> @param contextKey the key of the template context @param typeName the type name @return true if the context does not prohibit showing the type
[ "Helper", "method", "to", "check", "whether", "a", "given", "type", "should", "not", "be", "shown", "in", "a", "context", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsTemplateContextManager.java#L355-L363
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java
StreamSegmentReadIndex.getReadAlignedLength
private int getReadAlignedLength(long offset, int readLength) { // Calculate how many bytes over the last alignment marker the offset is. int lengthSinceLastMultiple = (int) (offset % this.config.getStorageReadAlignment()); // Even though we were asked to read a number of bytes, in some cases we will return fewer bytes than requested // in order to read-align the reads. return Math.min(readLength, this.config.getStorageReadAlignment() - lengthSinceLastMultiple); }
java
private int getReadAlignedLength(long offset, int readLength) { // Calculate how many bytes over the last alignment marker the offset is. int lengthSinceLastMultiple = (int) (offset % this.config.getStorageReadAlignment()); // Even though we were asked to read a number of bytes, in some cases we will return fewer bytes than requested // in order to read-align the reads. return Math.min(readLength, this.config.getStorageReadAlignment() - lengthSinceLastMultiple); }
[ "private", "int", "getReadAlignedLength", "(", "long", "offset", ",", "int", "readLength", ")", "{", "// Calculate how many bytes over the last alignment marker the offset is.", "int", "lengthSinceLastMultiple", "=", "(", "int", ")", "(", "offset", "%", "this", ".", "config", ".", "getStorageReadAlignment", "(", ")", ")", ";", "// Even though we were asked to read a number of bytes, in some cases we will return fewer bytes than requested", "// in order to read-align the reads.", "return", "Math", ".", "min", "(", "readLength", ",", "this", ".", "config", ".", "getStorageReadAlignment", "(", ")", "-", "lengthSinceLastMultiple", ")", ";", "}" ]
Returns an adjusted read length based on the given input, making sure the end of the Read Request is aligned with a multiple of STORAGE_READ_MAX_LEN. @param offset The read offset. @param readLength The requested read length. @return The adjusted (aligned) read length.
[ "Returns", "an", "adjusted", "read", "length", "based", "on", "the", "given", "input", "making", "sure", "the", "end", "of", "the", "Read", "Request", "is", "aligned", "with", "a", "multiple", "of", "STORAGE_READ_MAX_LEN", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/reading/StreamSegmentReadIndex.java#L1027-L1034
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/cemi/CEMILDataEx.java
CEMILDataEx.getAdditionalInfo
public synchronized List getAdditionalInfo() { final List l = new ArrayList(); for (int i = 0; i < addInfo.length; ++i) if (addInfo[i] != null) l.add(new AddInfo(i, (byte[]) addInfo[i].clone())); return l; }
java
public synchronized List getAdditionalInfo() { final List l = new ArrayList(); for (int i = 0; i < addInfo.length; ++i) if (addInfo[i] != null) l.add(new AddInfo(i, (byte[]) addInfo[i].clone())); return l; }
[ "public", "synchronized", "List", "getAdditionalInfo", "(", ")", "{", "final", "List", "l", "=", "new", "ArrayList", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "addInfo", ".", "length", ";", "++", "i", ")", "if", "(", "addInfo", "[", "i", "]", "!=", "null", ")", "l", ".", "add", "(", "new", "AddInfo", "(", "i", ",", "(", "byte", "[", "]", ")", "addInfo", "[", "i", "]", ".", "clone", "(", ")", ")", ")", ";", "return", "l", ";", "}" ]
Returns all additional information currently set. <p> @return a List with {@link AddInfo} objects
[ "Returns", "all", "additional", "information", "currently", "set", ".", "<p", ">" ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/cemi/CEMILDataEx.java#L342-L349
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.asum
public SDVariable asum(String name, SDVariable in, int... dimensions) { validateNumerical("asum", in); SDVariable ret = f().asum(in, dimensions); return updateVariableNameAndReference(ret, name); }
java
public SDVariable asum(String name, SDVariable in, int... dimensions) { validateNumerical("asum", in); SDVariable ret = f().asum(in, dimensions); return updateVariableNameAndReference(ret, name); }
[ "public", "SDVariable", "asum", "(", "String", "name", ",", "SDVariable", "in", ",", "int", "...", "dimensions", ")", "{", "validateNumerical", "(", "\"asum\"", ",", "in", ")", ";", "SDVariable", "ret", "=", "f", "(", ")", ".", "asum", "(", "in", ",", "dimensions", ")", ";", "return", "updateVariableNameAndReference", "(", "ret", ",", "name", ")", ";", "}" ]
Absolute sum array reduction operation, optionally along specified dimensions: out = sum(abs(x)) @param name Name of the output variable @param in Input variable @param dimensions Dimensions to reduce over. If dimensions are not specified, full array reduction is performed @return Reduced array of rank (input rank - num dimensions)
[ "Absolute", "sum", "array", "reduction", "operation", "optionally", "along", "specified", "dimensions", ":", "out", "=", "sum", "(", "abs", "(", "x", "))" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L270-L274
j256/ormlite-core
src/main/java/com/j256/ormlite/stmt/Where.java
Where.rawComparison
public Where<T, ID> rawComparison(String columnName, String rawOperator, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, rawOperator)); return this; }
java
public Where<T, ID> rawComparison(String columnName, String rawOperator, Object value) throws SQLException { addClause(new SimpleComparison(columnName, findColumnFieldType(columnName), value, rawOperator)); return this; }
[ "public", "Where", "<", "T", ",", "ID", ">", "rawComparison", "(", "String", "columnName", ",", "String", "rawOperator", ",", "Object", "value", ")", "throws", "SQLException", "{", "addClause", "(", "new", "SimpleComparison", "(", "columnName", ",", "findColumnFieldType", "(", "columnName", ")", ",", "value", ",", "rawOperator", ")", ")", ";", "return", "this", ";", "}" ]
Make a comparison where the operator is specified by the caller. It is up to the caller to specify an appropriate operator for the database and that it be formatted correctly.
[ "Make", "a", "comparison", "where", "the", "operator", "is", "specified", "by", "the", "caller", ".", "It", "is", "up", "to", "the", "caller", "to", "specify", "an", "appropriate", "operator", "for", "the", "database", "and", "that", "it", "be", "formatted", "correctly", "." ]
train
https://github.com/j256/ormlite-core/blob/154d85bbb9614a0ea65a012251257831fb4fba21/src/main/java/com/j256/ormlite/stmt/Where.java#L464-L467
apereo/cas
core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java
WebUtils.produceErrorView
public static ModelAndView produceErrorView(final String view, final Exception e) { return new ModelAndView(view, CollectionUtils.wrap("rootCauseException", e)); }
java
public static ModelAndView produceErrorView(final String view, final Exception e) { return new ModelAndView(view, CollectionUtils.wrap("rootCauseException", e)); }
[ "public", "static", "ModelAndView", "produceErrorView", "(", "final", "String", "view", ",", "final", "Exception", "e", ")", "{", "return", "new", "ModelAndView", "(", "view", ",", "CollectionUtils", ".", "wrap", "(", "\"rootCauseException\"", ",", "e", ")", ")", ";", "}" ]
Produce error view model and view. @param view the view @param e the e @return the model and view
[ "Produce", "error", "view", "model", "and", "view", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-web-api/src/main/java/org/apereo/cas/web/support/WebUtils.java#L793-L795
encoway/edu
edu/src/main/java/com/encoway/edu/EventDrivenUpdatesMap.java
EventDrivenUpdatesMap.get
public String get(String events, String defaultValue) { return get(parseEvents(events), defaultValue); }
java
public String get(String events, String defaultValue) { return get(parseEvents(events), defaultValue); }
[ "public", "String", "get", "(", "String", "events", ",", "String", "defaultValue", ")", "{", "return", "get", "(", "parseEvents", "(", "events", ")", ",", "defaultValue", ")", ";", "}" ]
Returns a space separated list of component IDs of components registered for at least one the `events`. @param events a comma/space separated list of event names @param defaultValue will be returned if no component is registered for one of the `events` @return a space separated list of fully qualified component IDs or `defaultValue`
[ "Returns", "a", "space", "separated", "list", "of", "component", "IDs", "of", "components", "registered", "for", "at", "least", "one", "the", "events", "." ]
train
https://github.com/encoway/edu/blob/52ae92b2207f7d5668e212904359fbeb360f3f05/edu/src/main/java/com/encoway/edu/EventDrivenUpdatesMap.java#L120-L122
alkacon/opencms-core
src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java
CmsContainerpageController.requiresOptionBar
public boolean requiresOptionBar(CmsContainerPageElementPanel element, I_CmsDropContainer dragParent) { return element.hasViewPermission() && (!element.hasModelGroupParent() || getData().isModelGroup()) && (matchRootView(element.getElementView()) || isGroupcontainerEditing() || shouldShowModelgroupOptionBar(element)) && isContainerEditable(dragParent) && matchesCurrentEditLevel(dragParent); }
java
public boolean requiresOptionBar(CmsContainerPageElementPanel element, I_CmsDropContainer dragParent) { return element.hasViewPermission() && (!element.hasModelGroupParent() || getData().isModelGroup()) && (matchRootView(element.getElementView()) || isGroupcontainerEditing() || shouldShowModelgroupOptionBar(element)) && isContainerEditable(dragParent) && matchesCurrentEditLevel(dragParent); }
[ "public", "boolean", "requiresOptionBar", "(", "CmsContainerPageElementPanel", "element", ",", "I_CmsDropContainer", "dragParent", ")", "{", "return", "element", ".", "hasViewPermission", "(", ")", "&&", "(", "!", "element", ".", "hasModelGroupParent", "(", ")", "||", "getData", "(", ")", ".", "isModelGroup", "(", ")", ")", "&&", "(", "matchRootView", "(", "element", ".", "getElementView", "(", ")", ")", "||", "isGroupcontainerEditing", "(", ")", "||", "shouldShowModelgroupOptionBar", "(", "element", ")", ")", "&&", "isContainerEditable", "(", "dragParent", ")", "&&", "matchesCurrentEditLevel", "(", "dragParent", ")", ";", "}" ]
Checks whether the given element should display the option bar.<p> @param element the element @param dragParent the element parent @return <code>true</code> if the given element should display the option bar
[ "Checks", "whether", "the", "given", "element", "should", "display", "the", "option", "bar", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/containerpage/client/CmsContainerpageController.java#L2825-L2834
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.getExports
public List<Export> getExports(UUID projectId, UUID iterationId) { return getExportsWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); }
java
public List<Export> getExports(UUID projectId, UUID iterationId) { return getExportsWithServiceResponseAsync(projectId, iterationId).toBlocking().single().body(); }
[ "public", "List", "<", "Export", ">", "getExports", "(", "UUID", "projectId", ",", "UUID", "iterationId", ")", "{", "return", "getExportsWithServiceResponseAsync", "(", "projectId", ",", "iterationId", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Get the list of exports for a specific iteration. @param projectId The project id @param iterationId The iteration id @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;Export&gt; object if successful.
[ "Get", "the", "list", "of", "exports", "for", "a", "specific", "iteration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L1129-L1131
apache/fluo
modules/core/src/main/java/org/apache/fluo/core/util/SpanUtil.java
SpanUtil.toRowColumn
public static RowColumn toRowColumn(Key key) { if (key == null) { return RowColumn.EMPTY; } if ((key.getRow() == null) || key.getRow().getLength() == 0) { return RowColumn.EMPTY; } Bytes row = ByteUtil.toBytes(key.getRow()); if ((key.getColumnFamily() == null) || key.getColumnFamily().getLength() == 0) { return new RowColumn(row); } Bytes cf = ByteUtil.toBytes(key.getColumnFamily()); if ((key.getColumnQualifier() == null) || key.getColumnQualifier().getLength() == 0) { return new RowColumn(row, new Column(cf)); } Bytes cq = ByteUtil.toBytes(key.getColumnQualifier()); if ((key.getColumnVisibility() == null) || key.getColumnVisibility().getLength() == 0) { return new RowColumn(row, new Column(cf, cq)); } Bytes cv = ByteUtil.toBytes(key.getColumnVisibility()); return new RowColumn(row, new Column(cf, cq, cv)); }
java
public static RowColumn toRowColumn(Key key) { if (key == null) { return RowColumn.EMPTY; } if ((key.getRow() == null) || key.getRow().getLength() == 0) { return RowColumn.EMPTY; } Bytes row = ByteUtil.toBytes(key.getRow()); if ((key.getColumnFamily() == null) || key.getColumnFamily().getLength() == 0) { return new RowColumn(row); } Bytes cf = ByteUtil.toBytes(key.getColumnFamily()); if ((key.getColumnQualifier() == null) || key.getColumnQualifier().getLength() == 0) { return new RowColumn(row, new Column(cf)); } Bytes cq = ByteUtil.toBytes(key.getColumnQualifier()); if ((key.getColumnVisibility() == null) || key.getColumnVisibility().getLength() == 0) { return new RowColumn(row, new Column(cf, cq)); } Bytes cv = ByteUtil.toBytes(key.getColumnVisibility()); return new RowColumn(row, new Column(cf, cq, cv)); }
[ "public", "static", "RowColumn", "toRowColumn", "(", "Key", "key", ")", "{", "if", "(", "key", "==", "null", ")", "{", "return", "RowColumn", ".", "EMPTY", ";", "}", "if", "(", "(", "key", ".", "getRow", "(", ")", "==", "null", ")", "||", "key", ".", "getRow", "(", ")", ".", "getLength", "(", ")", "==", "0", ")", "{", "return", "RowColumn", ".", "EMPTY", ";", "}", "Bytes", "row", "=", "ByteUtil", ".", "toBytes", "(", "key", ".", "getRow", "(", ")", ")", ";", "if", "(", "(", "key", ".", "getColumnFamily", "(", ")", "==", "null", ")", "||", "key", ".", "getColumnFamily", "(", ")", ".", "getLength", "(", ")", "==", "0", ")", "{", "return", "new", "RowColumn", "(", "row", ")", ";", "}", "Bytes", "cf", "=", "ByteUtil", ".", "toBytes", "(", "key", ".", "getColumnFamily", "(", ")", ")", ";", "if", "(", "(", "key", ".", "getColumnQualifier", "(", ")", "==", "null", ")", "||", "key", ".", "getColumnQualifier", "(", ")", ".", "getLength", "(", ")", "==", "0", ")", "{", "return", "new", "RowColumn", "(", "row", ",", "new", "Column", "(", "cf", ")", ")", ";", "}", "Bytes", "cq", "=", "ByteUtil", ".", "toBytes", "(", "key", ".", "getColumnQualifier", "(", ")", ")", ";", "if", "(", "(", "key", ".", "getColumnVisibility", "(", ")", "==", "null", ")", "||", "key", ".", "getColumnVisibility", "(", ")", ".", "getLength", "(", ")", "==", "0", ")", "{", "return", "new", "RowColumn", "(", "row", ",", "new", "Column", "(", "cf", ",", "cq", ")", ")", ";", "}", "Bytes", "cv", "=", "ByteUtil", ".", "toBytes", "(", "key", ".", "getColumnVisibility", "(", ")", ")", ";", "return", "new", "RowColumn", "(", "row", ",", "new", "Column", "(", "cf", ",", "cq", ",", "cv", ")", ")", ";", "}" ]
Converts from an Accumulo Key to a Fluo RowColumn @param key Key @return RowColumn
[ "Converts", "from", "an", "Accumulo", "Key", "to", "a", "Fluo", "RowColumn" ]
train
https://github.com/apache/fluo/blob/8e06204d4167651e2d3b5219b8c1397644e6ba6e/modules/core/src/main/java/org/apache/fluo/core/util/SpanUtil.java#L87-L108
protostuff/protostuff
protostuff-api/src/main/java/io/protostuff/IntSerializer.java
IntSerializer.writeInt16LE
public static void writeInt16LE(final int value, final byte[] buffer, int offset) { buffer[offset++] = (byte) value; buffer[offset] = (byte) ((value >>> 8) & 0xFF); }
java
public static void writeInt16LE(final int value, final byte[] buffer, int offset) { buffer[offset++] = (byte) value; buffer[offset] = (byte) ((value >>> 8) & 0xFF); }
[ "public", "static", "void", "writeInt16LE", "(", "final", "int", "value", ",", "final", "byte", "[", "]", "buffer", ",", "int", "offset", ")", "{", "buffer", "[", "offset", "++", "]", "=", "(", "byte", ")", "value", ";", "buffer", "[", "offset", "]", "=", "(", "byte", ")", "(", "(", "value", ">>>", "8", ")", "&", "0xFF", ")", ";", "}" ]
Writes the 16-bit int into the buffer starting with the least significant byte.
[ "Writes", "the", "16", "-", "bit", "int", "into", "the", "buffer", "starting", "with", "the", "least", "significant", "byte", "." ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-api/src/main/java/io/protostuff/IntSerializer.java#L44-L48
TestFX/Monocle
src/main/java/com/sun/glass/ui/monocle/X11WarpingCursor.java
X11WarpingCursor.setLocation
@Override void setLocation(int x, int y) { if (x != nextX || y != nextY) { nextX = x; nextY = y; MonocleWindowManager.getInstance().repaintAll(); } }
java
@Override void setLocation(int x, int y) { if (x != nextX || y != nextY) { nextX = x; nextY = y; MonocleWindowManager.getInstance().repaintAll(); } }
[ "@", "Override", "void", "setLocation", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "x", "!=", "nextX", "||", "y", "!=", "nextY", ")", "{", "nextX", "=", "x", ";", "nextY", "=", "y", ";", "MonocleWindowManager", ".", "getInstance", "(", ")", ".", "repaintAll", "(", ")", ";", "}", "}" ]
Update the next coordinates for the cursor. The actual move will occur on the next buffer swap @param x the new X location on the screen @param y the new Y location on the screen
[ "Update", "the", "next", "coordinates", "for", "the", "cursor", ".", "The", "actual", "move", "will", "occur", "on", "the", "next", "buffer", "swap" ]
train
https://github.com/TestFX/Monocle/blob/267ccba8889cab244bf8c562dbaa0345a612874c/src/main/java/com/sun/glass/ui/monocle/X11WarpingCursor.java#L41-L48
kaazing/gateway
mina.netty/src/main/java/org/kaazing/mina/core/future/DefaultUnbindFuture.java
DefaultUnbindFuture.combineFutures
public static UnbindFuture combineFutures(UnbindFuture future1, UnbindFuture future2) { if (future1 == null || future1.isUnbound()) { return future2; } else if (future2 == null || future2.isUnbound()) { return future1; } else { return new CompositeUnbindFuture(Arrays.asList(future1, future2)); } }
java
public static UnbindFuture combineFutures(UnbindFuture future1, UnbindFuture future2) { if (future1 == null || future1.isUnbound()) { return future2; } else if (future2 == null || future2.isUnbound()) { return future1; } else { return new CompositeUnbindFuture(Arrays.asList(future1, future2)); } }
[ "public", "static", "UnbindFuture", "combineFutures", "(", "UnbindFuture", "future1", ",", "UnbindFuture", "future2", ")", "{", "if", "(", "future1", "==", "null", "||", "future1", ".", "isUnbound", "(", ")", ")", "{", "return", "future2", ";", "}", "else", "if", "(", "future2", "==", "null", "||", "future2", ".", "isUnbound", "(", ")", ")", "{", "return", "future1", ";", "}", "else", "{", "return", "new", "CompositeUnbindFuture", "(", "Arrays", ".", "asList", "(", "future1", ",", "future2", ")", ")", ";", "}", "}" ]
Combine futures in a way that minimizes cost(no object creation) for the common case where both have already been fulfilled.
[ "Combine", "futures", "in", "a", "way", "that", "minimizes", "cost", "(", "no", "object", "creation", ")", "for", "the", "common", "case", "where", "both", "have", "already", "been", "fulfilled", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/mina.netty/src/main/java/org/kaazing/mina/core/future/DefaultUnbindFuture.java#L45-L55
drallgood/jpasskit
jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java
PKSigningInformationUtil.loadSigningInformationFromPKCS12AndIntermediateCertificate
public PKSigningInformation loadSigningInformationFromPKCS12AndIntermediateCertificate(InputStream keyStoreInputStream, String keyStorePassword, InputStream appleWWDRCAFileInputStream) throws IOException, CertificateException { KeyStore pkcs12KeyStore = loadPKCS12File(keyStoreInputStream, keyStorePassword); X509Certificate appleWWDRCACert = loadDERCertificate(appleWWDRCAFileInputStream); return loadSigningInformation(pkcs12KeyStore, keyStorePassword, appleWWDRCACert); }
java
public PKSigningInformation loadSigningInformationFromPKCS12AndIntermediateCertificate(InputStream keyStoreInputStream, String keyStorePassword, InputStream appleWWDRCAFileInputStream) throws IOException, CertificateException { KeyStore pkcs12KeyStore = loadPKCS12File(keyStoreInputStream, keyStorePassword); X509Certificate appleWWDRCACert = loadDERCertificate(appleWWDRCAFileInputStream); return loadSigningInformation(pkcs12KeyStore, keyStorePassword, appleWWDRCACert); }
[ "public", "PKSigningInformation", "loadSigningInformationFromPKCS12AndIntermediateCertificate", "(", "InputStream", "keyStoreInputStream", ",", "String", "keyStorePassword", ",", "InputStream", "appleWWDRCAFileInputStream", ")", "throws", "IOException", ",", "CertificateException", "{", "KeyStore", "pkcs12KeyStore", "=", "loadPKCS12File", "(", "keyStoreInputStream", ",", "keyStorePassword", ")", ";", "X509Certificate", "appleWWDRCACert", "=", "loadDERCertificate", "(", "appleWWDRCAFileInputStream", ")", ";", "return", "loadSigningInformation", "(", "pkcs12KeyStore", ",", "keyStorePassword", ",", "appleWWDRCACert", ")", ";", "}" ]
Load all signing information necessary for pass generation using two input streams for the key store and the Apple WWDRCA certificate. The caller is responsible for closing the stream after this method returns successfully or fails. @param keyStoreInputStream <code>InputStream</code> of the key store @param keyStorePassword Password used to access the key store @param appleWWDRCAFileInputStream <code>InputStream</code> of the Apple WWDRCA certificate. @return Signing information necessary to sign a pass. @throws IOException @throws IllegalStateException @throws CertificateException
[ "Load", "all", "signing", "information", "necessary", "for", "pass", "generation", "using", "two", "input", "streams", "for", "the", "key", "store", "and", "the", "Apple", "WWDRCA", "certificate", "." ]
train
https://github.com/drallgood/jpasskit/blob/63bfa8abbdb85c2d7596c60eed41ed8e374cbd01/jpasskit/src/main/java/de/brendamour/jpasskit/signing/PKSigningInformationUtil.java#L97-L104
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/tags/TagContextBuilder.java
TagContextBuilder.putPropagating
public final TagContextBuilder putPropagating(TagKey key, TagValue value) { return put(key, value, METADATA_UNLIMITED_PROPAGATION); }
java
public final TagContextBuilder putPropagating(TagKey key, TagValue value) { return put(key, value, METADATA_UNLIMITED_PROPAGATION); }
[ "public", "final", "TagContextBuilder", "putPropagating", "(", "TagKey", "key", ",", "TagValue", "value", ")", "{", "return", "put", "(", "key", ",", "value", ",", "METADATA_UNLIMITED_PROPAGATION", ")", ";", "}" ]
Adds an unlimited propagating tag to this {@code TagContextBuilder}. <p>This is equivalent to calling {@code put(key, value, TagMetadata.create(TagTtl.METADATA_UNLIMITED_PROPAGATION))}. <p>Only call this method if you want propagating tags. If you want tags for breaking down metrics, or there are sensitive messages in your tags, use {@link #putLocal(TagKey, TagValue)} instead. @param key the {@code TagKey} which will be set. @param value the {@code TagValue} to set for the given key. @return this @since 0.21
[ "Adds", "an", "unlimited", "propagating", "tag", "to", "this", "{", "@code", "TagContextBuilder", "}", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/tags/TagContextBuilder.java#L97-L99
OpenBEL/openbel-framework
org.openbel.framework.common/src/main/java/org/openbel/framework/common/lang/Signature.java
Signature.matches
public SemanticStatus matches(final Signature other) { if (other == null) return null; // Check simple function/return types first if (getFunction() != other.getFunction()) return INVALID_FUNCTION; if (getReturnType() != other.getReturnType()) return INVALID_RETURN_TYPE; String[] myargs = this.getArguments(); String[] otherargs = other.getArguments(); return argumentsMatch(myargs, otherargs); }
java
public SemanticStatus matches(final Signature other) { if (other == null) return null; // Check simple function/return types first if (getFunction() != other.getFunction()) return INVALID_FUNCTION; if (getReturnType() != other.getReturnType()) return INVALID_RETURN_TYPE; String[] myargs = this.getArguments(); String[] otherargs = other.getArguments(); return argumentsMatch(myargs, otherargs); }
[ "public", "SemanticStatus", "matches", "(", "final", "Signature", "other", ")", "{", "if", "(", "other", "==", "null", ")", "return", "null", ";", "// Check simple function/return types first", "if", "(", "getFunction", "(", ")", "!=", "other", ".", "getFunction", "(", ")", ")", "return", "INVALID_FUNCTION", ";", "if", "(", "getReturnType", "(", ")", "!=", "other", ".", "getReturnType", "(", ")", ")", "return", "INVALID_RETURN_TYPE", ";", "String", "[", "]", "myargs", "=", "this", ".", "getArguments", "(", ")", ";", "String", "[", "]", "otherargs", "=", "other", ".", "getArguments", "(", ")", ";", "return", "argumentsMatch", "(", "myargs", ",", "otherargs", ")", ";", "}" ]
Returns the {@link SemanticStatus semantic status} of the supplied signature against this one. @param other {@link Signature} @return SemanticStatus, which may be null
[ "Returns", "the", "{", "@link", "SemanticStatus", "semantic", "status", "}", "of", "the", "supplied", "signature", "against", "this", "one", "." ]
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/lang/Signature.java#L289-L301
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.createOrUpdate
public DataBoxEdgeDeviceInner createOrUpdate(String deviceName, String resourceGroupName, DataBoxEdgeDeviceInner dataBoxEdgeDevice) { return createOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, dataBoxEdgeDevice).toBlocking().last().body(); }
java
public DataBoxEdgeDeviceInner createOrUpdate(String deviceName, String resourceGroupName, DataBoxEdgeDeviceInner dataBoxEdgeDevice) { return createOrUpdateWithServiceResponseAsync(deviceName, resourceGroupName, dataBoxEdgeDevice).toBlocking().last().body(); }
[ "public", "DataBoxEdgeDeviceInner", "createOrUpdate", "(", "String", "deviceName", ",", "String", "resourceGroupName", ",", "DataBoxEdgeDeviceInner", "dataBoxEdgeDevice", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ",", "dataBoxEdgeDevice", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates or updates a Data Box Edge/Gateway resource. @param deviceName The device name. @param resourceGroupName The resource group name. @param dataBoxEdgeDevice The resource object. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DataBoxEdgeDeviceInner object if successful.
[ "Creates", "or", "updates", "a", "Data", "Box", "Edge", "/", "Gateway", "resource", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L703-L705
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/pyramid/PyramidOps.java
PyramidOps.scaleDown2
public static <T extends ImageGray<T>> void scaleDown2(T input , T output ) { if( input instanceof GrayF32) { ImplPyramidOps.scaleDown2((GrayF32)input,(GrayF32)output); } else if( input instanceof GrayU8) { ImplPyramidOps.scaleDown2((GrayU8)input,(GrayU8)output); } else { throw new IllegalArgumentException("Image type not yet supported"); } }
java
public static <T extends ImageGray<T>> void scaleDown2(T input , T output ) { if( input instanceof GrayF32) { ImplPyramidOps.scaleDown2((GrayF32)input,(GrayF32)output); } else if( input instanceof GrayU8) { ImplPyramidOps.scaleDown2((GrayU8)input,(GrayU8)output); } else { throw new IllegalArgumentException("Image type not yet supported"); } }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ">", "void", "scaleDown2", "(", "T", "input", ",", "T", "output", ")", "{", "if", "(", "input", "instanceof", "GrayF32", ")", "{", "ImplPyramidOps", ".", "scaleDown2", "(", "(", "GrayF32", ")", "input", ",", "(", "GrayF32", ")", "output", ")", ";", "}", "else", "if", "(", "input", "instanceof", "GrayU8", ")", "{", "ImplPyramidOps", ".", "scaleDown2", "(", "(", "GrayU8", ")", "input", ",", "(", "GrayU8", ")", "output", ")", ";", "}", "else", "{", "throw", "new", "IllegalArgumentException", "(", "\"Image type not yet supported\"", ")", ";", "}", "}" ]
Scales down the input by a factor of 2. Every other pixel along both axises is skipped.
[ "Scales", "down", "the", "input", "by", "a", "factor", "of", "2", ".", "Every", "other", "pixel", "along", "both", "axises", "is", "skipped", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/pyramid/PyramidOps.java#L152-L161
mozilla/rhino
src/org/mozilla/javascript/RhinoException.java
RhinoException.getScriptStackTrace
public String getScriptStackTrace(int limit, String functionName) { ScriptStackElement[] stack = getScriptStack(limit, functionName); return formatStackTrace(stack, details()); }
java
public String getScriptStackTrace(int limit, String functionName) { ScriptStackElement[] stack = getScriptStack(limit, functionName); return formatStackTrace(stack, details()); }
[ "public", "String", "getScriptStackTrace", "(", "int", "limit", ",", "String", "functionName", ")", "{", "ScriptStackElement", "[", "]", "stack", "=", "getScriptStack", "(", "limit", ",", "functionName", ")", ";", "return", "formatStackTrace", "(", "stack", ",", "details", "(", ")", ")", ";", "}" ]
Get a string representing the script stack of this exception. If optimization is enabled, this includes java stack elements whose source and method names suggest they have been generated by the Rhino script compiler. The optional "limit" parameter limits the number of stack frames returned. The "functionName" parameter will exclude any stack frames "below" the specified function on the stack. @param limit the number of stack frames returned @param functionName the name of a function on the stack -- frames below it will be ignored @return a script stack dump @since 1.8.0
[ "Get", "a", "string", "representing", "the", "script", "stack", "of", "this", "exception", ".", "If", "optimization", "is", "enabled", "this", "includes", "java", "stack", "elements", "whose", "source", "and", "method", "names", "suggest", "they", "have", "been", "generated", "by", "the", "Rhino", "script", "compiler", ".", "The", "optional", "limit", "parameter", "limits", "the", "number", "of", "stack", "frames", "returned", ".", "The", "functionName", "parameter", "will", "exclude", "any", "stack", "frames", "below", "the", "specified", "function", "on", "the", "stack", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/RhinoException.java#L221-L225
phax/ph-oton
ph-oton-core/src/main/java/com/helger/photon/core/menu/ui/MenuRendererCallback.java
MenuRendererCallback.createRenderedMenu
@Nonnull public static <T extends IHCList <T, HCLI>> T createRenderedMenu (@Nonnull final ILayoutExecutionContext aLEC, @Nonnull final ISupplier <T> aFactory, @Nonnull final IMenuItemRenderer <T> aRenderer, @Nonnull final ICommonsMap <String, Boolean> aDisplayMenuItemIDs) { return createRenderedMenu (aLEC, aFactory, aLEC.getMenuTree ().getRootItem (), aRenderer, aDisplayMenuItemIDs); }
java
@Nonnull public static <T extends IHCList <T, HCLI>> T createRenderedMenu (@Nonnull final ILayoutExecutionContext aLEC, @Nonnull final ISupplier <T> aFactory, @Nonnull final IMenuItemRenderer <T> aRenderer, @Nonnull final ICommonsMap <String, Boolean> aDisplayMenuItemIDs) { return createRenderedMenu (aLEC, aFactory, aLEC.getMenuTree ().getRootItem (), aRenderer, aDisplayMenuItemIDs); }
[ "@", "Nonnull", "public", "static", "<", "T", "extends", "IHCList", "<", "T", ",", "HCLI", ">", ">", "T", "createRenderedMenu", "(", "@", "Nonnull", "final", "ILayoutExecutionContext", "aLEC", ",", "@", "Nonnull", "final", "ISupplier", "<", "T", ">", "aFactory", ",", "@", "Nonnull", "final", "IMenuItemRenderer", "<", "T", ">", "aRenderer", ",", "@", "Nonnull", "final", "ICommonsMap", "<", "String", ",", "Boolean", ">", "aDisplayMenuItemIDs", ")", "{", "return", "createRenderedMenu", "(", "aLEC", ",", "aFactory", ",", "aLEC", ".", "getMenuTree", "(", ")", ".", "getRootItem", "(", ")", ",", "aRenderer", ",", "aDisplayMenuItemIDs", ")", ";", "}" ]
Render the whole menu @param aLEC The current layout execution context. Required for cookie-less handling. May not be <code>null</code>. @param aFactory The factory to be used to create nodes of type T. May not be <code>null</code>. @param aRenderer The renderer to use @param aDisplayMenuItemIDs The menu items to display as a map from menu item ID to expanded state @return Never <code>null</code>. @param <T> HC list type to be instantiated
[ "Render", "the", "whole", "menu" ]
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-core/src/main/java/com/helger/photon/core/menu/ui/MenuRendererCallback.java#L290-L297
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/source/ScopeHandler.java
ScopeHandler.visibilityIn
ScopeState visibilityIn(QualifiedName scope, QualifiedName type) { Set<QualifiedName> possibleConflicts = typesInScope(scope).get(type.getSimpleName()); if (possibleConflicts.equals(ImmutableSet.of(type))) { return ScopeState.IN_SCOPE; } else if (!possibleConflicts.isEmpty()) { return ScopeState.HIDDEN; } else if (!scope.isTopLevel()) { return visibilityIn(scope.enclosingType(), type); } else { return visibilityIn(scope.getPackage(), type); } }
java
ScopeState visibilityIn(QualifiedName scope, QualifiedName type) { Set<QualifiedName> possibleConflicts = typesInScope(scope).get(type.getSimpleName()); if (possibleConflicts.equals(ImmutableSet.of(type))) { return ScopeState.IN_SCOPE; } else if (!possibleConflicts.isEmpty()) { return ScopeState.HIDDEN; } else if (!scope.isTopLevel()) { return visibilityIn(scope.enclosingType(), type); } else { return visibilityIn(scope.getPackage(), type); } }
[ "ScopeState", "visibilityIn", "(", "QualifiedName", "scope", ",", "QualifiedName", "type", ")", "{", "Set", "<", "QualifiedName", ">", "possibleConflicts", "=", "typesInScope", "(", "scope", ")", ".", "get", "(", "type", ".", "getSimpleName", "(", ")", ")", ";", "if", "(", "possibleConflicts", ".", "equals", "(", "ImmutableSet", ".", "of", "(", "type", ")", ")", ")", "{", "return", "ScopeState", ".", "IN_SCOPE", ";", "}", "else", "if", "(", "!", "possibleConflicts", ".", "isEmpty", "(", ")", ")", "{", "return", "ScopeState", ".", "HIDDEN", ";", "}", "else", "if", "(", "!", "scope", ".", "isTopLevel", "(", ")", ")", "{", "return", "visibilityIn", "(", "scope", ".", "enclosingType", "(", ")", ",", "type", ")", ";", "}", "else", "{", "return", "visibilityIn", "(", "scope", ".", "getPackage", "(", ")", ",", "type", ")", ";", "}", "}" ]
Returns whether {@code type} is visible in, or can be imported into, the body of {@code type}.
[ "Returns", "whether", "{" ]
train
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/ScopeHandler.java#L77-L88
devnewton/jnuit
pngdecoder/src/main/java/de/matthiasmann/twl/utils/PNGDecoder.java
PNGDecoder.overwriteTRNS
public void overwriteTRNS(byte r, byte g, byte b) { if(hasAlphaChannel()) { throw new UnsupportedOperationException("image has an alpha channel"); } byte[] pal = this.palette; if(pal == null) { transPixel = new byte[] { 0, r, 0, g, 0, b }; } else { paletteA = new byte[pal.length/3]; for(int i=0,j=0 ; i<pal.length ; i+=3,j++) { if(pal[i] != r || pal[i+1] != g || pal[i+2] != b) { paletteA[j] = (byte)0xFF; } } } }
java
public void overwriteTRNS(byte r, byte g, byte b) { if(hasAlphaChannel()) { throw new UnsupportedOperationException("image has an alpha channel"); } byte[] pal = this.palette; if(pal == null) { transPixel = new byte[] { 0, r, 0, g, 0, b }; } else { paletteA = new byte[pal.length/3]; for(int i=0,j=0 ; i<pal.length ; i+=3,j++) { if(pal[i] != r || pal[i+1] != g || pal[i+2] != b) { paletteA[j] = (byte)0xFF; } } } }
[ "public", "void", "overwriteTRNS", "(", "byte", "r", ",", "byte", "g", ",", "byte", "b", ")", "{", "if", "(", "hasAlphaChannel", "(", ")", ")", "{", "throw", "new", "UnsupportedOperationException", "(", "\"image has an alpha channel\"", ")", ";", "}", "byte", "[", "]", "pal", "=", "this", ".", "palette", ";", "if", "(", "pal", "==", "null", ")", "{", "transPixel", "=", "new", "byte", "[", "]", "{", "0", ",", "r", ",", "0", ",", "g", ",", "0", ",", "b", "}", ";", "}", "else", "{", "paletteA", "=", "new", "byte", "[", "pal", ".", "length", "/", "3", "]", ";", "for", "(", "int", "i", "=", "0", ",", "j", "=", "0", ";", "i", "<", "pal", ".", "length", ";", "i", "+=", "3", ",", "j", "++", ")", "{", "if", "(", "pal", "[", "i", "]", "!=", "r", "||", "pal", "[", "i", "+", "1", "]", "!=", "g", "||", "pal", "[", "i", "+", "2", "]", "!=", "b", ")", "{", "paletteA", "[", "j", "]", "=", "(", "byte", ")", "0xFF", ";", "}", "}", "}", "}" ]
Overwrites the tRNS chunk entry to make a selected color transparent. <p>This can only be invoked when the image has no alpha channel.</p> <p>Calling this method causes {@link #hasAlpha()} to return true.</p> @param r the red component of the color to make transparent @param g the green component of the color to make transparent @param b the blue component of the color to make transparent @throws UnsupportedOperationException if the tRNS chunk data can't be set @see #hasAlphaChannel()
[ "Overwrites", "the", "tRNS", "chunk", "entry", "to", "make", "a", "selected", "color", "transparent", ".", "<p", ">", "This", "can", "only", "be", "invoked", "when", "the", "image", "has", "no", "alpha", "channel", ".", "<", "/", "p", ">", "<p", ">", "Calling", "this", "method", "causes", "{", "@link", "#hasAlpha", "()", "}", "to", "return", "true", ".", "<", "/", "p", ">" ]
train
https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/pngdecoder/src/main/java/de/matthiasmann/twl/utils/PNGDecoder.java#L190-L205
xiancloud/xian
xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java
ServiceDiscoveryImpl.queryForInstances
@Override public Collection<ServiceInstance<T>> queryForInstances(String name) throws Exception { return queryForInstances(name, null); }
java
@Override public Collection<ServiceInstance<T>> queryForInstances(String name) throws Exception { return queryForInstances(name, null); }
[ "@", "Override", "public", "Collection", "<", "ServiceInstance", "<", "T", ">", ">", "queryForInstances", "(", "String", "name", ")", "throws", "Exception", "{", "return", "queryForInstances", "(", "name", ",", "null", ")", ";", "}" ]
Return all known instances for the given group @param name name of the group @return list of instances (or an empty list) @throws Exception errors
[ "Return", "all", "known", "instances", "for", "the", "given", "group" ]
train
https://github.com/xiancloud/xian/blob/1948e088545553d2745b2c86d8b5a64988bb850e/xian-zookeeper/xian-curator/xian-curator-x-discovery/src/main/java/org/apache/curator/x/discovery/details/ServiceDiscoveryImpl.java#L307-L311
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/ScrollBarButtonPainter.java
ScrollBarButtonPainter.fillScrollBarButtonInteriorColors
private void fillScrollBarButtonInteriorColors(Graphics2D g, Shape s, boolean isIncrease, boolean buttonsTogether) { g.setPaint(getScrollBarButtonBackgroundPaint(s, isIncrease, buttonsTogether)); g.fill(s); int width = s.getBounds().width; g.setPaint(getScrollBarButtonLinePaint()); g.drawLine(0, 0, width - 1, 0); if (state != Which.FOREGROUND_CAP && buttonsTogether) { int height = s.getBounds().height; g.setPaint(getScrollBarButtonDividerPaint(isIncrease)); g.drawLine(width - 1, 1, width - 1, height - 1); } }
java
private void fillScrollBarButtonInteriorColors(Graphics2D g, Shape s, boolean isIncrease, boolean buttonsTogether) { g.setPaint(getScrollBarButtonBackgroundPaint(s, isIncrease, buttonsTogether)); g.fill(s); int width = s.getBounds().width; g.setPaint(getScrollBarButtonLinePaint()); g.drawLine(0, 0, width - 1, 0); if (state != Which.FOREGROUND_CAP && buttonsTogether) { int height = s.getBounds().height; g.setPaint(getScrollBarButtonDividerPaint(isIncrease)); g.drawLine(width - 1, 1, width - 1, height - 1); } }
[ "private", "void", "fillScrollBarButtonInteriorColors", "(", "Graphics2D", "g", ",", "Shape", "s", ",", "boolean", "isIncrease", ",", "boolean", "buttonsTogether", ")", "{", "g", ".", "setPaint", "(", "getScrollBarButtonBackgroundPaint", "(", "s", ",", "isIncrease", ",", "buttonsTogether", ")", ")", ";", "g", ".", "fill", "(", "s", ")", ";", "int", "width", "=", "s", ".", "getBounds", "(", ")", ".", "width", ";", "g", ".", "setPaint", "(", "getScrollBarButtonLinePaint", "(", ")", ")", ";", "g", ".", "drawLine", "(", "0", ",", "0", ",", "width", "-", "1", ",", "0", ")", ";", "if", "(", "state", "!=", "Which", ".", "FOREGROUND_CAP", "&&", "buttonsTogether", ")", "{", "int", "height", "=", "s", ".", "getBounds", "(", ")", ".", "height", ";", "g", ".", "setPaint", "(", "getScrollBarButtonDividerPaint", "(", "isIncrease", ")", ")", ";", "g", ".", "drawLine", "(", "width", "-", "1", ",", "1", ",", "width", "-", "1", ",", "height", "-", "1", ")", ";", "}", "}" ]
DOCUMENT ME! @param g DOCUMENT ME! @param s DOCUMENT ME! @param isIncrease DOCUMENT ME! @param buttonsTogether DOCUMENT ME!
[ "DOCUMENT", "ME!" ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/ScrollBarButtonPainter.java#L298-L313
stratosphere/stratosphere
stratosphere-compiler/src/main/java/eu/stratosphere/compiler/DataStatistics.java
DataStatistics.cacheBaseStatistics
public void cacheBaseStatistics(BaseStatistics statistics, String identifyer) { synchronized (this.baseStatisticsCache) { this.baseStatisticsCache.put(identifyer, statistics); } }
java
public void cacheBaseStatistics(BaseStatistics statistics, String identifyer) { synchronized (this.baseStatisticsCache) { this.baseStatisticsCache.put(identifyer, statistics); } }
[ "public", "void", "cacheBaseStatistics", "(", "BaseStatistics", "statistics", ",", "String", "identifyer", ")", "{", "synchronized", "(", "this", ".", "baseStatisticsCache", ")", "{", "this", ".", "baseStatisticsCache", ".", "put", "(", "identifyer", ",", "statistics", ")", ";", "}", "}" ]
Caches the given statistics. They are later retrievable under the given identifier. @param statistics The statistics to cache. @param identifyer The identifier which may be later used to retrieve the statistics.
[ "Caches", "the", "given", "statistics", ".", "They", "are", "later", "retrievable", "under", "the", "given", "identifier", "." ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-compiler/src/main/java/eu/stratosphere/compiler/DataStatistics.java#L59-L63
jaxio/celerio
celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java
IOUtil.inputStreamToOutputStream
public int inputStreamToOutputStream(InputStream is, OutputStream os) throws IOException { byte buffer[] = new byte[1024 * 100]; // 100kb int len = -1; int total = 0; while ((len = is.read(buffer)) >= 0) { os.write(buffer, 0, len); total += len; } return total; }
java
public int inputStreamToOutputStream(InputStream is, OutputStream os) throws IOException { byte buffer[] = new byte[1024 * 100]; // 100kb int len = -1; int total = 0; while ((len = is.read(buffer)) >= 0) { os.write(buffer, 0, len); total += len; } return total; }
[ "public", "int", "inputStreamToOutputStream", "(", "InputStream", "is", ",", "OutputStream", "os", ")", "throws", "IOException", "{", "byte", "buffer", "[", "]", "=", "new", "byte", "[", "1024", "*", "100", "]", ";", "// 100kb", "int", "len", "=", "-", "1", ";", "int", "total", "=", "0", ";", "while", "(", "(", "len", "=", "is", ".", "read", "(", "buffer", ")", ")", ">=", "0", ")", "{", "os", ".", "write", "(", "buffer", ",", "0", ",", "len", ")", ";", "total", "+=", "len", ";", "}", "return", "total", ";", "}" ]
Write to the outputstream the bytes read from the input stream.
[ "Write", "to", "the", "outputstream", "the", "bytes", "read", "from", "the", "input", "stream", "." ]
train
https://github.com/jaxio/celerio/blob/fbfacb639e286f9f3f3a18986f74ea275bebd887/celerio-engine/src/main/java/com/jaxio/celerio/util/IOUtil.java#L45-L55
casmi/casmi
src/main/java/casmi/graphics/element/Line.java
Line.setDashedLinePram
public void setDashedLinePram(double length, double interval) { this.dashedLineLength = length; this.dashedLineInterval = interval; this.dashed = true; calcDashedLine(); }
java
public void setDashedLinePram(double length, double interval) { this.dashedLineLength = length; this.dashedLineInterval = interval; this.dashed = true; calcDashedLine(); }
[ "public", "void", "setDashedLinePram", "(", "double", "length", ",", "double", "interval", ")", "{", "this", ".", "dashedLineLength", "=", "length", ";", "this", ".", "dashedLineInterval", "=", "interval", ";", "this", ".", "dashed", "=", "true", ";", "calcDashedLine", "(", ")", ";", "}" ]
Sets the parameter for the dashed line. @param length The length of the dashed lines. @param interval The interval of the dashed lines.
[ "Sets", "the", "parameter", "for", "the", "dashed", "line", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Line.java#L288-L293
grpc/grpc-java
netty/src/main/java/io/grpc/netty/NettyServerBuilder.java
NettyServerBuilder.maxConnectionAgeGrace
public NettyServerBuilder maxConnectionAgeGrace(long maxConnectionAgeGrace, TimeUnit timeUnit) { checkArgument(maxConnectionAgeGrace >= 0L, "max connection age grace must be non-negative"); maxConnectionAgeGraceInNanos = timeUnit.toNanos(maxConnectionAgeGrace); if (maxConnectionAgeGraceInNanos >= AS_LARGE_AS_INFINITE) { maxConnectionAgeGraceInNanos = MAX_CONNECTION_AGE_GRACE_NANOS_INFINITE; } return this; }
java
public NettyServerBuilder maxConnectionAgeGrace(long maxConnectionAgeGrace, TimeUnit timeUnit) { checkArgument(maxConnectionAgeGrace >= 0L, "max connection age grace must be non-negative"); maxConnectionAgeGraceInNanos = timeUnit.toNanos(maxConnectionAgeGrace); if (maxConnectionAgeGraceInNanos >= AS_LARGE_AS_INFINITE) { maxConnectionAgeGraceInNanos = MAX_CONNECTION_AGE_GRACE_NANOS_INFINITE; } return this; }
[ "public", "NettyServerBuilder", "maxConnectionAgeGrace", "(", "long", "maxConnectionAgeGrace", ",", "TimeUnit", "timeUnit", ")", "{", "checkArgument", "(", "maxConnectionAgeGrace", ">=", "0L", ",", "\"max connection age grace must be non-negative\"", ")", ";", "maxConnectionAgeGraceInNanos", "=", "timeUnit", ".", "toNanos", "(", "maxConnectionAgeGrace", ")", ";", "if", "(", "maxConnectionAgeGraceInNanos", ">=", "AS_LARGE_AS_INFINITE", ")", "{", "maxConnectionAgeGraceInNanos", "=", "MAX_CONNECTION_AGE_GRACE_NANOS_INFINITE", ";", "}", "return", "this", ";", "}" ]
Sets a custom grace time for the graceful connection termination. Once the max connection age is reached, RPCs have the grace time to complete. RPCs that do not complete in time will be cancelled, allowing the connection to terminate. {@code Long.MAX_VALUE} nano seconds or an unreasonably large value are considered infinite. @see #maxConnectionAge(long, TimeUnit) @since 1.3.0
[ "Sets", "a", "custom", "grace", "time", "for", "the", "graceful", "connection", "termination", ".", "Once", "the", "max", "connection", "age", "is", "reached", "RPCs", "have", "the", "grace", "time", "to", "complete", ".", "RPCs", "that", "do", "not", "complete", "in", "time", "will", "be", "cancelled", "allowing", "the", "connection", "to", "terminate", ".", "{", "@code", "Long", ".", "MAX_VALUE", "}", "nano", "seconds", "or", "an", "unreasonably", "large", "value", "are", "considered", "infinite", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/netty/src/main/java/io/grpc/netty/NettyServerBuilder.java#L454-L461
killbill/killbill
payment/src/main/java/org/killbill/billing/payment/core/janitor/IncompletePaymentTransactionTask.java
IncompletePaymentTransactionTask.computeNewTransactionStatusFromPaymentTransactionInfoPlugin
private TransactionStatus computeNewTransactionStatusFromPaymentTransactionInfoPlugin(final PaymentTransactionInfoPlugin input, final TransactionStatus currentTransactionStatus) { final TransactionStatus newTransactionStatus = PaymentTransactionInfoPluginConverter.toTransactionStatus(input); return (newTransactionStatus != TransactionStatus.UNKNOWN) ? newTransactionStatus : currentTransactionStatus; }
java
private TransactionStatus computeNewTransactionStatusFromPaymentTransactionInfoPlugin(final PaymentTransactionInfoPlugin input, final TransactionStatus currentTransactionStatus) { final TransactionStatus newTransactionStatus = PaymentTransactionInfoPluginConverter.toTransactionStatus(input); return (newTransactionStatus != TransactionStatus.UNKNOWN) ? newTransactionStatus : currentTransactionStatus; }
[ "private", "TransactionStatus", "computeNewTransactionStatusFromPaymentTransactionInfoPlugin", "(", "final", "PaymentTransactionInfoPlugin", "input", ",", "final", "TransactionStatus", "currentTransactionStatus", ")", "{", "final", "TransactionStatus", "newTransactionStatus", "=", "PaymentTransactionInfoPluginConverter", ".", "toTransactionStatus", "(", "input", ")", ";", "return", "(", "newTransactionStatus", "!=", "TransactionStatus", ".", "UNKNOWN", ")", "?", "newTransactionStatus", ":", "currentTransactionStatus", ";", "}" ]
Keep the existing currentTransactionStatus if we can't obtain a better answer from the plugin; if not, return the newTransactionStatus
[ "Keep", "the", "existing", "currentTransactionStatus", "if", "we", "can", "t", "obtain", "a", "better", "answer", "from", "the", "plugin", ";", "if", "not", "return", "the", "newTransactionStatus" ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/payment/src/main/java/org/killbill/billing/payment/core/janitor/IncompletePaymentTransactionTask.java#L271-L274
alkacon/opencms-core
src/org/opencms/file/types/CmsResourceTypeFunctionConfig.java
CmsResourceTypeFunctionConfig.writeFile
@Override public CmsFile writeFile(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource) throws CmsException { String savingStr = (String)cms.getRequestContext().getAttribute(CmsContentService.ATTR_EDITOR_SAVING); CmsFile file = super.writeFile(cms, securityManager, resource); // Formatter configuration cache updates are asynchronous, but to be able to reload a container page // element in the page editor directly after editing it and having it reflect the changes made by the user // requires that we wait on a wait handle for the formatter cache. if (Boolean.valueOf(savingStr).booleanValue()) { CmsWaitHandle waitHandle = OpenCms.getADEManager().addFormatterCacheWaitHandle(false); waitHandle.enter(10000); } return file; }
java
@Override public CmsFile writeFile(CmsObject cms, CmsSecurityManager securityManager, CmsFile resource) throws CmsException { String savingStr = (String)cms.getRequestContext().getAttribute(CmsContentService.ATTR_EDITOR_SAVING); CmsFile file = super.writeFile(cms, securityManager, resource); // Formatter configuration cache updates are asynchronous, but to be able to reload a container page // element in the page editor directly after editing it and having it reflect the changes made by the user // requires that we wait on a wait handle for the formatter cache. if (Boolean.valueOf(savingStr).booleanValue()) { CmsWaitHandle waitHandle = OpenCms.getADEManager().addFormatterCacheWaitHandle(false); waitHandle.enter(10000); } return file; }
[ "@", "Override", "public", "CmsFile", "writeFile", "(", "CmsObject", "cms", ",", "CmsSecurityManager", "securityManager", ",", "CmsFile", "resource", ")", "throws", "CmsException", "{", "String", "savingStr", "=", "(", "String", ")", "cms", ".", "getRequestContext", "(", ")", ".", "getAttribute", "(", "CmsContentService", ".", "ATTR_EDITOR_SAVING", ")", ";", "CmsFile", "file", "=", "super", ".", "writeFile", "(", "cms", ",", "securityManager", ",", "resource", ")", ";", "// Formatter configuration cache updates are asynchronous, but to be able to reload a container page", "// element in the page editor directly after editing it and having it reflect the changes made by the user", "// requires that we wait on a wait handle for the formatter cache.", "if", "(", "Boolean", ".", "valueOf", "(", "savingStr", ")", ".", "booleanValue", "(", ")", ")", "{", "CmsWaitHandle", "waitHandle", "=", "OpenCms", ".", "getADEManager", "(", ")", ".", "addFormatterCacheWaitHandle", "(", "false", ")", ";", "waitHandle", ".", "enter", "(", "10000", ")", ";", "}", "return", "file", ";", "}" ]
@see org.opencms.file.types.CmsResourceTypeXmlContent#writeFile(org.opencms.file.CmsObject, org.opencms.db.CmsSecurityManager, org.opencms.file.CmsFile) After writing the file, this method waits until the formatter configuration is update the next time.
[ "@see", "org", ".", "opencms", ".", "file", ".", "types", ".", "CmsResourceTypeXmlContent#writeFile", "(", "org", ".", "opencms", ".", "file", ".", "CmsObject", "org", ".", "opencms", ".", "db", ".", "CmsSecurityManager", "org", ".", "opencms", ".", "file", ".", "CmsFile", ")" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/types/CmsResourceTypeFunctionConfig.java#L88-L102
shrinkwrap/resolver
maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/plugins/Validate.java
Validate.isReadable
public static void isReadable(final File file, String message) throws IllegalArgumentException { notNull(file, message); if (!file.exists() || !file.isFile() || !file.canRead()) { throw new IllegalArgumentException(message); } }
java
public static void isReadable(final File file, String message) throws IllegalArgumentException { notNull(file, message); if (!file.exists() || !file.isFile() || !file.canRead()) { throw new IllegalArgumentException(message); } }
[ "public", "static", "void", "isReadable", "(", "final", "File", "file", ",", "String", "message", ")", "throws", "IllegalArgumentException", "{", "notNull", "(", "file", ",", "message", ")", ";", "if", "(", "!", "file", ".", "exists", "(", ")", "||", "!", "file", ".", "isFile", "(", ")", "||", "!", "file", ".", "canRead", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "message", ")", ";", "}", "}" ]
Checks that the specified String is not null or empty and represents a readable file, throws exception if it is empty or null and does not represent a path to a file. @param path The path to check @param message The exception message @throws IllegalArgumentException Thrown if path is empty, null or invalid
[ "Checks", "that", "the", "specified", "String", "is", "not", "null", "or", "empty", "and", "represents", "a", "readable", "file", "throws", "exception", "if", "it", "is", "empty", "or", "null", "and", "does", "not", "represent", "a", "path", "to", "a", "file", "." ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/impl-maven-archive/src/main/java/org/jboss/shrinkwrap/resolver/impl/maven/archive/plugins/Validate.java#L185-L190
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/JobsInner.java
JobsInner.cancelJob
public void cancelJob(String resourceGroupName, String accountName, String transformName, String jobName) { cancelJobWithServiceResponseAsync(resourceGroupName, accountName, transformName, jobName).toBlocking().single().body(); }
java
public void cancelJob(String resourceGroupName, String accountName, String transformName, String jobName) { cancelJobWithServiceResponseAsync(resourceGroupName, accountName, transformName, jobName).toBlocking().single().body(); }
[ "public", "void", "cancelJob", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "transformName", ",", "String", "jobName", ")", "{", "cancelJobWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName", ",", "transformName", ",", "jobName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Cancel Job. Cancel a Job. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param transformName The Transform name. @param jobName The Job name. @throws IllegalArgumentException thrown if parameters fail the validation @throws ApiErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Cancel", "Job", ".", "Cancel", "a", "Job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/JobsInner.java#L707-L709
querydsl/querydsl
querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java
ExpressionUtils.notIn
public static <D> Predicate notIn(Expression<D> left, Collection<? extends D> right) { if (right.size() == 1) { return neConst(left, right.iterator().next()); } else { return predicate(Ops.NOT_IN, left, ConstantImpl.create(right)); } }
java
public static <D> Predicate notIn(Expression<D> left, Collection<? extends D> right) { if (right.size() == 1) { return neConst(left, right.iterator().next()); } else { return predicate(Ops.NOT_IN, left, ConstantImpl.create(right)); } }
[ "public", "static", "<", "D", ">", "Predicate", "notIn", "(", "Expression", "<", "D", ">", "left", ",", "Collection", "<", "?", "extends", "D", ">", "right", ")", "{", "if", "(", "right", ".", "size", "(", ")", "==", "1", ")", "{", "return", "neConst", "(", "left", ",", "right", ".", "iterator", "(", ")", ".", "next", "(", ")", ")", ";", "}", "else", "{", "return", "predicate", "(", "Ops", ".", "NOT_IN", ",", "left", ",", "ConstantImpl", ".", "create", "(", "right", ")", ")", ";", "}", "}" ]
Create a {@code left not in right} expression @param <D> type of expressions @param left lhs of expression @param right rhs of expression @return left not in right
[ "Create", "a", "{", "@code", "left", "not", "in", "right", "}", "expression" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-core/src/main/java/com/querydsl/core/types/ExpressionUtils.java#L755-L761
finmath/finmath-lib
src/main/java6/net/finmath/montecarlo/assetderivativevaluation/products/DigitalOption.java
DigitalOption.getValue
@Override public RandomVariableInterface getValue(double evaluationTime, AssetModelMonteCarloSimulationInterface model) throws CalculationException { // Get underlying and numeraire // Get S(T) RandomVariableInterface underlyingAtMaturity = model.getAssetValue(maturity, underlyingIndex); // The payoff: values = indicator(underlying - strike, 0) = V(T) = max(S(T)-K,0) RandomVariableInterface values = underlyingAtMaturity.barrier(underlyingAtMaturity.sub(strike), underlyingAtMaturity.mult(0.0).add(1.0), 0.0); // Discounting... RandomVariableInterface numeraireAtMaturity = model.getNumeraire(maturity); RandomVariableInterface monteCarloWeights = model.getMonteCarloWeights(maturity); values = values.div(numeraireAtMaturity).mult(monteCarloWeights); // ...to evaluation time. RandomVariableInterface numeraireAtEvalTime = model.getNumeraire(evaluationTime); RandomVariableInterface monteCarloProbabilitiesAtEvalTime = model.getMonteCarloWeights(evaluationTime); values = values.mult(numeraireAtEvalTime).div(monteCarloProbabilitiesAtEvalTime); return values; }
java
@Override public RandomVariableInterface getValue(double evaluationTime, AssetModelMonteCarloSimulationInterface model) throws CalculationException { // Get underlying and numeraire // Get S(T) RandomVariableInterface underlyingAtMaturity = model.getAssetValue(maturity, underlyingIndex); // The payoff: values = indicator(underlying - strike, 0) = V(T) = max(S(T)-K,0) RandomVariableInterface values = underlyingAtMaturity.barrier(underlyingAtMaturity.sub(strike), underlyingAtMaturity.mult(0.0).add(1.0), 0.0); // Discounting... RandomVariableInterface numeraireAtMaturity = model.getNumeraire(maturity); RandomVariableInterface monteCarloWeights = model.getMonteCarloWeights(maturity); values = values.div(numeraireAtMaturity).mult(monteCarloWeights); // ...to evaluation time. RandomVariableInterface numeraireAtEvalTime = model.getNumeraire(evaluationTime); RandomVariableInterface monteCarloProbabilitiesAtEvalTime = model.getMonteCarloWeights(evaluationTime); values = values.mult(numeraireAtEvalTime).div(monteCarloProbabilitiesAtEvalTime); return values; }
[ "@", "Override", "public", "RandomVariableInterface", "getValue", "(", "double", "evaluationTime", ",", "AssetModelMonteCarloSimulationInterface", "model", ")", "throws", "CalculationException", "{", "// Get underlying and numeraire", "// Get S(T)", "RandomVariableInterface", "underlyingAtMaturity", "=", "model", ".", "getAssetValue", "(", "maturity", ",", "underlyingIndex", ")", ";", "// The payoff: values = indicator(underlying - strike, 0) = V(T) = max(S(T)-K,0)", "RandomVariableInterface", "values", "=", "underlyingAtMaturity", ".", "barrier", "(", "underlyingAtMaturity", ".", "sub", "(", "strike", ")", ",", "underlyingAtMaturity", ".", "mult", "(", "0.0", ")", ".", "add", "(", "1.0", ")", ",", "0.0", ")", ";", "// Discounting...", "RandomVariableInterface", "numeraireAtMaturity", "=", "model", ".", "getNumeraire", "(", "maturity", ")", ";", "RandomVariableInterface", "monteCarloWeights", "=", "model", ".", "getMonteCarloWeights", "(", "maturity", ")", ";", "values", "=", "values", ".", "div", "(", "numeraireAtMaturity", ")", ".", "mult", "(", "monteCarloWeights", ")", ";", "// ...to evaluation time.", "RandomVariableInterface", "numeraireAtEvalTime", "=", "model", ".", "getNumeraire", "(", "evaluationTime", ")", ";", "RandomVariableInterface", "monteCarloProbabilitiesAtEvalTime", "=", "model", ".", "getMonteCarloWeights", "(", "evaluationTime", ")", ";", "values", "=", "values", ".", "mult", "(", "numeraireAtEvalTime", ")", ".", "div", "(", "monteCarloProbabilitiesAtEvalTime", ")", ";", "return", "values", ";", "}" ]
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Note", ":", "For", "a", "lattice", "this", "is", "often", "the", "value", "conditional", "to", "evalutationTime", "for", "a", "Monte", "-", "Carlo", "simulation", "this", "is", "the", "(", "sum", "of", ")", "value", "discounted", "to", "evaluation", "time", ".", "Cashflows", "prior", "evaluationTime", "are", "not", "considered", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/assetderivativevaluation/products/DigitalOption.java#L70-L91
heinrichreimer/material-drawer
library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerItem.java
DrawerItem.setRoundedImage
public DrawerItem setRoundedImage(BitmapDrawable image, int imageMode) { return setImage(new RoundedAvatarDrawable(image.getBitmap()), imageMode); }
java
public DrawerItem setRoundedImage(BitmapDrawable image, int imageMode) { return setImage(new RoundedAvatarDrawable(image.getBitmap()), imageMode); }
[ "public", "DrawerItem", "setRoundedImage", "(", "BitmapDrawable", "image", ",", "int", "imageMode", ")", "{", "return", "setImage", "(", "new", "RoundedAvatarDrawable", "(", "image", ".", "getBitmap", "(", ")", ")", ",", "imageMode", ")", ";", "}" ]
Sets a rounded image with a given image mode to the drawer item @param image Image to set @param imageMode Image mode to set
[ "Sets", "a", "rounded", "image", "with", "a", "given", "image", "mode", "to", "the", "drawer", "item" ]
train
https://github.com/heinrichreimer/material-drawer/blob/7c2406812d73f710ef8bb73d4a0f4bbef3b275ce/library/src/main/java/com/heinrichreimersoftware/materialdrawer/structure/DrawerItem.java#L213-L215
OpenLiberty/open-liberty
dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java
SSLConfigManager.addSSLPropertiesFromKeyStore
public synchronized void addSSLPropertiesFromKeyStore(WSKeyStore wsks, SSLConfig sslprops) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "addSSLPropertiesFromKeyStore"); for (Enumeration<?> e = wsks.propertyNames(); e.hasMoreElements();) { String property = (String) e.nextElement(); String value = wsks.getProperty(property); sslprops.setProperty(property, value); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "addSSLPropertiesFromKeyStore"); }
java
public synchronized void addSSLPropertiesFromKeyStore(WSKeyStore wsks, SSLConfig sslprops) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.entry(tc, "addSSLPropertiesFromKeyStore"); for (Enumeration<?> e = wsks.propertyNames(); e.hasMoreElements();) { String property = (String) e.nextElement(); String value = wsks.getProperty(property); sslprops.setProperty(property, value); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) Tr.exit(tc, "addSSLPropertiesFromKeyStore"); }
[ "public", "synchronized", "void", "addSSLPropertiesFromKeyStore", "(", "WSKeyStore", "wsks", ",", "SSLConfig", "sslprops", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"addSSLPropertiesFromKeyStore\"", ")", ";", "for", "(", "Enumeration", "<", "?", ">", "e", "=", "wsks", ".", "propertyNames", "(", ")", ";", "e", ".", "hasMoreElements", "(", ")", ";", ")", "{", "String", "property", "=", "(", "String", ")", "e", ".", "nextElement", "(", ")", ";", "String", "value", "=", "wsks", ".", "getProperty", "(", "property", ")", ";", "sslprops", ".", "setProperty", "(", "property", ",", "value", ")", ";", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "exit", "(", "tc", ",", "\"addSSLPropertiesFromKeyStore\"", ")", ";", "}" ]
Adds all the properties from a WSKeyStore to an SSLConfig. @param wsks @param sslprops
[ "Adds", "all", "the", "properties", "from", "a", "WSKeyStore", "to", "an", "SSLConfig", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/SSLConfigManager.java#L536-L547
apache/groovy
src/main/java/org/apache/groovy/plugin/GroovyRunnerRegistry.java
GroovyRunnerRegistry.put
@Override public GroovyRunner put(String key, GroovyRunner runner) { if (key == null || runner == null) { return null; } Map<String, GroovyRunner> map = getMap(); writeLock.lock(); try { cachedValues = null; return map.put(key, runner); } finally { writeLock.unlock(); } }
java
@Override public GroovyRunner put(String key, GroovyRunner runner) { if (key == null || runner == null) { return null; } Map<String, GroovyRunner> map = getMap(); writeLock.lock(); try { cachedValues = null; return map.put(key, runner); } finally { writeLock.unlock(); } }
[ "@", "Override", "public", "GroovyRunner", "put", "(", "String", "key", ",", "GroovyRunner", "runner", ")", "{", "if", "(", "key", "==", "null", "||", "runner", "==", "null", ")", "{", "return", "null", ";", "}", "Map", "<", "String", ",", "GroovyRunner", ">", "map", "=", "getMap", "(", ")", ";", "writeLock", ".", "lock", "(", ")", ";", "try", "{", "cachedValues", "=", "null", ";", "return", "map", ".", "put", "(", "key", ",", "runner", ")", ";", "}", "finally", "{", "writeLock", ".", "unlock", "(", ")", ";", "}", "}" ]
Registers a runner with the specified key. @param key to associate with the runner @param runner the runner to register @return the previously registered runner for the given key, if no runner was previously registered for the key then {@code null}
[ "Registers", "a", "runner", "with", "the", "specified", "key", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/plugin/GroovyRunnerRegistry.java#L311-L324
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/ngmf/util/cosu/MH.java
MHdparam.qobs
double qobs(int i, double[] xt) { int x = (int) (xt[0]); double p = Math.random(); int y = 0; p -= pi(x, y); while (p > 0) { y++; p -= pi(x, y); } return (double) y; }
java
double qobs(int i, double[] xt) { int x = (int) (xt[0]); double p = Math.random(); int y = 0; p -= pi(x, y); while (p > 0) { y++; p -= pi(x, y); } return (double) y; }
[ "double", "qobs", "(", "int", "i", ",", "double", "[", "]", "xt", ")", "{", "int", "x", "=", "(", "int", ")", "(", "xt", "[", "0", "]", ")", ";", "double", "p", "=", "Math", ".", "random", "(", ")", ";", "int", "y", "=", "0", ";", "p", "-=", "pi", "(", "x", ",", "y", ")", ";", "while", "(", "p", ">", "0", ")", "{", "y", "++", ";", "p", "-=", "pi", "(", "x", ",", "y", ")", ";", "}", "return", "(", "double", ")", "y", ";", "}" ]
Draw an (internal) new state y given that we're in (internal) state xt
[ "Draw", "an", "(", "internal", ")", "new", "state", "y", "given", "that", "we", "re", "in", "(", "internal", ")", "state", "xt" ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/ngmf/util/cosu/MH.java#L328-L338
beangle/beangle3
commons/model/src/main/java/org/beangle/commons/transfer/excel/ExcelTools.java
ExcelTools.object2Excel
public <T> HSSFWorkbook object2Excel(List<T> list, String propertyKeys, String propertyShowKeys) throws Exception { return object2Excel(list, propertyKeys, propertyShowKeys, new DefaultPropertyExtractor()); }
java
public <T> HSSFWorkbook object2Excel(List<T> list, String propertyKeys, String propertyShowKeys) throws Exception { return object2Excel(list, propertyKeys, propertyShowKeys, new DefaultPropertyExtractor()); }
[ "public", "<", "T", ">", "HSSFWorkbook", "object2Excel", "(", "List", "<", "T", ">", "list", ",", "String", "propertyKeys", ",", "String", "propertyShowKeys", ")", "throws", "Exception", "{", "return", "object2Excel", "(", "list", ",", "propertyKeys", ",", "propertyShowKeys", ",", "new", "DefaultPropertyExtractor", "(", ")", ")", ";", "}" ]
<p> object2Excel. </p> @param list a {@link java.util.List} object. @param propertyKeys a {@link java.lang.String} object. @param propertyShowKeys a {@link java.lang.String} object. @param <T> a T object. @return a {@link org.apache.poi.hssf.usermodel.HSSFWorkbook} object. @throws java.lang.Exception if any.
[ "<p", ">", "object2Excel", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/model/src/main/java/org/beangle/commons/transfer/excel/ExcelTools.java#L194-L198
Impetus/Kundera
examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/ExecutorService.java
ExecutorService.findByQuery
@SuppressWarnings("unchecked") static void findByQuery(final EntityManager em, final String query) { Query q = em.createNamedQuery(query); logger.info("[On Find All by Query]"); List<User> users = q.getResultList(); if (users == null || users.isEmpty()) { logger.info("0 Users Returned"); return; } System.out.println("#######################START##########################################"); logger.info("\t\t Total number of users:" + users.size()); logger.info("\t\t User's total tweets:" + users.get(0).getTweets().size()); printTweets(users); logger.info("\n"); // logger.info("First tweet:" users.get(0).getTweets().); System.out.println("#######################END############################################"); logger.info("\n"); }
java
@SuppressWarnings("unchecked") static void findByQuery(final EntityManager em, final String query) { Query q = em.createNamedQuery(query); logger.info("[On Find All by Query]"); List<User> users = q.getResultList(); if (users == null || users.isEmpty()) { logger.info("0 Users Returned"); return; } System.out.println("#######################START##########################################"); logger.info("\t\t Total number of users:" + users.size()); logger.info("\t\t User's total tweets:" + users.get(0).getTweets().size()); printTweets(users); logger.info("\n"); // logger.info("First tweet:" users.get(0).getTweets().); System.out.println("#######################END############################################"); logger.info("\n"); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "static", "void", "findByQuery", "(", "final", "EntityManager", "em", ",", "final", "String", "query", ")", "{", "Query", "q", "=", "em", ".", "createNamedQuery", "(", "query", ")", ";", "logger", ".", "info", "(", "\"[On Find All by Query]\"", ")", ";", "List", "<", "User", ">", "users", "=", "q", ".", "getResultList", "(", ")", ";", "if", "(", "users", "==", "null", "||", "users", ".", "isEmpty", "(", ")", ")", "{", "logger", ".", "info", "(", "\"0 Users Returned\"", ")", ";", "return", ";", "}", "System", ".", "out", ".", "println", "(", "\"#######################START##########################################\"", ")", ";", "logger", ".", "info", "(", "\"\\t\\t Total number of users:\"", "+", "users", ".", "size", "(", ")", ")", ";", "logger", ".", "info", "(", "\"\\t\\t User's total tweets:\"", "+", "users", ".", "get", "(", "0", ")", ".", "getTweets", "(", ")", ".", "size", "(", ")", ")", ";", "printTweets", "(", "users", ")", ";", "logger", ".", "info", "(", "\"\\n\"", ")", ";", "// logger.info(\"First tweet:\" users.get(0).getTweets().);\r", "System", ".", "out", ".", "println", "(", "\"#######################END############################################\"", ")", ";", "logger", ".", "info", "(", "\"\\n\"", ")", ";", "}" ]
on find by wild search query. @param em entity manager instance. @param query query.
[ "on", "find", "by", "wild", "search", "query", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/examples/polyglot/kvapps/src/main/java/com/impetus/kvapps/runner/ExecutorService.java#L119-L141
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_mailingList_mailingListAddress_alias_alias_GET
public OvhExchangeMailingListAlias organizationName_service_exchangeService_mailingList_mailingListAddress_alias_alias_GET(String organizationName, String exchangeService, String mailingListAddress, String alias) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/alias/{alias}"; StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress, alias); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangeMailingListAlias.class); }
java
public OvhExchangeMailingListAlias organizationName_service_exchangeService_mailingList_mailingListAddress_alias_alias_GET(String organizationName, String exchangeService, String mailingListAddress, String alias) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/alias/{alias}"; StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress, alias); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhExchangeMailingListAlias.class); }
[ "public", "OvhExchangeMailingListAlias", "organizationName_service_exchangeService_mailingList_mailingListAddress_alias_alias_GET", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "mailingListAddress", ",", "String", "alias", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/alias/{alias}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "organizationName", ",", "exchangeService", ",", "mailingListAddress", ",", "alias", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhExchangeMailingListAlias", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}/alias/{alias} @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param mailingListAddress [required] The mailing list address @param alias [required] Alias
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1435-L1440
OpenLiberty/open-liberty
dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelOptions.java
SSLChannelOptions.updateConfguration
void updateConfguration(Dictionary<String, Object> props, String defaultId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "updateConfguration", props, defaultId); } String id = (String) props.get(SSLChannelProvider.SSL_CFG_REF); synchronized (this) { properties = props; if (id == null || id.isEmpty()) { useDefaultId = true; id = sslRefId = defaultId; properties.put(SSLChannelProvider.SSL_CFG_REF, defaultId); } else { sslRefId = id; useDefaultId = false; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "updateConfguration", id); } }
java
void updateConfguration(Dictionary<String, Object> props, String defaultId) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, "updateConfguration", props, defaultId); } String id = (String) props.get(SSLChannelProvider.SSL_CFG_REF); synchronized (this) { properties = props; if (id == null || id.isEmpty()) { useDefaultId = true; id = sslRefId = defaultId; properties.put(SSLChannelProvider.SSL_CFG_REF, defaultId); } else { sslRefId = id; useDefaultId = false; } } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, "updateConfguration", id); } }
[ "void", "updateConfguration", "(", "Dictionary", "<", "String", ",", "Object", ">", "props", ",", "String", "defaultId", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "entry", "(", "tc", ",", "\"updateConfguration\"", ",", "props", ",", "defaultId", ")", ";", "}", "String", "id", "=", "(", "String", ")", "props", ".", "get", "(", "SSLChannelProvider", ".", "SSL_CFG_REF", ")", ";", "synchronized", "(", "this", ")", "{", "properties", "=", "props", ";", "if", "(", "id", "==", "null", "||", "id", ".", "isEmpty", "(", ")", ")", "{", "useDefaultId", "=", "true", ";", "id", "=", "sslRefId", "=", "defaultId", ";", "properties", ".", "put", "(", "SSLChannelProvider", ".", "SSL_CFG_REF", ",", "defaultId", ")", ";", "}", "else", "{", "sslRefId", "=", "id", ";", "useDefaultId", "=", "false", ";", "}", "}", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "Tr", ".", "exit", "(", "tc", ",", "\"updateConfguration\"", ",", "id", ")", ";", "}", "}" ]
Create the new keystore based on the properties provided. Package private. @param properties
[ "Create", "the", "new", "keystore", "based", "on", "the", "properties", "provided", ".", "Package", "private", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channel.ssl/src/com/ibm/ws/channel/ssl/internal/SSLChannelOptions.java#L50-L73
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/message/record/GridRecordMessageFilter.java
GridRecordMessageFilter.init
public void init(Record record, Object source, boolean bReceiveAllAdds) { m_htBookmarks = new BookmarkList(); m_bReceiveAllAdds = bReceiveAllAdds; super.init(record, null, source); if (record != null) record.addListener(new GridSyncRecordMessageFilterHandler(this, true)); }
java
public void init(Record record, Object source, boolean bReceiveAllAdds) { m_htBookmarks = new BookmarkList(); m_bReceiveAllAdds = bReceiveAllAdds; super.init(record, null, source); if (record != null) record.addListener(new GridSyncRecordMessageFilterHandler(this, true)); }
[ "public", "void", "init", "(", "Record", "record", ",", "Object", "source", ",", "boolean", "bReceiveAllAdds", ")", "{", "m_htBookmarks", "=", "new", "BookmarkList", "(", ")", ";", "m_bReceiveAllAdds", "=", "bReceiveAllAdds", ";", "super", ".", "init", "(", "record", ",", "null", ",", "source", ")", ";", "if", "(", "record", "!=", "null", ")", "record", ".", "addListener", "(", "new", "GridSyncRecordMessageFilterHandler", "(", "this", ",", "true", ")", ")", ";", "}" ]
Constructor. @param record The record to watch. @param source The source of this filter, to eliminate echos. @param bReceiveAllAdds If true, receive all add notifications, otherwise just receive the adds on secondary reads.
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/message/record/GridRecordMessageFilter.java#L93-L100
azkaban/azkaban
azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java
DagBuilder.addParentNode
public void addParentNode(final String childNodeName, final String parentNodeName) { checkIsBuilt(); final Node child = this.nameToNodeMap.get(childNodeName); if (child == null) { throw new DagException(String.format("Unknown child node (%s). Did you create the node?", childNodeName)); } final Node parent = this.nameToNodeMap.get(parentNodeName); if (parent == null) { throw new DagException( String.format("Unknown parent node (%s). Did you create the node?", parentNodeName)); } child.addParent(parent); }
java
public void addParentNode(final String childNodeName, final String parentNodeName) { checkIsBuilt(); final Node child = this.nameToNodeMap.get(childNodeName); if (child == null) { throw new DagException(String.format("Unknown child node (%s). Did you create the node?", childNodeName)); } final Node parent = this.nameToNodeMap.get(parentNodeName); if (parent == null) { throw new DagException( String.format("Unknown parent node (%s). Did you create the node?", parentNodeName)); } child.addParent(parent); }
[ "public", "void", "addParentNode", "(", "final", "String", "childNodeName", ",", "final", "String", "parentNodeName", ")", "{", "checkIsBuilt", "(", ")", ";", "final", "Node", "child", "=", "this", ".", "nameToNodeMap", ".", "get", "(", "childNodeName", ")", ";", "if", "(", "child", "==", "null", ")", "{", "throw", "new", "DagException", "(", "String", ".", "format", "(", "\"Unknown child node (%s). Did you create the node?\"", ",", "childNodeName", ")", ")", ";", "}", "final", "Node", "parent", "=", "this", ".", "nameToNodeMap", ".", "get", "(", "parentNodeName", ")", ";", "if", "(", "parent", "==", "null", ")", "{", "throw", "new", "DagException", "(", "String", ".", "format", "(", "\"Unknown parent node (%s). Did you create the node?\"", ",", "parentNodeName", ")", ")", ";", "}", "child", ".", "addParent", "(", "parent", ")", ";", "}" ]
Add a parent node to a child node. All the names should have been registered with this builder with the {@link DagBuilder#createNode(String, NodeProcessor)} call. @param childNodeName name of the child node @param parentNodeName name of the parent node
[ "Add", "a", "parent", "node", "to", "a", "child", "node", ".", "All", "the", "names", "should", "have", "been", "registered", "with", "this", "builder", "with", "the", "{", "@link", "DagBuilder#createNode", "(", "String", "NodeProcessor", ")", "}", "call", "." ]
train
https://github.com/azkaban/azkaban/blob/d258ea7d6e66807c6eff79c5325d6d3443618dff/azkaban-exec-server/src/main/java/azkaban/dag/DagBuilder.java#L96-L112
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/MultiLayerConfiguration.java
MultiLayerConfiguration.getMemoryReport
public NetworkMemoryReport getMemoryReport(InputType inputType) { Map<String, MemoryReport> memoryReportMap = new LinkedHashMap<>(); int nLayers = confs.size(); for (int i = 0; i < nLayers; i++) { String layerName = confs.get(i).getLayer().getLayerName(); if (layerName == null) { layerName = String.valueOf(i); } //Pass input type through preprocessor, if necessary InputPreProcessor preproc = getInputPreProcess(i); //TODO memory requirements for preprocessor if (preproc != null) { inputType = preproc.getOutputType(inputType); } LayerMemoryReport report = confs.get(i).getLayer().getMemoryReport(inputType); memoryReportMap.put(layerName, report); inputType = confs.get(i).getLayer().getOutputType(i, inputType); } return new NetworkMemoryReport(memoryReportMap, MultiLayerConfiguration.class, "MultiLayerNetwork", inputType); }
java
public NetworkMemoryReport getMemoryReport(InputType inputType) { Map<String, MemoryReport> memoryReportMap = new LinkedHashMap<>(); int nLayers = confs.size(); for (int i = 0; i < nLayers; i++) { String layerName = confs.get(i).getLayer().getLayerName(); if (layerName == null) { layerName = String.valueOf(i); } //Pass input type through preprocessor, if necessary InputPreProcessor preproc = getInputPreProcess(i); //TODO memory requirements for preprocessor if (preproc != null) { inputType = preproc.getOutputType(inputType); } LayerMemoryReport report = confs.get(i).getLayer().getMemoryReport(inputType); memoryReportMap.put(layerName, report); inputType = confs.get(i).getLayer().getOutputType(i, inputType); } return new NetworkMemoryReport(memoryReportMap, MultiLayerConfiguration.class, "MultiLayerNetwork", inputType); }
[ "public", "NetworkMemoryReport", "getMemoryReport", "(", "InputType", "inputType", ")", "{", "Map", "<", "String", ",", "MemoryReport", ">", "memoryReportMap", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "int", "nLayers", "=", "confs", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nLayers", ";", "i", "++", ")", "{", "String", "layerName", "=", "confs", ".", "get", "(", "i", ")", ".", "getLayer", "(", ")", ".", "getLayerName", "(", ")", ";", "if", "(", "layerName", "==", "null", ")", "{", "layerName", "=", "String", ".", "valueOf", "(", "i", ")", ";", "}", "//Pass input type through preprocessor, if necessary", "InputPreProcessor", "preproc", "=", "getInputPreProcess", "(", "i", ")", ";", "//TODO memory requirements for preprocessor", "if", "(", "preproc", "!=", "null", ")", "{", "inputType", "=", "preproc", ".", "getOutputType", "(", "inputType", ")", ";", "}", "LayerMemoryReport", "report", "=", "confs", ".", "get", "(", "i", ")", ".", "getLayer", "(", ")", ".", "getMemoryReport", "(", "inputType", ")", ";", "memoryReportMap", ".", "put", "(", "layerName", ",", "report", ")", ";", "inputType", "=", "confs", ".", "get", "(", "i", ")", ".", "getLayer", "(", ")", ".", "getOutputType", "(", "i", ",", "inputType", ")", ";", "}", "return", "new", "NetworkMemoryReport", "(", "memoryReportMap", ",", "MultiLayerConfiguration", ".", "class", ",", "\"MultiLayerNetwork\"", ",", "inputType", ")", ";", "}" ]
Get a {@link MemoryReport} for the given MultiLayerConfiguration. This is used to estimate the memory requirements for the given network configuration and input @param inputType Input types for the network @return Memory report for the network
[ "Get", "a", "{", "@link", "MemoryReport", "}", "for", "the", "given", "MultiLayerConfiguration", ".", "This", "is", "used", "to", "estimate", "the", "memory", "requirements", "for", "the", "given", "network", "configuration", "and", "input" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/MultiLayerConfiguration.java#L397-L421
metamx/extendedset
src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java
PairSet.contains
public boolean contains(T transaction, I item) { int t = transactionToIndex(transaction); if (t < 0) return false; int i = itemToIndex(item); if (i < 0) return false; return matrix.contains(t, i); }
java
public boolean contains(T transaction, I item) { int t = transactionToIndex(transaction); if (t < 0) return false; int i = itemToIndex(item); if (i < 0) return false; return matrix.contains(t, i); }
[ "public", "boolean", "contains", "(", "T", "transaction", ",", "I", "item", ")", "{", "int", "t", "=", "transactionToIndex", "(", "transaction", ")", ";", "if", "(", "t", "<", "0", ")", "return", "false", ";", "int", "i", "=", "itemToIndex", "(", "item", ")", ";", "if", "(", "i", "<", "0", ")", "return", "false", ";", "return", "matrix", ".", "contains", "(", "t", ",", "i", ")", ";", "}" ]
Checks if the given transaction-item pair is contained within the set @param transaction the transaction of the pair @param item the item of the pair @return <code>true</code> if the given transaction-item pair is contained within the set
[ "Checks", "if", "the", "given", "transaction", "-", "item", "pair", "is", "contained", "within", "the", "set" ]
train
https://github.com/metamx/extendedset/blob/0f77c28057fac9c1bd6d79fbe5425b8efe5742a8/src/main/java/it/uniroma3/mat/extendedset/wrappers/matrix/PairSet.java#L384-L392
iipc/webarchive-commons
src/main/java/org/archive/util/ProcessUtils.java
ProcessUtils.exec
public static ProcessUtils.ProcessResult exec(String [] args) throws IOException { Process p = Runtime.getRuntime().exec(args); ProcessUtils pu = new ProcessUtils(); // Gobble up any output. StreamGobbler err = pu.new StreamGobbler(p.getErrorStream(), "stderr"); err.setDaemon(true); err.start(); StreamGobbler out = pu.new StreamGobbler(p.getInputStream(), "stdout"); out.setDaemon(true); out.start(); int exitVal; try { exitVal = p.waitFor(); } catch (InterruptedException e) { throw new IOException("Wait on process " + Arrays.toString(args) + " interrupted: " + e.getMessage()); } ProcessUtils.ProcessResult result = pu.new ProcessResult(args, exitVal, out.getSink(), err.getSink()); if (exitVal != 0) { throw new IOException(result.toString()); } else if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info(result.toString()); } return result; }
java
public static ProcessUtils.ProcessResult exec(String [] args) throws IOException { Process p = Runtime.getRuntime().exec(args); ProcessUtils pu = new ProcessUtils(); // Gobble up any output. StreamGobbler err = pu.new StreamGobbler(p.getErrorStream(), "stderr"); err.setDaemon(true); err.start(); StreamGobbler out = pu.new StreamGobbler(p.getInputStream(), "stdout"); out.setDaemon(true); out.start(); int exitVal; try { exitVal = p.waitFor(); } catch (InterruptedException e) { throw new IOException("Wait on process " + Arrays.toString(args) + " interrupted: " + e.getMessage()); } ProcessUtils.ProcessResult result = pu.new ProcessResult(args, exitVal, out.getSink(), err.getSink()); if (exitVal != 0) { throw new IOException(result.toString()); } else if (LOGGER.isLoggable(Level.INFO)) { LOGGER.info(result.toString()); } return result; }
[ "public", "static", "ProcessUtils", ".", "ProcessResult", "exec", "(", "String", "[", "]", "args", ")", "throws", "IOException", "{", "Process", "p", "=", "Runtime", ".", "getRuntime", "(", ")", ".", "exec", "(", "args", ")", ";", "ProcessUtils", "pu", "=", "new", "ProcessUtils", "(", ")", ";", "// Gobble up any output.", "StreamGobbler", "err", "=", "pu", ".", "new", "StreamGobbler", "(", "p", ".", "getErrorStream", "(", ")", ",", "\"stderr\"", ")", ";", "err", ".", "setDaemon", "(", "true", ")", ";", "err", ".", "start", "(", ")", ";", "StreamGobbler", "out", "=", "pu", ".", "new", "StreamGobbler", "(", "p", ".", "getInputStream", "(", ")", ",", "\"stdout\"", ")", ";", "out", ".", "setDaemon", "(", "true", ")", ";", "out", ".", "start", "(", ")", ";", "int", "exitVal", ";", "try", "{", "exitVal", "=", "p", ".", "waitFor", "(", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "throw", "new", "IOException", "(", "\"Wait on process \"", "+", "Arrays", ".", "toString", "(", "args", ")", "+", "\" interrupted: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "ProcessUtils", ".", "ProcessResult", "result", "=", "pu", ".", "new", "ProcessResult", "(", "args", ",", "exitVal", ",", "out", ".", "getSink", "(", ")", ",", "err", ".", "getSink", "(", ")", ")", ";", "if", "(", "exitVal", "!=", "0", ")", "{", "throw", "new", "IOException", "(", "result", ".", "toString", "(", ")", ")", ";", "}", "else", "if", "(", "LOGGER", ".", "isLoggable", "(", "Level", ".", "INFO", ")", ")", "{", "LOGGER", ".", "info", "(", "result", ".", "toString", "(", ")", ")", ";", "}", "return", "result", ";", "}" ]
Runs process. @param args List of process args. @return A ProcessResult data structure. @throws IOException If interrupted, we throw an IOException. If non-zero exit code, we throw an IOException (This may need to change).
[ "Runs", "process", "." ]
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/ProcessUtils.java#L124-L150
jboss/jboss-jsf-api_spec
src/main/java/javax/faces/component/behavior/ClientBehaviorContext.java
ClientBehaviorContext.createClientBehaviorContext
public static ClientBehaviorContext createClientBehaviorContext(FacesContext context, UIComponent component, String eventName, String sourceId, Collection<ClientBehaviorContext.Parameter> parameters) { return new ClientBehaviorContextImpl(context, component, eventName, sourceId, parameters); }
java
public static ClientBehaviorContext createClientBehaviorContext(FacesContext context, UIComponent component, String eventName, String sourceId, Collection<ClientBehaviorContext.Parameter> parameters) { return new ClientBehaviorContextImpl(context, component, eventName, sourceId, parameters); }
[ "public", "static", "ClientBehaviorContext", "createClientBehaviorContext", "(", "FacesContext", "context", ",", "UIComponent", "component", ",", "String", "eventName", ",", "String", "sourceId", ",", "Collection", "<", "ClientBehaviorContext", ".", "Parameter", ">", "parameters", ")", "{", "return", "new", "ClientBehaviorContextImpl", "(", "context", ",", "component", ",", "eventName", ",", "sourceId", ",", "parameters", ")", ";", "}" ]
<p class="changed_added_2_0">Creates a ClientBehaviorContext instance.</p> @param context the <code>FacesContext</code> for the current request. @param component the component instance to which the <code>ClientBehavior</code> is attached. @param eventName the name of the behavior event to which the <code>ClientBehavior</code> is attached. @param sourceId the id to use as the ClientBehavior's "source". @param parameters the collection of parameters for submitting ClientBehaviors to include in the request. @return a <code>ClientBehaviorContext</code> instance configured with the provided values. @throws NullPointerException if <code>context</code>, <code>component</code> or <code>eventName</code> is <code>null</code> @since 2.0
[ "<p", "class", "=", "changed_added_2_0", ">", "Creates", "a", "ClientBehaviorContext", "instance", ".", "<", "/", "p", ">" ]
train
https://github.com/jboss/jboss-jsf-api_spec/blob/cb33d215acbab847f2db5cdf2c6fe4d99c0a01c3/src/main/java/javax/faces/component/behavior/ClientBehaviorContext.java#L79-L86
BranchMetrics/android-branch-deep-linking
Branch-SDK/src/io/branch/indexing/BranchUniversalObject.java
BranchUniversalObject.userCompletedAction
public void userCompletedAction(String action, HashMap<String, String> metadata) { JSONObject actionCompletedPayload = new JSONObject(); try { JSONArray canonicalIDList = new JSONArray(); canonicalIDList.put(canonicalIdentifier_); actionCompletedPayload.put(canonicalIdentifier_, convertToJson()); if (metadata != null) { for (String key : metadata.keySet()) { actionCompletedPayload.put(key, metadata.get(key)); } } if (Branch.getInstance() != null) { Branch.getInstance().userCompletedAction(action, actionCompletedPayload); } } catch (JSONException ignore) { } }
java
public void userCompletedAction(String action, HashMap<String, String> metadata) { JSONObject actionCompletedPayload = new JSONObject(); try { JSONArray canonicalIDList = new JSONArray(); canonicalIDList.put(canonicalIdentifier_); actionCompletedPayload.put(canonicalIdentifier_, convertToJson()); if (metadata != null) { for (String key : metadata.keySet()) { actionCompletedPayload.put(key, metadata.get(key)); } } if (Branch.getInstance() != null) { Branch.getInstance().userCompletedAction(action, actionCompletedPayload); } } catch (JSONException ignore) { } }
[ "public", "void", "userCompletedAction", "(", "String", "action", ",", "HashMap", "<", "String", ",", "String", ">", "metadata", ")", "{", "JSONObject", "actionCompletedPayload", "=", "new", "JSONObject", "(", ")", ";", "try", "{", "JSONArray", "canonicalIDList", "=", "new", "JSONArray", "(", ")", ";", "canonicalIDList", ".", "put", "(", "canonicalIdentifier_", ")", ";", "actionCompletedPayload", ".", "put", "(", "canonicalIdentifier_", ",", "convertToJson", "(", ")", ")", ";", "if", "(", "metadata", "!=", "null", ")", "{", "for", "(", "String", "key", ":", "metadata", ".", "keySet", "(", ")", ")", "{", "actionCompletedPayload", ".", "put", "(", "key", ",", "metadata", ".", "get", "(", "key", ")", ")", ";", "}", "}", "if", "(", "Branch", ".", "getInstance", "(", ")", "!=", "null", ")", "{", "Branch", ".", "getInstance", "(", ")", ".", "userCompletedAction", "(", "action", ",", "actionCompletedPayload", ")", ";", "}", "}", "catch", "(", "JSONException", "ignore", ")", "{", "}", "}" ]
<p> Method to report user actions happened on this BUO. Use this method to report the user actions for analytics purpose. </p> @param action A {@link String }with value of user action name. See {@link BranchEvent} for Branch defined user events. @param metadata A HashMap containing any additional metadata need to add to this user event NOTE : please consider using {@link #userCompletedAction(BRANCH_STANDARD_EVENT, HashMap)} instead
[ "<p", ">", "Method", "to", "report", "user", "actions", "happened", "on", "this", "BUO", ".", "Use", "this", "method", "to", "report", "the", "user", "actions", "for", "analytics", "purpose", ".", "<", "/", "p", ">" ]
train
https://github.com/BranchMetrics/android-branch-deep-linking/blob/e3bee2ccfcbf6d4bf1a5815b5b86666e4ff8f848/Branch-SDK/src/io/branch/indexing/BranchUniversalObject.java#L357-L373
atomix/atomix
core/src/main/java/io/atomix/core/map/impl/AbstractAtomicMapService.java
AbstractAtomicMapService.scheduleTtl
protected void scheduleTtl(K key, MapEntryValue value) { if (value.ttl() > 0) { value.timer = getScheduler().schedule(Duration.ofMillis(value.ttl()), () -> { entries().remove(key, value); publish(new AtomicMapEvent<>(AtomicMapEvent.Type.REMOVE, key, null, toVersioned(value))); }); } }
java
protected void scheduleTtl(K key, MapEntryValue value) { if (value.ttl() > 0) { value.timer = getScheduler().schedule(Duration.ofMillis(value.ttl()), () -> { entries().remove(key, value); publish(new AtomicMapEvent<>(AtomicMapEvent.Type.REMOVE, key, null, toVersioned(value))); }); } }
[ "protected", "void", "scheduleTtl", "(", "K", "key", ",", "MapEntryValue", "value", ")", "{", "if", "(", "value", ".", "ttl", "(", ")", ">", "0", ")", "{", "value", ".", "timer", "=", "getScheduler", "(", ")", ".", "schedule", "(", "Duration", ".", "ofMillis", "(", "value", ".", "ttl", "(", ")", ")", ",", "(", ")", "->", "{", "entries", "(", ")", ".", "remove", "(", "key", ",", "value", ")", ";", "publish", "(", "new", "AtomicMapEvent", "<>", "(", "AtomicMapEvent", ".", "Type", ".", "REMOVE", ",", "key", ",", "null", ",", "toVersioned", "(", "value", ")", ")", ")", ";", "}", ")", ";", "}", "}" ]
Schedules the TTL for the given value. @param value the value for which to schedule the TTL
[ "Schedules", "the", "TTL", "for", "the", "given", "value", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/core/src/main/java/io/atomix/core/map/impl/AbstractAtomicMapService.java#L266-L273
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixtureWithMap.java
SlimFixtureWithMap.addValueTo
public void addValueTo(Object value, String name) { getMapHelper().addValueToIn(value, name, getCurrentValues()); }
java
public void addValueTo(Object value, String name) { getMapHelper().addValueToIn(value, name, getCurrentValues()); }
[ "public", "void", "addValueTo", "(", "Object", "value", ",", "String", "name", ")", "{", "getMapHelper", "(", ")", ".", "addValueToIn", "(", "value", ",", "name", ",", "getCurrentValues", "(", ")", ")", ";", "}" ]
Adds value to (end of) a list. @param value value to be stored. @param name name of list to extend.
[ "Adds", "value", "to", "(", "end", "of", ")", "a", "list", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/SlimFixtureWithMap.java#L72-L74
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.unsetUser
public String unsetUser(String uid, List<String> properties) throws ExecutionException, InterruptedException, IOException { return unsetUser(uid, properties, new DateTime()); }
java
public String unsetUser(String uid, List<String> properties) throws ExecutionException, InterruptedException, IOException { return unsetUser(uid, properties, new DateTime()); }
[ "public", "String", "unsetUser", "(", "String", "uid", ",", "List", "<", "String", ">", "properties", ")", "throws", "ExecutionException", ",", "InterruptedException", ",", "IOException", "{", "return", "unsetUser", "(", "uid", ",", "properties", ",", "new", "DateTime", "(", ")", ")", ";", "}" ]
Unsets properties of a user. Same as {@link #unsetUser(String, List, DateTime) unsetUser(String, List&lt;String&gt;, DateTime)} except event time is not specified and recorded as the time when the function is called.
[ "Unsets", "properties", "of", "a", "user", ".", "Same", "as", "{" ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L391-L394
alkacon/opencms-core
src-setup/org/opencms/setup/db/update6to7/postgresql/CmsUpdateDBCmsUsers.java
CmsUpdateDBCmsUsers.writeUserInfo
@Override protected void writeUserInfo(CmsSetupDb dbCon, String id, String key, Object value) { Connection conn = dbCon.getConnection(); try { PreparedStatement p = conn.prepareStatement(readQuery(QUERY_INSERT_CMS_USERDATA)); p.setString(1, id); p.setString(2, key); p.setBytes(3, CmsDataTypeUtil.dataSerialize(value)); p.setString(4, value.getClass().getName()); p.executeUpdate(); conn.commit(); } catch (SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
java
@Override protected void writeUserInfo(CmsSetupDb dbCon, String id, String key, Object value) { Connection conn = dbCon.getConnection(); try { PreparedStatement p = conn.prepareStatement(readQuery(QUERY_INSERT_CMS_USERDATA)); p.setString(1, id); p.setString(2, key); p.setBytes(3, CmsDataTypeUtil.dataSerialize(value)); p.setString(4, value.getClass().getName()); p.executeUpdate(); conn.commit(); } catch (SQLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
[ "@", "Override", "protected", "void", "writeUserInfo", "(", "CmsSetupDb", "dbCon", ",", "String", "id", ",", "String", "key", ",", "Object", "value", ")", "{", "Connection", "conn", "=", "dbCon", ".", "getConnection", "(", ")", ";", "try", "{", "PreparedStatement", "p", "=", "conn", ".", "prepareStatement", "(", "readQuery", "(", "QUERY_INSERT_CMS_USERDATA", ")", ")", ";", "p", ".", "setString", "(", "1", ",", "id", ")", ";", "p", ".", "setString", "(", "2", ",", "key", ")", ";", "p", ".", "setBytes", "(", "3", ",", "CmsDataTypeUtil", ".", "dataSerialize", "(", "value", ")", ")", ";", "p", ".", "setString", "(", "4", ",", "value", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "p", ".", "executeUpdate", "(", ")", ";", "conn", ".", "commit", "(", ")", ";", "}", "catch", "(", "SQLException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Writes one set of additional user info (key and its value) to the CMS_USERDATA table.<p> @param dbCon the db connection interface @param id the user id @param key the data key @param value the data value
[ "Writes", "one", "set", "of", "additional", "user", "info", "(", "key", "and", "its", "value", ")", "to", "the", "CMS_USERDATA", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/update6to7/postgresql/CmsUpdateDBCmsUsers.java#L214-L233
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/BooleanUtils.java
BooleanUtils.toIntegerObject
public static Integer toIntegerObject(final Boolean bool, final Integer trueValue, final Integer falseValue, final Integer nullValue) { if (bool == null) { return nullValue; } return bool.booleanValue() ? trueValue : falseValue; }
java
public static Integer toIntegerObject(final Boolean bool, final Integer trueValue, final Integer falseValue, final Integer nullValue) { if (bool == null) { return nullValue; } return bool.booleanValue() ? trueValue : falseValue; }
[ "public", "static", "Integer", "toIntegerObject", "(", "final", "Boolean", "bool", ",", "final", "Integer", "trueValue", ",", "final", "Integer", "falseValue", ",", "final", "Integer", "nullValue", ")", "{", "if", "(", "bool", "==", "null", ")", "{", "return", "nullValue", ";", "}", "return", "bool", ".", "booleanValue", "(", ")", "?", "trueValue", ":", "falseValue", ";", "}" ]
<p>Converts a Boolean to an Integer specifying the conversion values.</p> <pre> BooleanUtils.toIntegerObject(Boolean.TRUE, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(1) BooleanUtils.toIntegerObject(Boolean.FALSE, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(0) BooleanUtils.toIntegerObject(null, Integer.valueOf(1), Integer.valueOf(0), Integer.valueOf(2)) = Integer.valueOf(2) </pre> @param bool the Boolean to convert @param trueValue the value to return if {@code true}, may be {@code null} @param falseValue the value to return if {@code false}, may be {@code null} @param nullValue the value to return if {@code null}, may be {@code null} @return the appropriate value
[ "<p", ">", "Converts", "a", "Boolean", "to", "an", "Integer", "specifying", "the", "conversion", "values", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/BooleanUtils.java#L503-L508
Erudika/para
para-core/src/main/java/com/erudika/para/core/App.java
App.addSetting
public App addSetting(String name, Object value) { if (!StringUtils.isBlank(name) && value != null) { getSettings().put(name, value); for (AppSettingAddedListener listener : ADD_SETTING_LISTENERS) { listener.onSettingAdded(this, name, value); logger.debug("Executed {}.onSettingAdded().", listener.getClass().getName()); } } return this; }
java
public App addSetting(String name, Object value) { if (!StringUtils.isBlank(name) && value != null) { getSettings().put(name, value); for (AppSettingAddedListener listener : ADD_SETTING_LISTENERS) { listener.onSettingAdded(this, name, value); logger.debug("Executed {}.onSettingAdded().", listener.getClass().getName()); } } return this; }
[ "public", "App", "addSetting", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "!", "StringUtils", ".", "isBlank", "(", "name", ")", "&&", "value", "!=", "null", ")", "{", "getSettings", "(", ")", ".", "put", "(", "name", ",", "value", ")", ";", "for", "(", "AppSettingAddedListener", "listener", ":", "ADD_SETTING_LISTENERS", ")", "{", "listener", ".", "onSettingAdded", "(", "this", ",", "name", ",", "value", ")", ";", "logger", ".", "debug", "(", "\"Executed {}.onSettingAdded().\"", ",", "listener", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", ";", "}", "}", "return", "this", ";", "}" ]
Adds a new setting to the map. @param name a key @param value a value @return this
[ "Adds", "a", "new", "setting", "to", "the", "map", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/App.java#L174-L183
pac4j/pac4j
pac4j-core/src/main/java/org/pac4j/core/profile/definition/ProfileDefinition.java
ProfileDefinition.setProfileFactory
protected void setProfileFactory(final Function<Object[], P> profileFactory) { CommonHelper.assertNotNull("profileFactory", profileFactory); this.newProfile = profileFactory; }
java
protected void setProfileFactory(final Function<Object[], P> profileFactory) { CommonHelper.assertNotNull("profileFactory", profileFactory); this.newProfile = profileFactory; }
[ "protected", "void", "setProfileFactory", "(", "final", "Function", "<", "Object", "[", "]", ",", "P", ">", "profileFactory", ")", "{", "CommonHelper", ".", "assertNotNull", "(", "\"profileFactory\"", ",", "profileFactory", ")", ";", "this", ".", "newProfile", "=", "profileFactory", ";", "}" ]
Define the way to build the profile. @param profileFactory the way to build the profile
[ "Define", "the", "way", "to", "build", "the", "profile", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/profile/definition/ProfileDefinition.java#L105-L108
glyptodon/guacamole-client
guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java
StandardTokens.addStandardTokens
public static void addStandardTokens(TokenFilter filter, Credentials credentials) { // Add username token String username = credentials.getUsername(); if (username != null) filter.setToken(USERNAME_TOKEN, username); // Add password token String password = credentials.getPassword(); if (password != null) filter.setToken(PASSWORD_TOKEN, password); // Add client hostname token String hostname = credentials.getRemoteHostname(); if (hostname != null) filter.setToken(CLIENT_HOSTNAME_TOKEN, hostname); // Add client address token String address = credentials.getRemoteAddress(); if (address != null) filter.setToken(CLIENT_ADDRESS_TOKEN, address); // Add any tokens which do not require credentials addStandardTokens(filter); }
java
public static void addStandardTokens(TokenFilter filter, Credentials credentials) { // Add username token String username = credentials.getUsername(); if (username != null) filter.setToken(USERNAME_TOKEN, username); // Add password token String password = credentials.getPassword(); if (password != null) filter.setToken(PASSWORD_TOKEN, password); // Add client hostname token String hostname = credentials.getRemoteHostname(); if (hostname != null) filter.setToken(CLIENT_HOSTNAME_TOKEN, hostname); // Add client address token String address = credentials.getRemoteAddress(); if (address != null) filter.setToken(CLIENT_ADDRESS_TOKEN, address); // Add any tokens which do not require credentials addStandardTokens(filter); }
[ "public", "static", "void", "addStandardTokens", "(", "TokenFilter", "filter", ",", "Credentials", "credentials", ")", "{", "// Add username token", "String", "username", "=", "credentials", ".", "getUsername", "(", ")", ";", "if", "(", "username", "!=", "null", ")", "filter", ".", "setToken", "(", "USERNAME_TOKEN", ",", "username", ")", ";", "// Add password token", "String", "password", "=", "credentials", ".", "getPassword", "(", ")", ";", "if", "(", "password", "!=", "null", ")", "filter", ".", "setToken", "(", "PASSWORD_TOKEN", ",", "password", ")", ";", "// Add client hostname token", "String", "hostname", "=", "credentials", ".", "getRemoteHostname", "(", ")", ";", "if", "(", "hostname", "!=", "null", ")", "filter", ".", "setToken", "(", "CLIENT_HOSTNAME_TOKEN", ",", "hostname", ")", ";", "// Add client address token", "String", "address", "=", "credentials", ".", "getRemoteAddress", "(", ")", ";", "if", "(", "address", "!=", "null", ")", "filter", ".", "setToken", "(", "CLIENT_ADDRESS_TOKEN", ",", "address", ")", ";", "// Add any tokens which do not require credentials", "addStandardTokens", "(", "filter", ")", ";", "}" ]
Adds tokens which are standardized by guacamole-ext to the given TokenFilter using the values from the given Credentials object. These standardized tokens include the current username (GUAC_USERNAME), password (GUAC_PASSWORD), and the server date and time (GUAC_DATE and GUAC_TIME respectively). If either the username or password are not set within the given credentials, the corresponding token(s) will remain unset. @param filter The TokenFilter to add standard tokens to. @param credentials The Credentials to use when populating the GUAC_USERNAME and GUAC_PASSWORD tokens.
[ "Adds", "tokens", "which", "are", "standardized", "by", "guacamole", "-", "ext", "to", "the", "given", "TokenFilter", "using", "the", "values", "from", "the", "given", "Credentials", "object", ".", "These", "standardized", "tokens", "include", "the", "current", "username", "(", "GUAC_USERNAME", ")", "password", "(", "GUAC_PASSWORD", ")", "and", "the", "server", "date", "and", "time", "(", "GUAC_DATE", "and", "GUAC_TIME", "respectively", ")", ".", "If", "either", "the", "username", "or", "password", "are", "not", "set", "within", "the", "given", "credentials", "the", "corresponding", "token", "(", "s", ")", "will", "remain", "unset", "." ]
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/guacamole-ext/src/main/java/org/apache/guacamole/token/StandardTokens.java#L120-L145
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java
CollectionNamingConfusion.visitMethod
@Override public void visitMethod(Method obj) { LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { LocalVariable[] lvs = lvt.getLocalVariableTable(); for (LocalVariable lv : lvs) { if (checkConfusedName(lv.getName(), lv.getSignature())) { bugReporter.reportBug(new BugInstance(this, BugType.CNC_COLLECTION_NAMING_CONFUSION.name(), NORMAL_PRIORITY).addClass(this) .addString(lv.getName()).addSourceLine(this.clsContext, this, lv.getStartPC())); } } } }
java
@Override public void visitMethod(Method obj) { LocalVariableTable lvt = obj.getLocalVariableTable(); if (lvt != null) { LocalVariable[] lvs = lvt.getLocalVariableTable(); for (LocalVariable lv : lvs) { if (checkConfusedName(lv.getName(), lv.getSignature())) { bugReporter.reportBug(new BugInstance(this, BugType.CNC_COLLECTION_NAMING_CONFUSION.name(), NORMAL_PRIORITY).addClass(this) .addString(lv.getName()).addSourceLine(this.clsContext, this, lv.getStartPC())); } } } }
[ "@", "Override", "public", "void", "visitMethod", "(", "Method", "obj", ")", "{", "LocalVariableTable", "lvt", "=", "obj", ".", "getLocalVariableTable", "(", ")", ";", "if", "(", "lvt", "!=", "null", ")", "{", "LocalVariable", "[", "]", "lvs", "=", "lvt", ".", "getLocalVariableTable", "(", ")", ";", "for", "(", "LocalVariable", "lv", ":", "lvs", ")", "{", "if", "(", "checkConfusedName", "(", "lv", ".", "getName", "(", ")", ",", "lv", ".", "getSignature", "(", ")", ")", ")", "{", "bugReporter", ".", "reportBug", "(", "new", "BugInstance", "(", "this", ",", "BugType", ".", "CNC_COLLECTION_NAMING_CONFUSION", ".", "name", "(", ")", ",", "NORMAL_PRIORITY", ")", ".", "addClass", "(", "this", ")", ".", "addString", "(", "lv", ".", "getName", "(", ")", ")", ".", "addSourceLine", "(", "this", ".", "clsContext", ",", "this", ",", "lv", ".", "getStartPC", "(", ")", ")", ")", ";", "}", "}", "}", "}" ]
overrides the visitor to look for local variables where the name has 'Map', 'Set', 'List' in it but the type of that field isn't that. note that this only is useful if compiled with debug labels. @param obj the currently parsed method
[ "overrides", "the", "visitor", "to", "look", "for", "local", "variables", "where", "the", "name", "has", "Map", "Set", "List", "in", "it", "but", "the", "type", "of", "that", "field", "isn", "t", "that", ".", "note", "that", "this", "only", "is", "useful", "if", "compiled", "with", "debug", "labels", "." ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/CollectionNamingConfusion.java#L112-L124
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.shareProjectWithGroup
public void shareProjectWithGroup(GitlabAccessLevel accessLevel, String expiration, GitlabGroup group, GitlabProject project) throws IOException { Query query = new Query() .append("group_id", group.getId().toString()) .append("group_access", String.valueOf(accessLevel.accessValue)) .appendIf("expires_at", expiration); String tailUrl = GitlabProject.URL + "/" + project.getId() + "/share" + query.toString(); dispatch().to(tailUrl, Void.class); }
java
public void shareProjectWithGroup(GitlabAccessLevel accessLevel, String expiration, GitlabGroup group, GitlabProject project) throws IOException { Query query = new Query() .append("group_id", group.getId().toString()) .append("group_access", String.valueOf(accessLevel.accessValue)) .appendIf("expires_at", expiration); String tailUrl = GitlabProject.URL + "/" + project.getId() + "/share" + query.toString(); dispatch().to(tailUrl, Void.class); }
[ "public", "void", "shareProjectWithGroup", "(", "GitlabAccessLevel", "accessLevel", ",", "String", "expiration", ",", "GitlabGroup", "group", ",", "GitlabProject", "project", ")", "throws", "IOException", "{", "Query", "query", "=", "new", "Query", "(", ")", ".", "append", "(", "\"group_id\"", ",", "group", ".", "getId", "(", ")", ".", "toString", "(", ")", ")", ".", "append", "(", "\"group_access\"", ",", "String", ".", "valueOf", "(", "accessLevel", ".", "accessValue", ")", ")", ".", "appendIf", "(", "\"expires_at\"", ",", "expiration", ")", ";", "String", "tailUrl", "=", "GitlabProject", ".", "URL", "+", "\"/\"", "+", "project", ".", "getId", "(", ")", "+", "\"/share\"", "+", "query", ".", "toString", "(", ")", ";", "dispatch", "(", ")", ".", "to", "(", "tailUrl", ",", "Void", ".", "class", ")", ";", "}" ]
Share a project with a group. @param accessLevel The permissions level to grant the group. @param group The group to share with. @param project The project to be shared. @param expiration Share expiration date in ISO 8601 format: 2016-09-26 or {@code null}. @throws IOException on gitlab api call error
[ "Share", "a", "project", "with", "a", "group", "." ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L3887-L3895
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDITimephasedWorkNormaliser.java
MSPDITimephasedWorkNormaliser.splitDays
private void splitDays(ProjectCalendar calendar, LinkedList<TimephasedWork> list) { LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>(); for (TimephasedWork assignment : list) { while (assignment != null) { Date startDay = DateHelper.getDayStartDate(assignment.getStart()); Date finishDay = DateHelper.getDayStartDate(assignment.getFinish()); // special case - when the finishday time is midnight, it's really the previous day... if (assignment.getFinish().getTime() == finishDay.getTime()) { finishDay = DateHelper.addDays(finishDay, -1); } if (startDay.getTime() == finishDay.getTime()) { result.add(assignment); break; } TimephasedWork[] split = splitFirstDay(calendar, assignment); if (split[0] != null) { result.add(split[0]); } assignment = split[1]; } } list.clear(); list.addAll(result); }
java
private void splitDays(ProjectCalendar calendar, LinkedList<TimephasedWork> list) { LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>(); for (TimephasedWork assignment : list) { while (assignment != null) { Date startDay = DateHelper.getDayStartDate(assignment.getStart()); Date finishDay = DateHelper.getDayStartDate(assignment.getFinish()); // special case - when the finishday time is midnight, it's really the previous day... if (assignment.getFinish().getTime() == finishDay.getTime()) { finishDay = DateHelper.addDays(finishDay, -1); } if (startDay.getTime() == finishDay.getTime()) { result.add(assignment); break; } TimephasedWork[] split = splitFirstDay(calendar, assignment); if (split[0] != null) { result.add(split[0]); } assignment = split[1]; } } list.clear(); list.addAll(result); }
[ "private", "void", "splitDays", "(", "ProjectCalendar", "calendar", ",", "LinkedList", "<", "TimephasedWork", ">", "list", ")", "{", "LinkedList", "<", "TimephasedWork", ">", "result", "=", "new", "LinkedList", "<", "TimephasedWork", ">", "(", ")", ";", "for", "(", "TimephasedWork", "assignment", ":", "list", ")", "{", "while", "(", "assignment", "!=", "null", ")", "{", "Date", "startDay", "=", "DateHelper", ".", "getDayStartDate", "(", "assignment", ".", "getStart", "(", ")", ")", ";", "Date", "finishDay", "=", "DateHelper", ".", "getDayStartDate", "(", "assignment", ".", "getFinish", "(", ")", ")", ";", "// special case - when the finishday time is midnight, it's really the previous day...", "if", "(", "assignment", ".", "getFinish", "(", ")", ".", "getTime", "(", ")", "==", "finishDay", ".", "getTime", "(", ")", ")", "{", "finishDay", "=", "DateHelper", ".", "addDays", "(", "finishDay", ",", "-", "1", ")", ";", "}", "if", "(", "startDay", ".", "getTime", "(", ")", "==", "finishDay", ".", "getTime", "(", ")", ")", "{", "result", ".", "add", "(", "assignment", ")", ";", "break", ";", "}", "TimephasedWork", "[", "]", "split", "=", "splitFirstDay", "(", "calendar", ",", "assignment", ")", ";", "if", "(", "split", "[", "0", "]", "!=", "null", ")", "{", "result", ".", "add", "(", "split", "[", "0", "]", ")", ";", "}", "assignment", "=", "split", "[", "1", "]", ";", "}", "}", "list", ".", "clear", "(", ")", ";", "list", ".", "addAll", "(", "result", ")", ";", "}" ]
This method breaks down spans of time into individual days. @param calendar current project calendar @param list list of assignment data
[ "This", "method", "breaks", "down", "spans", "of", "time", "into", "individual", "days", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDITimephasedWorkNormaliser.java#L81-L114
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getWvWAbilityInfo
public void getWvWAbilityInfo(int[] ids, Callback<List<WvWAbility>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getWvWAbilityInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getWvWAbilityInfo(int[] ids, Callback<List<WvWAbility>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getWvWAbilityInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getWvWAbilityInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "WvWAbility", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")", ")", ";", "gw2API", ".", "getWvWAbilityInfo", "(", "processIds", "(", "ids", ")", ",", "GuildWars2", ".", "lang", ".", "getValue", "(", ")", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on WvW abilities API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/abilities">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of WvW abilities id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see WvWAbility WvW abilities info
[ "For", "more", "info", "on", "WvW", "abilities", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "wvw", "/", "abilities", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2582-L2585
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/IdClassMetadata.java
IdClassMetadata.findConstructor
private MethodHandle findConstructor() { try { MethodHandle mh = MethodHandles.publicLookup().findConstructor(clazz, MethodType.methodType(void.class, getIdType())); return mh; } catch (NoSuchMethodException | IllegalAccessException exp) { String pattern = "Class %s requires a public constructor with one parameter of type %s"; String error = String.format(pattern, clazz.getName(), getIdType()); throw new EntityManagerException(error, exp); } }
java
private MethodHandle findConstructor() { try { MethodHandle mh = MethodHandles.publicLookup().findConstructor(clazz, MethodType.methodType(void.class, getIdType())); return mh; } catch (NoSuchMethodException | IllegalAccessException exp) { String pattern = "Class %s requires a public constructor with one parameter of type %s"; String error = String.format(pattern, clazz.getName(), getIdType()); throw new EntityManagerException(error, exp); } }
[ "private", "MethodHandle", "findConstructor", "(", ")", "{", "try", "{", "MethodHandle", "mh", "=", "MethodHandles", ".", "publicLookup", "(", ")", ".", "findConstructor", "(", "clazz", ",", "MethodType", ".", "methodType", "(", "void", ".", "class", ",", "getIdType", "(", ")", ")", ")", ";", "return", "mh", ";", "}", "catch", "(", "NoSuchMethodException", "|", "IllegalAccessException", "exp", ")", "{", "String", "pattern", "=", "\"Class %s requires a public constructor with one parameter of type %s\"", ";", "String", "error", "=", "String", ".", "format", "(", "pattern", ",", "clazz", ".", "getName", "(", ")", ",", "getIdType", "(", ")", ")", ";", "throw", "new", "EntityManagerException", "(", "error", ",", "exp", ")", ";", "}", "}" ]
Creates and returns the MethodHandle for the constructor. @return the MethodHandle for the constructor.
[ "Creates", "and", "returns", "the", "MethodHandle", "for", "the", "constructor", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/IdClassMetadata.java#L131-L141
xmlunit/xmlunit
xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java
DefaultComparisonFormatter.getFullFormattedXml
protected String getFullFormattedXml(final Node node, ComparisonType type, boolean formatXml) { StringBuilder sb = new StringBuilder(); final Node nodeToConvert; if (type == ComparisonType.CHILD_NODELIST_SEQUENCE) { nodeToConvert = node.getParentNode(); } else if (node instanceof Document) { Document doc = (Document) node; appendFullDocumentHeader(sb, doc); return sb.toString(); } else if (node instanceof DocumentType) { Document doc = node.getOwnerDocument(); appendFullDocumentHeader(sb, doc); return sb.toString(); } else if (node instanceof Attr) { nodeToConvert = ((Attr) node).getOwnerElement(); } else if (node instanceof org.w3c.dom.CharacterData) { // in case of a simple text node, show the parent TAGs: "<a>xy</a>" instead "xy". nodeToConvert = node.getParentNode(); } else { nodeToConvert = node; } sb.append(getFormattedNodeXml(nodeToConvert, formatXml)); return sb.toString().trim(); }
java
protected String getFullFormattedXml(final Node node, ComparisonType type, boolean formatXml) { StringBuilder sb = new StringBuilder(); final Node nodeToConvert; if (type == ComparisonType.CHILD_NODELIST_SEQUENCE) { nodeToConvert = node.getParentNode(); } else if (node instanceof Document) { Document doc = (Document) node; appendFullDocumentHeader(sb, doc); return sb.toString(); } else if (node instanceof DocumentType) { Document doc = node.getOwnerDocument(); appendFullDocumentHeader(sb, doc); return sb.toString(); } else if (node instanceof Attr) { nodeToConvert = ((Attr) node).getOwnerElement(); } else if (node instanceof org.w3c.dom.CharacterData) { // in case of a simple text node, show the parent TAGs: "<a>xy</a>" instead "xy". nodeToConvert = node.getParentNode(); } else { nodeToConvert = node; } sb.append(getFormattedNodeXml(nodeToConvert, formatXml)); return sb.toString().trim(); }
[ "protected", "String", "getFullFormattedXml", "(", "final", "Node", "node", ",", "ComparisonType", "type", ",", "boolean", "formatXml", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "final", "Node", "nodeToConvert", ";", "if", "(", "type", "==", "ComparisonType", ".", "CHILD_NODELIST_SEQUENCE", ")", "{", "nodeToConvert", "=", "node", ".", "getParentNode", "(", ")", ";", "}", "else", "if", "(", "node", "instanceof", "Document", ")", "{", "Document", "doc", "=", "(", "Document", ")", "node", ";", "appendFullDocumentHeader", "(", "sb", ",", "doc", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}", "else", "if", "(", "node", "instanceof", "DocumentType", ")", "{", "Document", "doc", "=", "node", ".", "getOwnerDocument", "(", ")", ";", "appendFullDocumentHeader", "(", "sb", ",", "doc", ")", ";", "return", "sb", ".", "toString", "(", ")", ";", "}", "else", "if", "(", "node", "instanceof", "Attr", ")", "{", "nodeToConvert", "=", "(", "(", "Attr", ")", "node", ")", ".", "getOwnerElement", "(", ")", ";", "}", "else", "if", "(", "node", "instanceof", "org", ".", "w3c", ".", "dom", ".", "CharacterData", ")", "{", "// in case of a simple text node, show the parent TAGs: \"<a>xy</a>\" instead \"xy\".", "nodeToConvert", "=", "node", ".", "getParentNode", "(", ")", ";", "}", "else", "{", "nodeToConvert", "=", "node", ";", "}", "sb", ".", "append", "(", "getFormattedNodeXml", "(", "nodeToConvert", ",", "formatXml", ")", ")", ";", "return", "sb", ".", "toString", "(", ")", ".", "trim", "(", ")", ";", "}" ]
Formats the node using a format suitable for the node type and comparison. <p>The implementation outputs the document prolog and start element for {@code Document} and {@code DocumentType} nodes and may elect to format the node's parent element rather than just the node depending on the node and comparison type. It delegates to {@link #appendFullDocumentHeader} or {@link #getFormattedNodeXml}.</p> @param node the node to format @param type the comparison type @param formatXml true if the Comparison was generated with {@link org.xmlunit.builder.DiffBuilder#ignoreWhitespace()} - this affects the indentation of the generated output @return the fomatted XML @since XMLUnit 2.4.0
[ "Formats", "the", "node", "using", "a", "format", "suitable", "for", "the", "node", "type", "and", "comparison", "." ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-core/src/main/java/org/xmlunit/diff/DefaultComparisonFormatter.java#L359-L382
OpenLiberty/open-liberty
dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java
AbstractMBeanIntrospector.getFormattedTabularData
@SuppressWarnings("unchecked") String getFormattedTabularData(TabularData td, String indent) { StringBuilder sb = new StringBuilder(); indent += INDENT; sb.append("{"); Collection<CompositeData> values = (Collection<CompositeData>) td.values(); int valuesRemaining = values.size(); for (CompositeData cd : values) { sb.append(getFormattedCompositeData(cd, indent)); if (--valuesRemaining > 0) { sb.append("\n").append(indent).append("}, {"); } } sb.append("}"); return String.valueOf(sb); }
java
@SuppressWarnings("unchecked") String getFormattedTabularData(TabularData td, String indent) { StringBuilder sb = new StringBuilder(); indent += INDENT; sb.append("{"); Collection<CompositeData> values = (Collection<CompositeData>) td.values(); int valuesRemaining = values.size(); for (CompositeData cd : values) { sb.append(getFormattedCompositeData(cd, indent)); if (--valuesRemaining > 0) { sb.append("\n").append(indent).append("}, {"); } } sb.append("}"); return String.valueOf(sb); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "String", "getFormattedTabularData", "(", "TabularData", "td", ",", "String", "indent", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "indent", "+=", "INDENT", ";", "sb", ".", "append", "(", "\"{\"", ")", ";", "Collection", "<", "CompositeData", ">", "values", "=", "(", "Collection", "<", "CompositeData", ">", ")", "td", ".", "values", "(", ")", ";", "int", "valuesRemaining", "=", "values", ".", "size", "(", ")", ";", "for", "(", "CompositeData", "cd", ":", "values", ")", "{", "sb", ".", "append", "(", "getFormattedCompositeData", "(", "cd", ",", "indent", ")", ")", ";", "if", "(", "--", "valuesRemaining", ">", "0", ")", "{", "sb", ".", "append", "(", "\"\\n\"", ")", ".", "append", "(", "indent", ")", ".", "append", "(", "\"}, {\"", ")", ";", "}", "}", "sb", ".", "append", "(", "\"}\"", ")", ";", "return", "String", ".", "valueOf", "(", "sb", ")", ";", "}" ]
Format an open MBean tabular data attribute. @param td the tabular data attribute @param indent the current indent level of the formatted report @return the formatted composite data
[ "Format", "an", "open", "MBean", "tabular", "data", "attribute", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.diagnostics/src/com/ibm/ws/diagnostics/AbstractMBeanIntrospector.java#L271-L288
spotify/async-google-pubsub-client
src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java
Pubsub.getSubscription
public PubsubFuture<Subscription> getSubscription(final String project, final String subscription) { return getSubscription(canonicalSubscription(project, subscription)); }
java
public PubsubFuture<Subscription> getSubscription(final String project, final String subscription) { return getSubscription(canonicalSubscription(project, subscription)); }
[ "public", "PubsubFuture", "<", "Subscription", ">", "getSubscription", "(", "final", "String", "project", ",", "final", "String", "subscription", ")", "{", "return", "getSubscription", "(", "canonicalSubscription", "(", "project", ",", "subscription", ")", ")", ";", "}" ]
Get a Pub/Sub subscription. @param project The Google Cloud project. @param subscription The name of the subscription to get. @return A future that is completed when this request is completed. The future will be completed with {@code null} if the response is 404.
[ "Get", "a", "Pub", "/", "Sub", "subscription", "." ]
train
https://github.com/spotify/async-google-pubsub-client/blob/7d021528fa5bc29be458e6f210fa62f59b71d004/src/main/java/com/spotify/google/cloud/pubsub/client/Pubsub.java#L432-L434
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.telephony_spare_new_GET
public OvhOrder telephony_spare_new_GET(String brand, String mondialRelayId, Long quantity, Long shippingContactId) throws IOException { String qPath = "/order/telephony/spare/new"; StringBuilder sb = path(qPath); query(sb, "brand", brand); query(sb, "mondialRelayId", mondialRelayId); query(sb, "quantity", quantity); query(sb, "shippingContactId", shippingContactId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder telephony_spare_new_GET(String brand, String mondialRelayId, Long quantity, Long shippingContactId) throws IOException { String qPath = "/order/telephony/spare/new"; StringBuilder sb = path(qPath); query(sb, "brand", brand); query(sb, "mondialRelayId", mondialRelayId); query(sb, "quantity", quantity); query(sb, "shippingContactId", shippingContactId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "telephony_spare_new_GET", "(", "String", "brand", ",", "String", "mondialRelayId", ",", "Long", "quantity", ",", "Long", "shippingContactId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/telephony/spare/new\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ",", "\"brand\"", ",", "brand", ")", ";", "query", "(", "sb", ",", "\"mondialRelayId\"", ",", "mondialRelayId", ")", ";", "query", "(", "sb", ",", "\"quantity\"", ",", "quantity", ")", ";", "query", "(", "sb", ",", "\"shippingContactId\"", ",", "shippingContactId", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/telephony/spare/new @param shippingContactId [required] Shipping contact information id from /me entry point @param brand [required] Spare phone brand model @param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping contact address information entry. @param quantity [required] Number of phone quantity
[ "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#L6064-L6073
kristiankime/FCollections
src/main/java/com/artclod/common/collect/ArrayFList.java
ArrayFList.mkString
public String mkString(String start, String sep, String end) { StringBuilder ret = new StringBuilder(start); for (int i = 0; i < inner.size(); i++) { ret.append(inner.get(i)); if (i != (inner.size() - 1)) { ret.append(sep); } } return ret.append(end).toString(); }
java
public String mkString(String start, String sep, String end) { StringBuilder ret = new StringBuilder(start); for (int i = 0; i < inner.size(); i++) { ret.append(inner.get(i)); if (i != (inner.size() - 1)) { ret.append(sep); } } return ret.append(end).toString(); }
[ "public", "String", "mkString", "(", "String", "start", ",", "String", "sep", ",", "String", "end", ")", "{", "StringBuilder", "ret", "=", "new", "StringBuilder", "(", "start", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "inner", ".", "size", "(", ")", ";", "i", "++", ")", "{", "ret", ".", "append", "(", "inner", ".", "get", "(", "i", ")", ")", ";", "if", "(", "i", "!=", "(", "inner", ".", "size", "(", ")", "-", "1", ")", ")", "{", "ret", ".", "append", "(", "sep", ")", ";", "}", "}", "return", "ret", ".", "append", "(", "end", ")", ".", "toString", "(", ")", ";", "}" ]
Looping without creating in iterator is faster so we reimplement some methods for speed
[ "Looping", "without", "creating", "in", "iterator", "is", "faster", "so", "we", "reimplement", "some", "methods", "for", "speed" ]
train
https://github.com/kristiankime/FCollections/blob/a72eccf3c91ab855b72bedb2f6c1c9ad1499710a/src/main/java/com/artclod/common/collect/ArrayFList.java#L109-L118
jdereg/java-util
src/main/java/com/cedarsoftware/util/UrlUtilities.java
UrlUtilities.getContentFromUrl
@Deprecated public static byte[] getContentFromUrl(String url, Map inCookies, Map outCookies, Proxy proxy, SSLSocketFactory factory, HostnameVerifier verifier) { return getContentFromUrl(url, inCookies, outCookies, true); }
java
@Deprecated public static byte[] getContentFromUrl(String url, Map inCookies, Map outCookies, Proxy proxy, SSLSocketFactory factory, HostnameVerifier verifier) { return getContentFromUrl(url, inCookies, outCookies, true); }
[ "@", "Deprecated", "public", "static", "byte", "[", "]", "getContentFromUrl", "(", "String", "url", ",", "Map", "inCookies", ",", "Map", "outCookies", ",", "Proxy", "proxy", ",", "SSLSocketFactory", "factory", ",", "HostnameVerifier", "verifier", ")", "{", "return", "getContentFromUrl", "(", "url", ",", "inCookies", ",", "outCookies", ",", "true", ")", ";", "}" ]
Get content from the passed in URL. This code will open a connection to the passed in server, fetch the requested content, and return it as a byte[]. Anyone using the proxy calls such as this one should have that managed by the jvm with -D parameters: http.proxyHost http.proxyPort (default: 80) http.nonProxyHosts (should always include localhost) https.proxyHost https.proxyPort Example: -Dhttp.proxyHost=proxy.example.org -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy.example.org -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=*.foo.com|localhost|*.td.afg @param url URL to hit @param proxy Proxy server to create connection (or null if not needed) @param factory custom SSLSocket factory (or null if not needed) @param verifier custom Hostnameverifier (or null if not needed) @return byte[] of content fetched from URL. @deprecated As of release 1.13.0, replaced by {@link #getContentFromUrl(String)}
[ "Get", "content", "from", "the", "passed", "in", "URL", ".", "This", "code", "will", "open", "a", "connection", "to", "the", "passed", "in", "server", "fetch", "the", "requested", "content", "and", "return", "it", "as", "a", "byte", "[]", "." ]
train
https://github.com/jdereg/java-util/blob/a2dce61aed16d6454ee575174dda1ba6bff0015c/src/main/java/com/cedarsoftware/util/UrlUtilities.java#L804-L808
JoeKerouac/utils
src/main/java/com/joe/utils/secure/impl/SymmetryCipher.java
SymmetryCipher.buildInstance
public static CipherUtil buildInstance(Algorithms algorithms, byte[] keySpec) { SecretKey key = KeyTools.buildKey(algorithms, keySpec); return new SymmetryCipher(algorithms, key); }
java
public static CipherUtil buildInstance(Algorithms algorithms, byte[] keySpec) { SecretKey key = KeyTools.buildKey(algorithms, keySpec); return new SymmetryCipher(algorithms, key); }
[ "public", "static", "CipherUtil", "buildInstance", "(", "Algorithms", "algorithms", ",", "byte", "[", "]", "keySpec", ")", "{", "SecretKey", "key", "=", "KeyTools", ".", "buildKey", "(", "algorithms", ",", "keySpec", ")", ";", "return", "new", "SymmetryCipher", "(", "algorithms", ",", "key", ")", ";", "}" ]
SymmetryCipher构造器 @param algorithms 算法 @param keySpec keySpec @return CipherUtil
[ "SymmetryCipher构造器" ]
train
https://github.com/JoeKerouac/utils/blob/45e1b2dc4d736956674fc4dcbe6cf84eaee69278/src/main/java/com/joe/utils/secure/impl/SymmetryCipher.java#L84-L87
validator/validator
src/nu/validator/xml/HtmlSerializer.java
HtmlSerializer.endElement
@Override public void endElement(String namespaceURI, String localName, String qName) throws SAXException { try { if (XHTML_NS.equals(namespaceURI) && Arrays.binarySearch(emptyElements, localName) < 0) { this.writer.write("</"); this.writer.write(localName); this.writer.write('>'); } } catch (IOException ioe) { throw (SAXException)new SAXException(ioe).initCause(ioe); } }
java
@Override public void endElement(String namespaceURI, String localName, String qName) throws SAXException { try { if (XHTML_NS.equals(namespaceURI) && Arrays.binarySearch(emptyElements, localName) < 0) { this.writer.write("</"); this.writer.write(localName); this.writer.write('>'); } } catch (IOException ioe) { throw (SAXException)new SAXException(ioe).initCause(ioe); } }
[ "@", "Override", "public", "void", "endElement", "(", "String", "namespaceURI", ",", "String", "localName", ",", "String", "qName", ")", "throws", "SAXException", "{", "try", "{", "if", "(", "XHTML_NS", ".", "equals", "(", "namespaceURI", ")", "&&", "Arrays", ".", "binarySearch", "(", "emptyElements", ",", "localName", ")", "<", "0", ")", "{", "this", ".", "writer", ".", "write", "(", "\"</\"", ")", ";", "this", ".", "writer", ".", "write", "(", "localName", ")", ";", "this", ".", "writer", ".", "write", "(", "'", "'", ")", ";", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "(", "SAXException", ")", "new", "SAXException", "(", "ioe", ")", ".", "initCause", "(", "ioe", ")", ";", "}", "}" ]
Writes an end tag if the element is an XHTML element and is not an empty element in HTML 4.01 Strict. @param namespaceURI the XML namespace @param localName the element name in the namespace @param qName ignored @throws SAXException if there are IO problems
[ "Writes", "an", "end", "tag", "if", "the", "element", "is", "an", "XHTML", "element", "and", "is", "not", "an", "empty", "element", "in", "HTML", "4", ".", "01", "Strict", "." ]
train
https://github.com/validator/validator/blob/c7b7f85b3a364df7d9944753fb5b2cd0ce642889/src/nu/validator/xml/HtmlSerializer.java#L205-L218
bushidowallet/bushido-java-service
bushido-service-lib/src/main/java/com/bccapi/bitlib/model/CompactInt.java
CompactInt.toBytes
public static byte[] toBytes(long value) { if (isLessThan(value, 253)) { return new byte[] { (byte) value }; } else if (isLessThan(value, 65536)) { return new byte[] { (byte) 253, (byte) (value), (byte) (value >> 8) }; } else if (isLessThan(value, 4294967295L)) { byte[] bytes = new byte[5]; bytes[0] = (byte) 254; BitUtils.uint32ToByteArrayLE(value, bytes, 1); return bytes; } else { byte[] bytes = new byte[9]; bytes[0] = (byte) 255; BitUtils.uint32ToByteArrayLE(value, bytes, 1); BitUtils.uint32ToByteArrayLE(value >>> 32, bytes, 5); return bytes; } }
java
public static byte[] toBytes(long value) { if (isLessThan(value, 253)) { return new byte[] { (byte) value }; } else if (isLessThan(value, 65536)) { return new byte[] { (byte) 253, (byte) (value), (byte) (value >> 8) }; } else if (isLessThan(value, 4294967295L)) { byte[] bytes = new byte[5]; bytes[0] = (byte) 254; BitUtils.uint32ToByteArrayLE(value, bytes, 1); return bytes; } else { byte[] bytes = new byte[9]; bytes[0] = (byte) 255; BitUtils.uint32ToByteArrayLE(value, bytes, 1); BitUtils.uint32ToByteArrayLE(value >>> 32, bytes, 5); return bytes; } }
[ "public", "static", "byte", "[", "]", "toBytes", "(", "long", "value", ")", "{", "if", "(", "isLessThan", "(", "value", ",", "253", ")", ")", "{", "return", "new", "byte", "[", "]", "{", "(", "byte", ")", "value", "}", ";", "}", "else", "if", "(", "isLessThan", "(", "value", ",", "65536", ")", ")", "{", "return", "new", "byte", "[", "]", "{", "(", "byte", ")", "253", ",", "(", "byte", ")", "(", "value", ")", ",", "(", "byte", ")", "(", "value", ">>", "8", ")", "}", ";", "}", "else", "if", "(", "isLessThan", "(", "value", ",", "4294967295L", ")", ")", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "5", "]", ";", "bytes", "[", "0", "]", "=", "(", "byte", ")", "254", ";", "BitUtils", ".", "uint32ToByteArrayLE", "(", "value", ",", "bytes", ",", "1", ")", ";", "return", "bytes", ";", "}", "else", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "9", "]", ";", "bytes", "[", "0", "]", "=", "(", "byte", ")", "255", ";", "BitUtils", ".", "uint32ToByteArrayLE", "(", "value", ",", "bytes", ",", "1", ")", ";", "BitUtils", ".", "uint32ToByteArrayLE", "(", "value", ">>>", "32", ",", "bytes", ",", "5", ")", ";", "return", "bytes", ";", "}", "}" ]
Turn a long value into an array of bytes containing the CompactInt representation. @param value The value to turn into an array of bytes. @return an array of bytes.
[ "Turn", "a", "long", "value", "into", "an", "array", "of", "bytes", "containing", "the", "CompactInt", "representation", "." ]
train
https://github.com/bushidowallet/bushido-java-service/blob/e1a0157527e57459b509718044d2df44084876a2/bushido-service-lib/src/main/java/com/bccapi/bitlib/model/CompactInt.java#L97-L114
Crab2died/Excel4J
src/main/java/com/github/crab2died/ExcelUtils.java
ExcelUtils.noTemplateSheet2Excel
public void noTemplateSheet2Excel(List<NoTemplateSheetWrapper> sheets, String targetPath) throws Excel4JException, IOException { try (OutputStream fos = new FileOutputStream(targetPath); Workbook workbook = exportExcelNoTemplateHandler(sheets, true)) { workbook.write(fos); } }
java
public void noTemplateSheet2Excel(List<NoTemplateSheetWrapper> sheets, String targetPath) throws Excel4JException, IOException { try (OutputStream fos = new FileOutputStream(targetPath); Workbook workbook = exportExcelNoTemplateHandler(sheets, true)) { workbook.write(fos); } }
[ "public", "void", "noTemplateSheet2Excel", "(", "List", "<", "NoTemplateSheetWrapper", ">", "sheets", ",", "String", "targetPath", ")", "throws", "Excel4JException", ",", "IOException", "{", "try", "(", "OutputStream", "fos", "=", "new", "FileOutputStream", "(", "targetPath", ")", ";", "Workbook", "workbook", "=", "exportExcelNoTemplateHandler", "(", "sheets", ",", "true", ")", ")", "{", "workbook", ".", "write", "(", "fos", ")", ";", "}", "}" ]
无模板、基于注解、多sheet数据 @param sheets 待导出sheet数据 @param targetPath 生成的Excel输出全路径 @throws Excel4JException 异常 @throws IOException 异常
[ "无模板、基于注解、多sheet数据" ]
train
https://github.com/Crab2died/Excel4J/blob/2ab0a3b8226a69ff868c3ead6e724f3a774f5f77/src/main/java/com/github/crab2died/ExcelUtils.java#L1128-L1135
revapi/revapi
revapi/src/main/java/org/revapi/AnalysisResult.java
AnalysisResult.fakeFailure
public static AnalysisResult fakeFailure(Exception failure) { return new AnalysisResult(failure, new Extensions(Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap())); }
java
public static AnalysisResult fakeFailure(Exception failure) { return new AnalysisResult(failure, new Extensions(Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap())); }
[ "public", "static", "AnalysisResult", "fakeFailure", "(", "Exception", "failure", ")", "{", "return", "new", "AnalysisResult", "(", "failure", ",", "new", "Extensions", "(", "Collections", ".", "emptyMap", "(", ")", ",", "Collections", ".", "emptyMap", "(", ")", ",", "Collections", ".", "emptyMap", "(", ")", ",", "Collections", ".", "emptyMap", "(", ")", ")", ")", ";", "}" ]
Similar to {@link #fakeSuccess()}, this returns a failed analysis result without the need to run any analysis. @param failure the failure to report @return a "fake" failed analysis result
[ "Similar", "to", "{", "@link", "#fakeSuccess", "()", "}", "this", "returns", "a", "failed", "analysis", "result", "without", "the", "need", "to", "run", "any", "analysis", "." ]
train
https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi/src/main/java/org/revapi/AnalysisResult.java#L69-L72
alkacon/opencms-core
src/org/opencms/relations/CmsCategoryService.java
CmsCategoryService.addResourceToCategory
public void addResourceToCategory(CmsObject cms, String resourceName, CmsCategory category) throws CmsException { if (readResourceCategories(cms, cms.readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION)).contains( category)) { return; } String sitePath = cms.getRequestContext().removeSiteRoot(category.getRootPath()); cms.addRelationToResource(resourceName, sitePath, CmsRelationType.CATEGORY.getName()); String parentCatPath = category.getPath(); // recursively add to higher level categories if (parentCatPath.endsWith("/")) { parentCatPath = parentCatPath.substring(0, parentCatPath.length() - 1); } if (parentCatPath.lastIndexOf('/') > 0) { addResourceToCategory(cms, resourceName, parentCatPath.substring(0, parentCatPath.lastIndexOf('/') + 1)); } }
java
public void addResourceToCategory(CmsObject cms, String resourceName, CmsCategory category) throws CmsException { if (readResourceCategories(cms, cms.readResource(resourceName, CmsResourceFilter.IGNORE_EXPIRATION)).contains( category)) { return; } String sitePath = cms.getRequestContext().removeSiteRoot(category.getRootPath()); cms.addRelationToResource(resourceName, sitePath, CmsRelationType.CATEGORY.getName()); String parentCatPath = category.getPath(); // recursively add to higher level categories if (parentCatPath.endsWith("/")) { parentCatPath = parentCatPath.substring(0, parentCatPath.length() - 1); } if (parentCatPath.lastIndexOf('/') > 0) { addResourceToCategory(cms, resourceName, parentCatPath.substring(0, parentCatPath.lastIndexOf('/') + 1)); } }
[ "public", "void", "addResourceToCategory", "(", "CmsObject", "cms", ",", "String", "resourceName", ",", "CmsCategory", "category", ")", "throws", "CmsException", "{", "if", "(", "readResourceCategories", "(", "cms", ",", "cms", ".", "readResource", "(", "resourceName", ",", "CmsResourceFilter", ".", "IGNORE_EXPIRATION", ")", ")", ".", "contains", "(", "category", ")", ")", "{", "return", ";", "}", "String", "sitePath", "=", "cms", ".", "getRequestContext", "(", ")", ".", "removeSiteRoot", "(", "category", ".", "getRootPath", "(", ")", ")", ";", "cms", ".", "addRelationToResource", "(", "resourceName", ",", "sitePath", ",", "CmsRelationType", ".", "CATEGORY", ".", "getName", "(", ")", ")", ";", "String", "parentCatPath", "=", "category", ".", "getPath", "(", ")", ";", "// recursively add to higher level categories", "if", "(", "parentCatPath", ".", "endsWith", "(", "\"/\"", ")", ")", "{", "parentCatPath", "=", "parentCatPath", ".", "substring", "(", "0", ",", "parentCatPath", ".", "length", "(", ")", "-", "1", ")", ";", "}", "if", "(", "parentCatPath", ".", "lastIndexOf", "(", "'", "'", ")", ">", "0", ")", "{", "addResourceToCategory", "(", "cms", ",", "resourceName", ",", "parentCatPath", ".", "substring", "(", "0", ",", "parentCatPath", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ")", ";", "}", "}" ]
Adds a resource identified by the given resource name to the given category.<p> The resource has to be locked.<p> @param cms the current cms context @param resourceName the site relative path to the resource to add @param category the category to add the resource to @throws CmsException if something goes wrong
[ "Adds", "a", "resource", "identified", "by", "the", "given", "resource", "name", "to", "the", "given", "category", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsCategoryService.java#L102-L119
apache/incubator-druid
sql/src/main/java/org/apache/druid/sql/calcite/expression/ExtractionFns.java
ExtractionFns.fromQueryGranularity
public static ExtractionFn fromQueryGranularity(final Granularity queryGranularity) { if (queryGranularity == null) { return null; } else { return new TimeFormatExtractionFn(null, null, null, queryGranularity, true); } }
java
public static ExtractionFn fromQueryGranularity(final Granularity queryGranularity) { if (queryGranularity == null) { return null; } else { return new TimeFormatExtractionFn(null, null, null, queryGranularity, true); } }
[ "public", "static", "ExtractionFn", "fromQueryGranularity", "(", "final", "Granularity", "queryGranularity", ")", "{", "if", "(", "queryGranularity", "==", "null", ")", "{", "return", "null", ";", "}", "else", "{", "return", "new", "TimeFormatExtractionFn", "(", "null", ",", "null", ",", "null", ",", "queryGranularity", ",", "true", ")", ";", "}", "}" ]
Converts a QueryGranularity to an extractionFn, if possible. This is the inverse of {@link #toQueryGranularity(ExtractionFn)}. This will always return a non-null extractionFn if queryGranularity is non-null. @param queryGranularity granularity @return extractionFn, or null if queryGranularity is null
[ "Converts", "a", "QueryGranularity", "to", "an", "extractionFn", "if", "possible", ".", "This", "is", "the", "inverse", "of", "{", "@link", "#toQueryGranularity", "(", "ExtractionFn", ")", "}", ".", "This", "will", "always", "return", "a", "non", "-", "null", "extractionFn", "if", "queryGranularity", "is", "non", "-", "null", "." ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/sql/src/main/java/org/apache/druid/sql/calcite/expression/ExtractionFns.java#L62-L69