repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
sebastiangraf/perfidix
src/main/java/org/perfidix/element/AbstractMethodArrangement.java
AbstractMethodArrangement.getMethodArrangement
public static AbstractMethodArrangement getMethodArrangement(final List<BenchmarkElement> elements, final KindOfArrangement kind) { """ Factory method to get the method arrangement for a given set of classes. The kind of arrangement is set by an instance of the enum {@link KindOfArrangement}. @param elements to be benched @param kind for the method arrangement @return the arrangement, mainly an iterator """ AbstractMethodArrangement arrang = null; switch (kind) { case NoArrangement: arrang = new NoMethodArrangement(elements); break; case ShuffleArrangement: arrang = new ShuffleMethodArrangement(elements); break; case SequentialMethodArrangement: arrang = new SequentialMethodArrangement(elements); break; default: throw new IllegalArgumentException("Kind not known!"); } return arrang; }
java
public static AbstractMethodArrangement getMethodArrangement(final List<BenchmarkElement> elements, final KindOfArrangement kind) { AbstractMethodArrangement arrang = null; switch (kind) { case NoArrangement: arrang = new NoMethodArrangement(elements); break; case ShuffleArrangement: arrang = new ShuffleMethodArrangement(elements); break; case SequentialMethodArrangement: arrang = new SequentialMethodArrangement(elements); break; default: throw new IllegalArgumentException("Kind not known!"); } return arrang; }
[ "public", "static", "AbstractMethodArrangement", "getMethodArrangement", "(", "final", "List", "<", "BenchmarkElement", ">", "elements", ",", "final", "KindOfArrangement", "kind", ")", "{", "AbstractMethodArrangement", "arrang", "=", "null", ";", "switch", "(", "kind", ")", "{", "case", "NoArrangement", ":", "arrang", "=", "new", "NoMethodArrangement", "(", "elements", ")", ";", "break", ";", "case", "ShuffleArrangement", ":", "arrang", "=", "new", "ShuffleMethodArrangement", "(", "elements", ")", ";", "break", ";", "case", "SequentialMethodArrangement", ":", "arrang", "=", "new", "SequentialMethodArrangement", "(", "elements", ")", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Kind not known!\"", ")", ";", "}", "return", "arrang", ";", "}" ]
Factory method to get the method arrangement for a given set of classes. The kind of arrangement is set by an instance of the enum {@link KindOfArrangement}. @param elements to be benched @param kind for the method arrangement @return the arrangement, mainly an iterator
[ "Factory", "method", "to", "get", "the", "method", "arrangement", "for", "a", "given", "set", "of", "classes", ".", "The", "kind", "of", "arrangement", "is", "set", "by", "an", "instance", "of", "the", "enum", "{", "@link", "KindOfArrangement", "}", "." ]
train
https://github.com/sebastiangraf/perfidix/blob/f13aa793b6a3055215ed4edbb946c1bb5d564886/src/main/java/org/perfidix/element/AbstractMethodArrangement.java#L60-L77
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java
ExecutionGraph.tryRestartOrFail
private boolean tryRestartOrFail(long globalModVersionForRestart) { """ Try to restart the job. If we cannot restart the job (e.g. no more restarts allowed), then try to fail the job. This operation is only permitted if the current state is FAILING or RESTARTING. @return true if the operation could be executed; false if a concurrent job status change occurred """ JobStatus currentState = state; if (currentState == JobStatus.FAILING || currentState == JobStatus.RESTARTING) { final Throwable failureCause = this.failureCause; synchronized (progressLock) { if (LOG.isDebugEnabled()) { LOG.debug("Try to restart or fail the job {} ({}) if no longer possible.", getJobName(), getJobID(), failureCause); } else { LOG.info("Try to restart or fail the job {} ({}) if no longer possible.", getJobName(), getJobID()); } final boolean isFailureCauseAllowingRestart = !(failureCause instanceof SuppressRestartsException); final boolean isRestartStrategyAllowingRestart = restartStrategy.canRestart(); boolean isRestartable = isFailureCauseAllowingRestart && isRestartStrategyAllowingRestart; if (isRestartable && transitionState(currentState, JobStatus.RESTARTING)) { LOG.info("Restarting the job {} ({}).", getJobName(), getJobID()); RestartCallback restarter = new ExecutionGraphRestartCallback(this, globalModVersionForRestart); restartStrategy.restart(restarter, getJobMasterMainThreadExecutor()); return true; } else if (!isRestartable && transitionState(currentState, JobStatus.FAILED, failureCause)) { final String cause1 = isFailureCauseAllowingRestart ? null : "a type of SuppressRestartsException was thrown"; final String cause2 = isRestartStrategyAllowingRestart ? null : "the restart strategy prevented it"; LOG.info("Could not restart the job {} ({}) because {}.", getJobName(), getJobID(), StringUtils.concatenateWithAnd(cause1, cause2), failureCause); onTerminalState(JobStatus.FAILED); return true; } else { // we must have changed the state concurrently, thus we cannot complete this operation return false; } } } else { // this operation is only allowed in the state FAILING or RESTARTING return false; } }
java
private boolean tryRestartOrFail(long globalModVersionForRestart) { JobStatus currentState = state; if (currentState == JobStatus.FAILING || currentState == JobStatus.RESTARTING) { final Throwable failureCause = this.failureCause; synchronized (progressLock) { if (LOG.isDebugEnabled()) { LOG.debug("Try to restart or fail the job {} ({}) if no longer possible.", getJobName(), getJobID(), failureCause); } else { LOG.info("Try to restart or fail the job {} ({}) if no longer possible.", getJobName(), getJobID()); } final boolean isFailureCauseAllowingRestart = !(failureCause instanceof SuppressRestartsException); final boolean isRestartStrategyAllowingRestart = restartStrategy.canRestart(); boolean isRestartable = isFailureCauseAllowingRestart && isRestartStrategyAllowingRestart; if (isRestartable && transitionState(currentState, JobStatus.RESTARTING)) { LOG.info("Restarting the job {} ({}).", getJobName(), getJobID()); RestartCallback restarter = new ExecutionGraphRestartCallback(this, globalModVersionForRestart); restartStrategy.restart(restarter, getJobMasterMainThreadExecutor()); return true; } else if (!isRestartable && transitionState(currentState, JobStatus.FAILED, failureCause)) { final String cause1 = isFailureCauseAllowingRestart ? null : "a type of SuppressRestartsException was thrown"; final String cause2 = isRestartStrategyAllowingRestart ? null : "the restart strategy prevented it"; LOG.info("Could not restart the job {} ({}) because {}.", getJobName(), getJobID(), StringUtils.concatenateWithAnd(cause1, cause2), failureCause); onTerminalState(JobStatus.FAILED); return true; } else { // we must have changed the state concurrently, thus we cannot complete this operation return false; } } } else { // this operation is only allowed in the state FAILING or RESTARTING return false; } }
[ "private", "boolean", "tryRestartOrFail", "(", "long", "globalModVersionForRestart", ")", "{", "JobStatus", "currentState", "=", "state", ";", "if", "(", "currentState", "==", "JobStatus", ".", "FAILING", "||", "currentState", "==", "JobStatus", ".", "RESTARTING", ")", "{", "final", "Throwable", "failureCause", "=", "this", ".", "failureCause", ";", "synchronized", "(", "progressLock", ")", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Try to restart or fail the job {} ({}) if no longer possible.\"", ",", "getJobName", "(", ")", ",", "getJobID", "(", ")", ",", "failureCause", ")", ";", "}", "else", "{", "LOG", ".", "info", "(", "\"Try to restart or fail the job {} ({}) if no longer possible.\"", ",", "getJobName", "(", ")", ",", "getJobID", "(", ")", ")", ";", "}", "final", "boolean", "isFailureCauseAllowingRestart", "=", "!", "(", "failureCause", "instanceof", "SuppressRestartsException", ")", ";", "final", "boolean", "isRestartStrategyAllowingRestart", "=", "restartStrategy", ".", "canRestart", "(", ")", ";", "boolean", "isRestartable", "=", "isFailureCauseAllowingRestart", "&&", "isRestartStrategyAllowingRestart", ";", "if", "(", "isRestartable", "&&", "transitionState", "(", "currentState", ",", "JobStatus", ".", "RESTARTING", ")", ")", "{", "LOG", ".", "info", "(", "\"Restarting the job {} ({}).\"", ",", "getJobName", "(", ")", ",", "getJobID", "(", ")", ")", ";", "RestartCallback", "restarter", "=", "new", "ExecutionGraphRestartCallback", "(", "this", ",", "globalModVersionForRestart", ")", ";", "restartStrategy", ".", "restart", "(", "restarter", ",", "getJobMasterMainThreadExecutor", "(", ")", ")", ";", "return", "true", ";", "}", "else", "if", "(", "!", "isRestartable", "&&", "transitionState", "(", "currentState", ",", "JobStatus", ".", "FAILED", ",", "failureCause", ")", ")", "{", "final", "String", "cause1", "=", "isFailureCauseAllowingRestart", "?", "null", ":", "\"a type of SuppressRestartsException was thrown\"", ";", "final", "String", "cause2", "=", "isRestartStrategyAllowingRestart", "?", "null", ":", "\"the restart strategy prevented it\"", ";", "LOG", ".", "info", "(", "\"Could not restart the job {} ({}) because {}.\"", ",", "getJobName", "(", ")", ",", "getJobID", "(", ")", ",", "StringUtils", ".", "concatenateWithAnd", "(", "cause1", ",", "cause2", ")", ",", "failureCause", ")", ";", "onTerminalState", "(", "JobStatus", ".", "FAILED", ")", ";", "return", "true", ";", "}", "else", "{", "// we must have changed the state concurrently, thus we cannot complete this operation", "return", "false", ";", "}", "}", "}", "else", "{", "// this operation is only allowed in the state FAILING or RESTARTING", "return", "false", ";", "}", "}" ]
Try to restart the job. If we cannot restart the job (e.g. no more restarts allowed), then try to fail the job. This operation is only permitted if the current state is FAILING or RESTARTING. @return true if the operation could be executed; false if a concurrent job status change occurred
[ "Try", "to", "restart", "the", "job", ".", "If", "we", "cannot", "restart", "the", "job", "(", "e", ".", "g", ".", "no", "more", "restarts", "allowed", ")", "then", "try", "to", "fail", "the", "job", ".", "This", "operation", "is", "only", "permitted", "if", "the", "current", "state", "is", "FAILING", "or", "RESTARTING", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/executiongraph/ExecutionGraph.java#L1468-L1513
khuxtable/seaglass
src/main/java/com/seaglasslookandfeel/painter/button/SegmentedButtonPainter.java
SegmentedButtonPainter.createOuterFocus
protected Shape createOuterFocus(final SegmentType segmentType, final int x, final int y, final int w, final int h) { """ Create the shape for the outer focus ring. Designed to be drawn rather than filled. @param segmentType the segment type. @param x the x offset. @param y the y offset. @param w the width. @param h the height. @return the shape of the outer focus ring. Designed to be drawn rather than filled. """ switch (segmentType) { case FIRST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.SQUARE, CornerStyle.SQUARE); case MIDDLE: return shapeGenerator.createRectangle(x - 2, y - 2, w + 3, h + 3); case LAST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.ROUNDED, CornerStyle.ROUNDED); default: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS); } }
java
protected Shape createOuterFocus(final SegmentType segmentType, final int x, final int y, final int w, final int h) { switch (segmentType) { case FIRST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.ROUNDED, CornerStyle.ROUNDED, CornerStyle.SQUARE, CornerStyle.SQUARE); case MIDDLE: return shapeGenerator.createRectangle(x - 2, y - 2, w + 3, h + 3); case LAST: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS, CornerStyle.SQUARE, CornerStyle.SQUARE, CornerStyle.ROUNDED, CornerStyle.ROUNDED); default: return shapeGenerator.createRoundRectangle(x - 2, y - 2, w + 3, h + 3, CornerSize.OUTER_FOCUS); } }
[ "protected", "Shape", "createOuterFocus", "(", "final", "SegmentType", "segmentType", ",", "final", "int", "x", ",", "final", "int", "y", ",", "final", "int", "w", ",", "final", "int", "h", ")", "{", "switch", "(", "segmentType", ")", "{", "case", "FIRST", ":", "return", "shapeGenerator", ".", "createRoundRectangle", "(", "x", "-", "2", ",", "y", "-", "2", ",", "w", "+", "3", ",", "h", "+", "3", ",", "CornerSize", ".", "OUTER_FOCUS", ",", "CornerStyle", ".", "ROUNDED", ",", "CornerStyle", ".", "ROUNDED", ",", "CornerStyle", ".", "SQUARE", ",", "CornerStyle", ".", "SQUARE", ")", ";", "case", "MIDDLE", ":", "return", "shapeGenerator", ".", "createRectangle", "(", "x", "-", "2", ",", "y", "-", "2", ",", "w", "+", "3", ",", "h", "+", "3", ")", ";", "case", "LAST", ":", "return", "shapeGenerator", ".", "createRoundRectangle", "(", "x", "-", "2", ",", "y", "-", "2", ",", "w", "+", "3", ",", "h", "+", "3", ",", "CornerSize", ".", "OUTER_FOCUS", ",", "CornerStyle", ".", "SQUARE", ",", "CornerStyle", ".", "SQUARE", ",", "CornerStyle", ".", "ROUNDED", ",", "CornerStyle", ".", "ROUNDED", ")", ";", "default", ":", "return", "shapeGenerator", ".", "createRoundRectangle", "(", "x", "-", "2", ",", "y", "-", "2", ",", "w", "+", "3", ",", "h", "+", "3", ",", "CornerSize", ".", "OUTER_FOCUS", ")", ";", "}", "}" ]
Create the shape for the outer focus ring. Designed to be drawn rather than filled. @param segmentType the segment type. @param x the x offset. @param y the y offset. @param w the width. @param h the height. @return the shape of the outer focus ring. Designed to be drawn rather than filled.
[ "Create", "the", "shape", "for", "the", "outer", "focus", "ring", ".", "Designed", "to", "be", "drawn", "rather", "than", "filled", "." ]
train
https://github.com/khuxtable/seaglass/blob/f25ecba622923d7b29b64cb7d6068dd8005989b3/src/main/java/com/seaglasslookandfeel/painter/button/SegmentedButtonPainter.java#L227-L244
osglworks/java-tool
src/main/java/org/osgl/util/IO.java
IO.registerInputStreamHandler
public static void registerInputStreamHandler(MimeType type, InputStreamHandler handler) { """ Associate an {@link InputStreamHandler} with a specific {@link MimeType} @param type The mimetype the handler listen to @param handler the handler """ $.requireNotNull(handler); InputStreamHandlerDispatcher dispatcher = inputStreamHandlerLookup.get(type); if (null == dispatcher) { dispatcher = new InputStreamHandlerDispatcher(handler); inputStreamHandlerLookup.put(type, dispatcher); } else { dispatcher.add(handler); } }
java
public static void registerInputStreamHandler(MimeType type, InputStreamHandler handler) { $.requireNotNull(handler); InputStreamHandlerDispatcher dispatcher = inputStreamHandlerLookup.get(type); if (null == dispatcher) { dispatcher = new InputStreamHandlerDispatcher(handler); inputStreamHandlerLookup.put(type, dispatcher); } else { dispatcher.add(handler); } }
[ "public", "static", "void", "registerInputStreamHandler", "(", "MimeType", "type", ",", "InputStreamHandler", "handler", ")", "{", "$", ".", "requireNotNull", "(", "handler", ")", ";", "InputStreamHandlerDispatcher", "dispatcher", "=", "inputStreamHandlerLookup", ".", "get", "(", "type", ")", ";", "if", "(", "null", "==", "dispatcher", ")", "{", "dispatcher", "=", "new", "InputStreamHandlerDispatcher", "(", "handler", ")", ";", "inputStreamHandlerLookup", ".", "put", "(", "type", ",", "dispatcher", ")", ";", "}", "else", "{", "dispatcher", ".", "add", "(", "handler", ")", ";", "}", "}" ]
Associate an {@link InputStreamHandler} with a specific {@link MimeType} @param type The mimetype the handler listen to @param handler the handler
[ "Associate", "an", "{" ]
train
https://github.com/osglworks/java-tool/blob/8b6eee2bccb067eb32e6a7bc4a4dfef7a7d9008b/src/main/java/org/osgl/util/IO.java#L160-L169
sdl/Testy
src/main/java/com/sdl/selenium/bootstrap/button/UploadFile.java
UploadFile.newUpload
public boolean newUpload(String filePath) { """ Upload file with AutoIT. Use only this: button.newUpload("C:\\text.txt"); @param filePath "C:\\text.txt" @return true | false """ WebLocator uploadButton = new WebLocator(this).setTag("span").setClasses("fileupload-new").setElPathSuffix("icon-folder-open", "count(.//i[@class='icon-folder-open']) > 0"); return upload(uploadButton, filePath); }
java
public boolean newUpload(String filePath) { WebLocator uploadButton = new WebLocator(this).setTag("span").setClasses("fileupload-new").setElPathSuffix("icon-folder-open", "count(.//i[@class='icon-folder-open']) > 0"); return upload(uploadButton, filePath); }
[ "public", "boolean", "newUpload", "(", "String", "filePath", ")", "{", "WebLocator", "uploadButton", "=", "new", "WebLocator", "(", "this", ")", ".", "setTag", "(", "\"span\"", ")", ".", "setClasses", "(", "\"fileupload-new\"", ")", ".", "setElPathSuffix", "(", "\"icon-folder-open\"", ",", "\"count(.//i[@class='icon-folder-open']) > 0\"", ")", ";", "return", "upload", "(", "uploadButton", ",", "filePath", ")", ";", "}" ]
Upload file with AutoIT. Use only this: button.newUpload("C:\\text.txt"); @param filePath "C:\\text.txt" @return true | false
[ "Upload", "file", "with", "AutoIT", ".", "Use", "only", "this", ":", "button", ".", "newUpload", "(", "C", ":", "\\\\", "text", ".", "txt", ")", ";" ]
train
https://github.com/sdl/Testy/blob/b3ae061554016f926f04694a39ff00dab7576609/src/main/java/com/sdl/selenium/bootstrap/button/UploadFile.java#L94-L97
isisaddons-legacy/isis-module-security
dom/src/main/java/org/isisaddons/module/security/shiro/AuthenticationStrategyForIsisModuleSecurityRealm.java
AuthenticationStrategyForIsisModuleSecurityRealm.beforeAllAttempts
@Override public AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms, AuthenticationToken token) throws AuthenticationException { """ Reconfigures the SimpleAuthenticationInfo to use a implementation for storing its PrincipalCollections. <p> The default implementation uses a {@link org.apache.shiro.subject.SimplePrincipalCollection}, however this doesn't play well with the Isis Addons' security module which ends up chaining together multiple instances of {@link org.isisaddons.module.security.shiro.PrincipalForApplicationUser} for each login. This is probably because of it doing double duty with holding authorization information. There may be a better design here, but for now the solution I've chosen is to use a different implementation of {@link org.apache.shiro.subject.PrincipalCollection} that will only ever store one instance of {@link org.isisaddons.module.security.shiro.PrincipalForApplicationUser} as a principal. </p> """ final SimpleAuthenticationInfo authenticationInfo = (SimpleAuthenticationInfo) super.beforeAllAttempts(realms, token); authenticationInfo.setPrincipals(new PrincipalCollectionWithSinglePrincipalForApplicationUserInAnyRealm()); return authenticationInfo; }
java
@Override public AuthenticationInfo beforeAllAttempts(Collection<? extends Realm> realms, AuthenticationToken token) throws AuthenticationException { final SimpleAuthenticationInfo authenticationInfo = (SimpleAuthenticationInfo) super.beforeAllAttempts(realms, token); authenticationInfo.setPrincipals(new PrincipalCollectionWithSinglePrincipalForApplicationUserInAnyRealm()); return authenticationInfo; }
[ "@", "Override", "public", "AuthenticationInfo", "beforeAllAttempts", "(", "Collection", "<", "?", "extends", "Realm", ">", "realms", ",", "AuthenticationToken", "token", ")", "throws", "AuthenticationException", "{", "final", "SimpleAuthenticationInfo", "authenticationInfo", "=", "(", "SimpleAuthenticationInfo", ")", "super", ".", "beforeAllAttempts", "(", "realms", ",", "token", ")", ";", "authenticationInfo", ".", "setPrincipals", "(", "new", "PrincipalCollectionWithSinglePrincipalForApplicationUserInAnyRealm", "(", ")", ")", ";", "return", "authenticationInfo", ";", "}" ]
Reconfigures the SimpleAuthenticationInfo to use a implementation for storing its PrincipalCollections. <p> The default implementation uses a {@link org.apache.shiro.subject.SimplePrincipalCollection}, however this doesn't play well with the Isis Addons' security module which ends up chaining together multiple instances of {@link org.isisaddons.module.security.shiro.PrincipalForApplicationUser} for each login. This is probably because of it doing double duty with holding authorization information. There may be a better design here, but for now the solution I've chosen is to use a different implementation of {@link org.apache.shiro.subject.PrincipalCollection} that will only ever store one instance of {@link org.isisaddons.module.security.shiro.PrincipalForApplicationUser} as a principal. </p>
[ "Reconfigures", "the", "SimpleAuthenticationInfo", "to", "use", "a", "implementation", "for", "storing", "its", "PrincipalCollections", "." ]
train
https://github.com/isisaddons-legacy/isis-module-security/blob/a9deb1b003ba01e44c859085bd078be8df0c1863/dom/src/main/java/org/isisaddons/module/security/shiro/AuthenticationStrategyForIsisModuleSecurityRealm.java#L26-L32
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java
EscapedFunctions.sqllocate
public static String sqllocate(List<?> parsedArgs) throws SQLException { """ locate translation. @param parsedArgs arguments @return sql call @throws SQLException if something wrong happens """ if (parsedArgs.size() == 2) { return "position(" + parsedArgs.get(0) + " in " + parsedArgs.get(1) + ")"; } else if (parsedArgs.size() == 3) { String tmp = "position(" + parsedArgs.get(0) + " in substring(" + parsedArgs.get(1) + " from " + parsedArgs.get(2) + "))"; return "(" + parsedArgs.get(2) + "*sign(" + tmp + ")+" + tmp + ")"; } else { throw new PSQLException(GT.tr("{0} function takes two or three arguments.", "locate"), PSQLState.SYNTAX_ERROR); } }
java
public static String sqllocate(List<?> parsedArgs) throws SQLException { if (parsedArgs.size() == 2) { return "position(" + parsedArgs.get(0) + " in " + parsedArgs.get(1) + ")"; } else if (parsedArgs.size() == 3) { String tmp = "position(" + parsedArgs.get(0) + " in substring(" + parsedArgs.get(1) + " from " + parsedArgs.get(2) + "))"; return "(" + parsedArgs.get(2) + "*sign(" + tmp + ")+" + tmp + ")"; } else { throw new PSQLException(GT.tr("{0} function takes two or three arguments.", "locate"), PSQLState.SYNTAX_ERROR); } }
[ "public", "static", "String", "sqllocate", "(", "List", "<", "?", ">", "parsedArgs", ")", "throws", "SQLException", "{", "if", "(", "parsedArgs", ".", "size", "(", ")", "==", "2", ")", "{", "return", "\"position(\"", "+", "parsedArgs", ".", "get", "(", "0", ")", "+", "\" in \"", "+", "parsedArgs", ".", "get", "(", "1", ")", "+", "\")\"", ";", "}", "else", "if", "(", "parsedArgs", ".", "size", "(", ")", "==", "3", ")", "{", "String", "tmp", "=", "\"position(\"", "+", "parsedArgs", ".", "get", "(", "0", ")", "+", "\" in substring(\"", "+", "parsedArgs", ".", "get", "(", "1", ")", "+", "\" from \"", "+", "parsedArgs", ".", "get", "(", "2", ")", "+", "\"))\"", ";", "return", "\"(\"", "+", "parsedArgs", ".", "get", "(", "2", ")", "+", "\"*sign(\"", "+", "tmp", "+", "\")+\"", "+", "tmp", "+", "\")\"", ";", "}", "else", "{", "throw", "new", "PSQLException", "(", "GT", ".", "tr", "(", "\"{0} function takes two or three arguments.\"", ",", "\"locate\"", ")", ",", "PSQLState", ".", "SYNTAX_ERROR", ")", ";", "}", "}" ]
locate translation. @param parsedArgs arguments @return sql call @throws SQLException if something wrong happens
[ "locate", "translation", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/jdbc/EscapedFunctions.java#L302-L313
frostwire/frostwire-jlibtorrent
src/main/java/com/frostwire/jlibtorrent/TorrentHandle.java
TorrentHandle.setPieceDeadline
public void setPieceDeadline(int index, int deadline, deadline_flags_t flags) { """ This function sets or resets the deadline associated with a specific piece index (``index``). libtorrent will attempt to download this entire piece before the deadline expires. This is not necessarily possible, but pieces with a more recent deadline will always be prioritized over pieces with a deadline further ahead in time. The deadline (and flags) of a piece can be changed by calling this function again. <p> The ``flags`` parameter can be used to ask libtorrent to send an alert once the piece has been downloaded, by passing alert_when_available. When set, the read_piece_alert alert will be delivered, with the piece data, when it's downloaded. <p> If the piece is already downloaded when this call is made, nothing happens, unless the alert_when_available flag is set, in which case it will do the same thing as calling read_piece() for ``index``. @param index @param deadline @param flags """ th.set_piece_deadline(index, deadline, flags); }
java
public void setPieceDeadline(int index, int deadline, deadline_flags_t flags) { th.set_piece_deadline(index, deadline, flags); }
[ "public", "void", "setPieceDeadline", "(", "int", "index", ",", "int", "deadline", ",", "deadline_flags_t", "flags", ")", "{", "th", ".", "set_piece_deadline", "(", "index", ",", "deadline", ",", "flags", ")", ";", "}" ]
This function sets or resets the deadline associated with a specific piece index (``index``). libtorrent will attempt to download this entire piece before the deadline expires. This is not necessarily possible, but pieces with a more recent deadline will always be prioritized over pieces with a deadline further ahead in time. The deadline (and flags) of a piece can be changed by calling this function again. <p> The ``flags`` parameter can be used to ask libtorrent to send an alert once the piece has been downloaded, by passing alert_when_available. When set, the read_piece_alert alert will be delivered, with the piece data, when it's downloaded. <p> If the piece is already downloaded when this call is made, nothing happens, unless the alert_when_available flag is set, in which case it will do the same thing as calling read_piece() for ``index``. @param index @param deadline @param flags
[ "This", "function", "sets", "or", "resets", "the", "deadline", "associated", "with", "a", "specific", "piece", "index", "(", "index", ")", ".", "libtorrent", "will", "attempt", "to", "download", "this", "entire", "piece", "before", "the", "deadline", "expires", ".", "This", "is", "not", "necessarily", "possible", "but", "pieces", "with", "a", "more", "recent", "deadline", "will", "always", "be", "prioritized", "over", "pieces", "with", "a", "deadline", "further", "ahead", "in", "time", ".", "The", "deadline", "(", "and", "flags", ")", "of", "a", "piece", "can", "be", "changed", "by", "calling", "this", "function", "again", ".", "<p", ">", "The", "flags", "parameter", "can", "be", "used", "to", "ask", "libtorrent", "to", "send", "an", "alert", "once", "the", "piece", "has", "been", "downloaded", "by", "passing", "alert_when_available", ".", "When", "set", "the", "read_piece_alert", "alert", "will", "be", "delivered", "with", "the", "piece", "data", "when", "it", "s", "downloaded", ".", "<p", ">", "If", "the", "piece", "is", "already", "downloaded", "when", "this", "call", "is", "made", "nothing", "happens", "unless", "the", "alert_when_available", "flag", "is", "set", "in", "which", "case", "it", "will", "do", "the", "same", "thing", "as", "calling", "read_piece", "()", "for", "index", "." ]
train
https://github.com/frostwire/frostwire-jlibtorrent/blob/a29249a940d34aba8c4677d238b472ef01833506/src/main/java/com/frostwire/jlibtorrent/TorrentHandle.java#L1206-L1208
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nslimitidentifier_binding.java
nslimitidentifier_binding.get
public static nslimitidentifier_binding get(nitro_service service, String limitidentifier) throws Exception { """ Use this API to fetch nslimitidentifier_binding resource of given name . """ nslimitidentifier_binding obj = new nslimitidentifier_binding(); obj.set_limitidentifier(limitidentifier); nslimitidentifier_binding response = (nslimitidentifier_binding) obj.get_resource(service); return response; }
java
public static nslimitidentifier_binding get(nitro_service service, String limitidentifier) throws Exception{ nslimitidentifier_binding obj = new nslimitidentifier_binding(); obj.set_limitidentifier(limitidentifier); nslimitidentifier_binding response = (nslimitidentifier_binding) obj.get_resource(service); return response; }
[ "public", "static", "nslimitidentifier_binding", "get", "(", "nitro_service", "service", ",", "String", "limitidentifier", ")", "throws", "Exception", "{", "nslimitidentifier_binding", "obj", "=", "new", "nslimitidentifier_binding", "(", ")", ";", "obj", ".", "set_limitidentifier", "(", "limitidentifier", ")", ";", "nslimitidentifier_binding", "response", "=", "(", "nslimitidentifier_binding", ")", "obj", ".", "get_resource", "(", "service", ")", ";", "return", "response", ";", "}" ]
Use this API to fetch nslimitidentifier_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "nslimitidentifier_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nslimitidentifier_binding.java#L103-L108
gallandarakhneorg/afc
core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java
AlignedBox3d.setFromCorners
@Override public void setFromCorners(double x1, double y1, double z1, double x2, double y2, double z2) { """ Change the frame of the box. @param x1 is the coordinate of the first corner. @param y1 is the coordinate of the first corner. @param z1 is the coordinate of the first corner. @param x2 is the coordinate of the second corner. @param y2 is the coordinate of the second corner. @param z2 is the coordinate of the second corner. """ if (x1<x2) { this.minxProperty.set(x1); this.maxxProperty.set(x2); } else { this.minxProperty.set(x2); this.maxxProperty.set(x1); } if (y1<y2) { this.minyProperty.set(y1); this.maxyProperty.set(y2); } else { this.minyProperty.set(y2); this.maxyProperty.set(y1); } if (z1<z2) { this.minzProperty.set(z1); this.maxzProperty.set(z2); } else { this.minzProperty.set(z2); this.maxzProperty.set(z1); } }
java
@Override public void setFromCorners(double x1, double y1, double z1, double x2, double y2, double z2) { if (x1<x2) { this.minxProperty.set(x1); this.maxxProperty.set(x2); } else { this.minxProperty.set(x2); this.maxxProperty.set(x1); } if (y1<y2) { this.minyProperty.set(y1); this.maxyProperty.set(y2); } else { this.minyProperty.set(y2); this.maxyProperty.set(y1); } if (z1<z2) { this.minzProperty.set(z1); this.maxzProperty.set(z2); } else { this.minzProperty.set(z2); this.maxzProperty.set(z1); } }
[ "@", "Override", "public", "void", "setFromCorners", "(", "double", "x1", ",", "double", "y1", ",", "double", "z1", ",", "double", "x2", ",", "double", "y2", ",", "double", "z2", ")", "{", "if", "(", "x1", "<", "x2", ")", "{", "this", ".", "minxProperty", ".", "set", "(", "x1", ")", ";", "this", ".", "maxxProperty", ".", "set", "(", "x2", ")", ";", "}", "else", "{", "this", ".", "minxProperty", ".", "set", "(", "x2", ")", ";", "this", ".", "maxxProperty", ".", "set", "(", "x1", ")", ";", "}", "if", "(", "y1", "<", "y2", ")", "{", "this", ".", "minyProperty", ".", "set", "(", "y1", ")", ";", "this", ".", "maxyProperty", ".", "set", "(", "y2", ")", ";", "}", "else", "{", "this", ".", "minyProperty", ".", "set", "(", "y2", ")", ";", "this", ".", "maxyProperty", ".", "set", "(", "y1", ")", ";", "}", "if", "(", "z1", "<", "z2", ")", "{", "this", ".", "minzProperty", ".", "set", "(", "z1", ")", ";", "this", ".", "maxzProperty", ".", "set", "(", "z2", ")", ";", "}", "else", "{", "this", ".", "minzProperty", ".", "set", "(", "z2", ")", ";", "this", ".", "maxzProperty", ".", "set", "(", "z1", ")", ";", "}", "}" ]
Change the frame of the box. @param x1 is the coordinate of the first corner. @param y1 is the coordinate of the first corner. @param z1 is the coordinate of the first corner. @param x2 is the coordinate of the second corner. @param y2 is the coordinate of the second corner. @param z2 is the coordinate of the second corner.
[ "Change", "the", "frame", "of", "the", "box", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java#L368-L394
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAvailabilityEstimatePersistenceImpl.java
CommerceAvailabilityEstimatePersistenceImpl.findByGroupId
@Override public List<CommerceAvailabilityEstimate> findByGroupId(long groupId, int start, int end) { """ Returns a range of all the commerce availability estimates 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 CommerceAvailabilityEstimateModelImpl}. 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 availability estimates @param end the upper bound of the range of commerce availability estimates (not inclusive) @return the range of matching commerce availability estimates """ return findByGroupId(groupId, start, end, null); }
java
@Override public List<CommerceAvailabilityEstimate> findByGroupId(long groupId, int start, int end) { return findByGroupId(groupId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceAvailabilityEstimate", ">", "findByGroupId", "(", "long", "groupId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "start", ",", "end", ",", "null", ")", ";", "}" ]
Returns a range of all the commerce availability estimates 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 CommerceAvailabilityEstimateModelImpl}. 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 availability estimates @param end the upper bound of the range of commerce availability estimates (not inclusive) @return the range of matching commerce availability estimates
[ "Returns", "a", "range", "of", "all", "the", "commerce", "availability", "estimates", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceAvailabilityEstimatePersistenceImpl.java#L1556-L1560
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.scanForUpdates
public void scanForUpdates(String deviceName, String resourceGroupName) { """ Scans for updates on a data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent """ scanForUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().last().body(); }
java
public void scanForUpdates(String deviceName, String resourceGroupName) { scanForUpdatesWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().last().body(); }
[ "public", "void", "scanForUpdates", "(", "String", "deviceName", ",", "String", "resourceGroupName", ")", "{", "scanForUpdatesWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Scans for updates on a data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Scans", "for", "updates", "on", "a", "data", "box", "edge", "/", "gateway", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1682-L1684
googleapis/google-cloud-java
google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java
TableInfo.newBuilder
public static Builder newBuilder(TableId tableId, TableDefinition definition) { """ Returns a builder for a {@code TableInfo} object given table identity and definition. Use {@link StandardTableDefinition} to create simple BigQuery table. Use {@link ViewDefinition} to create a BigQuery view. Use {@link ExternalTableDefinition} to create a BigQuery a table backed by external data. """ return new BuilderImpl().setTableId(tableId).setDefinition(definition); }
java
public static Builder newBuilder(TableId tableId, TableDefinition definition) { return new BuilderImpl().setTableId(tableId).setDefinition(definition); }
[ "public", "static", "Builder", "newBuilder", "(", "TableId", "tableId", ",", "TableDefinition", "definition", ")", "{", "return", "new", "BuilderImpl", "(", ")", ".", "setTableId", "(", "tableId", ")", ".", "setDefinition", "(", "definition", ")", ";", "}" ]
Returns a builder for a {@code TableInfo} object given table identity and definition. Use {@link StandardTableDefinition} to create simple BigQuery table. Use {@link ViewDefinition} to create a BigQuery view. Use {@link ExternalTableDefinition} to create a BigQuery a table backed by external data.
[ "Returns", "a", "builder", "for", "a", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/TableInfo.java#L447-L449
indeedeng/util
util-core/src/main/java/com/indeed/util/core/TreeTimer.java
TreeTimer.leftpad
@Nonnull private static String leftpad(@Nonnull String s, int n, char padChar) { """ Left-pads a String with the specific padChar so it is length <code>n</code>. If the String is already at least length n, no padding is done. """ int diff = n - s.length(); if (diff <= 0) { return s; } StringBuilder buf = new StringBuilder(n); for (int i = 0; i < diff; ++i) { buf.append(padChar); } buf.append(s); return buf.toString(); }
java
@Nonnull private static String leftpad(@Nonnull String s, int n, char padChar) { int diff = n - s.length(); if (diff <= 0) { return s; } StringBuilder buf = new StringBuilder(n); for (int i = 0; i < diff; ++i) { buf.append(padChar); } buf.append(s); return buf.toString(); }
[ "@", "Nonnull", "private", "static", "String", "leftpad", "(", "@", "Nonnull", "String", "s", ",", "int", "n", ",", "char", "padChar", ")", "{", "int", "diff", "=", "n", "-", "s", ".", "length", "(", ")", ";", "if", "(", "diff", "<=", "0", ")", "{", "return", "s", ";", "}", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "n", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "diff", ";", "++", "i", ")", "{", "buf", ".", "append", "(", "padChar", ")", ";", "}", "buf", ".", "append", "(", "s", ")", ";", "return", "buf", ".", "toString", "(", ")", ";", "}" ]
Left-pads a String with the specific padChar so it is length <code>n</code>. If the String is already at least length n, no padding is done.
[ "Left", "-", "pads", "a", "String", "with", "the", "specific", "padChar", "so", "it", "is", "length", "<code", ">", "n<", "/", "code", ">", ".", "If", "the", "String", "is", "already", "at", "least", "length", "n", "no", "padding", "is", "done", "." ]
train
https://github.com/indeedeng/util/blob/332008426cf14b57e7fc3e817d9423e3f84fb922/util-core/src/main/java/com/indeed/util/core/TreeTimer.java#L90-L103
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobStreamsInner.java
JobStreamsInner.listByJobAsync
public Observable<Page<JobStreamInner>> listByJobAsync(final String resourceGroupName, final String automationAccountName, final String jobId, final String filter) { """ Retrieve a list of jobs streams identified by job id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job Id. @param filter The filter to apply on the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;JobStreamInner&gt; object """ return listByJobWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId, filter) .map(new Func1<ServiceResponse<Page<JobStreamInner>>, Page<JobStreamInner>>() { @Override public Page<JobStreamInner> call(ServiceResponse<Page<JobStreamInner>> response) { return response.body(); } }); }
java
public Observable<Page<JobStreamInner>> listByJobAsync(final String resourceGroupName, final String automationAccountName, final String jobId, final String filter) { return listByJobWithServiceResponseAsync(resourceGroupName, automationAccountName, jobId, filter) .map(new Func1<ServiceResponse<Page<JobStreamInner>>, Page<JobStreamInner>>() { @Override public Page<JobStreamInner> call(ServiceResponse<Page<JobStreamInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "JobStreamInner", ">", ">", "listByJobAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "automationAccountName", ",", "final", "String", "jobId", ",", "final", "String", "filter", ")", "{", "return", "listByJobWithServiceResponseAsync", "(", "resourceGroupName", ",", "automationAccountName", ",", "jobId", ",", "filter", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "JobStreamInner", ">", ">", ",", "Page", "<", "JobStreamInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "JobStreamInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "JobStreamInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Retrieve a list of jobs streams identified by job id. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param jobId The job Id. @param filter The filter to apply on the operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;JobStreamInner&gt; object
[ "Retrieve", "a", "list", "of", "jobs", "streams", "identified", "by", "job", "id", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/JobStreamsInner.java#L350-L358
crnk-project/crnk-framework
crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PreconditionUtil.java
PreconditionUtil.assertFalse
public static void assertFalse(boolean condition, String message, Object... args) { """ Asserts that a condition is true. If it isn't it throws an {@link AssertionError} with the given message. @param message the identifying message for the {@link AssertionError} ( <code>null</code> okay) @param condition condition to be checked """ verify(!condition, message, args); }
java
public static void assertFalse(boolean condition, String message, Object... args) { verify(!condition, message, args); }
[ "public", "static", "void", "assertFalse", "(", "boolean", "condition", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "verify", "(", "!", "condition", ",", "message", ",", "args", ")", ";", "}" ]
Asserts that a condition is true. If it isn't it throws an {@link AssertionError} with the given message. @param message the identifying message for the {@link AssertionError} ( <code>null</code> okay) @param condition condition to be checked
[ "Asserts", "that", "a", "condition", "is", "true", ".", "If", "it", "isn", "t", "it", "throws", "an", "{", "@link", "AssertionError", "}", "with", "the", "given", "message", "." ]
train
https://github.com/crnk-project/crnk-framework/blob/2fd3ef9a991788d46fd2e83b43c8ea37cbaf8681/crnk-core/src/main/java/io/crnk/core/engine/internal/utils/PreconditionUtil.java#L99-L101
Azure/azure-sdk-for-java
streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/TransformationsInner.java
TransformationsInner.getAsync
public Observable<TransformationInner> getAsync(String resourceGroupName, String jobName, String transformationName) { """ Gets details about the specified transformation. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param jobName The name of the streaming job. @param transformationName The name of the transformation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TransformationInner object """ return getWithServiceResponseAsync(resourceGroupName, jobName, transformationName).map(new Func1<ServiceResponseWithHeaders<TransformationInner, TransformationsGetHeaders>, TransformationInner>() { @Override public TransformationInner call(ServiceResponseWithHeaders<TransformationInner, TransformationsGetHeaders> response) { return response.body(); } }); }
java
public Observable<TransformationInner> getAsync(String resourceGroupName, String jobName, String transformationName) { return getWithServiceResponseAsync(resourceGroupName, jobName, transformationName).map(new Func1<ServiceResponseWithHeaders<TransformationInner, TransformationsGetHeaders>, TransformationInner>() { @Override public TransformationInner call(ServiceResponseWithHeaders<TransformationInner, TransformationsGetHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "TransformationInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "jobName", ",", "String", "transformationName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "jobName", ",", "transformationName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "TransformationInner", ",", "TransformationsGetHeaders", ">", ",", "TransformationInner", ">", "(", ")", "{", "@", "Override", "public", "TransformationInner", "call", "(", "ServiceResponseWithHeaders", "<", "TransformationInner", ",", "TransformationsGetHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets details about the specified transformation. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param jobName The name of the streaming job. @param transformationName The name of the transformation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the TransformationInner object
[ "Gets", "details", "about", "the", "specified", "transformation", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/TransformationsInner.java#L519-L526
scribejava/scribejava
scribejava-core/src/main/java/com/github/scribejava/core/utils/StreamUtils.java
StreamUtils.getStreamContents
public static String getStreamContents(InputStream is) throws IOException { """ Returns the stream contents as an UTF-8 encoded string @param is input stream @return string contents @throws java.io.IOException in any. SocketTimeout in example """ Preconditions.checkNotNull(is, "Cannot get String from a null object"); final char[] buffer = new char[0x10000]; final StringBuilder out = new StringBuilder(); try (Reader in = new InputStreamReader(is, "UTF-8")) { int read; do { read = in.read(buffer, 0, buffer.length); if (read > 0) { out.append(buffer, 0, read); } } while (read >= 0); } return out.toString(); }
java
public static String getStreamContents(InputStream is) throws IOException { Preconditions.checkNotNull(is, "Cannot get String from a null object"); final char[] buffer = new char[0x10000]; final StringBuilder out = new StringBuilder(); try (Reader in = new InputStreamReader(is, "UTF-8")) { int read; do { read = in.read(buffer, 0, buffer.length); if (read > 0) { out.append(buffer, 0, read); } } while (read >= 0); } return out.toString(); }
[ "public", "static", "String", "getStreamContents", "(", "InputStream", "is", ")", "throws", "IOException", "{", "Preconditions", ".", "checkNotNull", "(", "is", ",", "\"Cannot get String from a null object\"", ")", ";", "final", "char", "[", "]", "buffer", "=", "new", "char", "[", "0x10000", "]", ";", "final", "StringBuilder", "out", "=", "new", "StringBuilder", "(", ")", ";", "try", "(", "Reader", "in", "=", "new", "InputStreamReader", "(", "is", ",", "\"UTF-8\"", ")", ")", "{", "int", "read", ";", "do", "{", "read", "=", "in", ".", "read", "(", "buffer", ",", "0", ",", "buffer", ".", "length", ")", ";", "if", "(", "read", ">", "0", ")", "{", "out", ".", "append", "(", "buffer", ",", "0", ",", "read", ")", ";", "}", "}", "while", "(", "read", ">=", "0", ")", ";", "}", "return", "out", ".", "toString", "(", ")", ";", "}" ]
Returns the stream contents as an UTF-8 encoded string @param is input stream @return string contents @throws java.io.IOException in any. SocketTimeout in example
[ "Returns", "the", "stream", "contents", "as", "an", "UTF", "-", "8", "encoded", "string" ]
train
https://github.com/scribejava/scribejava/blob/030d76872fe371a84b5d05c6c3c33c34e8f611f1/scribejava-core/src/main/java/com/github/scribejava/core/utils/StreamUtils.java#L21-L35
CloudSlang/cs-actions
cs-vmware/src/main/java/io/cloudslang/content/vmware/services/VmService.java
VmService.getOsDescriptors
public Map<String, String> getOsDescriptors(HttpInputs httpInputs, VmInputs vmInputs, String delimiter) throws Exception { """ Method used to connect to data center to retrieve a list with all the guest operating system descriptors supported by the host system. @param httpInputs Object that has all the inputs necessary to made a connection to data center @param vmInputs Object that has all the specific inputs necessary to identify the targeted host system @param delimiter String that represents the delimiter needed in the result list @return Map with String as key and value that contains returnCode of the operation, a list that contains all the guest operating system descriptors supported by the host system or failure message and the exception if there is one @throws Exception """ ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { ManagedObjectReference environmentBrowserMor = new MorObjectHandler() .getEnvironmentBrowser(connectionResources, ManagedObjectType.ENVIRONMENT_BROWSER.getValue()); VirtualMachineConfigOption configOptions = connectionResources.getVimPortType() .queryConfigOption(environmentBrowserMor, null, connectionResources.getHostMor()); List<GuestOsDescriptor> guestOSDescriptors = configOptions.getGuestOSDescriptor(); return ResponseUtils.getResultsMap(ResponseUtils.getResponseStringFromCollection(guestOSDescriptors, delimiter), Outputs.RETURN_CODE_SUCCESS); } catch (Exception ex) { return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
java
public Map<String, String> getOsDescriptors(HttpInputs httpInputs, VmInputs vmInputs, String delimiter) throws Exception { ConnectionResources connectionResources = new ConnectionResources(httpInputs, vmInputs); try { ManagedObjectReference environmentBrowserMor = new MorObjectHandler() .getEnvironmentBrowser(connectionResources, ManagedObjectType.ENVIRONMENT_BROWSER.getValue()); VirtualMachineConfigOption configOptions = connectionResources.getVimPortType() .queryConfigOption(environmentBrowserMor, null, connectionResources.getHostMor()); List<GuestOsDescriptor> guestOSDescriptors = configOptions.getGuestOSDescriptor(); return ResponseUtils.getResultsMap(ResponseUtils.getResponseStringFromCollection(guestOSDescriptors, delimiter), Outputs.RETURN_CODE_SUCCESS); } catch (Exception ex) { return ResponseUtils.getResultsMap(ex.toString(), Outputs.RETURN_CODE_FAILURE); } finally { if (httpInputs.isCloseSession()) { connectionResources.getConnection().disconnect(); clearConnectionFromContext(httpInputs.getGlobalSessionObject()); } } }
[ "public", "Map", "<", "String", ",", "String", ">", "getOsDescriptors", "(", "HttpInputs", "httpInputs", ",", "VmInputs", "vmInputs", ",", "String", "delimiter", ")", "throws", "Exception", "{", "ConnectionResources", "connectionResources", "=", "new", "ConnectionResources", "(", "httpInputs", ",", "vmInputs", ")", ";", "try", "{", "ManagedObjectReference", "environmentBrowserMor", "=", "new", "MorObjectHandler", "(", ")", ".", "getEnvironmentBrowser", "(", "connectionResources", ",", "ManagedObjectType", ".", "ENVIRONMENT_BROWSER", ".", "getValue", "(", ")", ")", ";", "VirtualMachineConfigOption", "configOptions", "=", "connectionResources", ".", "getVimPortType", "(", ")", ".", "queryConfigOption", "(", "environmentBrowserMor", ",", "null", ",", "connectionResources", ".", "getHostMor", "(", ")", ")", ";", "List", "<", "GuestOsDescriptor", ">", "guestOSDescriptors", "=", "configOptions", ".", "getGuestOSDescriptor", "(", ")", ";", "return", "ResponseUtils", ".", "getResultsMap", "(", "ResponseUtils", ".", "getResponseStringFromCollection", "(", "guestOSDescriptors", ",", "delimiter", ")", ",", "Outputs", ".", "RETURN_CODE_SUCCESS", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "return", "ResponseUtils", ".", "getResultsMap", "(", "ex", ".", "toString", "(", ")", ",", "Outputs", ".", "RETURN_CODE_FAILURE", ")", ";", "}", "finally", "{", "if", "(", "httpInputs", ".", "isCloseSession", "(", ")", ")", "{", "connectionResources", ".", "getConnection", "(", ")", ".", "disconnect", "(", ")", ";", "clearConnectionFromContext", "(", "httpInputs", ".", "getGlobalSessionObject", "(", ")", ")", ";", "}", "}", "}" ]
Method used to connect to data center to retrieve a list with all the guest operating system descriptors supported by the host system. @param httpInputs Object that has all the inputs necessary to made a connection to data center @param vmInputs Object that has all the specific inputs necessary to identify the targeted host system @param delimiter String that represents the delimiter needed in the result list @return Map with String as key and value that contains returnCode of the operation, a list that contains all the guest operating system descriptors supported by the host system or failure message and the exception if there is one @throws Exception
[ "Method", "used", "to", "connect", "to", "data", "center", "to", "retrieve", "a", "list", "with", "all", "the", "guest", "operating", "system", "descriptors", "supported", "by", "the", "host", "system", "." ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-vmware/src/main/java/io/cloudslang/content/vmware/services/VmService.java#L52-L72
japgolly/svg-android
src/main/java/com/larvalabs/svgandroid/SVGBuilder.java
SVGBuilder.readFromAsset
public SVGBuilder readFromAsset(AssetManager assetMngr, String svgPath) throws IOException { """ Parse SVG data from an Android application asset. @param assetMngr the Android asset manager. @param svgPath the path to the SVG file in the application's assets. @throws IOException if there was a problem reading the file. """ this.data = assetMngr.open(svgPath); return this; }
java
public SVGBuilder readFromAsset(AssetManager assetMngr, String svgPath) throws IOException { this.data = assetMngr.open(svgPath); return this; }
[ "public", "SVGBuilder", "readFromAsset", "(", "AssetManager", "assetMngr", ",", "String", "svgPath", ")", "throws", "IOException", "{", "this", ".", "data", "=", "assetMngr", ".", "open", "(", "svgPath", ")", ";", "return", "this", ";", "}" ]
Parse SVG data from an Android application asset. @param assetMngr the Android asset manager. @param svgPath the path to the SVG file in the application's assets. @throws IOException if there was a problem reading the file.
[ "Parse", "SVG", "data", "from", "an", "Android", "application", "asset", "." ]
train
https://github.com/japgolly/svg-android/blob/823affb6110292abcb8c5f783f86217643307f27/src/main/java/com/larvalabs/svgandroid/SVGBuilder.java#L72-L75
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.getSubQuerySQL
private String getSubQuerySQL(Query subQuery) { """ Convert subQuery to SQL @param subQuery the subQuery value of SelectionCriteria """ ClassDescriptor cld = getRoot().cld.getRepository().getDescriptorFor(subQuery.getSearchClass()); String sql; if (subQuery instanceof QueryBySQL) { sql = ((QueryBySQL) subQuery).getSql(); } else { sql = new SqlSelectStatement(this, m_platform, cld, subQuery, m_logger).getStatement(); } return sql; }
java
private String getSubQuerySQL(Query subQuery) { ClassDescriptor cld = getRoot().cld.getRepository().getDescriptorFor(subQuery.getSearchClass()); String sql; if (subQuery instanceof QueryBySQL) { sql = ((QueryBySQL) subQuery).getSql(); } else { sql = new SqlSelectStatement(this, m_platform, cld, subQuery, m_logger).getStatement(); } return sql; }
[ "private", "String", "getSubQuerySQL", "(", "Query", "subQuery", ")", "{", "ClassDescriptor", "cld", "=", "getRoot", "(", ")", ".", "cld", ".", "getRepository", "(", ")", ".", "getDescriptorFor", "(", "subQuery", ".", "getSearchClass", "(", ")", ")", ";", "String", "sql", ";", "if", "(", "subQuery", "instanceof", "QueryBySQL", ")", "{", "sql", "=", "(", "(", "QueryBySQL", ")", "subQuery", ")", ".", "getSql", "(", ")", ";", "}", "else", "{", "sql", "=", "new", "SqlSelectStatement", "(", "this", ",", "m_platform", ",", "cld", ",", "subQuery", ",", "m_logger", ")", ".", "getStatement", "(", ")", ";", "}", "return", "sql", ";", "}" ]
Convert subQuery to SQL @param subQuery the subQuery value of SelectionCriteria
[ "Convert", "subQuery", "to", "SQL" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L982-L997
atomix/atomix
agent/src/main/java/io/atomix/agent/AtomixAgent.java
AtomixAgent.parseArgs
static Namespace parseArgs(String[] args, List<String> unknown) { """ Parses the command line arguments, returning an argparse4j namespace. @param args the arguments to parse @return the namespace """ ArgumentParser parser = createParser(); Namespace namespace = null; try { namespace = parser.parseKnownArgs(args, unknown); } catch (ArgumentParserException e) { parser.handleError(e); System.exit(1); } return namespace; }
java
static Namespace parseArgs(String[] args, List<String> unknown) { ArgumentParser parser = createParser(); Namespace namespace = null; try { namespace = parser.parseKnownArgs(args, unknown); } catch (ArgumentParserException e) { parser.handleError(e); System.exit(1); } return namespace; }
[ "static", "Namespace", "parseArgs", "(", "String", "[", "]", "args", ",", "List", "<", "String", ">", "unknown", ")", "{", "ArgumentParser", "parser", "=", "createParser", "(", ")", ";", "Namespace", "namespace", "=", "null", ";", "try", "{", "namespace", "=", "parser", ".", "parseKnownArgs", "(", "args", ",", "unknown", ")", ";", "}", "catch", "(", "ArgumentParserException", "e", ")", "{", "parser", ".", "handleError", "(", "e", ")", ";", "System", ".", "exit", "(", "1", ")", ";", "}", "return", "namespace", ";", "}" ]
Parses the command line arguments, returning an argparse4j namespace. @param args the arguments to parse @return the namespace
[ "Parses", "the", "command", "line", "arguments", "returning", "an", "argparse4j", "namespace", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/agent/src/main/java/io/atomix/agent/AtomixAgent.java#L89-L99
tango-controls/JTango
server/src/main/java/org/tango/server/export/TangoExporter.java
TangoExporter.exportAll
@Override public void exportAll() throws DevFailed { """ Build all devices of all classes that are is this executable @throws DevFailed """ // load tango db cache DatabaseFactory.getDatabase().loadCache(serverName, hostName); // special case for admin device final DeviceClassBuilder clazz = new DeviceClassBuilder(AdminDevice.class, Constants.ADMIN_SERVER_CLASS_NAME); deviceClassList.add(clazz); final DeviceImpl dev = buildDevice(Constants.ADMIN_DEVICE_DOMAIN + "/" + serverName, clazz); ((AdminDevice) dev.getBusinessObject()).setTangoExporter(this); ((AdminDevice) dev.getBusinessObject()).setClassList(deviceClassList); // load server class exportDevices(); // init polling pool config TangoCacheManager.initPoolConf(); // clear tango db cache (used only for server start-up phase) DatabaseFactory.getDatabase().clearCache(); }
java
@Override public void exportAll() throws DevFailed { // load tango db cache DatabaseFactory.getDatabase().loadCache(serverName, hostName); // special case for admin device final DeviceClassBuilder clazz = new DeviceClassBuilder(AdminDevice.class, Constants.ADMIN_SERVER_CLASS_NAME); deviceClassList.add(clazz); final DeviceImpl dev = buildDevice(Constants.ADMIN_DEVICE_DOMAIN + "/" + serverName, clazz); ((AdminDevice) dev.getBusinessObject()).setTangoExporter(this); ((AdminDevice) dev.getBusinessObject()).setClassList(deviceClassList); // load server class exportDevices(); // init polling pool config TangoCacheManager.initPoolConf(); // clear tango db cache (used only for server start-up phase) DatabaseFactory.getDatabase().clearCache(); }
[ "@", "Override", "public", "void", "exportAll", "(", ")", "throws", "DevFailed", "{", "// load tango db cache", "DatabaseFactory", ".", "getDatabase", "(", ")", ".", "loadCache", "(", "serverName", ",", "hostName", ")", ";", "// special case for admin device", "final", "DeviceClassBuilder", "clazz", "=", "new", "DeviceClassBuilder", "(", "AdminDevice", ".", "class", ",", "Constants", ".", "ADMIN_SERVER_CLASS_NAME", ")", ";", "deviceClassList", ".", "add", "(", "clazz", ")", ";", "final", "DeviceImpl", "dev", "=", "buildDevice", "(", "Constants", ".", "ADMIN_DEVICE_DOMAIN", "+", "\"/\"", "+", "serverName", ",", "clazz", ")", ";", "(", "(", "AdminDevice", ")", "dev", ".", "getBusinessObject", "(", ")", ")", ".", "setTangoExporter", "(", "this", ")", ";", "(", "(", "AdminDevice", ")", "dev", ".", "getBusinessObject", "(", ")", ")", ".", "setClassList", "(", "deviceClassList", ")", ";", "// load server class", "exportDevices", "(", ")", ";", "// init polling pool config", "TangoCacheManager", ".", "initPoolConf", "(", ")", ";", "// clear tango db cache (used only for server start-up phase)", "DatabaseFactory", ".", "getDatabase", "(", ")", ".", "clearCache", "(", ")", ";", "}" ]
Build all devices of all classes that are is this executable @throws DevFailed
[ "Build", "all", "devices", "of", "all", "classes", "that", "are", "is", "this", "executable" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/export/TangoExporter.java#L75-L94
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/Zealot.java
Zealot.getSqlInfoSimply
public static SqlInfo getSqlInfoSimply(String nsAtZealotId, Object paramObj) { """ 通过传入zealot xml文件对应的命名空间、zealot节点的ID以及参数对象(一般是JavaBean或者Map)的结合体,来简单快速的生成和获取sqlInfo信息(有参的SQL). @param nsAtZealotId xml命名空间nameSpace+@@+zealotId的值.如:"student@@queryStudentById" @param paramObj 参数对象(一般是JavaBean对象或者Map) @return 返回SqlInfo对象 """ String[] arr = nsAtZealotId.split(ZealotConst.SP_AT); if (arr.length != LEN) { throw new ValidFailException("nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值," + "如:'student@@queryStudentById'.其中student为nameSpace, queryStudentById为XML文件中SQL的zealotId."); } return getSqlInfo(arr[0], arr[1], paramObj); }
java
public static SqlInfo getSqlInfoSimply(String nsAtZealotId, Object paramObj) { String[] arr = nsAtZealotId.split(ZealotConst.SP_AT); if (arr.length != LEN) { throw new ValidFailException("nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值," + "如:'student@@queryStudentById'.其中student为nameSpace, queryStudentById为XML文件中SQL的zealotId."); } return getSqlInfo(arr[0], arr[1], paramObj); }
[ "public", "static", "SqlInfo", "getSqlInfoSimply", "(", "String", "nsAtZealotId", ",", "Object", "paramObj", ")", "{", "String", "[", "]", "arr", "=", "nsAtZealotId", ".", "split", "(", "ZealotConst", ".", "SP_AT", ")", ";", "if", "(", "arr", ".", "length", "!=", "LEN", ")", "{", "throw", "new", "ValidFailException", "(", "\"nsAtZealotId参数的值必须是xml文件中的 nameSpace + '@@' + zealotId 节点的值,\"", "+", "\"如:'student@@queryStudentById'.其中student为nameSpace, queryStudentById为XML文件中SQL的zealotId.\");", "", "", "}", "return", "getSqlInfo", "(", "arr", "[", "0", "]", ",", "arr", "[", "1", "]", ",", "paramObj", ")", ";", "}" ]
通过传入zealot xml文件对应的命名空间、zealot节点的ID以及参数对象(一般是JavaBean或者Map)的结合体,来简单快速的生成和获取sqlInfo信息(有参的SQL). @param nsAtZealotId xml命名空间nameSpace+@@+zealotId的值.如:"student@@queryStudentById" @param paramObj 参数对象(一般是JavaBean对象或者Map) @return 返回SqlInfo对象
[ "通过传入zealot", "xml文件对应的命名空间、zealot节点的ID以及参数对象", "(", "一般是JavaBean或者Map", ")", "的结合体,来简单快速的生成和获取sqlInfo信息", "(", "有参的SQL", ")", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/Zealot.java#L52-L59
atomix/catalyst
common/src/main/java/io/atomix/catalyst/util/PropertiesReader.java
PropertiesReader.getProperty
private <T> T getProperty(String property, Function<String, T> transformer) { """ Reads an arbitrary property. @param property The property name. @param transformer A transformer function with which to transform the property value to its appropriate type. @param <T> The property type. @return The property value. @throws ConfigurationException if the property is not present """ Assert.notNull(property, "property"); String value = properties.getProperty(property); if (value == null) throw new ConfigurationException("missing property: " + property); return transformer.apply(value); }
java
private <T> T getProperty(String property, Function<String, T> transformer) { Assert.notNull(property, "property"); String value = properties.getProperty(property); if (value == null) throw new ConfigurationException("missing property: " + property); return transformer.apply(value); }
[ "private", "<", "T", ">", "T", "getProperty", "(", "String", "property", ",", "Function", "<", "String", ",", "T", ">", "transformer", ")", "{", "Assert", ".", "notNull", "(", "property", ",", "\"property\"", ")", ";", "String", "value", "=", "properties", ".", "getProperty", "(", "property", ")", ";", "if", "(", "value", "==", "null", ")", "throw", "new", "ConfigurationException", "(", "\"missing property: \"", "+", "property", ")", ";", "return", "transformer", ".", "apply", "(", "value", ")", ";", "}" ]
Reads an arbitrary property. @param property The property name. @param transformer A transformer function with which to transform the property value to its appropriate type. @param <T> The property type. @return The property value. @throws ConfigurationException if the property is not present
[ "Reads", "an", "arbitrary", "property", "." ]
train
https://github.com/atomix/catalyst/blob/140e762cb975cd8ee1fd85119043c5b8bf917c5c/common/src/main/java/io/atomix/catalyst/util/PropertiesReader.java#L498-L504
interedition/collatex
collatex-core/src/main/java/eu/interedition/collatex/suffixtree/ActivePoint.java
ActivePoint.setPosition
void setPosition(Node<T, S> node, Edge<T, S> edge, int length) { """ Sets the active point to a new node, edge, length tripple. @param node @param edge @param length """ activeNode = node; activeEdge = edge; activeLength = length; }
java
void setPosition(Node<T, S> node, Edge<T, S> edge, int length) { activeNode = node; activeEdge = edge; activeLength = length; }
[ "void", "setPosition", "(", "Node", "<", "T", ",", "S", ">", "node", ",", "Edge", "<", "T", ",", "S", ">", "edge", ",", "int", "length", ")", "{", "activeNode", "=", "node", ";", "activeEdge", "=", "edge", ";", "activeLength", "=", "length", ";", "}" ]
Sets the active point to a new node, edge, length tripple. @param node @param edge @param length
[ "Sets", "the", "active", "point", "to", "a", "new", "node", "edge", "length", "tripple", "." ]
train
https://github.com/interedition/collatex/blob/76dd1fcc36047bc66a87d31142e72e98b5347821/collatex-core/src/main/java/eu/interedition/collatex/suffixtree/ActivePoint.java#L38-L42
infinispan/infinispan
core/src/main/java/org/infinispan/statetransfer/StateTransferInterceptor.java
StateTransferInterceptor.handleNonTxWriteCommand
private Object handleNonTxWriteCommand(InvocationContext ctx, WriteCommand command) { """ For non-tx write commands, we retry the command locally if the topology changed. But we only retry on the originator, and only if the command doesn't have the {@code CACHE_MODE_LOCAL} flag. """ if (trace) log.tracef("handleNonTxWriteCommand for command %s, topology id %d", command, command.getTopologyId()); updateTopologyId(command); // Only catch OutdatedTopologyExceptions on the originator if (!ctx.isOriginLocal()) { return invokeNext(ctx, command); } return invokeNextAndHandle(ctx, command, handleNonTxWriteReturn); }
java
private Object handleNonTxWriteCommand(InvocationContext ctx, WriteCommand command) { if (trace) log.tracef("handleNonTxWriteCommand for command %s, topology id %d", command, command.getTopologyId()); updateTopologyId(command); // Only catch OutdatedTopologyExceptions on the originator if (!ctx.isOriginLocal()) { return invokeNext(ctx, command); } return invokeNextAndHandle(ctx, command, handleNonTxWriteReturn); }
[ "private", "Object", "handleNonTxWriteCommand", "(", "InvocationContext", "ctx", ",", "WriteCommand", "command", ")", "{", "if", "(", "trace", ")", "log", ".", "tracef", "(", "\"handleNonTxWriteCommand for command %s, topology id %d\"", ",", "command", ",", "command", ".", "getTopologyId", "(", ")", ")", ";", "updateTopologyId", "(", "command", ")", ";", "// Only catch OutdatedTopologyExceptions on the originator", "if", "(", "!", "ctx", ".", "isOriginLocal", "(", ")", ")", "{", "return", "invokeNext", "(", "ctx", ",", "command", ")", ";", "}", "return", "invokeNextAndHandle", "(", "ctx", ",", "command", ",", "handleNonTxWriteReturn", ")", ";", "}" ]
For non-tx write commands, we retry the command locally if the topology changed. But we only retry on the originator, and only if the command doesn't have the {@code CACHE_MODE_LOCAL} flag.
[ "For", "non", "-", "tx", "write", "commands", "we", "retry", "the", "command", "locally", "if", "the", "topology", "changed", ".", "But", "we", "only", "retry", "on", "the", "originator", "and", "only", "if", "the", "command", "doesn", "t", "have", "the", "{" ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/statetransfer/StateTransferInterceptor.java#L299-L310
goldmansachs/reladomo
reladomo/src/main/java/com/gs/fw/common/mithra/cacheloader/CacheIndexBasedFilter.java
CacheIndexBasedFilter.timestampToAsofAttributeRelationiship
private static boolean timestampToAsofAttributeRelationiship(Map.Entry<Attribute, Attribute> each) { """ unsupported combination of businessDate timestamp -> businessDate asOf mapping. requires custom index """ return (each.getValue() != null && each.getValue().isAsOfAttribute()) && !each.getKey().isAsOfAttribute(); }
java
private static boolean timestampToAsofAttributeRelationiship(Map.Entry<Attribute, Attribute> each) { return (each.getValue() != null && each.getValue().isAsOfAttribute()) && !each.getKey().isAsOfAttribute(); }
[ "private", "static", "boolean", "timestampToAsofAttributeRelationiship", "(", "Map", ".", "Entry", "<", "Attribute", ",", "Attribute", ">", "each", ")", "{", "return", "(", "each", ".", "getValue", "(", ")", "!=", "null", "&&", "each", ".", "getValue", "(", ")", ".", "isAsOfAttribute", "(", ")", ")", "&&", "!", "each", ".", "getKey", "(", ")", ".", "isAsOfAttribute", "(", ")", ";", "}" ]
unsupported combination of businessDate timestamp -> businessDate asOf mapping. requires custom index
[ "unsupported", "combination", "of", "businessDate", "timestamp", "-", ">", "businessDate", "asOf", "mapping", ".", "requires", "custom", "index" ]
train
https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cacheloader/CacheIndexBasedFilter.java#L84-L87
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentPersistenceImpl.java
CommerceShipmentPersistenceImpl.findByGroupId
@Override public List<CommerceShipment> findByGroupId(long groupId) { """ Returns all the commerce shipments where groupId = &#63;. @param groupId the group ID @return the matching commerce shipments """ return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CommerceShipment> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CommerceShipment", ">", "findByGroupId", "(", "long", "groupId", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the commerce shipments where groupId = &#63;. @param groupId the group ID @return the matching commerce shipments
[ "Returns", "all", "the", "commerce", "shipments", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceShipmentPersistenceImpl.java#L122-L125
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPOutputHandler.java
PtoPOutputHandler.createControlNotFlushed
private ControlNotFlushed createControlNotFlushed(SIBUuid12 stream, long reqID) throws SIResourceException { """ Creates a NOTFLUSHED message for sending @param stream The UUID of the stream the message should be sent on. @param reqID The request ID that the message answers. @return the new NOTFLUSHED message. @throws SIResourceException if the message can't be created. """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createControlNotFlushed", new Object[] {stream, new Long(reqID)}); ControlNotFlushed notFlushedMsg; // Create new message try { notFlushedMsg = cmf.createNewControlNotFlushed(); } catch (MessageCreateFailedException e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.createControlNotFlushed", "1:1803:1.241", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exception(tc, e); SibTr.exit(tc, "createControlNotFlushed", e); } SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.PtoPOutputHandler", "1:1815:1.241", e } ); throw new SIResourceException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.PtoPOutputHandler", "1:1823:1.241", e }, null), e); } // As we are using the Guaranteed Header - set all the attributes as // well as the ones we want. SIMPUtils.setGuaranteedDeliveryProperties(notFlushedMsg, messageProcessor.getMessagingEngineUuid(), targetMEUuid, stream, null, destinationHandler.getUuid(), ProtocolType.UNICASTINPUT, GDConfig.PROTOCOL_VERSION); notFlushedMsg.setPriority(SIMPConstants.CTRL_MSG_PRIORITY); notFlushedMsg.setReliability(Reliability.ASSURED_PERSISTENT); notFlushedMsg.setRequestID(reqID); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createControlNotFlushed"); return notFlushedMsg; }
java
private ControlNotFlushed createControlNotFlushed(SIBUuid12 stream, long reqID) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createControlNotFlushed", new Object[] {stream, new Long(reqID)}); ControlNotFlushed notFlushedMsg; // Create new message try { notFlushedMsg = cmf.createNewControlNotFlushed(); } catch (MessageCreateFailedException e) { // FFDC FFDCFilter.processException( e, "com.ibm.ws.sib.processor.impl.PtoPOutputHandler.createControlNotFlushed", "1:1803:1.241", this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { SibTr.exception(tc, e); SibTr.exit(tc, "createControlNotFlushed", e); } SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.PtoPOutputHandler", "1:1815:1.241", e } ); throw new SIResourceException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0002", new Object[] { "com.ibm.ws.sib.processor.impl.PtoPOutputHandler", "1:1823:1.241", e }, null), e); } // As we are using the Guaranteed Header - set all the attributes as // well as the ones we want. SIMPUtils.setGuaranteedDeliveryProperties(notFlushedMsg, messageProcessor.getMessagingEngineUuid(), targetMEUuid, stream, null, destinationHandler.getUuid(), ProtocolType.UNICASTINPUT, GDConfig.PROTOCOL_VERSION); notFlushedMsg.setPriority(SIMPConstants.CTRL_MSG_PRIORITY); notFlushedMsg.setReliability(Reliability.ASSURED_PERSISTENT); notFlushedMsg.setRequestID(reqID); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createControlNotFlushed"); return notFlushedMsg; }
[ "private", "ControlNotFlushed", "createControlNotFlushed", "(", "SIBUuid12", "stream", ",", "long", "reqID", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"createControlNotFlushed\"", ",", "new", "Object", "[", "]", "{", "stream", ",", "new", "Long", "(", "reqID", ")", "}", ")", ";", "ControlNotFlushed", "notFlushedMsg", ";", "// Create new message", "try", "{", "notFlushedMsg", "=", "cmf", ".", "createNewControlNotFlushed", "(", ")", ";", "}", "catch", "(", "MessageCreateFailedException", "e", ")", "{", "// FFDC", "FFDCFilter", ".", "processException", "(", "e", ",", "\"com.ibm.ws.sib.processor.impl.PtoPOutputHandler.createControlNotFlushed\"", ",", "\"1:1803:1.241\"", ",", "this", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "{", "SibTr", ".", "exception", "(", "tc", ",", "e", ")", ";", "SibTr", ".", "exit", "(", "tc", ",", "\"createControlNotFlushed\"", ",", "e", ")", ";", "}", "SibTr", ".", "error", "(", "tc", ",", "\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.PtoPOutputHandler\"", ",", "\"1:1815:1.241\"", ",", "e", "}", ")", ";", "throw", "new", "SIResourceException", "(", "nls", ".", "getFormattedMessage", "(", "\"INTERNAL_MESSAGING_ERROR_CWSIP0002\"", ",", "new", "Object", "[", "]", "{", "\"com.ibm.ws.sib.processor.impl.PtoPOutputHandler\"", ",", "\"1:1823:1.241\"", ",", "e", "}", ",", "null", ")", ",", "e", ")", ";", "}", "// As we are using the Guaranteed Header - set all the attributes as", "// well as the ones we want.", "SIMPUtils", ".", "setGuaranteedDeliveryProperties", "(", "notFlushedMsg", ",", "messageProcessor", ".", "getMessagingEngineUuid", "(", ")", ",", "targetMEUuid", ",", "stream", ",", "null", ",", "destinationHandler", ".", "getUuid", "(", ")", ",", "ProtocolType", ".", "UNICASTINPUT", ",", "GDConfig", ".", "PROTOCOL_VERSION", ")", ";", "notFlushedMsg", ".", "setPriority", "(", "SIMPConstants", ".", "CTRL_MSG_PRIORITY", ")", ";", "notFlushedMsg", ".", "setReliability", "(", "Reliability", ".", "ASSURED_PERSISTENT", ")", ";", "notFlushedMsg", ".", "setRequestID", "(", "reqID", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"createControlNotFlushed\"", ")", ";", "return", "notFlushedMsg", ";", "}" ]
Creates a NOTFLUSHED message for sending @param stream The UUID of the stream the message should be sent on. @param reqID The request ID that the message answers. @return the new NOTFLUSHED message. @throws SIResourceException if the message can't be created.
[ "Creates", "a", "NOTFLUSHED", "message", "for", "sending" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/PtoPOutputHandler.java#L1700-L1765
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/StackTraceHelper.java
StackTraceHelper.getStackAsString
@Nonnull public static String getStackAsString (@Nullable final Throwable t, final boolean bOmitCommonStackTraceElements) { """ Get the stack trace of a throwable as string. @param t The throwable to be converted. May be <code>null</code>. @param bOmitCommonStackTraceElements If <code>true</code> the stack trace is cut after certain class names occurring. If <code>false</code> the complete stack trace is returned. @return the stack trace as newline separated string. If the passed Throwable is <code>null</code> an empty string is returned. """ if (t == null) return ""; // convert call stack to string final StringBuilder aCallStack = _getRecursiveStackAsStringBuilder (t, null, null, 1, bOmitCommonStackTraceElements); // avoid having a separator at the end -> remove the last char if (StringHelper.getLastChar (aCallStack) == STACKELEMENT_LINESEP) aCallStack.deleteCharAt (aCallStack.length () - 1); // no changes return aCallStack.toString (); }
java
@Nonnull public static String getStackAsString (@Nullable final Throwable t, final boolean bOmitCommonStackTraceElements) { if (t == null) return ""; // convert call stack to string final StringBuilder aCallStack = _getRecursiveStackAsStringBuilder (t, null, null, 1, bOmitCommonStackTraceElements); // avoid having a separator at the end -> remove the last char if (StringHelper.getLastChar (aCallStack) == STACKELEMENT_LINESEP) aCallStack.deleteCharAt (aCallStack.length () - 1); // no changes return aCallStack.toString (); }
[ "@", "Nonnull", "public", "static", "String", "getStackAsString", "(", "@", "Nullable", "final", "Throwable", "t", ",", "final", "boolean", "bOmitCommonStackTraceElements", ")", "{", "if", "(", "t", "==", "null", ")", "return", "\"\"", ";", "// convert call stack to string", "final", "StringBuilder", "aCallStack", "=", "_getRecursiveStackAsStringBuilder", "(", "t", ",", "null", ",", "null", ",", "1", ",", "bOmitCommonStackTraceElements", ")", ";", "// avoid having a separator at the end -> remove the last char", "if", "(", "StringHelper", ".", "getLastChar", "(", "aCallStack", ")", "==", "STACKELEMENT_LINESEP", ")", "aCallStack", ".", "deleteCharAt", "(", "aCallStack", ".", "length", "(", ")", "-", "1", ")", ";", "// no changes", "return", "aCallStack", ".", "toString", "(", ")", ";", "}" ]
Get the stack trace of a throwable as string. @param t The throwable to be converted. May be <code>null</code>. @param bOmitCommonStackTraceElements If <code>true</code> the stack trace is cut after certain class names occurring. If <code>false</code> the complete stack trace is returned. @return the stack trace as newline separated string. If the passed Throwable is <code>null</code> an empty string is returned.
[ "Get", "the", "stack", "trace", "of", "a", "throwable", "as", "string", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/StackTraceHelper.java#L207-L226
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/index/service/RowService.java
RowService.build
public static RowService build(ColumnFamilyStore baseCfs, ColumnDefinition columnDefinition) { """ Returns a new {@link RowService} for the specified {@link ColumnFamilyStore} and {@link ColumnDefinition}. @param baseCfs The {@link ColumnFamilyStore} associated to the managed index. @param columnDefinition The {@link ColumnDefinition} of the indexed column. @return A new {@link RowService} for the specified {@link ColumnFamilyStore} and {@link ColumnDefinition}. """ int clusteringPosition = baseCfs.metadata.clusteringColumns().size(); if (clusteringPosition > 0) { return new RowServiceWide(baseCfs, columnDefinition); } else { return new RowServiceSkinny(baseCfs, columnDefinition); } }
java
public static RowService build(ColumnFamilyStore baseCfs, ColumnDefinition columnDefinition) { int clusteringPosition = baseCfs.metadata.clusteringColumns().size(); if (clusteringPosition > 0) { return new RowServiceWide(baseCfs, columnDefinition); } else { return new RowServiceSkinny(baseCfs, columnDefinition); } }
[ "public", "static", "RowService", "build", "(", "ColumnFamilyStore", "baseCfs", ",", "ColumnDefinition", "columnDefinition", ")", "{", "int", "clusteringPosition", "=", "baseCfs", ".", "metadata", ".", "clusteringColumns", "(", ")", ".", "size", "(", ")", ";", "if", "(", "clusteringPosition", ">", "0", ")", "{", "return", "new", "RowServiceWide", "(", "baseCfs", ",", "columnDefinition", ")", ";", "}", "else", "{", "return", "new", "RowServiceSkinny", "(", "baseCfs", ",", "columnDefinition", ")", ";", "}", "}" ]
Returns a new {@link RowService} for the specified {@link ColumnFamilyStore} and {@link ColumnDefinition}. @param baseCfs The {@link ColumnFamilyStore} associated to the managed index. @param columnDefinition The {@link ColumnDefinition} of the indexed column. @return A new {@link RowService} for the specified {@link ColumnFamilyStore} and {@link ColumnDefinition}.
[ "Returns", "a", "new", "{", "@link", "RowService", "}", "for", "the", "specified", "{", "@link", "ColumnFamilyStore", "}", "and", "{", "@link", "ColumnDefinition", "}", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/service/RowService.java#L102-L109
assertthat/selenium-shutterbug
src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java
Shutterbug.shootPage
public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll, int scrollTimeout, boolean useDevicePixelRatio) { """ To be used when screen shooting the page and need to scroll while making screen shots, either vertically or horizontally or both directions (Chrome). @param driver WebDriver instance @param scroll ScrollStrategy How you need to scroll @param scrollTimeout Timeout to wait after scrolling and before taking screen shot @param useDevicePixelRatio whether or not take into account device pixel ratio @return PageSnapshot instance """ Browser browser = new Browser(driver, useDevicePixelRatio); browser.setScrollTimeout(scrollTimeout); PageSnapshot pageScreenshot = new PageSnapshot(driver, browser.getDevicePixelRatio()); switch (scroll) { case VIEWPORT_ONLY: pageScreenshot.setImage(browser.takeScreenshot()); break; case WHOLE_PAGE: pageScreenshot.setImage(browser.takeScreenshotEntirePage()); break; } return pageScreenshot; }
java
public static PageSnapshot shootPage(WebDriver driver, ScrollStrategy scroll, int scrollTimeout, boolean useDevicePixelRatio) { Browser browser = new Browser(driver, useDevicePixelRatio); browser.setScrollTimeout(scrollTimeout); PageSnapshot pageScreenshot = new PageSnapshot(driver, browser.getDevicePixelRatio()); switch (scroll) { case VIEWPORT_ONLY: pageScreenshot.setImage(browser.takeScreenshot()); break; case WHOLE_PAGE: pageScreenshot.setImage(browser.takeScreenshotEntirePage()); break; } return pageScreenshot; }
[ "public", "static", "PageSnapshot", "shootPage", "(", "WebDriver", "driver", ",", "ScrollStrategy", "scroll", ",", "int", "scrollTimeout", ",", "boolean", "useDevicePixelRatio", ")", "{", "Browser", "browser", "=", "new", "Browser", "(", "driver", ",", "useDevicePixelRatio", ")", ";", "browser", ".", "setScrollTimeout", "(", "scrollTimeout", ")", ";", "PageSnapshot", "pageScreenshot", "=", "new", "PageSnapshot", "(", "driver", ",", "browser", ".", "getDevicePixelRatio", "(", ")", ")", ";", "switch", "(", "scroll", ")", "{", "case", "VIEWPORT_ONLY", ":", "pageScreenshot", ".", "setImage", "(", "browser", ".", "takeScreenshot", "(", ")", ")", ";", "break", ";", "case", "WHOLE_PAGE", ":", "pageScreenshot", ".", "setImage", "(", "browser", ".", "takeScreenshotEntirePage", "(", ")", ")", ";", "break", ";", "}", "return", "pageScreenshot", ";", "}" ]
To be used when screen shooting the page and need to scroll while making screen shots, either vertically or horizontally or both directions (Chrome). @param driver WebDriver instance @param scroll ScrollStrategy How you need to scroll @param scrollTimeout Timeout to wait after scrolling and before taking screen shot @param useDevicePixelRatio whether or not take into account device pixel ratio @return PageSnapshot instance
[ "To", "be", "used", "when", "screen", "shooting", "the", "page", "and", "need", "to", "scroll", "while", "making", "screen", "shots", "either", "vertically", "or", "horizontally", "or", "both", "directions", "(", "Chrome", ")", "." ]
train
https://github.com/assertthat/selenium-shutterbug/blob/770d9b92423200d262c9ab70e40405921d81e262/src/main/java/com/assertthat/selenium_shutterbug/core/Shutterbug.java#L100-L114
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java
StructureTools.addGroupToStructure
public static Chain addGroupToStructure(Structure s, Group g, int model, Chain chainGuess, boolean clone ) { """ Adds a particular group to a structure. A new chain will be created if necessary. <p>When adding multiple groups, pass the return value of one call as the chainGuess parameter of the next call for efficiency. <pre> Chain guess = null; for(Group g : groups) { guess = addGroupToStructure(s, g, guess ); } </pre> @param s structure to receive the group @param g group to add @param chainGuess (optional) If not null, should be a chain from s. Used to improve performance when adding many groups from the same chain @param clone Indicates whether the input group should be cloned before being added to the new chain @return the chain g was added to """ synchronized(s) { // Find or create the chain String chainId = g.getChainId(); assert !chainId.isEmpty(); Chain chain; if(chainGuess != null && chainGuess.getId() == chainId) { // previously guessed chain chain = chainGuess; } else { // Try to guess chain = s.getChain(chainId, model); if(chain == null) { // no chain found chain = new ChainImpl(); chain.setId(chainId); Chain oldChain = g.getChain(); chain.setName(oldChain.getName()); EntityInfo oldEntityInfo = oldChain.getEntityInfo(); EntityInfo newEntityInfo; if(oldEntityInfo == null) { newEntityInfo = new EntityInfo(); s.addEntityInfo(newEntityInfo); } else { newEntityInfo = s.getEntityById(oldEntityInfo.getMolId()); if( newEntityInfo == null ) { newEntityInfo = new EntityInfo(oldEntityInfo); s.addEntityInfo(newEntityInfo); } } newEntityInfo.addChain(chain); chain.setEntityInfo(newEntityInfo); // TODO Do the seqres need to be cloned too? -SB 2016-10-7 chain.setSeqResGroups(oldChain.getSeqResGroups()); chain.setSeqMisMatches(oldChain.getSeqMisMatches()); s.addChain(chain,model); } } // Add cloned group if(clone) { g = (Group)g.clone(); } chain.addGroup(g); return chain; } }
java
public static Chain addGroupToStructure(Structure s, Group g, int model, Chain chainGuess, boolean clone ) { synchronized(s) { // Find or create the chain String chainId = g.getChainId(); assert !chainId.isEmpty(); Chain chain; if(chainGuess != null && chainGuess.getId() == chainId) { // previously guessed chain chain = chainGuess; } else { // Try to guess chain = s.getChain(chainId, model); if(chain == null) { // no chain found chain = new ChainImpl(); chain.setId(chainId); Chain oldChain = g.getChain(); chain.setName(oldChain.getName()); EntityInfo oldEntityInfo = oldChain.getEntityInfo(); EntityInfo newEntityInfo; if(oldEntityInfo == null) { newEntityInfo = new EntityInfo(); s.addEntityInfo(newEntityInfo); } else { newEntityInfo = s.getEntityById(oldEntityInfo.getMolId()); if( newEntityInfo == null ) { newEntityInfo = new EntityInfo(oldEntityInfo); s.addEntityInfo(newEntityInfo); } } newEntityInfo.addChain(chain); chain.setEntityInfo(newEntityInfo); // TODO Do the seqres need to be cloned too? -SB 2016-10-7 chain.setSeqResGroups(oldChain.getSeqResGroups()); chain.setSeqMisMatches(oldChain.getSeqMisMatches()); s.addChain(chain,model); } } // Add cloned group if(clone) { g = (Group)g.clone(); } chain.addGroup(g); return chain; } }
[ "public", "static", "Chain", "addGroupToStructure", "(", "Structure", "s", ",", "Group", "g", ",", "int", "model", ",", "Chain", "chainGuess", ",", "boolean", "clone", ")", "{", "synchronized", "(", "s", ")", "{", "// Find or create the chain", "String", "chainId", "=", "g", ".", "getChainId", "(", ")", ";", "assert", "!", "chainId", ".", "isEmpty", "(", ")", ";", "Chain", "chain", ";", "if", "(", "chainGuess", "!=", "null", "&&", "chainGuess", ".", "getId", "(", ")", "==", "chainId", ")", "{", "// previously guessed chain", "chain", "=", "chainGuess", ";", "}", "else", "{", "// Try to guess", "chain", "=", "s", ".", "getChain", "(", "chainId", ",", "model", ")", ";", "if", "(", "chain", "==", "null", ")", "{", "// no chain found", "chain", "=", "new", "ChainImpl", "(", ")", ";", "chain", ".", "setId", "(", "chainId", ")", ";", "Chain", "oldChain", "=", "g", ".", "getChain", "(", ")", ";", "chain", ".", "setName", "(", "oldChain", ".", "getName", "(", ")", ")", ";", "EntityInfo", "oldEntityInfo", "=", "oldChain", ".", "getEntityInfo", "(", ")", ";", "EntityInfo", "newEntityInfo", ";", "if", "(", "oldEntityInfo", "==", "null", ")", "{", "newEntityInfo", "=", "new", "EntityInfo", "(", ")", ";", "s", ".", "addEntityInfo", "(", "newEntityInfo", ")", ";", "}", "else", "{", "newEntityInfo", "=", "s", ".", "getEntityById", "(", "oldEntityInfo", ".", "getMolId", "(", ")", ")", ";", "if", "(", "newEntityInfo", "==", "null", ")", "{", "newEntityInfo", "=", "new", "EntityInfo", "(", "oldEntityInfo", ")", ";", "s", ".", "addEntityInfo", "(", "newEntityInfo", ")", ";", "}", "}", "newEntityInfo", ".", "addChain", "(", "chain", ")", ";", "chain", ".", "setEntityInfo", "(", "newEntityInfo", ")", ";", "// TODO Do the seqres need to be cloned too? -SB 2016-10-7", "chain", ".", "setSeqResGroups", "(", "oldChain", ".", "getSeqResGroups", "(", ")", ")", ";", "chain", ".", "setSeqMisMatches", "(", "oldChain", ".", "getSeqMisMatches", "(", ")", ")", ";", "s", ".", "addChain", "(", "chain", ",", "model", ")", ";", "}", "}", "// Add cloned group", "if", "(", "clone", ")", "{", "g", "=", "(", "Group", ")", "g", ".", "clone", "(", ")", ";", "}", "chain", ".", "addGroup", "(", "g", ")", ";", "return", "chain", ";", "}", "}" ]
Adds a particular group to a structure. A new chain will be created if necessary. <p>When adding multiple groups, pass the return value of one call as the chainGuess parameter of the next call for efficiency. <pre> Chain guess = null; for(Group g : groups) { guess = addGroupToStructure(s, g, guess ); } </pre> @param s structure to receive the group @param g group to add @param chainGuess (optional) If not null, should be a chain from s. Used to improve performance when adding many groups from the same chain @param clone Indicates whether the input group should be cloned before being added to the new chain @return the chain g was added to
[ "Adds", "a", "particular", "group", "to", "a", "structure", ".", "A", "new", "chain", "will", "be", "created", "if", "necessary", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/StructureTools.java#L525-L577
soi-toolkit/soi-toolkit-mule
commons/components/commons-xml/src/main/java/org/soitoolkit/commons/xml/XPathUtil.java
XPathUtil.getXml
public static String getXml(Node node, boolean indentXml, int indentSize) { """ Creates a string representation of the dom node. NOTE: The string can be formatted and indented with a specified indent size, but be aware that this is depending on a Xalan implementation of the XSLT library. @param node @param indentXml @param indentSize @return """ try { TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer; if (indentXml) { transformer = tf.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", new Integer(indentSize).toString()); } else { transformer = tf.newTransformer(new StreamSource(XPathUtil.class.getResourceAsStream("remove-whitespace.xsl"))); } //initialize StreamResult with File object to save to file StreamResult result = new StreamResult(new StringWriter()); DOMSource source = new DOMSource(node); transformer.transform(source, result); String xmlString = result.getWriter().toString(); return xmlString; } catch (Exception e) { throw new RuntimeException(e); } }
java
public static String getXml(Node node, boolean indentXml, int indentSize) { try { TransformerFactory tf = TransformerFactory.newInstance(); Transformer transformer; if (indentXml) { transformer = tf.newTransformer(); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", new Integer(indentSize).toString()); } else { transformer = tf.newTransformer(new StreamSource(XPathUtil.class.getResourceAsStream("remove-whitespace.xsl"))); } //initialize StreamResult with File object to save to file StreamResult result = new StreamResult(new StringWriter()); DOMSource source = new DOMSource(node); transformer.transform(source, result); String xmlString = result.getWriter().toString(); return xmlString; } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "String", "getXml", "(", "Node", "node", ",", "boolean", "indentXml", ",", "int", "indentSize", ")", "{", "try", "{", "TransformerFactory", "tf", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "Transformer", "transformer", ";", "if", "(", "indentXml", ")", "{", "transformer", "=", "tf", ".", "newTransformer", "(", ")", ";", "transformer", ".", "setOutputProperty", "(", "OutputKeys", ".", "INDENT", ",", "\"yes\"", ")", ";", "transformer", ".", "setOutputProperty", "(", "\"{http://xml.apache.org/xslt}indent-amount\"", ",", "new", "Integer", "(", "indentSize", ")", ".", "toString", "(", ")", ")", ";", "}", "else", "{", "transformer", "=", "tf", ".", "newTransformer", "(", "new", "StreamSource", "(", "XPathUtil", ".", "class", ".", "getResourceAsStream", "(", "\"remove-whitespace.xsl\"", ")", ")", ")", ";", "}", "//initialize StreamResult with File object to save to file", "StreamResult", "result", "=", "new", "StreamResult", "(", "new", "StringWriter", "(", ")", ")", ";", "DOMSource", "source", "=", "new", "DOMSource", "(", "node", ")", ";", "transformer", ".", "transform", "(", "source", ",", "result", ")", ";", "String", "xmlString", "=", "result", ".", "getWriter", "(", ")", ".", "toString", "(", ")", ";", "return", "xmlString", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Creates a string representation of the dom node. NOTE: The string can be formatted and indented with a specified indent size, but be aware that this is depending on a Xalan implementation of the XSLT library. @param node @param indentXml @param indentSize @return
[ "Creates", "a", "string", "representation", "of", "the", "dom", "node", ".", "NOTE", ":", "The", "string", "can", "be", "formatted", "and", "indented", "with", "a", "specified", "indent", "size", "but", "be", "aware", "that", "this", "is", "depending", "on", "a", "Xalan", "implementation", "of", "the", "XSLT", "library", "." ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-xml/src/main/java/org/soitoolkit/commons/xml/XPathUtil.java#L212-L235
nutzam/nutzboot
nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-elasticsearch/src/main/java/io/nutz/demo/simple/utils/ElasticsearchUtil.java
ElasticsearchUtil.createOrUpdateData
public void createOrUpdateData(String indexName, String type, List<NutMap> list) { """ 批量创建或更新文档 @param indexName 索引名 @param type 数据类型(表名) @param list 包含id和obj的NutMap集合对象 """ BulkRequestBuilder bulkRequest = getClient().prepareBulk(); if (list.size() > 0) { for (NutMap nutMap : list) { bulkRequest.add(getClient().prepareIndex(indexName, type).setId(nutMap.getString("id")).setSource(Lang.obj2map(nutMap.get("obj")))); } bulkRequest.execute().actionGet(); } }
java
public void createOrUpdateData(String indexName, String type, List<NutMap> list) { BulkRequestBuilder bulkRequest = getClient().prepareBulk(); if (list.size() > 0) { for (NutMap nutMap : list) { bulkRequest.add(getClient().prepareIndex(indexName, type).setId(nutMap.getString("id")).setSource(Lang.obj2map(nutMap.get("obj")))); } bulkRequest.execute().actionGet(); } }
[ "public", "void", "createOrUpdateData", "(", "String", "indexName", ",", "String", "type", ",", "List", "<", "NutMap", ">", "list", ")", "{", "BulkRequestBuilder", "bulkRequest", "=", "getClient", "(", ")", ".", "prepareBulk", "(", ")", ";", "if", "(", "list", ".", "size", "(", ")", ">", "0", ")", "{", "for", "(", "NutMap", "nutMap", ":", "list", ")", "{", "bulkRequest", ".", "add", "(", "getClient", "(", ")", ".", "prepareIndex", "(", "indexName", ",", "type", ")", ".", "setId", "(", "nutMap", ".", "getString", "(", "\"id\"", ")", ")", ".", "setSource", "(", "Lang", ".", "obj2map", "(", "nutMap", ".", "get", "(", "\"obj\"", ")", ")", ")", ")", ";", "}", "bulkRequest", ".", "execute", "(", ")", ".", "actionGet", "(", ")", ";", "}", "}" ]
批量创建或更新文档 @param indexName 索引名 @param type 数据类型(表名) @param list 包含id和obj的NutMap集合对象
[ "批量创建或更新文档" ]
train
https://github.com/nutzam/nutzboot/blob/fd33fd4fdce058eab594f28e4d3202f997e3c66a/nutzboot-demo/nutzboot-demo-simple/nutzboot-demo-simple-elasticsearch/src/main/java/io/nutz/demo/simple/utils/ElasticsearchUtil.java#L134-L142
jbundle/jbundle
app/program/screen/src/main/java/org/jbundle/app/program/screen/JavaButton.java
JavaButton.controlToField
public int controlToField() { """ Move the control's value to the field. @return An error value. """ int iErrorCode = super.controlToField(); if (m_classInfo != null) { TaskScheduler js = BaseApplet.getSharedInstance().getApplication().getTaskScheduler(); String strJob = Utility.addURLParam(null, DBParams.SCREEN, ".app.program.manual.util.WriteClassesScreen"); strJob = Utility.addURLParam(strJob, "fileName", m_classInfo.getField(ClassInfo.CLASS_SOURCE_FILE).toString()); strJob = Utility.addURLParam(strJob, "package", m_classInfo.getField(ClassInfo.CLASS_PACKAGE).toString()); strJob = Utility.addURLParam(strJob, "project", Converter.stripNonNumber(m_classInfo.getField(ClassInfo.CLASS_PROJECT_ID).toString())); strJob = Utility.addURLParam(strJob, DBParams.TASK, DBConstants.SAPPLET); // Screen class js.addTask(strJob); //BasePanel parentScreen = Screen.makeWindow(this.getParentScreen().getTask().getApplication()); //WriteJava screen = new WriteJava(null, null, parentScreen, null, ScreenConstants.DISPLAY_FIELD_DESC, m_classInfo.getField(ClassInfo.CLASS_SOURCE_FILE), m_classInfo.getField(ClassInfo.CLASS_PACKAGE)); //screen.writeFileDesc(); // Write the code //BasePanel panel = screen.getRootScreen(); //panel.free(); } return iErrorCode; }
java
public int controlToField() { int iErrorCode = super.controlToField(); if (m_classInfo != null) { TaskScheduler js = BaseApplet.getSharedInstance().getApplication().getTaskScheduler(); String strJob = Utility.addURLParam(null, DBParams.SCREEN, ".app.program.manual.util.WriteClassesScreen"); strJob = Utility.addURLParam(strJob, "fileName", m_classInfo.getField(ClassInfo.CLASS_SOURCE_FILE).toString()); strJob = Utility.addURLParam(strJob, "package", m_classInfo.getField(ClassInfo.CLASS_PACKAGE).toString()); strJob = Utility.addURLParam(strJob, "project", Converter.stripNonNumber(m_classInfo.getField(ClassInfo.CLASS_PROJECT_ID).toString())); strJob = Utility.addURLParam(strJob, DBParams.TASK, DBConstants.SAPPLET); // Screen class js.addTask(strJob); //BasePanel parentScreen = Screen.makeWindow(this.getParentScreen().getTask().getApplication()); //WriteJava screen = new WriteJava(null, null, parentScreen, null, ScreenConstants.DISPLAY_FIELD_DESC, m_classInfo.getField(ClassInfo.CLASS_SOURCE_FILE), m_classInfo.getField(ClassInfo.CLASS_PACKAGE)); //screen.writeFileDesc(); // Write the code //BasePanel panel = screen.getRootScreen(); //panel.free(); } return iErrorCode; }
[ "public", "int", "controlToField", "(", ")", "{", "int", "iErrorCode", "=", "super", ".", "controlToField", "(", ")", ";", "if", "(", "m_classInfo", "!=", "null", ")", "{", "TaskScheduler", "js", "=", "BaseApplet", ".", "getSharedInstance", "(", ")", ".", "getApplication", "(", ")", ".", "getTaskScheduler", "(", ")", ";", "String", "strJob", "=", "Utility", ".", "addURLParam", "(", "null", ",", "DBParams", ".", "SCREEN", ",", "\".app.program.manual.util.WriteClassesScreen\"", ")", ";", "strJob", "=", "Utility", ".", "addURLParam", "(", "strJob", ",", "\"fileName\"", ",", "m_classInfo", ".", "getField", "(", "ClassInfo", ".", "CLASS_SOURCE_FILE", ")", ".", "toString", "(", ")", ")", ";", "strJob", "=", "Utility", ".", "addURLParam", "(", "strJob", ",", "\"package\"", ",", "m_classInfo", ".", "getField", "(", "ClassInfo", ".", "CLASS_PACKAGE", ")", ".", "toString", "(", ")", ")", ";", "strJob", "=", "Utility", ".", "addURLParam", "(", "strJob", ",", "\"project\"", ",", "Converter", ".", "stripNonNumber", "(", "m_classInfo", ".", "getField", "(", "ClassInfo", ".", "CLASS_PROJECT_ID", ")", ".", "toString", "(", ")", ")", ")", ";", "strJob", "=", "Utility", ".", "addURLParam", "(", "strJob", ",", "DBParams", ".", "TASK", ",", "DBConstants", ".", "SAPPLET", ")", ";", "// Screen class", "js", ".", "addTask", "(", "strJob", ")", ";", "//BasePanel parentScreen = Screen.makeWindow(this.getParentScreen().getTask().getApplication());", "//WriteJava screen = new WriteJava(null, null, parentScreen, null, ScreenConstants.DISPLAY_FIELD_DESC, m_classInfo.getField(ClassInfo.CLASS_SOURCE_FILE), m_classInfo.getField(ClassInfo.CLASS_PACKAGE));", "//screen.writeFileDesc(); // Write the code", "//BasePanel panel = screen.getRootScreen();", "//panel.free();", "}", "return", "iErrorCode", ";", "}" ]
Move the control's value to the field. @return An error value.
[ "Move", "the", "control", "s", "value", "to", "the", "field", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/screen/JavaButton.java#L66-L85
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/persist/DataFileCache.java
DataFileCache.deleteOrResetFreePos
static void deleteOrResetFreePos(Database database, String filename) { """ This method deletes a data file or resets its free position. this is used only for nio files - not OOo files """ ScaledRAFile raFile = null; database.getFileAccess().removeElement(filename); // OOo related code if (database.isStoredFileAccess()) { return; } // OOo end if (!database.getFileAccess().isStreamElement(filename)) { return; } try { raFile = new ScaledRAFile(database, filename, false); raFile.seek(LONG_FREE_POS_POS); raFile.writeLong(INITIAL_FREE_POS); } catch (IOException e) { database.logger.appLog.logContext(e, null); } finally { if (raFile != null) { try { raFile.close(); } catch (IOException e) { database.logger.appLog.logContext(e, null); } } } }
java
static void deleteOrResetFreePos(Database database, String filename) { ScaledRAFile raFile = null; database.getFileAccess().removeElement(filename); // OOo related code if (database.isStoredFileAccess()) { return; } // OOo end if (!database.getFileAccess().isStreamElement(filename)) { return; } try { raFile = new ScaledRAFile(database, filename, false); raFile.seek(LONG_FREE_POS_POS); raFile.writeLong(INITIAL_FREE_POS); } catch (IOException e) { database.logger.appLog.logContext(e, null); } finally { if (raFile != null) { try { raFile.close(); } catch (IOException e) { database.logger.appLog.logContext(e, null); } } } }
[ "static", "void", "deleteOrResetFreePos", "(", "Database", "database", ",", "String", "filename", ")", "{", "ScaledRAFile", "raFile", "=", "null", ";", "database", ".", "getFileAccess", "(", ")", ".", "removeElement", "(", "filename", ")", ";", "// OOo related code", "if", "(", "database", ".", "isStoredFileAccess", "(", ")", ")", "{", "return", ";", "}", "// OOo end", "if", "(", "!", "database", ".", "getFileAccess", "(", ")", ".", "isStreamElement", "(", "filename", ")", ")", "{", "return", ";", "}", "try", "{", "raFile", "=", "new", "ScaledRAFile", "(", "database", ",", "filename", ",", "false", ")", ";", "raFile", ".", "seek", "(", "LONG_FREE_POS_POS", ")", ";", "raFile", ".", "writeLong", "(", "INITIAL_FREE_POS", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "database", ".", "logger", ".", "appLog", ".", "logContext", "(", "e", ",", "null", ")", ";", "}", "finally", "{", "if", "(", "raFile", "!=", "null", ")", "{", "try", "{", "raFile", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "database", ".", "logger", ".", "appLog", ".", "logContext", "(", "e", ",", "null", ")", ";", "}", "}", "}", "}" ]
This method deletes a data file or resets its free position. this is used only for nio files - not OOo files
[ "This", "method", "deletes", "a", "data", "file", "or", "resets", "its", "free", "position", ".", "this", "is", "used", "only", "for", "nio", "files", "-", "not", "OOo", "files" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/persist/DataFileCache.java#L949-L981
UrielCh/ovh-java-sdk
ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java
ApiOvhRouter.serviceName_network_ipNet_GET
public OvhNetwork serviceName_network_ipNet_GET(String serviceName, String ipNet) throws IOException { """ Get this object properties REST: GET /router/{serviceName}/network/{ipNet} @param serviceName [required] The internal name of your Router offer @param ipNet [required] Gateway IP / CIDR Netmask """ String qPath = "/router/{serviceName}/network/{ipNet}"; StringBuilder sb = path(qPath, serviceName, ipNet); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNetwork.class); }
java
public OvhNetwork serviceName_network_ipNet_GET(String serviceName, String ipNet) throws IOException { String qPath = "/router/{serviceName}/network/{ipNet}"; StringBuilder sb = path(qPath, serviceName, ipNet); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhNetwork.class); }
[ "public", "OvhNetwork", "serviceName_network_ipNet_GET", "(", "String", "serviceName", ",", "String", "ipNet", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/router/{serviceName}/network/{ipNet}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "serviceName", ",", "ipNet", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"GET\"", ",", "sb", ".", "toString", "(", ")", ",", "null", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhNetwork", ".", "class", ")", ";", "}" ]
Get this object properties REST: GET /router/{serviceName}/network/{ipNet} @param serviceName [required] The internal name of your Router offer @param ipNet [required] Gateway IP / CIDR Netmask
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-router/src/main/java/net/minidev/ovh/api/ApiOvhRouter.java#L274-L279
mailin-api/sendinblue-java-mvn
src/main/java/com/sendinblue/Sendinblue.java
Sendinblue.get_campaign_v2
public String get_campaign_v2(Map<String, Object> data) { """ /* Get a particular campaign detail. @param {Object} data contains json objects as a key value pair from HashMap. @options data {Integer} id: Unique Id of the campaign [Mandatory] """ String id = data.get("id").toString(); return get("campaign/" + id + "/detailsv2/", EMPTY_STRING); }
java
public String get_campaign_v2(Map<String, Object> data) { String id = data.get("id").toString(); return get("campaign/" + id + "/detailsv2/", EMPTY_STRING); }
[ "public", "String", "get_campaign_v2", "(", "Map", "<", "String", ",", "Object", ">", "data", ")", "{", "String", "id", "=", "data", ".", "get", "(", "\"id\"", ")", ".", "toString", "(", ")", ";", "return", "get", "(", "\"campaign/\"", "+", "id", "+", "\"/detailsv2/\"", ",", "EMPTY_STRING", ")", ";", "}" ]
/* Get a particular campaign detail. @param {Object} data contains json objects as a key value pair from HashMap. @options data {Integer} id: Unique Id of the campaign [Mandatory]
[ "/", "*", "Get", "a", "particular", "campaign", "detail", "." ]
train
https://github.com/mailin-api/sendinblue-java-mvn/blob/3a186b004003450f18d619aa084adc8d75086183/src/main/java/com/sendinblue/Sendinblue.java#L353-L356
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getYearlyRelativeDates
private void getYearlyRelativeDates(Calendar calendar, List<Date> dates) { """ Calculate start dates for a yearly relative recurrence. @param calendar current date @param dates array of start dates """ long startDate = calendar.getTimeInMillis(); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.MONTH, NumberHelper.getInt(m_monthNumber) - 1); int dayNumber = NumberHelper.getInt(m_dayNumber); while (moreDates(calendar, dates)) { if (dayNumber > 4) { setCalendarToLastRelativeDay(calendar); } else { setCalendarToOrdinalRelativeDay(calendar, dayNumber); } if (calendar.getTimeInMillis() > startDate) { dates.add(calendar.getTime()); if (!moreDates(calendar, dates)) { break; } } calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.YEAR, 1); } }
java
private void getYearlyRelativeDates(Calendar calendar, List<Date> dates) { long startDate = calendar.getTimeInMillis(); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.MONTH, NumberHelper.getInt(m_monthNumber) - 1); int dayNumber = NumberHelper.getInt(m_dayNumber); while (moreDates(calendar, dates)) { if (dayNumber > 4) { setCalendarToLastRelativeDay(calendar); } else { setCalendarToOrdinalRelativeDay(calendar, dayNumber); } if (calendar.getTimeInMillis() > startDate) { dates.add(calendar.getTime()); if (!moreDates(calendar, dates)) { break; } } calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.YEAR, 1); } }
[ "private", "void", "getYearlyRelativeDates", "(", "Calendar", "calendar", ",", "List", "<", "Date", ">", "dates", ")", "{", "long", "startDate", "=", "calendar", ".", "getTimeInMillis", "(", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "MONTH", ",", "NumberHelper", ".", "getInt", "(", "m_monthNumber", ")", "-", "1", ")", ";", "int", "dayNumber", "=", "NumberHelper", ".", "getInt", "(", "m_dayNumber", ")", ";", "while", "(", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "if", "(", "dayNumber", ">", "4", ")", "{", "setCalendarToLastRelativeDay", "(", "calendar", ")", ";", "}", "else", "{", "setCalendarToOrdinalRelativeDay", "(", "calendar", ",", "dayNumber", ")", ";", "}", "if", "(", "calendar", ".", "getTimeInMillis", "(", ")", ">", "startDate", ")", "{", "dates", ".", "add", "(", "calendar", ".", "getTime", "(", ")", ")", ";", "if", "(", "!", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "break", ";", "}", "}", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "calendar", ".", "add", "(", "Calendar", ".", "YEAR", ",", "1", ")", ";", "}", "}" ]
Calculate start dates for a yearly relative recurrence. @param calendar current date @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "yearly", "relative", "recurrence", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L569-L598
VoltDB/voltdb
src/frontend/org/voltdb/InvocationDispatcher.java
InvocationDispatcher.sendSentinel
public final void sendSentinel(long txnId, int partitionId) { """ Send a command log replay sentinel to the given partition. @param txnId @param partitionId """ final long initiatorHSId = m_cartographer.getHSIdForSinglePartitionMaster(partitionId); sendSentinel(txnId, initiatorHSId, -1, -1, true); }
java
public final void sendSentinel(long txnId, int partitionId) { final long initiatorHSId = m_cartographer.getHSIdForSinglePartitionMaster(partitionId); sendSentinel(txnId, initiatorHSId, -1, -1, true); }
[ "public", "final", "void", "sendSentinel", "(", "long", "txnId", ",", "int", "partitionId", ")", "{", "final", "long", "initiatorHSId", "=", "m_cartographer", ".", "getHSIdForSinglePartitionMaster", "(", "partitionId", ")", ";", "sendSentinel", "(", "txnId", ",", "initiatorHSId", ",", "-", "1", ",", "-", "1", ",", "true", ")", ";", "}" ]
Send a command log replay sentinel to the given partition. @param txnId @param partitionId
[ "Send", "a", "command", "log", "replay", "sentinel", "to", "the", "given", "partition", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/InvocationDispatcher.java#L898-L901
NoraUi/NoraUi
src/main/java/com/github/noraui/application/steps/Step.java
Step.displayConcernedElementsAtTheBeginningOfMethod
protected void displayConcernedElementsAtTheBeginningOfMethod(String methodName, List<String> concernedElements) { """ Display message (list of elements) at the beginning of method in logs. @param methodName is name of java method @param concernedElements is a list of concerned elements (example: authorized activities) """ logger.debug("{}: with {} concernedElements", methodName, concernedElements.size()); int i = 0; for (final String element : concernedElements) { i++; logger.debug(" element N°{}={}", i, element); } }
java
protected void displayConcernedElementsAtTheBeginningOfMethod(String methodName, List<String> concernedElements) { logger.debug("{}: with {} concernedElements", methodName, concernedElements.size()); int i = 0; for (final String element : concernedElements) { i++; logger.debug(" element N°{}={}", i, element); } }
[ "protected", "void", "displayConcernedElementsAtTheBeginningOfMethod", "(", "String", "methodName", ",", "List", "<", "String", ">", "concernedElements", ")", "{", "logger", ".", "debug", "(", "\"{}: with {} concernedElements\"", ",", "methodName", ",", "concernedElements", ".", "size", "(", ")", ")", ";", "int", "i", "=", "0", ";", "for", "(", "final", "String", "element", ":", "concernedElements", ")", "{", "i", "++", ";", "logger", ".", "debug", "(", "\" element N°{}={}\",", " ", ",", " ", "lement)", ";", "\r", "}", "}" ]
Display message (list of elements) at the beginning of method in logs. @param methodName is name of java method @param concernedElements is a list of concerned elements (example: authorized activities)
[ "Display", "message", "(", "list", "of", "elements", ")", "at", "the", "beginning", "of", "method", "in", "logs", "." ]
train
https://github.com/NoraUi/NoraUi/blob/5f491a3339c7d3c20d7207760bdaf2acdb8f260c/src/main/java/com/github/noraui/application/steps/Step.java#L861-L868
Terracotta-OSS/statistics
src/main/java/org/terracotta/statistics/derived/latency/DefaultLatencyHistogramStatistic.java
DefaultLatencyHistogramStatistic.tryExpire
private void tryExpire(boolean force, LongSupplier time) { """ Expire the histogram if it is time to expire it, or if force is true AND it is dirty """ long now = time.getAsLong(); if (force || now >= nextPruning) { nextPruning = now + pruningDelay; histogram.expire(now); } }
java
private void tryExpire(boolean force, LongSupplier time) { long now = time.getAsLong(); if (force || now >= nextPruning) { nextPruning = now + pruningDelay; histogram.expire(now); } }
[ "private", "void", "tryExpire", "(", "boolean", "force", ",", "LongSupplier", "time", ")", "{", "long", "now", "=", "time", ".", "getAsLong", "(", ")", ";", "if", "(", "force", "||", "now", ">=", "nextPruning", ")", "{", "nextPruning", "=", "now", "+", "pruningDelay", ";", "histogram", ".", "expire", "(", "now", ")", ";", "}", "}" ]
Expire the histogram if it is time to expire it, or if force is true AND it is dirty
[ "Expire", "the", "histogram", "if", "it", "is", "time", "to", "expire", "it", "or", "if", "force", "is", "true", "AND", "it", "is", "dirty" ]
train
https://github.com/Terracotta-OSS/statistics/blob/d24e4989b8c8dbe4f5210e49c7945d51b6585881/src/main/java/org/terracotta/statistics/derived/latency/DefaultLatencyHistogramStatistic.java#L169-L175
sirthias/parboiled
parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java
ParseTreeUtils.printNodeTree
public static <V> String printNodeTree(ParsingResult<V> parsingResult) { """ Creates a readable string represenation of the parse tree in the given {@link ParsingResult} object. @param parsingResult the parsing result containing the parse tree @return a new String """ checkArgNotNull(parsingResult, "parsingResult"); return printNodeTree(parsingResult, Predicates.<Node<V>>alwaysTrue(), Predicates.<Node<V>>alwaysTrue()); }
java
public static <V> String printNodeTree(ParsingResult<V> parsingResult) { checkArgNotNull(parsingResult, "parsingResult"); return printNodeTree(parsingResult, Predicates.<Node<V>>alwaysTrue(), Predicates.<Node<V>>alwaysTrue()); }
[ "public", "static", "<", "V", ">", "String", "printNodeTree", "(", "ParsingResult", "<", "V", ">", "parsingResult", ")", "{", "checkArgNotNull", "(", "parsingResult", ",", "\"parsingResult\"", ")", ";", "return", "printNodeTree", "(", "parsingResult", ",", "Predicates", ".", "<", "Node", "<", "V", ">", ">", "alwaysTrue", "(", ")", ",", "Predicates", ".", "<", "Node", "<", "V", ">", ">", "alwaysTrue", "(", ")", ")", ";", "}" ]
Creates a readable string represenation of the parse tree in the given {@link ParsingResult} object. @param parsingResult the parsing result containing the parse tree @return a new String
[ "Creates", "a", "readable", "string", "represenation", "of", "the", "parse", "tree", "in", "the", "given", "{", "@link", "ParsingResult", "}", "object", "." ]
train
https://github.com/sirthias/parboiled/blob/84f3ed43e3e171b4c6ab5e6ca6297d264a9d686a/parboiled-core/src/main/java/org/parboiled/support/ParseTreeUtils.java#L326-L329
apache/spark
common/network-common/src/main/java/org/apache/spark/network/TransportContext.java
TransportContext.initializePipeline
public TransportChannelHandler initializePipeline( SocketChannel channel, RpcHandler channelRpcHandler) { """ Initializes a client or server Netty Channel Pipeline which encodes/decodes messages and has a {@link org.apache.spark.network.server.TransportChannelHandler} to handle request or response messages. @param channel The channel to initialize. @param channelRpcHandler The RPC handler to use for the channel. @return Returns the created TransportChannelHandler, which includes a TransportClient that can be used to communicate on this channel. The TransportClient is directly associated with a ChannelHandler to ensure all users of the same channel get the same TransportClient object. """ try { TransportChannelHandler channelHandler = createChannelHandler(channel, channelRpcHandler); ChunkFetchRequestHandler chunkFetchHandler = createChunkFetchHandler(channelHandler, channelRpcHandler); ChannelPipeline pipeline = channel.pipeline() .addLast("encoder", ENCODER) .addLast(TransportFrameDecoder.HANDLER_NAME, NettyUtils.createFrameDecoder()) .addLast("decoder", DECODER) .addLast("idleStateHandler", new IdleStateHandler(0, 0, conf.connectionTimeoutMs() / 1000)) // NOTE: Chunks are currently guaranteed to be returned in the order of request, but this // would require more logic to guarantee if this were not part of the same event loop. .addLast("handler", channelHandler); // Use a separate EventLoopGroup to handle ChunkFetchRequest messages for shuffle rpcs. if (chunkFetchWorkers != null) { pipeline.addLast(chunkFetchWorkers, "chunkFetchHandler", chunkFetchHandler); } return channelHandler; } catch (RuntimeException e) { logger.error("Error while initializing Netty pipeline", e); throw e; } }
java
public TransportChannelHandler initializePipeline( SocketChannel channel, RpcHandler channelRpcHandler) { try { TransportChannelHandler channelHandler = createChannelHandler(channel, channelRpcHandler); ChunkFetchRequestHandler chunkFetchHandler = createChunkFetchHandler(channelHandler, channelRpcHandler); ChannelPipeline pipeline = channel.pipeline() .addLast("encoder", ENCODER) .addLast(TransportFrameDecoder.HANDLER_NAME, NettyUtils.createFrameDecoder()) .addLast("decoder", DECODER) .addLast("idleStateHandler", new IdleStateHandler(0, 0, conf.connectionTimeoutMs() / 1000)) // NOTE: Chunks are currently guaranteed to be returned in the order of request, but this // would require more logic to guarantee if this were not part of the same event loop. .addLast("handler", channelHandler); // Use a separate EventLoopGroup to handle ChunkFetchRequest messages for shuffle rpcs. if (chunkFetchWorkers != null) { pipeline.addLast(chunkFetchWorkers, "chunkFetchHandler", chunkFetchHandler); } return channelHandler; } catch (RuntimeException e) { logger.error("Error while initializing Netty pipeline", e); throw e; } }
[ "public", "TransportChannelHandler", "initializePipeline", "(", "SocketChannel", "channel", ",", "RpcHandler", "channelRpcHandler", ")", "{", "try", "{", "TransportChannelHandler", "channelHandler", "=", "createChannelHandler", "(", "channel", ",", "channelRpcHandler", ")", ";", "ChunkFetchRequestHandler", "chunkFetchHandler", "=", "createChunkFetchHandler", "(", "channelHandler", ",", "channelRpcHandler", ")", ";", "ChannelPipeline", "pipeline", "=", "channel", ".", "pipeline", "(", ")", ".", "addLast", "(", "\"encoder\"", ",", "ENCODER", ")", ".", "addLast", "(", "TransportFrameDecoder", ".", "HANDLER_NAME", ",", "NettyUtils", ".", "createFrameDecoder", "(", ")", ")", ".", "addLast", "(", "\"decoder\"", ",", "DECODER", ")", ".", "addLast", "(", "\"idleStateHandler\"", ",", "new", "IdleStateHandler", "(", "0", ",", "0", ",", "conf", ".", "connectionTimeoutMs", "(", ")", "/", "1000", ")", ")", "// NOTE: Chunks are currently guaranteed to be returned in the order of request, but this", "// would require more logic to guarantee if this were not part of the same event loop.", ".", "addLast", "(", "\"handler\"", ",", "channelHandler", ")", ";", "// Use a separate EventLoopGroup to handle ChunkFetchRequest messages for shuffle rpcs.", "if", "(", "chunkFetchWorkers", "!=", "null", ")", "{", "pipeline", ".", "addLast", "(", "chunkFetchWorkers", ",", "\"chunkFetchHandler\"", ",", "chunkFetchHandler", ")", ";", "}", "return", "channelHandler", ";", "}", "catch", "(", "RuntimeException", "e", ")", "{", "logger", ".", "error", "(", "\"Error while initializing Netty pipeline\"", ",", "e", ")", ";", "throw", "e", ";", "}", "}" ]
Initializes a client or server Netty Channel Pipeline which encodes/decodes messages and has a {@link org.apache.spark.network.server.TransportChannelHandler} to handle request or response messages. @param channel The channel to initialize. @param channelRpcHandler The RPC handler to use for the channel. @return Returns the created TransportChannelHandler, which includes a TransportClient that can be used to communicate on this channel. The TransportClient is directly associated with a ChannelHandler to ensure all users of the same channel get the same TransportClient object.
[ "Initializes", "a", "client", "or", "server", "Netty", "Channel", "Pipeline", "which", "encodes", "/", "decodes", "messages", "and", "has", "a", "{", "@link", "org", ".", "apache", ".", "spark", ".", "network", ".", "server", ".", "TransportChannelHandler", "}", "to", "handle", "request", "or", "response", "messages", "." ]
train
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/TransportContext.java#L185-L210
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java
ValidationUtils.validate3NonNegative
public static int[] validate3NonNegative(int[] data, String paramName) { """ Reformats the input array to a length 3 array and checks that all values >= 0. If the array is length 1, returns [a, a, a] If the array is length 3, returns the array. @param data An array @param paramName The param name, for error reporting @return An int array of length 3 that represents the input """ validateNonNegative(data, paramName); return validate3(data, paramName); }
java
public static int[] validate3NonNegative(int[] data, String paramName){ validateNonNegative(data, paramName); return validate3(data, paramName); }
[ "public", "static", "int", "[", "]", "validate3NonNegative", "(", "int", "[", "]", "data", ",", "String", "paramName", ")", "{", "validateNonNegative", "(", "data", ",", "paramName", ")", ";", "return", "validate3", "(", "data", ",", "paramName", ")", ";", "}" ]
Reformats the input array to a length 3 array and checks that all values >= 0. If the array is length 1, returns [a, a, a] If the array is length 3, returns the array. @param data An array @param paramName The param name, for error reporting @return An int array of length 3 that represents the input
[ "Reformats", "the", "input", "array", "to", "a", "length", "3", "array", "and", "checks", "that", "all", "values", ">", "=", "0", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/util/ValidationUtils.java#L230-L233
alibaba/otter
node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageParser.java
MessageParser.copyEventColumn
private EventColumn copyEventColumn(Column column, boolean isUpdate, TableInfoHolder tableHolder) { """ 把 erosa-protocol's Column 转化成 otter's model EventColumn. @param column @return """ EventColumn eventColumn = new EventColumn(); eventColumn.setIndex(column.getIndex()); eventColumn.setKey(column.getIsKey()); eventColumn.setNull(column.getIsNull()); eventColumn.setColumnName(column.getName()); eventColumn.setColumnValue(column.getValue()); eventColumn.setUpdate(isUpdate); eventColumn.setColumnType(column.getSqlType()); if (tableHolder != null && tableHolder.getTable() != null && (tableHolder.isUseTableTransform() || tableHolder.isOracle())) { org.apache.ddlutils.model.Column dbColumn = tableHolder.getTable().findColumn(column.getName(), false); if (dbColumn == null) { // 可能存在ddl,重新reload一下table tableHolder.reload(); dbColumn = tableHolder.getTable().findColumn(column.getName(), false); } if (dbColumn != null) { int sqlType = dbColumn.getTypeCode(); if (sqlType != column.getSqlType()) { // 针对oracle的erosa给出的字段为非标准的jdbc,需要做一次类型反查 eventColumn.setColumnType(sqlType); logger.info("table [{}] column [{}] is not match , MeType: {}, EType {}", new Object[] { tableHolder.getTable().getName(), column.getName(), sqlType, column.getSqlType() }); } } } return eventColumn; }
java
private EventColumn copyEventColumn(Column column, boolean isUpdate, TableInfoHolder tableHolder) { EventColumn eventColumn = new EventColumn(); eventColumn.setIndex(column.getIndex()); eventColumn.setKey(column.getIsKey()); eventColumn.setNull(column.getIsNull()); eventColumn.setColumnName(column.getName()); eventColumn.setColumnValue(column.getValue()); eventColumn.setUpdate(isUpdate); eventColumn.setColumnType(column.getSqlType()); if (tableHolder != null && tableHolder.getTable() != null && (tableHolder.isUseTableTransform() || tableHolder.isOracle())) { org.apache.ddlutils.model.Column dbColumn = tableHolder.getTable().findColumn(column.getName(), false); if (dbColumn == null) { // 可能存在ddl,重新reload一下table tableHolder.reload(); dbColumn = tableHolder.getTable().findColumn(column.getName(), false); } if (dbColumn != null) { int sqlType = dbColumn.getTypeCode(); if (sqlType != column.getSqlType()) { // 针对oracle的erosa给出的字段为非标准的jdbc,需要做一次类型反查 eventColumn.setColumnType(sqlType); logger.info("table [{}] column [{}] is not match , MeType: {}, EType {}", new Object[] { tableHolder.getTable().getName(), column.getName(), sqlType, column.getSqlType() }); } } } return eventColumn; }
[ "private", "EventColumn", "copyEventColumn", "(", "Column", "column", ",", "boolean", "isUpdate", ",", "TableInfoHolder", "tableHolder", ")", "{", "EventColumn", "eventColumn", "=", "new", "EventColumn", "(", ")", ";", "eventColumn", ".", "setIndex", "(", "column", ".", "getIndex", "(", ")", ")", ";", "eventColumn", ".", "setKey", "(", "column", ".", "getIsKey", "(", ")", ")", ";", "eventColumn", ".", "setNull", "(", "column", ".", "getIsNull", "(", ")", ")", ";", "eventColumn", ".", "setColumnName", "(", "column", ".", "getName", "(", ")", ")", ";", "eventColumn", ".", "setColumnValue", "(", "column", ".", "getValue", "(", ")", ")", ";", "eventColumn", ".", "setUpdate", "(", "isUpdate", ")", ";", "eventColumn", ".", "setColumnType", "(", "column", ".", "getSqlType", "(", ")", ")", ";", "if", "(", "tableHolder", "!=", "null", "&&", "tableHolder", ".", "getTable", "(", ")", "!=", "null", "&&", "(", "tableHolder", ".", "isUseTableTransform", "(", ")", "||", "tableHolder", ".", "isOracle", "(", ")", ")", ")", "{", "org", ".", "apache", ".", "ddlutils", ".", "model", ".", "Column", "dbColumn", "=", "tableHolder", ".", "getTable", "(", ")", ".", "findColumn", "(", "column", ".", "getName", "(", ")", ",", "false", ")", ";", "if", "(", "dbColumn", "==", "null", ")", "{", "// 可能存在ddl,重新reload一下table", "tableHolder", ".", "reload", "(", ")", ";", "dbColumn", "=", "tableHolder", ".", "getTable", "(", ")", ".", "findColumn", "(", "column", ".", "getName", "(", ")", ",", "false", ")", ";", "}", "if", "(", "dbColumn", "!=", "null", ")", "{", "int", "sqlType", "=", "dbColumn", ".", "getTypeCode", "(", ")", ";", "if", "(", "sqlType", "!=", "column", ".", "getSqlType", "(", ")", ")", "{", "// 针对oracle的erosa给出的字段为非标准的jdbc,需要做一次类型反查", "eventColumn", ".", "setColumnType", "(", "sqlType", ")", ";", "logger", ".", "info", "(", "\"table [{}] column [{}] is not match , MeType: {}, EType {}\"", ",", "new", "Object", "[", "]", "{", "tableHolder", ".", "getTable", "(", ")", ".", "getName", "(", ")", ",", "column", ".", "getName", "(", ")", ",", "sqlType", ",", "column", ".", "getSqlType", "(", ")", "}", ")", ";", "}", "}", "}", "return", "eventColumn", ";", "}" ]
把 erosa-protocol's Column 转化成 otter's model EventColumn. @param column @return
[ "把", "erosa", "-", "protocol", "s", "Column", "转化成", "otter", "s", "model", "EventColumn", "." ]
train
https://github.com/alibaba/otter/blob/c7b5f94a0dd162e01ddffaf3a63cade7d23fca55/node/etl/src/main/java/com/alibaba/otter/node/etl/select/selector/MessageParser.java#L656-L687
ngageoint/geopackage-java
src/main/java/mil/nga/geopackage/GeoPackageCache.java
GeoPackageCache.getOrNoCacheOpen
public GeoPackage getOrNoCacheOpen(String name, File file) { """ Get the cached GeoPackage or open the GeoPackage file without caching it @param name GeoPackage name @param file GeoPackage file @return GeoPackage @since 3.1.0 """ return getOrOpen(name, file, false); }
java
public GeoPackage getOrNoCacheOpen(String name, File file) { return getOrOpen(name, file, false); }
[ "public", "GeoPackage", "getOrNoCacheOpen", "(", "String", "name", ",", "File", "file", ")", "{", "return", "getOrOpen", "(", "name", ",", "file", ",", "false", ")", ";", "}" ]
Get the cached GeoPackage or open the GeoPackage file without caching it @param name GeoPackage name @param file GeoPackage file @return GeoPackage @since 3.1.0
[ "Get", "the", "cached", "GeoPackage", "or", "open", "the", "GeoPackage", "file", "without", "caching", "it" ]
train
https://github.com/ngageoint/geopackage-java/blob/889bffb5d18330a3f4bd89443acf7959ebe3a376/src/main/java/mil/nga/geopackage/GeoPackageCache.java#L68-L70
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcSession.java
CmsUgcSession.deleteContentValue
protected void deleteContentValue(CmsXmlContent content, Locale locale, String path) { """ Deletes the given value path from the content document.<p> @param content the content document @param locale the content locale @param path the value XPath """ boolean hasValue = content.hasValue(path, locale); if (hasValue) { int index = CmsXmlUtils.getXpathIndexInt(path) - 1; I_CmsXmlContentValue val = content.getValue(path, locale); if (index >= val.getMinOccurs()) { content.removeValue(path, locale, index); } else { val.setStringValue(m_cms, ""); } } }
java
protected void deleteContentValue(CmsXmlContent content, Locale locale, String path) { boolean hasValue = content.hasValue(path, locale); if (hasValue) { int index = CmsXmlUtils.getXpathIndexInt(path) - 1; I_CmsXmlContentValue val = content.getValue(path, locale); if (index >= val.getMinOccurs()) { content.removeValue(path, locale, index); } else { val.setStringValue(m_cms, ""); } } }
[ "protected", "void", "deleteContentValue", "(", "CmsXmlContent", "content", ",", "Locale", "locale", ",", "String", "path", ")", "{", "boolean", "hasValue", "=", "content", ".", "hasValue", "(", "path", ",", "locale", ")", ";", "if", "(", "hasValue", ")", "{", "int", "index", "=", "CmsXmlUtils", ".", "getXpathIndexInt", "(", "path", ")", "-", "1", ";", "I_CmsXmlContentValue", "val", "=", "content", ".", "getValue", "(", "path", ",", "locale", ")", ";", "if", "(", "index", ">=", "val", ".", "getMinOccurs", "(", ")", ")", "{", "content", ".", "removeValue", "(", "path", ",", "locale", ",", "index", ")", ";", "}", "else", "{", "val", ".", "setStringValue", "(", "m_cms", ",", "\"\"", ")", ";", "}", "}", "}" ]
Deletes the given value path from the content document.<p> @param content the content document @param locale the content locale @param path the value XPath
[ "Deletes", "the", "given", "value", "path", "from", "the", "content", "document", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L634-L646
lessthanoptimal/ddogleg
src/org/ddogleg/solver/PolynomialSolver.java
PolynomialSolver.polynomialRootsEVD
@SuppressWarnings("ToArrayCallWithZeroLengthArrayArgument") public static Complex_F64[] polynomialRootsEVD(double... coefficients) { """ Finds real and imaginary roots in a polynomial using the companion matrix and Eigenvalue decomposition. The coefficients order is specified from smallest to largest. Example, 5 + 6*x + 7*x^2 + 8*x^3 = [5,6,7,8] @param coefficients Polynomial coefficients from smallest to largest. @return The found roots. """ PolynomialRoots alg = new RootFinderCompanion(); if( !alg.process( Polynomial.wrap(coefficients)) ) throw new IllegalArgumentException("Algorithm failed, was the input bad?"); List<Complex_F64> coefs = alg.getRoots(); return coefs.toArray(new Complex_F64[0]); }
java
@SuppressWarnings("ToArrayCallWithZeroLengthArrayArgument") public static Complex_F64[] polynomialRootsEVD(double... coefficients) { PolynomialRoots alg = new RootFinderCompanion(); if( !alg.process( Polynomial.wrap(coefficients)) ) throw new IllegalArgumentException("Algorithm failed, was the input bad?"); List<Complex_F64> coefs = alg.getRoots(); return coefs.toArray(new Complex_F64[0]); }
[ "@", "SuppressWarnings", "(", "\"ToArrayCallWithZeroLengthArrayArgument\"", ")", "public", "static", "Complex_F64", "[", "]", "polynomialRootsEVD", "(", "double", "...", "coefficients", ")", "{", "PolynomialRoots", "alg", "=", "new", "RootFinderCompanion", "(", ")", ";", "if", "(", "!", "alg", ".", "process", "(", "Polynomial", ".", "wrap", "(", "coefficients", ")", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"Algorithm failed, was the input bad?\"", ")", ";", "List", "<", "Complex_F64", ">", "coefs", "=", "alg", ".", "getRoots", "(", ")", ";", "return", "coefs", ".", "toArray", "(", "new", "Complex_F64", "[", "0", "]", ")", ";", "}" ]
Finds real and imaginary roots in a polynomial using the companion matrix and Eigenvalue decomposition. The coefficients order is specified from smallest to largest. Example, 5 + 6*x + 7*x^2 + 8*x^3 = [5,6,7,8] @param coefficients Polynomial coefficients from smallest to largest. @return The found roots.
[ "Finds", "real", "and", "imaginary", "roots", "in", "a", "polynomial", "using", "the", "companion", "matrix", "and", "Eigenvalue", "decomposition", ".", "The", "coefficients", "order", "is", "specified", "from", "smallest", "to", "largest", ".", "Example", "5", "+", "6", "*", "x", "+", "7", "*", "x^2", "+", "8", "*", "x^3", "=", "[", "5", "6", "7", "8", "]" ]
train
https://github.com/lessthanoptimal/ddogleg/blob/3786bf448ba23d0e04962dd08c34fa68de276029/src/org/ddogleg/solver/PolynomialSolver.java#L66-L77
brettwooldridge/HikariCP
src/main/java/com/zaxxer/hikari/util/UtilityElf.java
UtilityElf.safeIsAssignableFrom
public static boolean safeIsAssignableFrom(Object obj, String className) { """ Checks whether an object is an instance of given type without throwing exception when the class is not loaded. @param obj the object to check @param className String class @return true if object is assignable from the type, false otherwise or when the class cannot be loaded """ try { Class<?> clazz = Class.forName(className); return clazz.isAssignableFrom(obj.getClass()); } catch (ClassNotFoundException ignored) { return false; } }
java
public static boolean safeIsAssignableFrom(Object obj, String className) { try { Class<?> clazz = Class.forName(className); return clazz.isAssignableFrom(obj.getClass()); } catch (ClassNotFoundException ignored) { return false; } }
[ "public", "static", "boolean", "safeIsAssignableFrom", "(", "Object", "obj", ",", "String", "className", ")", "{", "try", "{", "Class", "<", "?", ">", "clazz", "=", "Class", ".", "forName", "(", "className", ")", ";", "return", "clazz", ".", "isAssignableFrom", "(", "obj", ".", "getClass", "(", ")", ")", ";", "}", "catch", "(", "ClassNotFoundException", "ignored", ")", "{", "return", "false", ";", "}", "}" ]
Checks whether an object is an instance of given type without throwing exception when the class is not loaded. @param obj the object to check @param className String class @return true if object is assignable from the type, false otherwise or when the class cannot be loaded
[ "Checks", "whether", "an", "object", "is", "an", "instance", "of", "given", "type", "without", "throwing", "exception", "when", "the", "class", "is", "not", "loaded", "." ]
train
https://github.com/brettwooldridge/HikariCP/blob/c509ec1a3f1e19769ee69323972f339cf098ff4b/src/main/java/com/zaxxer/hikari/util/UtilityElf.java#L73-L80
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.searchGuildID
public void searchGuildID(String name, Callback<List<String>> callback) throws GuildWars2Exception, NullPointerException { """ For more info on guild Search API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/search">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param name guild name @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see GuildPermission guild permission info """ isParamValid(new ParamChecker(ParamType.GUILD, name)); gw2API.searchGuildID(name).enqueue(callback); }
java
public void searchGuildID(String name, Callback<List<String>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.GUILD, name)); gw2API.searchGuildID(name).enqueue(callback); }
[ "public", "void", "searchGuildID", "(", "String", "name", ",", "Callback", "<", "List", "<", "String", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ParamType", ".", "GUILD", ",", "name", ")", ")", ";", "gw2API", ".", "searchGuildID", "(", "name", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on guild Search API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/search">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param name guild name @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see GuildPermission guild permission info
[ "For", "more", "info", "on", "guild", "Search", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "guild", "/", "search", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1631-L1634
nextreports/nextreports-engine
src/ro/nextreports/engine/util/ReportUtil.java
ReportUtil.foundFunctionInGroupHeader
public static boolean foundFunctionInGroupHeader(ReportLayout layout, String groupName) { """ Test to see if a function is found in group header band @param layout report layout @param groupName group name @return true if a function is found in group header band, false otherwise """ List<Band> groupHeaderBands = layout.getGroupHeaderBands(); for (Band band : groupHeaderBands) { if (band.getName().equals(ReportLayout.GROUP_HEADER_BAND_NAME_PREFIX + groupName)) { return foundFunctionInBand(band); } } return false; }
java
public static boolean foundFunctionInGroupHeader(ReportLayout layout, String groupName) { List<Band> groupHeaderBands = layout.getGroupHeaderBands(); for (Band band : groupHeaderBands) { if (band.getName().equals(ReportLayout.GROUP_HEADER_BAND_NAME_PREFIX + groupName)) { return foundFunctionInBand(band); } } return false; }
[ "public", "static", "boolean", "foundFunctionInGroupHeader", "(", "ReportLayout", "layout", ",", "String", "groupName", ")", "{", "List", "<", "Band", ">", "groupHeaderBands", "=", "layout", ".", "getGroupHeaderBands", "(", ")", ";", "for", "(", "Band", "band", ":", "groupHeaderBands", ")", "{", "if", "(", "band", ".", "getName", "(", ")", ".", "equals", "(", "ReportLayout", ".", "GROUP_HEADER_BAND_NAME_PREFIX", "+", "groupName", ")", ")", "{", "return", "foundFunctionInBand", "(", "band", ")", ";", "}", "}", "return", "false", ";", "}" ]
Test to see if a function is found in group header band @param layout report layout @param groupName group name @return true if a function is found in group header band, false otherwise
[ "Test", "to", "see", "if", "a", "function", "is", "found", "in", "group", "header", "band" ]
train
https://github.com/nextreports/nextreports-engine/blob/a847575a9298b5fce63b88961190c5b83ddccc44/src/ro/nextreports/engine/util/ReportUtil.java#L1006-L1014
cdapio/tigon
tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/distributed/AbstractDistributedProgramRunner.java
AbstractDistributedProgramRunner.addCleanupListener
private TwillController addCleanupListener(TwillController controller, final File hConfFile, final File cConfFile, final Program program, final File programDir) { """ Adds a listener to the given TwillController to delete local temp files when the program has started/terminated. The local temp files could be removed once the program is started, since Twill would keep the files in HDFS and no long needs the local temp files once program is started. @return The same TwillController instance. """ final AtomicBoolean deleted = new AtomicBoolean(false); controller.addListener(new ServiceListenerAdapter() { @Override public void running() { cleanup(); } @Override public void terminated(Service.State from) { cleanup(); } @Override public void failed(Service.State from, Throwable failure) { cleanup(); } private void cleanup() { if (deleted.compareAndSet(false, true)) { LOG.debug("Cleanup tmp files for {}: {} {} {}", program.getName(), hConfFile, cConfFile, program.getJarLocation().toURI()); hConfFile.delete(); cConfFile.delete(); try { program.getJarLocation().delete(); } catch (IOException e) { LOG.warn("Failed to delete program jar {}", program.getJarLocation().toURI(), e); } try { FileUtils.deleteDirectory(programDir); } catch (IOException e) { LOG.warn("Failed to delete program directory {}", programDir, e); } } } }, Threads.SAME_THREAD_EXECUTOR); return controller; }
java
private TwillController addCleanupListener(TwillController controller, final File hConfFile, final File cConfFile, final Program program, final File programDir) { final AtomicBoolean deleted = new AtomicBoolean(false); controller.addListener(new ServiceListenerAdapter() { @Override public void running() { cleanup(); } @Override public void terminated(Service.State from) { cleanup(); } @Override public void failed(Service.State from, Throwable failure) { cleanup(); } private void cleanup() { if (deleted.compareAndSet(false, true)) { LOG.debug("Cleanup tmp files for {}: {} {} {}", program.getName(), hConfFile, cConfFile, program.getJarLocation().toURI()); hConfFile.delete(); cConfFile.delete(); try { program.getJarLocation().delete(); } catch (IOException e) { LOG.warn("Failed to delete program jar {}", program.getJarLocation().toURI(), e); } try { FileUtils.deleteDirectory(programDir); } catch (IOException e) { LOG.warn("Failed to delete program directory {}", programDir, e); } } } }, Threads.SAME_THREAD_EXECUTOR); return controller; }
[ "private", "TwillController", "addCleanupListener", "(", "TwillController", "controller", ",", "final", "File", "hConfFile", ",", "final", "File", "cConfFile", ",", "final", "Program", "program", ",", "final", "File", "programDir", ")", "{", "final", "AtomicBoolean", "deleted", "=", "new", "AtomicBoolean", "(", "false", ")", ";", "controller", ".", "addListener", "(", "new", "ServiceListenerAdapter", "(", ")", "{", "@", "Override", "public", "void", "running", "(", ")", "{", "cleanup", "(", ")", ";", "}", "@", "Override", "public", "void", "terminated", "(", "Service", ".", "State", "from", ")", "{", "cleanup", "(", ")", ";", "}", "@", "Override", "public", "void", "failed", "(", "Service", ".", "State", "from", ",", "Throwable", "failure", ")", "{", "cleanup", "(", ")", ";", "}", "private", "void", "cleanup", "(", ")", "{", "if", "(", "deleted", ".", "compareAndSet", "(", "false", ",", "true", ")", ")", "{", "LOG", ".", "debug", "(", "\"Cleanup tmp files for {}: {} {} {}\"", ",", "program", ".", "getName", "(", ")", ",", "hConfFile", ",", "cConfFile", ",", "program", ".", "getJarLocation", "(", ")", ".", "toURI", "(", ")", ")", ";", "hConfFile", ".", "delete", "(", ")", ";", "cConfFile", ".", "delete", "(", ")", ";", "try", "{", "program", ".", "getJarLocation", "(", ")", ".", "delete", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Failed to delete program jar {}\"", ",", "program", ".", "getJarLocation", "(", ")", ".", "toURI", "(", ")", ",", "e", ")", ";", "}", "try", "{", "FileUtils", ".", "deleteDirectory", "(", "programDir", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "LOG", ".", "warn", "(", "\"Failed to delete program directory {}\"", ",", "programDir", ",", "e", ")", ";", "}", "}", "}", "}", ",", "Threads", ".", "SAME_THREAD_EXECUTOR", ")", ";", "return", "controller", ";", "}" ]
Adds a listener to the given TwillController to delete local temp files when the program has started/terminated. The local temp files could be removed once the program is started, since Twill would keep the files in HDFS and no long needs the local temp files once program is started. @return The same TwillController instance.
[ "Adds", "a", "listener", "to", "the", "given", "TwillController", "to", "delete", "local", "temp", "files", "when", "the", "program", "has", "started", "/", "terminated", ".", "The", "local", "temp", "files", "could", "be", "removed", "once", "the", "program", "is", "started", "since", "Twill", "would", "keep", "the", "files", "in", "HDFS", "and", "no", "long", "needs", "the", "local", "temp", "files", "once", "program", "is", "started", "." ]
train
https://github.com/cdapio/tigon/blob/5be6dffd7c79519d1211bb08f75be7dcfbbad392/tigon-flow/src/main/java/co/cask/tigon/internal/app/runtime/distributed/AbstractDistributedProgramRunner.java#L184-L224
GoSimpleLLC/nbvcxz
src/main/java/me/gosimple/nbvcxz/Nbvcxz.java
Nbvcxz.calcEntropy
private double calcEntropy(final List<Match> matches, final boolean include_brute_force) { """ Helper method to calculate entropy from a list of matches. @param matches the list of matches @return the sum of the entropy in the list passed in """ double entropy = 0; for (Match match : matches) { if (include_brute_force || !(match instanceof BruteForceMatch)) { entropy += match.calculateEntropy(); } } return entropy; }
java
private double calcEntropy(final List<Match> matches, final boolean include_brute_force) { double entropy = 0; for (Match match : matches) { if (include_brute_force || !(match instanceof BruteForceMatch)) { entropy += match.calculateEntropy(); } } return entropy; }
[ "private", "double", "calcEntropy", "(", "final", "List", "<", "Match", ">", "matches", ",", "final", "boolean", "include_brute_force", ")", "{", "double", "entropy", "=", "0", ";", "for", "(", "Match", "match", ":", "matches", ")", "{", "if", "(", "include_brute_force", "||", "!", "(", "match", "instanceof", "BruteForceMatch", ")", ")", "{", "entropy", "+=", "match", ".", "calculateEntropy", "(", ")", ";", "}", "}", "return", "entropy", ";", "}" ]
Helper method to calculate entropy from a list of matches. @param matches the list of matches @return the sum of the entropy in the list passed in
[ "Helper", "method", "to", "calculate", "entropy", "from", "a", "list", "of", "matches", "." ]
train
https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/Nbvcxz.java#L531-L542
phax/ph-pdf-layout
src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java
PDPageContentStreamExt.newLineAtOffset
public void newLineAtOffset (final float tx, final float ty) throws IOException { """ The Td operator. Move to the start of the next line, offset from the start of the current line by (tx, ty). @param tx The x translation. @param ty The y translation. @throws IOException If there is an error writing to the stream. @throws IllegalStateException If the method was not allowed to be called at this time. """ if (!inTextMode) { throw new IllegalStateException ("Error: must call beginText() before newLineAtOffset()"); } writeOperand (tx); writeOperand (ty); writeOperator ((byte) 'T', (byte) 'd'); }
java
public void newLineAtOffset (final float tx, final float ty) throws IOException { if (!inTextMode) { throw new IllegalStateException ("Error: must call beginText() before newLineAtOffset()"); } writeOperand (tx); writeOperand (ty); writeOperator ((byte) 'T', (byte) 'd'); }
[ "public", "void", "newLineAtOffset", "(", "final", "float", "tx", ",", "final", "float", "ty", ")", "throws", "IOException", "{", "if", "(", "!", "inTextMode", ")", "{", "throw", "new", "IllegalStateException", "(", "\"Error: must call beginText() before newLineAtOffset()\"", ")", ";", "}", "writeOperand", "(", "tx", ")", ";", "writeOperand", "(", "ty", ")", ";", "writeOperator", "(", "(", "byte", ")", "'", "'", ",", "(", "byte", ")", "'", "'", ")", ";", "}" ]
The Td operator. Move to the start of the next line, offset from the start of the current line by (tx, ty). @param tx The x translation. @param ty The y translation. @throws IOException If there is an error writing to the stream. @throws IllegalStateException If the method was not allowed to be called at this time.
[ "The", "Td", "operator", ".", "Move", "to", "the", "start", "of", "the", "next", "line", "offset", "from", "the", "start", "of", "the", "current", "line", "by", "(", "tx", "ty", ")", "." ]
train
https://github.com/phax/ph-pdf-layout/blob/777d9f3a131cbe8f592c0de1cf554084e541bb54/src/main/java/com/helger/pdflayout4/pdfbox/PDPageContentStreamExt.java#L443-L452
facebookarchive/hadoop-20
src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java
BlockReconstructor.computeMetadata
DataInputStream computeMetadata(Configuration conf, InputStream dataStream) throws IOException { """ Reads data from the data stream provided and computes metadata. """ ByteArrayOutputStream mdOutBase = new ByteArrayOutputStream(1024*1024); DataOutputStream mdOut = new DataOutputStream(mdOutBase); // First, write out the version. mdOut.writeShort(FSDataset.FORMAT_VERSION_NON_INLINECHECKSUM); // Create a summer and write out its header. int bytesPerChecksum = conf.getInt("io.bytes.per.checksum", 512); DataChecksum sum = DataChecksum.newDataChecksum(DataChecksum.CHECKSUM_CRC32, bytesPerChecksum); sum.writeHeader(mdOut); // Buffer to read in a chunk of data. byte[] buf = new byte[bytesPerChecksum]; // Buffer to store the checksum bytes. byte[] chk = new byte[sum.getChecksumSize()]; // Read data till we reach the end of the input stream. int bytesSinceFlush = 0; while (true) { // Read some bytes. int bytesRead = dataStream.read(buf, bytesSinceFlush, bytesPerChecksum - bytesSinceFlush); if (bytesRead == -1) { if (bytesSinceFlush > 0) { boolean reset = true; sum.writeValue(chk, 0, reset); // This also resets the sum. // Write the checksum to the stream. mdOut.write(chk, 0, chk.length); bytesSinceFlush = 0; } break; } // Update the checksum. sum.update(buf, bytesSinceFlush, bytesRead); bytesSinceFlush += bytesRead; // Flush the checksum if necessary. if (bytesSinceFlush == bytesPerChecksum) { boolean reset = true; sum.writeValue(chk, 0, reset); // This also resets the sum. // Write the checksum to the stream. mdOut.write(chk, 0, chk.length); bytesSinceFlush = 0; } } byte[] mdBytes = mdOutBase.toByteArray(); return new DataInputStream(new ByteArrayInputStream(mdBytes)); }
java
DataInputStream computeMetadata(Configuration conf, InputStream dataStream) throws IOException { ByteArrayOutputStream mdOutBase = new ByteArrayOutputStream(1024*1024); DataOutputStream mdOut = new DataOutputStream(mdOutBase); // First, write out the version. mdOut.writeShort(FSDataset.FORMAT_VERSION_NON_INLINECHECKSUM); // Create a summer and write out its header. int bytesPerChecksum = conf.getInt("io.bytes.per.checksum", 512); DataChecksum sum = DataChecksum.newDataChecksum(DataChecksum.CHECKSUM_CRC32, bytesPerChecksum); sum.writeHeader(mdOut); // Buffer to read in a chunk of data. byte[] buf = new byte[bytesPerChecksum]; // Buffer to store the checksum bytes. byte[] chk = new byte[sum.getChecksumSize()]; // Read data till we reach the end of the input stream. int bytesSinceFlush = 0; while (true) { // Read some bytes. int bytesRead = dataStream.read(buf, bytesSinceFlush, bytesPerChecksum - bytesSinceFlush); if (bytesRead == -1) { if (bytesSinceFlush > 0) { boolean reset = true; sum.writeValue(chk, 0, reset); // This also resets the sum. // Write the checksum to the stream. mdOut.write(chk, 0, chk.length); bytesSinceFlush = 0; } break; } // Update the checksum. sum.update(buf, bytesSinceFlush, bytesRead); bytesSinceFlush += bytesRead; // Flush the checksum if necessary. if (bytesSinceFlush == bytesPerChecksum) { boolean reset = true; sum.writeValue(chk, 0, reset); // This also resets the sum. // Write the checksum to the stream. mdOut.write(chk, 0, chk.length); bytesSinceFlush = 0; } } byte[] mdBytes = mdOutBase.toByteArray(); return new DataInputStream(new ByteArrayInputStream(mdBytes)); }
[ "DataInputStream", "computeMetadata", "(", "Configuration", "conf", ",", "InputStream", "dataStream", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "mdOutBase", "=", "new", "ByteArrayOutputStream", "(", "1024", "*", "1024", ")", ";", "DataOutputStream", "mdOut", "=", "new", "DataOutputStream", "(", "mdOutBase", ")", ";", "// First, write out the version.", "mdOut", ".", "writeShort", "(", "FSDataset", ".", "FORMAT_VERSION_NON_INLINECHECKSUM", ")", ";", "// Create a summer and write out its header.", "int", "bytesPerChecksum", "=", "conf", ".", "getInt", "(", "\"io.bytes.per.checksum\"", ",", "512", ")", ";", "DataChecksum", "sum", "=", "DataChecksum", ".", "newDataChecksum", "(", "DataChecksum", ".", "CHECKSUM_CRC32", ",", "bytesPerChecksum", ")", ";", "sum", ".", "writeHeader", "(", "mdOut", ")", ";", "// Buffer to read in a chunk of data.", "byte", "[", "]", "buf", "=", "new", "byte", "[", "bytesPerChecksum", "]", ";", "// Buffer to store the checksum bytes.", "byte", "[", "]", "chk", "=", "new", "byte", "[", "sum", ".", "getChecksumSize", "(", ")", "]", ";", "// Read data till we reach the end of the input stream.", "int", "bytesSinceFlush", "=", "0", ";", "while", "(", "true", ")", "{", "// Read some bytes.", "int", "bytesRead", "=", "dataStream", ".", "read", "(", "buf", ",", "bytesSinceFlush", ",", "bytesPerChecksum", "-", "bytesSinceFlush", ")", ";", "if", "(", "bytesRead", "==", "-", "1", ")", "{", "if", "(", "bytesSinceFlush", ">", "0", ")", "{", "boolean", "reset", "=", "true", ";", "sum", ".", "writeValue", "(", "chk", ",", "0", ",", "reset", ")", ";", "// This also resets the sum.", "// Write the checksum to the stream.", "mdOut", ".", "write", "(", "chk", ",", "0", ",", "chk", ".", "length", ")", ";", "bytesSinceFlush", "=", "0", ";", "}", "break", ";", "}", "// Update the checksum.", "sum", ".", "update", "(", "buf", ",", "bytesSinceFlush", ",", "bytesRead", ")", ";", "bytesSinceFlush", "+=", "bytesRead", ";", "// Flush the checksum if necessary.", "if", "(", "bytesSinceFlush", "==", "bytesPerChecksum", ")", "{", "boolean", "reset", "=", "true", ";", "sum", ".", "writeValue", "(", "chk", ",", "0", ",", "reset", ")", ";", "// This also resets the sum.", "// Write the checksum to the stream.", "mdOut", ".", "write", "(", "chk", ",", "0", ",", "chk", ".", "length", ")", ";", "bytesSinceFlush", "=", "0", ";", "}", "}", "byte", "[", "]", "mdBytes", "=", "mdOutBase", ".", "toByteArray", "(", ")", ";", "return", "new", "DataInputStream", "(", "new", "ByteArrayInputStream", "(", "mdBytes", ")", ")", ";", "}" ]
Reads data from the data stream provided and computes metadata.
[ "Reads", "data", "from", "the", "data", "stream", "provided", "and", "computes", "metadata", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/raid/src/java/org/apache/hadoop/raid/BlockReconstructor.java#L649-L701
VoltDB/voltdb
src/frontend/org/voltdb/LoadedProcedureSet.java
LoadedProcedureSet.getNibbleDeleteProc
public ProcedureRunner getNibbleDeleteProc(String procName, Table catTable, Column column, ComparisonOperation op) { """ (TableName).nibbleDelete is cached in default procedure cache. @param tableName @return """ ProcedureRunner pr = m_defaultProcCache.get(procName); if (pr == null) { Procedure newCatProc = StatementCompiler.compileNibbleDeleteProcedure( catTable, procName, column, op); VoltProcedure voltProc = new ProcedureRunner.StmtProcedure(); pr = new ProcedureRunner(voltProc, m_site, newCatProc); // this will ensure any created fragment tasks know to load the plans // for this plan-on-the-fly procedure pr.setProcNameToLoadForFragmentTasks(newCatProc.getTypeName()); m_defaultProcCache.put(procName, pr); // also list nibble delete into default procedures m_defaultProcManager.m_defaultProcMap.put(procName.toLowerCase(), pr.getCatalogProcedure()); } return pr; }
java
public ProcedureRunner getNibbleDeleteProc(String procName, Table catTable, Column column, ComparisonOperation op) { ProcedureRunner pr = m_defaultProcCache.get(procName); if (pr == null) { Procedure newCatProc = StatementCompiler.compileNibbleDeleteProcedure( catTable, procName, column, op); VoltProcedure voltProc = new ProcedureRunner.StmtProcedure(); pr = new ProcedureRunner(voltProc, m_site, newCatProc); // this will ensure any created fragment tasks know to load the plans // for this plan-on-the-fly procedure pr.setProcNameToLoadForFragmentTasks(newCatProc.getTypeName()); m_defaultProcCache.put(procName, pr); // also list nibble delete into default procedures m_defaultProcManager.m_defaultProcMap.put(procName.toLowerCase(), pr.getCatalogProcedure()); } return pr; }
[ "public", "ProcedureRunner", "getNibbleDeleteProc", "(", "String", "procName", ",", "Table", "catTable", ",", "Column", "column", ",", "ComparisonOperation", "op", ")", "{", "ProcedureRunner", "pr", "=", "m_defaultProcCache", ".", "get", "(", "procName", ")", ";", "if", "(", "pr", "==", "null", ")", "{", "Procedure", "newCatProc", "=", "StatementCompiler", ".", "compileNibbleDeleteProcedure", "(", "catTable", ",", "procName", ",", "column", ",", "op", ")", ";", "VoltProcedure", "voltProc", "=", "new", "ProcedureRunner", ".", "StmtProcedure", "(", ")", ";", "pr", "=", "new", "ProcedureRunner", "(", "voltProc", ",", "m_site", ",", "newCatProc", ")", ";", "// this will ensure any created fragment tasks know to load the plans", "// for this plan-on-the-fly procedure", "pr", ".", "setProcNameToLoadForFragmentTasks", "(", "newCatProc", ".", "getTypeName", "(", ")", ")", ";", "m_defaultProcCache", ".", "put", "(", "procName", ",", "pr", ")", ";", "// also list nibble delete into default procedures", "m_defaultProcManager", ".", "m_defaultProcMap", ".", "put", "(", "procName", ".", "toLowerCase", "(", ")", ",", "pr", ".", "getCatalogProcedure", "(", ")", ")", ";", "}", "return", "pr", ";", "}" ]
(TableName).nibbleDelete is cached in default procedure cache. @param tableName @return
[ "(", "TableName", ")", ".", "nibbleDelete", "is", "cached", "in", "default", "procedure", "cache", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/LoadedProcedureSet.java#L285-L305
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java
JBasePanel.addToolbar
public JPanel addToolbar(JComponent screen, JComponent toolbar) { """ Add this toolbar to this panel and return the new main panel. @param screen The screen to add a toolbar to. @param toolbar The toolbar to add. @return The new panel with these two components in them. """ JPanel panelMain = new JPanel(); panelMain.setOpaque(false); panelMain.setLayout(new BoxLayout(panelMain, BoxLayout.Y_AXIS)); panelMain.add(toolbar); toolbar.setAlignmentX(0); panelMain.add(screen); screen.setAlignmentX(0); return panelMain; }
java
public JPanel addToolbar(JComponent screen, JComponent toolbar) { JPanel panelMain = new JPanel(); panelMain.setOpaque(false); panelMain.setLayout(new BoxLayout(panelMain, BoxLayout.Y_AXIS)); panelMain.add(toolbar); toolbar.setAlignmentX(0); panelMain.add(screen); screen.setAlignmentX(0); return panelMain; }
[ "public", "JPanel", "addToolbar", "(", "JComponent", "screen", ",", "JComponent", "toolbar", ")", "{", "JPanel", "panelMain", "=", "new", "JPanel", "(", ")", ";", "panelMain", ".", "setOpaque", "(", "false", ")", ";", "panelMain", ".", "setLayout", "(", "new", "BoxLayout", "(", "panelMain", ",", "BoxLayout", ".", "Y_AXIS", ")", ")", ";", "panelMain", ".", "add", "(", "toolbar", ")", ";", "toolbar", ".", "setAlignmentX", "(", "0", ")", ";", "panelMain", ".", "add", "(", "screen", ")", ";", "screen", ".", "setAlignmentX", "(", "0", ")", ";", "return", "panelMain", ";", "}" ]
Add this toolbar to this panel and return the new main panel. @param screen The screen to add a toolbar to. @param toolbar The toolbar to add. @return The new panel with these two components in them.
[ "Add", "this", "toolbar", "to", "this", "panel", "and", "return", "the", "new", "main", "panel", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBasePanel.java#L571-L581
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java
CommonOps_DDF5.extractRow
public static DMatrix5 extractRow( DMatrix5x5 a , int row , DMatrix5 out ) { """ Extracts the row from the matrix a. @param a Input matrix @param row Which row is to be extracted @param out output. Storage for the extracted row. If null then a new vector will be returned. @return The extracted row. """ if( out == null) out = new DMatrix5(); switch( row ) { case 0: out.a1 = a.a11; out.a2 = a.a12; out.a3 = a.a13; out.a4 = a.a14; out.a5 = a.a15; break; case 1: out.a1 = a.a21; out.a2 = a.a22; out.a3 = a.a23; out.a4 = a.a24; out.a5 = a.a25; break; case 2: out.a1 = a.a31; out.a2 = a.a32; out.a3 = a.a33; out.a4 = a.a34; out.a5 = a.a35; break; case 3: out.a1 = a.a41; out.a2 = a.a42; out.a3 = a.a43; out.a4 = a.a44; out.a5 = a.a45; break; case 4: out.a1 = a.a51; out.a2 = a.a52; out.a3 = a.a53; out.a4 = a.a54; out.a5 = a.a55; break; default: throw new IllegalArgumentException("Out of bounds row. row = "+row); } return out; }
java
public static DMatrix5 extractRow( DMatrix5x5 a , int row , DMatrix5 out ) { if( out == null) out = new DMatrix5(); switch( row ) { case 0: out.a1 = a.a11; out.a2 = a.a12; out.a3 = a.a13; out.a4 = a.a14; out.a5 = a.a15; break; case 1: out.a1 = a.a21; out.a2 = a.a22; out.a3 = a.a23; out.a4 = a.a24; out.a5 = a.a25; break; case 2: out.a1 = a.a31; out.a2 = a.a32; out.a3 = a.a33; out.a4 = a.a34; out.a5 = a.a35; break; case 3: out.a1 = a.a41; out.a2 = a.a42; out.a3 = a.a43; out.a4 = a.a44; out.a5 = a.a45; break; case 4: out.a1 = a.a51; out.a2 = a.a52; out.a3 = a.a53; out.a4 = a.a54; out.a5 = a.a55; break; default: throw new IllegalArgumentException("Out of bounds row. row = "+row); } return out; }
[ "public", "static", "DMatrix5", "extractRow", "(", "DMatrix5x5", "a", ",", "int", "row", ",", "DMatrix5", "out", ")", "{", "if", "(", "out", "==", "null", ")", "out", "=", "new", "DMatrix5", "(", ")", ";", "switch", "(", "row", ")", "{", "case", "0", ":", "out", ".", "a1", "=", "a", ".", "a11", ";", "out", ".", "a2", "=", "a", ".", "a12", ";", "out", ".", "a3", "=", "a", ".", "a13", ";", "out", ".", "a4", "=", "a", ".", "a14", ";", "out", ".", "a5", "=", "a", ".", "a15", ";", "break", ";", "case", "1", ":", "out", ".", "a1", "=", "a", ".", "a21", ";", "out", ".", "a2", "=", "a", ".", "a22", ";", "out", ".", "a3", "=", "a", ".", "a23", ";", "out", ".", "a4", "=", "a", ".", "a24", ";", "out", ".", "a5", "=", "a", ".", "a25", ";", "break", ";", "case", "2", ":", "out", ".", "a1", "=", "a", ".", "a31", ";", "out", ".", "a2", "=", "a", ".", "a32", ";", "out", ".", "a3", "=", "a", ".", "a33", ";", "out", ".", "a4", "=", "a", ".", "a34", ";", "out", ".", "a5", "=", "a", ".", "a35", ";", "break", ";", "case", "3", ":", "out", ".", "a1", "=", "a", ".", "a41", ";", "out", ".", "a2", "=", "a", ".", "a42", ";", "out", ".", "a3", "=", "a", ".", "a43", ";", "out", ".", "a4", "=", "a", ".", "a44", ";", "out", ".", "a5", "=", "a", ".", "a45", ";", "break", ";", "case", "4", ":", "out", ".", "a1", "=", "a", ".", "a51", ";", "out", ".", "a2", "=", "a", ".", "a52", ";", "out", ".", "a3", "=", "a", ".", "a53", ";", "out", ".", "a4", "=", "a", ".", "a54", ";", "out", ".", "a5", "=", "a", ".", "a55", ";", "break", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "\"Out of bounds row. row = \"", "+", "row", ")", ";", "}", "return", "out", ";", "}" ]
Extracts the row from the matrix a. @param a Input matrix @param row Which row is to be extracted @param out output. Storage for the extracted row. If null then a new vector will be returned. @return The extracted row.
[ "Extracts", "the", "row", "from", "the", "matrix", "a", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/fixed/CommonOps_DDF5.java#L1953-L1995
OpenLiberty/open-liberty
dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/BufferDump.java
BufferDump.formatLineId
static private StringBuilder formatLineId(StringBuilder buffer, int value) { """ Format the input value as a four digit hex number, padding with zeros. @param buffer @param value @return StringBuilder """ char[] chars = new char[4]; for (int i = 3; i >= 0; i--) { chars[i] = (char) HEX_BYTES[(value % 16) & 0xF]; value >>= 4; } return buffer.append(chars); }
java
static private StringBuilder formatLineId(StringBuilder buffer, int value) { char[] chars = new char[4]; for (int i = 3; i >= 0; i--) { chars[i] = (char) HEX_BYTES[(value % 16) & 0xF]; value >>= 4; } return buffer.append(chars); }
[ "static", "private", "StringBuilder", "formatLineId", "(", "StringBuilder", "buffer", ",", "int", "value", ")", "{", "char", "[", "]", "chars", "=", "new", "char", "[", "4", "]", ";", "for", "(", "int", "i", "=", "3", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "chars", "[", "i", "]", "=", "(", "char", ")", "HEX_BYTES", "[", "(", "value", "%", "16", ")", "&", "0xF", "]", ";", "value", ">>=", "4", ";", "}", "return", "buffer", ".", "append", "(", "chars", ")", ";", "}" ]
Format the input value as a four digit hex number, padding with zeros. @param buffer @param value @return StringBuilder
[ "Format", "the", "input", "value", "as", "a", "four", "digit", "hex", "number", "padding", "with", "zeros", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.channelfw/src/com/ibm/ws/udpchannel/internal/BufferDump.java#L94-L101
m-m-m/util
gwt/src/main/java/net/sf/mmm/util/gwt/base/rebind/AbstractIncrementalGenerator.java
AbstractIncrementalGenerator.isCachedResultObsolete
protected boolean isCachedResultObsolete(CachedGeneratorResult cachedGeneratorResult, String typeName) { """ This method determines whether a {@link CachedGeneratorResult} is obsolete or can be reused. @param cachedGeneratorResult is the {@link CachedGeneratorResult}. @param typeName is the full-qualified name of the {@link Class} to generate. @return {@code true} if the {@link CachedGeneratorResult} is obsolete and has to be re-generated, {@code false} otherwise (if it can be reused). """ try { URL javaFileUrl = Thread.currentThread().getContextClassLoader() .getResource(typeName.replace('.', '/') + ".java"); String protocol = javaFileUrl.getProtocol().toLowerCase(); if ("file".equals(protocol)) { String urlString = URLDecoder.decode(javaFileUrl.getFile(), "UTF-8"); File javaFile = new File(urlString); long lastModified = javaFile.lastModified(); long timeGenerated = cachedGeneratorResult.getTimeGenerated(); return (lastModified > timeGenerated); } else { throw new IllegalCaseException(protocol); } } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } }
java
protected boolean isCachedResultObsolete(CachedGeneratorResult cachedGeneratorResult, String typeName) { try { URL javaFileUrl = Thread.currentThread().getContextClassLoader() .getResource(typeName.replace('.', '/') + ".java"); String protocol = javaFileUrl.getProtocol().toLowerCase(); if ("file".equals(protocol)) { String urlString = URLDecoder.decode(javaFileUrl.getFile(), "UTF-8"); File javaFile = new File(urlString); long lastModified = javaFile.lastModified(); long timeGenerated = cachedGeneratorResult.getTimeGenerated(); return (lastModified > timeGenerated); } else { throw new IllegalCaseException(protocol); } } catch (UnsupportedEncodingException e) { throw new IllegalStateException(e); } }
[ "protected", "boolean", "isCachedResultObsolete", "(", "CachedGeneratorResult", "cachedGeneratorResult", ",", "String", "typeName", ")", "{", "try", "{", "URL", "javaFileUrl", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ".", "getResource", "(", "typeName", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "\".java\"", ")", ";", "String", "protocol", "=", "javaFileUrl", ".", "getProtocol", "(", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "\"file\"", ".", "equals", "(", "protocol", ")", ")", "{", "String", "urlString", "=", "URLDecoder", ".", "decode", "(", "javaFileUrl", ".", "getFile", "(", ")", ",", "\"UTF-8\"", ")", ";", "File", "javaFile", "=", "new", "File", "(", "urlString", ")", ";", "long", "lastModified", "=", "javaFile", ".", "lastModified", "(", ")", ";", "long", "timeGenerated", "=", "cachedGeneratorResult", ".", "getTimeGenerated", "(", ")", ";", "return", "(", "lastModified", ">", "timeGenerated", ")", ";", "}", "else", "{", "throw", "new", "IllegalCaseException", "(", "protocol", ")", ";", "}", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "IllegalStateException", "(", "e", ")", ";", "}", "}" ]
This method determines whether a {@link CachedGeneratorResult} is obsolete or can be reused. @param cachedGeneratorResult is the {@link CachedGeneratorResult}. @param typeName is the full-qualified name of the {@link Class} to generate. @return {@code true} if the {@link CachedGeneratorResult} is obsolete and has to be re-generated, {@code false} otherwise (if it can be reused).
[ "This", "method", "determines", "whether", "a", "{", "@link", "CachedGeneratorResult", "}", "is", "obsolete", "or", "can", "be", "reused", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/gwt/src/main/java/net/sf/mmm/util/gwt/base/rebind/AbstractIncrementalGenerator.java#L257-L275
joniles/mpxj
src/main/java/net/sf/mpxj/sample/PrimaveraConvert.java
PrimaveraConvert.processProject
private void processProject(PrimaveraDatabaseReader reader, int projectID, String outputFile) throws Exception { """ Process a single project. @param reader Primavera reader @param projectID required project ID @param outputFile output file name """ long start = System.currentTimeMillis(); reader.setProjectID(projectID); ProjectFile projectFile = reader.read(); long elapsed = System.currentTimeMillis() - start; System.out.println("Reading database completed in " + elapsed + "ms."); System.out.println("Writing output file started."); start = System.currentTimeMillis(); ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile); writer.write(projectFile, outputFile); elapsed = System.currentTimeMillis() - start; System.out.println("Writing output completed in " + elapsed + "ms."); }
java
private void processProject(PrimaveraDatabaseReader reader, int projectID, String outputFile) throws Exception { long start = System.currentTimeMillis(); reader.setProjectID(projectID); ProjectFile projectFile = reader.read(); long elapsed = System.currentTimeMillis() - start; System.out.println("Reading database completed in " + elapsed + "ms."); System.out.println("Writing output file started."); start = System.currentTimeMillis(); ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile); writer.write(projectFile, outputFile); elapsed = System.currentTimeMillis() - start; System.out.println("Writing output completed in " + elapsed + "ms."); }
[ "private", "void", "processProject", "(", "PrimaveraDatabaseReader", "reader", ",", "int", "projectID", ",", "String", "outputFile", ")", "throws", "Exception", "{", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "reader", ".", "setProjectID", "(", "projectID", ")", ";", "ProjectFile", "projectFile", "=", "reader", ".", "read", "(", ")", ";", "long", "elapsed", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ";", "System", ".", "out", ".", "println", "(", "\"Reading database completed in \"", "+", "elapsed", "+", "\"ms.\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Writing output file started.\"", ")", ";", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "ProjectWriter", "writer", "=", "ProjectWriterUtility", ".", "getProjectWriter", "(", "outputFile", ")", ";", "writer", ".", "write", "(", "projectFile", ",", "outputFile", ")", ";", "elapsed", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ";", "System", ".", "out", ".", "println", "(", "\"Writing output completed in \"", "+", "elapsed", "+", "\"ms.\"", ")", ";", "}" ]
Process a single project. @param reader Primavera reader @param projectID required project ID @param outputFile output file name
[ "Process", "a", "single", "project", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/PrimaveraConvert.java#L114-L128
aspectran/aspectran
shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java
HelpFormatter.appendOption
private void appendOption(StringBuilder sb, Option option, boolean required) { """ Appends the usage clause for an Option to a StringBuilder. @param sb the StringBuilder to append to @param option the Option to append @param required whether the Option is required or not """ if (!required) { sb.append(OPTIONAL_BRACKET_OPEN); } if (option.getName() != null) { sb.append(OPTION_PREFIX).append(option.getName()); } else { sb.append(LONG_OPTION_PREFIX).append(option.getLongName()); } // if the Option has a value and a non blank arg name if (option.hasValue() && (option.getValueName() == null || !option.getValueName().isEmpty())) { sb.append(option.isWithEqualSign() ? '=' : LONG_OPTION_SEPARATOR); sb.append(ARG_BRACKET_OPEN).append(option.getValueName() != null ? option.getValueName() : getArgName()).append(ARG_BRACKET_CLOSE); } if (!required) { sb.append(OPTIONAL_BRACKET_CLOSE); } }
java
private void appendOption(StringBuilder sb, Option option, boolean required) { if (!required) { sb.append(OPTIONAL_BRACKET_OPEN); } if (option.getName() != null) { sb.append(OPTION_PREFIX).append(option.getName()); } else { sb.append(LONG_OPTION_PREFIX).append(option.getLongName()); } // if the Option has a value and a non blank arg name if (option.hasValue() && (option.getValueName() == null || !option.getValueName().isEmpty())) { sb.append(option.isWithEqualSign() ? '=' : LONG_OPTION_SEPARATOR); sb.append(ARG_BRACKET_OPEN).append(option.getValueName() != null ? option.getValueName() : getArgName()).append(ARG_BRACKET_CLOSE); } if (!required) { sb.append(OPTIONAL_BRACKET_CLOSE); } }
[ "private", "void", "appendOption", "(", "StringBuilder", "sb", ",", "Option", "option", ",", "boolean", "required", ")", "{", "if", "(", "!", "required", ")", "{", "sb", ".", "append", "(", "OPTIONAL_BRACKET_OPEN", ")", ";", "}", "if", "(", "option", ".", "getName", "(", ")", "!=", "null", ")", "{", "sb", ".", "append", "(", "OPTION_PREFIX", ")", ".", "append", "(", "option", ".", "getName", "(", ")", ")", ";", "}", "else", "{", "sb", ".", "append", "(", "LONG_OPTION_PREFIX", ")", ".", "append", "(", "option", ".", "getLongName", "(", ")", ")", ";", "}", "// if the Option has a value and a non blank arg name", "if", "(", "option", ".", "hasValue", "(", ")", "&&", "(", "option", ".", "getValueName", "(", ")", "==", "null", "||", "!", "option", ".", "getValueName", "(", ")", ".", "isEmpty", "(", ")", ")", ")", "{", "sb", ".", "append", "(", "option", ".", "isWithEqualSign", "(", ")", "?", "'", "'", ":", "LONG_OPTION_SEPARATOR", ")", ";", "sb", ".", "append", "(", "ARG_BRACKET_OPEN", ")", ".", "append", "(", "option", ".", "getValueName", "(", ")", "!=", "null", "?", "option", ".", "getValueName", "(", ")", ":", "getArgName", "(", ")", ")", ".", "append", "(", "ARG_BRACKET_CLOSE", ")", ";", "}", "if", "(", "!", "required", ")", "{", "sb", ".", "append", "(", "OPTIONAL_BRACKET_CLOSE", ")", ";", "}", "}" ]
Appends the usage clause for an Option to a StringBuilder. @param sb the StringBuilder to append to @param option the Option to append @param required whether the Option is required or not
[ "Appends", "the", "usage", "clause", "for", "an", "Option", "to", "a", "StringBuilder", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/shell/src/main/java/com/aspectran/shell/command/option/HelpFormatter.java#L289-L306
audit4j/audit4j-core
src/main/java/org/audit4j/core/extra/scannotation/ClasspathUrlFinder.java
ClasspathUrlFinder.findResourceBase
public static URL findResourceBase(String baseResource, ClassLoader loader) { """ Find the classpath URL for a specific classpath resource. The classpath URL is extracted from loader.getResource() using the baseResource. @param baseResource @param loader @return """ URL url = loader.getResource(baseResource); return findResourceBase(url, baseResource); }
java
public static URL findResourceBase(String baseResource, ClassLoader loader) { URL url = loader.getResource(baseResource); return findResourceBase(url, baseResource); }
[ "public", "static", "URL", "findResourceBase", "(", "String", "baseResource", ",", "ClassLoader", "loader", ")", "{", "URL", "url", "=", "loader", ".", "getResource", "(", "baseResource", ")", ";", "return", "findResourceBase", "(", "url", ",", "baseResource", ")", ";", "}" ]
Find the classpath URL for a specific classpath resource. The classpath URL is extracted from loader.getResource() using the baseResource. @param baseResource @param loader @return
[ "Find", "the", "classpath", "URL", "for", "a", "specific", "classpath", "resource", ".", "The", "classpath", "URL", "is", "extracted", "from", "loader", ".", "getResource", "()", "using", "the", "baseResource", "." ]
train
https://github.com/audit4j/audit4j-core/blob/dc8569108851e64cb0ecc7a39048db0ad070fba2/src/main/java/org/audit4j/core/extra/scannotation/ClasspathUrlFinder.java#L103-L107
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosCommentsApi.java
PhotosCommentsApi.getList
public Comments getList(String photoId, String minCommentDate, String maxCommentDate, boolean sign) throws JinxException { """ Returns the comments for a photo <br> This method does not require authentication. You can choose to sign the call by passing true or false as the value of the sign parameter. <br> @param photoId (Required) The id of the photo to fetch comments for. @param minCommentDate (Optional) Minimum date that a a comment was added. The date should be in the form of a unix timestamp. @param maxCommentDate (Optional) Maximum date that a comment was added. The date should be in the form of a unix timestamp. @param sign if true, the request will be signed. @return object with a list of comments for the specified photo. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.comments.getList.html">flickr.photos.comments.getList</a> """ JinxUtils.validateParams(photoId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.comments.getList"); params.put("photo_id", photoId); if (!JinxUtils.isNullOrEmpty(minCommentDate)) { params.put("min_comment_date", minCommentDate); } if (!JinxUtils.isNullOrEmpty(maxCommentDate)) { params.put("max_comment_date", maxCommentDate); } return jinx.flickrGet(params, Comments.class, sign); }
java
public Comments getList(String photoId, String minCommentDate, String maxCommentDate, boolean sign) throws JinxException { JinxUtils.validateParams(photoId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.comments.getList"); params.put("photo_id", photoId); if (!JinxUtils.isNullOrEmpty(minCommentDate)) { params.put("min_comment_date", minCommentDate); } if (!JinxUtils.isNullOrEmpty(maxCommentDate)) { params.put("max_comment_date", maxCommentDate); } return jinx.flickrGet(params, Comments.class, sign); }
[ "public", "Comments", "getList", "(", "String", "photoId", ",", "String", "minCommentDate", ",", "String", "maxCommentDate", ",", "boolean", "sign", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photoId", ")", ";", "Map", "<", "String", ",", "String", ">", "params", "=", "new", "TreeMap", "<>", "(", ")", ";", "params", ".", "put", "(", "\"method\"", ",", "\"flickr.photos.comments.getList\"", ")", ";", "params", ".", "put", "(", "\"photo_id\"", ",", "photoId", ")", ";", "if", "(", "!", "JinxUtils", ".", "isNullOrEmpty", "(", "minCommentDate", ")", ")", "{", "params", ".", "put", "(", "\"min_comment_date\"", ",", "minCommentDate", ")", ";", "}", "if", "(", "!", "JinxUtils", ".", "isNullOrEmpty", "(", "maxCommentDate", ")", ")", "{", "params", ".", "put", "(", "\"max_comment_date\"", ",", "maxCommentDate", ")", ";", "}", "return", "jinx", ".", "flickrGet", "(", "params", ",", "Comments", ".", "class", ",", "sign", ")", ";", "}" ]
Returns the comments for a photo <br> This method does not require authentication. You can choose to sign the call by passing true or false as the value of the sign parameter. <br> @param photoId (Required) The id of the photo to fetch comments for. @param minCommentDate (Optional) Minimum date that a a comment was added. The date should be in the form of a unix timestamp. @param maxCommentDate (Optional) Maximum date that a comment was added. The date should be in the form of a unix timestamp. @param sign if true, the request will be signed. @return object with a list of comments for the specified photo. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.comments.getList.html">flickr.photos.comments.getList</a>
[ "Returns", "the", "comments", "for", "a", "photo", "<br", ">", "This", "method", "does", "not", "require", "authentication", ".", "You", "can", "choose", "to", "sign", "the", "call", "by", "passing", "true", "or", "false", "as", "the", "value", "of", "the", "sign", "parameter", ".", "<br", ">" ]
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosCommentsApi.java#L121-L133
mapbox/mapbox-events-android
liblocation/src/main/java/com/mapbox/android/core/location/LocationEngineProvider.java
LocationEngineProvider.getBestLocationEngine
@NonNull @Deprecated public static LocationEngine getBestLocationEngine(@NonNull Context context, boolean background) { """ Returns instance to the best location engine, given the included libraries. @param context {@link Context}. @param background true if background optimized engine is desired (note: parameter deprecated) @return a unique instance of {@link LocationEngine} every time method is called. @since 1.0.0 """ return getBestLocationEngine(context); }
java
@NonNull @Deprecated public static LocationEngine getBestLocationEngine(@NonNull Context context, boolean background) { return getBestLocationEngine(context); }
[ "@", "NonNull", "@", "Deprecated", "public", "static", "LocationEngine", "getBestLocationEngine", "(", "@", "NonNull", "Context", "context", ",", "boolean", "background", ")", "{", "return", "getBestLocationEngine", "(", "context", ")", ";", "}" ]
Returns instance to the best location engine, given the included libraries. @param context {@link Context}. @param background true if background optimized engine is desired (note: parameter deprecated) @return a unique instance of {@link LocationEngine} every time method is called. @since 1.0.0
[ "Returns", "instance", "to", "the", "best", "location", "engine", "given", "the", "included", "libraries", "." ]
train
https://github.com/mapbox/mapbox-events-android/blob/5b5ca7e04cb8fab31a8dc040b6e7521f930a58a4/liblocation/src/main/java/com/mapbox/android/core/location/LocationEngineProvider.java#L30-L34
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java
XmlStringBuilder.appendAttribute
public void appendAttribute(final String name, final Object value) { """ <p> Adds an xml attribute name+value pair to the end of this XmlStringBuilder. All attribute values are escaped to prevent malformed XML and XSS attacks. </p> <p> If the value is null an empty string "" is output. </p> <p> Eg. name="value" </p> @param name the name of the attribute to be added. @param value the value of the attribute to be added. """ write(' '); write(name); write("=\""); if (value instanceof Message) { appendEscaped(translate(value)); } else if (value != null) { appendEscaped(value.toString()); } write('"'); }
java
public void appendAttribute(final String name, final Object value) { write(' '); write(name); write("=\""); if (value instanceof Message) { appendEscaped(translate(value)); } else if (value != null) { appendEscaped(value.toString()); } write('"'); }
[ "public", "void", "appendAttribute", "(", "final", "String", "name", ",", "final", "Object", "value", ")", "{", "write", "(", "'", "'", ")", ";", "write", "(", "name", ")", ";", "write", "(", "\"=\\\"\"", ")", ";", "if", "(", "value", "instanceof", "Message", ")", "{", "appendEscaped", "(", "translate", "(", "value", ")", ")", ";", "}", "else", "if", "(", "value", "!=", "null", ")", "{", "appendEscaped", "(", "value", ".", "toString", "(", ")", ")", ";", "}", "write", "(", "'", "'", ")", ";", "}" ]
<p> Adds an xml attribute name+value pair to the end of this XmlStringBuilder. All attribute values are escaped to prevent malformed XML and XSS attacks. </p> <p> If the value is null an empty string "" is output. </p> <p> Eg. name="value" </p> @param name the name of the attribute to be added. @param value the value of the attribute to be added.
[ "<p", ">", "Adds", "an", "xml", "attribute", "name", "+", "value", "pair", "to", "the", "end", "of", "this", "XmlStringBuilder", ".", "All", "attribute", "values", "are", "escaped", "to", "prevent", "malformed", "XML", "and", "XSS", "attacks", ".", "<", "/", "p", ">", "<p", ">", "If", "the", "value", "is", "null", "an", "empty", "string", "is", "output", ".", "<", "/", "p", ">", "<p", ">", "Eg", ".", "name", "=", "value", "<", "/", "p", ">" ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/XmlStringBuilder.java#L190-L202
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.router_new_duration_POST
public OvhOrder router_new_duration_POST(String duration, String vrack) throws IOException { """ Create order REST: POST /order/router/new/{duration} @param vrack [required] The name of your vrack @param duration [required] Duration """ String qPath = "/order/router/new/{duration}"; StringBuilder sb = path(qPath, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "vrack", vrack); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder router_new_duration_POST(String duration, String vrack) throws IOException { String qPath = "/order/router/new/{duration}"; StringBuilder sb = path(qPath, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "vrack", vrack); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "router_new_duration_POST", "(", "String", "duration", ",", "String", "vrack", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/router/new/{duration}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ",", "duration", ")", ";", "HashMap", "<", "String", ",", "Object", ">", "o", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "addBody", "(", "o", ",", "\"vrack\"", ",", "vrack", ")", ";", "String", "resp", "=", "exec", "(", "qPath", ",", "\"POST\"", ",", "sb", ".", "toString", "(", ")", ",", "o", ")", ";", "return", "convertTo", "(", "resp", ",", "OvhOrder", ".", "class", ")", ";", "}" ]
Create order REST: POST /order/router/new/{duration} @param vrack [required] The name of your vrack @param duration [required] Duration
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L940-L947
alkacon/opencms-core
src-gwt/org/opencms/ade/galleries/client/ui/CmsCategoriesTab.java
CmsCategoriesTab.addChildren
private void addChildren(CmsTreeItem parent, List<CmsCategoryTreeEntry> children, List<String> selectedCategories) { """ Adds children item to the category tree and select the categories.<p> @param parent the parent item @param children the list of children @param selectedCategories the list of categories to select """ if (children != null) { for (CmsCategoryTreeEntry child : children) { // set the category tree item and add to parent tree item CmsTreeItem treeItem = buildTreeItem(child, selectedCategories); if ((selectedCategories != null) && selectedCategories.contains(child.getPath())) { parent.setOpen(true); openParents(parent); } parent.addChild(treeItem); addChildren(treeItem, child.getChildren(), selectedCategories); } } }
java
private void addChildren(CmsTreeItem parent, List<CmsCategoryTreeEntry> children, List<String> selectedCategories) { if (children != null) { for (CmsCategoryTreeEntry child : children) { // set the category tree item and add to parent tree item CmsTreeItem treeItem = buildTreeItem(child, selectedCategories); if ((selectedCategories != null) && selectedCategories.contains(child.getPath())) { parent.setOpen(true); openParents(parent); } parent.addChild(treeItem); addChildren(treeItem, child.getChildren(), selectedCategories); } } }
[ "private", "void", "addChildren", "(", "CmsTreeItem", "parent", ",", "List", "<", "CmsCategoryTreeEntry", ">", "children", ",", "List", "<", "String", ">", "selectedCategories", ")", "{", "if", "(", "children", "!=", "null", ")", "{", "for", "(", "CmsCategoryTreeEntry", "child", ":", "children", ")", "{", "// set the category tree item and add to parent tree item", "CmsTreeItem", "treeItem", "=", "buildTreeItem", "(", "child", ",", "selectedCategories", ")", ";", "if", "(", "(", "selectedCategories", "!=", "null", ")", "&&", "selectedCategories", ".", "contains", "(", "child", ".", "getPath", "(", ")", ")", ")", "{", "parent", ".", "setOpen", "(", "true", ")", ";", "openParents", "(", "parent", ")", ";", "}", "parent", ".", "addChild", "(", "treeItem", ")", ";", "addChildren", "(", "treeItem", ",", "child", ".", "getChildren", "(", ")", ",", "selectedCategories", ")", ";", "}", "}", "}" ]
Adds children item to the category tree and select the categories.<p> @param parent the parent item @param children the list of children @param selectedCategories the list of categories to select
[ "Adds", "children", "item", "to", "the", "category", "tree", "and", "select", "the", "categories", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/galleries/client/ui/CmsCategoriesTab.java#L334-L348
languagetool-org/languagetool
languagetool-server/src/main/java/org/languagetool/server/UserLimits.java
UserLimits.getLimitsFromToken
static UserLimits getLimitsFromToken(HTTPServerConfig config, String jwtToken) { """ Get limits from the JWT key itself, no database access needed. """ Objects.requireNonNull(jwtToken); try { String secretKey = config.getSecretTokenKey(); if (secretKey == null) { throw new RuntimeException("You specified a 'token' parameter but this server doesn't accept tokens"); } Algorithm algorithm = Algorithm.HMAC256(secretKey); DecodedJWT decodedToken; try { JWT.require(algorithm).build().verify(jwtToken); decodedToken = JWT.decode(jwtToken); } catch (JWTDecodeException e) { throw new AuthException("Could not decode token '" + jwtToken + "'", e); } Claim maxTextLengthClaim = decodedToken.getClaim("maxTextLength"); Claim premiumClaim = decodedToken.getClaim("premium"); boolean hasPremium = !premiumClaim.isNull() && premiumClaim.asBoolean(); Claim uidClaim = decodedToken.getClaim("uid"); long uid = uidClaim.isNull() ? -1 : uidClaim.asLong(); return new UserLimits( maxTextLengthClaim.isNull() ? config.maxTextLength : maxTextLengthClaim.asInt(), config.maxCheckTimeMillis, hasPremium ? uid : null); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
java
static UserLimits getLimitsFromToken(HTTPServerConfig config, String jwtToken) { Objects.requireNonNull(jwtToken); try { String secretKey = config.getSecretTokenKey(); if (secretKey == null) { throw new RuntimeException("You specified a 'token' parameter but this server doesn't accept tokens"); } Algorithm algorithm = Algorithm.HMAC256(secretKey); DecodedJWT decodedToken; try { JWT.require(algorithm).build().verify(jwtToken); decodedToken = JWT.decode(jwtToken); } catch (JWTDecodeException e) { throw new AuthException("Could not decode token '" + jwtToken + "'", e); } Claim maxTextLengthClaim = decodedToken.getClaim("maxTextLength"); Claim premiumClaim = decodedToken.getClaim("premium"); boolean hasPremium = !premiumClaim.isNull() && premiumClaim.asBoolean(); Claim uidClaim = decodedToken.getClaim("uid"); long uid = uidClaim.isNull() ? -1 : uidClaim.asLong(); return new UserLimits( maxTextLengthClaim.isNull() ? config.maxTextLength : maxTextLengthClaim.asInt(), config.maxCheckTimeMillis, hasPremium ? uid : null); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } }
[ "static", "UserLimits", "getLimitsFromToken", "(", "HTTPServerConfig", "config", ",", "String", "jwtToken", ")", "{", "Objects", ".", "requireNonNull", "(", "jwtToken", ")", ";", "try", "{", "String", "secretKey", "=", "config", ".", "getSecretTokenKey", "(", ")", ";", "if", "(", "secretKey", "==", "null", ")", "{", "throw", "new", "RuntimeException", "(", "\"You specified a 'token' parameter but this server doesn't accept tokens\"", ")", ";", "}", "Algorithm", "algorithm", "=", "Algorithm", ".", "HMAC256", "(", "secretKey", ")", ";", "DecodedJWT", "decodedToken", ";", "try", "{", "JWT", ".", "require", "(", "algorithm", ")", ".", "build", "(", ")", ".", "verify", "(", "jwtToken", ")", ";", "decodedToken", "=", "JWT", ".", "decode", "(", "jwtToken", ")", ";", "}", "catch", "(", "JWTDecodeException", "e", ")", "{", "throw", "new", "AuthException", "(", "\"Could not decode token '\"", "+", "jwtToken", "+", "\"'\"", ",", "e", ")", ";", "}", "Claim", "maxTextLengthClaim", "=", "decodedToken", ".", "getClaim", "(", "\"maxTextLength\"", ")", ";", "Claim", "premiumClaim", "=", "decodedToken", ".", "getClaim", "(", "\"premium\"", ")", ";", "boolean", "hasPremium", "=", "!", "premiumClaim", ".", "isNull", "(", ")", "&&", "premiumClaim", ".", "asBoolean", "(", ")", ";", "Claim", "uidClaim", "=", "decodedToken", ".", "getClaim", "(", "\"uid\"", ")", ";", "long", "uid", "=", "uidClaim", ".", "isNull", "(", ")", "?", "-", "1", ":", "uidClaim", ".", "asLong", "(", ")", ";", "return", "new", "UserLimits", "(", "maxTextLengthClaim", ".", "isNull", "(", ")", "?", "config", ".", "maxTextLength", ":", "maxTextLengthClaim", ".", "asInt", "(", ")", ",", "config", ".", "maxCheckTimeMillis", ",", "hasPremium", "?", "uid", ":", "null", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}" ]
Get limits from the JWT key itself, no database access needed.
[ "Get", "limits", "from", "the", "JWT", "key", "itself", "no", "database", "access", "needed", "." ]
train
https://github.com/languagetool-org/languagetool/blob/b7a3d63883d242fb2525877c6382681c57a0a142/languagetool-server/src/main/java/org/languagetool/server/UserLimits.java#L65-L92
Ordinastie/MalisisCore
src/main/java/net/malisis/core/registry/Registries.java
Registries.processPostSetBlock
public static void processPostSetBlock(Chunk chunk, BlockPos pos, IBlockState oldState, IBlockState newState) { """ Processes {@link ISetBlockCallback ISetBlockCallbacks}.<br> Called by ASM from {@link Chunk#setBlockState(BlockPos, IBlockState)}. @param chunk the chunk @param pos the pos @param oldState the old state @param newState the new state """ postSetBlockRegistry.processCallbacks(chunk, pos, oldState, newState); }
java
public static void processPostSetBlock(Chunk chunk, BlockPos pos, IBlockState oldState, IBlockState newState) { postSetBlockRegistry.processCallbacks(chunk, pos, oldState, newState); }
[ "public", "static", "void", "processPostSetBlock", "(", "Chunk", "chunk", ",", "BlockPos", "pos", ",", "IBlockState", "oldState", ",", "IBlockState", "newState", ")", "{", "postSetBlockRegistry", ".", "processCallbacks", "(", "chunk", ",", "pos", ",", "oldState", ",", "newState", ")", ";", "}" ]
Processes {@link ISetBlockCallback ISetBlockCallbacks}.<br> Called by ASM from {@link Chunk#setBlockState(BlockPos, IBlockState)}. @param chunk the chunk @param pos the pos @param oldState the old state @param newState the new state
[ "Processes", "{", "@link", "ISetBlockCallback", "ISetBlockCallbacks", "}", ".", "<br", ">", "Called", "by", "ASM", "from", "{", "@link", "Chunk#setBlockState", "(", "BlockPos", "IBlockState", ")", "}", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/registry/Registries.java#L151-L154
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/durableexecutor/impl/TaskRingBuffer.java
TaskRingBuffer.putBackup
void putBackup(int sequence, Callable task) { """ Puts the task for the given sequence @param sequence The sequence @param task The task """ head = Math.max(head, sequence); callableCounter++; int index = toIndex(sequence); ringItems[index] = task; isTask[index] = true; sequences[index] = sequence; }
java
void putBackup(int sequence, Callable task) { head = Math.max(head, sequence); callableCounter++; int index = toIndex(sequence); ringItems[index] = task; isTask[index] = true; sequences[index] = sequence; }
[ "void", "putBackup", "(", "int", "sequence", ",", "Callable", "task", ")", "{", "head", "=", "Math", ".", "max", "(", "head", ",", "sequence", ")", ";", "callableCounter", "++", ";", "int", "index", "=", "toIndex", "(", "sequence", ")", ";", "ringItems", "[", "index", "]", "=", "task", ";", "isTask", "[", "index", "]", "=", "true", ";", "sequences", "[", "index", "]", "=", "sequence", ";", "}" ]
Puts the task for the given sequence @param sequence The sequence @param task The task
[ "Puts", "the", "task", "for", "the", "given", "sequence" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/durableexecutor/impl/TaskRingBuffer.java#L101-L108
h2oai/h2o-2
src/main/java/water/fvec/Chunk.java
Chunk.set0
public final float set0(int idx, float f) { """ Set a floating element in a chunk given a 0-based chunk local index. """ setWrite(); if( _chk2.set_impl(idx,f) ) return f; (_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,f); return f; }
java
public final float set0(int idx, float f) { setWrite(); if( _chk2.set_impl(idx,f) ) return f; (_chk2 = inflate_impl(new NewChunk(this))).set_impl(idx,f); return f; }
[ "public", "final", "float", "set0", "(", "int", "idx", ",", "float", "f", ")", "{", "setWrite", "(", ")", ";", "if", "(", "_chk2", ".", "set_impl", "(", "idx", ",", "f", ")", ")", "return", "f", ";", "(", "_chk2", "=", "inflate_impl", "(", "new", "NewChunk", "(", "this", ")", ")", ")", ".", "set_impl", "(", "idx", ",", "f", ")", ";", "return", "f", ";", "}" ]
Set a floating element in a chunk given a 0-based chunk local index.
[ "Set", "a", "floating", "element", "in", "a", "chunk", "given", "a", "0", "-", "based", "chunk", "local", "index", "." ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/fvec/Chunk.java#L145-L150
jingwei/krati
krati-main/src/main/java/krati/core/StoreConfig.java
StoreConfig.getDouble
public double getDouble(String pName, double defaultValue) { """ Gets a double property via a string property name. @param pName - the property name @param defaultValue - the default property value @return a double property """ String pValue = _properties.getProperty(pName); return parseDouble(pName, pValue, defaultValue); }
java
public double getDouble(String pName, double defaultValue) { String pValue = _properties.getProperty(pName); return parseDouble(pName, pValue, defaultValue); }
[ "public", "double", "getDouble", "(", "String", "pName", ",", "double", "defaultValue", ")", "{", "String", "pValue", "=", "_properties", ".", "getProperty", "(", "pName", ")", ";", "return", "parseDouble", "(", "pName", ",", "pValue", ",", "defaultValue", ")", ";", "}" ]
Gets a double property via a string property name. @param pName - the property name @param defaultValue - the default property value @return a double property
[ "Gets", "a", "double", "property", "via", "a", "string", "property", "name", "." ]
train
https://github.com/jingwei/krati/blob/1ca0f994a7b0c8215b827eac9aaf95789ec08d21/krati-main/src/main/java/krati/core/StoreConfig.java#L447-L450
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurealert.java
br_configurealert.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { """ <pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre> """ br_configurealert_responses result = (br_configurealert_responses) service.get_payload_formatter().string_to_resource(br_configurealert_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_configurealert_response_array); } br_configurealert[] result_br_configurealert = new br_configurealert[result.br_configurealert_response_array.length]; for(int i = 0; i < result.br_configurealert_response_array.length; i++) { result_br_configurealert[i] = result.br_configurealert_response_array[i].br_configurealert[0]; } return result_br_configurealert; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { br_configurealert_responses result = (br_configurealert_responses) service.get_payload_formatter().string_to_resource(br_configurealert_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.br_configurealert_response_array); } br_configurealert[] result_br_configurealert = new br_configurealert[result.br_configurealert_response_array.length]; for(int i = 0; i < result.br_configurealert_response_array.length; i++) { result_br_configurealert[i] = result.br_configurealert_response_array[i].br_configurealert[0]; } return result_br_configurealert; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "br_configurealert_responses", "result", "=", "(", "br_configurealert_responses", ")", "service", ".", "get_payload_formatter", "(", ")", ".", "string_to_resource", "(", "br_configurealert_responses", ".", "class", ",", "response", ")", ";", "if", "(", "result", ".", "errorcode", "!=", "0", ")", "{", "if", "(", "result", ".", "errorcode", "==", "SESSION_NOT_EXISTS", ")", "service", ".", "clear_session", "(", ")", ";", "throw", "new", "nitro_exception", "(", "result", ".", "message", ",", "result", ".", "errorcode", ",", "(", "base_response", "[", "]", ")", "result", ".", "br_configurealert_response_array", ")", ";", "}", "br_configurealert", "[", "]", "result_br_configurealert", "=", "new", "br_configurealert", "[", "result", ".", "br_configurealert_response_array", ".", "length", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "result", ".", "br_configurealert_response_array", ".", "length", ";", "i", "++", ")", "{", "result_br_configurealert", "[", "i", "]", "=", "result", ".", "br_configurealert_response_array", "[", "i", "]", ".", "br_configurealert", "[", "0", "]", ";", "}", "return", "result_br_configurealert", ";", "}" ]
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/br/br_configurealert.java#L178-L195
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/CauchyDistribution.java
CauchyDistribution.logpdf
public static double logpdf(double x, double location, double shape) { """ PDF function, static version. @param x Value @param location Location (x0) @param shape Shape (gamma) @return PDF value """ final double v = (x - location) / shape; return -FastMath.log(Math.PI * shape * (1 + v * v)); }
java
public static double logpdf(double x, double location, double shape) { final double v = (x - location) / shape; return -FastMath.log(Math.PI * shape * (1 + v * v)); }
[ "public", "static", "double", "logpdf", "(", "double", "x", ",", "double", "location", ",", "double", "shape", ")", "{", "final", "double", "v", "=", "(", "x", "-", "location", ")", "/", "shape", ";", "return", "-", "FastMath", ".", "log", "(", "Math", ".", "PI", "*", "shape", "*", "(", "1", "+", "v", "*", "v", ")", ")", ";", "}" ]
PDF function, static version. @param x Value @param location Location (x0) @param shape Shape (gamma) @return PDF value
[ "PDF", "function", "static", "version", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/CauchyDistribution.java#L149-L152
PawelAdamski/HttpClientMock
src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java
HttpClientMockBuilder.doReturnJSON
public HttpClientResponseBuilder doReturnJSON(String response, Charset charset) { """ Adds action which returns provided JSON in provided encoding and status 200. Additionally it sets "Content-type" header to "application/json". @param response JSON to return @return response builder """ return responseBuilder.doReturnJSON(response, charset); }
java
public HttpClientResponseBuilder doReturnJSON(String response, Charset charset) { return responseBuilder.doReturnJSON(response, charset); }
[ "public", "HttpClientResponseBuilder", "doReturnJSON", "(", "String", "response", ",", "Charset", "charset", ")", "{", "return", "responseBuilder", ".", "doReturnJSON", "(", "response", ",", "charset", ")", ";", "}" ]
Adds action which returns provided JSON in provided encoding and status 200. Additionally it sets "Content-type" header to "application/json". @param response JSON to return @return response builder
[ "Adds", "action", "which", "returns", "provided", "JSON", "in", "provided", "encoding", "and", "status", "200", ".", "Additionally", "it", "sets", "Content", "-", "type", "header", "to", "application", "/", "json", "." ]
train
https://github.com/PawelAdamski/HttpClientMock/blob/0205498434bbc0c78c187a51181cac9b266a28fb/src/main/java/com/github/paweladamski/httpclientmock/HttpClientMockBuilder.java#L235-L237
hector-client/hector
core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java
HFactory.getOrCreateCluster
public static Cluster getOrCreateCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator, Map<String, String> credentials) { """ Method tries to create a Cluster instance for an existing Cassandra cluster. If another class already called getOrCreateCluster, the factory returns the cached instance. If the instance doesn't exist in memory, a new ThriftCluster is created and cached. Example usage for a default installation of Cassandra. String clusterName = "Test Cluster"; String host = "localhost:9160"; Cluster cluster = HFactory.getOrCreateCluster(clusterName, new CassandraHostConfigurator(host)); @param clusterName The cluster name. This is an identifying string for the cluster, e.g. "production" or "test" etc. Clusters will be created on demand per each unique clusterName key. @param cassandraHostConfigurator @param credentials The credentials map for authenticating a Keyspace """ return createCluster(clusterName, cassandraHostConfigurator, credentials); }
java
public static Cluster getOrCreateCluster(String clusterName, CassandraHostConfigurator cassandraHostConfigurator, Map<String, String> credentials) { return createCluster(clusterName, cassandraHostConfigurator, credentials); }
[ "public", "static", "Cluster", "getOrCreateCluster", "(", "String", "clusterName", ",", "CassandraHostConfigurator", "cassandraHostConfigurator", ",", "Map", "<", "String", ",", "String", ">", "credentials", ")", "{", "return", "createCluster", "(", "clusterName", ",", "cassandraHostConfigurator", ",", "credentials", ")", ";", "}" ]
Method tries to create a Cluster instance for an existing Cassandra cluster. If another class already called getOrCreateCluster, the factory returns the cached instance. If the instance doesn't exist in memory, a new ThriftCluster is created and cached. Example usage for a default installation of Cassandra. String clusterName = "Test Cluster"; String host = "localhost:9160"; Cluster cluster = HFactory.getOrCreateCluster(clusterName, new CassandraHostConfigurator(host)); @param clusterName The cluster name. This is an identifying string for the cluster, e.g. "production" or "test" etc. Clusters will be created on demand per each unique clusterName key. @param cassandraHostConfigurator @param credentials The credentials map for authenticating a Keyspace
[ "Method", "tries", "to", "create", "a", "Cluster", "instance", "for", "an", "existing", "Cassandra", "cluster", ".", "If", "another", "class", "already", "called", "getOrCreateCluster", "the", "factory", "returns", "the", "cached", "instance", ".", "If", "the", "instance", "doesn", "t", "exist", "in", "memory", "a", "new", "ThriftCluster", "is", "created", "and", "cached", "." ]
train
https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java#L166-L169
JOML-CI/JOML
src/org/joml/Matrix4x3f.java
Matrix4x3f.translationRotateScaleMul
public Matrix4x3f translationRotateScaleMul(Vector3fc translation, Quaternionfc quat, Vector3fc scale, Matrix4x3f m) { """ Set <code>this</code> matrix to <code>T * R * S * M</code>, where <code>T</code> is the given <code>translation</code>, <code>R</code> is a rotation transformation specified by the given quaternion, <code>S</code> is a scaling transformation which scales the axes by <code>scale</code>. <p> When transforming a vector by the resulting matrix the transformation described by <code>M</code> will be applied first, then the scaling, then rotation and at last the translation. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> This method is equivalent to calling: <code>translation(translation).rotate(quat).scale(scale).mul(m)</code> @see #translation(Vector3fc) @see #rotate(Quaternionfc) @param translation the translation @param quat the quaternion representing a rotation @param scale the scaling factors @param m the matrix to multiply by @return this """ return translationRotateScaleMul(translation.x(), translation.y(), translation.z(), quat.x(), quat.y(), quat.z(), quat.w(), scale.x(), scale.y(), scale.z(), m); }
java
public Matrix4x3f translationRotateScaleMul(Vector3fc translation, Quaternionfc quat, Vector3fc scale, Matrix4x3f m) { return translationRotateScaleMul(translation.x(), translation.y(), translation.z(), quat.x(), quat.y(), quat.z(), quat.w(), scale.x(), scale.y(), scale.z(), m); }
[ "public", "Matrix4x3f", "translationRotateScaleMul", "(", "Vector3fc", "translation", ",", "Quaternionfc", "quat", ",", "Vector3fc", "scale", ",", "Matrix4x3f", "m", ")", "{", "return", "translationRotateScaleMul", "(", "translation", ".", "x", "(", ")", ",", "translation", ".", "y", "(", ")", ",", "translation", ".", "z", "(", ")", ",", "quat", ".", "x", "(", ")", ",", "quat", ".", "y", "(", ")", ",", "quat", ".", "z", "(", ")", ",", "quat", ".", "w", "(", ")", ",", "scale", ".", "x", "(", ")", ",", "scale", ".", "y", "(", ")", ",", "scale", ".", "z", "(", ")", ",", "m", ")", ";", "}" ]
Set <code>this</code> matrix to <code>T * R * S * M</code>, where <code>T</code> is the given <code>translation</code>, <code>R</code> is a rotation transformation specified by the given quaternion, <code>S</code> is a scaling transformation which scales the axes by <code>scale</code>. <p> When transforming a vector by the resulting matrix the transformation described by <code>M</code> will be applied first, then the scaling, then rotation and at last the translation. <p> When used with a right-handed coordinate system, the produced rotation will rotate a vector counter-clockwise around the rotation axis, when viewing along the negative axis direction towards the origin. When used with a left-handed coordinate system, the rotation is clockwise. <p> This method is equivalent to calling: <code>translation(translation).rotate(quat).scale(scale).mul(m)</code> @see #translation(Vector3fc) @see #rotate(Quaternionfc) @param translation the translation @param quat the quaternion representing a rotation @param scale the scaling factors @param m the matrix to multiply by @return this
[ "Set", "<code", ">", "this<", "/", "code", ">", "matrix", "to", "<code", ">", "T", "*", "R", "*", "S", "*", "M<", "/", "code", ">", "where", "<code", ">", "T<", "/", "code", ">", "is", "the", "given", "<code", ">", "translation<", "/", "code", ">", "<code", ">", "R<", "/", "code", ">", "is", "a", "rotation", "transformation", "specified", "by", "the", "given", "quaternion", "<code", ">", "S<", "/", "code", ">", "is", "a", "scaling", "transformation", "which", "scales", "the", "axes", "by", "<code", ">", "scale<", "/", "code", ">", ".", "<p", ">", "When", "transforming", "a", "vector", "by", "the", "resulting", "matrix", "the", "transformation", "described", "by", "<code", ">", "M<", "/", "code", ">", "will", "be", "applied", "first", "then", "the", "scaling", "then", "rotation", "and", "at", "last", "the", "translation", ".", "<p", ">", "When", "used", "with", "a", "right", "-", "handed", "coordinate", "system", "the", "produced", "rotation", "will", "rotate", "a", "vector", "counter", "-", "clockwise", "around", "the", "rotation", "axis", "when", "viewing", "along", "the", "negative", "axis", "direction", "towards", "the", "origin", ".", "When", "used", "with", "a", "left", "-", "handed", "coordinate", "system", "the", "rotation", "is", "clockwise", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", ":", "<code", ">", "translation", "(", "translation", ")", ".", "rotate", "(", "quat", ")", ".", "scale", "(", "scale", ")", ".", "mul", "(", "m", ")", "<", "/", "code", ">" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3f.java#L2871-L2873
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagBundle.java
CmsJspTagBundle.getLocale
static Locale getLocale(PageContext pageContext, String name) { """ Returns the locale specified by the named scoped attribute or context configuration parameter. <p> The named scoped attribute is searched in the page, request, session (if valid), and application scope(s) (in this order). If no such attribute exists in any of the scopes, the locale is taken from the named context configuration parameter. @param pageContext the page in which to search for the named scoped attribute or context configuration parameter @param name the name of the scoped attribute or context configuration parameter @return the locale specified by the named scoped attribute or context configuration parameter, or <tt>null</tt> if no scoped attribute or configuration parameter with the given name exists """ Locale loc = null; Object obj = javax.servlet.jsp.jstl.core.Config.find(pageContext, name); if (obj != null) { if (obj instanceof Locale) { loc = (Locale)obj; } else { loc = SetLocaleSupport.parseLocale((String)obj); } } return loc; }
java
static Locale getLocale(PageContext pageContext, String name) { Locale loc = null; Object obj = javax.servlet.jsp.jstl.core.Config.find(pageContext, name); if (obj != null) { if (obj instanceof Locale) { loc = (Locale)obj; } else { loc = SetLocaleSupport.parseLocale((String)obj); } } return loc; }
[ "static", "Locale", "getLocale", "(", "PageContext", "pageContext", ",", "String", "name", ")", "{", "Locale", "loc", "=", "null", ";", "Object", "obj", "=", "javax", ".", "servlet", ".", "jsp", ".", "jstl", ".", "core", ".", "Config", ".", "find", "(", "pageContext", ",", "name", ")", ";", "if", "(", "obj", "!=", "null", ")", "{", "if", "(", "obj", "instanceof", "Locale", ")", "{", "loc", "=", "(", "Locale", ")", "obj", ";", "}", "else", "{", "loc", "=", "SetLocaleSupport", ".", "parseLocale", "(", "(", "String", ")", "obj", ")", ";", "}", "}", "return", "loc", ";", "}" ]
Returns the locale specified by the named scoped attribute or context configuration parameter. <p> The named scoped attribute is searched in the page, request, session (if valid), and application scope(s) (in this order). If no such attribute exists in any of the scopes, the locale is taken from the named context configuration parameter. @param pageContext the page in which to search for the named scoped attribute or context configuration parameter @param name the name of the scoped attribute or context configuration parameter @return the locale specified by the named scoped attribute or context configuration parameter, or <tt>null</tt> if no scoped attribute or configuration parameter with the given name exists
[ "Returns", "the", "locale", "specified", "by", "the", "named", "scoped", "attribute", "or", "context", "configuration", "parameter", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagBundle.java#L135-L149
aws/aws-sdk-java
aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/ListTagsLogGroupResult.java
ListTagsLogGroupResult.withTags
public ListTagsLogGroupResult withTags(java.util.Map<String, String> tags) { """ <p> The tags for the log group. </p> @param tags The tags for the log group. @return Returns a reference to this object so that method calls can be chained together. """ setTags(tags); return this; }
java
public ListTagsLogGroupResult withTags(java.util.Map<String, String> tags) { setTags(tags); return this; }
[ "public", "ListTagsLogGroupResult", "withTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "tags", ")", "{", "setTags", "(", "tags", ")", ";", "return", "this", ";", "}" ]
<p> The tags for the log group. </p> @param tags The tags for the log group. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "for", "the", "log", "group", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-logs/src/main/java/com/amazonaws/services/logs/model/ListTagsLogGroupResult.java#L71-L74
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.appendEventGuardEvaluators
protected void appendEventGuardEvaluators(JvmGenericType container) { """ Append the guard evaluators. @param container the container type. """ final GenerationContext context = getContext(container); if (context != null) { final Collection<Pair<SarlBehaviorUnit, Collection<Procedure1<? super ITreeAppendable>>>> allEvaluators = context.getGuardEvaluationCodes(); if (allEvaluators == null || allEvaluators.isEmpty()) { return; } final JvmTypeReference voidType = this._typeReferenceBuilder.typeRef(Void.TYPE); final JvmTypeReference runnableType = this._typeReferenceBuilder.typeRef(Runnable.class); final JvmTypeReference collectionType = this._typeReferenceBuilder.typeRef(Collection.class, runnableType); for (final Pair<SarlBehaviorUnit, Collection<Procedure1<? super ITreeAppendable>>> evaluators : allEvaluators) { final SarlBehaviorUnit source = evaluators.getKey(); // Determine the name of the operation for the behavior output final String behName = Utils.createNameForHiddenGuardGeneralEvaluatorMethod(source.getName().getSimpleName()); // Create the main function final JvmOperation operation = this.typesFactory.createJvmOperation(); // Annotation for the event bus appendGeneratedAnnotation(operation, context); addAnnotationSafe(operation, PerceptGuardEvaluator.class); // Guard evaluator unit parameters // - Event occurrence JvmFormalParameter jvmParam = this.typesFactory.createJvmFormalParameter(); jvmParam.setName(this.grammarKeywordAccess.getOccurrenceKeyword()); jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(source.getName())); this.associator.associate(source, jvmParam); operation.getParameters().add(jvmParam); // - List of runnables jvmParam = this.typesFactory.createJvmFormalParameter(); jvmParam.setName(RUNNABLE_COLLECTION); jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(collectionType)); operation.getParameters().add(jvmParam); operation.setAbstract(false); operation.setNative(false); operation.setSynchronized(false); operation.setStrictFloatingPoint(false); operation.setFinal(false); operation.setVisibility(JvmVisibility.PRIVATE); operation.setStatic(false); operation.setSimpleName(behName); operation.setReturnType(this.typeBuilder.cloneWithProxies(voidType)); container.getMembers().add(operation); setBody(operation, it -> { it.append("assert "); //$NON-NLS-1$ it.append(this.grammarKeywordAccess.getOccurrenceKeyword()); it.append(" != null;"); //$NON-NLS-1$ it.newLine(); it.append("assert "); //$NON-NLS-1$ it.append(RUNNABLE_COLLECTION); it.append(" != null;"); //$NON-NLS-1$ for (final Procedure1<? super ITreeAppendable> code : evaluators.getValue()) { it.newLine(); code.apply(it); } }); this.associator.associatePrimary(source, operation); this.typeBuilder.copyDocumentationTo(source, operation); } } }
java
protected void appendEventGuardEvaluators(JvmGenericType container) { final GenerationContext context = getContext(container); if (context != null) { final Collection<Pair<SarlBehaviorUnit, Collection<Procedure1<? super ITreeAppendable>>>> allEvaluators = context.getGuardEvaluationCodes(); if (allEvaluators == null || allEvaluators.isEmpty()) { return; } final JvmTypeReference voidType = this._typeReferenceBuilder.typeRef(Void.TYPE); final JvmTypeReference runnableType = this._typeReferenceBuilder.typeRef(Runnable.class); final JvmTypeReference collectionType = this._typeReferenceBuilder.typeRef(Collection.class, runnableType); for (final Pair<SarlBehaviorUnit, Collection<Procedure1<? super ITreeAppendable>>> evaluators : allEvaluators) { final SarlBehaviorUnit source = evaluators.getKey(); // Determine the name of the operation for the behavior output final String behName = Utils.createNameForHiddenGuardGeneralEvaluatorMethod(source.getName().getSimpleName()); // Create the main function final JvmOperation operation = this.typesFactory.createJvmOperation(); // Annotation for the event bus appendGeneratedAnnotation(operation, context); addAnnotationSafe(operation, PerceptGuardEvaluator.class); // Guard evaluator unit parameters // - Event occurrence JvmFormalParameter jvmParam = this.typesFactory.createJvmFormalParameter(); jvmParam.setName(this.grammarKeywordAccess.getOccurrenceKeyword()); jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(source.getName())); this.associator.associate(source, jvmParam); operation.getParameters().add(jvmParam); // - List of runnables jvmParam = this.typesFactory.createJvmFormalParameter(); jvmParam.setName(RUNNABLE_COLLECTION); jvmParam.setParameterType(this.typeBuilder.cloneWithProxies(collectionType)); operation.getParameters().add(jvmParam); operation.setAbstract(false); operation.setNative(false); operation.setSynchronized(false); operation.setStrictFloatingPoint(false); operation.setFinal(false); operation.setVisibility(JvmVisibility.PRIVATE); operation.setStatic(false); operation.setSimpleName(behName); operation.setReturnType(this.typeBuilder.cloneWithProxies(voidType)); container.getMembers().add(operation); setBody(operation, it -> { it.append("assert "); //$NON-NLS-1$ it.append(this.grammarKeywordAccess.getOccurrenceKeyword()); it.append(" != null;"); //$NON-NLS-1$ it.newLine(); it.append("assert "); //$NON-NLS-1$ it.append(RUNNABLE_COLLECTION); it.append(" != null;"); //$NON-NLS-1$ for (final Procedure1<? super ITreeAppendable> code : evaluators.getValue()) { it.newLine(); code.apply(it); } }); this.associator.associatePrimary(source, operation); this.typeBuilder.copyDocumentationTo(source, operation); } } }
[ "protected", "void", "appendEventGuardEvaluators", "(", "JvmGenericType", "container", ")", "{", "final", "GenerationContext", "context", "=", "getContext", "(", "container", ")", ";", "if", "(", "context", "!=", "null", ")", "{", "final", "Collection", "<", "Pair", "<", "SarlBehaviorUnit", ",", "Collection", "<", "Procedure1", "<", "?", "super", "ITreeAppendable", ">", ">", ">", ">", "allEvaluators", "=", "context", ".", "getGuardEvaluationCodes", "(", ")", ";", "if", "(", "allEvaluators", "==", "null", "||", "allEvaluators", ".", "isEmpty", "(", ")", ")", "{", "return", ";", "}", "final", "JvmTypeReference", "voidType", "=", "this", ".", "_typeReferenceBuilder", ".", "typeRef", "(", "Void", ".", "TYPE", ")", ";", "final", "JvmTypeReference", "runnableType", "=", "this", ".", "_typeReferenceBuilder", ".", "typeRef", "(", "Runnable", ".", "class", ")", ";", "final", "JvmTypeReference", "collectionType", "=", "this", ".", "_typeReferenceBuilder", ".", "typeRef", "(", "Collection", ".", "class", ",", "runnableType", ")", ";", "for", "(", "final", "Pair", "<", "SarlBehaviorUnit", ",", "Collection", "<", "Procedure1", "<", "?", "super", "ITreeAppendable", ">", ">", ">", "evaluators", ":", "allEvaluators", ")", "{", "final", "SarlBehaviorUnit", "source", "=", "evaluators", ".", "getKey", "(", ")", ";", "// Determine the name of the operation for the behavior output", "final", "String", "behName", "=", "Utils", ".", "createNameForHiddenGuardGeneralEvaluatorMethod", "(", "source", ".", "getName", "(", ")", ".", "getSimpleName", "(", ")", ")", ";", "// Create the main function", "final", "JvmOperation", "operation", "=", "this", ".", "typesFactory", ".", "createJvmOperation", "(", ")", ";", "// Annotation for the event bus", "appendGeneratedAnnotation", "(", "operation", ",", "context", ")", ";", "addAnnotationSafe", "(", "operation", ",", "PerceptGuardEvaluator", ".", "class", ")", ";", "// Guard evaluator unit parameters", "// - Event occurrence", "JvmFormalParameter", "jvmParam", "=", "this", ".", "typesFactory", ".", "createJvmFormalParameter", "(", ")", ";", "jvmParam", ".", "setName", "(", "this", ".", "grammarKeywordAccess", ".", "getOccurrenceKeyword", "(", ")", ")", ";", "jvmParam", ".", "setParameterType", "(", "this", ".", "typeBuilder", ".", "cloneWithProxies", "(", "source", ".", "getName", "(", ")", ")", ")", ";", "this", ".", "associator", ".", "associate", "(", "source", ",", "jvmParam", ")", ";", "operation", ".", "getParameters", "(", ")", ".", "add", "(", "jvmParam", ")", ";", "// - List of runnables", "jvmParam", "=", "this", ".", "typesFactory", ".", "createJvmFormalParameter", "(", ")", ";", "jvmParam", ".", "setName", "(", "RUNNABLE_COLLECTION", ")", ";", "jvmParam", ".", "setParameterType", "(", "this", ".", "typeBuilder", ".", "cloneWithProxies", "(", "collectionType", ")", ")", ";", "operation", ".", "getParameters", "(", ")", ".", "add", "(", "jvmParam", ")", ";", "operation", ".", "setAbstract", "(", "false", ")", ";", "operation", ".", "setNative", "(", "false", ")", ";", "operation", ".", "setSynchronized", "(", "false", ")", ";", "operation", ".", "setStrictFloatingPoint", "(", "false", ")", ";", "operation", ".", "setFinal", "(", "false", ")", ";", "operation", ".", "setVisibility", "(", "JvmVisibility", ".", "PRIVATE", ")", ";", "operation", ".", "setStatic", "(", "false", ")", ";", "operation", ".", "setSimpleName", "(", "behName", ")", ";", "operation", ".", "setReturnType", "(", "this", ".", "typeBuilder", ".", "cloneWithProxies", "(", "voidType", ")", ")", ";", "container", ".", "getMembers", "(", ")", ".", "add", "(", "operation", ")", ";", "setBody", "(", "operation", ",", "it", "->", "{", "it", ".", "append", "(", "\"assert \"", ")", ";", "//$NON-NLS-1$", "it", ".", "append", "(", "this", ".", "grammarKeywordAccess", ".", "getOccurrenceKeyword", "(", ")", ")", ";", "it", ".", "append", "(", "\" != null;\"", ")", ";", "//$NON-NLS-1$", "it", ".", "newLine", "(", ")", ";", "it", ".", "append", "(", "\"assert \"", ")", ";", "//$NON-NLS-1$", "it", ".", "append", "(", "RUNNABLE_COLLECTION", ")", ";", "it", ".", "append", "(", "\" != null;\"", ")", ";", "//$NON-NLS-1$", "for", "(", "final", "Procedure1", "<", "?", "super", "ITreeAppendable", ">", "code", ":", "evaluators", ".", "getValue", "(", ")", ")", "{", "it", ".", "newLine", "(", ")", ";", "code", ".", "apply", "(", "it", ")", ";", "}", "}", ")", ";", "this", ".", "associator", ".", "associatePrimary", "(", "source", ",", "operation", ")", ";", "this", ".", "typeBuilder", ".", "copyDocumentationTo", "(", "source", ",", "operation", ")", ";", "}", "}", "}" ]
Append the guard evaluators. @param container the container type.
[ "Append", "the", "guard", "evaluators", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L2505-L2572
sagiegurari/fax4j
src/main/java/org/fax4j/bridge/FaxBridgeImpl.java
FaxBridgeImpl.updateFaxJobWithFileInfo
@Override protected void updateFaxJobWithFileInfo(FaxJob faxJob,FileInfo fileInfo) { """ This function stores the file in the local machine and updates the fax job with the new file data. @param faxJob The fax job object to be updated @param fileInfo The file information of the requested fax """ //get file File file=fileInfo.getFile(); if(file==null) { //get file name String fileName=fileInfo.getName(); //get file content byte[] content=fileInfo.getContent(); try { //create temporary file file=File.createTempFile("fax_",fileName); //write content to file IOHelper.writeFile(content,file); } catch(IOException exception) { throw new FaxException("Unable to write file content to temporary file.",exception); } } //update fax job faxJob.setFile(file); }
java
@Override protected void updateFaxJobWithFileInfo(FaxJob faxJob,FileInfo fileInfo) { //get file File file=fileInfo.getFile(); if(file==null) { //get file name String fileName=fileInfo.getName(); //get file content byte[] content=fileInfo.getContent(); try { //create temporary file file=File.createTempFile("fax_",fileName); //write content to file IOHelper.writeFile(content,file); } catch(IOException exception) { throw new FaxException("Unable to write file content to temporary file.",exception); } } //update fax job faxJob.setFile(file); }
[ "@", "Override", "protected", "void", "updateFaxJobWithFileInfo", "(", "FaxJob", "faxJob", ",", "FileInfo", "fileInfo", ")", "{", "//get file", "File", "file", "=", "fileInfo", ".", "getFile", "(", ")", ";", "if", "(", "file", "==", "null", ")", "{", "//get file name", "String", "fileName", "=", "fileInfo", ".", "getName", "(", ")", ";", "//get file content", "byte", "[", "]", "content", "=", "fileInfo", ".", "getContent", "(", ")", ";", "try", "{", "//create temporary file", "file", "=", "File", ".", "createTempFile", "(", "\"fax_\"", ",", "fileName", ")", ";", "//write content to file", "IOHelper", ".", "writeFile", "(", "content", ",", "file", ")", ";", "}", "catch", "(", "IOException", "exception", ")", "{", "throw", "new", "FaxException", "(", "\"Unable to write file content to temporary file.\"", ",", "exception", ")", ";", "}", "}", "//update fax job", "faxJob", ".", "setFile", "(", "file", ")", ";", "}" ]
This function stores the file in the local machine and updates the fax job with the new file data. @param faxJob The fax job object to be updated @param fileInfo The file information of the requested fax
[ "This", "function", "stores", "the", "file", "in", "the", "local", "machine", "and", "updates", "the", "fax", "job", "with", "the", "new", "file", "data", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/bridge/FaxBridgeImpl.java#L85-L115
looly/hutool
hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java
IterUtil.toMap
public static <K, V> Map<K, V> toMap(Iterator<K> keys, Iterator<V> values) { """ 将键列表和值列表转换为Map<br> 以键为准,值与键位置需对应。如果键元素数多于值元素,多余部分值用null代替。<br> 如果值多于键,忽略多余的值。 @param <K> 键类型 @param <V> 值类型 @param keys 键列表 @param values 值列表 @return 标题内容Map @since 3.1.0 """ return toMap(keys, values, false); }
java
public static <K, V> Map<K, V> toMap(Iterator<K> keys, Iterator<V> values) { return toMap(keys, values, false); }
[ "public", "static", "<", "K", ",", "V", ">", "Map", "<", "K", ",", "V", ">", "toMap", "(", "Iterator", "<", "K", ">", "keys", ",", "Iterator", "<", "V", ">", "values", ")", "{", "return", "toMap", "(", "keys", ",", "values", ",", "false", ")", ";", "}" ]
将键列表和值列表转换为Map<br> 以键为准,值与键位置需对应。如果键元素数多于值元素,多余部分值用null代替。<br> 如果值多于键,忽略多余的值。 @param <K> 键类型 @param <V> 值类型 @param keys 键列表 @param values 值列表 @return 标题内容Map @since 3.1.0
[ "将键列表和值列表转换为Map<br", ">", "以键为准,值与键位置需对应。如果键元素数多于值元素,多余部分值用null代替。<br", ">", "如果值多于键,忽略多余的值。" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/collection/IterUtil.java#L404-L406
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/text/TokenStream.java
TokenStream.consumeLong
public long consumeLong() throws ParsingException, IllegalStateException { """ Convert the value of this token to a long, return it, and move to the next token. @return the current token's value, converted to an integer @throws ParsingException if there is no such token to consume, or if the token cannot be converted to a long @throws IllegalStateException if this method was called before the stream was {@link #start() started} """ if (completed) throwNoMoreContent(); // Get the value from the current token ... String value = currentToken().value(); try { long result = Long.parseLong(value); moveToNextToken(); return result; } catch (NumberFormatException e) { Position position = currentToken().position(); String msg = CommonI18n.expectingValidLongAtLineAndColumn.text(value, position.getLine(), position.getColumn()); throw new ParsingException(position, msg); } }
java
public long consumeLong() throws ParsingException, IllegalStateException { if (completed) throwNoMoreContent(); // Get the value from the current token ... String value = currentToken().value(); try { long result = Long.parseLong(value); moveToNextToken(); return result; } catch (NumberFormatException e) { Position position = currentToken().position(); String msg = CommonI18n.expectingValidLongAtLineAndColumn.text(value, position.getLine(), position.getColumn()); throw new ParsingException(position, msg); } }
[ "public", "long", "consumeLong", "(", ")", "throws", "ParsingException", ",", "IllegalStateException", "{", "if", "(", "completed", ")", "throwNoMoreContent", "(", ")", ";", "// Get the value from the current token ...", "String", "value", "=", "currentToken", "(", ")", ".", "value", "(", ")", ";", "try", "{", "long", "result", "=", "Long", ".", "parseLong", "(", "value", ")", ";", "moveToNextToken", "(", ")", ";", "return", "result", ";", "}", "catch", "(", "NumberFormatException", "e", ")", "{", "Position", "position", "=", "currentToken", "(", ")", ".", "position", "(", ")", ";", "String", "msg", "=", "CommonI18n", ".", "expectingValidLongAtLineAndColumn", ".", "text", "(", "value", ",", "position", ".", "getLine", "(", ")", ",", "position", ".", "getColumn", "(", ")", ")", ";", "throw", "new", "ParsingException", "(", "position", ",", "msg", ")", ";", "}", "}" ]
Convert the value of this token to a long, return it, and move to the next token. @return the current token's value, converted to an integer @throws ParsingException if there is no such token to consume, or if the token cannot be converted to a long @throws IllegalStateException if this method was called before the stream was {@link #start() started}
[ "Convert", "the", "value", "of", "this", "token", "to", "a", "long", "return", "it", "and", "move", "to", "the", "next", "token", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/text/TokenStream.java#L502-L515
streamsets/datacollector-api
src/main/java/com/streamsets/pipeline/api/Field.java
Field.createListMap
public static Field createListMap(LinkedHashMap<String, Field> v) { """ Creates a <code>LIST_MAP</code> field. The keys of the ordered Map must be of <code>String</code> type and the values must be of <code>Field</code> type, <code>NULL</code> values are not allowed as key or values. <p/> This method performs a deep copy of the ordered Map. @param v value. @return a <code>List-Map Field</code> with the given value. """ return new Field(Type.LIST_MAP, v); }
java
public static Field createListMap(LinkedHashMap<String, Field> v) { return new Field(Type.LIST_MAP, v); }
[ "public", "static", "Field", "createListMap", "(", "LinkedHashMap", "<", "String", ",", "Field", ">", "v", ")", "{", "return", "new", "Field", "(", "Type", ".", "LIST_MAP", ",", "v", ")", ";", "}" ]
Creates a <code>LIST_MAP</code> field. The keys of the ordered Map must be of <code>String</code> type and the values must be of <code>Field</code> type, <code>NULL</code> values are not allowed as key or values. <p/> This method performs a deep copy of the ordered Map. @param v value. @return a <code>List-Map Field</code> with the given value.
[ "Creates", "a", "<code", ">", "LIST_MAP<", "/", "code", ">", "field", ".", "The", "keys", "of", "the", "ordered", "Map", "must", "be", "of", "<code", ">", "String<", "/", "code", ">", "type", "and", "the", "values", "must", "be", "of", "<code", ">", "Field<", "/", "code", ">", "type", "<code", ">", "NULL<", "/", "code", ">", "values", "are", "not", "allowed", "as", "key", "or", "values", ".", "<p", "/", ">", "This", "method", "performs", "a", "deep", "copy", "of", "the", "ordered", "Map", "." ]
train
https://github.com/streamsets/datacollector-api/blob/ac832a97bea2fcef11f50fac6746e85019adad58/src/main/java/com/streamsets/pipeline/api/Field.java#L391-L393
attribyte/wpdb
src/main/java/org/attribyte/wp/model/ShortcodeParser.java
ShortcodeParser.scanForName
private static String scanForName(int pos, final char[] chars) { """ Scans for a valid shortcode name. @param pos The starting position. @param chars The character array to scan. @return The shortcode name or an empty string if none found or invalid character is encountered. """ StringBuilder buf = new StringBuilder(); while(pos < chars.length) { char ch = chars[pos++]; switch(ch) { case ' ': case ']': return buf.toString(); case '[': case '<': case '>': case '&': case '/': return ""; default: if(ch < 0x20 || Character.isWhitespace(ch)) { return ""; } else { buf.append(ch); } } } return ""; }
java
private static String scanForName(int pos, final char[] chars) { StringBuilder buf = new StringBuilder(); while(pos < chars.length) { char ch = chars[pos++]; switch(ch) { case ' ': case ']': return buf.toString(); case '[': case '<': case '>': case '&': case '/': return ""; default: if(ch < 0x20 || Character.isWhitespace(ch)) { return ""; } else { buf.append(ch); } } } return ""; }
[ "private", "static", "String", "scanForName", "(", "int", "pos", ",", "final", "char", "[", "]", "chars", ")", "{", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", ")", ";", "while", "(", "pos", "<", "chars", ".", "length", ")", "{", "char", "ch", "=", "chars", "[", "pos", "++", "]", ";", "switch", "(", "ch", ")", "{", "case", "'", "'", ":", "case", "'", "'", ":", "return", "buf", ".", "toString", "(", ")", ";", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "return", "\"\"", ";", "default", ":", "if", "(", "ch", "<", "0x20", "||", "Character", ".", "isWhitespace", "(", "ch", ")", ")", "{", "return", "\"\"", ";", "}", "else", "{", "buf", ".", "append", "(", "ch", ")", ";", "}", "}", "}", "return", "\"\"", ";", "}" ]
Scans for a valid shortcode name. @param pos The starting position. @param chars The character array to scan. @return The shortcode name or an empty string if none found or invalid character is encountered.
[ "Scans", "for", "a", "valid", "shortcode", "name", "." ]
train
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/model/ShortcodeParser.java#L318-L341
apache/reef
lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/RuntimeClock.java
RuntimeClock.subscribe
@SuppressWarnings("checkstyle:hiddenfield") private <T extends Time> void subscribe(final Class<T> eventClass, final Set<EventHandler<T>> handlers) { """ Register event handlers for the given event class. @param eventClass Event type to handle. Must be derived from Time. @param handlers One or many event handlers that can process given event type. @param <T> Event type - must be derived from class Time. (i.e. contain a timestamp). """ for (final EventHandler<T> handler : handlers) { LOG.log(Level.FINEST, "Subscribe: event {0} handler {1}", new Object[] {eventClass.getName(), handler}); this.handlers.subscribe(eventClass, handler); } }
java
@SuppressWarnings("checkstyle:hiddenfield") private <T extends Time> void subscribe(final Class<T> eventClass, final Set<EventHandler<T>> handlers) { for (final EventHandler<T> handler : handlers) { LOG.log(Level.FINEST, "Subscribe: event {0} handler {1}", new Object[] {eventClass.getName(), handler}); this.handlers.subscribe(eventClass, handler); } }
[ "@", "SuppressWarnings", "(", "\"checkstyle:hiddenfield\"", ")", "private", "<", "T", "extends", "Time", ">", "void", "subscribe", "(", "final", "Class", "<", "T", ">", "eventClass", ",", "final", "Set", "<", "EventHandler", "<", "T", ">", ">", "handlers", ")", "{", "for", "(", "final", "EventHandler", "<", "T", ">", "handler", ":", "handlers", ")", "{", "LOG", ".", "log", "(", "Level", ".", "FINEST", ",", "\"Subscribe: event {0} handler {1}\"", ",", "new", "Object", "[", "]", "{", "eventClass", ".", "getName", "(", ")", ",", "handler", "}", ")", ";", "this", ".", "handlers", ".", "subscribe", "(", "eventClass", ",", "handler", ")", ";", "}", "}" ]
Register event handlers for the given event class. @param eventClass Event type to handle. Must be derived from Time. @param handlers One or many event handlers that can process given event type. @param <T> Event type - must be derived from class Time. (i.e. contain a timestamp).
[ "Register", "event", "handlers", "for", "the", "given", "event", "class", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/time/runtime/RuntimeClock.java#L264-L270
jbossas/jboss-vfs
src/main/java/org/jboss/vfs/VirtualFile.java
VirtualFile.asDirectoryURI
public URI asDirectoryURI() throws URISyntaxException { """ Get file's URI as a directory. There will always be a trailing {@code "/"} character. @return the uri @throws URISyntaxException if the URI is somehow malformed """ final String pathName = getPathName(false); return new URI(VFSUtils.VFS_PROTOCOL, "", parent == null ? pathName : pathName + "/", null); }
java
public URI asDirectoryURI() throws URISyntaxException { final String pathName = getPathName(false); return new URI(VFSUtils.VFS_PROTOCOL, "", parent == null ? pathName : pathName + "/", null); }
[ "public", "URI", "asDirectoryURI", "(", ")", "throws", "URISyntaxException", "{", "final", "String", "pathName", "=", "getPathName", "(", "false", ")", ";", "return", "new", "URI", "(", "VFSUtils", ".", "VFS_PROTOCOL", ",", "\"\"", ",", "parent", "==", "null", "?", "pathName", ":", "pathName", "+", "\"/\"", ",", "null", ")", ";", "}" ]
Get file's URI as a directory. There will always be a trailing {@code "/"} character. @return the uri @throws URISyntaxException if the URI is somehow malformed
[ "Get", "file", "s", "URI", "as", "a", "directory", ".", "There", "will", "always", "be", "a", "trailing", "{", "@code", "/", "}", "character", "." ]
train
https://github.com/jbossas/jboss-vfs/blob/420f4b896d6178ee5f6758f3421e9f350d2b8ab5/src/main/java/org/jboss/vfs/VirtualFile.java#L558-L561
citrusframework/citrus
modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecutePLSQLBuilder.java
ExecutePLSQLBuilder.sqlResource
public ExecutePLSQLBuilder sqlResource(Resource sqlResource, Charset charset) { """ Setter for external file resource containing the SQL statements to execute. @param sqlResource @param charset """ try { action.setScript(FileUtils.readToString(sqlResource, charset)); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read sql resource", e); } return this; }
java
public ExecutePLSQLBuilder sqlResource(Resource sqlResource, Charset charset) { try { action.setScript(FileUtils.readToString(sqlResource, charset)); } catch (IOException e) { throw new CitrusRuntimeException("Failed to read sql resource", e); } return this; }
[ "public", "ExecutePLSQLBuilder", "sqlResource", "(", "Resource", "sqlResource", ",", "Charset", "charset", ")", "{", "try", "{", "action", ".", "setScript", "(", "FileUtils", ".", "readToString", "(", "sqlResource", ",", "charset", ")", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "CitrusRuntimeException", "(", "\"Failed to read sql resource\"", ",", "e", ")", ";", "}", "return", "this", ";", "}" ]
Setter for external file resource containing the SQL statements to execute. @param sqlResource @param charset
[ "Setter", "for", "external", "file", "resource", "containing", "the", "SQL", "statements", "to", "execute", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-java-dsl/src/main/java/com/consol/citrus/dsl/builder/ExecutePLSQLBuilder.java#L156-L163
OpenTSDB/opentsdb
src/tsd/HttpQuery.java
HttpQuery.escapeJson
static void escapeJson(final String s, final StringBuilder buf) { """ Escapes a string appropriately to be a valid in JSON. Valid JSON strings are defined in RFC 4627, Section 2.5. @param s The string to escape, which is assumed to be in . @param buf The buffer into which to write the escaped string. """ final int length = s.length(); int extra = 0; // First count how many extra chars we'll need, if any. for (int i = 0; i < length; i++) { final char c = s.charAt(i); switch (c) { case '"': case '\\': case '\b': case '\f': case '\n': case '\r': case '\t': extra++; continue; } if (c < 0x001F) { extra += 4; } } if (extra == 0) { buf.append(s); // Nothing to escape. return; } buf.ensureCapacity(buf.length() + length + extra); for (int i = 0; i < length; i++) { final char c = s.charAt(i); switch (c) { case '"': buf.append('\\').append('"'); continue; case '\\': buf.append('\\').append('\\'); continue; case '\b': buf.append('\\').append('b'); continue; case '\f': buf.append('\\').append('f'); continue; case '\n': buf.append('\\').append('n'); continue; case '\r': buf.append('\\').append('r'); continue; case '\t': buf.append('\\').append('t'); continue; } if (c < 0x001F) { buf.append('\\').append('u').append('0').append('0') .append((char) Const.HEX[(c >>> 4) & 0x0F]) .append((char) Const.HEX[c & 0x0F]); } else { buf.append(c); } } }
java
static void escapeJson(final String s, final StringBuilder buf) { final int length = s.length(); int extra = 0; // First count how many extra chars we'll need, if any. for (int i = 0; i < length; i++) { final char c = s.charAt(i); switch (c) { case '"': case '\\': case '\b': case '\f': case '\n': case '\r': case '\t': extra++; continue; } if (c < 0x001F) { extra += 4; } } if (extra == 0) { buf.append(s); // Nothing to escape. return; } buf.ensureCapacity(buf.length() + length + extra); for (int i = 0; i < length; i++) { final char c = s.charAt(i); switch (c) { case '"': buf.append('\\').append('"'); continue; case '\\': buf.append('\\').append('\\'); continue; case '\b': buf.append('\\').append('b'); continue; case '\f': buf.append('\\').append('f'); continue; case '\n': buf.append('\\').append('n'); continue; case '\r': buf.append('\\').append('r'); continue; case '\t': buf.append('\\').append('t'); continue; } if (c < 0x001F) { buf.append('\\').append('u').append('0').append('0') .append((char) Const.HEX[(c >>> 4) & 0x0F]) .append((char) Const.HEX[c & 0x0F]); } else { buf.append(c); } } }
[ "static", "void", "escapeJson", "(", "final", "String", "s", ",", "final", "StringBuilder", "buf", ")", "{", "final", "int", "length", "=", "s", ".", "length", "(", ")", ";", "int", "extra", "=", "0", ";", "// First count how many extra chars we'll need, if any.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "final", "char", "c", "=", "s", ".", "charAt", "(", "i", ")", ";", "switch", "(", "c", ")", "{", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "case", "'", "'", ":", "extra", "++", ";", "continue", ";", "}", "if", "(", "c", "<", "0x001F", ")", "{", "extra", "+=", "4", ";", "}", "}", "if", "(", "extra", "==", "0", ")", "{", "buf", ".", "append", "(", "s", ")", ";", "// Nothing to escape.", "return", ";", "}", "buf", ".", "ensureCapacity", "(", "buf", ".", "length", "(", ")", "+", "length", "+", "extra", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "final", "char", "c", "=", "s", ".", "charAt", "(", "i", ")", ";", "switch", "(", "c", ")", "{", "case", "'", "'", ":", "buf", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "continue", ";", "case", "'", "'", ":", "buf", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "continue", ";", "case", "'", "'", ":", "buf", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "continue", ";", "case", "'", "'", ":", "buf", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "continue", ";", "case", "'", "'", ":", "buf", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "continue", ";", "case", "'", "'", ":", "buf", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "continue", ";", "case", "'", "'", ":", "buf", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ";", "continue", ";", "}", "if", "(", "c", "<", "0x001F", ")", "{", "buf", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "'", "'", ")", ".", "append", "(", "(", "char", ")", "Const", ".", "HEX", "[", "(", "c", ">>>", "4", ")", "&", "0x0F", "]", ")", ".", "append", "(", "(", "char", ")", "Const", ".", "HEX", "[", "c", "&", "0x0F", "]", ")", ";", "}", "else", "{", "buf", ".", "append", "(", "c", ")", ";", "}", "}", "}" ]
Escapes a string appropriately to be a valid in JSON. Valid JSON strings are defined in RFC 4627, Section 2.5. @param s The string to escape, which is assumed to be in . @param buf The buffer into which to write the escaped string.
[ "Escapes", "a", "string", "appropriately", "to", "be", "a", "valid", "in", "JSON", ".", "Valid", "JSON", "strings", "are", "defined", "in", "RFC", "4627", "Section", "2", ".", "5", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpQuery.java#L478-L523
aol/cyclops
cyclops/src/main/java/cyclops/companion/Streams.java
Streams.optionalToStream
public final static <T> Stream<T> optionalToStream(final Optional<T> optional) { """ Convert an Optional to a Stream <pre> {@code Stream<Integer> stream = Streams.optionalToStream(Optional.of(1)); //Stream[1] Stream<Integer> zero = Streams.optionalToStream(Optional.zero()); //Stream[] } </pre> @param optional Optional to convert to a Stream @return Stream with a single value (if present) created from an Optional """ if (optional.isPresent()) return Stream.of(optional.get()); return Stream.of(); }
java
public final static <T> Stream<T> optionalToStream(final Optional<T> optional) { if (optional.isPresent()) return Stream.of(optional.get()); return Stream.of(); }
[ "public", "final", "static", "<", "T", ">", "Stream", "<", "T", ">", "optionalToStream", "(", "final", "Optional", "<", "T", ">", "optional", ")", "{", "if", "(", "optional", ".", "isPresent", "(", ")", ")", "return", "Stream", ".", "of", "(", "optional", ".", "get", "(", ")", ")", ";", "return", "Stream", ".", "of", "(", ")", ";", "}" ]
Convert an Optional to a Stream <pre> {@code Stream<Integer> stream = Streams.optionalToStream(Optional.of(1)); //Stream[1] Stream<Integer> zero = Streams.optionalToStream(Optional.zero()); //Stream[] } </pre> @param optional Optional to convert to a Stream @return Stream with a single value (if present) created from an Optional
[ "Convert", "an", "Optional", "to", "a", "Stream" ]
train
https://github.com/aol/cyclops/blob/59a9fde30190a4d1faeb9f6d9851d209d82b81dd/cyclops/src/main/java/cyclops/companion/Streams.java#L497-L501
jenkinsci/jenkins
core/src/main/java/hudson/util/NoClientBindSSLProtocolSocketFactory.java
NoClientBindSSLProtocolSocketFactory.createSocket
public Socket createSocket( final String host, final int port, final InetAddress localAddress, final int localPort, final HttpConnectionParams params ) throws IOException, UnknownHostException, ConnectTimeoutException { """ Attempts to get a new socket connection to the given host within the given time limit. <p> This method employs several techniques to circumvent the limitations of older JREs that do not support connect timeout. When running in JRE 1.4 or above reflection is used to call Socket#connect(SocketAddress endpoint, int timeout) method. When executing in older JREs a controller thread is executed. The controller thread attempts to create a new socket within the given limit of time. If socket constructor does not return until the timeout expires, the controller terminates and throws an {@link ConnectTimeoutException} </p> @param host the host name/IP @param port the port on the host @param localAddress the local host name/IP to bind the socket to, ignored. @param localPort the port on the local machine, ignored. @param params {@link HttpConnectionParams Http connection parameters} @return Socket a new socket @throws IOException if an I/O error occurs while creating the socket @throws UnknownHostException if the IP address of the host cannot be determined @since 3.0 """ if (params == null) { throw new IllegalArgumentException("Parameters may not be null"); } int timeout = params.getConnectionTimeout(); if (timeout == 0) { return createSocket(host, port); } else { // To be eventually deprecated when migrated to Java 1.4 or above Socket socket = ReflectionSocketFactory.createSocket( "javax.net.ssl.SSLSocketFactory", host, port, null, 0, timeout); if (socket == null) { socket = ControllerThreadSocketFactory.createSocket( this, host, port, null, 0, timeout); } return socket; } }
java
public Socket createSocket( final String host, final int port, final InetAddress localAddress, final int localPort, final HttpConnectionParams params ) throws IOException, UnknownHostException, ConnectTimeoutException { if (params == null) { throw new IllegalArgumentException("Parameters may not be null"); } int timeout = params.getConnectionTimeout(); if (timeout == 0) { return createSocket(host, port); } else { // To be eventually deprecated when migrated to Java 1.4 or above Socket socket = ReflectionSocketFactory.createSocket( "javax.net.ssl.SSLSocketFactory", host, port, null, 0, timeout); if (socket == null) { socket = ControllerThreadSocketFactory.createSocket( this, host, port, null, 0, timeout); } return socket; } }
[ "public", "Socket", "createSocket", "(", "final", "String", "host", ",", "final", "int", "port", ",", "final", "InetAddress", "localAddress", ",", "final", "int", "localPort", ",", "final", "HttpConnectionParams", "params", ")", "throws", "IOException", ",", "UnknownHostException", ",", "ConnectTimeoutException", "{", "if", "(", "params", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Parameters may not be null\"", ")", ";", "}", "int", "timeout", "=", "params", ".", "getConnectionTimeout", "(", ")", ";", "if", "(", "timeout", "==", "0", ")", "{", "return", "createSocket", "(", "host", ",", "port", ")", ";", "}", "else", "{", "// To be eventually deprecated when migrated to Java 1.4 or above", "Socket", "socket", "=", "ReflectionSocketFactory", ".", "createSocket", "(", "\"javax.net.ssl.SSLSocketFactory\"", ",", "host", ",", "port", ",", "null", ",", "0", ",", "timeout", ")", ";", "if", "(", "socket", "==", "null", ")", "{", "socket", "=", "ControllerThreadSocketFactory", ".", "createSocket", "(", "this", ",", "host", ",", "port", ",", "null", ",", "0", ",", "timeout", ")", ";", "}", "return", "socket", ";", "}", "}" ]
Attempts to get a new socket connection to the given host within the given time limit. <p> This method employs several techniques to circumvent the limitations of older JREs that do not support connect timeout. When running in JRE 1.4 or above reflection is used to call Socket#connect(SocketAddress endpoint, int timeout) method. When executing in older JREs a controller thread is executed. The controller thread attempts to create a new socket within the given limit of time. If socket constructor does not return until the timeout expires, the controller terminates and throws an {@link ConnectTimeoutException} </p> @param host the host name/IP @param port the port on the host @param localAddress the local host name/IP to bind the socket to, ignored. @param localPort the port on the local machine, ignored. @param params {@link HttpConnectionParams Http connection parameters} @return Socket a new socket @throws IOException if an I/O error occurs while creating the socket @throws UnknownHostException if the IP address of the host cannot be determined @since 3.0
[ "Attempts", "to", "get", "a", "new", "socket", "connection", "to", "the", "given", "host", "within", "the", "given", "time", "limit", ".", "<p", ">", "This", "method", "employs", "several", "techniques", "to", "circumvent", "the", "limitations", "of", "older", "JREs", "that", "do", "not", "support", "connect", "timeout", ".", "When", "running", "in", "JRE", "1", ".", "4", "or", "above", "reflection", "is", "used", "to", "call", "Socket#connect", "(", "SocketAddress", "endpoint", "int", "timeout", ")", "method", ".", "When", "executing", "in", "older", "JREs", "a", "controller", "thread", "is", "executed", ".", "The", "controller", "thread", "attempts", "to", "create", "a", "new", "socket", "within", "the", "given", "limit", "of", "time", ".", "If", "socket", "constructor", "does", "not", "return", "until", "the", "timeout", "expires", "the", "controller", "terminates", "and", "throws", "an", "{", "@link", "ConnectTimeoutException", "}", "<", "/", "p", ">" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/util/NoClientBindSSLProtocolSocketFactory.java#L105-L128
Bandwidth/java-bandwidth
src/main/java/com/bandwidth/sdk/model/Domain.java
Domain.update
public static Domain update(final String id) throws AppPlatformException, ParseException, IOException, Exception { """ Convenience method to get information about a specific Domain. @param id the domain id. @return information about a specific Domain. @throws AppPlatformException API Exception @throws ParseException Error parsing data @throws IOException unexpected error @throws Exception error """ return update(id, null); }
java
public static Domain update(final String id) throws AppPlatformException, ParseException, IOException, Exception { return update(id, null); }
[ "public", "static", "Domain", "update", "(", "final", "String", "id", ")", "throws", "AppPlatformException", ",", "ParseException", ",", "IOException", ",", "Exception", "{", "return", "update", "(", "id", ",", "null", ")", ";", "}" ]
Convenience method to get information about a specific Domain. @param id the domain id. @return information about a specific Domain. @throws AppPlatformException API Exception @throws ParseException Error parsing data @throws IOException unexpected error @throws Exception error
[ "Convenience", "method", "to", "get", "information", "about", "a", "specific", "Domain", "." ]
train
https://github.com/Bandwidth/java-bandwidth/blob/2124c85148ad6a54d2f2949cb952eb3985830e2a/src/main/java/com/bandwidth/sdk/model/Domain.java#L167-L169
EdwardRaff/JSAT
JSAT/src/jsat/linear/RowColumnOps.java
RowColumnOps.addMultCol
public static void addMultCol(Matrix A, int j, int start, int to, double t, double[] c) { """ Updates the values of column <tt>j</tt> in the given matrix to be A[:,j] = A[:,j]+c[:]*<tt>t</tt>.<br> The Matrix <tt>A</tt> and array <tt>c</tt> do not need to have the same dimensions, so long as they both have indices in the given range. @param A the matrix to perform he update on @param j the row to update @param start the first index of the row to update from (inclusive) @param to the last index of the row to update (exclusive) @param t the constant to multiply all elements of <tt>c</tt> by @param c the array of values to pairwise multiply by <tt>t</tt> before adding to the elements of A """ for(int i = start; i < to; i++) A.increment(i, j, c[i]*t); }
java
public static void addMultCol(Matrix A, int j, int start, int to, double t, double[] c) { for(int i = start; i < to; i++) A.increment(i, j, c[i]*t); }
[ "public", "static", "void", "addMultCol", "(", "Matrix", "A", ",", "int", "j", ",", "int", "start", ",", "int", "to", ",", "double", "t", ",", "double", "[", "]", "c", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "to", ";", "i", "++", ")", "A", ".", "increment", "(", "i", ",", "j", ",", "[", "i", "]", "*", "t", ")", ";", "}" ]
Updates the values of column <tt>j</tt> in the given matrix to be A[:,j] = A[:,j]+c[:]*<tt>t</tt>.<br> The Matrix <tt>A</tt> and array <tt>c</tt> do not need to have the same dimensions, so long as they both have indices in the given range. @param A the matrix to perform he update on @param j the row to update @param start the first index of the row to update from (inclusive) @param to the last index of the row to update (exclusive) @param t the constant to multiply all elements of <tt>c</tt> by @param c the array of values to pairwise multiply by <tt>t</tt> before adding to the elements of A
[ "Updates", "the", "values", "of", "column", "<tt", ">", "j<", "/", "tt", ">", "in", "the", "given", "matrix", "to", "be", "A", "[", ":", "j", "]", "=", "A", "[", ":", "j", "]", "+", "c", "[", ":", "]", "*", "<tt", ">", "t<", "/", "tt", ">", ".", "<br", ">", "The", "Matrix", "<tt", ">", "A<", "/", "tt", ">", "and", "array", "<tt", ">", "c<", "/", "tt", ">", "do", "not", "need", "to", "have", "the", "same", "dimensions", "so", "long", "as", "they", "both", "have", "indices", "in", "the", "given", "range", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/RowColumnOps.java#L327-L331
FasterXML/woodstox
src/main/java/com/ctc/wstx/dtd/DTDAttribute.java
DTDAttribute.validate
public String validate(DTDValidatorBase v, String value, boolean normalize) throws XMLStreamException { """ <p> Note: the default implementation is not optimized, as it does a potentially unnecessary copy of the contents. It is expected that this method is seldom called (Woodstox never directly calls it; it only gets called for chained validators when one validator normalizes the value, and then following validators are passed a String, not char array) """ int len = value.length(); /* Temporary buffer has to come from the validator itself, since * attribute objects are stateless and shared... */ char[] cbuf = v.getTempAttrValueBuffer(value.length()); if (len > 0) { value.getChars(0, len, cbuf, 0); } return validate(v, cbuf, 0, len, normalize); }
java
public String validate(DTDValidatorBase v, String value, boolean normalize) throws XMLStreamException { int len = value.length(); /* Temporary buffer has to come from the validator itself, since * attribute objects are stateless and shared... */ char[] cbuf = v.getTempAttrValueBuffer(value.length()); if (len > 0) { value.getChars(0, len, cbuf, 0); } return validate(v, cbuf, 0, len, normalize); }
[ "public", "String", "validate", "(", "DTDValidatorBase", "v", ",", "String", "value", ",", "boolean", "normalize", ")", "throws", "XMLStreamException", "{", "int", "len", "=", "value", ".", "length", "(", ")", ";", "/* Temporary buffer has to come from the validator itself, since\n * attribute objects are stateless and shared...\n */", "char", "[", "]", "cbuf", "=", "v", ".", "getTempAttrValueBuffer", "(", "value", ".", "length", "(", ")", ")", ";", "if", "(", "len", ">", "0", ")", "{", "value", ".", "getChars", "(", "0", ",", "len", ",", "cbuf", ",", "0", ")", ";", "}", "return", "validate", "(", "v", ",", "cbuf", ",", "0", ",", "len", ",", "normalize", ")", ";", "}" ]
<p> Note: the default implementation is not optimized, as it does a potentially unnecessary copy of the contents. It is expected that this method is seldom called (Woodstox never directly calls it; it only gets called for chained validators when one validator normalizes the value, and then following validators are passed a String, not char array)
[ "<p", ">", "Note", ":", "the", "default", "implementation", "is", "not", "optimized", "as", "it", "does", "a", "potentially", "unnecessary", "copy", "of", "the", "contents", ".", "It", "is", "expected", "that", "this", "method", "is", "seldom", "called", "(", "Woodstox", "never", "directly", "calls", "it", ";", "it", "only", "gets", "called", "for", "chained", "validators", "when", "one", "validator", "normalizes", "the", "value", "and", "then", "following", "validators", "are", "passed", "a", "String", "not", "char", "array", ")" ]
train
https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/dtd/DTDAttribute.java#L226-L238
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java
UsersInner.listByDataBoxEdgeDeviceAsync
public Observable<Page<UserInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) { """ Gets all the users registered on a data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;UserInner&gt; object """ return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName) .map(new Func1<ServiceResponse<Page<UserInner>>, Page<UserInner>>() { @Override public Page<UserInner> call(ServiceResponse<Page<UserInner>> response) { return response.body(); } }); }
java
public Observable<Page<UserInner>> listByDataBoxEdgeDeviceAsync(final String deviceName, final String resourceGroupName) { return listByDataBoxEdgeDeviceWithServiceResponseAsync(deviceName, resourceGroupName) .map(new Func1<ServiceResponse<Page<UserInner>>, Page<UserInner>>() { @Override public Page<UserInner> call(ServiceResponse<Page<UserInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "UserInner", ">", ">", "listByDataBoxEdgeDeviceAsync", "(", "final", "String", "deviceName", ",", "final", "String", "resourceGroupName", ")", "{", "return", "listByDataBoxEdgeDeviceWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "UserInner", ">", ">", ",", "Page", "<", "UserInner", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "UserInner", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "UserInner", ">", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Gets all the users registered on a data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;UserInner&gt; object
[ "Gets", "all", "the", "users", "registered", "on", "a", "data", "box", "edge", "/", "gateway", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/UsersInner.java#L143-L151
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java
MapMessage.asString
public String asString(final String format) { """ Formats the Structured data as described in <a href="https://tools.ietf.org/html/rfc5424">RFC 5424</a>. @param format The format identifier. @return The formatted String. """ try { return format(EnglishEnums.valueOf(MapFormat.class, format), new StringBuilder()).toString(); } catch (final IllegalArgumentException ex) { return asString(); } }
java
public String asString(final String format) { try { return format(EnglishEnums.valueOf(MapFormat.class, format), new StringBuilder()).toString(); } catch (final IllegalArgumentException ex) { return asString(); } }
[ "public", "String", "asString", "(", "final", "String", "format", ")", "{", "try", "{", "return", "format", "(", "EnglishEnums", ".", "valueOf", "(", "MapFormat", ".", "class", ",", "format", ")", ",", "new", "StringBuilder", "(", ")", ")", ".", "toString", "(", ")", ";", "}", "catch", "(", "final", "IllegalArgumentException", "ex", ")", "{", "return", "asString", "(", ")", ";", "}", "}" ]
Formats the Structured data as described in <a href="https://tools.ietf.org/html/rfc5424">RFC 5424</a>. @param format The format identifier. @return The formatted String.
[ "Formats", "the", "Structured", "data", "as", "described", "in", "<a", "href", "=", "https", ":", "//", "tools", ".", "ietf", ".", "org", "/", "html", "/", "rfc5424", ">", "RFC", "5424<", "/", "a", ">", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/message/MapMessage.java#L243-L249