repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
QSFT/Doradus
doradus-client/src/main/java/com/dell/doradus/client/SSLTransportParameters.java
SSLTransportParameters.setTrustStore
public void setTrustStore(String trustStore, String trustPass) { """ Set the truststore and password @param trustStore Location of the Truststore on disk @param trustPass Truststore password """ setTrustStore(trustStore, trustPass, null, null); }
java
public void setTrustStore(String trustStore, String trustPass) { setTrustStore(trustStore, trustPass, null, null); }
[ "public", "void", "setTrustStore", "(", "String", "trustStore", ",", "String", "trustPass", ")", "{", "setTrustStore", "(", "trustStore", ",", "trustPass", ",", "null", ",", "null", ")", ";", "}" ]
Set the truststore and password @param trustStore Location of the Truststore on disk @param trustPass Truststore password
[ "Set", "the", "truststore", "and", "password" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-client/src/main/java/com/dell/doradus/client/SSLTransportParameters.java#L254-L256
jbundle/jbundle
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java
XBasePanel.printReport
public void printReport(PrintWriter out, ResourceBundle reg) throws DBException { """ Output this screen using XML. Display the html headers, etc. then: <ol> - Parse any parameters passed in and set the field values. - Process any command (such as move=Next). - Render this screen as Html (by calling printHtmlScreen()). </ol> @exception DBException File exception. """ if (reg == null) reg = ((BaseApplication)this.getTask().getApplication()).getResources(HtmlConstants.XML_RESOURCE, false); String string = XmlUtilities.XML_LEAD_LINE; out.println(string); String strStylesheetPath = this.getStylesheetPath(); if (strStylesheetPath != null) { string = "<?xml-stylesheet type=\"text/xsl\" href=\"" + strStylesheetPath + "\" ?>"; out.println(string); } out.println(Utility.startTag(XMLTags.FULL_SCREEN)); this.printXMLParams(out, reg); // URL params this.printXMLHeaderInfo(out, reg); // Title, keywords, etc. this.printXmlHeader(out, reg); // Top menu this.printXmlMenu(out, reg); this.printXmlNavMenu(out, reg); this.printXmlTrailer(out, reg); this.processInputData(out); ((BasePanel)this.getScreenField()).prePrintReport(); out.println(Utility.startTag(XMLTags.CONTENT_AREA)); this.getScreenField().printScreen(out, reg); out.println(Utility.endTag(XMLTags.CONTENT_AREA)); out.println(Utility.endTag(XMLTags.FULL_SCREEN)); }
java
public void printReport(PrintWriter out, ResourceBundle reg) throws DBException { if (reg == null) reg = ((BaseApplication)this.getTask().getApplication()).getResources(HtmlConstants.XML_RESOURCE, false); String string = XmlUtilities.XML_LEAD_LINE; out.println(string); String strStylesheetPath = this.getStylesheetPath(); if (strStylesheetPath != null) { string = "<?xml-stylesheet type=\"text/xsl\" href=\"" + strStylesheetPath + "\" ?>"; out.println(string); } out.println(Utility.startTag(XMLTags.FULL_SCREEN)); this.printXMLParams(out, reg); // URL params this.printXMLHeaderInfo(out, reg); // Title, keywords, etc. this.printXmlHeader(out, reg); // Top menu this.printXmlMenu(out, reg); this.printXmlNavMenu(out, reg); this.printXmlTrailer(out, reg); this.processInputData(out); ((BasePanel)this.getScreenField()).prePrintReport(); out.println(Utility.startTag(XMLTags.CONTENT_AREA)); this.getScreenField().printScreen(out, reg); out.println(Utility.endTag(XMLTags.CONTENT_AREA)); out.println(Utility.endTag(XMLTags.FULL_SCREEN)); }
[ "public", "void", "printReport", "(", "PrintWriter", "out", ",", "ResourceBundle", "reg", ")", "throws", "DBException", "{", "if", "(", "reg", "==", "null", ")", "reg", "=", "(", "(", "BaseApplication", ")", "this", ".", "getTask", "(", ")", ".", "getApp...
Output this screen using XML. Display the html headers, etc. then: <ol> - Parse any parameters passed in and set the field values. - Process any command (such as move=Next). - Render this screen as Html (by calling printHtmlScreen()). </ol> @exception DBException File exception.
[ "Output", "this", "screen", "using", "XML", ".", "Display", "the", "html", "headers", "etc", ".", "then", ":", "<ol", ">", "-", "Parse", "any", "parameters", "passed", "in", "and", "set", "the", "field", "values", ".", "-", "Process", "any", "command", ...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBasePanel.java#L82-L115
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.collectNested
public static List collectNested(Iterable self, Closure transform) { """ Recursively iterates through this Iterable transforming each non-Collection value into a new value using the closure as a transformer. Returns a potentially nested list of transformed values. <pre class="groovyTestCase"> assert [2,[4,6],[8],[]] == [1,[2,3],[4],[]].collectNested { it * 2 } </pre> @param self an Iterable @param transform the closure used to transform each item of the Iterable @return the resultant list @since 2.2.0 """ return (List) collectNested(self, new ArrayList(), transform); }
java
public static List collectNested(Iterable self, Closure transform) { return (List) collectNested(self, new ArrayList(), transform); }
[ "public", "static", "List", "collectNested", "(", "Iterable", "self", ",", "Closure", "transform", ")", "{", "return", "(", "List", ")", "collectNested", "(", "self", ",", "new", "ArrayList", "(", ")", ",", "transform", ")", ";", "}" ]
Recursively iterates through this Iterable transforming each non-Collection value into a new value using the closure as a transformer. Returns a potentially nested list of transformed values. <pre class="groovyTestCase"> assert [2,[4,6],[8],[]] == [1,[2,3],[4],[]].collectNested { it * 2 } </pre> @param self an Iterable @param transform the closure used to transform each item of the Iterable @return the resultant list @since 2.2.0
[ "Recursively", "iterates", "through", "this", "Iterable", "transforming", "each", "non", "-", "Collection", "value", "into", "a", "new", "value", "using", "the", "closure", "as", "a", "transformer", ".", "Returns", "a", "potentially", "nested", "list", "of", "...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L3703-L3705
albfernandez/itext2
src/main/java/com/lowagie/text/Chunk.java
Chunk.setAttribute
private Chunk setAttribute(String name, Object obj) { """ Sets an arbitrary attribute. @param name the key for the attribute @param obj the value of the attribute @return this <CODE>Chunk</CODE> """ if (attributes == null) attributes = new HashMap(); attributes.put(name, obj); return this; }
java
private Chunk setAttribute(String name, Object obj) { if (attributes == null) attributes = new HashMap(); attributes.put(name, obj); return this; }
[ "private", "Chunk", "setAttribute", "(", "String", "name", ",", "Object", "obj", ")", "{", "if", "(", "attributes", "==", "null", ")", "attributes", "=", "new", "HashMap", "(", ")", ";", "attributes", ".", "put", "(", "name", ",", "obj", ")", ";", "r...
Sets an arbitrary attribute. @param name the key for the attribute @param obj the value of the attribute @return this <CODE>Chunk</CODE>
[ "Sets", "an", "arbitrary", "attribute", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Chunk.java#L444-L449
alkacon/opencms-core
src-modules/org/opencms/workplace/tools/content/CmsElementRename.java
CmsElementRename.writePageAndReport
private void writePageAndReport(CmsXmlPage page, boolean report) throws CmsException { """ Writes the given xml page by reporting the result.<p> @param page the xml page @param report if true then some output will be written to the report @throws CmsException if operation failed """ CmsFile file = page.getFile(); byte[] content = page.marshal(); file.setContents(content); // check lock CmsLock lock = getCms().getLock(file); if (lock.isNullLock() || lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) { // lock the page checkLock(getCms().getSitePath(file)); // write the file with the new content getCms().writeFile(file); // unlock the page getCms().unlockResource(getCms().getSitePath(file)); if (report) { m_report.println( Messages.get().container(Messages.RPT_ELEM_RENAME_2, getParamOldElement(), getParamNewElement()), I_CmsReport.FORMAT_OK); } } }
java
private void writePageAndReport(CmsXmlPage page, boolean report) throws CmsException { CmsFile file = page.getFile(); byte[] content = page.marshal(); file.setContents(content); // check lock CmsLock lock = getCms().getLock(file); if (lock.isNullLock() || lock.isOwnedBy(getCms().getRequestContext().getCurrentUser())) { // lock the page checkLock(getCms().getSitePath(file)); // write the file with the new content getCms().writeFile(file); // unlock the page getCms().unlockResource(getCms().getSitePath(file)); if (report) { m_report.println( Messages.get().container(Messages.RPT_ELEM_RENAME_2, getParamOldElement(), getParamNewElement()), I_CmsReport.FORMAT_OK); } } }
[ "private", "void", "writePageAndReport", "(", "CmsXmlPage", "page", ",", "boolean", "report", ")", "throws", "CmsException", "{", "CmsFile", "file", "=", "page", ".", "getFile", "(", ")", ";", "byte", "[", "]", "content", "=", "page", ".", "marshal", "(", ...
Writes the given xml page by reporting the result.<p> @param page the xml page @param report if true then some output will be written to the report @throws CmsException if operation failed
[ "Writes", "the", "given", "xml", "page", "by", "reporting", "the", "result", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-modules/org/opencms/workplace/tools/content/CmsElementRename.java#L957-L977
crawljax/crawljax
core/src/main/java/com/crawljax/core/configuration/Form.java
Form.inputField
public FormInput inputField(InputType type, Identification identification) { """ Specifies an input field to assign a value to. Crawljax first tries to match the found HTML input element's id and then the name attribute. @param type the type of input field @param identification the locator of the input field @return an InputField """ FormInput input = new FormInput(type, identification); this.formInputs.add(input); return input; }
java
public FormInput inputField(InputType type, Identification identification) { FormInput input = new FormInput(type, identification); this.formInputs.add(input); return input; }
[ "public", "FormInput", "inputField", "(", "InputType", "type", ",", "Identification", "identification", ")", "{", "FormInput", "input", "=", "new", "FormInput", "(", "type", ",", "identification", ")", ";", "this", ".", "formInputs", ".", "add", "(", "input", ...
Specifies an input field to assign a value to. Crawljax first tries to match the found HTML input element's id and then the name attribute. @param type the type of input field @param identification the locator of the input field @return an InputField
[ "Specifies", "an", "input", "field", "to", "assign", "a", "value", "to", ".", "Crawljax", "first", "tries", "to", "match", "the", "found", "HTML", "input", "element", "s", "id", "and", "then", "the", "name", "attribute", "." ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/core/configuration/Form.java#L55-L59
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/error/impl/DefaultSystemFailureMapper.java
DefaultSystemFailureMapper.toMessage
@Override public Message toMessage(final Throwable throwable) { """ This method converts a java Throwable into a "user friendly" error message. @param throwable the Throwable to convert @return A {@link Message} containing the hard coded description "The system is currently unavailable." """ LOG.error("The system is currently unavailable", throwable); return new Message(Message.ERROR_MESSAGE, InternalMessages.DEFAULT_SYSTEM_ERROR); }
java
@Override public Message toMessage(final Throwable throwable) { LOG.error("The system is currently unavailable", throwable); return new Message(Message.ERROR_MESSAGE, InternalMessages.DEFAULT_SYSTEM_ERROR); }
[ "@", "Override", "public", "Message", "toMessage", "(", "final", "Throwable", "throwable", ")", "{", "LOG", ".", "error", "(", "\"The system is currently unavailable\"", ",", "throwable", ")", ";", "return", "new", "Message", "(", "Message", ".", "ERROR_MESSAGE", ...
This method converts a java Throwable into a "user friendly" error message. @param throwable the Throwable to convert @return A {@link Message} containing the hard coded description "The system is currently unavailable."
[ "This", "method", "converts", "a", "java", "Throwable", "into", "a", "user", "friendly", "error", "message", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/error/impl/DefaultSystemFailureMapper.java#L27-L31
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/view/ViewFactory.java
ViewFactory.setupScreenFieldView
public ScreenFieldView setupScreenFieldView(ScreenField model, Class<?> screenFieldClass, boolean bEditableControl) { """ Create the field view. @param model The model to set up a view for. @param screenFieldClass The screen field Class @param bEditableControl Should this view be editable? @return The new view. """ if (screenFieldClass == null) screenFieldClass = model.getClass(); ScreenFieldView screenFieldView = this.getViewClassForModel(screenFieldClass); screenFieldView.init(model, bEditableControl); return screenFieldView; }
java
public ScreenFieldView setupScreenFieldView(ScreenField model, Class<?> screenFieldClass, boolean bEditableControl) { if (screenFieldClass == null) screenFieldClass = model.getClass(); ScreenFieldView screenFieldView = this.getViewClassForModel(screenFieldClass); screenFieldView.init(model, bEditableControl); return screenFieldView; }
[ "public", "ScreenFieldView", "setupScreenFieldView", "(", "ScreenField", "model", ",", "Class", "<", "?", ">", "screenFieldClass", ",", "boolean", "bEditableControl", ")", "{", "if", "(", "screenFieldClass", "==", "null", ")", "screenFieldClass", "=", "model", "."...
Create the field view. @param model The model to set up a view for. @param screenFieldClass The screen field Class @param bEditableControl Should this view be editable? @return The new view.
[ "Create", "the", "field", "view", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/ViewFactory.java#L109-L116
igniterealtime/Smack
smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java
OpenPgpPubSubUtil.getLeafNode
static LeafNode getLeafNode(PubSubManager pm, String nodeName) throws XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, InterruptedException, PubSubException.NotAPubSubNodeException, SmackException.NotConnectedException, SmackException.NoResponseException { """ Try to get a {@link LeafNode} the traditional way (first query information using disco#info), then query the node. If that fails, query the node directly. @param pm PubSubManager @param nodeName name of the node @return node @throws XMPPException.XMPPErrorException in case of an XMPP protocol error. @throws PubSubException.NotALeafNodeException if the queried node is not a {@link LeafNode}. @throws InterruptedException in case the thread gets interrupted @throws PubSubException.NotAPubSubNodeException in case the queried entity is not a PubSub node. @throws SmackException.NotConnectedException in case the connection is not connected. @throws SmackException.NoResponseException in case the server doesn't respond. """ LeafNode node; try { node = pm.getLeafNode(nodeName); } catch (XMPPException.XMPPErrorException e) { // It might happen, that the server doesn't allow disco#info queries from strangers. // In that case we have to fetch the node directly if (e.getStanzaError().getCondition() == StanzaError.Condition.subscription_required) { node = getOpenLeafNode(pm, nodeName); } else { throw e; } } return node; }
java
static LeafNode getLeafNode(PubSubManager pm, String nodeName) throws XMPPException.XMPPErrorException, PubSubException.NotALeafNodeException, InterruptedException, PubSubException.NotAPubSubNodeException, SmackException.NotConnectedException, SmackException.NoResponseException { LeafNode node; try { node = pm.getLeafNode(nodeName); } catch (XMPPException.XMPPErrorException e) { // It might happen, that the server doesn't allow disco#info queries from strangers. // In that case we have to fetch the node directly if (e.getStanzaError().getCondition() == StanzaError.Condition.subscription_required) { node = getOpenLeafNode(pm, nodeName); } else { throw e; } } return node; }
[ "static", "LeafNode", "getLeafNode", "(", "PubSubManager", "pm", ",", "String", "nodeName", ")", "throws", "XMPPException", ".", "XMPPErrorException", ",", "PubSubException", ".", "NotALeafNodeException", ",", "InterruptedException", ",", "PubSubException", ".", "NotAPu...
Try to get a {@link LeafNode} the traditional way (first query information using disco#info), then query the node. If that fails, query the node directly. @param pm PubSubManager @param nodeName name of the node @return node @throws XMPPException.XMPPErrorException in case of an XMPP protocol error. @throws PubSubException.NotALeafNodeException if the queried node is not a {@link LeafNode}. @throws InterruptedException in case the thread gets interrupted @throws PubSubException.NotAPubSubNodeException in case the queried entity is not a PubSub node. @throws SmackException.NotConnectedException in case the connection is not connected. @throws SmackException.NoResponseException in case the server doesn't respond.
[ "Try", "to", "get", "a", "{", "@link", "LeafNode", "}", "the", "traditional", "way", "(", "first", "query", "information", "using", "disco#info", ")", "then", "query", "the", "node", ".", "If", "that", "fails", "query", "the", "node", "directly", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-openpgp/src/main/java/org/jivesoftware/smackx/ox/util/OpenPgpPubSubUtil.java#L306-L323
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/util/collections/OptimizableHashSet.java
OptimizableHashSet.maxFill
public static int maxFill(int n, float f) { """ Returns the maximum number of entries that can be filled before rehashing. @param n the size of the backing array. @param f the load factor. @return the maximum number of entries before rehashing. """ return Math.min((int) Math.ceil((double) ((float) n * f)), n - 1); }
java
public static int maxFill(int n, float f) { return Math.min((int) Math.ceil((double) ((float) n * f)), n - 1); }
[ "public", "static", "int", "maxFill", "(", "int", "n", ",", "float", "f", ")", "{", "return", "Math", ".", "min", "(", "(", "int", ")", "Math", ".", "ceil", "(", "(", "double", ")", "(", "(", "float", ")", "n", "*", "f", ")", ")", ",", "n", ...
Returns the maximum number of entries that can be filled before rehashing. @param n the size of the backing array. @param f the load factor. @return the maximum number of entries before rehashing.
[ "Returns", "the", "maximum", "number", "of", "entries", "that", "can", "be", "filled", "before", "rehashing", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/runtime/util/collections/OptimizableHashSet.java#L134-L136
apiman/apiman
manager/api/es/src/main/java/io/apiman/manager/api/es/EsStorage.java
EsStorage.updateEntity
private void updateEntity(String type, String id, XContentBuilder source) throws StorageException { """ Updates a single entity. @param type @param id @param source @throws StorageException """ try { String doc = source.string(); /* JestResult response = */esClient.execute(new Index.Builder(doc) .setParameter(Parameters.OP_TYPE, "index").index(getIndexName()).type(type).id(id).build()); //$NON-NLS-1$ } catch (Exception e) { throw new StorageException(e); } }
java
private void updateEntity(String type, String id, XContentBuilder source) throws StorageException { try { String doc = source.string(); /* JestResult response = */esClient.execute(new Index.Builder(doc) .setParameter(Parameters.OP_TYPE, "index").index(getIndexName()).type(type).id(id).build()); //$NON-NLS-1$ } catch (Exception e) { throw new StorageException(e); } }
[ "private", "void", "updateEntity", "(", "String", "type", ",", "String", "id", ",", "XContentBuilder", "source", ")", "throws", "StorageException", "{", "try", "{", "String", "doc", "=", "source", ".", "string", "(", ")", ";", "/* JestResult response = */", "e...
Updates a single entity. @param type @param id @param source @throws StorageException
[ "Updates", "a", "single", "entity", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/manager/api/es/src/main/java/io/apiman/manager/api/es/EsStorage.java#L2081-L2089
hap-java/HAP-Java
src/main/java/io/github/hapjava/impl/pairing/ClientEvidenceRoutineImpl.java
ClientEvidenceRoutineImpl.computeClientEvidence
@Override public BigInteger computeClientEvidence( SRP6CryptoParams cryptoParams, SRP6ClientEvidenceContext ctx) { """ Calculates M1 according to the following formula: <p>M1 = H(H(N) xor H(g) || H(username) || s || A || B || H(S)) """ MessageDigest digest; try { digest = MessageDigest.getInstance(cryptoParams.H); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Could not locate requested algorithm", e); } digest.update(SrpHandler.bigIntegerToUnsignedByteArray(cryptoParams.N)); byte[] hN = digest.digest(); digest.update(SrpHandler.bigIntegerToUnsignedByteArray(cryptoParams.g)); byte[] hg = digest.digest(); byte[] hNhg = xor(hN, hg); digest.update(ctx.userID.getBytes(StandardCharsets.UTF_8)); byte[] hu = digest.digest(); digest.update(SrpHandler.bigIntegerToUnsignedByteArray(ctx.S)); byte[] hS = digest.digest(); digest.update(hNhg); digest.update(hu); digest.update(SrpHandler.bigIntegerToUnsignedByteArray(ctx.s)); digest.update(SrpHandler.bigIntegerToUnsignedByteArray(ctx.A)); digest.update(SrpHandler.bigIntegerToUnsignedByteArray(ctx.B)); digest.update(hS); BigInteger ret = new BigInteger(1, digest.digest()); return ret; }
java
@Override public BigInteger computeClientEvidence( SRP6CryptoParams cryptoParams, SRP6ClientEvidenceContext ctx) { MessageDigest digest; try { digest = MessageDigest.getInstance(cryptoParams.H); } catch (NoSuchAlgorithmException e) { throw new RuntimeException("Could not locate requested algorithm", e); } digest.update(SrpHandler.bigIntegerToUnsignedByteArray(cryptoParams.N)); byte[] hN = digest.digest(); digest.update(SrpHandler.bigIntegerToUnsignedByteArray(cryptoParams.g)); byte[] hg = digest.digest(); byte[] hNhg = xor(hN, hg); digest.update(ctx.userID.getBytes(StandardCharsets.UTF_8)); byte[] hu = digest.digest(); digest.update(SrpHandler.bigIntegerToUnsignedByteArray(ctx.S)); byte[] hS = digest.digest(); digest.update(hNhg); digest.update(hu); digest.update(SrpHandler.bigIntegerToUnsignedByteArray(ctx.s)); digest.update(SrpHandler.bigIntegerToUnsignedByteArray(ctx.A)); digest.update(SrpHandler.bigIntegerToUnsignedByteArray(ctx.B)); digest.update(hS); BigInteger ret = new BigInteger(1, digest.digest()); return ret; }
[ "@", "Override", "public", "BigInteger", "computeClientEvidence", "(", "SRP6CryptoParams", "cryptoParams", ",", "SRP6ClientEvidenceContext", "ctx", ")", "{", "MessageDigest", "digest", ";", "try", "{", "digest", "=", "MessageDigest", ".", "getInstance", "(", "cryptoPa...
Calculates M1 according to the following formula: <p>M1 = H(H(N) xor H(g) || H(username) || s || A || B || H(S))
[ "Calculates", "M1", "according", "to", "the", "following", "formula", ":" ]
train
https://github.com/hap-java/HAP-Java/blob/d2b2f4f1579580a2b5958af3a192128345843db9/src/main/java/io/github/hapjava/impl/pairing/ClientEvidenceRoutineImpl.java#L20-L52
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java
AbstractMySQLQuery.smallResult
@WithBridgeMethods(value = MySQLQuery.class, castRequired = true) public C smallResult() { """ For SQL_SMALL_RESULT, MySQL uses fast temporary tables to store the resulting table instead of using sorting. This should not normally be needed. @return the current object """ return addFlag(Position.AFTER_SELECT, SQL_SMALL_RESULT); }
java
@WithBridgeMethods(value = MySQLQuery.class, castRequired = true) public C smallResult() { return addFlag(Position.AFTER_SELECT, SQL_SMALL_RESULT); }
[ "@", "WithBridgeMethods", "(", "value", "=", "MySQLQuery", ".", "class", ",", "castRequired", "=", "true", ")", "public", "C", "smallResult", "(", ")", "{", "return", "addFlag", "(", "Position", ".", "AFTER_SELECT", ",", "SQL_SMALL_RESULT", ")", ";", "}" ]
For SQL_SMALL_RESULT, MySQL uses fast temporary tables to store the resulting table instead of using sorting. This should not normally be needed. @return the current object
[ "For", "SQL_SMALL_RESULT", "MySQL", "uses", "fast", "temporary", "tables", "to", "store", "the", "resulting", "table", "instead", "of", "using", "sorting", ".", "This", "should", "not", "normally", "be", "needed", "." ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/mysql/AbstractMySQLQuery.java#L189-L192
arquillian/arquillian-algeron
common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java
GitOperations.checkoutBranch
public Ref checkoutBranch(Git git, String branch) { """ Checkout existing branch. @param git instance. @param branch to move @return Ref to current branch """ try { return git.checkout() .setName(branch) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
java
public Ref checkoutBranch(Git git, String branch) { try { return git.checkout() .setName(branch) .call(); } catch (GitAPIException e) { throw new IllegalStateException(e); } }
[ "public", "Ref", "checkoutBranch", "(", "Git", "git", ",", "String", "branch", ")", "{", "try", "{", "return", "git", ".", "checkout", "(", ")", ".", "setName", "(", "branch", ")", ".", "call", "(", ")", ";", "}", "catch", "(", "GitAPIException", "e"...
Checkout existing branch. @param git instance. @param branch to move @return Ref to current branch
[ "Checkout", "existing", "branch", "." ]
train
https://github.com/arquillian/arquillian-algeron/blob/ec79372defdafe99ab2f7bb696f1c1eabdbbacb6/common/git/src/main/java/org/arquillian/algeron/git/GitOperations.java#L141-L149
xvik/dropwizard-guicey
src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java
ContextTreeRenderer.renderScopeItems
private void renderScopeItems(final ContextTreeConfig config, final TreeNode root, final Class<?> scope) { """ Render simple scope items (except bundles) including installer disables. @param config tree config @param root root node @param scope current scope """ final List<Class<Object>> items = service.getData() .getItems(Filters.registeredBy(scope).and(Filters.type(ConfigItem.Bundle).negate())); final List<String> markers = Lists.newArrayList(); for (Class<?> item : items) { markers.clear(); final ItemInfo info = service.getData().getInfo(item); if (isHidden(config, info, scope)) { continue; } fillCommonMarkers(info, markers, scope); renderLeaf(root, info.getItemType().name().toLowerCase(), item, markers); } if (!config.isHideDisables()) { final List<Class<Object>> disabled = service.getData().getItems(Filters.disabledBy(scope)); for (Class<?> item : disabled) { renderLeaf(root, "-disable", item, null); } } }
java
private void renderScopeItems(final ContextTreeConfig config, final TreeNode root, final Class<?> scope) { final List<Class<Object>> items = service.getData() .getItems(Filters.registeredBy(scope).and(Filters.type(ConfigItem.Bundle).negate())); final List<String> markers = Lists.newArrayList(); for (Class<?> item : items) { markers.clear(); final ItemInfo info = service.getData().getInfo(item); if (isHidden(config, info, scope)) { continue; } fillCommonMarkers(info, markers, scope); renderLeaf(root, info.getItemType().name().toLowerCase(), item, markers); } if (!config.isHideDisables()) { final List<Class<Object>> disabled = service.getData().getItems(Filters.disabledBy(scope)); for (Class<?> item : disabled) { renderLeaf(root, "-disable", item, null); } } }
[ "private", "void", "renderScopeItems", "(", "final", "ContextTreeConfig", "config", ",", "final", "TreeNode", "root", ",", "final", "Class", "<", "?", ">", "scope", ")", "{", "final", "List", "<", "Class", "<", "Object", ">", ">", "items", "=", "service", ...
Render simple scope items (except bundles) including installer disables. @param config tree config @param root root node @param scope current scope
[ "Render", "simple", "scope", "items", "(", "except", "bundles", ")", "including", "installer", "disables", "." ]
train
https://github.com/xvik/dropwizard-guicey/blob/dd39ad77283555be21f606d5ebf0f11207a733d4/src/main/java/ru/vyarus/dropwizard/guice/module/context/debug/report/tree/ContextTreeRenderer.java#L109-L130
belaban/JGroups
src/org/jgroups/util/Bits.java
Bits.readString
public static String readString(ByteBuffer buf) { """ Reads a string from buf. The length is read first, followed by the chars. Each char is a single byte @param buf the buffer @return the string read from buf """ if(buf.get() == 0) return null; int len=readInt(buf); if(buf.isDirect()) { byte[] bytes=new byte[len]; buf.get(bytes); return new String(bytes); } else { byte[] bytes=buf.array(); return new String(bytes, buf.arrayOffset() + buf.position(), len); } }
java
public static String readString(ByteBuffer buf) { if(buf.get() == 0) return null; int len=readInt(buf); if(buf.isDirect()) { byte[] bytes=new byte[len]; buf.get(bytes); return new String(bytes); } else { byte[] bytes=buf.array(); return new String(bytes, buf.arrayOffset() + buf.position(), len); } }
[ "public", "static", "String", "readString", "(", "ByteBuffer", "buf", ")", "{", "if", "(", "buf", ".", "get", "(", ")", "==", "0", ")", "return", "null", ";", "int", "len", "=", "readInt", "(", "buf", ")", ";", "if", "(", "buf", ".", "isDirect", ...
Reads a string from buf. The length is read first, followed by the chars. Each char is a single byte @param buf the buffer @return the string read from buf
[ "Reads", "a", "string", "from", "buf", ".", "The", "length", "is", "read", "first", "followed", "by", "the", "chars", ".", "Each", "char", "is", "a", "single", "byte" ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/util/Bits.java#L630-L643
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.getCacheEventJournalConfig
public EventJournalConfig getCacheEventJournalConfig(String name) { """ Returns the cache event journal config for the given name, creating one if necessary and adding it to the collection of known configurations. <p> The configuration is found by matching the configuration name pattern to the provided {@code name} without the partition qualifier (the part of the name after {@code '@'}). If no configuration matches, it will create one by cloning the {@code "default"} configuration and add it to the configuration collection. <p> If there is no default config as well, it will create one and disable the event journal by default. This method is intended to easily and fluently create and add configurations more specific than the default configuration without explicitly adding it by invoking {@link #addEventJournalConfig(EventJournalConfig)}. <p> Because it adds new configurations if they are not already present, this method is intended to be used before this config is used to create a hazelcast instance. Afterwards, newly added configurations may be ignored. @param name name of the cache event journal config @return the cache event journal configuration @throws ConfigurationException if ambiguous configurations are found @see StringPartitioningStrategy#getBaseName(java.lang.String) @see #setConfigPatternMatcher(ConfigPatternMatcher) @see #getConfigPatternMatcher() """ return ConfigUtils.getConfig(configPatternMatcher, cacheEventJournalConfigs, name, EventJournalConfig.class, new BiConsumer<EventJournalConfig, String>() { @Override public void accept(EventJournalConfig eventJournalConfig, String name) { eventJournalConfig.setCacheName(name); if ("default".equals(name)) { eventJournalConfig.setEnabled(false); } } }); }
java
public EventJournalConfig getCacheEventJournalConfig(String name) { return ConfigUtils.getConfig(configPatternMatcher, cacheEventJournalConfigs, name, EventJournalConfig.class, new BiConsumer<EventJournalConfig, String>() { @Override public void accept(EventJournalConfig eventJournalConfig, String name) { eventJournalConfig.setCacheName(name); if ("default".equals(name)) { eventJournalConfig.setEnabled(false); } } }); }
[ "public", "EventJournalConfig", "getCacheEventJournalConfig", "(", "String", "name", ")", "{", "return", "ConfigUtils", ".", "getConfig", "(", "configPatternMatcher", ",", "cacheEventJournalConfigs", ",", "name", ",", "EventJournalConfig", ".", "class", ",", "new", "B...
Returns the cache event journal config for the given name, creating one if necessary and adding it to the collection of known configurations. <p> The configuration is found by matching the configuration name pattern to the provided {@code name} without the partition qualifier (the part of the name after {@code '@'}). If no configuration matches, it will create one by cloning the {@code "default"} configuration and add it to the configuration collection. <p> If there is no default config as well, it will create one and disable the event journal by default. This method is intended to easily and fluently create and add configurations more specific than the default configuration without explicitly adding it by invoking {@link #addEventJournalConfig(EventJournalConfig)}. <p> Because it adds new configurations if they are not already present, this method is intended to be used before this config is used to create a hazelcast instance. Afterwards, newly added configurations may be ignored. @param name name of the cache event journal config @return the cache event journal configuration @throws ConfigurationException if ambiguous configurations are found @see StringPartitioningStrategy#getBaseName(java.lang.String) @see #setConfigPatternMatcher(ConfigPatternMatcher) @see #getConfigPatternMatcher()
[ "Returns", "the", "cache", "event", "journal", "config", "for", "the", "given", "name", "creating", "one", "if", "necessary", "and", "adding", "it", "to", "the", "collection", "of", "known", "configurations", ".", "<p", ">", "The", "configuration", "is", "fo...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L2860-L2871
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java
ProjectTreeController.addTables
private void addTables(MpxjTreeNode parentNode, ProjectFile file) { """ Add tables to the tree. @param parentNode parent tree node @param file tables container """ for (Table table : file.getTables()) { final Table t = table; MpxjTreeNode childNode = new MpxjTreeNode(table, TABLE_EXCLUDED_METHODS) { @Override public String toString() { return t.getName(); } }; parentNode.add(childNode); addColumns(childNode, table); } }
java
private void addTables(MpxjTreeNode parentNode, ProjectFile file) { for (Table table : file.getTables()) { final Table t = table; MpxjTreeNode childNode = new MpxjTreeNode(table, TABLE_EXCLUDED_METHODS) { @Override public String toString() { return t.getName(); } }; parentNode.add(childNode); addColumns(childNode, table); } }
[ "private", "void", "addTables", "(", "MpxjTreeNode", "parentNode", ",", "ProjectFile", "file", ")", "{", "for", "(", "Table", "table", ":", "file", ".", "getTables", "(", ")", ")", "{", "final", "Table", "t", "=", "table", ";", "MpxjTreeNode", "childNode",...
Add tables to the tree. @param parentNode parent tree node @param file tables container
[ "Add", "tables", "to", "the", "tree", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ProjectTreeController.java#L420-L436
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/ast/DebugASTDump.java
DebugASTDump.dumpUnit
public static void dumpUnit(CompilationUnit unit) { """ Dumps a compilation unit to a file. The output file's path is the same as where translated files get written, but with an "ast" suffix. """ String relativeOutputPath = unit.getMainTypeName().replace('.', '/') + ".ast"; File outputFile = new File( unit.getEnv().options().fileUtil().getOutputDirectory(), relativeOutputPath); outputFile.getParentFile().mkdirs(); try (FileOutputStream fout = new FileOutputStream(outputFile); OutputStreamWriter out = new OutputStreamWriter(fout, "UTF-8")) { out.write(dump(unit)); } catch (IOException e) { ErrorUtil.fatalError(e, outputFile.getPath()); } }
java
public static void dumpUnit(CompilationUnit unit) { String relativeOutputPath = unit.getMainTypeName().replace('.', '/') + ".ast"; File outputFile = new File( unit.getEnv().options().fileUtil().getOutputDirectory(), relativeOutputPath); outputFile.getParentFile().mkdirs(); try (FileOutputStream fout = new FileOutputStream(outputFile); OutputStreamWriter out = new OutputStreamWriter(fout, "UTF-8")) { out.write(dump(unit)); } catch (IOException e) { ErrorUtil.fatalError(e, outputFile.getPath()); } }
[ "public", "static", "void", "dumpUnit", "(", "CompilationUnit", "unit", ")", "{", "String", "relativeOutputPath", "=", "unit", ".", "getMainTypeName", "(", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\".ast\"", ";", "File", "outputFile", ...
Dumps a compilation unit to a file. The output file's path is the same as where translated files get written, but with an "ast" suffix.
[ "Dumps", "a", "compilation", "unit", "to", "a", "file", ".", "The", "output", "file", "s", "path", "is", "the", "same", "as", "where", "translated", "files", "get", "written", "but", "with", "an", "ast", "suffix", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/DebugASTDump.java#L43-L55
ZieIony/Carbon
carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java
LayerDrawable.setLayerInsetRelative
public void setLayerInsetRelative(int index, int s, int t, int e, int b) { """ Specifies the relative insets in pixels for the drawable at the specified index. @param index the index of the layer to adjust @param s number of pixels to inset from the start bound @param t number of pixels to inset from the top bound @param e number of pixels to inset from the end bound @param b number of pixels to inset from the bottom bound @attr ref android.R.styleable#LayerDrawableItem_start @attr ref android.R.styleable#LayerDrawableItem_top @attr ref android.R.styleable#LayerDrawableItem_end @attr ref android.R.styleable#LayerDrawableItem_bottom """ setLayerInsetInternal(index, 0, t, 0, b, s, e); }
java
public void setLayerInsetRelative(int index, int s, int t, int e, int b) { setLayerInsetInternal(index, 0, t, 0, b, s, e); }
[ "public", "void", "setLayerInsetRelative", "(", "int", "index", ",", "int", "s", ",", "int", "t", ",", "int", "e", ",", "int", "b", ")", "{", "setLayerInsetInternal", "(", "index", ",", "0", ",", "t", ",", "0", ",", "b", ",", "s", ",", "e", ")", ...
Specifies the relative insets in pixels for the drawable at the specified index. @param index the index of the layer to adjust @param s number of pixels to inset from the start bound @param t number of pixels to inset from the top bound @param e number of pixels to inset from the end bound @param b number of pixels to inset from the bottom bound @attr ref android.R.styleable#LayerDrawableItem_start @attr ref android.R.styleable#LayerDrawableItem_top @attr ref android.R.styleable#LayerDrawableItem_end @attr ref android.R.styleable#LayerDrawableItem_bottom
[ "Specifies", "the", "relative", "insets", "in", "pixels", "for", "the", "drawable", "at", "the", "specified", "index", "." ]
train
https://github.com/ZieIony/Carbon/blob/78b0a432bd49edc7a6a13ce111cab274085d1693/carbon/src/main/java/carbon/drawable/ripple/LayerDrawable.java#L688-L690
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getImploded
@Nonnull public static String getImploded (@Nonnull final String sSep, @Nullable final Iterable <?> aElements) { """ Get a concatenated String from all elements of the passed container, separated by the specified separator string. Even <code>null</code> elements are added. @param sSep The separator to use. May not be <code>null</code>. @param aElements The container to convert. May be <code>null</code> or empty. @return The concatenated string. """ return getImplodedMapped (sSep, aElements, String::valueOf); }
java
@Nonnull public static String getImploded (@Nonnull final String sSep, @Nullable final Iterable <?> aElements) { return getImplodedMapped (sSep, aElements, String::valueOf); }
[ "@", "Nonnull", "public", "static", "String", "getImploded", "(", "@", "Nonnull", "final", "String", "sSep", ",", "@", "Nullable", "final", "Iterable", "<", "?", ">", "aElements", ")", "{", "return", "getImplodedMapped", "(", "sSep", ",", "aElements", ",", ...
Get a concatenated String from all elements of the passed container, separated by the specified separator string. Even <code>null</code> elements are added. @param sSep The separator to use. May not be <code>null</code>. @param aElements The container to convert. May be <code>null</code> or empty. @return The concatenated string.
[ "Get", "a", "concatenated", "String", "from", "all", "elements", "of", "the", "passed", "container", "separated", "by", "the", "specified", "separator", "string", ".", "Even", "<code", ">", "null<", "/", "code", ">", "elements", "are", "added", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L929-L933
xqbase/util
util-jdk17/src/main/java/com/xqbase/util/Time.java
Time.toTimeString
public static String toTimeString(long time, boolean millis) { """ Convert a Unix time (in milliseconds) to a time string @param millis <code>true</code> to show milliseconds in decimal and <code>false</code> to round to the second """ GregorianCalendar cal = new GregorianCalendar(0, 0, 0); cal.setTimeInMillis(time); return toTimeString(cal, millis); }
java
public static String toTimeString(long time, boolean millis) { GregorianCalendar cal = new GregorianCalendar(0, 0, 0); cal.setTimeInMillis(time); return toTimeString(cal, millis); }
[ "public", "static", "String", "toTimeString", "(", "long", "time", ",", "boolean", "millis", ")", "{", "GregorianCalendar", "cal", "=", "new", "GregorianCalendar", "(", "0", ",", "0", ",", "0", ")", ";", "cal", ".", "setTimeInMillis", "(", "time", ")", "...
Convert a Unix time (in milliseconds) to a time string @param millis <code>true</code> to show milliseconds in decimal and <code>false</code> to round to the second
[ "Convert", "a", "Unix", "time", "(", "in", "milliseconds", ")", "to", "a", "time", "string" ]
train
https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util-jdk17/src/main/java/com/xqbase/util/Time.java#L99-L103
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java
HexUtil.encodeColor
public static String encodeColor(Color color, String prefix) { """ 将{@link Color}编码为Hex形式 @param color {@link Color} @param prefix 前缀字符串,可以是#、0x等 @return Hex字符串 @since 3.0.8 """ final StringBuffer builder = new StringBuffer(prefix); String colorHex; colorHex = Integer.toHexString(color.getRed()); if (1 == colorHex.length()) { builder.append('0'); } builder.append(colorHex); colorHex = Integer.toHexString(color.getGreen()); if (1 == colorHex.length()) { builder.append('0'); } builder.append(colorHex); colorHex = Integer.toHexString(color.getBlue()); if (1 == colorHex.length()) { builder.append('0'); } builder.append(colorHex); return builder.toString(); }
java
public static String encodeColor(Color color, String prefix) { final StringBuffer builder = new StringBuffer(prefix); String colorHex; colorHex = Integer.toHexString(color.getRed()); if (1 == colorHex.length()) { builder.append('0'); } builder.append(colorHex); colorHex = Integer.toHexString(color.getGreen()); if (1 == colorHex.length()) { builder.append('0'); } builder.append(colorHex); colorHex = Integer.toHexString(color.getBlue()); if (1 == colorHex.length()) { builder.append('0'); } builder.append(colorHex); return builder.toString(); }
[ "public", "static", "String", "encodeColor", "(", "Color", "color", ",", "String", "prefix", ")", "{", "final", "StringBuffer", "builder", "=", "new", "StringBuffer", "(", "prefix", ")", ";", "String", "colorHex", ";", "colorHex", "=", "Integer", ".", "toHex...
将{@link Color}编码为Hex形式 @param color {@link Color} @param prefix 前缀字符串,可以是#、0x等 @return Hex字符串 @since 3.0.8
[ "将", "{", "@link", "Color", "}", "编码为Hex形式" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/HexUtil.java#L222-L241
CenturyLinkCloud/mdw
mdw-common/src/com/centurylink/mdw/translator/DocumentReferenceTranslator.java
DocumentReferenceTranslator.fromDomNode
public Object fromDomNode(Node domNode, boolean tryProviders) throws TranslationException { """ Default implementation ignores providers. Override to try registry lookup. """ if (this instanceof XmlDocumentTranslator) return ((XmlDocumentTranslator)this).fromDomNode(domNode); else throw new UnsupportedOperationException("Translator: " + this.getClass().getName() + " does not implement" + XmlDocumentTranslator.class.getName()); }
java
public Object fromDomNode(Node domNode, boolean tryProviders) throws TranslationException { if (this instanceof XmlDocumentTranslator) return ((XmlDocumentTranslator)this).fromDomNode(domNode); else throw new UnsupportedOperationException("Translator: " + this.getClass().getName() + " does not implement" + XmlDocumentTranslator.class.getName()); }
[ "public", "Object", "fromDomNode", "(", "Node", "domNode", ",", "boolean", "tryProviders", ")", "throws", "TranslationException", "{", "if", "(", "this", "instanceof", "XmlDocumentTranslator", ")", "return", "(", "(", "XmlDocumentTranslator", ")", "this", ")", "."...
Default implementation ignores providers. Override to try registry lookup.
[ "Default", "implementation", "ignores", "providers", ".", "Override", "to", "try", "registry", "lookup", "." ]
train
https://github.com/CenturyLinkCloud/mdw/blob/91167fe65a25a5d7022cdcf8b0fae8506f5b87ce/mdw-common/src/com/centurylink/mdw/translator/DocumentReferenceTranslator.java#L80-L85
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/ModuleEnvironments.java
ModuleEnvironments.fetchOne
public CMAEnvironment fetchOne(String spaceId, String environmentId) { """ Fetch an environment with a given {@code environmentId} and space. <p> This method will override the configuration specified through {@link CMAClient.Builder#setSpaceId(String)}. @param spaceId space ID @param environmentId environment ID @return {@link CMAEnvironment} result instance @throws IllegalArgumentException if space id is null. @throws IllegalArgumentException if environment's id is null. """ assertNotNull(spaceId, "spaceId"); assertNotNull(environmentId, "environmentId"); return service.fetchOne(spaceId, environmentId).blockingFirst(); }
java
public CMAEnvironment fetchOne(String spaceId, String environmentId) { assertNotNull(spaceId, "spaceId"); assertNotNull(environmentId, "environmentId"); return service.fetchOne(spaceId, environmentId).blockingFirst(); }
[ "public", "CMAEnvironment", "fetchOne", "(", "String", "spaceId", ",", "String", "environmentId", ")", "{", "assertNotNull", "(", "spaceId", ",", "\"spaceId\"", ")", ";", "assertNotNull", "(", "environmentId", ",", "\"environmentId\"", ")", ";", "return", "service...
Fetch an environment with a given {@code environmentId} and space. <p> This method will override the configuration specified through {@link CMAClient.Builder#setSpaceId(String)}. @param spaceId space ID @param environmentId environment ID @return {@link CMAEnvironment} result instance @throws IllegalArgumentException if space id is null. @throws IllegalArgumentException if environment's id is null.
[ "Fetch", "an", "environment", "with", "a", "given", "{", "@code", "environmentId", "}", "and", "space", ".", "<p", ">", "This", "method", "will", "override", "the", "configuration", "specified", "through", "{", "@link", "CMAClient", ".", "Builder#setSpaceId", ...
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleEnvironments.java#L227-L231
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java
WriteFileExtensions.write2File
public static void write2File(final Reader reader, final Writer writer) throws IOException { """ The Method write2File() reads from an opened Reader and writes it to the opened Writer. @param reader The opened Reader. @param writer The opened Writer. @throws IOException Signals that an I/O exception has occurred. """ int byt; while ((byt = reader.read()) != -1) { writer.write(byt); } }
java
public static void write2File(final Reader reader, final Writer writer) throws IOException { int byt; while ((byt = reader.read()) != -1) { writer.write(byt); } }
[ "public", "static", "void", "write2File", "(", "final", "Reader", "reader", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "int", "byt", ";", "while", "(", "(", "byt", "=", "reader", ".", "read", "(", ")", ")", "!=", "-", "1", "...
The Method write2File() reads from an opened Reader and writes it to the opened Writer. @param reader The opened Reader. @param writer The opened Writer. @throws IOException Signals that an I/O exception has occurred.
[ "The", "Method", "write2File", "()", "reads", "from", "an", "opened", "Reader", "and", "writes", "it", "to", "the", "opened", "Writer", "." ]
train
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/write/WriteFileExtensions.java#L252-L259
CloudSlang/cs-actions
cs-vmware/src/main/java/io/cloudslang/content/vmware/services/ClusterComputeResourceService.java
ClusterComputeResourceService.updateOrAddVmOverride
public Map<String, String> updateOrAddVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs, final String restartPriority) throws Exception { """ Das method looks into das Cluster’s list of VM overrides to update das VM’s restartPriority value. If a VM override is found, das value will be updated, otherwise a new “override” will be created and added to das list. @param httpInputs @param vmInputs @param restartPriority @return @throws Exception """ final ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { final ManagedObjectReference vmMor = getVirtualMachineReference(vmInputs, connectionResources); final ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); final ClusterConfigInfoEx clusterConfigInfoEx = getClusterConfiguration(connectionResources, clusterMor, vmInputs.getClusterName()); final ClusterDasVmConfigSpec clusterDasVmConfigSpec = getClusterVmConfiguration(clusterConfigInfoEx, vmMor, restartPriority); final ManagedObjectReference task = connectionResources.getVimPortType() .reconfigureComputeResourceTask(clusterMor, createClusterConfigSpecEx(clusterConfigInfoEx, clusterDasVmConfigSpec), true); return new ResponseHelper(connectionResources, task) .getResultsMap(String.format(SUCCESS_MSG, vmInputs.getClusterName(), task.getValue()), String.format(FAILURE_MSG, vmInputs.getClusterName())); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
java
public Map<String, String> updateOrAddVmOverride(final HttpInputs httpInputs, final VmInputs vmInputs, final String restartPriority) throws Exception { final ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { final ManagedObjectReference vmMor = getVirtualMachineReference(vmInputs, connectionResources); final ManagedObjectReference clusterMor = new MorObjectHandler().getSpecificMor(connectionResources, connectionResources.getMorRootFolder(), ClusterParameter.CLUSTER_COMPUTE_RESOURCE.getValue(), vmInputs.getClusterName()); final ClusterConfigInfoEx clusterConfigInfoEx = getClusterConfiguration(connectionResources, clusterMor, vmInputs.getClusterName()); final ClusterDasVmConfigSpec clusterDasVmConfigSpec = getClusterVmConfiguration(clusterConfigInfoEx, vmMor, restartPriority); final ManagedObjectReference task = connectionResources.getVimPortType() .reconfigureComputeResourceTask(clusterMor, createClusterConfigSpecEx(clusterConfigInfoEx, clusterDasVmConfigSpec), true); return new ResponseHelper(connectionResources, task) .getResultsMap(String.format(SUCCESS_MSG, vmInputs.getClusterName(), task.getValue()), String.format(FAILURE_MSG, vmInputs.getClusterName())); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
[ "public", "Map", "<", "String", ",", "String", ">", "updateOrAddVmOverride", "(", "final", "HttpInputs", "httpInputs", ",", "final", "VmInputs", "vmInputs", ",", "final", "String", "restartPriority", ")", "throws", "Exception", "{", "final", "ConnectionResources", ...
Das method looks into das Cluster’s list of VM overrides to update das VM’s restartPriority value. If a VM override is found, das value will be updated, otherwise a new “override” will be created and added to das list. @param httpInputs @param vmInputs @param restartPriority @return @throws Exception
[ "Das", "method", "looks", "into", "das", "Cluster’s", "list", "of", "VM", "overrides", "to", "update", "das", "VM’s", "restartPriority", "value", ".", "If", "a", "VM", "override", "is", "found", "das", "value", "will", "be", "updated", "otherwise", "a", "n...
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-vmware/src/main/java/io/cloudslang/content/vmware/services/ClusterComputeResourceService.java#L44-L67
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/factory/filter/binary/FactoryThresholdBinary.java
FactoryThresholdBinary.blockOtsu
public static <T extends ImageGray<T>> InputToBinary<T> blockOtsu(ConfigLength regionWidth, double scale, boolean down, boolean thresholdFromLocalBlocks, boolean otsu2, double tuning,Class<T> inputType) { """ Applies a non-overlapping block Otsu threshold @see ThresholdBlockOtsu @param regionWidth Approximate size of block region @param scale Scale factor adjust for threshold. 1.0 means no change. @param down Should it threshold up or down. @param inputType Type of input image @return Filter to binary """ if( BOverrideFactoryThresholdBinary.blockOtsu != null ) return BOverrideFactoryThresholdBinary.blockOtsu.handle(otsu2,regionWidth, tuning, scale, down, thresholdFromLocalBlocks, inputType); BlockProcessor processor = new ThresholdBlockOtsu(otsu2,tuning,scale,down); InputToBinary<GrayU8> otsu; if( BoofConcurrency.USE_CONCURRENT ) { otsu = new ThresholdBlock_MT<>(processor, regionWidth, thresholdFromLocalBlocks, GrayU8.class); } else { otsu = new ThresholdBlock<>(processor, regionWidth, thresholdFromLocalBlocks, GrayU8.class); } return new InputToBinarySwitch<>(otsu,inputType); }
java
public static <T extends ImageGray<T>> InputToBinary<T> blockOtsu(ConfigLength regionWidth, double scale, boolean down, boolean thresholdFromLocalBlocks, boolean otsu2, double tuning,Class<T> inputType) { if( BOverrideFactoryThresholdBinary.blockOtsu != null ) return BOverrideFactoryThresholdBinary.blockOtsu.handle(otsu2,regionWidth, tuning, scale, down, thresholdFromLocalBlocks, inputType); BlockProcessor processor = new ThresholdBlockOtsu(otsu2,tuning,scale,down); InputToBinary<GrayU8> otsu; if( BoofConcurrency.USE_CONCURRENT ) { otsu = new ThresholdBlock_MT<>(processor, regionWidth, thresholdFromLocalBlocks, GrayU8.class); } else { otsu = new ThresholdBlock<>(processor, regionWidth, thresholdFromLocalBlocks, GrayU8.class); } return new InputToBinarySwitch<>(otsu,inputType); }
[ "public", "static", "<", "T", "extends", "ImageGray", "<", "T", ">", ">", "InputToBinary", "<", "T", ">", "blockOtsu", "(", "ConfigLength", "regionWidth", ",", "double", "scale", ",", "boolean", "down", ",", "boolean", "thresholdFromLocalBlocks", ",", "boolean...
Applies a non-overlapping block Otsu threshold @see ThresholdBlockOtsu @param regionWidth Approximate size of block region @param scale Scale factor adjust for threshold. 1.0 means no change. @param down Should it threshold up or down. @param inputType Type of input image @return Filter to binary
[ "Applies", "a", "non", "-", "overlapping", "block", "Otsu", "threshold" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/factory/filter/binary/FactoryThresholdBinary.java#L217-L234
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/restore/CmsRestoreMessages.java
CmsRestoreMessages.messageMoved
public static String messageMoved(String onlinePath, String offlinePath) { """ Message accessor.<p> @param onlinePath the path of the resource in the online project @param offlinePath the path of the resource in the offline path @return the message text """ return Messages.get().key(Messages.GUI_RESTORE_RESOURCE_MOVED_2, onlinePath, offlinePath); }
java
public static String messageMoved(String onlinePath, String offlinePath) { return Messages.get().key(Messages.GUI_RESTORE_RESOURCE_MOVED_2, onlinePath, offlinePath); }
[ "public", "static", "String", "messageMoved", "(", "String", "onlinePath", ",", "String", "offlinePath", ")", "{", "return", "Messages", ".", "get", "(", ")", ".", "key", "(", "Messages", ".", "GUI_RESTORE_RESOURCE_MOVED_2", ",", "onlinePath", ",", "offlinePath"...
Message accessor.<p> @param onlinePath the path of the resource in the online project @param offlinePath the path of the resource in the offline path @return the message text
[ "Message", "accessor", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/restore/CmsRestoreMessages.java#L84-L87
ixa-ehu/ixa-pipe-ml
src/main/java/eus/ixa/ixa/pipe/ml/document/features/DocTargetFeatureGenerator.java
DocTargetFeatureGenerator.processRangeOptions
private void processRangeOptions(final Map<String, String> properties) { """ Process the options of which kind of features are to be generated. @param properties the properties map """ final String featuresRange = properties.get("range"); if (featuresRange.equalsIgnoreCase("coarse")) { this.isCoarse = true; } if (featuresRange.equalsIgnoreCase("fine")) { this.isFineGrained = true; } }
java
private void processRangeOptions(final Map<String, String> properties) { final String featuresRange = properties.get("range"); if (featuresRange.equalsIgnoreCase("coarse")) { this.isCoarse = true; } if (featuresRange.equalsIgnoreCase("fine")) { this.isFineGrained = true; } }
[ "private", "void", "processRangeOptions", "(", "final", "Map", "<", "String", ",", "String", ">", "properties", ")", "{", "final", "String", "featuresRange", "=", "properties", ".", "get", "(", "\"range\"", ")", ";", "if", "(", "featuresRange", ".", "equalsI...
Process the options of which kind of features are to be generated. @param properties the properties map
[ "Process", "the", "options", "of", "which", "kind", "of", "features", "are", "to", "be", "generated", "." ]
train
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/document/features/DocTargetFeatureGenerator.java#L98-L106
lagom/lagom
service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/RequestHeader.java
RequestHeader.withUri
public RequestHeader withUri(URI uri) { """ Return a copy of this request header with the given uri set. @param uri The uri to set. @return A copy of this request header. """ return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, principal, headers, lowercaseHeaders); }
java
public RequestHeader withUri(URI uri) { return new RequestHeader(method, uri, protocol, acceptedResponseProtocols, principal, headers, lowercaseHeaders); }
[ "public", "RequestHeader", "withUri", "(", "URI", "uri", ")", "{", "return", "new", "RequestHeader", "(", "method", ",", "uri", ",", "protocol", ",", "acceptedResponseProtocols", ",", "principal", ",", "headers", ",", "lowercaseHeaders", ")", ";", "}" ]
Return a copy of this request header with the given uri set. @param uri The uri to set. @return A copy of this request header.
[ "Return", "a", "copy", "of", "this", "request", "header", "with", "the", "given", "uri", "set", "." ]
train
https://github.com/lagom/lagom/blob/3763055a9d1aace793a5d970f4e688aea61b1a5a/service/javadsl/api/src/main/java/com/lightbend/lagom/javadsl/api/transport/RequestHeader.java#L102-L104
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/common/ByteCode.java
ByteCode.getPrevInstruction
public static <T> T getPrevInstruction(InstructionHandle startHandle, Class<T> clazz) { """ Get the previous instruction matching the given type of instruction (second parameter) @param startHandle Location to start from @param clazz Type of instruction to look for @return The instruction found (null if not found) """ InstructionHandle curHandle = startHandle; while (curHandle != null) { curHandle = curHandle.getPrev(); if (curHandle != null && clazz.isInstance(curHandle.getInstruction())) { return clazz.cast(curHandle.getInstruction()); } } return null; }
java
public static <T> T getPrevInstruction(InstructionHandle startHandle, Class<T> clazz) { InstructionHandle curHandle = startHandle; while (curHandle != null) { curHandle = curHandle.getPrev(); if (curHandle != null && clazz.isInstance(curHandle.getInstruction())) { return clazz.cast(curHandle.getInstruction()); } } return null; }
[ "public", "static", "<", "T", ">", "T", "getPrevInstruction", "(", "InstructionHandle", "startHandle", ",", "Class", "<", "T", ">", "clazz", ")", "{", "InstructionHandle", "curHandle", "=", "startHandle", ";", "while", "(", "curHandle", "!=", "null", ")", "{...
Get the previous instruction matching the given type of instruction (second parameter) @param startHandle Location to start from @param clazz Type of instruction to look for @return The instruction found (null if not found)
[ "Get", "the", "previous", "instruction", "matching", "the", "given", "type", "of", "instruction", "(", "second", "parameter", ")" ]
train
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/common/ByteCode.java#L155-L165
BlueBrain/bluima
modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/genia/Event.java
Event.setThemes_protein
public void setThemes_protein(int i, Protein v) { """ indexed setter for themes_protein - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array """ if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_themes_protein == null) jcasType.jcas.throwFeatMissing("themes_protein", "ch.epfl.bbp.uima.genia.Event"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_themes_protein), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_themes_protein), i, jcasType.ll_cas.ll_getFSRef(v));}
java
public void setThemes_protein(int i, Protein v) { if (Event_Type.featOkTst && ((Event_Type)jcasType).casFeat_themes_protein == null) jcasType.jcas.throwFeatMissing("themes_protein", "ch.epfl.bbp.uima.genia.Event"); jcasType.jcas.checkArrayBounds(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_themes_protein), i); jcasType.ll_cas.ll_setRefArrayValue(jcasType.ll_cas.ll_getRefValue(addr, ((Event_Type)jcasType).casFeatCode_themes_protein), i, jcasType.ll_cas.ll_getFSRef(v));}
[ "public", "void", "setThemes_protein", "(", "int", "i", ",", "Protein", "v", ")", "{", "if", "(", "Event_Type", ".", "featOkTst", "&&", "(", "(", "Event_Type", ")", "jcasType", ")", ".", "casFeat_themes_protein", "==", "null", ")", "jcasType", ".", "jcas",...
indexed setter for themes_protein - sets an indexed value - @generated @param i index in the array to set @param v value to set into the array
[ "indexed", "setter", "for", "themes_protein", "-", "sets", "an", "indexed", "value", "-" ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_typesystem/src/main/java/ch/epfl/bbp/uima/genia/Event.java#L141-L145
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapPath.java
ShrinkWrapPath.toAbsolutePath
@Override public Path toAbsolutePath() { """ Resolves relative paths against the root directory, normalizing as well. @see java.nio.file.Path#toAbsolutePath() """ // Already absolute? if (this.isAbsolute()) { return this; } // Else construct a new absolute path and normalize it final Path absolutePath = new ShrinkWrapPath(ArchivePath.SEPARATOR + this.path, this.fileSystem); final Path normalized = absolutePath.normalize(); return normalized; }
java
@Override public Path toAbsolutePath() { // Already absolute? if (this.isAbsolute()) { return this; } // Else construct a new absolute path and normalize it final Path absolutePath = new ShrinkWrapPath(ArchivePath.SEPARATOR + this.path, this.fileSystem); final Path normalized = absolutePath.normalize(); return normalized; }
[ "@", "Override", "public", "Path", "toAbsolutePath", "(", ")", "{", "// Already absolute?", "if", "(", "this", ".", "isAbsolute", "(", ")", ")", "{", "return", "this", ";", "}", "// Else construct a new absolute path and normalize it", "final", "Path", "absolutePath...
Resolves relative paths against the root directory, normalizing as well. @see java.nio.file.Path#toAbsolutePath()
[ "Resolves", "relative", "paths", "against", "the", "root", "directory", "normalizing", "as", "well", "." ]
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/nio2/file/ShrinkWrapPath.java#L508-L520
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java
Forward.addActionOutput
public void addActionOutput( String paramName, Object value ) { """ Adds an action output that will be made available in the request, through {@link PageFlowUtils#getActionOutput}. @param paramName the name of the action output. @param value the action output value. """ if ( paramName == null || paramName.length() == 0 ) { throw new IllegalArgumentException( "An action output name may not be null or empty." ); } if ( _actionOutputs == null ) { _actionOutputs = new HashMap(); } // // Throw an exception if this is a redirect, and if there was an action output. Action outputs are carried // in the request, and will be lost on redirects. // if ( _init && getRedirect() ) { String actionPath = _mappingPath != null ? _mappingPath : ""; String descrip = getName() != null ? getName() : getPath(); PageFlowException ex = new IllegalActionOutputException( descrip, actionPath, _flowController, paramName ); InternalUtils.throwPageFlowException( ex ); } _actionOutputs.put( paramName, value ); }
java
public void addActionOutput( String paramName, Object value ) { if ( paramName == null || paramName.length() == 0 ) { throw new IllegalArgumentException( "An action output name may not be null or empty." ); } if ( _actionOutputs == null ) { _actionOutputs = new HashMap(); } // // Throw an exception if this is a redirect, and if there was an action output. Action outputs are carried // in the request, and will be lost on redirects. // if ( _init && getRedirect() ) { String actionPath = _mappingPath != null ? _mappingPath : ""; String descrip = getName() != null ? getName() : getPath(); PageFlowException ex = new IllegalActionOutputException( descrip, actionPath, _flowController, paramName ); InternalUtils.throwPageFlowException( ex ); } _actionOutputs.put( paramName, value ); }
[ "public", "void", "addActionOutput", "(", "String", "paramName", ",", "Object", "value", ")", "{", "if", "(", "paramName", "==", "null", "||", "paramName", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"An...
Adds an action output that will be made available in the request, through {@link PageFlowUtils#getActionOutput}. @param paramName the name of the action output. @param value the action output value.
[ "Adds", "an", "action", "output", "that", "will", "be", "made", "available", "in", "the", "request", "through", "{", "@link", "PageFlowUtils#getActionOutput", "}", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/Forward.java#L965-L990
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java
GeometryFactory.createPolygon
public Polygon createPolygon(LinearRing exteriorRing, LinearRing[] interiorRings) { """ Create a new {@link Polygon}, given a shell and and array of holes. @param exteriorRing A {@link LinearRing} object that represents the outer ring. @param interiorRings An array of {@link LinearRing} objects representing the holes. @return Returns a {@link Polygon} object. """ if (exteriorRing == null) { return new Polygon(srid, precision); } LinearRing[] clones = null; if (interiorRings != null) { clones = new LinearRing[interiorRings.length]; for (int i = 0; i < interiorRings.length; i++) { clones[i] = (LinearRing) interiorRings[i].clone(); } } return new Polygon(srid, precision, (LinearRing) exteriorRing.clone(), clones); }
java
public Polygon createPolygon(LinearRing exteriorRing, LinearRing[] interiorRings) { if (exteriorRing == null) { return new Polygon(srid, precision); } LinearRing[] clones = null; if (interiorRings != null) { clones = new LinearRing[interiorRings.length]; for (int i = 0; i < interiorRings.length; i++) { clones[i] = (LinearRing) interiorRings[i].clone(); } } return new Polygon(srid, precision, (LinearRing) exteriorRing.clone(), clones); }
[ "public", "Polygon", "createPolygon", "(", "LinearRing", "exteriorRing", ",", "LinearRing", "[", "]", "interiorRings", ")", "{", "if", "(", "exteriorRing", "==", "null", ")", "{", "return", "new", "Polygon", "(", "srid", ",", "precision", ")", ";", "}", "L...
Create a new {@link Polygon}, given a shell and and array of holes. @param exteriorRing A {@link LinearRing} object that represents the outer ring. @param interiorRings An array of {@link LinearRing} objects representing the holes. @return Returns a {@link Polygon} object.
[ "Create", "a", "new", "{", "@link", "Polygon", "}", "given", "a", "shell", "and", "and", "array", "of", "holes", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/spatial/geometry/GeometryFactory.java#L175-L187
RestComm/sip-servlets
sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java
FacebookRestClient.feed_publishActionOfUser
public boolean feed_publishActionOfUser(CharSequence title, CharSequence body) throws FacebookException, IOException { """ Publish the notification of an action taken by a user to newsfeed. @param title the title of the feed story (up to 60 characters, excluding tags) @param body (optional) the body of the feed story (up to 200 characters, excluding tags) @return whether the story was successfully published; false in case of permission error @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishActionOfUser"> Developers Wiki: Feed.publishActionOfUser</a> """ return feed_publishActionOfUser(title, body, null); }
java
public boolean feed_publishActionOfUser(CharSequence title, CharSequence body) throws FacebookException, IOException { return feed_publishActionOfUser(title, body, null); }
[ "public", "boolean", "feed_publishActionOfUser", "(", "CharSequence", "title", ",", "CharSequence", "body", ")", "throws", "FacebookException", ",", "IOException", "{", "return", "feed_publishActionOfUser", "(", "title", ",", "body", ",", "null", ")", ";", "}" ]
Publish the notification of an action taken by a user to newsfeed. @param title the title of the feed story (up to 60 characters, excluding tags) @param body (optional) the body of the feed story (up to 200 characters, excluding tags) @return whether the story was successfully published; false in case of permission error @see <a href="http://wiki.developers.facebook.com/index.php/Feed.publishActionOfUser"> Developers Wiki: Feed.publishActionOfUser</a>
[ "Publish", "the", "notification", "of", "an", "action", "taken", "by", "a", "user", "to", "newsfeed", "." ]
train
https://github.com/RestComm/sip-servlets/blob/fd7011d2803ab1d205b140768a760c8c69e0c997/sip-servlets-examples/facebook-c2c/src/main/java/com/facebook/api/FacebookRestClient.java#L300-L303
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositions.java
SuperPositions.superposeAtOrigin
public static Matrix4d superposeAtOrigin(Point3d[] fixed, Point3d[] moved) { """ Use the {@link SuperPosition#superpose(Point3d[], Point3d[])} method of the default static SuperPosition algorithm contained in this Class, assuming that the point arrays are centered at the origin. """ superposer.setCentered(true); return superposer.superpose(fixed, moved); }
java
public static Matrix4d superposeAtOrigin(Point3d[] fixed, Point3d[] moved) { superposer.setCentered(true); return superposer.superpose(fixed, moved); }
[ "public", "static", "Matrix4d", "superposeAtOrigin", "(", "Point3d", "[", "]", "fixed", ",", "Point3d", "[", "]", "moved", ")", "{", "superposer", ".", "setCentered", "(", "true", ")", ";", "return", "superposer", ".", "superpose", "(", "fixed", ",", "move...
Use the {@link SuperPosition#superpose(Point3d[], Point3d[])} method of the default static SuperPosition algorithm contained in this Class, assuming that the point arrays are centered at the origin.
[ "Use", "the", "{" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/SuperPositions.java#L58-L61
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuDeviceGetP2PAttribute
public static int cuDeviceGetP2PAttribute(int value[], int attrib, CUdevice srcDevice, CUdevice dstDevice) { """ Queries attributes of the link between two devices.<br> <br> Returns in *value the value of the requested attribute attrib of the link between srcDevice and dstDevice. The supported attributes are: <ul> <li>CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK: A relative value indicating the performance of the link between two devices.</li> <li>CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED P2P: 1 if P2P Access is enable.</li> <li>CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED: 1 if Atomic operations over the link are supported.</li> </ul> Returns ::CUDA_ERROR_INVALID_DEVICE if srcDevice or dstDevice are not valid or if they represent the same device.<br> <br> Returns ::CUDA_ERROR_INVALID_VALUE if attrib is not valid or if value is a null pointer.<br> @param value Returned value of the requested attribute @param attrib The requested attribute of the link between \p srcDevice and \p dstDevice. @param srcDevice The source device of the target link. @param dstDevice The destination device of the target link. @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_DEVICE, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuCtxEnablePeerAccess @see JCudaDriver#cuCtxDisablePeerAccess @see JCudaDriver#cuCtxCanAccessPeer """ return checkResult(cuDeviceGetP2PAttributeNative(value, attrib, srcDevice, dstDevice)); }
java
public static int cuDeviceGetP2PAttribute(int value[], int attrib, CUdevice srcDevice, CUdevice dstDevice) { return checkResult(cuDeviceGetP2PAttributeNative(value, attrib, srcDevice, dstDevice)); }
[ "public", "static", "int", "cuDeviceGetP2PAttribute", "(", "int", "value", "[", "]", ",", "int", "attrib", ",", "CUdevice", "srcDevice", ",", "CUdevice", "dstDevice", ")", "{", "return", "checkResult", "(", "cuDeviceGetP2PAttributeNative", "(", "value", ",", "at...
Queries attributes of the link between two devices.<br> <br> Returns in *value the value of the requested attribute attrib of the link between srcDevice and dstDevice. The supported attributes are: <ul> <li>CU_DEVICE_P2P_ATTRIBUTE_PERFORMANCE_RANK: A relative value indicating the performance of the link between two devices.</li> <li>CU_DEVICE_P2P_ATTRIBUTE_ACCESS_SUPPORTED P2P: 1 if P2P Access is enable.</li> <li>CU_DEVICE_P2P_ATTRIBUTE_NATIVE_ATOMIC_SUPPORTED: 1 if Atomic operations over the link are supported.</li> </ul> Returns ::CUDA_ERROR_INVALID_DEVICE if srcDevice or dstDevice are not valid or if they represent the same device.<br> <br> Returns ::CUDA_ERROR_INVALID_VALUE if attrib is not valid or if value is a null pointer.<br> @param value Returned value of the requested attribute @param attrib The requested attribute of the link between \p srcDevice and \p dstDevice. @param srcDevice The source device of the target link. @param dstDevice The destination device of the target link. @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_DEVICE, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuCtxEnablePeerAccess @see JCudaDriver#cuCtxDisablePeerAccess @see JCudaDriver#cuCtxCanAccessPeer
[ "Queries", "attributes", "of", "the", "link", "between", "two", "devices", ".", "<br", ">", "<br", ">", "Returns", "in", "*", "value", "the", "value", "of", "the", "requested", "attribute", "attrib", "of", "the", "link", "between", "srcDevice", "and", "dst...
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L11575-L11578
google/error-prone
check_api/src/main/java/com/google/errorprone/apply/SourceFile.java
SourceFile.getFragmentByLines
public String getFragmentByLines(int startLine, int endLine) { """ Returns a fragment of the source code between the two stated line numbers. The parameters represent <b>inclusive</b> line numbers. <p>The returned fragment will end in a newline. """ Preconditions.checkArgument(startLine <= endLine); return Joiner.on("\n").join(getLines(startLine, endLine)) + "\n"; }
java
public String getFragmentByLines(int startLine, int endLine) { Preconditions.checkArgument(startLine <= endLine); return Joiner.on("\n").join(getLines(startLine, endLine)) + "\n"; }
[ "public", "String", "getFragmentByLines", "(", "int", "startLine", ",", "int", "endLine", ")", "{", "Preconditions", ".", "checkArgument", "(", "startLine", "<=", "endLine", ")", ";", "return", "Joiner", ".", "on", "(", "\"\\n\"", ")", ".", "join", "(", "g...
Returns a fragment of the source code between the two stated line numbers. The parameters represent <b>inclusive</b> line numbers. <p>The returned fragment will end in a newline.
[ "Returns", "a", "fragment", "of", "the", "source", "code", "between", "the", "two", "stated", "line", "numbers", ".", "The", "parameters", "represent", "<b", ">", "inclusive<", "/", "b", ">", "line", "numbers", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/apply/SourceFile.java#L97-L100
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/compiler/Compiler.java
Compiler.compileSource0
private Class<?> compileSource0(String className, String sourceCode) throws Exception { """ Compiles multiple sources file and loads the classes. @param sourceFiles the source files to compile. @param parentLoader the parent class loader to use when loading classes. @return a map of compiled classes. This maps class names to Class objects. @throws Exception """ List<MemorySourceJavaFileObject> compUnits = new ArrayList<MemorySourceJavaFileObject>(1); compUnits.add(new MemorySourceJavaFileObject(className + ".java", sourceCode)); DiagnosticCollector<JavaFileObject> diag = new DiagnosticCollector<JavaFileObject>(); Boolean result = compiler.getTask(null, fileManager, diag, compilerOptions, null, compUnits).call(); if (result.equals(Boolean.FALSE)) { throw new RuntimeException(diag.getDiagnostics().toString()); } try { String classDotName = className.replace('/', '.'); return Class.forName(classDotName, true, loader); } catch (ClassNotFoundException e) { throw e; } }
java
private Class<?> compileSource0(String className, String sourceCode) throws Exception { List<MemorySourceJavaFileObject> compUnits = new ArrayList<MemorySourceJavaFileObject>(1); compUnits.add(new MemorySourceJavaFileObject(className + ".java", sourceCode)); DiagnosticCollector<JavaFileObject> diag = new DiagnosticCollector<JavaFileObject>(); Boolean result = compiler.getTask(null, fileManager, diag, compilerOptions, null, compUnits).call(); if (result.equals(Boolean.FALSE)) { throw new RuntimeException(diag.getDiagnostics().toString()); } try { String classDotName = className.replace('/', '.'); return Class.forName(classDotName, true, loader); } catch (ClassNotFoundException e) { throw e; } }
[ "private", "Class", "<", "?", ">", "compileSource0", "(", "String", "className", ",", "String", "sourceCode", ")", "throws", "Exception", "{", "List", "<", "MemorySourceJavaFileObject", ">", "compUnits", "=", "new", "ArrayList", "<", "MemorySourceJavaFileObject", ...
Compiles multiple sources file and loads the classes. @param sourceFiles the source files to compile. @param parentLoader the parent class loader to use when loading classes. @return a map of compiled classes. This maps class names to Class objects. @throws Exception
[ "Compiles", "multiple", "sources", "file", "and", "loads", "the", "classes", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/compiler/Compiler.java#L100-L115
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/CmsEditorBase.java
CmsEditorBase.addEntityChangeHandler
public void addEntityChangeHandler(String entityId, ValueChangeHandler<CmsEntity> handler) { """ Adds the value change handler to the entity with the given id.<p> @param entityId the entity id @param handler the change handler """ CmsEntity entity = m_entityBackend.getEntity(entityId); if (entity != null) { entity.addValueChangeHandler(handler); } }
java
public void addEntityChangeHandler(String entityId, ValueChangeHandler<CmsEntity> handler) { CmsEntity entity = m_entityBackend.getEntity(entityId); if (entity != null) { entity.addValueChangeHandler(handler); } }
[ "public", "void", "addEntityChangeHandler", "(", "String", "entityId", ",", "ValueChangeHandler", "<", "CmsEntity", ">", "handler", ")", "{", "CmsEntity", "entity", "=", "m_entityBackend", ".", "getEntity", "(", "entityId", ")", ";", "if", "(", "entity", "!=", ...
Adds the value change handler to the entity with the given id.<p> @param entityId the entity id @param handler the change handler
[ "Adds", "the", "value", "change", "handler", "to", "the", "entity", "with", "the", "given", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsEditorBase.java#L267-L273
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ZoneMeta.java
ZoneMeta.getCustomTimeZone
public static SimpleTimeZone getCustomTimeZone(int offset) { """ Creates a custom zone for the offset @param offset GMT offset in milliseconds @return A custom TimeZone for the offset with normalized time zone id """ boolean negative = false; int tmp = offset; if (offset < 0) { negative = true; tmp = -offset; } int hour, min, sec; if (ASSERT) { Assert.assrt("millis!=0", tmp % 1000 != 0); } tmp /= 1000; sec = tmp % 60; tmp /= 60; min = tmp % 60; hour = tmp / 60; // Note: No millisecond part included in TZID for now String zid = formatCustomID(hour, min, sec, negative); return new SimpleTimeZone(offset, zid); }
java
public static SimpleTimeZone getCustomTimeZone(int offset) { boolean negative = false; int tmp = offset; if (offset < 0) { negative = true; tmp = -offset; } int hour, min, sec; if (ASSERT) { Assert.assrt("millis!=0", tmp % 1000 != 0); } tmp /= 1000; sec = tmp % 60; tmp /= 60; min = tmp % 60; hour = tmp / 60; // Note: No millisecond part included in TZID for now String zid = formatCustomID(hour, min, sec, negative); return new SimpleTimeZone(offset, zid); }
[ "public", "static", "SimpleTimeZone", "getCustomTimeZone", "(", "int", "offset", ")", "{", "boolean", "negative", "=", "false", ";", "int", "tmp", "=", "offset", ";", "if", "(", "offset", "<", "0", ")", "{", "negative", "=", "true", ";", "tmp", "=", "-...
Creates a custom zone for the offset @param offset GMT offset in milliseconds @return A custom TimeZone for the offset with normalized time zone id
[ "Creates", "a", "custom", "zone", "for", "the", "offset" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ZoneMeta.java#L775-L798
Azure/azure-sdk-for-java
cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java
BingImagesImpl.trendingAsync
public ServiceFuture<TrendingImages> trendingAsync(TrendingOptionalParameter trendingOptionalParameter, final ServiceCallback<TrendingImages> serviceCallback) { """ The Image Trending Search API lets you search on Bing and get back a list of images that are trending based on search requests made by others. The images are broken out into different categories. For example, Popular People Searches. For a list of markets that support trending images, see [Trending Images](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-image-search/trending-images). @param trendingOptionalParameter the object representing the optional parameters to be set before calling this API @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object """ return ServiceFuture.fromResponse(trendingWithServiceResponseAsync(trendingOptionalParameter), serviceCallback); }
java
public ServiceFuture<TrendingImages> trendingAsync(TrendingOptionalParameter trendingOptionalParameter, final ServiceCallback<TrendingImages> serviceCallback) { return ServiceFuture.fromResponse(trendingWithServiceResponseAsync(trendingOptionalParameter), serviceCallback); }
[ "public", "ServiceFuture", "<", "TrendingImages", ">", "trendingAsync", "(", "TrendingOptionalParameter", "trendingOptionalParameter", ",", "final", "ServiceCallback", "<", "TrendingImages", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", ...
The Image Trending Search API lets you search on Bing and get back a list of images that are trending based on search requests made by others. The images are broken out into different categories. For example, Popular People Searches. For a list of markets that support trending images, see [Trending Images](https://docs.microsoft.com/en-us/azure/cognitive-services/bing-image-search/trending-images). @param trendingOptionalParameter the object representing the optional parameters to be set before calling this API @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "The", "Image", "Trending", "Search", "API", "lets", "you", "search", "on", "Bing", "and", "get", "back", "a", "list", "of", "images", "that", "are", "trending", "based", "on", "search", "requests", "made", "by", "others", ".", "The", "images", "are", "b...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/search/bingimagesearch/src/main/java/com/microsoft/azure/cognitiveservices/search/imagesearch/implementation/BingImagesImpl.java#L797-L799
molgenis/molgenis
molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java
PostgreSqlRepositoryCollection.updateReadonly
private void updateReadonly(EntityType entityType, Attribute attr, Attribute updatedAttr) { """ Updates triggers and functions based on attribute readonly changes. @param entityType entity meta data @param attr current attribute @param updatedAttr updated attribute """ Map<String, Attribute> readonlyTableAttrs = getTableAttributesReadonly(entityType) .collect(toLinkedMap(Attribute::getName, Function.identity())); if (!readonlyTableAttrs.isEmpty()) { dropTableTriggers(entityType); } if (attr.isReadOnly() && !updatedAttr.isReadOnly()) { readonlyTableAttrs.remove(attr.getName()); } else if (!attr.isReadOnly() && updatedAttr.isReadOnly()) { readonlyTableAttrs.put(updatedAttr.getName(), updatedAttr); } if (!readonlyTableAttrs.isEmpty()) { createTableTriggers(entityType, readonlyTableAttrs.values()); } }
java
private void updateReadonly(EntityType entityType, Attribute attr, Attribute updatedAttr) { Map<String, Attribute> readonlyTableAttrs = getTableAttributesReadonly(entityType) .collect(toLinkedMap(Attribute::getName, Function.identity())); if (!readonlyTableAttrs.isEmpty()) { dropTableTriggers(entityType); } if (attr.isReadOnly() && !updatedAttr.isReadOnly()) { readonlyTableAttrs.remove(attr.getName()); } else if (!attr.isReadOnly() && updatedAttr.isReadOnly()) { readonlyTableAttrs.put(updatedAttr.getName(), updatedAttr); } if (!readonlyTableAttrs.isEmpty()) { createTableTriggers(entityType, readonlyTableAttrs.values()); } }
[ "private", "void", "updateReadonly", "(", "EntityType", "entityType", ",", "Attribute", "attr", ",", "Attribute", "updatedAttr", ")", "{", "Map", "<", "String", ",", "Attribute", ">", "readonlyTableAttrs", "=", "getTableAttributesReadonly", "(", "entityType", ")", ...
Updates triggers and functions based on attribute readonly changes. @param entityType entity meta data @param attr current attribute @param updatedAttr updated attribute
[ "Updates", "triggers", "and", "functions", "based", "on", "attribute", "readonly", "changes", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L681-L698
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/LocationInventoryUrl.java
LocationInventoryUrl.addLocationInventoryUrl
public static MozuUrl addLocationInventoryUrl(String locationCode, Boolean performUpserts) { """ Get Resource Url for AddLocationInventory @param locationCode The unique, user-defined code that identifies a location. @param performUpserts Query string parameter lets the service perform an update for a new or existing record. When run, the update occurs without throwing a conflict exception that the record exists. If true, the updates completes regardless of the record currently existing. By default, if no value is specified, the service assumes this value is false. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/locationinventory/{locationCode}?performUpserts={performUpserts}"); formatter.formatUrl("locationCode", locationCode); formatter.formatUrl("performUpserts", performUpserts); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl addLocationInventoryUrl(String locationCode, Boolean performUpserts) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/locationinventory/{locationCode}?performUpserts={performUpserts}"); formatter.formatUrl("locationCode", locationCode); formatter.formatUrl("performUpserts", performUpserts); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "addLocationInventoryUrl", "(", "String", "locationCode", ",", "Boolean", "performUpserts", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/locationinventory/{locationCode}?performUpserts={perfo...
Get Resource Url for AddLocationInventory @param locationCode The unique, user-defined code that identifies a location. @param performUpserts Query string parameter lets the service perform an update for a new or existing record. When run, the update occurs without throwing a conflict exception that the record exists. If true, the updates completes regardless of the record currently existing. By default, if no value is specified, the service assumes this value is false. @return String Resource Url
[ "Get", "Resource", "Url", "for", "AddLocationInventory" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/LocationInventoryUrl.java#L62-L68
vladmihalcea/db-util
src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java
SQLStatementCountValidator.assertSelectCount
public static void assertSelectCount(long expectedSelectCount) { """ Assert select statement count @param expectedSelectCount expected select statement count """ QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedSelectCount = queryCount.getSelect(); if (expectedSelectCount != recordedSelectCount) { throw new SQLSelectCountMismatchException(expectedSelectCount, recordedSelectCount); } }
java
public static void assertSelectCount(long expectedSelectCount) { QueryCount queryCount = QueryCountHolder.getGrandTotal(); long recordedSelectCount = queryCount.getSelect(); if (expectedSelectCount != recordedSelectCount) { throw new SQLSelectCountMismatchException(expectedSelectCount, recordedSelectCount); } }
[ "public", "static", "void", "assertSelectCount", "(", "long", "expectedSelectCount", ")", "{", "QueryCount", "queryCount", "=", "QueryCountHolder", ".", "getGrandTotal", "(", ")", ";", "long", "recordedSelectCount", "=", "queryCount", ".", "getSelect", "(", ")", "...
Assert select statement count @param expectedSelectCount expected select statement count
[ "Assert", "select", "statement", "count" ]
train
https://github.com/vladmihalcea/db-util/blob/81c8c8421253c9869db1d4e221668d7afbd69fd0/src/main/java/com/vladmihalcea/sql/SQLStatementCountValidator.java#L51-L57
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsADEManager.java
CmsADEManager.lookupConfiguration
public CmsADEConfigData lookupConfiguration(CmsObject cms, String rootPath) { """ Looks up the configuration data for a given sitemap path.<p> @param cms the current CMS context @param rootPath the root path for which the configuration data should be looked up @return the configuration data """ CmsADEConfigData configData = internalLookupConfiguration(cms, rootPath); return configData; }
java
public CmsADEConfigData lookupConfiguration(CmsObject cms, String rootPath) { CmsADEConfigData configData = internalLookupConfiguration(cms, rootPath); return configData; }
[ "public", "CmsADEConfigData", "lookupConfiguration", "(", "CmsObject", "cms", ",", "String", "rootPath", ")", "{", "CmsADEConfigData", "configData", "=", "internalLookupConfiguration", "(", "cms", ",", "rootPath", ")", ";", "return", "configData", ";", "}" ]
Looks up the configuration data for a given sitemap path.<p> @param cms the current CMS context @param rootPath the root path for which the configuration data should be looked up @return the configuration data
[ "Looks", "up", "the", "configuration", "data", "for", "a", "given", "sitemap", "path", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsADEManager.java#L1141-L1145
RobotiumTech/robotium
robotium-solo/src/main/java/com/robotium/solo/WebElementCreator.java
WebElementCreator.createWebElementAndAddInList
public void createWebElementAndAddInList(String webData, WebView webView) { """ Creates a {@ WebElement} object from the given text and {@code WebView} @param webData the data of the web element @param webView the {@code WebView} the text is shown in """ WebElement webElement = createWebElementAndSetLocation(webData, webView); if((webElement!=null)) webElements.add(webElement); }
java
public void createWebElementAndAddInList(String webData, WebView webView){ WebElement webElement = createWebElementAndSetLocation(webData, webView); if((webElement!=null)) webElements.add(webElement); }
[ "public", "void", "createWebElementAndAddInList", "(", "String", "webData", ",", "WebView", "webView", ")", "{", "WebElement", "webElement", "=", "createWebElementAndSetLocation", "(", "webData", ",", "webView", ")", ";", "if", "(", "(", "webElement", "!=", "null"...
Creates a {@ WebElement} object from the given text and {@code WebView} @param webData the data of the web element @param webView the {@code WebView} the text is shown in
[ "Creates", "a", "{", "@", "WebElement", "}", "object", "from", "the", "given", "text", "and", "{", "@code", "WebView", "}" ]
train
https://github.com/RobotiumTech/robotium/blob/75e567c38f26a6a87dc8bef90b3886a20e28d291/robotium-solo/src/main/java/com/robotium/solo/WebElementCreator.java#L84-L90
VoltDB/voltdb
src/frontend/org/voltdb/iv2/MpTransactionState.java
MpTransactionState.restartFragment
public void restartFragment(FragmentResponseMessage message, List<Long> masters, Map<Integer, Long> partitionMastersMap) { """ Restart this fragment after the fragment is mis-routed from MigratePartitionLeader If the masters have been updated, the fragment will be routed to its new master. The fragment will be routed to the old master. until new master is updated. @param message The mis-routed response message @param partitionMastersMap The current partition masters """ final int partionId = message.getPartitionId(); Long restartHsid = partitionMastersMap.get(partionId); Long hsid = message.getExecutorSiteId(); if (!hsid.equals(restartHsid)) { m_masterMapForFragmentRestart.clear(); m_masterMapForFragmentRestart.put(restartHsid, hsid); //The very first fragment is to be rerouted to the new leader, then all the follow-up fragments are routed //to new leaders. updateMasters(masters, partitionMastersMap); } if (restartHsid == null) { restartHsid = hsid; } if (tmLog.isDebugEnabled()) { tmLog.debug("Rerouted fragment from " + CoreUtils.hsIdToString(hsid) + " to " + CoreUtils.hsIdToString(restartHsid) + "\n" + m_remoteWork); } m_fragmentRestarted = true; m_mbox.send(restartHsid, m_remoteWork); }
java
public void restartFragment(FragmentResponseMessage message, List<Long> masters, Map<Integer, Long> partitionMastersMap) { final int partionId = message.getPartitionId(); Long restartHsid = partitionMastersMap.get(partionId); Long hsid = message.getExecutorSiteId(); if (!hsid.equals(restartHsid)) { m_masterMapForFragmentRestart.clear(); m_masterMapForFragmentRestart.put(restartHsid, hsid); //The very first fragment is to be rerouted to the new leader, then all the follow-up fragments are routed //to new leaders. updateMasters(masters, partitionMastersMap); } if (restartHsid == null) { restartHsid = hsid; } if (tmLog.isDebugEnabled()) { tmLog.debug("Rerouted fragment from " + CoreUtils.hsIdToString(hsid) + " to " + CoreUtils.hsIdToString(restartHsid) + "\n" + m_remoteWork); } m_fragmentRestarted = true; m_mbox.send(restartHsid, m_remoteWork); }
[ "public", "void", "restartFragment", "(", "FragmentResponseMessage", "message", ",", "List", "<", "Long", ">", "masters", ",", "Map", "<", "Integer", ",", "Long", ">", "partitionMastersMap", ")", "{", "final", "int", "partionId", "=", "message", ".", "getParti...
Restart this fragment after the fragment is mis-routed from MigratePartitionLeader If the masters have been updated, the fragment will be routed to its new master. The fragment will be routed to the old master. until new master is updated. @param message The mis-routed response message @param partitionMastersMap The current partition masters
[ "Restart", "this", "fragment", "after", "the", "fragment", "is", "mis", "-", "routed", "from", "MigratePartitionLeader", "If", "the", "masters", "have", "been", "updated", "the", "fragment", "will", "be", "routed", "to", "its", "new", "master", ".", "The", "...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/MpTransactionState.java#L648-L668
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.parseDateStrictly
@GwtIncompatible("incompatible method") public static Date parseDateStrictly(final String str, final String... parsePatterns) throws ParseException { """ <p>Parses a string representing a date by trying a variety of different parsers.</p> <p>The parse will try each parse pattern in turn. A parse is only deemed successful if it parses the whole of the input string. If no parse patterns match, a ParseException is thrown.</p> The parser parses strictly - it does not allow for dates such as "February 942, 1996". @param str the date to parse, not null @param parsePatterns the date format patterns to use, see SimpleDateFormat, not null @return the parsed date @throws IllegalArgumentException if the date string or pattern array is null @throws ParseException if none of the date patterns were suitable @since 2.5 """ return parseDateStrictly(str, null, parsePatterns); }
java
@GwtIncompatible("incompatible method") public static Date parseDateStrictly(final String str, final String... parsePatterns) throws ParseException { return parseDateStrictly(str, null, parsePatterns); }
[ "@", "GwtIncompatible", "(", "\"incompatible method\"", ")", "public", "static", "Date", "parseDateStrictly", "(", "final", "String", "str", ",", "final", "String", "...", "parsePatterns", ")", "throws", "ParseException", "{", "return", "parseDateStrictly", "(", "st...
<p>Parses a string representing a date by trying a variety of different parsers.</p> <p>The parse will try each parse pattern in turn. A parse is only deemed successful if it parses the whole of the input string. If no parse patterns match, a ParseException is thrown.</p> The parser parses strictly - it does not allow for dates such as "February 942, 1996". @param str the date to parse, not null @param parsePatterns the date format patterns to use, see SimpleDateFormat, not null @return the parsed date @throws IllegalArgumentException if the date string or pattern array is null @throws ParseException if none of the date patterns were suitable @since 2.5
[ "<p", ">", "Parses", "a", "string", "representing", "a", "date", "by", "trying", "a", "variety", "of", "different", "parsers", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L325-L328
nmorel/gwt-jackson
gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/writer/JsniCodeBlockBuilder.java
JsniCodeBlockBuilder.addStatement
public JsniCodeBlockBuilder addStatement( String format, Object... args ) { """ <p>addStatement</p> @param format a {@link java.lang.String} object. @param args a {@link java.lang.Object} object. @return a {@link com.github.nmorel.gwtjackson.rebind.writer.JsniCodeBlockBuilder} object. """ builder.addStatement( format, args ); return this; }
java
public JsniCodeBlockBuilder addStatement( String format, Object... args ) { builder.addStatement( format, args ); return this; }
[ "public", "JsniCodeBlockBuilder", "addStatement", "(", "String", "format", ",", "Object", "...", "args", ")", "{", "builder", ".", "addStatement", "(", "format", ",", "args", ")", ";", "return", "this", ";", "}" ]
<p>addStatement</p> @param format a {@link java.lang.String} object. @param args a {@link java.lang.Object} object. @return a {@link com.github.nmorel.gwtjackson.rebind.writer.JsniCodeBlockBuilder} object.
[ "<p", ">", "addStatement<", "/", "p", ">" ]
train
https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/rebind/writer/JsniCodeBlockBuilder.java#L63-L66
mikepenz/Crossfader
library/src/main/java/com/mikepenz/crossfader/Crossfader.java
Crossfader.setLeftMargin
protected void setLeftMargin(View view, int leftMargin) { """ define the left margin of the given view @param view @param leftMargin """ SlidingPaneLayout.LayoutParams lp = (SlidingPaneLayout.LayoutParams) view.getLayoutParams(); lp.leftMargin = leftMargin; lp.rightMargin = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { lp.setMarginStart(leftMargin); lp.setMarginEnd(0); } view.setLayoutParams(lp); }
java
protected void setLeftMargin(View view, int leftMargin) { SlidingPaneLayout.LayoutParams lp = (SlidingPaneLayout.LayoutParams) view.getLayoutParams(); lp.leftMargin = leftMargin; lp.rightMargin = 0; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { lp.setMarginStart(leftMargin); lp.setMarginEnd(0); } view.setLayoutParams(lp); }
[ "protected", "void", "setLeftMargin", "(", "View", "view", ",", "int", "leftMargin", ")", "{", "SlidingPaneLayout", ".", "LayoutParams", "lp", "=", "(", "SlidingPaneLayout", ".", "LayoutParams", ")", "view", ".", "getLayoutParams", "(", ")", ";", "lp", ".", ...
define the left margin of the given view @param view @param leftMargin
[ "define", "the", "left", "margin", "of", "the", "given", "view" ]
train
https://github.com/mikepenz/Crossfader/blob/b2e1ee461bc3bcdd897d83f0fad950663bdc73b4/library/src/main/java/com/mikepenz/crossfader/Crossfader.java#L393-L403
alkacon/opencms-core
src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java
CmsXmlContentPropertyHelper.convertPropertiesToClientFormat
public static Map<String, String> convertPropertiesToClientFormat( CmsObject cms, Map<String, String> props, Map<String, CmsXmlContentProperty> propConfig) { """ Converts a map of properties from server format to client format.<p> @param cms the CmsObject to use for VFS operations @param props the map of properties @param propConfig the property configuration @return the converted property map """ return convertProperties(cms, props, propConfig, true); }
java
public static Map<String, String> convertPropertiesToClientFormat( CmsObject cms, Map<String, String> props, Map<String, CmsXmlContentProperty> propConfig) { return convertProperties(cms, props, propConfig, true); }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "convertPropertiesToClientFormat", "(", "CmsObject", "cms", ",", "Map", "<", "String", ",", "String", ">", "props", ",", "Map", "<", "String", ",", "CmsXmlContentProperty", ">", "propConfig", ")", ...
Converts a map of properties from server format to client format.<p> @param cms the CmsObject to use for VFS operations @param props the map of properties @param propConfig the property configuration @return the converted property map
[ "Converts", "a", "map", "of", "properties", "from", "server", "format", "to", "client", "format", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/content/CmsXmlContentPropertyHelper.java#L144-L150
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convertToArray
public static Object convertToArray(Object source, Class<?> target) throws ConversionException { """ Convert to array @param source Source object @param target Target class @return Converted object @throws ConversionException If object can't be converted """ try { Class<?> targetType = target.getComponentType(); if (source.getClass().isArray()) { Object targetInstance = Array.newInstance(targetType, Array.getLength(source)); for (int i = 0; i < Array.getLength(source); i++) { Array.set(targetInstance, i, convert(Array.get(source, i), targetType)); } return targetInstance; } if (source instanceof Collection<?>) { Collection<?> sourceCollection = (Collection<?>) source; Object targetInstance = Array.newInstance(target.getComponentType(), sourceCollection.size()); Iterator<?> it = sourceCollection.iterator(); int i = 0; while (it.hasNext()) { Array.set(targetInstance, i++, convert(it.next(), targetType)); } return targetInstance; } throw new ConversionException("Unable to convert to array"); } catch (Exception ex) { throw new ConversionException("Error converting to array", ex); } }
java
public static Object convertToArray(Object source, Class<?> target) throws ConversionException { try { Class<?> targetType = target.getComponentType(); if (source.getClass().isArray()) { Object targetInstance = Array.newInstance(targetType, Array.getLength(source)); for (int i = 0; i < Array.getLength(source); i++) { Array.set(targetInstance, i, convert(Array.get(source, i), targetType)); } return targetInstance; } if (source instanceof Collection<?>) { Collection<?> sourceCollection = (Collection<?>) source; Object targetInstance = Array.newInstance(target.getComponentType(), sourceCollection.size()); Iterator<?> it = sourceCollection.iterator(); int i = 0; while (it.hasNext()) { Array.set(targetInstance, i++, convert(it.next(), targetType)); } return targetInstance; } throw new ConversionException("Unable to convert to array"); } catch (Exception ex) { throw new ConversionException("Error converting to array", ex); } }
[ "public", "static", "Object", "convertToArray", "(", "Object", "source", ",", "Class", "<", "?", ">", "target", ")", "throws", "ConversionException", "{", "try", "{", "Class", "<", "?", ">", "targetType", "=", "target", ".", "getComponentType", "(", ")", "...
Convert to array @param source Source object @param target Target class @return Converted object @throws ConversionException If object can't be converted
[ "Convert", "to", "array" ]
train
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L168-L192
apache/flink
flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java
OptimizerNode.addBroadcastConnection
public void addBroadcastConnection(String name, DagConnection broadcastConnection) { """ Adds the broadcast connection identified by the given {@code name} to this node. @param broadcastConnection The connection to add. """ this.broadcastConnectionNames.add(name); this.broadcastConnections.add(broadcastConnection); }
java
public void addBroadcastConnection(String name, DagConnection broadcastConnection) { this.broadcastConnectionNames.add(name); this.broadcastConnections.add(broadcastConnection); }
[ "public", "void", "addBroadcastConnection", "(", "String", "name", ",", "DagConnection", "broadcastConnection", ")", "{", "this", ".", "broadcastConnectionNames", ".", "add", "(", "name", ")", ";", "this", ".", "broadcastConnections", ".", "add", "(", "broadcastCo...
Adds the broadcast connection identified by the given {@code name} to this node. @param broadcastConnection The connection to add.
[ "Adds", "the", "broadcast", "connection", "identified", "by", "the", "given", "{", "@code", "name", "}", "to", "this", "node", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-optimizer/src/main/java/org/apache/flink/optimizer/dag/OptimizerNode.java#L318-L321
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/code/Types.java
Types.isConvertible
public boolean isConvertible(Type t, Type s, Warner warn) { """ Is t a subtype of or convertible via boxing/unboxing conversion to s? """ if (t.hasTag(ERROR)) { return true; } boolean tPrimitive = t.isPrimitive(); boolean sPrimitive = s.isPrimitive(); if (tPrimitive == sPrimitive) { return isSubtypeUnchecked(t, s, warn); } if (!allowBoxing) return false; return tPrimitive ? isSubtype(boxedClass(t).type, s) : isSubtype(unboxedType(t), s); }
java
public boolean isConvertible(Type t, Type s, Warner warn) { if (t.hasTag(ERROR)) { return true; } boolean tPrimitive = t.isPrimitive(); boolean sPrimitive = s.isPrimitive(); if (tPrimitive == sPrimitive) { return isSubtypeUnchecked(t, s, warn); } if (!allowBoxing) return false; return tPrimitive ? isSubtype(boxedClass(t).type, s) : isSubtype(unboxedType(t), s); }
[ "public", "boolean", "isConvertible", "(", "Type", "t", ",", "Type", "s", ",", "Warner", "warn", ")", "{", "if", "(", "t", ".", "hasTag", "(", "ERROR", ")", ")", "{", "return", "true", ";", "}", "boolean", "tPrimitive", "=", "t", ".", "isPrimitive", ...
Is t a subtype of or convertible via boxing/unboxing conversion to s?
[ "Is", "t", "a", "subtype", "of", "or", "convertible", "via", "boxing", "/", "unboxing", "conversion", "to", "s?" ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/code/Types.java#L292-L305
revelytix/spark
spark-http-client/src/main/java/spark/protocol/ProtocolDataSource.java
ProtocolDataSource.createPooledClient
private HttpClient createPooledClient() { """ Creates a new thread-safe HTTP connection pool for use with a data source. @param poolSize The size of the connection pool. @return A new connection pool with the given size. """ HttpParams connMgrParams = new BasicHttpParams(); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme(HTTP_SCHEME, PlainSocketFactory.getSocketFactory(), HTTP_PORT)); schemeRegistry.register(new Scheme(HTTPS_SCHEME, SSLSocketFactory.getSocketFactory(), HTTPS_PORT)); // All connections will be to the same endpoint, so no need for per-route configuration. // TODO See how this does in the presence of redirects. ConnManagerParams.setMaxTotalConnections(connMgrParams, poolSize); ConnManagerParams.setMaxConnectionsPerRoute(connMgrParams, new ConnPerRouteBean(poolSize)); ClientConnectionManager ccm = new ThreadSafeClientConnManager(connMgrParams, schemeRegistry); HttpParams httpParams = new BasicHttpParams(); HttpProtocolParams.setUseExpectContinue(httpParams, false); ConnManagerParams.setTimeout(httpParams, acquireTimeout * 1000); return new DefaultHttpClient(ccm, httpParams); }
java
private HttpClient createPooledClient() { HttpParams connMgrParams = new BasicHttpParams(); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme(HTTP_SCHEME, PlainSocketFactory.getSocketFactory(), HTTP_PORT)); schemeRegistry.register(new Scheme(HTTPS_SCHEME, SSLSocketFactory.getSocketFactory(), HTTPS_PORT)); // All connections will be to the same endpoint, so no need for per-route configuration. // TODO See how this does in the presence of redirects. ConnManagerParams.setMaxTotalConnections(connMgrParams, poolSize); ConnManagerParams.setMaxConnectionsPerRoute(connMgrParams, new ConnPerRouteBean(poolSize)); ClientConnectionManager ccm = new ThreadSafeClientConnManager(connMgrParams, schemeRegistry); HttpParams httpParams = new BasicHttpParams(); HttpProtocolParams.setUseExpectContinue(httpParams, false); ConnManagerParams.setTimeout(httpParams, acquireTimeout * 1000); return new DefaultHttpClient(ccm, httpParams); }
[ "private", "HttpClient", "createPooledClient", "(", ")", "{", "HttpParams", "connMgrParams", "=", "new", "BasicHttpParams", "(", ")", ";", "SchemeRegistry", "schemeRegistry", "=", "new", "SchemeRegistry", "(", ")", ";", "schemeRegistry", ".", "register", "(", "new...
Creates a new thread-safe HTTP connection pool for use with a data source. @param poolSize The size of the connection pool. @return A new connection pool with the given size.
[ "Creates", "a", "new", "thread", "-", "safe", "HTTP", "connection", "pool", "for", "use", "with", "a", "data", "source", "." ]
train
https://github.com/revelytix/spark/blob/d777d40c962bc66fdc04b7c3a66d20b777ff6fb4/spark-http-client/src/main/java/spark/protocol/ProtocolDataSource.java#L187-L205
LAW-Unimi/BUbiNG
src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveWriter.java
GZIPArchiveWriter.writeEntry
protected void writeEntry(final GZIPArchive.Entry entry) throws IOException { """ Writes the entry on the underlying stream. More precisely, it writes the GZIP header, the content of the (bufferized) deflater stream and then the CZIP trailer. """ // ID1 ID2 CM FLG this.output.write(GZIPArchive.GZIP_START); // MTIME writeLEInt(this.output, entry.mtime); // XFL OS this.output.write(GZIPArchive.XFL_OS); /* EXTRA begin */ // XLEN writeLEShort(this.output, GZIPArchive.XLEN); // SI1 SI2 (as in warc spec) this.output.write(GZIPArchive.SKIP_LEN); // LEN writeLEShort(this.output, GZIPArchive.SUB_LEN); // compressed-skip-length (as in warc spec) writeLEInt(this.output, entry.compressedSkipLength); // uncompressed length (as in warc spec) writeLEInt(this.output, entry.uncompressedSkipLength); /* EXTRA end */ // NAME this.output.write(entry.name); this.output.write(0); // COMMENT this.output.write(entry.comment); this.output.write(0); // compressed blocks this.output.write(deflaterStream.array, 0, deflaterStream.length); // CRC32 writeLEInt(this.output, entry.crc32); // ISIZE writeLEInt(this.output, entry.uncompressedSkipLength); }
java
protected void writeEntry(final GZIPArchive.Entry entry) throws IOException { // ID1 ID2 CM FLG this.output.write(GZIPArchive.GZIP_START); // MTIME writeLEInt(this.output, entry.mtime); // XFL OS this.output.write(GZIPArchive.XFL_OS); /* EXTRA begin */ // XLEN writeLEShort(this.output, GZIPArchive.XLEN); // SI1 SI2 (as in warc spec) this.output.write(GZIPArchive.SKIP_LEN); // LEN writeLEShort(this.output, GZIPArchive.SUB_LEN); // compressed-skip-length (as in warc spec) writeLEInt(this.output, entry.compressedSkipLength); // uncompressed length (as in warc spec) writeLEInt(this.output, entry.uncompressedSkipLength); /* EXTRA end */ // NAME this.output.write(entry.name); this.output.write(0); // COMMENT this.output.write(entry.comment); this.output.write(0); // compressed blocks this.output.write(deflaterStream.array, 0, deflaterStream.length); // CRC32 writeLEInt(this.output, entry.crc32); // ISIZE writeLEInt(this.output, entry.uncompressedSkipLength); }
[ "protected", "void", "writeEntry", "(", "final", "GZIPArchive", ".", "Entry", "entry", ")", "throws", "IOException", "{", "// ID1 ID2 CM FLG", "this", ".", "output", ".", "write", "(", "GZIPArchive", ".", "GZIP_START", ")", ";", "// MTIME", "writeLEInt", "(", ...
Writes the entry on the underlying stream. More precisely, it writes the GZIP header, the content of the (bufferized) deflater stream and then the CZIP trailer.
[ "Writes", "the", "entry", "on", "the", "underlying", "stream", "." ]
train
https://github.com/LAW-Unimi/BUbiNG/blob/e148acc90031a4f3967422705a9fb07ddaf155e4/src/it/unimi/di/law/warc/io/gzarc/GZIPArchiveWriter.java#L54-L114
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java
AsyncLoggerSet.waitForWriteQuorum
<V> Map<AsyncLogger, V> waitForWriteQuorum(QuorumCall<AsyncLogger, V> q, int timeoutMs, String operationName) throws IOException { """ Wait for a quorum of loggers to respond to the given call. If a quorum can't be achieved, throws a QuorumException. @param q the quorum call @param timeoutMs the number of millis to wait @param operationName textual description of the operation, for logging @return a map of successful results @throws QuorumException if a quorum doesn't respond with success @throws IOException if the thread is interrupted or times out """ int majority = getMajoritySize(); int numLoggers = loggers.size(); checkMajoritySize(majority, numLoggers); return waitForQuorumInternal(q, loggers.size(), majority, numLoggers - majority + 1, majority, timeoutMs, operationName); }
java
<V> Map<AsyncLogger, V> waitForWriteQuorum(QuorumCall<AsyncLogger, V> q, int timeoutMs, String operationName) throws IOException { int majority = getMajoritySize(); int numLoggers = loggers.size(); checkMajoritySize(majority, numLoggers); return waitForQuorumInternal(q, loggers.size(), majority, numLoggers - majority + 1, majority, timeoutMs, operationName); }
[ "<", "V", ">", "Map", "<", "AsyncLogger", ",", "V", ">", "waitForWriteQuorum", "(", "QuorumCall", "<", "AsyncLogger", ",", "V", ">", "q", ",", "int", "timeoutMs", ",", "String", "operationName", ")", "throws", "IOException", "{", "int", "majority", "=", ...
Wait for a quorum of loggers to respond to the given call. If a quorum can't be achieved, throws a QuorumException. @param q the quorum call @param timeoutMs the number of millis to wait @param operationName textual description of the operation, for logging @return a map of successful results @throws QuorumException if a quorum doesn't respond with success @throws IOException if the thread is interrupted or times out
[ "Wait", "for", "a", "quorum", "of", "loggers", "to", "respond", "to", "the", "given", "call", ".", "If", "a", "quorum", "can", "t", "be", "achieved", "throws", "a", "QuorumException", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/client/AsyncLoggerSet.java#L129-L136
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/util/ExtractorUtils.java
ExtractorUtils.getVcsUrl
public static String getVcsUrl(Map<String, String> env) { """ Get the VCS url from the Jenkins build environment. The search will one of "SVN_REVISION", "GIT_COMMIT", "P4_CHANGELIST" in the environment. @param env Th Jenkins build environment. @return The vcs url for supported VCS """ String url = env.get("SVN_URL"); if (StringUtils.isBlank(url)) { url = publicGitUrl(env.get("GIT_URL")); } if (StringUtils.isBlank(url)) { url = env.get("P4PORT"); } return url; }
java
public static String getVcsUrl(Map<String, String> env) { String url = env.get("SVN_URL"); if (StringUtils.isBlank(url)) { url = publicGitUrl(env.get("GIT_URL")); } if (StringUtils.isBlank(url)) { url = env.get("P4PORT"); } return url; }
[ "public", "static", "String", "getVcsUrl", "(", "Map", "<", "String", ",", "String", ">", "env", ")", "{", "String", "url", "=", "env", ".", "get", "(", "\"SVN_URL\"", ")", ";", "if", "(", "StringUtils", ".", "isBlank", "(", "url", ")", ")", "{", "...
Get the VCS url from the Jenkins build environment. The search will one of "SVN_REVISION", "GIT_COMMIT", "P4_CHANGELIST" in the environment. @param env Th Jenkins build environment. @return The vcs url for supported VCS
[ "Get", "the", "VCS", "url", "from", "the", "Jenkins", "build", "environment", ".", "The", "search", "will", "one", "of", "SVN_REVISION", "GIT_COMMIT", "P4_CHANGELIST", "in", "the", "environment", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/util/ExtractorUtils.java#L99-L108
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java
PublicIPAddressesInner.beginCreateOrUpdateAsync
public Observable<PublicIPAddressInner> beginCreateOrUpdateAsync(String resourceGroupName, String publicIpAddressName, PublicIPAddressInner parameters) { """ Creates or updates a static or dynamic public IP address. @param resourceGroupName The name of the resource group. @param publicIpAddressName The name of the public IP address. @param parameters Parameters supplied to the create or update public IP address operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PublicIPAddressInner object """ return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, publicIpAddressName, parameters).map(new Func1<ServiceResponse<PublicIPAddressInner>, PublicIPAddressInner>() { @Override public PublicIPAddressInner call(ServiceResponse<PublicIPAddressInner> response) { return response.body(); } }); }
java
public Observable<PublicIPAddressInner> beginCreateOrUpdateAsync(String resourceGroupName, String publicIpAddressName, PublicIPAddressInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, publicIpAddressName, parameters).map(new Func1<ServiceResponse<PublicIPAddressInner>, PublicIPAddressInner>() { @Override public PublicIPAddressInner call(ServiceResponse<PublicIPAddressInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "PublicIPAddressInner", ">", "beginCreateOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "publicIpAddressName", ",", "PublicIPAddressInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "...
Creates or updates a static or dynamic public IP address. @param resourceGroupName The name of the resource group. @param publicIpAddressName The name of the public IP address. @param parameters Parameters supplied to the create or update public IP address operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PublicIPAddressInner object
[ "Creates", "or", "updates", "a", "static", "or", "dynamic", "public", "IP", "address", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/PublicIPAddressesInner.java#L566-L573
operasoftware/operaprestodriver
src/com/opera/core/systems/OperaDesktopDriver.java
OperaDesktopDriver.findWidgetByStringId
public QuickWidget findWidgetByStringId(QuickWidgetType type, int windowId, String stringId) { """ Finds widget with the text specified by string id in the window with the given id. @param windowId id of parent window @param stringId string id of the widget @return QuickWidget or null if no matching widget found """ String text = desktopUtils.getString(stringId, true); return findWidgetByText(type, windowId, text); }
java
public QuickWidget findWidgetByStringId(QuickWidgetType type, int windowId, String stringId) { String text = desktopUtils.getString(stringId, true); return findWidgetByText(type, windowId, text); }
[ "public", "QuickWidget", "findWidgetByStringId", "(", "QuickWidgetType", "type", ",", "int", "windowId", ",", "String", "stringId", ")", "{", "String", "text", "=", "desktopUtils", ".", "getString", "(", "stringId", ",", "true", ")", ";", "return", "findWidgetBy...
Finds widget with the text specified by string id in the window with the given id. @param windowId id of parent window @param stringId string id of the widget @return QuickWidget or null if no matching widget found
[ "Finds", "widget", "with", "the", "text", "specified", "by", "string", "id", "in", "the", "window", "with", "the", "given", "id", "." ]
train
https://github.com/operasoftware/operaprestodriver/blob/1ccceda80f1c1a0489171d17dcaa6e7b18fb4c01/src/com/opera/core/systems/OperaDesktopDriver.java#L379-L383
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/Instructions.java
Instructions.mergeAndSkipExisting
public static Properties mergeAndSkipExisting(Properties props1, Properties props2) { """ Utility method to merge instructions from {@code props2} into the {@code props1}. The instructions from {@code props2} do not override the instructions from {@code props1} (when both contain the same instruction), so instructions from {@code props1} stay unchanged and are contained in the file set of instructions. <p> Notice that entries with empty values from {@code props2} are <strong>not</strong> merged. @param props1 the first set of instructions @param props2 the second set of instructions @return the new set of instructions containing the instructions from {@code props2} merged into {@code props1}. """ Properties properties = new Properties(); properties.putAll(props1); for (String key : props2.stringPropertyNames()) { if (!props1.containsKey(key) && !Strings.isNullOrEmpty(props2.getProperty(key))) { properties.put(key, props2.getProperty(key)); } } return properties; }
java
public static Properties mergeAndSkipExisting(Properties props1, Properties props2) { Properties properties = new Properties(); properties.putAll(props1); for (String key : props2.stringPropertyNames()) { if (!props1.containsKey(key) && !Strings.isNullOrEmpty(props2.getProperty(key))) { properties.put(key, props2.getProperty(key)); } } return properties; }
[ "public", "static", "Properties", "mergeAndSkipExisting", "(", "Properties", "props1", ",", "Properties", "props2", ")", "{", "Properties", "properties", "=", "new", "Properties", "(", ")", ";", "properties", ".", "putAll", "(", "props1", ")", ";", "for", "(",...
Utility method to merge instructions from {@code props2} into the {@code props1}. The instructions from {@code props2} do not override the instructions from {@code props1} (when both contain the same instruction), so instructions from {@code props1} stay unchanged and are contained in the file set of instructions. <p> Notice that entries with empty values from {@code props2} are <strong>not</strong> merged. @param props1 the first set of instructions @param props2 the second set of instructions @return the new set of instructions containing the instructions from {@code props2} merged into {@code props1}.
[ "Utility", "method", "to", "merge", "instructions", "from", "{", "@code", "props2", "}", "into", "the", "{", "@code", "props1", "}", ".", "The", "instructions", "from", "{", "@code", "props2", "}", "do", "not", "override", "the", "instructions", "from", "{...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/osgi/Instructions.java#L83-L92
apache/incubator-gobblin
gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java
JobLauncherFactory.newJobLauncher
public static @Nonnull JobLauncher newJobLauncher(Properties sysProps, Properties jobProps, SharedResourcesBroker<GobblinScopeTypes> instanceBroker, List<? extends Tag<?>> metadataTags) throws Exception { """ Create a new {@link JobLauncher}. <p> This method will never return a {@code null}. </p> @param sysProps system configuration properties @param jobProps job configuration properties @param instanceBroker @param metadataTags @return newly created {@link JobLauncher} """ String launcherTypeValue = sysProps.getProperty(ConfigurationKeys.JOB_LAUNCHER_TYPE_KEY, JobLauncherType.LOCAL.name()); return newJobLauncher(sysProps, jobProps, launcherTypeValue, instanceBroker, metadataTags); }
java
public static @Nonnull JobLauncher newJobLauncher(Properties sysProps, Properties jobProps, SharedResourcesBroker<GobblinScopeTypes> instanceBroker, List<? extends Tag<?>> metadataTags) throws Exception { String launcherTypeValue = sysProps.getProperty(ConfigurationKeys.JOB_LAUNCHER_TYPE_KEY, JobLauncherType.LOCAL.name()); return newJobLauncher(sysProps, jobProps, launcherTypeValue, instanceBroker, metadataTags); }
[ "public", "static", "@", "Nonnull", "JobLauncher", "newJobLauncher", "(", "Properties", "sysProps", ",", "Properties", "jobProps", ",", "SharedResourcesBroker", "<", "GobblinScopeTypes", ">", "instanceBroker", ",", "List", "<", "?", "extends", "Tag", "<", "?", ">"...
Create a new {@link JobLauncher}. <p> This method will never return a {@code null}. </p> @param sysProps system configuration properties @param jobProps job configuration properties @param instanceBroker @param metadataTags @return newly created {@link JobLauncher}
[ "Create", "a", "new", "{", "@link", "JobLauncher", "}", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-runtime/src/main/java/org/apache/gobblin/runtime/JobLauncherFactory.java#L102-L108
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java
XPathParser.initMatchPattern
public void initMatchPattern( Compiler compiler, String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException { """ Given an string, init an XPath object for pattern matches, in order that a parse doesn't have to be done each time the expression is evaluated. @param compiler The XPath object to be initialized. @param expression A String representing the XPath. @param namespaceContext An object that is able to resolve prefixes in the XPath to namespaces. @throws javax.xml.transform.TransformerException """ m_ops = compiler; m_namespaceContext = namespaceContext; m_functionTable = compiler.getFunctionTable(); Lexer lexer = new Lexer(compiler, namespaceContext, this); lexer.tokenize(expression); m_ops.setOp(0, OpCodes.OP_MATCHPATTERN); m_ops.setOp(OpMap.MAPINDEX_LENGTH, 2); nextToken(); Pattern(); if (null != m_token) { String extraTokens = ""; while (null != m_token) { extraTokens += "'" + m_token + "'"; nextToken(); if (null != m_token) extraTokens += ", "; } error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS, new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens); } // Terminate for safety. m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH)+1); m_ops.shrink(); }
java
public void initMatchPattern( Compiler compiler, String expression, PrefixResolver namespaceContext) throws javax.xml.transform.TransformerException { m_ops = compiler; m_namespaceContext = namespaceContext; m_functionTable = compiler.getFunctionTable(); Lexer lexer = new Lexer(compiler, namespaceContext, this); lexer.tokenize(expression); m_ops.setOp(0, OpCodes.OP_MATCHPATTERN); m_ops.setOp(OpMap.MAPINDEX_LENGTH, 2); nextToken(); Pattern(); if (null != m_token) { String extraTokens = ""; while (null != m_token) { extraTokens += "'" + m_token + "'"; nextToken(); if (null != m_token) extraTokens += ", "; } error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS, new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens); } // Terminate for safety. m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), OpCodes.ENDOP); m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH)+1); m_ops.shrink(); }
[ "public", "void", "initMatchPattern", "(", "Compiler", "compiler", ",", "String", "expression", ",", "PrefixResolver", "namespaceContext", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "m_ops", "=", "compiler", ";", "m_nam...
Given an string, init an XPath object for pattern matches, in order that a parse doesn't have to be done each time the expression is evaluated. @param compiler The XPath object to be initialized. @param expression A String representing the XPath. @param namespaceContext An object that is able to resolve prefixes in the XPath to namespaces. @throws javax.xml.transform.TransformerException
[ "Given", "an", "string", "init", "an", "XPath", "object", "for", "pattern", "matches", "in", "order", "that", "a", "parse", "doesn", "t", "have", "to", "be", "done", "each", "time", "the", "expression", "is", "evaluated", ".", "@param", "compiler", "The", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L177-L219
super-csv/super-csv
super-csv/src/main/java/org/supercsv/cellprocessor/constraint/RequireHashCode.java
RequireHashCode.execute
public Object execute(final Object value, final CsvContext context) { """ {@inheritDoc} @throws SuperCsvCellProcessorException if value is null @throws SuperCsvConstraintViolationException if value isn't one of the required hash codes """ validateInputNotNull(value, context); int hash = value.hashCode(); if( !requiredHashCodes.contains(hash) ) { throw new SuperCsvConstraintViolationException(String.format( "the hashcode of %d for value '%s' does not match any of the required hashcodes", hash, value), context, this); } return next.execute(value, context); }
java
public Object execute(final Object value, final CsvContext context) { validateInputNotNull(value, context); int hash = value.hashCode(); if( !requiredHashCodes.contains(hash) ) { throw new SuperCsvConstraintViolationException(String.format( "the hashcode of %d for value '%s' does not match any of the required hashcodes", hash, value), context, this); } return next.execute(value, context); }
[ "public", "Object", "execute", "(", "final", "Object", "value", ",", "final", "CsvContext", "context", ")", "{", "validateInputNotNull", "(", "value", ",", "context", ")", ";", "int", "hash", "=", "value", ".", "hashCode", "(", ")", ";", "if", "(", "!", ...
{@inheritDoc} @throws SuperCsvCellProcessorException if value is null @throws SuperCsvConstraintViolationException if value isn't one of the required hash codes
[ "{", "@inheritDoc", "}" ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/cellprocessor/constraint/RequireHashCode.java#L131-L142
Tirasa/ADSDDL
src/main/java/net/tirasa/adsddl/ntsd/SID.java
SID.parse
int parse(final IntBuffer buff, final int start) { """ Load the SID from the buffer returning the last SID segment position into the buffer. @param buff source buffer. @param start start loading position. @return last loading position. """ int pos = start; // Check for a SID (http://msdn.microsoft.com/en-us/library/cc230371.aspx) final byte[] sidHeader = NumberFacility.getBytes(buff.get(pos)); // Revision(1 byte): An 8-bit unsigned integer that specifies the revision level of the SID. // This value MUST be set to 0x01. revision = sidHeader[0]; //SubAuthorityCount (1 byte): An 8-bit unsigned integer that specifies the number of elements //in the SubAuthority array. The maximum number of elements allowed is 15. int subAuthorityCount = NumberFacility.getInt(sidHeader[1]); // IdentifierAuthority (6 bytes): A SID_IDENTIFIER_AUTHORITY structure that indicates the // authority under which the SID was created. It describes the entity that created the SID. // The Identifier Authority value {0,0,0,0,0,5} denotes SIDs created by the NT SID authority. identifierAuthority = new byte[6]; System.arraycopy(sidHeader, 2, identifierAuthority, 0, 2); pos++; System.arraycopy(NumberFacility.getBytes(buff.get(pos)), 0, identifierAuthority, 2, 4); // SubAuthority (variable): A variable length array of unsigned 32-bit integers that uniquely // identifies a principal relative to the IdentifierAuthority. Its length is determined by // SubAuthorityCount. for (int j = 0; j < subAuthorityCount; j++) { pos++; subAuthorities.add(Hex.reverse(NumberFacility.getBytes(buff.get(pos)))); } return pos; }
java
int parse(final IntBuffer buff, final int start) { int pos = start; // Check for a SID (http://msdn.microsoft.com/en-us/library/cc230371.aspx) final byte[] sidHeader = NumberFacility.getBytes(buff.get(pos)); // Revision(1 byte): An 8-bit unsigned integer that specifies the revision level of the SID. // This value MUST be set to 0x01. revision = sidHeader[0]; //SubAuthorityCount (1 byte): An 8-bit unsigned integer that specifies the number of elements //in the SubAuthority array. The maximum number of elements allowed is 15. int subAuthorityCount = NumberFacility.getInt(sidHeader[1]); // IdentifierAuthority (6 bytes): A SID_IDENTIFIER_AUTHORITY structure that indicates the // authority under which the SID was created. It describes the entity that created the SID. // The Identifier Authority value {0,0,0,0,0,5} denotes SIDs created by the NT SID authority. identifierAuthority = new byte[6]; System.arraycopy(sidHeader, 2, identifierAuthority, 0, 2); pos++; System.arraycopy(NumberFacility.getBytes(buff.get(pos)), 0, identifierAuthority, 2, 4); // SubAuthority (variable): A variable length array of unsigned 32-bit integers that uniquely // identifies a principal relative to the IdentifierAuthority. Its length is determined by // SubAuthorityCount. for (int j = 0; j < subAuthorityCount; j++) { pos++; subAuthorities.add(Hex.reverse(NumberFacility.getBytes(buff.get(pos)))); } return pos; }
[ "int", "parse", "(", "final", "IntBuffer", "buff", ",", "final", "int", "start", ")", "{", "int", "pos", "=", "start", ";", "// Check for a SID (http://msdn.microsoft.com/en-us/library/cc230371.aspx)", "final", "byte", "[", "]", "sidHeader", "=", "NumberFacility", "...
Load the SID from the buffer returning the last SID segment position into the buffer. @param buff source buffer. @param start start loading position. @return last loading position.
[ "Load", "the", "SID", "from", "the", "buffer", "returning", "the", "last", "SID", "segment", "position", "into", "the", "buffer", "." ]
train
https://github.com/Tirasa/ADSDDL/blob/16dad53e1222c7faa904c64394af94ba18f6d09c/src/main/java/net/tirasa/adsddl/ntsd/SID.java#L116-L149
apache/flink
flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java
Statistics.columnNullCount
public Statistics columnNullCount(String columnName, Long nullCount) { """ Sets the number of null values statistic for the given column. """ this.columnStats .computeIfAbsent(columnName, column -> new HashMap<>()) .put(NULL_COUNT, String.valueOf(nullCount)); return this; }
java
public Statistics columnNullCount(String columnName, Long nullCount) { this.columnStats .computeIfAbsent(columnName, column -> new HashMap<>()) .put(NULL_COUNT, String.valueOf(nullCount)); return this; }
[ "public", "Statistics", "columnNullCount", "(", "String", "columnName", ",", "Long", "nullCount", ")", "{", "this", ".", "columnStats", ".", "computeIfAbsent", "(", "columnName", ",", "column", "->", "new", "HashMap", "<>", "(", ")", ")", ".", "put", "(", ...
Sets the number of null values statistic for the given column.
[ "Sets", "the", "number", "of", "null", "values", "statistic", "for", "the", "given", "column", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-common/src/main/java/org/apache/flink/table/descriptors/Statistics.java#L101-L106
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java
DOM3TreeWalker.applyFilter
protected boolean applyFilter(Node node, int nodeType) { """ Applies a filter on the node to serialize @param node The Node to serialize @return True if the node is to be serialized else false if the node is to be rejected or skipped. """ if (fFilter != null && (fWhatToShowFilter & nodeType) != 0) { short code = fFilter.acceptNode(node); switch (code) { case NodeFilter.FILTER_REJECT : case NodeFilter.FILTER_SKIP : return false; // skip the node default : // fall through.. } } return true; }
java
protected boolean applyFilter(Node node, int nodeType) { if (fFilter != null && (fWhatToShowFilter & nodeType) != 0) { short code = fFilter.acceptNode(node); switch (code) { case NodeFilter.FILTER_REJECT : case NodeFilter.FILTER_SKIP : return false; // skip the node default : // fall through.. } } return true; }
[ "protected", "boolean", "applyFilter", "(", "Node", "node", ",", "int", "nodeType", ")", "{", "if", "(", "fFilter", "!=", "null", "&&", "(", "fWhatToShowFilter", "&", "nodeType", ")", "!=", "0", ")", "{", "short", "code", "=", "fFilter", ".", "acceptNode...
Applies a filter on the node to serialize @param node The Node to serialize @return True if the node is to be serialized else false if the node is to be rejected or skipped.
[ "Applies", "a", "filter", "on", "the", "node", "to", "serialize" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOM3TreeWalker.java#L476-L488
astrapi69/jaulp-wicket
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/request/mapper/HighScoreRequestMapper.java
HighScoreRequestMapper.newComparator
protected Comparator<RequestMapperBean> newComparator() { """ Factory method for creating a new Comparator for sort the compatibility score. This method is invoked in the method initializeRequestMappers and can be overridden so users can provide their own version of a Comparator. @return the new Comparator. """ return new Comparator<RequestMapperBean>() { @Override public int compare(final RequestMapperBean o1, final RequestMapperBean o2) { return o1.getCompatibilityScore() - o2.getCompatibilityScore(); } }; }
java
protected Comparator<RequestMapperBean> newComparator() { return new Comparator<RequestMapperBean>() { @Override public int compare(final RequestMapperBean o1, final RequestMapperBean o2) { return o1.getCompatibilityScore() - o2.getCompatibilityScore(); } }; }
[ "protected", "Comparator", "<", "RequestMapperBean", ">", "newComparator", "(", ")", "{", "return", "new", "Comparator", "<", "RequestMapperBean", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "final", "RequestMapperBean", "o1", ",", "f...
Factory method for creating a new Comparator for sort the compatibility score. This method is invoked in the method initializeRequestMappers and can be overridden so users can provide their own version of a Comparator. @return the new Comparator.
[ "Factory", "method", "for", "creating", "a", "new", "Comparator", "for", "sort", "the", "compatibility", "score", ".", "This", "method", "is", "invoked", "in", "the", "method", "initializeRequestMappers", "and", "can", "be", "overridden", "so", "users", "can", ...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/request/mapper/HighScoreRequestMapper.java#L168-L178
b3log/latke
latke-core/src/main/java/org/b3log/latke/util/Callstacks.java
Callstacks.printCallstack
public static void printCallstack(final Level logLevel, final String[] carePackages, final String[] exceptablePackages) { """ Prints call stack with the specified logging level. @param logLevel the specified logging level @param carePackages the specified packages to print, for example, ["org.b3log.latke", "org.b3log.solo"], {@code null} to care nothing @param exceptablePackages the specified packages to skip, for example, ["com.sun", "java.io", "org.b3log.solo.filter"], {@code null} to skip nothing """ if (null == logLevel) { LOGGER.log(Level.WARN, "Requires parameter [logLevel]"); return; } final Throwable throwable = new Throwable(); final StackTraceElement[] stackElements = throwable.getStackTrace(); if (null == stackElements) { LOGGER.log(Level.WARN, "Empty call stack"); return; } final long tId = Thread.currentThread().getId(); final StringBuilder stackBuilder = new StringBuilder("CallStack [tId=").append(tId).append(Strings.LINE_SEPARATOR); for (int i = 1; i < stackElements.length; i++) { final String stackElemClassName = stackElements[i].getClassName(); if (!StringUtils.startsWithAny(stackElemClassName, carePackages) || StringUtils.startsWithAny(stackElemClassName, exceptablePackages)) { continue; } stackBuilder.append(" [className=").append(stackElements[i].getClassName()).append(", fileName=").append(stackElements[i].getFileName()).append(", lineNumber=").append(stackElements[i].getLineNumber()).append(", methodName=").append(stackElements[i].getMethodName()).append(']').append( Strings.LINE_SEPARATOR); } stackBuilder.append("], full depth [").append(stackElements.length).append("]"); LOGGER.log(logLevel, stackBuilder.toString()); }
java
public static void printCallstack(final Level logLevel, final String[] carePackages, final String[] exceptablePackages) { if (null == logLevel) { LOGGER.log(Level.WARN, "Requires parameter [logLevel]"); return; } final Throwable throwable = new Throwable(); final StackTraceElement[] stackElements = throwable.getStackTrace(); if (null == stackElements) { LOGGER.log(Level.WARN, "Empty call stack"); return; } final long tId = Thread.currentThread().getId(); final StringBuilder stackBuilder = new StringBuilder("CallStack [tId=").append(tId).append(Strings.LINE_SEPARATOR); for (int i = 1; i < stackElements.length; i++) { final String stackElemClassName = stackElements[i].getClassName(); if (!StringUtils.startsWithAny(stackElemClassName, carePackages) || StringUtils.startsWithAny(stackElemClassName, exceptablePackages)) { continue; } stackBuilder.append(" [className=").append(stackElements[i].getClassName()).append(", fileName=").append(stackElements[i].getFileName()).append(", lineNumber=").append(stackElements[i].getLineNumber()).append(", methodName=").append(stackElements[i].getMethodName()).append(']').append( Strings.LINE_SEPARATOR); } stackBuilder.append("], full depth [").append(stackElements.length).append("]"); LOGGER.log(logLevel, stackBuilder.toString()); }
[ "public", "static", "void", "printCallstack", "(", "final", "Level", "logLevel", ",", "final", "String", "[", "]", "carePackages", ",", "final", "String", "[", "]", "exceptablePackages", ")", "{", "if", "(", "null", "==", "logLevel", ")", "{", "LOGGER", "....
Prints call stack with the specified logging level. @param logLevel the specified logging level @param carePackages the specified packages to print, for example, ["org.b3log.latke", "org.b3log.solo"], {@code null} to care nothing @param exceptablePackages the specified packages to skip, for example, ["com.sun", "java.io", "org.b3log.solo.filter"], {@code null} to skip nothing
[ "Prints", "call", "stack", "with", "the", "specified", "logging", "level", "." ]
train
https://github.com/b3log/latke/blob/f7e08a47eeecea5f7c94006382c24f353585de33/latke-core/src/main/java/org/b3log/latke/util/Callstacks.java#L72-L105
intellimate/Izou
src/main/java/org/intellimate/izou/security/storage/SecureStorageImpl.java
SecureStorageImpl.createKeyStore
private KeyStore createKeyStore(String fileName, String password) { """ Creates a new keystore for the izou aes key @param fileName the path to the keystore @param password the password to use with the keystore @return the newly created keystore """ File file = new File(fileName); KeyStore keyStore = null; try { keyStore = KeyStore.getInstance("JCEKS"); if (file.exists()) { keyStore.load(new FileInputStream(file), password.toCharArray()); } else { keyStore.load(null, null); keyStore.store(new FileOutputStream(fileName), password.toCharArray()); } } catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException e) { logger.error("Unable to create key store", e); } return keyStore; }
java
private KeyStore createKeyStore(String fileName, String password) { File file = new File(fileName); KeyStore keyStore = null; try { keyStore = KeyStore.getInstance("JCEKS"); if (file.exists()) { keyStore.load(new FileInputStream(file), password.toCharArray()); } else { keyStore.load(null, null); keyStore.store(new FileOutputStream(fileName), password.toCharArray()); } } catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException e) { logger.error("Unable to create key store", e); } return keyStore; }
[ "private", "KeyStore", "createKeyStore", "(", "String", "fileName", ",", "String", "password", ")", "{", "File", "file", "=", "new", "File", "(", "fileName", ")", ";", "KeyStore", "keyStore", "=", "null", ";", "try", "{", "keyStore", "=", "KeyStore", ".", ...
Creates a new keystore for the izou aes key @param fileName the path to the keystore @param password the password to use with the keystore @return the newly created keystore
[ "Creates", "a", "new", "keystore", "for", "the", "izou", "aes", "key" ]
train
https://github.com/intellimate/Izou/blob/40a808b97998e17655c4a78e30ce7326148aed27/src/main/java/org/intellimate/izou/security/storage/SecureStorageImpl.java#L241-L257
katjahahn/PortEx
src/main/java/com/github/katjahahn/parser/ByteArrayUtil.java
ByteArrayUtil.getBytesLongValue
public static long getBytesLongValue(byte[] bytes, int offset, int length) { """ Retrieves the long value of a subarray of bytes. <p> The values are considered little endian. The subarray is determined by offset and length. <p> Presumes the byte array to be not null and its length should be between 1 and 8 inclusive. The length of bytes must be larger than or equal to length + offset. @param bytes the little endian byte array that shall be converted to long @param offset the index to start reading the long value from @param length the number of bytes used to convert to long @return long value """ assert length <= 8 && length > 0; assert bytes != null && bytes.length >= length + offset; byte[] value = Arrays.copyOfRange(bytes, offset, offset + length); return bytesToLong(value); }
java
public static long getBytesLongValue(byte[] bytes, int offset, int length) { assert length <= 8 && length > 0; assert bytes != null && bytes.length >= length + offset; byte[] value = Arrays.copyOfRange(bytes, offset, offset + length); return bytesToLong(value); }
[ "public", "static", "long", "getBytesLongValue", "(", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ")", "{", "assert", "length", "<=", "8", "&&", "length", ">", "0", ";", "assert", "bytes", "!=", "null", "&&", "bytes", ".", ...
Retrieves the long value of a subarray of bytes. <p> The values are considered little endian. The subarray is determined by offset and length. <p> Presumes the byte array to be not null and its length should be between 1 and 8 inclusive. The length of bytes must be larger than or equal to length + offset. @param bytes the little endian byte array that shall be converted to long @param offset the index to start reading the long value from @param length the number of bytes used to convert to long @return long value
[ "Retrieves", "the", "long", "value", "of", "a", "subarray", "of", "bytes", ".", "<p", ">", "The", "values", "are", "considered", "little", "endian", ".", "The", "subarray", "is", "determined", "by", "offset", "and", "length", ".", "<p", ">", "Presumes", ...
train
https://github.com/katjahahn/PortEx/blob/319f08560aa58e3d5d7abe346ffdf623d6dc6990/src/main/java/com/github/katjahahn/parser/ByteArrayUtil.java#L100-L105
geomajas/geomajas-project-client-gwt2
api/src/main/java/org/geomajas/gwt2/client/map/layer/tile/TileConfiguration.java
TileConfiguration.setResolutions
public void setResolutions(List<Double> resolutions) { """ Set the list of resolutions for this configuration object. Each should represent a tile level. Know that resolutions passed through this method will be ordered from large values to small values (from zoom out to zoom in). @param resolutions The new list of resolutions. """ this.resolutions.clear(); this.resolutions.addAll(resolutions); Collections.sort(this.resolutions, new Comparator<Double>() { @Override public int compare(Double o1, Double o2) { return o2.compareTo(o1); } }); }
java
public void setResolutions(List<Double> resolutions) { this.resolutions.clear(); this.resolutions.addAll(resolutions); Collections.sort(this.resolutions, new Comparator<Double>() { @Override public int compare(Double o1, Double o2) { return o2.compareTo(o1); } }); }
[ "public", "void", "setResolutions", "(", "List", "<", "Double", ">", "resolutions", ")", "{", "this", ".", "resolutions", ".", "clear", "(", ")", ";", "this", ".", "resolutions", ".", "addAll", "(", "resolutions", ")", ";", "Collections", ".", "sort", "(...
Set the list of resolutions for this configuration object. Each should represent a tile level. Know that resolutions passed through this method will be ordered from large values to small values (from zoom out to zoom in). @param resolutions The new list of resolutions.
[ "Set", "the", "list", "of", "resolutions", "for", "this", "configuration", "object", ".", "Each", "should", "represent", "a", "tile", "level", ".", "Know", "that", "resolutions", "passed", "through", "this", "method", "will", "be", "ordered", "from", "large", ...
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/api/src/main/java/org/geomajas/gwt2/client/map/layer/tile/TileConfiguration.java#L155-L165
spring-projects/spring-ldap
samples/user-admin/src/main/java/org/springframework/ldap/samples/useradmin/service/UserService.java
UserService.updateUserStandard
private User updateUserStandard(LdapName originalId, User existingUser) { """ Update the user and - if its id changed - update all group references to the user. @param originalId the original id of the user. @param existingUser the user, populated with new data @return the updated entry """ User savedUser = userRepo.save(existingUser); if(!originalId.equals(savedUser.getId())) { // The user has moved - we need to update group references. LdapName oldMemberDn = toAbsoluteDn(originalId); LdapName newMemberDn = toAbsoluteDn(savedUser.getId()); Collection<Group> groups = groupRepo.findByMember(oldMemberDn); updateGroupReferences(groups, oldMemberDn, newMemberDn); } return savedUser; }
java
private User updateUserStandard(LdapName originalId, User existingUser) { User savedUser = userRepo.save(existingUser); if(!originalId.equals(savedUser.getId())) { // The user has moved - we need to update group references. LdapName oldMemberDn = toAbsoluteDn(originalId); LdapName newMemberDn = toAbsoluteDn(savedUser.getId()); Collection<Group> groups = groupRepo.findByMember(oldMemberDn); updateGroupReferences(groups, oldMemberDn, newMemberDn); } return savedUser; }
[ "private", "User", "updateUserStandard", "(", "LdapName", "originalId", ",", "User", "existingUser", ")", "{", "User", "savedUser", "=", "userRepo", ".", "save", "(", "existingUser", ")", ";", "if", "(", "!", "originalId", ".", "equals", "(", "savedUser", "....
Update the user and - if its id changed - update all group references to the user. @param originalId the original id of the user. @param existingUser the user, populated with new data @return the updated entry
[ "Update", "the", "user", "and", "-", "if", "its", "id", "changed", "-", "update", "all", "group", "references", "to", "the", "user", "." ]
train
https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/samples/user-admin/src/main/java/org/springframework/ldap/samples/useradmin/service/UserService.java#L141-L153
geomajas/geomajas-project-client-gwt
client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/SliderArea.java
SliderArea.drawMapRectangle
public void drawMapRectangle() { """ Provides a rectangle over the map, on which the onDrag event of {@link ZoomSliderController} is listening. An onUp event redraws this rectangle into the start rectangle with {@link SliderArea#drawStartRectangle()}. """ mapWidget.getVectorContext().drawRectangle(group, MAP_AREA, new Bbox(0, 0, mapWidget.getWidth(), mapWidget.getHeight()), // IE9 does not draw an empty shapestyle (new ShapeStyle()), but it does draw one with opacity = 0... new ShapeStyle("#00FF00", 0, "#00FF00", 0, 1)); // new ShapeStyle("#00FF00", 0.1f, "#00FF00", 0.5f, 1)); }
java
public void drawMapRectangle() { mapWidget.getVectorContext().drawRectangle(group, MAP_AREA, new Bbox(0, 0, mapWidget.getWidth(), mapWidget.getHeight()), // IE9 does not draw an empty shapestyle (new ShapeStyle()), but it does draw one with opacity = 0... new ShapeStyle("#00FF00", 0, "#00FF00", 0, 1)); // new ShapeStyle("#00FF00", 0.1f, "#00FF00", 0.5f, 1)); }
[ "public", "void", "drawMapRectangle", "(", ")", "{", "mapWidget", ".", "getVectorContext", "(", ")", ".", "drawRectangle", "(", "group", ",", "MAP_AREA", ",", "new", "Bbox", "(", "0", ",", "0", ",", "mapWidget", ".", "getWidth", "(", ")", ",", "mapWidget...
Provides a rectangle over the map, on which the onDrag event of {@link ZoomSliderController} is listening. An onUp event redraws this rectangle into the start rectangle with {@link SliderArea#drawStartRectangle()}.
[ "Provides", "a", "rectangle", "over", "the", "map", "on", "which", "the", "onDrag", "event", "of", "{" ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/client/src/main/java/org/geomajas/gwt/client/gfx/paintable/mapaddon/SliderArea.java#L86-L92
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
FSNamesystem.registerMBean
void registerMBean(Configuration conf) { """ Register the FSNamesystem MBean using the name "hadoop:service=NameNode,name=FSNamesystemState" """ // We wrap to bypass standard mbean naming convention. // This wraping can be removed in java 6 as it is more flexible in // package naming for mbeans and their impl. StandardMBean bean; try { versionBeanName = VersionInfo.registerJMX("NameNode"); myFSMetrics = new FSNamesystemMetrics(conf, this); bean = new StandardMBean(this, FSNamesystemMBean.class); mbeanName = MBeanUtil.registerMBean("NameNode", "FSNamesystemState", bean); } catch (NotCompliantMBeanException e) { e.printStackTrace(); } LOG.info("Registered FSNamesystemStatusMBean"); }
java
void registerMBean(Configuration conf) { // We wrap to bypass standard mbean naming convention. // This wraping can be removed in java 6 as it is more flexible in // package naming for mbeans and their impl. StandardMBean bean; try { versionBeanName = VersionInfo.registerJMX("NameNode"); myFSMetrics = new FSNamesystemMetrics(conf, this); bean = new StandardMBean(this, FSNamesystemMBean.class); mbeanName = MBeanUtil.registerMBean("NameNode", "FSNamesystemState", bean); } catch (NotCompliantMBeanException e) { e.printStackTrace(); } LOG.info("Registered FSNamesystemStatusMBean"); }
[ "void", "registerMBean", "(", "Configuration", "conf", ")", "{", "// We wrap to bypass standard mbean naming convention.", "// This wraping can be removed in java 6 as it is more flexible in", "// package naming for mbeans and their impl.", "StandardMBean", "bean", ";", "try", "{", "ve...
Register the FSNamesystem MBean using the name "hadoop:service=NameNode,name=FSNamesystemState"
[ "Register", "the", "FSNamesystem", "MBean", "using", "the", "name", "hadoop", ":", "service", "=", "NameNode", "name", "=", "FSNamesystemState" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java#L9039-L9054
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.delegatedAccount_email_filter_name_rule_id_GET
public OvhRule delegatedAccount_email_filter_name_rule_id_GET(String email, String name, Long id) throws IOException { """ Get this object properties REST: GET /email/domain/delegatedAccount/{email}/filter/{name}/rule/{id} @param email [required] Email @param name [required] Filter name @param id [required] """ String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}/rule/{id}"; StringBuilder sb = path(qPath, email, name, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRule.class); }
java
public OvhRule delegatedAccount_email_filter_name_rule_id_GET(String email, String name, Long id) throws IOException { String qPath = "/email/domain/delegatedAccount/{email}/filter/{name}/rule/{id}"; StringBuilder sb = path(qPath, email, name, id); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhRule.class); }
[ "public", "OvhRule", "delegatedAccount_email_filter_name_rule_id_GET", "(", "String", "email", ",", "String", "name", ",", "Long", "id", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/delegatedAccount/{email}/filter/{name}/rule/{id}\"", ";", "St...
Get this object properties REST: GET /email/domain/delegatedAccount/{email}/filter/{name}/rule/{id} @param email [required] Email @param name [required] Filter name @param id [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L178-L183
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/ContentElement.java
ContentElement.writePreamble
public void writePreamble(final XMLUtil util, final ZipUTF8Writer writer) throws IOException { """ Write the preamble into the given writer. Used by the MetaAndStylesElementsFlusher and by standard write method @param util an XML util @param writer the destination @throws IOException if the preamble was not written """ writer.putNextEntry(new ZipEntry("content.xml")); writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); writer.write( "<office:document-content xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\" " + "xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\" " + "xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\" " + "xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\" " + "xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\" " + "xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\" " + "xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" " + "xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\" " + "xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\" " + "xmlns:presentation=\"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0\" " + "xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\" " + "xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\" " + "xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\" xmlns:math=\"http://www" + ".w3.org/1998/Math/MathML\" xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\" " + "xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\" " + "xmlns:ooo=\"http://openoffice.org/2004/office\" xmlns:ooow=\"http://openoffice" + ".org/2004/writer\" xmlns:oooc=\"http://openoffice.org/2004/calc\" xmlns:dom=\"http://www" + ".w3.org/2001/xml-events\" xmlns:xforms=\"http://www.w3.org/2002/xforms\" " + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www" + ".w3.org/2001/XMLSchema-instance\" office:version=\"1.1\">"); writer.write("<office:scripts/>"); this.stylesContainer.writeFontFaceDecls(util, writer); writer.write("<office:automatic-styles>"); this.stylesContainer.writeHiddenDataStyles(util, writer); this.stylesContainer.writeContentAutomaticStyles(util, writer); writer.write("</office:automatic-styles>"); writer.write("<office:body>"); writer.write("<office:spreadsheet>"); }
java
public void writePreamble(final XMLUtil util, final ZipUTF8Writer writer) throws IOException { writer.putNextEntry(new ZipEntry("content.xml")); writer.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); writer.write( "<office:document-content xmlns:office=\"urn:oasis:names:tc:opendocument:xmlns:office:1.0\" " + "xmlns:style=\"urn:oasis:names:tc:opendocument:xmlns:style:1.0\" " + "xmlns:text=\"urn:oasis:names:tc:opendocument:xmlns:text:1.0\" " + "xmlns:table=\"urn:oasis:names:tc:opendocument:xmlns:table:1.0\" " + "xmlns:draw=\"urn:oasis:names:tc:opendocument:xmlns:drawing:1.0\" " + "xmlns:fo=\"urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0\" " + "xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" " + "xmlns:meta=\"urn:oasis:names:tc:opendocument:xmlns:meta:1.0\" " + "xmlns:number=\"urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0\" " + "xmlns:presentation=\"urn:oasis:names:tc:opendocument:xmlns:presentation:1.0\" " + "xmlns:svg=\"urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0\" " + "xmlns:chart=\"urn:oasis:names:tc:opendocument:xmlns:chart:1.0\" " + "xmlns:dr3d=\"urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0\" xmlns:math=\"http://www" + ".w3.org/1998/Math/MathML\" xmlns:form=\"urn:oasis:names:tc:opendocument:xmlns:form:1.0\" " + "xmlns:script=\"urn:oasis:names:tc:opendocument:xmlns:script:1.0\" " + "xmlns:ooo=\"http://openoffice.org/2004/office\" xmlns:ooow=\"http://openoffice" + ".org/2004/writer\" xmlns:oooc=\"http://openoffice.org/2004/calc\" xmlns:dom=\"http://www" + ".w3.org/2001/xml-events\" xmlns:xforms=\"http://www.w3.org/2002/xforms\" " + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www" + ".w3.org/2001/XMLSchema-instance\" office:version=\"1.1\">"); writer.write("<office:scripts/>"); this.stylesContainer.writeFontFaceDecls(util, writer); writer.write("<office:automatic-styles>"); this.stylesContainer.writeHiddenDataStyles(util, writer); this.stylesContainer.writeContentAutomaticStyles(util, writer); writer.write("</office:automatic-styles>"); writer.write("<office:body>"); writer.write("<office:spreadsheet>"); }
[ "public", "void", "writePreamble", "(", "final", "XMLUtil", "util", ",", "final", "ZipUTF8Writer", "writer", ")", "throws", "IOException", "{", "writer", ".", "putNextEntry", "(", "new", "ZipEntry", "(", "\"content.xml\"", ")", ")", ";", "writer", ".", "write"...
Write the preamble into the given writer. Used by the MetaAndStylesElementsFlusher and by standard write method @param util an XML util @param writer the destination @throws IOException if the preamble was not written
[ "Write", "the", "preamble", "into", "the", "given", "writer", ".", "Used", "by", "the", "MetaAndStylesElementsFlusher", "and", "by", "standard", "write", "method" ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/ContentElement.java#L257-L270
languagetool-org/languagetool
languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java
GermanSpellerRule.getWordAfterEnumerationOrNull
@Nullable private String getWordAfterEnumerationOrNull(List<String> words, int idx) { """ for "Stil- und Grammatikprüfung", get "Grammatikprüfung" when at position of "Stil-" """ for (int i = idx; i < words.size(); i++) { String word = words.get(i); if (!(word.endsWith("-") || StringUtils.equalsAny(word, ",", "und", "oder", "sowie") || word.trim().isEmpty())) { return word; } } return null; }
java
@Nullable private String getWordAfterEnumerationOrNull(List<String> words, int idx) { for (int i = idx; i < words.size(); i++) { String word = words.get(i); if (!(word.endsWith("-") || StringUtils.equalsAny(word, ",", "und", "oder", "sowie") || word.trim().isEmpty())) { return word; } } return null; }
[ "@", "Nullable", "private", "String", "getWordAfterEnumerationOrNull", "(", "List", "<", "String", ">", "words", ",", "int", "idx", ")", "{", "for", "(", "int", "i", "=", "idx", ";", "i", "<", "words", ".", "size", "(", ")", ";", "i", "++", ")", "{...
for "Stil- und Grammatikprüfung", get "Grammatikprüfung" when at position of "Stil-"
[ "for", "Stil", "-", "und", "Grammatikprüfung", "get", "Grammatikprüfung", "when", "at", "position", "of", "Stil", "-" ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-language-modules/de/src/main/java/org/languagetool/rules/de/GermanSpellerRule.java#L1245-L1254
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/FilenameUtils.java
FilenameUtils.getUniqueFile
public static File getUniqueFile(File srcFile, char extSeparator) throws IOException { """ Returns a file name that does not overlap in the specified directory. If a duplicate file name exists, it is returned by appending a number after the file name. @param srcFile the file to seek @param extSeparator the extension separator @return an unique file @throws IOException if failed to obtain an unique file """ if (srcFile == null) { throw new IllegalArgumentException("srcFile must not be null"); } String path = getFullPath(srcFile.getCanonicalPath()); String name = removeExtension(srcFile.getName()); String ext = getExtension(srcFile.getName()); String newName; if (ext != null && !ext.isEmpty()) { newName = name + extSeparator + ext; } else { newName = name; } int count = 0; File destFile = new File(path, newName); while (destFile.exists()) { count++; if (ext != null && !ext.isEmpty()) { newName = name + "-" + count + extSeparator + ext; } else { newName = name + "-" + count; } destFile = new File(path, newName); } return (count == 0 ? srcFile : destFile); }
java
public static File getUniqueFile(File srcFile, char extSeparator) throws IOException { if (srcFile == null) { throw new IllegalArgumentException("srcFile must not be null"); } String path = getFullPath(srcFile.getCanonicalPath()); String name = removeExtension(srcFile.getName()); String ext = getExtension(srcFile.getName()); String newName; if (ext != null && !ext.isEmpty()) { newName = name + extSeparator + ext; } else { newName = name; } int count = 0; File destFile = new File(path, newName); while (destFile.exists()) { count++; if (ext != null && !ext.isEmpty()) { newName = name + "-" + count + extSeparator + ext; } else { newName = name + "-" + count; } destFile = new File(path, newName); } return (count == 0 ? srcFile : destFile); }
[ "public", "static", "File", "getUniqueFile", "(", "File", "srcFile", ",", "char", "extSeparator", ")", "throws", "IOException", "{", "if", "(", "srcFile", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"srcFile must not be null\"", ")",...
Returns a file name that does not overlap in the specified directory. If a duplicate file name exists, it is returned by appending a number after the file name. @param srcFile the file to seek @param extSeparator the extension separator @return an unique file @throws IOException if failed to obtain an unique file
[ "Returns", "a", "file", "name", "that", "does", "not", "overlap", "in", "the", "specified", "directory", ".", "If", "a", "duplicate", "file", "name", "exists", "it", "is", "returned", "by", "appending", "a", "number", "after", "the", "file", "name", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/FilenameUtils.java#L300-L330
jmrozanec/cron-utils
src/main/java/com/cronutils/descriptor/DescriptionStrategy.java
DescriptionStrategy.describe
protected String describe(final Between between, final boolean and) { """ Provide a human readable description for Between instance. @param between - Between @return human readable description - String """ return bundle.getString(EVERY) + " %s " + MessageFormat.format(bundle.getString("between_x_and_y"), nominalValue(between.getFrom()), nominalValue(between.getTo())) + WHITE_SPACE; }
java
protected String describe(final Between between, final boolean and) { return bundle.getString(EVERY) + " %s " + MessageFormat.format(bundle.getString("between_x_and_y"), nominalValue(between.getFrom()), nominalValue(between.getTo())) + WHITE_SPACE; }
[ "protected", "String", "describe", "(", "final", "Between", "between", ",", "final", "boolean", "and", ")", "{", "return", "bundle", ".", "getString", "(", "EVERY", ")", "+", "\" %s \"", "+", "MessageFormat", ".", "format", "(", "bundle", ".", "getString", ...
Provide a human readable description for Between instance. @param between - Between @return human readable description - String
[ "Provide", "a", "human", "readable", "description", "for", "Between", "instance", "." ]
train
https://github.com/jmrozanec/cron-utils/blob/adac5ec8fd9160b082f9762a6eedea0715731170/src/main/java/com/cronutils/descriptor/DescriptionStrategy.java#L137-L140
spring-projects/spring-retry
src/main/java/org/springframework/retry/policy/SimpleRetryPolicy.java
SimpleRetryPolicy.registerThrowable
@Override public void registerThrowable(RetryContext context, Throwable throwable) { """ Update the status with another attempted retry and the latest exception. @see RetryPolicy#registerThrowable(RetryContext, Throwable) """ SimpleRetryContext simpleContext = ((SimpleRetryContext) context); simpleContext.registerThrowable(throwable); }
java
@Override public void registerThrowable(RetryContext context, Throwable throwable) { SimpleRetryContext simpleContext = ((SimpleRetryContext) context); simpleContext.registerThrowable(throwable); }
[ "@", "Override", "public", "void", "registerThrowable", "(", "RetryContext", "context", ",", "Throwable", "throwable", ")", "{", "SimpleRetryContext", "simpleContext", "=", "(", "(", "SimpleRetryContext", ")", "context", ")", ";", "simpleContext", ".", "registerThro...
Update the status with another attempted retry and the latest exception. @see RetryPolicy#registerThrowable(RetryContext, Throwable)
[ "Update", "the", "status", "with", "another", "attempted", "retry", "and", "the", "latest", "exception", "." ]
train
https://github.com/spring-projects/spring-retry/blob/e2b0555f96594c2321990d0deeac45fc44d4f123/src/main/java/org/springframework/retry/policy/SimpleRetryPolicy.java#L185-L189
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java
SeleniumDriverSetup.connectToDriverForOnAt
public boolean connectToDriverForOnAt(String browser, String platformName, String url) throws MalformedURLException { """ Connects SeleniumHelper to a remote web driver, without specifying browser version. @param browser name of browser to connect to. @param platformName platform browser must run on. @param url url to connect to browser. @return true. @throws MalformedURLException if supplied url can not be transformed to URL. """ return connectToDriverForVersionOnAt(browser, "", platformName, url); }
java
public boolean connectToDriverForOnAt(String browser, String platformName, String url) throws MalformedURLException { return connectToDriverForVersionOnAt(browser, "", platformName, url); }
[ "public", "boolean", "connectToDriverForOnAt", "(", "String", "browser", ",", "String", "platformName", ",", "String", "url", ")", "throws", "MalformedURLException", "{", "return", "connectToDriverForVersionOnAt", "(", "browser", ",", "\"\"", ",", "platformName", ",",...
Connects SeleniumHelper to a remote web driver, without specifying browser version. @param browser name of browser to connect to. @param platformName platform browser must run on. @param url url to connect to browser. @return true. @throws MalformedURLException if supplied url can not be transformed to URL.
[ "Connects", "SeleniumHelper", "to", "a", "remote", "web", "driver", "without", "specifying", "browser", "version", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/slim/web/SeleniumDriverSetup.java#L124-L127
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ButtonTemplateBuilder.java
ButtonTemplateBuilder.addPostbackButton
public ButtonTemplateBuilder addPostbackButton(String title, String payload) { """ Adds a button which sends a payload back when clicked to the current template. There can be at most 3 buttons. @param title the button label. @param payload the payload to send back when clicked. @return this builder. """ Button button = ButtonFactory.createPostbackButton(title, payload); this.payload.addButton(button); return this; }
java
public ButtonTemplateBuilder addPostbackButton(String title, String payload) { Button button = ButtonFactory.createPostbackButton(title, payload); this.payload.addButton(button); return this; }
[ "public", "ButtonTemplateBuilder", "addPostbackButton", "(", "String", "title", ",", "String", "payload", ")", "{", "Button", "button", "=", "ButtonFactory", ".", "createPostbackButton", "(", "title", ",", "payload", ")", ";", "this", ".", "payload", ".", "addBu...
Adds a button which sends a payload back when clicked to the current template. There can be at most 3 buttons. @param title the button label. @param payload the payload to send back when clicked. @return this builder.
[ "Adds", "a", "button", "which", "sends", "a", "payload", "back", "when", "clicked", "to", "the", "current", "template", ".", "There", "can", "be", "at", "most", "3", "buttons", "." ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/ButtonTemplateBuilder.java#L128-L132
menacher/java-game-server
jetserver/src/main/java/org/menacheri/jetserver/concurrent/DataFlowVariable.java
DataFlowVariable.getVal
public Object getVal(long waitTime, TimeUnit timeUnit) throws InterruptedException { """ This method blocks for a specified amount of time to retrieve the value bound in bind method. @param waitTime the amount of time to wait @param timeUnit the unit, milliseconds, seconds etc. @return Returns the bound value or null if the time out has exceeded. @throws InterruptedException """ if(latch.await(waitTime, timeUnit)){ return val; } else { return null; } }
java
public Object getVal(long waitTime, TimeUnit timeUnit) throws InterruptedException { if(latch.await(waitTime, timeUnit)){ return val; } else { return null; } }
[ "public", "Object", "getVal", "(", "long", "waitTime", ",", "TimeUnit", "timeUnit", ")", "throws", "InterruptedException", "{", "if", "(", "latch", ".", "await", "(", "waitTime", ",", "timeUnit", ")", ")", "{", "return", "val", ";", "}", "else", "{", "re...
This method blocks for a specified amount of time to retrieve the value bound in bind method. @param waitTime the amount of time to wait @param timeUnit the unit, milliseconds, seconds etc. @return Returns the bound value or null if the time out has exceeded. @throws InterruptedException
[ "This", "method", "blocks", "for", "a", "specified", "amount", "of", "time", "to", "retrieve", "the", "value", "bound", "in", "bind", "method", "." ]
train
https://github.com/menacher/java-game-server/blob/668ca49e8bd1dac43add62378cf6c22a93125d48/jetserver/src/main/java/org/menacheri/jetserver/concurrent/DataFlowVariable.java#L65-L75
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/dialogs/TextInputDialog.java
TextInputDialog.showPasswordDialog
public static String showPasswordDialog(WindowBasedTextGUI textGUI, String title, String description, String initialContent) { """ Shortcut for quickly showing a {@code TextInputDialog} with password masking @param textGUI GUI to show the dialog on @param title Title of the dialog @param description Description of the dialog @param initialContent What content to place in the text box initially @return The string the user typed into the text box, or {@code null} if the dialog was cancelled """ TextInputDialog textInputDialog = new TextInputDialogBuilder() .setTitle(title) .setDescription(description) .setInitialContent(initialContent) .setPasswordInput(true) .build(); return textInputDialog.showDialog(textGUI); }
java
public static String showPasswordDialog(WindowBasedTextGUI textGUI, String title, String description, String initialContent) { TextInputDialog textInputDialog = new TextInputDialogBuilder() .setTitle(title) .setDescription(description) .setInitialContent(initialContent) .setPasswordInput(true) .build(); return textInputDialog.showDialog(textGUI); }
[ "public", "static", "String", "showPasswordDialog", "(", "WindowBasedTextGUI", "textGUI", ",", "String", "title", ",", "String", "description", ",", "String", "initialContent", ")", "{", "TextInputDialog", "textInputDialog", "=", "new", "TextInputDialogBuilder", "(", ...
Shortcut for quickly showing a {@code TextInputDialog} with password masking @param textGUI GUI to show the dialog on @param title Title of the dialog @param description Description of the dialog @param initialContent What content to place in the text box initially @return The string the user typed into the text box, or {@code null} if the dialog was cancelled
[ "Shortcut", "for", "quickly", "showing", "a", "{" ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/dialogs/TextInputDialog.java#L165-L173
igniterealtime/Smack
smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java
OmemoStore.getFingerprint
public OmemoFingerprint getFingerprint(OmemoDevice userDevice, OmemoDevice contactsDevice) throws CorruptedOmemoKeyException, NoIdentityKeyException { """ Return the fingerprint of the identityKey belonging to contactsDevice. @param userDevice our OmemoDevice. @param contactsDevice OmemoDevice we want to have the fingerprint for. @return fingerprint of the userDevices IdentityKey. @throws CorruptedOmemoKeyException if the IdentityKey is corrupted. @throws NoIdentityKeyException if no IdentityKey for contactsDevice has been found locally. """ T_IdKey identityKey = loadOmemoIdentityKey(userDevice, contactsDevice); if (identityKey == null) { throw new NoIdentityKeyException(contactsDevice); } return keyUtil().getFingerprintOfIdentityKey(identityKey); }
java
public OmemoFingerprint getFingerprint(OmemoDevice userDevice, OmemoDevice contactsDevice) throws CorruptedOmemoKeyException, NoIdentityKeyException { T_IdKey identityKey = loadOmemoIdentityKey(userDevice, contactsDevice); if (identityKey == null) { throw new NoIdentityKeyException(contactsDevice); } return keyUtil().getFingerprintOfIdentityKey(identityKey); }
[ "public", "OmemoFingerprint", "getFingerprint", "(", "OmemoDevice", "userDevice", ",", "OmemoDevice", "contactsDevice", ")", "throws", "CorruptedOmemoKeyException", ",", "NoIdentityKeyException", "{", "T_IdKey", "identityKey", "=", "loadOmemoIdentityKey", "(", "userDevice", ...
Return the fingerprint of the identityKey belonging to contactsDevice. @param userDevice our OmemoDevice. @param contactsDevice OmemoDevice we want to have the fingerprint for. @return fingerprint of the userDevices IdentityKey. @throws CorruptedOmemoKeyException if the IdentityKey is corrupted. @throws NoIdentityKeyException if no IdentityKey for contactsDevice has been found locally.
[ "Return", "the", "fingerprint", "of", "the", "identityKey", "belonging", "to", "contactsDevice", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-omemo/src/main/java/org/jivesoftware/smackx/omemo/OmemoStore.java#L603-L611
OpenTSDB/opentsdb
src/tools/OpenTSDBMain.java
OpenTSDBMain.setLogbackInternal
protected static void setLogbackInternal(final String logFileName, final String rollPattern, final boolean keepConsoleOpen) { """ Sets the logback system property, <b><code>tsdb.logback.file</code></b> and then reloads the internal file based logging configuration. The property will not be set if it was already set, allowing the value to be set by a standard command line set system property. @param logFileName The name of the file logback will log to. @param rollPattern The pattern specifying the rolling file pattern, inserted between the file name base and extension. So for a log file name of <b><code>/var/log/opentsdb.log</code></b> and a pattern of <b><code>_%d{yyyy-MM-dd}.%i</code></b>, the configured fileNamePattern would be <b><code>/var/log/opentsdb_%d{yyyy-MM-dd}.%i.log</code></b> @param keepConsoleOpen If true, will keep the console appender open, otherwise closes it and logs exclusively to the file. """ if(System.getProperty("tsdb.logback.file", null) == null) { System.setProperty("tsdb.logback.file", logFileName); } System.setProperty("tsd.logback.rollpattern", insertPattern(logFileName, rollPattern)); BasicStatusManager bsm = new BasicStatusManager(); for(StatusListener listener: bsm.getCopyOfStatusListenerList()) { log.info("Status Listener: {}", listener); } try { final URL url = OpenTSDBMain.class.getClassLoader().getResource("file-logback.xml"); final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); try { final JoranConfigurator configurator = new JoranConfigurator(); configurator.setContext(context); configurator.doConfigure(url); if(!keepConsoleOpen) { final ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); root.detachAppender("STDOUT"); } log.info("Set internal logback config with file [{}] and roll pattern [{}]", logFileName, rollPattern); } catch (JoranException je) { System.err.println("Failed to configure internal logback"); je.printStackTrace(System.err); } } catch (Exception ex) { log.warn("Failed to set internal logback config with file [{}]", logFileName, ex); } }
java
protected static void setLogbackInternal(final String logFileName, final String rollPattern, final boolean keepConsoleOpen) { if(System.getProperty("tsdb.logback.file", null) == null) { System.setProperty("tsdb.logback.file", logFileName); } System.setProperty("tsd.logback.rollpattern", insertPattern(logFileName, rollPattern)); BasicStatusManager bsm = new BasicStatusManager(); for(StatusListener listener: bsm.getCopyOfStatusListenerList()) { log.info("Status Listener: {}", listener); } try { final URL url = OpenTSDBMain.class.getClassLoader().getResource("file-logback.xml"); final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); try { final JoranConfigurator configurator = new JoranConfigurator(); configurator.setContext(context); configurator.doConfigure(url); if(!keepConsoleOpen) { final ch.qos.logback.classic.Logger root = (ch.qos.logback.classic.Logger)LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); root.detachAppender("STDOUT"); } log.info("Set internal logback config with file [{}] and roll pattern [{}]", logFileName, rollPattern); } catch (JoranException je) { System.err.println("Failed to configure internal logback"); je.printStackTrace(System.err); } } catch (Exception ex) { log.warn("Failed to set internal logback config with file [{}]", logFileName, ex); } }
[ "protected", "static", "void", "setLogbackInternal", "(", "final", "String", "logFileName", ",", "final", "String", "rollPattern", ",", "final", "boolean", "keepConsoleOpen", ")", "{", "if", "(", "System", ".", "getProperty", "(", "\"tsdb.logback.file\"", ",", "nu...
Sets the logback system property, <b><code>tsdb.logback.file</code></b> and then reloads the internal file based logging configuration. The property will not be set if it was already set, allowing the value to be set by a standard command line set system property. @param logFileName The name of the file logback will log to. @param rollPattern The pattern specifying the rolling file pattern, inserted between the file name base and extension. So for a log file name of <b><code>/var/log/opentsdb.log</code></b> and a pattern of <b><code>_%d{yyyy-MM-dd}.%i</code></b>, the configured fileNamePattern would be <b><code>/var/log/opentsdb_%d{yyyy-MM-dd}.%i.log</code></b> @param keepConsoleOpen If true, will keep the console appender open, otherwise closes it and logs exclusively to the file.
[ "Sets", "the", "logback", "system", "property", "<b", ">", "<code", ">", "tsdb", ".", "logback", ".", "file<", "/", "code", ">", "<", "/", "b", ">", "and", "then", "reloads", "the", "internal", "file", "based", "logging", "configuration", ".", "The", "...
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/OpenTSDBMain.java#L490-L518
alkacon/opencms-core
src/org/opencms/xml/page/CmsXmlPage.java
CmsXmlPage.addValue
public void addValue(String name, Locale locale) throws CmsIllegalArgumentException { """ Adds a new, empty value with the given name and locale to this XML document.<p> @param name the name of the value @param locale the locale of the value @throws CmsIllegalArgumentException if the name contains an index ("[&lt;number&gt;]") or the value for the given locale already exists in the xmlpage. """ if (name.indexOf('[') >= 0) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_CONTAINS_INDEX_1, name)); } if (hasValue(name, locale)) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_LANG_ELEM_EXISTS_2, name, locale)); } Element pages = m_document.getRootElement(); String localeStr = locale.toString(); Element page = null; // search if a page for the selected language is already available for (Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(pages, NODE_PAGE); i.hasNext();) { Element nextPage = i.next(); String language = nextPage.attributeValue(ATTRIBUTE_LANGUAGE); if (localeStr.equals(language)) { // a page for the selected language was found page = nextPage; break; } } // create the new element Element element; if (page != null) { // page for selected language already available element = page.addElement(NODE_ELEMENT).addAttribute(ATTRIBUTE_NAME, name); } else { // no page for the selected language was found element = pages.addElement(NODE_PAGE).addAttribute(ATTRIBUTE_LANGUAGE, localeStr); element = element.addElement(NODE_ELEMENT).addAttribute(ATTRIBUTE_NAME, name); } // add empty nodes for link table and content to the element element.addElement(NODE_LINKS); element.addElement(NODE_CONTENT); CmsXmlHtmlValue value = new CmsXmlHtmlValue(this, element, locale); // bookmark the element addBookmark(CmsXmlUtils.createXpathElement(name, 1), locale, true, value); }
java
public void addValue(String name, Locale locale) throws CmsIllegalArgumentException { if (name.indexOf('[') >= 0) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_CONTAINS_INDEX_1, name)); } if (hasValue(name, locale)) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_LANG_ELEM_EXISTS_2, name, locale)); } Element pages = m_document.getRootElement(); String localeStr = locale.toString(); Element page = null; // search if a page for the selected language is already available for (Iterator<Element> i = CmsXmlGenericWrapper.elementIterator(pages, NODE_PAGE); i.hasNext();) { Element nextPage = i.next(); String language = nextPage.attributeValue(ATTRIBUTE_LANGUAGE); if (localeStr.equals(language)) { // a page for the selected language was found page = nextPage; break; } } // create the new element Element element; if (page != null) { // page for selected language already available element = page.addElement(NODE_ELEMENT).addAttribute(ATTRIBUTE_NAME, name); } else { // no page for the selected language was found element = pages.addElement(NODE_PAGE).addAttribute(ATTRIBUTE_LANGUAGE, localeStr); element = element.addElement(NODE_ELEMENT).addAttribute(ATTRIBUTE_NAME, name); } // add empty nodes for link table and content to the element element.addElement(NODE_LINKS); element.addElement(NODE_CONTENT); CmsXmlHtmlValue value = new CmsXmlHtmlValue(this, element, locale); // bookmark the element addBookmark(CmsXmlUtils.createXpathElement(name, 1), locale, true, value); }
[ "public", "void", "addValue", "(", "String", "name", ",", "Locale", "locale", ")", "throws", "CmsIllegalArgumentException", "{", "if", "(", "name", ".", "indexOf", "(", "'", "'", ")", ">=", "0", ")", "{", "throw", "new", "CmsIllegalArgumentException", "(", ...
Adds a new, empty value with the given name and locale to this XML document.<p> @param name the name of the value @param locale the locale of the value @throws CmsIllegalArgumentException if the name contains an index ("[&lt;number&gt;]") or the value for the given locale already exists in the xmlpage.
[ "Adds", "a", "new", "empty", "value", "with", "the", "given", "name", "and", "locale", "to", "this", "XML", "document", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/page/CmsXmlPage.java#L183-L229
geomajas/geomajas-project-client-gwt
plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/MultiLayerFeaturesList.java
MultiLayerFeaturesList.setFeatures
public void setFeatures(Map<String, List<org.geomajas.layer.feature.Feature>> featureMap) { """ Feed a map of features to the widget, so it can be built. @param featureMap feature map """ MapModel mapModel = mapWidget.getMapModel(); for (Entry<String, List<org.geomajas.layer.feature.Feature>> clientLayerId : featureMap.entrySet()) { Layer<?> layer = mapModel.getLayer(clientLayerId.getKey()); if (null != layer) { List<org.geomajas.layer.feature.Feature> orgFeatures = clientLayerId.getValue(); if (!orgFeatures.isEmpty()) { addFeatures(layer, orgFeatures); } } } }
java
public void setFeatures(Map<String, List<org.geomajas.layer.feature.Feature>> featureMap) { MapModel mapModel = mapWidget.getMapModel(); for (Entry<String, List<org.geomajas.layer.feature.Feature>> clientLayerId : featureMap.entrySet()) { Layer<?> layer = mapModel.getLayer(clientLayerId.getKey()); if (null != layer) { List<org.geomajas.layer.feature.Feature> orgFeatures = clientLayerId.getValue(); if (!orgFeatures.isEmpty()) { addFeatures(layer, orgFeatures); } } } }
[ "public", "void", "setFeatures", "(", "Map", "<", "String", ",", "List", "<", "org", ".", "geomajas", ".", "layer", ".", "feature", ".", "Feature", ">", ">", "featureMap", ")", "{", "MapModel", "mapModel", "=", "mapWidget", ".", "getMapModel", "(", ")", ...
Feed a map of features to the widget, so it can be built. @param featureMap feature map
[ "Feed", "a", "map", "of", "features", "to", "the", "widget", "so", "it", "can", "be", "built", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/widget-featureinfo/featureinfo-gwt/src/main/java/org/geomajas/widget/featureinfo/client/widget/MultiLayerFeaturesList.java#L100-L112
stripe/stripe-android
stripe/src/main/java/com/stripe/android/Stripe.java
Stripe.createTokenSynchronous
public Token createTokenSynchronous(final Card card) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException { """ Blocking method to create a {@link Token}. Do not call this on the UI thread or your app will crash. This method uses the default publishable key for this {@link Stripe} instance. @param card the {@link Card} to use for this token @return a {@link Token} that can be used for this card @throws AuthenticationException failure to properly authenticate yourself (check your key) @throws InvalidRequestException your request has invalid parameters @throws APIConnectionException failure to connect to Stripe's API @throws CardException the card cannot be charged for some reason @throws APIException any other type of problem (for instance, a temporary issue with Stripe's servers """ return createTokenSynchronous(card, mDefaultPublishableKey); }
java
public Token createTokenSynchronous(final Card card) throws AuthenticationException, InvalidRequestException, APIConnectionException, CardException, APIException { return createTokenSynchronous(card, mDefaultPublishableKey); }
[ "public", "Token", "createTokenSynchronous", "(", "final", "Card", "card", ")", "throws", "AuthenticationException", ",", "InvalidRequestException", ",", "APIConnectionException", ",", "CardException", ",", "APIException", "{", "return", "createTokenSynchronous", "(", "ca...
Blocking method to create a {@link Token}. Do not call this on the UI thread or your app will crash. This method uses the default publishable key for this {@link Stripe} instance. @param card the {@link Card} to use for this token @return a {@link Token} that can be used for this card @throws AuthenticationException failure to properly authenticate yourself (check your key) @throws InvalidRequestException your request has invalid parameters @throws APIConnectionException failure to connect to Stripe's API @throws CardException the card cannot be charged for some reason @throws APIException any other type of problem (for instance, a temporary issue with Stripe's servers
[ "Blocking", "method", "to", "create", "a", "{", "@link", "Token", "}", ".", "Do", "not", "call", "this", "on", "the", "UI", "thread", "or", "your", "app", "will", "crash", ".", "This", "method", "uses", "the", "default", "publishable", "key", "for", "t...
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/Stripe.java#L522-L529
vvakame/JsonPullParser
jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java
JsonModelCoder.encodeList
public void encodeList(OutputStream out, List<? extends T> list) throws IOException { """ Encodes the given {@link List} of values into the JSON format, and appends it into the given stream using {@link JsonPullParser#DEFAULT_CHARSET}.<br> This method is an alias of {@link #encodeListNullToBlank(Writer, List)}. @param out {@link OutputStream} to be written @param list {@link List} of values to be encoded @throws IOException """ OutputStreamWriter writer = new OutputStreamWriter(out, JsonPullParser.DEFAULT_CHARSET); encodeListNullToBlank(writer, list); }
java
public void encodeList(OutputStream out, List<? extends T> list) throws IOException { OutputStreamWriter writer = new OutputStreamWriter(out, JsonPullParser.DEFAULT_CHARSET); encodeListNullToBlank(writer, list); }
[ "public", "void", "encodeList", "(", "OutputStream", "out", ",", "List", "<", "?", "extends", "T", ">", "list", ")", "throws", "IOException", "{", "OutputStreamWriter", "writer", "=", "new", "OutputStreamWriter", "(", "out", ",", "JsonPullParser", ".", "DEFAUL...
Encodes the given {@link List} of values into the JSON format, and appends it into the given stream using {@link JsonPullParser#DEFAULT_CHARSET}.<br> This method is an alias of {@link #encodeListNullToBlank(Writer, List)}. @param out {@link OutputStream} to be written @param list {@link List} of values to be encoded @throws IOException
[ "Encodes", "the", "given", "{", "@link", "List", "}", "of", "values", "into", "the", "JSON", "format", "and", "appends", "it", "into", "the", "given", "stream", "using", "{", "@link", "JsonPullParser#DEFAULT_CHARSET", "}", ".", "<br", ">", "This", "method", ...
train
https://github.com/vvakame/JsonPullParser/blob/fce183ca66354723323a77f2ae8cb5222b5836bc/jsonpullparser-core/src/main/java/net/vvakame/util/jsonpullparser/builder/JsonModelCoder.java#L312-L315
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseXgebsr2csr
public static int cusparseXgebsr2csr( cusparseHandle handle, int dirA, int mb, int nb, cusparseMatDescr descrA, Pointer bsrSortedRowPtrA, Pointer bsrSortedColIndA, int rowBlockDim, int colBlockDim, cusparseMatDescr descrC, Pointer csrSortedRowPtrC, Pointer csrSortedColIndC) { """ Description: This routine converts a sparse matrix in general block-CSR storage format to a sparse matrix in CSR storage format. """ return checkResult(cusparseXgebsr2csrNative(handle, dirA, mb, nb, descrA, bsrSortedRowPtrA, bsrSortedColIndA, rowBlockDim, colBlockDim, descrC, csrSortedRowPtrC, csrSortedColIndC)); }
java
public static int cusparseXgebsr2csr( cusparseHandle handle, int dirA, int mb, int nb, cusparseMatDescr descrA, Pointer bsrSortedRowPtrA, Pointer bsrSortedColIndA, int rowBlockDim, int colBlockDim, cusparseMatDescr descrC, Pointer csrSortedRowPtrC, Pointer csrSortedColIndC) { return checkResult(cusparseXgebsr2csrNative(handle, dirA, mb, nb, descrA, bsrSortedRowPtrA, bsrSortedColIndA, rowBlockDim, colBlockDim, descrC, csrSortedRowPtrC, csrSortedColIndC)); }
[ "public", "static", "int", "cusparseXgebsr2csr", "(", "cusparseHandle", "handle", ",", "int", "dirA", ",", "int", "mb", ",", "int", "nb", ",", "cusparseMatDescr", "descrA", ",", "Pointer", "bsrSortedRowPtrA", ",", "Pointer", "bsrSortedColIndA", ",", "int", "rowB...
Description: This routine converts a sparse matrix in general block-CSR storage format to a sparse matrix in CSR storage format.
[ "Description", ":", "This", "routine", "converts", "a", "sparse", "matrix", "in", "general", "block", "-", "CSR", "storage", "format", "to", "a", "sparse", "matrix", "in", "CSR", "storage", "format", "." ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L13026-L13041
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/dialogs/ActionListDialog.java
ActionListDialog.showDialog
public static void showDialog(WindowBasedTextGUI textGUI, String title, String description, Runnable... items) { """ Helper method for immediately displaying a {@code ActionListDialog}, the method will return when the dialog is closed @param textGUI Text GUI the dialog should be added to @param title Title of the dialog @param description Description of the dialog @param items Items in the {@code ActionListBox}, the label will be taken from each {@code Runnable} by calling {@code toString()} on each one """ ActionListDialog actionListDialog = new ActionListDialogBuilder() .setTitle(title) .setDescription(description) .addActions(items) .build(); actionListDialog.showDialog(textGUI); }
java
public static void showDialog(WindowBasedTextGUI textGUI, String title, String description, Runnable... items) { ActionListDialog actionListDialog = new ActionListDialogBuilder() .setTitle(title) .setDescription(description) .addActions(items) .build(); actionListDialog.showDialog(textGUI); }
[ "public", "static", "void", "showDialog", "(", "WindowBasedTextGUI", "textGUI", ",", "String", "title", ",", "String", "description", ",", "Runnable", "...", "items", ")", "{", "ActionListDialog", "actionListDialog", "=", "new", "ActionListDialogBuilder", "(", ")", ...
Helper method for immediately displaying a {@code ActionListDialog}, the method will return when the dialog is closed @param textGUI Text GUI the dialog should be added to @param title Title of the dialog @param description Description of the dialog @param items Items in the {@code ActionListBox}, the label will be taken from each {@code Runnable} by calling {@code toString()} on each one
[ "Helper", "method", "for", "immediately", "displaying", "a", "{" ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/dialogs/ActionListDialog.java#L106-L113
gwtbootstrap3/gwtbootstrap3
gwtbootstrap3/src/main/java/org/gwtbootstrap3/client/ui/ScrollSpy.java
ScrollSpy.scrollSpy
public static ScrollSpy scrollSpy(final UIObject spyOn, final HasId target) { """ Attaches ScrollSpy to specified object with specified target element. @param spyOn Spy on this object @param target Target element having an ID @return ScrollSpy """ return new ScrollSpy(spyOn.getElement(), target); }
java
public static ScrollSpy scrollSpy(final UIObject spyOn, final HasId target) { return new ScrollSpy(spyOn.getElement(), target); }
[ "public", "static", "ScrollSpy", "scrollSpy", "(", "final", "UIObject", "spyOn", ",", "final", "HasId", "target", ")", "{", "return", "new", "ScrollSpy", "(", "spyOn", ".", "getElement", "(", ")", ",", "target", ")", ";", "}" ]
Attaches ScrollSpy to specified object with specified target element. @param spyOn Spy on this object @param target Target element having an ID @return ScrollSpy
[ "Attaches", "ScrollSpy", "to", "specified", "object", "with", "specified", "target", "element", "." ]
train
https://github.com/gwtbootstrap3/gwtbootstrap3/blob/54bdbd0b12ba7a436b278c007df960d1adf2e641/gwtbootstrap3/src/main/java/org/gwtbootstrap3/client/ui/ScrollSpy.java#L97-L99
liferay/com-liferay-commerce
commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java
CommerceCurrencyPersistenceImpl.findByUUID_G
@Override public CommerceCurrency findByUUID_G(String uuid, long groupId) throws NoSuchCurrencyException { """ Returns the commerce currency where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCurrencyException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce currency @throws NoSuchCurrencyException if a matching commerce currency could not be found """ CommerceCurrency commerceCurrency = fetchByUUID_G(uuid, groupId); if (commerceCurrency == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCurrencyException(msg.toString()); } return commerceCurrency; }
java
@Override public CommerceCurrency findByUUID_G(String uuid, long groupId) throws NoSuchCurrencyException { CommerceCurrency commerceCurrency = fetchByUUID_G(uuid, groupId); if (commerceCurrency == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchCurrencyException(msg.toString()); } return commerceCurrency; }
[ "@", "Override", "public", "CommerceCurrency", "findByUUID_G", "(", "String", "uuid", ",", "long", "groupId", ")", "throws", "NoSuchCurrencyException", "{", "CommerceCurrency", "commerceCurrency", "=", "fetchByUUID_G", "(", "uuid", ",", "groupId", ")", ";", "if", ...
Returns the commerce currency where uuid = &#63; and groupId = &#63; or throws a {@link NoSuchCurrencyException} if it could not be found. @param uuid the uuid @param groupId the group ID @return the matching commerce currency @throws NoSuchCurrencyException if a matching commerce currency could not be found
[ "Returns", "the", "commerce", "currency", "where", "uuid", "=", "&#63", ";", "and", "groupId", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCurrencyException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L666-L692
reactor/reactor-netty
src/main/java/reactor/netty/udp/UdpServer.java
UdpServer.doOnLifecycle
public final UdpServer doOnLifecycle(Consumer<? super Bootstrap> onBind, Consumer<? super Connection> onBound, Consumer<? super Connection> onUnbound) { """ Setup all lifecycle callbacks called on or after {@link io.netty.channel.Channel} has been bound and after it has been unbound. @param onBind a consumer observing server start event @param onBound a consumer observing server started event @param onUnbound a consumer observing server stop event @return a new {@link UdpServer} """ Objects.requireNonNull(onBind, "onBind"); Objects.requireNonNull(onBound, "onBound"); Objects.requireNonNull(onUnbound, "onUnbound"); return new UdpServerDoOn(this, onBind, onBound, onUnbound); }
java
public final UdpServer doOnLifecycle(Consumer<? super Bootstrap> onBind, Consumer<? super Connection> onBound, Consumer<? super Connection> onUnbound) { Objects.requireNonNull(onBind, "onBind"); Objects.requireNonNull(onBound, "onBound"); Objects.requireNonNull(onUnbound, "onUnbound"); return new UdpServerDoOn(this, onBind, onBound, onUnbound); }
[ "public", "final", "UdpServer", "doOnLifecycle", "(", "Consumer", "<", "?", "super", "Bootstrap", ">", "onBind", ",", "Consumer", "<", "?", "super", "Connection", ">", "onBound", ",", "Consumer", "<", "?", "super", "Connection", ">", "onUnbound", ")", "{", ...
Setup all lifecycle callbacks called on or after {@link io.netty.channel.Channel} has been bound and after it has been unbound. @param onBind a consumer observing server start event @param onBound a consumer observing server started event @param onUnbound a consumer observing server stop event @return a new {@link UdpServer}
[ "Setup", "all", "lifecycle", "callbacks", "called", "on", "or", "after", "{", "@link", "io", ".", "netty", ".", "channel", ".", "Channel", "}", "has", "been", "bound", "and", "after", "it", "has", "been", "unbound", "." ]
train
https://github.com/reactor/reactor-netty/blob/4ed14316e1d7fca3cecd18d6caa5f2251e159e49/src/main/java/reactor/netty/udp/UdpServer.java#L222-L229
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/websocket/AbstractWebSocketFilter.java
AbstractWebSocketFilter.headerContainsToken
private boolean headerContainsToken(Request request, String headerName, String target) { """ /* This only works for tokens. Quoted strings need more sophisticated parsing. """ Enumeration<String> headers = request.getHeaders(headerName); while (headers.hasMoreElements()) { String header = headers.nextElement(); String[] tokens = header.split(","); for (String token : tokens) { if (target.equalsIgnoreCase(token.trim())) { return true; } } } return false; }
java
private boolean headerContainsToken(Request request, String headerName, String target) { Enumeration<String> headers = request.getHeaders(headerName); while (headers.hasMoreElements()) { String header = headers.nextElement(); String[] tokens = header.split(","); for (String token : tokens) { if (target.equalsIgnoreCase(token.trim())) { return true; } } } return false; }
[ "private", "boolean", "headerContainsToken", "(", "Request", "request", ",", "String", "headerName", ",", "String", "target", ")", "{", "Enumeration", "<", "String", ">", "headers", "=", "request", ".", "getHeaders", "(", "headerName", ")", ";", "while", "(", ...
/* This only works for tokens. Quoted strings need more sophisticated parsing.
[ "/", "*", "This", "only", "works", "for", "tokens", ".", "Quoted", "strings", "need", "more", "sophisticated", "parsing", "." ]
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/websocket/AbstractWebSocketFilter.java#L86-L99