repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/BundleProcessingStatus.java
BundleProcessingStatus.addPostProcessVariant
public void addPostProcessVariant(String variantType, VariantSet variantSet) { Map<String, VariantSet> variantMap = new HashMap<>(); variantMap.put(variantType, variantSet); addPostProcessVariant(variantMap); }
java
public void addPostProcessVariant(String variantType, VariantSet variantSet) { Map<String, VariantSet> variantMap = new HashMap<>(); variantMap.put(variantType, variantSet); addPostProcessVariant(variantMap); }
[ "public", "void", "addPostProcessVariant", "(", "String", "variantType", ",", "VariantSet", "variantSet", ")", "{", "Map", "<", "String", ",", "VariantSet", ">", "variantMap", "=", "new", "HashMap", "<>", "(", ")", ";", "variantMap", ".", "put", "(", "varian...
Add a post process variant @param variantType the variant type @param variantSet the variant set
[ "Add", "a", "post", "process", "variant" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/postprocess/BundleProcessingStatus.java#L245-L250
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java
ElasticPoolsInner.getAsync
public Observable<ElasticPoolInner> getAsync(String resourceGroupName, String serverName, String elasticPoolName) { return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1<ServiceResponse<ElasticPoolInner>, ElasticPoolInner>() { @Override public ElasticPoolInner call(ServiceResponse<ElasticPoolInner> response) { return response.body(); } }); }
java
public Observable<ElasticPoolInner> getAsync(String resourceGroupName, String serverName, String elasticPoolName) { return getWithServiceResponseAsync(resourceGroupName, serverName, elasticPoolName).map(new Func1<ServiceResponse<ElasticPoolInner>, ElasticPoolInner>() { @Override public ElasticPoolInner call(ServiceResponse<ElasticPoolInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ElasticPoolInner", ">", "getAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "elasticPoolName", ")", "{", "return", "getWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "e...
Gets an elastic pool. @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 serverName The name of the server. @param elasticPoolName The name of the elastic pool to be retrieved. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ElasticPoolInner object
[ "Gets", "an", "elastic", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ElasticPoolsInner.java#L603-L610
lukas-krecan/completion-stage
src/main/java/net/javacrumbs/completionstage/CompletionStageFactory.java
CompletionStageFactory.supplyAsync
public final <U> CompletionStage<U> supplyAsync(Supplier<U> supplier) { return supplyAsync(supplier, defaultAsyncExecutor); }
java
public final <U> CompletionStage<U> supplyAsync(Supplier<U> supplier) { return supplyAsync(supplier, defaultAsyncExecutor); }
[ "public", "final", "<", "U", ">", "CompletionStage", "<", "U", ">", "supplyAsync", "(", "Supplier", "<", "U", ">", "supplier", ")", "{", "return", "supplyAsync", "(", "supplier", ",", "defaultAsyncExecutor", ")", ";", "}" ]
Returns a new CompletionStage that is asynchronously completed by a task running in the defaultAsyncExecutor with the value obtained by calling the given Supplier. @param supplier a function returning the value to be used to complete the returned CompletionStage @param <U> the function's return type @return the new CompletionStage
[ "Returns", "a", "new", "CompletionStage", "that", "is", "asynchronously", "completed", "by", "a", "task", "running", "in", "the", "defaultAsyncExecutor", "with", "the", "value", "obtained", "by", "calling", "the", "given", "Supplier", "." ]
train
https://github.com/lukas-krecan/completion-stage/blob/9c270d779b5fc98dc958a5fb335f6e2ad9d06962/src/main/java/net/javacrumbs/completionstage/CompletionStageFactory.java#L72-L74
gwtbootstrap3/gwtbootstrap3-extras
src/main/java/org/gwtbootstrap3/extras/typeahead/client/ui/Typeahead.java
Typeahead.onCursorChanged
private void onCursorChanged(final Event event, final Suggestion<T> suggestion) { TypeaheadCursorChangedEvent.fire(this, suggestion, event); }
java
private void onCursorChanged(final Event event, final Suggestion<T> suggestion) { TypeaheadCursorChangedEvent.fire(this, suggestion, event); }
[ "private", "void", "onCursorChanged", "(", "final", "Event", "event", ",", "final", "Suggestion", "<", "T", ">", "suggestion", ")", "{", "TypeaheadCursorChangedEvent", ".", "fire", "(", "this", ",", "suggestion", ",", "event", ")", ";", "}" ]
Triggered when the dropdown menu cursor is moved to a different suggestion. @param event the event @param suggestion the suggestion object
[ "Triggered", "when", "the", "dropdown", "menu", "cursor", "is", "moved", "to", "a", "different", "suggestion", "." ]
train
https://github.com/gwtbootstrap3/gwtbootstrap3-extras/blob/8e42aaffd2a082e9cb23a14c37a3c87b7cbdfa94/src/main/java/org/gwtbootstrap3/extras/typeahead/client/ui/Typeahead.java#L180-L182
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRJassimpAdapter.java
GVRJassimpAdapter.fixKeys
private void fixKeys(GVRAnimationChannel channel, Vector3f scaleFactor) { float[] temp = new float[3]; for (int i = 0; i < channel.getNumPosKeys(); ++i) { float time = (float) channel.getPosKeyTime(i); channel.getPosKeyVector(i, temp); temp[0] *= scaleFactor.x; temp[1] *= scaleFactor.y; temp[2] *= scaleFactor.z; channel.setPosKeyVector(i, time, temp); } for (int i = 0; i < channel.getNumScaleKeys(); ++i) { float time = (float) channel.getScaleKeyTime(i); channel.getScaleKeyVector(i, temp); temp[0] *= scaleFactor.x; temp[1] *= scaleFactor.y; temp[2] *= scaleFactor.z; channel.setScaleKeyVector(i, time, temp); } }
java
private void fixKeys(GVRAnimationChannel channel, Vector3f scaleFactor) { float[] temp = new float[3]; for (int i = 0; i < channel.getNumPosKeys(); ++i) { float time = (float) channel.getPosKeyTime(i); channel.getPosKeyVector(i, temp); temp[0] *= scaleFactor.x; temp[1] *= scaleFactor.y; temp[2] *= scaleFactor.z; channel.setPosKeyVector(i, time, temp); } for (int i = 0; i < channel.getNumScaleKeys(); ++i) { float time = (float) channel.getScaleKeyTime(i); channel.getScaleKeyVector(i, temp); temp[0] *= scaleFactor.x; temp[1] *= scaleFactor.y; temp[2] *= scaleFactor.z; channel.setScaleKeyVector(i, time, temp); } }
[ "private", "void", "fixKeys", "(", "GVRAnimationChannel", "channel", ",", "Vector3f", "scaleFactor", ")", "{", "float", "[", "]", "temp", "=", "new", "float", "[", "3", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "channel", ".", "getNu...
/* Some FBX files are exported as centimeters. Assimp does not correctly compute the scale keys. They should include the scaling from the bind pose since the animations are NOT relative to the bind pose.
[ "/", "*", "Some", "FBX", "files", "are", "exported", "as", "centimeters", ".", "Assimp", "does", "not", "correctly", "compute", "the", "scale", "keys", ".", "They", "should", "include", "the", "scaling", "from", "the", "bind", "pose", "since", "the", "anim...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRJassimpAdapter.java#L647-L668
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java
QueryExecutorImpl.startCopy
public synchronized CopyOperation startCopy(String sql, boolean suppressBegin) throws SQLException { waitOnLock(); if (!suppressBegin) { doSubprotocolBegin(); } byte[] buf = Utils.encodeUTF8(sql); try { LOGGER.log(Level.FINEST, " FE=> Query(CopyStart)"); pgStream.sendChar('Q'); pgStream.sendInteger4(buf.length + 4 + 1); pgStream.send(buf); pgStream.sendChar(0); pgStream.flush(); return processCopyResults(null, true); // expect a CopyInResponse or CopyOutResponse to our query above } catch (IOException ioe) { throw new PSQLException(GT.tr("Database connection failed when starting copy"), PSQLState.CONNECTION_FAILURE, ioe); } }
java
public synchronized CopyOperation startCopy(String sql, boolean suppressBegin) throws SQLException { waitOnLock(); if (!suppressBegin) { doSubprotocolBegin(); } byte[] buf = Utils.encodeUTF8(sql); try { LOGGER.log(Level.FINEST, " FE=> Query(CopyStart)"); pgStream.sendChar('Q'); pgStream.sendInteger4(buf.length + 4 + 1); pgStream.send(buf); pgStream.sendChar(0); pgStream.flush(); return processCopyResults(null, true); // expect a CopyInResponse or CopyOutResponse to our query above } catch (IOException ioe) { throw new PSQLException(GT.tr("Database connection failed when starting copy"), PSQLState.CONNECTION_FAILURE, ioe); } }
[ "public", "synchronized", "CopyOperation", "startCopy", "(", "String", "sql", ",", "boolean", "suppressBegin", ")", "throws", "SQLException", "{", "waitOnLock", "(", ")", ";", "if", "(", "!", "suppressBegin", ")", "{", "doSubprotocolBegin", "(", ")", ";", "}",...
Sends given query to BE to start, initialize and lock connection for a CopyOperation. @param sql COPY FROM STDIN / COPY TO STDOUT statement @return CopyIn or CopyOut operation object @throws SQLException on failure
[ "Sends", "given", "query", "to", "BE", "to", "start", "initialize", "and", "lock", "connection", "for", "a", "CopyOperation", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/core/v3/QueryExecutorImpl.java#L853-L876
alkacon/opencms-core
src-setup/org/opencms/setup/CmsSetupBean.java
CmsSetupBean.setStartView
public void setStartView(String userName, String view) throws CmsException { try { CmsUser user = m_cms.readUser(userName); user.getAdditionalInfo().put( CmsUserSettings.PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + CmsWorkplaceConfiguration.N_WORKPLACEVIEW, view); m_cms.writeUser(user); } catch (CmsException e) { e.printStackTrace(System.err); throw e; } }
java
public void setStartView(String userName, String view) throws CmsException { try { CmsUser user = m_cms.readUser(userName); user.getAdditionalInfo().put( CmsUserSettings.PREFERENCES + CmsWorkplaceConfiguration.N_WORKPLACESTARTUPSETTINGS + CmsWorkplaceConfiguration.N_WORKPLACEVIEW, view); m_cms.writeUser(user); } catch (CmsException e) { e.printStackTrace(System.err); throw e; } }
[ "public", "void", "setStartView", "(", "String", "userName", ",", "String", "view", ")", "throws", "CmsException", "{", "try", "{", "CmsUser", "user", "=", "m_cms", ".", "readUser", "(", "userName", ")", ";", "user", ".", "getAdditionalInfo", "(", ")", "."...
Sets the start view for the given user.<p> @param userName the name of the user @param view the start view path @throws CmsException if something goes wrong
[ "Sets", "the", "start", "view", "for", "the", "given", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/CmsSetupBean.java#L2235-L2250
fuinorg/utils4j
src/main/java/org/fuin/utils4j/JandexUtils.java
JandexUtils.indexClasspath
public static void indexClasspath(final URLClassLoader classLoader, final Indexer indexer, final List<File> knownFiles) { // Variant that works with Maven "exec:java" final List<File> classPathFiles = Utils4J.localFilesFromUrlClassLoader(classLoader); for (final File file : classPathFiles) { if (Utils4J.nonJreJarFile(file)) { indexJar(indexer, knownFiles, file); } else if (file.isDirectory() && !file.getName().startsWith(".")) { indexDir(indexer, knownFiles, file); } } // Variant that works for Maven surefire tests for (final File file : Utils4J.classpathFiles(Utils4J::nonJreJarFile)) { indexJar(indexer, knownFiles, file); } for (final File file : Utils4J.classpathFiles(Utils4J::classFile)) { indexClassFile(indexer, knownFiles, file); } }
java
public static void indexClasspath(final URLClassLoader classLoader, final Indexer indexer, final List<File> knownFiles) { // Variant that works with Maven "exec:java" final List<File> classPathFiles = Utils4J.localFilesFromUrlClassLoader(classLoader); for (final File file : classPathFiles) { if (Utils4J.nonJreJarFile(file)) { indexJar(indexer, knownFiles, file); } else if (file.isDirectory() && !file.getName().startsWith(".")) { indexDir(indexer, knownFiles, file); } } // Variant that works for Maven surefire tests for (final File file : Utils4J.classpathFiles(Utils4J::nonJreJarFile)) { indexJar(indexer, knownFiles, file); } for (final File file : Utils4J.classpathFiles(Utils4J::classFile)) { indexClassFile(indexer, knownFiles, file); } }
[ "public", "static", "void", "indexClasspath", "(", "final", "URLClassLoader", "classLoader", ",", "final", "Indexer", "indexer", ",", "final", "List", "<", "File", ">", "knownFiles", ")", "{", "// Variant that works with Maven \"exec:java\"", "final", "List", "<", "...
Indexes all classes in the classpath (*.jar or *.class). @param classLoader Class loader to use. @param indexer Indexer to use. @param knownFiles List of files already analyzed. New files will be added within this method.
[ "Indexes", "all", "classes", "in", "the", "classpath", "(", "*", ".", "jar", "or", "*", ".", "class", ")", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/JandexUtils.java#L137-L157
esigate/esigate
esigate-core/src/main/java/org/esigate/http/HttpResponseUtils.java
HttpResponseUtils.writeTo
public static void writeTo(final HttpEntity httpEntity, final OutputStream outstream) throws IOException { Args.notNull(outstream, "Output stream"); try (InputStream instream = httpEntity.getContent()) { final byte[] buffer = new byte[OUTPUT_BUFFER_SIZE]; int l; if (httpEntity.getContentLength() < 0) { // consume until EOF while ((l = instream.read(buffer)) != -1) { outstream.write(buffer, 0, l); outstream.flush(); LOG.debug("Flushed {} bytes of data"); } } else { // consume no more than length long remaining = httpEntity.getContentLength(); while (remaining > 0) { l = instream.read(buffer, 0, (int) Math.min(OUTPUT_BUFFER_SIZE, remaining)); if (l == -1) { break; } outstream.write(buffer, 0, l); outstream.flush(); LOG.debug("Flushed {} bytes of data"); remaining -= l; } } } }
java
public static void writeTo(final HttpEntity httpEntity, final OutputStream outstream) throws IOException { Args.notNull(outstream, "Output stream"); try (InputStream instream = httpEntity.getContent()) { final byte[] buffer = new byte[OUTPUT_BUFFER_SIZE]; int l; if (httpEntity.getContentLength() < 0) { // consume until EOF while ((l = instream.read(buffer)) != -1) { outstream.write(buffer, 0, l); outstream.flush(); LOG.debug("Flushed {} bytes of data"); } } else { // consume no more than length long remaining = httpEntity.getContentLength(); while (remaining > 0) { l = instream.read(buffer, 0, (int) Math.min(OUTPUT_BUFFER_SIZE, remaining)); if (l == -1) { break; } outstream.write(buffer, 0, l); outstream.flush(); LOG.debug("Flushed {} bytes of data"); remaining -= l; } } } }
[ "public", "static", "void", "writeTo", "(", "final", "HttpEntity", "httpEntity", ",", "final", "OutputStream", "outstream", ")", "throws", "IOException", "{", "Args", ".", "notNull", "(", "outstream", ",", "\"Output stream\"", ")", ";", "try", "(", "InputStream"...
Copied from org.apache.http.entity.InputStreamEntity.writeTo(OutputStream) method but flushes the buffer after each read in order to allow streaming and web sockets. @param httpEntity The entity to copy to the OutputStream @param outstream The OutputStream @throws IOException If a problem occurs
[ "Copied", "from", "org", ".", "apache", ".", "http", ".", "entity", ".", "InputStreamEntity", ".", "writeTo", "(", "OutputStream", ")", "method", "but", "flushes", "the", "buffer", "after", "each", "read", "in", "order", "to", "allow", "streaming", "and", ...
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/http/HttpResponseUtils.java#L237-L264
carewebframework/carewebframework-core
org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java
ElementPlugin.tryRegisterListener
public boolean tryRegisterListener(Object object, boolean register) { boolean success = false; if (object instanceof IPluginEvent) { if (register) { registerListener((IPluginEvent) object); } else { unregisterListener((IPluginEvent) object); } success = true; } if (object instanceof IPluginEventListener) { if (register) { registerListener((IPluginEventListener) object); } else { unregisterListener((IPluginEventListener) object); } success = true; } return success; }
java
public boolean tryRegisterListener(Object object, boolean register) { boolean success = false; if (object instanceof IPluginEvent) { if (register) { registerListener((IPluginEvent) object); } else { unregisterListener((IPluginEvent) object); } success = true; } if (object instanceof IPluginEventListener) { if (register) { registerListener((IPluginEventListener) object); } else { unregisterListener((IPluginEventListener) object); } success = true; } return success; }
[ "public", "boolean", "tryRegisterListener", "(", "Object", "object", ",", "boolean", "register", ")", "{", "boolean", "success", "=", "false", ";", "if", "(", "object", "instanceof", "IPluginEvent", ")", "{", "if", "(", "register", ")", "{", "registerListener"...
Attempts to register or unregister an object as an event listener. @param object Object to register/unregister. @param register If true, we are attempting to register. If false, unregister. @return True if operation was successful. False if the object supports none of the recognized event listeners.
[ "Attempts", "to", "register", "or", "unregister", "an", "object", "as", "an", "event", "listener", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.shell/src/main/java/org/carewebframework/shell/elements/ElementPlugin.java#L705-L727
intive-FDV/DynamicJasper
src/main/java/ar/com/fdvs/dj/util/HyperLinkUtil.java
HyperLinkUtil.applyHyperLinkToElement
public static void applyHyperLinkToElement(DynamicJasperDesign design, DJHyperLink djlink, JRDesignChart chart, String name) { JRDesignExpression hlpe = ExpressionUtils.createAndRegisterExpression(design, name, djlink.getExpression()); chart.setHyperlinkReferenceExpression(hlpe); chart.setHyperlinkType( HyperlinkTypeEnum.REFERENCE ); //FIXME Should this be a parameter in the future? if (djlink.getTooltip() != null){ JRDesignExpression tooltipExp = ExpressionUtils.createAndRegisterExpression(design, "tooltip_" + name, djlink.getTooltip()); chart.setHyperlinkTooltipExpression(tooltipExp); } }
java
public static void applyHyperLinkToElement(DynamicJasperDesign design, DJHyperLink djlink, JRDesignChart chart, String name) { JRDesignExpression hlpe = ExpressionUtils.createAndRegisterExpression(design, name, djlink.getExpression()); chart.setHyperlinkReferenceExpression(hlpe); chart.setHyperlinkType( HyperlinkTypeEnum.REFERENCE ); //FIXME Should this be a parameter in the future? if (djlink.getTooltip() != null){ JRDesignExpression tooltipExp = ExpressionUtils.createAndRegisterExpression(design, "tooltip_" + name, djlink.getTooltip()); chart.setHyperlinkTooltipExpression(tooltipExp); } }
[ "public", "static", "void", "applyHyperLinkToElement", "(", "DynamicJasperDesign", "design", ",", "DJHyperLink", "djlink", ",", "JRDesignChart", "chart", ",", "String", "name", ")", "{", "JRDesignExpression", "hlpe", "=", "ExpressionUtils", ".", "createAndRegisterExpres...
Creates necessary objects to make a chart an hyperlink @param design @param djlink @param chart @param name
[ "Creates", "necessary", "objects", "to", "make", "a", "chart", "an", "hyperlink" ]
train
https://github.com/intive-FDV/DynamicJasper/blob/63919574cc401ae40574d13129f628e66d1682a3/src/main/java/ar/com/fdvs/dj/util/HyperLinkUtil.java#L95-L104
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XStringForFSB.java
XStringForFSB.indexOf
public int indexOf(int ch, int fromIndex) { int max = m_start + m_length; FastStringBuffer fsb = fsb(); if (fromIndex < 0) { fromIndex = 0; } else if (fromIndex >= m_length) { // Note: fromIndex might be near -1>>>1. return -1; } for (int i = m_start + fromIndex; i < max; i++) { if (fsb.charAt(i) == ch) { return i - m_start; } } return -1; }
java
public int indexOf(int ch, int fromIndex) { int max = m_start + m_length; FastStringBuffer fsb = fsb(); if (fromIndex < 0) { fromIndex = 0; } else if (fromIndex >= m_length) { // Note: fromIndex might be near -1>>>1. return -1; } for (int i = m_start + fromIndex; i < max; i++) { if (fsb.charAt(i) == ch) { return i - m_start; } } return -1; }
[ "public", "int", "indexOf", "(", "int", "ch", ",", "int", "fromIndex", ")", "{", "int", "max", "=", "m_start", "+", "m_length", ";", "FastStringBuffer", "fsb", "=", "fsb", "(", ")", ";", "if", "(", "fromIndex", "<", "0", ")", "{", "fromIndex", "=", ...
Returns the index within this string of the first occurrence of the specified character, starting the search at the specified index. <p> If a character with value <code>ch</code> occurs in the character sequence represented by this <code>String</code> object at an index no smaller than <code>fromIndex</code>, then the index of the first such occurrence is returned--that is, the smallest value <i>k</i> such that: <blockquote><pre> (this.charAt(<i>k</i>) == ch) && (<i>k</i> >= fromIndex) </pre></blockquote> is true. If no such character occurs in this string at or after position <code>fromIndex</code>, then <code>-1</code> is returned. <p> There is no restriction on the value of <code>fromIndex</code>. If it is negative, it has the same effect as if it were zero: this entire string may be searched. If it is greater than the length of this string, it has the same effect as if it were equal to the length of this string: <code>-1</code> is returned. @param ch a character. @param fromIndex the index to start the search from. @return the index of the first occurrence of the character in the character sequence represented by this object that is greater than or equal to <code>fromIndex</code>, or <code>-1</code> if the character does not occur.
[ "Returns", "the", "index", "within", "this", "string", "of", "the", "first", "occurrence", "of", "the", "specified", "character", "starting", "the", "search", "at", "the", "specified", "index", ".", "<p", ">", "If", "a", "character", "with", "value", "<code"...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XStringForFSB.java#L707-L733
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java
FileUtils.loadFileListRelativeTo
public static ImmutableList<File> loadFileListRelativeTo(File fileList, File basePath) throws IOException { checkNotNull(basePath); final ImmutableList.Builder<File> ret = ImmutableList.builder(); for (final String filename : Files.readLines(fileList, Charsets.UTF_8)) { if (!filename.isEmpty() && !isCommentLine(filename)) { ret.add(new File(basePath, filename.trim())); } } return ret.build(); }
java
public static ImmutableList<File> loadFileListRelativeTo(File fileList, File basePath) throws IOException { checkNotNull(basePath); final ImmutableList.Builder<File> ret = ImmutableList.builder(); for (final String filename : Files.readLines(fileList, Charsets.UTF_8)) { if (!filename.isEmpty() && !isCommentLine(filename)) { ret.add(new File(basePath, filename.trim())); } } return ret.build(); }
[ "public", "static", "ImmutableList", "<", "File", ">", "loadFileListRelativeTo", "(", "File", "fileList", ",", "File", "basePath", ")", "throws", "IOException", "{", "checkNotNull", "(", "basePath", ")", ";", "final", "ImmutableList", ".", "Builder", "<", "File"...
Takes a file with relative pathnames listed one per line and returns a list of the corresponding {@link java.io.File} objects, resolved against the provided base path using the {@link java.io.File#File(java.io.File, String)} constructor. Ignores blank lines and lines beginning with "#".
[ "Takes", "a", "file", "with", "relative", "pathnames", "listed", "one", "per", "line", "and", "returns", "a", "list", "of", "the", "corresponding", "{" ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L170-L182
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/Relinearlize.java
Relinearlize.process
public void process( DMatrixRMaj L_full , DMatrixRMaj y , double betas[] ) { svd.decompose(L_full); // extract null space V = svd.getV(null,true); // compute one possible solution pseudo.setA(L_full); pseudo.solve(y,x0); // add additional constraints to reduce the number of possible solutions DMatrixRMaj alphas = solveConstraintMatrix(); // compute the final solution for( int i = 0; i < x0.numRows; i++ ) { for( int j = 0; j < numNull; j++ ) { x0.data[i] += alphas.data[j]*valueNull(j,i); } } if( numControl == 4 ) { betas[0] = Math.sqrt(Math.abs(x0.data[0])); betas[1] = Math.sqrt(Math.abs(x0.data[4]))*Math.signum(x0.data[1]); betas[2] = Math.sqrt(Math.abs(x0.data[7]))*Math.signum(x0.data[2]); betas[3] = Math.sqrt(Math.abs(x0.data[9]))*Math.signum(x0.data[3]); } else { betas[0] = Math.sqrt(Math.abs(x0.data[0])); betas[1] = Math.sqrt(Math.abs(x0.data[3]))*Math.signum(x0.data[1]); betas[2] = Math.sqrt(Math.abs(x0.data[5]))*Math.signum(x0.data[2]); } }
java
public void process( DMatrixRMaj L_full , DMatrixRMaj y , double betas[] ) { svd.decompose(L_full); // extract null space V = svd.getV(null,true); // compute one possible solution pseudo.setA(L_full); pseudo.solve(y,x0); // add additional constraints to reduce the number of possible solutions DMatrixRMaj alphas = solveConstraintMatrix(); // compute the final solution for( int i = 0; i < x0.numRows; i++ ) { for( int j = 0; j < numNull; j++ ) { x0.data[i] += alphas.data[j]*valueNull(j,i); } } if( numControl == 4 ) { betas[0] = Math.sqrt(Math.abs(x0.data[0])); betas[1] = Math.sqrt(Math.abs(x0.data[4]))*Math.signum(x0.data[1]); betas[2] = Math.sqrt(Math.abs(x0.data[7]))*Math.signum(x0.data[2]); betas[3] = Math.sqrt(Math.abs(x0.data[9]))*Math.signum(x0.data[3]); } else { betas[0] = Math.sqrt(Math.abs(x0.data[0])); betas[1] = Math.sqrt(Math.abs(x0.data[3]))*Math.signum(x0.data[1]); betas[2] = Math.sqrt(Math.abs(x0.data[5]))*Math.signum(x0.data[2]); } }
[ "public", "void", "process", "(", "DMatrixRMaj", "L_full", ",", "DMatrixRMaj", "y", ",", "double", "betas", "[", "]", ")", "{", "svd", ".", "decompose", "(", "L_full", ")", ";", "// extract null space", "V", "=", "svd", ".", "getV", "(", "null", ",", "...
Estimates betas using relinearization. @param L_full Linear constraint matrix @param y distances between world control points @param betas Estimated betas. Output.
[ "Estimates", "betas", "using", "relinearization", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/Relinearlize.java#L110-L141
classgraph/classgraph
src/main/java/io/github/classgraph/Classfile.java
Classfile.readAnnotation
private AnnotationInfo readAnnotation() throws IOException { // Lcom/xyz/Annotation; -> Lcom.xyz.Annotation; final String annotationClassName = getConstantPoolClassDescriptor( inputStreamOrByteBuffer.readUnsignedShort()); final int numElementValuePairs = inputStreamOrByteBuffer.readUnsignedShort(); AnnotationParameterValueList paramVals = null; if (numElementValuePairs > 0) { paramVals = new AnnotationParameterValueList(numElementValuePairs); for (int i = 0; i < numElementValuePairs; i++) { final String paramName = getConstantPoolString(inputStreamOrByteBuffer.readUnsignedShort()); final Object paramValue = readAnnotationElementValue(); paramVals.add(new AnnotationParameterValue(paramName, paramValue)); } } return new AnnotationInfo(annotationClassName, paramVals); }
java
private AnnotationInfo readAnnotation() throws IOException { // Lcom/xyz/Annotation; -> Lcom.xyz.Annotation; final String annotationClassName = getConstantPoolClassDescriptor( inputStreamOrByteBuffer.readUnsignedShort()); final int numElementValuePairs = inputStreamOrByteBuffer.readUnsignedShort(); AnnotationParameterValueList paramVals = null; if (numElementValuePairs > 0) { paramVals = new AnnotationParameterValueList(numElementValuePairs); for (int i = 0; i < numElementValuePairs; i++) { final String paramName = getConstantPoolString(inputStreamOrByteBuffer.readUnsignedShort()); final Object paramValue = readAnnotationElementValue(); paramVals.add(new AnnotationParameterValue(paramName, paramValue)); } } return new AnnotationInfo(annotationClassName, paramVals); }
[ "private", "AnnotationInfo", "readAnnotation", "(", ")", "throws", "IOException", "{", "// Lcom/xyz/Annotation; -> Lcom.xyz.Annotation;", "final", "String", "annotationClassName", "=", "getConstantPoolClassDescriptor", "(", "inputStreamOrByteBuffer", ".", "readUnsignedShort", "("...
Read annotation entry from classfile. @return the annotation, as an {@link AnnotationInfo} object. @throws IOException If an IO exception occurs.
[ "Read", "annotation", "entry", "from", "classfile", "." ]
train
https://github.com/classgraph/classgraph/blob/c8c8b2ca1eb76339f69193fdac33d735c864215c/src/main/java/io/github/classgraph/Classfile.java#L807-L822
h2oai/h2o-2
src/main/java/water/Model.java
Model.toJavaPredict
private SB toJavaPredict(SB ccsb, SB fileCtxSb) { // ccsb = classContext ccsb.nl(); ccsb.p(" // Pass in data in a double[], pre-aligned to the Model's requirements.").nl(); ccsb.p(" // Jam predictions into the preds[] array; preds[0] is reserved for the").nl(); ccsb.p(" // main prediction (class for classifiers or value for regression),").nl(); ccsb.p(" // and remaining columns hold a probability distribution for classifiers.").nl(); ccsb.p(" public final float[] predict( double[] data, float[] preds) { preds = predict( data, preds, "+toJavaDefaultMaxIters()+"); return preds; }").nl(); // ccsb.p(" public final float[] predict( double[] data, float[] preds) { return predict( data, preds, "+toJavaDefaultMaxIters()+"); }").nl(); ccsb.p(" public final float[] predict( double[] data, float[] preds, int maxIters ) {").nl(); SB classCtxSb = new SB(); toJavaPredictBody(ccsb.ii(1), classCtxSb, fileCtxSb); ccsb.di(1); ccsb.p(" return preds;").nl(); ccsb.p(" }").nl(); ccsb.p(classCtxSb); return ccsb; }
java
private SB toJavaPredict(SB ccsb, SB fileCtxSb) { // ccsb = classContext ccsb.nl(); ccsb.p(" // Pass in data in a double[], pre-aligned to the Model's requirements.").nl(); ccsb.p(" // Jam predictions into the preds[] array; preds[0] is reserved for the").nl(); ccsb.p(" // main prediction (class for classifiers or value for regression),").nl(); ccsb.p(" // and remaining columns hold a probability distribution for classifiers.").nl(); ccsb.p(" public final float[] predict( double[] data, float[] preds) { preds = predict( data, preds, "+toJavaDefaultMaxIters()+"); return preds; }").nl(); // ccsb.p(" public final float[] predict( double[] data, float[] preds) { return predict( data, preds, "+toJavaDefaultMaxIters()+"); }").nl(); ccsb.p(" public final float[] predict( double[] data, float[] preds, int maxIters ) {").nl(); SB classCtxSb = new SB(); toJavaPredictBody(ccsb.ii(1), classCtxSb, fileCtxSb); ccsb.di(1); ccsb.p(" return preds;").nl(); ccsb.p(" }").nl(); ccsb.p(classCtxSb); return ccsb; }
[ "private", "SB", "toJavaPredict", "(", "SB", "ccsb", ",", "SB", "fileCtxSb", ")", "{", "// ccsb = classContext", "ccsb", ".", "nl", "(", ")", ";", "ccsb", ".", "p", "(", "\" // Pass in data in a double[], pre-aligned to the Model's requirements.\"", ")", ".", "nl",...
Wrapper around the main predict call, including the signature and return value
[ "Wrapper", "around", "the", "main", "predict", "call", "including", "the", "signature", "and", "return", "value" ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Model.java#L696-L711
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java
SignatureConverter.convertMethodSignature
public static String convertMethodSignature(JavaClass javaClass, Method method) { return convertMethodSignature(javaClass.getClassName(), method.getName(), method.getSignature()); }
java
public static String convertMethodSignature(JavaClass javaClass, Method method) { return convertMethodSignature(javaClass.getClassName(), method.getName(), method.getSignature()); }
[ "public", "static", "String", "convertMethodSignature", "(", "JavaClass", "javaClass", ",", "Method", "method", ")", "{", "return", "convertMethodSignature", "(", "javaClass", ".", "getClassName", "(", ")", ",", "method", ".", "getName", "(", ")", ",", "method",...
Convenience method for generating a method signature in human readable form. @param javaClass the class @param method the method
[ "Convenience", "method", "for", "generating", "a", "method", "signature", "in", "human", "readable", "form", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SignatureConverter.java#L146-L148
haraldk/TwelveMonkeys
sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java
NetUtil.getInputStreamHttp
public static InputStream getInputStreamHttp(URL pURL, Properties pProperties, boolean pFollowRedirects, int pTimeout) throws IOException { // Open the connection, and get the stream HttpURLConnection conn = createHttpURLConnection(pURL, pProperties, pFollowRedirects, pTimeout); // HTTP GET method conn.setRequestMethod(HTTP_GET); // This is where the connect happens InputStream is = conn.getInputStream(); // We only accept the 200 OK message if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) { throw new IOException("The request gave the response: " + conn.getResponseCode() + ": " + conn.getResponseMessage()); } return is; }
java
public static InputStream getInputStreamHttp(URL pURL, Properties pProperties, boolean pFollowRedirects, int pTimeout) throws IOException { // Open the connection, and get the stream HttpURLConnection conn = createHttpURLConnection(pURL, pProperties, pFollowRedirects, pTimeout); // HTTP GET method conn.setRequestMethod(HTTP_GET); // This is where the connect happens InputStream is = conn.getInputStream(); // We only accept the 200 OK message if (conn.getResponseCode() != HttpURLConnection.HTTP_OK) { throw new IOException("The request gave the response: " + conn.getResponseCode() + ": " + conn.getResponseMessage()); } return is; }
[ "public", "static", "InputStream", "getInputStreamHttp", "(", "URL", "pURL", ",", "Properties", "pProperties", ",", "boolean", "pFollowRedirects", ",", "int", "pTimeout", ")", "throws", "IOException", "{", "// Open the connection, and get the stream", "HttpURLConnection", ...
Gets the InputStream from a given URL, with the given timeout. The timeout must be > 0. A timeout of zero is interpreted as an infinite timeout. Supports basic HTTP authentication, using a URL string similar to most browsers. <P/> <SMALL>Implementation note: If the timeout parameter is greater than 0, this method uses my own implementation of java.net.HttpURLConnection, that uses plain sockets, to create an HTTP connection to the given URL. The {@code read} methods called on the returned InputStream, will block only for the specified timeout. If the timeout expires, a java.io.InterruptedIOException is raised. This might happen BEFORE OR AFTER this method returns, as the HTTP headers will be read and parsed from the InputStream before this method returns, while further read operations on the returned InputStream might be performed at a later stage. <BR/> </SMALL> @param pURL the URL to get. @param pProperties the request header properties. @param pFollowRedirects specifying wether redirects should be followed. @param pTimeout the specified timeout, in milliseconds. @return an input stream that reads from the socket connection, created from the given URL. @throws UnknownHostException if the IP address for the given URL cannot be resolved. @throws FileNotFoundException if there is no file at the given URL. @throws IOException if an error occurs during transfer. @see #getInputStreamHttp(URL,int) @see java.net.Socket @see java.net.Socket#setSoTimeout(int) setSoTimeout @see java.io.InterruptedIOException @see <A href="http://www.w3.org/Protocols/rfc2616/rfc2616.html">RFC 2616</A>
[ "Gets", "the", "InputStream", "from", "a", "given", "URL", "with", "the", "given", "timeout", ".", "The", "timeout", "must", "be", ">", "0", ".", "A", "timeout", "of", "zero", "is", "interpreted", "as", "an", "infinite", "timeout", ".", "Supports", "basi...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/sandbox/sandbox-common/src/main/java/com/twelvemonkeys/net/NetUtil.java#L705-L722
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/util/ReflectionUtils.java
ReflectionUtils.getAnnotation
public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationClass) { A annotation = method.getAnnotation(annotationClass); if (annotation == null) { for (Annotation metaAnnotation : method.getAnnotations()) { annotation = metaAnnotation.annotationType().getAnnotation(annotationClass); if (annotation != null) { return annotation; } } Method superclassMethod = getOverriddenMethod(method); if (superclassMethod != null) { annotation = getAnnotation(superclassMethod, annotationClass); } } return annotation; }
java
public static <A extends Annotation> A getAnnotation(Method method, Class<A> annotationClass) { A annotation = method.getAnnotation(annotationClass); if (annotation == null) { for (Annotation metaAnnotation : method.getAnnotations()) { annotation = metaAnnotation.annotationType().getAnnotation(annotationClass); if (annotation != null) { return annotation; } } Method superclassMethod = getOverriddenMethod(method); if (superclassMethod != null) { annotation = getAnnotation(superclassMethod, annotationClass); } } return annotation; }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "A", "getAnnotation", "(", "Method", "method", ",", "Class", "<", "A", ">", "annotationClass", ")", "{", "A", "annotation", "=", "method", ".", "getAnnotation", "(", "annotationClass", ")", ";", "...
Returns an annotation by type from a method. @param method is the method to find @param annotationClass is the type of annotation @param <A> is the type of annotation @return annotation if it is found
[ "Returns", "an", "annotation", "by", "type", "from", "a", "method", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/util/ReflectionUtils.java#L215-L230
apache/incubator-heron
heron/scheduler-core/src/java/org/apache/heron/scheduler/UpdateTopologyManager.java
UpdateTopologyManager.getTopology
@VisibleForTesting TopologyAPI.Topology getTopology(SchedulerStateManagerAdaptor stateManager, String topologyName) { return stateManager.getPhysicalPlan(topologyName).getTopology(); }
java
@VisibleForTesting TopologyAPI.Topology getTopology(SchedulerStateManagerAdaptor stateManager, String topologyName) { return stateManager.getPhysicalPlan(topologyName).getTopology(); }
[ "@", "VisibleForTesting", "TopologyAPI", ".", "Topology", "getTopology", "(", "SchedulerStateManagerAdaptor", "stateManager", ",", "String", "topologyName", ")", "{", "return", "stateManager", ".", "getPhysicalPlan", "(", "topologyName", ")", ".", "getTopology", "(", ...
Returns the topology. It's key that we get the topology from the physical plan to reflect any state changes since launch. The stateManager.getTopology(name) method returns the topology from the time of submission. See additional commentary in topology.proto and physical_plan.proto.
[ "Returns", "the", "topology", ".", "It", "s", "key", "that", "we", "get", "the", "topology", "from", "the", "physical", "plan", "to", "reflect", "any", "state", "changes", "since", "launch", ".", "The", "stateManager", ".", "getTopology", "(", "name", ")",...
train
https://github.com/apache/incubator-heron/blob/776abe2b5a45b93a0eb957fd65cbc149d901a92a/heron/scheduler-core/src/java/org/apache/heron/scheduler/UpdateTopologyManager.java#L346-L349
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java
JsonUtil.getInt
public static int getInt(JsonObject object, String field) { final JsonValue value = object.get(field); throwExceptionIfNull(value, field); return value.asInt(); }
java
public static int getInt(JsonObject object, String field) { final JsonValue value = object.get(field); throwExceptionIfNull(value, field); return value.asInt(); }
[ "public", "static", "int", "getInt", "(", "JsonObject", "object", ",", "String", "field", ")", "{", "final", "JsonValue", "value", "=", "object", ".", "get", "(", "field", ")", ";", "throwExceptionIfNull", "(", "value", ",", "field", ")", ";", "return", ...
Returns a field in a Json object as an int. Throws IllegalArgumentException if the field value is null. @param object the Json Object @param field the field in the Json object to return @return the Json field value as an int
[ "Returns", "a", "field", "in", "a", "Json", "object", "as", "an", "int", ".", "Throws", "IllegalArgumentException", "if", "the", "field", "value", "is", "null", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/util/JsonUtil.java#L45-L49
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/Completable.java
Completable.unsubscribeOn
@CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) public final Completable unsubscribeOn(final Scheduler scheduler) { ObjectHelper.requireNonNull(scheduler, "scheduler is null"); return RxJavaPlugins.onAssembly(new CompletableDisposeOn(this, scheduler)); }
java
@CheckReturnValue @SchedulerSupport(SchedulerSupport.CUSTOM) public final Completable unsubscribeOn(final Scheduler scheduler) { ObjectHelper.requireNonNull(scheduler, "scheduler is null"); return RxJavaPlugins.onAssembly(new CompletableDisposeOn(this, scheduler)); }
[ "@", "CheckReturnValue", "@", "SchedulerSupport", "(", "SchedulerSupport", ".", "CUSTOM", ")", "public", "final", "Completable", "unsubscribeOn", "(", "final", "Scheduler", "scheduler", ")", "{", "ObjectHelper", ".", "requireNonNull", "(", "scheduler", ",", "\"sched...
Returns a Completable which makes sure when a subscriber disposes the subscription, the dispose is called on the specified scheduler. <p> <img width="640" height="716" src="https://raw.github.com/wiki/ReactiveX/RxJava/images/rx-operators/Completable.unsubscribeOn.png" alt=""> <dl> <dt><b>Scheduler:</b></dt> <dd>{@code unsubscribeOn} calls dispose() of the upstream on the {@link Scheduler} you specify.</dd> </dl> @param scheduler the target scheduler where to execute the disposing @return the new Completable instance @throws NullPointerException if scheduler is null
[ "Returns", "a", "Completable", "which", "makes", "sure", "when", "a", "subscriber", "disposes", "the", "subscription", "the", "dispose", "is", "called", "on", "the", "specified", "scheduler", ".", "<p", ">", "<img", "width", "=", "640", "height", "=", "716",...
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/Completable.java#L2598-L2603
alkacon/opencms-core
src/org/opencms/ui/apps/A_CmsWorkplaceApp.java
A_CmsWorkplaceApp.addParamToState
public static String addParamToState(String state, String paramName, String value) { return state + PARAM_SEPARATOR + paramName + PARAM_ASSIGN + CmsEncoder.encode(value, CmsEncoder.ENCODING_UTF_8); }
java
public static String addParamToState(String state, String paramName, String value) { return state + PARAM_SEPARATOR + paramName + PARAM_ASSIGN + CmsEncoder.encode(value, CmsEncoder.ENCODING_UTF_8); }
[ "public", "static", "String", "addParamToState", "(", "String", "state", ",", "String", "paramName", ",", "String", "value", ")", "{", "return", "state", "+", "PARAM_SEPARATOR", "+", "paramName", "+", "PARAM_ASSIGN", "+", "CmsEncoder", ".", "encode", "(", "val...
Adds a parameter value to the given state.<p> @param state the state @param paramName the parameter name @param value the parameter value @return the state
[ "Adds", "a", "parameter", "value", "to", "the", "given", "state", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/A_CmsWorkplaceApp.java#L170-L173
inferred/FreeBuilder
src/main/java/org/inferred/freebuilder/processor/source/FunctionalType.java
FunctionalType.functionalTypesAcceptedByMethod
public static List<FunctionalType> functionalTypesAcceptedByMethod( DeclaredType type, String methodName, Elements elements, Types types) { TypeElement typeElement = asElement(type); return methodsOn(typeElement, elements, errorType -> { }) .stream() .filter(method -> method.getSimpleName().contentEquals(methodName) && method.getParameters().size() == 1) .flatMap(method -> { ExecutableType methodType = (ExecutableType) types.asMemberOf(type, method); TypeMirror parameter = getOnlyElement(methodType.getParameterTypes()); return maybeFunctionalType(parameter, elements, types) .map(Stream::of).orElse(Stream.of()); }) .collect(toList()); }
java
public static List<FunctionalType> functionalTypesAcceptedByMethod( DeclaredType type, String methodName, Elements elements, Types types) { TypeElement typeElement = asElement(type); return methodsOn(typeElement, elements, errorType -> { }) .stream() .filter(method -> method.getSimpleName().contentEquals(methodName) && method.getParameters().size() == 1) .flatMap(method -> { ExecutableType methodType = (ExecutableType) types.asMemberOf(type, method); TypeMirror parameter = getOnlyElement(methodType.getParameterTypes()); return maybeFunctionalType(parameter, elements, types) .map(Stream::of).orElse(Stream.of()); }) .collect(toList()); }
[ "public", "static", "List", "<", "FunctionalType", ">", "functionalTypesAcceptedByMethod", "(", "DeclaredType", "type", ",", "String", "methodName", ",", "Elements", "elements", ",", "Types", "types", ")", "{", "TypeElement", "typeElement", "=", "asElement", "(", ...
Returns the functional types accepted by {@code methodName} on {@code type}.
[ "Returns", "the", "functional", "types", "accepted", "by", "{" ]
train
https://github.com/inferred/FreeBuilder/blob/d5a222f90648aece135da4b971c55a60afe8649c/src/main/java/org/inferred/freebuilder/processor/source/FunctionalType.java#L149-L166
apache/groovy
src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.writeLine
public static void writeLine(BufferedWriter writer, String line) throws IOException { writer.write(line); writer.newLine(); }
java
public static void writeLine(BufferedWriter writer, String line) throws IOException { writer.write(line); writer.newLine(); }
[ "public", "static", "void", "writeLine", "(", "BufferedWriter", "writer", ",", "String", "line", ")", "throws", "IOException", "{", "writer", ".", "write", "(", "line", ")", ";", "writer", ".", "newLine", "(", ")", ";", "}" ]
Write the text and append a newline (using the platform's line-ending). @param writer a BufferedWriter @param line the line to write @throws IOException if an IOException occurs. @since 1.0
[ "Write", "the", "text", "and", "append", "a", "newline", "(", "using", "the", "platform", "s", "line", "-", "ending", ")", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/IOGroovyMethods.java#L925-L928
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java
AccountsInner.listStorageAccountsAsync
public Observable<Page<StorageAccountInfoInner>> listStorageAccountsAsync(final String resourceGroupName, final String accountName) { return listStorageAccountsWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<StorageAccountInfoInner>>, Page<StorageAccountInfoInner>>() { @Override public Page<StorageAccountInfoInner> call(ServiceResponse<Page<StorageAccountInfoInner>> response) { return response.body(); } }); }
java
public Observable<Page<StorageAccountInfoInner>> listStorageAccountsAsync(final String resourceGroupName, final String accountName) { return listStorageAccountsWithServiceResponseAsync(resourceGroupName, accountName) .map(new Func1<ServiceResponse<Page<StorageAccountInfoInner>>, Page<StorageAccountInfoInner>>() { @Override public Page<StorageAccountInfoInner> call(ServiceResponse<Page<StorageAccountInfoInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "StorageAccountInfoInner", ">", ">", "listStorageAccountsAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ")", "{", "return", "listStorageAccountsWithServiceResponseAsync", "(", "resource...
Gets the first page of Azure Storage accounts, if any, linked to the specified Data Lake Analytics account. The response includes a link to the next page, if any. @param resourceGroupName The name of the Azure resource group that contains the Data Lake Analytics account. @param accountName The name of the Data Lake Analytics account for which to list Azure Storage accounts. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StorageAccountInfoInner&gt; object
[ "Gets", "the", "first", "page", "of", "Azure", "Storage", "accounts", "if", "any", "linked", "to", "the", "specified", "Data", "Lake", "Analytics", "account", ".", "The", "response", "includes", "a", "link", "to", "the", "next", "page", "if", "any", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2015_10_01_preview/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2015_10_01_preview/implementation/AccountsInner.java#L1270-L1278
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/datastore/MultiMapDataStore.java
MultiMapDataStore.addMapDataStore
public void addMapDataStore(MapDataStore mapDataStore, boolean useStartZoomLevel, boolean useStartPosition) { if (this.mapDatabases.contains(mapDataStore)) { throw new IllegalArgumentException("Duplicate map database"); } this.mapDatabases.add(mapDataStore); if (useStartZoomLevel) { this.startZoomLevel = mapDataStore.startZoomLevel(); } if (useStartPosition) { this.startPosition = mapDataStore.startPosition(); } if (null == this.boundingBox) { this.boundingBox = mapDataStore.boundingBox(); } else { this.boundingBox = this.boundingBox.extendBoundingBox(mapDataStore.boundingBox()); } }
java
public void addMapDataStore(MapDataStore mapDataStore, boolean useStartZoomLevel, boolean useStartPosition) { if (this.mapDatabases.contains(mapDataStore)) { throw new IllegalArgumentException("Duplicate map database"); } this.mapDatabases.add(mapDataStore); if (useStartZoomLevel) { this.startZoomLevel = mapDataStore.startZoomLevel(); } if (useStartPosition) { this.startPosition = mapDataStore.startPosition(); } if (null == this.boundingBox) { this.boundingBox = mapDataStore.boundingBox(); } else { this.boundingBox = this.boundingBox.extendBoundingBox(mapDataStore.boundingBox()); } }
[ "public", "void", "addMapDataStore", "(", "MapDataStore", "mapDataStore", ",", "boolean", "useStartZoomLevel", ",", "boolean", "useStartPosition", ")", "{", "if", "(", "this", ".", "mapDatabases", ".", "contains", "(", "mapDataStore", ")", ")", "{", "throw", "ne...
adds another mapDataStore @param mapDataStore the mapDataStore to add @param useStartZoomLevel if true, use the start zoom level of this mapDataStore as the start zoom level @param useStartPosition if true, use the start position of this mapDataStore as the start position
[ "adds", "another", "mapDataStore" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/datastore/MultiMapDataStore.java#L65-L81
mkotsur/restito
src/main/java/com/xebialabs/restito/semantics/Condition.java
Condition.withPostBodyContainingJsonPath
public static Condition withPostBodyContainingJsonPath(final String pattern, final Object value) { return new Condition(input -> value.equals(JsonPath.parse(input.getPostBody()).read(pattern))); }
java
public static Condition withPostBodyContainingJsonPath(final String pattern, final Object value) { return new Condition(input -> value.equals(JsonPath.parse(input.getPostBody()).read(pattern))); }
[ "public", "static", "Condition", "withPostBodyContainingJsonPath", "(", "final", "String", "pattern", ",", "final", "Object", "value", ")", "{", "return", "new", "Condition", "(", "input", "->", "value", ".", "equals", "(", "JsonPath", ".", "parse", "(", "inpu...
With Valid Json Path. Check to see if incoming path has a valid string value selected via a <a href="https://github.com/jayway/JsonPath/"> JSONPath</a> expression.
[ "With", "Valid", "Json", "Path", ".", "Check", "to", "see", "if", "incoming", "path", "has", "a", "valid", "string", "value", "selected", "via", "a", "<a", "href", "=", "https", ":", "//", "github", ".", "com", "/", "jayway", "/", "JsonPath", "/", ">...
train
https://github.com/mkotsur/restito/blob/b999293616ca84fdea1ffe929e92a5db29c7e415/src/main/java/com/xebialabs/restito/semantics/Condition.java#L168-L170
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/util/EditableNamespaceContext.java
EditableNamespaceContext.setNamespaceURI
public void setNamespaceURI(String prefix, String namespaceURI) { if (prefix == null) throw new IllegalArgumentException("Cannot bind null prefix"); if (namespaceURI == null) throw new IllegalArgumentException("Cannot set prefix to null namespace URI"); // no need to store if (XMLConstants.XML_NS_PREFIX.equals(prefix) || XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) return; bindings.put(prefix, namespaceURI); }
java
public void setNamespaceURI(String prefix, String namespaceURI) { if (prefix == null) throw new IllegalArgumentException("Cannot bind null prefix"); if (namespaceURI == null) throw new IllegalArgumentException("Cannot set prefix to null namespace URI"); // no need to store if (XMLConstants.XML_NS_PREFIX.equals(prefix) || XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) return; bindings.put(prefix, namespaceURI); }
[ "public", "void", "setNamespaceURI", "(", "String", "prefix", ",", "String", "namespaceURI", ")", "{", "if", "(", "prefix", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Cannot bind null prefix\"", ")", ";", "if", "(", "namespaceURI", "=...
Specifies a binding between a prefix and a namespace URI. @param prefix the prefix for the binding @param namespaceURI the URI for the namespace
[ "Specifies", "a", "binding", "between", "a", "prefix", "and", "a", "namespace", "URI", "." ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/util/EditableNamespaceContext.java#L87-L98
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/journal/recoverylog/JournalRecoveryLog.java
JournalRecoveryLog.logHeaderInfo
public void logHeaderInfo(Map<String, String> parameters) { StringBuffer buffer = new StringBuffer("Recovery parameters:"); for (Iterator<String> keys = parameters.keySet().iterator(); keys .hasNext();) { Object key = keys.next(); Object value = parameters.get(key); buffer.append("\n ").append(key).append("=").append(value); } log(buffer.toString()); }
java
public void logHeaderInfo(Map<String, String> parameters) { StringBuffer buffer = new StringBuffer("Recovery parameters:"); for (Iterator<String> keys = parameters.keySet().iterator(); keys .hasNext();) { Object key = keys.next(); Object value = parameters.get(key); buffer.append("\n ").append(key).append("=").append(value); } log(buffer.toString()); }
[ "public", "void", "logHeaderInfo", "(", "Map", "<", "String", ",", "String", ">", "parameters", ")", "{", "StringBuffer", "buffer", "=", "new", "StringBuffer", "(", "\"Recovery parameters:\"", ")", ";", "for", "(", "Iterator", "<", "String", ">", "keys", "="...
Concrete sub-classes should call this method from their constructor, or as soon as the log is ready for writing.
[ "Concrete", "sub", "-", "classes", "should", "call", "this", "method", "from", "their", "constructor", "or", "as", "soon", "as", "the", "log", "is", "ready", "for", "writing", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/journal/recoverylog/JournalRecoveryLog.java#L129-L138
alkacon/opencms-core
src/org/opencms/workplace/tools/CmsToolManager.java
CmsToolManager.jspForwardTool
public void jspForwardTool(CmsWorkplace wp, String toolPath, Map<String, String[]> params) throws IOException, ServletException { Map<String, String[]> newParams; if (params == null) { newParams = new HashMap<String, String[]>(); } else { newParams = new HashMap<String, String[]>(params); } // update path param newParams.put(CmsToolDialog.PARAM_PATH, new String[] {toolPath}); jspForwardPage(wp, VIEW_JSPPAGE_LOCATION, newParams); }
java
public void jspForwardTool(CmsWorkplace wp, String toolPath, Map<String, String[]> params) throws IOException, ServletException { Map<String, String[]> newParams; if (params == null) { newParams = new HashMap<String, String[]>(); } else { newParams = new HashMap<String, String[]>(params); } // update path param newParams.put(CmsToolDialog.PARAM_PATH, new String[] {toolPath}); jspForwardPage(wp, VIEW_JSPPAGE_LOCATION, newParams); }
[ "public", "void", "jspForwardTool", "(", "CmsWorkplace", "wp", ",", "String", "toolPath", ",", "Map", "<", "String", ",", "String", "[", "]", ">", "params", ")", "throws", "IOException", ",", "ServletException", "{", "Map", "<", "String", ",", "String", "[...
Redirects to the given tool with the given parameters.<p> @param wp the workplace object @param toolPath the path to the tool to redirect to @param params the parameters to send @throws IOException in case of errors during forwarding @throws ServletException in case of errors during forwarding
[ "Redirects", "to", "the", "given", "tool", "with", "the", "given", "parameters", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/tools/CmsToolManager.java#L502-L514
eFaps/eFaps-Kernel
src/main/java/org/efaps/admin/runlevel/RunLevel.java
RunLevel.isInitialisable
public static boolean isInitialisable() throws EFapsException { try { final Connection con = Context.getConnection(); final boolean ret = Context.getDbType().existsTable(Context.getConnection(), RunLevel.TABLE_TESTS); con.close(); return ret; } catch (final SQLException e) { throw new EFapsException(RunLevel.class, "isInitialisable.SQLException", e); } }
java
public static boolean isInitialisable() throws EFapsException { try { final Connection con = Context.getConnection(); final boolean ret = Context.getDbType().existsTable(Context.getConnection(), RunLevel.TABLE_TESTS); con.close(); return ret; } catch (final SQLException e) { throw new EFapsException(RunLevel.class, "isInitialisable.SQLException", e); } }
[ "public", "static", "boolean", "isInitialisable", "(", ")", "throws", "EFapsException", "{", "try", "{", "final", "Connection", "con", "=", "Context", ".", "getConnection", "(", ")", ";", "final", "boolean", "ret", "=", "Context", ".", "getDbType", "(", ")",...
Tests, if the SQL table {@link #TABLE_TESTS} exists (= <i>true</i>). This means the run level could be initialized. @return <i>true</i> if a run level could be initialized (and the SQL table exists in the database); otherwise <i>false</i> @throws EFapsException if the test for the table fails @see #TABLE_TESTS
[ "Tests", "if", "the", "SQL", "table", "{", "@link", "#TABLE_TESTS", "}", "exists", "(", "=", "<i", ">", "true<", "/", "i", ">", ")", ".", "This", "means", "the", "run", "level", "could", "be", "initialized", "." ]
train
https://github.com/eFaps/eFaps-Kernel/blob/04b96548f518c2386a93f5ec2b9349f9b9063859/src/main/java/org/efaps/admin/runlevel/RunLevel.java#L188-L199
Erudika/para
para-client/src/main/java/com/erudika/para/client/ParaClient.java
ParaClient.addAppSetting
public void addAppSetting(String key, Object value) { if (!StringUtils.isBlank(key) && value != null) { invokePut(Utils.formatMessage("_settings/{0}", key), Entity.json(Collections.singletonMap("value", value))); } }
java
public void addAppSetting(String key, Object value) { if (!StringUtils.isBlank(key) && value != null) { invokePut(Utils.formatMessage("_settings/{0}", key), Entity.json(Collections.singletonMap("value", value))); } }
[ "public", "void", "addAppSetting", "(", "String", "key", ",", "Object", "value", ")", "{", "if", "(", "!", "StringUtils", ".", "isBlank", "(", "key", ")", "&&", "value", "!=", "null", ")", "{", "invokePut", "(", "Utils", ".", "formatMessage", "(", "\"_...
Adds or overwrites an app-specific setting. @param key a key @param value a value
[ "Adds", "or", "overwrites", "an", "app", "-", "specific", "setting", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-client/src/main/java/com/erudika/para/client/ParaClient.java#L1530-L1534
actframework/actframework
src/main/java/act/apidoc/javadoc/Javadoc.java
Javadoc.addBlockTag
public Javadoc addBlockTag(String tagName, String content) { return addBlockTag(new JavadocBlockTag(tagName, content)); }
java
public Javadoc addBlockTag(String tagName, String content) { return addBlockTag(new JavadocBlockTag(tagName, content)); }
[ "public", "Javadoc", "addBlockTag", "(", "String", "tagName", ",", "String", "content", ")", "{", "return", "addBlockTag", "(", "new", "JavadocBlockTag", "(", "tagName", ",", "content", ")", ")", ";", "}" ]
For tags like "@return good things" where tagName is "return", and the rest is content.
[ "For", "tags", "like" ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/apidoc/javadoc/Javadoc.java#L60-L62
BorderTech/wcomponents
wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/FlowLayoutExample.java
FlowLayoutExample.addBoxes
private static void addBoxes(final WPanel panel, final int amount) { for (int i = 1; i <= amount; i++) { WPanel box = new WPanel(WPanel.Type.BOX); box.add(new WText(Integer.toString(i))); panel.add(box); } }
java
private static void addBoxes(final WPanel panel, final int amount) { for (int i = 1; i <= amount; i++) { WPanel box = new WPanel(WPanel.Type.BOX); box.add(new WText(Integer.toString(i))); panel.add(box); } }
[ "private", "static", "void", "addBoxes", "(", "final", "WPanel", "panel", ",", "final", "int", "amount", ")", "{", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "amount", ";", "i", "++", ")", "{", "WPanel", "box", "=", "new", "WPanel", "(", "...
Adds a set of boxes to the given panel. @param panel the panel to add the boxes to. @param amount the number of boxes to add.
[ "Adds", "a", "set", "of", "boxes", "to", "the", "given", "panel", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-examples/src/main/java/com/github/bordertech/wcomponents/examples/layout/FlowLayoutExample.java#L177-L183
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/FileLocator.java
FileLocator.getMatchingFiles
public static List<File> getMatchingFiles(String root, String filterExpr) { if (root == null) return Collections.emptyList(); File file = new File(root); return getMatchingFiles(file, filterExpr); }
java
public static List<File> getMatchingFiles(String root, String filterExpr) { if (root == null) return Collections.emptyList(); File file = new File(root); return getMatchingFiles(file, filterExpr); }
[ "public", "static", "List", "<", "File", ">", "getMatchingFiles", "(", "String", "root", ",", "String", "filterExpr", ")", "{", "if", "(", "root", "==", "null", ")", "return", "Collections", ".", "emptyList", "(", ")", ";", "File", "file", "=", "new", ...
Get a list of Files from the given path that match the provided filter; not recursive. @param root base directory to look for files @param filterExpr the regular expression to match, may be null @return List of File objects; List will be empty if root is null
[ "Get", "a", "list", "of", "Files", "from", "the", "given", "path", "that", "match", "the", "provided", "filter", ";", "not", "recursive", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/FileLocator.java#L223-L229
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java
DerInputStream.getUnalignedBitString
public BitArray getUnalignedBitString() throws IOException { if (buffer.read() != DerValue.tag_BitString) throw new IOException("DER input not a bit string"); int length = getLength(buffer) - 1; /* * First byte = number of excess bits in the last octet of the * representation. */ int validBits = length*8 - buffer.read(); byte[] repn = new byte[length]; if ((length != 0) && (buffer.read(repn) != length)) throw new IOException("short read of DER bit string"); return new BitArray(validBits, repn); }
java
public BitArray getUnalignedBitString() throws IOException { if (buffer.read() != DerValue.tag_BitString) throw new IOException("DER input not a bit string"); int length = getLength(buffer) - 1; /* * First byte = number of excess bits in the last octet of the * representation. */ int validBits = length*8 - buffer.read(); byte[] repn = new byte[length]; if ((length != 0) && (buffer.read(repn) != length)) throw new IOException("short read of DER bit string"); return new BitArray(validBits, repn); }
[ "public", "BitArray", "getUnalignedBitString", "(", ")", "throws", "IOException", "{", "if", "(", "buffer", ".", "read", "(", ")", "!=", "DerValue", ".", "tag_BitString", ")", "throw", "new", "IOException", "(", "\"DER input not a bit string\"", ")", ";", "int",...
Get a bit string from the input stream. The bit string need not be byte-aligned.
[ "Get", "a", "bit", "string", "from", "the", "input", "stream", ".", "The", "bit", "string", "need", "not", "be", "byte", "-", "aligned", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L226-L243
google/closure-compiler
src/com/google/javascript/rhino/JSDocInfo.java
JSDocInfo.documentParam
boolean documentParam(String parameter, String description) { if (!lazyInitDocumentation()) { return true; } if (documentation.parameters == null) { documentation.parameters = new LinkedHashMap<>(); } if (!documentation.parameters.containsKey(parameter)) { documentation.parameters.put(parameter, description); return true; } else { return false; } }
java
boolean documentParam(String parameter, String description) { if (!lazyInitDocumentation()) { return true; } if (documentation.parameters == null) { documentation.parameters = new LinkedHashMap<>(); } if (!documentation.parameters.containsKey(parameter)) { documentation.parameters.put(parameter, description); return true; } else { return false; } }
[ "boolean", "documentParam", "(", "String", "parameter", ",", "String", "description", ")", "{", "if", "(", "!", "lazyInitDocumentation", "(", ")", ")", "{", "return", "true", ";", "}", "if", "(", "documentation", ".", "parameters", "==", "null", ")", "{", ...
Documents a parameter. Parameters are described using the {@code @param} annotation. @param parameter the parameter's name @param description the parameter's description
[ "Documents", "a", "parameter", ".", "Parameters", "are", "described", "using", "the", "{", "@code", "@param", "}", "annotation", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/JSDocInfo.java#L1302-L1317
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCollapsibleRenderer.java
WCollapsibleRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WCollapsible collapsible = (WCollapsible) component; XmlStringBuilder xml = renderContext.getWriter(); WComponent content = collapsible.getContent(); boolean collapsed = collapsible.isCollapsed(); xml.appendTagOpen("ui:collapsible"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendAttribute("groupName", collapsible.getGroupName()); xml.appendOptionalAttribute("collapsed", collapsed, "true"); xml.appendOptionalAttribute("hidden", collapsible.isHidden(), "true"); switch (collapsible.getMode()) { case CLIENT: xml.appendAttribute("mode", "client"); break; case LAZY: xml.appendAttribute("mode", "lazy"); break; case EAGER: xml.appendAttribute("mode", "eager"); break; case DYNAMIC: xml.appendAttribute("mode", "dynamic"); break; case SERVER: xml.appendAttribute("mode", "server"); break; default: throw new SystemException("Unknown collapsible mode: " + collapsible.getMode()); } HeadingLevel level = collapsible.getHeadingLevel(); if (level != null) { xml.appendAttribute("level", level.getLevel()); } xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(collapsible, renderContext); // Label collapsible.getDecoratedLabel().paint(renderContext); // Content xml.appendTagOpen("ui:content"); xml.appendAttribute("id", component.getId() + "-content"); xml.appendClose(); // Render content if not EAGER Mode or is EAGER and is the current AJAX trigger if (CollapsibleMode.EAGER != collapsible.getMode() || AjaxHelper.isCurrentAjaxTrigger( collapsible)) { // Visibility of content set in prepare paint content.paint(renderContext); } xml.appendEndTag("ui:content"); xml.appendEndTag("ui:collapsible"); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WCollapsible collapsible = (WCollapsible) component; XmlStringBuilder xml = renderContext.getWriter(); WComponent content = collapsible.getContent(); boolean collapsed = collapsible.isCollapsed(); xml.appendTagOpen("ui:collapsible"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendAttribute("groupName", collapsible.getGroupName()); xml.appendOptionalAttribute("collapsed", collapsed, "true"); xml.appendOptionalAttribute("hidden", collapsible.isHidden(), "true"); switch (collapsible.getMode()) { case CLIENT: xml.appendAttribute("mode", "client"); break; case LAZY: xml.appendAttribute("mode", "lazy"); break; case EAGER: xml.appendAttribute("mode", "eager"); break; case DYNAMIC: xml.appendAttribute("mode", "dynamic"); break; case SERVER: xml.appendAttribute("mode", "server"); break; default: throw new SystemException("Unknown collapsible mode: " + collapsible.getMode()); } HeadingLevel level = collapsible.getHeadingLevel(); if (level != null) { xml.appendAttribute("level", level.getLevel()); } xml.appendClose(); // Render margin MarginRendererUtil.renderMargin(collapsible, renderContext); // Label collapsible.getDecoratedLabel().paint(renderContext); // Content xml.appendTagOpen("ui:content"); xml.appendAttribute("id", component.getId() + "-content"); xml.appendClose(); // Render content if not EAGER Mode or is EAGER and is the current AJAX trigger if (CollapsibleMode.EAGER != collapsible.getMode() || AjaxHelper.isCurrentAjaxTrigger( collapsible)) { // Visibility of content set in prepare paint content.paint(renderContext); } xml.appendEndTag("ui:content"); xml.appendEndTag("ui:collapsible"); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WCollapsible", "collapsible", "=", "(", "WCollapsible", ")", "component", ";", "XmlStringBuilder", "xml", "=", ...
Paints the given WCollapsible. @param component the WCollapsible to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WCollapsible", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCollapsibleRenderer.java#L26-L89
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.overTheBox_serviceName_migrate_POST
public OvhOrder overTheBox_serviceName_migrate_POST(String serviceName, Boolean hardware, String offer, String shippingContactID, OvhShippingMethodEnum shippingMethod, Long shippingRelayID) throws IOException { String qPath = "/order/overTheBox/{serviceName}/migrate"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "hardware", hardware); addBody(o, "offer", offer); addBody(o, "shippingContactID", shippingContactID); addBody(o, "shippingMethod", shippingMethod); addBody(o, "shippingRelayID", shippingRelayID); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder overTheBox_serviceName_migrate_POST(String serviceName, Boolean hardware, String offer, String shippingContactID, OvhShippingMethodEnum shippingMethod, Long shippingRelayID) throws IOException { String qPath = "/order/overTheBox/{serviceName}/migrate"; StringBuilder sb = path(qPath, serviceName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "hardware", hardware); addBody(o, "offer", offer); addBody(o, "shippingContactID", shippingContactID); addBody(o, "shippingMethod", shippingMethod); addBody(o, "shippingRelayID", shippingRelayID); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "overTheBox_serviceName_migrate_POST", "(", "String", "serviceName", ",", "Boolean", "hardware", ",", "String", "offer", ",", "String", "shippingContactID", ",", "OvhShippingMethodEnum", "shippingMethod", ",", "Long", "shippingRelayID", ")", "throws"...
Create order REST: POST /order/overTheBox/{serviceName}/migrate @param offer [required] Offer name to migrate to @param shippingContactID [required] Contact ID to deliver to @param shippingRelayID [required] Relay ID to deliver to. Needed if shipping is mondialRelay @param shippingMethod [required] How do you want your shipment shipped @param hardware [required] If you want to migrate with a new hardware @param serviceName [required] The internal name of your overTheBox offer API beta
[ "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#L3177-L3188
JDBDT/jdbdt
src/main/java/org/jdbdt/DataSource.java
DataSource.proceedWithQuery
private void proceedWithQuery (PreparedStatement queryStmt, DataSet ds) throws SQLException { if (queryArgs != null && queryArgs.length > 0) { for (int i=0; i < queryArgs.length; i++) { queryStmt.setObject(i + 1, queryArgs[i]); } } try(ResultSet rs = queryStmt.executeQuery()) { int colCount = metaData.getColumnCount(); while (rs.next()) { Object[] data = new Object[colCount]; for (int i = 0; i < colCount; i++) { data[i] = rs.getObject(i+1); } ds.addRow(new Row(data)); } } }
java
private void proceedWithQuery (PreparedStatement queryStmt, DataSet ds) throws SQLException { if (queryArgs != null && queryArgs.length > 0) { for (int i=0; i < queryArgs.length; i++) { queryStmt.setObject(i + 1, queryArgs[i]); } } try(ResultSet rs = queryStmt.executeQuery()) { int colCount = metaData.getColumnCount(); while (rs.next()) { Object[] data = new Object[colCount]; for (int i = 0; i < colCount; i++) { data[i] = rs.getObject(i+1); } ds.addRow(new Row(data)); } } }
[ "private", "void", "proceedWithQuery", "(", "PreparedStatement", "queryStmt", ",", "DataSet", "ds", ")", "throws", "SQLException", "{", "if", "(", "queryArgs", "!=", "null", "&&", "queryArgs", ".", "length", ">", "0", ")", "{", "for", "(", "int", "i", "=",...
Execute query. @param queryStmt Query statement. @param ds Target data set. @throws SQLException if a database error occurs.
[ "Execute", "query", "." ]
train
https://github.com/JDBDT/jdbdt/blob/7e32845ad41dfbc5d6fd0fd561e3613697186df4/src/main/java/org/jdbdt/DataSource.java#L268-L285
Indoqa/logspace
logspace-agent-api/src/main/java/io/logspace/agent/api/AgentControllerProvider.java
AgentControllerProvider.setDescription
public static synchronized void setDescription(InputStream inputStream) { try { setDescription(AgentControllerDescriptionFactory.read(inputStream)); } catch (IOException ioex) { throw new AgentControllerInitializationException("Could not load logspace configuration.", ioex); } finally { closeQuietly(inputStream); } }
java
public static synchronized void setDescription(InputStream inputStream) { try { setDescription(AgentControllerDescriptionFactory.read(inputStream)); } catch (IOException ioex) { throw new AgentControllerInitializationException("Could not load logspace configuration.", ioex); } finally { closeQuietly(inputStream); } }
[ "public", "static", "synchronized", "void", "setDescription", "(", "InputStream", "inputStream", ")", "{", "try", "{", "setDescription", "(", "AgentControllerDescriptionFactory", ".", "read", "(", "inputStream", ")", ")", ";", "}", "catch", "(", "IOException", "io...
Set the {@link AgentControllerDescription} by reading it from the given {@link InputStream} and close the InputStream afterwards.<br> <br> This method expects the InputStream to provide a description in a format, that can be read by the {@link AgentControllerDescriptionFactory}.<br> This method will fail with an {@link AgentControllerInitializationException} if the AgentController has already been initialized or the AgentControllerDescription could not be loaded from the InputStream. @param inputStream The InputStream to read the AgentControllerDescription from. @see #isInitialized()
[ "Set", "the", "{", "@link", "AgentControllerDescription", "}", "by", "reading", "it", "from", "the", "given", "{", "@link", "InputStream", "}", "and", "close", "the", "InputStream", "afterwards", ".", "<br", ">", "<br", ">", "This", "method", "expects", "the...
train
https://github.com/Indoqa/logspace/blob/781a3f1da0580542d7dd726cac8eafecb090663d/logspace-agent-api/src/main/java/io/logspace/agent/api/AgentControllerProvider.java#L115-L123
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/jdeps/JdepsTask.java
JdepsTask.toTag
private String toTag(String name, Archive source, Analyzer.Type type) { if (!isJDKArchive(source)) { return source.getName(); } JDKArchive jdk = (JDKArchive)source; boolean isExported = false; if (type == CLASS || type == VERBOSE) { isExported = jdk.isExported(name); } else { isExported = jdk.isExportedPackage(name); } Profile p = getProfile(name, type); if (isExported) { // exported API return options.showProfile && p != null ? p.profileName() : ""; } else { return "JDK internal API (" + source.getName() + ")"; } }
java
private String toTag(String name, Archive source, Analyzer.Type type) { if (!isJDKArchive(source)) { return source.getName(); } JDKArchive jdk = (JDKArchive)source; boolean isExported = false; if (type == CLASS || type == VERBOSE) { isExported = jdk.isExported(name); } else { isExported = jdk.isExportedPackage(name); } Profile p = getProfile(name, type); if (isExported) { // exported API return options.showProfile && p != null ? p.profileName() : ""; } else { return "JDK internal API (" + source.getName() + ")"; } }
[ "private", "String", "toTag", "(", "String", "name", ",", "Archive", "source", ",", "Analyzer", ".", "Type", "type", ")", "{", "if", "(", "!", "isJDKArchive", "(", "source", ")", ")", "{", "return", "source", ".", "getName", "(", ")", ";", "}", "JDKA...
If the given archive is JDK archive, this method returns the profile name only if -profile option is specified; it accesses a private JDK API and the returned value will have "JDK internal API" prefix For non-JDK archives, this method returns the file name of the archive.
[ "If", "the", "given", "archive", "is", "JDK", "archive", "this", "method", "returns", "the", "profile", "name", "only", "if", "-", "profile", "option", "is", "specified", ";", "it", "accesses", "a", "private", "JDK", "API", "and", "the", "returned", "value...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/jdeps/JdepsTask.java#L954-L973
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/support/ReflectionUtils.java
ReflectionUtils.invokeMethod
public static Object invokeMethod(Method method, Object target) { return invokeMethod(method, target, new Object[0]); }
java
public static Object invokeMethod(Method method, Object target) { return invokeMethod(method, target, new Object[0]); }
[ "public", "static", "Object", "invokeMethod", "(", "Method", "method", ",", "Object", "target", ")", "{", "return", "invokeMethod", "(", "method", ",", "target", ",", "new", "Object", "[", "0", "]", ")", ";", "}" ]
Invoke the specified {@link Method} against the supplied target object with no arguments. The target object can be {@code null} when invoking a static {@link Method}. <p> Thrown exceptions are handled via a call to {@link #handleReflectionException}. @param method the method to invoke @param target the target object to invoke the method on @return the invocation result, if any @see #invokeMethod(java.lang.reflect.Method, Object, Object[])
[ "Invoke", "the", "specified", "{", "@link", "Method", "}", "against", "the", "supplied", "target", "object", "with", "no", "arguments", ".", "The", "target", "object", "can", "be", "{", "@code", "null", "}", "when", "invoking", "a", "static", "{", "@link",...
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ReflectionUtils.java#L107-L109
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDynacache.java
HTODDynacache.readCacheIdsByRange
public Result readCacheIdsByRange(int index, int length) { Result result = readByRange(CACHE_ID_DATA, index, length, CHECK_EXPIRED, FILTER); return result; }
java
public Result readCacheIdsByRange(int index, int length) { Result result = readByRange(CACHE_ID_DATA, index, length, CHECK_EXPIRED, FILTER); return result; }
[ "public", "Result", "readCacheIdsByRange", "(", "int", "index", ",", "int", "length", ")", "{", "Result", "result", "=", "readByRange", "(", "CACHE_ID_DATA", ",", "index", ",", "length", ",", "CHECK_EXPIRED", ",", "FILTER", ")", ";", "return", "result", ";",...
*********************************************************************** readCacheIdsByRange() This method is used by CacheMonitor to retrive the cache ids from the disk. If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous". The length of the max number of templates to be read. If length = -1, it reads all templates until the end. ***********************************************************************
[ "***********************************************************************", "readCacheIdsByRange", "()", "This", "method", "is", "used", "by", "CacheMonitor", "to", "retrive", "the", "cache", "ids", "from", "the", "disk", ".", "If", "index", "=", "0", "it", "starts", "...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/HTODDynacache.java#L1374-L1377
apereo/cas
support/cas-server-support-actions/src/main/java/org/apereo/cas/web/flow/GenerateServiceTicketAction.java
GenerateServiceTicketAction.newEvent
private Event newEvent(final String id, final Exception error) { return new EventFactorySupport().event(this, id, new LocalAttributeMap<>("error", error)); }
java
private Event newEvent(final String id, final Exception error) { return new EventFactorySupport().event(this, id, new LocalAttributeMap<>("error", error)); }
[ "private", "Event", "newEvent", "(", "final", "String", "id", ",", "final", "Exception", "error", ")", "{", "return", "new", "EventFactorySupport", "(", ")", ".", "event", "(", "this", ",", "id", ",", "new", "LocalAttributeMap", "<>", "(", "\"error\"", ","...
New event based on the id, which contains an error attribute referring to the exception occurred. @param id the id @param error the error @return the event
[ "New", "event", "based", "on", "the", "id", "which", "contains", "an", "error", "attribute", "referring", "to", "the", "exception", "occurred", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-actions/src/main/java/org/apereo/cas/web/flow/GenerateServiceTicketAction.java#L129-L131
looly/hutool
hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java
NetUtil.getMacAddress
public static String getMacAddress(InetAddress inetAddress, String separator) { if (null == inetAddress) { return null; } byte[] mac; try { mac = NetworkInterface.getByInetAddress(inetAddress).getHardwareAddress(); } catch (SocketException e) { throw new UtilException(e); } if (null != mac) { final StringBuilder sb = new StringBuilder(); String s; for (int i = 0; i < mac.length; i++) { if (i != 0) { sb.append(separator); } // 字节转换为整数 s = Integer.toHexString(mac[i] & 0xFF); sb.append(s.length() == 1 ? 0 + s : s); } return sb.toString(); } return null; }
java
public static String getMacAddress(InetAddress inetAddress, String separator) { if (null == inetAddress) { return null; } byte[] mac; try { mac = NetworkInterface.getByInetAddress(inetAddress).getHardwareAddress(); } catch (SocketException e) { throw new UtilException(e); } if (null != mac) { final StringBuilder sb = new StringBuilder(); String s; for (int i = 0; i < mac.length; i++) { if (i != 0) { sb.append(separator); } // 字节转换为整数 s = Integer.toHexString(mac[i] & 0xFF); sb.append(s.length() == 1 ? 0 + s : s); } return sb.toString(); } return null; }
[ "public", "static", "String", "getMacAddress", "(", "InetAddress", "inetAddress", ",", "String", "separator", ")", "{", "if", "(", "null", "==", "inetAddress", ")", "{", "return", "null", ";", "}", "byte", "[", "]", "mac", ";", "try", "{", "mac", "=", ...
获得指定地址信息中的MAC地址 @param inetAddress {@link InetAddress} @param separator 分隔符,推荐使用“-”或者“:” @return MAC地址,用-分隔
[ "获得指定地址信息中的MAC地址" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/net/NetUtil.java#L432-L457
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageFactoryImpl.java
JsMessageFactoryImpl.ensureSchemasAvailable
private final static int ensureSchemasAvailable(byte[] buffer, int offset, Object store) throws MessageRestoreFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "ensureSchemasAvailable", new Object[] {offset, store}); // If we have a message store we need to ensure all the schemas we'll // need to decode the message are restored from the store. int temp = ArrayUtil.readInt(buffer, offset); // the number of encoding Ids offset += ArrayUtil.INT_SIZE; long[] decodeIds = new long[temp]; for (int i = 0; i < temp; i++) { decodeIds[i] = ArrayUtil.readLong(buffer, offset); // each encoding schema id offset += ArrayUtil.LONG_SIZE; } if (store != null && decodeIds.length > 0) { if (!(store instanceof MessageStore)) throw new IllegalArgumentException("store is not a MessageStore instance"); SchemaStore.loadSchemas((MessageStore)store, decodeIds); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "ensureSchemasAvailable", offset); return offset; }
java
private final static int ensureSchemasAvailable(byte[] buffer, int offset, Object store) throws MessageRestoreFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "ensureSchemasAvailable", new Object[] {offset, store}); // If we have a message store we need to ensure all the schemas we'll // need to decode the message are restored from the store. int temp = ArrayUtil.readInt(buffer, offset); // the number of encoding Ids offset += ArrayUtil.INT_SIZE; long[] decodeIds = new long[temp]; for (int i = 0; i < temp; i++) { decodeIds[i] = ArrayUtil.readLong(buffer, offset); // each encoding schema id offset += ArrayUtil.LONG_SIZE; } if (store != null && decodeIds.length > 0) { if (!(store instanceof MessageStore)) throw new IllegalArgumentException("store is not a MessageStore instance"); SchemaStore.loadSchemas((MessageStore)store, decodeIds); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "ensureSchemasAvailable", offset); return offset; }
[ "private", "final", "static", "int", "ensureSchemasAvailable", "(", "byte", "[", "]", "buffer", ",", "int", "offset", ",", "Object", "store", ")", "throws", "MessageRestoreFailedException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", ...
Utility method to extract the schema ids from a message buffer and, if a message store is supplied, check that all the necessary schemas are available. @param buffer The buffer containing the schema ids @param offset The offset into the buffer where the schema ids start @param store The MesasgeStore from which the message is being recovered, may be null. @return int The offset in the buffer of the first byte after the schema ids @exception MessageRestoreFailedException is thrown if the necessary schemas are not available.
[ "Utility", "method", "to", "extract", "the", "schema", "ids", "from", "a", "message", "buffer", "and", "if", "a", "message", "store", "is", "supplied", "check", "that", "all", "the", "necessary", "schemas", "are", "available", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.common/src/com/ibm/ws/sib/mfp/impl/JsMessageFactoryImpl.java#L563-L582
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.zone_zoneName_dynHost_record_id_PUT
public void zone_zoneName_dynHost_record_id_PUT(String zoneName, Long id, OvhDynHostRecord body) throws IOException { String qPath = "/domain/zone/{zoneName}/dynHost/record/{id}"; StringBuilder sb = path(qPath, zoneName, id); exec(qPath, "PUT", sb.toString(), body); }
java
public void zone_zoneName_dynHost_record_id_PUT(String zoneName, Long id, OvhDynHostRecord body) throws IOException { String qPath = "/domain/zone/{zoneName}/dynHost/record/{id}"; StringBuilder sb = path(qPath, zoneName, id); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "zone_zoneName_dynHost_record_id_PUT", "(", "String", "zoneName", ",", "Long", "id", ",", "OvhDynHostRecord", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/zone/{zoneName}/dynHost/record/{id}\"", ";", "StringBuilder", "sb"...
Alter this object properties REST: PUT /domain/zone/{zoneName}/dynHost/record/{id} @param body [required] New object properties @param zoneName [required] The internal name of your zone @param id [required] Id of the object
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L412-L416
spotbugs/spotbugs
eclipsePlugin/src/de/tobject/findbugs/classify/SeverityClassificationPulldownAction.java
SeverityClassificationPulldownAction.fillMenu
private void fillMenu() { // Create a selection listener to handle when the // user selects a warning severity. SelectionListener menuItemSelectionListener = new SelectionAdapter() { /* * (non-Javadoc) * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse * .swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { Widget w = e.widget; int index; for (index = 0; index < severityItemList.length; ++index) { if (w == severityItemList[index]) { break; } } if (index < severityItemList.length) { if (bugInstance != null) { bugInstance.setProperty(BugProperty.SEVERITY, String.valueOf(index + 1)); } } } }; severityItemList = new MenuItem[SEVERITY_LABEL_LIST.length]; for (int i = 0; i < SEVERITY_LABEL_LIST.length; ++i) { MenuItem menuItem = new MenuItem(menu, SWT.RADIO); menuItem.setText(SEVERITY_LABEL_LIST[i]); menuItem.addSelectionListener(menuItemSelectionListener); severityItemList[i] = menuItem; } // Keep menu in sync with current BugInstance. menu.addMenuListener(new MenuAdapter() { /* * (non-Javadoc) * * @see * org.eclipse.swt.events.MenuAdapter#menuShown(org.eclipse.swt. * events.MenuEvent) */ @Override public void menuShown(MenuEvent e) { syncMenu(); } }); }
java
private void fillMenu() { // Create a selection listener to handle when the // user selects a warning severity. SelectionListener menuItemSelectionListener = new SelectionAdapter() { /* * (non-Javadoc) * * @see * org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse * .swt.events.SelectionEvent) */ @Override public void widgetSelected(SelectionEvent e) { Widget w = e.widget; int index; for (index = 0; index < severityItemList.length; ++index) { if (w == severityItemList[index]) { break; } } if (index < severityItemList.length) { if (bugInstance != null) { bugInstance.setProperty(BugProperty.SEVERITY, String.valueOf(index + 1)); } } } }; severityItemList = new MenuItem[SEVERITY_LABEL_LIST.length]; for (int i = 0; i < SEVERITY_LABEL_LIST.length; ++i) { MenuItem menuItem = new MenuItem(menu, SWT.RADIO); menuItem.setText(SEVERITY_LABEL_LIST[i]); menuItem.addSelectionListener(menuItemSelectionListener); severityItemList[i] = menuItem; } // Keep menu in sync with current BugInstance. menu.addMenuListener(new MenuAdapter() { /* * (non-Javadoc) * * @see * org.eclipse.swt.events.MenuAdapter#menuShown(org.eclipse.swt. * events.MenuEvent) */ @Override public void menuShown(MenuEvent e) { syncMenu(); } }); }
[ "private", "void", "fillMenu", "(", ")", "{", "// Create a selection listener to handle when the", "// user selects a warning severity.", "SelectionListener", "menuItemSelectionListener", "=", "new", "SelectionAdapter", "(", ")", "{", "/*\n * (non-Javadoc)\n *...
Fill the drop-down menu. We allow the user to choose a severity from 1 (least severe) to 5 (most severe). Default is 3.
[ "Fill", "the", "drop", "-", "down", "menu", ".", "We", "allow", "the", "user", "to", "choose", "a", "severity", "from", "1", "(", "least", "severe", ")", "to", "5", "(", "most", "severe", ")", ".", "Default", "is", "3", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/classify/SeverityClassificationPulldownAction.java#L73-L125
alkacon/opencms-core
src/org/opencms/ui/favorites/CmsFavoriteEntry.java
CmsFavoriteEntry.readId
public static CmsUUID readId(JSONObject obj, String key) { String strValue = obj.optString(key); if (!CmsUUID.isValidUUID(strValue)) { return null; } return new CmsUUID(strValue); }
java
public static CmsUUID readId(JSONObject obj, String key) { String strValue = obj.optString(key); if (!CmsUUID.isValidUUID(strValue)) { return null; } return new CmsUUID(strValue); }
[ "public", "static", "CmsUUID", "readId", "(", "JSONObject", "obj", ",", "String", "key", ")", "{", "String", "strValue", "=", "obj", ".", "optString", "(", "key", ")", ";", "if", "(", "!", "CmsUUID", ".", "isValidUUID", "(", "strValue", ")", ")", "{", ...
Reads a UUID from a JSON object. Returns null if the JSON value for the given key is not present or not a valid UUID @param obj the JSON object @param key the JSON key @return the UUID
[ "Reads", "a", "UUID", "from", "a", "JSON", "object", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteEntry.java#L157-L164
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_account_accountName_changePassword_POST
public OvhTaskPop domain_account_accountName_changePassword_POST(String domain, String accountName, String password) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/changePassword"; StringBuilder sb = path(qPath, domain, accountName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "password", password); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskPop.class); }
java
public OvhTaskPop domain_account_accountName_changePassword_POST(String domain, String accountName, String password) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/changePassword"; StringBuilder sb = path(qPath, domain, accountName); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "password", password); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskPop.class); }
[ "public", "OvhTaskPop", "domain_account_accountName_changePassword_POST", "(", "String", "domain", ",", "String", "accountName", ",", "String", "password", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/domain/{domain}/account/{accountName}/changePassword\...
Change mailbox password (length : [9;30], no space at begin and end, no accent) REST: POST /email/domain/{domain}/account/{accountName}/changePassword @param password [required] New password @param domain [required] Name of your domain name @param accountName [required] Name of account
[ "Change", "mailbox", "password", "(", "length", ":", "[", "9", ";", "30", "]", "no", "space", "at", "begin", "and", "end", "no", "accent", ")" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L558-L565
mgormley/pacaya
src/main/java/edu/jhu/pacaya/gm/model/FactorGraph.java
FactorGraph.getClamped
public FactorGraph getClamped(VarConfig clampVars) { FactorGraph clmpFg = new FactorGraph(); // Add ALL the original variables to the clamped factor graph. for (Var v : this.getVars()) { clmpFg.addVar(v); } // Add ALL the original factors to the clamped factor graph. for (Factor origFactor : this.getFactors()) { clmpFg.addFactor(origFactor); } // Add unary factors to the clamped variables to ensure they take on the correct value. for (Var v : clampVars.getVars()) { // TODO: We could skip these (cautiously) if there's already a // ClampFactor attached to this variable. int c = clampVars.getState(v); clmpFg.addFactor(new ClampFactor(v, c)); } return clmpFg; }
java
public FactorGraph getClamped(VarConfig clampVars) { FactorGraph clmpFg = new FactorGraph(); // Add ALL the original variables to the clamped factor graph. for (Var v : this.getVars()) { clmpFg.addVar(v); } // Add ALL the original factors to the clamped factor graph. for (Factor origFactor : this.getFactors()) { clmpFg.addFactor(origFactor); } // Add unary factors to the clamped variables to ensure they take on the correct value. for (Var v : clampVars.getVars()) { // TODO: We could skip these (cautiously) if there's already a // ClampFactor attached to this variable. int c = clampVars.getState(v); clmpFg.addFactor(new ClampFactor(v, c)); } return clmpFg; }
[ "public", "FactorGraph", "getClamped", "(", "VarConfig", "clampVars", ")", "{", "FactorGraph", "clmpFg", "=", "new", "FactorGraph", "(", ")", ";", "// Add ALL the original variables to the clamped factor graph.", "for", "(", "Var", "v", ":", "this", ".", "getVars", ...
Gets a new factor graph, identical to this one, except that specified variables are clamped to their values. This is accomplished by adding a unary factor on each clamped variable. The original K factors are preserved in order with IDs 1...K. @param clampVars The variables to clamp.
[ "Gets", "a", "new", "factor", "graph", "identical", "to", "this", "one", "except", "that", "specified", "variables", "are", "clamped", "to", "their", "values", ".", "This", "is", "accomplished", "by", "adding", "a", "unary", "factor", "on", "each", "clamped"...
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/gm/model/FactorGraph.java#L52-L71
tango-controls/JTango
server/src/main/java/org/tango/server/build/StatusBuilder.java
StatusBuilder.build
public void build(final Class<?> clazz, final Field field, final DeviceImpl device, final Object businessObject) throws DevFailed { xlogger.entry(); BuilderUtils.checkStatic(field); Method getter; final String stateName = field.getName(); final String getterName = BuilderUtils.GET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH) + stateName.substring(1); try { getter = clazz.getMethod(getterName); } catch (final NoSuchMethodException e) { throw DevFailedUtils.newDevFailed(e); } if (getter.getParameterTypes().length != 0) { throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must not have a parameter"); } logger.debug("Has an status : {}", field.getName()); if (getter.getReturnType() != String.class) { throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must have a return type of " + String.class); } Method setter; final String setterName = BuilderUtils.SET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH) + stateName.substring(1); try { setter = clazz.getMethod(setterName, String.class); } catch (final NoSuchMethodException e) { throw DevFailedUtils.newDevFailed(e); } device.setStatusImpl(new StatusImpl(businessObject, getter, setter)); final Status annot = field.getAnnotation(Status.class); if (annot.isPolled()) { device.addAttributePolling(DeviceImpl.STATUS_NAME, annot.pollingPeriod()); } xlogger.exit(); }
java
public void build(final Class<?> clazz, final Field field, final DeviceImpl device, final Object businessObject) throws DevFailed { xlogger.entry(); BuilderUtils.checkStatic(field); Method getter; final String stateName = field.getName(); final String getterName = BuilderUtils.GET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH) + stateName.substring(1); try { getter = clazz.getMethod(getterName); } catch (final NoSuchMethodException e) { throw DevFailedUtils.newDevFailed(e); } if (getter.getParameterTypes().length != 0) { throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must not have a parameter"); } logger.debug("Has an status : {}", field.getName()); if (getter.getReturnType() != String.class) { throw DevFailedUtils.newDevFailed(DevFailedUtils.TANGO_BUILD_FAILED, getter + " must have a return type of " + String.class); } Method setter; final String setterName = BuilderUtils.SET + stateName.substring(0, 1).toUpperCase(Locale.ENGLISH) + stateName.substring(1); try { setter = clazz.getMethod(setterName, String.class); } catch (final NoSuchMethodException e) { throw DevFailedUtils.newDevFailed(e); } device.setStatusImpl(new StatusImpl(businessObject, getter, setter)); final Status annot = field.getAnnotation(Status.class); if (annot.isPolled()) { device.addAttributePolling(DeviceImpl.STATUS_NAME, annot.pollingPeriod()); } xlogger.exit(); }
[ "public", "void", "build", "(", "final", "Class", "<", "?", ">", "clazz", ",", "final", "Field", "field", ",", "final", "DeviceImpl", "device", ",", "final", "Object", "businessObject", ")", "throws", "DevFailed", "{", "xlogger", ".", "entry", "(", ")", ...
Create a status @param clazz @param field @param device @param businessObject @throws DevFailed
[ "Create", "a", "status" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/build/StatusBuilder.java#L61-L97
jbundle/jbundle
thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageQueue.java
RemoteMessageQueue.createMessageSender
public BaseMessageSender createMessageSender() { RemoteTask server = (RemoteTask)((App)this.getMessageManager().getApplication()).getRemoteTask(null); try { return new RemoteMessageSender(server, this); } catch (RemoteException ex) { ex.printStackTrace(); } return null; }
java
public BaseMessageSender createMessageSender() { RemoteTask server = (RemoteTask)((App)this.getMessageManager().getApplication()).getRemoteTask(null); try { return new RemoteMessageSender(server, this); } catch (RemoteException ex) { ex.printStackTrace(); } return null; }
[ "public", "BaseMessageSender", "createMessageSender", "(", ")", "{", "RemoteTask", "server", "=", "(", "RemoteTask", ")", "(", "(", "App", ")", "this", ".", "getMessageManager", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getRemoteTask", "(", "null...
Create a new (Remote) message sender. @return The message sender.
[ "Create", "a", "new", "(", "Remote", ")", "message", "sender", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/remote/src/main/java/org/jbundle/thin/base/message/remote/RemoteMessageQueue.java#L64-L73
patrickfav/bcrypt
modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCryptOpenBSDProtocol.java
BCryptOpenBSDProtocol.enhancedKeySchedule
private void enhancedKeySchedule(int[] P, int[] S, byte[] data, byte[] key) { int i; int[] koffp = {0}, doffp = {0}; int[] lr = {0, 0}; int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) { P[i] = P[i] ^ streamToWord(key, koffp); } //noinspection Duplicates for (i = 0; i < plen; i += 2) { lr[0] ^= streamToWord(data, doffp); lr[1] ^= streamToWord(data, doffp); encipher(P, S, lr, 0); P[i] = lr[0]; P[i + 1] = lr[1]; } //noinspection Duplicates for (i = 0; i < slen; i += 2) { lr[0] ^= streamToWord(data, doffp); lr[1] ^= streamToWord(data, doffp); encipher(P, S, lr, 0); S[i] = lr[0]; S[i + 1] = lr[1]; } }
java
private void enhancedKeySchedule(int[] P, int[] S, byte[] data, byte[] key) { int i; int[] koffp = {0}, doffp = {0}; int[] lr = {0, 0}; int plen = P.length, slen = S.length; for (i = 0; i < plen; i++) { P[i] = P[i] ^ streamToWord(key, koffp); } //noinspection Duplicates for (i = 0; i < plen; i += 2) { lr[0] ^= streamToWord(data, doffp); lr[1] ^= streamToWord(data, doffp); encipher(P, S, lr, 0); P[i] = lr[0]; P[i + 1] = lr[1]; } //noinspection Duplicates for (i = 0; i < slen; i += 2) { lr[0] ^= streamToWord(data, doffp); lr[1] ^= streamToWord(data, doffp); encipher(P, S, lr, 0); S[i] = lr[0]; S[i + 1] = lr[1]; } }
[ "private", "void", "enhancedKeySchedule", "(", "int", "[", "]", "P", ",", "int", "[", "]", "S", ",", "byte", "[", "]", "data", ",", "byte", "[", "]", "key", ")", "{", "int", "i", ";", "int", "[", "]", "koffp", "=", "{", "0", "}", ",", "doffp"...
Perform the "enhanced key schedule" step described by Provos and Mazieres in "A Future-Adaptable Password Scheme" http://www.openbsd.org/papers/bcrypt-paper.ps @param data salt information @param key password information
[ "Perform", "the", "enhanced", "key", "schedule", "step", "described", "by", "Provos", "and", "Mazieres", "in", "A", "Future", "-", "Adaptable", "Password", "Scheme", "http", ":", "//", "www", ".", "openbsd", ".", "org", "/", "papers", "/", "bcrypt", "-", ...
train
https://github.com/patrickfav/bcrypt/blob/40e75be395b4e1b57b9872b22d98a9fb560e0184/modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCryptOpenBSDProtocol.java#L366-L393
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_ips_ipAddress_PUT
public void serviceName_ips_ipAddress_PUT(String serviceName, String ipAddress, OvhIp body) throws IOException { String qPath = "/vps/{serviceName}/ips/{ipAddress}"; StringBuilder sb = path(qPath, serviceName, ipAddress); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_ips_ipAddress_PUT(String serviceName, String ipAddress, OvhIp body) throws IOException { String qPath = "/vps/{serviceName}/ips/{ipAddress}"; StringBuilder sb = path(qPath, serviceName, ipAddress); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_ips_ipAddress_PUT", "(", "String", "serviceName", ",", "String", "ipAddress", ",", "OvhIp", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vps/{serviceName}/ips/{ipAddress}\"", ";", "StringBuilder", "sb", "=", "pa...
Alter this object properties REST: PUT /vps/{serviceName}/ips/{ipAddress} @param body [required] New object properties @param serviceName [required] The internal name of your VPS offer @param ipAddress [required] The effective ip address of the Ip object
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L562-L566
bekkopen/NoCommons
src/main/java/no/bekk/bekkopen/banking/Kidnummer.java
Kidnummer.mod10Kid
public static Kidnummer mod10Kid(String baseNumber, int targetLength) { if (baseNumber.length() >= targetLength) throw new IllegalArgumentException("baseNumber too long"); String padded = String.format("%0" + (targetLength-1) + "d", new BigInteger(baseNumber)); Kidnummer k = new Kidnummer(padded + "0"); return KidnummerValidator.getKidnummer(padded + calculateMod10CheckSum(getMod10Weights(k), k)); }
java
public static Kidnummer mod10Kid(String baseNumber, int targetLength) { if (baseNumber.length() >= targetLength) throw new IllegalArgumentException("baseNumber too long"); String padded = String.format("%0" + (targetLength-1) + "d", new BigInteger(baseNumber)); Kidnummer k = new Kidnummer(padded + "0"); return KidnummerValidator.getKidnummer(padded + calculateMod10CheckSum(getMod10Weights(k), k)); }
[ "public", "static", "Kidnummer", "mod10Kid", "(", "String", "baseNumber", ",", "int", "targetLength", ")", "{", "if", "(", "baseNumber", ".", "length", "(", ")", ">=", "targetLength", ")", "throw", "new", "IllegalArgumentException", "(", "\"baseNumber too long\"",...
Create a valid KID numer of the wanted length, using MOD10. Input is padded with leading zeros to reach wanted target length @param baseNumber base number to calculate checksum digit for @param targetLength wanted length, 0-padded. Between 2-25 @return Kidnummer
[ "Create", "a", "valid", "KID", "numer", "of", "the", "wanted", "length", "using", "MOD10", ".", "Input", "is", "padded", "with", "leading", "zeros", "to", "reach", "wanted", "target", "length" ]
train
https://github.com/bekkopen/NoCommons/blob/5a576696390cecaac111fa97fde581e0c1afb9b8/src/main/java/no/bekk/bekkopen/banking/Kidnummer.java#L36-L42
gallandarakhneorg/afc
advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java
DBaseFileReader.readNumberRecordValue
private static int readNumberRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData, int rawOffset, OutputParameter<Double> value) throws IOException { final String buffer = new String(rawData, rawOffset, field.getLength()); try { final String b = buffer.trim(); if (b != null && b.length() > 0) { value.set(new Double(b)); return field.getLength(); } } catch (NumberFormatException e) { // } throw new InvalidRawDataFormatException(nrecord, nfield, buffer); }
java
private static int readNumberRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData, int rawOffset, OutputParameter<Double> value) throws IOException { final String buffer = new String(rawData, rawOffset, field.getLength()); try { final String b = buffer.trim(); if (b != null && b.length() > 0) { value.set(new Double(b)); return field.getLength(); } } catch (NumberFormatException e) { // } throw new InvalidRawDataFormatException(nrecord, nfield, buffer); }
[ "private", "static", "int", "readNumberRecordValue", "(", "DBaseFileField", "field", ",", "int", "nrecord", ",", "int", "nfield", ",", "byte", "[", "]", "rawData", ",", "int", "rawOffset", ",", "OutputParameter", "<", "Double", ">", "value", ")", "throws", "...
Read a NUMBER record value. @param field is the current parsed field. @param nrecord is the number of the record @param nfield is the number of the field @param rawData raw data @param rawOffset is the index at which the data could be obtained @param value will be set with the value extracted from the dBASE file @return the count of consumed bytes @throws IOException in case of error.
[ "Read", "a", "NUMBER", "record", "value", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1122-L1135
grails/grails-core
grails-bootstrap/src/main/groovy/grails/util/GrailsNameUtils.java
GrailsNameUtils.getPropertyForGetter
public static String getPropertyForGetter(String getterName, String returnType) { if (getterName == null || getterName.length() == 0) return null; if (getterName.startsWith("get")) { String prop = getterName.substring(3); return convertValidPropertyMethodSuffix(prop); } if (getterName.startsWith("is") && returnType.equals("boolean")) { String prop = getterName.substring(2); return convertValidPropertyMethodSuffix(prop); } return null; }
java
public static String getPropertyForGetter(String getterName, String returnType) { if (getterName == null || getterName.length() == 0) return null; if (getterName.startsWith("get")) { String prop = getterName.substring(3); return convertValidPropertyMethodSuffix(prop); } if (getterName.startsWith("is") && returnType.equals("boolean")) { String prop = getterName.substring(2); return convertValidPropertyMethodSuffix(prop); } return null; }
[ "public", "static", "String", "getPropertyForGetter", "(", "String", "getterName", ",", "String", "returnType", ")", "{", "if", "(", "getterName", "==", "null", "||", "getterName", ".", "length", "(", ")", "==", "0", ")", "return", "null", ";", "if", "(", ...
Returns a property name equivalent for the given getter name and return type or null if it is not a valid getter. If not null or empty the getter name is assumed to be a valid identifier. @param getterName The getter name @param returnType The type the method returns @return The property name equivalent
[ "Returns", "a", "property", "name", "equivalent", "for", "the", "given", "getter", "name", "and", "return", "type", "or", "null", "if", "it", "is", "not", "a", "valid", "getter", ".", "If", "not", "null", "or", "empty", "the", "getter", "name", "is", "...
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-bootstrap/src/main/groovy/grails/util/GrailsNameUtils.java#L576-L588
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/http/apache/utils/ApacheUtils.java
ApacheUtils.createResponse
public static HttpResponse createResponse(Request<?> request, HttpRequestBase method, org.apache.http.HttpResponse apacheHttpResponse, HttpContext context) throws IOException { HttpResponse httpResponse = new HttpResponse(request, method, context); if (apacheHttpResponse.getEntity() != null) { httpResponse.setContent(apacheHttpResponse.getEntity().getContent()); } httpResponse.setStatusCode(apacheHttpResponse.getStatusLine().getStatusCode()); httpResponse.setStatusText(apacheHttpResponse.getStatusLine().getReasonPhrase()); for (Header header : apacheHttpResponse.getAllHeaders()) { httpResponse.addHeader(header.getName(), header.getValue()); } return httpResponse; }
java
public static HttpResponse createResponse(Request<?> request, HttpRequestBase method, org.apache.http.HttpResponse apacheHttpResponse, HttpContext context) throws IOException { HttpResponse httpResponse = new HttpResponse(request, method, context); if (apacheHttpResponse.getEntity() != null) { httpResponse.setContent(apacheHttpResponse.getEntity().getContent()); } httpResponse.setStatusCode(apacheHttpResponse.getStatusLine().getStatusCode()); httpResponse.setStatusText(apacheHttpResponse.getStatusLine().getReasonPhrase()); for (Header header : apacheHttpResponse.getAllHeaders()) { httpResponse.addHeader(header.getName(), header.getValue()); } return httpResponse; }
[ "public", "static", "HttpResponse", "createResponse", "(", "Request", "<", "?", ">", "request", ",", "HttpRequestBase", "method", ",", "org", ".", "apache", ".", "http", ".", "HttpResponse", "apacheHttpResponse", ",", "HttpContext", "context", ")", "throws", "IO...
Creates and initializes an HttpResponse object suitable to be passed to an HTTP response handler object. @param request Marshalled request object. @param method The HTTP method that was invoked to get the response. @param context The HTTP context associated with the request and response. @return The new, initialized HttpResponse object ready to be passed to an HTTP response handler object. @throws IOException If there were any problems getting any response information from the HttpClient method object.
[ "Creates", "and", "initializes", "an", "HttpResponse", "object", "suitable", "to", "be", "passed", "to", "an", "HTTP", "response", "handler", "object", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/http/apache/utils/ApacheUtils.java#L69-L86
FedericoPecora/meta-csp-framework
src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelopeSolver.java
TrajectoryEnvelopeSolver.createEnvelopes
public HashMap<Integer,ArrayList<TrajectoryEnvelope>> createEnvelopes(int firstRobotID, String ... pathFiles) { //Default footprint, 2.7 (w) x 6.6 (l) Coordinate frontLeft = new Coordinate(5.3, 1.35); Coordinate frontRight = new Coordinate(5.3, -1.35); Coordinate backRight = new Coordinate(-1.3, -1.35); Coordinate backLeft = new Coordinate(-1.3, 1.35); Coordinate[] footprint = new Coordinate[] {frontLeft,frontRight,backLeft,backRight}; long durationFirstParking = 3000; long durationLastParking = 3000; return createEnvelopes(firstRobotID, durationFirstParking, durationLastParking, footprint, pathFiles); }
java
public HashMap<Integer,ArrayList<TrajectoryEnvelope>> createEnvelopes(int firstRobotID, String ... pathFiles) { //Default footprint, 2.7 (w) x 6.6 (l) Coordinate frontLeft = new Coordinate(5.3, 1.35); Coordinate frontRight = new Coordinate(5.3, -1.35); Coordinate backRight = new Coordinate(-1.3, -1.35); Coordinate backLeft = new Coordinate(-1.3, 1.35); Coordinate[] footprint = new Coordinate[] {frontLeft,frontRight,backLeft,backRight}; long durationFirstParking = 3000; long durationLastParking = 3000; return createEnvelopes(firstRobotID, durationFirstParking, durationLastParking, footprint, pathFiles); }
[ "public", "HashMap", "<", "Integer", ",", "ArrayList", "<", "TrajectoryEnvelope", ">", ">", "createEnvelopes", "(", "int", "firstRobotID", ",", "String", "...", "pathFiles", ")", "{", "//Default footprint, 2.7 (w) x 6.6 (l)", "Coordinate", "frontLeft", "=", "new", "...
Create a trajectory envelope for each given reference to a file containing a path. Robot IDs are assigned starting from the given integer. This method creates three envelopes for each path: the main {@link TrajectoryEnvelope} covering the path; one {@link TrajectoryEnvelope} for the starting position of the robot; and one one {@link TrajectoryEnvelope} for the final parking position of the robot. The three envelopes are constrained with {@link AllenIntervalConstraint.Type#Meets} constraints. The two parking envelopes have a duration of 3000 ms each. A default footprint of size 2.7 (w) x 6.6 (l) is used. @param firstRobotID The starting robot ID. @param pathFiles The files containing paths over which to create the {@link TrajectoryEnvelope}s. @return A mapping between robot IDs and the newly created sets of {@link TrajectoryEnvelope}s.
[ "Create", "a", "trajectory", "envelope", "for", "each", "given", "reference", "to", "a", "file", "containing", "a", "path", ".", "Robot", "IDs", "are", "assigned", "starting", "from", "the", "given", "integer", ".", "This", "method", "creates", "three", "env...
train
https://github.com/FedericoPecora/meta-csp-framework/blob/42aaef2e2b76d0f738427f0dd9653c4f62b40517/src/main/java/org/metacsp/multi/spatioTemporal/paths/TrajectoryEnvelopeSolver.java#L339-L349
chr78rm/tracelogger
src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java
AbstractTracer.readConfiguration
protected void readConfiguration(XPath xpath, Node node) throws XPathExpressionException, AbstractTracer.Exception { this.autoflush = "true".equals((String) xpath.evaluate("./dns:AutoFlush/text()", node, XPathConstants.STRING)); this.bufferSize = Integer.parseInt((String) xpath.evaluate("./dns:BufSize/text()", node, XPathConstants.STRING)); System.out.println("this.autoflush = " + this.autoflush); System.out.println("this.bufferSize = " + this.bufferSize); NodeList threadNodes = (NodeList) xpath.evaluate("./dns:Context/dns:Thread", node, XPathConstants.NODESET); for (int i = 0; i < threadNodes.getLength(); i++) { String threadName = threadNodes.item(i).getAttributes().getNamedItem("name").getNodeValue(); boolean online = "true".equals((String) xpath.evaluate("./dns:Online/text()", threadNodes.item(i), XPathConstants.STRING)); int debugLevel = Integer.parseInt((String) xpath.evaluate("./dns:DebugLevel/text()", threadNodes.item(i), XPathConstants.STRING)); System.out.println("(*-*)"); System.out.println("threadName = " + threadName); System.out.println("online = " + online); System.out.println("debugLevel = " + debugLevel); this.debugConfigMap.put(threadName, new DebugConfig(online, debugLevel)); } }
java
protected void readConfiguration(XPath xpath, Node node) throws XPathExpressionException, AbstractTracer.Exception { this.autoflush = "true".equals((String) xpath.evaluate("./dns:AutoFlush/text()", node, XPathConstants.STRING)); this.bufferSize = Integer.parseInt((String) xpath.evaluate("./dns:BufSize/text()", node, XPathConstants.STRING)); System.out.println("this.autoflush = " + this.autoflush); System.out.println("this.bufferSize = " + this.bufferSize); NodeList threadNodes = (NodeList) xpath.evaluate("./dns:Context/dns:Thread", node, XPathConstants.NODESET); for (int i = 0; i < threadNodes.getLength(); i++) { String threadName = threadNodes.item(i).getAttributes().getNamedItem("name").getNodeValue(); boolean online = "true".equals((String) xpath.evaluate("./dns:Online/text()", threadNodes.item(i), XPathConstants.STRING)); int debugLevel = Integer.parseInt((String) xpath.evaluate("./dns:DebugLevel/text()", threadNodes.item(i), XPathConstants.STRING)); System.out.println("(*-*)"); System.out.println("threadName = " + threadName); System.out.println("online = " + online); System.out.println("debugLevel = " + debugLevel); this.debugConfigMap.put(threadName, new DebugConfig(online, debugLevel)); } }
[ "protected", "void", "readConfiguration", "(", "XPath", "xpath", ",", "Node", "node", ")", "throws", "XPathExpressionException", ",", "AbstractTracer", ".", "Exception", "{", "this", ".", "autoflush", "=", "\"true\"", ".", "equals", "(", "(", "String", ")", "x...
Reads the configuration for this particular tracer instance by evaluating the given node with the given xpath engine. @param xpath the xpath engine @param node the config node @throws javax.xml.xpath.XPathExpressionException indicates xpath problems @throws de.christofreichardt.diagnosis.AbstractTracer.Exception indicates problems when configuring certain tracer instances
[ "Reads", "the", "configuration", "for", "this", "particular", "tracer", "instance", "by", "evaluating", "the", "given", "node", "with", "the", "given", "xpath", "engine", "." ]
train
https://github.com/chr78rm/tracelogger/blob/ad22452b20f8111ad4d367302c2b26a100a20200/src/main/java/de/christofreichardt/diagnosis/AbstractTracer.java#L310-L331
alkacon/opencms-core
src/org/opencms/loader/CmsDefaultTemplateContextProvider.java
CmsDefaultTemplateContextProvider.initMap
private Map<String, CmsTemplateContext> initMap() throws Exception { Map<String, CmsTemplateContext> result = new LinkedHashMap<String, CmsTemplateContext>(); String path = getConfigurationPropertyPath(); CmsResource resource = m_cms.readResource(path); CmsFile file = m_cms.readFile(resource); String fileContent = new String(file.getContents(), "UTF-8"); CmsMacroResolver resolver = new CmsMacroResolver(); resolver.setCmsObject(m_cms); for (Map.Entry<String, String> param : m_params.entrySet()) { resolver.addMacro(param.getKey(), param.getValue()); } fileContent = resolver.resolveMacros(fileContent); JSONTokener tok = new JSONTokener(fileContent); tok.setOrdered(true); JSONObject root = new JSONObject(tok, true); for (String templateContextName : root.keySet()) { JSONObject templateContextJson = (JSONObject)(root.opt(templateContextName)); CmsJsonMessageContainer jsonMessage = new CmsJsonMessageContainer(templateContextJson.opt(A_NICE_NAME)); String templatePath = (String)templateContextJson.opt(A_PATH); JSONObject variantsJson = (JSONObject)templateContextJson.opt(A_VARIANTS); List<CmsClientVariant> variants = new ArrayList<CmsClientVariant>(); if (variantsJson != null) { for (String variantName : variantsJson.keySet()) { JSONObject variantJson = (JSONObject)variantsJson.opt(variantName); CmsJsonMessageContainer variantMessage = new CmsJsonMessageContainer(variantJson.opt(A_NICE_NAME)); int width = variantJson.optInt(A_WIDTH, 800); int height = variantJson.optInt(A_HEIGHT, 600); CmsClientVariant variant = new CmsClientVariant( variantName, variantMessage, width, height, new HashMap<String, String>()); variants.add(variant); } } CmsTemplateContext templateContext = new CmsTemplateContext( templateContextName, templatePath, jsonMessage, this, variants, false); result.put(templateContextName, templateContext); } return result; }
java
private Map<String, CmsTemplateContext> initMap() throws Exception { Map<String, CmsTemplateContext> result = new LinkedHashMap<String, CmsTemplateContext>(); String path = getConfigurationPropertyPath(); CmsResource resource = m_cms.readResource(path); CmsFile file = m_cms.readFile(resource); String fileContent = new String(file.getContents(), "UTF-8"); CmsMacroResolver resolver = new CmsMacroResolver(); resolver.setCmsObject(m_cms); for (Map.Entry<String, String> param : m_params.entrySet()) { resolver.addMacro(param.getKey(), param.getValue()); } fileContent = resolver.resolveMacros(fileContent); JSONTokener tok = new JSONTokener(fileContent); tok.setOrdered(true); JSONObject root = new JSONObject(tok, true); for (String templateContextName : root.keySet()) { JSONObject templateContextJson = (JSONObject)(root.opt(templateContextName)); CmsJsonMessageContainer jsonMessage = new CmsJsonMessageContainer(templateContextJson.opt(A_NICE_NAME)); String templatePath = (String)templateContextJson.opt(A_PATH); JSONObject variantsJson = (JSONObject)templateContextJson.opt(A_VARIANTS); List<CmsClientVariant> variants = new ArrayList<CmsClientVariant>(); if (variantsJson != null) { for (String variantName : variantsJson.keySet()) { JSONObject variantJson = (JSONObject)variantsJson.opt(variantName); CmsJsonMessageContainer variantMessage = new CmsJsonMessageContainer(variantJson.opt(A_NICE_NAME)); int width = variantJson.optInt(A_WIDTH, 800); int height = variantJson.optInt(A_HEIGHT, 600); CmsClientVariant variant = new CmsClientVariant( variantName, variantMessage, width, height, new HashMap<String, String>()); variants.add(variant); } } CmsTemplateContext templateContext = new CmsTemplateContext( templateContextName, templatePath, jsonMessage, this, variants, false); result.put(templateContextName, templateContext); } return result; }
[ "private", "Map", "<", "String", ",", "CmsTemplateContext", ">", "initMap", "(", ")", "throws", "Exception", "{", "Map", "<", "String", ",", "CmsTemplateContext", ">", "result", "=", "new", "LinkedHashMap", "<", "String", ",", "CmsTemplateContext", ">", "(", ...
Loads the context map from the VFS.<p> @return the context map @throws Exception if something goes wrong
[ "Loads", "the", "context", "map", "from", "the", "VFS", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsDefaultTemplateContextProvider.java#L220-L268
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.stateIsTrue
@Throws(IllegalStateOfArgumentException.class) public static void stateIsTrue(final boolean expression, @Nonnull final String descriptionTemplate, final Object... descriptionTemplateArgs) { if (!expression) { throw new IllegalStateOfArgumentException(descriptionTemplate, descriptionTemplateArgs); } }
java
@Throws(IllegalStateOfArgumentException.class) public static void stateIsTrue(final boolean expression, @Nonnull final String descriptionTemplate, final Object... descriptionTemplateArgs) { if (!expression) { throw new IllegalStateOfArgumentException(descriptionTemplate, descriptionTemplateArgs); } }
[ "@", "Throws", "(", "IllegalStateOfArgumentException", ".", "class", ")", "public", "static", "void", "stateIsTrue", "(", "final", "boolean", "expression", ",", "@", "Nonnull", "final", "String", "descriptionTemplate", ",", "final", "Object", "...", "descriptionTemp...
Ensures that a given state is {@code true} @param expression an expression that must be {@code true} to indicate a valid state @param descriptionTemplate format string template that explains why the state is invalid @param descriptionTemplateArgs format string template arguments to explain why the state is invalid @throws IllegalStateOfArgumentException if the given arguments caused an invalid state
[ "Ensures", "that", "a", "given", "state", "is", "{", "@code", "true", "}" ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L3327-L3333
OpenLiberty/open-liberty
dev/com.ibm.ws.session/src/com/ibm/ws/session/StoreCallback.java
StoreCallback.sessionExpiryTimeSet
public void sessionExpiryTimeSet(ISession session, long old, long newone) { _sessionStateEventDispatcher.sessionExpiryTimeSet(session, old, newone); }
java
public void sessionExpiryTimeSet(ISession session, long old, long newone) { _sessionStateEventDispatcher.sessionExpiryTimeSet(session, old, newone); }
[ "public", "void", "sessionExpiryTimeSet", "(", "ISession", "session", ",", "long", "old", ",", "long", "newone", ")", "{", "_sessionStateEventDispatcher", ".", "sessionExpiryTimeSet", "(", "session", ",", "old", ",", "newone", ")", ";", "}" ]
Method sessionExpiryTimeSet <p> @param session @param old @param newone @see com.ibm.wsspi.session.IStoreCallback#sessionExpiryTimeSet(com.ibm.wsspi.session.ISession, long, long)
[ "Method", "sessionExpiryTimeSet", "<p", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session/src/com/ibm/ws/session/StoreCallback.java#L252-L255
calimero-project/calimero-core
src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java
KNXNetworkLinkIP.newTunnelingLink
public static KNXNetworkLinkIP newTunnelingLink(final InetSocketAddress localEP, final InetSocketAddress remoteEP, final boolean useNAT, final KNXMediumSettings settings) throws KNXException, InterruptedException { return new KNXNetworkLinkIP(TUNNELING, localEP, remoteEP, useNAT, settings); }
java
public static KNXNetworkLinkIP newTunnelingLink(final InetSocketAddress localEP, final InetSocketAddress remoteEP, final boolean useNAT, final KNXMediumSettings settings) throws KNXException, InterruptedException { return new KNXNetworkLinkIP(TUNNELING, localEP, remoteEP, useNAT, settings); }
[ "public", "static", "KNXNetworkLinkIP", "newTunnelingLink", "(", "final", "InetSocketAddress", "localEP", ",", "final", "InetSocketAddress", "remoteEP", ",", "final", "boolean", "useNAT", ",", "final", "KNXMediumSettings", "settings", ")", "throws", "KNXException", ",",...
Creates a new network link using KNXnet/IP tunneling (internally using a {@link KNXnetIPConnection}) to a remote KNXnet/IP server endpoint. @param localEP the local control endpoint of the link to use, supply the wildcard address to use a local IP on the same subnet as <code>remoteEP</code> and an ephemeral port number @param remoteEP the remote endpoint of the link to communicate with; this is the KNXnet/IP server control endpoint @param useNAT <code>true</code> to use network address translation (NAT) in tunneling service mode, <code>false</code> to use the default (non aware) mode @param settings medium settings defining device and KNX medium specifics for communication @return the network link in open state @throws KNXException on failure establishing link using the KNXnet/IP connection @throws InterruptedException on interrupted thread while establishing link
[ "Creates", "a", "new", "network", "link", "using", "KNXnet", "/", "IP", "tunneling", "(", "internally", "using", "a", "{", "@link", "KNXnetIPConnection", "}", ")", "to", "a", "remote", "KNXnet", "/", "IP", "server", "endpoint", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/link/KNXNetworkLinkIP.java#L131-L135
Azure/azure-sdk-for-java
cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java
DatabaseAccountsInner.beginRegenerateKeyAsync
public Observable<Void> beginRegenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind) { return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginRegenerateKeyAsync(String resourceGroupName, String accountName, KeyKind keyKind) { return beginRegenerateKeyWithServiceResponseAsync(resourceGroupName, accountName, keyKind).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginRegenerateKeyAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "KeyKind", "keyKind", ")", "{", "return", "beginRegenerateKeyWithServiceResponseAsync", "(", "resourceGroupName", ",", "accountName"...
Regenerates an access key for the specified Azure Cosmos DB database account. @param resourceGroupName Name of an Azure resource group. @param accountName Cosmos DB database account name. @param keyKind The access key to regenerate. Possible values include: 'primary', 'secondary', 'primaryReadonly', 'secondaryReadonly' @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Regenerates", "an", "access", "key", "for", "the", "specified", "Azure", "Cosmos", "DB", "database", "account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1904-L1911
actframework/actframework
src/main/java/act/data/ApacheMultipartParser.java
ApacheMultipartParser.getFileName
private String getFileName(Map /* String, String */ headers) { String fileName = null; String cd = getHeader(headers, CONTENT_DISPOSITION); if (cd != null) { String cdl = cd.toLowerCase(); if (cdl.startsWith(FORM_DATA) || cdl.startsWith(ATTACHMENT)) { ParameterParser parser = new ParameterParser(); parser.setLowerCaseNames(true); // Parameter parser can handle null input Map params = parser.parse(cd, ';'); if (params.containsKey("filename")) { fileName = (String) params.get("filename"); if (fileName != null) { fileName = fileName.trim(); // IE7 returning fullpath name (#300920) if (fileName.indexOf('\\') != -1) { fileName = fileName.substring(fileName.lastIndexOf('\\') + 1); } } else { // Even if there is no value, the parameter is present, // so we return an empty file name rather than no file // name. fileName = ""; } } } } return fileName; }
java
private String getFileName(Map /* String, String */ headers) { String fileName = null; String cd = getHeader(headers, CONTENT_DISPOSITION); if (cd != null) { String cdl = cd.toLowerCase(); if (cdl.startsWith(FORM_DATA) || cdl.startsWith(ATTACHMENT)) { ParameterParser parser = new ParameterParser(); parser.setLowerCaseNames(true); // Parameter parser can handle null input Map params = parser.parse(cd, ';'); if (params.containsKey("filename")) { fileName = (String) params.get("filename"); if (fileName != null) { fileName = fileName.trim(); // IE7 returning fullpath name (#300920) if (fileName.indexOf('\\') != -1) { fileName = fileName.substring(fileName.lastIndexOf('\\') + 1); } } else { // Even if there is no value, the parameter is present, // so we return an empty file name rather than no file // name. fileName = ""; } } } } return fileName; }
[ "private", "String", "getFileName", "(", "Map", "/* String, String */", "headers", ")", "{", "String", "fileName", "=", "null", ";", "String", "cd", "=", "getHeader", "(", "headers", ",", "CONTENT_DISPOSITION", ")", ";", "if", "(", "cd", "!=", "null", ")", ...
Retrieves the file name from the <code>Content-disposition</code> header. @param headers A <code>Map</code> containing the HTTP request headers. @return The file name for the current <code>encapsulation</code>.
[ "Retrieves", "the", "file", "name", "from", "the", "<code", ">", "Content", "-", "disposition<", "/", "code", ">", "header", "." ]
train
https://github.com/actframework/actframework/blob/55a8f8b45e71159a79ec6e157c02f71700f8cd54/src/main/java/act/data/ApacheMultipartParser.java#L169-L198
zaproxy/zaproxy
src/org/parosproxy/paros/extension/ExtensionLoader.java
ExtensionLoader.initViewAllExtension
private void initViewAllExtension(final View view, double progressFactor) { if (view == null) { return; } final double factorPerc = progressFactor / getExtensionCount(); for (int i = 0; i < getExtensionCount(); i++) { final Extension extension = getExtension(i); try { EventQueue.invokeAndWait(new Runnable() { @Override public void run() { extension.initView(view); view.addSplashScreenLoadingCompletion(factorPerc); } }); } catch (Exception e) { logExtensionInitError(extension, e); } } }
java
private void initViewAllExtension(final View view, double progressFactor) { if (view == null) { return; } final double factorPerc = progressFactor / getExtensionCount(); for (int i = 0; i < getExtensionCount(); i++) { final Extension extension = getExtension(i); try { EventQueue.invokeAndWait(new Runnable() { @Override public void run() { extension.initView(view); view.addSplashScreenLoadingCompletion(factorPerc); } }); } catch (Exception e) { logExtensionInitError(extension, e); } } }
[ "private", "void", "initViewAllExtension", "(", "final", "View", "view", ",", "double", "progressFactor", ")", "{", "if", "(", "view", "==", "null", ")", "{", "return", ";", "}", "final", "double", "factorPerc", "=", "progressFactor", "/", "getExtensionCount",...
Init all extensions with the same View @param view the View that need to be applied
[ "Init", "all", "extensions", "with", "the", "same", "View" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/extension/ExtensionLoader.java#L1331-L1354
sdl/odata
odata_processor/src/main/java/com/sdl/odata/processor/write/ActionPostMethodHandler.java
ActionPostMethodHandler.handleWrite
@Override public ProcessorResult handleWrite(Object action) throws ODataException { Operation operation; if (action instanceof Operation) { operation = (Operation) action; Object data = operation.doOperation(getODataRequestContext(), getDataSourceFactory()); if (data == null) { return new ProcessorResult(ODataResponse.Status.NO_CONTENT); } else { return new ProcessorResult(ODataResponse.Status.CREATED, QueryResult.from(data)); } } else { throw new ODataBadRequestException("Incorrect operation instance"); } }
java
@Override public ProcessorResult handleWrite(Object action) throws ODataException { Operation operation; if (action instanceof Operation) { operation = (Operation) action; Object data = operation.doOperation(getODataRequestContext(), getDataSourceFactory()); if (data == null) { return new ProcessorResult(ODataResponse.Status.NO_CONTENT); } else { return new ProcessorResult(ODataResponse.Status.CREATED, QueryResult.from(data)); } } else { throw new ODataBadRequestException("Incorrect operation instance"); } }
[ "@", "Override", "public", "ProcessorResult", "handleWrite", "(", "Object", "action", ")", "throws", "ODataException", "{", "Operation", "operation", ";", "if", "(", "action", "instanceof", "Operation", ")", "{", "operation", "=", "(", "Operation", ")", "action"...
Handles action call and returns result in case when action returns it. @param action The instance of action. @return The result of calling action. @throws ODataException in case of any error.
[ "Handles", "action", "call", "and", "returns", "result", "in", "case", "when", "action", "returns", "it", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_processor/src/main/java/com/sdl/odata/processor/write/ActionPostMethodHandler.java#L49-L63
jhy/jsoup
src/main/java/org/jsoup/nodes/Element.java
Element.wholeText
public String wholeText() { final StringBuilder accum = StringUtil.borrowBuilder(); NodeTraversor.traverse(new NodeVisitor() { public void head(Node node, int depth) { if (node instanceof TextNode) { TextNode textNode = (TextNode) node; accum.append(textNode.getWholeText()); } } public void tail(Node node, int depth) { } }, this); return StringUtil.releaseBuilder(accum); }
java
public String wholeText() { final StringBuilder accum = StringUtil.borrowBuilder(); NodeTraversor.traverse(new NodeVisitor() { public void head(Node node, int depth) { if (node instanceof TextNode) { TextNode textNode = (TextNode) node; accum.append(textNode.getWholeText()); } } public void tail(Node node, int depth) { } }, this); return StringUtil.releaseBuilder(accum); }
[ "public", "String", "wholeText", "(", ")", "{", "final", "StringBuilder", "accum", "=", "StringUtil", ".", "borrowBuilder", "(", ")", ";", "NodeTraversor", ".", "traverse", "(", "new", "NodeVisitor", "(", ")", "{", "public", "void", "head", "(", "Node", "n...
Get the (unencoded) text of all children of this element, including any newlines and spaces present in the original. @return unencoded, un-normalized text @see #text()
[ "Get", "the", "(", "unencoded", ")", "text", "of", "all", "children", "of", "this", "element", "including", "any", "newlines", "and", "spaces", "present", "in", "the", "original", "." ]
train
https://github.com/jhy/jsoup/blob/68ff8cbe7ad847059737a09c567a501a7f1d251f/src/main/java/org/jsoup/nodes/Element.java#L1095-L1110
googleapis/google-cloud-java
google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java
WebSecurityScannerClient.updateScanConfig
public final ScanConfig updateScanConfig(ScanConfig scanConfig, FieldMask updateMask) { UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder() .setScanConfig(scanConfig) .setUpdateMask(updateMask) .build(); return updateScanConfig(request); }
java
public final ScanConfig updateScanConfig(ScanConfig scanConfig, FieldMask updateMask) { UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder() .setScanConfig(scanConfig) .setUpdateMask(updateMask) .build(); return updateScanConfig(request); }
[ "public", "final", "ScanConfig", "updateScanConfig", "(", "ScanConfig", "scanConfig", ",", "FieldMask", "updateMask", ")", "{", "UpdateScanConfigRequest", "request", "=", "UpdateScanConfigRequest", ".", "newBuilder", "(", ")", ".", "setScanConfig", "(", "scanConfig", ...
Updates a ScanConfig. This method support partial update of a ScanConfig. <p>Sample code: <pre><code> try (WebSecurityScannerClient webSecurityScannerClient = WebSecurityScannerClient.create()) { ScanConfig scanConfig = ScanConfig.newBuilder().build(); FieldMask updateMask = FieldMask.newBuilder().build(); ScanConfig response = webSecurityScannerClient.updateScanConfig(scanConfig, updateMask); } </code></pre> @param scanConfig Required. The ScanConfig to be updated. The name field must be set to identify the resource to be updated. The values of fields not covered by the mask will be ignored. @param updateMask Required. The update mask applies to the resource. For the `FieldMask` definition, see https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#fieldmask @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "a", "ScanConfig", ".", "This", "method", "support", "partial", "update", "of", "a", "ScanConfig", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-websecurityscanner/src/main/java/com/google/cloud/websecurityscanner/v1alpha/WebSecurityScannerClient.java#L605-L613
googlegenomics/utils-java
src/main/java/com/google/cloud/genomics/utils/grpc/VariantUtils.java
VariantUtils.isSameVariantSite
public static final boolean isSameVariantSite(Variant.Builder variant1, Variant variant2) { return variant1.getReferenceName().equals(variant2.getReferenceName()) && variant1.getReferenceBases().equals(variant2.getReferenceBases()) && variant1.getStart() == variant2.getStart(); }
java
public static final boolean isSameVariantSite(Variant.Builder variant1, Variant variant2) { return variant1.getReferenceName().equals(variant2.getReferenceName()) && variant1.getReferenceBases().equals(variant2.getReferenceBases()) && variant1.getStart() == variant2.getStart(); }
[ "public", "static", "final", "boolean", "isSameVariantSite", "(", "Variant", ".", "Builder", "variant1", ",", "Variant", "variant2", ")", "{", "return", "variant1", ".", "getReferenceName", "(", ")", ".", "equals", "(", "variant2", ".", "getReferenceName", "(", ...
Determine whether two variants occur at the same site in the genome, where "site" is defined by reference name, start position, and reference bases. The reference bases are taken into account particularly for indels. @param variant1 @param variant2 @return true, if they occur at the same site
[ "Determine", "whether", "two", "variants", "occur", "at", "the", "same", "site", "in", "the", "genome", "where", "site", "is", "defined", "by", "reference", "name", "start", "position", "and", "reference", "bases", "." ]
train
https://github.com/googlegenomics/utils-java/blob/7205d5b4e4f61fc6b93acb4bdd76b93df5b5f612/src/main/java/com/google/cloud/genomics/utils/grpc/VariantUtils.java#L261-L265
intendia-oss/rxjava-gwt
src/main/modified/io/reactivex/super/io/reactivex/internal/operators/flowable/FlowableReplay.java
FlowableReplay.createFrom
@SuppressWarnings("unchecked") public static <T> ConnectableFlowable<T> createFrom(Flowable<? extends T> source) { Flowable<T> sourceCast = (Flowable<T>) source; return create(sourceCast, DEFAULT_UNBOUNDED_FACTORY); }
java
@SuppressWarnings("unchecked") public static <T> ConnectableFlowable<T> createFrom(Flowable<? extends T> source) { Flowable<T> sourceCast = (Flowable<T>) source; return create(sourceCast, DEFAULT_UNBOUNDED_FACTORY); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", ">", "ConnectableFlowable", "<", "T", ">", "createFrom", "(", "Flowable", "<", "?", "extends", "T", ">", "source", ")", "{", "Flowable", "<", "T", ">", "sourceCast", "=", "...
Creates a replaying ConnectableObservable with an unbounded buffer. @param <T> the value type @param source the source Publisher to use @return the new ConnectableObservable instance
[ "Creates", "a", "replaying", "ConnectableObservable", "with", "an", "unbounded", "buffer", "." ]
train
https://github.com/intendia-oss/rxjava-gwt/blob/8d5635b12ce40da99e76b59dc6bfe6fc2fffc1fa/src/main/modified/io/reactivex/super/io/reactivex/internal/operators/flowable/FlowableReplay.java#L83-L87
ironjacamar/ironjacamar
core/src/main/java/org/ironjacamar/core/workmanager/transport/remote/jgroups/JGroupsTransport.java
JGroupsTransport.addWorkManager
public void addWorkManager(org.ironjacamar.core.spi.workmanager.Address logicalAddress, org.jgroups.Address address) { super.localWorkManagerAdd(logicalAddress, address); }
java
public void addWorkManager(org.ironjacamar.core.spi.workmanager.Address logicalAddress, org.jgroups.Address address) { super.localWorkManagerAdd(logicalAddress, address); }
[ "public", "void", "addWorkManager", "(", "org", ".", "ironjacamar", ".", "core", ".", "spi", ".", "workmanager", ".", "Address", "logicalAddress", ",", "org", ".", "jgroups", ".", "Address", "address", ")", "{", "super", ".", "localWorkManagerAdd", "(", "log...
Delegator @param logicalAddress The logical address @param address The address
[ "Delegator" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/core/src/main/java/org/ironjacamar/core/workmanager/transport/remote/jgroups/JGroupsTransport.java#L298-L301
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.readResource
public I_CmsHistoryResource readResource(CmsUUID structureID, int version) throws CmsException, CmsVfsResourceNotFoundException { CmsResource resource = readResource(structureID, CmsResourceFilter.ALL); return m_securityManager.readResource(m_context, resource, version); }
java
public I_CmsHistoryResource readResource(CmsUUID structureID, int version) throws CmsException, CmsVfsResourceNotFoundException { CmsResource resource = readResource(structureID, CmsResourceFilter.ALL); return m_securityManager.readResource(m_context, resource, version); }
[ "public", "I_CmsHistoryResource", "readResource", "(", "CmsUUID", "structureID", ",", "int", "version", ")", "throws", "CmsException", ",", "CmsVfsResourceNotFoundException", "{", "CmsResource", "resource", "=", "readResource", "(", "structureID", ",", "CmsResourceFilter"...
Reads the historical resource with the given version for the resource given the given structure id.<p> A resource may be of type <code>{@link CmsFile}</code> or <code>{@link CmsFolder}</code>. In case of a file, the resource will not contain the binary file content. Since reading the binary content is a cost-expensive database operation, it's recommended to work with resources if possible, and only read the file content when absolutely required. To "upgrade" a resource to a file, use <code>{@link #readFile(CmsResource)}</code>.<p> Please note that historical versions are just generated during publishing, so the first version with version number 1 is generated during publishing of a new resource (exception is a new sibling, that may also contain some relevant versions of already published siblings) and the last version available is the version of the current online resource.<p> @param structureID the structure ID of the resource to read @param version the version number you want to retrieve @return the resource that was read @throws CmsException if the resource could not be read for any reason @throws CmsVfsResourceNotFoundException if the version does not exists @see #restoreResourceVersion(CmsUUID, int)
[ "Reads", "the", "historical", "resource", "with", "the", "given", "version", "for", "the", "resource", "given", "the", "given", "structure", "id", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L3146-L3151
Stratio/stratio-cassandra
src/java/com/stratio/cassandra/index/schema/mapping/Mapping.java
Mapping.validate
public void validate(CFMetaData metadata) { for (Map.Entry<String, ColumnMapper> entry : columnMappers.entrySet()) { String name = entry.getKey(); ColumnMapper columnMapper = entry.getValue(); ByteBuffer columnName = UTF8Type.instance.decompose(name); ColumnDefinition columnDefinition = metadata.getColumnDefinition(columnName); if (columnDefinition == null) { throw new RuntimeException("No column definition for mapper " + name); } if (columnDefinition.isStatic()) { throw new RuntimeException("Lucene indexes are not allowed on static columns as " + name); } AbstractType<?> type = columnDefinition.type; if (!columnMapper.supports(type)) { throw new RuntimeException(String.format("Type '%s' is not supported by mapper '%s'", type, name)); } } }
java
public void validate(CFMetaData metadata) { for (Map.Entry<String, ColumnMapper> entry : columnMappers.entrySet()) { String name = entry.getKey(); ColumnMapper columnMapper = entry.getValue(); ByteBuffer columnName = UTF8Type.instance.decompose(name); ColumnDefinition columnDefinition = metadata.getColumnDefinition(columnName); if (columnDefinition == null) { throw new RuntimeException("No column definition for mapper " + name); } if (columnDefinition.isStatic()) { throw new RuntimeException("Lucene indexes are not allowed on static columns as " + name); } AbstractType<?> type = columnDefinition.type; if (!columnMapper.supports(type)) { throw new RuntimeException(String.format("Type '%s' is not supported by mapper '%s'", type, name)); } } }
[ "public", "void", "validate", "(", "CFMetaData", "metadata", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "ColumnMapper", ">", "entry", ":", "columnMappers", ".", "entrySet", "(", ")", ")", "{", "String", "name", "=", "entry", ".", "g...
Checks if this is consistent with the specified column family metadata. @param metadata A column family metadata.
[ "Checks", "if", "this", "is", "consistent", "with", "the", "specified", "column", "family", "metadata", "." ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/com/stratio/cassandra/index/schema/mapping/Mapping.java#L50-L71
google/error-prone
check_api/src/main/java/com/google/errorprone/matchers/Matchers.java
Matchers.contains
public static <T extends Tree, V extends Tree> Matcher<T> contains( Class<V> clazz, Matcher<V> treeMatcher) { final Matcher<Tree> contains = new Contains(toType(clazz, treeMatcher)); return contains::matches; }
java
public static <T extends Tree, V extends Tree> Matcher<T> contains( Class<V> clazz, Matcher<V> treeMatcher) { final Matcher<Tree> contains = new Contains(toType(clazz, treeMatcher)); return contains::matches; }
[ "public", "static", "<", "T", "extends", "Tree", ",", "V", "extends", "Tree", ">", "Matcher", "<", "T", ">", "contains", "(", "Class", "<", "V", ">", "clazz", ",", "Matcher", "<", "V", ">", "treeMatcher", ")", "{", "final", "Matcher", "<", "Tree", ...
Applies the given matcher recursively to all descendants of an AST node, and matches if any matching descendant node is found. @param clazz The type of node to be matched. @param treeMatcher The matcher to apply recursively to the tree.
[ "Applies", "the", "given", "matcher", "recursively", "to", "all", "descendants", "of", "an", "AST", "node", "and", "matches", "if", "any", "matching", "descendant", "node", "is", "found", "." ]
train
https://github.com/google/error-prone/blob/fe2e3cc2cf1958cb7c487bfe89852bb4c225ba9d/check_api/src/main/java/com/google/errorprone/matchers/Matchers.java#L1411-L1415
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java
JCRStatisticsManager.getStatistics
private static Statistics getStatistics(String category, String name) { StatisticsContext context = getContext(category); if (context == null) { return null; } // Format the name name = formatName(name); if (name == null) { return null; } Statistics statistics; if (GLOBAL_STATISTICS_NAME.equalsIgnoreCase(name)) { statistics = context.global; } else { statistics = context.allStatistics.get(name); } return statistics; }
java
private static Statistics getStatistics(String category, String name) { StatisticsContext context = getContext(category); if (context == null) { return null; } // Format the name name = formatName(name); if (name == null) { return null; } Statistics statistics; if (GLOBAL_STATISTICS_NAME.equalsIgnoreCase(name)) { statistics = context.global; } else { statistics = context.allStatistics.get(name); } return statistics; }
[ "private", "static", "Statistics", "getStatistics", "(", "String", "category", ",", "String", "name", ")", "{", "StatisticsContext", "context", "=", "getContext", "(", "category", ")", ";", "if", "(", "context", "==", "null", ")", "{", "return", "null", ";",...
Retrieve statistics of the given category and name. @return the related {@link Statistics}, <code>null</code> otherwise.
[ "Retrieve", "statistics", "of", "the", "given", "category", "and", "name", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/statistics/JCRStatisticsManager.java#L353-L376
BioPAX/Paxtools
pattern/src/main/java/org/biopax/paxtools/pattern/miner/SIFSearcher.java
SIFSearcher.searchSIF
public boolean searchSIF(Model model, OutputStream out, SIFToText stt) { Set<SIFInteraction> inters = searchSIF(model); if (!inters.isEmpty()) { List<SIFInteraction> interList = new ArrayList<SIFInteraction>(inters); Collections.sort(interList); try { boolean first = true; OutputStreamWriter writer = new OutputStreamWriter(out); for (SIFInteraction inter : interList) { if (first) first = false; else writer.write("\n"); writer.write(stt.convert(inter)); } writer.close(); return true; } catch (IOException e) { e.printStackTrace(); } } return false; }
java
public boolean searchSIF(Model model, OutputStream out, SIFToText stt) { Set<SIFInteraction> inters = searchSIF(model); if (!inters.isEmpty()) { List<SIFInteraction> interList = new ArrayList<SIFInteraction>(inters); Collections.sort(interList); try { boolean first = true; OutputStreamWriter writer = new OutputStreamWriter(out); for (SIFInteraction inter : interList) { if (first) first = false; else writer.write("\n"); writer.write(stt.convert(inter)); } writer.close(); return true; } catch (IOException e) { e.printStackTrace(); } } return false; }
[ "public", "boolean", "searchSIF", "(", "Model", "model", ",", "OutputStream", "out", ",", "SIFToText", "stt", ")", "{", "Set", "<", "SIFInteraction", ">", "inters", "=", "searchSIF", "(", "model", ")", ";", "if", "(", "!", "inters", ".", "isEmpty", "(", ...
Searches the given model with the contained miners. Writes the textual result to the given output stream. Closes the stream at the end. @param model model to search @param out stream to write @param stt sif to text converter @return true if any output produced successfully
[ "Searches", "the", "given", "model", "with", "the", "contained", "miners", ".", "Writes", "the", "textual", "result", "to", "the", "given", "output", "stream", ".", "Closes", "the", "stream", "at", "the", "end", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/pattern/src/main/java/org/biopax/paxtools/pattern/miner/SIFSearcher.java#L213-L241
Whiley/WhileyCompiler
src/main/java/wyc/io/WhileyFileParser.java
WhileyFileParser.parseQualifiedAccess
private Expr parseQualifiedAccess(EnclosingScope scope, boolean terminated) { int start = index; // Parse qualified name Name name = parseName(scope); // Construct link to be resolved Decl.Link link = new Decl.Link<>(name); // Decide what we've got int mid = index; Expr expr; if (skipTemplate(scope) && tryAndMatch(terminated, LeftBrace) != null) { // backtrack index = mid; // parse any optional template arguments Tuple<? extends SyntacticItem> templateArguments = parseOptionalTemplateArguments(scope, terminated); // Construct binding to be resolved Decl.Binding<Type.Callable, Decl.Callable> binding = new Decl.Binding<>(link, templateArguments); // Repeat this match(LeftBrace); // Parse arguments to invocation Tuple<Expr> arguments = parseInvocationArguments(scope); // This indicates we have an direct invocation expr = new Expr.Invoke(binding, arguments); } else { // Must be a qualified static variable access expr = new Expr.StaticVariableAccess(Type.Void, link); } return annotateSourceLocation(expr, start); }
java
private Expr parseQualifiedAccess(EnclosingScope scope, boolean terminated) { int start = index; // Parse qualified name Name name = parseName(scope); // Construct link to be resolved Decl.Link link = new Decl.Link<>(name); // Decide what we've got int mid = index; Expr expr; if (skipTemplate(scope) && tryAndMatch(terminated, LeftBrace) != null) { // backtrack index = mid; // parse any optional template arguments Tuple<? extends SyntacticItem> templateArguments = parseOptionalTemplateArguments(scope, terminated); // Construct binding to be resolved Decl.Binding<Type.Callable, Decl.Callable> binding = new Decl.Binding<>(link, templateArguments); // Repeat this match(LeftBrace); // Parse arguments to invocation Tuple<Expr> arguments = parseInvocationArguments(scope); // This indicates we have an direct invocation expr = new Expr.Invoke(binding, arguments); } else { // Must be a qualified static variable access expr = new Expr.StaticVariableAccess(Type.Void, link); } return annotateSourceLocation(expr, start); }
[ "private", "Expr", "parseQualifiedAccess", "(", "EnclosingScope", "scope", ",", "boolean", "terminated", ")", "{", "int", "start", "=", "index", ";", "// Parse qualified name", "Name", "name", "=", "parseName", "(", "scope", ")", ";", "// Construct link to be resolv...
Attempt to parse a possible module identifier. This will reflect a true module identifier only if the root variable is not in the given environment. @param src @param scope The enclosing scope for this statement, which determines the set of visible (i.e. declared) variables and also the current indentation level. @return
[ "Attempt", "to", "parse", "a", "possible", "module", "identifier", ".", "This", "will", "reflect", "a", "true", "module", "identifier", "only", "if", "the", "root", "variable", "is", "not", "in", "the", "given", "environment", "." ]
train
https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileParser.java#L2271-L2298
fcrepo3/fcrepo
fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/util/ContextUtil.java
ContextUtil.buildRequest
public RequestCtx buildRequest(List<Map<URI, List<AttributeValue>>> subjects, Map<URI, AttributeValue> actions, Map<URI, AttributeValue> resources, Map<URI, AttributeValue> environment, RelationshipResolver relationshipResolver) throws MelcoeXacmlException { logger.debug("Building request!"); RequestCtx request = null; // Create the new Request. // Note that the Environment must be specified using a valid Set, even // if that Set is empty try { request = new BasicRequestCtx(setupSubjects(subjects), setupResources(resources, relationshipResolver), setupAction(actions), setupEnvironment(environment)); } catch (Exception e) { logger.error("Error creating request.", e); throw new MelcoeXacmlException("Error creating request", e); } return request; }
java
public RequestCtx buildRequest(List<Map<URI, List<AttributeValue>>> subjects, Map<URI, AttributeValue> actions, Map<URI, AttributeValue> resources, Map<URI, AttributeValue> environment, RelationshipResolver relationshipResolver) throws MelcoeXacmlException { logger.debug("Building request!"); RequestCtx request = null; // Create the new Request. // Note that the Environment must be specified using a valid Set, even // if that Set is empty try { request = new BasicRequestCtx(setupSubjects(subjects), setupResources(resources, relationshipResolver), setupAction(actions), setupEnvironment(environment)); } catch (Exception e) { logger.error("Error creating request.", e); throw new MelcoeXacmlException("Error creating request", e); } return request; }
[ "public", "RequestCtx", "buildRequest", "(", "List", "<", "Map", "<", "URI", ",", "List", "<", "AttributeValue", ">", ">", ">", "subjects", ",", "Map", "<", "URI", ",", "AttributeValue", ">", "actions", ",", "Map", "<", "URI", ",", "AttributeValue", ">",...
Constructs a RequestCtx object. @param subjects list of Subjects @param actions list of Action attributes @param resources list of resource Attributes @param environment list of environment Attributes @return the RequestCtx object @throws MelcoeXacmlException
[ "Constructs", "a", "RequestCtx", "object", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pdp/src/main/java/org/fcrepo/server/security/xacml/util/ContextUtil.java#L250-L275
zerodhatech/javakiteconnect
kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java
KiteConnect.modifyMFSIP
public boolean modifyMFSIP(String frequency, int day, int instalments, double amount, String status, String sipId) throws KiteException, IOException, JSONException { Map<String, Object> params = new HashMap<String, Object>(); params.put("frequency", frequency); params.put("day", day); params.put("instalments", instalments); params.put("amount", amount); params.put("status", status); new KiteRequestHandler(proxy).putRequest(routes.get("mutualfunds.sips.modify").replace(":sip_id", sipId), params, apiKey, accessToken); return true; }
java
public boolean modifyMFSIP(String frequency, int day, int instalments, double amount, String status, String sipId) throws KiteException, IOException, JSONException { Map<String, Object> params = new HashMap<String, Object>(); params.put("frequency", frequency); params.put("day", day); params.put("instalments", instalments); params.put("amount", amount); params.put("status", status); new KiteRequestHandler(proxy).putRequest(routes.get("mutualfunds.sips.modify").replace(":sip_id", sipId), params, apiKey, accessToken); return true; }
[ "public", "boolean", "modifyMFSIP", "(", "String", "frequency", ",", "int", "day", ",", "int", "instalments", ",", "double", "amount", ",", "String", "status", ",", "String", "sipId", ")", "throws", "KiteException", ",", "IOException", ",", "JSONException", "{...
Modify a mutualfunds sip. @param frequency weekly, monthly, or quarterly. @param status Pause or unpause an SIP (active or paused). @param amount Amount worth of units to purchase. It should be equal to or greated than minimum_additional_purchase_amount and in multiple of purchase_amount_multiplier in the instrument master. @param day If Frequency is monthly, the day of the month (1, 5, 10, 15, 20, 25) to trigger the order on. @param instalments Number of instalments to trigger. If set to -1, instalments are triggered at fixed intervals until the SIP is cancelled. @param sipId is the id of the sip. @return returns true, if modify sip is successful else exception is thrown. @throws KiteException is thrown for all Kite trade related errors. @throws IOException is thrown when there is connection related error.
[ "Modify", "a", "mutualfunds", "sip", "." ]
train
https://github.com/zerodhatech/javakiteconnect/blob/4a3f15ff2c8a1b3b6ec61799f8bb047e4dfeb92d/kiteconnect/src/com/zerodhatech/kiteconnect/KiteConnect.java#L713-L723
sai-pullabhotla/catatumbo
src/main/java/com/jmethods/catatumbo/BaseQueryRequest.java
BaseQueryRequest.addPositionalBindings
public void addPositionalBindings(Object first, Object... others) { positionalBindings.add(first); positionalBindings.addAll(Arrays.asList(others)); }
java
public void addPositionalBindings(Object first, Object... others) { positionalBindings.add(first); positionalBindings.addAll(Arrays.asList(others)); }
[ "public", "void", "addPositionalBindings", "(", "Object", "first", ",", "Object", "...", "others", ")", "{", "positionalBindings", ".", "add", "(", "first", ")", ";", "positionalBindings", ".", "addAll", "(", "Arrays", ".", "asList", "(", "others", ")", ")",...
Adds the positional bindings that are needed for any positional parameters in the GQL query. @param first the first positional binding @param others subsequent positional bindings, if any
[ "Adds", "the", "positional", "bindings", "that", "are", "needed", "for", "any", "positional", "parameters", "in", "the", "GQL", "query", "." ]
train
https://github.com/sai-pullabhotla/catatumbo/blob/96d4c6dce3a5009624f7112a398406914dd19165/src/main/java/com/jmethods/catatumbo/BaseQueryRequest.java#L152-L155
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.addEntry
public Jar addEntry(Path path, Path file) throws IOException { return addEntry(path, Files.newInputStream(file)); }
java
public Jar addEntry(Path path, Path file) throws IOException { return addEntry(path, Files.newInputStream(file)); }
[ "public", "Jar", "addEntry", "(", "Path", "path", ",", "Path", "file", ")", "throws", "IOException", "{", "return", "addEntry", "(", "path", ",", "Files", ".", "newInputStream", "(", "file", ")", ")", ";", "}" ]
Adds an entry to this JAR. @param path the entry's path within the JAR @param file the file to add as an entry @return {@code this}
[ "Adds", "an", "entry", "to", "this", "JAR", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L332-L334
voldemort/voldemort
src/java/voldemort/utils/UpdateClusterUtils.java
UpdateClusterUtils.removePartitionsFromNode
public static Node removePartitionsFromNode(final Node node, final Set<Integer> donatedPartitions) { List<Integer> deepCopy = new ArrayList<Integer>(node.getPartitionIds()); deepCopy.removeAll(donatedPartitions); return updateNode(node, deepCopy); }
java
public static Node removePartitionsFromNode(final Node node, final Set<Integer> donatedPartitions) { List<Integer> deepCopy = new ArrayList<Integer>(node.getPartitionIds()); deepCopy.removeAll(donatedPartitions); return updateNode(node, deepCopy); }
[ "public", "static", "Node", "removePartitionsFromNode", "(", "final", "Node", "node", ",", "final", "Set", "<", "Integer", ">", "donatedPartitions", ")", "{", "List", "<", "Integer", ">", "deepCopy", "=", "new", "ArrayList", "<", "Integer", ">", "(", "node",...
Remove the set of partitions from the node provided @param node The node from which we're removing the partitions @param donatedPartitions The list of partitions to remove @return The new node without the partitions
[ "Remove", "the", "set", "of", "partitions", "from", "the", "node", "provided" ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/utils/UpdateClusterUtils.java#L103-L108
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlModifyBuilder.java
SqlModifyBuilder.generateLogForModifiers
public static void generateLogForModifiers(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { JQLChecker jqlChecker = JQLChecker.getInstance(); final One<Boolean> usedInWhere = new One<Boolean>(false); methodBuilder.addCode("\n// display log\n"); String sqlForLog = jqlChecker.replace(method, method.jql, new JQLReplacerListenerImpl(method) { @Override public String onColumnNameToUpdate(String columnName) { // only entity's columns return currentEntity.findPropertyByName(columnName).columnName; } @Override public String onColumnName(String columnName) { // return entity.findByName(columnName).columnName; return currentSchema.findColumnNameByPropertyName(method, columnName); } @Override public String onBindParameter(String bindParameterName, boolean inStatement) { if (usedInWhere.value0) { return "?"; } else { String paramName = bindParameterName; if (paramName.contains(".")) { String[] a = paramName.split("\\."); if (a.length == 2) { paramName = a[1]; } } SQLProperty property = currentEntity.findPropertyByName(paramName); AssertKripton.assertTrueOrUnknownPropertyInJQLException(property != null, method, bindParameterName); return ":" + property.columnName; } } @Override public void onWhereStatementBegin(Where_stmtContext ctx) { usedInWhere.value0 = true; } @Override public void onWhereStatementEnd(Where_stmtContext ctx) { usedInWhere.value0 = false; } }); if (method.jql.dynamicReplace.containsKey(JQLDynamicStatementType.DYNAMIC_WHERE)) { methodBuilder.addStatement("$T.info($S, $L)", Logger.class, sqlForLog.replace(method.jql.dynamicReplace.get(JQLDynamicStatementType.DYNAMIC_WHERE), "%s"), "StringUtils.ifNotEmptyAppend(_sqlDynamicWhere,\" AND \")"); } else { methodBuilder.addStatement("$T.info($S)", Logger.class, sqlForLog); } }
java
public static void generateLogForModifiers(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { JQLChecker jqlChecker = JQLChecker.getInstance(); final One<Boolean> usedInWhere = new One<Boolean>(false); methodBuilder.addCode("\n// display log\n"); String sqlForLog = jqlChecker.replace(method, method.jql, new JQLReplacerListenerImpl(method) { @Override public String onColumnNameToUpdate(String columnName) { // only entity's columns return currentEntity.findPropertyByName(columnName).columnName; } @Override public String onColumnName(String columnName) { // return entity.findByName(columnName).columnName; return currentSchema.findColumnNameByPropertyName(method, columnName); } @Override public String onBindParameter(String bindParameterName, boolean inStatement) { if (usedInWhere.value0) { return "?"; } else { String paramName = bindParameterName; if (paramName.contains(".")) { String[] a = paramName.split("\\."); if (a.length == 2) { paramName = a[1]; } } SQLProperty property = currentEntity.findPropertyByName(paramName); AssertKripton.assertTrueOrUnknownPropertyInJQLException(property != null, method, bindParameterName); return ":" + property.columnName; } } @Override public void onWhereStatementBegin(Where_stmtContext ctx) { usedInWhere.value0 = true; } @Override public void onWhereStatementEnd(Where_stmtContext ctx) { usedInWhere.value0 = false; } }); if (method.jql.dynamicReplace.containsKey(JQLDynamicStatementType.DYNAMIC_WHERE)) { methodBuilder.addStatement("$T.info($S, $L)", Logger.class, sqlForLog.replace(method.jql.dynamicReplace.get(JQLDynamicStatementType.DYNAMIC_WHERE), "%s"), "StringUtils.ifNotEmptyAppend(_sqlDynamicWhere,\" AND \")"); } else { methodBuilder.addStatement("$T.info($S)", Logger.class, sqlForLog); } }
[ "public", "static", "void", "generateLogForModifiers", "(", "final", "SQLiteModelMethod", "method", ",", "MethodSpec", ".", "Builder", "methodBuilder", ")", "{", "JQLChecker", "jqlChecker", "=", "JQLChecker", ".", "getInstance", "(", ")", ";", "final", "One", "<",...
generate sql log. @param method the method @param methodBuilder the method builder
[ "generate", "sql", "log", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlModifyBuilder.java#L579-L640
Axway/Grapes
commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java
DataModelFactory.createLicense
public static License createLicense(final String name, final String longName, final String comments, final String regexp, final String url){ final License license = new License(); license.setName(name); license.setLongName(longName); license.setComments(comments); license.setRegexp(regexp); license.setUrl(url); return license; }
java
public static License createLicense(final String name, final String longName, final String comments, final String regexp, final String url){ final License license = new License(); license.setName(name); license.setLongName(longName); license.setComments(comments); license.setRegexp(regexp); license.setUrl(url); return license; }
[ "public", "static", "License", "createLicense", "(", "final", "String", "name", ",", "final", "String", "longName", ",", "final", "String", "comments", ",", "final", "String", "regexp", ",", "final", "String", "url", ")", "{", "final", "License", "license", ...
Generates a License regarding the parameters. @param name String @param longName String @param comments String @param regexp String @param url String @return License
[ "Generates", "a", "License", "regarding", "the", "parameters", "." ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/commons/src/main/java/org/axway/grapes/commons/datamodel/DataModelFactory.java#L124-L134
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPFieldStruct.java
JBBPFieldStruct.mapTo
public <T> T mapTo(final Class<T> mappingClass, final JBBPMapperCustomFieldProcessor customFieldProcessor) { return JBBPMapper.map(this, mappingClass, customFieldProcessor); }
java
public <T> T mapTo(final Class<T> mappingClass, final JBBPMapperCustomFieldProcessor customFieldProcessor) { return JBBPMapper.map(this, mappingClass, customFieldProcessor); }
[ "public", "<", "T", ">", "T", "mapTo", "(", "final", "Class", "<", "T", ">", "mappingClass", ",", "final", "JBBPMapperCustomFieldProcessor", "customFieldProcessor", ")", "{", "return", "JBBPMapper", ".", "map", "(", "this", ",", "mappingClass", ",", "customFie...
Map the structure fields to a class fields. @param <T> a class type @param mappingClass a mapping class to be mapped by the structure fields, must not be null and must have the default constructor @param customFieldProcessor a custom field processor to provide values for custom mapping fields, it can be null if there is not any custom field @return a mapped instance of the class, must not be null
[ "Map", "the", "structure", "fields", "to", "a", "class", "fields", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/model/JBBPFieldStruct.java#L258-L260
molgenis/molgenis
molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java
PostgreSqlRepositoryCollection.updateUnique
private void updateUnique(EntityType entityType, Attribute attr, Attribute updatedAttr) { if (attr.isUnique() && !updatedAttr.isUnique()) { Attribute idAttr = entityType.getIdAttribute(); if (idAttr != null && idAttr.getName().equals(attr.getName())) { throw new MolgenisDataException( format( "ID attribute [%s] of entity [%s] must be unique", attr.getName(), entityType.getId())); } dropUniqueKey(entityType, updatedAttr); } else if (!attr.isUnique() && updatedAttr.isUnique()) { createUniqueKey(entityType, updatedAttr); } }
java
private void updateUnique(EntityType entityType, Attribute attr, Attribute updatedAttr) { if (attr.isUnique() && !updatedAttr.isUnique()) { Attribute idAttr = entityType.getIdAttribute(); if (idAttr != null && idAttr.getName().equals(attr.getName())) { throw new MolgenisDataException( format( "ID attribute [%s] of entity [%s] must be unique", attr.getName(), entityType.getId())); } dropUniqueKey(entityType, updatedAttr); } else if (!attr.isUnique() && updatedAttr.isUnique()) { createUniqueKey(entityType, updatedAttr); } }
[ "private", "void", "updateUnique", "(", "EntityType", "entityType", ",", "Attribute", "attr", ",", "Attribute", "updatedAttr", ")", "{", "if", "(", "attr", ".", "isUnique", "(", ")", "&&", "!", "updatedAttr", ".", "isUnique", "(", ")", ")", "{", "Attribute...
Updates unique constraint based on attribute unique changes. @param entityType entity meta data @param attr current attribute @param updatedAttr updated attribute
[ "Updates", "unique", "constraint", "based", "on", "attribute", "unique", "changes", "." ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-postgresql/src/main/java/org/molgenis/data/postgresql/PostgreSqlRepositoryCollection.java#L658-L672
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/util/ColorHelper.java
ColorHelper.getFromRGB
public Color getFromRGB(final int red, final int green, final int blue) { return this.getFromString("#" + this.toHexString(red) + this.toHexString(green) + this .toHexString(blue)); }
java
public Color getFromRGB(final int red, final int green, final int blue) { return this.getFromString("#" + this.toHexString(red) + this.toHexString(green) + this .toHexString(blue)); }
[ "public", "Color", "getFromRGB", "(", "final", "int", "red", ",", "final", "int", "green", ",", "final", "int", "blue", ")", "{", "return", "this", ".", "getFromString", "(", "\"#\"", "+", "this", ".", "toHexString", "(", "red", ")", "+", "this", ".", ...
Helper function to create any available color string from color values. @param red The red value, 0-255 @param green The green value, 0-255 @param blue The blue value, 0-255 @return The hex string in the format '#rrggbb'
[ "Helper", "function", "to", "create", "any", "available", "color", "string", "from", "color", "values", "." ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/util/ColorHelper.java#L87-L90
jeremybrooks/jinx
src/main/java/net/jeremybrooks/jinx/api/PhotosGeoApi.java
PhotosGeoApi.setContext
public Response setContext(String photoId, JinxConstants.GeoContext context) throws JinxException { JinxUtils.validateParams(photoId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.geo.setContext"); params.put("photo_id", photoId); params.put("context", Integer.toString(JinxUtils.geoContextToFlickrContextId(context))); return jinx.flickrPost(params, Response.class); }
java
public Response setContext(String photoId, JinxConstants.GeoContext context) throws JinxException { JinxUtils.validateParams(photoId); Map<String, String> params = new TreeMap<>(); params.put("method", "flickr.photos.geo.setContext"); params.put("photo_id", photoId); params.put("context", Integer.toString(JinxUtils.geoContextToFlickrContextId(context))); return jinx.flickrPost(params, Response.class); }
[ "public", "Response", "setContext", "(", "String", "photoId", ",", "JinxConstants", ".", "GeoContext", "context", ")", "throws", "JinxException", "{", "JinxUtils", ".", "validateParams", "(", "photoId", ")", ";", "Map", "<", "String", ",", "String", ">", "para...
Indicate the state of a photo's geotagginess beyond latitude and longitude. <br> Note : photos passed to this method must already be geotagged. <br> This method requires authentication with 'write' permission. @param photoId (Required) The id of the photo to set context data for. @param context (Required) The photo's geotagginess beyond latitude and longitude. @return object with the status of the requested operation. @throws JinxException if required parameters are missing, or if there are any errors. @see <a href="https://www.flickr.com/services/api/flickr.photos.geo.setContext.html">flickr.photos.geo.setContext</a>
[ "Indicate", "the", "state", "of", "a", "photo", "s", "geotagginess", "beyond", "latitude", "and", "longitude", ".", "<br", ">", "Note", ":", "photos", "passed", "to", "this", "method", "must", "already", "be", "geotagged", ".", "<br", ">", "This", "method"...
train
https://github.com/jeremybrooks/jinx/blob/ab7a4b7462d08bcbfd9b98bd3f5029771c20f6c6/src/main/java/net/jeremybrooks/jinx/api/PhotosGeoApi.java#L221-L228
Ordinastie/MalisisCore
src/main/java/net/malisis/core/block/component/ItemTransformComponent.java
ItemTransformComponent.firstPerson
public ItemTransformComponent firstPerson(Matrix4f left, Matrix4f right) { this.firstPersonLeftHand = left; this.firstPersonRightHand = right; return this; }
java
public ItemTransformComponent firstPerson(Matrix4f left, Matrix4f right) { this.firstPersonLeftHand = left; this.firstPersonRightHand = right; return this; }
[ "public", "ItemTransformComponent", "firstPerson", "(", "Matrix4f", "left", ",", "Matrix4f", "right", ")", "{", "this", ".", "firstPersonLeftHand", "=", "left", ";", "this", ".", "firstPersonRightHand", "=", "right", ";", "return", "this", ";", "}" ]
Sets the transforms to use for the {@link Item} in first person. @param left the left @param right the right @return the item transform component
[ "Sets", "the", "transforms", "to", "use", "for", "the", "{", "@link", "Item", "}", "in", "first", "person", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/block/component/ItemTransformComponent.java#L80-L85
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/square/QuadPoseEstimator.java
QuadPoseEstimator.process
public boolean process(Quadrilateral_F64 corners, boolean unitsPixels) { if( unitsPixels ) { pixelCorners.set(corners); pixelToNorm.compute(corners.a.x, corners.a.y, normCorners.a); pixelToNorm.compute(corners.b.x, corners.b.y, normCorners.b); pixelToNorm.compute(corners.c.x, corners.c.y, normCorners.c); pixelToNorm.compute(corners.d.x, corners.d.y, normCorners.d); } else { normCorners.set(corners); normToPixel.compute(corners.a.x, corners.a.y, pixelCorners.a); normToPixel.compute(corners.b.x, corners.b.y, pixelCorners.b); normToPixel.compute(corners.c.x, corners.c.y, pixelCorners.c); normToPixel.compute(corners.d.x, corners.d.y, pixelCorners.d); } if( estimate(pixelCorners, normCorners, outputFiducialToCamera) ) { outputError = computeErrors(outputFiducialToCamera); return true; } else { return false; } }
java
public boolean process(Quadrilateral_F64 corners, boolean unitsPixels) { if( unitsPixels ) { pixelCorners.set(corners); pixelToNorm.compute(corners.a.x, corners.a.y, normCorners.a); pixelToNorm.compute(corners.b.x, corners.b.y, normCorners.b); pixelToNorm.compute(corners.c.x, corners.c.y, normCorners.c); pixelToNorm.compute(corners.d.x, corners.d.y, normCorners.d); } else { normCorners.set(corners); normToPixel.compute(corners.a.x, corners.a.y, pixelCorners.a); normToPixel.compute(corners.b.x, corners.b.y, pixelCorners.b); normToPixel.compute(corners.c.x, corners.c.y, pixelCorners.c); normToPixel.compute(corners.d.x, corners.d.y, pixelCorners.d); } if( estimate(pixelCorners, normCorners, outputFiducialToCamera) ) { outputError = computeErrors(outputFiducialToCamera); return true; } else { return false; } }
[ "public", "boolean", "process", "(", "Quadrilateral_F64", "corners", ",", "boolean", "unitsPixels", ")", "{", "if", "(", "unitsPixels", ")", "{", "pixelCorners", ".", "set", "(", "corners", ")", ";", "pixelToNorm", ".", "compute", "(", "corners", ".", "a", ...
<p>Estimate the 3D pose of the camera from the observed location of the fiducial.</p> MUST call {@link #setFiducial} and {@link #setLensDistoriton} before calling this function. @param corners Observed corners of the fiducial. @param unitsPixels If true the specified corners are in original image pixels or false for normalized image coordinates @return true if successful or false if not
[ "<p", ">", "Estimate", "the", "3D", "pose", "of", "the", "camera", "from", "the", "observed", "location", "of", "the", "fiducial", ".", "<", "/", "p", ">" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/square/QuadPoseEstimator.java#L182-L204
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java
LabsInner.updateAsync
public Observable<LabInner> updateAsync(String resourceGroupName, String labAccountName, String labName, LabFragment lab) { return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, lab).map(new Func1<ServiceResponse<LabInner>, LabInner>() { @Override public LabInner call(ServiceResponse<LabInner> response) { return response.body(); } }); }
java
public Observable<LabInner> updateAsync(String resourceGroupName, String labAccountName, String labName, LabFragment lab) { return updateWithServiceResponseAsync(resourceGroupName, labAccountName, labName, lab).map(new Func1<ServiceResponse<LabInner>, LabInner>() { @Override public LabInner call(ServiceResponse<LabInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LabInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "LabFragment", "lab", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Modify properties of labs. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param lab Represents a lab. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the LabInner object
[ "Modify", "properties", "of", "labs", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java#L864-L871
apiman/apiman
gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/AbstractIPListPolicy.java
AbstractIPListPolicy.getRemoteAddr
protected String getRemoteAddr(ApiRequest request, IPListConfig config) { String httpHeader = config.getHttpHeader(); if (httpHeader != null && httpHeader.trim().length() > 0) { String value = (String) request.getHeaders().get(httpHeader); if (value != null) { return value; } } return request.getRemoteAddr(); }
java
protected String getRemoteAddr(ApiRequest request, IPListConfig config) { String httpHeader = config.getHttpHeader(); if (httpHeader != null && httpHeader.trim().length() > 0) { String value = (String) request.getHeaders().get(httpHeader); if (value != null) { return value; } } return request.getRemoteAddr(); }
[ "protected", "String", "getRemoteAddr", "(", "ApiRequest", "request", ",", "IPListConfig", "config", ")", "{", "String", "httpHeader", "=", "config", ".", "getHttpHeader", "(", ")", ";", "if", "(", "httpHeader", "!=", "null", "&&", "httpHeader", ".", "trim", ...
Gets the remote address for comparison. @param request the request @param config the config
[ "Gets", "the", "remote", "address", "for", "comparison", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/gateway/engine/policies/src/main/java/io/apiman/gateway/engine/policies/AbstractIPListPolicy.java#L35-L44
JOML-CI/JOML
src/org/joml/Intersectionf.java
Intersectionf.intersectCircleCircle
public static boolean intersectCircleCircle(Vector2fc centerA, float radiusSquaredA, Vector2fc centerB, float radiusSquaredB, Vector3f intersectionCenterAndHL) { return intersectCircleCircle(centerA.x(), centerA.y(), radiusSquaredA, centerB.x(), centerB.y(), radiusSquaredB, intersectionCenterAndHL); }
java
public static boolean intersectCircleCircle(Vector2fc centerA, float radiusSquaredA, Vector2fc centerB, float radiusSquaredB, Vector3f intersectionCenterAndHL) { return intersectCircleCircle(centerA.x(), centerA.y(), radiusSquaredA, centerB.x(), centerB.y(), radiusSquaredB, intersectionCenterAndHL); }
[ "public", "static", "boolean", "intersectCircleCircle", "(", "Vector2fc", "centerA", ",", "float", "radiusSquaredA", ",", "Vector2fc", "centerB", ",", "float", "radiusSquaredB", ",", "Vector3f", "intersectionCenterAndHL", ")", "{", "return", "intersectCircleCircle", "("...
Test whether the one circle with center <code>centerA</code> and square radius <code>radiusSquaredA</code> intersects the other circle with center <code>centerB</code> and square radius <code>radiusSquaredB</code>, and store the center of the line segment of intersection in the <code>(x, y)</code> components of the supplied vector and the half-length of that line segment in the z component. <p> This method returns <code>false</code> when one circle contains the other circle. <p> Reference: <a href="http://gamedev.stackexchange.com/questions/75756/sphere-sphere-intersection-and-circle-sphere-intersection">http://gamedev.stackexchange.com</a> @param centerA the first circle's center @param radiusSquaredA the square of the first circle's radius @param centerB the second circle's center @param radiusSquaredB the square of the second circle's radius @param intersectionCenterAndHL will hold the center of the line segment of intersection in the <code>(x, y)</code> components and the half-length in the z component @return <code>true</code> iff both circles intersect; <code>false</code> otherwise
[ "Test", "whether", "the", "one", "circle", "with", "center", "<code", ">", "centerA<", "/", "code", ">", "and", "square", "radius", "<code", ">", "radiusSquaredA<", "/", "code", ">", "intersects", "the", "other", "circle", "with", "center", "<code", ">", "...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Intersectionf.java#L3756-L3758
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java
HMac.digestHex
public String digestHex(InputStream data, int bufferLength) { return HexUtil.encodeHexStr(digest(data, bufferLength)); }
java
public String digestHex(InputStream data, int bufferLength) { return HexUtil.encodeHexStr(digest(data, bufferLength)); }
[ "public", "String", "digestHex", "(", "InputStream", "data", ",", "int", "bufferLength", ")", "{", "return", "HexUtil", ".", "encodeHexStr", "(", "digest", "(", "data", ",", "bufferLength", ")", ")", ";", "}" ]
生成摘要,并转为16进制字符串<br> 使用默认缓存大小,见 {@link IoUtil#DEFAULT_BUFFER_SIZE} @param data 被摘要数据 @param bufferLength 缓存长度,不足1使用 {@link IoUtil#DEFAULT_BUFFER_SIZE} 做为默认值 @return 摘要
[ "生成摘要,并转为16进制字符串<br", ">", "使用默认缓存大小,见", "{", "@link", "IoUtil#DEFAULT_BUFFER_SIZE", "}" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/digest/HMac.java#L252-L254
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/support/AbstractBinderSelectionStrategy.java
AbstractBinderSelectionStrategy.findBinderByPropertyName
protected Binder findBinderByPropertyName(Class parentObjectType, String propertyName) { PropertyNameKey key = new PropertyNameKey(parentObjectType, propertyName); Binder binder = (Binder)propertyNameBinders.get(key); if (binder == null) { // if no direct match was found try to find a match in any super classes final Map potentialMatchingBinders = new HashMap(); for (Iterator i = propertyNameBinders.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry)i.next(); if (((PropertyNameKey)entry.getKey()).getPropertyName().equals(propertyName)) { potentialMatchingBinders.put(((PropertyNameKey)entry.getKey()).getParentObjectType(), entry.getValue()); } } binder = (Binder) ClassUtils.getValueFromMapForClass(parentObjectType, potentialMatchingBinders); if (binder != null) { // remember the lookup so it doesn't have to be discovered again registerBinderForPropertyName(parentObjectType, propertyName, binder); } } return binder; }
java
protected Binder findBinderByPropertyName(Class parentObjectType, String propertyName) { PropertyNameKey key = new PropertyNameKey(parentObjectType, propertyName); Binder binder = (Binder)propertyNameBinders.get(key); if (binder == null) { // if no direct match was found try to find a match in any super classes final Map potentialMatchingBinders = new HashMap(); for (Iterator i = propertyNameBinders.entrySet().iterator(); i.hasNext();) { Map.Entry entry = (Map.Entry)i.next(); if (((PropertyNameKey)entry.getKey()).getPropertyName().equals(propertyName)) { potentialMatchingBinders.put(((PropertyNameKey)entry.getKey()).getParentObjectType(), entry.getValue()); } } binder = (Binder) ClassUtils.getValueFromMapForClass(parentObjectType, potentialMatchingBinders); if (binder != null) { // remember the lookup so it doesn't have to be discovered again registerBinderForPropertyName(parentObjectType, propertyName, binder); } } return binder; }
[ "protected", "Binder", "findBinderByPropertyName", "(", "Class", "parentObjectType", ",", "String", "propertyName", ")", "{", "PropertyNameKey", "key", "=", "new", "PropertyNameKey", "(", "parentObjectType", ",", "propertyName", ")", ";", "Binder", "binder", "=", "(...
Try to find a binder for the provided parentObjectType and propertyName. If no direct match found try to find binder for any superclass of the provided objectType which also has the same propertyName.
[ "Try", "to", "find", "a", "binder", "for", "the", "provided", "parentObjectType", "and", "propertyName", ".", "If", "no", "direct", "match", "found", "try", "to", "find", "binder", "for", "any", "superclass", "of", "the", "provided", "objectType", "which", "...
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/support/AbstractBinderSelectionStrategy.java#L93-L113