repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
kkopacz/agiso-core
bundles/agiso-core-beans/src/main/java/org/agiso/core/beans/util/BeanUtils.java
BeanUtils.getBean
public static Object getBean(String name, long waitTime) { """ Pobiera z kontekstu aplikacji obiekt o wskazanej nazwie w razie potrzeby wstrzymując bieżący wątek w oczekiwaniu na inicjalizację fabryki obiektów (poprzez wywołanie metody {@link #setBeanFactory(IBeanFactory)}). @param name Nazwa jednoznacznie identyfikująca obiekt. @param waitTime Maksymalny czas oczekiwania na inicjalizację fabryki obiektów (w sekundach). Wartość ujemna oznacza czas nieograniczony. @return Obiekt o wskazanej nazwie lub <code>null</code> jeśli nie znaleziono. @throws BeanRetrievalException jeśli nie została ustawiona fabryka obiektów lub nie udało się pozyskać żądanego obiektu. """ checkBeanFactory(waitTime, name); return beanFactory.getBean(name); }
java
public static Object getBean(String name, long waitTime) { checkBeanFactory(waitTime, name); return beanFactory.getBean(name); }
[ "public", "static", "Object", "getBean", "(", "String", "name", ",", "long", "waitTime", ")", "{", "checkBeanFactory", "(", "waitTime", ",", "name", ")", ";", "return", "beanFactory", ".", "getBean", "(", "name", ")", ";", "}" ]
Pobiera z kontekstu aplikacji obiekt o wskazanej nazwie w razie potrzeby wstrzymując bieżący wątek w oczekiwaniu na inicjalizację fabryki obiektów (poprzez wywołanie metody {@link #setBeanFactory(IBeanFactory)}). @param name Nazwa jednoznacznie identyfikująca obiekt. @param waitTime Maksymalny czas oczekiwania na inicjalizację fabryki obiektów (w sekundach). Wartość ujemna oznacza czas nieograniczony. @return Obiekt o wskazanej nazwie lub <code>null</code> jeśli nie znaleziono. @throws BeanRetrievalException jeśli nie została ustawiona fabryka obiektów lub nie udało się pozyskać żądanego obiektu.
[ "Pobiera", "z", "kontekstu", "aplikacji", "obiekt", "o", "wskazanej", "nazwie", "w", "razie", "potrzeby", "wstrzymując", "bieżący", "wątek", "w", "oczekiwaniu", "na", "inicjalizację", "fabryki", "obiektów", "(", "poprzez", "wywołanie", "metody", "{", "@link", "#se...
train
https://github.com/kkopacz/agiso-core/blob/b994ec0146be1fe3f10829d69cd719bdbdebe1c5/bundles/agiso-core-beans/src/main/java/org/agiso/core/beans/util/BeanUtils.java#L85-L89
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java
GenericEncodingStrategy.pushRawSupport
protected void pushRawSupport(CodeAssembler a, LocalVariable instanceVar) throws SupportException { """ Generates code to push RawSupport instance to the stack. RawSupport is available only in Storable instances. If instanceVar is an Object[], a SupportException is thrown. @param instanceVar Storable instance or array of property values. Null is storable instance of "this". """ boolean isObjectArrayInstanceVar = instanceVar != null && instanceVar.getType() == TypeDesc.forClass(Object[].class); if (isObjectArrayInstanceVar) { throw new SupportException("Lob properties not supported"); } if (instanceVar == null) { a.loadThis(); } else { a.loadLocal(instanceVar); } a.loadField(SUPPORT_FIELD_NAME, TypeDesc.forClass(TriggerSupport.class)); a.checkCast(TypeDesc.forClass(RawSupport.class)); }
java
protected void pushRawSupport(CodeAssembler a, LocalVariable instanceVar) throws SupportException { boolean isObjectArrayInstanceVar = instanceVar != null && instanceVar.getType() == TypeDesc.forClass(Object[].class); if (isObjectArrayInstanceVar) { throw new SupportException("Lob properties not supported"); } if (instanceVar == null) { a.loadThis(); } else { a.loadLocal(instanceVar); } a.loadField(SUPPORT_FIELD_NAME, TypeDesc.forClass(TriggerSupport.class)); a.checkCast(TypeDesc.forClass(RawSupport.class)); }
[ "protected", "void", "pushRawSupport", "(", "CodeAssembler", "a", ",", "LocalVariable", "instanceVar", ")", "throws", "SupportException", "{", "boolean", "isObjectArrayInstanceVar", "=", "instanceVar", "!=", "null", "&&", "instanceVar", ".", "getType", "(", ")", "==...
Generates code to push RawSupport instance to the stack. RawSupport is available only in Storable instances. If instanceVar is an Object[], a SupportException is thrown. @param instanceVar Storable instance or array of property values. Null is storable instance of "this".
[ "Generates", "code", "to", "push", "RawSupport", "instance", "to", "the", "stack", ".", "RawSupport", "is", "available", "only", "in", "Storable", "instances", ".", "If", "instanceVar", "is", "an", "Object", "[]", "a", "SupportException", "is", "thrown", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/GenericEncodingStrategy.java#L1770-L1788
eclipse/xtext-core
org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java
IdeContentProposalCreator.createProposal
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context) { """ Returns an entry with the given proposal and the prefix from the context, or null if the proposal is not valid. """ return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, null); }
java
public ContentAssistEntry createProposal(final String proposal, final ContentAssistContext context) { return this.createProposal(proposal, context.getPrefix(), context, ContentAssistEntry.KIND_UNKNOWN, null); }
[ "public", "ContentAssistEntry", "createProposal", "(", "final", "String", "proposal", ",", "final", "ContentAssistContext", "context", ")", "{", "return", "this", ".", "createProposal", "(", "proposal", ",", "context", ".", "getPrefix", "(", ")", ",", "context", ...
Returns an entry with the given proposal and the prefix from the context, or null if the proposal is not valid.
[ "Returns", "an", "entry", "with", "the", "given", "proposal", "and", "the", "prefix", "from", "the", "context", "or", "null", "if", "the", "proposal", "is", "not", "valid", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext.ide/xtend-gen/org/eclipse/xtext/ide/editor/contentassist/IdeContentProposalCreator.java#L36-L38
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-default/src/main/java/org/xwiki/component/annotation/ComponentDescriptorFactory.java
ComponentDescriptorFactory.createComponentDescriptors
@Deprecated public List<ComponentDescriptor> createComponentDescriptors(Class<?> componentClass, Class<?> componentRoleClass) { """ Create component descriptors for the passed component implementation class and component role class. There can be more than one descriptor if the component class has specified several hints. @param componentClass the component implementation class @param componentRoleClass the component role class @return the component descriptors with resolved component dependencies @deprecated since 4.0M1 use {@link #createComponentDescriptors(Class, Type)} instead """ return createComponentDescriptors(componentClass, (Type) componentRoleClass); }
java
@Deprecated public List<ComponentDescriptor> createComponentDescriptors(Class<?> componentClass, Class<?> componentRoleClass) { return createComponentDescriptors(componentClass, (Type) componentRoleClass); }
[ "@", "Deprecated", "public", "List", "<", "ComponentDescriptor", ">", "createComponentDescriptors", "(", "Class", "<", "?", ">", "componentClass", ",", "Class", "<", "?", ">", "componentRoleClass", ")", "{", "return", "createComponentDescriptors", "(", "componentCla...
Create component descriptors for the passed component implementation class and component role class. There can be more than one descriptor if the component class has specified several hints. @param componentClass the component implementation class @param componentRoleClass the component role class @return the component descriptors with resolved component dependencies @deprecated since 4.0M1 use {@link #createComponentDescriptors(Class, Type)} instead
[ "Create", "component", "descriptors", "for", "the", "passed", "component", "implementation", "class", "and", "component", "role", "class", ".", "There", "can", "be", "more", "than", "one", "descriptor", "if", "the", "component", "class", "has", "specified", "sev...
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-component/xwiki-commons-component-default/src/main/java/org/xwiki/component/annotation/ComponentDescriptorFactory.java#L63-L68
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java
DocTreeScanner.visitUnknownBlockTag
@Override public R visitUnknownBlockTag(UnknownBlockTagTree node, P p) { """ {@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning """ return scan(node.getContent(), p); }
java
@Override public R visitUnknownBlockTag(UnknownBlockTagTree node, P p) { return scan(node.getContent(), p); }
[ "@", "Override", "public", "R", "visitUnknownBlockTag", "(", "UnknownBlockTagTree", "node", ",", "P", "p", ")", "{", "return", "scan", "(", "node", ".", "getContent", "(", ")", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L473-L476
m-m-m/util
cli/src/main/java/net/sf/mmm/util/cli/base/CliState.java
CliState.requireMode
protected CliModeObject requireMode(String id, Object annotationContainer) { """ This method is like {@link #getMode(String)} but also {@link net.sf.mmm.util.cli.api.CliStyle#modeUndefined() handles} the case that a {@link net.sf.mmm.util.cli.api.CliMode} may be undefined. @param id is the {@link net.sf.mmm.util.cli.api.CliMode#id() ID} of the requested {@link net.sf.mmm.util.cli.api.CliMode}. @param annotationContainer is the {@link CliArgumentContainer} or {@link CliOptionContainer}. @return the requested {@link CliModeObject}. """ CliModeObject modeObject = getMode(id); if (modeObject == null) { CliStyleHandling handling = getCliStyle().modeUndefined(); if (handling != CliStyleHandling.OK) { handling.handle(LOG, new CliModeUndefinedException(id, annotationContainer)); } CliModeContainer modeContainer = new CliModeContainer(id); addMode(modeContainer); modeObject = modeContainer; } return modeObject; }
java
protected CliModeObject requireMode(String id, Object annotationContainer) { CliModeObject modeObject = getMode(id); if (modeObject == null) { CliStyleHandling handling = getCliStyle().modeUndefined(); if (handling != CliStyleHandling.OK) { handling.handle(LOG, new CliModeUndefinedException(id, annotationContainer)); } CliModeContainer modeContainer = new CliModeContainer(id); addMode(modeContainer); modeObject = modeContainer; } return modeObject; }
[ "protected", "CliModeObject", "requireMode", "(", "String", "id", ",", "Object", "annotationContainer", ")", "{", "CliModeObject", "modeObject", "=", "getMode", "(", "id", ")", ";", "if", "(", "modeObject", "==", "null", ")", "{", "CliStyleHandling", "handling",...
This method is like {@link #getMode(String)} but also {@link net.sf.mmm.util.cli.api.CliStyle#modeUndefined() handles} the case that a {@link net.sf.mmm.util.cli.api.CliMode} may be undefined. @param id is the {@link net.sf.mmm.util.cli.api.CliMode#id() ID} of the requested {@link net.sf.mmm.util.cli.api.CliMode}. @param annotationContainer is the {@link CliArgumentContainer} or {@link CliOptionContainer}. @return the requested {@link CliModeObject}.
[ "This", "method", "is", "like", "{", "@link", "#getMode", "(", "String", ")", "}", "but", "also", "{", "@link", "net", ".", "sf", ".", "mmm", ".", "util", ".", "cli", ".", "api", ".", "CliStyle#modeUndefined", "()", "handles", "}", "the", "case", "th...
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/cli/src/main/java/net/sf/mmm/util/cli/base/CliState.java#L307-L320
facebook/fresco
drawee/src/main/java/com/facebook/drawee/drawable/DrawableUtils.java
DrawableUtils.copyProperties
public static void copyProperties(@Nullable Drawable to, @Nullable Drawable from) { """ Copies various properties from one drawable to the other. @param to drawable to copy properties to @param from drawable to copy properties from """ if (from == null || to == null || to == from) { return; } to.setBounds(from.getBounds()); to.setChangingConfigurations(from.getChangingConfigurations()); to.setLevel(from.getLevel()); to.setVisible(from.isVisible(), /* restart */ false); to.setState(from.getState()); }
java
public static void copyProperties(@Nullable Drawable to, @Nullable Drawable from) { if (from == null || to == null || to == from) { return; } to.setBounds(from.getBounds()); to.setChangingConfigurations(from.getChangingConfigurations()); to.setLevel(from.getLevel()); to.setVisible(from.isVisible(), /* restart */ false); to.setState(from.getState()); }
[ "public", "static", "void", "copyProperties", "(", "@", "Nullable", "Drawable", "to", ",", "@", "Nullable", "Drawable", "from", ")", "{", "if", "(", "from", "==", "null", "||", "to", "==", "null", "||", "to", "==", "from", ")", "{", "return", ";", "}...
Copies various properties from one drawable to the other. @param to drawable to copy properties to @param from drawable to copy properties from
[ "Copies", "various", "properties", "from", "one", "drawable", "to", "the", "other", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/drawee/src/main/java/com/facebook/drawee/drawable/DrawableUtils.java#L39-L49
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java
SameDiff.associateArrayWithVariable
public void associateArrayWithVariable(INDArray arr, @NonNull String variable) { """ Associate the array with the given variable. @param arr the array to get the variable for @param variable the name of the variable to associate the array with """ Preconditions.checkState(variables.containsKey(variable), "Cannot associate array with variable \"%s\": " + "variable \"%s\" does not exist in this SameDiff instance", variable, variable); associateArrayWithVariable(arr, this.getVariable(variable)); }
java
public void associateArrayWithVariable(INDArray arr, @NonNull String variable) { Preconditions.checkState(variables.containsKey(variable), "Cannot associate array with variable \"%s\": " + "variable \"%s\" does not exist in this SameDiff instance", variable, variable); associateArrayWithVariable(arr, this.getVariable(variable)); }
[ "public", "void", "associateArrayWithVariable", "(", "INDArray", "arr", ",", "@", "NonNull", "String", "variable", ")", "{", "Preconditions", ".", "checkState", "(", "variables", ".", "containsKey", "(", "variable", ")", ",", "\"Cannot associate array with variable \\...
Associate the array with the given variable. @param arr the array to get the variable for @param variable the name of the variable to associate the array with
[ "Associate", "the", "array", "with", "the", "given", "variable", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/SameDiff.java#L779-L783
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java
PacketCapturesInner.getAsync
public Observable<PacketCaptureResultInner> getAsync(String resourceGroupName, String networkWatcherName, String packetCaptureName) { """ Gets a packet capture session by name. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param packetCaptureName The name of the packet capture session. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PacketCaptureResultInner object """ return getWithServiceResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName).map(new Func1<ServiceResponse<PacketCaptureResultInner>, PacketCaptureResultInner>() { @Override public PacketCaptureResultInner call(ServiceResponse<PacketCaptureResultInner> response) { return response.body(); } }); }
java
public Observable<PacketCaptureResultInner> getAsync(String resourceGroupName, String networkWatcherName, String packetCaptureName) { return getWithServiceResponseAsync(resourceGroupName, networkWatcherName, packetCaptureName).map(new Func1<ServiceResponse<PacketCaptureResultInner>, PacketCaptureResultInner>() { @Override public PacketCaptureResultInner call(ServiceResponse<PacketCaptureResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PacketCaptureResultInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "networkWatcherName", ",", "String", "packetCaptureName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "networ...
Gets a packet capture session by name. @param resourceGroupName The name of the resource group. @param networkWatcherName The name of the network watcher. @param packetCaptureName The name of the packet capture session. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PacketCaptureResultInner object
[ "Gets", "a", "packet", "capture", "session", "by", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PacketCapturesInner.java#L325-L332
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipUtil.java
ZipUtil.replaceEntry
public static boolean replaceEntry(File zip, ZipEntrySource entry, File destZip) { """ Copies an existing ZIP file and replaces a given entry in it. @param zip an existing ZIP file (only read). @param entry new ZIP entry. @param destZip new ZIP file created. @return <code>true</code> if the entry was replaced. """ return replaceEntries(zip, new ZipEntrySource[] { entry }, destZip); }
java
public static boolean replaceEntry(File zip, ZipEntrySource entry, File destZip) { return replaceEntries(zip, new ZipEntrySource[] { entry }, destZip); }
[ "public", "static", "boolean", "replaceEntry", "(", "File", "zip", ",", "ZipEntrySource", "entry", ",", "File", "destZip", ")", "{", "return", "replaceEntries", "(", "zip", ",", "new", "ZipEntrySource", "[", "]", "{", "entry", "}", ",", "destZip", ")", ";"...
Copies an existing ZIP file and replaces a given entry in it. @param zip an existing ZIP file (only read). @param entry new ZIP entry. @param destZip new ZIP file created. @return <code>true</code> if the entry was replaced.
[ "Copies", "an", "existing", "ZIP", "file", "and", "replaces", "a", "given", "entry", "in", "it", "." ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipUtil.java#L2594-L2596
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.addTagsInfo
protected void addTagsInfo(Element e, Content htmltree) { """ Adds the tags information. @param e the Element for which the tags will be generated @param htmltree the documentation tree to which the tags will be added """ if (configuration.nocomment) { return; } Content dl = new HtmlTree(HtmlTag.DL); if (utils.isExecutableElement(e) && !utils.isConstructor(e)) { addMethodInfo((ExecutableElement)e, dl); } Content output = new ContentBuilder(); TagletWriter.genTagOutput(configuration.tagletManager, e, configuration.tagletManager.getCustomTaglets(e), getTagletWriterInstance(false), output); dl.addContent(output); htmltree.addContent(dl); }
java
protected void addTagsInfo(Element e, Content htmltree) { if (configuration.nocomment) { return; } Content dl = new HtmlTree(HtmlTag.DL); if (utils.isExecutableElement(e) && !utils.isConstructor(e)) { addMethodInfo((ExecutableElement)e, dl); } Content output = new ContentBuilder(); TagletWriter.genTagOutput(configuration.tagletManager, e, configuration.tagletManager.getCustomTaglets(e), getTagletWriterInstance(false), output); dl.addContent(output); htmltree.addContent(dl); }
[ "protected", "void", "addTagsInfo", "(", "Element", "e", ",", "Content", "htmltree", ")", "{", "if", "(", "configuration", ".", "nocomment", ")", "{", "return", ";", "}", "Content", "dl", "=", "new", "HtmlTree", "(", "HtmlTag", ".", "DL", ")", ";", "if...
Adds the tags information. @param e the Element for which the tags will be generated @param htmltree the documentation tree to which the tags will be added
[ "Adds", "the", "tags", "information", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L310-L324
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/selector/Hud.java
Hud.checkActionsInCommon
private static void checkActionsInCommon(Actioner actioner, Collection<ActionRef> actions) { """ Get all actions in common. @param actioner The current selectable. @param actions The collected actions in common. """ if (actions.isEmpty()) { actions.addAll(actioner.getActions()); } else { actions.retainAll(actioner.getActions()); } }
java
private static void checkActionsInCommon(Actioner actioner, Collection<ActionRef> actions) { if (actions.isEmpty()) { actions.addAll(actioner.getActions()); } else { actions.retainAll(actioner.getActions()); } }
[ "private", "static", "void", "checkActionsInCommon", "(", "Actioner", "actioner", ",", "Collection", "<", "ActionRef", ">", "actions", ")", "{", "if", "(", "actions", ".", "isEmpty", "(", ")", ")", "{", "actions", ".", "addAll", "(", "actioner", ".", "getA...
Get all actions in common. @param actioner The current selectable. @param actions The collected actions in common.
[ "Get", "all", "actions", "in", "common", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/collidable/selector/Hud.java#L87-L97
apache/groovy
src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java
ClassNodeUtils.getStaticProperty
public static PropertyNode getStaticProperty(ClassNode cNode, String propName) { """ Detect whether a static property with the given name is within the class or a super class. @param cNode the ClassNode of interest @param propName the property name @return the static property if found or else null """ ClassNode classNode = cNode; while (classNode != null) { for (PropertyNode pn : classNode.getProperties()) { if (pn.getName().equals(propName) && pn.isStatic()) return pn; } classNode = classNode.getSuperClass(); } return null; }
java
public static PropertyNode getStaticProperty(ClassNode cNode, String propName) { ClassNode classNode = cNode; while (classNode != null) { for (PropertyNode pn : classNode.getProperties()) { if (pn.getName().equals(propName) && pn.isStatic()) return pn; } classNode = classNode.getSuperClass(); } return null; }
[ "public", "static", "PropertyNode", "getStaticProperty", "(", "ClassNode", "cNode", ",", "String", "propName", ")", "{", "ClassNode", "classNode", "=", "cNode", ";", "while", "(", "classNode", "!=", "null", ")", "{", "for", "(", "PropertyNode", "pn", ":", "c...
Detect whether a static property with the given name is within the class or a super class. @param cNode the ClassNode of interest @param propName the property name @return the static property if found or else null
[ "Detect", "whether", "a", "static", "property", "with", "the", "given", "name", "is", "within", "the", "class", "or", "a", "super", "class", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/apache/groovy/ast/tools/ClassNodeUtils.java#L319-L328
rzwitserloot/lombok
src/core/lombok/javac/handlers/JavacHandlerUtil.java
JavacHandlerUtil.chainDotsString
public static JCExpression chainDotsString(JavacNode node, String elems) { """ In javac, dotted access of any kind, from {@code java.lang.String} to {@code var.methodName} is represented by a fold-left of {@code Select} nodes with the leftmost string represented by a {@code Ident} node. This method generates such an expression. For example, maker.Select(maker.Select(maker.Ident(NAME[java]), NAME[lang]), NAME[String]). @see com.sun.tools.javac.tree.JCTree.JCIdent @see com.sun.tools.javac.tree.JCTree.JCFieldAccess """ return chainDots(node, null, null, elems.split("\\.")); }
java
public static JCExpression chainDotsString(JavacNode node, String elems) { return chainDots(node, null, null, elems.split("\\.")); }
[ "public", "static", "JCExpression", "chainDotsString", "(", "JavacNode", "node", ",", "String", "elems", ")", "{", "return", "chainDots", "(", "node", ",", "null", ",", "null", ",", "elems", ".", "split", "(", "\"\\\\.\"", ")", ")", ";", "}" ]
In javac, dotted access of any kind, from {@code java.lang.String} to {@code var.methodName} is represented by a fold-left of {@code Select} nodes with the leftmost string represented by a {@code Ident} node. This method generates such an expression. For example, maker.Select(maker.Select(maker.Ident(NAME[java]), NAME[lang]), NAME[String]). @see com.sun.tools.javac.tree.JCTree.JCIdent @see com.sun.tools.javac.tree.JCTree.JCFieldAccess
[ "In", "javac", "dotted", "access", "of", "any", "kind", "from", "{", "@code", "java", ".", "lang", ".", "String", "}", "to", "{", "@code", "var", ".", "methodName", "}", "is", "represented", "by", "a", "fold", "-", "left", "of", "{", "@code", "Select...
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/javac/handlers/JavacHandlerUtil.java#L1385-L1387
czyzby/gdx-lml
kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/scene2d/Tooltips.java
Tooltips.setDefaultTooltipManager
public static void setDefaultTooltipManager(final TooltipManager tooltipManager) { """ Since main tooltip manager instance cannot be changed globally with a regular setter, this method modifies it using reflection. @param tooltipManager will be returned on {@link TooltipManager#getInstance()} calls. @throws GdxRuntimeException if unable to change manager. """ try { TooltipManager.getInstance(); Reflection.setFieldValue(ClassReflection.getDeclaredField(TooltipManager.class, "instance"), null, tooltipManager); } catch (final ReflectionException exception) { throw new GdxRuntimeException("Unable to set default tooltip manager.", exception); } }
java
public static void setDefaultTooltipManager(final TooltipManager tooltipManager) { try { TooltipManager.getInstance(); Reflection.setFieldValue(ClassReflection.getDeclaredField(TooltipManager.class, "instance"), null, tooltipManager); } catch (final ReflectionException exception) { throw new GdxRuntimeException("Unable to set default tooltip manager.", exception); } }
[ "public", "static", "void", "setDefaultTooltipManager", "(", "final", "TooltipManager", "tooltipManager", ")", "{", "try", "{", "TooltipManager", ".", "getInstance", "(", ")", ";", "Reflection", ".", "setFieldValue", "(", "ClassReflection", ".", "getDeclaredField", ...
Since main tooltip manager instance cannot be changed globally with a regular setter, this method modifies it using reflection. @param tooltipManager will be returned on {@link TooltipManager#getInstance()} calls. @throws GdxRuntimeException if unable to change manager.
[ "Since", "main", "tooltip", "manager", "instance", "cannot", "be", "changed", "globally", "with", "a", "regular", "setter", "this", "method", "modifies", "it", "using", "reflection", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/scene2d/Tooltips.java#L22-L30
wisdom-framework/wisdom
core/content-manager/src/main/java/org/wisdom/content/bodyparsers/BodyParserJson.java
BodyParserJson.invoke
@Override public <T> T invoke(byte[] bytes, Class<T> classOfT) { """ Builds an instance of {@literal T} from the request payload. @param bytes the payload. @param classOfT The class we expect @param <T> the type of the object @return the build object, {@literal null} if the object cannot be built. """ T t = null; try { t = json.mapper().readValue(bytes, classOfT); } catch (IOException e) { LOGGER.error(ERROR, e); } return t; }
java
@Override public <T> T invoke(byte[] bytes, Class<T> classOfT) { T t = null; try { t = json.mapper().readValue(bytes, classOfT); } catch (IOException e) { LOGGER.error(ERROR, e); } return t; }
[ "@", "Override", "public", "<", "T", ">", "T", "invoke", "(", "byte", "[", "]", "bytes", ",", "Class", "<", "T", ">", "classOfT", ")", "{", "T", "t", "=", "null", ";", "try", "{", "t", "=", "json", ".", "mapper", "(", ")", ".", "readValue", "...
Builds an instance of {@literal T} from the request payload. @param bytes the payload. @param classOfT The class we expect @param <T> the type of the object @return the build object, {@literal null} if the object cannot be built.
[ "Builds", "an", "instance", "of", "{", "@literal", "T", "}", "from", "the", "request", "payload", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/content-manager/src/main/java/org/wisdom/content/bodyparsers/BodyParserJson.java#L102-L112
facebookarchive/hive-dwrf
hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java
Slice.compareTo
@SuppressWarnings("ObjectEquality") @Override public int compareTo(Slice that) { """ Compares the content of the specified buffer to the content of this buffer. This comparison is performed byte by byte using an unsigned comparison. """ if (this == that) { return 0; } return compareTo(0, size, that, 0, that.size); }
java
@SuppressWarnings("ObjectEquality") @Override public int compareTo(Slice that) { if (this == that) { return 0; } return compareTo(0, size, that, 0, that.size); }
[ "@", "SuppressWarnings", "(", "\"ObjectEquality\"", ")", "@", "Override", "public", "int", "compareTo", "(", "Slice", "that", ")", "{", "if", "(", "this", "==", "that", ")", "{", "return", "0", ";", "}", "return", "compareTo", "(", "0", ",", "size", ",...
Compares the content of the specified buffer to the content of this buffer. This comparison is performed byte by byte using an unsigned comparison.
[ "Compares", "the", "content", "of", "the", "specified", "buffer", "to", "the", "content", "of", "this", "buffer", ".", "This", "comparison", "is", "performed", "byte", "by", "byte", "using", "an", "unsigned", "comparison", "." ]
train
https://github.com/facebookarchive/hive-dwrf/blob/a7b4fcf28a57e006a2fc041d40cf7e5ad16e6b45/hive-dwrf-shims/src/main/java/org/apache/hadoop/hive/ql/io/slice/Slice.java#L586-L594
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WListRenderer.java
WListRenderer.paintRows
protected void paintRows(final WList list, final WebXmlRenderContext renderContext) { """ Paints the rows. @param list the WList to paint the rows for. @param renderContext the RenderContext to paint to. """ List<?> beanList = list.getBeanList(); WComponent row = list.getRepeatedComponent(); XmlStringBuilder xml = renderContext.getWriter(); for (int i = 0; i < beanList.size(); i++) { Object rowData = beanList.get(i); // Each row has its own context. This is why we can reuse the same // WComponent instance for each row. UIContext rowContext = list.getRowContext(rowData, i); UIContextHolder.pushContext(rowContext); try { xml.appendTag("ui:cell"); row.paint(renderContext); xml.appendEndTag("ui:cell"); } finally { UIContextHolder.popContext(); } } }
java
protected void paintRows(final WList list, final WebXmlRenderContext renderContext) { List<?> beanList = list.getBeanList(); WComponent row = list.getRepeatedComponent(); XmlStringBuilder xml = renderContext.getWriter(); for (int i = 0; i < beanList.size(); i++) { Object rowData = beanList.get(i); // Each row has its own context. This is why we can reuse the same // WComponent instance for each row. UIContext rowContext = list.getRowContext(rowData, i); UIContextHolder.pushContext(rowContext); try { xml.appendTag("ui:cell"); row.paint(renderContext); xml.appendEndTag("ui:cell"); } finally { UIContextHolder.popContext(); } } }
[ "protected", "void", "paintRows", "(", "final", "WList", "list", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "List", "<", "?", ">", "beanList", "=", "list", ".", "getBeanList", "(", ")", ";", "WComponent", "row", "=", "list", ".", "getR...
Paints the rows. @param list the WList to paint the rows for. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "rows", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WListRenderer.java#L100-L122
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java
RuleBasedNumberFormat.extractSpecial
private String extractSpecial(StringBuilder description, String specialName) { """ This extracts the special information from the rule sets before the main parsing starts. Extra whitespace must have already been removed from the description. If found, the special information is removed from the description and returned, otherwise the description is unchanged and null is returned. Note: the trailing semicolon at the end of the special rules is stripped. @param description the rbnf description with extra whitespace removed @param specialName the name of the special rule text to extract @return the special rule text, or null if the rule was not found """ String result = null; int lp = description.indexOf(specialName); if (lp != -1) { // we've got to make sure we're not in the middle of a rule // (where specialName would actually get treated as // rule text) if (lp == 0 || description.charAt(lp - 1) == ';') { // locate the beginning and end of the actual special // rules (there may be whitespace between the name and // the first token in the description) int lpEnd = description.indexOf(";%", lp); if (lpEnd == -1) { lpEnd = description.length() - 1; // later we add 1 back to get the '%' } int lpStart = lp + specialName.length(); while (lpStart < lpEnd && PatternProps.isWhiteSpace(description.charAt(lpStart))) { ++lpStart; } // copy out the special rules result = description.substring(lpStart, lpEnd); // remove the special rule from the description description.delete(lp, lpEnd+1); // delete the semicolon but not the '%' } } return result; }
java
private String extractSpecial(StringBuilder description, String specialName) { String result = null; int lp = description.indexOf(specialName); if (lp != -1) { // we've got to make sure we're not in the middle of a rule // (where specialName would actually get treated as // rule text) if (lp == 0 || description.charAt(lp - 1) == ';') { // locate the beginning and end of the actual special // rules (there may be whitespace between the name and // the first token in the description) int lpEnd = description.indexOf(";%", lp); if (lpEnd == -1) { lpEnd = description.length() - 1; // later we add 1 back to get the '%' } int lpStart = lp + specialName.length(); while (lpStart < lpEnd && PatternProps.isWhiteSpace(description.charAt(lpStart))) { ++lpStart; } // copy out the special rules result = description.substring(lpStart, lpEnd); // remove the special rule from the description description.delete(lp, lpEnd+1); // delete the semicolon but not the '%' } } return result; }
[ "private", "String", "extractSpecial", "(", "StringBuilder", "description", ",", "String", "specialName", ")", "{", "String", "result", "=", "null", ";", "int", "lp", "=", "description", ".", "indexOf", "(", "specialName", ")", ";", "if", "(", "lp", "!=", ...
This extracts the special information from the rule sets before the main parsing starts. Extra whitespace must have already been removed from the description. If found, the special information is removed from the description and returned, otherwise the description is unchanged and null is returned. Note: the trailing semicolon at the end of the special rules is stripped. @param description the rbnf description with extra whitespace removed @param specialName the name of the special rule text to extract @return the special rule text, or null if the rule was not found
[ "This", "extracts", "the", "special", "information", "from", "the", "rule", "sets", "before", "the", "main", "parsing", "starts", ".", "Extra", "whitespace", "must", "have", "already", "been", "removed", "from", "the", "description", ".", "If", "found", "the",...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1626-L1656
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/BinaryLogRecordSerializerVersion2Impl.java
BinaryLogRecordSerializerVersion2Impl.writeString
private static void writeString(String str, DataOutput writer) throws IOException { """ /* Serialize string. Need to take care of <code>null</code> value since {@link DataOutput#writeUTF(String)} does not handle it. """ if (str == null) { writer.writeByte(0); } else { int blocks = str.length() >> 15; // Use smallest number of bytes possible for number of blocks. if (blocks > 0x3FFFFF) { // Need 4 bytes writer.writeByte(0xc0 | (blocks >> 24)); writer.writeByte(0xFF & (blocks >> 16)); writer.writeByte(0xFF & (blocks >> 8)); } else if (blocks > 0x3FFF) { // Need 3 bytes writer.writeByte(0x80 | (blocks >> 16)); writer.writeByte(0xFF & (blocks >> 8)); } else if (blocks > 0x3F) { // Need 2 bytes writer.writeByte(0x40 | (blocks >> 8)); } // Need to add 1 to number of blocks to avoid confusion with 'null' writer.writeByte(0xFF & (blocks+1)); int end = 0; for (int i=0; i<blocks; i++) { int start = end; end = (i+1)<<15; writer.writeUTF(str.substring(start, end)); } writer.writeUTF(str.substring(end)); } }
java
private static void writeString(String str, DataOutput writer) throws IOException { if (str == null) { writer.writeByte(0); } else { int blocks = str.length() >> 15; // Use smallest number of bytes possible for number of blocks. if (blocks > 0x3FFFFF) { // Need 4 bytes writer.writeByte(0xc0 | (blocks >> 24)); writer.writeByte(0xFF & (blocks >> 16)); writer.writeByte(0xFF & (blocks >> 8)); } else if (blocks > 0x3FFF) { // Need 3 bytes writer.writeByte(0x80 | (blocks >> 16)); writer.writeByte(0xFF & (blocks >> 8)); } else if (blocks > 0x3F) { // Need 2 bytes writer.writeByte(0x40 | (blocks >> 8)); } // Need to add 1 to number of blocks to avoid confusion with 'null' writer.writeByte(0xFF & (blocks+1)); int end = 0; for (int i=0; i<blocks; i++) { int start = end; end = (i+1)<<15; writer.writeUTF(str.substring(start, end)); } writer.writeUTF(str.substring(end)); } }
[ "private", "static", "void", "writeString", "(", "String", "str", ",", "DataOutput", "writer", ")", "throws", "IOException", "{", "if", "(", "str", "==", "null", ")", "{", "writer", ".", "writeByte", "(", "0", ")", ";", "}", "else", "{", "int", "blocks...
/* Serialize string. Need to take care of <code>null</code> value since {@link DataOutput#writeUTF(String)} does not handle it.
[ "/", "*", "Serialize", "string", ".", "Need", "to", "take", "care", "of", "<code", ">", "null<", "/", "code", ">", "value", "since", "{" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/BinaryLogRecordSerializerVersion2Impl.java#L670-L699
osglworks/java-tool
src/main/java/org/osgl/Lang.java
F3.lift
public F3<P1, P2, P3, Option<R>> lift() { """ Turns this partial function into a plain function returning an Option result. @return a function that takes an argument x to Some(this.apply(x)) if this can be applied, and to None otherwise. """ final F3<P1, P2, P3, R> me = this; return new F3<P1, P2, P3, Option<R>>() { @Override public Option<R> apply(P1 p1, P2 p2, P3 p3) { try { return some(me.apply(p1, p2, p3)); } catch (RuntimeException e) { return none(); } } }; }
java
public F3<P1, P2, P3, Option<R>> lift() { final F3<P1, P2, P3, R> me = this; return new F3<P1, P2, P3, Option<R>>() { @Override public Option<R> apply(P1 p1, P2 p2, P3 p3) { try { return some(me.apply(p1, p2, p3)); } catch (RuntimeException e) { return none(); } } }; }
[ "public", "F3", "<", "P1", ",", "P2", ",", "P3", ",", "Option", "<", "R", ">", ">", "lift", "(", ")", "{", "final", "F3", "<", "P1", ",", "P2", ",", "P3", ",", "R", ">", "me", "=", "this", ";", "return", "new", "F3", "<", "P1", ",", "P2",...
Turns this partial function into a plain function returning an Option result. @return a function that takes an argument x to Some(this.apply(x)) if this can be applied, and to None otherwise.
[ "Turns", "this", "partial", "function", "into", "a", "plain", "function", "returning", "an", "Option", "result", "." ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/Lang.java#L1327-L1339
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java
ComputationGraph.evaluateROC
public <T extends ROC> T evaluateROC(DataSetIterator iterator, int rocThresholdSteps) { """ Evaluate the network (must be a binary classifier) on the specified data, using the {@link ROC} class @param iterator Data to evaluate on @param rocThresholdSteps Number of threshold steps to use with {@link ROC} @return ROC evaluation on the given dataset """ Layer outputLayer = getOutputLayer(0); if(getConfiguration().isValidateOutputLayerConfig()){ OutputLayerUtil.validateOutputLayerForClassifierEvaluation(outputLayer.conf().getLayer(), ROC.class); } return (T)doEvaluation(iterator, new org.deeplearning4j.eval.ROC(rocThresholdSteps))[0]; }
java
public <T extends ROC> T evaluateROC(DataSetIterator iterator, int rocThresholdSteps) { Layer outputLayer = getOutputLayer(0); if(getConfiguration().isValidateOutputLayerConfig()){ OutputLayerUtil.validateOutputLayerForClassifierEvaluation(outputLayer.conf().getLayer(), ROC.class); } return (T)doEvaluation(iterator, new org.deeplearning4j.eval.ROC(rocThresholdSteps))[0]; }
[ "public", "<", "T", "extends", "ROC", ">", "T", "evaluateROC", "(", "DataSetIterator", "iterator", ",", "int", "rocThresholdSteps", ")", "{", "Layer", "outputLayer", "=", "getOutputLayer", "(", "0", ")", ";", "if", "(", "getConfiguration", "(", ")", ".", "...
Evaluate the network (must be a binary classifier) on the specified data, using the {@link ROC} class @param iterator Data to evaluate on @param rocThresholdSteps Number of threshold steps to use with {@link ROC} @return ROC evaluation on the given dataset
[ "Evaluate", "the", "network", "(", "must", "be", "a", "binary", "classifier", ")", "on", "the", "specified", "data", "using", "the", "{", "@link", "ROC", "}", "class" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/graph/ComputationGraph.java#L3933-L3939
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/inject/writer/BeanDefinitionWriter.java
BeanDefinitionWriter.visitBeanDefinitionConstructor
@Override public void visitBeanDefinitionConstructor(AnnotationMetadata annotationMetadata, boolean requiresReflection) { """ Visits a no-args constructor used to create the bean definition. """ if (constructorVisitor == null) { // first build the constructor visitBeanDefinitionConstructorInternal(annotationMetadata, requiresReflection, Collections.emptyMap(), null, null); // now prepare the implementation of the build method. See BeanFactory interface visitBuildMethodDefinition(annotationMetadata, Collections.emptyMap(), Collections.emptyMap()); // now override the injectBean method visitInjectMethodDefinition(); } }
java
@Override public void visitBeanDefinitionConstructor(AnnotationMetadata annotationMetadata, boolean requiresReflection) { if (constructorVisitor == null) { // first build the constructor visitBeanDefinitionConstructorInternal(annotationMetadata, requiresReflection, Collections.emptyMap(), null, null); // now prepare the implementation of the build method. See BeanFactory interface visitBuildMethodDefinition(annotationMetadata, Collections.emptyMap(), Collections.emptyMap()); // now override the injectBean method visitInjectMethodDefinition(); } }
[ "@", "Override", "public", "void", "visitBeanDefinitionConstructor", "(", "AnnotationMetadata", "annotationMetadata", ",", "boolean", "requiresReflection", ")", "{", "if", "(", "constructorVisitor", "==", "null", ")", "{", "// first build the constructor", "visitBeanDefinit...
Visits a no-args constructor used to create the bean definition.
[ "Visits", "a", "no", "-", "args", "constructor", "used", "to", "create", "the", "bean", "definition", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/inject/writer/BeanDefinitionWriter.java#L438-L451
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java
FormLayout.getLayoutInfo
public LayoutInfo getLayoutInfo(Container parent) { """ Computes and returns the horizontal and vertical grid origins. Performs the same layout process as {@code #layoutContainer} but does not layout the components.<p> This method has been added only to make it easier to debug the form layout. <strong>You must not call this method directly; It may be removed in a future release or the visibility may be reduced.</strong> @param parent the {@code Container} to inspect @return an object that comprises the grid x and y origins """ synchronized (parent.getTreeLock()) { initializeColAndRowComponentLists(); Dimension size = parent.getSize(); Insets insets = parent.getInsets(); int totalWidth = size.width - insets.left - insets.right; int totalHeight = size.height - insets.top - insets.bottom; int[] x = computeGridOrigins(parent, totalWidth, insets.left, colSpecs, colComponents, colGroupIndices, minimumWidthMeasure, preferredWidthMeasure ); int[] y = computeGridOrigins(parent, totalHeight, insets.top, rowSpecs, rowComponents, rowGroupIndices, minimumHeightMeasure, preferredHeightMeasure ); return new LayoutInfo(x, y); } }
java
public LayoutInfo getLayoutInfo(Container parent) { synchronized (parent.getTreeLock()) { initializeColAndRowComponentLists(); Dimension size = parent.getSize(); Insets insets = parent.getInsets(); int totalWidth = size.width - insets.left - insets.right; int totalHeight = size.height - insets.top - insets.bottom; int[] x = computeGridOrigins(parent, totalWidth, insets.left, colSpecs, colComponents, colGroupIndices, minimumWidthMeasure, preferredWidthMeasure ); int[] y = computeGridOrigins(parent, totalHeight, insets.top, rowSpecs, rowComponents, rowGroupIndices, minimumHeightMeasure, preferredHeightMeasure ); return new LayoutInfo(x, y); } }
[ "public", "LayoutInfo", "getLayoutInfo", "(", "Container", "parent", ")", "{", "synchronized", "(", "parent", ".", "getTreeLock", "(", ")", ")", "{", "initializeColAndRowComponentLists", "(", ")", ";", "Dimension", "size", "=", "parent", ".", "getSize", "(", "...
Computes and returns the horizontal and vertical grid origins. Performs the same layout process as {@code #layoutContainer} but does not layout the components.<p> This method has been added only to make it easier to debug the form layout. <strong>You must not call this method directly; It may be removed in a future release or the visibility may be reduced.</strong> @param parent the {@code Container} to inspect @return an object that comprises the grid x and y origins
[ "Computes", "and", "returns", "the", "horizontal", "and", "vertical", "grid", "origins", ".", "Performs", "the", "same", "layout", "process", "as", "{", "@code", "#layoutContainer", "}", "but", "does", "not", "layout", "the", "components", ".", "<p", ">" ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/privatejgoodies/forms/layout/FormLayout.java#L1851-L1878
spring-projects/spring-android
spring-android-rest-template/src/main/java/org/springframework/http/client/support/HttpAccessor.java
HttpAccessor.createRequest
protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException { """ Create a new {@link ClientHttpRequest} via this template's {@link ClientHttpRequestFactory}. @param url the URL to connect to @param method the HTTP method to exectute (GET, POST, etc.) @return the created request @throws IOException in case of I/O errors """ ClientHttpRequest request = getRequestFactory().createRequest(url, method); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Created " + method.name() + " request for \"" + url + "\""); } return request; }
java
protected ClientHttpRequest createRequest(URI url, HttpMethod method) throws IOException { ClientHttpRequest request = getRequestFactory().createRequest(url, method); if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "Created " + method.name() + " request for \"" + url + "\""); } return request; }
[ "protected", "ClientHttpRequest", "createRequest", "(", "URI", "url", ",", "HttpMethod", "method", ")", "throws", "IOException", "{", "ClientHttpRequest", "request", "=", "getRequestFactory", "(", ")", ".", "createRequest", "(", "url", ",", "method", ")", ";", "...
Create a new {@link ClientHttpRequest} via this template's {@link ClientHttpRequestFactory}. @param url the URL to connect to @param method the HTTP method to exectute (GET, POST, etc.) @return the created request @throws IOException in case of I/O errors
[ "Create", "a", "new", "{" ]
train
https://github.com/spring-projects/spring-android/blob/941296e152d49a40e0745a3e81628a974f72b7e4/spring-android-rest-template/src/main/java/org/springframework/http/client/support/HttpAccessor.java#L106-L112
buschmais/jqa-rdbms-plugin
src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/ConnectionPropertyFileScannerPlugin.java
ConnectionPropertyFileScannerPlugin.loadDriver
private void loadDriver(String driver) throws IOException { """ Load a class, e.g. the JDBC driver. @param driver The class name. """ if (driver != null) { try { Class.forName(driver); } catch (ClassNotFoundException e) { throw new IOException(driver + " cannot be loaded, skipping scan of schema.", e); } } }
java
private void loadDriver(String driver) throws IOException { if (driver != null) { try { Class.forName(driver); } catch (ClassNotFoundException e) { throw new IOException(driver + " cannot be loaded, skipping scan of schema.", e); } } }
[ "private", "void", "loadDriver", "(", "String", "driver", ")", "throws", "IOException", "{", "if", "(", "driver", "!=", "null", ")", "{", "try", "{", "Class", ".", "forName", "(", "driver", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")",...
Load a class, e.g. the JDBC driver. @param driver The class name.
[ "Load", "a", "class", "e", ".", "g", ".", "the", "JDBC", "driver", "." ]
train
https://github.com/buschmais/jqa-rdbms-plugin/blob/96c3919907deee00175cf5ab005867d76e01ba62/src/main/java/com/buschmais/jqassistant/plugin/rdbms/impl/scanner/ConnectionPropertyFileScannerPlugin.java#L108-L116
OrienteerBAP/wicket-orientdb
wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java
OSchemaHelper.oIndex
public OSchemaHelper oIndex(String name, INDEX_TYPE type) { """ Create {@link OIndex} if required on a current property @param name name of an index @param type type of an {@link OIndex} @return this helper """ checkOProperty(); return oIndex(name, type, lastProperty.getName()); }
java
public OSchemaHelper oIndex(String name, INDEX_TYPE type) { checkOProperty(); return oIndex(name, type, lastProperty.getName()); }
[ "public", "OSchemaHelper", "oIndex", "(", "String", "name", ",", "INDEX_TYPE", "type", ")", "{", "checkOProperty", "(", ")", ";", "return", "oIndex", "(", "name", ",", "type", ",", "lastProperty", ".", "getName", "(", ")", ")", ";", "}" ]
Create {@link OIndex} if required on a current property @param name name of an index @param type type of an {@link OIndex} @return this helper
[ "Create", "{" ]
train
https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/utils/OSchemaHelper.java#L277-L281
groovy/groovy-core
src/main/org/codehaus/groovy/tools/FileSystemCompiler.java
FileSystemCompiler.commandLineCompile
public static void commandLineCompile(String[] args, boolean lookupUnnamedFiles) throws Exception { """ Same as main(args) except that exceptions are thrown out instead of causing the VM to exit and the lookup for .groovy files can be controlled """ Options options = createCompilationOptions(); CommandLineParser cliParser = new GroovyInternalPosixParser(); CommandLine cli; cli = cliParser.parse(options, args); if (cli.hasOption('h')) { displayHelp(options); return; } if (cli.hasOption('v')) { displayVersion(); return; } displayStackTraceOnError = cli.hasOption('e'); CompilerConfiguration configuration = generateCompilerConfigurationFromOptions(cli); // // Load the file name list String[] filenames = generateFileNamesFromOptions(cli); boolean fileNameErrors = filenames == null; if (!fileNameErrors && (filenames.length == 0)) { displayHelp(options); return; } fileNameErrors = fileNameErrors && !validateFiles(filenames); if (!fileNameErrors) { doCompilation(configuration, null, filenames, lookupUnnamedFiles); } }
java
public static void commandLineCompile(String[] args, boolean lookupUnnamedFiles) throws Exception { Options options = createCompilationOptions(); CommandLineParser cliParser = new GroovyInternalPosixParser(); CommandLine cli; cli = cliParser.parse(options, args); if (cli.hasOption('h')) { displayHelp(options); return; } if (cli.hasOption('v')) { displayVersion(); return; } displayStackTraceOnError = cli.hasOption('e'); CompilerConfiguration configuration = generateCompilerConfigurationFromOptions(cli); // // Load the file name list String[] filenames = generateFileNamesFromOptions(cli); boolean fileNameErrors = filenames == null; if (!fileNameErrors && (filenames.length == 0)) { displayHelp(options); return; } fileNameErrors = fileNameErrors && !validateFiles(filenames); if (!fileNameErrors) { doCompilation(configuration, null, filenames, lookupUnnamedFiles); } }
[ "public", "static", "void", "commandLineCompile", "(", "String", "[", "]", "args", ",", "boolean", "lookupUnnamedFiles", ")", "throws", "Exception", "{", "Options", "options", "=", "createCompilationOptions", "(", ")", ";", "CommandLineParser", "cliParser", "=", "...
Same as main(args) except that exceptions are thrown out instead of causing the VM to exit and the lookup for .groovy files can be controlled
[ "Same", "as", "main", "(", "args", ")", "except", "that", "exceptions", "are", "thrown", "out", "instead", "of", "causing", "the", "VM", "to", "exit", "and", "the", "lookup", "for", ".", "groovy", "files", "can", "be", "controlled" ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/tools/FileSystemCompiler.java#L116-L152
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java
Calendar.handleGetDateFormat
protected DateFormat handleGetDateFormat(String pattern, ULocale locale) { """ Creates a <code>DateFormat</code> appropriate to this calendar. This is a framework method for subclasses to override. This method is responsible for creating the calendar-specific DateFormat and DateFormatSymbols objects as needed. @param pattern the pattern, specific to the <code>DateFormat</code> subclass @param locale the locale for which the symbols should be drawn @return a <code>DateFormat</code> appropriate to this calendar """ return handleGetDateFormat(pattern, null, locale); }
java
protected DateFormat handleGetDateFormat(String pattern, ULocale locale) { return handleGetDateFormat(pattern, null, locale); }
[ "protected", "DateFormat", "handleGetDateFormat", "(", "String", "pattern", ",", "ULocale", "locale", ")", "{", "return", "handleGetDateFormat", "(", "pattern", ",", "null", ",", "locale", ")", ";", "}" ]
Creates a <code>DateFormat</code> appropriate to this calendar. This is a framework method for subclasses to override. This method is responsible for creating the calendar-specific DateFormat and DateFormatSymbols objects as needed. @param pattern the pattern, specific to the <code>DateFormat</code> subclass @param locale the locale for which the symbols should be drawn @return a <code>DateFormat</code> appropriate to this calendar
[ "Creates", "a", "<code", ">", "DateFormat<", "/", "code", ">", "appropriate", "to", "this", "calendar", ".", "This", "is", "a", "framework", "method", "for", "subclasses", "to", "override", ".", "This", "method", "is", "responsible", "for", "creating", "the"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L3390-L3392
knowm/XChange
xchange-koinim/src/main/java/org/knowm/xchange/koinim/KoinimAdapters.java
KoinimAdapters.adaptTicker
public static Ticker adaptTicker(KoinimTicker koinimTicker, CurrencyPair currencyPair) { """ Adapts a KoinimTicker to a Ticker Object @param koinimTicker The exchange specific ticker @param currencyPair @return The ticker """ if (!currencyPair.equals(new CurrencyPair(BTC, TRY))) { throw new NotAvailableFromExchangeException(); } if (koinimTicker != null) { return new Ticker.Builder() .currencyPair(new CurrencyPair(BTC, Currency.TRY)) .last(koinimTicker.getSell()) .bid(koinimTicker.getBid()) .ask(koinimTicker.getAsk()) .high(koinimTicker.getHigh()) .low(koinimTicker.getLow()) .volume(koinimTicker.getVolume()) .vwap(koinimTicker.getAvg()) .build(); } return null; }
java
public static Ticker adaptTicker(KoinimTicker koinimTicker, CurrencyPair currencyPair) { if (!currencyPair.equals(new CurrencyPair(BTC, TRY))) { throw new NotAvailableFromExchangeException(); } if (koinimTicker != null) { return new Ticker.Builder() .currencyPair(new CurrencyPair(BTC, Currency.TRY)) .last(koinimTicker.getSell()) .bid(koinimTicker.getBid()) .ask(koinimTicker.getAsk()) .high(koinimTicker.getHigh()) .low(koinimTicker.getLow()) .volume(koinimTicker.getVolume()) .vwap(koinimTicker.getAvg()) .build(); } return null; }
[ "public", "static", "Ticker", "adaptTicker", "(", "KoinimTicker", "koinimTicker", ",", "CurrencyPair", "currencyPair", ")", "{", "if", "(", "!", "currencyPair", ".", "equals", "(", "new", "CurrencyPair", "(", "BTC", ",", "TRY", ")", ")", ")", "{", "throw", ...
Adapts a KoinimTicker to a Ticker Object @param koinimTicker The exchange specific ticker @param currencyPair @return The ticker
[ "Adapts", "a", "KoinimTicker", "to", "a", "Ticker", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-koinim/src/main/java/org/knowm/xchange/koinim/KoinimAdapters.java#L24-L43
lucee/Lucee
core/src/main/java/lucee/transformer/library/function/FunctionLibEntityResolver.java
FunctionLibEntityResolver.resolveEntity
@Override public InputSource resolveEntity(String publicId, String systemId) { """ Laedt die DTD vom lokalen System. @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) """ for (int i = 0; i < Constants.DTDS_FLD.length; i++) { if (publicId.equals(Constants.DTDS_FLD[i])) { return new InputSource(getClass().getResourceAsStream(DTD_1_0)); } } return null; }
java
@Override public InputSource resolveEntity(String publicId, String systemId) { for (int i = 0; i < Constants.DTDS_FLD.length; i++) { if (publicId.equals(Constants.DTDS_FLD[i])) { return new InputSource(getClass().getResourceAsStream(DTD_1_0)); } } return null; }
[ "@", "Override", "public", "InputSource", "resolveEntity", "(", "String", "publicId", ",", "String", "systemId", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "Constants", ".", "DTDS_FLD", ".", "length", ";", "i", "++", ")", "{", "if", "...
Laedt die DTD vom lokalen System. @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String)
[ "Laedt", "die", "DTD", "vom", "lokalen", "System", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/function/FunctionLibEntityResolver.java#L43-L51
javagl/ND
nd-distance/src/main/java/de/javagl/nd/distance/tuples/i/MathUtils.java
MathUtils.wrappedDistance
static int wrappedDistance(int i0, int i1, int size) { """ Computes the distance (absolute difference) between the given values when they are interpreted as points on a circle with the given size (that is, circumference). <br> <br> E.g. <br> <pre><code> wrappedDistance(0, 9, 10) = 1 wrappedDistance(0, 10, 10) = 0 wrappedDistance(0, 11, 10) = 1 wrappedDistance(1, -4, 10) = 5 </code></pre> @param i0 The first value @param i1 The second value @param size The wrapping size @return The wrapped distance """ int w0 = wrap(i0, size); int w1 = wrap(i1, size); int d = Math.abs(w1-w0); return Math.min(d, size-d); }
java
static int wrappedDistance(int i0, int i1, int size) { int w0 = wrap(i0, size); int w1 = wrap(i1, size); int d = Math.abs(w1-w0); return Math.min(d, size-d); }
[ "static", "int", "wrappedDistance", "(", "int", "i0", ",", "int", "i1", ",", "int", "size", ")", "{", "int", "w0", "=", "wrap", "(", "i0", ",", "size", ")", ";", "int", "w1", "=", "wrap", "(", "i1", ",", "size", ")", ";", "int", "d", "=", "Ma...
Computes the distance (absolute difference) between the given values when they are interpreted as points on a circle with the given size (that is, circumference). <br> <br> E.g. <br> <pre><code> wrappedDistance(0, 9, 10) = 1 wrappedDistance(0, 10, 10) = 0 wrappedDistance(0, 11, 10) = 1 wrappedDistance(1, -4, 10) = 5 </code></pre> @param i0 The first value @param i1 The second value @param size The wrapping size @return The wrapped distance
[ "Computes", "the", "distance", "(", "absolute", "difference", ")", "between", "the", "given", "values", "when", "they", "are", "interpreted", "as", "points", "on", "a", "circle", "with", "the", "given", "size", "(", "that", "is", "circumference", ")", ".", ...
train
https://github.com/javagl/ND/blob/bcb655aaf5fc88af6194f73a27cca079186ff559/nd-distance/src/main/java/de/javagl/nd/distance/tuples/i/MathUtils.java#L71-L77
sksamuel/scrimage
scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java
Gradient.setKnotPosition
public void setKnotPosition(int n, int x) { """ Set a knot position. @param n the knot index @param x the knot position @see #setKnotPosition """ xKnots[n] = ImageMath.clamp(x, 0, 255); sortKnots(); rebuildGradient(); }
java
public void setKnotPosition(int n, int x) { xKnots[n] = ImageMath.clamp(x, 0, 255); sortKnots(); rebuildGradient(); }
[ "public", "void", "setKnotPosition", "(", "int", "n", ",", "int", "x", ")", "{", "xKnots", "[", "n", "]", "=", "ImageMath", ".", "clamp", "(", "x", ",", "0", ",", "255", ")", ";", "sortKnots", "(", ")", ";", "rebuildGradient", "(", ")", ";", "}" ...
Set a knot position. @param n the knot index @param x the knot position @see #setKnotPosition
[ "Set", "a", "knot", "position", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-filters/src/main/java/thirdparty/jhlabs/image/Gradient.java#L344-L348
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionFactory.java
ExtensionFactory.getExtensionRepositoryDescriptor
public ExtensionRepositoryDescriptor getExtensionRepositoryDescriptor(String id, String type, URI uri) { """ Store and return a weak reference equals to the passed {@link ExtensionRepositoryDescriptor} elements. @param id the unique identifier @param type the repository type (maven, xwiki, etc.) @param uri the repository address @return unique instance of {@link ExtensionRepositoryDescriptor} equals to the passed one """ return getExtensionRepositoryDescriptor(new DefaultExtensionRepositoryDescriptor(id, type, uri)); }
java
public ExtensionRepositoryDescriptor getExtensionRepositoryDescriptor(String id, String type, URI uri) { return getExtensionRepositoryDescriptor(new DefaultExtensionRepositoryDescriptor(id, type, uri)); }
[ "public", "ExtensionRepositoryDescriptor", "getExtensionRepositoryDescriptor", "(", "String", "id", ",", "String", "type", ",", "URI", "uri", ")", "{", "return", "getExtensionRepositoryDescriptor", "(", "new", "DefaultExtensionRepositoryDescriptor", "(", "id", ",", "type"...
Store and return a weak reference equals to the passed {@link ExtensionRepositoryDescriptor} elements. @param id the unique identifier @param type the repository type (maven, xwiki, etc.) @param uri the repository address @return unique instance of {@link ExtensionRepositoryDescriptor} equals to the passed one
[ "Store", "and", "return", "a", "weak", "reference", "equals", "to", "the", "passed", "{", "@link", "ExtensionRepositoryDescriptor", "}", "elements", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/internal/ExtensionFactory.java#L134-L137
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CurrencyLocalizationUrl.java
CurrencyLocalizationUrl.updateCurrencyLocalizationUrl
public static MozuUrl updateCurrencyLocalizationUrl(String currencyCode, String responseFields) { """ Get Resource Url for UpdateCurrencyLocalization @param currencyCode The three character ISO currency code, such as USD for US Dollars. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/currency/{currencyCode}?responseFields={responseFields}"); formatter.formatUrl("currencyCode", currencyCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateCurrencyLocalizationUrl(String currencyCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/currency/{currencyCode}?responseFields={responseFields}"); formatter.formatUrl("currencyCode", currencyCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateCurrencyLocalizationUrl", "(", "String", "currencyCode", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/currency/{currencyCode}?responseFields={responseF...
Get Resource Url for UpdateCurrencyLocalization @param currencyCode The three character ISO currency code, such as USD for US Dollars. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateCurrencyLocalization" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CurrencyLocalizationUrl.java#L114-L120
undertow-io/undertow
parser-generator/src/main/java/io/undertow/annotationprocessor/AbstractParserGenerator.java
AbstractParserGenerator.stateNotFound
private static void stateNotFound(final CodeAttribute c, final TableSwitchBuilder builder) { """ Throws an exception when an invalid state is hit in a tableswitch """ c.branchEnd(builder.getDefaultBranchEnd().get()); c.newInstruction(RuntimeException.class); c.dup(); c.ldc("Invalid character"); c.invokespecial(RuntimeException.class.getName(), "<init>", "(Ljava/lang/String;)V"); c.athrow(); }
java
private static void stateNotFound(final CodeAttribute c, final TableSwitchBuilder builder) { c.branchEnd(builder.getDefaultBranchEnd().get()); c.newInstruction(RuntimeException.class); c.dup(); c.ldc("Invalid character"); c.invokespecial(RuntimeException.class.getName(), "<init>", "(Ljava/lang/String;)V"); c.athrow(); }
[ "private", "static", "void", "stateNotFound", "(", "final", "CodeAttribute", "c", ",", "final", "TableSwitchBuilder", "builder", ")", "{", "c", ".", "branchEnd", "(", "builder", ".", "getDefaultBranchEnd", "(", ")", ".", "get", "(", ")", ")", ";", "c", "."...
Throws an exception when an invalid state is hit in a tableswitch
[ "Throws", "an", "exception", "when", "an", "invalid", "state", "is", "hit", "in", "a", "tableswitch" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/parser-generator/src/main/java/io/undertow/annotationprocessor/AbstractParserGenerator.java#L709-L716
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/impl/Marshaller.java
Marshaller.applyAutoTimestamp
private void applyAutoTimestamp(PropertyMetadata propertyMetadata, long millis) { """ Applies the given time, <code>millis</code>, to the property represented by the given metadata. @param propertyMetadata the property metadata of the field @param millis the time in milliseconds """ Object timestamp = null; Class<?> fieldType = propertyMetadata.getDeclaredType(); if (Date.class.equals(fieldType)) { timestamp = new Date(millis); } else if (Calendar.class.equals(fieldType)) { Calendar calendar = new Calendar.Builder().setInstant(millis).build(); timestamp = calendar; } else if (Long.class.equals(fieldType) || long.class.equals(fieldType)) { timestamp = millis; } else if (OffsetDateTime.class.equals(fieldType)) { timestamp = OffsetDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.systemDefault()); } else if (ZonedDateTime.class.equals(fieldType)) { timestamp = ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.systemDefault()); } ValueBuilder<?, ?, ?> valueBuilder = propertyMetadata.getMapper().toDatastore(timestamp); valueBuilder.setExcludeFromIndexes(!propertyMetadata.isIndexed()); entityBuilder.set(propertyMetadata.getMappedName(), valueBuilder.build()); }
java
private void applyAutoTimestamp(PropertyMetadata propertyMetadata, long millis) { Object timestamp = null; Class<?> fieldType = propertyMetadata.getDeclaredType(); if (Date.class.equals(fieldType)) { timestamp = new Date(millis); } else if (Calendar.class.equals(fieldType)) { Calendar calendar = new Calendar.Builder().setInstant(millis).build(); timestamp = calendar; } else if (Long.class.equals(fieldType) || long.class.equals(fieldType)) { timestamp = millis; } else if (OffsetDateTime.class.equals(fieldType)) { timestamp = OffsetDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.systemDefault()); } else if (ZonedDateTime.class.equals(fieldType)) { timestamp = ZonedDateTime.ofInstant(Instant.ofEpochMilli(millis), ZoneId.systemDefault()); } ValueBuilder<?, ?, ?> valueBuilder = propertyMetadata.getMapper().toDatastore(timestamp); valueBuilder.setExcludeFromIndexes(!propertyMetadata.isIndexed()); entityBuilder.set(propertyMetadata.getMappedName(), valueBuilder.build()); }
[ "private", "void", "applyAutoTimestamp", "(", "PropertyMetadata", "propertyMetadata", ",", "long", "millis", ")", "{", "Object", "timestamp", "=", "null", ";", "Class", "<", "?", ">", "fieldType", "=", "propertyMetadata", ".", "getDeclaredType", "(", ")", ";", ...
Applies the given time, <code>millis</code>, to the property represented by the given metadata. @param propertyMetadata the property metadata of the field @param millis the time in milliseconds
[ "Applies", "the", "given", "time", "<code", ">", "millis<", "/", "code", ">", "to", "the", "property", "represented", "by", "the", "given", "metadata", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/impl/Marshaller.java#L605-L623
carewebframework/carewebframework-core
org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java
BaseMojo.init
protected void init(String classifier, String moduleBase) throws MojoExecutionException { """ Subclasses must call this method early in their execute method. @param classifier The output jar classifier. @param moduleBase The base path for generated resources. @throws MojoExecutionException Unspecified exception. """ this.classifier = classifier; this.moduleBase = moduleBase; stagingDirectory = new File(buildDirectory, classifier + "-staging"); configTemplate = new ConfigTemplate(classifier + "-spring.xml"); exclusionFilter = exclusions == null || exclusions.isEmpty() ? null : new WildcardFileFilter(exclusions); archiveConfig.setAddMavenDescriptor(false); }
java
protected void init(String classifier, String moduleBase) throws MojoExecutionException { this.classifier = classifier; this.moduleBase = moduleBase; stagingDirectory = new File(buildDirectory, classifier + "-staging"); configTemplate = new ConfigTemplate(classifier + "-spring.xml"); exclusionFilter = exclusions == null || exclusions.isEmpty() ? null : new WildcardFileFilter(exclusions); archiveConfig.setAddMavenDescriptor(false); }
[ "protected", "void", "init", "(", "String", "classifier", ",", "String", "moduleBase", ")", "throws", "MojoExecutionException", "{", "this", ".", "classifier", "=", "classifier", ";", "this", ".", "moduleBase", "=", "moduleBase", ";", "stagingDirectory", "=", "n...
Subclasses must call this method early in their execute method. @param classifier The output jar classifier. @param moduleBase The base path for generated resources. @throws MojoExecutionException Unspecified exception.
[ "Subclasses", "must", "call", "this", "method", "early", "in", "their", "execute", "method", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.mvn-parent/org.carewebframework.mvn.plugin-parent/org.carewebframework.mvn.plugin.core/src/main/java/org/carewebframework/maven/plugin/core/BaseMojo.java#L138-L145
operasoftware/operaprestodriver
src/com/opera/core/systems/runner/launcher/OperaLauncherProtocol.java
OperaLauncherProtocol.recv
private void recv(byte[] buffer, int length) throws IOException { """ Receive and block until *all* length bytes are placed in buffer. @param buffer Target buffer to fill @param length Desired length @throws IOException if socket read error or protocol parse error """ int bytes = 0; while (bytes < length) { int res = socket.getInputStream().read(buffer, bytes, length - bytes); if (res > 0) { bytes += res; } else { return; } } }
java
private void recv(byte[] buffer, int length) throws IOException { int bytes = 0; while (bytes < length) { int res = socket.getInputStream().read(buffer, bytes, length - bytes); if (res > 0) { bytes += res; } else { return; } } }
[ "private", "void", "recv", "(", "byte", "[", "]", "buffer", ",", "int", "length", ")", "throws", "IOException", "{", "int", "bytes", "=", "0", ";", "while", "(", "bytes", "<", "length", ")", "{", "int", "res", "=", "socket", ".", "getInputStream", "(...
Receive and block until *all* length bytes are placed in buffer. @param buffer Target buffer to fill @param length Desired length @throws IOException if socket read error or protocol parse error
[ "Receive", "and", "block", "until", "*", "all", "*", "length", "bytes", "are", "placed", "in", "buffer", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/runner/launcher/OperaLauncherProtocol.java#L177-L188
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.socketTextStream
@Deprecated public DataStreamSource<String> socketTextStream(String hostname, int port, char delimiter, long maxRetry) { """ Creates a new data stream that contains the strings received infinitely from a socket. Received strings are decoded by the system's default character set. On the termination of the socket server connection retries can be initiated. <p>Let us note that the socket itself does not report on abort and as a consequence retries are only initiated when the socket was gracefully terminated. @param hostname The host name which a server socket binds @param port The port number which a server socket binds. A port number of 0 means that the port number is automatically allocated. @param delimiter A character which splits received strings into records @param maxRetry The maximal retry interval in seconds while the program waits for a socket that is temporarily down. Reconnection is initiated every second. A number of 0 means that the reader is immediately terminated, while a negative value ensures retrying forever. @return A data stream containing the strings received from the socket @deprecated Use {@link #socketTextStream(String, int, String, long)} instead. """ return socketTextStream(hostname, port, String.valueOf(delimiter), maxRetry); }
java
@Deprecated public DataStreamSource<String> socketTextStream(String hostname, int port, char delimiter, long maxRetry) { return socketTextStream(hostname, port, String.valueOf(delimiter), maxRetry); }
[ "@", "Deprecated", "public", "DataStreamSource", "<", "String", ">", "socketTextStream", "(", "String", "hostname", ",", "int", "port", ",", "char", "delimiter", ",", "long", "maxRetry", ")", "{", "return", "socketTextStream", "(", "hostname", ",", "port", ","...
Creates a new data stream that contains the strings received infinitely from a socket. Received strings are decoded by the system's default character set. On the termination of the socket server connection retries can be initiated. <p>Let us note that the socket itself does not report on abort and as a consequence retries are only initiated when the socket was gracefully terminated. @param hostname The host name which a server socket binds @param port The port number which a server socket binds. A port number of 0 means that the port number is automatically allocated. @param delimiter A character which splits received strings into records @param maxRetry The maximal retry interval in seconds while the program waits for a socket that is temporarily down. Reconnection is initiated every second. A number of 0 means that the reader is immediately terminated, while a negative value ensures retrying forever. @return A data stream containing the strings received from the socket @deprecated Use {@link #socketTextStream(String, int, String, long)} instead.
[ "Creates", "a", "new", "data", "stream", "that", "contains", "the", "strings", "received", "infinitely", "from", "a", "socket", ".", "Received", "strings", "are", "decoded", "by", "the", "system", "s", "default", "character", "set", ".", "On", "the", "termin...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L1187-L1190
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/InfinispanJBossASClient.java
InfinispanJBossASClient.createNewCacheContainerRequest
public ModelNode createNewCacheContainerRequest(String name, String defaultCacheName) { """ Returns a ModelNode that can be used to create a cache container configuration for subsequent cache configuration. Callers are free to tweak the request that is returned, if they so choose, before asking the client to execute the request. <p> The JNDI name will be java:jboss/infinispan/&lt;cacheContainerName&gt; </p> @param name the name of the cache container @param defaultCacheName the name of the default cache. The referenced cache must be subsequently created. @return the request to create the cache container configuration. """ String dmrTemplate = "" // + "{" // + "\"default-cache-name\" => \"%s\" ," // + "\"jndi-name\" => \"%s\" " // + "}"; String jndiName = "java:jboss/infinispan/" + name; String dmr = String.format(dmrTemplate, defaultCacheName, jndiName); Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, name); final ModelNode result = ModelNode.fromString(dmr); result.get(OPERATION).set(ADD); result.get(ADDRESS).set(addr.getAddressNode()); return result; }
java
public ModelNode createNewCacheContainerRequest(String name, String defaultCacheName) { String dmrTemplate = "" // + "{" // + "\"default-cache-name\" => \"%s\" ," // + "\"jndi-name\" => \"%s\" " // + "}"; String jndiName = "java:jboss/infinispan/" + name; String dmr = String.format(dmrTemplate, defaultCacheName, jndiName); Address addr = Address.root().add(SUBSYSTEM, SUBSYSTEM_INFINISPAN, CACHE_CONTAINER, name); final ModelNode result = ModelNode.fromString(dmr); result.get(OPERATION).set(ADD); result.get(ADDRESS).set(addr.getAddressNode()); return result; }
[ "public", "ModelNode", "createNewCacheContainerRequest", "(", "String", "name", ",", "String", "defaultCacheName", ")", "{", "String", "dmrTemplate", "=", "\"\"", "//", "+", "\"{\"", "//", "+", "\"\\\"default-cache-name\\\" => \\\"%s\\\" ,\"", "//", "+", "\"\\\"jndi-nam...
Returns a ModelNode that can be used to create a cache container configuration for subsequent cache configuration. Callers are free to tweak the request that is returned, if they so choose, before asking the client to execute the request. <p> The JNDI name will be java:jboss/infinispan/&lt;cacheContainerName&gt; </p> @param name the name of the cache container @param defaultCacheName the name of the default cache. The referenced cache must be subsequently created. @return the request to create the cache container configuration.
[ "Returns", "a", "ModelNode", "that", "can", "be", "used", "to", "create", "a", "cache", "container", "configuration", "for", "subsequent", "cache", "configuration", ".", "Callers", "are", "free", "to", "tweak", "the", "request", "that", "is", "returned", "if",...
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/InfinispanJBossASClient.java#L83-L99
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlLinkedList.java
HsqlLinkedList.set
public Object set(int index, Object element) { """ Replaces the current element at <code>index/code> with <code>element</code>. @return The current element at <code>index</code>. """ Node setMe = getInternal(index); Object oldData = setMe.data; setMe.data = element; return oldData; }
java
public Object set(int index, Object element) { Node setMe = getInternal(index); Object oldData = setMe.data; setMe.data = element; return oldData; }
[ "public", "Object", "set", "(", "int", "index", ",", "Object", "element", ")", "{", "Node", "setMe", "=", "getInternal", "(", "index", ")", ";", "Object", "oldData", "=", "setMe", ".", "data", ";", "setMe", ".", "data", "=", "element", ";", "return", ...
Replaces the current element at <code>index/code> with <code>element</code>. @return The current element at <code>index</code>.
[ "Replaces", "the", "current", "element", "at", "<code", ">", "index", "/", "code", ">", "with", "<code", ">", "element<", "/", "code", ">", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlLinkedList.java#L199-L207
JodaOrg/joda-beans
src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java
MsgPackOutput.writeExtensionString
void writeExtensionString(int extensionType, String str) throws IOException { """ Writes an extension string using EXT_8. @param extensionType the type @param str the string to write as the data @throws IOException if an error occurs """ byte[] bytes = str.getBytes(UTF_8); if (bytes.length > 256) { throw new IllegalArgumentException("String too long"); } output.write(EXT_8); output.write(bytes.length); output.write(extensionType); output.write(bytes); }
java
void writeExtensionString(int extensionType, String str) throws IOException { byte[] bytes = str.getBytes(UTF_8); if (bytes.length > 256) { throw new IllegalArgumentException("String too long"); } output.write(EXT_8); output.write(bytes.length); output.write(extensionType); output.write(bytes); }
[ "void", "writeExtensionString", "(", "int", "extensionType", ",", "String", "str", ")", "throws", "IOException", "{", "byte", "[", "]", "bytes", "=", "str", ".", "getBytes", "(", "UTF_8", ")", ";", "if", "(", "bytes", ".", "length", ">", "256", ")", "{...
Writes an extension string using EXT_8. @param extensionType the type @param str the string to write as the data @throws IOException if an error occurs
[ "Writes", "an", "extension", "string", "using", "EXT_8", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/ser/bin/MsgPackOutput.java#L292-L301
lightblueseas/email-tails
src/main/java/de/alpharogroup/email/utils/EmailExtensions.java
EmailExtensions.newAddress
public static Address newAddress(final String address, String personal, final String charset) throws AddressException, UnsupportedEncodingException { """ Creates an Address from the given the address and personal name. @param address The address in RFC822 format. @param personal The personal name. @param charset MIME charset to be used to encode the name as per RFC 2047. @return The created InternetAddress-object from the given address and personal name. @throws AddressException is thrown if the parse failed @throws UnsupportedEncodingException is thrown if the encoding not supported """ if (personal.isNullOrEmpty()) { personal = address; } final InternetAddress internetAdress = new InternetAddress(address); if (charset.isNullOrEmpty()) { internetAdress.setPersonal(personal); } else { internetAdress.setPersonal(personal, charset); } return internetAdress; }
java
public static Address newAddress(final String address, String personal, final String charset) throws AddressException, UnsupportedEncodingException { if (personal.isNullOrEmpty()) { personal = address; } final InternetAddress internetAdress = new InternetAddress(address); if (charset.isNullOrEmpty()) { internetAdress.setPersonal(personal); } else { internetAdress.setPersonal(personal, charset); } return internetAdress; }
[ "public", "static", "Address", "newAddress", "(", "final", "String", "address", ",", "String", "personal", ",", "final", "String", "charset", ")", "throws", "AddressException", ",", "UnsupportedEncodingException", "{", "if", "(", "personal", ".", "isNullOrEmpty", ...
Creates an Address from the given the address and personal name. @param address The address in RFC822 format. @param personal The personal name. @param charset MIME charset to be used to encode the name as per RFC 2047. @return The created InternetAddress-object from the given address and personal name. @throws AddressException is thrown if the parse failed @throws UnsupportedEncodingException is thrown if the encoding not supported
[ "Creates", "an", "Address", "from", "the", "given", "the", "address", "and", "personal", "name", "." ]
train
https://github.com/lightblueseas/email-tails/blob/7be6fee3548e61e697cc8e64e90603cb1f505be2/src/main/java/de/alpharogroup/email/utils/EmailExtensions.java#L219-L236
mongodb/stitch-android-sdk
core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/ChangeEvents.java
ChangeEvents.changeEventForLocalInsert
static ChangeEvent<BsonDocument> changeEventForLocalInsert( final MongoNamespace namespace, final BsonDocument document, final boolean writePending ) { """ Generates a change event for a local insert of the given document in the given namespace. @param namespace the namespace where the document was inserted. @param document the document that was inserted. @return a change event for a local insert of the given document in the given namespace. """ final BsonValue docId = BsonUtils.getDocumentId(document); return new ChangeEvent<>( new BsonDocument(), OperationType.INSERT, document, namespace, new BsonDocument("_id", docId), null, writePending); }
java
static ChangeEvent<BsonDocument> changeEventForLocalInsert( final MongoNamespace namespace, final BsonDocument document, final boolean writePending ) { final BsonValue docId = BsonUtils.getDocumentId(document); return new ChangeEvent<>( new BsonDocument(), OperationType.INSERT, document, namespace, new BsonDocument("_id", docId), null, writePending); }
[ "static", "ChangeEvent", "<", "BsonDocument", ">", "changeEventForLocalInsert", "(", "final", "MongoNamespace", "namespace", ",", "final", "BsonDocument", "document", ",", "final", "boolean", "writePending", ")", "{", "final", "BsonValue", "docId", "=", "BsonUtils", ...
Generates a change event for a local insert of the given document in the given namespace. @param namespace the namespace where the document was inserted. @param document the document that was inserted. @return a change event for a local insert of the given document in the given namespace.
[ "Generates", "a", "change", "event", "for", "a", "local", "insert", "of", "the", "given", "document", "in", "the", "given", "namespace", "." ]
train
https://github.com/mongodb/stitch-android-sdk/blob/159b9334b1f1a827285544be5ee20cdf7b04e4cc/core/services/mongodb-remote/src/main/java/com/mongodb/stitch/core/services/mongodb/remote/sync/internal/ChangeEvents.java#L40-L54
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/jaxp/XPathFactoryImpl.java
XPathFactoryImpl.setFeature
public void setFeature(String name, boolean value) throws XPathFactoryConfigurationException { """ <p>Set a feature for this <code>XPathFactory</code> and <code>XPath</code>s created by this factory.</p> <p> Feature names are fully qualified {@link java.net.URI}s. Implementations may define their own features. An {@link XPathFactoryConfigurationException} is thrown if this <code>XPathFactory</code> or the <code>XPath</code>s it creates cannot support the feature. It is possible for an <code>XPathFactory</code> to expose a feature value but be unable to change its state. </p> <p>See {@link javax.xml.xpath.XPathFactory} for full documentation of specific features.</p> @param name Feature name. @param value Is feature state <code>true</code> or <code>false</code>. @throws XPathFactoryConfigurationException if this <code>XPathFactory</code> or the <code>XPath</code>s it creates cannot support this feature. @throws NullPointerException if <code>name</code> is <code>null</code>. """ // feature name cannot be null if (name == null) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_FEATURE_NAME_NULL, new Object[] { CLASS_NAME, new Boolean( value) } ); throw new NullPointerException( fmsg ); } // secure processing? if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { featureSecureProcessing = value; // all done processing feature return; } // unknown feature String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_FEATURE_UNKNOWN, new Object[] { name, CLASS_NAME, new Boolean(value) } ); throw new XPathFactoryConfigurationException( fmsg ); }
java
public void setFeature(String name, boolean value) throws XPathFactoryConfigurationException { // feature name cannot be null if (name == null) { String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_FEATURE_NAME_NULL, new Object[] { CLASS_NAME, new Boolean( value) } ); throw new NullPointerException( fmsg ); } // secure processing? if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) { featureSecureProcessing = value; // all done processing feature return; } // unknown feature String fmsg = XSLMessages.createXPATHMessage( XPATHErrorResources.ER_FEATURE_UNKNOWN, new Object[] { name, CLASS_NAME, new Boolean(value) } ); throw new XPathFactoryConfigurationException( fmsg ); }
[ "public", "void", "setFeature", "(", "String", "name", ",", "boolean", "value", ")", "throws", "XPathFactoryConfigurationException", "{", "// feature name cannot be null", "if", "(", "name", "==", "null", ")", "{", "String", "fmsg", "=", "XSLMessages", ".", "creat...
<p>Set a feature for this <code>XPathFactory</code> and <code>XPath</code>s created by this factory.</p> <p> Feature names are fully qualified {@link java.net.URI}s. Implementations may define their own features. An {@link XPathFactoryConfigurationException} is thrown if this <code>XPathFactory</code> or the <code>XPath</code>s it creates cannot support the feature. It is possible for an <code>XPathFactory</code> to expose a feature value but be unable to change its state. </p> <p>See {@link javax.xml.xpath.XPathFactory} for full documentation of specific features.</p> @param name Feature name. @param value Is feature state <code>true</code> or <code>false</code>. @throws XPathFactoryConfigurationException if this <code>XPathFactory</code> or the <code>XPath</code>s it creates cannot support this feature. @throws NullPointerException if <code>name</code> is <code>null</code>.
[ "<p", ">", "Set", "a", "feature", "for", "this", "<code", ">", "XPathFactory<", "/", "code", ">", "and", "<code", ">", "XPath<", "/", "code", ">", "s", "created", "by", "this", "factory", ".", "<", "/", "p", ">" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/jaxp/XPathFactoryImpl.java#L136-L161
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CachedSessionProperties.java
CachedSessionProperties.areTheyTheSame
private boolean areTheyTheSame(Object obj1, Object obj2) { """ Method which compares 2 objects and determines if they are the same. Objects are the same if they are both null, or if they have equal values. <p> Note this method should only be used for comparing String objects, Reliability objects and SIDestinationAddress objects (and shouldn't be used for comparing a String to a Reliability either - smart guy). @param obj1 @param obj2 @return Returns true if the objects are equal. """ // If they are both null, then they are equal if (obj1 == null && obj2 == null) return true; // If only one is null then they are not equal if (obj1 == null || obj2 == null) return false; // At this point neither are null - so check them // String if (obj1 instanceof String) { return ((String) obj1).equals(obj2); } // Reliability if (obj1 instanceof Reliability) { return ((Reliability) obj1).compareTo(obj2) == 0; } // Start f192759.2 // SIDestinationAddress if (obj1 instanceof SIDestinationAddress) { return obj1.toString().equals(obj2.toString()); } // End f192759.2 // Otherwise, I have no idea - so return false return false; }
java
private boolean areTheyTheSame(Object obj1, Object obj2) { // If they are both null, then they are equal if (obj1 == null && obj2 == null) return true; // If only one is null then they are not equal if (obj1 == null || obj2 == null) return false; // At this point neither are null - so check them // String if (obj1 instanceof String) { return ((String) obj1).equals(obj2); } // Reliability if (obj1 instanceof Reliability) { return ((Reliability) obj1).compareTo(obj2) == 0; } // Start f192759.2 // SIDestinationAddress if (obj1 instanceof SIDestinationAddress) { return obj1.toString().equals(obj2.toString()); } // End f192759.2 // Otherwise, I have no idea - so return false return false; }
[ "private", "boolean", "areTheyTheSame", "(", "Object", "obj1", ",", "Object", "obj2", ")", "{", "// If they are both null, then they are equal", "if", "(", "obj1", "==", "null", "&&", "obj2", "==", "null", ")", "return", "true", ";", "// If only one is null then the...
Method which compares 2 objects and determines if they are the same. Objects are the same if they are both null, or if they have equal values. <p> Note this method should only be used for comparing String objects, Reliability objects and SIDestinationAddress objects (and shouldn't be used for comparing a String to a Reliability either - smart guy). @param obj1 @param obj2 @return Returns true if the objects are equal.
[ "Method", "which", "compares", "2", "objects", "and", "determines", "if", "they", "are", "the", "same", ".", "Objects", "are", "the", "same", "if", "they", "are", "both", "null", "or", "if", "they", "have", "equal", "values", ".", "<p", ">", "Note", "t...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.server/src/com/ibm/ws/sib/comms/server/clientsupport/CachedSessionProperties.java#L107-L136
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java
ExtensionsInner.enableMonitoring
public void enableMonitoring(String resourceGroupName, String clusterName, ClusterMonitoringRequest parameters) { """ Enables the Operations Management Suite (OMS) on the HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param parameters The Operations Management Suite (OMS) workspace parameters. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ enableMonitoringWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().last().body(); }
java
public void enableMonitoring(String resourceGroupName, String clusterName, ClusterMonitoringRequest parameters) { enableMonitoringWithServiceResponseAsync(resourceGroupName, clusterName, parameters).toBlocking().last().body(); }
[ "public", "void", "enableMonitoring", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "ClusterMonitoringRequest", "parameters", ")", "{", "enableMonitoringWithServiceResponseAsync", "(", "resourceGroupName", ",", "clusterName", ",", "parameters", ")",...
Enables the Operations Management Suite (OMS) on the HDInsight cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param parameters The Operations Management Suite (OMS) workspace parameters. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Enables", "the", "Operations", "Management", "Suite", "(", "OMS", ")", "on", "the", "HDInsight", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ExtensionsInner.java#L111-L113
liferay/com-liferay-commerce
commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java
CommercePriceListPersistenceImpl.findAll
@Override public List<CommercePriceList> findAll(int start, int end) { """ Returns a range of all the commerce price lists. <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 CommercePriceListModelImpl}. 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 price lists @param end the upper bound of the range of commerce price lists (not inclusive) @return the range of commerce price lists """ return findAll(start, end, null); }
java
@Override public List<CommercePriceList> findAll(int start, int end) { return findAll(start, end, null); }
[ "@", "Override", "public", "List", "<", "CommercePriceList", ">", "findAll", "(", "int", "start", ",", "int", "end", ")", "{", "return", "findAll", "(", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce price lists. <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 CommercePriceListModelImpl}. 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 price lists @param end the upper bound of the range of commerce price lists (not inclusive) @return the range of commerce price lists
[ "Returns", "a", "range", "of", "all", "the", "commerce", "price", "lists", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-price-list-service/src/main/java/com/liferay/commerce/price/list/service/persistence/impl/CommercePriceListPersistenceImpl.java#L5958-L5961
jbundle/jbundle
base/db/xml/src/main/java/org/jbundle/base/db/xml/XDatabase.java
XDatabase.makeNewPTable
public PTable makeNewPTable(FieldList record, Object key) { """ Create a raw data table for this table. @param table The table to create a raw data table for. @param key The lookup key that will be passed (on initialization) to the new raw data table. @return The new raw data table. """ XTable xTable = new XTable(this, record, key); // New empty table return xTable; }
java
public PTable makeNewPTable(FieldList record, Object key) { XTable xTable = new XTable(this, record, key); // New empty table return xTable; }
[ "public", "PTable", "makeNewPTable", "(", "FieldList", "record", ",", "Object", "key", ")", "{", "XTable", "xTable", "=", "new", "XTable", "(", "this", ",", "record", ",", "key", ")", ";", "// New empty table", "return", "xTable", ";", "}" ]
Create a raw data table for this table. @param table The table to create a raw data table for. @param key The lookup key that will be passed (on initialization) to the new raw data table. @return The new raw data table.
[ "Create", "a", "raw", "data", "table", "for", "this", "table", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/xml/src/main/java/org/jbundle/base/db/xml/XDatabase.java#L56-L60
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionsInner.java
VirtualMachineScaleSetExtensionsInner.listAsync
public Observable<Page<VirtualMachineScaleSetExtensionInner>> listAsync(final String resourceGroupName, final String vmScaleSetName) { """ Gets a list of all extensions in a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set containing the extension. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VirtualMachineScaleSetExtensionInner&gt; object """ return listWithServiceResponseAsync(resourceGroupName, vmScaleSetName) .map(new Func1<ServiceResponse<Page<VirtualMachineScaleSetExtensionInner>>, Page<VirtualMachineScaleSetExtensionInner>>() { @Override public Page<VirtualMachineScaleSetExtensionInner> call(ServiceResponse<Page<VirtualMachineScaleSetExtensionInner>> response) { return response.body(); } }); }
java
public Observable<Page<VirtualMachineScaleSetExtensionInner>> listAsync(final String resourceGroupName, final String vmScaleSetName) { return listWithServiceResponseAsync(resourceGroupName, vmScaleSetName) .map(new Func1<ServiceResponse<Page<VirtualMachineScaleSetExtensionInner>>, Page<VirtualMachineScaleSetExtensionInner>>() { @Override public Page<VirtualMachineScaleSetExtensionInner> call(ServiceResponse<Page<VirtualMachineScaleSetExtensionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "VirtualMachineScaleSetExtensionInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "vmScaleSetName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ...
Gets a list of all extensions in a VM scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set containing the extension. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VirtualMachineScaleSetExtensionInner&gt; object
[ "Gets", "a", "list", "of", "all", "extensions", "in", "a", "VM", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetExtensionsInner.java#L684-L692
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java
BeanDeployer.addClass
public BeanDeployer addClass(String className, AnnotatedTypeLoader loader) { """ Loads a given class, creates a {@link SlimAnnotatedTypeContext} for it and stores it in {@link BeanDeployerEnvironment}. """ addIfNotNull(loader.loadAnnotatedType(className, getManager().getId())); return this; }
java
public BeanDeployer addClass(String className, AnnotatedTypeLoader loader) { addIfNotNull(loader.loadAnnotatedType(className, getManager().getId())); return this; }
[ "public", "BeanDeployer", "addClass", "(", "String", "className", ",", "AnnotatedTypeLoader", "loader", ")", "{", "addIfNotNull", "(", "loader", ".", "loadAnnotatedType", "(", "className", ",", "getManager", "(", ")", ".", "getId", "(", ")", ")", ")", ";", "...
Loads a given class, creates a {@link SlimAnnotatedTypeContext} for it and stores it in {@link BeanDeployerEnvironment}.
[ "Loads", "a", "given", "class", "creates", "a", "{" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/BeanDeployer.java#L86-L89
google/error-prone
check_api/src/main/java/com/google/errorprone/util/FindIdentifiers.java
FindIdentifiers.findIdent
public static Symbol findIdent(String name, VisitorState state) { """ Finds a variable declaration with the given name that is in scope at the current location. """ return findIdent(name, state, KindSelector.VAR); }
java
public static Symbol findIdent(String name, VisitorState state) { return findIdent(name, state, KindSelector.VAR); }
[ "public", "static", "Symbol", "findIdent", "(", "String", "name", ",", "VisitorState", "state", ")", "{", "return", "findIdent", "(", "name", ",", "state", ",", "KindSelector", ".", "VAR", ")", ";", "}" ]
Finds a variable declaration with the given name that is in scope at the current location.
[ "Finds", "a", "variable", "declaration", "with", "the", "given", "name", "that", "is", "in", "scope", "at", "the", "current", "location", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/util/FindIdentifiers.java#L80-L82
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java
StructuredQueryBuilder.containerConstraint
public StructuredQueryDefinition containerConstraint(String constraintName, StructuredQueryDefinition query) { """ Matches a query within the substructure of the container specified by the constraint. @param constraintName the constraint definition @param query the query definition @return the StructuredQueryDefinition for the element constraint query """ checkQuery(query); return new ContainerConstraintQuery(constraintName, query); }
java
public StructuredQueryDefinition containerConstraint(String constraintName, StructuredQueryDefinition query) { checkQuery(query); return new ContainerConstraintQuery(constraintName, query); }
[ "public", "StructuredQueryDefinition", "containerConstraint", "(", "String", "constraintName", ",", "StructuredQueryDefinition", "query", ")", "{", "checkQuery", "(", "query", ")", ";", "return", "new", "ContainerConstraintQuery", "(", "constraintName", ",", "query", ")...
Matches a query within the substructure of the container specified by the constraint. @param constraintName the constraint definition @param query the query definition @return the StructuredQueryDefinition for the element constraint query
[ "Matches", "a", "query", "within", "the", "substructure", "of", "the", "container", "specified", "by", "the", "constraint", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/query/StructuredQueryBuilder.java#L997-L1000
alkacon/opencms-core
src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java
CmsMessageBundleEditorOptions.initLowerLeftComponent
private void initLowerLeftComponent() { """ Initializes the lower left component {@link #m_lowerLeftComponent} with the correctly placed "Add key"-label. """ HorizontalLayout placeHolderLowerLeft = new HorizontalLayout(); placeHolderLowerLeft.setWidth("100%"); Label newKeyLabel = new Label(m_messages.key(Messages.GUI_CAPTION_ADD_KEY_0)); newKeyLabel.setWidthUndefined(); HorizontalLayout lowerLeft = new HorizontalLayout(placeHolderLowerLeft, newKeyLabel); lowerLeft.setWidth("100%"); lowerLeft.setExpandRatio(placeHolderLowerLeft, 1f); m_lowerLeftComponent = lowerLeft; }
java
private void initLowerLeftComponent() { HorizontalLayout placeHolderLowerLeft = new HorizontalLayout(); placeHolderLowerLeft.setWidth("100%"); Label newKeyLabel = new Label(m_messages.key(Messages.GUI_CAPTION_ADD_KEY_0)); newKeyLabel.setWidthUndefined(); HorizontalLayout lowerLeft = new HorizontalLayout(placeHolderLowerLeft, newKeyLabel); lowerLeft.setWidth("100%"); lowerLeft.setExpandRatio(placeHolderLowerLeft, 1f); m_lowerLeftComponent = lowerLeft; }
[ "private", "void", "initLowerLeftComponent", "(", ")", "{", "HorizontalLayout", "placeHolderLowerLeft", "=", "new", "HorizontalLayout", "(", ")", ";", "placeHolderLowerLeft", ".", "setWidth", "(", "\"100%\"", ")", ";", "Label", "newKeyLabel", "=", "new", "Label", ...
Initializes the lower left component {@link #m_lowerLeftComponent} with the correctly placed "Add key"-label.
[ "Initializes", "the", "lower", "left", "component", "{" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/editors/messagebundle/CmsMessageBundleEditorOptions.java#L395-L406
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java
DocTreeScanner.visitSince
@Override public R visitSince(SinceTree node, P p) { """ {@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning """ return scan(node.getBody(), p); }
java
@Override public R visitSince(SinceTree node, P p) { return scan(node.getBody(), p); }
[ "@", "Override", "public", "R", "visitSince", "(", "SinceTree", "node", ",", "P", "p", ")", "{", "return", "scan", "(", "node", ".", "getBody", "(", ")", ",", "p", ")", ";", "}" ]
{@inheritDoc} This implementation scans the children in left to right order. @param node {@inheritDoc} @param p {@inheritDoc} @return the result of scanning
[ "{", "@inheritDoc", "}", "This", "implementation", "scans", "the", "children", "in", "left", "to", "right", "order", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/source/util/DocTreeScanner.java#L423-L426
BioPAX/Paxtools
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
QueryExecuter.runCommonStreamWithPOIMultiSet
public static Set<BioPAXElement> runCommonStreamWithPOIMultiSet( Set<Set<BioPAXElement>> sourceSets, Model model, Direction direction, int limit, Filter... filters) { """ First finds the common stream, then completes it with the paths between seed and common stream. @param sourceSets Seed to the query @param model BioPAX model @param direction UPSTREAM or DOWNSTREAM @param limit Length limit for the search @param filters for filtering graph elements @return BioPAX elements in the result """ Graph graph; if (model.getLevel() == BioPAXLevel.L3) { graph = new GraphL3(model, filters); } else return Collections.emptySet(); Collection<Set<Node>> nodes = prepareNodeSetsFromSets(sourceSets, graph); if (nodes.size() < 2) return Collections.emptySet(); return runCommonStreamWithPOIContinued(nodes, direction, limit, graph); }
java
public static Set<BioPAXElement> runCommonStreamWithPOIMultiSet( Set<Set<BioPAXElement>> sourceSets, Model model, Direction direction, int limit, Filter... filters) { Graph graph; if (model.getLevel() == BioPAXLevel.L3) { graph = new GraphL3(model, filters); } else return Collections.emptySet(); Collection<Set<Node>> nodes = prepareNodeSetsFromSets(sourceSets, graph); if (nodes.size() < 2) return Collections.emptySet(); return runCommonStreamWithPOIContinued(nodes, direction, limit, graph); }
[ "public", "static", "Set", "<", "BioPAXElement", ">", "runCommonStreamWithPOIMultiSet", "(", "Set", "<", "Set", "<", "BioPAXElement", ">", ">", "sourceSets", ",", "Model", "model", ",", "Direction", "direction", ",", "int", "limit", ",", "Filter", "...", "filt...
First finds the common stream, then completes it with the paths between seed and common stream. @param sourceSets Seed to the query @param model BioPAX model @param direction UPSTREAM or DOWNSTREAM @param limit Length limit for the search @param filters for filtering graph elements @return BioPAX elements in the result
[ "First", "finds", "the", "common", "stream", "then", "completes", "it", "with", "the", "paths", "between", "seed", "and", "common", "stream", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L363-L383
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageFactoryImpl.java
JsMessageFactoryImpl.createInboundJsMessage
public JsMessage createInboundJsMessage(byte rawMessage[], int offset, int length) throws MessageDecodeFailedException { """ Create a JsMessage to represent an inbound message. (To be called by the Communications component.) @param rawMessage The inbound byte array containging a complete message @param offset The offset in the byte array at which the message begins @param length The length of the message within the byte array @return The new JsMessage @exception MessageDecodeFailedException Thrown if the inbound message could not be decoded """ return createInboundJsMessage(rawMessage, offset, length, null); }
java
public JsMessage createInboundJsMessage(byte rawMessage[], int offset, int length) throws MessageDecodeFailedException { return createInboundJsMessage(rawMessage, offset, length, null); }
[ "public", "JsMessage", "createInboundJsMessage", "(", "byte", "rawMessage", "[", "]", ",", "int", "offset", ",", "int", "length", ")", "throws", "MessageDecodeFailedException", "{", "return", "createInboundJsMessage", "(", "rawMessage", ",", "offset", ",", "length",...
Create a JsMessage to represent an inbound message. (To be called by the Communications component.) @param rawMessage The inbound byte array containging a complete message @param offset The offset in the byte array at which the message begins @param length The length of the message within the byte array @return The new JsMessage @exception MessageDecodeFailedException Thrown if the inbound message could not be decoded
[ "Create", "a", "JsMessage", "to", "represent", "an", "inbound", "message", ".", "(", "To", "be", "called", "by", "the", "Communications", "component", ".", ")" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageFactoryImpl.java#L78-L81
librato/librato-java
src/main/java/com/librato/metrics/client/Authorization.java
Authorization.buildAuthHeader
public static String buildAuthHeader(String username, String token) { """ Builds a new HTTP Authorization header for Librato API requests @param username the Librato username @param token the Librato token @return the Authorization header value """ if (username == null || "".equals(username)) { throw new IllegalArgumentException("Username must be specified"); } if (token == null || "".equals(token)) { throw new IllegalArgumentException("Token must be specified"); } return String.format("Basic %s", base64Encode((username + ":" + token).getBytes(Charset.forName("UTF-8")))); }
java
public static String buildAuthHeader(String username, String token) { if (username == null || "".equals(username)) { throw new IllegalArgumentException("Username must be specified"); } if (token == null || "".equals(token)) { throw new IllegalArgumentException("Token must be specified"); } return String.format("Basic %s", base64Encode((username + ":" + token).getBytes(Charset.forName("UTF-8")))); }
[ "public", "static", "String", "buildAuthHeader", "(", "String", "username", ",", "String", "token", ")", "{", "if", "(", "username", "==", "null", "||", "\"\"", ".", "equals", "(", "username", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", ...
Builds a new HTTP Authorization header for Librato API requests @param username the Librato username @param token the Librato token @return the Authorization header value
[ "Builds", "a", "new", "HTTP", "Authorization", "header", "for", "Librato", "API", "requests" ]
train
https://github.com/librato/librato-java/blob/bff7e776d4af5e978181db47f65e171ab67c1c77/src/main/java/com/librato/metrics/client/Authorization.java#L18-L26
Bedework/bw-util
bw-util-timezones/src/main/java/org/bedework/util/timezones/DateTimeUtil.java
DateTimeUtil.rfcDateTime
@SuppressWarnings("unused") public static String rfcDateTime(final Date val, final TimeZone tz) { """ Turn Date into "yyyy-MM-ddTHH:mm:ss" for a given timezone @param val date @param tz TimeZone @return String "yyyy-MM-ddTHH:mm:ss" """ synchronized (rfcDateTimeTZFormat) { rfcDateTimeTZFormat.setTimeZone(tz); return rfcDateTimeTZFormat.format(val); } }
java
@SuppressWarnings("unused") public static String rfcDateTime(final Date val, final TimeZone tz) { synchronized (rfcDateTimeTZFormat) { rfcDateTimeTZFormat.setTimeZone(tz); return rfcDateTimeTZFormat.format(val); } }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "public", "static", "String", "rfcDateTime", "(", "final", "Date", "val", ",", "final", "TimeZone", "tz", ")", "{", "synchronized", "(", "rfcDateTimeTZFormat", ")", "{", "rfcDateTimeTZFormat", ".", "setTimeZone", ...
Turn Date into "yyyy-MM-ddTHH:mm:ss" for a given timezone @param val date @param tz TimeZone @return String "yyyy-MM-ddTHH:mm:ss"
[ "Turn", "Date", "into", "yyyy", "-", "MM", "-", "ddTHH", ":", "mm", ":", "ss", "for", "a", "given", "timezone" ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-timezones/src/main/java/org/bedework/util/timezones/DateTimeUtil.java#L225-L231
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminClient.java
FirestoreAdminClient.createIndex
public final Operation createIndex(ParentName parent, Index index) { """ Creates a composite index. This returns a [google.longrunning.Operation][google.longrunning.Operation] which may be used to track the status of the creation. The metadata for the operation will be the type [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata]. <p>Sample code: <pre><code> try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) { ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]"); Index index = Index.newBuilder().build(); Operation response = firestoreAdminClient.createIndex(parent, index); } </code></pre> @param parent A parent name of the form `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` @param index The composite index to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ CreateIndexRequest request = CreateIndexRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setIndex(index) .build(); return createIndex(request); }
java
public final Operation createIndex(ParentName parent, Index index) { CreateIndexRequest request = CreateIndexRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setIndex(index) .build(); return createIndex(request); }
[ "public", "final", "Operation", "createIndex", "(", "ParentName", "parent", ",", "Index", "index", ")", "{", "CreateIndexRequest", "request", "=", "CreateIndexRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "parent", "==", "null", "?", "null", ":...
Creates a composite index. This returns a [google.longrunning.Operation][google.longrunning.Operation] which may be used to track the status of the creation. The metadata for the operation will be the type [IndexOperationMetadata][google.firestore.admin.v1.IndexOperationMetadata]. <p>Sample code: <pre><code> try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) { ParentName parent = ParentName.of("[PROJECT]", "[DATABASE]", "[COLLECTION_ID]"); Index index = Index.newBuilder().build(); Operation response = firestoreAdminClient.createIndex(parent, index); } </code></pre> @param parent A parent name of the form `projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}` @param index The composite index to create. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "composite", "index", ".", "This", "returns", "a", "[", "google", ".", "longrunning", ".", "Operation", "]", "[", "google", ".", "longrunning", ".", "Operation", "]", "which", "may", "be", "used", "to", "track", "the", "status", "of", "th...
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreAdminClient.java#L199-L207
alkacon/opencms-core
src/org/opencms/staticexport/CmsDefaultLinkSubstitutionHandler.java
CmsDefaultLinkSubstitutionHandler.getTargetSiteRoot
private String getTargetSiteRoot(CmsObject cms, String path, String basePath) { """ Returns the target site for the given path.<p> @param cms the cms context @param path the path @param basePath the base path @return the target site """ if (OpenCms.getSiteManager().startsWithShared(path) || path.startsWith(CmsWorkplace.VFS_PATH_SYSTEM)) { return null; } String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(path); if ((targetSiteRoot == null) && (basePath != null)) { targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(basePath); } if (targetSiteRoot == null) { targetSiteRoot = cms.getRequestContext().getSiteRoot(); } return targetSiteRoot; }
java
private String getTargetSiteRoot(CmsObject cms, String path, String basePath) { if (OpenCms.getSiteManager().startsWithShared(path) || path.startsWith(CmsWorkplace.VFS_PATH_SYSTEM)) { return null; } String targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(path); if ((targetSiteRoot == null) && (basePath != null)) { targetSiteRoot = OpenCms.getSiteManager().getSiteRoot(basePath); } if (targetSiteRoot == null) { targetSiteRoot = cms.getRequestContext().getSiteRoot(); } return targetSiteRoot; }
[ "private", "String", "getTargetSiteRoot", "(", "CmsObject", "cms", ",", "String", "path", ",", "String", "basePath", ")", "{", "if", "(", "OpenCms", ".", "getSiteManager", "(", ")", ".", "startsWithShared", "(", "path", ")", "||", "path", ".", "startsWith", ...
Returns the target site for the given path.<p> @param cms the cms context @param path the path @param basePath the base path @return the target site
[ "Returns", "the", "target", "site", "for", "the", "given", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/staticexport/CmsDefaultLinkSubstitutionHandler.java#L790-L803
kejunxia/AndroidMvc
library/poke/src/main/java/com/shipdream/lib/poke/util/ReflectUtils.java
ReflectUtils.getFieldValue
public static Object getFieldValue(Object obj, Field field) { """ Gets value of the field of the given object. @param obj The object @param field The field """ Object value = null; boolean accessible = field.isAccessible(); //hack accessibility if (!accessible) { field.setAccessible(true); } try { value = field.get(obj); } catch (IllegalAccessException e) { //ignore should not happen as accessibility has been updated to suit assignment e.printStackTrace(); // $COVERAGE-IGNORE$ } //restore accessibility field.setAccessible(accessible); return value; }
java
public static Object getFieldValue(Object obj, Field field) { Object value = null; boolean accessible = field.isAccessible(); //hack accessibility if (!accessible) { field.setAccessible(true); } try { value = field.get(obj); } catch (IllegalAccessException e) { //ignore should not happen as accessibility has been updated to suit assignment e.printStackTrace(); // $COVERAGE-IGNORE$ } //restore accessibility field.setAccessible(accessible); return value; }
[ "public", "static", "Object", "getFieldValue", "(", "Object", "obj", ",", "Field", "field", ")", "{", "Object", "value", "=", "null", ";", "boolean", "accessible", "=", "field", ".", "isAccessible", "(", ")", ";", "//hack accessibility", "if", "(", "!", "a...
Gets value of the field of the given object. @param obj The object @param field The field
[ "Gets", "value", "of", "the", "field", "of", "the", "given", "object", "." ]
train
https://github.com/kejunxia/AndroidMvc/blob/c7893f0a13119d64297b9eb2988f7323b7da5bbc/library/poke/src/main/java/com/shipdream/lib/poke/util/ReflectUtils.java#L112-L128
Stratio/stratio-cassandra
src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java
ColumnNameHelper.maxComponents
public static List<ByteBuffer> maxComponents(List<ByteBuffer> maxSeen, Composite candidate, CellNameType comparator) { """ finds the max cell name component(s) Note that this method *can modify maxSeen*. @param maxSeen the max columns seen so far @param candidate the candidate column(s) @param comparator the comparator to use @return a list with the max column(s) """ // For a cell name, no reason to look more than the clustering prefix // (and comparing the collection element would actually crash) int size = Math.min(candidate.size(), comparator.clusteringPrefixSize()); if (maxSeen.isEmpty()) return getComponents(candidate, size); // In most case maxSeen is big enough to hold the result so update it in place in those cases maxSeen = maybeGrow(maxSeen, size); for (int i = 0; i < size; i++) maxSeen.set(i, max(maxSeen.get(i), candidate.get(i), comparator.subtype(i))); return maxSeen; }
java
public static List<ByteBuffer> maxComponents(List<ByteBuffer> maxSeen, Composite candidate, CellNameType comparator) { // For a cell name, no reason to look more than the clustering prefix // (and comparing the collection element would actually crash) int size = Math.min(candidate.size(), comparator.clusteringPrefixSize()); if (maxSeen.isEmpty()) return getComponents(candidate, size); // In most case maxSeen is big enough to hold the result so update it in place in those cases maxSeen = maybeGrow(maxSeen, size); for (int i = 0; i < size; i++) maxSeen.set(i, max(maxSeen.get(i), candidate.get(i), comparator.subtype(i))); return maxSeen; }
[ "public", "static", "List", "<", "ByteBuffer", ">", "maxComponents", "(", "List", "<", "ByteBuffer", ">", "maxSeen", ",", "Composite", "candidate", ",", "CellNameType", "comparator", ")", "{", "// For a cell name, no reason to look more than the clustering prefix", "// (a...
finds the max cell name component(s) Note that this method *can modify maxSeen*. @param maxSeen the max columns seen so far @param candidate the candidate column(s) @param comparator the comparator to use @return a list with the max column(s)
[ "finds", "the", "max", "cell", "name", "component", "(", "s", ")" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/io/sstable/ColumnNameHelper.java#L63-L79
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceClient.java
TargetInstanceClient.insertTargetInstance
@BetaApi public final Operation insertTargetInstance(String zone, TargetInstance targetInstanceResource) { """ Creates a TargetInstance resource in the specified project and zone using the data included in the request. <p>Sample code: <pre><code> try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) { ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); TargetInstance targetInstanceResource = TargetInstance.newBuilder().build(); Operation response = targetInstanceClient.insertTargetInstance(zone.toString(), targetInstanceResource); } </code></pre> @param zone Name of the zone scoping this request. @param targetInstanceResource A TargetInstance resource. This resource defines an endpoint instance that terminates traffic of certain protocols. (== resource_for beta.targetInstances ==) (== resource_for v1.targetInstances ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails """ InsertTargetInstanceHttpRequest request = InsertTargetInstanceHttpRequest.newBuilder() .setZone(zone) .setTargetInstanceResource(targetInstanceResource) .build(); return insertTargetInstance(request); }
java
@BetaApi public final Operation insertTargetInstance(String zone, TargetInstance targetInstanceResource) { InsertTargetInstanceHttpRequest request = InsertTargetInstanceHttpRequest.newBuilder() .setZone(zone) .setTargetInstanceResource(targetInstanceResource) .build(); return insertTargetInstance(request); }
[ "@", "BetaApi", "public", "final", "Operation", "insertTargetInstance", "(", "String", "zone", ",", "TargetInstance", "targetInstanceResource", ")", "{", "InsertTargetInstanceHttpRequest", "request", "=", "InsertTargetInstanceHttpRequest", ".", "newBuilder", "(", ")", "."...
Creates a TargetInstance resource in the specified project and zone using the data included in the request. <p>Sample code: <pre><code> try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) { ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); TargetInstance targetInstanceResource = TargetInstance.newBuilder().build(); Operation response = targetInstanceClient.insertTargetInstance(zone.toString(), targetInstanceResource); } </code></pre> @param zone Name of the zone scoping this request. @param targetInstanceResource A TargetInstance resource. This resource defines an endpoint instance that terminates traffic of certain protocols. (== resource_for beta.targetInstances ==) (== resource_for v1.targetInstances ==) @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "TargetInstance", "resource", "in", "the", "specified", "project", "and", "zone", "using", "the", "data", "included", "in", "the", "request", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetInstanceClient.java#L551-L560
alkacon/opencms-core
src/org/opencms/main/CmsSessionManager.java
CmsSessionManager.killSession
public void killSession(CmsObject cms, CmsUser user) throws CmsException { """ Kills all sessions for the given user.<p> @param cms the current CMS context @param user the user for whom the sessions should be killed @throws CmsException if something goes wrong """ OpenCms.getRoleManager().checkRole(cms, CmsRole.ACCOUNT_MANAGER); List<CmsSessionInfo> infos = getSessionInfos(user.getId()); for (CmsSessionInfo info : infos) { m_sessionStorageProvider.remove(info.getSessionId()); } }
java
public void killSession(CmsObject cms, CmsUser user) throws CmsException { OpenCms.getRoleManager().checkRole(cms, CmsRole.ACCOUNT_MANAGER); List<CmsSessionInfo> infos = getSessionInfos(user.getId()); for (CmsSessionInfo info : infos) { m_sessionStorageProvider.remove(info.getSessionId()); } }
[ "public", "void", "killSession", "(", "CmsObject", "cms", ",", "CmsUser", "user", ")", "throws", "CmsException", "{", "OpenCms", ".", "getRoleManager", "(", ")", ".", "checkRole", "(", "cms", ",", "CmsRole", ".", "ACCOUNT_MANAGER", ")", ";", "List", "<", "...
Kills all sessions for the given user.<p> @param cms the current CMS context @param user the user for whom the sessions should be killed @throws CmsException if something goes wrong
[ "Kills", "all", "sessions", "for", "the", "given", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/main/CmsSessionManager.java#L305-L312
sdaschner/jaxrs-analyzer
src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java
ProjectAnalyzer.addDirectoryClasses
private void addDirectoryClasses(final Path location, final Path subPath) { """ Adds all classes in the given directory location to the set of known classes. @param location The location of the current directory @param subPath The sub-path which is relevant for the package names or {@code null} if currently in the root directory """ for (final File file : location.toFile().listFiles()) { if (file.isDirectory()) addDirectoryClasses(location.resolve(file.getName()), subPath.resolve(file.getName())); else if (file.isFile() && file.getName().endsWith(".class")) { final String classFileName = subPath.resolve(file.getName()).toString(); classes.add(toQualifiedClassName(classFileName)); } } }
java
private void addDirectoryClasses(final Path location, final Path subPath) { for (final File file : location.toFile().listFiles()) { if (file.isDirectory()) addDirectoryClasses(location.resolve(file.getName()), subPath.resolve(file.getName())); else if (file.isFile() && file.getName().endsWith(".class")) { final String classFileName = subPath.resolve(file.getName()).toString(); classes.add(toQualifiedClassName(classFileName)); } } }
[ "private", "void", "addDirectoryClasses", "(", "final", "Path", "location", ",", "final", "Path", "subPath", ")", "{", "for", "(", "final", "File", "file", ":", "location", ".", "toFile", "(", ")", ".", "listFiles", "(", ")", ")", "{", "if", "(", "file...
Adds all classes in the given directory location to the set of known classes. @param location The location of the current directory @param subPath The sub-path which is relevant for the package names or {@code null} if currently in the root directory
[ "Adds", "all", "classes", "in", "the", "given", "directory", "location", "to", "the", "set", "of", "known", "classes", "." ]
train
https://github.com/sdaschner/jaxrs-analyzer/blob/4ac62942202d05632977d6c14d3cd7e2d27e2b9b/src/main/java/com/sebastian_daschner/jaxrs_analyzer/analysis/ProjectAnalyzer.java#L189-L198
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/events/Event.java
Event.addAttribute
public Event addAttribute(String key, Object value) { """ Add an attribute to the event @param key key of attribute @param String value of attribute @return this object, to allow event attribute chains """ eventAttributes.put(key, (value == null ? "null" : value)); return this; }
java
public Event addAttribute(String key, Object value) { eventAttributes.put(key, (value == null ? "null" : value)); return this; }
[ "public", "Event", "addAttribute", "(", "String", "key", ",", "Object", "value", ")", "{", "eventAttributes", ".", "put", "(", "key", ",", "(", "value", "==", "null", "?", "\"null\"", ":", "value", ")", ")", ";", "return", "this", ";", "}" ]
Add an attribute to the event @param key key of attribute @param String value of attribute @return this object, to allow event attribute chains
[ "Add", "an", "attribute", "to", "the", "event" ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/events/Event.java#L111-L114
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/ComputeNodeOperations.java
ComputeNodeOperations.addComputeNodeUser
public void addComputeNodeUser(String poolId, String nodeId, ComputeNodeUser user) throws BatchErrorException, IOException { """ Adds a user account to the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node where the user account will be created. @param user The user account to be created. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service. """ addComputeNodeUser(poolId, nodeId, user, null); }
java
public void addComputeNodeUser(String poolId, String nodeId, ComputeNodeUser user) throws BatchErrorException, IOException { addComputeNodeUser(poolId, nodeId, user, null); }
[ "public", "void", "addComputeNodeUser", "(", "String", "poolId", ",", "String", "nodeId", ",", "ComputeNodeUser", "user", ")", "throws", "BatchErrorException", ",", "IOException", "{", "addComputeNodeUser", "(", "poolId", ",", "nodeId", ",", "user", ",", "null", ...
Adds a user account to the specified compute node. @param poolId The ID of the pool that contains the compute node. @param nodeId The ID of the compute node where the user account will be created. @param user The user account to be created. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Adds", "a", "user", "account", "to", "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/ComputeNodeOperations.java#L82-L84
OpenLiberty/open-liberty
dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/generator/ModelInterfaceImplClassGenerator.java
ModelInterfaceImplClassGenerator.writeHandleXMINillableAttribute
private void writeHandleXMINillableAttribute(PrintWriter out, String indent, ModelAttribute attribute, String object) { """ Handle a nillable XMI attribute as an element with an xsi:nil="true". """ ModelMethod method = attribute.method; String fieldName = method.field.name; String typeName = method.getType().getJavaImplTypeName(); out.append(indent).append(" ").append(typeName).append(' ').append(fieldName).append(" = new ").append(typeName).append("();").println(); out.append(indent).append(" parser.parse(").append(fieldName).append(");").println(); out.append(indent).append(" if (!").append(fieldName).append(".isNil()) {").println(); out.append(indent).append(" ").append(object).append('.').append(fieldName).append(" = ").append(fieldName).append(';').println(); out.append(indent).append(" }").println(); out.append(indent).append(" return true;").println(); }
java
private void writeHandleXMINillableAttribute(PrintWriter out, String indent, ModelAttribute attribute, String object) { ModelMethod method = attribute.method; String fieldName = method.field.name; String typeName = method.getType().getJavaImplTypeName(); out.append(indent).append(" ").append(typeName).append(' ').append(fieldName).append(" = new ").append(typeName).append("();").println(); out.append(indent).append(" parser.parse(").append(fieldName).append(");").println(); out.append(indent).append(" if (!").append(fieldName).append(".isNil()) {").println(); out.append(indent).append(" ").append(object).append('.').append(fieldName).append(" = ").append(fieldName).append(';').println(); out.append(indent).append(" }").println(); out.append(indent).append(" return true;").println(); }
[ "private", "void", "writeHandleXMINillableAttribute", "(", "PrintWriter", "out", ",", "String", "indent", ",", "ModelAttribute", "attribute", ",", "String", "object", ")", "{", "ModelMethod", "method", "=", "attribute", ".", "method", ";", "String", "fieldName", "...
Handle a nillable XMI attribute as an element with an xsi:nil="true".
[ "Handle", "a", "nillable", "XMI", "attribute", "as", "an", "element", "with", "an", "xsi", ":", "nil", "=", "true", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.javaee.ddmetadata/src/com/ibm/ws/javaee/ddmetadata/generator/ModelInterfaceImplClassGenerator.java#L736-L746
jamesagnew/hapi-fhir
hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/subscriber/BaseResourceMessage.java
BaseResourceMessage.setAttribute
public void setAttribute(String theKey, String theValue) { """ Sets an attribute stored in this message. <p> Attributes are just a spot for user data of any kind to be added to the message for passing along the subscription processing pipeline (typically by interceptors). Values will be carried from the beginning to the end. </p> <p> Note that messages are designed to be passed into queueing systems and serialized as JSON. As a result, only strings are currently allowed as values. </p> @param theKey The key (must not be null or blank) @param theValue The value (must not be null) """ Validate.notBlank(theKey); Validate.notNull(theValue); if (myAttributes == null) { myAttributes = new HashMap<>(); } myAttributes.put(theKey, theValue); }
java
public void setAttribute(String theKey, String theValue) { Validate.notBlank(theKey); Validate.notNull(theValue); if (myAttributes == null) { myAttributes = new HashMap<>(); } myAttributes.put(theKey, theValue); }
[ "public", "void", "setAttribute", "(", "String", "theKey", ",", "String", "theValue", ")", "{", "Validate", ".", "notBlank", "(", "theKey", ")", ";", "Validate", ".", "notNull", "(", "theValue", ")", ";", "if", "(", "myAttributes", "==", "null", ")", "{"...
Sets an attribute stored in this message. <p> Attributes are just a spot for user data of any kind to be added to the message for passing along the subscription processing pipeline (typically by interceptors). Values will be carried from the beginning to the end. </p> <p> Note that messages are designed to be passed into queueing systems and serialized as JSON. As a result, only strings are currently allowed as values. </p> @param theKey The key (must not be null or blank) @param theValue The value (must not be null)
[ "Sets", "an", "attribute", "stored", "in", "this", "message", ".", "<p", ">", "Attributes", "are", "just", "a", "spot", "for", "user", "data", "of", "any", "kind", "to", "be", "added", "to", "the", "message", "for", "passing", "along", "the", "subscripti...
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-jpaserver-subscription/src/main/java/ca/uhn/fhir/jpa/subscription/module/subscriber/BaseResourceMessage.java#L77-L84
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java
ImageLoader.displayImage
public void displayImage(String uri, ImageView imageView, DisplayImageOptions options) { """ Adds display image task to execution pool. Image will be set to ImageView when it's turn.<br /> <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") @param imageView {@link ImageView} which should display image @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image decoding and displaying. If <b>null</b> - default display image options {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions) from configuration} will be used. @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before @throws IllegalArgumentException if passed <b>imageView</b> is null """ displayImage(uri, new ImageViewAware(imageView), options, null, null); }
java
public void displayImage(String uri, ImageView imageView, DisplayImageOptions options) { displayImage(uri, new ImageViewAware(imageView), options, null, null); }
[ "public", "void", "displayImage", "(", "String", "uri", ",", "ImageView", "imageView", ",", "DisplayImageOptions", "options", ")", "{", "displayImage", "(", "uri", ",", "new", "ImageViewAware", "(", "imageView", ")", ",", "options", ",", "null", ",", "null", ...
Adds display image task to execution pool. Image will be set to ImageView when it's turn.<br /> <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") @param imageView {@link ImageView} which should display image @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image decoding and displaying. If <b>null</b> - default display image options {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions) from configuration} will be used. @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before @throws IllegalArgumentException if passed <b>imageView</b> is null
[ "Adds", "display", "image", "task", "to", "execution", "pool", ".", "Image", "will", "be", "set", "to", "ImageView", "when", "it", "s", "turn", ".", "<br", "/", ">", "<b", ">", "NOTE", ":", "<", "/", "b", ">", "{", "@link", "#init", "(", "ImageLoad...
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/core/ImageLoader.java#L347-L349
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/br/br_snmpmanager.java
br_snmpmanager.addmanager
public static br_snmpmanager addmanager(nitro_service client, br_snmpmanager resource) throws Exception { """ <pre> Use this operation to add snmp manager to Repeater Instances. </pre> """ return ((br_snmpmanager[]) resource.perform_operation(client, "addmanager"))[0]; }
java
public static br_snmpmanager addmanager(nitro_service client, br_snmpmanager resource) throws Exception { return ((br_snmpmanager[]) resource.perform_operation(client, "addmanager"))[0]; }
[ "public", "static", "br_snmpmanager", "addmanager", "(", "nitro_service", "client", ",", "br_snmpmanager", "resource", ")", "throws", "Exception", "{", "return", "(", "(", "br_snmpmanager", "[", "]", ")", "resource", ".", "perform_operation", "(", "client", ",", ...
<pre> Use this operation to add snmp manager to Repeater Instances. </pre>
[ "<pre", ">", "Use", "this", "operation", "to", "add", "snmp", "manager", "to", "Repeater", "Instances", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_snmpmanager.java#L147-L150
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/disktree/DiskTreeReader.java
DiskTreeReader.readIndex
public STRtree readIndex() throws Exception { """ Reads the {@link STRtree} object from the file. @return the quadtree, holding envelops and geometry positions in the file. @throws Exception """ File file = new File(path); raf = new RandomAccessFile(file, "r"); raf.seek(6L); checkVersions(); long position = INDEX_ADDRESS_POSITION; raf.seek(position); long indexAddress = raf.readLong(); position = INDEX_ADDRESS_POSITION + INDEX_ADDRESS_SIZE; raf.seek(position); long indexSize = raf.readLong(); raf.seek(indexAddress); byte[] indexBytes = new byte[(int) indexSize]; int read = raf.read(indexBytes); if (read != indexSize) { throw new IOException(); } ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(indexBytes)); indexObj = (STRtree) in.readObject(); return indexObj; }
java
public STRtree readIndex() throws Exception { File file = new File(path); raf = new RandomAccessFile(file, "r"); raf.seek(6L); checkVersions(); long position = INDEX_ADDRESS_POSITION; raf.seek(position); long indexAddress = raf.readLong(); position = INDEX_ADDRESS_POSITION + INDEX_ADDRESS_SIZE; raf.seek(position); long indexSize = raf.readLong(); raf.seek(indexAddress); byte[] indexBytes = new byte[(int) indexSize]; int read = raf.read(indexBytes); if (read != indexSize) { throw new IOException(); } ObjectInputStream in = new ObjectInputStream(new ByteArrayInputStream(indexBytes)); indexObj = (STRtree) in.readObject(); return indexObj; }
[ "public", "STRtree", "readIndex", "(", ")", "throws", "Exception", "{", "File", "file", "=", "new", "File", "(", "path", ")", ";", "raf", "=", "new", "RandomAccessFile", "(", "file", ",", "\"r\"", ")", ";", "raf", ".", "seek", "(", "6L", ")", ";", ...
Reads the {@link STRtree} object from the file. @return the quadtree, holding envelops and geometry positions in the file. @throws Exception
[ "Reads", "the", "{", "@link", "STRtree", "}", "object", "from", "the", "file", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/disktree/DiskTreeReader.java#L59-L84
vakinge/jeesuite-libs
jeesuite-common/src/main/java/com/jeesuite/common/util/DateUtils.java
DateUtils.formatDate
public static Date formatDate(Date orig, String... patterns) { """ 格式化日期为指定格式<br> generate by: vakin jiang at 2012-3-7 @param orig @param patterns @return """ String pattern = TIMESTAMP_PATTERN; if (patterns != null && patterns.length > 0 && StringUtils.isNotBlank(patterns[0])) { pattern = patterns[0]; } return parseDate(DateFormatUtils.format(orig, pattern)); }
java
public static Date formatDate(Date orig, String... patterns) { String pattern = TIMESTAMP_PATTERN; if (patterns != null && patterns.length > 0 && StringUtils.isNotBlank(patterns[0])) { pattern = patterns[0]; } return parseDate(DateFormatUtils.format(orig, pattern)); }
[ "public", "static", "Date", "formatDate", "(", "Date", "orig", ",", "String", "...", "patterns", ")", "{", "String", "pattern", "=", "TIMESTAMP_PATTERN", ";", "if", "(", "patterns", "!=", "null", "&&", "patterns", ".", "length", ">", "0", "&&", "StringUtil...
格式化日期为指定格式<br> generate by: vakin jiang at 2012-3-7 @param orig @param patterns @return
[ "格式化日期为指定格式<br", ">", "generate", "by", ":", "vakin", "jiang", "at", "2012", "-", "3", "-", "7" ]
train
https://github.com/vakinge/jeesuite-libs/blob/c48fe2c7fbd294892cf4030dbec96e744dd3e386/jeesuite-common/src/main/java/com/jeesuite/common/util/DateUtils.java#L196-L203
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/Criteria.java
Criteria.fuzzy
public Criteria fuzzy(String s, float levenshteinDistance) { """ Crates new {@link Predicate} with trailing {@code ~} followed by levensteinDistance @param s @param levenshteinDistance @return """ if (!Float.isNaN(levenshteinDistance) && (levenshteinDistance < 0 || levenshteinDistance > 1)) { throw new InvalidDataAccessApiUsageException("Levenshtein Distance has to be within its bounds (0.0 - 1.0)."); } predicates.add(new Predicate(OperationKey.FUZZY, new Object[] { s, Float.valueOf(levenshteinDistance) })); return this; }
java
public Criteria fuzzy(String s, float levenshteinDistance) { if (!Float.isNaN(levenshteinDistance) && (levenshteinDistance < 0 || levenshteinDistance > 1)) { throw new InvalidDataAccessApiUsageException("Levenshtein Distance has to be within its bounds (0.0 - 1.0)."); } predicates.add(new Predicate(OperationKey.FUZZY, new Object[] { s, Float.valueOf(levenshteinDistance) })); return this; }
[ "public", "Criteria", "fuzzy", "(", "String", "s", ",", "float", "levenshteinDistance", ")", "{", "if", "(", "!", "Float", ".", "isNaN", "(", "levenshteinDistance", ")", "&&", "(", "levenshteinDistance", "<", "0", "||", "levenshteinDistance", ">", "1", ")", ...
Crates new {@link Predicate} with trailing {@code ~} followed by levensteinDistance @param s @param levenshteinDistance @return
[ "Crates", "new", "{", "@link", "Predicate", "}", "with", "trailing", "{", "@code", "~", "}", "followed", "by", "levensteinDistance" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L341-L347
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.searchRecipes
public void searchRecipes(boolean isInput, int id, Callback<List<Integer>> callback) throws NullPointerException { """ For more info on Recipes search API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes/search">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @see Recipe recipe info """ if (isInput) gw2API.searchInputRecipes(Integer.toString(id)).enqueue(callback); else gw2API.searchOutputRecipes(Integer.toString(id)).enqueue(callback); }
java
public void searchRecipes(boolean isInput, int id, Callback<List<Integer>> callback) throws NullPointerException { if (isInput) gw2API.searchInputRecipes(Integer.toString(id)).enqueue(callback); else gw2API.searchOutputRecipes(Integer.toString(id)).enqueue(callback); }
[ "public", "void", "searchRecipes", "(", "boolean", "isInput", ",", "int", "id", ",", "Callback", "<", "List", "<", "Integer", ">", ">", "callback", ")", "throws", "NullPointerException", "{", "if", "(", "isInput", ")", "gw2API", ".", "searchInputRecipes", "(...
For more info on Recipes search API go <a href="https://wiki.guildwars2.com/wiki/API:2/recipes/search">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @see Recipe recipe info
[ "For", "more", "info", "on", "Recipes", "search", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "recipes", "/", "search", ">", "here<", "/", "a", ">", "<br", "/"...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2321-L2324
google/closure-templates
java/src/com/google/template/soy/parsepasses/contextautoesc/SoyAutoescapeException.java
SoyAutoescapeException.createWithNode
static SoyAutoescapeException createWithNode(String message, SoyNode node) { """ Creates a SoyAutoescapeException, with meta info filled in based on the given Soy node. @param message The error message. @param node The node from which to derive the exception meta info. @return The new SoyAutoescapeException object. """ return new SoyAutoescapeException(message, /*cause=*/ null, node); }
java
static SoyAutoescapeException createWithNode(String message, SoyNode node) { return new SoyAutoescapeException(message, /*cause=*/ null, node); }
[ "static", "SoyAutoescapeException", "createWithNode", "(", "String", "message", ",", "SoyNode", "node", ")", "{", "return", "new", "SoyAutoescapeException", "(", "message", ",", "/*cause=*/", "null", ",", "node", ")", ";", "}" ]
Creates a SoyAutoescapeException, with meta info filled in based on the given Soy node. @param message The error message. @param node The node from which to derive the exception meta info. @return The new SoyAutoescapeException object.
[ "Creates", "a", "SoyAutoescapeException", "with", "meta", "info", "filled", "in", "based", "on", "the", "given", "Soy", "node", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/SoyAutoescapeException.java#L36-L38
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/deepboof/ClipAndReduce.java
ClipAndReduce.massage
public void massage( T input , T output ) { """ Clipps and scales the input iamge as neccisary @param input Input image. Typically larger than output @param output Output image """ if( clip ) { T inputAdjusted = clipInput(input, output); // configure a simple change in scale for both axises transform.a11 = input.width / (float) output.width; transform.a22 = input.height / (float) output.height; // this change is automatically reflected in the distortion class. It is configured to cache nothing distort.apply(inputAdjusted, output); } else { // scale each axis independently. It will have the whole image but it will be distorted transform.a11 = input.width / (float) output.width; transform.a22 = input.height / (float) output.height; distort.apply(input, output); } }
java
public void massage( T input , T output ) { if( clip ) { T inputAdjusted = clipInput(input, output); // configure a simple change in scale for both axises transform.a11 = input.width / (float) output.width; transform.a22 = input.height / (float) output.height; // this change is automatically reflected in the distortion class. It is configured to cache nothing distort.apply(inputAdjusted, output); } else { // scale each axis independently. It will have the whole image but it will be distorted transform.a11 = input.width / (float) output.width; transform.a22 = input.height / (float) output.height; distort.apply(input, output); } }
[ "public", "void", "massage", "(", "T", "input", ",", "T", "output", ")", "{", "if", "(", "clip", ")", "{", "T", "inputAdjusted", "=", "clipInput", "(", "input", ",", "output", ")", ";", "// configure a simple change in scale for both axises", "transform", ".",...
Clipps and scales the input iamge as neccisary @param input Input image. Typically larger than output @param output Output image
[ "Clipps", "and", "scales", "the", "input", "iamge", "as", "neccisary" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/deepboof/ClipAndReduce.java#L71-L89
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java
FileUtils.loadStringToFileMap
public static Map<String, File> loadStringToFileMap(final CharSource source) throws IOException { """ Reads a {@link Map} from a {@link CharSource}, where each line is a key, a tab character ("\t"), and a value. Blank lines and lines beginning with "#" are ignored. """ return loadMap(source, Functions.<String>identity(), FileFunction.INSTANCE, IsCommentLine.INSTANCE); }
java
public static Map<String, File> loadStringToFileMap(final CharSource source) throws IOException { return loadMap(source, Functions.<String>identity(), FileFunction.INSTANCE, IsCommentLine.INSTANCE); }
[ "public", "static", "Map", "<", "String", ",", "File", ">", "loadStringToFileMap", "(", "final", "CharSource", "source", ")", "throws", "IOException", "{", "return", "loadMap", "(", "source", ",", "Functions", ".", "<", "String", ">", "identity", "(", ")", ...
Reads a {@link Map} from a {@link CharSource}, where each line is a key, a tab character ("\t"), and a value. Blank lines and lines beginning with "#" are ignored.
[ "Reads", "a", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L283-L286
aws/aws-sdk-java
aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java
WeeklyAutoScalingSchedule.withSunday
public WeeklyAutoScalingSchedule withSunday(java.util.Map<String, String> sunday) { """ <p> The schedule for Sunday. </p> @param sunday The schedule for Sunday. @return Returns a reference to this object so that method calls can be chained together. """ setSunday(sunday); return this; }
java
public WeeklyAutoScalingSchedule withSunday(java.util.Map<String, String> sunday) { setSunday(sunday); return this; }
[ "public", "WeeklyAutoScalingSchedule", "withSunday", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "sunday", ")", "{", "setSunday", "(", "sunday", ")", ";", "return", "this", ";", "}" ]
<p> The schedule for Sunday. </p> @param sunday The schedule for Sunday. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "schedule", "for", "Sunday", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-opsworks/src/main/java/com/amazonaws/services/opsworks/model/WeeklyAutoScalingSchedule.java#L521-L524
MGunlogson/CuckooFilter4J
src/main/java/com/github/mgunlogson/cuckoofilter4j/Utils.java
Utils.getBitsPerItemForFpRate
static int getBitsPerItemForFpRate(double fpProb,double loadFactor) { """ Calculates how many bits are needed to reach a given false positive rate. @param fpProb the false positive probability. @return the length of the tag needed (in bits) to reach the false positive rate. """ /* * equation from Cuckoo Filter: Practically Better Than Bloom Bin Fan, * David G. Andersen, Michael Kaminsky , Michael D. Mitzenmacher */ return DoubleMath.roundToInt(DoubleMath.log2((1 / fpProb) + 3) / loadFactor, RoundingMode.UP); }
java
static int getBitsPerItemForFpRate(double fpProb,double loadFactor) { /* * equation from Cuckoo Filter: Practically Better Than Bloom Bin Fan, * David G. Andersen, Michael Kaminsky , Michael D. Mitzenmacher */ return DoubleMath.roundToInt(DoubleMath.log2((1 / fpProb) + 3) / loadFactor, RoundingMode.UP); }
[ "static", "int", "getBitsPerItemForFpRate", "(", "double", "fpProb", ",", "double", "loadFactor", ")", "{", "/*\r\n\t\t * equation from Cuckoo Filter: Practically Better Than Bloom Bin Fan,\r\n\t\t * David G. Andersen, Michael Kaminsky , Michael D. Mitzenmacher\r\n\t\t */", "return", "Doub...
Calculates how many bits are needed to reach a given false positive rate. @param fpProb the false positive probability. @return the length of the tag needed (in bits) to reach the false positive rate.
[ "Calculates", "how", "many", "bits", "are", "needed", "to", "reach", "a", "given", "false", "positive", "rate", "." ]
train
https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/Utils.java#L148-L154
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/DeltaCollectionValuedMap.java
DeltaCollectionValuedMap.addAll
@Override public void addAll(Map<K, V> m) { """ Adds all of the mappings in m to this CollectionValuedMap. If m is a CollectionValuedMap, it will behave strangely. Use the constructor instead. """ for (Map.Entry<K, V> e : m.entrySet()) { add(e.getKey(), e.getValue()); } }
java
@Override public void addAll(Map<K, V> m) { for (Map.Entry<K, V> e : m.entrySet()) { add(e.getKey(), e.getValue()); } }
[ "@", "Override", "public", "void", "addAll", "(", "Map", "<", "K", ",", "V", ">", "m", ")", "{", "for", "(", "Map", ".", "Entry", "<", "K", ",", "V", ">", "e", ":", "m", ".", "entrySet", "(", ")", ")", "{", "add", "(", "e", ".", "getKey", ...
Adds all of the mappings in m to this CollectionValuedMap. If m is a CollectionValuedMap, it will behave strangely. Use the constructor instead.
[ "Adds", "all", "of", "the", "mappings", "in", "m", "to", "this", "CollectionValuedMap", ".", "If", "m", "is", "a", "CollectionValuedMap", "it", "will", "behave", "strangely", ".", "Use", "the", "constructor", "instead", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/DeltaCollectionValuedMap.java#L126-L131
vlingo/vlingo-actors
src/main/java/io/vlingo/actors/Actor.java
Actor.childActorFor
protected Protocols childActorFor(final Class<?>[] protocols, final Definition definition) { """ Answers the {@code Protocols} for the child {@code Actor} to be created by this parent {@code Actor}. @param protocols the {@code Class<T>[]} protocols of the child {@code Actor} @param definition the {@code Definition} of the child {@code Actor} to be created by this parent {@code Actor} @return Protocols """ if (definition.supervisor() != null) { return lifeCycle.environment.stage.actorFor(protocols, definition, this, definition.supervisor(), logger()); } else { if (this instanceof Supervisor) { return lifeCycle.environment.stage.actorFor(protocols, definition, this, lifeCycle.lookUpProxy(Supervisor.class), logger()); } else { return lifeCycle.environment.stage.actorFor(protocols, definition, this, null, logger()); } } }
java
protected Protocols childActorFor(final Class<?>[] protocols, final Definition definition) { if (definition.supervisor() != null) { return lifeCycle.environment.stage.actorFor(protocols, definition, this, definition.supervisor(), logger()); } else { if (this instanceof Supervisor) { return lifeCycle.environment.stage.actorFor(protocols, definition, this, lifeCycle.lookUpProxy(Supervisor.class), logger()); } else { return lifeCycle.environment.stage.actorFor(protocols, definition, this, null, logger()); } } }
[ "protected", "Protocols", "childActorFor", "(", "final", "Class", "<", "?", ">", "[", "]", "protocols", ",", "final", "Definition", "definition", ")", "{", "if", "(", "definition", ".", "supervisor", "(", ")", "!=", "null", ")", "{", "return", "lifeCycle",...
Answers the {@code Protocols} for the child {@code Actor} to be created by this parent {@code Actor}. @param protocols the {@code Class<T>[]} protocols of the child {@code Actor} @param definition the {@code Definition} of the child {@code Actor} to be created by this parent {@code Actor} @return Protocols
[ "Answers", "the", "{" ]
train
https://github.com/vlingo/vlingo-actors/blob/c7d046fd139c0490cf0fd2588d7dc2f792f13493/src/main/java/io/vlingo/actors/Actor.java#L181-L191
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/io/StreamUtils.java
StreamUtils.copy
public static long copy(ReadableByteChannel inputChannel, WritableByteChannel outputChannel) throws IOException { """ Copies a {@link ReadableByteChannel} to a {@link WritableByteChannel}. <p> <b>Note:</b> The {@link ReadableByteChannel} and {@link WritableByteChannel}s are NOT closed by the method </p> @return Total bytes copied """ return new StreamCopier(inputChannel, outputChannel).copy(); }
java
public static long copy(ReadableByteChannel inputChannel, WritableByteChannel outputChannel) throws IOException { return new StreamCopier(inputChannel, outputChannel).copy(); }
[ "public", "static", "long", "copy", "(", "ReadableByteChannel", "inputChannel", ",", "WritableByteChannel", "outputChannel", ")", "throws", "IOException", "{", "return", "new", "StreamCopier", "(", "inputChannel", ",", "outputChannel", ")", ".", "copy", "(", ")", ...
Copies a {@link ReadableByteChannel} to a {@link WritableByteChannel}. <p> <b>Note:</b> The {@link ReadableByteChannel} and {@link WritableByteChannel}s are NOT closed by the method </p> @return Total bytes copied
[ "Copies", "a", "{", "@link", "ReadableByteChannel", "}", "to", "a", "{", "@link", "WritableByteChannel", "}", ".", "<p", ">", "<b", ">", "Note", ":", "<", "/", "b", ">", "The", "{", "@link", "ReadableByteChannel", "}", "and", "{", "@link", "WritableByteC...
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/io/StreamUtils.java#L87-L89
apache/incubator-heron
heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java
SchedulerStateManagerAdaptor.getMetricsCacheLocation
public TopologyMaster.MetricsCacheLocation getMetricsCacheLocation(String topologyName) { """ Get the metricscache location for the given topology @return MetricsCacheLocation """ return awaitResult(delegate.getMetricsCacheLocation(null, topologyName)); }
java
public TopologyMaster.MetricsCacheLocation getMetricsCacheLocation(String topologyName) { return awaitResult(delegate.getMetricsCacheLocation(null, topologyName)); }
[ "public", "TopologyMaster", ".", "MetricsCacheLocation", "getMetricsCacheLocation", "(", "String", "topologyName", ")", "{", "return", "awaitResult", "(", "delegate", ".", "getMetricsCacheLocation", "(", "null", ",", "topologyName", ")", ")", ";", "}" ]
Get the metricscache location for the given topology @return MetricsCacheLocation
[ "Get", "the", "metricscache", "location", "for", "the", "given", "topology" ]
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/spi/src/java/org/apache/heron/spi/statemgr/SchedulerStateManagerAdaptor.java#L265-L267
DDTH/ddth-dao
ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java
GenericBoJdbcDao.createOrUpdate
protected DaoResult createOrUpdate(Connection conn, T bo) { """ Create a new BO or update an existing one. @param conn @param bo @return @since 0.8.1 """ if (bo == null) { return null; } DaoResult result = create(conn, bo); DaoOperationStatus status = result.getStatus(); if (status == DaoOperationStatus.DUPLICATED_VALUE || status == DaoOperationStatus.DUPLICATED_UNIQUE) { result = update(conn, bo); } return result; }
java
protected DaoResult createOrUpdate(Connection conn, T bo) { if (bo == null) { return null; } DaoResult result = create(conn, bo); DaoOperationStatus status = result.getStatus(); if (status == DaoOperationStatus.DUPLICATED_VALUE || status == DaoOperationStatus.DUPLICATED_UNIQUE) { result = update(conn, bo); } return result; }
[ "protected", "DaoResult", "createOrUpdate", "(", "Connection", "conn", ",", "T", "bo", ")", "{", "if", "(", "bo", "==", "null", ")", "{", "return", "null", ";", "}", "DaoResult", "result", "=", "create", "(", "conn", ",", "bo", ")", ";", "DaoOperationS...
Create a new BO or update an existing one. @param conn @param bo @return @since 0.8.1
[ "Create", "a", "new", "BO", "or", "update", "an", "existing", "one", "." ]
train
https://github.com/DDTH/ddth-dao/blob/8d059ddf641a1629aa53851f9d1b41abf175a180/ddth-dao-core/src/main/java/com/github/ddth/dao/jdbc/GenericBoJdbcDao.java#L692-L703
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java
ImageIOGreyScale.getImageWritersBySuffix
public static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix) { """ Returns an <code>Iterator</code> containing all currently registered <code>ImageWriter</code>s that claim to be able to encode files with the given suffix. @param fileSuffix a <code>String</code> containing a file suffix (<i>e.g.</i>, "jpg" or "tiff"). @return an <code>Iterator</code> containing <code>ImageWriter</code>s. @exception IllegalArgumentException if <code>fileSuffix</code> is <code>null</code>. @see javax.imageio.spi.ImageWriterSpi#getFileSuffixes """ if (fileSuffix == null) { throw new IllegalArgumentException("fileSuffix == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new ContainsFilter(writerFileSuffixesMethod, fileSuffix), true); } catch (IllegalArgumentException e) { return new HashSet().iterator(); } return new ImageWriterIterator(iter); }
java
public static Iterator<ImageWriter> getImageWritersBySuffix(String fileSuffix) { if (fileSuffix == null) { throw new IllegalArgumentException("fileSuffix == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new ContainsFilter(writerFileSuffixesMethod, fileSuffix), true); } catch (IllegalArgumentException e) { return new HashSet().iterator(); } return new ImageWriterIterator(iter); }
[ "public", "static", "Iterator", "<", "ImageWriter", ">", "getImageWritersBySuffix", "(", "String", "fileSuffix", ")", "{", "if", "(", "fileSuffix", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"fileSuffix == null!\"", ")", ";", "}", ...
Returns an <code>Iterator</code> containing all currently registered <code>ImageWriter</code>s that claim to be able to encode files with the given suffix. @param fileSuffix a <code>String</code> containing a file suffix (<i>e.g.</i>, "jpg" or "tiff"). @return an <code>Iterator</code> containing <code>ImageWriter</code>s. @exception IllegalArgumentException if <code>fileSuffix</code> is <code>null</code>. @see javax.imageio.spi.ImageWriterSpi#getFileSuffixes
[ "Returns", "an", "<code", ">", "Iterator<", "/", "code", ">", "containing", "all", "currently", "registered", "<code", ">", "ImageWriter<", "/", "code", ">", "s", "that", "claim", "to", "be", "able", "to", "encode", "files", "with", "the", "given", "suffix...
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java#L809-L821
synchronoss/cpo-api
cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java
CassandraCpoAdapter.deleteObjects
@Override public <T> long deleteObjects(String name, Collection<T> coll, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException { """ Removes the Objects contained in the collection from the datasource. The assumption is that the object exists in the datasource. This method stores the objects contained in the collection in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions. <p/> This means that if one of the objects fail being deleted in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects deleted thus far. <p/> <pre>Example: <code> <p/> class SomeObject so = null; class CpoAdapter cpo = null; <p/> try { cpo = new CpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p/> if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } <p/> try{ cpo.deleteObjects("IdNameDelete",al); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the DELETE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param coll This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. @param wheres A collection of CpoWhere beans that define the constraints that should be used when retrieving beans @param orderBy The CpoOrderBy bean that defines the order in which beans should be returned @param nativeExpressions Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time @return The number of objects deleted from the datasource @throws CpoException Thrown if there are errors accessing the datasource """ return processUpdateGroup(coll, CpoAdapter.DELETE_GROUP, name, wheres, orderBy, nativeExpressions); }
java
@Override public <T> long deleteObjects(String name, Collection<T> coll, Collection<CpoWhere> wheres, Collection<CpoOrderBy> orderBy, Collection<CpoNativeFunction> nativeExpressions) throws CpoException { return processUpdateGroup(coll, CpoAdapter.DELETE_GROUP, name, wheres, orderBy, nativeExpressions); }
[ "@", "Override", "public", "<", "T", ">", "long", "deleteObjects", "(", "String", "name", ",", "Collection", "<", "T", ">", "coll", ",", "Collection", "<", "CpoWhere", ">", "wheres", ",", "Collection", "<", "CpoOrderBy", ">", "orderBy", ",", "Collection", ...
Removes the Objects contained in the collection from the datasource. The assumption is that the object exists in the datasource. This method stores the objects contained in the collection in the datasource. The objects in the collection will be treated as one transaction, assuming the datasource supports transactions. <p/> This means that if one of the objects fail being deleted in the datasource then the CpoAdapter should stop processing the remainder of the collection, and if supported, rollback all the objects deleted thus far. <p/> <pre>Example: <code> <p/> class SomeObject so = null; class CpoAdapter cpo = null; <p/> try { cpo = new CpoAdapter(new JdbcDataSourceInfo(driver, url, user, password,1,1,false)); } catch (CpoException ce) { // Handle the error cpo = null; } <p/> if (cpo!=null) { ArrayList al = new ArrayList(); for (int i=0; i<3; i++){ so = new SomeObject(); so.setId(1); so.setName("SomeName"); al.add(so); } <p/> try{ cpo.deleteObjects("IdNameDelete",al); } catch (CpoException ce) { // Handle the error } } </code> </pre> @param name The String name of the DELETE Function Group that will be used to create the object in the datasource. null signifies that the default rules will be used. @param coll This is a collection of objects that have been defined within the metadata of the datasource. If the class is not defined an exception will be thrown. @param wheres A collection of CpoWhere beans that define the constraints that should be used when retrieving beans @param orderBy The CpoOrderBy bean that defines the order in which beans should be returned @param nativeExpressions Native expression that will be used to augment the expression stored in the meta data. This text will be embedded at run-time @return The number of objects deleted from the datasource @throws CpoException Thrown if there are errors accessing the datasource
[ "Removes", "the", "Objects", "contained", "in", "the", "collection", "from", "the", "datasource", ".", "The", "assumption", "is", "that", "the", "object", "exists", "in", "the", "datasource", ".", "This", "method", "stores", "the", "objects", "contained", "in"...
train
https://github.com/synchronoss/cpo-api/blob/dc745aca3b3206abf80b85d9689b0132f5baa694/cpo-cassandra/src/main/java/org/synchronoss/cpo/cassandra/CassandraCpoAdapter.java#L679-L682
windup/windup
utils/src/main/java/org/jboss/windup/util/PathUtil.java
PathUtil.getRootFolderForSource
public static Path getRootFolderForSource(Path sourceFilePath, String packageName) { """ Returns the root path for this source file, based upon the package name. For example, if path is "/project/src/main/java/org/example/Foo.java" and the package is "org.example", then this should return "/project/src/main/java". Returns null if the folder structure does not match the package name. """ if (packageName == null || packageName.trim().isEmpty()) { return sourceFilePath.getParent(); } String[] packageNameComponents = packageName.split("\\."); Path currentPath = sourceFilePath.getParent(); for (int i = packageNameComponents.length; i > 0; i--) { String packageComponent = packageNameComponents[i - 1]; if (!StringUtils.equals(packageComponent, currentPath.getFileName().toString())) { return null; } currentPath = currentPath.getParent(); } return currentPath; }
java
public static Path getRootFolderForSource(Path sourceFilePath, String packageName) { if (packageName == null || packageName.trim().isEmpty()) { return sourceFilePath.getParent(); } String[] packageNameComponents = packageName.split("\\."); Path currentPath = sourceFilePath.getParent(); for (int i = packageNameComponents.length; i > 0; i--) { String packageComponent = packageNameComponents[i - 1]; if (!StringUtils.equals(packageComponent, currentPath.getFileName().toString())) { return null; } currentPath = currentPath.getParent(); } return currentPath; }
[ "public", "static", "Path", "getRootFolderForSource", "(", "Path", "sourceFilePath", ",", "String", "packageName", ")", "{", "if", "(", "packageName", "==", "null", "||", "packageName", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "return", "...
Returns the root path for this source file, based upon the package name. For example, if path is "/project/src/main/java/org/example/Foo.java" and the package is "org.example", then this should return "/project/src/main/java". Returns null if the folder structure does not match the package name.
[ "Returns", "the", "root", "path", "for", "this", "source", "file", "based", "upon", "the", "package", "name", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/utils/src/main/java/org/jboss/windup/util/PathUtil.java#L213-L231
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/Space.java
Space.pickLowestCost
public boolean pickLowestCost(Space target, NavPath path) { """ Pick the lowest cost route from this space to another on the path @param target The target space we're looking for @param path The path to add the steps to @return True if the path was found """ if (target == this) { return true; } if (links.size() == 0) { return false; } Link bestLink = null; for (int i=0;i<getLinkCount();i++) { Link link = getLink(i); if ((bestLink == null) || (link.getTarget().getCost() < bestLink.getTarget().getCost())) { bestLink = link; } } path.push(bestLink); return bestLink.getTarget().pickLowestCost(target, path); }
java
public boolean pickLowestCost(Space target, NavPath path) { if (target == this) { return true; } if (links.size() == 0) { return false; } Link bestLink = null; for (int i=0;i<getLinkCount();i++) { Link link = getLink(i); if ((bestLink == null) || (link.getTarget().getCost() < bestLink.getTarget().getCost())) { bestLink = link; } } path.push(bestLink); return bestLink.getTarget().pickLowestCost(target, path); }
[ "public", "boolean", "pickLowestCost", "(", "Space", "target", ",", "NavPath", "path", ")", "{", "if", "(", "target", "==", "this", ")", "{", "return", "true", ";", "}", "if", "(", "links", ".", "size", "(", ")", "==", "0", ")", "{", "return", "fal...
Pick the lowest cost route from this space to another on the path @param target The target space we're looking for @param path The path to add the steps to @return True if the path was found
[ "Pick", "the", "lowest", "cost", "route", "from", "this", "space", "to", "another", "on", "the", "path" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/util/pathfinding/navmesh/Space.java#L291-L309
ironjacamar/ironjacamar
web/src/main/java/org/ironjacamar/web/console/HtmlAdaptorServlet.java
HtmlAdaptorServlet.displayMBeans
private void displayMBeans(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { """ Display all MBeans @param request The HTTP request @param response The HTTP response @exception ServletException Thrown if an error occurs @exception IOException Thrown if an I/O error occurs """ Iterator mbeans; try { mbeans = getDomainData(); } catch (Exception e) { throw new ServletException("Failed to get MBeans", e); } request.setAttribute("mbeans", mbeans); RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/displaymbeans.jsp"); rd.forward(request, response); }
java
private void displayMBeans(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { Iterator mbeans; try { mbeans = getDomainData(); } catch (Exception e) { throw new ServletException("Failed to get MBeans", e); } request.setAttribute("mbeans", mbeans); RequestDispatcher rd = this.getServletContext().getRequestDispatcher("/displaymbeans.jsp"); rd.forward(request, response); }
[ "private", "void", "displayMBeans", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "Iterator", "mbeans", ";", "try", "{", "mbeans", "=", "getDomainData", "(", ")", ";", "}",...
Display all MBeans @param request The HTTP request @param response The HTTP response @exception ServletException Thrown if an error occurs @exception IOException Thrown if an I/O error occurs
[ "Display", "all", "MBeans" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/web/src/main/java/org/ironjacamar/web/console/HtmlAdaptorServlet.java#L148-L165
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.deleteUserDataPair
public ApiSuccessResponse deleteUserDataPair(String id, KeyData keyData) throws ApiException { """ Remove a key/value pair from user data Delete data with the specified key from the call&#39;s user data. @param id The connection ID of the call. (required) @param keyData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<ApiSuccessResponse> resp = deleteUserDataPairWithHttpInfo(id, keyData); return resp.getData(); }
java
public ApiSuccessResponse deleteUserDataPair(String id, KeyData keyData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = deleteUserDataPairWithHttpInfo(id, keyData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "deleteUserDataPair", "(", "String", "id", ",", "KeyData", "keyData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "deleteUserDataPairWithHttpInfo", "(", "id", ",", "keyData", ")", ";...
Remove a key/value pair from user data Delete data with the specified key from the call&#39;s user data. @param id The connection ID of the call. (required) @param keyData (required) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Remove", "a", "key", "/", "value", "pair", "from", "user", "data", "Delete", "data", "with", "the", "specified", "key", "from", "the", "call&#39", ";", "s", "user", "data", "." ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L1343-L1346
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUESubspace.java
CLIQUESubspace.dfs
public void dfs(CLIQUEUnit unit, ModifiableDBIDs cluster, CLIQUESubspace model) { """ Depth-first search algorithm to find connected dense units in this subspace that build a cluster. It starts with a unit, assigns it to a cluster and finds all units it is connected to. @param unit the unit @param cluster the IDs of the feature vectors of the current cluster @param model the model of the cluster """ cluster.addDBIDs(unit.getIds()); unit.markAsAssigned(); model.addDenseUnit(unit); final long[] dims = getDimensions(); for(int dim = BitsUtil.nextSetBit(dims, 0); dim >= 0; dim = BitsUtil.nextSetBit(dims, dim + 1)) { CLIQUEUnit left = leftNeighbor(unit, dim); if(left != null && !left.isAssigned()) { dfs(left, cluster, model); } CLIQUEUnit right = rightNeighbor(unit, dim); if(right != null && !right.isAssigned()) { dfs(right, cluster, model); } } }
java
public void dfs(CLIQUEUnit unit, ModifiableDBIDs cluster, CLIQUESubspace model) { cluster.addDBIDs(unit.getIds()); unit.markAsAssigned(); model.addDenseUnit(unit); final long[] dims = getDimensions(); for(int dim = BitsUtil.nextSetBit(dims, 0); dim >= 0; dim = BitsUtil.nextSetBit(dims, dim + 1)) { CLIQUEUnit left = leftNeighbor(unit, dim); if(left != null && !left.isAssigned()) { dfs(left, cluster, model); } CLIQUEUnit right = rightNeighbor(unit, dim); if(right != null && !right.isAssigned()) { dfs(right, cluster, model); } } }
[ "public", "void", "dfs", "(", "CLIQUEUnit", "unit", ",", "ModifiableDBIDs", "cluster", ",", "CLIQUESubspace", "model", ")", "{", "cluster", ".", "addDBIDs", "(", "unit", ".", "getIds", "(", ")", ")", ";", "unit", ".", "markAsAssigned", "(", ")", ";", "mo...
Depth-first search algorithm to find connected dense units in this subspace that build a cluster. It starts with a unit, assigns it to a cluster and finds all units it is connected to. @param unit the unit @param cluster the IDs of the feature vectors of the current cluster @param model the model of the cluster
[ "Depth", "-", "first", "search", "algorithm", "to", "find", "connected", "dense", "units", "in", "this", "subspace", "that", "build", "a", "cluster", ".", "It", "starts", "with", "a", "unit", "assigns", "it", "to", "a", "cluster", "and", "finds", "all", ...
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/algorithm/clustering/subspace/clique/CLIQUESubspace.java#L120-L137
fcrepo4/fcrepo4
fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java
JcrRdfTools.createValue
public Value createValue(final Node node, final RDFNode data, final String propertyName) throws RepositoryException { """ Create a JCR value from an RDFNode for a given JCR property @param node the JCR node we want a property for @param data an RDF Node (possibly with a DataType) @param propertyName name of the property to populate (used to use the right type for the value) @return the JCR value from an RDFNode for a given JCR property @throws RepositoryException if repository exception occurred """ final ValueFactory valueFactory = node.getSession().getValueFactory(); return createValue(valueFactory, data, getPropertyType(node, propertyName).orElse(UNDEFINED)); }
java
public Value createValue(final Node node, final RDFNode data, final String propertyName) throws RepositoryException { final ValueFactory valueFactory = node.getSession().getValueFactory(); return createValue(valueFactory, data, getPropertyType(node, propertyName).orElse(UNDEFINED)); }
[ "public", "Value", "createValue", "(", "final", "Node", "node", ",", "final", "RDFNode", "data", ",", "final", "String", "propertyName", ")", "throws", "RepositoryException", "{", "final", "ValueFactory", "valueFactory", "=", "node", ".", "getSession", "(", ")",...
Create a JCR value from an RDFNode for a given JCR property @param node the JCR node we want a property for @param data an RDF Node (possibly with a DataType) @param propertyName name of the property to populate (used to use the right type for the value) @return the JCR value from an RDFNode for a given JCR property @throws RepositoryException if repository exception occurred
[ "Create", "a", "JCR", "value", "from", "an", "RDFNode", "for", "a", "given", "JCR", "property" ]
train
https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/rdf/JcrRdfTools.java#L174-L179
stratosphere/stratosphere
stratosphere-core/src/main/java/eu/stratosphere/api/common/Plan.java
Plan.registerCachedFile
public void registerCachedFile(String filePath, String name) throws IOException { """ register cache files in program level @param filePath The files must be stored in a place that can be accessed from all workers (most commonly HDFS) @param name user defined name of that file @throws java.io.IOException """ if (!this.cacheFile.containsKey(name)) { try { URI u = new URI(filePath); if (!u.getPath().startsWith("/")) { u = new URI(new File(filePath).getAbsolutePath()); } FileSystem fs = FileSystem.get(u); if (fs.exists(new Path(u.getPath()))) { this.cacheFile.put(name, u.toString()); } else { throw new RuntimeException("File " + u.toString() + " doesn't exist."); } } catch (URISyntaxException ex) { throw new RuntimeException("Invalid path: " + filePath, ex); } } else { throw new RuntimeException("cache file " + name + "already exists!"); } }
java
public void registerCachedFile(String filePath, String name) throws IOException { if (!this.cacheFile.containsKey(name)) { try { URI u = new URI(filePath); if (!u.getPath().startsWith("/")) { u = new URI(new File(filePath).getAbsolutePath()); } FileSystem fs = FileSystem.get(u); if (fs.exists(new Path(u.getPath()))) { this.cacheFile.put(name, u.toString()); } else { throw new RuntimeException("File " + u.toString() + " doesn't exist."); } } catch (URISyntaxException ex) { throw new RuntimeException("Invalid path: " + filePath, ex); } } else { throw new RuntimeException("cache file " + name + "already exists!"); } }
[ "public", "void", "registerCachedFile", "(", "String", "filePath", ",", "String", "name", ")", "throws", "IOException", "{", "if", "(", "!", "this", ".", "cacheFile", ".", "containsKey", "(", "name", ")", ")", "{", "try", "{", "URI", "u", "=", "new", "...
register cache files in program level @param filePath The files must be stored in a place that can be accessed from all workers (most commonly HDFS) @param name user defined name of that file @throws java.io.IOException
[ "register", "cache", "files", "in", "program", "level" ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-core/src/main/java/eu/stratosphere/api/common/Plan.java#L308-L327
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendBinary
public static <T> void sendBinary(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context, long timeoutmillis) { """ Sends a complete binary message, invoking the callback when complete @param data The data to send @param wsChannel The web socket channel @param callback The callback to invoke on completion @param context The context object that will be passed to the callback on completion @param timeoutmillis the timeout in milliseconds """ sendInternal(mergeBuffers(data), WebSocketFrameType.BINARY, wsChannel, callback, context, timeoutmillis); }
java
public static <T> void sendBinary(final ByteBuffer[] data, final WebSocketChannel wsChannel, final WebSocketCallback<T> callback, T context, long timeoutmillis) { sendInternal(mergeBuffers(data), WebSocketFrameType.BINARY, wsChannel, callback, context, timeoutmillis); }
[ "public", "static", "<", "T", ">", "void", "sendBinary", "(", "final", "ByteBuffer", "[", "]", "data", ",", "final", "WebSocketChannel", "wsChannel", ",", "final", "WebSocketCallback", "<", "T", ">", "callback", ",", "T", "context", ",", "long", "timeoutmill...
Sends a complete binary message, invoking the callback when complete @param data The data to send @param wsChannel The web socket channel @param callback The callback to invoke on completion @param context The context object that will be passed to the callback on completion @param timeoutmillis the timeout in milliseconds
[ "Sends", "a", "complete", "binary", "message", "invoking", "the", "callback", "when", "complete" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L674-L676
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/ParseDateTimeAbstract.java
ParseDateTimeAbstract.execute
public Object execute(final Object value, final CsvContext context) { """ {@inheritDoc} @throws SuperCsvCellProcessorException if value is null, isn't a String, or can't be parsed to a Date """ validateInputNotNull(value, context); if( !(value instanceof String) ) { throw new SuperCsvCellProcessorException(String.class, value, context, this); } try { if( locale == null ) { formatter = new SimpleDateFormat(dateFormat); } else { formatter = new SimpleDateFormat(dateFormat, locale); } formatter.setLenient(lenient); Object result = parseValue(value); return next.execute(result, context); } catch(final ParseException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Date", value), context, this, e); } }
java
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); if( !(value instanceof String) ) { throw new SuperCsvCellProcessorException(String.class, value, context, this); } try { if( locale == null ) { formatter = new SimpleDateFormat(dateFormat); } else { formatter = new SimpleDateFormat(dateFormat, locale); } formatter.setLenient(lenient); Object result = parseValue(value); return next.execute(result, context); } catch(final ParseException e) { throw new SuperCsvCellProcessorException(String.format("'%s' could not be parsed as a Date", value), context, this, e); } }
[ "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "validateInputNotNull", "(", "value", ",", "context", ")", ";", "if", "(", "!", "(", "value", "instanceof", "String", ")", ")", "{", "throw", ...
{@inheritDoc} @throws SuperCsvCellProcessorException if value is null, isn't a String, or can't be parsed to a Date
[ "{", "@inheritDoc", "}" ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/ParseDateTimeAbstract.java#L210-L231
google/cloud-reporting
src/main/java/com/google/cloud/metrics/MetricsUtils.java
MetricsUtils.buildCombinedType
static String buildCombinedType(String eventType, Optional<String> objectType) { """ Combines event and object type into a single type string. @param eventType type or category of the reporting event. @param objectType optional type of the object this event applies to. @return Combined type string. """ return Joiner.on("/").skipNulls().join(eventType, objectType.orNull()); }
java
static String buildCombinedType(String eventType, Optional<String> objectType) { return Joiner.on("/").skipNulls().join(eventType, objectType.orNull()); }
[ "static", "String", "buildCombinedType", "(", "String", "eventType", ",", "Optional", "<", "String", ">", "objectType", ")", "{", "return", "Joiner", ".", "on", "(", "\"/\"", ")", ".", "skipNulls", "(", ")", ".", "join", "(", "eventType", ",", "objectType"...
Combines event and object type into a single type string. @param eventType type or category of the reporting event. @param objectType optional type of the object this event applies to. @return Combined type string.
[ "Combines", "event", "and", "object", "type", "into", "a", "single", "type", "string", "." ]
train
https://github.com/google/cloud-reporting/blob/af2a8ff6077a9763f7f2d405dd55c82efaead0ac/src/main/java/com/google/cloud/metrics/MetricsUtils.java#L128-L130
MTDdk/jawn
jawn-core/src/main/java/net/javapla/jawn/core/util/StreamUtil.java
StreamUtil.saveTo
public static void saveTo(String path, InputStream in) throws IOException { """ Saves content read from input stream into a file. @param path path to file. @param in input stream to read content from. @throws IOException IO error @throws IllegalArgumentException if stream is null or path is null """ if (in == null) throw new IllegalArgumentException("input stream cannot be null"); if (path == null) throw new IllegalArgumentException("path cannot be null"); try (OutputStream out = new BufferedOutputStream( Files.newOutputStream( Paths.get(path), StandardOpenOption.CREATE, StandardOpenOption.APPEND))) { byte[] bytes = new byte[1024]; for (int x = in.read(bytes); x != -1; x = in.read(bytes)) out.write(bytes, 0, x); } }
java
public static void saveTo(String path, InputStream in) throws IOException { if (in == null) throw new IllegalArgumentException("input stream cannot be null"); if (path == null) throw new IllegalArgumentException("path cannot be null"); try (OutputStream out = new BufferedOutputStream( Files.newOutputStream( Paths.get(path), StandardOpenOption.CREATE, StandardOpenOption.APPEND))) { byte[] bytes = new byte[1024]; for (int x = in.read(bytes); x != -1; x = in.read(bytes)) out.write(bytes, 0, x); } }
[ "public", "static", "void", "saveTo", "(", "String", "path", ",", "InputStream", "in", ")", "throws", "IOException", "{", "if", "(", "in", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"input stream cannot be null\"", ")", ";", "if", "(...
Saves content read from input stream into a file. @param path path to file. @param in input stream to read content from. @throws IOException IO error @throws IllegalArgumentException if stream is null or path is null
[ "Saves", "content", "read", "from", "input", "stream", "into", "a", "file", "." ]
train
https://github.com/MTDdk/jawn/blob/4ec2d09b97d413efdead7487e6075e5bfd13b925/jawn-core/src/main/java/net/javapla/jawn/core/util/StreamUtil.java#L82-L97