repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java
JQMHeader.setLeftButton
public JQMButton setLeftButton(String text, JQMPage page) { return setLeftButton(text, page, null); }
java
public JQMButton setLeftButton(String text, JQMPage page) { return setLeftButton(text, page, null); }
[ "public", "JQMButton", "setLeftButton", "(", "String", "text", ",", "JQMPage", "page", ")", "{", "return", "setLeftButton", "(", "text", ",", "page", ",", "null", ")", ";", "}" ]
Creates a new {@link JQMButton} with the given text and linking to the given {@link JQMPage} and then sets that button in the left slot. Any existing right button will be replaced. @param text the text for the button @param page the optional page for the button to link to, if null then this button does not navigate by default @return the created button
[ "Creates", "a", "new", "{", "@link", "JQMButton", "}", "with", "the", "given", "text", "and", "linking", "to", "the", "given", "{", "@link", "JQMPage", "}", "and", "then", "sets", "that", "button", "in", "the", "left", "slot", ".", "Any", "existing", "...
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/toolbar/JQMHeader.java#L184-L186
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/ZealotKhala.java
ZealotKhala.orIn
public ZealotKhala orIn(String field, Object[] values) { return this.doIn(ZealotConst.OR_PREFIX, field, values, true, true); }
java
public ZealotKhala orIn(String field, Object[] values) { return this.doIn(ZealotConst.OR_PREFIX, field, values, true, true); }
[ "public", "ZealotKhala", "orIn", "(", "String", "field", ",", "Object", "[", "]", "values", ")", "{", "return", "this", ".", "doIn", "(", "ZealotConst", ".", "OR_PREFIX", ",", "field", ",", "values", ",", "true", ",", "true", ")", ";", "}" ]
生成带" OR "前缀的in范围查询的SQL片段. @param field 数据库字段 @param values 数组的值 @return ZealotKhala实例
[ "生成带", "OR", "前缀的in范围查询的SQL片段", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/ZealotKhala.java#L1347-L1349
aws/aws-sdk-java
aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/ContainerDefinition.java
ContainerDefinition.withEnvironment
public ContainerDefinition withEnvironment(java.util.Map<String, String> environment) { setEnvironment(environment); return this; }
java
public ContainerDefinition withEnvironment(java.util.Map<String, String> environment) { setEnvironment(environment); return this; }
[ "public", "ContainerDefinition", "withEnvironment", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "environment", ")", "{", "setEnvironment", "(", "environment", ")", ";", "return", "this", ";", "}" ]
<p> The environment variables to set in the Docker container. Each key and value in the <code>Environment</code> string to string map can have length of up to 1024. We support up to 16 entries in the map. </p> @param environment The environment variables to set in the Docker container. Each key and value in the <code>Environment</code> string to string map can have length of up to 1024. We support up to 16 entries in the map. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "environment", "variables", "to", "set", "in", "the", "Docker", "container", ".", "Each", "key", "and", "value", "in", "the", "<code", ">", "Environment<", "/", "code", ">", "string", "to", "string", "map", "can", "have", "length", "of"...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sagemaker/src/main/java/com/amazonaws/services/sagemaker/model/ContainerDefinition.java#L323-L326
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ComponentUtil.java
ComponentUtil.getComponentPropertiesClass
public static Class getComponentPropertiesClass(Config config, String className, ASMProperty[] properties, Class extendsClass) throws PageException { try { return _getComponentPropertiesClass(null, config, className, properties, extendsClass); } catch (Exception e) { throw Caster.toPageException(e); } }
java
public static Class getComponentPropertiesClass(Config config, String className, ASMProperty[] properties, Class extendsClass) throws PageException { try { return _getComponentPropertiesClass(null, config, className, properties, extendsClass); } catch (Exception e) { throw Caster.toPageException(e); } }
[ "public", "static", "Class", "getComponentPropertiesClass", "(", "Config", "config", ",", "String", "className", ",", "ASMProperty", "[", "]", "properties", ",", "Class", "extendsClass", ")", "throws", "PageException", "{", "try", "{", "return", "_getComponentProper...
/* does not include the application context javasettings @param pc @param className @param properties @return @throws PageException
[ "/", "*", "does", "not", "include", "the", "application", "context", "javasettings" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ComponentUtil.java#L380-L387
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/io/file/PathOperations.java
PathOperations.copyFile
@Nonnull public static FileIOError copyFile (@Nonnull final Path aSourceFile, @Nonnull final Path aTargetFile) { ValueEnforcer.notNull (aSourceFile, "SourceFile"); ValueEnforcer.notNull (aTargetFile, "TargetFile"); final Path aRealSourceFile = _getUnifiedPath (aSourceFile); final Path aRealTargetFile = _getUnifiedPath (aTargetFile); // Does the source file exist? if (!aRealSourceFile.toFile ().isFile ()) return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.COPY_FILE, aRealSourceFile); // Are source and target different? if (EqualsHelper.equals (aRealSourceFile, aRealTargetFile)) return EFileIOErrorCode.SOURCE_EQUALS_TARGET.getAsIOError (EFileIOOperation.COPY_FILE, aRealSourceFile); // Does the target file already exist? if (aRealTargetFile.toFile ().exists ()) return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.COPY_FILE, aRealTargetFile); // Is the source file readable? if (!Files.isReadable (aRealSourceFile)) return EFileIOErrorCode.SOURCE_NOT_READABLE.getAsIOError (EFileIOOperation.COPY_FILE, aRealSourceFile); // Is the target parent directory writable? final Path aTargetParentDir = aRealTargetFile.getParent (); if (aTargetParentDir != null && aTargetParentDir.toFile ().exists () && !Files.isWritable (aTargetParentDir)) return EFileIOErrorCode.TARGET_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.COPY_FILE, aRealTargetFile); // Ensure the targets parent directory is present PathHelper.ensureParentDirectoryIsPresent (aRealTargetFile); return _perform (EFileIOOperation.COPY_FILE, Files::copy, aRealSourceFile, aRealTargetFile); }
java
@Nonnull public static FileIOError copyFile (@Nonnull final Path aSourceFile, @Nonnull final Path aTargetFile) { ValueEnforcer.notNull (aSourceFile, "SourceFile"); ValueEnforcer.notNull (aTargetFile, "TargetFile"); final Path aRealSourceFile = _getUnifiedPath (aSourceFile); final Path aRealTargetFile = _getUnifiedPath (aTargetFile); // Does the source file exist? if (!aRealSourceFile.toFile ().isFile ()) return EFileIOErrorCode.SOURCE_DOES_NOT_EXIST.getAsIOError (EFileIOOperation.COPY_FILE, aRealSourceFile); // Are source and target different? if (EqualsHelper.equals (aRealSourceFile, aRealTargetFile)) return EFileIOErrorCode.SOURCE_EQUALS_TARGET.getAsIOError (EFileIOOperation.COPY_FILE, aRealSourceFile); // Does the target file already exist? if (aRealTargetFile.toFile ().exists ()) return EFileIOErrorCode.TARGET_ALREADY_EXISTS.getAsIOError (EFileIOOperation.COPY_FILE, aRealTargetFile); // Is the source file readable? if (!Files.isReadable (aRealSourceFile)) return EFileIOErrorCode.SOURCE_NOT_READABLE.getAsIOError (EFileIOOperation.COPY_FILE, aRealSourceFile); // Is the target parent directory writable? final Path aTargetParentDir = aRealTargetFile.getParent (); if (aTargetParentDir != null && aTargetParentDir.toFile ().exists () && !Files.isWritable (aTargetParentDir)) return EFileIOErrorCode.TARGET_PARENT_NOT_WRITABLE.getAsIOError (EFileIOOperation.COPY_FILE, aRealTargetFile); // Ensure the targets parent directory is present PathHelper.ensureParentDirectoryIsPresent (aRealTargetFile); return _perform (EFileIOOperation.COPY_FILE, Files::copy, aRealSourceFile, aRealTargetFile); }
[ "@", "Nonnull", "public", "static", "FileIOError", "copyFile", "(", "@", "Nonnull", "final", "Path", "aSourceFile", ",", "@", "Nonnull", "final", "Path", "aTargetFile", ")", "{", "ValueEnforcer", ".", "notNull", "(", "aSourceFile", ",", "\"SourceFile\"", ")", ...
Copies the source file to the target file. @param aSourceFile The source file to use. May not be <code>null</code>. Needs to be an existing file. @param aTargetFile The destination files. May not be <code>null</code> and may not be an existing file. @return A non-<code>null</code> error code.
[ "Copies", "the", "source", "file", "to", "the", "target", "file", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/file/PathOperations.java#L530-L564
zeroturnaround/zt-exec
src/main/java/org/zeroturnaround/exec/stream/PumpStreamHandler.java
PumpStreamHandler.createSystemInPump
protected Thread createSystemInPump(InputStream is, OutputStream os) { inputStreamPumper = new InputStreamPumper(is, os); return newThread(inputStreamPumper); }
java
protected Thread createSystemInPump(InputStream is, OutputStream os) { inputStreamPumper = new InputStreamPumper(is, os); return newThread(inputStreamPumper); }
[ "protected", "Thread", "createSystemInPump", "(", "InputStream", "is", ",", "OutputStream", "os", ")", "{", "inputStreamPumper", "=", "new", "InputStreamPumper", "(", "is", ",", "os", ")", ";", "return", "newThread", "(", "inputStreamPumper", ")", ";", "}" ]
Creates a stream pumper to copy the given input stream to the given output stream. @param is the System.in input stream to copy from @param os the output stream to copy into @return the stream pumper thread
[ "Creates", "a", "stream", "pumper", "to", "copy", "the", "given", "input", "stream", "to", "the", "given", "output", "stream", "." ]
train
https://github.com/zeroturnaround/zt-exec/blob/6c3b93b99bf3c69c9f41d6350bf7707005b6a4cd/src/main/java/org/zeroturnaround/exec/stream/PumpStreamHandler.java#L350-L353
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java
JDBCResultSet.updateBoolean
public void updateBoolean(int columnIndex, boolean x) throws SQLException { Boolean value = x ? Boolean.TRUE : Boolean.FALSE; startUpdate(columnIndex); preparedStatement.setParameter(columnIndex, value); }
java
public void updateBoolean(int columnIndex, boolean x) throws SQLException { Boolean value = x ? Boolean.TRUE : Boolean.FALSE; startUpdate(columnIndex); preparedStatement.setParameter(columnIndex, value); }
[ "public", "void", "updateBoolean", "(", "int", "columnIndex", ",", "boolean", "x", ")", "throws", "SQLException", "{", "Boolean", "value", "=", "x", "?", "Boolean", ".", "TRUE", ":", "Boolean", ".", "FALSE", ";", "startUpdate", "(", "columnIndex", ")", ";"...
<!-- start generic documentation --> Updates the designated column with a <code>boolean</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB supports this feature. <p> </div> <!-- end release-specific documentation --> @param columnIndex the first column is 1, the second is 2, ... @param x the new column value @exception SQLException if a database access error occurs, the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.2 (JDK 1.1.x developers: read the overview for JDBCResultSet)
[ "<!", "--", "start", "generic", "documentation", "--", ">", "Updates", "the", "designated", "column", "with", "a", "<code", ">", "boolean<", "/", "code", ">", "value", ".", "The", "updater", "methods", "are", "used", "to", "update", "column", "values", "in...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L2649-L2656
authorjapps/zerocode
core/src/main/java/org/jsmart/zerocode/core/runner/ZeroCodePackageRunner.java
ZeroCodePackageRunner.describeChild
@Override protected Description describeChild(ScenarioSpec child) { this.scenarioDescription = Description.createTestDescription(testClass, child.getScenarioName()); return scenarioDescription; /* * Commented for right click, fix and enable, Try with IntelliJ or Eclipse, see if it works */ //Class<?> clazz, String name, Annotation... annotations /*Annotation annotation = null; try { annotation = (Annotation)Class.forName("org.junit.Test").newInstance(); } catch (Exception e) { throw new RuntimeException("Right Click Error. Ah, error while introducing annotation" + e); } //Description testDescription = Description.createTestDescription(testClass, child.getScenarioName(), annotation); */ }
java
@Override protected Description describeChild(ScenarioSpec child) { this.scenarioDescription = Description.createTestDescription(testClass, child.getScenarioName()); return scenarioDescription; /* * Commented for right click, fix and enable, Try with IntelliJ or Eclipse, see if it works */ //Class<?> clazz, String name, Annotation... annotations /*Annotation annotation = null; try { annotation = (Annotation)Class.forName("org.junit.Test").newInstance(); } catch (Exception e) { throw new RuntimeException("Right Click Error. Ah, error while introducing annotation" + e); } //Description testDescription = Description.createTestDescription(testClass, child.getScenarioName(), annotation); */ }
[ "@", "Override", "protected", "Description", "describeChild", "(", "ScenarioSpec", "child", ")", "{", "this", ".", "scenarioDescription", "=", "Description", ".", "createTestDescription", "(", "testClass", ",", "child", ".", "getScenarioName", "(", ")", ")", ";", ...
Returns a {@link Description} for {@code child}, which can be assumed to be an element of the list returned by {@link ParentRunner#getChildren()} @param child
[ "Returns", "a", "{", "@link", "Description", "}", "for", "{", "@code", "child", "}", "which", "can", "be", "assumed", "to", "be", "an", "element", "of", "the", "list", "returned", "by", "{", "@link", "ParentRunner#getChildren", "()", "}" ]
train
https://github.com/authorjapps/zerocode/blob/d66a3e8778d2eb5e4f0006bfcccfc0922ceb7cef/core/src/main/java/org/jsmart/zerocode/core/runner/ZeroCodePackageRunner.java#L113-L133
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/util/LineInput.java
LineInput.readLine
public synchronized String readLine() throws IOException { int len=fillLine(_buf.length); if (len<0) return null; String s=null; if (_encoding==null) s=new String(_buf,_mark,len); else { try { s=new String(_buf,_mark,len,_encoding); } catch(UnsupportedEncodingException e) { log.warn(LogSupport.EXCEPTION,e); } } _mark=-1; return s; }
java
public synchronized String readLine() throws IOException { int len=fillLine(_buf.length); if (len<0) return null; String s=null; if (_encoding==null) s=new String(_buf,_mark,len); else { try { s=new String(_buf,_mark,len,_encoding); } catch(UnsupportedEncodingException e) { log.warn(LogSupport.EXCEPTION,e); } } _mark=-1; return s; }
[ "public", "synchronized", "String", "readLine", "(", ")", "throws", "IOException", "{", "int", "len", "=", "fillLine", "(", "_buf", ".", "length", ")", ";", "if", "(", "len", "<", "0", ")", "return", "null", ";", "String", "s", "=", "null", ";", "if"...
Read a line ended by CR, LF or CRLF. The default or supplied encoding is used to convert bytes to characters. @return The line as a String or null for EOF. @exception IOException
[ "Read", "a", "line", "ended", "by", "CR", "LF", "or", "CRLF", ".", "The", "default", "or", "supplied", "encoding", "is", "used", "to", "convert", "bytes", "to", "characters", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/LineInput.java#L180-L205
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java
Ssh2Channel.sendRequest
public boolean sendRequest(String requesttype, boolean wantreply, byte[] requestdata, boolean isActivity) throws SshException { synchronized (this) { ByteArrayWriter msg = new ByteArrayWriter(); try { msg.write(SSH_MSG_CHANNEL_REQUEST); msg.writeInt(remoteid); msg.writeString(requesttype); msg.writeBoolean(wantreply); if (requestdata != null) { msg.write(requestdata); } if (Log.isDebugEnabled()) { Log.debug(this, "Sending SSH_MSG_CHANNEL_REQUEST id=" + channelid + " rid=" + remoteid + " request=" + requesttype + " wantreply=" + wantreply); } connection.sendMessage(msg.toByteArray(), true); boolean result = false; if (wantreply) { SshMessage reply = processMessages(CHANNEL_REQUEST_MESSAGES); return reply.getMessageId() == SSH_MSG_CHANNEL_SUCCESS; } return result; } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } finally { try { msg.close(); } catch (IOException e) { } } } }
java
public boolean sendRequest(String requesttype, boolean wantreply, byte[] requestdata, boolean isActivity) throws SshException { synchronized (this) { ByteArrayWriter msg = new ByteArrayWriter(); try { msg.write(SSH_MSG_CHANNEL_REQUEST); msg.writeInt(remoteid); msg.writeString(requesttype); msg.writeBoolean(wantreply); if (requestdata != null) { msg.write(requestdata); } if (Log.isDebugEnabled()) { Log.debug(this, "Sending SSH_MSG_CHANNEL_REQUEST id=" + channelid + " rid=" + remoteid + " request=" + requesttype + " wantreply=" + wantreply); } connection.sendMessage(msg.toByteArray(), true); boolean result = false; if (wantreply) { SshMessage reply = processMessages(CHANNEL_REQUEST_MESSAGES); return reply.getMessageId() == SSH_MSG_CHANNEL_SUCCESS; } return result; } catch (IOException ex) { throw new SshException(ex, SshException.INTERNAL_ERROR); } finally { try { msg.close(); } catch (IOException e) { } } } }
[ "public", "boolean", "sendRequest", "(", "String", "requesttype", ",", "boolean", "wantreply", ",", "byte", "[", "]", "requestdata", ",", "boolean", "isActivity", ")", "throws", "SshException", "{", "synchronized", "(", "this", ")", "{", "ByteArrayWriter", "msg"...
Sends a channel request. Many channels have extensions that are specific to that particular channel type, an example of which is requesting a pseudo terminal from an interactive session. @param requesttype the name of the request, for example "pty-req" @param wantreply specifies whether the remote side should send a success/failure message @param requestdata the request data @param isActivity @return <code>true</code> if the request succeeded and wantreply=true, otherwise <code>false</code> @throws IOException
[ "Sends", "a", "channel", "request", ".", "Many", "channels", "have", "extensions", "that", "are", "specific", "to", "that", "particular", "channel", "type", "an", "example", "of", "which", "is", "requesting", "a", "pseudo", "terminal", "from", "an", "interacti...
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/ssh2/Ssh2Channel.java#L767-L809
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.consent_campaignName_decision_PUT
public void consent_campaignName_decision_PUT(String campaignName, Boolean value) throws IOException { String qPath = "/me/consent/{campaignName}/decision"; StringBuilder sb = path(qPath, campaignName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "value", value); exec(qPath, "PUT", sb.toString(), o); }
java
public void consent_campaignName_decision_PUT(String campaignName, Boolean value) throws IOException { String qPath = "/me/consent/{campaignName}/decision"; StringBuilder sb = path(qPath, campaignName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "value", value); exec(qPath, "PUT", sb.toString(), o); }
[ "public", "void", "consent_campaignName_decision_PUT", "(", "String", "campaignName", ",", "Boolean", "value", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/consent/{campaignName}/decision\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ...
Update decision of a consent campaign REST: PUT /me/consent/{campaignName}/decision @param campaignName [required] Consent campaign name @param value [required] Decision value
[ "Update", "decision", "of", "a", "consent", "campaign" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L1576-L1582
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/ParserDQL.java
ParserDQL.XStartsWithPredicateRightPart
private ExpressionLogical XStartsWithPredicateRightPart(Expression left) { readThis(Tokens.WITH); if (token.tokenType == Tokens.QUESTION) { // handle user parameter case Expression right = XreadRowValuePredicand(); if (left.isParam() && right.isParam()) { // again make sure the left side is valid throw Error.error(ErrorCode.X_42567); } /** In this case, we make the right parameter as the lower bound, * and the right parameter concatenating a special char (greater than any other chars) as the upper bound. * It now becomes a range scan for all the strings with right parameter as its prefix. */ Expression l = new ExpressionLogical(OpTypes.GREATER_EQUAL, left, right); Expression r = new ExpressionLogical(OpTypes.SMALLER_EQUAL, left, new ExpressionArithmetic(OpTypes.CONCAT, right, new ExpressionValue("\uffff", Type.SQL_CHAR))); return new ExpressionLogical(OpTypes.AND, l, r); } else { // handle plain string value and the column Expression right = XreadStringValueExpression(); return new ExpressionStartsWith(left, right, this.isCheckOrTriggerCondition); } }
java
private ExpressionLogical XStartsWithPredicateRightPart(Expression left) { readThis(Tokens.WITH); if (token.tokenType == Tokens.QUESTION) { // handle user parameter case Expression right = XreadRowValuePredicand(); if (left.isParam() && right.isParam()) { // again make sure the left side is valid throw Error.error(ErrorCode.X_42567); } /** In this case, we make the right parameter as the lower bound, * and the right parameter concatenating a special char (greater than any other chars) as the upper bound. * It now becomes a range scan for all the strings with right parameter as its prefix. */ Expression l = new ExpressionLogical(OpTypes.GREATER_EQUAL, left, right); Expression r = new ExpressionLogical(OpTypes.SMALLER_EQUAL, left, new ExpressionArithmetic(OpTypes.CONCAT, right, new ExpressionValue("\uffff", Type.SQL_CHAR))); return new ExpressionLogical(OpTypes.AND, l, r); } else { // handle plain string value and the column Expression right = XreadStringValueExpression(); return new ExpressionStartsWith(left, right, this.isCheckOrTriggerCondition); } }
[ "private", "ExpressionLogical", "XStartsWithPredicateRightPart", "(", "Expression", "left", ")", "{", "readThis", "(", "Tokens", ".", "WITH", ")", ";", "if", "(", "token", ".", "tokenType", "==", "Tokens", ".", "QUESTION", ")", "{", "// handle user parameter case"...
Scan the right-side string value, return a STARTS WITH Expression for generating XML @param a ExpressionColumn
[ "Scan", "the", "right", "-", "side", "string", "value", "return", "a", "STARTS", "WITH", "Expression", "for", "generating", "XML" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/ParserDQL.java#L3384-L3405
i-net-software/jlessc
src/com/inet/lib/less/LessExtendMap.java
LessExtendMap.add
void add( LessExtend lessExtend, String[] mainSelector ) { if( mainSelector == null || mainSelector[0].startsWith( "@media" ) ) { mainSelector = lessExtend.getSelectors(); } else { mainSelector = SelectorUtils.merge( mainSelector, lessExtend.getSelectors() ); } String extendingSelector = lessExtend.getExtendingSelector(); if( lessExtend.isAll() ) { LessExtendResult extend = new LessExtendResult( mainSelector, extendingSelector ); SelectorTokenizer tokenizer = tokenizers.pollLast().init( extendingSelector ); do { String token = tokenizer.next(); if( token == null ) { break; } all.add( token, extend ); } while( true ); tokenizers.addLast( tokenizer ); } else { exact.add( extendingSelector, mainSelector ); } }
java
void add( LessExtend lessExtend, String[] mainSelector ) { if( mainSelector == null || mainSelector[0].startsWith( "@media" ) ) { mainSelector = lessExtend.getSelectors(); } else { mainSelector = SelectorUtils.merge( mainSelector, lessExtend.getSelectors() ); } String extendingSelector = lessExtend.getExtendingSelector(); if( lessExtend.isAll() ) { LessExtendResult extend = new LessExtendResult( mainSelector, extendingSelector ); SelectorTokenizer tokenizer = tokenizers.pollLast().init( extendingSelector ); do { String token = tokenizer.next(); if( token == null ) { break; } all.add( token, extend ); } while( true ); tokenizers.addLast( tokenizer ); } else { exact.add( extendingSelector, mainSelector ); } }
[ "void", "add", "(", "LessExtend", "lessExtend", ",", "String", "[", "]", "mainSelector", ")", "{", "if", "(", "mainSelector", "==", "null", "||", "mainSelector", "[", "0", "]", ".", "startsWith", "(", "\"@media\"", ")", ")", "{", "mainSelector", "=", "le...
Is calling on formatting if an extends was include. @param lessExtend the extend @param mainSelector the selectors in which the extend is placed.
[ "Is", "calling", "on", "formatting", "if", "an", "extends", "was", "include", "." ]
train
https://github.com/i-net-software/jlessc/blob/15b13e1637f6cc2e4d72df021e23ee0ca8d5e629/src/com/inet/lib/less/LessExtendMap.java#L79-L100
box/box-java-sdk
src/main/java/com/box/sdk/BoxUser.java
BoxUser.createEnterpriseUser
public static BoxUser.Info createEnterpriseUser(BoxAPIConnection api, String login, String name, CreateUserParams params) { JsonObject requestJSON = new JsonObject(); requestJSON.add("login", login); requestJSON.add("name", name); if (params != null) { if (params.getRole() != null) { requestJSON.add("role", params.getRole().toJSONValue()); } if (params.getStatus() != null) { requestJSON.add("status", params.getStatus().toJSONValue()); } requestJSON.add("language", params.getLanguage()); requestJSON.add("is_sync_enabled", params.getIsSyncEnabled()); requestJSON.add("job_title", params.getJobTitle()); requestJSON.add("phone", params.getPhone()); requestJSON.add("address", params.getAddress()); requestJSON.add("space_amount", params.getSpaceAmount()); requestJSON.add("can_see_managed_users", params.getCanSeeManagedUsers()); requestJSON.add("timezone", params.getTimezone()); requestJSON.add("is_exempt_from_device_limits", params.getIsExemptFromDeviceLimits()); requestJSON.add("is_exempt_from_login_verification", params.getIsExemptFromLoginVerification()); requestJSON.add("is_platform_access_only", params.getIsPlatformAccessOnly()); requestJSON.add("external_app_user_id", params.getExternalAppUserId()); } URL url = USERS_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, "POST"); request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxUser createdUser = new BoxUser(api, responseJSON.get("id").asString()); return createdUser.new Info(responseJSON); }
java
public static BoxUser.Info createEnterpriseUser(BoxAPIConnection api, String login, String name, CreateUserParams params) { JsonObject requestJSON = new JsonObject(); requestJSON.add("login", login); requestJSON.add("name", name); if (params != null) { if (params.getRole() != null) { requestJSON.add("role", params.getRole().toJSONValue()); } if (params.getStatus() != null) { requestJSON.add("status", params.getStatus().toJSONValue()); } requestJSON.add("language", params.getLanguage()); requestJSON.add("is_sync_enabled", params.getIsSyncEnabled()); requestJSON.add("job_title", params.getJobTitle()); requestJSON.add("phone", params.getPhone()); requestJSON.add("address", params.getAddress()); requestJSON.add("space_amount", params.getSpaceAmount()); requestJSON.add("can_see_managed_users", params.getCanSeeManagedUsers()); requestJSON.add("timezone", params.getTimezone()); requestJSON.add("is_exempt_from_device_limits", params.getIsExemptFromDeviceLimits()); requestJSON.add("is_exempt_from_login_verification", params.getIsExemptFromLoginVerification()); requestJSON.add("is_platform_access_only", params.getIsPlatformAccessOnly()); requestJSON.add("external_app_user_id", params.getExternalAppUserId()); } URL url = USERS_URL_TEMPLATE.build(api.getBaseURL()); BoxJSONRequest request = new BoxJSONRequest(api, url, "POST"); request.setBody(requestJSON.toString()); BoxJSONResponse response = (BoxJSONResponse) request.send(); JsonObject responseJSON = JsonObject.readFrom(response.getJSON()); BoxUser createdUser = new BoxUser(api, responseJSON.get("id").asString()); return createdUser.new Info(responseJSON); }
[ "public", "static", "BoxUser", ".", "Info", "createEnterpriseUser", "(", "BoxAPIConnection", "api", ",", "String", "login", ",", "String", "name", ",", "CreateUserParams", "params", ")", "{", "JsonObject", "requestJSON", "=", "new", "JsonObject", "(", ")", ";", ...
Provisions a new user in an enterprise with additional user information. @param api the API connection to be used by the created user. @param login the email address the user will use to login. @param name the name of the user. @param params additional user information. @return the created user's info.
[ "Provisions", "a", "new", "user", "in", "an", "enterprise", "with", "additional", "user", "information", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxUser.java#L120-L158
liferay/com-liferay-commerce
commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java
CommerceWishListPersistenceImpl.findByGroupId
@Override public List<CommerceWishList> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
java
@Override public List<CommerceWishList> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceWishList", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce wish lists where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceWishListModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of commerce wish lists @param end the upper bound of the range of commerce wish lists (not inclusive) @return the range of matching commerce wish lists
[ "Returns", "a", "range", "of", "all", "the", "commerce", "wish", "lists", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-wish-list-service/src/main/java/com/liferay/commerce/wish/list/service/persistence/impl/CommerceWishListPersistenceImpl.java#L1533-L1536
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java
CPInstancePersistenceImpl.fetchByC_S
@Override public CPInstance fetchByC_S(long CPDefinitionId, String sku) { return fetchByC_S(CPDefinitionId, sku, true); }
java
@Override public CPInstance fetchByC_S(long CPDefinitionId, String sku) { return fetchByC_S(CPDefinitionId, sku, true); }
[ "@", "Override", "public", "CPInstance", "fetchByC_S", "(", "long", "CPDefinitionId", ",", "String", "sku", ")", "{", "return", "fetchByC_S", "(", "CPDefinitionId", ",", "sku", ",", "true", ")", ";", "}" ]
Returns the cp instance where CPDefinitionId = &#63; and sku = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache. @param CPDefinitionId the cp definition ID @param sku the sku @return the matching cp instance, or <code>null</code> if a matching cp instance could not be found
[ "Returns", "the", "cp", "instance", "where", "CPDefinitionId", "=", "&#63", ";", "and", "sku", "=", "&#63", ";", "or", "returns", "<code", ">", "null<", "/", "code", ">", "if", "it", "could", "not", "be", "found", ".", "Uses", "the", "finder", "cache",...
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPInstancePersistenceImpl.java#L4369-L4372
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java
DiscreteFourierTransformOps.multiplyComplex
public static void multiplyComplex( InterleavedF32 complexA , InterleavedF32 complexB , InterleavedF32 complexC ) { InputSanityCheck.checkSameShape(complexA, complexB,complexC); for( int y = 0; y < complexA.height; y++ ) { int indexA = complexA.startIndex + y*complexA.stride; int indexB = complexB.startIndex + y*complexB.stride; int indexC = complexC.startIndex + y*complexC.stride; for( int x = 0; x < complexA.width; x++, indexA += 2 , indexB += 2 ,indexC += 2 ) { float realA = complexA.data[indexA]; float imgA = complexA.data[indexA+1]; float realB = complexB.data[indexB]; float imgB = complexB.data[indexB+1]; complexC.data[indexC] = realA*realB - imgA*imgB; complexC.data[indexC+1] = realA*imgB + imgA*realB; } } }
java
public static void multiplyComplex( InterleavedF32 complexA , InterleavedF32 complexB , InterleavedF32 complexC ) { InputSanityCheck.checkSameShape(complexA, complexB,complexC); for( int y = 0; y < complexA.height; y++ ) { int indexA = complexA.startIndex + y*complexA.stride; int indexB = complexB.startIndex + y*complexB.stride; int indexC = complexC.startIndex + y*complexC.stride; for( int x = 0; x < complexA.width; x++, indexA += 2 , indexB += 2 ,indexC += 2 ) { float realA = complexA.data[indexA]; float imgA = complexA.data[indexA+1]; float realB = complexB.data[indexB]; float imgB = complexB.data[indexB+1]; complexC.data[indexC] = realA*realB - imgA*imgB; complexC.data[indexC+1] = realA*imgB + imgA*realB; } } }
[ "public", "static", "void", "multiplyComplex", "(", "InterleavedF32", "complexA", ",", "InterleavedF32", "complexB", ",", "InterleavedF32", "complexC", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "complexA", ",", "complexB", ",", "complexC", ")", ";", ...
Performs element-wise complex multiplication between two complex images. @param complexA (Input) Complex image @param complexB (Input) Complex image @param complexC (Output) Complex image
[ "Performs", "element", "-", "wise", "complex", "multiplication", "between", "two", "complex", "images", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/transform/fft/DiscreteFourierTransformOps.java#L459-L480
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java
ClassPathBuilder.probeCodeBaseForResource
private boolean probeCodeBaseForResource(DiscoveredCodeBase discoveredCodeBase, String resourceName) { ICodeBaseEntry resource = discoveredCodeBase.getCodeBase().lookupResource(resourceName); return resource != null; }
java
private boolean probeCodeBaseForResource(DiscoveredCodeBase discoveredCodeBase, String resourceName) { ICodeBaseEntry resource = discoveredCodeBase.getCodeBase().lookupResource(resourceName); return resource != null; }
[ "private", "boolean", "probeCodeBaseForResource", "(", "DiscoveredCodeBase", "discoveredCodeBase", ",", "String", "resourceName", ")", "{", "ICodeBaseEntry", "resource", "=", "discoveredCodeBase", ".", "getCodeBase", "(", ")", ".", "lookupResource", "(", "resourceName", ...
Probe a codebase to see if a given source exists in that code base. @param resourceName name of a resource @return true if the resource exists in the codebase, false if not
[ "Probe", "a", "codebase", "to", "see", "if", "a", "given", "source", "exists", "in", "that", "code", "base", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/classfile/impl/ClassPathBuilder.java#L366-L369
aspectran/aspectran
core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java
BasicResponseAdapter.setHeader
@Override public void setHeader(String name, String value) { touchHeaders().set(name, value); }
java
@Override public void setHeader(String name, String value) { touchHeaders().set(name, value); }
[ "@", "Override", "public", "void", "setHeader", "(", "String", "name", ",", "String", "value", ")", "{", "touchHeaders", "(", ")", ".", "set", "(", "name", ",", "value", ")", ";", "}" ]
Set the given single header value under the given header name. @param name the header name @param value the header value to set
[ "Set", "the", "given", "single", "header", "value", "under", "the", "given", "header", "name", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/adapter/BasicResponseAdapter.java#L124-L127
codescape/bitvunit
bitvunit-core/src/main/java/de/codescape/bitvunit/ruleset/XmlRuleSet.java
XmlRuleSet.addRule
private void addRule(String className, Priority priority) { Rule rule; try { rule = (Rule) Class.forName(className).newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new XmlRuleSetException("Could not instantiate rule " + className + ".", e); } rule.setPriority(priority); addRule(rule); }
java
private void addRule(String className, Priority priority) { Rule rule; try { rule = (Rule) Class.forName(className).newInstance(); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { throw new XmlRuleSetException("Could not instantiate rule " + className + ".", e); } rule.setPriority(priority); addRule(rule); }
[ "private", "void", "addRule", "(", "String", "className", ",", "Priority", "priority", ")", "{", "Rule", "rule", ";", "try", "{", "rule", "=", "(", "Rule", ")", "Class", ".", "forName", "(", "className", ")", ".", "newInstance", "(", ")", ";", "}", "...
Instantiates and adds an instance of a {@link Rule} with the given class name to the list of rules contained in this {@link RuleSet} and configures the {@link Priority} accordingly. @param className class name of the {@link Rule} to be added @param priority priority of the {@link Rule} to be added
[ "Instantiates", "and", "adds", "an", "instance", "of", "a", "{", "@link", "Rule", "}", "with", "the", "given", "class", "name", "to", "the", "list", "of", "rules", "contained", "in", "this", "{", "@link", "RuleSet", "}", "and", "configures", "the", "{", ...
train
https://github.com/codescape/bitvunit/blob/cef6d9af60d684e41294981c10b6d92c8f063a4e/bitvunit-core/src/main/java/de/codescape/bitvunit/ruleset/XmlRuleSet.java#L92-L101
asciidoctor/asciidoctor-maven-plugin
src/main/java/org/asciidoctor/maven/AsciidoctorHelper.java
AsciidoctorHelper.addAttributes
public static void addAttributes(final Map<String, Object> attributes, AttributesBuilder attributesBuilder) { // TODO Figure out how to reliably set other values (like boolean values, dates, times, etc) for (Map.Entry<String, Object> attributeEntry : attributes.entrySet()) { addAttribute(attributeEntry.getKey(), attributeEntry.getValue(), attributesBuilder); } }
java
public static void addAttributes(final Map<String, Object> attributes, AttributesBuilder attributesBuilder) { // TODO Figure out how to reliably set other values (like boolean values, dates, times, etc) for (Map.Entry<String, Object> attributeEntry : attributes.entrySet()) { addAttribute(attributeEntry.getKey(), attributeEntry.getValue(), attributesBuilder); } }
[ "public", "static", "void", "addAttributes", "(", "final", "Map", "<", "String", ",", "Object", ">", "attributes", ",", "AttributesBuilder", "attributesBuilder", ")", "{", "// TODO Figure out how to reliably set other values (like boolean values, dates, times, etc)", "for", "...
Adds attributes from a {@link Map} into a {@link AttributesBuilder} taking care of Maven's XML parsing special cases like toggles, nulls, etc. @param attributes map of Asciidoctor attributes @param attributesBuilder AsciidoctorJ AttributesBuilder
[ "Adds", "attributes", "from", "a", "{", "@link", "Map", "}", "into", "a", "{", "@link", "AttributesBuilder", "}", "taking", "care", "of", "Maven", "s", "XML", "parsing", "special", "cases", "like", "toggles", "nulls", "etc", "." ]
train
https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/880938df1c638aaabedb3c944cd3e0ea1844109e/src/main/java/org/asciidoctor/maven/AsciidoctorHelper.java#L32-L37
rometools/rome
rome/src/main/java/com/rometools/rome/io/SyndFeedOutput.java
SyndFeedOutput.output
public void output(final SyndFeed feed, final File file) throws IOException, FeedException { feedOutput.output(feed.createWireFeed(), file); }
java
public void output(final SyndFeed feed, final File file) throws IOException, FeedException { feedOutput.output(feed.createWireFeed(), file); }
[ "public", "void", "output", "(", "final", "SyndFeed", "feed", ",", "final", "File", "file", ")", "throws", "IOException", ",", "FeedException", "{", "feedOutput", ".", "output", "(", "feed", ".", "createWireFeed", "(", ")", ",", "file", ")", ";", "}" ]
Creates a File containing with the XML representation for the given SyndFeedImpl. <p> If the feed encoding is not NULL, it will be used in the XML prolog encoding attribute. The platform default charset encoding is used to write the feed to the file. It is the responsibility of the developer to ensure the feed encoding is set to the platform charset encoding. <p> @param feed Abstract feed to create XML representation from. The type of the SyndFeedImpl must match the type given to the FeedOuptut constructor. @param file the file where to write the XML representation for the given SyndFeedImpl. @throws IOException thrown if there was some problem writing to the File. @throws FeedException thrown if the XML representation for the feed could not be created.
[ "Creates", "a", "File", "containing", "with", "the", "XML", "representation", "for", "the", "given", "SyndFeedImpl", ".", "<p", ">", "If", "the", "feed", "encoding", "is", "not", "NULL", "it", "will", "be", "used", "in", "the", "XML", "prolog", "encoding",...
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome/src/main/java/com/rometools/rome/io/SyndFeedOutput.java#L90-L92
Omertron/api-tvrage
src/main/java/com/omertron/tvrageapi/TVRageApi.java
TVRageApi.getEpisodeInfo
public Episode getEpisodeInfo(String showID, String seasonId, String episodeId) throws TVRageException { if (!isValidString(showID) || !isValidString(seasonId) || !isValidString(episodeId)) { return new Episode(); } StringBuilder tvrageURL = buildURL(API_EPISODE_INFO, showID); // Append the Season & Episode to the URL tvrageURL.append("&ep=").append(seasonId); tvrageURL.append("x").append(episodeId); return TVRageParser.getEpisodeInfo(tvrageURL.toString()); }
java
public Episode getEpisodeInfo(String showID, String seasonId, String episodeId) throws TVRageException { if (!isValidString(showID) || !isValidString(seasonId) || !isValidString(episodeId)) { return new Episode(); } StringBuilder tvrageURL = buildURL(API_EPISODE_INFO, showID); // Append the Season & Episode to the URL tvrageURL.append("&ep=").append(seasonId); tvrageURL.append("x").append(episodeId); return TVRageParser.getEpisodeInfo(tvrageURL.toString()); }
[ "public", "Episode", "getEpisodeInfo", "(", "String", "showID", ",", "String", "seasonId", ",", "String", "episodeId", ")", "throws", "TVRageException", "{", "if", "(", "!", "isValidString", "(", "showID", ")", "||", "!", "isValidString", "(", "seasonId", ")",...
Get the information for a specific episode @param showID @param seasonId @param episodeId @return @throws com.omertron.tvrageapi.TVRageException
[ "Get", "the", "information", "for", "a", "specific", "episode" ]
train
https://github.com/Omertron/api-tvrage/blob/4e805a99de812fabea69d97098f2376be14d51bc/src/main/java/com/omertron/tvrageapi/TVRageApi.java#L87-L98
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java
HylaFaxJob.setTargetAddress
public void setTargetAddress(String targetAddress) { try { this.JOB.setDialstring(targetAddress); } catch(Exception exception) { throw new FaxException("Error while setting job target address.",exception); } }
java
public void setTargetAddress(String targetAddress) { try { this.JOB.setDialstring(targetAddress); } catch(Exception exception) { throw new FaxException("Error while setting job target address.",exception); } }
[ "public", "void", "setTargetAddress", "(", "String", "targetAddress", ")", "{", "try", "{", "this", ".", "JOB", ".", "setDialstring", "(", "targetAddress", ")", ";", "}", "catch", "(", "Exception", "exception", ")", "{", "throw", "new", "FaxException", "(", ...
This function sets the fax job target address. @param targetAddress The fax job target address
[ "This", "function", "sets", "the", "fax", "job", "target", "address", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxJob.java#L187-L197
nextreports/nextreports-server
src/ro/nextreports/server/web/integration/IntegrationAuthenticationFilter.java
IntegrationAuthenticationFilter.requiresAuthentication
protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) { String uri = request.getRequestURI(); int pathParamIndex = uri.indexOf(';'); if (pathParamIndex > 0) { // strip everything after the first semi-colon uri = uri.substring(0, pathParamIndex); } if ("".equals(request.getContextPath())) { return uri.endsWith(filterProcessesUrl); } return uri.endsWith(request.getContextPath() + filterProcessesUrl); }
java
protected boolean requiresAuthentication(HttpServletRequest request, HttpServletResponse response) { String uri = request.getRequestURI(); int pathParamIndex = uri.indexOf(';'); if (pathParamIndex > 0) { // strip everything after the first semi-colon uri = uri.substring(0, pathParamIndex); } if ("".equals(request.getContextPath())) { return uri.endsWith(filterProcessesUrl); } return uri.endsWith(request.getContextPath() + filterProcessesUrl); }
[ "protected", "boolean", "requiresAuthentication", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "{", "String", "uri", "=", "request", ".", "getRequestURI", "(", ")", ";", "int", "pathParamIndex", "=", "uri", ".", "indexOf", "("...
/* public void setAuthenticationSuccessHandler(AuthenticationSuccessHandler successHandler) { Assert.notNull(successHandler, "successHandler cannot be null"); this.successHandler = successHandler; } public void setAuthenticationFailureHandler(AuthenticationFailureHandler failureHandler) { Assert.notNull(failureHandler, "failureHandler cannot be null"); this.failureHandler = failureHandler; }
[ "/", "*", "public", "void", "setAuthenticationSuccessHandler", "(", "AuthenticationSuccessHandler", "successHandler", ")", "{", "Assert", ".", "notNull", "(", "successHandler", "successHandler", "cannot", "be", "null", ")", ";", "this", ".", "successHandler", "=", "...
train
https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/web/integration/IntegrationAuthenticationFilter.java#L185-L199
BioPAX/Paxtools
sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java
L3ToSBGNPDConverter.createGlyphBasics
private Glyph createGlyphBasics(Entity e, boolean idIsFinal) { Glyph g = factory.createGlyph(); g.setId(convertID(e.getUri())); String s = typeMatchMap.get(e.getModelInterface()); if(( //use 'or' sbgn class for special generic physical entities e instanceof Complex && !((Complex)e).getMemberPhysicalEntity().isEmpty() && ((Complex) e).getComponent().isEmpty()) || (e instanceof SimplePhysicalEntity && ((SimplePhysicalEntity) e).getEntityReference()==null && !((SimplePhysicalEntity) e).getMemberPhysicalEntity().isEmpty())) { s = GlyphClazz.OR.getClazz(); } g.setClazz(s); // Set the label Label label = factory.createLabel(); label.setText(findLabelFor(e)); g.setLabel(label); // Detect if ubique if (ubiqueDet != null && ubiqueDet.isUbique(e)) { g.setClone(factory.createGlyphClone()); } // Put on state variables if (!g.getClazz().equals(GlyphClazz.OR.getClazz())) { g.getGlyph().addAll(getInformation(e)); } // Record the mapping if (idIsFinal) { Set<String> uris = new HashSet<String>(); uris.add(e.getUri()); sbgn2BPMap.put(g.getId(), uris); } return g; }
java
private Glyph createGlyphBasics(Entity e, boolean idIsFinal) { Glyph g = factory.createGlyph(); g.setId(convertID(e.getUri())); String s = typeMatchMap.get(e.getModelInterface()); if(( //use 'or' sbgn class for special generic physical entities e instanceof Complex && !((Complex)e).getMemberPhysicalEntity().isEmpty() && ((Complex) e).getComponent().isEmpty()) || (e instanceof SimplePhysicalEntity && ((SimplePhysicalEntity) e).getEntityReference()==null && !((SimplePhysicalEntity) e).getMemberPhysicalEntity().isEmpty())) { s = GlyphClazz.OR.getClazz(); } g.setClazz(s); // Set the label Label label = factory.createLabel(); label.setText(findLabelFor(e)); g.setLabel(label); // Detect if ubique if (ubiqueDet != null && ubiqueDet.isUbique(e)) { g.setClone(factory.createGlyphClone()); } // Put on state variables if (!g.getClazz().equals(GlyphClazz.OR.getClazz())) { g.getGlyph().addAll(getInformation(e)); } // Record the mapping if (idIsFinal) { Set<String> uris = new HashSet<String>(); uris.add(e.getUri()); sbgn2BPMap.put(g.getId(), uris); } return g; }
[ "private", "Glyph", "createGlyphBasics", "(", "Entity", "e", ",", "boolean", "idIsFinal", ")", "{", "Glyph", "g", "=", "factory", ".", "createGlyph", "(", ")", ";", "g", ".", "setId", "(", "convertID", "(", "e", ".", "getUri", "(", ")", ")", ")", ";"...
/* This method creates a glyph for the given PhysicalEntity, sets its title and state variables if applicable. @param e PhysicalEntity or Gene to represent @param idIsFinal if ID is final, then it is recorded for future reference @return the glyph
[ "/", "*", "This", "method", "creates", "a", "glyph", "for", "the", "given", "PhysicalEntity", "sets", "its", "title", "and", "state", "variables", "if", "applicable", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/sbgn-converter/src/main/java/org/biopax/paxtools/io/sbgn/L3ToSBGNPDConverter.java#L461-L502
looly/hutool
hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java
ImgUtil.getWriter
public static ImageWriter getWriter(Image img, String formatName) { final ImageTypeSpecifier type = ImageTypeSpecifier.createFromRenderedImage(toRenderedImage(img)); final Iterator<ImageWriter> iter = ImageIO.getImageWriters(type, formatName); return iter.hasNext() ? iter.next() : null; }
java
public static ImageWriter getWriter(Image img, String formatName) { final ImageTypeSpecifier type = ImageTypeSpecifier.createFromRenderedImage(toRenderedImage(img)); final Iterator<ImageWriter> iter = ImageIO.getImageWriters(type, formatName); return iter.hasNext() ? iter.next() : null; }
[ "public", "static", "ImageWriter", "getWriter", "(", "Image", "img", ",", "String", "formatName", ")", "{", "final", "ImageTypeSpecifier", "type", "=", "ImageTypeSpecifier", ".", "createFromRenderedImage", "(", "toRenderedImage", "(", "img", ")", ")", ";", "final"...
根据给定的Image对象和格式获取对应的{@link ImageWriter},如果未找到合适的Writer,返回null @param img {@link Image} @param formatName 图片格式,例如"jpg"、"png" @return {@link ImageWriter} @since 4.3.2
[ "根据给定的Image对象和格式获取对应的", "{", "@link", "ImageWriter", "}", ",如果未找到合适的Writer,返回null" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/img/ImgUtil.java#L1654-L1658
stephenc/redmine-java-api
src/main/java/org/redmine/ta/internal/RedmineJSONParser.java
RedmineJSONParser.getShortDateOrNull
private static Date getShortDateOrNull(JSONObject obj, String field) throws JSONException { final String dateStr = JsonInput.getStringOrNull(obj, field); if (dateStr == null) { return null; } final SimpleDateFormat dateFormat; if (dateStr.length() >= 5 && dateStr.charAt(4) == '/') dateFormat = RedmineDateUtils.SHORT_DATE_FORMAT.get(); else dateFormat = RedmineDateUtils.SHORT_DATE_FORMAT_V2.get(); try { return dateFormat.parse(dateStr); } catch (ParseException e) { throw new JSONException("Bad date " + dateStr); } }
java
private static Date getShortDateOrNull(JSONObject obj, String field) throws JSONException { final String dateStr = JsonInput.getStringOrNull(obj, field); if (dateStr == null) { return null; } final SimpleDateFormat dateFormat; if (dateStr.length() >= 5 && dateStr.charAt(4) == '/') dateFormat = RedmineDateUtils.SHORT_DATE_FORMAT.get(); else dateFormat = RedmineDateUtils.SHORT_DATE_FORMAT_V2.get(); try { return dateFormat.parse(dateStr); } catch (ParseException e) { throw new JSONException("Bad date " + dateStr); } }
[ "private", "static", "Date", "getShortDateOrNull", "(", "JSONObject", "obj", ",", "String", "field", ")", "throws", "JSONException", "{", "final", "String", "dateStr", "=", "JsonInput", ".", "getStringOrNull", "(", "obj", ",", "field", ")", ";", "if", "(", "...
Fetches an optional date from an object. @param obj object to get a field from. @param field field to get a value from. @throws RedmineFormatException if value is not valid
[ "Fetches", "an", "optional", "date", "from", "an", "object", "." ]
train
https://github.com/stephenc/redmine-java-api/blob/7e5270c84aba32d74a506260ec47ff86ab6c9d84/src/main/java/org/redmine/ta/internal/RedmineJSONParser.java#L586-L603
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java
JDBC4CallableStatement.setTimestamp
@Override public void setTimestamp(String parameterName, Timestamp x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public void setTimestamp(String parameterName, Timestamp x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "void", "setTimestamp", "(", "String", "parameterName", ",", "Timestamp", "x", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Sets the designated parameter to the given java.sql.Timestamp value.
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "java", ".", "sql", ".", "Timestamp", "value", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L903-L908
Red5/red5-server-common
src/main/java/org/red5/server/net/rtmp/BaseRTMPHandler.java
BaseRTMPHandler.onStreamBytesRead
protected void onStreamBytesRead(RTMPConnection conn, Channel channel, Header source, BytesRead streamBytesRead) { conn.receivedBytesRead(streamBytesRead.getBytesRead()); }
java
protected void onStreamBytesRead(RTMPConnection conn, Channel channel, Header source, BytesRead streamBytesRead) { conn.receivedBytesRead(streamBytesRead.getBytesRead()); }
[ "protected", "void", "onStreamBytesRead", "(", "RTMPConnection", "conn", ",", "Channel", "channel", ",", "Header", "source", ",", "BytesRead", "streamBytesRead", ")", "{", "conn", ".", "receivedBytesRead", "(", "streamBytesRead", ".", "getBytesRead", "(", ")", ")"...
Stream bytes read event handler. @param conn Connection @param channel Channel @param source Header @param streamBytesRead Bytes read event context
[ "Stream", "bytes", "read", "event", "handler", "." ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/net/rtmp/BaseRTMPHandler.java#L341-L343
agmip/translator-dssat
src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java
DssatCommonOutput.formatStr
protected String formatStr(int bits, HashMap m, Object key, String defVal) { String ret = getObjectOr(m, key, defVal).trim(); return formatStr(bits, ret, key); }
java
protected String formatStr(int bits, HashMap m, Object key, String defVal) { String ret = getObjectOr(m, key, defVal).trim(); return formatStr(bits, ret, key); }
[ "protected", "String", "formatStr", "(", "int", "bits", ",", "HashMap", "m", ",", "Object", "key", ",", "String", "defVal", ")", "{", "String", "ret", "=", "getObjectOr", "(", "m", ",", "key", ",", "defVal", ")", ".", "trim", "(", ")", ";", "return",...
Format the output string with maximum length @param bits Maximum length of the output string @param m the experiment data holder @param key the key of field in the map @param defVal the default return value when error happens @return formated string of number
[ "Format", "the", "output", "string", "with", "maximum", "length" ]
train
https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java#L106-L110
eFaps/eFaps-Kernel
src/main/java/org/efaps/db/stmt/runner/SQLRunner.java
SQLRunner.executeInserts
private void executeInserts() throws EFapsException { ConnectionResource con = null; try { final Insert insert = (Insert) runnable; con = Context.getThreadContext().getConnectionResource(); long id = 0; for (final Entry<SQLTable, AbstractSQLInsertUpdate<?>> entry : updatemap.entrySet()) { if (id != 0) { entry.getValue().column(entry.getKey().getSqlColId(), id); } if (entry.getKey().getSqlColType() != null) { entry.getValue().column(entry.getKey().getSqlColType(), insert.getType().getId()); } final Long created = ((SQLInsert) entry.getValue()).execute(con); if (created != null) { id = created; insert.evaluateInstance(created); } } } catch (final SQLException e) { throw new EFapsException(SQLRunner.class, "executeOneCompleteStmt", e); } }
java
private void executeInserts() throws EFapsException { ConnectionResource con = null; try { final Insert insert = (Insert) runnable; con = Context.getThreadContext().getConnectionResource(); long id = 0; for (final Entry<SQLTable, AbstractSQLInsertUpdate<?>> entry : updatemap.entrySet()) { if (id != 0) { entry.getValue().column(entry.getKey().getSqlColId(), id); } if (entry.getKey().getSqlColType() != null) { entry.getValue().column(entry.getKey().getSqlColType(), insert.getType().getId()); } final Long created = ((SQLInsert) entry.getValue()).execute(con); if (created != null) { id = created; insert.evaluateInstance(created); } } } catch (final SQLException e) { throw new EFapsException(SQLRunner.class, "executeOneCompleteStmt", e); } }
[ "private", "void", "executeInserts", "(", ")", "throws", "EFapsException", "{", "ConnectionResource", "con", "=", "null", ";", "try", "{", "final", "Insert", "insert", "=", "(", "Insert", ")", "runnable", ";", "con", "=", "Context", ".", "getThreadContext", ...
Execute the inserts. @throws EFapsException the e faps exception
[ "Execute", "the", "inserts", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/db/stmt/runner/SQLRunner.java#L527-L550
eclipse/xtext-core
org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java
GeneratorNodeExtensions.appendNewLine
public CompositeGeneratorNode appendNewLine(final CompositeGeneratorNode parent) { List<IGeneratorNode> _children = parent.getChildren(); String _lineDelimiter = this.wsConfig.getLineDelimiter(); NewLineNode _newLineNode = new NewLineNode(_lineDelimiter, false); _children.add(_newLineNode); return parent; }
java
public CompositeGeneratorNode appendNewLine(final CompositeGeneratorNode parent) { List<IGeneratorNode> _children = parent.getChildren(); String _lineDelimiter = this.wsConfig.getLineDelimiter(); NewLineNode _newLineNode = new NewLineNode(_lineDelimiter, false); _children.add(_newLineNode); return parent; }
[ "public", "CompositeGeneratorNode", "appendNewLine", "(", "final", "CompositeGeneratorNode", "parent", ")", "{", "List", "<", "IGeneratorNode", ">", "_children", "=", "parent", ".", "getChildren", "(", ")", ";", "String", "_lineDelimiter", "=", "this", ".", "wsCon...
Appends a line separator node to the given parent. @return the given parent node
[ "Appends", "a", "line", "separator", "node", "to", "the", "given", "parent", "." ]
train
https://github.com/eclipse/xtext-core/blob/bac941cb75cb24706519845ec174cfef874d7557/org.eclipse.xtext/xtend-gen/org/eclipse/xtext/generator/trace/node/GeneratorNodeExtensions.java#L96-L102
couchbase/java-dcp-client
src/main/java/com/couchbase/client/dcp/config/SSLEngineFactory.java
SSLEngineFactory.get
public SSLEngine get() { try { String pass = env.sslKeystorePassword(); char[] password = pass == null || pass.isEmpty() ? null : pass.toCharArray(); KeyStore ks = env.sslKeystore(); if (ks == null) { ks = KeyStore.getInstance(KeyStore.getDefaultType()); String ksFile = env.sslKeystoreFile(); if (ksFile == null || ksFile.isEmpty()) { throw new IllegalArgumentException("Path to Keystore File must not be null or empty."); } ks.load(new FileInputStream(ksFile), password); } String defaultAlgorithm = KeyManagerFactory.getDefaultAlgorithm(); KeyManagerFactory kmf = KeyManagerFactory.getInstance(defaultAlgorithm); TrustManagerFactory tmf = TrustManagerFactory.getInstance(defaultAlgorithm); kmf.init(ks, password); tmf.init(ks); SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); SSLEngine engine = ctx.createSSLEngine(); engine.setUseClientMode(true); return engine; } catch (Exception ex) { throw new SSLException("Could not create SSLEngine.", ex); } }
java
public SSLEngine get() { try { String pass = env.sslKeystorePassword(); char[] password = pass == null || pass.isEmpty() ? null : pass.toCharArray(); KeyStore ks = env.sslKeystore(); if (ks == null) { ks = KeyStore.getInstance(KeyStore.getDefaultType()); String ksFile = env.sslKeystoreFile(); if (ksFile == null || ksFile.isEmpty()) { throw new IllegalArgumentException("Path to Keystore File must not be null or empty."); } ks.load(new FileInputStream(ksFile), password); } String defaultAlgorithm = KeyManagerFactory.getDefaultAlgorithm(); KeyManagerFactory kmf = KeyManagerFactory.getInstance(defaultAlgorithm); TrustManagerFactory tmf = TrustManagerFactory.getInstance(defaultAlgorithm); kmf.init(ks, password); tmf.init(ks); SSLContext ctx = SSLContext.getInstance("TLS"); ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null); SSLEngine engine = ctx.createSSLEngine(); engine.setUseClientMode(true); return engine; } catch (Exception ex) { throw new SSLException("Could not create SSLEngine.", ex); } }
[ "public", "SSLEngine", "get", "(", ")", "{", "try", "{", "String", "pass", "=", "env", ".", "sslKeystorePassword", "(", ")", ";", "char", "[", "]", "password", "=", "pass", "==", "null", "||", "pass", ".", "isEmpty", "(", ")", "?", "null", ":", "pa...
Returns a new {@link SSLEngine} constructed from the config settings. @return a {@link SSLEngine} ready to be used.
[ "Returns", "a", "new", "{", "@link", "SSLEngine", "}", "constructed", "from", "the", "config", "settings", "." ]
train
https://github.com/couchbase/java-dcp-client/blob/75359d8c081d6c575f8087cf7c28d24ab24c6421/src/main/java/com/couchbase/client/dcp/config/SSLEngineFactory.java#L54-L83
loldevs/riotapi
domain/src/main/java/net/boreeas/riotapi/rtmp/serialization/AmfWriter.java
AmfWriter.serializeAmf3
@SneakyThrows(value = {InstantiationException.class, IllegalAccessException.class}) public void serializeAmf3(Object obj, Amf3Type marker) throws IOException { if (checkReferenceable(obj, marker)) { return; } Serialization context; if (amf3Serializers.containsKey(obj.getClass())) { amf3Serializers.get(obj.getClass()).serialize(obj, out); } else if ((context = Util.searchClassHierarchy(obj.getClass(), Serialization.class)) != null && !context.deserializeOnly()) { Amf3ObjectSerializer serializer = context.amf3Serializer().newInstance(); serializer.setTraitRefTable(traitRefTable); serializer.setTraitDefCache(traitDefCache); serializer.setWriter(this); serializer.serialize(obj, out); } else if (obj.getClass().isArray()) { // Arrays require special handling serializeArrayAmf3(obj); } else if (obj instanceof Enum) { // Enums are written by name serializeAmf3(((Enum) obj).name()); } else { Amf3ObjectSerializer serializer = new Amf3ObjectSerializer(); serializer.setTraitRefTable(traitRefTable); serializer.setTraitDefCache(traitDefCache); serializer.setWriter(this); serializer.serialize(obj, out); } out.flush(); }
java
@SneakyThrows(value = {InstantiationException.class, IllegalAccessException.class}) public void serializeAmf3(Object obj, Amf3Type marker) throws IOException { if (checkReferenceable(obj, marker)) { return; } Serialization context; if (amf3Serializers.containsKey(obj.getClass())) { amf3Serializers.get(obj.getClass()).serialize(obj, out); } else if ((context = Util.searchClassHierarchy(obj.getClass(), Serialization.class)) != null && !context.deserializeOnly()) { Amf3ObjectSerializer serializer = context.amf3Serializer().newInstance(); serializer.setTraitRefTable(traitRefTable); serializer.setTraitDefCache(traitDefCache); serializer.setWriter(this); serializer.serialize(obj, out); } else if (obj.getClass().isArray()) { // Arrays require special handling serializeArrayAmf3(obj); } else if (obj instanceof Enum) { // Enums are written by name serializeAmf3(((Enum) obj).name()); } else { Amf3ObjectSerializer serializer = new Amf3ObjectSerializer(); serializer.setTraitRefTable(traitRefTable); serializer.setTraitDefCache(traitDefCache); serializer.setWriter(this); serializer.serialize(obj, out); } out.flush(); }
[ "@", "SneakyThrows", "(", "value", "=", "{", "InstantiationException", ".", "class", ",", "IllegalAccessException", ".", "class", "}", ")", "public", "void", "serializeAmf3", "(", "Object", "obj", ",", "Amf3Type", "marker", ")", "throws", "IOException", "{", "...
Serializes the specified object to amf3 @param obj The object to serialize @param marker The type of the object to check for referencability @throws IOException
[ "Serializes", "the", "specified", "object", "to", "amf3" ]
train
https://github.com/loldevs/riotapi/blob/0b8aac407aa5289845f249024f9732332855544f/domain/src/main/java/net/boreeas/riotapi/rtmp/serialization/AmfWriter.java#L267-L303
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.catalog_formatted_privateCloudDC_GET
public net.minidev.ovh.api.order.catalog.privatecloud.OvhCatalog catalog_formatted_privateCloudDC_GET(OvhOvhSubsidiaryEnum ovhSubsidiary) throws IOException { String qPath = "/order/catalog/formatted/privateCloudDC"; StringBuilder sb = path(qPath); query(sb, "ovhSubsidiary", ovhSubsidiary); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, net.minidev.ovh.api.order.catalog.privatecloud.OvhCatalog.class); }
java
public net.minidev.ovh.api.order.catalog.privatecloud.OvhCatalog catalog_formatted_privateCloudDC_GET(OvhOvhSubsidiaryEnum ovhSubsidiary) throws IOException { String qPath = "/order/catalog/formatted/privateCloudDC"; StringBuilder sb = path(qPath); query(sb, "ovhSubsidiary", ovhSubsidiary); String resp = execN(qPath, "GET", sb.toString(), null); return convertTo(resp, net.minidev.ovh.api.order.catalog.privatecloud.OvhCatalog.class); }
[ "public", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "order", ".", "catalog", ".", "privatecloud", ".", "OvhCatalog", "catalog_formatted_privateCloudDC_GET", "(", "OvhOvhSubsidiaryEnum", "ovhSubsidiary", ")", "throws", "IOException", "{", "String", "qPath",...
Retrieve information of Private Cloud Dedicated Cloud catalog REST: GET /order/catalog/formatted/privateCloudDC @param ovhSubsidiary [required] Subsidiary of the country you want to consult catalog API beta
[ "Retrieve", "information", "of", "Private", "Cloud", "Dedicated", "Cloud", "catalog" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L7331-L7337
jhy/jsoup
src/main/java/org/jsoup/safety/Whitelist.java
Whitelist.addAttributes
public Whitelist addAttributes(String tag, String... attributes) { Validate.notEmpty(tag); Validate.notNull(attributes); Validate.isTrue(attributes.length > 0, "No attribute names supplied."); TagName tagName = TagName.valueOf(tag); tagNames.add(tagName); Set<AttributeKey> attributeSet = new HashSet<>(); for (String key : attributes) { Validate.notEmpty(key); attributeSet.add(AttributeKey.valueOf(key)); } if (this.attributes.containsKey(tagName)) { Set<AttributeKey> currentSet = this.attributes.get(tagName); currentSet.addAll(attributeSet); } else { this.attributes.put(tagName, attributeSet); } return this; }
java
public Whitelist addAttributes(String tag, String... attributes) { Validate.notEmpty(tag); Validate.notNull(attributes); Validate.isTrue(attributes.length > 0, "No attribute names supplied."); TagName tagName = TagName.valueOf(tag); tagNames.add(tagName); Set<AttributeKey> attributeSet = new HashSet<>(); for (String key : attributes) { Validate.notEmpty(key); attributeSet.add(AttributeKey.valueOf(key)); } if (this.attributes.containsKey(tagName)) { Set<AttributeKey> currentSet = this.attributes.get(tagName); currentSet.addAll(attributeSet); } else { this.attributes.put(tagName, attributeSet); } return this; }
[ "public", "Whitelist", "addAttributes", "(", "String", "tag", ",", "String", "...", "attributes", ")", "{", "Validate", ".", "notEmpty", "(", "tag", ")", ";", "Validate", ".", "notNull", "(", "attributes", ")", ";", "Validate", ".", "isTrue", "(", "attribu...
Add a list of allowed attributes to a tag. (If an attribute is not allowed on an element, it will be removed.) <p> E.g.: <code>addAttributes("a", "href", "class")</code> allows <code>href</code> and <code>class</code> attributes on <code>a</code> tags. </p> <p> To make an attribute valid for <b>all tags</b>, use the pseudo tag <code>:all</code>, e.g. <code>addAttributes(":all", "class")</code>. </p> @param tag The tag the attributes are for. The tag will be added to the allowed tag list if necessary. @param attributes List of valid attributes for the tag @return this (for chaining)
[ "Add", "a", "list", "of", "allowed", "attributes", "to", "a", "tag", ".", "(", "If", "an", "attribute", "is", "not", "allowed", "on", "an", "element", "it", "will", "be", "removed", ".", ")", "<p", ">", "E", ".", "g", ".", ":", "<code", ">", "add...
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/safety/Whitelist.java#L253-L272
arnaudroger/SimpleFlatMapper
sfm-map/src/main/java/org/simpleflatmapper/map/mapper/MapperBuilder.java
MapperBuilder.addMapping
public final B addMapping(String column, int index, final ColumnDefinition<K, ?> columnDefinition) { return addMapping(key(column, index), columnDefinition); }
java
public final B addMapping(String column, int index, final ColumnDefinition<K, ?> columnDefinition) { return addMapping(key(column, index), columnDefinition); }
[ "public", "final", "B", "addMapping", "(", "String", "column", ",", "int", "index", ",", "final", "ColumnDefinition", "<", "K", ",", "?", ">", "columnDefinition", ")", "{", "return", "addMapping", "(", "key", "(", "column", ",", "index", ")", ",", "colum...
add a new mapping to the specified property with the specified index, specified property definition and an undefined type. @param column the property name @param index the property index @param columnDefinition the property definition @return the current builder
[ "add", "a", "new", "mapping", "to", "the", "specified", "property", "with", "the", "specified", "index", "specified", "property", "definition", "and", "an", "undefined", "type", "." ]
train
https://github.com/arnaudroger/SimpleFlatMapper/blob/93435438c18f26c87963d5e0f3ebf0f264dcd8c2/sfm-map/src/main/java/org/simpleflatmapper/map/mapper/MapperBuilder.java#L111-L113
eclipse/xtext-lib
org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IterableExtensions.java
IterableExtensions.flatMap
@Pure public static <T, R> Iterable<R> flatMap(Iterable<T> original, Function1<? super T, ? extends Iterable<R>> transformation) { return flatten(map(original, transformation)); }
java
@Pure public static <T, R> Iterable<R> flatMap(Iterable<T> original, Function1<? super T, ? extends Iterable<R>> transformation) { return flatten(map(original, transformation)); }
[ "@", "Pure", "public", "static", "<", "T", ",", "R", ">", "Iterable", "<", "R", ">", "flatMap", "(", "Iterable", "<", "T", ">", "original", ",", "Function1", "<", "?", "super", "T", ",", "?", "extends", "Iterable", "<", "R", ">", ">", "transformati...
Returns an iterable that performs the given {@code transformation} for each element of {@code original} when requested. The mapping is done lazily. That is, subsequent iterations of the elements in the iterable will repeatedly apply the transformation. <p> The transformation maps each element to an iterable, and all resulting iterables are combined to a single iterable. Effectively a combination of {@link #map(Iterable, Functions.Function1)} and {@link #flatten(Iterable)} is performed. </p> <p> The returned iterable's iterator <i>does not support {@code remove()}</i> in contrast to {@link #map(Iterable, Functions.Function1)}. </p> @param original the original iterable. May not be <code>null</code>. @param transformation the transformation. May not be <code>null</code> and must not yield <code>null</code>. @return an iterable that provides the result of the transformation. Never <code>null</code>. @since 2.13
[ "Returns", "an", "iterable", "that", "performs", "the", "given", "{", "@code", "transformation", "}", "for", "each", "element", "of", "{", "@code", "original", "}", "when", "requested", ".", "The", "mapping", "is", "done", "lazily", ".", "That", "is", "sub...
train
https://github.com/eclipse/xtext-lib/blob/7063572e1f1bd713a3aa53bdf3a8dc60e25c169a/org.eclipse.xtext.xbase.lib/src/org/eclipse/xtext/xbase/lib/IterableExtensions.java#L366-L369
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/StringUtils.java
StringUtils.unicodeToString
public static String unicodeToString(String s) { StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(s, "\\u"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (token.length() > 4) { sb.append((char) Integer.parseInt(token.substring(0, 4), 16)); sb.append(token.substring(4)); } else { sb.append((char) Integer.parseInt(token, 16)); } } return sb.toString(); }
java
public static String unicodeToString(String s) { StringBuilder sb = new StringBuilder(); StringTokenizer st = new StringTokenizer(s, "\\u"); while (st.hasMoreTokens()) { String token = st.nextToken(); if (token.length() > 4) { sb.append((char) Integer.parseInt(token.substring(0, 4), 16)); sb.append(token.substring(4)); } else { sb.append((char) Integer.parseInt(token, 16)); } } return sb.toString(); }
[ "public", "static", "String", "unicodeToString", "(", "String", "s", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "StringTokenizer", "st", "=", "new", "StringTokenizer", "(", "s", ",", "\"\\\\u\"", ")", ";", "while", "(", "s...
Convert a string that is unicode form to a normal string. @param s The unicode form of a string, e.g. "\\u8001\\u9A6C" @return Normal string
[ "Convert", "a", "string", "that", "is", "unicode", "form", "to", "a", "normal", "string", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/StringUtils.java#L656-L669
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/MockRequest.java
MockRequest.setFileContents
public void setFileContents(final String key, final byte[] contents) { MockFileItem fileItem = new MockFileItem(); fileItem.set(contents); files.put(key, new FileItem[]{fileItem}); }
java
public void setFileContents(final String key, final byte[] contents) { MockFileItem fileItem = new MockFileItem(); fileItem.set(contents); files.put(key, new FileItem[]{fileItem}); }
[ "public", "void", "setFileContents", "(", "final", "String", "key", ",", "final", "byte", "[", "]", "contents", ")", "{", "MockFileItem", "fileItem", "=", "new", "MockFileItem", "(", ")", ";", "fileItem", ".", "set", "(", "contents", ")", ";", "files", "...
Sets mock file upload contents. @param key the parameter key. @param contents the file binary data.
[ "Sets", "mock", "file", "upload", "contents", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/util/mock/MockRequest.java#L105-L109
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java
MapUtils.buildClickBoundingBox
public static BoundingBox buildClickBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage); // Create the bounding box to query for features BoundingBox boundingBox = new BoundingBox( latLngBoundingBox.getLeftCoordinate().longitude, latLngBoundingBox.getDownCoordinate().latitude, latLngBoundingBox.getRightCoordinate().longitude, latLngBoundingBox.getUpCoordinate().latitude); return boundingBox; }
java
public static BoundingBox buildClickBoundingBox(LatLng latLng, View view, GoogleMap map, float screenClickPercentage) { LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox(latLng, view, map, screenClickPercentage); // Create the bounding box to query for features BoundingBox boundingBox = new BoundingBox( latLngBoundingBox.getLeftCoordinate().longitude, latLngBoundingBox.getDownCoordinate().latitude, latLngBoundingBox.getRightCoordinate().longitude, latLngBoundingBox.getUpCoordinate().latitude); return boundingBox; }
[ "public", "static", "BoundingBox", "buildClickBoundingBox", "(", "LatLng", "latLng", ",", "View", "view", ",", "GoogleMap", "map", ",", "float", "screenClickPercentage", ")", "{", "LatLngBoundingBox", "latLngBoundingBox", "=", "buildClickLatLngBoundingBox", "(", "latLng...
Build a bounding box using the click location, map view, map, and screen percentage tolerance. The bounding box can be used to query for features that were clicked @param latLng click location @param view view @param map Google map @param screenClickPercentage screen click percentage between 0.0 and 1.0 for how close a feature on the screen must be to be included in a click query @return bounding box
[ "Build", "a", "bounding", "box", "using", "the", "click", "location", "map", "view", "map", "and", "screen", "percentage", "tolerance", ".", "The", "bounding", "box", "can", "be", "used", "to", "query", "for", "features", "that", "were", "clicked" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/MapUtils.java#L113-L125
igniterealtime/Smack
smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java
TransportNegotiator.triggerTransportEstablished
private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException { List<JingleListener> listeners = getListenersList(); for (JingleListener li : listeners) { if (li instanceof JingleTransportListener) { JingleTransportListener mli = (JingleTransportListener) li; LOGGER.fine("triggerTransportEstablished " + local.getLocalIp() + ":" + local.getPort() + " <-> " + remote.getIp() + ":" + remote.getPort()); mli.transportEstablished(local, remote); } } }
java
private void triggerTransportEstablished(TransportCandidate local, TransportCandidate remote) throws NotConnectedException, InterruptedException { List<JingleListener> listeners = getListenersList(); for (JingleListener li : listeners) { if (li instanceof JingleTransportListener) { JingleTransportListener mli = (JingleTransportListener) li; LOGGER.fine("triggerTransportEstablished " + local.getLocalIp() + ":" + local.getPort() + " <-> " + remote.getIp() + ":" + remote.getPort()); mli.transportEstablished(local, remote); } } }
[ "private", "void", "triggerTransportEstablished", "(", "TransportCandidate", "local", ",", "TransportCandidate", "remote", ")", "throws", "NotConnectedException", ",", "InterruptedException", "{", "List", "<", "JingleListener", ">", "listeners", "=", "getListenersList", "...
Trigger a Transport session established event. @param local TransportCandidate that has been agreed. @param remote TransportCandidate that has been agreed. @throws NotConnectedException @throws InterruptedException
[ "Trigger", "a", "Transport", "session", "established", "event", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/nat/TransportNegotiator.java#L799-L809
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/lib/CombineFileInputFormat.java
CombineFileInputFormat.createPool
protected void createPool(JobConf conf, List<PathFilter> filters) { pools.add(new MultiPathFilter(filters)); }
java
protected void createPool(JobConf conf, List<PathFilter> filters) { pools.add(new MultiPathFilter(filters)); }
[ "protected", "void", "createPool", "(", "JobConf", "conf", ",", "List", "<", "PathFilter", ">", "filters", ")", "{", "pools", ".", "add", "(", "new", "MultiPathFilter", "(", "filters", ")", ")", ";", "}" ]
Create a new pool and add the filters to it. A split cannot have files from different pools.
[ "Create", "a", "new", "pool", "and", "add", "the", "filters", "to", "it", ".", "A", "split", "cannot", "have", "files", "from", "different", "pools", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/CombineFileInputFormat.java#L269-L271
hageldave/ImagingKit
ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorPixel.java
ColorPixel.getGrey
public double getGrey(final double redWeight, final double greenWeight, final double blueWeight){ return ColorPixel.getGrey(r_asDouble(),g_asDouble(),b_asDouble(), redWeight, greenWeight, blueWeight); }
java
public double getGrey(final double redWeight, final double greenWeight, final double blueWeight){ return ColorPixel.getGrey(r_asDouble(),g_asDouble(),b_asDouble(), redWeight, greenWeight, blueWeight); }
[ "public", "double", "getGrey", "(", "final", "double", "redWeight", ",", "final", "double", "greenWeight", ",", "final", "double", "blueWeight", ")", "{", "return", "ColorPixel", ".", "getGrey", "(", "r_asDouble", "(", ")", ",", "g_asDouble", "(", ")", ",", ...
Calculates the grey value of this pixel using specified weights. @param redWeight weight for red channel @param greenWeight weight for green channel @param blueWeight weight for blue channel @return grey value of pixel for specified weights @throws ArrayIndexOutOfBoundsException if this Pixel's index is not in range of the ColorImg's data array. @see #getLuminance() @see #getGrey(double r, double g, double b, double rW, double gW, double bW)
[ "Calculates", "the", "grey", "value", "of", "this", "pixel", "using", "specified", "weights", "." ]
train
https://github.com/hageldave/ImagingKit/blob/3837c7d550a12cf4dc5718b644ced94b97f52668/ImagingKit_Core/src/main/java/hageldave/imagingkit/core/scientific/ColorPixel.java#L250-L252
Wadpam/guja
guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java
GeneratedDUserDaoImpl.queryByZipCode
public Iterable<DUser> queryByZipCode(java.lang.String zipCode) { return queryByField(null, DUserMapper.Field.ZIPCODE.getFieldName(), zipCode); }
java
public Iterable<DUser> queryByZipCode(java.lang.String zipCode) { return queryByField(null, DUserMapper.Field.ZIPCODE.getFieldName(), zipCode); }
[ "public", "Iterable", "<", "DUser", ">", "queryByZipCode", "(", "java", ".", "lang", ".", "String", "zipCode", ")", "{", "return", "queryByField", "(", "null", ",", "DUserMapper", ".", "Field", ".", "ZIPCODE", ".", "getFieldName", "(", ")", ",", "zipCode",...
query-by method for field zipCode @param zipCode the specified attribute @return an Iterable of DUsers for the specified zipCode
[ "query", "-", "by", "method", "for", "field", "zipCode" ]
train
https://github.com/Wadpam/guja/blob/eb8ba8e6794a96ea0dd9744cada4f9ad9618f114/guja-core/src/main/java/com/wadpam/guja/oauth2/dao/GeneratedDUserDaoImpl.java#L286-L288
michael-rapp/AndroidMaterialValidation
library/src/main/java/de/mrapp/android/validation/Validators.java
Validators.notNull
public static Validator<Object> notNull(@NonNull final Context context) { return new NotNullValidator(context, R.string.default_error_message); }
java
public static Validator<Object> notNull(@NonNull final Context context) { return new NotNullValidator(context, R.string.default_error_message); }
[ "public", "static", "Validator", "<", "Object", ">", "notNull", "(", "@", "NonNull", "final", "Context", "context", ")", "{", "return", "new", "NotNullValidator", "(", "context", ",", "R", ".", "string", ".", "default_error_message", ")", ";", "}" ]
Creates and returns a validator, which allows to ensure, that values are not null. @param context The context, which should be used to retrieve the error message, as an instance of the class {@link Context}. The context may not be null @return The validator, which has been created, as an instance of the type {@link Validator}
[ "Creates", "and", "returns", "a", "validator", "which", "allows", "to", "ensure", "that", "values", "are", "not", "null", "." ]
train
https://github.com/michael-rapp/AndroidMaterialValidation/blob/ac8693baeac7abddf2e38a47da4c1849d4661a8b/library/src/main/java/de/mrapp/android/validation/Validators.java#L286-L288
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.intersectLineSegmentAar
public static int intersectLineSegmentAar(Vector2fc p0, Vector2fc p1, Vector2fc min, Vector2fc max, Vector2f result) { return intersectLineSegmentAar(p0.x(), p0.y(), p1.x(), p1.y(), min.x(), min.y(), max.x(), max.y(), result); }
java
public static int intersectLineSegmentAar(Vector2fc p0, Vector2fc p1, Vector2fc min, Vector2fc max, Vector2f result) { return intersectLineSegmentAar(p0.x(), p0.y(), p1.x(), p1.y(), min.x(), min.y(), max.x(), max.y(), result); }
[ "public", "static", "int", "intersectLineSegmentAar", "(", "Vector2fc", "p0", ",", "Vector2fc", "p1", ",", "Vector2fc", "min", ",", "Vector2fc", "max", ",", "Vector2f", "result", ")", "{", "return", "intersectLineSegmentAar", "(", "p0", ".", "x", "(", ")", "...
Determine whether the undirected line segment with the end points <code>p0</code> and <code>p1</code> intersects the axis-aligned rectangle given as its minimum corner <code>min</code> and maximum corner <code>max</code>, and store the values of the parameter <i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection into <code>result</code>. <p> This method also detects an intersection of a line segment whose either end point lies inside the axis-aligned rectangle. <p> Reference: <a href="https://dl.acm.org/citation.cfm?id=1198748">An Efficient and Robust Ray–Box Intersection</a> #see {@link #intersectLineSegmentAar(float, float, float, float, float, float, float, float, Vector2f)} @param p0 the line segment's first end point @param p1 the line segment's second end point @param min the minimum corner of the axis-aligned rectangle @param max the maximum corner of the axis-aligned rectangle @param result a vector which will hold the values of the parameter <i>t</i> in the ray equation <i>p(t) = p0 + t * (p1 - p0)</i> of the near and far point of intersection @return {@link #INSIDE} if the line segment lies completely inside of the axis-aligned rectangle; or {@link #OUTSIDE} if the line segment lies completely outside of the axis-aligned rectangle; or {@link #ONE_INTERSECTION} if one of the end points of the line segment lies inside of the axis-aligned rectangle; or {@link #TWO_INTERSECTION} if the line segment intersects two edges of the axis-aligned rectangle
[ "Determine", "whether", "the", "undirected", "line", "segment", "with", "the", "end", "points", "<code", ">", "p0<", "/", "code", ">", "and", "<code", ">", "p1<", "/", "code", ">", "intersects", "the", "axis", "-", "aligned", "rectangle", "given", "as", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L4551-L4553
HeidelTime/heideltime
src/de/unihd/dbs/uima/annotator/heideltime/utilities/Logger.java
Logger.printDetail
public static void printDetail(Class<?> c, String msg) { if(Logger.printDetails) { String preamble; if(c != null) preamble = "["+c.getSimpleName()+"]"; else preamble = ""; synchronized(System.err) { System.err.println(preamble+" "+msg); } } }
java
public static void printDetail(Class<?> c, String msg) { if(Logger.printDetails) { String preamble; if(c != null) preamble = "["+c.getSimpleName()+"]"; else preamble = ""; synchronized(System.err) { System.err.println(preamble+" "+msg); } } }
[ "public", "static", "void", "printDetail", "(", "Class", "<", "?", ">", "c", ",", "String", "msg", ")", "{", "if", "(", "Logger", ".", "printDetails", ")", "{", "String", "preamble", ";", "if", "(", "c", "!=", "null", ")", "preamble", "=", "\"[\"", ...
print DEBUG level information with package name @param component Component from which the message originates @param msg DEBUG-level message
[ "print", "DEBUG", "level", "information", "with", "package", "name" ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/de/unihd/dbs/uima/annotator/heideltime/utilities/Logger.java#L27-L39
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.kindIs
public static <T extends Tree> Matcher<T> kindIs(final Kind kind) { return new Matcher<T>() { @Override public boolean matches(T tree, VisitorState state) { return tree.getKind() == kind; } }; }
java
public static <T extends Tree> Matcher<T> kindIs(final Kind kind) { return new Matcher<T>() { @Override public boolean matches(T tree, VisitorState state) { return tree.getKind() == kind; } }; }
[ "public", "static", "<", "T", "extends", "Tree", ">", "Matcher", "<", "T", ">", "kindIs", "(", "final", "Kind", "kind", ")", "{", "return", "new", "Matcher", "<", "T", ">", "(", ")", "{", "@", "Override", "public", "boolean", "matches", "(", "T", "...
Matches an AST node of a given kind, for example, an Annotation or a switch block.
[ "Matches", "an", "AST", "node", "of", "a", "given", "kind", "for", "example", "an", "Annotation", "or", "a", "switch", "block", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L181-L188
mozilla/rhino
src/org/mozilla/classfile/ClassFileWriter.java
ClassFileWriter.startMethod
public void startMethod(String methodName, String type, short flags) { short methodNameIndex = itsConstantPool.addUtf8(methodName); short typeIndex = itsConstantPool.addUtf8(type); itsCurrentMethod = new ClassFileMethod(methodName, methodNameIndex, type, typeIndex, flags); itsJumpFroms = new UintMap(); itsMethods.add(itsCurrentMethod); addSuperBlockStart(0); }
java
public void startMethod(String methodName, String type, short flags) { short methodNameIndex = itsConstantPool.addUtf8(methodName); short typeIndex = itsConstantPool.addUtf8(type); itsCurrentMethod = new ClassFileMethod(methodName, methodNameIndex, type, typeIndex, flags); itsJumpFroms = new UintMap(); itsMethods.add(itsCurrentMethod); addSuperBlockStart(0); }
[ "public", "void", "startMethod", "(", "String", "methodName", ",", "String", "type", ",", "short", "flags", ")", "{", "short", "methodNameIndex", "=", "itsConstantPool", ".", "addUtf8", "(", "methodName", ")", ";", "short", "typeIndex", "=", "itsConstantPool", ...
Add a method and begin adding code. This method must be called before other methods for adding code, exception tables, etc. can be invoked. @param methodName the name of the method @param type a string representing the type @param flags the attributes of the field, such as ACC_PUBLIC, etc. bitwise or'd together
[ "Add", "a", "method", "and", "begin", "adding", "code", "." ]
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/classfile/ClassFileWriter.java#L234-L242
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java
CassandraSchemaManager.isColumnPresent
private boolean isColumnPresent(ColumnInfo columnInfo, ColumnDef columnDef, boolean isCql3Enabled) throws Exception { return (new String(columnDef.getName(), Constants.ENCODING).equals(columnInfo.getColumnName())); }
java
private boolean isColumnPresent(ColumnInfo columnInfo, ColumnDef columnDef, boolean isCql3Enabled) throws Exception { return (new String(columnDef.getName(), Constants.ENCODING).equals(columnInfo.getColumnName())); }
[ "private", "boolean", "isColumnPresent", "(", "ColumnInfo", "columnInfo", ",", "ColumnDef", "columnDef", ",", "boolean", "isCql3Enabled", ")", "throws", "Exception", "{", "return", "(", "new", "String", "(", "columnDef", ".", "getName", "(", ")", ",", "Constants...
isInedexesPresent method return whether indexes present or not on particular column. @param columnInfo the column info @param columnDef the column def @param isCql3Enabled the is cql3 enabled @return true, if is indexes present @throws Exception the exception
[ "isInedexesPresent", "method", "return", "whether", "indexes", "present", "or", "not", "on", "particular", "column", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L2068-L2071
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
FlowControllerFactory.createPageFlow
public PageFlowController createPageFlow( RequestContext context, String pageFlowClassName ) throws ClassNotFoundException, InstantiationException, IllegalAccessException { Class pageFlowClass = getFlowControllerClass( pageFlowClassName ); return createPageFlow( context, pageFlowClass ); }
java
public PageFlowController createPageFlow( RequestContext context, String pageFlowClassName ) throws ClassNotFoundException, InstantiationException, IllegalAccessException { Class pageFlowClass = getFlowControllerClass( pageFlowClassName ); return createPageFlow( context, pageFlowClass ); }
[ "public", "PageFlowController", "createPageFlow", "(", "RequestContext", "context", ",", "String", "pageFlowClassName", ")", "throws", "ClassNotFoundException", ",", "InstantiationException", ",", "IllegalAccessException", "{", "Class", "pageFlowClass", "=", "getFlowControlle...
Create a {@link PageFlowController} of the given type. The {@link PageFlowController} stack used for nesting will be cleared or pushed, and the new instance will be stored as the current {@link PageFlowController}. @param context a {@link RequestContext} object which contains the current request and response. @param pageFlowClassName the type name of the desired page flow. @return the newly-created PageFlowController, or <code>null</code> if none was found.
[ "Create", "a", "{", "@link", "PageFlowController", "}", "of", "the", "given", "type", ".", "The", "{", "@link", "PageFlowController", "}", "stack", "used", "for", "nesting", "will", "be", "cleared", "or", "pushed", "and", "the", "new", "instance", "will", ...
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowControllerFactory.java#L186-L191
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java
DebugUtil.buildTimeDifference
public static String buildTimeDifference(final long pStartTime, final long pEndTime) { //return pEndTime - pStartTime; StringBuilder retVal = new StringBuilder(); // The time difference in milliseconds long timeDifference = pEndTime - pStartTime; if (timeDifference < 1000) { retVal.append(timeDifference); retVal.append(" ms"); } else { long seconds = timeDifference / 1000; timeDifference = timeDifference % 1000; retVal.append(seconds); retVal.append("s "); retVal.append(timeDifference); retVal.append("ms"); } //return retVal.toString() + " (original timeDifference: " + new String(new Long(pEndTime - pStartTime).toString()) + ")"; return retVal.toString(); }
java
public static String buildTimeDifference(final long pStartTime, final long pEndTime) { //return pEndTime - pStartTime; StringBuilder retVal = new StringBuilder(); // The time difference in milliseconds long timeDifference = pEndTime - pStartTime; if (timeDifference < 1000) { retVal.append(timeDifference); retVal.append(" ms"); } else { long seconds = timeDifference / 1000; timeDifference = timeDifference % 1000; retVal.append(seconds); retVal.append("s "); retVal.append(timeDifference); retVal.append("ms"); } //return retVal.toString() + " (original timeDifference: " + new String(new Long(pEndTime - pStartTime).toString()) + ")"; return retVal.toString(); }
[ "public", "static", "String", "buildTimeDifference", "(", "final", "long", "pStartTime", ",", "final", "long", "pEndTime", ")", "{", "//return pEndTime - pStartTime;\r", "StringBuilder", "retVal", "=", "new", "StringBuilder", "(", ")", ";", "// The time difference in mi...
Builds the time difference between two millisecond representations. <p> This method is to be used with small time intervals between 0 ms up to a couple of minutes. <p> @param pStartTime the start time. @param pEndTime the end time. @return the time difference in milliseconds.
[ "Builds", "the", "time", "difference", "between", "two", "millisecond", "representations", ".", "<p", ">", "This", "method", "is", "to", "be", "used", "with", "small", "time", "intervals", "between", "0", "ms", "up", "to", "a", "couple", "of", "minutes", "...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/util/DebugUtil.java#L848-L871
undera/jmeter-plugins
plugins/functions/src/main/java/kg/apc/jmeter/functions/CaseFormat.java
CaseFormat.addVariableValue
private final void addVariableValue(String value, String variableName) { if (StringUtils.isNotEmpty(variableName)) { JMeterVariables vars = getVariables(); if (vars != null) { vars.put(variableName, value); } } }
java
private final void addVariableValue(String value, String variableName) { if (StringUtils.isNotEmpty(variableName)) { JMeterVariables vars = getVariables(); if (vars != null) { vars.put(variableName, value); } } }
[ "private", "final", "void", "addVariableValue", "(", "String", "value", ",", "String", "variableName", ")", "{", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "variableName", ")", ")", "{", "JMeterVariables", "vars", "=", "getVariables", "(", ")", ";", "...
Store value in a variable @param value value of variable to update @param String variable name
[ "Store", "value", "in", "a", "variable" ]
train
https://github.com/undera/jmeter-plugins/blob/416d2a77249ab921c7e4134c3e6a9639901ef7e8/plugins/functions/src/main/java/kg/apc/jmeter/functions/CaseFormat.java#L242-L249
liferay/com-liferay-commerce
commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceCountryUtil.java
CommerceCountryUtil.findByG_N
public static CommerceCountry findByG_N(long groupId, int numericISOCode) throws com.liferay.commerce.exception.NoSuchCountryException { return getPersistence().findByG_N(groupId, numericISOCode); }
java
public static CommerceCountry findByG_N(long groupId, int numericISOCode) throws com.liferay.commerce.exception.NoSuchCountryException { return getPersistence().findByG_N(groupId, numericISOCode); }
[ "public", "static", "CommerceCountry", "findByG_N", "(", "long", "groupId", ",", "int", "numericISOCode", ")", "throws", "com", ".", "liferay", ".", "commerce", ".", "exception", ".", "NoSuchCountryException", "{", "return", "getPersistence", "(", ")", ".", "fin...
Returns the commerce country where groupId = &#63; and numericISOCode = &#63; or throws a {@link NoSuchCountryException} if it could not be found. @param groupId the group ID @param numericISOCode the numeric iso code @return the matching commerce country @throws NoSuchCountryException if a matching commerce country could not be found
[ "Returns", "the", "commerce", "country", "where", "groupId", "=", "&#63", ";", "and", "numericISOCode", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchCountryException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-api/src/main/java/com/liferay/commerce/service/persistence/CommerceCountryUtil.java#L734-L737
google/error-prone
core/src/main/java/com/google/errorprone/bugpatterns/inject/dagger/Util.java
Util.makeConcreteClassAbstract
static SuggestedFix.Builder makeConcreteClassAbstract(ClassTree classTree, VisitorState state) { Set<Modifier> flags = EnumSet.noneOf(Modifier.class); flags.addAll(classTree.getModifiers().getFlags()); boolean wasFinal = flags.remove(FINAL); boolean wasAbstract = !flags.add(ABSTRACT); if (classTree.getKind().equals(INTERFACE) || (!wasFinal && wasAbstract)) { return SuggestedFix.builder(); // no-op } ImmutableList.Builder<Object> modifiers = ImmutableList.builder(); for (AnnotationTree annotation : classTree.getModifiers().getAnnotations()) { modifiers.add(state.getSourceForNode(annotation)); } modifiers.addAll(flags); SuggestedFix.Builder makeAbstract = SuggestedFix.builder(); if (((JCModifiers) classTree.getModifiers()).pos == -1) { makeAbstract.prefixWith(classTree, Joiner.on(' ').join(modifiers.build())); } else { makeAbstract.replace(classTree.getModifiers(), Joiner.on(' ').join(modifiers.build())); } if (wasFinal && HAS_GENERATED_CONSTRUCTOR.matches(classTree, state)) { makeAbstract.merge(addPrivateConstructor(classTree)); } return makeAbstract; }
java
static SuggestedFix.Builder makeConcreteClassAbstract(ClassTree classTree, VisitorState state) { Set<Modifier> flags = EnumSet.noneOf(Modifier.class); flags.addAll(classTree.getModifiers().getFlags()); boolean wasFinal = flags.remove(FINAL); boolean wasAbstract = !flags.add(ABSTRACT); if (classTree.getKind().equals(INTERFACE) || (!wasFinal && wasAbstract)) { return SuggestedFix.builder(); // no-op } ImmutableList.Builder<Object> modifiers = ImmutableList.builder(); for (AnnotationTree annotation : classTree.getModifiers().getAnnotations()) { modifiers.add(state.getSourceForNode(annotation)); } modifiers.addAll(flags); SuggestedFix.Builder makeAbstract = SuggestedFix.builder(); if (((JCModifiers) classTree.getModifiers()).pos == -1) { makeAbstract.prefixWith(classTree, Joiner.on(' ').join(modifiers.build())); } else { makeAbstract.replace(classTree.getModifiers(), Joiner.on(' ').join(modifiers.build())); } if (wasFinal && HAS_GENERATED_CONSTRUCTOR.matches(classTree, state)) { makeAbstract.merge(addPrivateConstructor(classTree)); } return makeAbstract; }
[ "static", "SuggestedFix", ".", "Builder", "makeConcreteClassAbstract", "(", "ClassTree", "classTree", ",", "VisitorState", "state", ")", "{", "Set", "<", "Modifier", ">", "flags", "=", "EnumSet", ".", "noneOf", "(", "Modifier", ".", "class", ")", ";", "flags",...
Returns a fix that changes a concrete class to an abstract class. <ul> <li>Removes {@code final} if it was there. <li>Adds {@code abstract} if it wasn't there. <li>Adds a private empty constructor if the class was {@code final} and had only a default constructor. </ul>
[ "Returns", "a", "fix", "that", "changes", "a", "concrete", "class", "to", "an", "abstract", "class", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/core/src/main/java/com/google/errorprone/bugpatterns/inject/dagger/Util.java#L164-L190
Impetus/Kundera
src/data-as-object/src/main/java/com/impetus/dao/utils/JsonUtil.java
JsonUtil.readJson
public final static <T> T readJson(InputStream jsonStream, Class<T> clazz) { ObjectMapper mapper = new ObjectMapper(); try { if (jsonStream != null) { return mapper.readValue(jsonStream, clazz); } else { LOGGER.error("InputStream is null."); throw new KunderaException("InputStream is null."); } } catch (IOException e) { LOGGER.error("Error while mapping input stream to object. Caused By: ", e); throw new KunderaException("Error while mapping input stream to object. Caused By: ", e); } }
java
public final static <T> T readJson(InputStream jsonStream, Class<T> clazz) { ObjectMapper mapper = new ObjectMapper(); try { if (jsonStream != null) { return mapper.readValue(jsonStream, clazz); } else { LOGGER.error("InputStream is null."); throw new KunderaException("InputStream is null."); } } catch (IOException e) { LOGGER.error("Error while mapping input stream to object. Caused By: ", e); throw new KunderaException("Error while mapping input stream to object. Caused By: ", e); } }
[ "public", "final", "static", "<", "T", ">", "T", "readJson", "(", "InputStream", "jsonStream", ",", "Class", "<", "T", ">", "clazz", ")", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "try", "{", "if", "(", "jsonStream", "!=...
Read json. @param <T> the generic type @param jsonStream the json stream @param clazz the clazz @return the t
[ "Read", "json", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/data-as-object/src/main/java/com/impetus/dao/utils/JsonUtil.java#L81-L102
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPTaxCategoryPersistenceImpl.java
CPTaxCategoryPersistenceImpl.findByGroupId
@Override public List<CPTaxCategory> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
java
@Override public List<CPTaxCategory> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPTaxCategory", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the cp tax categories where groupId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPTaxCategoryModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param groupId the group ID @param start the lower bound of the range of cp tax categories @param end the upper bound of the range of cp tax categories (not inclusive) @return the range of matching cp tax categories
[ "Returns", "a", "range", "of", "all", "the", "cp", "tax", "categories", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPTaxCategoryPersistenceImpl.java#L138-L141
OpenLiberty/open-liberty
dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAPCtxtProcessor.java
JPAPCtxtProcessor.createInjectionBinding
@Override public InjectionBinding<PersistenceContext> createInjectionBinding (PersistenceContext annotation, Class<?> instanceClass, Member member, String jndiName) throws InjectionException { return new JPAPCtxtInjectionBinding(annotation, ivNameSpaceConfig, ivAttributeAccessor); }
java
@Override public InjectionBinding<PersistenceContext> createInjectionBinding (PersistenceContext annotation, Class<?> instanceClass, Member member, String jndiName) throws InjectionException { return new JPAPCtxtInjectionBinding(annotation, ivNameSpaceConfig, ivAttributeAccessor); }
[ "@", "Override", "public", "InjectionBinding", "<", "PersistenceContext", ">", "createInjectionBinding", "(", "PersistenceContext", "annotation", ",", "Class", "<", "?", ">", "instanceClass", ",", "Member", "member", ",", "String", "jndiName", ")", "throws", "Inject...
Returns an annotation specific InjectionBinding associated with the input annotation. <p> Provides a 'factory' to the base InjectionProcessor for creating annotation specific Binding objects. <p> @param annotation the annotation to create a binding for. @param compNSConfig component configuration data. @throws InjectionException when a problem occurs processing the annotation. @see com.ibm.wsspi.injectionengine.InjectionProcessor#createInjectionBinding
[ "Returns", "an", "annotation", "specific", "InjectionBinding", "associated", "with", "the", "input", "annotation", ".", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jpa.container.core/src/com/ibm/ws/jpa/management/JPAPCtxtProcessor.java#L130-L136
FrodeRanders/java-vopn
src/main/java/org/gautelis/vopn/lang/DynamicLoader.java
DynamicLoader.createObject
public C createObject(String className, Class clazz, DynamicInitializer<C> di) throws ClassNotFoundException { C object; try { object = (C) clazz.newInstance(); } catch (InstantiationException ie) { String info = "Could not create " + description + " object: " + className + ". Could not access object constructor: "; info += ie.getMessage(); throw new ClassNotFoundException(info, ie); } catch (IllegalAccessException iae) { String info = "Could not create " + description + " object: " + className + ". Could not instantiate object. Does the object classname refer to an abstract class, " + "an interface or the like?: "; info += iae.getMessage(); throw new ClassNotFoundException(info, iae); } catch (ClassCastException cce) { String info = "Could not create " + description + " object: " + className + ". The specified object classname does not refer to the proper type: "; info += cce.getMessage(); throw new ClassNotFoundException(info, cce); } // Initialize object if (null != di) { di.initialize(object); } return object; }
java
public C createObject(String className, Class clazz, DynamicInitializer<C> di) throws ClassNotFoundException { C object; try { object = (C) clazz.newInstance(); } catch (InstantiationException ie) { String info = "Could not create " + description + " object: " + className + ". Could not access object constructor: "; info += ie.getMessage(); throw new ClassNotFoundException(info, ie); } catch (IllegalAccessException iae) { String info = "Could not create " + description + " object: " + className + ". Could not instantiate object. Does the object classname refer to an abstract class, " + "an interface or the like?: "; info += iae.getMessage(); throw new ClassNotFoundException(info, iae); } catch (ClassCastException cce) { String info = "Could not create " + description + " object: " + className + ". The specified object classname does not refer to the proper type: "; info += cce.getMessage(); throw new ClassNotFoundException(info, cce); } // Initialize object if (null != di) { di.initialize(object); } return object; }
[ "public", "C", "createObject", "(", "String", "className", ",", "Class", "clazz", ",", "DynamicInitializer", "<", "C", ">", "di", ")", "throws", "ClassNotFoundException", "{", "C", "object", ";", "try", "{", "object", "=", "(", "C", ")", "clazz", ".", "n...
Creates an instance from a Class. <p> Supports the use of a dynamic initializer (see {@link org.gautelis.vopn.lang.DynamicInitializer}&lt;C&gt;)
[ "Creates", "an", "instance", "from", "a", "Class", ".", "<p", ">", "Supports", "the", "use", "of", "a", "dynamic", "initializer", "(", "see", "{" ]
train
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/lang/DynamicLoader.java#L290-L321
b3dgs/lionengine
lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java
ToolsAwt.saveImage
public static void saveImage(BufferedImage image, OutputStream output) throws IOException { ImageIO.write(image, "png", output); }
java
public static void saveImage(BufferedImage image, OutputStream output) throws IOException { ImageIO.write(image, "png", output); }
[ "public", "static", "void", "saveImage", "(", "BufferedImage", "image", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "ImageIO", ".", "write", "(", "image", ",", "\"png\"", ",", "output", ")", ";", "}" ]
Save image to output stream. @param image The image to save. @param output The output stream. @throws IOException If error when saving image.
[ "Save", "image", "to", "output", "stream", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java#L147-L150
RoaringBitmap/RoaringBitmap
roaringbitmap/src/main/java/org/roaringbitmap/Util.java
Util.flipBitmapRange
public static void flipBitmapRange(long[] bitmap, int start, int end) { if (start == end) { return; } int firstword = start / 64; int endword = (end - 1) / 64; bitmap[firstword] ^= ~(~0L << start); for (int i = firstword; i < endword; i++) { bitmap[i] = ~bitmap[i]; } bitmap[endword] ^= ~0L >>> -end; }
java
public static void flipBitmapRange(long[] bitmap, int start, int end) { if (start == end) { return; } int firstword = start / 64; int endword = (end - 1) / 64; bitmap[firstword] ^= ~(~0L << start); for (int i = firstword; i < endword; i++) { bitmap[i] = ~bitmap[i]; } bitmap[endword] ^= ~0L >>> -end; }
[ "public", "static", "void", "flipBitmapRange", "(", "long", "[", "]", "bitmap", ",", "int", "start", ",", "int", "end", ")", "{", "if", "(", "start", "==", "end", ")", "{", "return", ";", "}", "int", "firstword", "=", "start", "/", "64", ";", "int"...
flip bits at start, start+1,..., end-1 @param bitmap array of words to be modified @param start first index to be modified (inclusive) @param end last index to be modified (exclusive)
[ "flip", "bits", "at", "start", "start", "+", "1", "...", "end", "-", "1" ]
train
https://github.com/RoaringBitmap/RoaringBitmap/blob/b26fd0a1330fd4d2877f4d74feb69ceb812e9efa/roaringbitmap/src/main/java/org/roaringbitmap/Util.java#L288-L299
alkacon/opencms-core
src/org/opencms/search/documents/CmsDocumentContainerPage.java
CmsDocumentContainerPage.createDocument
@Override public I_CmsSearchDocument createDocument(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsException { // extract the content from the resource I_CmsExtractionResult content = null; if (index.isExtractingContent()) { // do full text content extraction only if required try { content = extractContent(cms, resource, index); } catch (Exception e) { // text extraction failed for document - continue indexing meta information only LOG.error(Messages.get().getBundle().key(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()), e); } } // create the Lucene document according to the index field configuration return index.getFieldConfiguration().createDocument(cms, resource, index, content); }
java
@Override public I_CmsSearchDocument createDocument(CmsObject cms, CmsResource resource, I_CmsSearchIndex index) throws CmsException { // extract the content from the resource I_CmsExtractionResult content = null; if (index.isExtractingContent()) { // do full text content extraction only if required try { content = extractContent(cms, resource, index); } catch (Exception e) { // text extraction failed for document - continue indexing meta information only LOG.error(Messages.get().getBundle().key(Messages.ERR_TEXT_EXTRACTION_1, resource.getRootPath()), e); } } // create the Lucene document according to the index field configuration return index.getFieldConfiguration().createDocument(cms, resource, index, content); }
[ "@", "Override", "public", "I_CmsSearchDocument", "createDocument", "(", "CmsObject", "cms", ",", "CmsResource", "resource", ",", "I_CmsSearchIndex", "index", ")", "throws", "CmsException", "{", "// extract the content from the resource", "I_CmsExtractionResult", "content", ...
Generates a new lucene document instance from contents of the given resource for the provided index.<p> For container pages, we must not cache based on the container page content age, since the content of the included elements may change any time.
[ "Generates", "a", "new", "lucene", "document", "instance", "from", "contents", "of", "the", "given", "resource", "for", "the", "provided", "index", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/documents/CmsDocumentContainerPage.java#L85-L105
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/math/ArrayMath.java
ArrayMath.sigLevelByApproxRand
public static double sigLevelByApproxRand(double[] A, double[] B, int iterations) { if (A.length == 0) throw new IllegalArgumentException("Input arrays must not be empty!"); if (A.length != B.length) throw new IllegalArgumentException("Input arrays must have equal length!"); if (iterations <= 0) throw new IllegalArgumentException("Number of iterations must be positive!"); double testStatistic = absDiffOfMeans(A, B, false); // not randomized int successes = 0; for (int i = 0; i < iterations; i++) { double t = absDiffOfMeans(A, B, true); // randomized if (t >= testStatistic) successes++; } return (double) (successes + 1) / (double) (iterations + 1); }
java
public static double sigLevelByApproxRand(double[] A, double[] B, int iterations) { if (A.length == 0) throw new IllegalArgumentException("Input arrays must not be empty!"); if (A.length != B.length) throw new IllegalArgumentException("Input arrays must have equal length!"); if (iterations <= 0) throw new IllegalArgumentException("Number of iterations must be positive!"); double testStatistic = absDiffOfMeans(A, B, false); // not randomized int successes = 0; for (int i = 0; i < iterations; i++) { double t = absDiffOfMeans(A, B, true); // randomized if (t >= testStatistic) successes++; } return (double) (successes + 1) / (double) (iterations + 1); }
[ "public", "static", "double", "sigLevelByApproxRand", "(", "double", "[", "]", "A", ",", "double", "[", "]", "B", ",", "int", "iterations", ")", "{", "if", "(", "A", ".", "length", "==", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Input...
Takes a pair of arrays, A and B, which represent corresponding outcomes of a pair of random variables: say, results for two different classifiers on a sequence of inputs. Returns the estimated probability that the difference between the means of A and B is not significant, that is, the significance level. This is computed by "approximate randomization". The test statistic is the absolute difference between the means of the two arrays. A randomized test statistic is computed the same way after initially randomizing the arrays by swapping each pair of elements with 50% probability. For the given number of iterations, we generate a randomized test statistic and compare it to the actual test statistic. The return value is the proportion of iterations in which a randomized test statistic was found to exceed the actual test statistic. @param A Outcome of one r.v. @param B Outcome of another r.v. @return Significance level by randomization
[ "Takes", "a", "pair", "of", "arrays", "A", "and", "B", "which", "represent", "corresponding", "outcomes", "of", "a", "pair", "of", "random", "variables", ":", "say", "results", "for", "two", "different", "classifiers", "on", "a", "sequence", "of", "inputs", ...
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/math/ArrayMath.java#L1503-L1517
BioPAX/Paxtools
paxtools-core/src/main/java/org/biopax/paxtools/controller/ObjectPropertyEditor.java
ObjectPropertyEditor.addRangeRestriction
public void addRangeRestriction(Class<? extends BioPAXElement> domain, Set<Class<? extends BioPAXElement>> ranges) { this.restrictedRanges.put(domain, ranges); }
java
public void addRangeRestriction(Class<? extends BioPAXElement> domain, Set<Class<? extends BioPAXElement>> ranges) { this.restrictedRanges.put(domain, ranges); }
[ "public", "void", "addRangeRestriction", "(", "Class", "<", "?", "extends", "BioPAXElement", ">", "domain", ",", "Set", "<", "Class", "<", "?", "extends", "BioPAXElement", ">", ">", "ranges", ")", "{", "this", ".", "restrictedRanges", ".", "put", "(", "dom...
This method adds a range restriction to the property editor. e.g. All entityReferences of Proteins should be ProteinReferences. Note: All restrictions specified in the BioPAX specification is automatically created by the {@link EditorMap} during initialization. Use this method if you need to add restrictions that are not specified in the model. @param domain subdomain of the property to be restricted @param ranges valid ranges for this subdomain.
[ "This", "method", "adds", "a", "range", "restriction", "to", "the", "property", "editor", ".", "e", ".", "g", ".", "All", "entityReferences", "of", "Proteins", "should", "be", "ProteinReferences", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-core/src/main/java/org/biopax/paxtools/controller/ObjectPropertyEditor.java#L141-L144
forge/javaee-descriptors
impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/beans10/BeansDescriptorImpl.java
BeansDescriptorImpl.addNamespace
public BeansDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
java
public BeansDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
[ "public", "BeansDescriptor", "addNamespace", "(", "String", "name", ",", "String", "value", ")", "{", "model", ".", "attribute", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a new namespace @return the current instance of <code>BeansDescriptor</code>
[ "Adds", "a", "new", "namespace" ]
train
https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/beans10/BeansDescriptorImpl.java#L85-L89
VoltDB/voltdb
src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java
JDBC4CallableStatement.setDate
@Override public void setDate(String parameterName, Date x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
java
@Override public void setDate(String parameterName, Date x) throws SQLException { checkClosed(); throw SQLError.noSupport(); }
[ "@", "Override", "public", "void", "setDate", "(", "String", "parameterName", ",", "Date", "x", ")", "throws", "SQLException", "{", "checkClosed", "(", ")", ";", "throw", "SQLError", ".", "noSupport", "(", ")", ";", "}" ]
Sets the designated parameter to the given java.sql.Date value using the default time zone of the virtual machine that is running the application.
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "java", ".", "sql", ".", "Date", "value", "using", "the", "default", "time", "zone", "of", "the", "virtual", "machine", "that", "is", "running", "the", "application", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/jdbc/JDBC4CallableStatement.java#L719-L724
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/util/StringUtil.java
StringUtil.fromBytes
public static String fromBytes(byte[] bytes) { EnsureUtil.ensureActiveCommandContext("StringUtil.fromBytes"); ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); return fromBytes(bytes, processEngineConfiguration.getProcessEngine()); }
java
public static String fromBytes(byte[] bytes) { EnsureUtil.ensureActiveCommandContext("StringUtil.fromBytes"); ProcessEngineConfigurationImpl processEngineConfiguration = Context.getProcessEngineConfiguration(); return fromBytes(bytes, processEngineConfiguration.getProcessEngine()); }
[ "public", "static", "String", "fromBytes", "(", "byte", "[", "]", "bytes", ")", "{", "EnsureUtil", ".", "ensureActiveCommandContext", "(", "\"StringUtil.fromBytes\"", ")", ";", "ProcessEngineConfigurationImpl", "processEngineConfiguration", "=", "Context", ".", "getProc...
converts a byte array into a string using the current process engines default charset as returned by {@link ProcessEngineConfigurationImpl#getDefaultCharset()} @param bytes the byte array @return a string representing the bytes
[ "converts", "a", "byte", "array", "into", "a", "string", "using", "the", "current", "process", "engines", "default", "charset", "as", "returned", "by", "{", "@link", "ProcessEngineConfigurationImpl#getDefaultCharset", "()", "}" ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/util/StringUtil.java#L109-L113
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java
FsCrawlerUtil.readDefaultJsonVersionedFile
public static String readDefaultJsonVersionedFile(Path config, String version, String type) throws IOException { Path defaultConfigDir = config.resolve("_default"); try { return readJsonVersionedFile(defaultConfigDir, version, type); } catch (NoSuchFileException e) { throw new IllegalArgumentException("Mapping file " + type + ".json does not exist for elasticsearch version " + version + " in [" + defaultConfigDir + "] dir"); } }
java
public static String readDefaultJsonVersionedFile(Path config, String version, String type) throws IOException { Path defaultConfigDir = config.resolve("_default"); try { return readJsonVersionedFile(defaultConfigDir, version, type); } catch (NoSuchFileException e) { throw new IllegalArgumentException("Mapping file " + type + ".json does not exist for elasticsearch version " + version + " in [" + defaultConfigDir + "] dir"); } }
[ "public", "static", "String", "readDefaultJsonVersionedFile", "(", "Path", "config", ",", "String", "version", ",", "String", "type", ")", "throws", "IOException", "{", "Path", "defaultConfigDir", "=", "config", ".", "resolve", "(", "\"_default\"", ")", ";", "tr...
Reads a mapping from config/_default/version/type.json file @param config Root dir where we can find the configuration (default to ~/.fscrawler) @param version Elasticsearch major version number (only major digit is kept so for 2.3.4 it will be 2) @param type The expected type (will be expanded to type.json) @return the mapping @throws IOException If the mapping can not be read
[ "Reads", "a", "mapping", "from", "config", "/", "_default", "/", "version", "/", "type", ".", "json", "file" ]
train
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/FsCrawlerUtil.java#L81-L89
nextreports/nextreports-engine
src/ro/nextreports/engine/util/ParameterUtil.java
ParameterUtil.allParametersAreHidden
public static boolean allParametersAreHidden(Map<String, QueryParameter> map) { for (QueryParameter qp : map.values()) { if (!qp.isHidden()) { return false; } } return true; }
java
public static boolean allParametersAreHidden(Map<String, QueryParameter> map) { for (QueryParameter qp : map.values()) { if (!qp.isHidden()) { return false; } } return true; }
[ "public", "static", "boolean", "allParametersAreHidden", "(", "Map", "<", "String", ",", "QueryParameter", ">", "map", ")", "{", "for", "(", "QueryParameter", "qp", ":", "map", ".", "values", "(", ")", ")", "{", "if", "(", "!", "qp", ".", "isHidden", "...
See if all parameters are hidden @param map map of parameters @return true if all parameters are hidden
[ "See", "if", "all", "parameters", "are", "hidden" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ParameterUtil.java#L801-L808
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java
PathNormalizer.getRelativeWebPath
public static final String getRelativeWebPath(final String oldPath, final String newPath) { if (StringUtils.isEmpty(oldPath) || StringUtils.isEmpty(newPath)) { return ""; } String resultPath = buildRelativePath(newPath, oldPath, '/'); if (newPath.endsWith("/") && !resultPath.endsWith("/")) { return resultPath + "/"; } return resultPath; }
java
public static final String getRelativeWebPath(final String oldPath, final String newPath) { if (StringUtils.isEmpty(oldPath) || StringUtils.isEmpty(newPath)) { return ""; } String resultPath = buildRelativePath(newPath, oldPath, '/'); if (newPath.endsWith("/") && !resultPath.endsWith("/")) { return resultPath + "/"; } return resultPath; }
[ "public", "static", "final", "String", "getRelativeWebPath", "(", "final", "String", "oldPath", ",", "final", "String", "newPath", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "oldPath", ")", "||", "StringUtils", ".", "isEmpty", "(", "newPath", "...
This method can calculate the relative path between two pathes on a web site. <br/> <pre> PathUtils.getRelativeWebPath( null, null ) = "" PathUtils.getRelativeWebPath( null, "http://plexus.codehaus.org/" ) = "" PathUtils.getRelativeWebPath( "http://plexus.codehaus.org/", null ) = "" PathUtils.getRelativeWebPath( "http://plexus.codehaus.org/", "http://plexus.codehaus.org/plexus-utils/index.html" ) = "plexus-utils/index.html" PathUtils.getRelativeWebPath( "http://plexus.codehaus.org/plexus-utils/index.html", "http://plexus.codehaus.org/" = "../../" </pre> @param oldPath @param newPath @return a relative web path from <code>oldPath</code>.
[ "This", "method", "can", "calculate", "the", "relative", "path", "between", "two", "pathes", "on", "a", "web", "site", ".", "<br", "/", ">" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/PathNormalizer.java#L761-L773
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java
DefaultApplicationObjectConfigurer.configureCommandIcons
protected void configureCommandIcons(CommandIconConfigurable configurable, String objectName) { Assert.notNull(configurable, "configurable"); Assert.notNull(objectName, "objectName"); setIconInfo(configurable, objectName, false); setIconInfo(configurable, objectName, true); }
java
protected void configureCommandIcons(CommandIconConfigurable configurable, String objectName) { Assert.notNull(configurable, "configurable"); Assert.notNull(objectName, "objectName"); setIconInfo(configurable, objectName, false); setIconInfo(configurable, objectName, true); }
[ "protected", "void", "configureCommandIcons", "(", "CommandIconConfigurable", "configurable", ",", "String", "objectName", ")", "{", "Assert", ".", "notNull", "(", "configurable", ",", "\"configurable\"", ")", ";", "Assert", ".", "notNull", "(", "objectName", ",", ...
Sets the icons of the given object. <p> The icons are loaded from this instance's {@link IconSource}. using a key in the format </p> <pre> &lt;objectName&gt;.someIconType </pre> <p> The keys used to retrieve large icons from the icon source are created by concatenating the given {@code objectName} with a dot (.), the text 'large' and then an icon type like so: </p> <pre> &lt;myObjectName&gt;.large.someIconType </pre> <p> If the icon source cannot find an icon under that key, the object's icon will be set to null. </p> <p> If the {@code loadOptionalIcons} flag is set to true (it is by default) all the following icon types will be used. If the flag is false, only the first will be used: </p> <ul> <li>{@value #ICON_KEY}</li> <li>{@value #SELECTED_ICON_KEY}</li> <li>{@value #ROLLOVER_ICON_KEY}</li> <li>{@value #DISABLED_ICON_KEY}</li> <li>{@value #PRESSED_ICON_KEY}</li> </ul> @param configurable The object to be configured. Must not be null. @param objectName The name of the configurable object, unique within the application. Must not be null. @throws IllegalArgumentException if either argument is null.
[ "Sets", "the", "icons", "of", "the", "given", "object", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/application/config/support/DefaultApplicationObjectConfigurer.java#L583-L588
VoltDB/voltdb
src/frontend/org/voltdb/utils/CatalogUtil.java
CatalogUtil.getTableObjectNameFromId
public static Table getTableObjectNameFromId(Database catalog, int tableId) { for (Table table: catalog.getTables()) { if (table.getRelativeIndex() == tableId) { return table; } } return null; }
java
public static Table getTableObjectNameFromId(Database catalog, int tableId) { for (Table table: catalog.getTables()) { if (table.getRelativeIndex() == tableId) { return table; } } return null; }
[ "public", "static", "Table", "getTableObjectNameFromId", "(", "Database", "catalog", ",", "int", "tableId", ")", "{", "for", "(", "Table", "table", ":", "catalog", ".", "getTables", "(", ")", ")", "{", "if", "(", "table", ".", "getRelativeIndex", "(", ")",...
Iterate through all the tables in the catalog, find a table with an id that matches the given table id, and return its name. @param catalog Catalog database @param tableId table id @return table name associated with the given table id (null if no association is found)
[ "Iterate", "through", "all", "the", "tables", "in", "the", "catalog", "find", "a", "table", "with", "an", "id", "that", "matches", "the", "given", "table", "id", "and", "return", "its", "name", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/utils/CatalogUtil.java#L2794-L2801
Harium/keel
src/main/java/com/harium/keel/catalano/math/distance/Distance.java
Distance.BrayCurtis
public static double BrayCurtis(double[] p, double[] q) { double sumP, sumN; sumP = sumN = 0; for (int i = 0; i < p.length; i++) { sumN += Math.abs(p[i] - q[i]); sumP += Math.abs(p[i] + q[i]); } return sumN / sumP; }
java
public static double BrayCurtis(double[] p, double[] q) { double sumP, sumN; sumP = sumN = 0; for (int i = 0; i < p.length; i++) { sumN += Math.abs(p[i] - q[i]); sumP += Math.abs(p[i] + q[i]); } return sumN / sumP; }
[ "public", "static", "double", "BrayCurtis", "(", "double", "[", "]", "p", ",", "double", "[", "]", "q", ")", "{", "double", "sumP", ",", "sumN", ";", "sumP", "=", "sumN", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "p", "....
Gets the Bray Curtis distance between two points. @param p A point in space. @param q A point in space. @return The Bray Curtis distance between x and y.
[ "Gets", "the", "Bray", "Curtis", "distance", "between", "two", "points", "." ]
train
https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L86-L96
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/local/LocalExtensionStorage.java
LocalExtensionStorage.getFilePath
private String getFilePath(ExtensionId id, String fileExtension) { String encodedId = PathUtils.encode(id.getId()); String encodedVersion = PathUtils.encode(id.getVersion().toString()); String encodedType = PathUtils.encode(fileExtension); return encodedId + File.separator + encodedVersion + File.separator + encodedId + '-' + encodedVersion + '.' + encodedType; }
java
private String getFilePath(ExtensionId id, String fileExtension) { String encodedId = PathUtils.encode(id.getId()); String encodedVersion = PathUtils.encode(id.getVersion().toString()); String encodedType = PathUtils.encode(fileExtension); return encodedId + File.separator + encodedVersion + File.separator + encodedId + '-' + encodedVersion + '.' + encodedType; }
[ "private", "String", "getFilePath", "(", "ExtensionId", "id", ",", "String", "fileExtension", ")", "{", "String", "encodedId", "=", "PathUtils", ".", "encode", "(", "id", ".", "getId", "(", ")", ")", ";", "String", "encodedVersion", "=", "PathUtils", ".", ...
Get file path in the local extension repository. @param id the extension id @param fileExtension the file extension @return the encoded file path
[ "Get", "file", "path", "in", "the", "local", "extension", "repository", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-extension/xwiki-commons-extension-api/src/main/java/org/xwiki/extension/repository/internal/local/LocalExtensionStorage.java#L266-L274
fuinorg/srcgen4javassist
src/main/java/org/fuin/srcgen4javassist/SgUtils.java
SgUtils.addToStringMethod
public static void addToStringMethod(final SgClassPool pool, final SgClass clasz, final List<SgField> fields) { final SgMethod m = new SgMethod(clasz, "public", SgClass.create(pool, String.class), "toString"); m.addBodyLine("return getClass().getSimpleName() + \"{\""); for (int i = 0; i < fields.size(); i++) { final SgField field = fields.get(i); final String nameValue = " + \"" + field.getName() + "=\" + " + field.getName(); if (i < fields.size() - 1) { m.addBodyLine(nameValue + " + \", \""); } else { m.addBodyLine(nameValue); } } m.addBodyLine(" + \"}\";"); clasz.addMethod(m); }
java
public static void addToStringMethod(final SgClassPool pool, final SgClass clasz, final List<SgField> fields) { final SgMethod m = new SgMethod(clasz, "public", SgClass.create(pool, String.class), "toString"); m.addBodyLine("return getClass().getSimpleName() + \"{\""); for (int i = 0; i < fields.size(); i++) { final SgField field = fields.get(i); final String nameValue = " + \"" + field.getName() + "=\" + " + field.getName(); if (i < fields.size() - 1) { m.addBodyLine(nameValue + " + \", \""); } else { m.addBodyLine(nameValue); } } m.addBodyLine(" + \"}\";"); clasz.addMethod(m); }
[ "public", "static", "void", "addToStringMethod", "(", "final", "SgClassPool", "pool", ",", "final", "SgClass", "clasz", ",", "final", "List", "<", "SgField", ">", "fields", ")", "{", "final", "SgMethod", "m", "=", "new", "SgMethod", "(", "clasz", ",", "\"p...
Creates an <code>toString()</code> method with all fields. @param pool Pool to use. @param clasz Class to add the new method to. @param fields List of fields to output.
[ "Creates", "an", "<code", ">", "toString", "()", "<", "/", "code", ">", "method", "with", "all", "fields", "." ]
train
https://github.com/fuinorg/srcgen4javassist/blob/355828113cfce3cdd3d69ba242c5bdfc7d899f2f/src/main/java/org/fuin/srcgen4javassist/SgUtils.java#L355-L371
allcolor/YaHP-Converter
YaHPConverter/src/org/allcolor/yahp/converter/CClassLoader.java
CClassLoader.createLoader
private static final CClassLoader createLoader(final ClassLoader parent, final String name) { try { return new CClassLoader(parent, name); } catch (final Exception ignore) { return null; } }
java
private static final CClassLoader createLoader(final ClassLoader parent, final String name) { try { return new CClassLoader(parent, name); } catch (final Exception ignore) { return null; } }
[ "private", "static", "final", "CClassLoader", "createLoader", "(", "final", "ClassLoader", "parent", ",", "final", "String", "name", ")", "{", "try", "{", "return", "new", "CClassLoader", "(", "parent", ",", "name", ")", ";", "}", "catch", "(", "final", "E...
Create a new loader @param parent a reference to the parent loader @param name loader name @return a new loader
[ "Create", "a", "new", "loader" ]
train
https://github.com/allcolor/YaHP-Converter/blob/d72745281766a784a6b319f3787aa1d8de7cd0fe/YaHPConverter/src/org/allcolor/yahp/converter/CClassLoader.java#L125-L132
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBitMaskField.java
JBitMaskField.init
public void init(int iCheckCount, boolean bCheckedIsOn) { m_bCheckedIsOn = bCheckedIsOn; this.setBorder(null); this.setOpaque(false); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); for (int i = 0; i < iCheckCount; i++) { JCheckBox checkBox = new JCheckBox(); this.add(checkBox); checkBox.setName(Integer.toString(i)); checkBox.setOpaque(false); } }
java
public void init(int iCheckCount, boolean bCheckedIsOn) { m_bCheckedIsOn = bCheckedIsOn; this.setBorder(null); this.setOpaque(false); this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); for (int i = 0; i < iCheckCount; i++) { JCheckBox checkBox = new JCheckBox(); this.add(checkBox); checkBox.setName(Integer.toString(i)); checkBox.setOpaque(false); } }
[ "public", "void", "init", "(", "int", "iCheckCount", ",", "boolean", "bCheckedIsOn", ")", "{", "m_bCheckedIsOn", "=", "bCheckedIsOn", ";", "this", ".", "setBorder", "(", "null", ")", ";", "this", ".", "setOpaque", "(", "false", ")", ";", "this", ".", "se...
Creates new JCellButton. @param iCheckCount The number of checkboxes to add. @param bCheckedIsOn A 1 bit is a checked checkbox.
[ "Creates", "new", "JCellButton", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/JBitMaskField.java#L81-L96
EdwardRaff/JSAT
JSAT/src/jsat/distributions/discrete/Zipf.java
Zipf.setCardinality
public void setCardinality(double cardinality) { if (cardinality < 0 || Double.isNaN(cardinality)) throw new IllegalArgumentException("Cardinality must be a positive integer or infinity, not " + cardinality); this.cardinality = Math.ceil(cardinality); fixCache(); }
java
public void setCardinality(double cardinality) { if (cardinality < 0 || Double.isNaN(cardinality)) throw new IllegalArgumentException("Cardinality must be a positive integer or infinity, not " + cardinality); this.cardinality = Math.ceil(cardinality); fixCache(); }
[ "public", "void", "setCardinality", "(", "double", "cardinality", ")", "{", "if", "(", "cardinality", "<", "0", "||", "Double", ".", "isNaN", "(", "cardinality", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Cardinality must be a positive integer or ...
Sets the cardinality of the distribution, defining the maximum number of items that Zipf can return. @param cardinality the maximum output range of the distribution, can be {@link Double#POSITIVE_INFINITY infinite}.
[ "Sets", "the", "cardinality", "of", "the", "distribution", "defining", "the", "maximum", "number", "of", "items", "that", "Zipf", "can", "return", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/discrete/Zipf.java#L87-L93
jOOQ/jOOL
jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java
Agg.maxAll
public static <T extends Comparable<? super T>> Collector<T, ?, Seq<T>> maxAll() { return maxAllBy(t -> t, naturalOrder()); }
java
public static <T extends Comparable<? super T>> Collector<T, ?, Seq<T>> maxAll() { return maxAllBy(t -> t, naturalOrder()); }
[ "public", "static", "<", "T", "extends", "Comparable", "<", "?", "super", "T", ">", ">", "Collector", "<", "T", ",", "?", ",", "Seq", "<", "T", ">", ">", "maxAll", "(", ")", "{", "return", "maxAllBy", "(", "t", "->", "t", ",", "naturalOrder", "("...
Get a {@link Collector} that calculates the <code>MAX()</code> function, producing multiple results.
[ "Get", "a", "{" ]
train
https://github.com/jOOQ/jOOL/blob/889d87c85ca57bafd4eddd78e0f7ae2804d2ee86/jOOL-java-8/src/main/java/org/jooq/lambda/Agg.java#L329-L331
jcuda/jcuda
JCudaJava/src/main/java/jcuda/runtime/JCuda.java
JCuda.cudaMemRangeGetAttributes
public static int cudaMemRangeGetAttributes(Pointer data[], long dataSizes[], int attributes[], long numAttributes, Pointer devPtr, long count) { return checkResult(cudaMemRangeGetAttributesNative(data, dataSizes, attributes, numAttributes, devPtr, count)); }
java
public static int cudaMemRangeGetAttributes(Pointer data[], long dataSizes[], int attributes[], long numAttributes, Pointer devPtr, long count) { return checkResult(cudaMemRangeGetAttributesNative(data, dataSizes, attributes, numAttributes, devPtr, count)); }
[ "public", "static", "int", "cudaMemRangeGetAttributes", "(", "Pointer", "data", "[", "]", ",", "long", "dataSizes", "[", "]", ",", "int", "attributes", "[", "]", ",", "long", "numAttributes", ",", "Pointer", "devPtr", ",", "long", "count", ")", "{", "retur...
Query attributes of a given memory range.<br> <br> Query attributes of the memory range starting at devPtr with a size of count bytes. The memory range must refer to managed memory allocated via cudaMallocManaged or declared via __managed__ variables. The attributes array will be interpreted to have numAttributes entries. The dataSizes array will also be interpreted to have numAttributes entries. The results of the query will be stored in data.<br> <br> The list of supported attributes are given below. Please refer to {@link #cudaMemRangeGetAttribute} for attribute descriptions and restrictions. <ul> <li> cudaMemRangeAttributeReadMostly </li> <li> cudaMemRangeAttributePreferredLocation </li> <li> cudaMemRangeAttributeAccessedBy </li> <li> cudaMemRangeAttributeLastPrefetchLocation </li> </ul> @param data A two-dimensional array containing pointers to memory locations where the result of each attribute query will be written to. @param dataSizes Array containing the sizes of each result @param attributes An array of {@link cudaMemRangeAttribute} to query (numAttributes and the number of attributes in this array should match) @param numAttributes Number of attributes to query @param devPtr Start of the range to query @param count Size of the range to query @return cudaSuccess, cudaErrorInvalidValue @see JCuda#cudaMemRangeGetAttribute @see JCuda#cudaMemAdvisecudaMemPrefetchAsync
[ "Query", "attributes", "of", "a", "given", "memory", "range", ".", "<br", ">", "<br", ">", "Query", "attributes", "of", "the", "memory", "range", "starting", "at", "devPtr", "with", "a", "size", "of", "count", "bytes", ".", "The", "memory", "range", "mus...
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/runtime/JCuda.java#L8981-L8984
haifengl/smile
data/src/main/java/smile/data/BinarySparseDataset.java
BinarySparseDataset.toSparseMatrix
public SparseMatrix toSparseMatrix() { int[] pos = new int[numColumns]; int[] colIndex = new int[numColumns + 1]; for (int i = 0; i < numColumns; i++) { colIndex[i + 1] = colIndex[i] + colSize[i]; } int nrows = size(); int[] rowIndex = new int[n]; double[] x = new double[n]; for (int i = 0; i < nrows; i++) { for (int j : get(i).x) { int k = colIndex[j] + pos[j]; rowIndex[k] = i; x[k] = 1; pos[j]++; } } return new SparseMatrix(nrows, numColumns, x, rowIndex, colIndex); }
java
public SparseMatrix toSparseMatrix() { int[] pos = new int[numColumns]; int[] colIndex = new int[numColumns + 1]; for (int i = 0; i < numColumns; i++) { colIndex[i + 1] = colIndex[i] + colSize[i]; } int nrows = size(); int[] rowIndex = new int[n]; double[] x = new double[n]; for (int i = 0; i < nrows; i++) { for (int j : get(i).x) { int k = colIndex[j] + pos[j]; rowIndex[k] = i; x[k] = 1; pos[j]++; } } return new SparseMatrix(nrows, numColumns, x, rowIndex, colIndex); }
[ "public", "SparseMatrix", "toSparseMatrix", "(", ")", "{", "int", "[", "]", "pos", "=", "new", "int", "[", "numColumns", "]", ";", "int", "[", "]", "colIndex", "=", "new", "int", "[", "numColumns", "+", "1", "]", ";", "for", "(", "int", "i", "=", ...
Convert into Harwell-Boeing column-compressed sparse matrix format.
[ "Convert", "into", "Harwell", "-", "Boeing", "column", "-", "compressed", "sparse", "matrix", "format", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/BinarySparseDataset.java#L165-L187
icode/ameba
src/main/java/ameba/websocket/internal/EndpointMeta.java
EndpointMeta.checkMessageSize
protected static void checkMessageSize(Object message, long maxMessageSize) { if (maxMessageSize != -1) { final long messageSize = (message instanceof String ? ((String) message).getBytes(Charset.defaultCharset()).length : ((ByteBuffer) message).remaining()); if (messageSize > maxMessageSize) { throw new MessageTooBigException( Messages.get("web.socket.error.message.too.long", maxMessageSize, messageSize) ); } } }
java
protected static void checkMessageSize(Object message, long maxMessageSize) { if (maxMessageSize != -1) { final long messageSize = (message instanceof String ? ((String) message).getBytes(Charset.defaultCharset()).length : ((ByteBuffer) message).remaining()); if (messageSize > maxMessageSize) { throw new MessageTooBigException( Messages.get("web.socket.error.message.too.long", maxMessageSize, messageSize) ); } } }
[ "protected", "static", "void", "checkMessageSize", "(", "Object", "message", ",", "long", "maxMessageSize", ")", "{", "if", "(", "maxMessageSize", "!=", "-", "1", ")", "{", "final", "long", "messageSize", "=", "(", "message", "instanceof", "String", "?", "("...
<p>checkMessageSize.</p> @param message a {@link java.lang.Object} object. @param maxMessageSize a long.
[ "<p", ">", "checkMessageSize", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/websocket/internal/EndpointMeta.java#L52-L64
alkacon/opencms-core
src/org/opencms/ui/dialogs/CmsSecureExportDialog.java
CmsSecureExportDialog.saveData
protected void saveData() throws CmsException { CmsObject cms = m_context.getCms(); for (CmsResource resource : m_context.getResources()) { CmsLockActionRecord actionRecord = null; try { actionRecord = CmsLockUtil.ensureLock(m_context.getCms(), resource); String secureValue = (String)m_secureField.getValue(); String exportValue = (String)m_exportField.getValue(); String exportname = m_exportNameField.getValue(); CmsProperty secureProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_SECURE, secureValue, null); CmsProperty exportProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_EXPORT, exportValue, null); CmsProperty exportNameProp = new CmsProperty( CmsPropertyDefinition.PROPERTY_EXPORTNAME, exportname, null); boolean internal = m_internalField.getValue().booleanValue(); cms.writePropertyObjects(resource, Arrays.asList(secureProp, exportProp, exportNameProp)); resource.setInternal(internal); cms.writeResource(resource); } finally { if ((actionRecord != null) && (actionRecord.getChange() == LockChange.locked)) { try { cms.unlockResource(resource); } catch (CmsLockException e) { LOG.warn(e.getLocalizedMessage(), e); } } } } }
java
protected void saveData() throws CmsException { CmsObject cms = m_context.getCms(); for (CmsResource resource : m_context.getResources()) { CmsLockActionRecord actionRecord = null; try { actionRecord = CmsLockUtil.ensureLock(m_context.getCms(), resource); String secureValue = (String)m_secureField.getValue(); String exportValue = (String)m_exportField.getValue(); String exportname = m_exportNameField.getValue(); CmsProperty secureProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_SECURE, secureValue, null); CmsProperty exportProp = new CmsProperty(CmsPropertyDefinition.PROPERTY_EXPORT, exportValue, null); CmsProperty exportNameProp = new CmsProperty( CmsPropertyDefinition.PROPERTY_EXPORTNAME, exportname, null); boolean internal = m_internalField.getValue().booleanValue(); cms.writePropertyObjects(resource, Arrays.asList(secureProp, exportProp, exportNameProp)); resource.setInternal(internal); cms.writeResource(resource); } finally { if ((actionRecord != null) && (actionRecord.getChange() == LockChange.locked)) { try { cms.unlockResource(resource); } catch (CmsLockException e) { LOG.warn(e.getLocalizedMessage(), e); } } } } }
[ "protected", "void", "saveData", "(", ")", "throws", "CmsException", "{", "CmsObject", "cms", "=", "m_context", ".", "getCms", "(", ")", ";", "for", "(", "CmsResource", "resource", ":", "m_context", ".", "getResources", "(", ")", ")", "{", "CmsLockActionReco...
Touches the selected files.<p> @throws CmsException if something goes wrong
[ "Touches", "the", "selected", "files", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/dialogs/CmsSecureExportDialog.java#L240-L272
oaqa/uima-ecd
src/main/java/edu/cmu/lti/oaqa/ecd/driver/SimplePipelineRev803.java
SimplePipelineRev803.runPipeline
public static void runPipeline(final JCas jCas, final AnalysisEngineDescription... descs) throws UIMAException, IOException { runPipeline(jCas.getCas(), descs); }
java
public static void runPipeline(final JCas jCas, final AnalysisEngineDescription... descs) throws UIMAException, IOException { runPipeline(jCas.getCas(), descs); }
[ "public", "static", "void", "runPipeline", "(", "final", "JCas", "jCas", ",", "final", "AnalysisEngineDescription", "...", "descs", ")", "throws", "UIMAException", ",", "IOException", "{", "runPipeline", "(", "jCas", ".", "getCas", "(", ")", ",", "descs", ")",...
Run a sequence of {@link AnalysisEngine analysis engines} over a {@link JCas}. The result of the analysis can be read from the JCas. @param jCas the jCas to process @param descs a sequence of analysis engines to run on the jCas @throws UIMAException @throws IOException
[ "Run", "a", "sequence", "of", "{", "@link", "AnalysisEngine", "analysis", "engines", "}", "over", "a", "{", "@link", "JCas", "}", ".", "The", "result", "of", "the", "analysis", "can", "be", "read", "from", "the", "JCas", "." ]
train
https://github.com/oaqa/uima-ecd/blob/09a0ae26647490b43affc36ab3a01100702b989f/src/main/java/edu/cmu/lti/oaqa/ecd/driver/SimplePipelineRev803.java#L208-L211
google/jimfs
jimfs/src/main/java/com/google/common/jimfs/RegularFile.java
RegularFile.bytesToRead
private long bytesToRead(long pos, long max) { long available = size - pos; if (available <= 0) { return -1; } return Math.min(available, max); }
java
private long bytesToRead(long pos, long max) { long available = size - pos; if (available <= 0) { return -1; } return Math.min(available, max); }
[ "private", "long", "bytesToRead", "(", "long", "pos", ",", "long", "max", ")", "{", "long", "available", "=", "size", "-", "pos", ";", "if", "(", "available", "<=", "0", ")", "{", "return", "-", "1", ";", "}", "return", "Math", ".", "min", "(", "...
Returns the number of bytes that can be read starting at position {@code pos} (up to a maximum of {@code max}) or -1 if {@code pos} is greater than or equal to the current size.
[ "Returns", "the", "number", "of", "bytes", "that", "can", "be", "read", "starting", "at", "position", "{" ]
train
https://github.com/google/jimfs/blob/3eadff747a3afa7b498030f420d2d04ce700534a/jimfs/src/main/java/com/google/common/jimfs/RegularFile.java#L620-L626
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/modules/encryption/KeyManagerActor.java
KeyManagerActor.onPublicKeysGroupAdded
private void onPublicKeysGroupAdded(int uid, ApiEncryptionKeyGroup keyGroup) { UserKeys userKeys = getCachedUserKeys(uid); if (userKeys == null) { return; } UserKeysGroup validatedKeysGroup = validateUserKeysGroup(uid, keyGroup); if (validatedKeysGroup != null) { UserKeys updatedUserKeys = userKeys.addUserKeyGroup(validatedKeysGroup); cacheUserKeys(updatedUserKeys); context().getEncryption().getEncryptedChatManager(uid) .send(new EncryptedPeerActor.KeyGroupUpdated(userKeys)); } }
java
private void onPublicKeysGroupAdded(int uid, ApiEncryptionKeyGroup keyGroup) { UserKeys userKeys = getCachedUserKeys(uid); if (userKeys == null) { return; } UserKeysGroup validatedKeysGroup = validateUserKeysGroup(uid, keyGroup); if (validatedKeysGroup != null) { UserKeys updatedUserKeys = userKeys.addUserKeyGroup(validatedKeysGroup); cacheUserKeys(updatedUserKeys); context().getEncryption().getEncryptedChatManager(uid) .send(new EncryptedPeerActor.KeyGroupUpdated(userKeys)); } }
[ "private", "void", "onPublicKeysGroupAdded", "(", "int", "uid", ",", "ApiEncryptionKeyGroup", "keyGroup", ")", "{", "UserKeys", "userKeys", "=", "getCachedUserKeys", "(", "uid", ")", ";", "if", "(", "userKeys", "==", "null", ")", "{", "return", ";", "}", "Us...
Handler for adding new key group @param uid User's id @param keyGroup Added key group
[ "Handler", "for", "adding", "new", "key", "group" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/modules/encryption/KeyManagerActor.java#L440-L452
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getHierarchicalEntityAsync
public Observable<HierarchicalEntityExtractor> getHierarchicalEntityAsync(UUID appId, String versionId, UUID hEntityId) { return getHierarchicalEntityWithServiceResponseAsync(appId, versionId, hEntityId).map(new Func1<ServiceResponse<HierarchicalEntityExtractor>, HierarchicalEntityExtractor>() { @Override public HierarchicalEntityExtractor call(ServiceResponse<HierarchicalEntityExtractor> response) { return response.body(); } }); }
java
public Observable<HierarchicalEntityExtractor> getHierarchicalEntityAsync(UUID appId, String versionId, UUID hEntityId) { return getHierarchicalEntityWithServiceResponseAsync(appId, versionId, hEntityId).map(new Func1<ServiceResponse<HierarchicalEntityExtractor>, HierarchicalEntityExtractor>() { @Override public HierarchicalEntityExtractor call(ServiceResponse<HierarchicalEntityExtractor> response) { return response.body(); } }); }
[ "public", "Observable", "<", "HierarchicalEntityExtractor", ">", "getHierarchicalEntityAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "hEntityId", ")", "{", "return", "getHierarchicalEntityWithServiceResponseAsync", "(", "appId", ",", "versionId", ...
Gets information about the hierarchical entity model. @param appId The application ID. @param versionId The version ID. @param hEntityId The hierarchical entity extractor ID. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the HierarchicalEntityExtractor object
[ "Gets", "information", "about", "the", "hierarchical", "entity", "model", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L3683-L3690
shrinkwrap/descriptors
metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java
Metadata.addClassElement
public void addClassElement(final String className, final MetadataElement classElement) { classElement.setType(getNamespaceValue(classElement.getType())); if (classElement.getMaxOccurs() != null && !classElement.getMaxOccurs().equals("1")) { classElement.setMaxOccurs("unbounded"); } for (MetadataItem item : classList) { if (item.getName().equals(className) && item.getNamespace().equals(getCurrentNamespace()) && item.getPackageApi().equals(getCurrentPackageApi())) { // check for a element with the same name, if found then set 'maxOccurs = unbounded' for (MetadataElement element : item.getElements()) { if (element.getName().equals(classElement.getName()) && !classElement.getIsAttribute()) { element.setMaxOccurs("unbounded"); return; } } item.getElements().add(classElement); return; } } final MetadataItem newItem = new MetadataItem(className); newItem.getElements().add(classElement); newItem.setNamespace(getCurrentNamespace()); newItem.setSchemaName(getCurrentSchmema()); newItem.setPackageApi(getCurrentPackageApi()); newItem.setPackageImpl(getCurrentPackageImpl()); classList.add(newItem); }
java
public void addClassElement(final String className, final MetadataElement classElement) { classElement.setType(getNamespaceValue(classElement.getType())); if (classElement.getMaxOccurs() != null && !classElement.getMaxOccurs().equals("1")) { classElement.setMaxOccurs("unbounded"); } for (MetadataItem item : classList) { if (item.getName().equals(className) && item.getNamespace().equals(getCurrentNamespace()) && item.getPackageApi().equals(getCurrentPackageApi())) { // check for a element with the same name, if found then set 'maxOccurs = unbounded' for (MetadataElement element : item.getElements()) { if (element.getName().equals(classElement.getName()) && !classElement.getIsAttribute()) { element.setMaxOccurs("unbounded"); return; } } item.getElements().add(classElement); return; } } final MetadataItem newItem = new MetadataItem(className); newItem.getElements().add(classElement); newItem.setNamespace(getCurrentNamespace()); newItem.setSchemaName(getCurrentSchmema()); newItem.setPackageApi(getCurrentPackageApi()); newItem.setPackageImpl(getCurrentPackageImpl()); classList.add(newItem); }
[ "public", "void", "addClassElement", "(", "final", "String", "className", ",", "final", "MetadataElement", "classElement", ")", "{", "classElement", ".", "setType", "(", "getNamespaceValue", "(", "classElement", ".", "getType", "(", ")", ")", ")", ";", "if", "...
Adds a new element to the specific element class. If no element class is found, then a new element class. will be created. @param className the class name @param classElement the new element to be added.
[ "Adds", "a", "new", "element", "to", "the", "specific", "element", "class", ".", "If", "no", "element", "class", "is", "found", "then", "a", "new", "element", "class", ".", "will", "be", "created", "." ]
train
https://github.com/shrinkwrap/descriptors/blob/023ba080e6396b9f4dd8275dc4e5c0ebb6b5e6ba/metadata-parser/src/main/java/org/jboss/shrinkwrap/descriptor/metadata/Metadata.java#L196-L226
iobeam/iobeam-client-java
src/main/java/com/iobeam/api/client/Iobeam.java
Iobeam.registerDeviceAsync
public void registerDeviceAsync(Device device, RegisterCallback callback) { RestCallback<Device> cb; if (callback == null) { cb = RegisterCallback.getEmptyCallback().getInnerCallback(this); } else { cb = callback.getInnerCallback(this); } // If device ID is set and not explicitly asking for a different one, return current ID. boolean alreadySet = this.deviceId != null; if (alreadySet && (device == null || this.deviceId.equals(device.getId()))) { cb.completed(device, null); return; } // Make sure to unset before attempting, so as not to reuse old ID if it fails. this.deviceId = null; final DeviceService.Add req; try { req = prepareDeviceRequest(device); } catch (ApiException e) { IobeamException ie = new IobeamException(e); if (callback == null) { throw ie; } else { cb.failed(ie, null); return; } } req.executeAsync(cb); }
java
public void registerDeviceAsync(Device device, RegisterCallback callback) { RestCallback<Device> cb; if (callback == null) { cb = RegisterCallback.getEmptyCallback().getInnerCallback(this); } else { cb = callback.getInnerCallback(this); } // If device ID is set and not explicitly asking for a different one, return current ID. boolean alreadySet = this.deviceId != null; if (alreadySet && (device == null || this.deviceId.equals(device.getId()))) { cb.completed(device, null); return; } // Make sure to unset before attempting, so as not to reuse old ID if it fails. this.deviceId = null; final DeviceService.Add req; try { req = prepareDeviceRequest(device); } catch (ApiException e) { IobeamException ie = new IobeamException(e); if (callback == null) { throw ie; } else { cb.failed(ie, null); return; } } req.executeAsync(cb); }
[ "public", "void", "registerDeviceAsync", "(", "Device", "device", ",", "RegisterCallback", "callback", ")", "{", "RestCallback", "<", "Device", ">", "cb", ";", "if", "(", "callback", "==", "null", ")", "{", "cb", "=", "RegisterCallback", ".", "getEmptyCallback...
Registers a device asynchronously with parameters of the provided {@link Device}. This will not block the calling thread. If successful, the device ID of this client will be set (either to the id provided, or if not provided, a randomly generated one). Any provided callback will be run on a background thread. If the client already has a device ID set, registration will only happen for a non-null device. Otherwise, the callback will be called with a {@link Device} with the current ID. @param device Desired device parameters to register. @param callback Callback for result of the registration. @throws ApiException Thrown if the iobeam client is not initialized.
[ "Registers", "a", "device", "asynchronously", "with", "parameters", "of", "the", "provided", "{", "@link", "Device", "}", ".", "This", "will", "not", "block", "the", "calling", "thread", ".", "If", "successful", "the", "device", "ID", "of", "this", "client",...
train
https://github.com/iobeam/iobeam-client-java/blob/06e7aeb2a313503392358a3671de7d28628d0e33/src/main/java/com/iobeam/api/client/Iobeam.java#L636-L667
haifengl/smile
plot/src/main/java/smile/swing/table/MultiColumnSortTableHeaderCellRenderer.java
MultiColumnSortTableHeaderCellRenderer.getIcon
@Override public Icon getIcon(JTable table, int column) { float computedAlpha = 1.0F; for (RowSorter.SortKey sortKey : table.getRowSorter().getSortKeys()) { if (table.convertColumnIndexToView(sortKey.getColumn()) == column) { switch (sortKey.getSortOrder()) { case ASCENDING: return new AlphaIcon(UIManager.getIcon("Table.ascendingSortIcon"), computedAlpha); case DESCENDING: return new AlphaIcon(UIManager.getIcon("Table.descendingSortIcon"), computedAlpha); default: // Just to remove unmatched case warning } } computedAlpha *= alpha; } return null; }
java
@Override public Icon getIcon(JTable table, int column) { float computedAlpha = 1.0F; for (RowSorter.SortKey sortKey : table.getRowSorter().getSortKeys()) { if (table.convertColumnIndexToView(sortKey.getColumn()) == column) { switch (sortKey.getSortOrder()) { case ASCENDING: return new AlphaIcon(UIManager.getIcon("Table.ascendingSortIcon"), computedAlpha); case DESCENDING: return new AlphaIcon(UIManager.getIcon("Table.descendingSortIcon"), computedAlpha); default: // Just to remove unmatched case warning } } computedAlpha *= alpha; } return null; }
[ "@", "Override", "public", "Icon", "getIcon", "(", "JTable", "table", ",", "int", "column", ")", "{", "float", "computedAlpha", "=", "1.0F", ";", "for", "(", "RowSorter", ".", "SortKey", "sortKey", ":", "table", ".", "getRowSorter", "(", ")", ".", "getSo...
Overridden to return an icon suitable to a sorted column, or null if the column is unsorted. The icon for the primary sorted column is fully opaque, and the opacity is reduced by a factor of <code>alpha</code> for each subsequent sort index. @param table the <code>JTable</code>. @param column the column index. @return the sort icon with appropriate opacity, or null if the column is unsorted.
[ "Overridden", "to", "return", "an", "icon", "suitable", "to", "a", "sorted", "column", "or", "null", "if", "the", "column", "is", "unsorted", ".", "The", "icon", "for", "the", "primary", "sorted", "column", "is", "fully", "opaque", "and", "the", "opacity",...
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/plot/src/main/java/smile/swing/table/MultiColumnSortTableHeaderCellRenderer.java#L71-L89
googleapis/google-cloud-java
google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java
IntentsClient.updateIntent
public final Intent updateIntent(Intent intent, String languageCode, FieldMask updateMask) { UpdateIntentRequest request = UpdateIntentRequest.newBuilder() .setIntent(intent) .setLanguageCode(languageCode) .setUpdateMask(updateMask) .build(); return updateIntent(request); }
java
public final Intent updateIntent(Intent intent, String languageCode, FieldMask updateMask) { UpdateIntentRequest request = UpdateIntentRequest.newBuilder() .setIntent(intent) .setLanguageCode(languageCode) .setUpdateMask(updateMask) .build(); return updateIntent(request); }
[ "public", "final", "Intent", "updateIntent", "(", "Intent", "intent", ",", "String", "languageCode", ",", "FieldMask", "updateMask", ")", "{", "UpdateIntentRequest", "request", "=", "UpdateIntentRequest", ".", "newBuilder", "(", ")", ".", "setIntent", "(", "intent...
Updates the specified intent. <p>Sample code: <pre><code> try (IntentsClient intentsClient = IntentsClient.create()) { Intent intent = Intent.newBuilder().build(); String languageCode = ""; FieldMask updateMask = FieldMask.newBuilder().build(); Intent response = intentsClient.updateIntent(intent, languageCode, updateMask); } </code></pre> @param intent Required. The intent to update. @param languageCode Optional. The language of training phrases, parameters and rich messages defined in `intent`. If not specified, the agent's default language is used. [Many languages](https://cloud.google.com/dialogflow-enterprise/docs/reference/language) are supported. Note: languages must be enabled in the agent before they can be used. @param updateMask Optional. The mask to control which fields get updated. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "the", "specified", "intent", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-dialogflow/src/main/java/com/google/cloud/dialogflow/v2beta1/IntentsClient.java#L773-L782
kiegroup/drools
kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/util/EvalHelper.java
EvalHelper.getValue
public static Object getValue(final Object current, final String property) { return getDefinedValue(current, property).getValueResult().getOrElse(null); }
java
public static Object getValue(final Object current, final String property) { return getDefinedValue(current, property).getValueResult().getOrElse(null); }
[ "public", "static", "Object", "getValue", "(", "final", "Object", "current", ",", "final", "String", "property", ")", "{", "return", "getDefinedValue", "(", "current", ",", "property", ")", ".", "getValueResult", "(", ")", ".", "getOrElse", "(", "null", ")",...
{@link #getDefinedValue(Object, String)} method instead. @deprecated this method cannot distinguish null because: 1. property undefined for current, 2. an error, 3. a properly defined property value valorized to null.
[ "{", "@link", "#getDefinedValue", "(", "Object", "String", ")", "}", "method", "instead", ".", "@deprecated", "this", "method", "cannot", "distinguish", "null", "because", ":", "1", ".", "property", "undefined", "for", "current", "2", ".", "an", "error", "3"...
train
https://github.com/kiegroup/drools/blob/22b0275d6dbe93070b8090948502cf46eda543c4/kie-dmn/kie-dmn-feel/src/main/java/org/kie/dmn/feel/util/EvalHelper.java#L398-L400
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/util/PropertiesUtils.java
PropertiesUtils.filterProperties
public static Map<String, String> filterProperties(Properties props, String prefix, boolean removePrefix) { List<String> excludedProperties = Collections.emptyList(); return filterProperties(props, prefix, removePrefix, excludedProperties); }
java
public static Map<String, String> filterProperties(Properties props, String prefix, boolean removePrefix) { List<String> excludedProperties = Collections.emptyList(); return filterProperties(props, prefix, removePrefix, excludedProperties); }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "filterProperties", "(", "Properties", "props", ",", "String", "prefix", ",", "boolean", "removePrefix", ")", "{", "List", "<", "String", ">", "excludedProperties", "=", "Collections", ".", "emptyLi...
Filters the properties file using the prefix given in parameter. @param props the properties @param prefix the prefix of the property to retrieve @param removePrefix the flag indicating if the prefix should be removed from the property key. @return the filtered properties
[ "Filters", "the", "properties", "file", "using", "the", "prefix", "given", "in", "parameter", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/util/PropertiesUtils.java#L56-L60
OpenTSDB/opentsdb
src/utils/JSON.java
JSON.serializeToJSONPString
public static final String serializeToJSONPString(final String callback, final Object object) { if (callback == null || callback.isEmpty()) throw new IllegalArgumentException("Missing callback name"); if (object == null) throw new IllegalArgumentException("Object was null"); try { return jsonMapper.writeValueAsString(new JSONPObject(callback, object)); } catch (JsonProcessingException e) { throw new JSONException(e); } }
java
public static final String serializeToJSONPString(final String callback, final Object object) { if (callback == null || callback.isEmpty()) throw new IllegalArgumentException("Missing callback name"); if (object == null) throw new IllegalArgumentException("Object was null"); try { return jsonMapper.writeValueAsString(new JSONPObject(callback, object)); } catch (JsonProcessingException e) { throw new JSONException(e); } }
[ "public", "static", "final", "String", "serializeToJSONPString", "(", "final", "String", "callback", ",", "final", "Object", "object", ")", "{", "if", "(", "callback", "==", "null", "||", "callback", ".", "isEmpty", "(", ")", ")", "throw", "new", "IllegalArg...
Serializes the given object and wraps it in a callback function i.e. &lt;callback&gt;(&lt;json&gt;) Note: This will not append a trailing semicolon @param callback The name of the Javascript callback to prepend @param object The object to serialize @return A JSONP formatted string @throws IllegalArgumentException if the callback method name was missing or object was null @throws JSONException if the object could not be serialized
[ "Serializes", "the", "given", "object", "and", "wraps", "it", "in", "a", "callback", "function", "i", ".", "e", ".", "&lt", ";", "callback&gt", ";", "(", "&lt", ";", "json&gt", ";", ")", "Note", ":", "This", "will", "not", "append", "a", "trailing", ...
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/utils/JSON.java#L311-L322
amzn/ion-java
src/com/amazon/ion/impl/IonBinary.java
IonBinary.readAll
public static void readAll(InputStream in, byte[] buf, int offset, int len) throws IOException { int rem = len; while (rem > 0) { int amount = in.read(buf, offset, rem); if (amount <= 0) { // try to throw a useful exception if (in instanceof Reader) { ((Reader) in).throwUnexpectedEOFException(); } // defer to a plain exception throw new IonException("Unexpected EOF"); } rem -= amount; offset += amount; } }
java
public static void readAll(InputStream in, byte[] buf, int offset, int len) throws IOException { int rem = len; while (rem > 0) { int amount = in.read(buf, offset, rem); if (amount <= 0) { // try to throw a useful exception if (in instanceof Reader) { ((Reader) in).throwUnexpectedEOFException(); } // defer to a plain exception throw new IonException("Unexpected EOF"); } rem -= amount; offset += amount; } }
[ "public", "static", "void", "readAll", "(", "InputStream", "in", ",", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "len", ")", "throws", "IOException", "{", "int", "rem", "=", "len", ";", "while", "(", "rem", ">", "0", ")", "{", "int"...
Uses {@link InputStream#read(byte[], int, int)} until the entire length is read. This method will block until the request is satisfied. @param in The stream to read from. @param buf The buffer to read to. @param offset The offset of the buffer to read from. @param len The length of the data to read.
[ "Uses", "{", "@link", "InputStream#read", "(", "byte", "[]", "int", "int", ")", "}", "until", "the", "entire", "length", "is", "read", ".", "This", "method", "will", "block", "until", "the", "request", "is", "satisfied", "." ]
train
https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonBinary.java#L921-L940
prestodb/presto
presto-raptor/src/main/java/com/facebook/presto/raptor/util/DatabaseUtil.java
DatabaseUtil.mySqlErrorCodeMatches
private static boolean mySqlErrorCodeMatches(Exception e, int errorCode) { return Throwables.getCausalChain(e).stream() .filter(SQLException.class::isInstance) .map(SQLException.class::cast) .filter(t -> t.getErrorCode() == errorCode) .map(Throwable::getStackTrace) .anyMatch(isMySQLException()); }
java
private static boolean mySqlErrorCodeMatches(Exception e, int errorCode) { return Throwables.getCausalChain(e).stream() .filter(SQLException.class::isInstance) .map(SQLException.class::cast) .filter(t -> t.getErrorCode() == errorCode) .map(Throwable::getStackTrace) .anyMatch(isMySQLException()); }
[ "private", "static", "boolean", "mySqlErrorCodeMatches", "(", "Exception", "e", ",", "int", "errorCode", ")", "{", "return", "Throwables", ".", "getCausalChain", "(", "e", ")", ".", "stream", "(", ")", ".", "filter", "(", "SQLException", ".", "class", "::", ...
Check if an exception is caused by a MySQL exception of certain error code
[ "Check", "if", "an", "exception", "is", "caused", "by", "a", "MySQL", "exception", "of", "certain", "error", "code" ]
train
https://github.com/prestodb/presto/blob/89de5e379d8f85e139d292b0add8c537a2a01a88/presto-raptor/src/main/java/com/facebook/presto/raptor/util/DatabaseUtil.java#L155-L163
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.accessRestriction_u2f_id_enable_POST
public void accessRestriction_u2f_id_enable_POST(Long id, String clientData, String signatureData) throws IOException { String qPath = "/me/accessRestriction/u2f/{id}/enable"; StringBuilder sb = path(qPath, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "clientData", clientData); addBody(o, "signatureData", signatureData); exec(qPath, "POST", sb.toString(), o); }
java
public void accessRestriction_u2f_id_enable_POST(Long id, String clientData, String signatureData) throws IOException { String qPath = "/me/accessRestriction/u2f/{id}/enable"; StringBuilder sb = path(qPath, id); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "clientData", clientData); addBody(o, "signatureData", signatureData); exec(qPath, "POST", sb.toString(), o); }
[ "public", "void", "accessRestriction_u2f_id_enable_POST", "(", "Long", "id", ",", "String", "clientData", ",", "String", "signatureData", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/accessRestriction/u2f/{id}/enable\"", ";", "StringBuilder", "sb", ...
Enable this U2F account REST: POST /me/accessRestriction/u2f/{id}/enable @param signatureData [required] @param clientData [required] @param id [required] The Id of the restriction
[ "Enable", "this", "U2F", "account" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L4181-L4188
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/time/DateUtils.java
DateUtils.setHours
public static Date setHours(final Date date, final int amount) { return set(date, Calendar.HOUR_OF_DAY, amount); }
java
public static Date setHours(final Date date, final int amount) { return set(date, Calendar.HOUR_OF_DAY, amount); }
[ "public", "static", "Date", "setHours", "(", "final", "Date", "date", ",", "final", "int", "amount", ")", "{", "return", "set", "(", "date", ",", "Calendar", ".", "HOUR_OF_DAY", ",", "amount", ")", ";", "}" ]
Sets the hours field to a date returning a new object. Hours range from 0-23. The original {@code Date} is unchanged. @param date the date, not null @param amount the amount to set @return a new {@code Date} set with the specified value @throws IllegalArgumentException if the date is null @since 2.4
[ "Sets", "the", "hours", "field", "to", "a", "date", "returning", "a", "new", "object", ".", "Hours", "range", "from", "0", "-", "23", ".", "The", "original", "{", "@code", "Date", "}", "is", "unchanged", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/time/DateUtils.java#L586-L588