repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
sequencelengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
sequencelengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/keywords/GrammarKeywordAccessFragment2.java
GrammarKeywordAccessFragment2.generateMembersFromConfig
protected StringConcatenationClient generateMembersFromConfig(Set<String> addedKeywords, Map<String, String> getters) { final List<StringConcatenationClient> clients = new ArrayList<>(); for (final String keyword : this.configuration.getKeywords()) { final String id = keyword.toLowerCase(); if (!addedKeywords.contains(id) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(keyword, getGrammar().getName(), getters)); addedKeywords.add(id); } } for (final String keyword : this.configuration.getLiterals()) { final String id = keyword.toLowerCase(); if (!addedKeywords.contains(id) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(keyword, getGrammar().getName(), getters)); addedKeywords.add(id); } } return new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { for (final StringConcatenationClient client : clients) { it.append(client); } } }; }
java
protected StringConcatenationClient generateMembersFromConfig(Set<String> addedKeywords, Map<String, String> getters) { final List<StringConcatenationClient> clients = new ArrayList<>(); for (final String keyword : this.configuration.getKeywords()) { final String id = keyword.toLowerCase(); if (!addedKeywords.contains(id) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(keyword, getGrammar().getName(), getters)); addedKeywords.add(id); } } for (final String keyword : this.configuration.getLiterals()) { final String id = keyword.toLowerCase(); if (!addedKeywords.contains(id) && !this.configuration.getIgnoredKeywords().contains(keyword)) { clients.add(generateKeyword(keyword, getGrammar().getName(), getters)); addedKeywords.add(id); } } return new StringConcatenationClient() { @Override protected void appendTo(TargetStringConcatenation it) { for (final StringConcatenationClient client : clients) { it.append(client); } } }; }
[ "protected", "StringConcatenationClient", "generateMembersFromConfig", "(", "Set", "<", "String", ">", "addedKeywords", ",", "Map", "<", "String", ",", "String", ">", "getters", ")", "{", "final", "List", "<", "StringConcatenationClient", ">", "clients", "=", "new", "ArrayList", "<>", "(", ")", ";", "for", "(", "final", "String", "keyword", ":", "this", ".", "configuration", ".", "getKeywords", "(", ")", ")", "{", "final", "String", "id", "=", "keyword", ".", "toLowerCase", "(", ")", ";", "if", "(", "!", "addedKeywords", ".", "contains", "(", "id", ")", "&&", "!", "this", ".", "configuration", ".", "getIgnoredKeywords", "(", ")", ".", "contains", "(", "keyword", ")", ")", "{", "clients", ".", "add", "(", "generateKeyword", "(", "keyword", ",", "getGrammar", "(", ")", ".", "getName", "(", ")", ",", "getters", ")", ")", ";", "addedKeywords", ".", "add", "(", "id", ")", ";", "}", "}", "for", "(", "final", "String", "keyword", ":", "this", ".", "configuration", ".", "getLiterals", "(", ")", ")", "{", "final", "String", "id", "=", "keyword", ".", "toLowerCase", "(", ")", ";", "if", "(", "!", "addedKeywords", ".", "contains", "(", "id", ")", "&&", "!", "this", ".", "configuration", ".", "getIgnoredKeywords", "(", ")", ".", "contains", "(", "keyword", ")", ")", "{", "clients", ".", "add", "(", "generateKeyword", "(", "keyword", ",", "getGrammar", "(", ")", ".", "getName", "(", ")", ",", "getters", ")", ")", ";", "addedKeywords", ".", "add", "(", "id", ")", ";", "}", "}", "return", "new", "StringConcatenationClient", "(", ")", "{", "@", "Override", "protected", "void", "appendTo", "(", "TargetStringConcatenation", "it", ")", "{", "for", "(", "final", "StringConcatenationClient", "client", ":", "clients", ")", "{", "it", ".", "append", "(", "client", ")", ";", "}", "}", "}", ";", "}" ]
Generate the members of the accessors. @param addedKeywords the set of keywords that are added to the output. @param getters filled by this function with the getters' names. @return the content.
[ "Generate", "the", "members", "of", "the", "accessors", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/keywords/GrammarKeywordAccessFragment2.java#L200-L224
derari/cthul
objects/src/main/java/org/cthul/objects/Boxing.java
Boxing.deepBox
public static Object deepBox(Object src) { Class<?> resultType = arrayBoxingType(src.getClass()); return deepBox(resultType, src); }
java
public static Object deepBox(Object src) { Class<?> resultType = arrayBoxingType(src.getClass()); return deepBox(resultType, src); }
[ "public", "static", "Object", "deepBox", "(", "Object", "src", ")", "{", "Class", "<", "?", ">", "resultType", "=", "arrayBoxingType", "(", "src", ".", "getClass", "(", ")", ")", ";", "return", "deepBox", "(", "resultType", ",", "src", ")", ";", "}" ]
Returns any multidimensional array into an array of boxed values. @param src source array @return multidimensional array
[ "Returns", "any", "multidimensional", "array", "into", "an", "array", "of", "boxed", "values", "." ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/objects/src/main/java/org/cthul/objects/Boxing.java#L713-L716
jtrfp/javamod
src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java
MP3FileID3Controller.setTrack
public void setTrack(int track, int type) { if (allow(type&ID3V1)) { id3v1.setTrack(track); } if (allow(type&ID3V2)) { id3v2.setTextFrame(ID3v2Frames.TRACK_NUMBER, String.valueOf(track)); } }
java
public void setTrack(int track, int type) { if (allow(type&ID3V1)) { id3v1.setTrack(track); } if (allow(type&ID3V2)) { id3v2.setTextFrame(ID3v2Frames.TRACK_NUMBER, String.valueOf(track)); } }
[ "public", "void", "setTrack", "(", "int", "track", ",", "int", "type", ")", "{", "if", "(", "allow", "(", "type", "&", "ID3V1", ")", ")", "{", "id3v1", ".", "setTrack", "(", "track", ")", ";", "}", "if", "(", "allow", "(", "type", "&", "ID3V2", ")", ")", "{", "id3v2", ".", "setTextFrame", "(", "ID3v2Frames", ".", "TRACK_NUMBER", ",", "String", ".", "valueOf", "(", "track", ")", ")", ";", "}", "}" ]
Set the track number of this mp3. @param track the track number of this mp3
[ "Set", "the", "track", "number", "of", "this", "mp3", "." ]
train
https://github.com/jtrfp/javamod/blob/cda4fe943a589dc49415f4413453e2eece72076a/src/main/java/de/quippy/javamod/multimedia/mp3/id3/MP3FileID3Controller.java#L261-L271
h2oai/h2o-3
h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java
SharedTreeNode.printDotNodesAtLevel
void printDotNodesAtLevel(PrintStream os, int levelToPrint, boolean detail, PrintMojo.PrintTreeOptions treeOptions) { if (getDepth() == levelToPrint) { printDotNode(os, detail, treeOptions); return; } assert (getDepth() < levelToPrint); if (leftChild != null) { leftChild.printDotNodesAtLevel(os, levelToPrint, detail, treeOptions); } if (rightChild != null) { rightChild.printDotNodesAtLevel(os, levelToPrint, detail, treeOptions); } }
java
void printDotNodesAtLevel(PrintStream os, int levelToPrint, boolean detail, PrintMojo.PrintTreeOptions treeOptions) { if (getDepth() == levelToPrint) { printDotNode(os, detail, treeOptions); return; } assert (getDepth() < levelToPrint); if (leftChild != null) { leftChild.printDotNodesAtLevel(os, levelToPrint, detail, treeOptions); } if (rightChild != null) { rightChild.printDotNodesAtLevel(os, levelToPrint, detail, treeOptions); } }
[ "void", "printDotNodesAtLevel", "(", "PrintStream", "os", ",", "int", "levelToPrint", ",", "boolean", "detail", ",", "PrintMojo", ".", "PrintTreeOptions", "treeOptions", ")", "{", "if", "(", "getDepth", "(", ")", "==", "levelToPrint", ")", "{", "printDotNode", "(", "os", ",", "detail", ",", "treeOptions", ")", ";", "return", ";", "}", "assert", "(", "getDepth", "(", ")", "<", "levelToPrint", ")", ";", "if", "(", "leftChild", "!=", "null", ")", "{", "leftChild", ".", "printDotNodesAtLevel", "(", "os", ",", "levelToPrint", ",", "detail", ",", "treeOptions", ")", ";", "}", "if", "(", "rightChild", "!=", "null", ")", "{", "rightChild", ".", "printDotNodesAtLevel", "(", "os", ",", "levelToPrint", ",", "detail", ",", "treeOptions", ")", ";", "}", "}" ]
Recursively print nodes at a particular depth level in the tree. Useful to group them so they render properly. @param os output stream @param levelToPrint level number @param detail include additional node detail information
[ "Recursively", "print", "nodes", "at", "a", "particular", "depth", "level", "in", "the", "tree", ".", "Useful", "to", "group", "them", "so", "they", "render", "properly", "." ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeNode.java#L344-L358
jbundle/jbundle
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/RemoteFieldTable.java
RemoteFieldTable.init
public void init(Rec record, RemoteTable tableRemote, Object syncObject) { super.init(record); this.setRemoteTable(tableRemote, syncObject); }
java
public void init(Rec record, RemoteTable tableRemote, Object syncObject) { super.init(record); this.setRemoteTable(tableRemote, syncObject); }
[ "public", "void", "init", "(", "Rec", "record", ",", "RemoteTable", "tableRemote", ",", "Object", "syncObject", ")", "{", "super", ".", "init", "(", "record", ")", ";", "this", ".", "setRemoteTable", "(", "tableRemote", ",", "syncObject", ")", ";", "}" ]
Constructor. @param record The record to handle. @param tableRemote The remote table. @param server The remote server (only used for synchronization).
[ "Constructor", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/RemoteFieldTable.java#L77-L81
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Lock.java
Lock.setName
public void setName(String name) throws ApplicationException { if (name == null) return; this.name = name.trim(); if (name.length() == 0) throw new ApplicationException("invalid attribute definition", "attribute [name] can't be a empty string"); }
java
public void setName(String name) throws ApplicationException { if (name == null) return; this.name = name.trim(); if (name.length() == 0) throw new ApplicationException("invalid attribute definition", "attribute [name] can't be a empty string"); }
[ "public", "void", "setName", "(", "String", "name", ")", "throws", "ApplicationException", "{", "if", "(", "name", "==", "null", ")", "return", ";", "this", ".", "name", "=", "name", ".", "trim", "(", ")", ";", "if", "(", "name", ".", "length", "(", ")", "==", "0", ")", "throw", "new", "ApplicationException", "(", "\"invalid attribute definition\"", ",", "\"attribute [name] can't be a empty string\"", ")", ";", "}" ]
set the value name @param name value to set @throws ApplicationException
[ "set", "the", "value", "name" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Lock.java#L195-L199
easymock/objenesis
tck/src/main/java/org/objenesis/tck/TCK.java
TCK.registerCandidate
public void registerCandidate(Class<?> candidateClass, String description, Candidate.CandidateType type) { Candidate candidate = new Candidate(candidateClass, description, type); int index = candidates.indexOf(candidate); if(index >= 0) { Candidate existingCandidate = candidates.get(index); if(!description.equals(existingCandidate.getDescription())) { throw new IllegalStateException("Two different descriptions for candidate " + candidateClass.getName()); } existingCandidate.getTypes().add(type); } else { candidates.add(candidate); } }
java
public void registerCandidate(Class<?> candidateClass, String description, Candidate.CandidateType type) { Candidate candidate = new Candidate(candidateClass, description, type); int index = candidates.indexOf(candidate); if(index >= 0) { Candidate existingCandidate = candidates.get(index); if(!description.equals(existingCandidate.getDescription())) { throw new IllegalStateException("Two different descriptions for candidate " + candidateClass.getName()); } existingCandidate.getTypes().add(type); } else { candidates.add(candidate); } }
[ "public", "void", "registerCandidate", "(", "Class", "<", "?", ">", "candidateClass", ",", "String", "description", ",", "Candidate", ".", "CandidateType", "type", ")", "{", "Candidate", "candidate", "=", "new", "Candidate", "(", "candidateClass", ",", "description", ",", "type", ")", ";", "int", "index", "=", "candidates", ".", "indexOf", "(", "candidate", ")", ";", "if", "(", "index", ">=", "0", ")", "{", "Candidate", "existingCandidate", "=", "candidates", ".", "get", "(", "index", ")", ";", "if", "(", "!", "description", ".", "equals", "(", "existingCandidate", ".", "getDescription", "(", ")", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Two different descriptions for candidate \"", "+", "candidateClass", ".", "getName", "(", ")", ")", ";", "}", "existingCandidate", ".", "getTypes", "(", ")", ".", "add", "(", "type", ")", ";", "}", "else", "{", "candidates", ".", "add", "(", "candidate", ")", ";", "}", "}" ]
Register a candidate class to attempt to instantiate. @param candidateClass Class to attempt to instantiate @param description Description of the class
[ "Register", "a", "candidate", "class", "to", "attempt", "to", "instantiate", "." ]
train
https://github.com/easymock/objenesis/blob/8f601c8ba1aa20bbc640e2c2bc48d55df52c489f/tck/src/main/java/org/objenesis/tck/TCK.java#L91-L104
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WRadioButtonRenderer.java
WRadioButtonRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WRadioButton button = (WRadioButton) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = button.isReadOnly(); String value = button.getValue(); xml.appendTagOpen("ui:radiobutton"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", button.isHidden(), "true"); xml.appendAttribute("groupName", button.getGroupName()); xml.appendAttribute("value", WebUtilities.encode(value)); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { xml.appendOptionalAttribute("disabled", button.isDisabled(), "true"); xml.appendOptionalAttribute("required", button.isMandatory(), "true"); xml.appendOptionalAttribute("submitOnChange", button.isSubmitOnChange(), "true"); xml.appendOptionalAttribute("toolTip", button.getToolTip()); xml.appendOptionalAttribute("accessibleText", button.getAccessibleText()); // Check for null option (ie null or empty). Match isEmpty() logic. boolean isNull = value == null ? true : (value.length() == 0); xml.appendOptionalAttribute("isNull", isNull, "true"); } xml.appendOptionalAttribute("selected", button.isSelected(), "true"); xml.appendEnd(); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WRadioButton button = (WRadioButton) component; XmlStringBuilder xml = renderContext.getWriter(); boolean readOnly = button.isReadOnly(); String value = button.getValue(); xml.appendTagOpen("ui:radiobutton"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendOptionalAttribute("hidden", button.isHidden(), "true"); xml.appendAttribute("groupName", button.getGroupName()); xml.appendAttribute("value", WebUtilities.encode(value)); if (readOnly) { xml.appendAttribute("readOnly", "true"); } else { xml.appendOptionalAttribute("disabled", button.isDisabled(), "true"); xml.appendOptionalAttribute("required", button.isMandatory(), "true"); xml.appendOptionalAttribute("submitOnChange", button.isSubmitOnChange(), "true"); xml.appendOptionalAttribute("toolTip", button.getToolTip()); xml.appendOptionalAttribute("accessibleText", button.getAccessibleText()); // Check for null option (ie null or empty). Match isEmpty() logic. boolean isNull = value == null ? true : (value.length() == 0); xml.appendOptionalAttribute("isNull", isNull, "true"); } xml.appendOptionalAttribute("selected", button.isSelected(), "true"); xml.appendEnd(); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WRadioButton", "button", "=", "(", "WRadioButton", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "boolean", "readOnly", "=", "button", ".", "isReadOnly", "(", ")", ";", "String", "value", "=", "button", ".", "getValue", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:radiobutton\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"class\"", ",", "component", ".", "getHtmlClass", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"hidden\"", ",", "button", ".", "isHidden", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"groupName\"", ",", "button", ".", "getGroupName", "(", ")", ")", ";", "xml", ".", "appendAttribute", "(", "\"value\"", ",", "WebUtilities", ".", "encode", "(", "value", ")", ")", ";", "if", "(", "readOnly", ")", "{", "xml", ".", "appendAttribute", "(", "\"readOnly\"", ",", "\"true\"", ")", ";", "}", "else", "{", "xml", ".", "appendOptionalAttribute", "(", "\"disabled\"", ",", "button", ".", "isDisabled", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"required\"", ",", "button", ".", "isMandatory", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"submitOnChange\"", ",", "button", ".", "isSubmitOnChange", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"toolTip\"", ",", "button", ".", "getToolTip", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"accessibleText\"", ",", "button", ".", "getAccessibleText", "(", ")", ")", ";", "// Check for null option (ie null or empty). Match isEmpty() logic.", "boolean", "isNull", "=", "value", "==", "null", "?", "true", ":", "(", "value", ".", "length", "(", ")", "==", "0", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"isNull\"", ",", "isNull", ",", "\"true\"", ")", ";", "}", "xml", ".", "appendOptionalAttribute", "(", "\"selected\"", ",", "button", ".", "isSelected", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendEnd", "(", ")", ";", "}" ]
Paints the given WRadioButton. @param component the WRadioButton to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WRadioButton", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WRadioButtonRenderer.java#L24-L53
google/closure-compiler
src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java
TypeTransformationParser.validBooleanExpression
private boolean validBooleanExpression(Node expr) { if (isBooleanOperation(expr)) { return validBooleanOperation(expr); } if (!isOperation(expr)) { warnInvalidExpression("boolean", expr); return false; } if (!isValidPredicate(getCallName(expr))) { warnInvalid("boolean predicate", expr); return false; } Keywords keyword = nameToKeyword(getCallName(expr)); if (!checkParameterCount(expr, keyword)) { return false; } switch (keyword.kind) { case TYPE_PREDICATE: return validTypePredicate(expr, getCallParamCount(expr)); case STRING_PREDICATE: return validStringPredicate(expr, getCallParamCount(expr)); case TYPEVAR_PREDICATE: return validTypevarPredicate(expr, getCallParamCount(expr)); default: throw new IllegalStateException("Invalid boolean expression"); } }
java
private boolean validBooleanExpression(Node expr) { if (isBooleanOperation(expr)) { return validBooleanOperation(expr); } if (!isOperation(expr)) { warnInvalidExpression("boolean", expr); return false; } if (!isValidPredicate(getCallName(expr))) { warnInvalid("boolean predicate", expr); return false; } Keywords keyword = nameToKeyword(getCallName(expr)); if (!checkParameterCount(expr, keyword)) { return false; } switch (keyword.kind) { case TYPE_PREDICATE: return validTypePredicate(expr, getCallParamCount(expr)); case STRING_PREDICATE: return validStringPredicate(expr, getCallParamCount(expr)); case TYPEVAR_PREDICATE: return validTypevarPredicate(expr, getCallParamCount(expr)); default: throw new IllegalStateException("Invalid boolean expression"); } }
[ "private", "boolean", "validBooleanExpression", "(", "Node", "expr", ")", "{", "if", "(", "isBooleanOperation", "(", "expr", ")", ")", "{", "return", "validBooleanOperation", "(", "expr", ")", ";", "}", "if", "(", "!", "isOperation", "(", "expr", ")", ")", "{", "warnInvalidExpression", "(", "\"boolean\"", ",", "expr", ")", ";", "return", "false", ";", "}", "if", "(", "!", "isValidPredicate", "(", "getCallName", "(", "expr", ")", ")", ")", "{", "warnInvalid", "(", "\"boolean predicate\"", ",", "expr", ")", ";", "return", "false", ";", "}", "Keywords", "keyword", "=", "nameToKeyword", "(", "getCallName", "(", "expr", ")", ")", ";", "if", "(", "!", "checkParameterCount", "(", "expr", ",", "keyword", ")", ")", "{", "return", "false", ";", "}", "switch", "(", "keyword", ".", "kind", ")", "{", "case", "TYPE_PREDICATE", ":", "return", "validTypePredicate", "(", "expr", ",", "getCallParamCount", "(", "expr", ")", ")", ";", "case", "STRING_PREDICATE", ":", "return", "validStringPredicate", "(", "expr", ",", "getCallParamCount", "(", "expr", ")", ")", ";", "case", "TYPEVAR_PREDICATE", ":", "return", "validTypevarPredicate", "(", "expr", ",", "getCallParamCount", "(", "expr", ")", ")", ";", "default", ":", "throw", "new", "IllegalStateException", "(", "\"Invalid boolean expression\"", ")", ";", "}", "}" ]
A boolean expression must be a boolean predicate or a boolean type predicate
[ "A", "boolean", "expression", "must", "be", "a", "boolean", "predicate", "or", "a", "boolean", "type", "predicate" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java#L572-L599
alkacon/opencms-core
src/org/opencms/site/xmlsitemap/CmsXmlSitemapGenerator.java
CmsXmlSitemapGenerator.getLocale
private Locale getLocale(CmsResource resource, List<CmsProperty> propertyList) { return OpenCms.getLocaleManager().getDefaultLocale(m_guestCms, m_guestCms.getSitePath(resource)); }
java
private Locale getLocale(CmsResource resource, List<CmsProperty> propertyList) { return OpenCms.getLocaleManager().getDefaultLocale(m_guestCms, m_guestCms.getSitePath(resource)); }
[ "private", "Locale", "getLocale", "(", "CmsResource", "resource", ",", "List", "<", "CmsProperty", ">", "propertyList", ")", "{", "return", "OpenCms", ".", "getLocaleManager", "(", ")", ".", "getDefaultLocale", "(", "m_guestCms", ",", "m_guestCms", ".", "getSitePath", "(", "resource", ")", ")", ";", "}" ]
Gets the locale to use for the given resource.<p> @param resource the resource @param propertyList the properties of the resource @return the locale to use for the given resource
[ "Gets", "the", "locale", "to", "use", "for", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/xmlsitemap/CmsXmlSitemapGenerator.java#L753-L756
Red5/red5-server-common
src/main/java/org/red5/server/Client.java
Client.from
public static Client from(CompositeData cd) { Client instance = null; if (cd.containsKey("id")) { String id = (String) cd.get("id"); instance = new Client(id, (Long) cd.get("creationTime"), null); instance.setAttribute(PERMISSIONS, cd.get(PERMISSIONS)); } if (cd.containsKey("attributes")) { AttributeStore attrs = (AttributeStore) cd.get("attributes"); instance.setAttributes(attrs); } return instance; }
java
public static Client from(CompositeData cd) { Client instance = null; if (cd.containsKey("id")) { String id = (String) cd.get("id"); instance = new Client(id, (Long) cd.get("creationTime"), null); instance.setAttribute(PERMISSIONS, cd.get(PERMISSIONS)); } if (cd.containsKey("attributes")) { AttributeStore attrs = (AttributeStore) cd.get("attributes"); instance.setAttributes(attrs); } return instance; }
[ "public", "static", "Client", "from", "(", "CompositeData", "cd", ")", "{", "Client", "instance", "=", "null", ";", "if", "(", "cd", ".", "containsKey", "(", "\"id\"", ")", ")", "{", "String", "id", "=", "(", "String", ")", "cd", ".", "get", "(", "\"id\"", ")", ";", "instance", "=", "new", "Client", "(", "id", ",", "(", "Long", ")", "cd", ".", "get", "(", "\"creationTime\"", ")", ",", "null", ")", ";", "instance", ".", "setAttribute", "(", "PERMISSIONS", ",", "cd", ".", "get", "(", "PERMISSIONS", ")", ")", ";", "}", "if", "(", "cd", ".", "containsKey", "(", "\"attributes\"", ")", ")", "{", "AttributeStore", "attrs", "=", "(", "AttributeStore", ")", "cd", ".", "get", "(", "\"attributes\"", ")", ";", "instance", ".", "setAttributes", "(", "attrs", ")", ";", "}", "return", "instance", ";", "}" ]
Allows for reconstruction via CompositeData. @param cd composite data @return Client class instance
[ "Allows", "for", "reconstruction", "via", "CompositeData", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/Client.java#L369-L381
outbrain/ob1k
ob1k-concurrent/src/main/java/com/outbrain/ob1k/concurrent/ComposableFutures.java
ComposableFutures.toColdObservable
public static <T> Observable<T> toColdObservable(final RecursiveFutureProvider<T> futureProvider) { return Observable.create(new Observable.OnSubscribe<T>() { @Override public void call(final Subscriber<? super T> subscriber) { recursiveChain(subscriber, futureProvider.createStopCriteria()); } private void recursiveChain(final Subscriber<? super T> subscriber, final Predicate<T> stopCriteria) { futureProvider.provide().consume(result -> { if (result.isSuccess()) { final T value = result.getValue(); subscriber.onNext(value); if (stopCriteria.apply(value)) { subscriber.onCompleted(); } else { recursiveChain(subscriber, stopCriteria); } } else { subscriber.onError(result.getError()); } }); } }); }
java
public static <T> Observable<T> toColdObservable(final RecursiveFutureProvider<T> futureProvider) { return Observable.create(new Observable.OnSubscribe<T>() { @Override public void call(final Subscriber<? super T> subscriber) { recursiveChain(subscriber, futureProvider.createStopCriteria()); } private void recursiveChain(final Subscriber<? super T> subscriber, final Predicate<T> stopCriteria) { futureProvider.provide().consume(result -> { if (result.isSuccess()) { final T value = result.getValue(); subscriber.onNext(value); if (stopCriteria.apply(value)) { subscriber.onCompleted(); } else { recursiveChain(subscriber, stopCriteria); } } else { subscriber.onError(result.getError()); } }); } }); }
[ "public", "static", "<", "T", ">", "Observable", "<", "T", ">", "toColdObservable", "(", "final", "RecursiveFutureProvider", "<", "T", ">", "futureProvider", ")", "{", "return", "Observable", ".", "create", "(", "new", "Observable", ".", "OnSubscribe", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "void", "call", "(", "final", "Subscriber", "<", "?", "super", "T", ">", "subscriber", ")", "{", "recursiveChain", "(", "subscriber", ",", "futureProvider", ".", "createStopCriteria", "(", ")", ")", ";", "}", "private", "void", "recursiveChain", "(", "final", "Subscriber", "<", "?", "super", "T", ">", "subscriber", ",", "final", "Predicate", "<", "T", ">", "stopCriteria", ")", "{", "futureProvider", ".", "provide", "(", ")", ".", "consume", "(", "result", "->", "{", "if", "(", "result", ".", "isSuccess", "(", ")", ")", "{", "final", "T", "value", "=", "result", ".", "getValue", "(", ")", ";", "subscriber", ".", "onNext", "(", "value", ")", ";", "if", "(", "stopCriteria", ".", "apply", "(", "value", ")", ")", "{", "subscriber", ".", "onCompleted", "(", ")", ";", "}", "else", "{", "recursiveChain", "(", "subscriber", ",", "stopCriteria", ")", ";", "}", "}", "else", "{", "subscriber", ".", "onError", "(", "result", ".", "getError", "(", ")", ")", ";", "}", "}", ")", ";", "}", "}", ")", ";", "}" ]
creates new cold observable, given future provider, on each subscribe will consume the provided future and repeat until stop criteria will exists each result will be emitted to the stream @param futureProvider the future provider @param <T> the stream type @return the stream
[ "creates", "new", "cold", "observable", "given", "future", "provider", "on", "each", "subscribe", "will", "consume", "the", "provided", "future", "and", "repeat", "until", "stop", "criteria", "will", "exists", "each", "result", "will", "be", "emitted", "to", "the", "stream" ]
train
https://github.com/outbrain/ob1k/blob/9e43ab39230c5787065053da0f766d822d0fe4e7/ob1k-concurrent/src/main/java/com/outbrain/ob1k/concurrent/ComposableFutures.java#L649-L672
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/concurrency/DeviceAllocationsTracker.java
DeviceAllocationsTracker.reserveAllocationIfPossible
public boolean reserveAllocationIfPossible(Long threadId, Integer deviceId, long memorySize) { ensureThreadRegistered(threadId, deviceId); try { deviceLocks.get(deviceId).writeLock().lock(); /* if (getAllocatedSize(deviceId) + memorySize + getReservedSpace(deviceId)> environment.getDeviceInformation(deviceId).getTotalMemory() * configuration.getMaxDeviceMemoryUsed()) { return false; } else { addToReservedSpace(deviceId, memorySize); return true; } */ addToReservedSpace(deviceId, memorySize); return true; } finally { deviceLocks.get(deviceId).writeLock().unlock(); } }
java
public boolean reserveAllocationIfPossible(Long threadId, Integer deviceId, long memorySize) { ensureThreadRegistered(threadId, deviceId); try { deviceLocks.get(deviceId).writeLock().lock(); /* if (getAllocatedSize(deviceId) + memorySize + getReservedSpace(deviceId)> environment.getDeviceInformation(deviceId).getTotalMemory() * configuration.getMaxDeviceMemoryUsed()) { return false; } else { addToReservedSpace(deviceId, memorySize); return true; } */ addToReservedSpace(deviceId, memorySize); return true; } finally { deviceLocks.get(deviceId).writeLock().unlock(); } }
[ "public", "boolean", "reserveAllocationIfPossible", "(", "Long", "threadId", ",", "Integer", "deviceId", ",", "long", "memorySize", ")", "{", "ensureThreadRegistered", "(", "threadId", ",", "deviceId", ")", ";", "try", "{", "deviceLocks", ".", "get", "(", "deviceId", ")", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "/*\n if (getAllocatedSize(deviceId) + memorySize + getReservedSpace(deviceId)> environment.getDeviceInformation(deviceId).getTotalMemory() * configuration.getMaxDeviceMemoryUsed()) {\n return false;\n } else {\n addToReservedSpace(deviceId, memorySize);\n return true;\n }\n */", "addToReservedSpace", "(", "deviceId", ",", "memorySize", ")", ";", "return", "true", ";", "}", "finally", "{", "deviceLocks", ".", "get", "(", "deviceId", ")", ".", "writeLock", "(", ")", ".", "unlock", "(", ")", ";", "}", "}" ]
This method "reserves" memory within allocator @param threadId @param deviceId @param memorySize @return
[ "This", "method", "reserves", "memory", "within", "allocator" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-backend-impls/nd4j-cuda/src/main/java/org/nd4j/jita/allocator/concurrency/DeviceAllocationsTracker.java#L131-L148
mapsforge/mapsforge
sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java
DatabaseUtils.cursorDoubleToCursorValues
public static void cursorDoubleToCursorValues(Cursor cursor, String field, ContentValues values) { cursorDoubleToContentValues(cursor, field, values, field); }
java
public static void cursorDoubleToCursorValues(Cursor cursor, String field, ContentValues values) { cursorDoubleToContentValues(cursor, field, values, field); }
[ "public", "static", "void", "cursorDoubleToCursorValues", "(", "Cursor", "cursor", ",", "String", "field", ",", "ContentValues", "values", ")", "{", "cursorDoubleToContentValues", "(", "cursor", ",", "field", ",", "values", ",", "field", ")", ";", "}" ]
Reads a Double out of a field in a Cursor and writes it to a Map. @param cursor The cursor to read from @param field The REAL field to read @param values The {@link ContentValues} to put the value into
[ "Reads", "a", "Double", "out", "of", "a", "field", "in", "a", "Cursor", "and", "writes", "it", "to", "a", "Map", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/sqlite-android/src/main/java/org/sqlite/database/DatabaseUtils.java#L706-L709
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java
Identifiers.createIp6
public static IpAddress createIp6(String value, String admDom) { return createIp(IpAddressType.IPv6, value, admDom); }
java
public static IpAddress createIp6(String value, String admDom) { return createIp(IpAddressType.IPv6, value, admDom); }
[ "public", "static", "IpAddress", "createIp6", "(", "String", "value", ",", "String", "admDom", ")", "{", "return", "createIp", "(", "IpAddressType", ".", "IPv6", ",", "value", ",", "admDom", ")", ";", "}" ]
Create an ip-address identifier for IPv6 with the given parameters. @param value a {@link String} that represents a valid IPv4 address @param admDom the administrative-domain @return the new ip-address identifier
[ "Create", "an", "ip", "-", "address", "identifier", "for", "IPv6", "with", "the", "given", "parameters", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identifiers.java#L637-L639
lessthanoptimal/BoofCV
main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/direct/VisOdomDirectColorDepth.java
VisOdomDirectColorDepth.estimateMotion
public boolean estimateMotion(Planar<I> input , Se3_F32 hintKeyToInput ) { InputSanityCheck.checkSameShape(derivX,input); initMotion(input); keyToCurrent.set(hintKeyToInput); boolean foundSolution = false; float previousError = Float.MAX_VALUE; for (int i = 0; i < maxIterations; i++) { constructLinearSystem(input, keyToCurrent); if (!solveSystem()) break; if( Math.abs(previousError-errorOptical)/previousError < convergeTol ) break; else { // update the estimated motion from the computed twist previousError = errorOptical; keyToCurrent.concat(motionTwist, tmp); keyToCurrent.set(tmp); foundSolution = true; } } return foundSolution; }
java
public boolean estimateMotion(Planar<I> input , Se3_F32 hintKeyToInput ) { InputSanityCheck.checkSameShape(derivX,input); initMotion(input); keyToCurrent.set(hintKeyToInput); boolean foundSolution = false; float previousError = Float.MAX_VALUE; for (int i = 0; i < maxIterations; i++) { constructLinearSystem(input, keyToCurrent); if (!solveSystem()) break; if( Math.abs(previousError-errorOptical)/previousError < convergeTol ) break; else { // update the estimated motion from the computed twist previousError = errorOptical; keyToCurrent.concat(motionTwist, tmp); keyToCurrent.set(tmp); foundSolution = true; } } return foundSolution; }
[ "public", "boolean", "estimateMotion", "(", "Planar", "<", "I", ">", "input", ",", "Se3_F32", "hintKeyToInput", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "derivX", ",", "input", ")", ";", "initMotion", "(", "input", ")", ";", "keyToCurrent", ".", "set", "(", "hintKeyToInput", ")", ";", "boolean", "foundSolution", "=", "false", ";", "float", "previousError", "=", "Float", ".", "MAX_VALUE", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "maxIterations", ";", "i", "++", ")", "{", "constructLinearSystem", "(", "input", ",", "keyToCurrent", ")", ";", "if", "(", "!", "solveSystem", "(", ")", ")", "break", ";", "if", "(", "Math", ".", "abs", "(", "previousError", "-", "errorOptical", ")", "/", "previousError", "<", "convergeTol", ")", "break", ";", "else", "{", "// update the estimated motion from the computed twist", "previousError", "=", "errorOptical", ";", "keyToCurrent", ".", "concat", "(", "motionTwist", ",", "tmp", ")", ";", "keyToCurrent", ".", "set", "(", "tmp", ")", ";", "foundSolution", "=", "true", ";", "}", "}", "return", "foundSolution", ";", "}" ]
Estimates the motion relative to the key frame. @param input Next image in the sequence @param hintKeyToInput estimated transform from keyframe to the current input image @return true if it was successful at estimating the motion or false if it failed for some reason
[ "Estimates", "the", "motion", "relative", "to", "the", "key", "frame", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-sfm/src/main/java/boofcv/alg/sfm/d3/direct/VisOdomDirectColorDepth.java#L252-L276
spotify/scio
scio-examples/src/main/java/org/apache/beam/examples/complete/TfIdf.java
TfIdf.listInputDocuments
public static Set<URI> listInputDocuments(Options options) throws URISyntaxException, IOException { URI baseUri = new URI(options.getInput()); // List all documents in the directory or GCS prefix. URI absoluteUri; if (baseUri.getScheme() != null) { absoluteUri = baseUri; } else { absoluteUri = new URI( "file", baseUri.getAuthority(), baseUri.getPath(), baseUri.getQuery(), baseUri.getFragment()); } Set<URI> uris = new HashSet<>(); if ("file".equals(absoluteUri.getScheme())) { File directory = new File(absoluteUri); for (String entry : Optional.fromNullable(directory.list()).or(new String[] {})) { File path = new File(directory, entry); uris.add(path.toURI()); } } else if ("gs".equals(absoluteUri.getScheme())) { GcsUtil gcsUtil = options.as(GcsOptions.class).getGcsUtil(); URI gcsUriGlob = new URI( absoluteUri.getScheme(), absoluteUri.getAuthority(), absoluteUri.getPath() + "*", absoluteUri.getQuery(), absoluteUri.getFragment()); for (GcsPath entry : gcsUtil.expand(GcsPath.fromUri(gcsUriGlob))) { uris.add(entry.toUri()); } } return uris; }
java
public static Set<URI> listInputDocuments(Options options) throws URISyntaxException, IOException { URI baseUri = new URI(options.getInput()); // List all documents in the directory or GCS prefix. URI absoluteUri; if (baseUri.getScheme() != null) { absoluteUri = baseUri; } else { absoluteUri = new URI( "file", baseUri.getAuthority(), baseUri.getPath(), baseUri.getQuery(), baseUri.getFragment()); } Set<URI> uris = new HashSet<>(); if ("file".equals(absoluteUri.getScheme())) { File directory = new File(absoluteUri); for (String entry : Optional.fromNullable(directory.list()).or(new String[] {})) { File path = new File(directory, entry); uris.add(path.toURI()); } } else if ("gs".equals(absoluteUri.getScheme())) { GcsUtil gcsUtil = options.as(GcsOptions.class).getGcsUtil(); URI gcsUriGlob = new URI( absoluteUri.getScheme(), absoluteUri.getAuthority(), absoluteUri.getPath() + "*", absoluteUri.getQuery(), absoluteUri.getFragment()); for (GcsPath entry : gcsUtil.expand(GcsPath.fromUri(gcsUriGlob))) { uris.add(entry.toUri()); } } return uris; }
[ "public", "static", "Set", "<", "URI", ">", "listInputDocuments", "(", "Options", "options", ")", "throws", "URISyntaxException", ",", "IOException", "{", "URI", "baseUri", "=", "new", "URI", "(", "options", ".", "getInput", "(", ")", ")", ";", "// List all documents in the directory or GCS prefix.", "URI", "absoluteUri", ";", "if", "(", "baseUri", ".", "getScheme", "(", ")", "!=", "null", ")", "{", "absoluteUri", "=", "baseUri", ";", "}", "else", "{", "absoluteUri", "=", "new", "URI", "(", "\"file\"", ",", "baseUri", ".", "getAuthority", "(", ")", ",", "baseUri", ".", "getPath", "(", ")", ",", "baseUri", ".", "getQuery", "(", ")", ",", "baseUri", ".", "getFragment", "(", ")", ")", ";", "}", "Set", "<", "URI", ">", "uris", "=", "new", "HashSet", "<>", "(", ")", ";", "if", "(", "\"file\"", ".", "equals", "(", "absoluteUri", ".", "getScheme", "(", ")", ")", ")", "{", "File", "directory", "=", "new", "File", "(", "absoluteUri", ")", ";", "for", "(", "String", "entry", ":", "Optional", ".", "fromNullable", "(", "directory", ".", "list", "(", ")", ")", ".", "or", "(", "new", "String", "[", "]", "{", "}", ")", ")", "{", "File", "path", "=", "new", "File", "(", "directory", ",", "entry", ")", ";", "uris", ".", "add", "(", "path", ".", "toURI", "(", ")", ")", ";", "}", "}", "else", "if", "(", "\"gs\"", ".", "equals", "(", "absoluteUri", ".", "getScheme", "(", ")", ")", ")", "{", "GcsUtil", "gcsUtil", "=", "options", ".", "as", "(", "GcsOptions", ".", "class", ")", ".", "getGcsUtil", "(", ")", ";", "URI", "gcsUriGlob", "=", "new", "URI", "(", "absoluteUri", ".", "getScheme", "(", ")", ",", "absoluteUri", ".", "getAuthority", "(", ")", ",", "absoluteUri", ".", "getPath", "(", ")", "+", "\"*\"", ",", "absoluteUri", ".", "getQuery", "(", ")", ",", "absoluteUri", ".", "getFragment", "(", ")", ")", ";", "for", "(", "GcsPath", "entry", ":", "gcsUtil", ".", "expand", "(", "GcsPath", ".", "fromUri", "(", "gcsUriGlob", ")", ")", ")", "{", "uris", ".", "add", "(", "entry", ".", "toUri", "(", ")", ")", ";", "}", "}", "return", "uris", ";", "}" ]
Lists documents contained beneath the {@code options.input} prefix/directory.
[ "Lists", "documents", "contained", "beneath", "the", "{" ]
train
https://github.com/spotify/scio/blob/ed9a44428251b0c6834aad231b463d8eda418471/scio-examples/src/main/java/org/apache/beam/examples/complete/TfIdf.java#L104-L142
jmapper-framework/jmapper-core
JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java
ConfigReader.getValue
private String getValue(final String value, final String mappedFieldName) { if (isNull(value)) return null; return value.equals(DEFAULT_FIELD_VALUE)?mappedFieldName:value; }
java
private String getValue(final String value, final String mappedFieldName) { if (isNull(value)) return null; return value.equals(DEFAULT_FIELD_VALUE)?mappedFieldName:value; }
[ "private", "String", "getValue", "(", "final", "String", "value", ",", "final", "String", "mappedFieldName", ")", "{", "if", "(", "isNull", "(", "value", ")", ")", "return", "null", ";", "return", "value", ".", "equals", "(", "DEFAULT_FIELD_VALUE", ")", "?", "mappedFieldName", ":", "value", ";", "}" ]
This method compare the name of the target field with the DEFAULT_FIELD_VALUE and returns the final value. @param value configuration parameter @param mappedFieldName name of the configured field @return the name of target field @see Constants#DEFAULT_FIELD_VALUE
[ "This", "method", "compare", "the", "name", "of", "the", "target", "field", "with", "the", "DEFAULT_FIELD_VALUE", "and", "returns", "the", "final", "value", "." ]
train
https://github.com/jmapper-framework/jmapper-core/blob/b48fd3527f35055b8b4a30f53a51136f183acc90/JMapper Framework/src/main/java/com/googlecode/jmapper/config/ConfigReader.java#L70-L75
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
FileSupport.getClassFileFromDirectoryInClassPath
public static File getClassFileFromDirectoryInClassPath(String className) { String fileName = StringSupport.replaceAll(className, ".", "/"); fileName += ".class"; return getFileFromDirectoryInClassPath(fileName, System.getProperty("java.class.path")); }
java
public static File getClassFileFromDirectoryInClassPath(String className) { String fileName = StringSupport.replaceAll(className, ".", "/"); fileName += ".class"; return getFileFromDirectoryInClassPath(fileName, System.getProperty("java.class.path")); }
[ "public", "static", "File", "getClassFileFromDirectoryInClassPath", "(", "String", "className", ")", "{", "String", "fileName", "=", "StringSupport", ".", "replaceAll", "(", "className", ",", "\".\"", ",", "\"/\"", ")", ";", "fileName", "+=", "\".class\"", ";", "return", "getFileFromDirectoryInClassPath", "(", "fileName", ",", "System", ".", "getProperty", "(", "\"java.class.path\"", ")", ")", ";", "}" ]
Tries to retrieve a class as File from all directories mentioned in system property java.class.path @param className class name as retrieved in myObject.getClass().getName() @return a File if the class file was found or null otherwise
[ "Tries", "to", "retrieve", "a", "class", "as", "File", "from", "all", "directories", "mentioned", "in", "system", "property", "java", ".", "class", ".", "path" ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L207-L211
code4everything/util
src/main/java/com/zhazhapan/util/DateUtils.java
DateUtils.addSecond
public static Date addSecond(String date, int amount) throws ParseException { return add(date, Calendar.SECOND, amount); }
java
public static Date addSecond(String date, int amount) throws ParseException { return add(date, Calendar.SECOND, amount); }
[ "public", "static", "Date", "addSecond", "(", "String", "date", ",", "int", "amount", ")", "throws", "ParseException", "{", "return", "add", "(", "date", ",", "Calendar", ".", "SECOND", ",", "amount", ")", ";", "}" ]
添加秒 @param date 日期 @param amount 数量 @return 添加后的日期 @throws ParseException 异常
[ "添加秒" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/DateUtils.java#L383-L385
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/api/Table.java
Table.first
private static Sort first(String columnName, Sort.Order order) { return Sort.on(columnName, order); }
java
private static Sort first(String columnName, Sort.Order order) { return Sort.on(columnName, order); }
[ "private", "static", "Sort", "first", "(", "String", "columnName", ",", "Sort", ".", "Order", "order", ")", "{", "return", "Sort", ".", "on", "(", "columnName", ",", "order", ")", ";", "}" ]
Returns a sort Key that can be used for simple or chained comparator sorting <p> You can extend the sort key by using .next() to fill more columns to the sort order
[ "Returns", "a", "sort", "Key", "that", "can", "be", "used", "for", "simple", "or", "chained", "comparator", "sorting", "<p", ">", "You", "can", "extend", "the", "sort", "key", "by", "using", ".", "next", "()", "to", "fill", "more", "columns", "to", "the", "sort", "order" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/api/Table.java#L171-L173
jenkinsci/jenkins
core/src/main/java/hudson/model/AbstractItem.java
AbstractItem.onLoad
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException { this.parent = parent; doSetName(name); }
java
public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException { this.parent = parent; doSetName(name); }
[ "public", "void", "onLoad", "(", "ItemGroup", "<", "?", "extends", "Item", ">", "parent", ",", "String", "name", ")", "throws", "IOException", "{", "this", ".", "parent", "=", "parent", ";", "doSetName", "(", "name", ")", ";", "}" ]
Called right after when a {@link Item} is loaded from disk. This is an opportunity to do a post load processing.
[ "Called", "right", "after", "when", "a", "{" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/AbstractItem.java#L505-L508
kobakei/Android-RateThisApp
ratethisapp/src/main/java/com/kobakei/ratethisapp/RateThisApp.java
RateThisApp.storeInstallDate
private static void storeInstallDate(final Context context, SharedPreferences.Editor editor) { Date installDate = new Date(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { PackageManager packMan = context.getPackageManager(); try { PackageInfo pkgInfo = packMan.getPackageInfo(context.getPackageName(), 0); installDate = new Date(pkgInfo.firstInstallTime); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } } editor.putLong(KEY_INSTALL_DATE, installDate.getTime()); log("First install: " + installDate.toString()); }
java
private static void storeInstallDate(final Context context, SharedPreferences.Editor editor) { Date installDate = new Date(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) { PackageManager packMan = context.getPackageManager(); try { PackageInfo pkgInfo = packMan.getPackageInfo(context.getPackageName(), 0); installDate = new Date(pkgInfo.firstInstallTime); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } } editor.putLong(KEY_INSTALL_DATE, installDate.getTime()); log("First install: " + installDate.toString()); }
[ "private", "static", "void", "storeInstallDate", "(", "final", "Context", "context", ",", "SharedPreferences", ".", "Editor", "editor", ")", "{", "Date", "installDate", "=", "new", "Date", "(", ")", ";", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", "GINGERBREAD", ")", "{", "PackageManager", "packMan", "=", "context", ".", "getPackageManager", "(", ")", ";", "try", "{", "PackageInfo", "pkgInfo", "=", "packMan", ".", "getPackageInfo", "(", "context", ".", "getPackageName", "(", ")", ",", "0", ")", ";", "installDate", "=", "new", "Date", "(", "pkgInfo", ".", "firstInstallTime", ")", ";", "}", "catch", "(", "PackageManager", ".", "NameNotFoundException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "editor", ".", "putLong", "(", "KEY_INSTALL_DATE", ",", "installDate", ".", "getTime", "(", ")", ")", ";", "log", "(", "\"First install: \"", "+", "installDate", ".", "toString", "(", ")", ")", ";", "}" ]
Store install date. Install date is retrieved from package manager if possible. @param context @param editor
[ "Store", "install", "date", ".", "Install", "date", "is", "retrieved", "from", "package", "manager", "if", "possible", "." ]
train
https://github.com/kobakei/Android-RateThisApp/blob/c3d007c8c02beb6ff196745c2310c259737f5c81/ratethisapp/src/main/java/com/kobakei/ratethisapp/RateThisApp.java#L338-L351
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java
MamManager.retrieveFormFields
public List<FormField> retrieveFormFields(String node) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotLoggedInException { String queryId = UUID.randomUUID().toString(); MamQueryIQ mamQueryIq = new MamQueryIQ(queryId, node, null); mamQueryIq.setTo(archiveAddress); MamQueryIQ mamResponseQueryIq = connection().createStanzaCollectorAndSend(mamQueryIq).nextResultOrThrow(); return mamResponseQueryIq.getDataForm().getFields(); }
java
public List<FormField> retrieveFormFields(String node) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotLoggedInException { String queryId = UUID.randomUUID().toString(); MamQueryIQ mamQueryIq = new MamQueryIQ(queryId, node, null); mamQueryIq.setTo(archiveAddress); MamQueryIQ mamResponseQueryIq = connection().createStanzaCollectorAndSend(mamQueryIq).nextResultOrThrow(); return mamResponseQueryIq.getDataForm().getFields(); }
[ "public", "List", "<", "FormField", ">", "retrieveFormFields", "(", "String", "node", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", ",", "NotLoggedInException", "{", "String", "queryId", "=", "UUID", ".", "randomUUID", "(", ")", ".", "toString", "(", ")", ";", "MamQueryIQ", "mamQueryIq", "=", "new", "MamQueryIQ", "(", "queryId", ",", "node", ",", "null", ")", ";", "mamQueryIq", ".", "setTo", "(", "archiveAddress", ")", ";", "MamQueryIQ", "mamResponseQueryIq", "=", "connection", "(", ")", ".", "createStanzaCollectorAndSend", "(", "mamQueryIq", ")", ".", "nextResultOrThrow", "(", ")", ";", "return", "mamResponseQueryIq", ".", "getDataForm", "(", ")", ".", "getFields", "(", ")", ";", "}" ]
Get the form fields supported by the server. @param node The PubSub node name, can be null @return the list of form fields. @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException @throws NotLoggedInException
[ "Get", "the", "form", "fields", "supported", "by", "the", "server", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/mam/MamManager.java#L524-L534
infinispan/infinispan
client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transaction/entry/Modification.java
Modification.writeTo
public void writeTo(ByteBuf byteBuf, Codec codec) { writeArray(byteBuf, key); byteBuf.writeByte(control); if (!ControlByte.NON_EXISTING.hasFlag(control) && !ControlByte.NOT_READ.hasFlag(control)) { byteBuf.writeLong(versionRead); } if (ControlByte.REMOVE_OP.hasFlag(control)) { return; } codec.writeExpirationParams(byteBuf, lifespan, lifespanTimeUnit, maxIdle, maxIdleTimeUnit); writeArray(byteBuf, value); }
java
public void writeTo(ByteBuf byteBuf, Codec codec) { writeArray(byteBuf, key); byteBuf.writeByte(control); if (!ControlByte.NON_EXISTING.hasFlag(control) && !ControlByte.NOT_READ.hasFlag(control)) { byteBuf.writeLong(versionRead); } if (ControlByte.REMOVE_OP.hasFlag(control)) { return; } codec.writeExpirationParams(byteBuf, lifespan, lifespanTimeUnit, maxIdle, maxIdleTimeUnit); writeArray(byteBuf, value); }
[ "public", "void", "writeTo", "(", "ByteBuf", "byteBuf", ",", "Codec", "codec", ")", "{", "writeArray", "(", "byteBuf", ",", "key", ")", ";", "byteBuf", ".", "writeByte", "(", "control", ")", ";", "if", "(", "!", "ControlByte", ".", "NON_EXISTING", ".", "hasFlag", "(", "control", ")", "&&", "!", "ControlByte", ".", "NOT_READ", ".", "hasFlag", "(", "control", ")", ")", "{", "byteBuf", ".", "writeLong", "(", "versionRead", ")", ";", "}", "if", "(", "ControlByte", ".", "REMOVE_OP", ".", "hasFlag", "(", "control", ")", ")", "{", "return", ";", "}", "codec", ".", "writeExpirationParams", "(", "byteBuf", ",", "lifespan", ",", "lifespanTimeUnit", ",", "maxIdle", ",", "maxIdleTimeUnit", ")", ";", "writeArray", "(", "byteBuf", ",", "value", ")", ";", "}" ]
Writes this modification to the {@link ByteBuf}. @param byteBuf the {@link ByteBuf} to write to. @param codec the {@link Codec} to use.
[ "Writes", "this", "modification", "to", "the", "{", "@link", "ByteBuf", "}", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/client/hotrod-client/src/main/java/org/infinispan/client/hotrod/impl/transaction/entry/Modification.java#L47-L59
JM-Lab/utils-java8
src/main/java/kr/jm/utils/helper/JMFiles.java
JMFiles.writeString
public static boolean writeString(String inputString, File targetFile) { if (!targetFile.exists()) { try { Files.write(targetFile.toPath(), inputString.getBytes()); } catch (IOException e) { return JMExceptionManager.handleExceptionAndReturnFalse(log, e, "writeString", inputString, targetFile); } } return true; }
java
public static boolean writeString(String inputString, File targetFile) { if (!targetFile.exists()) { try { Files.write(targetFile.toPath(), inputString.getBytes()); } catch (IOException e) { return JMExceptionManager.handleExceptionAndReturnFalse(log, e, "writeString", inputString, targetFile); } } return true; }
[ "public", "static", "boolean", "writeString", "(", "String", "inputString", ",", "File", "targetFile", ")", "{", "if", "(", "!", "targetFile", ".", "exists", "(", ")", ")", "{", "try", "{", "Files", ".", "write", "(", "targetFile", ".", "toPath", "(", ")", ",", "inputString", ".", "getBytes", "(", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "return", "JMExceptionManager", ".", "handleExceptionAndReturnFalse", "(", "log", ",", "e", ",", "\"writeString\"", ",", "inputString", ",", "targetFile", ")", ";", "}", "}", "return", "true", ";", "}" ]
Write string boolean. @param inputString the input string @param targetFile the target file @return the boolean
[ "Write", "string", "boolean", "." ]
train
https://github.com/JM-Lab/utils-java8/blob/9e407b3f28a7990418a1e877229fa8344f4d78a5/src/main/java/kr/jm/utils/helper/JMFiles.java#L91-L101
Azure/azure-sdk-for-java
privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java
PrivateZonesInner.createOrUpdateAsync
public Observable<PrivateZoneInner> createOrUpdateAsync(String resourceGroupName, String privateZoneName, PrivateZoneInner parameters, String ifMatch, String ifNoneMatch) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, privateZoneName, parameters, ifMatch, ifNoneMatch).map(new Func1<ServiceResponse<PrivateZoneInner>, PrivateZoneInner>() { @Override public PrivateZoneInner call(ServiceResponse<PrivateZoneInner> response) { return response.body(); } }); }
java
public Observable<PrivateZoneInner> createOrUpdateAsync(String resourceGroupName, String privateZoneName, PrivateZoneInner parameters, String ifMatch, String ifNoneMatch) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, privateZoneName, parameters, ifMatch, ifNoneMatch).map(new Func1<ServiceResponse<PrivateZoneInner>, PrivateZoneInner>() { @Override public PrivateZoneInner call(ServiceResponse<PrivateZoneInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PrivateZoneInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "privateZoneName", ",", "PrivateZoneInner", "parameters", ",", "String", "ifMatch", ",", "String", "ifNoneMatch", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "privateZoneName", ",", "parameters", ",", "ifMatch", ",", "ifNoneMatch", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "PrivateZoneInner", ">", ",", "PrivateZoneInner", ">", "(", ")", "{", "@", "Override", "public", "PrivateZoneInner", "call", "(", "ServiceResponse", "<", "PrivateZoneInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Creates or updates a Private DNS zone. Does not modify Links to virtual networks or DNS records within the zone. @param resourceGroupName The name of the resource group. @param privateZoneName The name of the Private DNS zone (without a terminating dot). @param parameters Parameters supplied to the CreateOrUpdate operation. @param ifMatch The ETag of the Private DNS zone. Omit this value to always overwrite the current zone. Specify the last-seen ETag value to prevent accidentally overwriting any concurrent changes. @param ifNoneMatch Set to '*' to allow a new Private DNS zone to be created, but to prevent updating an existing zone. Other values will be ignored. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "Private", "DNS", "zone", ".", "Does", "not", "modify", "Links", "to", "virtual", "networks", "or", "DNS", "records", "within", "the", "zone", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/privatedns/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/privatedns/v2018_09_01/implementation/PrivateZonesInner.java#L236-L243
sculptor/sculptor
sculptor-maven/sculptor-maven-plugin/src/main/java/org/sculptor/maven/plugin/GraphvizMojo.java
GraphvizMojo.executeDot
protected boolean executeDot(Set<String> dotFiles) throws MojoExecutionException { // Build executor for projects base directory MavenLogOutputStream stdout = getStdoutStream(); MavenLogOutputStream stderr = getStderrStream(); Executor exec = getExecutor(); exec.setWorkingDirectory(project.getBasedir()); exec.setStreamHandler(new PumpStreamHandler(stdout, stderr, System.in)); // Execute commandline and check return code try { int exitValue = exec.execute(getDotCommandLine(dotFiles)); if (exitValue == 0 && stdout.getErrorCount() == 0) { return true; } } catch (ExecuteException e) { // ignore } catch (IOException e) { // ignore } return false; }
java
protected boolean executeDot(Set<String> dotFiles) throws MojoExecutionException { // Build executor for projects base directory MavenLogOutputStream stdout = getStdoutStream(); MavenLogOutputStream stderr = getStderrStream(); Executor exec = getExecutor(); exec.setWorkingDirectory(project.getBasedir()); exec.setStreamHandler(new PumpStreamHandler(stdout, stderr, System.in)); // Execute commandline and check return code try { int exitValue = exec.execute(getDotCommandLine(dotFiles)); if (exitValue == 0 && stdout.getErrorCount() == 0) { return true; } } catch (ExecuteException e) { // ignore } catch (IOException e) { // ignore } return false; }
[ "protected", "boolean", "executeDot", "(", "Set", "<", "String", ">", "dotFiles", ")", "throws", "MojoExecutionException", "{", "// Build executor for projects base directory", "MavenLogOutputStream", "stdout", "=", "getStdoutStream", "(", ")", ";", "MavenLogOutputStream", "stderr", "=", "getStderrStream", "(", ")", ";", "Executor", "exec", "=", "getExecutor", "(", ")", ";", "exec", ".", "setWorkingDirectory", "(", "project", ".", "getBasedir", "(", ")", ")", ";", "exec", ".", "setStreamHandler", "(", "new", "PumpStreamHandler", "(", "stdout", ",", "stderr", ",", "System", ".", "in", ")", ")", ";", "// Execute commandline and check return code", "try", "{", "int", "exitValue", "=", "exec", ".", "execute", "(", "getDotCommandLine", "(", "dotFiles", ")", ")", ";", "if", "(", "exitValue", "==", "0", "&&", "stdout", ".", "getErrorCount", "(", ")", "==", "0", ")", "{", "return", "true", ";", "}", "}", "catch", "(", "ExecuteException", "e", ")", "{", "// ignore", "}", "catch", "(", "IOException", "e", ")", "{", "// ignore", "}", "return", "false", ";", "}" ]
Executes the command line tool <code>dot</code>. @param dotFiles list of dot files from the {@link AbstractGeneratorMojo#statusFile}
[ "Executes", "the", "command", "line", "tool", "<code", ">", "dot<", "/", "code", ">", "." ]
train
https://github.com/sculptor/sculptor/blob/38df06ceb7e40f5f52dbd53b1cd1d07ee11aade5/sculptor-maven/sculptor-maven-plugin/src/main/java/org/sculptor/maven/plugin/GraphvizMojo.java#L161-L183
jMotif/GI
src/main/java/net/seninp/gi/logic/GIUtils.java
GIUtils.getZeroIntervals
public static List<RuleInterval> getZeroIntervals(int[] coverageArray) { ArrayList<RuleInterval> res = new ArrayList<RuleInterval>(); int start = -1; boolean inInterval = false; int intervalsCounter = -1; // slide over the array from left to the right // for (int i = 0; i < coverageArray.length; i++) { if (0 == coverageArray[i] && !inInterval) { start = i; inInterval = true; } if (coverageArray[i] > 0 && inInterval) { res.add(new RuleInterval(intervalsCounter, start, i, 0)); inInterval = false; intervalsCounter--; } } // we need to check for the last interval here // if (inInterval) { res.add(new RuleInterval(intervalsCounter, start, coverageArray.length, 0)); } return res; }
java
public static List<RuleInterval> getZeroIntervals(int[] coverageArray) { ArrayList<RuleInterval> res = new ArrayList<RuleInterval>(); int start = -1; boolean inInterval = false; int intervalsCounter = -1; // slide over the array from left to the right // for (int i = 0; i < coverageArray.length; i++) { if (0 == coverageArray[i] && !inInterval) { start = i; inInterval = true; } if (coverageArray[i] > 0 && inInterval) { res.add(new RuleInterval(intervalsCounter, start, i, 0)); inInterval = false; intervalsCounter--; } } // we need to check for the last interval here // if (inInterval) { res.add(new RuleInterval(intervalsCounter, start, coverageArray.length, 0)); } return res; }
[ "public", "static", "List", "<", "RuleInterval", ">", "getZeroIntervals", "(", "int", "[", "]", "coverageArray", ")", "{", "ArrayList", "<", "RuleInterval", ">", "res", "=", "new", "ArrayList", "<", "RuleInterval", ">", "(", ")", ";", "int", "start", "=", "-", "1", ";", "boolean", "inInterval", "=", "false", ";", "int", "intervalsCounter", "=", "-", "1", ";", "// slide over the array from left to the right", "//", "for", "(", "int", "i", "=", "0", ";", "i", "<", "coverageArray", ".", "length", ";", "i", "++", ")", "{", "if", "(", "0", "==", "coverageArray", "[", "i", "]", "&&", "!", "inInterval", ")", "{", "start", "=", "i", ";", "inInterval", "=", "true", ";", "}", "if", "(", "coverageArray", "[", "i", "]", ">", "0", "&&", "inInterval", ")", "{", "res", ".", "add", "(", "new", "RuleInterval", "(", "intervalsCounter", ",", "start", ",", "i", ",", "0", ")", ")", ";", "inInterval", "=", "false", ";", "intervalsCounter", "--", ";", "}", "}", "// we need to check for the last interval here", "//", "if", "(", "inInterval", ")", "{", "res", ".", "add", "(", "new", "RuleInterval", "(", "intervalsCounter", ",", "start", ",", "coverageArray", ".", "length", ",", "0", ")", ")", ";", "}", "return", "res", ";", "}" ]
Run a quick scan along the time series coverage to find a zeroed intervals. @param coverageArray the coverage to analyze. @return set of zeroed intervals (if found).
[ "Run", "a", "quick", "scan", "along", "the", "time", "series", "coverage", "to", "find", "a", "zeroed", "intervals", "." ]
train
https://github.com/jMotif/GI/blob/381212dd4f193246a6df82bd46f0d2bcd04a68d6/src/main/java/net/seninp/gi/logic/GIUtils.java#L42-L74
bluejoe2008/elfinder-2.x-servlet
src/main/java/cn/bluejoe/elfinder/impl/DefaultFsService.java
DefaultFsService.findRecursively
private Collection<FsItemEx> findRecursively(FsItemFilter filter, FsItem root) { List<FsItemEx> results = new ArrayList<FsItemEx>(); FsVolume vol = root.getVolume(); for (FsItem child : vol.listChildren(root)) { if (vol.isFolder(child)) { results.addAll(findRecursively(filter, child)); } else { FsItemEx item = new FsItemEx(child, this); if (filter.accepts(item)) results.add(item); } } return results; }
java
private Collection<FsItemEx> findRecursively(FsItemFilter filter, FsItem root) { List<FsItemEx> results = new ArrayList<FsItemEx>(); FsVolume vol = root.getVolume(); for (FsItem child : vol.listChildren(root)) { if (vol.isFolder(child)) { results.addAll(findRecursively(filter, child)); } else { FsItemEx item = new FsItemEx(child, this); if (filter.accepts(item)) results.add(item); } } return results; }
[ "private", "Collection", "<", "FsItemEx", ">", "findRecursively", "(", "FsItemFilter", "filter", ",", "FsItem", "root", ")", "{", "List", "<", "FsItemEx", ">", "results", "=", "new", "ArrayList", "<", "FsItemEx", ">", "(", ")", ";", "FsVolume", "vol", "=", "root", ".", "getVolume", "(", ")", ";", "for", "(", "FsItem", "child", ":", "vol", ".", "listChildren", "(", "root", ")", ")", "{", "if", "(", "vol", ".", "isFolder", "(", "child", ")", ")", "{", "results", ".", "addAll", "(", "findRecursively", "(", "filter", ",", "child", ")", ")", ";", "}", "else", "{", "FsItemEx", "item", "=", "new", "FsItemEx", "(", "child", ",", "this", ")", ";", "if", "(", "filter", ".", "accepts", "(", "item", ")", ")", "results", ".", "add", "(", "item", ")", ";", "}", "}", "return", "results", ";", "}" ]
find files recursively in specific folder @param filter The filter to apply to select files. @param root The location in the hierarchy to search from. @return A collection of files that match the filter and have the root as a parent.
[ "find", "files", "recursively", "in", "specific", "folder" ]
train
https://github.com/bluejoe2008/elfinder-2.x-servlet/blob/83caa5c8ccb05a4139c87babb1b37b73248db9da/src/main/java/cn/bluejoe/elfinder/impl/DefaultFsService.java#L66-L86
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/http/HttpPipelineCallContext.java
HttpPipelineCallContext.setData
public void setData(String key, Object value) { this.data = this.data.addData(key, value); }
java
public void setData(String key, Object value) { this.data = this.data.addData(key, value); }
[ "public", "void", "setData", "(", "String", "key", ",", "Object", "value", ")", "{", "this", ".", "data", "=", "this", ".", "data", ".", "addData", "(", "key", ",", "value", ")", ";", "}" ]
Stores a key-value data in the context. @param key the key @param value the value
[ "Stores", "a", "key", "-", "value", "data", "in", "the", "context", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/http/HttpPipelineCallContext.java#L57-L59
elki-project/elki
elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/strategies/insert/MinimumEnlargementInsert.java
MinimumEnlargementInsert.choosePath
private IndexTreePath<E> choosePath(AbstractMTree<?, N, E, ?> tree, E object, IndexTreePath<E> subtree) { N node = tree.getNode(subtree.getEntry()); // leaf if(node.isLeaf()) { return subtree; } // Initialize from first: int bestIdx = 0; E bestEntry = node.getEntry(0); double bestDistance = tree.distance(object.getRoutingObjectID(), bestEntry.getRoutingObjectID()); // Iterate over remaining for(int i = 1; i < node.getNumEntries(); i++) { E entry = node.getEntry(i); double distance = tree.distance(object.getRoutingObjectID(), entry.getRoutingObjectID()); if(distance < bestDistance) { bestIdx = i; bestEntry = entry; bestDistance = distance; } } return choosePath(tree, object, new IndexTreePath<>(subtree, bestEntry, bestIdx)); }
java
private IndexTreePath<E> choosePath(AbstractMTree<?, N, E, ?> tree, E object, IndexTreePath<E> subtree) { N node = tree.getNode(subtree.getEntry()); // leaf if(node.isLeaf()) { return subtree; } // Initialize from first: int bestIdx = 0; E bestEntry = node.getEntry(0); double bestDistance = tree.distance(object.getRoutingObjectID(), bestEntry.getRoutingObjectID()); // Iterate over remaining for(int i = 1; i < node.getNumEntries(); i++) { E entry = node.getEntry(i); double distance = tree.distance(object.getRoutingObjectID(), entry.getRoutingObjectID()); if(distance < bestDistance) { bestIdx = i; bestEntry = entry; bestDistance = distance; } } return choosePath(tree, object, new IndexTreePath<>(subtree, bestEntry, bestIdx)); }
[ "private", "IndexTreePath", "<", "E", ">", "choosePath", "(", "AbstractMTree", "<", "?", ",", "N", ",", "E", ",", "?", ">", "tree", ",", "E", "object", ",", "IndexTreePath", "<", "E", ">", "subtree", ")", "{", "N", "node", "=", "tree", ".", "getNode", "(", "subtree", ".", "getEntry", "(", ")", ")", ";", "// leaf", "if", "(", "node", ".", "isLeaf", "(", ")", ")", "{", "return", "subtree", ";", "}", "// Initialize from first:", "int", "bestIdx", "=", "0", ";", "E", "bestEntry", "=", "node", ".", "getEntry", "(", "0", ")", ";", "double", "bestDistance", "=", "tree", ".", "distance", "(", "object", ".", "getRoutingObjectID", "(", ")", ",", "bestEntry", ".", "getRoutingObjectID", "(", ")", ")", ";", "// Iterate over remaining", "for", "(", "int", "i", "=", "1", ";", "i", "<", "node", ".", "getNumEntries", "(", ")", ";", "i", "++", ")", "{", "E", "entry", "=", "node", ".", "getEntry", "(", "i", ")", ";", "double", "distance", "=", "tree", ".", "distance", "(", "object", ".", "getRoutingObjectID", "(", ")", ",", "entry", ".", "getRoutingObjectID", "(", ")", ")", ";", "if", "(", "distance", "<", "bestDistance", ")", "{", "bestIdx", "=", "i", ";", "bestEntry", "=", "entry", ";", "bestDistance", "=", "distance", ";", "}", "}", "return", "choosePath", "(", "tree", ",", "object", ",", "new", "IndexTreePath", "<>", "(", "subtree", ",", "bestEntry", ",", "bestIdx", ")", ")", ";", "}" ]
Chooses the best path of the specified subtree for insertion of the given object. @param tree the tree to insert into @param object the entry to search @param subtree the subtree to be tested for insertion @return the path of the appropriate subtree to insert the given object
[ "Chooses", "the", "best", "path", "of", "the", "specified", "subtree", "for", "insertion", "of", "the", "given", "object", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-index-mtree/src/main/java/de/lmu/ifi/dbs/elki/index/tree/metrical/mtreevariants/strategies/insert/MinimumEnlargementInsert.java#L61-L86
qos-ch/slf4j
slf4j-simple/src/main/java/org/slf4j/simple/SimpleLogger.java
SimpleLogger.formatAndLog
private void formatAndLog(int level, String format, Object arg1, Object arg2) { if (!isLevelEnabled(level)) { return; } FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); log(level, tp.getMessage(), tp.getThrowable()); }
java
private void formatAndLog(int level, String format, Object arg1, Object arg2) { if (!isLevelEnabled(level)) { return; } FormattingTuple tp = MessageFormatter.format(format, arg1, arg2); log(level, tp.getMessage(), tp.getThrowable()); }
[ "private", "void", "formatAndLog", "(", "int", "level", ",", "String", "format", ",", "Object", "arg1", ",", "Object", "arg2", ")", "{", "if", "(", "!", "isLevelEnabled", "(", "level", ")", ")", "{", "return", ";", "}", "FormattingTuple", "tp", "=", "MessageFormatter", ".", "format", "(", "format", ",", "arg1", ",", "arg2", ")", ";", "log", "(", "level", ",", "tp", ".", "getMessage", "(", ")", ",", "tp", ".", "getThrowable", "(", ")", ")", ";", "}" ]
For formatted messages, first substitute arguments and then log. @param level @param format @param arg1 @param arg2
[ "For", "formatted", "messages", "first", "substitute", "arguments", "and", "then", "log", "." ]
train
https://github.com/qos-ch/slf4j/blob/905443f39fadd88a8dd2c467e44affd8cb072a4d/slf4j-simple/src/main/java/org/slf4j/simple/SimpleLogger.java#L350-L356
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/common/Similarity.java
Similarity.kendallsTau
public static double kendallsTau(double[] a, double[] b) { return kendallsTau(Vectors.asVector(a), Vectors.asVector(b)); }
java
public static double kendallsTau(double[] a, double[] b) { return kendallsTau(Vectors.asVector(a), Vectors.asVector(b)); }
[ "public", "static", "double", "kendallsTau", "(", "double", "[", "]", "a", ",", "double", "[", "]", "b", ")", "{", "return", "kendallsTau", "(", "Vectors", ".", "asVector", "(", "a", ")", ",", "Vectors", ".", "asVector", "(", "b", ")", ")", ";", "}" ]
Computes <a href="http://en.wikipedia.org/wiki/Kendall%27s_tau">Kendall's tau</a> of the values in the two arrays. This method uses tau-b, which is suitable for arrays with duplicate values. @throws IllegalArgumentException when the length of the two arrays are not the same.
[ "Computes", "<a", "href", "=", "http", ":", "//", "en", ".", "wikipedia", ".", "org", "/", "wiki", "/", "Kendall%27s_tau", ">", "Kendall", "s", "tau<", "/", "a", ">", "of", "the", "values", "in", "the", "two", "arrays", ".", "This", "method", "uses", "tau", "-", "b", "which", "is", "suitable", "for", "arrays", "with", "duplicate", "values", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/Similarity.java#L2031-L2033
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Parameters.java
Parameters.setDate
@NonNull public Parameters setDate(@NonNull String name, Date value) { return setValue(name, value); }
java
@NonNull public Parameters setDate(@NonNull String name, Date value) { return setValue(name, value); }
[ "@", "NonNull", "public", "Parameters", "setDate", "(", "@", "NonNull", "String", "name", ",", "Date", "value", ")", "{", "return", "setValue", "(", "name", ",", "value", ")", ";", "}" ]
Set a date value to the query parameter referenced by the given name. A query parameter is defined by using the Expression's parameter(String name) function. @param name The parameter name. @param value The date value. @return The self object.
[ "Set", "a", "date", "value", "to", "the", "query", "parameter", "referenced", "by", "the", "given", "name", ".", "A", "query", "parameter", "is", "defined", "by", "using", "the", "Expression", "s", "parameter", "(", "String", "name", ")", "function", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Parameters.java#L170-L173
RestComm/media-core
rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTCPCryptoContext.java
SRTCPCryptoContext.processPacketAESCM
public void processPacketAESCM(RawPacket pkt, int index) { long ssrc = pkt.getRTCPSSRC(); /* Compute the CM IV (refer to chapter 4.1.1 in RFC 3711): * * k_s XX XX XX XX XX XX XX XX XX XX XX XX XX XX * SSRC XX XX XX XX * index XX XX XX XX * ------------------------------------------------------XOR * IV XX XX XX XX XX XX XX XX XX XX XX XX XX XX 00 00 * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */ ivStore[0] = saltKey[0]; ivStore[1] = saltKey[1]; ivStore[2] = saltKey[2]; ivStore[3] = saltKey[3]; // The shifts transform the ssrc and index into network order ivStore[4] = (byte) (((ssrc >> 24) & 0xff) ^ this.saltKey[4]); ivStore[5] = (byte) (((ssrc >> 16) & 0xff) ^ this.saltKey[5]); ivStore[6] = (byte) (((ssrc >> 8) & 0xff) ^ this.saltKey[6]); ivStore[7] = (byte) ((ssrc & 0xff) ^ this.saltKey[7]); ivStore[8] = saltKey[8]; ivStore[9] = saltKey[9]; ivStore[10] = (byte) (((index >> 24) & 0xff) ^ this.saltKey[10]); ivStore[11] = (byte) (((index >> 16) & 0xff) ^ this.saltKey[11]); ivStore[12] = (byte) (((index >> 8) & 0xff) ^ this.saltKey[12]); ivStore[13] = (byte) ((index & 0xff) ^ this.saltKey[13]); ivStore[14] = ivStore[15] = 0; // Encrypted part excludes fixed header (8 bytes) final int payloadOffset = 8; final int payloadLength = pkt.getLength() - payloadOffset; cipherCtr.process(cipher, pkt.getBuffer(), payloadOffset, payloadLength, ivStore); }
java
public void processPacketAESCM(RawPacket pkt, int index) { long ssrc = pkt.getRTCPSSRC(); /* Compute the CM IV (refer to chapter 4.1.1 in RFC 3711): * * k_s XX XX XX XX XX XX XX XX XX XX XX XX XX XX * SSRC XX XX XX XX * index XX XX XX XX * ------------------------------------------------------XOR * IV XX XX XX XX XX XX XX XX XX XX XX XX XX XX 00 00 * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 */ ivStore[0] = saltKey[0]; ivStore[1] = saltKey[1]; ivStore[2] = saltKey[2]; ivStore[3] = saltKey[3]; // The shifts transform the ssrc and index into network order ivStore[4] = (byte) (((ssrc >> 24) & 0xff) ^ this.saltKey[4]); ivStore[5] = (byte) (((ssrc >> 16) & 0xff) ^ this.saltKey[5]); ivStore[6] = (byte) (((ssrc >> 8) & 0xff) ^ this.saltKey[6]); ivStore[7] = (byte) ((ssrc & 0xff) ^ this.saltKey[7]); ivStore[8] = saltKey[8]; ivStore[9] = saltKey[9]; ivStore[10] = (byte) (((index >> 24) & 0xff) ^ this.saltKey[10]); ivStore[11] = (byte) (((index >> 16) & 0xff) ^ this.saltKey[11]); ivStore[12] = (byte) (((index >> 8) & 0xff) ^ this.saltKey[12]); ivStore[13] = (byte) ((index & 0xff) ^ this.saltKey[13]); ivStore[14] = ivStore[15] = 0; // Encrypted part excludes fixed header (8 bytes) final int payloadOffset = 8; final int payloadLength = pkt.getLength() - payloadOffset; cipherCtr.process(cipher, pkt.getBuffer(), payloadOffset, payloadLength, ivStore); }
[ "public", "void", "processPacketAESCM", "(", "RawPacket", "pkt", ",", "int", "index", ")", "{", "long", "ssrc", "=", "pkt", ".", "getRTCPSSRC", "(", ")", ";", "/* Compute the CM IV (refer to chapter 4.1.1 in RFC 3711):\r\n *\r\n * k_s XX XX XX XX XX XX XX XX XX XX XX XX XX XX\r\n * SSRC XX XX XX XX\r\n * index XX XX XX XX\r\n * ------------------------------------------------------XOR\r\n * IV XX XX XX XX XX XX XX XX XX XX XX XX XX XX 00 00\r\n * 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\r\n */", "ivStore", "[", "0", "]", "=", "saltKey", "[", "0", "]", ";", "ivStore", "[", "1", "]", "=", "saltKey", "[", "1", "]", ";", "ivStore", "[", "2", "]", "=", "saltKey", "[", "2", "]", ";", "ivStore", "[", "3", "]", "=", "saltKey", "[", "3", "]", ";", "// The shifts transform the ssrc and index into network order\r", "ivStore", "[", "4", "]", "=", "(", "byte", ")", "(", "(", "(", "ssrc", ">>", "24", ")", "&", "0xff", ")", "^", "this", ".", "saltKey", "[", "4", "]", ")", ";", "ivStore", "[", "5", "]", "=", "(", "byte", ")", "(", "(", "(", "ssrc", ">>", "16", ")", "&", "0xff", ")", "^", "this", ".", "saltKey", "[", "5", "]", ")", ";", "ivStore", "[", "6", "]", "=", "(", "byte", ")", "(", "(", "(", "ssrc", ">>", "8", ")", "&", "0xff", ")", "^", "this", ".", "saltKey", "[", "6", "]", ")", ";", "ivStore", "[", "7", "]", "=", "(", "byte", ")", "(", "(", "ssrc", "&", "0xff", ")", "^", "this", ".", "saltKey", "[", "7", "]", ")", ";", "ivStore", "[", "8", "]", "=", "saltKey", "[", "8", "]", ";", "ivStore", "[", "9", "]", "=", "saltKey", "[", "9", "]", ";", "ivStore", "[", "10", "]", "=", "(", "byte", ")", "(", "(", "(", "index", ">>", "24", ")", "&", "0xff", ")", "^", "this", ".", "saltKey", "[", "10", "]", ")", ";", "ivStore", "[", "11", "]", "=", "(", "byte", ")", "(", "(", "(", "index", ">>", "16", ")", "&", "0xff", ")", "^", "this", ".", "saltKey", "[", "11", "]", ")", ";", "ivStore", "[", "12", "]", "=", "(", "byte", ")", "(", "(", "(", "index", ">>", "8", ")", "&", "0xff", ")", "^", "this", ".", "saltKey", "[", "12", "]", ")", ";", "ivStore", "[", "13", "]", "=", "(", "byte", ")", "(", "(", "index", "&", "0xff", ")", "^", "this", ".", "saltKey", "[", "13", "]", ")", ";", "ivStore", "[", "14", "]", "=", "ivStore", "[", "15", "]", "=", "0", ";", "// Encrypted part excludes fixed header (8 bytes) \r", "final", "int", "payloadOffset", "=", "8", ";", "final", "int", "payloadLength", "=", "pkt", ".", "getLength", "(", ")", "-", "payloadOffset", ";", "cipherCtr", ".", "process", "(", "cipher", ",", "pkt", ".", "getBuffer", "(", ")", ",", "payloadOffset", ",", "payloadLength", ",", "ivStore", ")", ";", "}" ]
Perform Counter Mode AES encryption / decryption @param pkt the RTP packet to be encrypted / decrypted
[ "Perform", "Counter", "Mode", "AES", "encryption", "/", "decryption" ]
train
https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/rtp/src/main/java/org/restcomm/media/core/rtp/crypto/SRTCPCryptoContext.java#L372-L409
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.processOldJdk
boolean processOldJdk(String jdkHome, Collection<String> classNames) throws IOException { String RTJAR = jdkHome + "/jre/lib/rt.jar"; String CSJAR = jdkHome + "/jre/lib/charsets.jar"; bootClassPath.add(0, new File(RTJAR)); bootClassPath.add(1, new File(CSJAR)); options.add("-source"); options.add("8"); if (classNames.isEmpty()) { return doJarFile(RTJAR); } else { return doClassNames(classNames); } }
java
boolean processOldJdk(String jdkHome, Collection<String> classNames) throws IOException { String RTJAR = jdkHome + "/jre/lib/rt.jar"; String CSJAR = jdkHome + "/jre/lib/charsets.jar"; bootClassPath.add(0, new File(RTJAR)); bootClassPath.add(1, new File(CSJAR)); options.add("-source"); options.add("8"); if (classNames.isEmpty()) { return doJarFile(RTJAR); } else { return doClassNames(classNames); } }
[ "boolean", "processOldJdk", "(", "String", "jdkHome", ",", "Collection", "<", "String", ">", "classNames", ")", "throws", "IOException", "{", "String", "RTJAR", "=", "jdkHome", "+", "\"/jre/lib/rt.jar\"", ";", "String", "CSJAR", "=", "jdkHome", "+", "\"/jre/lib/charsets.jar\"", ";", "bootClassPath", ".", "add", "(", "0", ",", "new", "File", "(", "RTJAR", ")", ")", ";", "bootClassPath", ".", "add", "(", "1", ",", "new", "File", "(", "CSJAR", ")", ")", ";", "options", ".", "add", "(", "\"-source\"", ")", ";", "options", ".", "add", "(", "\"8\"", ")", ";", "if", "(", "classNames", ".", "isEmpty", "(", ")", ")", "{", "return", "doJarFile", "(", "RTJAR", ")", ";", "}", "else", "{", "return", "doClassNames", "(", "classNames", ")", ";", "}", "}" ]
Processes named class files from rt.jar of a JDK version 7 or 8. If classNames is empty, processes all classes. @param jdkHome the path to the "home" of the JDK to process @param classNames the names of classes to process @return true for success, false for failure @throws IOException if an I/O error occurs
[ "Processes", "named", "class", "files", "from", "rt", ".", "jar", "of", "a", "JDK", "version", "7", "or", "8", ".", "If", "classNames", "is", "empty", "processes", "all", "classes", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L300-L314
tzaeschke/zoodb
src/org/zoodb/internal/query/TypeConverterTools.java
TypeConverterTools.checkAssignability
public static void checkAssignability(Class<?> c1, Class<?> c2) { COMPARISON_TYPE ct1 = COMPARISON_TYPE.fromClass(c1); COMPARISON_TYPE ct2 = COMPARISON_TYPE.fromClass(c2); try { COMPARISON_TYPE.fromOperands(ct1, ct2); } catch (Exception e) { throw DBLogger.newUser("Cannot assign " + c2 + " to " + c1, e); } }
java
public static void checkAssignability(Class<?> c1, Class<?> c2) { COMPARISON_TYPE ct1 = COMPARISON_TYPE.fromClass(c1); COMPARISON_TYPE ct2 = COMPARISON_TYPE.fromClass(c2); try { COMPARISON_TYPE.fromOperands(ct1, ct2); } catch (Exception e) { throw DBLogger.newUser("Cannot assign " + c2 + " to " + c1, e); } }
[ "public", "static", "void", "checkAssignability", "(", "Class", "<", "?", ">", "c1", ",", "Class", "<", "?", ">", "c2", ")", "{", "COMPARISON_TYPE", "ct1", "=", "COMPARISON_TYPE", ".", "fromClass", "(", "c1", ")", ";", "COMPARISON_TYPE", "ct2", "=", "COMPARISON_TYPE", ".", "fromClass", "(", "c2", ")", ";", "try", "{", "COMPARISON_TYPE", ".", "fromOperands", "(", "ct1", ",", "ct2", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "DBLogger", ".", "newUser", "(", "\"Cannot assign \"", "+", "c2", "+", "\" to \"", "+", "c1", ",", "e", ")", ";", "}", "}" ]
This assumes that comparability implies assignability or convertability... @param c1 type #1 @param c2 type #2
[ "This", "assumes", "that", "comparability", "implies", "assignability", "or", "convertability", "..." ]
train
https://github.com/tzaeschke/zoodb/blob/058d0ff161a8ee9d53244c433aca97ee9c654410/src/org/zoodb/internal/query/TypeConverterTools.java#L183-L191
alkacon/opencms-core
src/org/opencms/importexport/CmsImportExportManager.java
CmsImportExportManager.exportData
public void exportData(CmsObject cms, I_CmsImportExportHandler handler, I_CmsReport report) throws CmsConfigurationException, CmsImportExportException, CmsRoleViolationException { OpenCms.getRoleManager().checkRole(cms, CmsRole.DATABASE_MANAGER); handler.exportData(cms, report); }
java
public void exportData(CmsObject cms, I_CmsImportExportHandler handler, I_CmsReport report) throws CmsConfigurationException, CmsImportExportException, CmsRoleViolationException { OpenCms.getRoleManager().checkRole(cms, CmsRole.DATABASE_MANAGER); handler.exportData(cms, report); }
[ "public", "void", "exportData", "(", "CmsObject", "cms", ",", "I_CmsImportExportHandler", "handler", ",", "I_CmsReport", "report", ")", "throws", "CmsConfigurationException", ",", "CmsImportExportException", ",", "CmsRoleViolationException", "{", "OpenCms", ".", "getRoleManager", "(", ")", ".", "checkRole", "(", "cms", ",", "CmsRole", ".", "DATABASE_MANAGER", ")", ";", "handler", ".", "exportData", "(", "cms", ",", "report", ")", ";", "}" ]
Checks if the current user has permissions to export Cms data of a specified export handler, and if so, triggers the handler to write the export.<p> @param cms the cms context @param handler handler containing the export data @param report the output report @throws CmsRoleViolationException if the current user is not a allowed to export the OpenCms database @throws CmsImportExportException if operation was not successful @throws CmsConfigurationException if something goes wrong @see I_CmsImportExportHandler
[ "Checks", "if", "the", "current", "user", "has", "permissions", "to", "export", "Cms", "data", "of", "a", "specified", "export", "handler", "and", "if", "so", "triggers", "the", "handler", "to", "write", "the", "export", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/importexport/CmsImportExportManager.java#L660-L665
pravega/pravega
common/src/main/java/io/pravega/common/LoggerHelpers.java
LoggerHelpers.traceEnterWithContext
public static long traceEnterWithContext(Logger log, String context, String method, Object... args) { if (!log.isTraceEnabled()) { return 0; } long time = CURRENT_TIME.get(); log.trace("ENTER {}::{}@{} {}.", context, method, time, args); return time; }
java
public static long traceEnterWithContext(Logger log, String context, String method, Object... args) { if (!log.isTraceEnabled()) { return 0; } long time = CURRENT_TIME.get(); log.trace("ENTER {}::{}@{} {}.", context, method, time, args); return time; }
[ "public", "static", "long", "traceEnterWithContext", "(", "Logger", "log", ",", "String", "context", ",", "String", "method", ",", "Object", "...", "args", ")", "{", "if", "(", "!", "log", ".", "isTraceEnabled", "(", ")", ")", "{", "return", "0", ";", "}", "long", "time", "=", "CURRENT_TIME", ".", "get", "(", ")", ";", "log", ".", "trace", "(", "\"ENTER {}::{}@{} {}.\"", ",", "context", ",", "method", ",", "time", ",", "args", ")", ";", "return", "time", ";", "}" ]
Traces the fact that a method entry has occurred. @param log The Logger to log to. @param context Identifying context for the operation. For example, this can be used to differentiate between different instances of the same object. @param method The name of the method. @param args The arguments to the method. @return A generated identifier that can be used to correlate this traceEnter with its corresponding traceLeave. This is usually generated from the current System time, and when used with traceLeave it can be used to log elapsed call times.
[ "Traces", "the", "fact", "that", "a", "method", "entry", "has", "occurred", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/LoggerHelpers.java#L62-L70
entrusc/Pi-RC-Switch
src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java
RCSwitch.switchOn
public void switchOn(BitSet switchGroupAddress, int switchCode) { if (switchGroupAddress.length() > 5) { throw new IllegalArgumentException("switch group address has more than 5 bits!"); } this.sendTriState(this.getCodeWordA(switchGroupAddress, switchCode, true)); }
java
public void switchOn(BitSet switchGroupAddress, int switchCode) { if (switchGroupAddress.length() > 5) { throw new IllegalArgumentException("switch group address has more than 5 bits!"); } this.sendTriState(this.getCodeWordA(switchGroupAddress, switchCode, true)); }
[ "public", "void", "switchOn", "(", "BitSet", "switchGroupAddress", ",", "int", "switchCode", ")", "{", "if", "(", "switchGroupAddress", ".", "length", "(", ")", ">", "5", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"switch group address has more than 5 bits!\"", ")", ";", "}", "this", ".", "sendTriState", "(", "this", ".", "getCodeWordA", "(", "switchGroupAddress", ",", "switchCode", ",", "true", ")", ")", ";", "}" ]
Switch a remote switch on (Type A with 10 pole DIP switches) @param switchGroupAddress Code of the switch group (refers to DIP switches 1..5 where "1" = on and "0" = off, if all DIP switches are on it's "11111") @param switchCode Number of the switch itself (1..4)
[ "Switch", "a", "remote", "switch", "on", "(", "Type", "A", "with", "10", "pole", "DIP", "switches", ")" ]
train
https://github.com/entrusc/Pi-RC-Switch/blob/3a7433074a3382154cfc31c086eee75e928aced7/src/main/java/de/pi3g/pi/rcswitch/RCSwitch.java#L89-L94
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.hosting_privateDatabase_serviceName_ram_duration_GET
public OvhOrder hosting_privateDatabase_serviceName_ram_duration_GET(String serviceName, String duration, OvhAvailableRamSizeEnum ram) throws IOException { String qPath = "/order/hosting/privateDatabase/{serviceName}/ram/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "ram", ram); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder hosting_privateDatabase_serviceName_ram_duration_GET(String serviceName, String duration, OvhAvailableRamSizeEnum ram) throws IOException { String qPath = "/order/hosting/privateDatabase/{serviceName}/ram/{duration}"; StringBuilder sb = path(qPath, serviceName, duration); query(sb, "ram", ram); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "hosting_privateDatabase_serviceName_ram_duration_GET", "(", "String", "serviceName", ",", "String", "duration", ",", "OvhAvailableRamSizeEnum", "ram", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/hosting/privateDatabase/{serviceName}/ram/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "duration", ")", ";", "query", "(", "sb", ",", "\"ram\"", ",", "ram", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Get prices and contracts information REST: GET /order/hosting/privateDatabase/{serviceName}/ram/{duration} @param ram [required] Private database ram size @param serviceName [required] The internal name of your private database @param duration [required] Duration
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L5168-L5174
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/Services.java
Services.startServices
public static void startServices(IServiceManager manager) { final List<Service> otherServices = new ArrayList<>(); final List<Service> infraServices = new ArrayList<>(); final LinkedList<DependencyNode> serviceQueue = new LinkedList<>(); final Accessors accessors = new StartingPhaseAccessors(); // Build the dependency graph buildDependencyGraph(manager, serviceQueue, infraServices, otherServices, accessors); // Launch the services runDependencyGraph(serviceQueue, infraServices, otherServices, accessors); manager.awaitHealthy(); }
java
public static void startServices(IServiceManager manager) { final List<Service> otherServices = new ArrayList<>(); final List<Service> infraServices = new ArrayList<>(); final LinkedList<DependencyNode> serviceQueue = new LinkedList<>(); final Accessors accessors = new StartingPhaseAccessors(); // Build the dependency graph buildDependencyGraph(manager, serviceQueue, infraServices, otherServices, accessors); // Launch the services runDependencyGraph(serviceQueue, infraServices, otherServices, accessors); manager.awaitHealthy(); }
[ "public", "static", "void", "startServices", "(", "IServiceManager", "manager", ")", "{", "final", "List", "<", "Service", ">", "otherServices", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "List", "<", "Service", ">", "infraServices", "=", "new", "ArrayList", "<>", "(", ")", ";", "final", "LinkedList", "<", "DependencyNode", ">", "serviceQueue", "=", "new", "LinkedList", "<>", "(", ")", ";", "final", "Accessors", "accessors", "=", "new", "StartingPhaseAccessors", "(", ")", ";", "// Build the dependency graph", "buildDependencyGraph", "(", "manager", ",", "serviceQueue", ",", "infraServices", ",", "otherServices", ",", "accessors", ")", ";", "// Launch the services", "runDependencyGraph", "(", "serviceQueue", ",", "infraServices", ",", "otherServices", ",", "accessors", ")", ";", "manager", ".", "awaitHealthy", "(", ")", ";", "}" ]
Start the services associated to the given service manager. <p>This starting function supports the {@link DependentService prioritized services}. @param manager the manager of the services to start.
[ "Start", "the", "services", "associated", "to", "the", "given", "service", "manager", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/services/Services.java#L75-L88
protostuff/protostuff
protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java
XmlIOUtil.writeTo
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema) throws IOException { writeTo(out, message, schema, DEFAULT_OUTPUT_FACTORY); }
java
public static <T> void writeTo(OutputStream out, T message, Schema<T> schema) throws IOException { writeTo(out, message, schema, DEFAULT_OUTPUT_FACTORY); }
[ "public", "static", "<", "T", ">", "void", "writeTo", "(", "OutputStream", "out", ",", "T", "message", ",", "Schema", "<", "T", ">", "schema", ")", "throws", "IOException", "{", "writeTo", "(", "out", ",", "message", ",", "schema", ",", "DEFAULT_OUTPUT_FACTORY", ")", ";", "}" ]
Serializes the {@code message} into an {@link OutputStream} using the given {@code schema}.
[ "Serializes", "the", "{" ]
train
https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-xml/src/main/java/io/protostuff/XmlIOUtil.java#L353-L357
alibaba/Tangram-Android
tangram/src/main/java/com/tmall/wireless/tangram/support/SimpleClickSupport.java
SimpleClickSupport.onClick
public void onClick(View targetView, BaseCell cell, int eventType) { if (cell instanceof Cell) { onClick(targetView, (Cell) cell, eventType); } else { onClick(targetView, cell, eventType, null); } }
java
public void onClick(View targetView, BaseCell cell, int eventType) { if (cell instanceof Cell) { onClick(targetView, (Cell) cell, eventType); } else { onClick(targetView, cell, eventType, null); } }
[ "public", "void", "onClick", "(", "View", "targetView", ",", "BaseCell", "cell", ",", "int", "eventType", ")", "{", "if", "(", "cell", "instanceof", "Cell", ")", "{", "onClick", "(", "targetView", ",", "(", "Cell", ")", "cell", ",", "eventType", ")", ";", "}", "else", "{", "onClick", "(", "targetView", ",", "cell", ",", "eventType", ",", "null", ")", ";", "}", "}" ]
Handler click event on item @param targetView the view that trigger the click event, not the view respond the cell! @param cell the corresponding cell @param eventType click event type, defined by developer.
[ "Handler", "click", "event", "on", "item" ]
train
https://github.com/alibaba/Tangram-Android/blob/caa57f54e009c8dacd34a2322d5761956ebed321/tangram/src/main/java/com/tmall/wireless/tangram/support/SimpleClickSupport.java#L124-L130
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/FileUtils.java
FileUtils.toDocument
public static Document toDocument(final String aFilePath, final String aPattern) throws FileNotFoundException, ParserConfigurationException { return toDocument(aFilePath, aPattern, false); }
java
public static Document toDocument(final String aFilePath, final String aPattern) throws FileNotFoundException, ParserConfigurationException { return toDocument(aFilePath, aPattern, false); }
[ "public", "static", "Document", "toDocument", "(", "final", "String", "aFilePath", ",", "final", "String", "aPattern", ")", "throws", "FileNotFoundException", ",", "ParserConfigurationException", "{", "return", "toDocument", "(", "aFilePath", ",", "aPattern", ",", "false", ")", ";", "}" ]
Returns an XML Document representing the file structure found at the supplied file system path. Files included in the representation will match the supplied regular expression pattern. This method doesn't descend through the directory structure. @param aFilePath The directory from which the structural representation should be built @param aPattern A regular expression pattern which files included in the Element should match @return An XML Document representation of the directory structure @throws FileNotFoundException If the supplied directory isn't found @throws ParserConfigurationException If the default XML parser for the JRE isn't configured correctly
[ "Returns", "an", "XML", "Document", "representing", "the", "file", "structure", "found", "at", "the", "supplied", "file", "system", "path", ".", "Files", "included", "in", "the", "representation", "will", "match", "the", "supplied", "regular", "expression", "pattern", ".", "This", "method", "doesn", "t", "descend", "through", "the", "directory", "structure", "." ]
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/FileUtils.java#L293-L296
johnkil/Android-RobotoTextView
robototextview/src/main/java/com/devspark/robototextview/RobotoTypefaces.java
RobotoTypefaces.obtainTypeface
@NonNull public static Typeface obtainTypeface(@NonNull Context context, @RobotoTypeface int typefaceValue) { Typeface typeface = typefacesCache.get(typefaceValue); if (typeface == null) { typeface = createTypeface(context, typefaceValue); typefacesCache.put(typefaceValue, typeface); } return typeface; }
java
@NonNull public static Typeface obtainTypeface(@NonNull Context context, @RobotoTypeface int typefaceValue) { Typeface typeface = typefacesCache.get(typefaceValue); if (typeface == null) { typeface = createTypeface(context, typefaceValue); typefacesCache.put(typefaceValue, typeface); } return typeface; }
[ "@", "NonNull", "public", "static", "Typeface", "obtainTypeface", "(", "@", "NonNull", "Context", "context", ",", "@", "RobotoTypeface", "int", "typefaceValue", ")", "{", "Typeface", "typeface", "=", "typefacesCache", ".", "get", "(", "typefaceValue", ")", ";", "if", "(", "typeface", "==", "null", ")", "{", "typeface", "=", "createTypeface", "(", "context", ",", "typefaceValue", ")", ";", "typefacesCache", ".", "put", "(", "typefaceValue", ",", "typeface", ")", ";", "}", "return", "typeface", ";", "}" ]
Obtain typeface. @param context The Context the widget is running in, through which it can access the current theme, resources, etc. @param typefaceValue The value of "robotoTypeface" attribute @return specify {@link Typeface} or throws IllegalArgumentException if unknown `robotoTypeface` attribute value.
[ "Obtain", "typeface", "." ]
train
https://github.com/johnkil/Android-RobotoTextView/blob/1341602f16c08057dddd193411e7dab96f963b77/robototextview/src/main/java/com/devspark/robototextview/RobotoTypefaces.java#L168-L176
Netflix/netflix-graph
src/main/java/com/netflix/nfgraph/compressed/NFCompressedGraph.java
NFCompressedGraph.readFrom
public static NFCompressedGraph readFrom(InputStream is, ByteSegmentPool memoryPool) throws IOException { NFCompressedGraphDeserializer deserializer = new NFCompressedGraphDeserializer(); return deserializer.deserialize(is, memoryPool); }
java
public static NFCompressedGraph readFrom(InputStream is, ByteSegmentPool memoryPool) throws IOException { NFCompressedGraphDeserializer deserializer = new NFCompressedGraphDeserializer(); return deserializer.deserialize(is, memoryPool); }
[ "public", "static", "NFCompressedGraph", "readFrom", "(", "InputStream", "is", ",", "ByteSegmentPool", "memoryPool", ")", "throws", "IOException", "{", "NFCompressedGraphDeserializer", "deserializer", "=", "new", "NFCompressedGraphDeserializer", "(", ")", ";", "return", "deserializer", ".", "deserialize", "(", "is", ",", "memoryPool", ")", ";", "}" ]
When using a {@link ByteSegmentPool}, this method will borrow arrays used to construct the NFCompressedGraph from that pool. <p> Note that because the {@link ByteSegmentPool} is NOT thread-safe, this this call is also NOT thread-safe. It is up to implementations to ensure that only a single update thread is accessing this memory pool at any given time.
[ "When", "using", "a", "{" ]
train
https://github.com/Netflix/netflix-graph/blob/ee129252a08a9f51dd296d6fca2f0b28b7be284e/src/main/java/com/netflix/nfgraph/compressed/NFCompressedGraph.java#L251-L254
salesforce/Argus
ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java
InterpolateTransform.putDataPoint
private void putDataPoint(int i, Entry<Long, Double> datapoint) { timestamps[i] = datapoint.getKey(); values[i] = datapoint.getValue(); }
java
private void putDataPoint(int i, Entry<Long, Double> datapoint) { timestamps[i] = datapoint.getKey(); values[i] = datapoint.getValue(); }
[ "private", "void", "putDataPoint", "(", "int", "i", ",", "Entry", "<", "Long", ",", "Double", ">", "datapoint", ")", "{", "timestamps", "[", "i", "]", "=", "datapoint", ".", "getKey", "(", ")", ";", "values", "[", "i", "]", "=", "datapoint", ".", "getValue", "(", ")", ";", "}" ]
Puts the next data point of an iterator in the next section of internal buffer. @param i The index of the iterator. @param datapoint The last data point returned by that iterator.
[ "Puts", "the", "next", "data", "point", "of", "an", "iterator", "in", "the", "next", "section", "of", "internal", "buffer", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusCore/src/main/java/com/salesforce/dva/argus/service/metric/transform/InterpolateTransform.java#L226-L229
rzwitserloot/lombok
src/core/lombok/core/handlers/HandlerUtil.java
HandlerUtil.checkName
public static boolean checkName(String nameSpec, String identifier, LombokNode<?, ?, ?> errorNode) { if (identifier.isEmpty()) { errorNode.addError(nameSpec + " cannot be the empty string."); return false; } if (!JavaIdentifiers.isValidJavaIdentifier(identifier)) { errorNode.addError(nameSpec + " must be a valid java identifier."); return false; } return true; }
java
public static boolean checkName(String nameSpec, String identifier, LombokNode<?, ?, ?> errorNode) { if (identifier.isEmpty()) { errorNode.addError(nameSpec + " cannot be the empty string."); return false; } if (!JavaIdentifiers.isValidJavaIdentifier(identifier)) { errorNode.addError(nameSpec + " must be a valid java identifier."); return false; } return true; }
[ "public", "static", "boolean", "checkName", "(", "String", "nameSpec", ",", "String", "identifier", ",", "LombokNode", "<", "?", ",", "?", ",", "?", ">", "errorNode", ")", "{", "if", "(", "identifier", ".", "isEmpty", "(", ")", ")", "{", "errorNode", ".", "addError", "(", "nameSpec", "+", "\" cannot be the empty string.\"", ")", ";", "return", "false", ";", "}", "if", "(", "!", "JavaIdentifiers", ".", "isValidJavaIdentifier", "(", "identifier", ")", ")", "{", "errorNode", ".", "addError", "(", "nameSpec", "+", "\" must be a valid java identifier.\"", ")", ";", "return", "false", ";", "}", "return", "true", ";", "}" ]
Checks if the given name is a valid identifier. If it is, this returns {@code true} and does nothing else. If it isn't, this returns {@code false} and adds an error message to the supplied node.
[ "Checks", "if", "the", "given", "name", "is", "a", "valid", "identifier", "." ]
train
https://github.com/rzwitserloot/lombok/blob/75601240760bd81ff95fcde7a1b8185769ce64e8/src/core/lombok/core/handlers/HandlerUtil.java#L310-L322
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java
ToUnknownStream.startDTD
public void startDTD(String name, String publicId, String systemId) throws SAXException { m_handler.startDTD(name, publicId, systemId); }
java
public void startDTD(String name, String publicId, String systemId) throws SAXException { m_handler.startDTD(name, publicId, systemId); }
[ "public", "void", "startDTD", "(", "String", "name", ",", "String", "publicId", ",", "String", "systemId", ")", "throws", "SAXException", "{", "m_handler", ".", "startDTD", "(", "name", ",", "publicId", ",", "systemId", ")", ";", "}" ]
Pass the call on to the underlying handler @see org.xml.sax.ext.LexicalHandler#startDTD(String, String, String)
[ "Pass", "the", "call", "on", "to", "the", "underlying", "handler" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToUnknownStream.java#L944-L948
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerSegmentUrl.java
CustomerSegmentUrl.getSegmentUrl
public static MozuUrl getSegmentUrl(Integer id, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/segments/{id}?responseFields={responseFields}"); formatter.formatUrl("id", id); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getSegmentUrl(Integer id, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/segments/{id}?responseFields={responseFields}"); formatter.formatUrl("id", id); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getSegmentUrl", "(", "Integer", "id", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/customer/segments/{id}?responseFields={responseFields}\"", ")", ";", "formatter", ".", "formatUrl", "(", "\"id\"", ",", "id", ")", ";", "formatter", ".", "formatUrl", "(", "\"responseFields\"", ",", "responseFields", ")", ";", "return", "new", "MozuUrl", "(", "formatter", ".", "getResourceUrl", "(", ")", ",", "MozuUrl", ".", "UrlLocation", ".", "TENANT_POD", ")", ";", "}" ]
Get Resource Url for GetSegment @param id Unique identifier of the customer segment to retrieve. @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", "GetSegment" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/commerce/customer/CustomerSegmentUrl.java#L42-L48
VueGWT/vue-gwt
processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java
TemplateParser.shouldSkipExpressionProcessing
private boolean shouldSkipExpressionProcessing(String expressionString) { // We don't skip if it's a component prop as we want Java validation // We don't optimize String expression, as we want GWT to convert Java values // to String for us (Enums, wrapped primitives...) return currentProp == null && !String.class .getCanonicalName() .equals(currentExpressionReturnType.toString()) && isSimpleVueJsExpression( expressionString); }
java
private boolean shouldSkipExpressionProcessing(String expressionString) { // We don't skip if it's a component prop as we want Java validation // We don't optimize String expression, as we want GWT to convert Java values // to String for us (Enums, wrapped primitives...) return currentProp == null && !String.class .getCanonicalName() .equals(currentExpressionReturnType.toString()) && isSimpleVueJsExpression( expressionString); }
[ "private", "boolean", "shouldSkipExpressionProcessing", "(", "String", "expressionString", ")", "{", "// We don't skip if it's a component prop as we want Java validation", "// We don't optimize String expression, as we want GWT to convert Java values", "// to String for us (Enums, wrapped primitives...)", "return", "currentProp", "==", "null", "&&", "!", "String", ".", "class", ".", "getCanonicalName", "(", ")", ".", "equals", "(", "currentExpressionReturnType", ".", "toString", "(", ")", ")", "&&", "isSimpleVueJsExpression", "(", "expressionString", ")", ";", "}" ]
In some cases we want to skip expression processing for optimization. This is when we are sure the expression is valid and there is no need to create a Java method for it. @param expressionString The expression to asses @return true if we can skip the expression
[ "In", "some", "cases", "we", "want", "to", "skip", "expression", "processing", "for", "optimization", ".", "This", "is", "when", "we", "are", "sure", "the", "expression", "is", "valid", "and", "there", "is", "no", "need", "to", "create", "a", "Java", "method", "for", "it", "." ]
train
https://github.com/VueGWT/vue-gwt/blob/961cd83aed6fe8e2dd80c279847f1b3f62918a1f/processors/src/main/java/com/axellience/vuegwt/processors/component/template/parser/TemplateParser.java#L591-L599
yegor256/takes
src/main/java/org/takes/rs/RsWithHeaders.java
RsWithHeaders.extend
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") private static Iterable<String> extend(final Response res, final Iterable<? extends CharSequence> headers) throws IOException { Response resp = res; for (final CharSequence hdr: headers) { resp = new RsWithHeader(resp, hdr); } return resp.head(); }
java
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") private static Iterable<String> extend(final Response res, final Iterable<? extends CharSequence> headers) throws IOException { Response resp = res; for (final CharSequence hdr: headers) { resp = new RsWithHeader(resp, hdr); } return resp.head(); }
[ "@", "SuppressWarnings", "(", "\"PMD.AvoidInstantiatingObjectsInLoops\"", ")", "private", "static", "Iterable", "<", "String", ">", "extend", "(", "final", "Response", "res", ",", "final", "Iterable", "<", "?", "extends", "CharSequence", ">", "headers", ")", "throws", "IOException", "{", "Response", "resp", "=", "res", ";", "for", "(", "final", "CharSequence", "hdr", ":", "headers", ")", "{", "resp", "=", "new", "RsWithHeader", "(", "resp", ",", "hdr", ")", ";", "}", "return", "resp", ".", "head", "(", ")", ";", "}" ]
Add to head additional headers. @param res Original response @param headers Values witch will be added to head @return Head with additional headers @throws IOException If fails
[ "Add", "to", "head", "additional", "headers", "." ]
train
https://github.com/yegor256/takes/blob/a4f4d939c8f8e0af190025716ad7f22b7de40e70/src/main/java/org/takes/rs/RsWithHeaders.java#L90-L98
Azure/azure-sdk-for-java
applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentsInner.java
ComponentsInner.getByResourceGroupAsync
public Observable<ApplicationInsightsComponentInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ApplicationInsightsComponentInner>, ApplicationInsightsComponentInner>() { @Override public ApplicationInsightsComponentInner call(ServiceResponse<ApplicationInsightsComponentInner> response) { return response.body(); } }); }
java
public Observable<ApplicationInsightsComponentInner> getByResourceGroupAsync(String resourceGroupName, String resourceName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, resourceName).map(new Func1<ServiceResponse<ApplicationInsightsComponentInner>, ApplicationInsightsComponentInner>() { @Override public ApplicationInsightsComponentInner call(ServiceResponse<ApplicationInsightsComponentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ApplicationInsightsComponentInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "resourceName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "ApplicationInsightsComponentInner", ">", ",", "ApplicationInsightsComponentInner", ">", "(", ")", "{", "@", "Override", "public", "ApplicationInsightsComponentInner", "call", "(", "ServiceResponse", "<", "ApplicationInsightsComponentInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Returns an Application Insights component. @param resourceGroupName The name of the resource group. @param resourceName The name of the Application Insights component resource. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ApplicationInsightsComponentInner object
[ "Returns", "an", "Application", "Insights", "component", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationinsights/resource-manager/v2015_05_01/src/main/java/com/microsoft/azure/management/applicationinsights/v2015_05_01/implementation/ComponentsInner.java#L457-L464
sdl/odata
odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java
EntityDataModelUtil.getAndCheckFunctionImport
public static FunctionImport getAndCheckFunctionImport(EntityDataModel entityDataModel, String functionImportName) { FunctionImport functionImport = entityDataModel.getEntityContainer().getFunctionImport(functionImportName); if (functionImport == null) { throw new ODataSystemException("Function import not found in the entity data model: " + functionImportName); } return functionImport; }
java
public static FunctionImport getAndCheckFunctionImport(EntityDataModel entityDataModel, String functionImportName) { FunctionImport functionImport = entityDataModel.getEntityContainer().getFunctionImport(functionImportName); if (functionImport == null) { throw new ODataSystemException("Function import not found in the entity data model: " + functionImportName); } return functionImport; }
[ "public", "static", "FunctionImport", "getAndCheckFunctionImport", "(", "EntityDataModel", "entityDataModel", ",", "String", "functionImportName", ")", "{", "FunctionImport", "functionImport", "=", "entityDataModel", ".", "getEntityContainer", "(", ")", ".", "getFunctionImport", "(", "functionImportName", ")", ";", "if", "(", "functionImport", "==", "null", ")", "{", "throw", "new", "ODataSystemException", "(", "\"Function import not found in the entity data model: \"", "+", "functionImportName", ")", ";", "}", "return", "functionImport", ";", "}" ]
Gets the function import by the specified name, throw an exception if no function import with the specified name exists. @param entityDataModel The entity data model. @param functionImportName The name of the function import. @return The function import
[ "Gets", "the", "function", "import", "by", "the", "specified", "name", "throw", "an", "exception", "if", "no", "function", "import", "with", "the", "specified", "name", "exists", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_api/src/main/java/com/sdl/odata/util/edm/EntityDataModelUtil.java#L598-L605
zaproxy/zaproxy
src/org/parosproxy/paros/network/HttpSender.java
HttpSender.sendAndReceive
public void sendAndReceive(HttpMessage message, HttpRequestConfig requestConfig) throws IOException { if (message == null) { throw new IllegalArgumentException("Parameter message must not be null."); } if (requestConfig == null) { throw new IllegalArgumentException("Parameter requestConfig must not be null."); } sendAndReceiveImpl(message, requestConfig); if (requestConfig.isFollowRedirects()) { followRedirections(message, requestConfig); } }
java
public void sendAndReceive(HttpMessage message, HttpRequestConfig requestConfig) throws IOException { if (message == null) { throw new IllegalArgumentException("Parameter message must not be null."); } if (requestConfig == null) { throw new IllegalArgumentException("Parameter requestConfig must not be null."); } sendAndReceiveImpl(message, requestConfig); if (requestConfig.isFollowRedirects()) { followRedirections(message, requestConfig); } }
[ "public", "void", "sendAndReceive", "(", "HttpMessage", "message", ",", "HttpRequestConfig", "requestConfig", ")", "throws", "IOException", "{", "if", "(", "message", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter message must not be null.\"", ")", ";", "}", "if", "(", "requestConfig", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameter requestConfig must not be null.\"", ")", ";", "}", "sendAndReceiveImpl", "(", "message", ",", "requestConfig", ")", ";", "if", "(", "requestConfig", ".", "isFollowRedirects", "(", ")", ")", "{", "followRedirections", "(", "message", ",", "requestConfig", ")", ";", "}", "}" ]
Sends the request of given HTTP {@code message} with the given configurations. @param message the message that will be sent @param requestConfig the request configurations. @throws IllegalArgumentException if any of the parameters is {@code null} @throws IOException if an error occurred while sending the message or following the redirections @since 2.6.0 @see #sendAndReceive(HttpMessage, boolean)
[ "Sends", "the", "request", "of", "given", "HTTP", "{", "@code", "message", "}", "with", "the", "given", "configurations", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/network/HttpSender.java#L877-L890
tracee/tracee
core/src/main/java/io/tracee/Utilities.java
Utilities.generateSessionIdIfNecessary
public static void generateSessionIdIfNecessary(final TraceeBackend backend, final String sessionId) { if (backend != null && !backend.containsKey(TraceeConstants.SESSION_ID_KEY) && backend.getConfiguration().shouldGenerateSessionId()) { backend.put(TraceeConstants.SESSION_ID_KEY, Utilities.createAlphanumericHash(sessionId, backend.getConfiguration().generatedSessionIdLength())); } }
java
public static void generateSessionIdIfNecessary(final TraceeBackend backend, final String sessionId) { if (backend != null && !backend.containsKey(TraceeConstants.SESSION_ID_KEY) && backend.getConfiguration().shouldGenerateSessionId()) { backend.put(TraceeConstants.SESSION_ID_KEY, Utilities.createAlphanumericHash(sessionId, backend.getConfiguration().generatedSessionIdLength())); } }
[ "public", "static", "void", "generateSessionIdIfNecessary", "(", "final", "TraceeBackend", "backend", ",", "final", "String", "sessionId", ")", "{", "if", "(", "backend", "!=", "null", "&&", "!", "backend", ".", "containsKey", "(", "TraceeConstants", ".", "SESSION_ID_KEY", ")", "&&", "backend", ".", "getConfiguration", "(", ")", ".", "shouldGenerateSessionId", "(", ")", ")", "{", "backend", ".", "put", "(", "TraceeConstants", ".", "SESSION_ID_KEY", ",", "Utilities", ".", "createAlphanumericHash", "(", "sessionId", ",", "backend", ".", "getConfiguration", "(", ")", ".", "generatedSessionIdLength", "(", ")", ")", ")", ";", "}", "}" ]
Generate session id hash if it doesn't exist in TraceeBackend and configuration asks for one @param backend Currently used TraceeBackend @param sessionId Current http sessionId
[ "Generate", "session", "id", "hash", "if", "it", "doesn", "t", "exist", "in", "TraceeBackend", "and", "configuration", "asks", "for", "one" ]
train
https://github.com/tracee/tracee/blob/15a68e435248f57757beb8ceac6db5b7f6035bb3/core/src/main/java/io/tracee/Utilities.java#L78-L82
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/internal/ScopeProviderAccess.java
ScopeProviderAccess.getErrorNode
private INode getErrorNode(XExpression expression, INode node) { if (expression instanceof XFeatureCall) { XFeatureCall featureCall = (XFeatureCall) expression; if (!canBeTypeLiteral(featureCall)) { return node; } if (featureCall.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) { XMemberFeatureCall container = (XMemberFeatureCall) featureCall.eContainer(); if (canBeTypeLiteral(container)) { boolean explicitStatic = container.isExplicitStatic(); XMemberFeatureCall outerMost = getLongestTypeLiteralCandidate(container, explicitStatic); if (outerMost != null) return NodeModelUtils.getNode(outerMost); } } } return node; }
java
private INode getErrorNode(XExpression expression, INode node) { if (expression instanceof XFeatureCall) { XFeatureCall featureCall = (XFeatureCall) expression; if (!canBeTypeLiteral(featureCall)) { return node; } if (featureCall.eContainingFeature() == XbasePackage.Literals.XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET) { XMemberFeatureCall container = (XMemberFeatureCall) featureCall.eContainer(); if (canBeTypeLiteral(container)) { boolean explicitStatic = container.isExplicitStatic(); XMemberFeatureCall outerMost = getLongestTypeLiteralCandidate(container, explicitStatic); if (outerMost != null) return NodeModelUtils.getNode(outerMost); } } } return node; }
[ "private", "INode", "getErrorNode", "(", "XExpression", "expression", ",", "INode", "node", ")", "{", "if", "(", "expression", "instanceof", "XFeatureCall", ")", "{", "XFeatureCall", "featureCall", "=", "(", "XFeatureCall", ")", "expression", ";", "if", "(", "!", "canBeTypeLiteral", "(", "featureCall", ")", ")", "{", "return", "node", ";", "}", "if", "(", "featureCall", ".", "eContainingFeature", "(", ")", "==", "XbasePackage", ".", "Literals", ".", "XMEMBER_FEATURE_CALL__MEMBER_CALL_TARGET", ")", "{", "XMemberFeatureCall", "container", "=", "(", "XMemberFeatureCall", ")", "featureCall", ".", "eContainer", "(", ")", ";", "if", "(", "canBeTypeLiteral", "(", "container", ")", ")", "{", "boolean", "explicitStatic", "=", "container", ".", "isExplicitStatic", "(", ")", ";", "XMemberFeatureCall", "outerMost", "=", "getLongestTypeLiteralCandidate", "(", "container", ",", "explicitStatic", ")", ";", "if", "(", "outerMost", "!=", "null", ")", "return", "NodeModelUtils", ".", "getNode", "(", "outerMost", ")", ";", "}", "}", "}", "return", "node", ";", "}" ]
Returns the node that best describes the error, e.g. if there is an expression <code>com::foo::DoesNotExist::method()</code> the error will be rooted at <code>com</code>, but the real problem is <code>com::foo::DoesNotExist</code>.
[ "Returns", "the", "node", "that", "best", "describes", "the", "error", "e", ".", "g", ".", "if", "there", "is", "an", "expression", "<code", ">", "com", "::", "foo", "::", "DoesNotExist", "::", "method", "()", "<", "/", "code", ">", "the", "error", "will", "be", "rooted", "at", "<code", ">", "com<", "/", "code", ">", "but", "the", "real", "problem", "is", "<code", ">", "com", "::", "foo", "::", "DoesNotExist<", "/", "code", ">", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/typesystem/internal/ScopeProviderAccess.java#L187-L204
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRenderer.java
WDataTableRenderer.doPaintRows
private void doPaintRows(final WDataTable table, final WebXmlRenderContext renderContext) { TableDataModel model = table.getDataModel(); WRepeater repeater = table.getRepeater(); List<?> beanList = repeater.getBeanList(); final int rowCount = beanList.size(); WComponent row = repeater.getRepeatedComponent(); for (int i = 0; i < rowCount; i++) { if (model instanceof TreeTableDataModel) { Integer nodeIdx = (Integer) beanList.get(i); TableTreeNode node = ((TreeTableDataModel) model).getNodeAtLine(nodeIdx); if (node.getLevel() != 1) { // Handled by the layout, so don't paint the row. continue; } } // Each row has its own context. This is why we can reuse the same // WComponent instance for each row. UIContext rowContext = repeater.getRowContext(beanList.get(i), i); UIContextHolder.pushContext(rowContext); try { row.paint(renderContext); } finally { UIContextHolder.popContext(); } } }
java
private void doPaintRows(final WDataTable table, final WebXmlRenderContext renderContext) { TableDataModel model = table.getDataModel(); WRepeater repeater = table.getRepeater(); List<?> beanList = repeater.getBeanList(); final int rowCount = beanList.size(); WComponent row = repeater.getRepeatedComponent(); for (int i = 0; i < rowCount; i++) { if (model instanceof TreeTableDataModel) { Integer nodeIdx = (Integer) beanList.get(i); TableTreeNode node = ((TreeTableDataModel) model).getNodeAtLine(nodeIdx); if (node.getLevel() != 1) { // Handled by the layout, so don't paint the row. continue; } } // Each row has its own context. This is why we can reuse the same // WComponent instance for each row. UIContext rowContext = repeater.getRowContext(beanList.get(i), i); UIContextHolder.pushContext(rowContext); try { row.paint(renderContext); } finally { UIContextHolder.popContext(); } } }
[ "private", "void", "doPaintRows", "(", "final", "WDataTable", "table", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "TableDataModel", "model", "=", "table", ".", "getDataModel", "(", ")", ";", "WRepeater", "repeater", "=", "table", ".", "getRepeater", "(", ")", ";", "List", "<", "?", ">", "beanList", "=", "repeater", ".", "getBeanList", "(", ")", ";", "final", "int", "rowCount", "=", "beanList", ".", "size", "(", ")", ";", "WComponent", "row", "=", "repeater", ".", "getRepeatedComponent", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rowCount", ";", "i", "++", ")", "{", "if", "(", "model", "instanceof", "TreeTableDataModel", ")", "{", "Integer", "nodeIdx", "=", "(", "Integer", ")", "beanList", ".", "get", "(", "i", ")", ";", "TableTreeNode", "node", "=", "(", "(", "TreeTableDataModel", ")", "model", ")", ".", "getNodeAtLine", "(", "nodeIdx", ")", ";", "if", "(", "node", ".", "getLevel", "(", ")", "!=", "1", ")", "{", "// Handled by the layout, so don't paint the row.", "continue", ";", "}", "}", "// Each row has its own context. This is why we can reuse the same", "// WComponent instance for each row.", "UIContext", "rowContext", "=", "repeater", ".", "getRowContext", "(", "beanList", ".", "get", "(", "i", ")", ",", "i", ")", ";", "UIContextHolder", ".", "pushContext", "(", "rowContext", ")", ";", "try", "{", "row", ".", "paint", "(", "renderContext", ")", ";", "}", "finally", "{", "UIContextHolder", ".", "popContext", "(", ")", ";", "}", "}", "}" ]
Override paintRow so that we only paint the first-level nodes for tree-tables. @param table the table to paint the rows for. @param renderContext the RenderContext to paint to.
[ "Override", "paintRow", "so", "that", "we", "only", "paint", "the", "first", "-", "level", "nodes", "for", "tree", "-", "tables", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WDataTableRenderer.java#L332-L362
SUSE/salt-netapi-client
src/main/java/com/suse/salt/netapi/calls/modules/File.java
File.getHash
public static LocalCall<String> getHash(String path) { return getHash(path, Optional.empty(), Optional.empty()); }
java
public static LocalCall<String> getHash(String path) { return getHash(path, Optional.empty(), Optional.empty()); }
[ "public", "static", "LocalCall", "<", "String", ">", "getHash", "(", "String", "path", ")", "{", "return", "getHash", "(", "path", ",", "Optional", ".", "empty", "(", ")", ",", "Optional", ".", "empty", "(", ")", ")", ";", "}" ]
Get the hash sum of a file <p> SHA256 algorithm is used by default @param path Path to the file or directory @return The {@link LocalCall} object to make the call
[ "Get", "the", "hash", "sum", "of", "a", "file", "<p", ">", "SHA256", "algorithm", "is", "used", "by", "default" ]
train
https://github.com/SUSE/salt-netapi-client/blob/a0bdf643c8e34fa4def4b915366594c1491fdad5/src/main/java/com/suse/salt/netapi/calls/modules/File.java#L120-L122
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java
AbstractRenderer.toScreenCoordinates
public Point2d toScreenCoordinates(double modelX, double modelY) { double[] dest = new double[2]; transform.transform(new double[]{modelX, modelY}, 0, dest, 0, 1); return new Point2d(dest[0], dest[1]); }
java
public Point2d toScreenCoordinates(double modelX, double modelY) { double[] dest = new double[2]; transform.transform(new double[]{modelX, modelY}, 0, dest, 0, 1); return new Point2d(dest[0], dest[1]); }
[ "public", "Point2d", "toScreenCoordinates", "(", "double", "modelX", ",", "double", "modelY", ")", "{", "double", "[", "]", "dest", "=", "new", "double", "[", "2", "]", ";", "transform", ".", "transform", "(", "new", "double", "[", "]", "{", "modelX", ",", "modelY", "}", ",", "0", ",", "dest", ",", "0", ",", "1", ")", ";", "return", "new", "Point2d", "(", "dest", "[", "0", "]", ",", "dest", "[", "1", "]", ")", ";", "}" ]
Convert a point in model space into a point in screen space. @param modelX the model x-coordinate @param modelY the model y-coordinate @return the equivalent point in screen space
[ "Convert", "a", "point", "in", "model", "space", "into", "a", "point", "in", "screen", "space", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java#L180-L184
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/Solo.java
Solo.setDatePicker
public void setDatePicker(int index, int year, int monthOfYear, int dayOfMonth) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "setDatePicker("+index+", "+year+", "+monthOfYear+", "+dayOfMonth+")"); } setDatePicker(waiter.waitForAndGetView(index, DatePicker.class), year, monthOfYear, dayOfMonth); }
java
public void setDatePicker(int index, int year, int monthOfYear, int dayOfMonth) { if(config.commandLogging){ Log.d(config.commandLoggingTag, "setDatePicker("+index+", "+year+", "+monthOfYear+", "+dayOfMonth+")"); } setDatePicker(waiter.waitForAndGetView(index, DatePicker.class), year, monthOfYear, dayOfMonth); }
[ "public", "void", "setDatePicker", "(", "int", "index", ",", "int", "year", ",", "int", "monthOfYear", ",", "int", "dayOfMonth", ")", "{", "if", "(", "config", ".", "commandLogging", ")", "{", "Log", ".", "d", "(", "config", ".", "commandLoggingTag", ",", "\"setDatePicker(\"", "+", "index", "+", "\", \"", "+", "year", "+", "\", \"", "+", "monthOfYear", "+", "\", \"", "+", "dayOfMonth", "+", "\")\"", ")", ";", "}", "setDatePicker", "(", "waiter", ".", "waitForAndGetView", "(", "index", ",", "DatePicker", ".", "class", ")", ",", "year", ",", "monthOfYear", ",", "dayOfMonth", ")", ";", "}" ]
Sets the date in a DatePicker matching the specified index. @param index the index of the {@link DatePicker}. {@code 0} if only one is available @param year the year e.g. 2011 @param monthOfYear the month which starts from zero e.g. 0 for January @param dayOfMonth the day e.g. 10
[ "Sets", "the", "date", "in", "a", "DatePicker", "matching", "the", "specified", "index", "." ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/Solo.java#L2521-L2527
hawtio/hawtio
hawtio-ide/src/main/java/io/hawt/ide/IdeFacade.java
IdeFacade.findInSourceFolders
protected String findInSourceFolders(File baseDir, String fileName) { String answer = findInFolder(baseDir, fileName); if (answer == null && baseDir.exists()) { answer = findInChildFolders(new File(baseDir, "src/main"), fileName); if (answer == null) { answer = findInChildFolders(new File(baseDir, "src/test"), fileName); } } return answer; }
java
protected String findInSourceFolders(File baseDir, String fileName) { String answer = findInFolder(baseDir, fileName); if (answer == null && baseDir.exists()) { answer = findInChildFolders(new File(baseDir, "src/main"), fileName); if (answer == null) { answer = findInChildFolders(new File(baseDir, "src/test"), fileName); } } return answer; }
[ "protected", "String", "findInSourceFolders", "(", "File", "baseDir", ",", "String", "fileName", ")", "{", "String", "answer", "=", "findInFolder", "(", "baseDir", ",", "fileName", ")", ";", "if", "(", "answer", "==", "null", "&&", "baseDir", ".", "exists", "(", ")", ")", "{", "answer", "=", "findInChildFolders", "(", "new", "File", "(", "baseDir", ",", "\"src/main\"", ")", ",", "fileName", ")", ";", "if", "(", "answer", "==", "null", ")", "{", "answer", "=", "findInChildFolders", "(", "new", "File", "(", "baseDir", ",", "\"src/test\"", ")", ",", "fileName", ")", ";", "}", "}", "return", "answer", ";", "}" ]
Searches in this directory and in the source directories in src/main/* and src/test/* for the given file name path @return the absolute file or null
[ "Searches", "in", "this", "directory", "and", "in", "the", "source", "directories", "in", "src", "/", "main", "/", "*", "and", "src", "/", "test", "/", "*", "for", "the", "given", "file", "name", "path" ]
train
https://github.com/hawtio/hawtio/blob/d8b1c8f246307c0313ba297a494106d0859f3ffd/hawtio-ide/src/main/java/io/hawt/ide/IdeFacade.java#L88-L97
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.countByLtD_S
@Override public int countByLtD_S(Date displayDate, int status) { FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTD_S; Object[] finderArgs = new Object[] { _getTime(displayDate), status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPINSTANCE_WHERE); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_LTD_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByLtD_S(Date displayDate, int status) { FinderPath finderPath = FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTD_S; Object[] finderArgs = new Object[] { _getTime(displayDate), status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_CPINSTANCE_WHERE); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_LTD_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByLtD_S", "(", "Date", "displayDate", ",", "int", "status", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_WITH_PAGINATION_COUNT_BY_LTD_S", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", "]", "{", "_getTime", "(", "displayDate", ")", ",", "status", "}", ";", "Long", "count", "=", "(", "Long", ")", "finderCache", ".", "getResult", "(", "finderPath", ",", "finderArgs", ",", "this", ")", ";", "if", "(", "count", "==", "null", ")", "{", "StringBundler", "query", "=", "new", "StringBundler", "(", "3", ")", ";", "query", ".", "append", "(", "_SQL_COUNT_CPINSTANCE_WHERE", ")", ";", "boolean", "bindDisplayDate", "=", "false", ";", "if", "(", "displayDate", "==", "null", ")", "{", "query", ".", "append", "(", "_FINDER_COLUMN_LTD_S_DISPLAYDATE_1", ")", ";", "}", "else", "{", "bindDisplayDate", "=", "true", ";", "query", ".", "append", "(", "_FINDER_COLUMN_LTD_S_DISPLAYDATE_2", ")", ";", "}", "query", ".", "append", "(", "_FINDER_COLUMN_LTD_S_STATUS_2", ")", ";", "String", "sql", "=", "query", ".", "toString", "(", ")", ";", "Session", "session", "=", "null", ";", "try", "{", "session", "=", "openSession", "(", ")", ";", "Query", "q", "=", "session", ".", "createQuery", "(", "sql", ")", ";", "QueryPos", "qPos", "=", "QueryPos", ".", "getInstance", "(", "q", ")", ";", "if", "(", "bindDisplayDate", ")", "{", "qPos", ".", "add", "(", "new", "Timestamp", "(", "displayDate", ".", "getTime", "(", ")", ")", ")", ";", "}", "qPos", ".", "add", "(", "status", ")", ";", "count", "=", "(", "Long", ")", "q", ".", "uniqueResult", "(", ")", ";", "finderCache", ".", "putResult", "(", "finderPath", ",", "finderArgs", ",", "count", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "finderCache", ".", "removeResult", "(", "finderPath", ",", "finderArgs", ")", ";", "throw", "processException", "(", "e", ")", ";", "}", "finally", "{", "closeSession", "(", "session", ")", ";", "}", "}", "return", "count", ".", "intValue", "(", ")", ";", "}" ]
Returns the number of cp instances where displayDate &lt; &#63; and status = &#63;. @param displayDate the display date @param status the status @return the number of matching cp instances
[ "Returns", "the", "number", "of", "cp", "instances", "where", "displayDate", "&lt", ";", "&#63", ";", "and", "status", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L6134-L6192
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/system/exec/Exec.java
Exec.appAs
public static Execed appAs(String as, String... command) throws IOException { return appAs(as, Arrays.asList(command)); }
java
public static Execed appAs(String as, String... command) throws IOException { return appAs(as, Arrays.asList(command)); }
[ "public", "static", "Execed", "appAs", "(", "String", "as", ",", "String", "...", "command", ")", "throws", "IOException", "{", "return", "appAs", "(", "as", ",", "Arrays", ".", "asList", "(", "command", ")", ")", ";", "}" ]
Runs a command, optionally executing as a different user (eg root) @param as @param command @return @throws IOException
[ "Runs", "a", "command", "optionally", "executing", "as", "a", "different", "user", "(", "eg", "root", ")" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/system/exec/Exec.java#L389-L392
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/WildcardImport.java
WildcardImport.qualifiedNameFix
private static void qualifiedNameFix( final SuggestedFix.Builder fix, final Symbol owner, VisitorState state) { fix.addImport(owner.getQualifiedName().toString()); final JCCompilationUnit unit = (JCCompilationUnit) state.getPath().getCompilationUnit(); new TreePathScanner<Void, Void>() { @Override public Void visitIdentifier(IdentifierTree tree, Void unused) { Symbol sym = ASTHelpers.getSymbol(tree); if (sym == null) { return null; } Tree parent = getCurrentPath().getParentPath().getLeaf(); if (parent.getKind() == Tree.Kind.CASE && ((CaseTree) parent).getExpression().equals(tree) && sym.owner.getKind() == ElementKind.ENUM) { // switch cases can refer to enum constants by simple name without importing them return null; } if (sym.owner.equals(owner) && unit.starImportScope.includes(sym)) { fix.prefixWith(tree, owner.getSimpleName() + "."); } return null; } }.scan(unit, null); }
java
private static void qualifiedNameFix( final SuggestedFix.Builder fix, final Symbol owner, VisitorState state) { fix.addImport(owner.getQualifiedName().toString()); final JCCompilationUnit unit = (JCCompilationUnit) state.getPath().getCompilationUnit(); new TreePathScanner<Void, Void>() { @Override public Void visitIdentifier(IdentifierTree tree, Void unused) { Symbol sym = ASTHelpers.getSymbol(tree); if (sym == null) { return null; } Tree parent = getCurrentPath().getParentPath().getLeaf(); if (parent.getKind() == Tree.Kind.CASE && ((CaseTree) parent).getExpression().equals(tree) && sym.owner.getKind() == ElementKind.ENUM) { // switch cases can refer to enum constants by simple name without importing them return null; } if (sym.owner.equals(owner) && unit.starImportScope.includes(sym)) { fix.prefixWith(tree, owner.getSimpleName() + "."); } return null; } }.scan(unit, null); }
[ "private", "static", "void", "qualifiedNameFix", "(", "final", "SuggestedFix", ".", "Builder", "fix", ",", "final", "Symbol", "owner", ",", "VisitorState", "state", ")", "{", "fix", ".", "addImport", "(", "owner", ".", "getQualifiedName", "(", ")", ".", "toString", "(", ")", ")", ";", "final", "JCCompilationUnit", "unit", "=", "(", "JCCompilationUnit", ")", "state", ".", "getPath", "(", ")", ".", "getCompilationUnit", "(", ")", ";", "new", "TreePathScanner", "<", "Void", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "visitIdentifier", "(", "IdentifierTree", "tree", ",", "Void", "unused", ")", "{", "Symbol", "sym", "=", "ASTHelpers", ".", "getSymbol", "(", "tree", ")", ";", "if", "(", "sym", "==", "null", ")", "{", "return", "null", ";", "}", "Tree", "parent", "=", "getCurrentPath", "(", ")", ".", "getParentPath", "(", ")", ".", "getLeaf", "(", ")", ";", "if", "(", "parent", ".", "getKind", "(", ")", "==", "Tree", ".", "Kind", ".", "CASE", "&&", "(", "(", "CaseTree", ")", "parent", ")", ".", "getExpression", "(", ")", ".", "equals", "(", "tree", ")", "&&", "sym", ".", "owner", ".", "getKind", "(", ")", "==", "ElementKind", ".", "ENUM", ")", "{", "// switch cases can refer to enum constants by simple name without importing them", "return", "null", ";", "}", "if", "(", "sym", ".", "owner", ".", "equals", "(", "owner", ")", "&&", "unit", ".", "starImportScope", ".", "includes", "(", "sym", ")", ")", "{", "fix", ".", "prefixWith", "(", "tree", ",", "owner", ".", "getSimpleName", "(", ")", "+", "\".\"", ")", ";", "}", "return", "null", ";", "}", "}", ".", "scan", "(", "unit", ",", "null", ")", ";", "}" ]
Add an import for {@code owner}, and qualify all on demand imported references to members of owner by owner's simple name.
[ "Add", "an", "import", "for", "{" ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/WildcardImport.java#L222-L246
andrehertwig/admintool
admin-tools-filebrowser/src/main/java/de/chandre/admintool/filebrowser/AdminToolFilebrowserServiceImpl.java
AdminToolFilebrowserServiceImpl.formatFileSize
protected String formatFileSize(BigInteger fileLength, BigInteger divisor, String unit) { BigDecimal size = new BigDecimal(fileLength); size = size.setScale(config.getFileSizeDisplayScale()).divide(new BigDecimal(divisor), BigDecimal.ROUND_HALF_EVEN); return String.format("%s %s", size.doubleValue(), unit); }
java
protected String formatFileSize(BigInteger fileLength, BigInteger divisor, String unit) { BigDecimal size = new BigDecimal(fileLength); size = size.setScale(config.getFileSizeDisplayScale()).divide(new BigDecimal(divisor), BigDecimal.ROUND_HALF_EVEN); return String.format("%s %s", size.doubleValue(), unit); }
[ "protected", "String", "formatFileSize", "(", "BigInteger", "fileLength", ",", "BigInteger", "divisor", ",", "String", "unit", ")", "{", "BigDecimal", "size", "=", "new", "BigDecimal", "(", "fileLength", ")", ";", "size", "=", "size", ".", "setScale", "(", "config", ".", "getFileSizeDisplayScale", "(", ")", ")", ".", "divide", "(", "new", "BigDecimal", "(", "divisor", ")", ",", "BigDecimal", ".", "ROUND_HALF_EVEN", ")", ";", "return", "String", ".", "format", "(", "\"%s %s\"", ",", "size", ".", "doubleValue", "(", ")", ",", "unit", ")", ";", "}" ]
calculates the and formats files size @see #getFileSize(long) @param fileLength @param divisor @param unit the Unit for the divisor @return
[ "calculates", "the", "and", "formats", "files", "size" ]
train
https://github.com/andrehertwig/admintool/blob/6d391e2d26969b70e3ccabfc34202abe8d915080/admin-tools-filebrowser/src/main/java/de/chandre/admintool/filebrowser/AdminToolFilebrowserServiceImpl.java#L341-L345
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/readerwriter/multicast/LocalDirectoryTransport.java
LocalDirectoryTransport.openFile
@Override public void openFile(String repositoryHash, String filename, Date currentDate) throws JournalException { try { super.testStateChange(State.FILE_OPEN); journalFile = new TransportOutputFile(directory, filename); xmlWriter = new IndentingXMLEventWriter(XMLOutputFactory.newInstance() .createXMLEventWriter(journalFile.open())); parent.writeDocumentHeader(xmlWriter, repositoryHash, currentDate); super.setState(State.FILE_OPEN); } catch (FactoryConfigurationError e) { throw new JournalException(e); } catch (XMLStreamException e) { throw new JournalException(e); } catch (IOException e) { throw new JournalException(e); } }
java
@Override public void openFile(String repositoryHash, String filename, Date currentDate) throws JournalException { try { super.testStateChange(State.FILE_OPEN); journalFile = new TransportOutputFile(directory, filename); xmlWriter = new IndentingXMLEventWriter(XMLOutputFactory.newInstance() .createXMLEventWriter(journalFile.open())); parent.writeDocumentHeader(xmlWriter, repositoryHash, currentDate); super.setState(State.FILE_OPEN); } catch (FactoryConfigurationError e) { throw new JournalException(e); } catch (XMLStreamException e) { throw new JournalException(e); } catch (IOException e) { throw new JournalException(e); } }
[ "@", "Override", "public", "void", "openFile", "(", "String", "repositoryHash", ",", "String", "filename", ",", "Date", "currentDate", ")", "throws", "JournalException", "{", "try", "{", "super", ".", "testStateChange", "(", "State", ".", "FILE_OPEN", ")", ";", "journalFile", "=", "new", "TransportOutputFile", "(", "directory", ",", "filename", ")", ";", "xmlWriter", "=", "new", "IndentingXMLEventWriter", "(", "XMLOutputFactory", ".", "newInstance", "(", ")", ".", "createXMLEventWriter", "(", "journalFile", ".", "open", "(", ")", ")", ")", ";", "parent", ".", "writeDocumentHeader", "(", "xmlWriter", ",", "repositoryHash", ",", "currentDate", ")", ";", "super", ".", "setState", "(", "State", ".", "FILE_OPEN", ")", ";", "}", "catch", "(", "FactoryConfigurationError", "e", ")", "{", "throw", "new", "JournalException", "(", "e", ")", ";", "}", "catch", "(", "XMLStreamException", "e", ")", "{", "throw", "new", "JournalException", "(", "e", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "JournalException", "(", "e", ")", ";", "}", "}" ]
On a request to open the file, <ul> <li>check that we are in a valid state,</li> <li>create the file,</li> <li>create the {@link XMLEventWriter} for use on the file,</li> <li>ask the parent to write the header to the file,</li> <li>set the state.</li> </ul>
[ "On", "a", "request", "to", "open", "the", "file", "<ul", ">", "<li", ">", "check", "that", "we", "are", "in", "a", "valid", "state", "<", "/", "li", ">", "<li", ">", "create", "the", "file", "<", "/", "li", ">", "<li", ">", "create", "the", "{" ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/readerwriter/multicast/LocalDirectoryTransport.java#L73-L96
czyzby/gdx-lml
lml/src/main/java/com/github/czyzby/lml/util/LmlUtilities.java
LmlUtilities.toRangeArrayArgument
public static String toRangeArrayArgument(final Object base, final int rangeStart, final int rangeEnd) { return Nullables.toString(base, Strings.EMPTY_STRING) + '[' + rangeStart + ',' + rangeEnd + ']'; }
java
public static String toRangeArrayArgument(final Object base, final int rangeStart, final int rangeEnd) { return Nullables.toString(base, Strings.EMPTY_STRING) + '[' + rangeStart + ',' + rangeEnd + ']'; }
[ "public", "static", "String", "toRangeArrayArgument", "(", "final", "Object", "base", ",", "final", "int", "rangeStart", ",", "final", "int", "rangeEnd", ")", "{", "return", "Nullables", ".", "toString", "(", "base", ",", "Strings", ".", "EMPTY_STRING", ")", "+", "'", "'", "+", "rangeStart", "+", "'", "'", "+", "rangeEnd", "+", "'", "'", ";", "}" ]
Warning: uses default LML syntax. Will not work if you modified any LML markers. @param base base of the range. Can be null - range will not have a base and will iterate solely over numbers. @param rangeStart start of range. Can be negative. Does not have to be lower than end - if start is bigger, range is iterating from bigger to lower values. @param rangeEnd end of range. Can be negative. @return range is format: base + rangeOpening + start + separator + end + rangeClosing. For example, "base[4,2]".
[ "Warning", ":", "uses", "default", "LML", "syntax", ".", "Will", "not", "work", "if", "you", "modified", "any", "LML", "markers", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/lml/src/main/java/com/github/czyzby/lml/util/LmlUtilities.java#L483-L485
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.unwrapKey
public KeyOperationResult unwrapKey(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value) { return unwrapKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value).toBlocking().single().body(); }
java
public KeyOperationResult unwrapKey(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value) { return unwrapKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value).toBlocking().single().body(); }
[ "public", "KeyOperationResult", "unwrapKey", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "String", "keyVersion", ",", "JsonWebKeyEncryptionAlgorithm", "algorithm", ",", "byte", "[", "]", "value", ")", "{", "return", "unwrapKeyWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "keyName", ",", "keyVersion", ",", "algorithm", ",", "value", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(", ")", ";", "}" ]
Unwraps a symmetric key using the specified key that was initially used for wrapping that key. The UNWRAP operation supports decryption of a symmetric key using the target key encryption key. This operation is the reverse of the WRAP operation. The UNWRAP operation applies to asymmetric and symmetric keys stored in Azure Key Vault since it uses the private portion of the key. This operation requires the keys/unwrapKey permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the key. @param keyVersion The version of the key. @param algorithm algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5' @param value the Base64Url value @throws IllegalArgumentException thrown if parameters fail the validation @throws KeyVaultErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the KeyOperationResult object if successful.
[ "Unwraps", "a", "symmetric", "key", "using", "the", "specified", "key", "that", "was", "initially", "used", "for", "wrapping", "that", "key", ".", "The", "UNWRAP", "operation", "supports", "decryption", "of", "a", "symmetric", "key", "using", "the", "target", "key", "encryption", "key", ".", "This", "operation", "is", "the", "reverse", "of", "the", "WRAP", "operation", ".", "The", "UNWRAP", "operation", "applies", "to", "asymmetric", "and", "symmetric", "keys", "stored", "in", "Azure", "Key", "Vault", "since", "it", "uses", "the", "private", "portion", "of", "the", "key", ".", "This", "operation", "requires", "the", "keys", "/", "unwrapKey", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L2714-L2716
looly/hutool
hutool-db/src/main/java/cn/hutool/db/AbstractDb.java
AbstractDb.find
public <T> T find(Entity where, RsHandler<T> rsh, String... fields) throws SQLException { return find(CollectionUtil.newArrayList(fields), where, rsh); }
java
public <T> T find(Entity where, RsHandler<T> rsh, String... fields) throws SQLException { return find(CollectionUtil.newArrayList(fields), where, rsh); }
[ "public", "<", "T", ">", "T", "find", "(", "Entity", "where", ",", "RsHandler", "<", "T", ">", "rsh", ",", "String", "...", "fields", ")", "throws", "SQLException", "{", "return", "find", "(", "CollectionUtil", ".", "newArrayList", "(", "fields", ")", ",", "where", ",", "rsh", ")", ";", "}" ]
查询,返回所有字段<br> 查询条件为多个key value对表示,默认key = value,如果使用其它条件可以使用:where.put("key", " &gt; 1"),value也可以传Condition对象,key被忽略 @param <T> 需要处理成的结果对象类型 @param where 条件实体类(包含表名) @param rsh 结果集处理对象 @param fields 字段列表,可变长参数如果无值表示查询全部字段 @return 结果对象 @throws SQLException SQL执行异常
[ "查询,返回所有字段<br", ">", "查询条件为多个key", "value对表示,默认key", "=", "value,如果使用其它条件可以使用:where", ".", "put", "(", "key", "&gt", ";", "1", ")", ",value也可以传Condition对象,key被忽略" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/AbstractDb.java#L478-L480
jmxtrans/jmxtrans
jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/output/Settings.java
Settings.getIntegerSetting
public static Integer getIntegerSetting(Map<String, Object> settings, String key, Integer defaultVal) { final Object value = settings.get(key); if (value == null) { return defaultVal; } if (value instanceof Number) { return ((Number) value).intValue(); } if (value instanceof String) { try { return Integer.parseInt((String) value); } catch (NumberFormatException e) { return defaultVal; } } return defaultVal; }
java
public static Integer getIntegerSetting(Map<String, Object> settings, String key, Integer defaultVal) { final Object value = settings.get(key); if (value == null) { return defaultVal; } if (value instanceof Number) { return ((Number) value).intValue(); } if (value instanceof String) { try { return Integer.parseInt((String) value); } catch (NumberFormatException e) { return defaultVal; } } return defaultVal; }
[ "public", "static", "Integer", "getIntegerSetting", "(", "Map", "<", "String", ",", "Object", ">", "settings", ",", "String", "key", ",", "Integer", "defaultVal", ")", "{", "final", "Object", "value", "=", "settings", ".", "get", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "return", "defaultVal", ";", "}", "if", "(", "value", "instanceof", "Number", ")", "{", "return", "(", "(", "Number", ")", "value", ")", ".", "intValue", "(", ")", ";", "}", "if", "(", "value", "instanceof", "String", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "(", "String", ")", "value", ")", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "return", "defaultVal", ";", "}", "}", "return", "defaultVal", ";", "}" ]
Gets an Integer value for the key, returning the default value given if not specified or not a valid numeric value. @param settings @param key the key to get the Integer setting for @param defaultVal the default value to return if the setting was not specified or was not coercible to an Integer value @return the Integer value for the setting
[ "Gets", "an", "Integer", "value", "for", "the", "key", "returning", "the", "default", "value", "given", "if", "not", "specified", "or", "not", "a", "valid", "numeric", "value", "." ]
train
https://github.com/jmxtrans/jmxtrans/blob/496f342de3bcf2c2226626374b7a16edf8f4ba2a/jmxtrans-core/src/main/java/com/googlecode/jmxtrans/model/output/Settings.java#L88-L105
kopihao/peasy-recyclerview
peasy-recyclerview/src/main/java/com/kopirealm/peasyrecyclerview/PeasyViewHolder.java
PeasyViewHolder.GetViewHolder
public static <VH extends PeasyViewHolder> VH GetViewHolder(PeasyViewHolder vh, Class<VH> cls) { return cls.cast(vh); }
java
public static <VH extends PeasyViewHolder> VH GetViewHolder(PeasyViewHolder vh, Class<VH> cls) { return cls.cast(vh); }
[ "public", "static", "<", "VH", "extends", "PeasyViewHolder", ">", "VH", "GetViewHolder", "(", "PeasyViewHolder", "vh", ",", "Class", "<", "VH", ">", "cls", ")", "{", "return", "cls", ".", "cast", "(", "vh", ")", ";", "}" ]
Help to cast provided PeasyViewHolder to its child class instance @param vh PeasyViewHolder Parent Class @param cls Class of PeasyViewHolder @param <VH> PeasyViewHolder Child Class @return VH as Child Class Instance
[ "Help", "to", "cast", "provided", "PeasyViewHolder", "to", "its", "child", "class", "instance" ]
train
https://github.com/kopihao/peasy-recyclerview/blob/a26071849e5d5b5b1febe685f205558b49908f87/peasy-recyclerview/src/main/java/com/kopirealm/peasyrecyclerview/PeasyViewHolder.java#L37-L39
neo4j/neo4j-java-driver
driver/src/main/java/org/neo4j/driver/internal/util/CertificateTool.java
CertificateTool.saveX509Cert
public static void saveX509Cert( Certificate[] certs, File certFile ) throws GeneralSecurityException, IOException { try ( BufferedWriter writer = new BufferedWriter( new FileWriter( certFile ) ) ) { for ( Certificate cert : certs ) { String certStr = Base64.getEncoder().encodeToString( cert.getEncoded() ).replaceAll( "(.{64})", "$1\n" ); writer.write( BEGIN_CERT ); writer.newLine(); writer.write( certStr ); writer.newLine(); writer.write( END_CERT ); writer.newLine(); } } }
java
public static void saveX509Cert( Certificate[] certs, File certFile ) throws GeneralSecurityException, IOException { try ( BufferedWriter writer = new BufferedWriter( new FileWriter( certFile ) ) ) { for ( Certificate cert : certs ) { String certStr = Base64.getEncoder().encodeToString( cert.getEncoded() ).replaceAll( "(.{64})", "$1\n" ); writer.write( BEGIN_CERT ); writer.newLine(); writer.write( certStr ); writer.newLine(); writer.write( END_CERT ); writer.newLine(); } } }
[ "public", "static", "void", "saveX509Cert", "(", "Certificate", "[", "]", "certs", ",", "File", "certFile", ")", "throws", "GeneralSecurityException", ",", "IOException", "{", "try", "(", "BufferedWriter", "writer", "=", "new", "BufferedWriter", "(", "new", "FileWriter", "(", "certFile", ")", ")", ")", "{", "for", "(", "Certificate", "cert", ":", "certs", ")", "{", "String", "certStr", "=", "Base64", ".", "getEncoder", "(", ")", ".", "encodeToString", "(", "cert", ".", "getEncoded", "(", ")", ")", ".", "replaceAll", "(", "\"(.{64})\"", ",", "\"$1\\n\"", ")", ";", "writer", ".", "write", "(", "BEGIN_CERT", ")", ";", "writer", ".", "newLine", "(", ")", ";", "writer", ".", "write", "(", "certStr", ")", ";", "writer", ".", "newLine", "(", ")", ";", "writer", ".", "write", "(", "END_CERT", ")", ";", "writer", ".", "newLine", "(", ")", ";", "}", "}", "}" ]
Save a list of certificates into a file @param certs @param certFile @throws GeneralSecurityException @throws IOException
[ "Save", "a", "list", "of", "certificates", "into", "a", "file" ]
train
https://github.com/neo4j/neo4j-java-driver/blob/8dad6c48251fa1ab7017e72d9998a24fa2337a22/driver/src/main/java/org/neo4j/driver/internal/util/CertificateTool.java#L85-L103
Carbonado/Carbonado
src/main/java/com/amazon/carbonado/raw/DataEncoder.java
DataEncoder.writeLength
public static int writeLength(int valueLength, OutputStream out) throws IOException { if (valueLength < 128) { out.write(valueLength); return 1; } else if (valueLength < 16384) { out.write((valueLength >> 8) | 0x80); out.write(valueLength); return 2; } else if (valueLength < 2097152) { out.write((valueLength >> 16) | 0xc0); out.write(valueLength >> 8); out.write(valueLength); return 3; } else if (valueLength < 268435456) { out.write((valueLength >> 24) | 0xe0); out.write(valueLength >> 16); out.write(valueLength >> 8); out.write(valueLength); return 4; } else { out.write(0xf0); out.write(valueLength >> 24); out.write(valueLength >> 16); out.write(valueLength >> 8); out.write(valueLength); return 5; } }
java
public static int writeLength(int valueLength, OutputStream out) throws IOException { if (valueLength < 128) { out.write(valueLength); return 1; } else if (valueLength < 16384) { out.write((valueLength >> 8) | 0x80); out.write(valueLength); return 2; } else if (valueLength < 2097152) { out.write((valueLength >> 16) | 0xc0); out.write(valueLength >> 8); out.write(valueLength); return 3; } else if (valueLength < 268435456) { out.write((valueLength >> 24) | 0xe0); out.write(valueLength >> 16); out.write(valueLength >> 8); out.write(valueLength); return 4; } else { out.write(0xf0); out.write(valueLength >> 24); out.write(valueLength >> 16); out.write(valueLength >> 8); out.write(valueLength); return 5; } }
[ "public", "static", "int", "writeLength", "(", "int", "valueLength", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "if", "(", "valueLength", "<", "128", ")", "{", "out", ".", "write", "(", "valueLength", ")", ";", "return", "1", ";", "}", "else", "if", "(", "valueLength", "<", "16384", ")", "{", "out", ".", "write", "(", "(", "valueLength", ">>", "8", ")", "|", "0x80", ")", ";", "out", ".", "write", "(", "valueLength", ")", ";", "return", "2", ";", "}", "else", "if", "(", "valueLength", "<", "2097152", ")", "{", "out", ".", "write", "(", "(", "valueLength", ">>", "16", ")", "|", "0xc0", ")", ";", "out", ".", "write", "(", "valueLength", ">>", "8", ")", ";", "out", ".", "write", "(", "valueLength", ")", ";", "return", "3", ";", "}", "else", "if", "(", "valueLength", "<", "268435456", ")", "{", "out", ".", "write", "(", "(", "valueLength", ">>", "24", ")", "|", "0xe0", ")", ";", "out", ".", "write", "(", "valueLength", ">>", "16", ")", ";", "out", ".", "write", "(", "valueLength", ">>", "8", ")", ";", "out", ".", "write", "(", "valueLength", ")", ";", "return", "4", ";", "}", "else", "{", "out", ".", "write", "(", "0xf0", ")", ";", "out", ".", "write", "(", "valueLength", ">>", "24", ")", ";", "out", ".", "write", "(", "valueLength", ">>", "16", ")", ";", "out", ".", "write", "(", "valueLength", ">>", "8", ")", ";", "out", ".", "write", "(", "valueLength", ")", ";", "return", "5", ";", "}", "}" ]
Writes a positive length value in up to five bytes. @return number of bytes written @since 1.2
[ "Writes", "a", "positive", "length", "value", "in", "up", "to", "five", "bytes", "." ]
train
https://github.com/Carbonado/Carbonado/blob/eee29b365a61c8f03e1a1dc6bed0692e6b04b1db/src/main/java/com/amazon/carbonado/raw/DataEncoder.java#L616-L643
ZenHarbinger/l2fprod-properties-editor
src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java
PropertySheetTable.getIndent
static int getIndent(PropertySheetTable table, Item item) { int indent; if (item.isProperty()) { // it is a property, it has no parent or a category, and no child if ((item.getParent() == null || !item.getParent().isProperty()) && !item.hasToggle()) { indent = table.getWantsExtraIndent() ? HOTSPOT_SIZE : 0; } else { // it is a property with children if (item.hasToggle()) { indent = item.getDepth() * HOTSPOT_SIZE; } else { indent = (item.getDepth() + 1) * HOTSPOT_SIZE; } } if (table.getSheetModel().getMode() == PropertySheet.VIEW_AS_CATEGORIES && table.getWantsExtraIndent()) { indent += HOTSPOT_SIZE; } } else { // category has no indent indent = 0; } return indent; }
java
static int getIndent(PropertySheetTable table, Item item) { int indent; if (item.isProperty()) { // it is a property, it has no parent or a category, and no child if ((item.getParent() == null || !item.getParent().isProperty()) && !item.hasToggle()) { indent = table.getWantsExtraIndent() ? HOTSPOT_SIZE : 0; } else { // it is a property with children if (item.hasToggle()) { indent = item.getDepth() * HOTSPOT_SIZE; } else { indent = (item.getDepth() + 1) * HOTSPOT_SIZE; } } if (table.getSheetModel().getMode() == PropertySheet.VIEW_AS_CATEGORIES && table.getWantsExtraIndent()) { indent += HOTSPOT_SIZE; } } else { // category has no indent indent = 0; } return indent; }
[ "static", "int", "getIndent", "(", "PropertySheetTable", "table", ",", "Item", "item", ")", "{", "int", "indent", ";", "if", "(", "item", ".", "isProperty", "(", ")", ")", "{", "// it is a property, it has no parent or a category, and no child\r", "if", "(", "(", "item", ".", "getParent", "(", ")", "==", "null", "||", "!", "item", ".", "getParent", "(", ")", ".", "isProperty", "(", ")", ")", "&&", "!", "item", ".", "hasToggle", "(", ")", ")", "{", "indent", "=", "table", ".", "getWantsExtraIndent", "(", ")", "?", "HOTSPOT_SIZE", ":", "0", ";", "}", "else", "{", "// it is a property with children\r", "if", "(", "item", ".", "hasToggle", "(", ")", ")", "{", "indent", "=", "item", ".", "getDepth", "(", ")", "*", "HOTSPOT_SIZE", ";", "}", "else", "{", "indent", "=", "(", "item", ".", "getDepth", "(", ")", "+", "1", ")", "*", "HOTSPOT_SIZE", ";", "}", "}", "if", "(", "table", ".", "getSheetModel", "(", ")", ".", "getMode", "(", ")", "==", "PropertySheet", ".", "VIEW_AS_CATEGORIES", "&&", "table", ".", "getWantsExtraIndent", "(", ")", ")", "{", "indent", "+=", "HOTSPOT_SIZE", ";", "}", "}", "else", "{", "// category has no indent\r", "indent", "=", "0", ";", "}", "return", "indent", ";", "}" ]
Calculates the required left indent for a given item, given its type and its hierarchy level.
[ "Calculates", "the", "required", "left", "indent", "for", "a", "given", "item", "given", "its", "type", "and", "its", "hierarchy", "level", "." ]
train
https://github.com/ZenHarbinger/l2fprod-properties-editor/blob/d9b15c3f0b6ac1d9a2a9d315be073d2a4a419c32/src/main/java/com/l2fprod/common/propertysheet/PropertySheetTable.java#L632-L659
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/impl/triggers/CronTrigger.java
CronTrigger.willFireOn
public boolean willFireOn (final Calendar aTest, final boolean dayOnly) { final Calendar test = (Calendar) aTest.clone (); test.set (Calendar.MILLISECOND, 0); // don't compare millis. if (dayOnly) { test.set (Calendar.HOUR_OF_DAY, 0); test.set (Calendar.MINUTE, 0); test.set (Calendar.SECOND, 0); } final Date testTime = test.getTime (); Date fta = getFireTimeAfter (new Date (test.getTime ().getTime () - 1000)); if (fta == null) return false; final Calendar p = Calendar.getInstance (test.getTimeZone (), Locale.getDefault (Locale.Category.FORMAT)); p.setTime (fta); final int year = p.get (Calendar.YEAR); final int month = p.get (Calendar.MONTH); final int day = p.get (Calendar.DATE); if (dayOnly) { return (year == test.get (Calendar.YEAR) && month == test.get (Calendar.MONTH) && day == test.get (Calendar.DATE)); } while (fta.before (testTime)) { fta = getFireTimeAfter (fta); } return fta.equals (testTime); }
java
public boolean willFireOn (final Calendar aTest, final boolean dayOnly) { final Calendar test = (Calendar) aTest.clone (); test.set (Calendar.MILLISECOND, 0); // don't compare millis. if (dayOnly) { test.set (Calendar.HOUR_OF_DAY, 0); test.set (Calendar.MINUTE, 0); test.set (Calendar.SECOND, 0); } final Date testTime = test.getTime (); Date fta = getFireTimeAfter (new Date (test.getTime ().getTime () - 1000)); if (fta == null) return false; final Calendar p = Calendar.getInstance (test.getTimeZone (), Locale.getDefault (Locale.Category.FORMAT)); p.setTime (fta); final int year = p.get (Calendar.YEAR); final int month = p.get (Calendar.MONTH); final int day = p.get (Calendar.DATE); if (dayOnly) { return (year == test.get (Calendar.YEAR) && month == test.get (Calendar.MONTH) && day == test.get (Calendar.DATE)); } while (fta.before (testTime)) { fta = getFireTimeAfter (fta); } return fta.equals (testTime); }
[ "public", "boolean", "willFireOn", "(", "final", "Calendar", "aTest", ",", "final", "boolean", "dayOnly", ")", "{", "final", "Calendar", "test", "=", "(", "Calendar", ")", "aTest", ".", "clone", "(", ")", ";", "test", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "// don't compare millis.", "if", "(", "dayOnly", ")", "{", "test", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "0", ")", ";", "test", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "0", ")", ";", "test", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "}", "final", "Date", "testTime", "=", "test", ".", "getTime", "(", ")", ";", "Date", "fta", "=", "getFireTimeAfter", "(", "new", "Date", "(", "test", ".", "getTime", "(", ")", ".", "getTime", "(", ")", "-", "1000", ")", ")", ";", "if", "(", "fta", "==", "null", ")", "return", "false", ";", "final", "Calendar", "p", "=", "Calendar", ".", "getInstance", "(", "test", ".", "getTimeZone", "(", ")", ",", "Locale", ".", "getDefault", "(", "Locale", ".", "Category", ".", "FORMAT", ")", ")", ";", "p", ".", "setTime", "(", "fta", ")", ";", "final", "int", "year", "=", "p", ".", "get", "(", "Calendar", ".", "YEAR", ")", ";", "final", "int", "month", "=", "p", ".", "get", "(", "Calendar", ".", "MONTH", ")", ";", "final", "int", "day", "=", "p", ".", "get", "(", "Calendar", ".", "DATE", ")", ";", "if", "(", "dayOnly", ")", "{", "return", "(", "year", "==", "test", ".", "get", "(", "Calendar", ".", "YEAR", ")", "&&", "month", "==", "test", ".", "get", "(", "Calendar", ".", "MONTH", ")", "&&", "day", "==", "test", ".", "get", "(", "Calendar", ".", "DATE", ")", ")", ";", "}", "while", "(", "fta", ".", "before", "(", "testTime", ")", ")", "{", "fta", "=", "getFireTimeAfter", "(", "fta", ")", ";", "}", "return", "fta", ".", "equals", "(", "testTime", ")", ";", "}" ]
<p> Determines whether the date and (optionally) time of the given Calendar instance falls on a scheduled fire-time of this trigger. </p> <p> Note that the value returned is NOT validated against the related {@link ICalendar} (if any) </p> @param aTest the date to compare @param dayOnly if set to true, the method will only determine if the trigger will fire during the day represented by the given Calendar (hours, minutes and seconds will be ignored). @see #willFireOn(Calendar)
[ "<p", ">", "Determines", "whether", "the", "date", "and", "(", "optionally", ")", "time", "of", "the", "given", "Calendar", "instance", "falls", "on", "a", "scheduled", "fire", "-", "time", "of", "this", "trigger", ".", "<", "/", "p", ">", "<p", ">", "Note", "that", "the", "value", "returned", "is", "NOT", "validated", "against", "the", "related", "{", "@link", "ICalendar", "}", "(", "if", "any", ")", "<", "/", "p", ">" ]
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/impl/triggers/CronTrigger.java#L434-L473
OpenLiberty/open-liberty
dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java
PasswordUtil.isHashed
public static boolean isHashed(String encoded_string) { String algorithm = getCryptoAlgorithm(encoded_string); return isValidAlgorithm(algorithm, PasswordCipherUtil.getSupportedHashAlgorithms()); }
java
public static boolean isHashed(String encoded_string) { String algorithm = getCryptoAlgorithm(encoded_string); return isValidAlgorithm(algorithm, PasswordCipherUtil.getSupportedHashAlgorithms()); }
[ "public", "static", "boolean", "isHashed", "(", "String", "encoded_string", ")", "{", "String", "algorithm", "=", "getCryptoAlgorithm", "(", "encoded_string", ")", ";", "return", "isValidAlgorithm", "(", "algorithm", ",", "PasswordCipherUtil", ".", "getSupportedHashAlgorithms", "(", ")", ")", ";", "}" ]
Determine if the provided string is hashed by examining the algorithm tag. Note that this method is only avaiable for the Liberty profile. @param encoded_string the string with the encoded algorithm tag. @return true if the encoded algorithm is hash. false otherwise.
[ "Determine", "if", "the", "provided", "string", "is", "hashed", "by", "examining", "the", "algorithm", "tag", ".", "Note", "that", "this", "method", "is", "only", "avaiable", "for", "the", "Liberty", "profile", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.crypto.passwordutil/src/com/ibm/websphere/crypto/PasswordUtil.java#L371-L374
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/actions/ReceiveMessageAction.java
ReceiveMessageAction.receiveSelected
private Message receiveSelected(TestContext context, String selectorString) { if (log.isDebugEnabled()) { log.debug("Setting message selector: '" + selectorString + "'"); } Endpoint messageEndpoint = getOrCreateEndpoint(context); Consumer consumer = messageEndpoint.createConsumer(); if (consumer instanceof SelectiveConsumer) { if (receiveTimeout > 0) { return ((SelectiveConsumer) messageEndpoint.createConsumer()).receive( context.replaceDynamicContentInString(selectorString), context, receiveTimeout); } else { return ((SelectiveConsumer) messageEndpoint.createConsumer()).receive( context.replaceDynamicContentInString(selectorString), context, messageEndpoint.getEndpointConfiguration().getTimeout()); } } else { log.warn(String.format("Unable to receive selective with consumer implementation: '%s'", consumer.getClass())); return receive(context); } }
java
private Message receiveSelected(TestContext context, String selectorString) { if (log.isDebugEnabled()) { log.debug("Setting message selector: '" + selectorString + "'"); } Endpoint messageEndpoint = getOrCreateEndpoint(context); Consumer consumer = messageEndpoint.createConsumer(); if (consumer instanceof SelectiveConsumer) { if (receiveTimeout > 0) { return ((SelectiveConsumer) messageEndpoint.createConsumer()).receive( context.replaceDynamicContentInString(selectorString), context, receiveTimeout); } else { return ((SelectiveConsumer) messageEndpoint.createConsumer()).receive( context.replaceDynamicContentInString(selectorString), context, messageEndpoint.getEndpointConfiguration().getTimeout()); } } else { log.warn(String.format("Unable to receive selective with consumer implementation: '%s'", consumer.getClass())); return receive(context); } }
[ "private", "Message", "receiveSelected", "(", "TestContext", "context", ",", "String", "selectorString", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "\"Setting message selector: '\"", "+", "selectorString", "+", "\"'\"", ")", ";", "}", "Endpoint", "messageEndpoint", "=", "getOrCreateEndpoint", "(", "context", ")", ";", "Consumer", "consumer", "=", "messageEndpoint", ".", "createConsumer", "(", ")", ";", "if", "(", "consumer", "instanceof", "SelectiveConsumer", ")", "{", "if", "(", "receiveTimeout", ">", "0", ")", "{", "return", "(", "(", "SelectiveConsumer", ")", "messageEndpoint", ".", "createConsumer", "(", ")", ")", ".", "receive", "(", "context", ".", "replaceDynamicContentInString", "(", "selectorString", ")", ",", "context", ",", "receiveTimeout", ")", ";", "}", "else", "{", "return", "(", "(", "SelectiveConsumer", ")", "messageEndpoint", ".", "createConsumer", "(", ")", ")", ".", "receive", "(", "context", ".", "replaceDynamicContentInString", "(", "selectorString", ")", ",", "context", ",", "messageEndpoint", ".", "getEndpointConfiguration", "(", ")", ".", "getTimeout", "(", ")", ")", ";", "}", "}", "else", "{", "log", ".", "warn", "(", "String", ".", "format", "(", "\"Unable to receive selective with consumer implementation: '%s'\"", ",", "consumer", ".", "getClass", "(", ")", ")", ")", ";", "return", "receive", "(", "context", ")", ";", "}", "}" ]
Receives the message with the respective message receiver implementation also using a message selector. @param context the test context. @param selectorString the message selector string. @return
[ "Receives", "the", "message", "with", "the", "respective", "message", "receiver", "implementation", "also", "using", "a", "message", "selector", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/actions/ReceiveMessageAction.java#L151-L172
lucee/Lucee
core/src/main/java/lucee/runtime/converter/ScriptConverter.java
ScriptConverter._serializeDateTime
private void _serializeDateTime(DateTime dateTime, StringBuilder sb) throws ConverterException { try { TimeZone tz = ThreadLocalPageContext.getTimeZone(); sb.append(goIn()); sb.append("createDateTime("); sb.append(DateFormat.call(null, dateTime, "yyyy,m,d", tz)); sb.append(','); sb.append(TimeFormat.call(null, dateTime, "H,m,s,l,", tz)); sb.append('"').append(tz.getID()).append('"'); sb.append(')'); } catch (PageException e) { throw toConverterException(e); } }
java
private void _serializeDateTime(DateTime dateTime, StringBuilder sb) throws ConverterException { try { TimeZone tz = ThreadLocalPageContext.getTimeZone(); sb.append(goIn()); sb.append("createDateTime("); sb.append(DateFormat.call(null, dateTime, "yyyy,m,d", tz)); sb.append(','); sb.append(TimeFormat.call(null, dateTime, "H,m,s,l,", tz)); sb.append('"').append(tz.getID()).append('"'); sb.append(')'); } catch (PageException e) { throw toConverterException(e); } }
[ "private", "void", "_serializeDateTime", "(", "DateTime", "dateTime", ",", "StringBuilder", "sb", ")", "throws", "ConverterException", "{", "try", "{", "TimeZone", "tz", "=", "ThreadLocalPageContext", ".", "getTimeZone", "(", ")", ";", "sb", ".", "append", "(", "goIn", "(", ")", ")", ";", "sb", ".", "append", "(", "\"createDateTime(\"", ")", ";", "sb", ".", "append", "(", "DateFormat", ".", "call", "(", "null", ",", "dateTime", ",", "\"yyyy,m,d\"", ",", "tz", ")", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ";", "sb", ".", "append", "(", "TimeFormat", ".", "call", "(", "null", ",", "dateTime", ",", "\"H,m,s,l,\"", ",", "tz", ")", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ".", "append", "(", "tz", ".", "getID", "(", ")", ")", ".", "append", "(", "'", "'", ")", ";", "sb", ".", "append", "(", "'", "'", ")", ";", "}", "catch", "(", "PageException", "e", ")", "{", "throw", "toConverterException", "(", "e", ")", ";", "}", "}" ]
serialize a DateTime @param dateTime DateTime to serialize @param sb @throws ConverterException
[ "serialize", "a", "DateTime" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/converter/ScriptConverter.java#L126-L141
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java
XHTMLManager.setServiceEnabled
public static synchronized void setServiceEnabled(XMPPConnection connection, boolean enabled) { if (isServiceEnabled(connection) == enabled) return; if (enabled) { ServiceDiscoveryManager.getInstanceFor(connection).addFeature(XHTMLExtension.NAMESPACE); } else { ServiceDiscoveryManager.getInstanceFor(connection).removeFeature(XHTMLExtension.NAMESPACE); } }
java
public static synchronized void setServiceEnabled(XMPPConnection connection, boolean enabled) { if (isServiceEnabled(connection) == enabled) return; if (enabled) { ServiceDiscoveryManager.getInstanceFor(connection).addFeature(XHTMLExtension.NAMESPACE); } else { ServiceDiscoveryManager.getInstanceFor(connection).removeFeature(XHTMLExtension.NAMESPACE); } }
[ "public", "static", "synchronized", "void", "setServiceEnabled", "(", "XMPPConnection", "connection", ",", "boolean", "enabled", ")", "{", "if", "(", "isServiceEnabled", "(", "connection", ")", "==", "enabled", ")", "return", ";", "if", "(", "enabled", ")", "{", "ServiceDiscoveryManager", ".", "getInstanceFor", "(", "connection", ")", ".", "addFeature", "(", "XHTMLExtension", ".", "NAMESPACE", ")", ";", "}", "else", "{", "ServiceDiscoveryManager", ".", "getInstanceFor", "(", "connection", ")", ".", "removeFeature", "(", "XHTMLExtension", ".", "NAMESPACE", ")", ";", "}", "}" ]
Enables or disables the XHTML support on a given connection.<p> Before starting to send XHTML messages to a user, check that the user can handle XHTML messages. Enable the XHTML support to indicate that this client handles XHTML messages. @param connection the connection where the service will be enabled or disabled @param enabled indicates if the service will be enabled or disabled
[ "Enables", "or", "disables", "the", "XHTML", "support", "on", "a", "given", "connection", ".", "<p", ">" ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-extensions/src/main/java/org/jivesoftware/smackx/xhtmlim/XHTMLManager.java#L104-L114
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java
BatchUpdateDaemon.pushExternalCacheFragment
public synchronized void pushExternalCacheFragment(ExternalInvalidation externalCacheFragment, DCache cache) { BatchUpdateList bul = getUpdateList(cache); bul.pushECFEvents.add(externalCacheFragment); }
java
public synchronized void pushExternalCacheFragment(ExternalInvalidation externalCacheFragment, DCache cache) { BatchUpdateList bul = getUpdateList(cache); bul.pushECFEvents.add(externalCacheFragment); }
[ "public", "synchronized", "void", "pushExternalCacheFragment", "(", "ExternalInvalidation", "externalCacheFragment", ",", "DCache", "cache", ")", "{", "BatchUpdateList", "bul", "=", "getUpdateList", "(", "cache", ")", ";", "bul", ".", "pushECFEvents", ".", "add", "(", "externalCacheFragment", ")", ";", "}" ]
This allows an external cache fragment to be added to the BatchUpdateDaemon. @param cacheEntry The external cache fragment to be added.
[ "This", "allows", "an", "external", "cache", "fragment", "to", "be", "added", "to", "the", "BatchUpdateDaemon", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/BatchUpdateDaemon.java#L202-L205
apache/incubator-druid
server/src/main/java/org/apache/druid/initialization/Initialization.java
Initialization.getHadoopDependencyFilesToLoad
public static File[] getHadoopDependencyFilesToLoad( List<String> hadoopDependencyCoordinates, ExtensionsConfig extensionsConfig ) { final File rootHadoopDependenciesDir = new File(extensionsConfig.getHadoopDependenciesDir()); if (rootHadoopDependenciesDir.exists() && !rootHadoopDependenciesDir.isDirectory()) { throw new ISE("Root Hadoop dependencies directory [%s] is not a directory!?", rootHadoopDependenciesDir); } final File[] hadoopDependenciesToLoad = new File[hadoopDependencyCoordinates.size()]; int i = 0; for (final String coordinate : hadoopDependencyCoordinates) { final DefaultArtifact artifact = new DefaultArtifact(coordinate); final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId()); final File versionDir = new File(hadoopDependencyDir, artifact.getVersion()); // find the hadoop dependency with the version specified in coordinate if (!hadoopDependencyDir.isDirectory() || !versionDir.isDirectory()) { throw new ISE("Hadoop dependency [%s] didn't exist!?", versionDir.getAbsolutePath()); } hadoopDependenciesToLoad[i++] = versionDir; } return hadoopDependenciesToLoad; }
java
public static File[] getHadoopDependencyFilesToLoad( List<String> hadoopDependencyCoordinates, ExtensionsConfig extensionsConfig ) { final File rootHadoopDependenciesDir = new File(extensionsConfig.getHadoopDependenciesDir()); if (rootHadoopDependenciesDir.exists() && !rootHadoopDependenciesDir.isDirectory()) { throw new ISE("Root Hadoop dependencies directory [%s] is not a directory!?", rootHadoopDependenciesDir); } final File[] hadoopDependenciesToLoad = new File[hadoopDependencyCoordinates.size()]; int i = 0; for (final String coordinate : hadoopDependencyCoordinates) { final DefaultArtifact artifact = new DefaultArtifact(coordinate); final File hadoopDependencyDir = new File(rootHadoopDependenciesDir, artifact.getArtifactId()); final File versionDir = new File(hadoopDependencyDir, artifact.getVersion()); // find the hadoop dependency with the version specified in coordinate if (!hadoopDependencyDir.isDirectory() || !versionDir.isDirectory()) { throw new ISE("Hadoop dependency [%s] didn't exist!?", versionDir.getAbsolutePath()); } hadoopDependenciesToLoad[i++] = versionDir; } return hadoopDependenciesToLoad; }
[ "public", "static", "File", "[", "]", "getHadoopDependencyFilesToLoad", "(", "List", "<", "String", ">", "hadoopDependencyCoordinates", ",", "ExtensionsConfig", "extensionsConfig", ")", "{", "final", "File", "rootHadoopDependenciesDir", "=", "new", "File", "(", "extensionsConfig", ".", "getHadoopDependenciesDir", "(", ")", ")", ";", "if", "(", "rootHadoopDependenciesDir", ".", "exists", "(", ")", "&&", "!", "rootHadoopDependenciesDir", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "ISE", "(", "\"Root Hadoop dependencies directory [%s] is not a directory!?\"", ",", "rootHadoopDependenciesDir", ")", ";", "}", "final", "File", "[", "]", "hadoopDependenciesToLoad", "=", "new", "File", "[", "hadoopDependencyCoordinates", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "for", "(", "final", "String", "coordinate", ":", "hadoopDependencyCoordinates", ")", "{", "final", "DefaultArtifact", "artifact", "=", "new", "DefaultArtifact", "(", "coordinate", ")", ";", "final", "File", "hadoopDependencyDir", "=", "new", "File", "(", "rootHadoopDependenciesDir", ",", "artifact", ".", "getArtifactId", "(", ")", ")", ";", "final", "File", "versionDir", "=", "new", "File", "(", "hadoopDependencyDir", ",", "artifact", ".", "getVersion", "(", ")", ")", ";", "// find the hadoop dependency with the version specified in coordinate", "if", "(", "!", "hadoopDependencyDir", ".", "isDirectory", "(", ")", "||", "!", "versionDir", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "ISE", "(", "\"Hadoop dependency [%s] didn't exist!?\"", ",", "versionDir", ".", "getAbsolutePath", "(", ")", ")", ";", "}", "hadoopDependenciesToLoad", "[", "i", "++", "]", "=", "versionDir", ";", "}", "return", "hadoopDependenciesToLoad", ";", "}" ]
Find all the hadoop dependencies that should be loaded by druid @param hadoopDependencyCoordinates e.g.["org.apache.hadoop:hadoop-client:2.3.0"] @param extensionsConfig ExtensionsConfig configured by druid.extensions.xxx @return an array of hadoop dependency files that will be loaded by druid process
[ "Find", "all", "the", "hadoop", "dependencies", "that", "should", "be", "loaded", "by", "druid" ]
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/initialization/Initialization.java#L264-L286
coursera/courier
typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java
TSSyntax.escapeKeyword
private static String escapeKeyword(String symbol, EscapeStrategy strategy) { if (tsKeywords.contains(symbol)) { if (strategy.equals(EscapeStrategy.MANGLE)) { return symbol + "$"; } else { return "\"" + symbol + "\""; } } else { return symbol; } }
java
private static String escapeKeyword(String symbol, EscapeStrategy strategy) { if (tsKeywords.contains(symbol)) { if (strategy.equals(EscapeStrategy.MANGLE)) { return symbol + "$"; } else { return "\"" + symbol + "\""; } } else { return symbol; } }
[ "private", "static", "String", "escapeKeyword", "(", "String", "symbol", ",", "EscapeStrategy", "strategy", ")", "{", "if", "(", "tsKeywords", ".", "contains", "(", "symbol", ")", ")", "{", "if", "(", "strategy", ".", "equals", "(", "EscapeStrategy", ".", "MANGLE", ")", ")", "{", "return", "symbol", "+", "\"$\"", ";", "}", "else", "{", "return", "\"\\\"\"", "+", "symbol", "+", "\"\\\"\"", ";", "}", "}", "else", "{", "return", "symbol", ";", "}", "}" ]
Returns the escaped Pegasus symbol for use in Typescript source code. Pegasus symbols must be of the form [A-Za-z_], so this routine simply checks if the symbol collides with a typescript keyword, and if so, escapes it. @param symbol the symbol to escape @param strategy which strategy to use in escaping @return the escaped Pegasus symbol.
[ "Returns", "the", "escaped", "Pegasus", "symbol", "for", "use", "in", "Typescript", "source", "code", "." ]
train
https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java#L161-L171
mboudreau/Alternator
src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java
AmazonDynamoDBClient.putItem
public PutItemResult putItem(PutItemRequest putItemRequest) throws AmazonServiceException, AmazonClientException { ExecutionContext executionContext = createExecutionContext(putItemRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); Request<PutItemRequest> request = marshall(putItemRequest, new PutItemRequestMarshaller(), executionContext.getAwsRequestMetrics()); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); Unmarshaller<PutItemResult, JsonUnmarshallerContext> unmarshaller = new PutItemResultJsonUnmarshaller(); JsonResponseHandler<PutItemResult> responseHandler = new JsonResponseHandler<PutItemResult>(unmarshaller); return invoke(request, responseHandler, executionContext); }
java
public PutItemResult putItem(PutItemRequest putItemRequest) throws AmazonServiceException, AmazonClientException { ExecutionContext executionContext = createExecutionContext(putItemRequest); AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics(); Request<PutItemRequest> request = marshall(putItemRequest, new PutItemRequestMarshaller(), executionContext.getAwsRequestMetrics()); // Binds the request metrics to the current request. request.setAWSRequestMetrics(awsRequestMetrics); Unmarshaller<PutItemResult, JsonUnmarshallerContext> unmarshaller = new PutItemResultJsonUnmarshaller(); JsonResponseHandler<PutItemResult> responseHandler = new JsonResponseHandler<PutItemResult>(unmarshaller); return invoke(request, responseHandler, executionContext); }
[ "public", "PutItemResult", "putItem", "(", "PutItemRequest", "putItemRequest", ")", "throws", "AmazonServiceException", ",", "AmazonClientException", "{", "ExecutionContext", "executionContext", "=", "createExecutionContext", "(", "putItemRequest", ")", ";", "AWSRequestMetrics", "awsRequestMetrics", "=", "executionContext", ".", "getAwsRequestMetrics", "(", ")", ";", "Request", "<", "PutItemRequest", ">", "request", "=", "marshall", "(", "putItemRequest", ",", "new", "PutItemRequestMarshaller", "(", ")", ",", "executionContext", ".", "getAwsRequestMetrics", "(", ")", ")", ";", "// Binds the request metrics to the current request.", "request", ".", "setAWSRequestMetrics", "(", "awsRequestMetrics", ")", ";", "Unmarshaller", "<", "PutItemResult", ",", "JsonUnmarshallerContext", ">", "unmarshaller", "=", "new", "PutItemResultJsonUnmarshaller", "(", ")", ";", "JsonResponseHandler", "<", "PutItemResult", ">", "responseHandler", "=", "new", "JsonResponseHandler", "<", "PutItemResult", ">", "(", "unmarshaller", ")", ";", "return", "invoke", "(", "request", ",", "responseHandler", ",", "executionContext", ")", ";", "}" ]
<p> Creates a new item, or replaces an old item with a new item (including all the attributes). </p> <p> If an item already exists in the specified table with the same primary key, the new item completely replaces the existing item. You can perform a conditional put (insert a new item if one with the specified primary key doesn't exist), or replace an existing item if it has certain attribute values. </p> @param putItemRequest Container for the necessary parameters to execute the PutItem service method on AmazonDynamoDB. @return The response from the PutItem service method, as returned by AmazonDynamoDB. @throws LimitExceededException @throws ProvisionedThroughputExceededException @throws ConditionalCheckFailedException @throws InternalServerErrorException @throws ResourceNotFoundException @throws AmazonClientException If any internal errors are encountered inside the client while attempting to make the request or handle the response. For example if a network connection is not available. @throws AmazonServiceException If an error response is returned by AmazonDynamoDB indicating either a problem with the data in the request, or a server side issue.
[ "<p", ">", "Creates", "a", "new", "item", "or", "replaces", "an", "old", "item", "with", "a", "new", "item", "(", "including", "all", "the", "attributes", ")", ".", "<", "/", "p", ">", "<p", ">", "If", "an", "item", "already", "exists", "in", "the", "specified", "table", "with", "the", "same", "primary", "key", "the", "new", "item", "completely", "replaces", "the", "existing", "item", ".", "You", "can", "perform", "a", "conditional", "put", "(", "insert", "a", "new", "item", "if", "one", "with", "the", "specified", "primary", "key", "doesn", "t", "exist", ")", "or", "replace", "an", "existing", "item", "if", "it", "has", "certain", "attribute", "values", ".", "<", "/", "p", ">" ]
train
https://github.com/mboudreau/Alternator/blob/4b230ac843494cb10e46ddc2848f5b5d377d7b72/src/main/java/com/amazonaws/services/dynamodb/AmazonDynamoDBClient.java#L548-L560
alkacon/opencms-core
src/org/opencms/configuration/CmsParameterConfiguration.java
CmsParameterConfiguration.countPreceding
protected static int countPreceding(String line, int index, char ch) { int i; for (i = index - 1; i >= 0; i--) { if (line.charAt(i) != ch) { break; } } return index - 1 - i; }
java
protected static int countPreceding(String line, int index, char ch) { int i; for (i = index - 1; i >= 0; i--) { if (line.charAt(i) != ch) { break; } } return index - 1 - i; }
[ "protected", "static", "int", "countPreceding", "(", "String", "line", ",", "int", "index", ",", "char", "ch", ")", "{", "int", "i", ";", "for", "(", "i", "=", "index", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "line", ".", "charAt", "(", "i", ")", "!=", "ch", ")", "{", "break", ";", "}", "}", "return", "index", "-", "1", "-", "i", ";", "}" ]
Counts the number of successive times 'ch' appears in the 'line' before the position indicated by the 'index'.<p> @param line the line to count @param index the index position to start @param ch the character to count @return the number of successive times 'ch' appears in the 'line' before the position indicated by the 'index'
[ "Counts", "the", "number", "of", "successive", "times", "ch", "appears", "in", "the", "line", "before", "the", "position", "indicated", "by", "the", "index", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/configuration/CmsParameterConfiguration.java#L334-L343
lessthanoptimal/BoofCV
main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/CalibrationPlanarGridZhang99.java
CalibrationPlanarGridZhang99.applyDistortion
public static void applyDistortion(Point2D_F64 normPt, double[] radial, double t1 , double t2 ) { final double x = normPt.x; final double y = normPt.y; double a = 0; double r2 = x*x + y*y; double r2i = r2; for( int i = 0; i < radial.length; i++ ) { a += radial[i]*r2i; r2i *= r2; } normPt.x = x + x*a + 2*t1*x*y + t2*(r2 + 2*x*x); normPt.y = y + y*a + t1*(r2 + 2*y*y) + 2*t2*x*y; }
java
public static void applyDistortion(Point2D_F64 normPt, double[] radial, double t1 , double t2 ) { final double x = normPt.x; final double y = normPt.y; double a = 0; double r2 = x*x + y*y; double r2i = r2; for( int i = 0; i < radial.length; i++ ) { a += radial[i]*r2i; r2i *= r2; } normPt.x = x + x*a + 2*t1*x*y + t2*(r2 + 2*x*x); normPt.y = y + y*a + t1*(r2 + 2*y*y) + 2*t2*x*y; }
[ "public", "static", "void", "applyDistortion", "(", "Point2D_F64", "normPt", ",", "double", "[", "]", "radial", ",", "double", "t1", ",", "double", "t2", ")", "{", "final", "double", "x", "=", "normPt", ".", "x", ";", "final", "double", "y", "=", "normPt", ".", "y", ";", "double", "a", "=", "0", ";", "double", "r2", "=", "x", "*", "x", "+", "y", "*", "y", ";", "double", "r2i", "=", "r2", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "radial", ".", "length", ";", "i", "++", ")", "{", "a", "+=", "radial", "[", "i", "]", "*", "r2i", ";", "r2i", "*=", "r2", ";", "}", "normPt", ".", "x", "=", "x", "+", "x", "*", "a", "+", "2", "*", "t1", "*", "x", "*", "y", "+", "t2", "*", "(", "r2", "+", "2", "*", "x", "*", "x", ")", ";", "normPt", ".", "y", "=", "y", "+", "y", "*", "a", "+", "t1", "*", "(", "r2", "+", "2", "*", "y", "*", "y", ")", "+", "2", "*", "t2", "*", "x", "*", "y", ";", "}" ]
Applies radial and tangential distortion to the normalized image coordinate. @param normPt point in normalized image coordinates @param radial radial distortion parameters @param t1 tangential parameter @param t2 tangential parameter
[ "Applies", "radial", "and", "tangential", "distortion", "to", "the", "normalized", "image", "coordinate", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-calibration/src/main/java/boofcv/alg/geo/calibration/CalibrationPlanarGridZhang99.java#L303-L318
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readExceptions
private void readExceptions(Project.Calendars.Calendar calendar, ProjectCalendar bc) { Project.Calendars.Calendar.Exceptions exceptions = calendar.getExceptions(); if (exceptions != null) { for (Project.Calendars.Calendar.Exceptions.Exception exception : exceptions.getException()) { readException(bc, exception); } } }
java
private void readExceptions(Project.Calendars.Calendar calendar, ProjectCalendar bc) { Project.Calendars.Calendar.Exceptions exceptions = calendar.getExceptions(); if (exceptions != null) { for (Project.Calendars.Calendar.Exceptions.Exception exception : exceptions.getException()) { readException(bc, exception); } } }
[ "private", "void", "readExceptions", "(", "Project", ".", "Calendars", ".", "Calendar", "calendar", ",", "ProjectCalendar", "bc", ")", "{", "Project", ".", "Calendars", ".", "Calendar", ".", "Exceptions", "exceptions", "=", "calendar", ".", "getExceptions", "(", ")", ";", "if", "(", "exceptions", "!=", "null", ")", "{", "for", "(", "Project", ".", "Calendars", ".", "Calendar", ".", "Exceptions", ".", "Exception", "exception", ":", "exceptions", ".", "getException", "(", ")", ")", "{", "readException", "(", "bc", ",", "exception", ")", ";", "}", "}", "}" ]
Reads any exceptions present in the file. This is only used in MSPDI file versions saved by Project 2007 and later. @param calendar XML calendar @param bc MPXJ calendar
[ "Reads", "any", "exceptions", "present", "in", "the", "file", ".", "This", "is", "only", "used", "in", "MSPDI", "file", "versions", "saved", "by", "Project", "2007", "and", "later", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L586-L596
yanzhenjie/SwipeRecyclerView
support/src/main/java/com/yanzhenjie/recyclerview/SwipeRecyclerView.java
SwipeRecyclerView.setSwipeItemMenuEnabled
public void setSwipeItemMenuEnabled(int position, boolean enabled) { if (enabled) { if (mDisableSwipeItemMenuList.contains(position)) { mDisableSwipeItemMenuList.remove(Integer.valueOf(position)); } } else { if (!mDisableSwipeItemMenuList.contains(position)) { mDisableSwipeItemMenuList.add(position); } } }
java
public void setSwipeItemMenuEnabled(int position, boolean enabled) { if (enabled) { if (mDisableSwipeItemMenuList.contains(position)) { mDisableSwipeItemMenuList.remove(Integer.valueOf(position)); } } else { if (!mDisableSwipeItemMenuList.contains(position)) { mDisableSwipeItemMenuList.add(position); } } }
[ "public", "void", "setSwipeItemMenuEnabled", "(", "int", "position", ",", "boolean", "enabled", ")", "{", "if", "(", "enabled", ")", "{", "if", "(", "mDisableSwipeItemMenuList", ".", "contains", "(", "position", ")", ")", "{", "mDisableSwipeItemMenuList", ".", "remove", "(", "Integer", ".", "valueOf", "(", "position", ")", ")", ";", "}", "}", "else", "{", "if", "(", "!", "mDisableSwipeItemMenuList", ".", "contains", "(", "position", ")", ")", "{", "mDisableSwipeItemMenuList", ".", "add", "(", "position", ")", ";", "}", "}", "}" ]
Set the item menu to enable status. @param position the position of the item. @param enabled true means available, otherwise not available; default is true.
[ "Set", "the", "item", "menu", "to", "enable", "status", "." ]
train
https://github.com/yanzhenjie/SwipeRecyclerView/blob/69aa14d05da09beaeb880240c62f7de6f4f1bb39/support/src/main/java/com/yanzhenjie/recyclerview/SwipeRecyclerView.java#L157-L167
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java
VariablesInner.getAsync
public Observable<VariableInner> getAsync(String resourceGroupName, String automationAccountName, String variableName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName).map(new Func1<ServiceResponse<VariableInner>, VariableInner>() { @Override public VariableInner call(ServiceResponse<VariableInner> response) { return response.body(); } }); }
java
public Observable<VariableInner> getAsync(String resourceGroupName, String automationAccountName, String variableName) { return getWithServiceResponseAsync(resourceGroupName, automationAccountName, variableName).map(new Func1<ServiceResponse<VariableInner>, VariableInner>() { @Override public VariableInner call(ServiceResponse<VariableInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VariableInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "variableName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "variableName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VariableInner", ">", ",", "VariableInner", ">", "(", ")", "{", "@", "Override", "public", "VariableInner", "call", "(", "ServiceResponse", "<", "VariableInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieve the variable identified by variable name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param variableName The name of variable. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VariableInner object
[ "Retrieve", "the", "variable", "identified", "by", "variable", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/VariablesInner.java#L420-L427
sarxos/webcam-capture
webcam-capture-drivers/driver-raspberrypi/src/main/java/com/github/sarxos/webcam/ds/raspberrypi/PNGDecoder.java
PNGDecoder.decode
public final BufferedImage decode() throws IOException { if (!validPNG) { return null; } ColorModel cmodel = new ComponentColorModel(COLOR_SPACE, BITS, false, false, Transparency.OPAQUE, DATA_TYPE); SampleModel smodel = new ComponentSampleModel(DATA_TYPE, width, height, 3, width * 3, BAND_OFFSETS); byte[] bytes = new byte[width * height * 3];// must new each time! byte[][] data = new byte[][] { bytes }; ByteBuffer buffer = ByteBuffer.wrap(bytes); decode(buffer, TextureFormat.RGB); DataBufferByte dbuf = new DataBufferByte(data, bytes.length, OFFSET); WritableRaster raster = Raster.createWritableRaster(smodel, dbuf, null); BufferedImage bi = new BufferedImage(cmodel, raster, false, null); bi.flush(); return bi; }
java
public final BufferedImage decode() throws IOException { if (!validPNG) { return null; } ColorModel cmodel = new ComponentColorModel(COLOR_SPACE, BITS, false, false, Transparency.OPAQUE, DATA_TYPE); SampleModel smodel = new ComponentSampleModel(DATA_TYPE, width, height, 3, width * 3, BAND_OFFSETS); byte[] bytes = new byte[width * height * 3];// must new each time! byte[][] data = new byte[][] { bytes }; ByteBuffer buffer = ByteBuffer.wrap(bytes); decode(buffer, TextureFormat.RGB); DataBufferByte dbuf = new DataBufferByte(data, bytes.length, OFFSET); WritableRaster raster = Raster.createWritableRaster(smodel, dbuf, null); BufferedImage bi = new BufferedImage(cmodel, raster, false, null); bi.flush(); return bi; }
[ "public", "final", "BufferedImage", "decode", "(", ")", "throws", "IOException", "{", "if", "(", "!", "validPNG", ")", "{", "return", "null", ";", "}", "ColorModel", "cmodel", "=", "new", "ComponentColorModel", "(", "COLOR_SPACE", ",", "BITS", ",", "false", ",", "false", ",", "Transparency", ".", "OPAQUE", ",", "DATA_TYPE", ")", ";", "SampleModel", "smodel", "=", "new", "ComponentSampleModel", "(", "DATA_TYPE", ",", "width", ",", "height", ",", "3", ",", "width", "*", "3", ",", "BAND_OFFSETS", ")", ";", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "width", "*", "height", "*", "3", "]", ";", "// must new each time!", "byte", "[", "]", "[", "]", "data", "=", "new", "byte", "[", "]", "[", "]", "{", "bytes", "}", ";", "ByteBuffer", "buffer", "=", "ByteBuffer", ".", "wrap", "(", "bytes", ")", ";", "decode", "(", "buffer", ",", "TextureFormat", ".", "RGB", ")", ";", "DataBufferByte", "dbuf", "=", "new", "DataBufferByte", "(", "data", ",", "bytes", ".", "length", ",", "OFFSET", ")", ";", "WritableRaster", "raster", "=", "Raster", ".", "createWritableRaster", "(", "smodel", ",", "dbuf", ",", "null", ")", ";", "BufferedImage", "bi", "=", "new", "BufferedImage", "(", "cmodel", ",", "raster", ",", "false", ",", "null", ")", ";", "bi", ".", "flush", "(", ")", ";", "return", "bi", ";", "}" ]
read just one png file, if invalid, return null @return @throws IOException
[ "read", "just", "one", "png", "file", "if", "invalid", "return", "null" ]
train
https://github.com/sarxos/webcam-capture/blob/efbdae04f9ba48db9ec621e94a9bcd6f031882c8/webcam-capture-drivers/driver-raspberrypi/src/main/java/com/github/sarxos/webcam/ds/raspberrypi/PNGDecoder.java#L134-L151
broadinstitute/barclay
src/main/java/org/broadinstitute/barclay/help/DocletUtils.java
DocletUtils.getClassName
protected static String getClassName(ProgramElementDoc doc, boolean binaryName) { PackageDoc containingPackage = doc.containingPackage(); String className = doc.name(); if (binaryName) { className = className.replaceAll("\\.", "\\$"); } return containingPackage.name().length() > 0 ? String.format("%s.%s", containingPackage.name(), className) : String.format("%s", className); }
java
protected static String getClassName(ProgramElementDoc doc, boolean binaryName) { PackageDoc containingPackage = doc.containingPackage(); String className = doc.name(); if (binaryName) { className = className.replaceAll("\\.", "\\$"); } return containingPackage.name().length() > 0 ? String.format("%s.%s", containingPackage.name(), className) : String.format("%s", className); }
[ "protected", "static", "String", "getClassName", "(", "ProgramElementDoc", "doc", ",", "boolean", "binaryName", ")", "{", "PackageDoc", "containingPackage", "=", "doc", ".", "containingPackage", "(", ")", ";", "String", "className", "=", "doc", ".", "name", "(", ")", ";", "if", "(", "binaryName", ")", "{", "className", "=", "className", ".", "replaceAll", "(", "\"\\\\.\"", ",", "\"\\\\$\"", ")", ";", "}", "return", "containingPackage", ".", "name", "(", ")", ".", "length", "(", ")", ">", "0", "?", "String", ".", "format", "(", "\"%s.%s\"", ",", "containingPackage", ".", "name", "(", ")", ",", "className", ")", ":", "String", ".", "format", "(", "\"%s\"", ",", "className", ")", ";", "}" ]
Reconstitute the class name from the given class JavaDoc object. @param doc the Javadoc model for the given class. @return The (string) class name of the given class.
[ "Reconstitute", "the", "class", "name", "from", "the", "given", "class", "JavaDoc", "object", "." ]
train
https://github.com/broadinstitute/barclay/blob/7e56d725766b0da3baff23e79a31c3d01c3589c2/src/main/java/org/broadinstitute/barclay/help/DocletUtils.java#L35-L44
jcuda/jcusolver
JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java
JCusolverSp.cusolverSpScsreigvsiHost
public static int cusolverSpScsreigvsiHost( cusolverSpHandle handle, int m, int nnz, cusparseMatDescr descrA, Pointer csrValA, Pointer csrRowPtrA, Pointer csrColIndA, float mu0, Pointer x0, int maxite, float tol, Pointer mu, Pointer x) { return checkResult(cusolverSpScsreigvsiHostNative(handle, m, nnz, descrA, csrValA, csrRowPtrA, csrColIndA, mu0, x0, maxite, tol, mu, x)); }
java
public static int cusolverSpScsreigvsiHost( cusolverSpHandle handle, int m, int nnz, cusparseMatDescr descrA, Pointer csrValA, Pointer csrRowPtrA, Pointer csrColIndA, float mu0, Pointer x0, int maxite, float tol, Pointer mu, Pointer x) { return checkResult(cusolverSpScsreigvsiHostNative(handle, m, nnz, descrA, csrValA, csrRowPtrA, csrColIndA, mu0, x0, maxite, tol, mu, x)); }
[ "public", "static", "int", "cusolverSpScsreigvsiHost", "(", "cusolverSpHandle", "handle", ",", "int", "m", ",", "int", "nnz", ",", "cusparseMatDescr", "descrA", ",", "Pointer", "csrValA", ",", "Pointer", "csrRowPtrA", ",", "Pointer", "csrColIndA", ",", "float", "mu0", ",", "Pointer", "x0", ",", "int", "maxite", ",", "float", "tol", ",", "Pointer", "mu", ",", "Pointer", "x", ")", "{", "return", "checkResult", "(", "cusolverSpScsreigvsiHostNative", "(", "handle", ",", "m", ",", "nnz", ",", "descrA", ",", "csrValA", ",", "csrRowPtrA", ",", "csrColIndA", ",", "mu0", ",", "x0", ",", "maxite", ",", "tol", ",", "mu", ",", "x", ")", ")", ";", "}" ]
<pre> --------- CPU eigenvalue solver by shift inverse solve A*x = lambda * x where lambda is the eigenvalue nearest mu0. [eig] stands for eigenvalue solver [si] stands for shift-inverse </pre>
[ "<pre", ">", "---------", "CPU", "eigenvalue", "solver", "by", "shift", "inverse", "solve", "A", "*", "x", "=", "lambda", "*", "x", "where", "lambda", "is", "the", "eigenvalue", "nearest", "mu0", ".", "[", "eig", "]", "stands", "for", "eigenvalue", "solver", "[", "si", "]", "stands", "for", "shift", "-", "inverse", "<", "/", "pre", ">" ]
train
https://github.com/jcuda/jcusolver/blob/2600c7eca36a92a60ebcc78cae6e028e0c1d00b9/JCusolverJava/src/main/java/jcuda/jcusolver/JCusolverSp.java#L965-L981
UrielCh/ovh-java-sdk
ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java
ApiOvhPackxdsl.packName_emailPro_services_POST
public OvhTask packName_emailPro_services_POST(String packName, String email, String password) throws IOException { String qPath = "/pack/xdsl/{packName}/emailPro/services"; StringBuilder sb = path(qPath, packName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "email", email); addBody(o, "password", password); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask packName_emailPro_services_POST(String packName, String email, String password) throws IOException { String qPath = "/pack/xdsl/{packName}/emailPro/services"; StringBuilder sb = path(qPath, packName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "email", email); addBody(o, "password", password); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "packName_emailPro_services_POST", "(", "String", "packName", ",", "String", "email", ",", "String", "password", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/pack/xdsl/{packName}/emailPro/services\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "packName", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"email\"", ",", "email", ")", ";", "addBody", "(", "o", ",", "\"password\"", ",", "password", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhTask", ".", "class", ")", ";", "}" ]
Activate an Email Pro service REST: POST /pack/xdsl/{packName}/emailPro/services @param email [required] The email address @param password [required] The password @param packName [required] The internal name of your pack
[ "Activate", "an", "Email", "Pro", "service" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-packxdsl/src/main/java/net/minidev/ovh/api/ApiOvhPackxdsl.java#L190-L198
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.addInPlace
public static void addInPlace(double[] a, double b) { for (int i = 0; i < a.length; i++) { a[i] = a[i] + b; } }
java
public static void addInPlace(double[] a, double b) { for (int i = 0; i < a.length; i++) { a[i] = a[i] + b; } }
[ "public", "static", "void", "addInPlace", "(", "double", "[", "]", "a", ",", "double", "b", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "a", "[", "i", "]", "=", "a", "[", "i", "]", "+", "b", ";", "}", "}" ]
Increases the values in this array by b. Does it in place. @param a The array @param b The amount by which to increase each item
[ "Increases", "the", "values", "in", "this", "array", "by", "b", ".", "Does", "it", "in", "place", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L121-L125
mozilla/rhino
src/org/mozilla/javascript/NativeSymbol.java
NativeSymbol.put
@Override public void put(String name, Scriptable start, Object value) { if (!isSymbol()) { super.put(name, start, value); } else if (Context.getCurrentContext().isStrictMode()) { throw ScriptRuntime.typeError0("msg.no.assign.symbol.strict"); } }
java
@Override public void put(String name, Scriptable start, Object value) { if (!isSymbol()) { super.put(name, start, value); } else if (Context.getCurrentContext().isStrictMode()) { throw ScriptRuntime.typeError0("msg.no.assign.symbol.strict"); } }
[ "@", "Override", "public", "void", "put", "(", "String", "name", ",", "Scriptable", "start", ",", "Object", "value", ")", "{", "if", "(", "!", "isSymbol", "(", ")", ")", "{", "super", ".", "put", "(", "name", ",", "start", ",", "value", ")", ";", "}", "else", "if", "(", "Context", ".", "getCurrentContext", "(", ")", ".", "isStrictMode", "(", ")", ")", "{", "throw", "ScriptRuntime", ".", "typeError0", "(", "\"msg.no.assign.symbol.strict\"", ")", ";", "}", "}" ]
Symbol objects have a special property that one cannot add properties.
[ "Symbol", "objects", "have", "a", "special", "property", "that", "one", "cannot", "add", "properties", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/NativeSymbol.java#L283-L291
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java
ULocale.getKeywordValue
public static String getKeywordValue(String localeID, String keywordName) { return new LocaleIDParser(localeID).getKeywordValue(keywordName); }
java
public static String getKeywordValue(String localeID, String keywordName) { return new LocaleIDParser(localeID).getKeywordValue(keywordName); }
[ "public", "static", "String", "getKeywordValue", "(", "String", "localeID", ",", "String", "keywordName", ")", "{", "return", "new", "LocaleIDParser", "(", "localeID", ")", ".", "getKeywordValue", "(", "keywordName", ")", ";", "}" ]
<strong>[icu]</strong> Returns the value for a keyword in the specified locale. If the keyword is not defined, returns null. The locale name does not need to be normalized. @param keywordName name of the keyword whose value is desired. Case insensitive. @return String the value of the keyword as a string
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Returns", "the", "value", "for", "a", "keyword", "in", "the", "specified", "locale", ".", "If", "the", "keyword", "is", "not", "defined", "returns", "null", ".", "The", "locale", "name", "does", "not", "need", "to", "be", "normalized", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L1149-L1151
Azure/azure-sdk-for-java
marketplaceordering/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/marketplaceordering/v2015_06_01/implementation/MarketplaceAgreementsInner.java
MarketplaceAgreementsInner.cancelAsync
public Observable<AgreementTermsInner> cancelAsync(String publisherId, String offerId, String planId) { return cancelWithServiceResponseAsync(publisherId, offerId, planId).map(new Func1<ServiceResponse<AgreementTermsInner>, AgreementTermsInner>() { @Override public AgreementTermsInner call(ServiceResponse<AgreementTermsInner> response) { return response.body(); } }); }
java
public Observable<AgreementTermsInner> cancelAsync(String publisherId, String offerId, String planId) { return cancelWithServiceResponseAsync(publisherId, offerId, planId).map(new Func1<ServiceResponse<AgreementTermsInner>, AgreementTermsInner>() { @Override public AgreementTermsInner call(ServiceResponse<AgreementTermsInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AgreementTermsInner", ">", "cancelAsync", "(", "String", "publisherId", ",", "String", "offerId", ",", "String", "planId", ")", "{", "return", "cancelWithServiceResponseAsync", "(", "publisherId", ",", "offerId", ",", "planId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "AgreementTermsInner", ">", ",", "AgreementTermsInner", ">", "(", ")", "{", "@", "Override", "public", "AgreementTermsInner", "call", "(", "ServiceResponse", "<", "AgreementTermsInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Cancel marketplace terms. @param publisherId Publisher identifier string of image being deployed. @param offerId Offer identifier string of image being deployed. @param planId Plan identifier string of image being deployed. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AgreementTermsInner object
[ "Cancel", "marketplace", "terms", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/marketplaceordering/resource-manager/v2015_06_01/src/main/java/com/microsoft/azure/management/marketplaceordering/v2015_06_01/implementation/MarketplaceAgreementsInner.java#L415-L422
petergeneric/stdlib
guice/common/src/main/java/com/peterphi/std/guice/restclient/exception/RestExceptionFactory.java
RestExceptionFactory.buildKnown
private RestException buildKnown(Constructor<RestException> constructor, RestFailure failure) { try { return constructor.newInstance(failure.exception.detail, null); } catch (Exception e) { return buildUnknown(failure); } }
java
private RestException buildKnown(Constructor<RestException> constructor, RestFailure failure) { try { return constructor.newInstance(failure.exception.detail, null); } catch (Exception e) { return buildUnknown(failure); } }
[ "private", "RestException", "buildKnown", "(", "Constructor", "<", "RestException", ">", "constructor", ",", "RestFailure", "failure", ")", "{", "try", "{", "return", "constructor", ".", "newInstance", "(", "failure", ".", "exception", ".", "detail", ",", "null", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "return", "buildUnknown", "(", "failure", ")", ";", "}", "}" ]
Build an exception for a known exception type @param constructor @param failure @return
[ "Build", "an", "exception", "for", "a", "known", "exception", "type" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/guice/common/src/main/java/com/peterphi/std/guice/restclient/exception/RestExceptionFactory.java#L70-L80