repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
188
func_name
stringlengths
7
127
whole_func_string
stringlengths
77
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
77
3.91k
func_code_tokens
listlengths
20
745
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
477
split_name
stringclasses
1 value
func_code_url
stringlengths
111
288
ops4j/org.ops4j.base
ops4j-base-spi/src/main/java/org/ops4j/spi/SafeServiceLoader.java
SafeServiceLoader.parseLine
private void parseLine( List<String> names, String line ) { int commentPos = line.indexOf( '#' ); if( commentPos >= 0 ) { line = line.substring( 0, commentPos ); } line = line.trim(); if( !line.isEmpty() && !names.contains( line ) ) { names.add( line ); } }
java
private void parseLine( List<String> names, String line ) { int commentPos = line.indexOf( '#' ); if( commentPos >= 0 ) { line = line.substring( 0, commentPos ); } line = line.trim(); if( !line.isEmpty() && !names.contains( line ) ) { names.add( line ); } }
[ "private", "void", "parseLine", "(", "List", "<", "String", ">", "names", ",", "String", "line", ")", "{", "int", "commentPos", "=", "line", ".", "indexOf", "(", "'", "'", ")", ";", "if", "(", "commentPos", ">=", "0", ")", "{", "line", "=", "line",...
Parses a single line of a META-INF/services resources. If the line contains a class name, the name is added to the given list. @param names list of class names @param line line to be parsed
[ "Parses", "a", "single", "line", "of", "a", "META", "-", "INF", "/", "services", "resources", ".", "If", "the", "line", "contains", "a", "class", "name", "the", "name", "is", "added", "to", "the", "given", "list", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-spi/src/main/java/org/ops4j/spi/SafeServiceLoader.java#L180-L192
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_dynHost_login_login_GET
public OvhDynHostLogin zone_zoneName_dynHost_login_login_GET(String zoneName, String login) throws IOException { String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}"; StringBuilder sb = path(qPath, zoneName, login); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDynHostLogin.class); }
java
public OvhDynHostLogin zone_zoneName_dynHost_login_login_GET(String zoneName, String login) throws IOException { String qPath = "/domain/zone/{zoneName}/dynHost/login/{login}"; StringBuilder sb = path(qPath, zoneName, login); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhDynHostLogin.class); }
[ "public", "OvhDynHostLogin", "zone_zoneName_dynHost_login_login_GET", "(", "String", "zoneName", ",", "String", "login", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/dynHost/login/{login}\"", ";", "StringBuilder", "sb", "=", "path", ...
Get this object properties REST: GET /domain/zone/{zoneName}/dynHost/login/{login} @param zoneName [required] The internal name of your zone @param login [required] Login
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L438-L443
rhuss/jolokia
agent/core/src/main/java/org/jolokia/restrictor/policy/MBeanPolicyConfig.java
MBeanPolicyConfig.addValues
void addValues(ObjectName pOName, Set<String> pReadAttributes, Set<String> pWriteAttributes, Set<String> pOperations) { readAttributes.put(pOName,pReadAttributes); writeAttributes.put(pOName,pWriteAttributes); operations.put(pOName,pOperations); if (pOName.isPattern()) { addPattern(pOName); } }
java
void addValues(ObjectName pOName, Set<String> pReadAttributes, Set<String> pWriteAttributes, Set<String> pOperations) { readAttributes.put(pOName,pReadAttributes); writeAttributes.put(pOName,pWriteAttributes); operations.put(pOName,pOperations); if (pOName.isPattern()) { addPattern(pOName); } }
[ "void", "addValues", "(", "ObjectName", "pOName", ",", "Set", "<", "String", ">", "pReadAttributes", ",", "Set", "<", "String", ">", "pWriteAttributes", ",", "Set", "<", "String", ">", "pOperations", ")", "{", "readAttributes", ".", "put", "(", "pOName", "...
Add for a given MBean a set of read/write attributes and operations @param pOName MBean name (which should not be pattern) @param pReadAttributes read attributes @param pWriteAttributes write attributes @param pOperations operations
[ "Add", "for", "a", "given", "MBean", "a", "set", "of", "read", "/", "write", "attributes", "and", "operations" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/restrictor/policy/MBeanPolicyConfig.java#L57-L64
codeprimate-software/cp-elements
src/main/java/org/cp/elements/tools/io/ListFiles.java
ListFiles.listFiles
public void listFiles(File directory, String indent) { directory = validateDirectory(directory); indent = Optional.ofNullable(indent).filter(StringUtils::hasText).orElse(StringUtils.EMPTY_STRING); printDirectoryName(indent, directory); String directoryContentIndent = buildDirectoryContentIndent(indent); stream(sort(nullSafeArray(directory.listFiles(), File.class))).forEach(file -> { if (FileSystemUtils.isDirectory(file)) { listFiles(file, directoryContentIndent); } else { printFileName(directoryContentIndent, file); } }); }
java
public void listFiles(File directory, String indent) { directory = validateDirectory(directory); indent = Optional.ofNullable(indent).filter(StringUtils::hasText).orElse(StringUtils.EMPTY_STRING); printDirectoryName(indent, directory); String directoryContentIndent = buildDirectoryContentIndent(indent); stream(sort(nullSafeArray(directory.listFiles(), File.class))).forEach(file -> { if (FileSystemUtils.isDirectory(file)) { listFiles(file, directoryContentIndent); } else { printFileName(directoryContentIndent, file); } }); }
[ "public", "void", "listFiles", "(", "File", "directory", ",", "String", "indent", ")", "{", "directory", "=", "validateDirectory", "(", "directory", ")", ";", "indent", "=", "Optional", ".", "ofNullable", "(", "indent", ")", ".", "filter", "(", "StringUtils"...
Lists the contents of the given {@link File directory} displayed from the given {@link String indent}. @param directory {@link File} referring to the directory for which the contents will be listed. @param indent {@link String} containing the characters of the indent in which to begin the view of the directory hierarchy/tree. @throws IllegalArgumentException if the given {@link File} is not a valid directory. @see #validateDirectory(File) @see java.io.File
[ "Lists", "the", "contents", "of", "the", "given", "{", "@link", "File", "directory", "}", "displayed", "from", "the", "given", "{", "@link", "String", "indent", "}", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/tools/io/ListFiles.java#L158-L175
tango-controls/JTango
client/src/main/java/org/tango/client/database/Database.java
Database.setClassProperties
@Override public void setClassProperties(final String name, final Map<String, String[]> properties) throws DevFailed { cache.setClassProperties(name, properties); }
java
@Override public void setClassProperties(final String name, final Map<String, String[]> properties) throws DevFailed { cache.setClassProperties(name, properties); }
[ "@", "Override", "public", "void", "setClassProperties", "(", "final", "String", "name", ",", "final", "Map", "<", "String", ",", "String", "[", "]", ">", "properties", ")", "throws", "DevFailed", "{", "cache", ".", "setClassProperties", "(", "name", ",", ...
Set a tango class properties. (execute DbPutClassProperty on DB device) @param name The class name @param properties The properties names and values. @throws DevFailed
[ "Set", "a", "tango", "class", "properties", ".", "(", "execute", "DbPutClassProperty", "on", "DB", "device", ")" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/client/src/main/java/org/tango/client/database/Database.java#L173-L176
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/AddSarlNatureHandler.java
AddSarlNatureHandler.doConvert
protected void doConvert(IProject project, IProgressMonitor monitor) throws ExecutionException { monitor.setTaskName(MessageFormat.format(Messages.AddSarlNatureHandler_2, project.getName())); final SubMonitor mon = SubMonitor.convert(monitor, 2); if (this.configurator.canConfigure(project, Collections.emptySet(), mon.newChild(1))) { this.configurator.configure(project, Collections.emptySet(), mon.newChild(1)); } monitor.done(); }
java
protected void doConvert(IProject project, IProgressMonitor monitor) throws ExecutionException { monitor.setTaskName(MessageFormat.format(Messages.AddSarlNatureHandler_2, project.getName())); final SubMonitor mon = SubMonitor.convert(monitor, 2); if (this.configurator.canConfigure(project, Collections.emptySet(), mon.newChild(1))) { this.configurator.configure(project, Collections.emptySet(), mon.newChild(1)); } monitor.done(); }
[ "protected", "void", "doConvert", "(", "IProject", "project", ",", "IProgressMonitor", "monitor", ")", "throws", "ExecutionException", "{", "monitor", ".", "setTaskName", "(", "MessageFormat", ".", "format", "(", "Messages", ".", "AddSarlNatureHandler_2", ",", "proj...
Convert the given project. @param project the project to convert.. @param monitor the progress monitor. @throws ExecutionException if something going wrong.
[ "Convert", "the", "given", "project", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/natures/AddSarlNatureHandler.java#L116-L123
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubClassOfAxiomImpl_CustomFieldSerializer.java
OWLSubClassOfAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLSubClassOfAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLSubClassOfAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLSubClassOfAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}" ]
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLSubClassOfAxiomImpl_CustomFieldSerializer.java#L97-L100
opsbears/owc-dic
src/main/java/com/opsbears/webcomponents/dic/InjectorConfiguration.java
InjectorConfiguration.withScopedAlias
public <TAbstract, TImplementation extends TAbstract> InjectorConfiguration withScopedAlias( Class scope, Class<TAbstract> abstractDefinition, Class<TImplementation> implementationDefinition ) { if (abstractDefinition.equals(Injector.class)) { throw new DependencyInjectionFailedException("Cowardly refusing to define a global alias for Injector since that would lead to a Service Locator pattern. If you need the injector, please define it on a per-class or per-method basis."); } //noinspection unchecked return new InjectorConfiguration( scopes, definedClasses, factories, factoryClasses, sharedClasses, sharedInstances, aliases.withModified(scope, (value) -> value.with(abstractDefinition, implementationDefinition)), collectedAliases, namedParameterValues ); }
java
public <TAbstract, TImplementation extends TAbstract> InjectorConfiguration withScopedAlias( Class scope, Class<TAbstract> abstractDefinition, Class<TImplementation> implementationDefinition ) { if (abstractDefinition.equals(Injector.class)) { throw new DependencyInjectionFailedException("Cowardly refusing to define a global alias for Injector since that would lead to a Service Locator pattern. If you need the injector, please define it on a per-class or per-method basis."); } //noinspection unchecked return new InjectorConfiguration( scopes, definedClasses, factories, factoryClasses, sharedClasses, sharedInstances, aliases.withModified(scope, (value) -> value.with(abstractDefinition, implementationDefinition)), collectedAliases, namedParameterValues ); }
[ "public", "<", "TAbstract", ",", "TImplementation", "extends", "TAbstract", ">", "InjectorConfiguration", "withScopedAlias", "(", "Class", "scope", ",", "Class", "<", "TAbstract", ">", "abstractDefinition", ",", "Class", "<", "TImplementation", ">", "implementationDef...
Defines that instead of the class/interface passed in abstractDefinition, the class specified in implementationDefinition should be used. The specified replacement class must be defined as injectable. @param abstractDefinition the abstract class or interface to replace. @param implementationDefinition the implementation class @param <TAbstract> type of the abstract class/interface @param <TImplementation> type if the implementation @return a modified copy of this injection configuration.
[ "Defines", "that", "instead", "of", "the", "class", "/", "interface", "passed", "in", "abstractDefinition", "the", "class", "specified", "in", "implementationDefinition", "should", "be", "used", ".", "The", "specified", "replacement", "class", "must", "be", "defin...
train
https://github.com/opsbears/owc-dic/blob/eb254ca993b26c299292a01598b358a31f323566/src/main/java/com/opsbears/webcomponents/dic/InjectorConfiguration.java#L914-L933
headius/invokebinder
src/main/java/com/headius/invokebinder/Signature.java
Signature.insertArg
public Signature insertArg(String beforeName, String name, Class<?> type) { return insertArgs(argOffset(beforeName), new String[]{name}, new Class<?>[]{type}); }
java
public Signature insertArg(String beforeName, String name, Class<?> type) { return insertArgs(argOffset(beforeName), new String[]{name}, new Class<?>[]{type}); }
[ "public", "Signature", "insertArg", "(", "String", "beforeName", ",", "String", "name", ",", "Class", "<", "?", ">", "type", ")", "{", "return", "insertArgs", "(", "argOffset", "(", "beforeName", ")", ",", "new", "String", "[", "]", "{", "name", "}", "...
Insert an argument (name + type) into the signature before the argument with the given name. @param beforeName the name of the argument before which to insert @param name the name of the new argument @param type the type of the new argument @return a new signature with the added arguments
[ "Insert", "an", "argument", "(", "name", "+", "type", ")", "into", "the", "signature", "before", "the", "argument", "with", "the", "given", "name", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L263-L265
sebastiangraf/jSCSI
bundles/targetExtensions/scsi/src/org/jscsi/scsi/tasks/management/DefaultTaskSet.java
DefaultTaskSet.poll
public Task poll(long timeout, TimeUnit unit) throws InterruptedException { lock.lockInterruptibly(); try { // wait for the set to be not empty timeout = unit.toNanos(timeout); while (this.dormant.size() == 0) { _logger.trace("Task set empty; waiting for new task to be added"); if (timeout > 0) { // "notEmpty" is notified whenever a task is added to the set timeout = notEmpty.awaitNanos(timeout); } else { return null; } } // wait until the next task is not blocked while (this.blocked(this.dormant.get(0))) { _logger.trace("Next task blocked; waiting for other tasks to finish"); if (timeout > 0) { // "unblocked" is notified whenever a task is finished or a new task is // added to the set. We wait on that before checking if this task is still // blocked. timeout = unblocked.awaitNanos(timeout); } else { return null; // a timeout occurred } } TaskContainer container = this.dormant.remove(0); this.enabled.add(container); if (_logger.isDebugEnabled()) { _logger.debug("Enabling command: " + container.getCommand()); _logger.debug("Dormant task set: " + this.dormant); } return container; } finally { lock.unlock(); } }
java
public Task poll(long timeout, TimeUnit unit) throws InterruptedException { lock.lockInterruptibly(); try { // wait for the set to be not empty timeout = unit.toNanos(timeout); while (this.dormant.size() == 0) { _logger.trace("Task set empty; waiting for new task to be added"); if (timeout > 0) { // "notEmpty" is notified whenever a task is added to the set timeout = notEmpty.awaitNanos(timeout); } else { return null; } } // wait until the next task is not blocked while (this.blocked(this.dormant.get(0))) { _logger.trace("Next task blocked; waiting for other tasks to finish"); if (timeout > 0) { // "unblocked" is notified whenever a task is finished or a new task is // added to the set. We wait on that before checking if this task is still // blocked. timeout = unblocked.awaitNanos(timeout); } else { return null; // a timeout occurred } } TaskContainer container = this.dormant.remove(0); this.enabled.add(container); if (_logger.isDebugEnabled()) { _logger.debug("Enabling command: " + container.getCommand()); _logger.debug("Dormant task set: " + this.dormant); } return container; } finally { lock.unlock(); } }
[ "public", "Task", "poll", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "lock", ".", "lockInterruptibly", "(", ")", ";", "try", "{", "// wait for the set to be not empty\r", "timeout", "=", "unit", ".", "toNanos", "...
Retrieves and removes the task at the head of the queue. Blocks on both an empty set and all blocking boundaries specified in SAM-2. <p> The maximum wait time is twice the timeout. This occurs because first we wait for the set to be not empty, then we wait for the task to be unblocked.
[ "Retrieves", "and", "removes", "the", "task", "at", "the", "head", "of", "the", "queue", ".", "Blocks", "on", "both", "an", "empty", "set", "and", "all", "blocking", "boundaries", "specified", "in", "SAM", "-", "2", ".", "<p", ">", "The", "maximum", "w...
train
https://github.com/sebastiangraf/jSCSI/blob/6169bfe73f0b15de7d6485453555389e782ae888/bundles/targetExtensions/scsi/src/org/jscsi/scsi/tasks/management/DefaultTaskSet.java#L350-L404
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java
StructureIO.getBiologicalAssembly
public static Structure getBiologicalAssembly(String pdbId, int biolAssemblyNr) throws IOException, StructureException { return getBiologicalAssembly(pdbId, biolAssemblyNr, AtomCache.DEFAULT_BIOASSEMBLY_STYLE); }
java
public static Structure getBiologicalAssembly(String pdbId, int biolAssemblyNr) throws IOException, StructureException { return getBiologicalAssembly(pdbId, biolAssemblyNr, AtomCache.DEFAULT_BIOASSEMBLY_STYLE); }
[ "public", "static", "Structure", "getBiologicalAssembly", "(", "String", "pdbId", ",", "int", "biolAssemblyNr", ")", "throws", "IOException", ",", "StructureException", "{", "return", "getBiologicalAssembly", "(", "pdbId", ",", "biolAssemblyNr", ",", "AtomCache", ".",...
Returns the biological assembly for the given PDB id and bioassembly identifier, using multiModel={@value AtomCache#DEFAULT_BIOASSEMBLY_STYLE} @param pdbId @param biolAssemblyNr - the ith biological assembly that is available for a PDB ID (we start counting at 1, 0 represents the asym unit). @return a Structure object or null if that assembly is not available @throws StructureException if there is no bioassembly available for given biolAssemblyNr or some other problems encountered while loading it @throws IOException
[ "Returns", "the", "biological", "assembly", "for", "the", "given", "PDB", "id", "and", "bioassembly", "identifier", "using", "multiModel", "=", "{" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureIO.java#L216-L218
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java
ToUnknownStream.endElement
public void endElement(String namespaceURI, String localName, String qName) throws SAXException { if (m_firstTagNotEmitted) { flush(); if (namespaceURI == null && m_firstElementURI != null) namespaceURI = m_firstElementURI; if (localName == null && m_firstElementLocalName != null) localName = m_firstElementLocalName; } m_handler.endElement(namespaceURI, localName, qName); }
java
public void endElement(String namespaceURI, String localName, String qName) throws SAXException { if (m_firstTagNotEmitted) { flush(); if (namespaceURI == null && m_firstElementURI != null) namespaceURI = m_firstElementURI; if (localName == null && m_firstElementLocalName != null) localName = m_firstElementLocalName; } m_handler.endElement(namespaceURI, localName, qName); }
[ "public", "void", "endElement", "(", "String", "namespaceURI", ",", "String", "localName", ",", "String", "qName", ")", "throws", "SAXException", "{", "if", "(", "m_firstTagNotEmitted", ")", "{", "flush", "(", ")", ";", "if", "(", "namespaceURI", "==", "null...
Pass the call on to the underlying handler @see org.xml.sax.ContentHandler#endElement(String, String, String)
[ "Pass", "the", "call", "on", "to", "the", "underlying", "handler" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java#L809-L824
RestComm/sip-servlets
sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipFactoryImpl.java
SipFactoryImpl.validateCreation
private static void validateCreation(String method, SipApplicationSession app) { if (method.equals(Request.ACK)) { throw new IllegalArgumentException( "Wrong method to create request with[" + Request.ACK + "]!"); } if (method.equals(Request.PRACK)) { throw new IllegalArgumentException( "Wrong method to create request with[" + Request.PRACK + "]!"); } if (method.equals(Request.CANCEL)) { throw new IllegalArgumentException( "Wrong method to create request with[" + Request.CANCEL + "]!"); } if (!((MobicentsSipApplicationSession)app).isValidInternal()) { throw new IllegalArgumentException( "Cant associate request with invalidaded sip session application!"); } }
java
private static void validateCreation(String method, SipApplicationSession app) { if (method.equals(Request.ACK)) { throw new IllegalArgumentException( "Wrong method to create request with[" + Request.ACK + "]!"); } if (method.equals(Request.PRACK)) { throw new IllegalArgumentException( "Wrong method to create request with[" + Request.PRACK + "]!"); } if (method.equals(Request.CANCEL)) { throw new IllegalArgumentException( "Wrong method to create request with[" + Request.CANCEL + "]!"); } if (!((MobicentsSipApplicationSession)app).isValidInternal()) { throw new IllegalArgumentException( "Cant associate request with invalidaded sip session application!"); } }
[ "private", "static", "void", "validateCreation", "(", "String", "method", ",", "SipApplicationSession", "app", ")", "{", "if", "(", "method", ".", "equals", "(", "Request", ".", "ACK", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Wrong me...
Does basic check for illegal methods, wrong state, if it finds, it throws exception
[ "Does", "basic", "check", "for", "illegal", "methods", "wrong", "state", "if", "it", "finds", "it", "throws", "exception" ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-impl/src/main/java/org/mobicents/servlet/sip/message/SipFactoryImpl.java#L631-L651
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java
DefaultImageFormatChecker.isIcoHeader
private static boolean isIcoHeader(final byte[] imageHeaderBytes, final int headerSize) { if (headerSize < ICO_HEADER.length) { return false; } return ImageFormatCheckerUtils.startsWithPattern(imageHeaderBytes, ICO_HEADER); }
java
private static boolean isIcoHeader(final byte[] imageHeaderBytes, final int headerSize) { if (headerSize < ICO_HEADER.length) { return false; } return ImageFormatCheckerUtils.startsWithPattern(imageHeaderBytes, ICO_HEADER); }
[ "private", "static", "boolean", "isIcoHeader", "(", "final", "byte", "[", "]", "imageHeaderBytes", ",", "final", "int", "headerSize", ")", "{", "if", "(", "headerSize", "<", "ICO_HEADER", ".", "length", ")", "{", "return", "false", ";", "}", "return", "Ima...
Checks if first headerSize bytes of imageHeaderBytes constitute a valid header for a ico image. Details on ICO header can be found <a href="https://en.wikipedia.org/wiki/ICO_(file_format)"> </a> @param imageHeaderBytes @param headerSize @return true if imageHeaderBytes is a valid header for a ico image
[ "Checks", "if", "first", "headerSize", "bytes", "of", "imageHeaderBytes", "constitute", "a", "valid", "header", "for", "a", "ico", "image", ".", "Details", "on", "ICO", "header", "can", "be", "found", "<a", "href", "=", "https", ":", "//", "en", ".", "wi...
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageformat/DefaultImageFormatChecker.java#L234-L239
before/uadetector
modules/uadetector-core/src/main/java/net/sf/uadetector/VersionParser.java
VersionParser.parseVersion
public static VersionNumber parseVersion(@Nonnull final String version) { Check.notNull(version, "version"); VersionNumber result = new VersionNumber(new ArrayList<String>(0), version); final Matcher matcher = VERSIONSTRING.matcher(version); if (matcher.find()) { final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\.")); final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher .group(EXTENSION_INDEX)); result = new VersionNumber(groups, extension); } return result; }
java
public static VersionNumber parseVersion(@Nonnull final String version) { Check.notNull(version, "version"); VersionNumber result = new VersionNumber(new ArrayList<String>(0), version); final Matcher matcher = VERSIONSTRING.matcher(version); if (matcher.find()) { final List<String> groups = Arrays.asList(matcher.group(MAJOR_INDEX).split("\\.")); final String extension = matcher.group(EXTENSION_INDEX) == null ? VersionNumber.EMPTY_EXTENSION : trimRight(matcher .group(EXTENSION_INDEX)); result = new VersionNumber(groups, extension); } return result; }
[ "public", "static", "VersionNumber", "parseVersion", "(", "@", "Nonnull", "final", "String", "version", ")", "{", "Check", ".", "notNull", "(", "version", ",", "\"version\"", ")", ";", "VersionNumber", "result", "=", "new", "VersionNumber", "(", "new", "ArrayL...
Interprets a string with version information. The first found group will be taken and processed. @param version version as string @return an object of {@code VersionNumber}, never {@code null}
[ "Interprets", "a", "string", "with", "version", "information", ".", "The", "first", "found", "group", "will", "be", "taken", "and", "processed", "." ]
train
https://github.com/before/uadetector/blob/215fb652723c52866572cff885f52a3fe67b9db5/modules/uadetector-core/src/main/java/net/sf/uadetector/VersionParser.java#L346-L359
alkacon/opencms-core
src-modules/org/opencms/workplace/commons/CmsLock.java
CmsLock.performSingleResourceOperation
protected void performSingleResourceOperation(String resourceName, int dialogAction) throws CmsException { // store original name to use for lock action String originalResourceName = resourceName; CmsResource res = getCms().readResource(resourceName, CmsResourceFilter.ALL); if (res.isFolder() && !resourceName.endsWith("/")) { resourceName += "/"; } org.opencms.lock.CmsLock lock = getCms().getLock(res); // perform action depending on dialog uri switch (dialogAction) { case TYPE_LOCKCHANGE: case TYPE_LOCK: if (lock.isNullLock()) { getCms().lockResource(originalResourceName); } else if (!lock.isDirectlyOwnedInProjectBy(getCms())) { getCms().changeLock(resourceName); } break; case TYPE_UNLOCK: default: if (lock.isNullLock()) { break; } if (lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) { getCms().unlockResource(resourceName); } } }
java
protected void performSingleResourceOperation(String resourceName, int dialogAction) throws CmsException { // store original name to use for lock action String originalResourceName = resourceName; CmsResource res = getCms().readResource(resourceName, CmsResourceFilter.ALL); if (res.isFolder() && !resourceName.endsWith("/")) { resourceName += "/"; } org.opencms.lock.CmsLock lock = getCms().getLock(res); // perform action depending on dialog uri switch (dialogAction) { case TYPE_LOCKCHANGE: case TYPE_LOCK: if (lock.isNullLock()) { getCms().lockResource(originalResourceName); } else if (!lock.isDirectlyOwnedInProjectBy(getCms())) { getCms().changeLock(resourceName); } break; case TYPE_UNLOCK: default: if (lock.isNullLock()) { break; } if (lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) { getCms().unlockResource(resourceName); } } }
[ "protected", "void", "performSingleResourceOperation", "(", "String", "resourceName", ",", "int", "dialogAction", ")", "throws", "CmsException", "{", "// store original name to use for lock action", "String", "originalResourceName", "=", "resourceName", ";", "CmsResource", "r...
Performs the lock state operation on a single resource.<p> @param resourceName the resource name to perform the operation on @param dialogAction the lock action: lock, unlock or change lock @throws CmsException if the operation fails
[ "Performs", "the", "lock", "state", "operation", "on", "a", "single", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/commons/CmsLock.java#L975-L1003
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/SoftDeleteDetailHandler.java
SoftDeleteDetailHandler.init
public void init(Record record, BaseField fldDeleteFlag, Record recDetail) { m_fldDeleteFlag = fldDeleteFlag; m_recDetail = recDetail; super.init(record); }
java
public void init(Record record, BaseField fldDeleteFlag, Record recDetail) { m_fldDeleteFlag = fldDeleteFlag; m_recDetail = recDetail; super.init(record); }
[ "public", "void", "init", "(", "Record", "record", ",", "BaseField", "fldDeleteFlag", ",", "Record", "recDetail", ")", "{", "m_fldDeleteFlag", "=", "fldDeleteFlag", ";", "m_recDetail", "=", "recDetail", ";", "super", ".", "init", "(", "record", ")", ";", "}"...
Constructor. @param record My owner (usually passed as null, and set on addListener in setOwner()).
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/SoftDeleteDetailHandler.java#L57-L62
matthewhorridge/mdock
src/main/java/org/coode/mdock/SplitterNode.java
SplitterNode.insertNodeAt
public void insertNodeAt(Node insert, int index, double split) { addChild(insert, index, split); notifyStateChange(); }
java
public void insertNodeAt(Node insert, int index, double split) { addChild(insert, index, split); notifyStateChange(); }
[ "public", "void", "insertNodeAt", "(", "Node", "insert", ",", "int", "index", ",", "double", "split", ")", "{", "addChild", "(", "insert", ",", "index", ",", "split", ")", ";", "notifyStateChange", "(", ")", ";", "}" ]
Inserts a node after (right of or bottom of) a given node by splitting the inserted node with the given node. @param insert The node to be inserted. @param index The index @param split The split
[ "Inserts", "a", "node", "after", "(", "right", "of", "or", "bottom", "of", ")", "a", "given", "node", "by", "splitting", "the", "inserted", "node", "with", "the", "given", "node", "." ]
train
https://github.com/matthewhorridge/mdock/blob/37839a56f30bdb73d56d82c4d1afe548d66b404b/src/main/java/org/coode/mdock/SplitterNode.java#L303-L306
facebookarchive/hadoop-20
src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java
ResourceTracker.updateTrackerAddr
public void updateTrackerAddr(String trackerName, InetAddress addr) { synchronized (lockObject) { trackerAddress.put(trackerName, addr); } }
java
public void updateTrackerAddr(String trackerName, InetAddress addr) { synchronized (lockObject) { trackerAddress.put(trackerName, addr); } }
[ "public", "void", "updateTrackerAddr", "(", "String", "trackerName", ",", "InetAddress", "addr", ")", "{", "synchronized", "(", "lockObject", ")", "{", "trackerAddress", ".", "put", "(", "trackerName", ",", "addr", ")", ";", "}", "}" ]
Updates mapping between tracker names and adresses @param trackerName name of tracker @param addr address of the tracker
[ "Updates", "mapping", "between", "tracker", "names", "and", "adresses" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/ResourceTracker.java#L347-L351
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/ArtFinder.java
ArtFinder.updateArt
private void updateArt(TrackMetadataUpdate update, AlbumArt art) { hotCache.put(DeckReference.getDeckReference(update.player, 0), art); // Main deck if (update.metadata.getCueList() != null) { // Update the cache with any hot cues in this track as well for (CueList.Entry entry : update.metadata.getCueList().entries) { if (entry.hotCueNumber != 0) { hotCache.put(DeckReference.getDeckReference(update.player, entry.hotCueNumber), art); } } } deliverAlbumArtUpdate(update.player, art); }
java
private void updateArt(TrackMetadataUpdate update, AlbumArt art) { hotCache.put(DeckReference.getDeckReference(update.player, 0), art); // Main deck if (update.metadata.getCueList() != null) { // Update the cache with any hot cues in this track as well for (CueList.Entry entry : update.metadata.getCueList().entries) { if (entry.hotCueNumber != 0) { hotCache.put(DeckReference.getDeckReference(update.player, entry.hotCueNumber), art); } } } deliverAlbumArtUpdate(update.player, art); }
[ "private", "void", "updateArt", "(", "TrackMetadataUpdate", "update", ",", "AlbumArt", "art", ")", "{", "hotCache", ".", "put", "(", "DeckReference", ".", "getDeckReference", "(", "update", ".", "player", ",", "0", ")", ",", "art", ")", ";", "// Main deck", ...
We have obtained album art for a device, so store it and alert any listeners. @param update the update which caused us to retrieve this art @param art the album art which we retrieved
[ "We", "have", "obtained", "album", "art", "for", "a", "device", "so", "store", "it", "and", "alert", "any", "listeners", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/ArtFinder.java#L177-L187
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/io/IOUtils.java
IOUtils.slurpReader
public static String slurpReader(Reader reader) { BufferedReader r = new BufferedReader(reader); StringBuilder buff = new StringBuilder(); try { char[] chars = new char[SLURPBUFFSIZE]; while (true) { int amountRead = r.read(chars, 0, SLURPBUFFSIZE); if (amountRead < 0) { break; } buff.append(chars, 0, amountRead); } r.close(); } catch (Exception e) { throw new RuntimeIOException("slurpReader IO problem", e); } return buff.toString(); }
java
public static String slurpReader(Reader reader) { BufferedReader r = new BufferedReader(reader); StringBuilder buff = new StringBuilder(); try { char[] chars = new char[SLURPBUFFSIZE]; while (true) { int amountRead = r.read(chars, 0, SLURPBUFFSIZE); if (amountRead < 0) { break; } buff.append(chars, 0, amountRead); } r.close(); } catch (Exception e) { throw new RuntimeIOException("slurpReader IO problem", e); } return buff.toString(); }
[ "public", "static", "String", "slurpReader", "(", "Reader", "reader", ")", "{", "BufferedReader", "r", "=", "new", "BufferedReader", "(", "reader", ")", ";", "StringBuilder", "buff", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "char", "[", "]",...
Returns all the text from the given Reader. @return The text in the file.
[ "Returns", "all", "the", "text", "from", "the", "given", "Reader", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/io/IOUtils.java#L903-L920
landawn/AbacusUtil
src/com/landawn/abacus/util/N.java
N.distinct
public static <T> List<T> distinct(final Collection<? extends T> c) { if (N.isNullOrEmpty(c)) { return new ArrayList<>(); } return distinct(c, 0, c.size()); }
java
public static <T> List<T> distinct(final Collection<? extends T> c) { if (N.isNullOrEmpty(c)) { return new ArrayList<>(); } return distinct(c, 0, c.size()); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "distinct", "(", "final", "Collection", "<", "?", "extends", "T", ">", "c", ")", "{", "if", "(", "N", ".", "isNullOrEmpty", "(", "c", ")", ")", "{", "return", "new", "ArrayList", "<>", "("...
Mostly it's designed for one-step operation to complete the operation in one step. <code>java.util.stream.Stream</code> is preferred for multiple phases operation. @param c @return
[ "Mostly", "it", "s", "designed", "for", "one", "-", "step", "operation", "to", "complete", "the", "operation", "in", "one", "step", ".", "<code", ">", "java", ".", "util", ".", "stream", ".", "Stream<", "/", "code", ">", "is", "preferred", "for", "mult...
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/N.java#L17953-L17959
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java
CommerceWarehouseItemPersistenceImpl.findAll
@Override public List<CommerceWarehouseItem> findAll(int start, int end) { return findAll(start, end, null); }
java
@Override public List<CommerceWarehouseItem> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceWarehouseItem", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce warehouse items. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceWarehouseItemModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param start the lower bound of the range of commerce warehouse items @param end the upper bound of the range of commerce warehouse items (not inclusive) @return the range of commerce warehouse items
[ "Returns", "a", "range", "of", "all", "the", "commerce", "warehouse", "items", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java#L2078-L2081
JadiraOrg/jadira
bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java
BasicBinder.registerUnmarshaller
public final <S, T> void registerUnmarshaller(Class<S> source, Class<T> target, FromUnmarshaller<S, T> converter) { Class<? extends Annotation> scope = matchImplementationToScope(converter.getClass()); registerUnmarshaller(new ConverterKey<S,T>(source, target, scope == null ? DefaultBinding.class : scope), converter); }
java
public final <S, T> void registerUnmarshaller(Class<S> source, Class<T> target, FromUnmarshaller<S, T> converter) { Class<? extends Annotation> scope = matchImplementationToScope(converter.getClass()); registerUnmarshaller(new ConverterKey<S,T>(source, target, scope == null ? DefaultBinding.class : scope), converter); }
[ "public", "final", "<", "S", ",", "T", ">", "void", "registerUnmarshaller", "(", "Class", "<", "S", ">", "source", ",", "Class", "<", "T", ">", "target", ",", "FromUnmarshaller", "<", "S", ",", "T", ">", "converter", ")", "{", "Class", "<", "?", "e...
Register an UnMarshaller with the given source and target class. The unmarshaller is used as follows: Instances of the source can be marshalled into the target class. @param source The source (input) class @param target The target (output) class @param converter The FromUnmarshaller to be registered
[ "Register", "an", "UnMarshaller", "with", "the", "given", "source", "and", "target", "class", ".", "The", "unmarshaller", "is", "used", "as", "follows", ":", "Instances", "of", "the", "source", "can", "be", "marshalled", "into", "the", "target", "class", "."...
train
https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/bindings/src/main/java/org/jadira/bindings/core/binder/BasicBinder.java#L556-L559
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuTexRefSetMipmapLevelClamp
public static int cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp) { return checkResult(cuTexRefSetMipmapLevelClampNative(hTexRef, minMipmapLevelClamp, maxMipmapLevelClamp)); }
java
public static int cuTexRefSetMipmapLevelClamp(CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp) { return checkResult(cuTexRefSetMipmapLevelClampNative(hTexRef, minMipmapLevelClamp, maxMipmapLevelClamp)); }
[ "public", "static", "int", "cuTexRefSetMipmapLevelClamp", "(", "CUtexref", "hTexRef", ",", "float", "minMipmapLevelClamp", ",", "float", "maxMipmapLevelClamp", ")", "{", "return", "checkResult", "(", "cuTexRefSetMipmapLevelClampNative", "(", "hTexRef", ",", "minMipmapLeve...
Sets the mipmap min/max mipmap level clamps for a texture reference. <pre> CUresult cuTexRefSetMipmapLevelClamp ( CUtexref hTexRef, float minMipmapLevelClamp, float maxMipmapLevelClamp ) </pre> <div> <p>Sets the mipmap min/max mipmap level clamps for a texture reference. Specifies the min/max mipmap level clamps, <tt>minMipmapLevelClamp</tt> and <tt>maxMipmapLevelClamp</tt> respectively, to be used when reading memory through the texture reference <tt>hTexRef</tt>. </p> <p>Note that this call has no effect if <tt>hTexRef</tt> is not bound to a mipmapped array. </p> </div> @param hTexRef Texture reference @param minMipmapLevelClamp Mipmap min level clamp @param maxMipmapLevelClamp Mipmap max level clamp @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuTexRefSetAddress @see JCudaDriver#cuTexRefSetAddress2D @see JCudaDriver#cuTexRefSetAddressMode @see JCudaDriver#cuTexRefSetArray @see JCudaDriver#cuTexRefSetFlags @see JCudaDriver#cuTexRefSetFormat @see JCudaDriver#cuTexRefGetAddress @see JCudaDriver#cuTexRefGetAddressMode @see JCudaDriver#cuTexRefGetArray @see JCudaDriver#cuTexRefGetFilterMode @see JCudaDriver#cuTexRefGetFlags @see JCudaDriver#cuTexRefGetFormat
[ "Sets", "the", "mipmap", "min", "/", "max", "mipmap", "level", "clamps", "for", "a", "texture", "reference", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L10206-L10209
kotcrab/vis-ui
ui/src/main/java/com/kotcrab/vis/ui/util/ToastManager.java
ToastManager.show
public void show (ToastTable toastTable, float timeSec) { Toast toast = toastTable.getToast(); if (toast != null) { show(toast, timeSec); } else { show(new Toast(toastTable), timeSec); } }
java
public void show (ToastTable toastTable, float timeSec) { Toast toast = toastTable.getToast(); if (toast != null) { show(toast, timeSec); } else { show(new Toast(toastTable), timeSec); } }
[ "public", "void", "show", "(", "ToastTable", "toastTable", ",", "float", "timeSec", ")", "{", "Toast", "toast", "=", "toastTable", ".", "getToast", "(", ")", ";", "if", "(", "toast", "!=", "null", ")", "{", "show", "(", "toast", ",", "timeSec", ")", ...
Displays toast with provided table as toast's content. If this toast was already displayed then it reuses stored {@link Toast} instance. Toast will be displayed for given amount of seconds.
[ "Displays", "toast", "with", "provided", "table", "as", "toast", "s", "content", ".", "If", "this", "toast", "was", "already", "displayed", "then", "it", "reuses", "stored", "{" ]
train
https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/ToastManager.java#L111-L118
google/closure-templates
java/src/com/google/template/soy/jbcsrc/ExpressionToSoyValueProviderCompiler.java
ExpressionToSoyValueProviderCompiler.compileAvoidingDetaches
Optional<Expression> compileAvoidingDetaches(ExprNode node) { checkNotNull(node); return new CompilerVisitor(variables, varManager, exprCompiler, null).exec(node); }
java
Optional<Expression> compileAvoidingDetaches(ExprNode node) { checkNotNull(node); return new CompilerVisitor(variables, varManager, exprCompiler, null).exec(node); }
[ "Optional", "<", "Expression", ">", "compileAvoidingDetaches", "(", "ExprNode", "node", ")", "{", "checkNotNull", "(", "node", ")", ";", "return", "new", "CompilerVisitor", "(", "variables", ",", "varManager", ",", "exprCompiler", ",", "null", ")", ".", "exec"...
Compiles the given expression tree to a sequence of bytecode in the current method visitor. <p>If successful, the generated bytecode will resolve to a {@link SoyValueProvider} if it can be done without introducing any detach operations. This is intended for situations where we need to model the expression as a SoyValueProvider to satisfy a contract (e.g. let nodes and params), but we also want to preserve any laziness. So boxing is fine, but detaches are not.
[ "Compiles", "the", "given", "expression", "tree", "to", "a", "sequence", "of", "bytecode", "in", "the", "current", "method", "visitor", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jbcsrc/ExpressionToSoyValueProviderCompiler.java#L115-L118
Erudika/para
para-server/src/main/java/com/erudika/para/rest/RestUtils.java
RestUtils.pathParam
public static String pathParam(String param, ContainerRequestContext ctx) { return ctx.getUriInfo().getPathParameters().getFirst(param); }
java
public static String pathParam(String param, ContainerRequestContext ctx) { return ctx.getUriInfo().getPathParameters().getFirst(param); }
[ "public", "static", "String", "pathParam", "(", "String", "param", ",", "ContainerRequestContext", "ctx", ")", "{", "return", "ctx", ".", "getUriInfo", "(", ")", ".", "getPathParameters", "(", ")", ".", "getFirst", "(", "param", ")", ";", "}" ]
Returns the path parameter value. @param param a parameter name @param ctx ctx @return a value
[ "Returns", "the", "path", "parameter", "value", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/rest/RestUtils.java#L992-L994
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java
ToPojo.readMapValue
private static String readMapValue(String ref, TypeDef source, Property property) { TypeRef propertyTypeRef = property.getTypeRef(); Method getter = getterOf(source, property); if (getter == null) { return "null"; } TypeRef getterTypeRef = getter.getReturnType(); if (propertyTypeRef.getDimensions() == getterTypeRef.getDimensions() && propertyTypeRef.isAssignableFrom(getterTypeRef)) { return readObjectValue(ref, source, property); } if (property.getTypeRef().getDimensions() > 0) { return readArrayValue(ref, source, property); } if (property.getTypeRef() instanceof ClassRef && ((ClassRef)getterTypeRef).getDefinition().isAnnotation()) { return readAnnotationValue("((Map)(" + ref + " instanceof Map ? ((Map)" + ref + ").get(\"" + getterOf(source, property).getName() + "\") : "+getDefaultValue(property)+"))", ((ClassRef) getterTypeRef).getDefinition(), property); } return readObjectValue(ref, source, property); }
java
private static String readMapValue(String ref, TypeDef source, Property property) { TypeRef propertyTypeRef = property.getTypeRef(); Method getter = getterOf(source, property); if (getter == null) { return "null"; } TypeRef getterTypeRef = getter.getReturnType(); if (propertyTypeRef.getDimensions() == getterTypeRef.getDimensions() && propertyTypeRef.isAssignableFrom(getterTypeRef)) { return readObjectValue(ref, source, property); } if (property.getTypeRef().getDimensions() > 0) { return readArrayValue(ref, source, property); } if (property.getTypeRef() instanceof ClassRef && ((ClassRef)getterTypeRef).getDefinition().isAnnotation()) { return readAnnotationValue("((Map)(" + ref + " instanceof Map ? ((Map)" + ref + ").get(\"" + getterOf(source, property).getName() + "\") : "+getDefaultValue(property)+"))", ((ClassRef) getterTypeRef).getDefinition(), property); } return readObjectValue(ref, source, property); }
[ "private", "static", "String", "readMapValue", "(", "String", "ref", ",", "TypeDef", "source", ",", "Property", "property", ")", "{", "TypeRef", "propertyTypeRef", "=", "property", ".", "getTypeRef", "(", ")", ";", "Method", "getter", "=", "getterOf", "(", "...
Returns the string representation of the code that given a reference of the specified type, reads the specified property. @param ref The reference. @param source The type of the reference. @param property The property to read. @return The code.
[ "Returns", "the", "string", "representation", "of", "the", "code", "that", "given", "a", "reference", "of", "the", "specified", "type", "reads", "the", "specified", "property", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/ToPojo.java#L728-L747
lucee/Lucee
core/src/main/java/lucee/commons/lang/ClassUtil.java
ClassUtil.getSourcePathForClass
public static String getSourcePathForClass(Class clazz, String defaultValue) { try { String result = clazz.getProtectionDomain().getCodeSource().getLocation().getPath(); result = URLDecoder.decode(result, CharsetUtil.UTF8.name()); result = SystemUtil.fixWindowsPath(result); return result; } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } return defaultValue; }
java
public static String getSourcePathForClass(Class clazz, String defaultValue) { try { String result = clazz.getProtectionDomain().getCodeSource().getLocation().getPath(); result = URLDecoder.decode(result, CharsetUtil.UTF8.name()); result = SystemUtil.fixWindowsPath(result); return result; } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } return defaultValue; }
[ "public", "static", "String", "getSourcePathForClass", "(", "Class", "clazz", ",", "String", "defaultValue", ")", "{", "try", "{", "String", "result", "=", "clazz", ".", "getProtectionDomain", "(", ")", ".", "getCodeSource", "(", ")", ".", "getLocation", "(", ...
returns the path to the directory or jar file that the class was loaded from @param clazz - the Class object to check, for a live object pass obj.getClass(); @param defaultValue - a value to return in case the source could not be determined @return
[ "returns", "the", "path", "to", "the", "directory", "or", "jar", "file", "that", "the", "class", "was", "loaded", "from" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ClassUtil.java#L726-L740
haifengl/smile
core/src/main/java/smile/neighbor/MPLSH.java
MPLSH.learn
public void learn(RNNSearch<double[], double[]> range, double[][] samples, double radius, int Nz) { learn(range, samples, radius, Nz, 0.2); }
java
public void learn(RNNSearch<double[], double[]> range, double[][] samples, double radius, int Nz) { learn(range, samples, radius, Nz, 0.2); }
[ "public", "void", "learn", "(", "RNNSearch", "<", "double", "[", "]", ",", "double", "[", "]", ">", "range", ",", "double", "[", "]", "[", "]", "samples", ",", "double", "radius", ",", "int", "Nz", ")", "{", "learn", "(", "range", ",", "samples", ...
Train the posteriori multiple probe algorithm. @param range the neighborhood search data structure. @param radius the radius for range search. @param Nz the number of quantized values.
[ "Train", "the", "posteriori", "multiple", "probe", "algorithm", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/core/src/main/java/smile/neighbor/MPLSH.java#L858-L860
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java
BasePanel.setProperty
public void setProperty(String strProperty, String strValue) { if (this.getTask() != null) this.getTask().setProperty(strProperty, strValue); }
java
public void setProperty(String strProperty, String strValue) { if (this.getTask() != null) this.getTask().setProperty(strProperty, strValue); }
[ "public", "void", "setProperty", "(", "String", "strProperty", ",", "String", "strValue", ")", "{", "if", "(", "this", ".", "getTask", "(", ")", "!=", "null", ")", "this", ".", "getTask", "(", ")", ".", "setProperty", "(", "strProperty", ",", "strValue",...
Set this property. @param strProperty The property key. @param strValue The property value.
[ "Set", "this", "property", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BasePanel.java#L1364-L1368
Jasig/uPortal
uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java
AuthorizationImpl.getPrincipal
@Override public IAuthorizationPrincipal getPrincipal(IPermission permission) throws AuthorizationException { String principalString = permission.getPrincipal(); int idx = principalString.indexOf(PRINCIPAL_SEPARATOR); Integer typeId = Integer.valueOf(principalString.substring(0, idx)); Class type = EntityTypesLocator.getEntityTypes().getEntityTypeFromID(typeId); String key = principalString.substring(idx + 1); return newPrincipal(key, type); }
java
@Override public IAuthorizationPrincipal getPrincipal(IPermission permission) throws AuthorizationException { String principalString = permission.getPrincipal(); int idx = principalString.indexOf(PRINCIPAL_SEPARATOR); Integer typeId = Integer.valueOf(principalString.substring(0, idx)); Class type = EntityTypesLocator.getEntityTypes().getEntityTypeFromID(typeId); String key = principalString.substring(idx + 1); return newPrincipal(key, type); }
[ "@", "Override", "public", "IAuthorizationPrincipal", "getPrincipal", "(", "IPermission", "permission", ")", "throws", "AuthorizationException", "{", "String", "principalString", "=", "permission", ".", "getPrincipal", "(", ")", ";", "int", "idx", "=", "principalStrin...
Returns <code>IAuthorizationPrincipal</code> associated with the <code>IPermission</code>. @return IAuthorizationPrincipal @param permission IPermission
[ "Returns", "<code", ">", "IAuthorizationPrincipal<", "/", "code", ">", "associated", "with", "the", "<code", ">", "IPermission<", "/", "code", ">", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-permissions/src/main/java/org/apereo/portal/security/provider/AuthorizationImpl.java#L817-L826
geomajas/geomajas-project-client-gwt
common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java
HtmlBuilder.divClass
public static String divClass(String clazz, String... content) { return tagClass(Html.Tag.DIV, clazz, content); }
java
public static String divClass(String clazz, String... content) { return tagClass(Html.Tag.DIV, clazz, content); }
[ "public", "static", "String", "divClass", "(", "String", "clazz", ",", "String", "...", "content", ")", "{", "return", "tagClass", "(", "Html", ".", "Tag", ".", "DIV", ",", "clazz", ",", "content", ")", ";", "}" ]
Build a HTML DIV with given CSS class for a string. Given content does <b>not</b> consists of HTML snippets and as such is being prepared with {@link HtmlBuilder#htmlEncode(String)}. @param clazz class for div element @param content content string @return HTML DIV element as string
[ "Build", "a", "HTML", "DIV", "with", "given", "CSS", "class", "for", "a", "string", ".", "Given", "content", "does", "<b", ">", "not<", "/", "b", ">", "consists", "of", "HTML", "snippets", "and", "as", "such", "is", "being", "prepared", "with", "{", ...
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/common-gwt-smartgwt/src/main/java/org/geomajas/gwt/client/util/HtmlBuilder.java#L251-L253
febit/wit
wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java
ClassWriter.newField
public int newField( final String owner, final String name, final String desc) { Item result = get(key3.set(FIELD, owner, name, desc)); if (result == null) { put122(FIELD, newClass(owner), newNameType(name, desc)); result = new Item(poolIndex++, key3); put(result); } return result.index; }
java
public int newField( final String owner, final String name, final String desc) { Item result = get(key3.set(FIELD, owner, name, desc)); if (result == null) { put122(FIELD, newClass(owner), newNameType(name, desc)); result = new Item(poolIndex++, key3); put(result); } return result.index; }
[ "public", "int", "newField", "(", "final", "String", "owner", ",", "final", "String", "name", ",", "final", "String", "desc", ")", "{", "Item", "result", "=", "get", "(", "key3", ".", "set", "(", "FIELD", ",", "owner", ",", "name", ",", "desc", ")", ...
Adds a field reference to the constant pool of the class being build. Does nothing if the constant pool already contains a similar item. <i>This method is intended for {@link Attribute} sub classes, and is normally not needed by class generators or adapters.</i> @param owner the internal name of the field's owner class. @param name the field's name. @param desc the field's descriptor. @return the index of a new or already existing field reference item.
[ "Adds", "a", "field", "reference", "to", "the", "constant", "pool", "of", "the", "class", "being", "build", ".", "Does", "nothing", "if", "the", "constant", "pool", "already", "contains", "a", "similar", "item", ".", "<i", ">", "This", "method", "is", "i...
train
https://github.com/febit/wit/blob/89ee29efbc5633b79c30c3c7b953c9f4130575af/wit-core/src/main/java/org/febit/wit_shaded/asm/ClassWriter.java#L570-L581
centic9/commons-dost
src/main/java/org/dstadler/commons/http/HttpClientWrapper.java
HttpClientWrapper.retrieveData
public static String retrieveData(String url, String user, String password, int timeoutMs) throws IOException { try (HttpClientWrapper wrapper = new HttpClientWrapper(user, password, timeoutMs)) { return wrapper.simpleGet(url); } }
java
public static String retrieveData(String url, String user, String password, int timeoutMs) throws IOException { try (HttpClientWrapper wrapper = new HttpClientWrapper(user, password, timeoutMs)) { return wrapper.simpleGet(url); } }
[ "public", "static", "String", "retrieveData", "(", "String", "url", ",", "String", "user", ",", "String", "password", ",", "int", "timeoutMs", ")", "throws", "IOException", "{", "try", "(", "HttpClientWrapper", "wrapper", "=", "new", "HttpClientWrapper", "(", ...
Small helper method to simply query the URL without password and return the resulting data. @param url The URL to query data from. @param user The username to send @param password The password to send @param timeoutMs How long in milliseconds to wait for the request @return The resulting data read from the URL @throws IOException If the URL is not accessible or the query returns a HTTP code other than 200.
[ "Small", "helper", "method", "to", "simply", "query", "the", "URL", "without", "password", "and", "return", "the", "resulting", "data", "." ]
train
https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/http/HttpClientWrapper.java#L336-L340
alkacon/opencms-core
src/org/opencms/webdav/CmsWebdavServlet.java
CmsWebdavServlet.doProppatch
protected void doProppatch(HttpServletRequest req, HttpServletResponse resp) { // Check if Webdav is read only if (m_readOnly) { resp.setStatus(CmsWebdavStatus.SC_FORBIDDEN); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_WEBDAV_READ_ONLY_0)); } return; } // Check if resource is locked if (isLocked(req)) { resp.setStatus(CmsWebdavStatus.SC_LOCKED); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ITEM_LOCKED_1, getRelativePath(req))); } return; } resp.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED); }
java
protected void doProppatch(HttpServletRequest req, HttpServletResponse resp) { // Check if Webdav is read only if (m_readOnly) { resp.setStatus(CmsWebdavStatus.SC_FORBIDDEN); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_WEBDAV_READ_ONLY_0)); } return; } // Check if resource is locked if (isLocked(req)) { resp.setStatus(CmsWebdavStatus.SC_LOCKED); if (LOG.isDebugEnabled()) { LOG.debug(Messages.get().getBundle().key(Messages.LOG_ITEM_LOCKED_1, getRelativePath(req))); } return; } resp.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED); }
[ "protected", "void", "doProppatch", "(", "HttpServletRequest", "req", ",", "HttpServletResponse", "resp", ")", "{", "// Check if Webdav is read only", "if", "(", "m_readOnly", ")", "{", "resp", ".", "setStatus", "(", "CmsWebdavStatus", ".", "SC_FORBIDDEN", ")", ";",...
Process a PROPPATCH WebDAV request for the specified resource.<p> Not implemented yet.<p> @param req the servlet request we are processing @param resp the servlet response we are creating
[ "Process", "a", "PROPPATCH", "WebDAV", "request", "for", "the", "specified", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/webdav/CmsWebdavServlet.java#L1973-L2000
JetBrains/xodus
environment/src/main/java/jetbrains/exodus/tree/btree/BTreeBalancePolicy.java
BTreeBalancePolicy.needMerge
public boolean needMerge(@NotNull final BasePage left, @NotNull final BasePage right) { final int leftSize = left.getSize(); final int rightSize = right.getSize(); return leftSize == 0 || rightSize == 0 || leftSize + rightSize <= (((isDupTree(left) ? getDupPageMaxSize() : getPageMaxSize()) * 7) >> 3); }
java
public boolean needMerge(@NotNull final BasePage left, @NotNull final BasePage right) { final int leftSize = left.getSize(); final int rightSize = right.getSize(); return leftSize == 0 || rightSize == 0 || leftSize + rightSize <= (((isDupTree(left) ? getDupPageMaxSize() : getPageMaxSize()) * 7) >> 3); }
[ "public", "boolean", "needMerge", "(", "@", "NotNull", "final", "BasePage", "left", ",", "@", "NotNull", "final", "BasePage", "right", ")", "{", "final", "int", "leftSize", "=", "left", ".", "getSize", "(", ")", ";", "final", "int", "rightSize", "=", "ri...
Is invoked on the leaf deletion only. @param left left page. @param right right page. @return true if the left page ought to be merged with the right one.
[ "Is", "invoked", "on", "the", "leaf", "deletion", "only", "." ]
train
https://github.com/JetBrains/xodus/blob/7b3476c4e81db66f9c7529148c761605cc8eea6d/environment/src/main/java/jetbrains/exodus/tree/btree/BTreeBalancePolicy.java#L70-L75
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_misc.java
xen_health_monitor_misc.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_monitor_misc_responses result = (xen_health_monitor_misc_responses) service.get_payload_formatter().string_to_resource(xen_health_monitor_misc_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_monitor_misc_response_array); } xen_health_monitor_misc[] result_xen_health_monitor_misc = new xen_health_monitor_misc[result.xen_health_monitor_misc_response_array.length]; for(int i = 0; i < result.xen_health_monitor_misc_response_array.length; i++) { result_xen_health_monitor_misc[i] = result.xen_health_monitor_misc_response_array[i].xen_health_monitor_misc[0]; } return result_xen_health_monitor_misc; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { xen_health_monitor_misc_responses result = (xen_health_monitor_misc_responses) service.get_payload_formatter().string_to_resource(xen_health_monitor_misc_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.xen_health_monitor_misc_response_array); } xen_health_monitor_misc[] result_xen_health_monitor_misc = new xen_health_monitor_misc[result.xen_health_monitor_misc_response_array.length]; for(int i = 0; i < result.xen_health_monitor_misc_response_array.length; i++) { result_xen_health_monitor_misc[i] = result.xen_health_monitor_misc_response_array[i].xen_health_monitor_misc[0]; } return result_xen_health_monitor_misc; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "xen_health_monitor_misc_responses", "result", "=", "(", "xen_health_monitor_misc_responses", ")", "service", "....
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/xen/xen_health_monitor_misc.java#L173-L190
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/DistributerMap.java
DistributerMap.toRemote
public String toRemote(final String host, final File localFile) { if (this.remoteName != null && (this.hosts == null || this.hosts.contains(host))) { try { final String canonical = localFile.getCanonicalPath(); if (canonical.startsWith(this.canonicalPath) && isActive()) { return this.remoteName + canonical.substring(this.canonicalPath.length()).replace(File.separatorChar, this.remoteSeparator); } } catch (final IOException ex) { return null; } } return null; }
java
public String toRemote(final String host, final File localFile) { if (this.remoteName != null && (this.hosts == null || this.hosts.contains(host))) { try { final String canonical = localFile.getCanonicalPath(); if (canonical.startsWith(this.canonicalPath) && isActive()) { return this.remoteName + canonical.substring(this.canonicalPath.length()).replace(File.separatorChar, this.remoteSeparator); } } catch (final IOException ex) { return null; } } return null; }
[ "public", "String", "toRemote", "(", "final", "String", "host", ",", "final", "File", "localFile", ")", "{", "if", "(", "this", ".", "remoteName", "!=", "null", "&&", "(", "this", ".", "hosts", "==", "null", "||", "this", ".", "hosts", ".", "contains",...
Converts the local file name to the remote name for the same file. @param host host @param localFile local file @return remote name for local file, null if unknown.
[ "Converts", "the", "local", "file", "name", "to", "the", "remote", "name", "for", "the", "same", "file", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/DistributerMap.java#L210-L223
TheHolyWaffle/League-of-Legends-XMPP-Chat-Library
src/main/java/com/github/theholywaffle/lolchatapi/LolChat.java
LolChat.addFriendByName
public boolean addFriendByName(String name, FriendGroup friendGroup) { if (getRiotApi() != null) { try { final StringBuilder buf = new StringBuilder(); buf.append("sum"); buf.append(getRiotApi().getSummonerId(name)); buf.append("@pvp.net"); addFriendById(buf.toString(), name, friendGroup); return true; } catch (IOException | URISyntaxException e) { e.printStackTrace(); return false; } } return false; }
java
public boolean addFriendByName(String name, FriendGroup friendGroup) { if (getRiotApi() != null) { try { final StringBuilder buf = new StringBuilder(); buf.append("sum"); buf.append(getRiotApi().getSummonerId(name)); buf.append("@pvp.net"); addFriendById(buf.toString(), name, friendGroup); return true; } catch (IOException | URISyntaxException e) { e.printStackTrace(); return false; } } return false; }
[ "public", "boolean", "addFriendByName", "(", "String", "name", ",", "FriendGroup", "friendGroup", ")", "{", "if", "(", "getRiotApi", "(", ")", "!=", "null", ")", "{", "try", "{", "final", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", ...
Sends an friend request to an other user. An Riot API key is required for this. @param name The name of the Friend you want to add (case insensitive) @param friendGroup The FriendGroup you want to put this user in. @return True if succesful otherwise false.
[ "Sends", "an", "friend", "request", "to", "an", "other", "user", ".", "An", "Riot", "API", "key", "is", "required", "for", "this", "." ]
train
https://github.com/TheHolyWaffle/League-of-Legends-XMPP-Chat-Library/blob/5e4d87d0c054ff2f6510545b0e9f838338695c70/src/main/java/com/github/theholywaffle/lolchatapi/LolChat.java#L266-L281
liyiorg/weixin-popular
src/main/java/weixin/popular/api/WxaAPI.java
WxaAPI.modify_domain
public static ModifyDomainResult modify_domain(String access_token,ModifyDomain modifyDomain){ String json = JsonUtil.toJSONString(modifyDomain); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/wxa/modify_domain") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(json,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,ModifyDomainResult.class); }
java
public static ModifyDomainResult modify_domain(String access_token,ModifyDomain modifyDomain){ String json = JsonUtil.toJSONString(modifyDomain); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(jsonHeader) .setUri(BASE_URI + "/wxa/modify_domain") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .setEntity(new StringEntity(json,Charset.forName("utf-8"))) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,ModifyDomainResult.class); }
[ "public", "static", "ModifyDomainResult", "modify_domain", "(", "String", "access_token", ",", "ModifyDomain", "modifyDomain", ")", "{", "String", "json", "=", "JsonUtil", ".", "toJSONString", "(", "modifyDomain", ")", ";", "HttpUriRequest", "httpUriRequest", "=", "...
修改服务器地址 @since 2.8.9 @param access_token access_token @param modifyDomain modifyDomain @return result
[ "修改服务器地址" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/WxaAPI.java#L64-L73
offbynull/coroutines
instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java
GenericGenerators.saveVar
public static InsnList saveVar(Variable variable) { Validate.notNull(variable); InsnList ret = new InsnList(); switch (variable.getType().getSort()) { case Type.BOOLEAN: case Type.BYTE: case Type.CHAR: case Type.SHORT: case Type.INT: ret.add(new VarInsnNode(Opcodes.ISTORE, variable.getIndex())); break; case Type.LONG: ret.add(new VarInsnNode(Opcodes.LSTORE, variable.getIndex())); break; case Type.FLOAT: ret.add(new VarInsnNode(Opcodes.FSTORE, variable.getIndex())); break; case Type.DOUBLE: ret.add(new VarInsnNode(Opcodes.DSTORE, variable.getIndex())); break; case Type.OBJECT: case Type.ARRAY: ret.add(new VarInsnNode(Opcodes.ASTORE, variable.getIndex())); break; default: throw new IllegalStateException(); // should never happen, there is code in Variable/VariableTable to make sure invalid // types aren't set } return ret; }
java
public static InsnList saveVar(Variable variable) { Validate.notNull(variable); InsnList ret = new InsnList(); switch (variable.getType().getSort()) { case Type.BOOLEAN: case Type.BYTE: case Type.CHAR: case Type.SHORT: case Type.INT: ret.add(new VarInsnNode(Opcodes.ISTORE, variable.getIndex())); break; case Type.LONG: ret.add(new VarInsnNode(Opcodes.LSTORE, variable.getIndex())); break; case Type.FLOAT: ret.add(new VarInsnNode(Opcodes.FSTORE, variable.getIndex())); break; case Type.DOUBLE: ret.add(new VarInsnNode(Opcodes.DSTORE, variable.getIndex())); break; case Type.OBJECT: case Type.ARRAY: ret.add(new VarInsnNode(Opcodes.ASTORE, variable.getIndex())); break; default: throw new IllegalStateException(); // should never happen, there is code in Variable/VariableTable to make sure invalid // types aren't set } return ret; }
[ "public", "static", "InsnList", "saveVar", "(", "Variable", "variable", ")", "{", "Validate", ".", "notNull", "(", "variable", ")", ";", "InsnList", "ret", "=", "new", "InsnList", "(", ")", ";", "switch", "(", "variable", ".", "getType", "(", ")", ".", ...
Pops the stack in to the the local variable table. You may run in to problems if the item on top of the stack isn't of the same type as the variable it's being put in to. @param variable variable within the local variable table to save to @return instructions to pop an item off the top of the stack and save it to {@code variable} @throws NullPointerException if any argument is {@code null} @throws IllegalArgumentException if {@code variable} has been released
[ "Pops", "the", "stack", "in", "to", "the", "the", "local", "variable", "table", ".", "You", "may", "run", "in", "to", "problems", "if", "the", "item", "on", "top", "of", "the", "stack", "isn", "t", "of", "the", "same", "type", "as", "the", "variable"...
train
https://github.com/offbynull/coroutines/blob/b1b83c293945f53a2f63fca8f15a53e88b796bf5/instrumenter/src/main/java/com/offbynull/coroutines/instrumenter/generators/GenericGenerators.java#L431-L462
gallandarakhneorg/afc
maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java
AbstractArakhneMojo.createArtifact
public final Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type) { VersionRange versionRange = null; if (version != null) { versionRange = VersionRange.createFromVersion(version); } String desiredScope = scope; if (Artifact.SCOPE_TEST.equals(desiredScope)) { desiredScope = Artifact.SCOPE_TEST; } if (Artifact.SCOPE_PROVIDED.equals(desiredScope)) { desiredScope = Artifact.SCOPE_PROVIDED; } if (Artifact.SCOPE_SYSTEM.equals(desiredScope)) { // system scopes come through unchanged... desiredScope = Artifact.SCOPE_SYSTEM; } final ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler(type); return new org.apache.maven.artifact.DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, null, handler, false); }
java
public final Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type) { VersionRange versionRange = null; if (version != null) { versionRange = VersionRange.createFromVersion(version); } String desiredScope = scope; if (Artifact.SCOPE_TEST.equals(desiredScope)) { desiredScope = Artifact.SCOPE_TEST; } if (Artifact.SCOPE_PROVIDED.equals(desiredScope)) { desiredScope = Artifact.SCOPE_PROVIDED; } if (Artifact.SCOPE_SYSTEM.equals(desiredScope)) { // system scopes come through unchanged... desiredScope = Artifact.SCOPE_SYSTEM; } final ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler(type); return new org.apache.maven.artifact.DefaultArtifact( groupId, artifactId, versionRange, desiredScope, type, null, handler, false); }
[ "public", "final", "Artifact", "createArtifact", "(", "String", "groupId", ",", "String", "artifactId", ",", "String", "version", ",", "String", "scope", ",", "String", "type", ")", "{", "VersionRange", "versionRange", "=", "null", ";", "if", "(", "version", ...
Create an artifact from the given values. @param groupId group id. @param artifactId artifact id. @param version version number. @param scope artifact scope. @param type artifact type. @return the artifact
[ "Create", "an", "artifact", "from", "the", "given", "values", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L987-L1013
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getWithLeading
@Nonnull public static String getWithLeading (@Nullable final String sSrc, @Nonnegative final int nMinLen, final char cFront) { return _getWithLeadingOrTrailing (sSrc, nMinLen, cFront, true); }
java
@Nonnull public static String getWithLeading (@Nullable final String sSrc, @Nonnegative final int nMinLen, final char cFront) { return _getWithLeadingOrTrailing (sSrc, nMinLen, cFront, true); }
[ "@", "Nonnull", "public", "static", "String", "getWithLeading", "(", "@", "Nullable", "final", "String", "sSrc", ",", "@", "Nonnegative", "final", "int", "nMinLen", ",", "final", "char", "cFront", ")", "{", "return", "_getWithLeadingOrTrailing", "(", "sSrc", "...
Get a string that is filled at the beginning with the passed character until the minimum length is reached. If the input string is empty, the result is a string with the provided len only consisting of the passed characters. If the input String is longer than the provided length, it is returned unchanged. @param sSrc Source string. May be <code>null</code>. @param nMinLen Minimum length. Should be &gt; 0. @param cFront The character to be used at the beginning @return A non-<code>null</code> string that has at least nLen chars
[ "Get", "a", "string", "that", "is", "filled", "at", "the", "beginning", "with", "the", "passed", "character", "until", "the", "minimum", "length", "is", "reached", ".", "If", "the", "input", "string", "is", "empty", "the", "result", "is", "a", "string", ...
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L500-L504
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java
HtmlWriter.getBody
public HtmlTree getBody(boolean includeScript, String title) { HtmlTree body = new HtmlTree(HtmlTag.BODY); // Set window title string which is later printed this.winTitle = title; // Don't print windowtitle script for overview-frame, allclasses-frame // and package-frame if (includeScript) { this.script = getWinTitleScript(); body.addContent(script); Content noScript = HtmlTree.NOSCRIPT( HtmlTree.DIV(configuration.getContent("doclet.No_Script_Message"))); body.addContent(noScript); } return body; }
java
public HtmlTree getBody(boolean includeScript, String title) { HtmlTree body = new HtmlTree(HtmlTag.BODY); // Set window title string which is later printed this.winTitle = title; // Don't print windowtitle script for overview-frame, allclasses-frame // and package-frame if (includeScript) { this.script = getWinTitleScript(); body.addContent(script); Content noScript = HtmlTree.NOSCRIPT( HtmlTree.DIV(configuration.getContent("doclet.No_Script_Message"))); body.addContent(noScript); } return body; }
[ "public", "HtmlTree", "getBody", "(", "boolean", "includeScript", ",", "String", "title", ")", "{", "HtmlTree", "body", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "BODY", ")", ";", "// Set window title string which is later printed", "this", ".", "winTitle", "="...
Returns an HtmlTree for the BODY tag. @param includeScript set true if printing windowtitle script @param title title for the window @return an HtmlTree for the BODY tag
[ "Returns", "an", "HtmlTree", "for", "the", "BODY", "tag", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/HtmlWriter.java#L312-L326
SonarSource/sonarqube
sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/CharsetValidation.java
CharsetValidation.tryDecode
public boolean tryDecode(byte[] bytes, @Nullable Charset charset) { if (charset == null) { return false; } CharsetDecoder decoder = charset.newDecoder() .onMalformedInput(CodingErrorAction.REPORT) .onUnmappableCharacter(CodingErrorAction.REPORT); try { decoder.decode(ByteBuffer.wrap(bytes)); } catch (CharacterCodingException e) { return false; } return true; }
java
public boolean tryDecode(byte[] bytes, @Nullable Charset charset) { if (charset == null) { return false; } CharsetDecoder decoder = charset.newDecoder() .onMalformedInput(CodingErrorAction.REPORT) .onUnmappableCharacter(CodingErrorAction.REPORT); try { decoder.decode(ByteBuffer.wrap(bytes)); } catch (CharacterCodingException e) { return false; } return true; }
[ "public", "boolean", "tryDecode", "(", "byte", "[", "]", "bytes", ",", "@", "Nullable", "Charset", "charset", ")", "{", "if", "(", "charset", "==", "null", ")", "{", "return", "false", ";", "}", "CharsetDecoder", "decoder", "=", "charset", ".", "newDecod...
Tries to use the given charset to decode the byte array. @return true if decoding succeeded, false if there was a decoding error.
[ "Tries", "to", "use", "the", "given", "charset", "to", "decode", "the", "byte", "array", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/scan/filesystem/CharsetValidation.java#L248-L262
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.addEntry
public Jar addEntry(String path, InputStream is) throws IOException { beginWriting(); addEntry(jos, path, is); return this; }
java
public Jar addEntry(String path, InputStream is) throws IOException { beginWriting(); addEntry(jos, path, is); return this; }
[ "public", "Jar", "addEntry", "(", "String", "path", ",", "InputStream", "is", ")", "throws", "IOException", "{", "beginWriting", "(", ")", ";", "addEntry", "(", "jos", ",", "path", ",", "is", ")", ";", "return", "this", ";", "}" ]
Adds an entry to this JAR. @param path the entry's path within the JAR @param is the entry's content @return {@code this}
[ "Adds", "an", "entry", "to", "this", "JAR", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L295-L299
b3dgs/lionengine
lionengine-network/src/main/java/com/b3dgs/lionengine/network/NetworkModel.java
NetworkModel.decodeMessage
protected void decodeMessage(byte type, byte from, byte dest, DataInputStream buffer) throws IOException { final NetworkMessage message = decoder.getNetworkMessageFromType(type); if (message != null) { final int skip = 3; if (buffer.skipBytes(skip) == skip) { message.decode(type, from, dest, buffer); messagesIn.add(message); } } }
java
protected void decodeMessage(byte type, byte from, byte dest, DataInputStream buffer) throws IOException { final NetworkMessage message = decoder.getNetworkMessageFromType(type); if (message != null) { final int skip = 3; if (buffer.skipBytes(skip) == skip) { message.decode(type, from, dest, buffer); messagesIn.add(message); } } }
[ "protected", "void", "decodeMessage", "(", "byte", "type", ",", "byte", "from", ",", "byte", "dest", ",", "DataInputStream", "buffer", ")", "throws", "IOException", "{", "final", "NetworkMessage", "message", "=", "decoder", ".", "getNetworkMessageFromType", "(", ...
Decode a message from its type. @param type The message type. @param from The client id source. @param dest The client id destination (-1 if all). @param buffer The data. @throws IOException Error on reading.
[ "Decode", "a", "message", "from", "its", "type", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-network/src/main/java/com/b3dgs/lionengine/network/NetworkModel.java#L66-L78
lucee/Lucee
core/src/main/java/lucee/runtime/db/QoQ.java
QoQ.executeExp
private Object executeExp(PageContext pc, SQL sql, Query qr, Expression exp, int row) throws PageException { // print.e("name:"+exp.getClass().getName()); if (exp instanceof Value) return ((Value) exp).getValue();// executeConstant(sql,qr, (Value)exp, row); if (exp instanceof Column) return executeColumn(sql, qr, (Column) exp, row); if (exp instanceof Operation) return executeOperation(pc, sql, qr, (Operation) exp, row); if (exp instanceof BracketExpression) return executeBracked(pc, sql, qr, (BracketExpression) exp, row); throw new DatabaseException("unsupported sql statement [" + exp + "]", null, sql, null); }
java
private Object executeExp(PageContext pc, SQL sql, Query qr, Expression exp, int row) throws PageException { // print.e("name:"+exp.getClass().getName()); if (exp instanceof Value) return ((Value) exp).getValue();// executeConstant(sql,qr, (Value)exp, row); if (exp instanceof Column) return executeColumn(sql, qr, (Column) exp, row); if (exp instanceof Operation) return executeOperation(pc, sql, qr, (Operation) exp, row); if (exp instanceof BracketExpression) return executeBracked(pc, sql, qr, (BracketExpression) exp, row); throw new DatabaseException("unsupported sql statement [" + exp + "]", null, sql, null); }
[ "private", "Object", "executeExp", "(", "PageContext", "pc", ",", "SQL", "sql", ",", "Query", "qr", ",", "Expression", "exp", ",", "int", "row", ")", "throws", "PageException", "{", "// print.e(\"name:\"+exp.getClass().getName());", "if", "(", "exp", "instanceof",...
Executes a ZEXp @param sql @param qr Query Result @param exp expression to execute @param row current row of resultset @return result @throws PageException
[ "Executes", "a", "ZEXp" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/db/QoQ.java#L307-L314
VoltDB/voltdb
src/frontend/org/voltdb/RealVoltDB.java
RealVoltDB.recoverPartitions
private AbstractTopology recoverPartitions(AbstractTopology topology, String haGroup, Set<Integer> recoverPartitions) { long version = topology.version; if (!recoverPartitions.isEmpty()) { // In rejoin case, partition list from the rejoining node could be out of range if the rejoining // host is a previously elastic removed node or some other used nodes, if out of range, do not restore if (Collections.max(recoverPartitions) > Collections.max(m_cartographer.getPartitions())) { recoverPartitions.clear(); } } AbstractTopology recoveredTopo = AbstractTopology.mutateRecoverTopology(topology, m_messenger.getLiveHostIds(), m_messenger.getHostId(), haGroup, recoverPartitions); if (recoveredTopo == null) { return null; } List<Integer> partitions = Lists.newArrayList(recoveredTopo.getPartitionIdList(m_messenger.getHostId())); if (partitions != null && partitions.size() == m_catalogContext.getNodeSettings().getLocalSitesCount()) { TopologyZKUtils.updateTopologyToZK(m_messenger.getZK(), recoveredTopo); } if (version < recoveredTopo.version && !recoverPartitions.isEmpty()) { consoleLog.info("Partition placement layout has been restored for rejoining."); } return recoveredTopo; }
java
private AbstractTopology recoverPartitions(AbstractTopology topology, String haGroup, Set<Integer> recoverPartitions) { long version = topology.version; if (!recoverPartitions.isEmpty()) { // In rejoin case, partition list from the rejoining node could be out of range if the rejoining // host is a previously elastic removed node or some other used nodes, if out of range, do not restore if (Collections.max(recoverPartitions) > Collections.max(m_cartographer.getPartitions())) { recoverPartitions.clear(); } } AbstractTopology recoveredTopo = AbstractTopology.mutateRecoverTopology(topology, m_messenger.getLiveHostIds(), m_messenger.getHostId(), haGroup, recoverPartitions); if (recoveredTopo == null) { return null; } List<Integer> partitions = Lists.newArrayList(recoveredTopo.getPartitionIdList(m_messenger.getHostId())); if (partitions != null && partitions.size() == m_catalogContext.getNodeSettings().getLocalSitesCount()) { TopologyZKUtils.updateTopologyToZK(m_messenger.getZK(), recoveredTopo); } if (version < recoveredTopo.version && !recoverPartitions.isEmpty()) { consoleLog.info("Partition placement layout has been restored for rejoining."); } return recoveredTopo; }
[ "private", "AbstractTopology", "recoverPartitions", "(", "AbstractTopology", "topology", ",", "String", "haGroup", ",", "Set", "<", "Integer", ">", "recoverPartitions", ")", "{", "long", "version", "=", "topology", ".", "version", ";", "if", "(", "!", "recoverPa...
recover the partition assignment from one of lost hosts in the same placement group for rejoin Use the placement group of the recovering host to find a matched host from the lost nodes in the topology If the partition count from the lost node is the same as the site count of the recovering host, The partitions on the lost node will be placed on the recovering host. Partition group layout will be maintained. Topology will be updated on ZK if successful @param topology The topology from ZK, which contains the partition assignments for live or lost hosts @param haGroup The placement group of the recovering host @param recoverPartitions the partition placement to be recovered on this host @return A list of partitions if recover effort is a success.
[ "recover", "the", "partition", "assignment", "from", "one", "of", "lost", "hosts", "in", "the", "same", "placement", "group", "for", "rejoin", "Use", "the", "placement", "group", "of", "the", "recovering", "host", "to", "find", "a", "matched", "host", "from"...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/RealVoltDB.java#L1704-L1730
alkacon/opencms-core
src/org/opencms/util/CmsHtml2TextConverter.java
CmsHtml2TextConverter.setIndentation
private void setIndentation(int length, boolean open) { if (open) { m_indent += length; } else { m_indent -= length; if (m_indent < 0) { m_indent = 0; } } }
java
private void setIndentation(int length, boolean open) { if (open) { m_indent += length; } else { m_indent -= length; if (m_indent < 0) { m_indent = 0; } } }
[ "private", "void", "setIndentation", "(", "int", "length", ",", "boolean", "open", ")", "{", "if", "(", "open", ")", "{", "m_indent", "+=", "length", ";", "}", "else", "{", "m_indent", "-=", "length", ";", "if", "(", "m_indent", "<", "0", ")", "{", ...
Sets the indentation.<p> @param length the indentation length @param open if the indentation should be added or reduced
[ "Sets", "the", "indentation", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/util/CmsHtml2TextConverter.java#L340-L350
javers/javers
javers-core/src/main/java/org/javers/core/JaversBuilder.java
JaversBuilder.registerCustomComparator
public <T> JaversBuilder registerCustomComparator(CustomPropertyComparator<T, ?> comparator, Class<T> customType){ registerType(new CustomDefinition(customType, comparator)); bindComponent(comparator, new CustomToNativeAppenderAdapter(comparator, customType)); return this; }
java
public <T> JaversBuilder registerCustomComparator(CustomPropertyComparator<T, ?> comparator, Class<T> customType){ registerType(new CustomDefinition(customType, comparator)); bindComponent(comparator, new CustomToNativeAppenderAdapter(comparator, customType)); return this; }
[ "public", "<", "T", ">", "JaversBuilder", "registerCustomComparator", "(", "CustomPropertyComparator", "<", "T", ",", "?", ">", "comparator", ",", "Class", "<", "T", ">", "customType", ")", "{", "registerType", "(", "new", "CustomDefinition", "(", "customType", ...
Registers a custom property comparator for a given Custom Type. <br/><br/> Custom comparators are used by diff algorithm to calculate property-to-property diff and also collection-to-collection diff. <br/><br/> Internally, given type is mapped as {@link CustomType}. @param <T> Custom Type @see CustomType @see CustomPropertyComparator
[ "Registers", "a", "custom", "property", "comparator", "for", "a", "given", "Custom", "Type", ".", "<br", "/", ">", "<br", "/", ">" ]
train
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/core/JaversBuilder.java#L633-L637
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java
JobOperations.getTaskCounts
public TaskCounts getTaskCounts(String jobId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { JobGetTaskCountsOptions options = new JobGetTaskCountsOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); return this.parentBatchClient.protocolLayer().jobs().getTaskCounts(jobId, options); }
java
public TaskCounts getTaskCounts(String jobId, Iterable<BatchClientBehavior> additionalBehaviors) throws BatchErrorException, IOException { JobGetTaskCountsOptions options = new JobGetTaskCountsOptions(); BehaviorManager bhMgr = new BehaviorManager(this.customBehaviors(), additionalBehaviors); bhMgr.applyRequestBehaviors(options); return this.parentBatchClient.protocolLayer().jobs().getTaskCounts(jobId, options); }
[ "public", "TaskCounts", "getTaskCounts", "(", "String", "jobId", ",", "Iterable", "<", "BatchClientBehavior", ">", "additionalBehaviors", ")", "throws", "BatchErrorException", ",", "IOException", "{", "JobGetTaskCountsOptions", "options", "=", "new", "JobGetTaskCountsOpti...
Gets the task counts for the specified job. Task counts provide a count of the tasks by active, running or completed task state, and a count of tasks which succeeded or failed. Tasks in the preparing state are counted as running. @param jobId The ID of the job. @param additionalBehaviors A collection of {@link BatchClientBehavior} instances that are applied to the Batch service request. @throws BatchErrorException thrown if the request is rejected by server @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. @return the TaskCounts object if successful.
[ "Gets", "the", "task", "counts", "for", "the", "specified", "job", ".", "Task", "counts", "provide", "a", "count", "of", "the", "tasks", "by", "active", "running", "or", "completed", "task", "state", "and", "a", "count", "of", "tasks", "which", "succeeded"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L619-L625
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.accessRestriction_ip_POST
public void accessRestriction_ip_POST(String ip, OvhIpRestrictionRuleEnum rule, Boolean warning) throws IOException { String qPath = "/me/accessRestriction/ip"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ip", ip); addBody(o, "rule", rule); addBody(o, "warning", warning); exec(qPath, "POST", sb.toString(), o); }
java
public void accessRestriction_ip_POST(String ip, OvhIpRestrictionRuleEnum rule, Boolean warning) throws IOException { String qPath = "/me/accessRestriction/ip"; StringBuilder sb = path(qPath); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "ip", ip); addBody(o, "rule", rule); addBody(o, "warning", warning); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "accessRestriction_ip_POST", "(", "String", "ip", ",", "OvhIpRestrictionRuleEnum", "rule", ",", "Boolean", "warning", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/accessRestriction/ip\"", ";", "StringBuilder", "sb", "=", "path", ...
Add an IP access restriction REST: POST /me/accessRestriction/ip @param rule [required] Accept or deny IP access @param warning [required] Send an email if someone try to access with this IP address @param ip [required] An IP range where we will apply the rule
[ "Add", "an", "IP", "access", "restriction" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4077-L4085
Azure/azure-sdk-for-java
containerinstance/resource-manager/v2017_12_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2017_12_01_preview/implementation/ContainerLogsInner.java
ContainerLogsInner.listAsync
public Observable<LogsInner> listAsync(String resourceGroupName, String containerGroupName, String containerName, Integer tail) { return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, tail).map(new Func1<ServiceResponse<LogsInner>, LogsInner>() { @Override public LogsInner call(ServiceResponse<LogsInner> response) { return response.body(); } }); }
java
public Observable<LogsInner> listAsync(String resourceGroupName, String containerGroupName, String containerName, Integer tail) { return listWithServiceResponseAsync(resourceGroupName, containerGroupName, containerName, tail).map(new Func1<ServiceResponse<LogsInner>, LogsInner>() { @Override public LogsInner call(ServiceResponse<LogsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LogsInner", ">", "listAsync", "(", "String", "resourceGroupName", ",", "String", "containerGroupName", ",", "String", "containerName", ",", "Integer", "tail", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", "...
Get the logs for a specified container instance. Get the logs for a specified container instance in a specified resource group and container group. @param resourceGroupName The name of the resource group. @param containerGroupName The name of the container group. @param containerName The name of the container instance. @param tail The number of lines to show from the tail of the container instance log. If not provided, all available logs are shown up to 4mb. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LogsInner object
[ "Get", "the", "logs", "for", "a", "specified", "container", "instance", ".", "Get", "the", "logs", "for", "a", "specified", "container", "instance", "in", "a", "specified", "resource", "group", "and", "container", "group", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerinstance/resource-manager/v2017_12_01_preview/src/main/java/com/microsoft/azure/management/containerinstance/v2017_12_01_preview/implementation/ContainerLogsInner.java#L195-L202
vakinge/jeesuite-libs
jeesuite-mybatis/src/main/java/com/jeesuite/mybatis/plugin/cache/EntityCacheHelper.java
EntityCacheHelper.queryTryCache
public static <T> T queryTryCache(Class<? extends BaseEntity> entityClass,String key,Callable<T> dataCaller){ return queryTryCache(entityClass, key, CacheHandler.defaultCacheExpire, dataCaller); }
java
public static <T> T queryTryCache(Class<? extends BaseEntity> entityClass,String key,Callable<T> dataCaller){ return queryTryCache(entityClass, key, CacheHandler.defaultCacheExpire, dataCaller); }
[ "public", "static", "<", "T", ">", "T", "queryTryCache", "(", "Class", "<", "?", "extends", "BaseEntity", ">", "entityClass", ",", "String", "key", ",", "Callable", "<", "T", ">", "dataCaller", ")", "{", "return", "queryTryCache", "(", "entityClass", ",", ...
查询并缓存结果(默认缓存一天) @param entityClass 实体类class (用户组装实际的缓存key) @param key 缓存的key(和entityClass一起组成真实的缓存key。<br>如entityClass=UserEntity.class,key=findlist,实际的key为:UserEntity.findlist) @param dataCaller 缓存不存在数据加载源 @return
[ "查询并缓存结果", "(", "默认缓存一天", ")" ]
train
https://github.com/vakinge/jeesuite-libs/blob/c48fe2c7fbd294892cf4030dbec96e744dd3e386/jeesuite-mybatis/src/main/java/com/jeesuite/mybatis/plugin/cache/EntityCacheHelper.java#L33-L35
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_DELETE
public void billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_DELETE(String billingAccount, String serviceName, Long conditionId) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId); exec(qPath, "DELETE", sb.toString(), null); }
java
public void billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_DELETE(String billingAccount, String serviceName, Long conditionId) throws IOException { String qPath = "/telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, conditionId); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "billingAccount_easyHunting_serviceName_timeConditions_conditions_conditionId_DELETE", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "conditionId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingA...
Delete the given condition REST: DELETE /telephony/{billingAccount}/easyHunting/{serviceName}/timeConditions/conditions/{conditionId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param conditionId [required]
[ "Delete", "the", "given", "condition" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3355-L3359
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldTracker.java
TldTracker.setTrackerLocation
public void setTrackerLocation( int x0 , int y0 , int x1 , int y1 ) { int width = x1-x0; int height = y1-y0; // change change in scale double scale = (width/targetRegion.getWidth() + height/targetRegion.getHeight())/2.0; // new center location double centerX = (x0+x1)/2.0; double centerY = (y0+y1)/2.0; targetRegion.p0.x = centerX-scale*targetRegion.getWidth()/2.0; targetRegion.p1.x = targetRegion.p0.x + scale*targetRegion.getWidth(); targetRegion.p0.y = centerY-scale*targetRegion.getHeight()/2.0; targetRegion.p1.y = targetRegion.p0.y + scale*targetRegion.getHeight(); }
java
public void setTrackerLocation( int x0 , int y0 , int x1 , int y1 ) { int width = x1-x0; int height = y1-y0; // change change in scale double scale = (width/targetRegion.getWidth() + height/targetRegion.getHeight())/2.0; // new center location double centerX = (x0+x1)/2.0; double centerY = (y0+y1)/2.0; targetRegion.p0.x = centerX-scale*targetRegion.getWidth()/2.0; targetRegion.p1.x = targetRegion.p0.x + scale*targetRegion.getWidth(); targetRegion.p0.y = centerY-scale*targetRegion.getHeight()/2.0; targetRegion.p1.y = targetRegion.p0.y + scale*targetRegion.getHeight(); }
[ "public", "void", "setTrackerLocation", "(", "int", "x0", ",", "int", "y0", ",", "int", "x1", ",", "int", "y1", ")", "{", "int", "width", "=", "x1", "-", "x0", ";", "int", "height", "=", "y1", "-", "y0", ";", "// change change in scale", "double", "s...
Used to set the location of the track without changing any appearance history. Move the track region but keep the same aspect ratio as it had before So scale the region and re-center it
[ "Used", "to", "set", "the", "location", "of", "the", "track", "without", "changing", "any", "appearance", "history", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/tracker/tld/TldTracker.java#L183-L199
geomajas/geomajas-project-client-gwt2
impl/src/main/java/org/geomajas/gwt2/client/map/feature/JsonFeatureFactory.java
JsonFeatureFactory.createCollection
public FeatureCollection createCollection(JSONObject jsonObject, FeaturesSupported layer) { FeatureCollection dto = new FeatureCollection(layer); String type = JsonService.getStringValue(jsonObject, "type"); if ("FeatureCollection".equals(type)) { JSONArray features = JsonService.getChildArray(jsonObject, "features"); for (int i = 0; i < features.size(); i++) { dto.getFeatures().add(createFeature((JSONObject) features.get(i), layer)); } } else if ("Feature".equals(type)) { dto.getFeatures().add(createFeature(jsonObject, layer)); } return dto; }
java
public FeatureCollection createCollection(JSONObject jsonObject, FeaturesSupported layer) { FeatureCollection dto = new FeatureCollection(layer); String type = JsonService.getStringValue(jsonObject, "type"); if ("FeatureCollection".equals(type)) { JSONArray features = JsonService.getChildArray(jsonObject, "features"); for (int i = 0; i < features.size(); i++) { dto.getFeatures().add(createFeature((JSONObject) features.get(i), layer)); } } else if ("Feature".equals(type)) { dto.getFeatures().add(createFeature(jsonObject, layer)); } return dto; }
[ "public", "FeatureCollection", "createCollection", "(", "JSONObject", "jsonObject", ",", "FeaturesSupported", "layer", ")", "{", "FeatureCollection", "dto", "=", "new", "FeatureCollection", "(", "layer", ")", ";", "String", "type", "=", "JsonService", ".", "getStrin...
Create a feature collection for this layer. @param jsonObject @param layer the layer (optional) @return the feature
[ "Create", "a", "feature", "collection", "for", "this", "layer", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/impl/src/main/java/org/geomajas/gwt2/client/map/feature/JsonFeatureFactory.java#L44-L56
structr/structr
structr-core/src/main/java/javatools/parsers/Char.java
Char.truncate
public static CharSequence truncate(CharSequence s, int len) { if (s.length() == len) return (s); if (s.length() > len) return (s.subSequence(0, len)); StringBuilder result = new StringBuilder(s); while (result.length() < len) result.append(' '); return (result); }
java
public static CharSequence truncate(CharSequence s, int len) { if (s.length() == len) return (s); if (s.length() > len) return (s.subSequence(0, len)); StringBuilder result = new StringBuilder(s); while (result.length() < len) result.append(' '); return (result); }
[ "public", "static", "CharSequence", "truncate", "(", "CharSequence", "s", ",", "int", "len", ")", "{", "if", "(", "s", ".", "length", "(", ")", "==", "len", ")", "return", "(", "s", ")", ";", "if", "(", "s", ".", "length", "(", ")", ">", "len", ...
Returns a string of the given length, fills with spaces if necessary
[ "Returns", "a", "string", "of", "the", "given", "length", "fills", "with", "spaces", "if", "necessary" ]
train
https://github.com/structr/structr/blob/c111a1d0c0201c7fea5574ed69aa5a5053185a97/structr-core/src/main/java/javatools/parsers/Char.java#L1410-L1417
JodaOrg/joda-beans
src/main/java/org/joda/beans/ser/JodaBeanSer.java
JodaBeanSer.withIncludeDerived
public JodaBeanSer withIncludeDerived(boolean includeDerived) { return new JodaBeanSer(indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived); }
java
public JodaBeanSer withIncludeDerived(boolean includeDerived) { return new JodaBeanSer(indent, newLine, converter, iteratorFactory, shortTypes, deserializers, includeDerived); }
[ "public", "JodaBeanSer", "withIncludeDerived", "(", "boolean", "includeDerived", ")", "{", "return", "new", "JodaBeanSer", "(", "indent", ",", "newLine", ",", "converter", ",", "iteratorFactory", ",", "shortTypes", ",", "deserializers", ",", "includeDerived", ")", ...
Returns a copy of this serializer with the specified include derived flag. <p> The default deserializers can be modified. <p> This is used to set the output to include derived properties. @param includeDerived whether to include derived properties on output @return a copy of this object with the converter changed, not null
[ "Returns", "a", "copy", "of", "this", "serializer", "with", "the", "specified", "include", "derived", "flag", ".", "<p", ">", "The", "default", "deserializers", "can", "be", "modified", ".", "<p", ">", "This", "is", "used", "to", "set", "the", "output", ...
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/JodaBeanSer.java#L253-L255
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/db/DBOutputFormat.java
DBOutputFormat.setOutput
public static void setOutput(JobConf job, String tableName, String... fieldNames) { job.setOutputFormat(DBOutputFormat.class); job.setReduceSpeculativeExecution(false); DBConfiguration dbConf = new DBConfiguration(job); dbConf.setOutputTableName(tableName); dbConf.setOutputFieldNames(fieldNames); }
java
public static void setOutput(JobConf job, String tableName, String... fieldNames) { job.setOutputFormat(DBOutputFormat.class); job.setReduceSpeculativeExecution(false); DBConfiguration dbConf = new DBConfiguration(job); dbConf.setOutputTableName(tableName); dbConf.setOutputFieldNames(fieldNames); }
[ "public", "static", "void", "setOutput", "(", "JobConf", "job", ",", "String", "tableName", ",", "String", "...", "fieldNames", ")", "{", "job", ".", "setOutputFormat", "(", "DBOutputFormat", ".", "class", ")", ";", "job", ".", "setReduceSpeculativeExecution", ...
Initializes the reduce-part of the job with the appropriate output settings @param job The job @param tableName The table to insert data into @param fieldNames The field names in the table. If unknown, supply the appropriate number of nulls.
[ "Initializes", "the", "reduce", "-", "part", "of", "the", "job", "with", "the", "appropriate", "output", "settings" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/db/DBOutputFormat.java#L177-L185
racc/typesafeconfig-guice
src/main/java/com/github/racc/tscg/TypesafeConfigModule.java
TypesafeConfigModule.fromConfigWithReflections
public static TypesafeConfigModule fromConfigWithReflections(Config config, Reflections reflections) { return new TypesafeConfigModule(config, new ReflectionsReflector(reflections)); }
java
public static TypesafeConfigModule fromConfigWithReflections(Config config, Reflections reflections) { return new TypesafeConfigModule(config, new ReflectionsReflector(reflections)); }
[ "public", "static", "TypesafeConfigModule", "fromConfigWithReflections", "(", "Config", "config", ",", "Reflections", "reflections", ")", "{", "return", "new", "TypesafeConfigModule", "(", "config", ",", "new", "ReflectionsReflector", "(", "reflections", ")", ")", ";"...
Scans the specified packages for annotated classes, and applies Config values to them. @param config the Config to derive values from @param reflections the reflections object to use @return The constructed TypesafeConfigModule.
[ "Scans", "the", "specified", "packages", "for", "annotated", "classes", "and", "applies", "Config", "values", "to", "them", "." ]
train
https://github.com/racc/typesafeconfig-guice/blob/95e383ced94fe59f4a651d043f9d1764bc618a94/src/main/java/com/github/racc/tscg/TypesafeConfigModule.java#L89-L91
codegist/crest
core/src/main/java/org/codegist/crest/CRestBuilder.java
CRestBuilder.bindDeserializer
public CRestBuilder bindDeserializer(Class<? extends Deserializer> deserializer, Class<?>... classes) { return bindDeserializer(deserializer, classes, Collections.<String, Object>emptyMap()); }
java
public CRestBuilder bindDeserializer(Class<? extends Deserializer> deserializer, Class<?>... classes) { return bindDeserializer(deserializer, classes, Collections.<String, Object>emptyMap()); }
[ "public", "CRestBuilder", "bindDeserializer", "(", "Class", "<", "?", "extends", "Deserializer", ">", "deserializer", ",", "Class", "<", "?", ">", "...", "classes", ")", "{", "return", "bindDeserializer", "(", "deserializer", ",", "classes", ",", "Collections", ...
<p>Binds a deserializer to a list of interface method's return types.</p> <p>By default, <b>CRest</b> handle the following types:</p> <ul> <li>all primitives and wrapper types</li> <li>java.io.InputStream</li> <li>java.io.Reader</li> </ul> <p>Meaning that any interface method return type can be by default one of these types.</p> @param deserializer Deserializer class to use for the given interface method's return types @param classes Interface method's return types to bind deserializer to @return current builder
[ "<p", ">", "Binds", "a", "deserializer", "to", "a", "list", "of", "interface", "method", "s", "return", "types", ".", "<", "/", "p", ">", "<p", ">", "By", "default", "<b", ">", "CRest<", "/", "b", ">", "handle", "the", "following", "types", ":", "<...
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L546-L548
google/closure-compiler
src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java
DevirtualizePrototypeMethods.rewriteDefinition
private void rewriteDefinition(Node definitionSite, String newMethodName) { final Node function; final Node subtreeToRemove; final Node nameSource; switch (definitionSite.getToken()) { case GETPROP: function = definitionSite.getParent().getLastChild(); nameSource = definitionSite.getLastChild(); subtreeToRemove = NodeUtil.getEnclosingStatement(definitionSite); break; case STRING_KEY: case MEMBER_FUNCTION_DEF: function = definitionSite.getLastChild(); nameSource = definitionSite; subtreeToRemove = definitionSite; break; default: throw new IllegalArgumentException(definitionSite.toString()); } // Define a new variable after the original declaration. Node statement = NodeUtil.getEnclosingStatement(definitionSite); Node newNameNode = IR.name(newMethodName).useSourceInfoIfMissingFrom(nameSource); Node newVarNode = IR.var(newNameNode).useSourceInfoIfMissingFrom(nameSource); statement.getParent().addChildBefore(newVarNode, statement); // Attatch the function to the new variable. function.detach(); newNameNode.addChildToFront(function); // Create the `this` param. String selfName = newMethodName + "$self"; Node paramList = function.getSecondChild(); paramList.addChildToFront(IR.name(selfName).useSourceInfoIfMissingFrom(function)); compiler.reportChangeToEnclosingScope(paramList); // Eliminate `this`. replaceReferencesToThis(function.getSecondChild(), selfName); // In default param values. replaceReferencesToThis(function.getLastChild(), selfName); // In function body. fixFunctionType(function); // Clean up dangling AST. NodeUtil.deleteNode(subtreeToRemove, compiler); compiler.reportChangeToEnclosingScope(newVarNode); }
java
private void rewriteDefinition(Node definitionSite, String newMethodName) { final Node function; final Node subtreeToRemove; final Node nameSource; switch (definitionSite.getToken()) { case GETPROP: function = definitionSite.getParent().getLastChild(); nameSource = definitionSite.getLastChild(); subtreeToRemove = NodeUtil.getEnclosingStatement(definitionSite); break; case STRING_KEY: case MEMBER_FUNCTION_DEF: function = definitionSite.getLastChild(); nameSource = definitionSite; subtreeToRemove = definitionSite; break; default: throw new IllegalArgumentException(definitionSite.toString()); } // Define a new variable after the original declaration. Node statement = NodeUtil.getEnclosingStatement(definitionSite); Node newNameNode = IR.name(newMethodName).useSourceInfoIfMissingFrom(nameSource); Node newVarNode = IR.var(newNameNode).useSourceInfoIfMissingFrom(nameSource); statement.getParent().addChildBefore(newVarNode, statement); // Attatch the function to the new variable. function.detach(); newNameNode.addChildToFront(function); // Create the `this` param. String selfName = newMethodName + "$self"; Node paramList = function.getSecondChild(); paramList.addChildToFront(IR.name(selfName).useSourceInfoIfMissingFrom(function)); compiler.reportChangeToEnclosingScope(paramList); // Eliminate `this`. replaceReferencesToThis(function.getSecondChild(), selfName); // In default param values. replaceReferencesToThis(function.getLastChild(), selfName); // In function body. fixFunctionType(function); // Clean up dangling AST. NodeUtil.deleteNode(subtreeToRemove, compiler); compiler.reportChangeToEnclosingScope(newVarNode); }
[ "private", "void", "rewriteDefinition", "(", "Node", "definitionSite", ",", "String", "newMethodName", ")", "{", "final", "Node", "function", ";", "final", "Node", "subtreeToRemove", ";", "final", "Node", "nameSource", ";", "switch", "(", "definitionSite", ".", ...
Rewrites method definitions as global functions that take "this" as their first argument. <p>Before: a.prototype.b = function(a, b, c) {...} <p>After: var b = function(self, a, b, c) {...}
[ "Rewrites", "method", "definitions", "as", "global", "functions", "that", "take", "this", "as", "their", "first", "argument", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/DevirtualizePrototypeMethods.java#L397-L445
openwms/org.openwms
org.openwms.core.util/src/main/java/org/openwms/core/SecurityUtils.java
SecurityUtils.createHeaders
public static HttpHeaders createHeaders(String username, String password) { if (username == null || username.isEmpty()) { return new HttpHeaders(); } String auth = username + ":" + password; byte[] encodedAuth = Base64.getEncoder().encode(auth.getBytes(StandardCharsets.UTF_8)); String authHeader = "Basic " + new String(encodedAuth); HttpHeaders result = new HttpHeaders(); result.add(HttpHeaders.AUTHORIZATION, authHeader); return result; }
java
public static HttpHeaders createHeaders(String username, String password) { if (username == null || username.isEmpty()) { return new HttpHeaders(); } String auth = username + ":" + password; byte[] encodedAuth = Base64.getEncoder().encode(auth.getBytes(StandardCharsets.UTF_8)); String authHeader = "Basic " + new String(encodedAuth); HttpHeaders result = new HttpHeaders(); result.add(HttpHeaders.AUTHORIZATION, authHeader); return result; }
[ "public", "static", "HttpHeaders", "createHeaders", "(", "String", "username", ",", "String", "password", ")", "{", "if", "(", "username", "==", "null", "||", "username", ".", "isEmpty", "(", ")", ")", "{", "return", "new", "HttpHeaders", "(", ")", ";", ...
With the given {@code username} and {@code password} create a Base64 encoded valid http BASIC schema authorization header, and return it within a {@link HttpHeaders} object. @param username The BASIC auth username @param password The BASIC auth password @return The HttpHeaders object containing the Authorization Header
[ "With", "the", "given", "{", "@code", "username", "}", "and", "{", "@code", "password", "}", "create", "a", "Base64", "encoded", "valid", "http", "BASIC", "schema", "authorization", "header", "and", "return", "it", "within", "a", "{", "@link", "HttpHeaders",...
train
https://github.com/openwms/org.openwms/blob/b24a95c5d09a7ec3c723d7e107d1cb0039d06a7e/org.openwms.core.util/src/main/java/org/openwms/core/SecurityUtils.java#L41-L52
tvesalainen/lpg
src/main/java/org/vesalainen/grammar/Grammar.java
Grammar.addRule
public void addRule(String nonterminal, List<String> rhs) { addRule(null, nonterminal, "", false, rhs); }
java
public void addRule(String nonterminal, List<String> rhs) { addRule(null, nonterminal, "", false, rhs); }
[ "public", "void", "addRule", "(", "String", "nonterminal", ",", "List", "<", "String", ">", "rhs", ")", "{", "addRule", "(", "null", ",", "nonterminal", ",", "\"\"", ",", "false", ",", "rhs", ")", ";", "}" ]
Adds new rule if the same rule doesn't exist already. @param nonterminal Left hand side of the rule. @param rhs
[ "Adds", "new", "rule", "if", "the", "same", "rule", "doesn", "t", "exist", "already", "." ]
train
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/grammar/Grammar.java#L283-L286
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeList
protected static void writeList(Output out, List<?> list) { if (!list.isEmpty()) { int size = list.size(); // if its a small list, write it as an array if (size < 100) { out.writeArray(list); return; } // else we should check for lots of null values, // if there are over 80% then its probably best to do it as a map int nullCount = 0; for (int i = 0; i < size; i++) { if (list.get(i) == null) { nullCount++; } } if (nullCount > (size * 0.8)) { out.writeMap(list); } else { out.writeArray(list); } } else { out.writeArray(new Object[] {}); } }
java
protected static void writeList(Output out, List<?> list) { if (!list.isEmpty()) { int size = list.size(); // if its a small list, write it as an array if (size < 100) { out.writeArray(list); return; } // else we should check for lots of null values, // if there are over 80% then its probably best to do it as a map int nullCount = 0; for (int i = 0; i < size; i++) { if (list.get(i) == null) { nullCount++; } } if (nullCount > (size * 0.8)) { out.writeMap(list); } else { out.writeArray(list); } } else { out.writeArray(new Object[] {}); } }
[ "protected", "static", "void", "writeList", "(", "Output", "out", ",", "List", "<", "?", ">", "list", ")", "{", "if", "(", "!", "list", ".", "isEmpty", "(", ")", ")", "{", "int", "size", "=", "list", ".", "size", "(", ")", ";", "// if its a small l...
Writes a List out as an Object @param out Output writer @param list List to write as Object
[ "Writes", "a", "List", "out", "as", "an", "Object" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L218-L242
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.hosting_web_serviceName_cdn_duration_GET
public OvhOrder hosting_web_serviceName_cdn_duration_GET(String serviceName, String duration, OvhCdnOfferEnum offer) throws IOException { String qPath = "/order/hosting/web/{serviceName}/cdn/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "offer", offer); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder hosting_web_serviceName_cdn_duration_GET(String serviceName, String duration, OvhCdnOfferEnum offer) throws IOException { String qPath = "/order/hosting/web/{serviceName}/cdn/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "offer", offer); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "hosting_web_serviceName_cdn_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhCdnOfferEnum", "offer", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/hosting/web/{serviceName}/cdn/{duration}\"", ";", ...
Get prices and contracts information REST: GET /order/hosting/web/{serviceName}/cdn/{duration} @param offer [required] Cdn offers you can add to your hosting @param serviceName [required] The internal name of your hosting @param duration [required] Duration
[ "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#L4997-L5003
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/logging/messages/consumer/ConsumerLogMessages.java
ConsumerLogMessages.logException
public static void logException(final Logger logger, final Exception e) { logger.logException(Level.ERROR, "Unexpected Exception", e); }
java
public static void logException(final Logger logger, final Exception e) { logger.logException(Level.ERROR, "Unexpected Exception", e); }
[ "public", "static", "void", "logException", "(", "final", "Logger", "logger", ",", "final", "Exception", "e", ")", "{", "logger", ".", "logException", "(", "Level", ".", "ERROR", ",", "\"Unexpected Exception\"", ",", "e", ")", ";", "}" ]
Logs an exception. @param logger reference to the logger @param e reference to the exception
[ "Logs", "an", "exception", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.revisionmachine/src/main/java/de/tudarmstadt/ukp/wikipedia/revisionmachine/common/logging/messages/consumer/ConsumerLogMessages.java#L67-L70
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java
CacheStatsModule.updateCacheSizes
public void updateCacheSizes(long max, long current) { final String methodName = "updateCacheSizes()"; if (tc.isDebugEnabled() && null != _maxInMemoryCacheEntryCount && null != _inMemoryCacheEntryCount) { if (max != _maxInMemoryCacheEntryCount.getCount() && _inMemoryCacheEntryCount.getCount() != current) Tr.debug(tc, methodName + " cacheName=" + _sCacheName + " max=" + max + " current=" + current + " enable=" + this._enable, this); } if (_enable) { if (_maxInMemoryCacheEntryCount != null) _maxInMemoryCacheEntryCount.setCount(max); if (_inMemoryCacheEntryCount != null) _inMemoryCacheEntryCount.setCount(current); } }
java
public void updateCacheSizes(long max, long current) { final String methodName = "updateCacheSizes()"; if (tc.isDebugEnabled() && null != _maxInMemoryCacheEntryCount && null != _inMemoryCacheEntryCount) { if (max != _maxInMemoryCacheEntryCount.getCount() && _inMemoryCacheEntryCount.getCount() != current) Tr.debug(tc, methodName + " cacheName=" + _sCacheName + " max=" + max + " current=" + current + " enable=" + this._enable, this); } if (_enable) { if (_maxInMemoryCacheEntryCount != null) _maxInMemoryCacheEntryCount.setCount(max); if (_inMemoryCacheEntryCount != null) _inMemoryCacheEntryCount.setCount(current); } }
[ "public", "void", "updateCacheSizes", "(", "long", "max", ",", "long", "current", ")", "{", "final", "String", "methodName", "=", "\"updateCacheSizes()\"", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", "&&", "null", "!=", "_maxInMemoryCacheEntryCount", ...
Updates statistics using two supplied arguments - maxInMemoryCacheSize and currentInMemoryCacheSize. @param max Maximum # of entries that can be stored in memory @param current Current # of in memory cache entries
[ "Updates", "statistics", "using", "two", "supplied", "arguments", "-", "maxInMemoryCacheSize", "and", "currentInMemoryCacheSize", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache.monitor/src/com/ibm/ws/cache/stat/internal/CacheStatsModule.java#L635-L651
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java
FilesImpl.listFromComputeNodeNext
public PagedList<NodeFile> listFromComputeNodeNext(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions) { ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> response = listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions).toBlocking().single(); return new PagedList<NodeFile>(response.body()) { @Override public Page<NodeFile> nextPage(String nextPageLink) { return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions).toBlocking().single().body(); } }; }
java
public PagedList<NodeFile> listFromComputeNodeNext(final String nextPageLink, final FileListFromComputeNodeNextOptions fileListFromComputeNodeNextOptions) { ServiceResponseWithHeaders<Page<NodeFile>, FileListFromComputeNodeHeaders> response = listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions).toBlocking().single(); return new PagedList<NodeFile>(response.body()) { @Override public Page<NodeFile> nextPage(String nextPageLink) { return listFromComputeNodeNextSinglePageAsync(nextPageLink, fileListFromComputeNodeNextOptions).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "NodeFile", ">", "listFromComputeNodeNext", "(", "final", "String", "nextPageLink", ",", "final", "FileListFromComputeNodeNextOptions", "fileListFromComputeNodeNextOptions", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "NodeFile", ">...
Lists all of the files in task directories on the specified compute node. @param nextPageLink The NextLink from the previous successful call to List operation. @param fileListFromComputeNodeNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;NodeFile&gt; object if successful.
[ "Lists", "all", "of", "the", "files", "in", "task", "directories", "on", "the", "specified", "compute", "node", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/FilesImpl.java#L2588-L2596
XDean/Java-EX
src/main/java/xdean/jex/util/reflect/GenericUtil.java
GenericUtil.getActualType
private static Type getActualType(Map<TypeVariable<?>, Type> map, Type type) { return TypeVisitor.of(type, b -> b .onClass(c -> c) .onTypeVariable(tv -> map.containsKey(tv) ? getActualType(map, map.get(tv)) : tv) .onParameterizedType(pt -> TypeVisitor.of(pt.getRawType(), bb -> bb .onClass(c -> createParameterizedType(c, pt.getOwnerType(), Arrays.stream(pt.getActualTypeArguments()).map(t -> getActualType(map, t)).toArray(Type[]::new))) .result())) .onWildcardType(wt -> createWildcardType( Arrays.stream(wt.getUpperBounds()).map(t -> getActualType(map, t)).toArray(Type[]::new), Arrays.stream(wt.getLowerBounds()).map(t -> getActualType(map, t)).toArray(Type[]::new))) .onGenericArrayType(gat -> createGenericArrayType(getActualType(map, gat.getGenericComponentType()))) .result(type)); }
java
private static Type getActualType(Map<TypeVariable<?>, Type> map, Type type) { return TypeVisitor.of(type, b -> b .onClass(c -> c) .onTypeVariable(tv -> map.containsKey(tv) ? getActualType(map, map.get(tv)) : tv) .onParameterizedType(pt -> TypeVisitor.of(pt.getRawType(), bb -> bb .onClass(c -> createParameterizedType(c, pt.getOwnerType(), Arrays.stream(pt.getActualTypeArguments()).map(t -> getActualType(map, t)).toArray(Type[]::new))) .result())) .onWildcardType(wt -> createWildcardType( Arrays.stream(wt.getUpperBounds()).map(t -> getActualType(map, t)).toArray(Type[]::new), Arrays.stream(wt.getLowerBounds()).map(t -> getActualType(map, t)).toArray(Type[]::new))) .onGenericArrayType(gat -> createGenericArrayType(getActualType(map, gat.getGenericComponentType()))) .result(type)); }
[ "private", "static", "Type", "getActualType", "(", "Map", "<", "TypeVariable", "<", "?", ">", ",", "Type", ">", "map", ",", "Type", "type", ")", "{", "return", "TypeVisitor", ".", "of", "(", "type", ",", "b", "->", "b", ".", "onClass", "(", "c", "-...
Get actual type by the type map. @param map @param type @return The actual type. Return itself if it's already the most explicit type.
[ "Get", "actual", "type", "by", "the", "type", "map", "." ]
train
https://github.com/XDean/Java-EX/blob/9208ba71c5b2af9f9bd979d01fab2ff5e433b3e7/src/main/java/xdean/jex/util/reflect/GenericUtil.java#L132-L145
cybazeitalia/emaze-dysfunctional
src/main/java/net/emaze/dysfunctional/Spies.java
Spies.spy1st
public static <T> Consumer<T> spy1st(Consumer<T> consumer, Box<T> param) { return spy(consumer, param); }
java
public static <T> Consumer<T> spy1st(Consumer<T> consumer, Box<T> param) { return spy(consumer, param); }
[ "public", "static", "<", "T", ">", "Consumer", "<", "T", ">", "spy1st", "(", "Consumer", "<", "T", ">", "consumer", ",", "Box", "<", "T", ">", "param", ")", "{", "return", "spy", "(", "consumer", ",", "param", ")", ";", "}" ]
Proxies a binary consumer spying for first parameter. @param <T> the consumer parameter type @param consumer the consumer that will be spied @param param a box that will be containing the spied parameter @return the proxied consumer
[ "Proxies", "a", "binary", "consumer", "spying", "for", "first", "parameter", "." ]
train
https://github.com/cybazeitalia/emaze-dysfunctional/blob/98115a436e35335c5e8831f9fdc12f6d93d524be/src/main/java/net/emaze/dysfunctional/Spies.java#L387-L389
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerDumpPackager.java
ServerDumpPackager.packageServerDumps
private ReturnCode packageServerDumps(File packageFile, List<String> javaDumps) { DumpProcessor processor = new DumpProcessor(serverName, packageFile, bootProps, javaDumps); return processor.execute(); }
java
private ReturnCode packageServerDumps(File packageFile, List<String> javaDumps) { DumpProcessor processor = new DumpProcessor(serverName, packageFile, bootProps, javaDumps); return processor.execute(); }
[ "private", "ReturnCode", "packageServerDumps", "(", "File", "packageFile", ",", "List", "<", "String", ">", "javaDumps", ")", "{", "DumpProcessor", "processor", "=", "new", "DumpProcessor", "(", "serverName", ",", "packageFile", ",", "bootProps", ",", "javaDumps",...
Creates an archive containing the server dumps, server configurations. @param packageFile @return
[ "Creates", "an", "archive", "containing", "the", "server", "dumps", "server", "configurations", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/commands/ServerDumpPackager.java#L354-L357
atteo/classindex
classindex/src/main/java/org/atteo/classindex/ClassIndex.java
ClassIndex.getPackageClasses
public static Iterable<Class<?>> getPackageClasses(String packageName) { return getPackageClasses(packageName, Thread.currentThread().getContextClassLoader()); }
java
public static Iterable<Class<?>> getPackageClasses(String packageName) { return getPackageClasses(packageName, Thread.currentThread().getContextClassLoader()); }
[ "public", "static", "Iterable", "<", "Class", "<", "?", ">", ">", "getPackageClasses", "(", "String", "packageName", ")", "{", "return", "getPackageClasses", "(", "packageName", ",", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ...
Retrieves a list of classes from given package. <p/> <p> The package must be annotated with {@link IndexSubclasses} for the classes inside to be indexed at compile-time by {@link org.atteo.classindex.processor.ClassIndexProcessor}. </p> @param packageName name of the package to search classes for @return list of classes from package
[ "Retrieves", "a", "list", "of", "classes", "from", "given", "package", ".", "<p", "/", ">", "<p", ">", "The", "package", "must", "be", "annotated", "with", "{", "@link", "IndexSubclasses", "}", "for", "the", "classes", "inside", "to", "be", "indexed", "a...
train
https://github.com/atteo/classindex/blob/ad76c6bd8b4e84c594d94e48f466a095ffe2306a/classindex/src/main/java/org/atteo/classindex/ClassIndex.java#L173-L175
facebook/fresco
samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java
DefaultZoomableController.limitTranslation
private boolean limitTranslation(Matrix transform, @LimitFlag int limitTypes) { if (!shouldLimit(limitTypes, LIMIT_TRANSLATION_X | LIMIT_TRANSLATION_Y)) { return false; } RectF b = mTempRect; b.set(mImageBounds); transform.mapRect(b); float offsetLeft = shouldLimit(limitTypes, LIMIT_TRANSLATION_X) ? getOffset(b.left, b.right, mViewBounds.left, mViewBounds.right, mImageBounds.centerX()) : 0; float offsetTop = shouldLimit(limitTypes, LIMIT_TRANSLATION_Y) ? getOffset(b.top, b.bottom, mViewBounds.top, mViewBounds.bottom, mImageBounds.centerY()) : 0; if (offsetLeft != 0 || offsetTop != 0) { transform.postTranslate(offsetLeft, offsetTop); return true; } return false; }
java
private boolean limitTranslation(Matrix transform, @LimitFlag int limitTypes) { if (!shouldLimit(limitTypes, LIMIT_TRANSLATION_X | LIMIT_TRANSLATION_Y)) { return false; } RectF b = mTempRect; b.set(mImageBounds); transform.mapRect(b); float offsetLeft = shouldLimit(limitTypes, LIMIT_TRANSLATION_X) ? getOffset(b.left, b.right, mViewBounds.left, mViewBounds.right, mImageBounds.centerX()) : 0; float offsetTop = shouldLimit(limitTypes, LIMIT_TRANSLATION_Y) ? getOffset(b.top, b.bottom, mViewBounds.top, mViewBounds.bottom, mImageBounds.centerY()) : 0; if (offsetLeft != 0 || offsetTop != 0) { transform.postTranslate(offsetLeft, offsetTop); return true; } return false; }
[ "private", "boolean", "limitTranslation", "(", "Matrix", "transform", ",", "@", "LimitFlag", "int", "limitTypes", ")", "{", "if", "(", "!", "shouldLimit", "(", "limitTypes", ",", "LIMIT_TRANSLATION_X", "|", "LIMIT_TRANSLATION_Y", ")", ")", "{", "return", "false"...
Limits the translation so that there are no empty spaces on the sides if possible. <p> The image is attempted to be centered within the view bounds if the transformed image is smaller. There will be no empty spaces within the view bounds if the transformed image is bigger. This applies to each dimension (horizontal and vertical) independently. @param limitTypes whether to limit translation along the specific axis. @return whether limiting has been applied or not
[ "Limits", "the", "translation", "so", "that", "there", "are", "no", "empty", "spaces", "on", "the", "sides", "if", "possible", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/samples/zoomable/src/main/java/com/facebook/samples/zoomable/DefaultZoomableController.java#L523-L539
apache/flink
flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java
MetricConfig.getInteger
public int getInteger(String key, int defaultValue) { String argument = getProperty(key, null); return argument == null ? defaultValue : Integer.parseInt(argument); }
java
public int getInteger(String key, int defaultValue) { String argument = getProperty(key, null); return argument == null ? defaultValue : Integer.parseInt(argument); }
[ "public", "int", "getInteger", "(", "String", "key", ",", "int", "defaultValue", ")", "{", "String", "argument", "=", "getProperty", "(", "key", ",", "null", ")", ";", "return", "argument", "==", "null", "?", "defaultValue", ":", "Integer", ".", "parseInt"...
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found. @param key the hashtable key. @param defaultValue a default value. @return the value in this property list with the specified key value parsed as an int.
[ "Searches", "for", "the", "property", "with", "the", "specified", "key", "in", "this", "property", "list", ".", "If", "the", "key", "is", "not", "found", "in", "this", "property", "list", "the", "default", "property", "list", "and", "its", "defaults", "rec...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-metrics/flink-metrics-core/src/main/java/org/apache/flink/metrics/MetricConfig.java#L42-L47
algolia/instantsearch-android
ui/src/main/java/com/algolia/instantsearch/ui/databinding/BindingHelper.java
BindingHelper.setVariantForView
@Nullable public static String setVariantForView(@NonNull View view, @Nullable String variant) { String previousVariant = null; String previousAttribute = null; for (Map.Entry<String, HashMap<Integer, String>> entry : bindings.entrySet()) { if (entry.getValue().containsKey(view.getId())) { previousVariant = entry.getKey(); previousAttribute = entry.getValue().get(view.getId()); bindings.remove(previousVariant); break; } } mapAttribute(previousAttribute, view.getId(), variant, view.getClass().getSimpleName()); return previousVariant; }
java
@Nullable public static String setVariantForView(@NonNull View view, @Nullable String variant) { String previousVariant = null; String previousAttribute = null; for (Map.Entry<String, HashMap<Integer, String>> entry : bindings.entrySet()) { if (entry.getValue().containsKey(view.getId())) { previousVariant = entry.getKey(); previousAttribute = entry.getValue().get(view.getId()); bindings.remove(previousVariant); break; } } mapAttribute(previousAttribute, view.getId(), variant, view.getClass().getSimpleName()); return previousVariant; }
[ "@", "Nullable", "public", "static", "String", "setVariantForView", "(", "@", "NonNull", "View", "view", ",", "@", "Nullable", "String", "variant", ")", "{", "String", "previousVariant", "=", "null", ";", "String", "previousAttribute", "=", "null", ";", "for",...
Associates programmatically a view with a variant. @param view any existing view. @return the previous variant for this view, if any.
[ "Associates", "programmatically", "a", "view", "with", "a", "variant", "." ]
train
https://github.com/algolia/instantsearch-android/blob/12092ec30140df9ffc2bf916339b433372034616/ui/src/main/java/com/algolia/instantsearch/ui/databinding/BindingHelper.java#L119-L133
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Notification.java
Notification.getMetricToAnnotate
public static Metric getMetricToAnnotate(String metric) { Metric result = null; if (metric != null && !metric.isEmpty()) { Pattern pattern = Pattern.compile( "([\\w,\\-,\\.,/]+):([\\w,\\-,\\.,/]+)(\\{(?:[\\w,\\-,\\.,/]+=[\\w,\\-,\\.,/,\\*,|]+)(?:,[\\w,\\-,\\.,/]+=[\\w,\\-,\\.,/,\\*,|]+)*\\})?:([\\w,\\-,\\.,/]+)"); Matcher matcher = pattern.matcher(metric.replaceAll("\\s", "")); if (matcher.matches()) { String scopeName = matcher.group(1); String metricName = matcher.group(2); String tagString = matcher.group(3); Map<String, String> tags = new HashMap<>(); if (tagString != null) { tagString = tagString.replaceAll("\\{", "").replaceAll("\\}", ""); for (String tag : tagString.split(",")) { String[] entry = tag.split("="); tags.put(entry[0], entry[1]); } } result = new Metric(scopeName, metricName); result.setTags(tags); } } return result; }
java
public static Metric getMetricToAnnotate(String metric) { Metric result = null; if (metric != null && !metric.isEmpty()) { Pattern pattern = Pattern.compile( "([\\w,\\-,\\.,/]+):([\\w,\\-,\\.,/]+)(\\{(?:[\\w,\\-,\\.,/]+=[\\w,\\-,\\.,/,\\*,|]+)(?:,[\\w,\\-,\\.,/]+=[\\w,\\-,\\.,/,\\*,|]+)*\\})?:([\\w,\\-,\\.,/]+)"); Matcher matcher = pattern.matcher(metric.replaceAll("\\s", "")); if (matcher.matches()) { String scopeName = matcher.group(1); String metricName = matcher.group(2); String tagString = matcher.group(3); Map<String, String> tags = new HashMap<>(); if (tagString != null) { tagString = tagString.replaceAll("\\{", "").replaceAll("\\}", ""); for (String tag : tagString.split(",")) { String[] entry = tag.split("="); tags.put(entry[0], entry[1]); } } result = new Metric(scopeName, metricName); result.setTags(tags); } } return result; }
[ "public", "static", "Metric", "getMetricToAnnotate", "(", "String", "metric", ")", "{", "Metric", "result", "=", "null", ";", "if", "(", "metric", "!=", "null", "&&", "!", "metric", ".", "isEmpty", "(", ")", ")", "{", "Pattern", "pattern", "=", "Pattern"...
Given a metric to annotate expression, return a corresponding metric object. @param metric The metric to annotate expression. @return The corresponding metric or null if the metric to annotate expression is invalid.
[ "Given", "a", "metric", "to", "annotate", "expression", "return", "a", "corresponding", "metric", "object", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/entity/Notification.java#L367-L394
drapostolos/type-parser
src/main/java/com/github/drapostolos/typeparser/TypeParserBuilder.java
TypeParserBuilder.registerParser
public <T> TypeParserBuilder registerParser(Class<T> targetType, Parser<T> parser) { if (parser == null) { throw new NullPointerException(makeNullArgumentErrorMsg("parser")); } if (targetType == null) { throw new NullPointerException(makeNullArgumentErrorMsg("targetType")); } if (targetType.isArray()) { String message = "Cannot register Parser for array class. Register a Parser for " + "the component type '%s' instead, as arrays are handled automatically " + "internally in type-parser."; Class<?> componentType = targetType.getComponentType(); throw new IllegalArgumentException(String.format(message, componentType.getName())); } parsers.put(targetType, decorateParser(targetType, parser)); return this; }
java
public <T> TypeParserBuilder registerParser(Class<T> targetType, Parser<T> parser) { if (parser == null) { throw new NullPointerException(makeNullArgumentErrorMsg("parser")); } if (targetType == null) { throw new NullPointerException(makeNullArgumentErrorMsg("targetType")); } if (targetType.isArray()) { String message = "Cannot register Parser for array class. Register a Parser for " + "the component type '%s' instead, as arrays are handled automatically " + "internally in type-parser."; Class<?> componentType = targetType.getComponentType(); throw new IllegalArgumentException(String.format(message, componentType.getName())); } parsers.put(targetType, decorateParser(targetType, parser)); return this; }
[ "public", "<", "T", ">", "TypeParserBuilder", "registerParser", "(", "Class", "<", "T", ">", "targetType", ",", "Parser", "<", "T", ">", "parser", ")", "{", "if", "(", "parser", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "makeNu...
Register a custom made {@link Parser} implementation, associated with the given {@code targetType}. @param targetType associated with given {@code parser}. @param parser custom made {@link Parser} implementation. @return {@link TypeParserBuilder} @throws NullPointerException if any given argument is null.
[ "Register", "a", "custom", "made", "{", "@link", "Parser", "}", "implementation", "associated", "with", "the", "given", "{", "@code", "targetType", "}", "." ]
train
https://github.com/drapostolos/type-parser/blob/74c66311f8dd009897c74ab5069e36c045cda073/src/main/java/com/github/drapostolos/typeparser/TypeParserBuilder.java#L62-L78
trajano/caliper
caliper/src/main/java/com/google/caliper/runner/ServerSocketService.java
ServerSocketService.getConnection
public ListenableFuture<OpenedSocket> getConnection(UUID id) { checkState(isRunning(), "You can only get connections from a running service: %s", this); return getConnectionImpl(id, Source.REQUEST); }
java
public ListenableFuture<OpenedSocket> getConnection(UUID id) { checkState(isRunning(), "You can only get connections from a running service: %s", this); return getConnectionImpl(id, Source.REQUEST); }
[ "public", "ListenableFuture", "<", "OpenedSocket", ">", "getConnection", "(", "UUID", "id", ")", "{", "checkState", "(", "isRunning", "(", ")", ",", "\"You can only get connections from a running service: %s\"", ",", "this", ")", ";", "return", "getConnectionImpl", "(...
Returns a {@link ListenableFuture} for an open connection corresponding to the given id. <p>N.B. calling this method 'consumes' the connection and as such calling it twice with the same id will not work, the second future returned will never complete. Similarly calling it with an id that does not correspond to a worker trying to connect will also fail.
[ "Returns", "a", "{", "@link", "ListenableFuture", "}", "for", "an", "open", "connection", "corresponding", "to", "the", "given", "id", "." ]
train
https://github.com/trajano/caliper/blob/a8bcfd84fa9d7b893b3edfadc3b13240ae5cd658/caliper/src/main/java/com/google/caliper/runner/ServerSocketService.java#L134-L137
eobermuhlner/big-math
ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java
BigDecimalMath.acot
public static BigDecimal acot(BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); BigDecimal result = pi(mc).divide(TWO, mc).subtract(atan(x, mc), mc); return round(result, mathContext); }
java
public static BigDecimal acot(BigDecimal x, MathContext mathContext) { checkMathContext(mathContext); MathContext mc = new MathContext(mathContext.getPrecision() + 4, mathContext.getRoundingMode()); BigDecimal result = pi(mc).divide(TWO, mc).subtract(atan(x, mc), mc); return round(result, mathContext); }
[ "public", "static", "BigDecimal", "acot", "(", "BigDecimal", "x", ",", "MathContext", "mathContext", ")", "{", "checkMathContext", "(", "mathContext", ")", ";", "MathContext", "mc", "=", "new", "MathContext", "(", "mathContext", ".", "getPrecision", "(", ")", ...
Calculates the inverse cotangens (arc cotangens) of {@link BigDecimal} x. <p>See: <a href="http://en.wikipedia.org/wiki/Arccotangens">Wikipedia: Arccotangens</a></p> @param x the {@link BigDecimal} to calculate the arc cotangens for @param mathContext the {@link MathContext} used for the result @return the calculated arc cotangens {@link BigDecimal} with the precision specified in the <code>mathContext</code> @throws UnsupportedOperationException if the {@link MathContext} has unlimited precision
[ "Calculates", "the", "inverse", "cotangens", "(", "arc", "cotangens", ")", "of", "{", "@link", "BigDecimal", "}", "x", "." ]
train
https://github.com/eobermuhlner/big-math/blob/52c4fc334d0d722b295de740c1018ee400e3e8f2/ch.obermuhlner.math.big/src/main/java/ch/obermuhlner/math/big/BigDecimalMath.java#L1516-L1521
apache/groovy
subprojects/groovy-xml/src/main/java/groovy/xml/Namespace.java
Namespace.get
public QName get(String localName) { if (uri != null && uri.length() > 0) { if (prefix != null) { return new QName(uri, localName, prefix); } else { return new QName(uri, localName); } } else { return new QName(localName); } }
java
public QName get(String localName) { if (uri != null && uri.length() > 0) { if (prefix != null) { return new QName(uri, localName, prefix); } else { return new QName(uri, localName); } } else { return new QName(localName); } }
[ "public", "QName", "get", "(", "String", "localName", ")", "{", "if", "(", "uri", "!=", "null", "&&", "uri", ".", "length", "(", ")", ">", "0", ")", "{", "if", "(", "prefix", "!=", "null", ")", "{", "return", "new", "QName", "(", "uri", ",", "l...
Returns the QName for the given localName. @param localName the local name within this
[ "Returns", "the", "QName", "for", "the", "given", "localName", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-xml/src/main/java/groovy/xml/Namespace.java#L48-L60
apache/flink
flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/util/InterpreterUtils.java
InterpreterUtils.deserializeFunction
@SuppressWarnings("unchecked") public static <X> X deserializeFunction(RuntimeContext context, byte[] serFun) throws FlinkException { if (!jythonInitialized) { // This branch is only tested by end-to-end tests String path = context.getDistributedCache().getFile(PythonConstants.FLINK_PYTHON_DC_ID).getAbsolutePath(); String scriptName = PythonStreamExecutionEnvironment.PythonJobParameters.getScriptName(context.getExecutionConfig().getGlobalJobParameters()); try { initPythonInterpreter( new String[]{Paths.get(path, scriptName).toString()}, path, scriptName); } catch (Exception e) { try { LOG.error("Initialization of jython failed.", e); throw new FlinkRuntimeException("Initialization of jython failed.", e); } catch (Exception ie) { // this may occur if the initial exception relies on jython being initialized properly LOG.error("Initialization of jython failed. Could not print original stacktrace.", ie); throw new FlinkRuntimeException("Initialization of jython failed. Could not print original stacktrace."); } } } try { return (X) SerializationUtils.deserializeObject(serFun); } catch (IOException | ClassNotFoundException ex) { throw new FlinkException("Deserialization of user-function failed.", ex); } }
java
@SuppressWarnings("unchecked") public static <X> X deserializeFunction(RuntimeContext context, byte[] serFun) throws FlinkException { if (!jythonInitialized) { // This branch is only tested by end-to-end tests String path = context.getDistributedCache().getFile(PythonConstants.FLINK_PYTHON_DC_ID).getAbsolutePath(); String scriptName = PythonStreamExecutionEnvironment.PythonJobParameters.getScriptName(context.getExecutionConfig().getGlobalJobParameters()); try { initPythonInterpreter( new String[]{Paths.get(path, scriptName).toString()}, path, scriptName); } catch (Exception e) { try { LOG.error("Initialization of jython failed.", e); throw new FlinkRuntimeException("Initialization of jython failed.", e); } catch (Exception ie) { // this may occur if the initial exception relies on jython being initialized properly LOG.error("Initialization of jython failed. Could not print original stacktrace.", ie); throw new FlinkRuntimeException("Initialization of jython failed. Could not print original stacktrace."); } } } try { return (X) SerializationUtils.deserializeObject(serFun); } catch (IOException | ClassNotFoundException ex) { throw new FlinkException("Deserialization of user-function failed.", ex); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "X", ">", "X", "deserializeFunction", "(", "RuntimeContext", "context", ",", "byte", "[", "]", "serFun", ")", "throws", "FlinkException", "{", "if", "(", "!", "jythonInitialized", ")"...
Deserialize the given python function. If the functions class definition cannot be found we assume that this is the first invocation of this method for a given job and load the python script containing the class definition via jython. @param context the RuntimeContext of the java function @param serFun serialized python UDF @return deserialized python UDF @throws FlinkException if the deserialization failed
[ "Deserialize", "the", "given", "python", "function", ".", "If", "the", "functions", "class", "definition", "cannot", "be", "found", "we", "assume", "that", "this", "is", "the", "first", "invocation", "of", "this", "method", "for", "a", "given", "job", "and",...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-streaming-python/src/main/java/org/apache/flink/streaming/python/util/InterpreterUtils.java#L64-L95
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/inject/annotation/DefaultAnnotationMetadata.java
DefaultAnnotationMetadata.mutateMember
@Internal public static AnnotationMetadata mutateMember( AnnotationMetadata annotationMetadata, String annotationName, String member, Object value) { return mutateMember(annotationMetadata, annotationName, Collections.singletonMap(member, value)); }
java
@Internal public static AnnotationMetadata mutateMember( AnnotationMetadata annotationMetadata, String annotationName, String member, Object value) { return mutateMember(annotationMetadata, annotationName, Collections.singletonMap(member, value)); }
[ "@", "Internal", "public", "static", "AnnotationMetadata", "mutateMember", "(", "AnnotationMetadata", "annotationMetadata", ",", "String", "annotationName", ",", "String", "member", ",", "Object", "value", ")", "{", "return", "mutateMember", "(", "annotationMetadata", ...
<p>Sets a member of the given {@link AnnotationMetadata} return a new annotation metadata instance without mutating the existing.</p> <p>WARNING: for internal use only be the framework</p> @param annotationMetadata The metadata @param annotationName The annotation name @param member The member @param value The value @return The metadata
[ "<p", ">", "Sets", "a", "member", "of", "the", "given", "{", "@link", "AnnotationMetadata", "}", "return", "a", "new", "annotation", "metadata", "instance", "without", "mutating", "the", "existing", ".", "<", "/", "p", ">" ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/annotation/DefaultAnnotationMetadata.java#L918-L926
audit4j/audit4j-core
src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java
DeIdentifyUtil.deidentifyRight
public static String deidentifyRight(String str, int size) { int end = str.length(); int repeat; if (size > str.length()) { repeat = str.length(); } else { repeat = size; } return StringUtils.overlay(str, StringUtils.repeat('*', repeat), end - size, end); }
java
public static String deidentifyRight(String str, int size) { int end = str.length(); int repeat; if (size > str.length()) { repeat = str.length(); } else { repeat = size; } return StringUtils.overlay(str, StringUtils.repeat('*', repeat), end - size, end); }
[ "public", "static", "String", "deidentifyRight", "(", "String", "str", ",", "int", "size", ")", "{", "int", "end", "=", "str", ".", "length", "(", ")", ";", "int", "repeat", ";", "if", "(", "size", ">", "str", ".", "length", "(", ")", ")", "{", "...
Deidentify right. @param str the str @param size the size @return the string @since 2.0.0
[ "Deidentify", "right", "." ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/annotation/DeIdentifyUtil.java#L68-L77
OpenLiberty/open-liberty
dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java
WebAppConfigurator.configureWebAppHelperFactory
public void configureWebAppHelperFactory(WebAppConfiguratorHelperFactory webAppConfiguratorHelperFactory, ResourceRefConfigFactory resourceRefConfigFactory) { webAppHelper = webAppConfiguratorHelperFactory.createWebAppConfiguratorHelper(this, resourceRefConfigFactory, getListenerInterfaces()); this.configHelpers.add(webAppHelper); }
java
public void configureWebAppHelperFactory(WebAppConfiguratorHelperFactory webAppConfiguratorHelperFactory, ResourceRefConfigFactory resourceRefConfigFactory) { webAppHelper = webAppConfiguratorHelperFactory.createWebAppConfiguratorHelper(this, resourceRefConfigFactory, getListenerInterfaces()); this.configHelpers.add(webAppHelper); }
[ "public", "void", "configureWebAppHelperFactory", "(", "WebAppConfiguratorHelperFactory", "webAppConfiguratorHelperFactory", ",", "ResourceRefConfigFactory", "resourceRefConfigFactory", ")", "{", "webAppHelper", "=", "webAppConfiguratorHelperFactory", ".", "createWebAppConfiguratorHelp...
Configure the WebApp helper factory @param webAppConfiguratorHelperFactory The factory to be used @param resourceRefConfigFactory
[ "Configure", "the", "WebApp", "helper", "factory" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer/src/com/ibm/ws/webcontainer/osgi/container/config/WebAppConfigurator.java#L217-L220
alexvasilkov/GestureViews
library/src/main/java/com/alexvasilkov/gestures/utils/GravityUtils.java
GravityUtils.getDefaultPivot
public static void getDefaultPivot(Settings settings, Point out) { getMovementAreaPosition(settings, tmpRect2); Gravity.apply(settings.getGravity(), 0, 0, tmpRect2, tmpRect1); out.set(tmpRect1.left, tmpRect1.top); }
java
public static void getDefaultPivot(Settings settings, Point out) { getMovementAreaPosition(settings, tmpRect2); Gravity.apply(settings.getGravity(), 0, 0, tmpRect2, tmpRect1); out.set(tmpRect1.left, tmpRect1.top); }
[ "public", "static", "void", "getDefaultPivot", "(", "Settings", "settings", ",", "Point", "out", ")", "{", "getMovementAreaPosition", "(", "settings", ",", "tmpRect2", ")", ";", "Gravity", ".", "apply", "(", "settings", ".", "getGravity", "(", ")", ",", "0",...
Calculates default pivot point for scale and rotation. @param settings Image settings @param out Output point
[ "Calculates", "default", "pivot", "point", "for", "scale", "and", "rotation", "." ]
train
https://github.com/alexvasilkov/GestureViews/blob/f0a4c266e31dcad23bd0d9013531bc1c501b9c9f/library/src/main/java/com/alexvasilkov/gestures/utils/GravityUtils.java#L73-L77
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java
MetatypeUtils.parseDuration
public static long parseDuration(Object configAlias, String propertyKey, Object obj, long defaultValue) { return parseDuration(configAlias, propertyKey, obj, defaultValue, TimeUnit.MILLISECONDS); }
java
public static long parseDuration(Object configAlias, String propertyKey, Object obj, long defaultValue) { return parseDuration(configAlias, propertyKey, obj, defaultValue, TimeUnit.MILLISECONDS); }
[ "public", "static", "long", "parseDuration", "(", "Object", "configAlias", ",", "String", "propertyKey", ",", "Object", "obj", ",", "long", "defaultValue", ")", "{", "return", "parseDuration", "(", "configAlias", ",", "propertyKey", ",", "obj", ",", "defaultValu...
Parse a duration from the provided config value: checks for whether or not the object read from the Service/Component configuration is a String or a Metatype converted long duration value <p> If an exception occurs converting the object parameter: A translated warning message will be issued using the provided propertyKey and object as parameters. FFDC for the exception is suppressed: Callers should handle the thrown IllegalArgumentException as appropriate. @param configAlias Name of config (pid or alias) associated with a registered service or DS component. @param propertyKey The key used to retrieve the property value from the map. Used in the warning message if the value is badly formed. @param obj The object retrieved from the configuration property map/dictionary. @param defaultValue The default value that should be applied if the object is null. @return Long parsed/retrieved from obj, or default value if obj is null @throws IllegalArgumentException If value is not a Long, or if an error occurs while converting/casting the object to the return parameter type.
[ "Parse", "a", "duration", "from", "the", "provided", "config", "value", ":", "checks", "for", "whether", "or", "not", "the", "object", "read", "from", "the", "Service", "/", "Component", "configuration", "is", "a", "String", "or", "a", "Metatype", "converted...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service/src/com/ibm/wsspi/kernel/service/utils/MetatypeUtils.java#L433-L435
phax/ph-schedule
ph-schedule/src/main/java/com/helger/schedule/quartz/QuartzSchedulerHelper.java
QuartzSchedulerHelper.getSchedulerMetaData
@Nonnull public static SchedulerMetaData getSchedulerMetaData () { try { // Get the scheduler without starting it return s_aSchedulerFactory.getScheduler ().getMetaData (); } catch (final SchedulerException ex) { throw new IllegalStateException ("Failed to get scheduler metadata", ex); } }
java
@Nonnull public static SchedulerMetaData getSchedulerMetaData () { try { // Get the scheduler without starting it return s_aSchedulerFactory.getScheduler ().getMetaData (); } catch (final SchedulerException ex) { throw new IllegalStateException ("Failed to get scheduler metadata", ex); } }
[ "@", "Nonnull", "public", "static", "SchedulerMetaData", "getSchedulerMetaData", "(", ")", "{", "try", "{", "// Get the scheduler without starting it", "return", "s_aSchedulerFactory", ".", "getScheduler", "(", ")", ".", "getMetaData", "(", ")", ";", "}", "catch", "...
Get the metadata of the scheduler. The state of the scheduler is not changed within this method. @return The metadata of the underlying scheduler.
[ "Get", "the", "metadata", "of", "the", "scheduler", ".", "The", "state", "of", "the", "scheduler", "is", "not", "changed", "within", "this", "method", "." ]
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-schedule/src/main/java/com/helger/schedule/quartz/QuartzSchedulerHelper.java#L97-L109
stapler/stapler
groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/StaplerClosureScript.java
StaplerClosureScript._
public String _(String key, Object... args) { // JellyBuilder b = (JellyBuilder)getDelegate(); ResourceBundle resourceBundle = getResourceBundle(); // notify the listener if set // InternationalizedStringExpressionListener listener = (InternationalizedStringExpressionListener) Stapler.getCurrentRequest().getAttribute(LISTENER_NAME); // if(listener!=null) // listener.onUsed(this, args); args = Stapler.htmlSafeArguments(args); return resourceBundle.format(LocaleProvider.getLocale(), key, args); }
java
public String _(String key, Object... args) { // JellyBuilder b = (JellyBuilder)getDelegate(); ResourceBundle resourceBundle = getResourceBundle(); // notify the listener if set // InternationalizedStringExpressionListener listener = (InternationalizedStringExpressionListener) Stapler.getCurrentRequest().getAttribute(LISTENER_NAME); // if(listener!=null) // listener.onUsed(this, args); args = Stapler.htmlSafeArguments(args); return resourceBundle.format(LocaleProvider.getLocale(), key, args); }
[ "public", "String", "_", "(", "String", "key", ",", "Object", "...", "args", ")", "{", "// JellyBuilder b = (JellyBuilder)getDelegate();", "ResourceBundle", "resourceBundle", "=", "getResourceBundle", "(", ")", ";", "// notify the listener if set", "// Interna...
Looks up the resource bundle with the given key, formats with arguments, then return that formatted string.
[ "Looks", "up", "the", "resource", "bundle", "with", "the", "given", "key", "formats", "with", "arguments", "then", "return", "that", "formatted", "string", "." ]
train
https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/StaplerClosureScript.java#L36-L49
grails/grails-core
grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java
GroovyPagesUriSupport.getAbsoluteTemplateURI
public String getAbsoluteTemplateURI(String templateName, boolean includeExtension) { FastStringWriter buf = new FastStringWriter(); String tmp = templateName.substring(1,templateName.length()); if (tmp.indexOf(SLASH) > -1) { buf.append(SLASH); int i = tmp.lastIndexOf(SLASH); buf.append(tmp.substring(0, i)); buf.append(SLASH_UNDR); buf.append(tmp.substring(i + 1,tmp.length())); } else { buf.append(SLASH_UNDR); buf.append(templateName.substring(1,templateName.length())); } if (includeExtension) { buf.append(EXTENSION); } String uri = buf.toString(); buf.close(); return uri; }
java
public String getAbsoluteTemplateURI(String templateName, boolean includeExtension) { FastStringWriter buf = new FastStringWriter(); String tmp = templateName.substring(1,templateName.length()); if (tmp.indexOf(SLASH) > -1) { buf.append(SLASH); int i = tmp.lastIndexOf(SLASH); buf.append(tmp.substring(0, i)); buf.append(SLASH_UNDR); buf.append(tmp.substring(i + 1,tmp.length())); } else { buf.append(SLASH_UNDR); buf.append(templateName.substring(1,templateName.length())); } if (includeExtension) { buf.append(EXTENSION); } String uri = buf.toString(); buf.close(); return uri; }
[ "public", "String", "getAbsoluteTemplateURI", "(", "String", "templateName", ",", "boolean", "includeExtension", ")", "{", "FastStringWriter", "buf", "=", "new", "FastStringWriter", "(", ")", ";", "String", "tmp", "=", "templateName", ".", "substring", "(", "1", ...
Used to resolve template names that are not relative to a controller. @param templateName The template name normally beginning with / @param includeExtension The flag to include the template extension @return The template URI
[ "Used", "to", "resolve", "template", "names", "that", "are", "not", "relative", "to", "a", "controller", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-web-common/src/main/groovy/org/grails/web/pages/GroovyPagesUriSupport.java#L157-L177
JOML-CI/JOML
src/org/joml/Matrix3x2d.java
Matrix3x2d.scale
public Matrix3x2d scale(Vector2dc xy, Matrix3x2d dest) { return scale(xy.x(), xy.y(), dest); }
java
public Matrix3x2d scale(Vector2dc xy, Matrix3x2d dest) { return scale(xy.x(), xy.y(), dest); }
[ "public", "Matrix3x2d", "scale", "(", "Vector2dc", "xy", ",", "Matrix3x2d", "dest", ")", "{", "return", "scale", "(", "xy", ".", "x", "(", ")", ",", "xy", ".", "y", "(", ")", ",", "dest", ")", ";", "}" ]
Apply scaling to this matrix by scaling the base axes by the given <code>xy</code> factors and store the result in <code>dest</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>S</code> the scaling matrix, then the new matrix will be <code>M * S</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * S * v</code>, the scaling will be applied first! @param xy the factors of the x and y component, respectively @param dest will hold the result @return dest
[ "Apply", "scaling", "to", "this", "matrix", "by", "scaling", "the", "base", "axes", "by", "the", "given", "<code", ">", "xy<", "/", "code", ">", "factors", "and", "store", "the", "result", "in", "<code", ">", "dest<", "/", "code", ">", ".", "<p", ">"...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix3x2d.java#L1280-L1282
ReactiveX/RxNetty
rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/sse/ServerSentEvent.java
ServerSentEvent.withEventId
public static ServerSentEvent withEventId(ByteBuf eventId, ByteBuf data) { return new ServerSentEvent(eventId, null, data); }
java
public static ServerSentEvent withEventId(ByteBuf eventId, ByteBuf data) { return new ServerSentEvent(eventId, null, data); }
[ "public", "static", "ServerSentEvent", "withEventId", "(", "ByteBuf", "eventId", ",", "ByteBuf", "data", ")", "{", "return", "new", "ServerSentEvent", "(", "eventId", ",", "null", ",", "data", ")", ";", "}" ]
Creates a {@link ServerSentEvent} instance with an event id. @param eventId Id for the event. @param data Data for the event. @return The {@link ServerSentEvent} instance.
[ "Creates", "a", "{", "@link", "ServerSentEvent", "}", "instance", "with", "an", "event", "id", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-http/src/main/java/io/reactivex/netty/protocol/http/sse/ServerSentEvent.java#L252-L254
google/closure-compiler
src/com/google/javascript/jscomp/CollapseProperties.java
CollapseProperties.updateTwinnedDeclaration
private void updateTwinnedDeclaration(String alias, Name refName, Ref ref) { checkNotNull(ref.getTwin()); // Don't handle declarations of an already flat name, just qualified names. if (!ref.getNode().isGetProp()) { return; } Node rvalue = ref.getNode().getNext(); Node parent = ref.getNode().getParent(); Node grandparent = parent.getParent(); if (rvalue != null && rvalue.isFunction()) { checkForHosedThisReferences(rvalue, refName.getJSDocInfo(), refName); } // Create the new alias node. Node nameNode = NodeUtil.newName(compiler, alias, grandparent.getFirstChild(), refName.getFullName()); NodeUtil.copyNameAnnotations(ref.getNode().getLastChild(), nameNode); // BEFORE: // ... (x.y = 3); // // AFTER: // var x$y; // ... (x$y = 3); Node current = grandparent; Node currentParent = grandparent.getParent(); for (; !currentParent.isScript() && !currentParent.isBlock(); current = currentParent, currentParent = currentParent.getParent()) {} // Create a stub variable declaration right // before the current statement. Node stubVar = IR.var(nameNode.cloneTree()).useSourceInfoIfMissingFrom(nameNode); currentParent.addChildBefore(stubVar, current); parent.replaceChild(ref.getNode(), nameNode); compiler.reportChangeToEnclosingScope(nameNode); }
java
private void updateTwinnedDeclaration(String alias, Name refName, Ref ref) { checkNotNull(ref.getTwin()); // Don't handle declarations of an already flat name, just qualified names. if (!ref.getNode().isGetProp()) { return; } Node rvalue = ref.getNode().getNext(); Node parent = ref.getNode().getParent(); Node grandparent = parent.getParent(); if (rvalue != null && rvalue.isFunction()) { checkForHosedThisReferences(rvalue, refName.getJSDocInfo(), refName); } // Create the new alias node. Node nameNode = NodeUtil.newName(compiler, alias, grandparent.getFirstChild(), refName.getFullName()); NodeUtil.copyNameAnnotations(ref.getNode().getLastChild(), nameNode); // BEFORE: // ... (x.y = 3); // // AFTER: // var x$y; // ... (x$y = 3); Node current = grandparent; Node currentParent = grandparent.getParent(); for (; !currentParent.isScript() && !currentParent.isBlock(); current = currentParent, currentParent = currentParent.getParent()) {} // Create a stub variable declaration right // before the current statement. Node stubVar = IR.var(nameNode.cloneTree()).useSourceInfoIfMissingFrom(nameNode); currentParent.addChildBefore(stubVar, current); parent.replaceChild(ref.getNode(), nameNode); compiler.reportChangeToEnclosingScope(nameNode); }
[ "private", "void", "updateTwinnedDeclaration", "(", "String", "alias", ",", "Name", "refName", ",", "Ref", "ref", ")", "{", "checkNotNull", "(", "ref", ".", "getTwin", "(", ")", ")", ";", "// Don't handle declarations of an already flat name, just qualified names.", "...
Updates the initial assignment to a collapsible property at global scope by adding a VAR stub and collapsing the property. e.g. c = a.b = 1; => var a$b; c = a$b = 1; This specifically handles "twinned" assignments, which are those where the assignment is also used as a reference and which need special handling. @param alias The flattened property name (e.g. "a$b") @param refName The name for the reference being updated. @param ref An object containing information about the assignment getting updated
[ "Updates", "the", "initial", "assignment", "to", "a", "collapsible", "property", "at", "global", "scope", "by", "adding", "a", "VAR", "stub", "and", "collapsing", "the", "property", ".", "e", ".", "g", ".", "c", "=", "a", ".", "b", "=", "1", ";", "="...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CollapseProperties.java#L464-L503
b3log/latke
latke-core/src/main/java/org/json/JSONObject.java
JSONObject.optBigDecimal
public BigDecimal optBigDecimal(String key, BigDecimal defaultValue) { Object val = this.opt(key); return objectToBigDecimal(val, defaultValue); }
java
public BigDecimal optBigDecimal(String key, BigDecimal defaultValue) { Object val = this.opt(key); return objectToBigDecimal(val, defaultValue); }
[ "public", "BigDecimal", "optBigDecimal", "(", "String", "key", ",", "BigDecimal", "defaultValue", ")", "{", "Object", "val", "=", "this", ".", "opt", "(", "key", ")", ";", "return", "objectToBigDecimal", "(", "val", ",", "defaultValue", ")", ";", "}" ]
Get an optional BigDecimal associated with a key, or the defaultValue if there is no such key or if its value is not a number. If the value is a string, an attempt will be made to evaluate it as a number. If the value is float or double, then the {@link BigDecimal#BigDecimal(double)} constructor will be used. See notes on the constructor for conversion issues that may arise. @param key A key string. @param defaultValue The default. @return An object which is the value.
[ "Get", "an", "optional", "BigDecimal", "associated", "with", "a", "key", "or", "the", "defaultValue", "if", "there", "is", "no", "such", "key", "or", "if", "its", "value", "is", "not", "a", "number", ".", "If", "the", "value", "is", "a", "string", "an"...
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/json/JSONObject.java#L1109-L1112
unbescape/unbescape
src/main/java/org/unbescape/html/HtmlEscape.java
HtmlEscape.unescapeHtml
public static void unescapeHtml(final char[] text, final int offset, final int len, final Writer writer) throws IOException{ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } HtmlEscapeUtil.unescape(text, offset, len, writer); }
java
public static void unescapeHtml(final char[] text, final int offset, final int len, final Writer writer) throws IOException{ if (writer == null) { throw new IllegalArgumentException("Argument 'writer' cannot be null"); } final int textLen = (text == null? 0 : text.length); if (offset < 0 || offset > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } if (len < 0 || (offset + len) > textLen) { throw new IllegalArgumentException( "Invalid (offset, len). offset=" + offset + ", len=" + len + ", text.length=" + textLen); } HtmlEscapeUtil.unescape(text, offset, len, writer); }
[ "public", "static", "void", "unescapeHtml", "(", "final", "char", "[", "]", "text", ",", "final", "int", "offset", ",", "final", "int", "len", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "if", "(", "writer", "==", "null", ")", ...
<p> Perform an HTML <strong>unescape</strong> operation on a <tt>char[]</tt> input. </p> <p> No additional configuration arguments are required. Unescape operations will always perform <em>complete</em> unescape of NCRs (whole HTML5 set supported), decimal and hexadecimal references. </p> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>char[]</tt> to be unescaped. @param offset the position in <tt>text</tt> at which the unescape operation should start. @param len the number of characters in <tt>text</tt> that should be unescaped. @param writer the <tt>java.io.Writer</tt> to which the unescaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs
[ "<p", ">", "Perform", "an", "HTML", "<strong", ">", "unescape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "char", "[]", "<", "/", "tt", ">", "input", ".", "<", "/", "p", ">", "<p", ">", "No", "additional", "configuration", "arguments",...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/html/HtmlEscape.java#L1198-L1219
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java
SpaceRepository.removeLocalSpaceDefinition
protected void removeLocalSpaceDefinition(SpaceID id, boolean isLocalDestruction) { final Space space; synchronized (getSpaceRepositoryMutex()) { space = this.spaces.remove(id); if (space != null) { this.spacesBySpec.remove(id.getSpaceSpecification(), id); } } if (space != null) { fireSpaceRemoved(space, isLocalDestruction); } }
java
protected void removeLocalSpaceDefinition(SpaceID id, boolean isLocalDestruction) { final Space space; synchronized (getSpaceRepositoryMutex()) { space = this.spaces.remove(id); if (space != null) { this.spacesBySpec.remove(id.getSpaceSpecification(), id); } } if (space != null) { fireSpaceRemoved(space, isLocalDestruction); } }
[ "protected", "void", "removeLocalSpaceDefinition", "(", "SpaceID", "id", ",", "boolean", "isLocalDestruction", ")", "{", "final", "Space", "space", ";", "synchronized", "(", "getSpaceRepositoryMutex", "(", ")", ")", "{", "space", "=", "this", ".", "spaces", ".",...
Remove a remote space. @param id identifier of the space @param isLocalDestruction indicates if the destruction is initiated by the local kernel.
[ "Remove", "a", "remote", "space", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L224-L235