repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
avianey/facebook-api-android-maven
facebook/src/main/java/com/facebook/Request.java
Request.executeGraphPathRequestAsync
@Deprecated public static RequestAsyncTask executeGraphPathRequestAsync(Session session, String graphPath, Callback callback) { return newGraphPathRequest(session, graphPath, callback).executeAsync(); }
java
@Deprecated public static RequestAsyncTask executeGraphPathRequestAsync(Session session, String graphPath, Callback callback) { return newGraphPathRequest(session, graphPath, callback).executeAsync(); }
[ "@", "Deprecated", "public", "static", "RequestAsyncTask", "executeGraphPathRequestAsync", "(", "Session", "session", ",", "String", "graphPath", ",", "Callback", "callback", ")", "{", "return", "newGraphPathRequest", "(", "session", ",", "graphPath", ",", "callback",...
Starts a new Request configured to retrieve a particular graph path. <p/> This should only be called from the UI thread. This method is deprecated. Prefer to call Request.newGraphPathRequest(...).executeAsync(); @param session the Session to use, or null; if non-null, the session must be in an opened state @param graphPath the graph path to retrieve @param callback a callback that will be called when the request is completed to handle success or error conditions @return a RequestAsyncTask that is executing the request
[ "Starts", "a", "new", "Request", "configured", "to", "retrieve", "a", "particular", "graph", "path", ".", "<p", "/", ">", "This", "should", "only", "be", "called", "from", "the", "UI", "thread", "." ]
train
https://github.com/avianey/facebook-api-android-maven/blob/ae6c7aa7ae45739ee19f18c1983e05f7e35b9ede/facebook/src/main/java/com/facebook/Request.java#L1192-L1195
eduarddrenth/ConfigurableReports
src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java
DefaultElementProducer.makeImageTranslucent
public static BufferedImage makeImageTranslucent(BufferedImage source, float opacity) { if (opacity == 1) { return source; } BufferedImage translucent = new BufferedImage(source.getWidth(), source.getHeight(), BufferedImage.TRANSLUCENT); Graphics2D g = translucent.createGraphics(); g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity)); g.drawImage(source, null, 0, 0); g.dispose(); return translucent; }
java
public static BufferedImage makeImageTranslucent(BufferedImage source, float opacity) { if (opacity == 1) { return source; } BufferedImage translucent = new BufferedImage(source.getWidth(), source.getHeight(), BufferedImage.TRANSLUCENT); Graphics2D g = translucent.createGraphics(); g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, opacity)); g.drawImage(source, null, 0, 0); g.dispose(); return translucent; }
[ "public", "static", "BufferedImage", "makeImageTranslucent", "(", "BufferedImage", "source", ",", "float", "opacity", ")", "{", "if", "(", "opacity", "==", "1", ")", "{", "return", "source", ";", "}", "BufferedImage", "translucent", "=", "new", "BufferedImage", ...
returns a transparent image when opacity &lt; 1 @param source @param opacity @return
[ "returns", "a", "transparent", "image", "when", "opacity", "&lt", ";", "1" ]
train
https://github.com/eduarddrenth/ConfigurableReports/blob/b5fb7a89e16d9b35f557f3bf620594f821fa1552/src/main/java/com/vectorprint/report/itext/DefaultElementProducer.java#L426-L436
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupEnginesInner.java
BackupEnginesInner.listAsync
public Observable<Page<BackupEngineBaseResourceInner>> listAsync(final String vaultName, final String resourceGroupName) { return listWithServiceResponseAsync(vaultName, resourceGroupName) .map(new Func1<ServiceResponse<Page<BackupEngineBaseResourceInner>>, Page<BackupEngineBaseResourceInner>>() { @Override public Page<BackupEngineBaseResourceInner> call(ServiceResponse<Page<BackupEngineBaseResourceInner>> response) { return response.body(); } }); }
java
public Observable<Page<BackupEngineBaseResourceInner>> listAsync(final String vaultName, final String resourceGroupName) { return listWithServiceResponseAsync(vaultName, resourceGroupName) .map(new Func1<ServiceResponse<Page<BackupEngineBaseResourceInner>>, Page<BackupEngineBaseResourceInner>>() { @Override public Page<BackupEngineBaseResourceInner> call(ServiceResponse<Page<BackupEngineBaseResourceInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "BackupEngineBaseResourceInner", ">", ">", "listAsync", "(", "final", "String", "vaultName", ",", "final", "String", "resourceGroupName", ")", "{", "return", "listWithServiceResponseAsync", "(", "vaultName", ",", "resourceGrou...
Backup management servers registered to Recovery Services Vault. Returns a pageable list of servers. @param vaultName The name of the recovery services vault. @param resourceGroupName The name of the resource group where the recovery services vault is present. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;BackupEngineBaseResourceInner&gt; object
[ "Backup", "management", "servers", "registered", "to", "Recovery", "Services", "Vault", ".", "Returns", "a", "pageable", "list", "of", "servers", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2017_07_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2017_07_01/implementation/BackupEnginesInner.java#L123-L131
roboconf/roboconf-platform
core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java
UserDataHelper.findParametersFromUrl
public AgentProperties findParametersFromUrl( String url, Logger logger ) { logger.info( "User data are being retrieved from URL: " + url ); AgentProperties result = null; try { URI uri = UriUtils.urlToUri( url ); Properties props = new Properties(); InputStream in = null; try { in = uri.toURL().openStream(); props.load( in ); } finally { Utils.closeQuietly( in ); } result = AgentProperties.readIaasProperties( props ); } catch( Exception e ) { logger.fine( "Agent parameters could not be read from " + url ); result = null; } return result; }
java
public AgentProperties findParametersFromUrl( String url, Logger logger ) { logger.info( "User data are being retrieved from URL: " + url ); AgentProperties result = null; try { URI uri = UriUtils.urlToUri( url ); Properties props = new Properties(); InputStream in = null; try { in = uri.toURL().openStream(); props.load( in ); } finally { Utils.closeQuietly( in ); } result = AgentProperties.readIaasProperties( props ); } catch( Exception e ) { logger.fine( "Agent parameters could not be read from " + url ); result = null; } return result; }
[ "public", "AgentProperties", "findParametersFromUrl", "(", "String", "url", ",", "Logger", "logger", ")", "{", "logger", ".", "info", "(", "\"User data are being retrieved from URL: \"", "+", "url", ")", ";", "AgentProperties", "result", "=", "null", ";", "try", "...
Retrieve the agent's configuration from an URL. @param logger a logger @return the agent's data, or null if they could not be parsed
[ "Retrieve", "the", "agent", "s", "configuration", "from", "an", "URL", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-agent/src/main/java/net/roboconf/agent/internal/misc/UserDataHelper.java#L213-L237
allcolor/YaHP-Converter
YaHPConverter/src/org/allcolor/yahp/converter/CClassLoader.java
CClassLoader.createMemoryURL
public static URL createMemoryURL(final String entryName, final byte[] entry) { try { final Class c = ClassLoader.getSystemClassLoader().loadClass( "org.allcolor.yahp.converter.CMemoryURLHandler"); final Method m = c.getDeclaredMethod("createMemoryURL", new Class[] { String.class, byte[].class }); m.setAccessible(true); return (URL) m.invoke(null, new Object[] { entryName, entry }); } catch (final Exception ignore) { ignore.printStackTrace(); return null; } }
java
public static URL createMemoryURL(final String entryName, final byte[] entry) { try { final Class c = ClassLoader.getSystemClassLoader().loadClass( "org.allcolor.yahp.converter.CMemoryURLHandler"); final Method m = c.getDeclaredMethod("createMemoryURL", new Class[] { String.class, byte[].class }); m.setAccessible(true); return (URL) m.invoke(null, new Object[] { entryName, entry }); } catch (final Exception ignore) { ignore.printStackTrace(); return null; } }
[ "public", "static", "URL", "createMemoryURL", "(", "final", "String", "entryName", ",", "final", "byte", "[", "]", "entry", ")", "{", "try", "{", "final", "Class", "c", "=", "ClassLoader", ".", "getSystemClassLoader", "(", ")", ".", "loadClass", "(", "\"or...
Creates and allocates a memory URL @param entryName name of the entry @param entry byte array of the entry @return the created URL or null if an error occurs.
[ "Creates", "and", "allocates", "a", "memory", "URL" ]
train
https://github.com/allcolor/YaHP-Converter/blob/d72745281766a784a6b319f3787aa1d8de7cd0fe/YaHPConverter/src/org/allcolor/yahp/converter/CClassLoader.java#L143-L155
elastic/elasticsearch-metrics-reporter-java
src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java
ElasticsearchReporter.writeJsonMetric
private void writeJsonMetric(JsonMetric jsonMetric, ObjectWriter writer, OutputStream out) throws IOException { writer.writeValue(out, new BulkIndexOperationHeader(currentIndexName, jsonMetric.type())); out.write("\n".getBytes()); writer.writeValue(out, jsonMetric); out.write("\n".getBytes()); out.flush(); }
java
private void writeJsonMetric(JsonMetric jsonMetric, ObjectWriter writer, OutputStream out) throws IOException { writer.writeValue(out, new BulkIndexOperationHeader(currentIndexName, jsonMetric.type())); out.write("\n".getBytes()); writer.writeValue(out, jsonMetric); out.write("\n".getBytes()); out.flush(); }
[ "private", "void", "writeJsonMetric", "(", "JsonMetric", "jsonMetric", ",", "ObjectWriter", "writer", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "writer", ".", "writeValue", "(", "out", ",", "new", "BulkIndexOperationHeader", "(", "currentIndexNa...
serialize a JSON metric over the outputstream in a bulk request
[ "serialize", "a", "JSON", "metric", "over", "the", "outputstream", "in", "a", "bulk", "request" ]
train
https://github.com/elastic/elasticsearch-metrics-reporter-java/blob/4018eaef6fc7721312f7440b2bf5a19699a6cb56/src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java#L424-L431
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/chunklistener/ChunkListener.java
ChunkListener.isValidPostListener
public boolean isValidPostListener(Chunk chunk, BlockPos listener, BlockPos modified, IBlockState oldState, IBlockState newState) { if (listener.equals(modified)) return false; IBlockListener.Post bl = IComponent.getComponent(IBlockListener.Post.class, chunk.getWorld().getBlockState(listener).getBlock()); if (bl != null && bl.isInRange(listener, modified)) return true; return false; }
java
public boolean isValidPostListener(Chunk chunk, BlockPos listener, BlockPos modified, IBlockState oldState, IBlockState newState) { if (listener.equals(modified)) return false; IBlockListener.Post bl = IComponent.getComponent(IBlockListener.Post.class, chunk.getWorld().getBlockState(listener).getBlock()); if (bl != null && bl.isInRange(listener, modified)) return true; return false; }
[ "public", "boolean", "isValidPostListener", "(", "Chunk", "chunk", ",", "BlockPos", "listener", ",", "BlockPos", "modified", ",", "IBlockState", "oldState", ",", "IBlockState", "newState", ")", "{", "if", "(", "listener", ".", "equals", "(", "modified", ")", "...
Checks if the listener {@link BlockPos} has a {@link IBlockListener.Pre} component and if the modified {@code BlockPos} is in range. @param chunk the chunk @param listener the listener @param modified the modified @param oldState the old state @param newState the new state @return true, if is valid post listener
[ "Checks", "if", "the", "listener", "{", "@link", "BlockPos", "}", "has", "a", "{", "@link", "IBlockListener", ".", "Pre", "}", "component", "and", "if", "the", "modified", "{", "@code", "BlockPos", "}", "is", "in", "range", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/chunklistener/ChunkListener.java#L126-L135
lucee/Lucee
core/src/main/java/lucee/commons/io/IOUtil.java
IOUtil.merge
public static final void merge(InputStream in1, InputStream in2, OutputStream out, boolean closeIS1, boolean closeIS2, boolean closeOS) throws IOException { try { merge(in1, in2, out, 0xffff); } finally { if (closeIS1) closeEL(in1); if (closeIS2) closeEL(in2); if (closeOS) closeEL(out); } }
java
public static final void merge(InputStream in1, InputStream in2, OutputStream out, boolean closeIS1, boolean closeIS2, boolean closeOS) throws IOException { try { merge(in1, in2, out, 0xffff); } finally { if (closeIS1) closeEL(in1); if (closeIS2) closeEL(in2); if (closeOS) closeEL(out); } }
[ "public", "static", "final", "void", "merge", "(", "InputStream", "in1", ",", "InputStream", "in2", ",", "OutputStream", "out", ",", "boolean", "closeIS1", ",", "boolean", "closeIS2", ",", "boolean", "closeOS", ")", "throws", "IOException", "{", "try", "{", ...
copy a inputstream to a outputstream @param in @param out @param closeIS @param closeOS @throws IOException
[ "copy", "a", "inputstream", "to", "a", "outputstream" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/IOUtil.java#L93-L102
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201811/exchangerateservice/CreateExchangeRates.java
CreateExchangeRates.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the ExchangeRateService. ExchangeRateServiceInterface exchangeRateService = adManagerServices.get(session, ExchangeRateServiceInterface.class); // Create an exchange rate. ExchangeRate exchangeRate = new ExchangeRate(); // Set the currency code. exchangeRate.setCurrencyCode("AUD"); // Set the direction of the conversion (from the network currency). exchangeRate.setDirection(ExchangeRateDirection.FROM_NETWORK); // Set the conversion value as 1.5 (this value is multiplied by 10,000,000,000) exchangeRate.setExchangeRate(15000000000L); // Do not refresh exchange rate from Google data. Update manually only. exchangeRate.setRefreshRate(ExchangeRateRefreshRate.FIXED); // Create the exchange rate on the server. ExchangeRate[] exchangeRates = exchangeRateService.createExchangeRates(new ExchangeRate[] {exchangeRate}); for (ExchangeRate createdExchangeRate : exchangeRates) { System.out.printf( "An exchange rate with ID %d, currency code '%s'," + " direction '%s', and exchange rate %.2f was created.%n", createdExchangeRate.getId(), createdExchangeRate.getCurrencyCode(), createdExchangeRate.getDirection().getValue(), (createdExchangeRate.getExchangeRate() / 10000000000f)); } }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the ExchangeRateService. ExchangeRateServiceInterface exchangeRateService = adManagerServices.get(session, ExchangeRateServiceInterface.class); // Create an exchange rate. ExchangeRate exchangeRate = new ExchangeRate(); // Set the currency code. exchangeRate.setCurrencyCode("AUD"); // Set the direction of the conversion (from the network currency). exchangeRate.setDirection(ExchangeRateDirection.FROM_NETWORK); // Set the conversion value as 1.5 (this value is multiplied by 10,000,000,000) exchangeRate.setExchangeRate(15000000000L); // Do not refresh exchange rate from Google data. Update manually only. exchangeRate.setRefreshRate(ExchangeRateRefreshRate.FIXED); // Create the exchange rate on the server. ExchangeRate[] exchangeRates = exchangeRateService.createExchangeRates(new ExchangeRate[] {exchangeRate}); for (ExchangeRate createdExchangeRate : exchangeRates) { System.out.printf( "An exchange rate with ID %d, currency code '%s'," + " direction '%s', and exchange rate %.2f was created.%n", createdExchangeRate.getId(), createdExchangeRate.getCurrencyCode(), createdExchangeRate.getDirection().getValue(), (createdExchangeRate.getExchangeRate() / 10000000000f)); } }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "// Get the ExchangeRateService.", "ExchangeRateServiceInterface", "exchangeRateService", "=", "adManagerServices", ...
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201811/exchangerateservice/CreateExchangeRates.java#L52-L86
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/spi/LoggerRegistry.java
LoggerRegistry.getLogger
public T getLogger(final String name, final MessageFactory messageFactory) { return getOrCreateInnerMap(factoryKey(messageFactory)).get(name); }
java
public T getLogger(final String name, final MessageFactory messageFactory) { return getOrCreateInnerMap(factoryKey(messageFactory)).get(name); }
[ "public", "T", "getLogger", "(", "final", "String", "name", ",", "final", "MessageFactory", "messageFactory", ")", "{", "return", "getOrCreateInnerMap", "(", "factoryKey", "(", "messageFactory", ")", ")", ".", "get", "(", "name", ")", ";", "}" ]
Returns an ExtendedLogger. @param name The name of the Logger to return. @param messageFactory The message factory is used only when creating a logger, subsequent use does not change the logger but will log a warning if mismatched. @return The logger with the specified name.
[ "Returns", "an", "ExtendedLogger", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/spi/LoggerRegistry.java#L124-L126
LearnLib/automatalib
commons/util/src/main/java/net/automatalib/commons/util/UnionFindRemSP.java
UnionFindRemSP.link
@Override public int link(int x, int y) { if (x < y) { p[x] = y; return y; } p[y] = x; return x; }
java
@Override public int link(int x, int y) { if (x < y) { p[x] = y; return y; } p[y] = x; return x; }
[ "@", "Override", "public", "int", "link", "(", "int", "x", ",", "int", "y", ")", "{", "if", "(", "x", "<", "y", ")", "{", "p", "[", "x", "]", "=", "y", ";", "return", "y", ";", "}", "p", "[", "y", "]", "=", "x", ";", "return", "x", ";",...
Unites two given sets. Note that the behavior of this method is not specified if the given parameters are normal elements and no set identifiers. @param x the first set @param y the second set @return the identifier of the resulting set (either {@code x} or {@code y})
[ "Unites", "two", "given", "sets", ".", "Note", "that", "the", "behavior", "of", "this", "method", "is", "not", "specified", "if", "the", "given", "parameters", "are", "normal", "elements", "and", "no", "set", "identifiers", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/UnionFindRemSP.java#L140-L148
apache/incubator-gobblin
gobblin-utility/src/main/java/org/apache/gobblin/util/executors/IteratorExecutor.java
IteratorExecutor.verifyAllSuccessful
public static <T> boolean verifyAllSuccessful(List<Either<T, ExecutionException>> results) { return Iterables.all(results, new Predicate<Either<T, ExecutionException>>() { @Override public boolean apply(@Nullable Either<T, ExecutionException> input) { return input instanceof Either.Left; } }); }
java
public static <T> boolean verifyAllSuccessful(List<Either<T, ExecutionException>> results) { return Iterables.all(results, new Predicate<Either<T, ExecutionException>>() { @Override public boolean apply(@Nullable Either<T, ExecutionException> input) { return input instanceof Either.Left; } }); }
[ "public", "static", "<", "T", ">", "boolean", "verifyAllSuccessful", "(", "List", "<", "Either", "<", "T", ",", "ExecutionException", ">", ">", "results", ")", "{", "return", "Iterables", ".", "all", "(", "results", ",", "new", "Predicate", "<", "Either", ...
Utility method that checks whether all tasks succeeded from the output of {@link #executeAndGetResults()}. @return true if all tasks succeeded.
[ "Utility", "method", "that", "checks", "whether", "all", "tasks", "succeeded", "from", "the", "output", "of", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-utility/src/main/java/org/apache/gobblin/util/executors/IteratorExecutor.java#L140-L147
infinispan/infinispan
server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java
ExtendedByteBuf.readOptString
public static Optional<String> readOptString(ByteBuf bf) { Optional<byte[]> bytes = readOptRangedBytes(bf); return bytes.map(b -> new String(b, CharsetUtil.UTF_8)); }
java
public static Optional<String> readOptString(ByteBuf bf) { Optional<byte[]> bytes = readOptRangedBytes(bf); return bytes.map(b -> new String(b, CharsetUtil.UTF_8)); }
[ "public", "static", "Optional", "<", "String", ">", "readOptString", "(", "ByteBuf", "bf", ")", "{", "Optional", "<", "byte", "[", "]", ">", "bytes", "=", "readOptRangedBytes", "(", "bf", ")", ";", "return", "bytes", ".", "map", "(", "b", "->", "new", ...
Reads an optional String. 0 length is an empty string, negative length is translated to None.
[ "Reads", "an", "optional", "String", ".", "0", "length", "is", "an", "empty", "string", "negative", "length", "is", "translated", "to", "None", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/server/hotrod/src/main/java/org/infinispan/server/hotrod/transport/ExtendedByteBuf.java#L67-L70
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/tools/WikipediaCleaner.java
WikipediaCleaner.removeWikiLinkMarkup
public void removeWikiLinkMarkup(StringBuilder article, String title) { int bracketStart = article.indexOf("[["); boolean includeLinkText = options.contains(CleanerOption.INCLUDE_LINK_TEXT); while (bracketStart >= 0) { // grab the linked article name which is all text to the next ]], or // to int bracketEnd = article.indexOf("]]", bracketStart); // If there wasn't a matching closing bracket (i.e. malformatted // wiki), then abort the replacement if (bracketEnd < 0) break; // If the link text is supposed to be included in the document, then // strip out the pertinent text. However, ensure that the link // points to an article, which filters out non-content links in the // article headers and footers if (includeLinkText && isArticleLink(article.substring(bracketStart+2, bracketEnd), title)) { // the link may also have a text description that replaces the // link text, e.g. [[article title|link text]]. int optionalLinkDescriptionStart = article.indexOf("|", bracketStart); // When selecting the optional text, ensure that the | delimeter // falls within the link structure itself int linkTextStart = (optionalLinkDescriptionStart >= 0 && optionalLinkDescriptionStart < bracketEnd) ? optionalLinkDescriptionStart + 1 : bracketStart + 2; // Parse out the link text String linkText = article.substring(linkTextStart, bracketEnd); // Then replace the entire link with the desired text article.replace(bracketStart, bracketEnd+2, linkText); } // If the link text isn't to be used in the document, remove it // completely else { article.delete(bracketStart, bracketEnd + 2); } bracketStart = article.indexOf("[[", bracketStart); } }
java
public void removeWikiLinkMarkup(StringBuilder article, String title) { int bracketStart = article.indexOf("[["); boolean includeLinkText = options.contains(CleanerOption.INCLUDE_LINK_TEXT); while (bracketStart >= 0) { // grab the linked article name which is all text to the next ]], or // to int bracketEnd = article.indexOf("]]", bracketStart); // If there wasn't a matching closing bracket (i.e. malformatted // wiki), then abort the replacement if (bracketEnd < 0) break; // If the link text is supposed to be included in the document, then // strip out the pertinent text. However, ensure that the link // points to an article, which filters out non-content links in the // article headers and footers if (includeLinkText && isArticleLink(article.substring(bracketStart+2, bracketEnd), title)) { // the link may also have a text description that replaces the // link text, e.g. [[article title|link text]]. int optionalLinkDescriptionStart = article.indexOf("|", bracketStart); // When selecting the optional text, ensure that the | delimeter // falls within the link structure itself int linkTextStart = (optionalLinkDescriptionStart >= 0 && optionalLinkDescriptionStart < bracketEnd) ? optionalLinkDescriptionStart + 1 : bracketStart + 2; // Parse out the link text String linkText = article.substring(linkTextStart, bracketEnd); // Then replace the entire link with the desired text article.replace(bracketStart, bracketEnd+2, linkText); } // If the link text isn't to be used in the document, remove it // completely else { article.delete(bracketStart, bracketEnd + 2); } bracketStart = article.indexOf("[[", bracketStart); } }
[ "public", "void", "removeWikiLinkMarkup", "(", "StringBuilder", "article", ",", "String", "title", ")", "{", "int", "bracketStart", "=", "article", ".", "indexOf", "(", "\"[[\"", ")", ";", "boolean", "includeLinkText", "=", "options", ".", "contains", "(", "Cl...
Replace [[link]] tags with link name and track what articles this article links to. @param text The article text to clean and process link structure of. @return A Duple containing the cleaned text and the outgoing link count.
[ "Replace", "[[", "link", "]]", "tags", "with", "link", "name", "and", "track", "what", "articles", "this", "article", "links", "to", "." ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/tools/WikipediaCleaner.java#L362-L407
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java
EnumHelper.getFromNameCaseInsensitiveOrNull
@Nullable public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasName> ENUMTYPE getFromNameCaseInsensitiveOrNull (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sName) { return getFromNameCaseInsensitiveOrDefault (aClass, sName, null); }
java
@Nullable public static <ENUMTYPE extends Enum <ENUMTYPE> & IHasName> ENUMTYPE getFromNameCaseInsensitiveOrNull (@Nonnull final Class <ENUMTYPE> aClass, @Nullable final String sName) { return getFromNameCaseInsensitiveOrDefault (aClass, sName, null); }
[ "@", "Nullable", "public", "static", "<", "ENUMTYPE", "extends", "Enum", "<", "ENUMTYPE", ">", "&", "IHasName", ">", "ENUMTYPE", "getFromNameCaseInsensitiveOrNull", "(", "@", "Nonnull", "final", "Class", "<", "ENUMTYPE", ">", "aClass", ",", "@", "Nullable", "f...
Get the enum value with the passed name case insensitive @param <ENUMTYPE> The enum type @param aClass The enum class @param sName The name to search @return <code>null</code> if no enum item with the given ID is present.
[ "Get", "the", "enum", "value", "with", "the", "passed", "name", "case", "insensitive" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/lang/EnumHelper.java#L418-L423
EdwardRaff/JSAT
JSAT/src/jsat/io/JSATData.java
JSATData.loadRegression
public static RegressionDataSet loadRegression(InputStream inRaw, DataStore backingStore) throws IOException { return (RegressionDataSet) load(inRaw, backingStore); }
java
public static RegressionDataSet loadRegression(InputStream inRaw, DataStore backingStore) throws IOException { return (RegressionDataSet) load(inRaw, backingStore); }
[ "public", "static", "RegressionDataSet", "loadRegression", "(", "InputStream", "inRaw", ",", "DataStore", "backingStore", ")", "throws", "IOException", "{", "return", "(", "RegressionDataSet", ")", "load", "(", "inRaw", ",", "backingStore", ")", ";", "}" ]
Loads in a JSAT dataset as a {@link RegressionDataSet}. An exception will be thrown if the original dataset in the file was not a {@link RegressionDataSet}. @param inRaw the input stream, caller should buffer it @param backingStore the data store to put all data points in @return a RegressionDataSet object @throws IOException @throws ClassCastException if the original dataset was a not a RegressionDataSet
[ "Loads", "in", "a", "JSAT", "dataset", "as", "a", "{", "@link", "RegressionDataSet", "}", ".", "An", "exception", "will", "be", "thrown", "if", "the", "original", "dataset", "in", "the", "file", "was", "not", "a", "{", "@link", "RegressionDataSet", "}", ...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/io/JSATData.java#L599-L602
cdapio/netty-http
src/main/java/io/cdap/http/internal/ParamConvertUtils.java
ParamConvertUtils.createPrimitiveTypeConverter
@Nullable private static Converter<List<String>, Object> createPrimitiveTypeConverter(final Class<?> resultClass) { Object defaultValue = defaultValue(resultClass); if (defaultValue == null) { // For primitive type, the default value shouldn't be null return null; } return new BasicConverter(defaultValue) { @Override protected Object convert(String value) throws Exception { return valueOf(value, resultClass); } }; }
java
@Nullable private static Converter<List<String>, Object> createPrimitiveTypeConverter(final Class<?> resultClass) { Object defaultValue = defaultValue(resultClass); if (defaultValue == null) { // For primitive type, the default value shouldn't be null return null; } return new BasicConverter(defaultValue) { @Override protected Object convert(String value) throws Exception { return valueOf(value, resultClass); } }; }
[ "@", "Nullable", "private", "static", "Converter", "<", "List", "<", "String", ">", ",", "Object", ">", "createPrimitiveTypeConverter", "(", "final", "Class", "<", "?", ">", "resultClass", ")", "{", "Object", "defaultValue", "=", "defaultValue", "(", "resultCl...
Creates a converter function that converts value into primitive type. @return A converter function or {@code null} if the given type is not primitive type or boxed type
[ "Creates", "a", "converter", "function", "that", "converts", "value", "into", "primitive", "type", "." ]
train
https://github.com/cdapio/netty-http/blob/02fdbb45bdd51d3dd58c0efbb2f27195d265cd0f/src/main/java/io/cdap/http/internal/ParamConvertUtils.java#L158-L173
flow/commons
src/main/java/com/flowpowered/commons/ViewFrustum.java
ViewFrustum.intersectsCuboid
public boolean intersectsCuboid(Vector3f[] vertices, float x, float y, float z) { if (vertices.length != 8) { throw new IllegalArgumentException("A cuboid has 8 vertices, not " + vertices.length); } planes: for (int i = 0; i < 6; i++) { for (Vector3f vertex : vertices) { if (distance(i, vertex.getX() + x, vertex.getY() + y, vertex.getZ() + z) > 0) { continue planes; } } return false; } return true; }
java
public boolean intersectsCuboid(Vector3f[] vertices, float x, float y, float z) { if (vertices.length != 8) { throw new IllegalArgumentException("A cuboid has 8 vertices, not " + vertices.length); } planes: for (int i = 0; i < 6; i++) { for (Vector3f vertex : vertices) { if (distance(i, vertex.getX() + x, vertex.getY() + y, vertex.getZ() + z) > 0) { continue planes; } } return false; } return true; }
[ "public", "boolean", "intersectsCuboid", "(", "Vector3f", "[", "]", "vertices", ",", "float", "x", ",", "float", "y", ",", "float", "z", ")", "{", "if", "(", "vertices", ".", "length", "!=", "8", ")", "{", "throw", "new", "IllegalArgumentException", "(",...
Checks if the frustum of this camera intersects the given cuboid vertices. @param vertices The cuboid local vertices to check the frustum against @param x The x coordinate of the cuboid position @param y The y coordinate of the cuboid position @param z The z coordinate of the cuboid position @return Whether or not the frustum intersects the cuboid
[ "Checks", "if", "the", "frustum", "of", "this", "camera", "intersects", "the", "given", "cuboid", "vertices", "." ]
train
https://github.com/flow/commons/blob/0690efdac06fd728fcd7e9cf10f2b1319379c45b/src/main/java/com/flowpowered/commons/ViewFrustum.java#L240-L254
headius/invokebinder
src/main/java/com/headius/invokebinder/Signature.java
Signature.appendArgs
public Signature appendArgs(String[] names, Class<?>... types) { assert names.length == types.length : "names and types must be of the same length"; String[] newArgNames = new String[argNames.length + names.length]; System.arraycopy(argNames, 0, newArgNames, 0, argNames.length); System.arraycopy(names, 0, newArgNames, argNames.length, names.length); MethodType newMethodType = methodType.appendParameterTypes(types); return new Signature(newMethodType, newArgNames); }
java
public Signature appendArgs(String[] names, Class<?>... types) { assert names.length == types.length : "names and types must be of the same length"; String[] newArgNames = new String[argNames.length + names.length]; System.arraycopy(argNames, 0, newArgNames, 0, argNames.length); System.arraycopy(names, 0, newArgNames, argNames.length, names.length); MethodType newMethodType = methodType.appendParameterTypes(types); return new Signature(newMethodType, newArgNames); }
[ "public", "Signature", "appendArgs", "(", "String", "[", "]", "names", ",", "Class", "<", "?", ">", "...", "types", ")", "{", "assert", "names", ".", "length", "==", "types", ".", "length", ":", "\"names and types must be of the same length\"", ";", "String", ...
Append an argument (name + type) to the signature. @param names the names of the arguments @param types the types of the argument @return a new signature with the added arguments
[ "Append", "an", "argument", "(", "name", "+", "type", ")", "to", "the", "signature", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L202-L210
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.createTransferMessageSenderFromEntityPathAsync
public static CompletableFuture<IMessageSender> createTransferMessageSenderFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String viaEntityPath) { Utils.assertNonNull("messagingFactory", messagingFactory); MessageSender sender = new MessageSender(messagingFactory, viaEntityPath, entityPath, null); return sender.initializeAsync().thenApply((v) -> sender); }
java
public static CompletableFuture<IMessageSender> createTransferMessageSenderFromEntityPathAsync(MessagingFactory messagingFactory, String entityPath, String viaEntityPath) { Utils.assertNonNull("messagingFactory", messagingFactory); MessageSender sender = new MessageSender(messagingFactory, viaEntityPath, entityPath, null); return sender.initializeAsync().thenApply((v) -> sender); }
[ "public", "static", "CompletableFuture", "<", "IMessageSender", ">", "createTransferMessageSenderFromEntityPathAsync", "(", "MessagingFactory", "messagingFactory", ",", "String", "entityPath", ",", "String", "viaEntityPath", ")", "{", "Utils", ".", "assertNonNull", "(", "...
Creates a transfer message sender asynchronously. This sender sends message to destination entity via another entity. This is mainly to be used when sending messages in a transaction. When messages need to be sent across entities in a single transaction, this can be used to ensure all the messages land initially in the same entity/partition for local transactions, and then let service bus handle transferring the message to the actual destination. @param messagingFactory messaging factory (which represents a connection) on which sender needs to be created. @param entityPath path of the final destination of the message. @param viaEntityPath The initial destination of the message. @return a CompletableFuture representing the pending creating of IMessageSender instance.
[ "Creates", "a", "transfer", "message", "sender", "asynchronously", ".", "This", "sender", "sends", "message", "to", "destination", "entity", "via", "another", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L209-L214
stratosphere/stratosphere
stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/JobmanagerInfoServlet.java
JobmanagerInfoServlet.writeJsonForJobs
private void writeJsonForJobs(PrintWriter wrt, List<RecentJobEvent> jobs) { try { wrt.write("["); // Loop Jobs for (int i = 0; i < jobs.size(); i++) { RecentJobEvent jobEvent = jobs.get(i); writeJsonForJob(wrt, jobEvent); //Write seperator between json objects if(i != jobs.size() - 1) { wrt.write(","); } } wrt.write("]"); } catch (EofException eof) { // Connection closed by client LOG.info("Info server for jobmanager: Connection closed by client, EofException"); } catch (IOException ioe) { // Connection closed by client LOG.info("Info server for jobmanager: Connection closed by client, IOException"); } }
java
private void writeJsonForJobs(PrintWriter wrt, List<RecentJobEvent> jobs) { try { wrt.write("["); // Loop Jobs for (int i = 0; i < jobs.size(); i++) { RecentJobEvent jobEvent = jobs.get(i); writeJsonForJob(wrt, jobEvent); //Write seperator between json objects if(i != jobs.size() - 1) { wrt.write(","); } } wrt.write("]"); } catch (EofException eof) { // Connection closed by client LOG.info("Info server for jobmanager: Connection closed by client, EofException"); } catch (IOException ioe) { // Connection closed by client LOG.info("Info server for jobmanager: Connection closed by client, IOException"); } }
[ "private", "void", "writeJsonForJobs", "(", "PrintWriter", "wrt", ",", "List", "<", "RecentJobEvent", ">", "jobs", ")", "{", "try", "{", "wrt", ".", "write", "(", "\"[\"", ")", ";", "// Loop Jobs", "for", "(", "int", "i", "=", "0", ";", "i", "<", "jo...
Writes ManagementGraph as Json for all recent jobs @param wrt @param jobs
[ "Writes", "ManagementGraph", "as", "Json", "for", "all", "recent", "jobs" ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-runtime/src/main/java/eu/stratosphere/nephele/jobmanager/web/JobmanagerInfoServlet.java#L119-L144
stephanenicolas/robospice
robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java
SpiceManager.putDataInCache
public <T> Future<T> putDataInCache(final Object cacheKey, final T data) throws CacheSavingException, CacheCreationException { return executeCommand(new PutDataInCacheCommand<T>(this, data, cacheKey)); }
java
public <T> Future<T> putDataInCache(final Object cacheKey, final T data) throws CacheSavingException, CacheCreationException { return executeCommand(new PutDataInCacheCommand<T>(this, data, cacheKey)); }
[ "public", "<", "T", ">", "Future", "<", "T", ">", "putDataInCache", "(", "final", "Object", "cacheKey", ",", "final", "T", "data", ")", "throws", "CacheSavingException", ",", "CacheCreationException", "{", "return", "executeCommand", "(", "new", "PutDataInCacheC...
Put some new data in cache using cache key <i>requestCacheKey</i>. This method doesn't perform any network processing, it just data in cache, erasing any previsouly saved date in cache using the same class and key. Don't call this method in the main thread because you could block it. Instead, use the asynchronous version of this method: {@link #putInCache(Class, Object, Object)}. @param cacheKey the key used to store and retrieve the result of the request in the cache @param data the data to be saved in cache. @return the data has it has been saved by an ObjectPersister in cache. @throws CacheLoadingException Exception thrown when a problem occurs while loading data from cache.
[ "Put", "some", "new", "data", "in", "cache", "using", "cache", "key", "<i", ">", "requestCacheKey<", "/", "i", ">", ".", "This", "method", "doesn", "t", "perform", "any", "network", "processing", "it", "just", "data", "in", "cache", "erasing", "any", "pr...
train
https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/SpiceManager.java#L925-L927
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java
ConsoleMenu.getBoolean
public static boolean getBoolean(final String title, final boolean defaultValue) { final String val = ConsoleMenu.selectOne(title, new String[] { "Yes", "No" }, new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() }, defaultValue ? 1 : 2); return Boolean.valueOf(val); }
java
public static boolean getBoolean(final String title, final boolean defaultValue) { final String val = ConsoleMenu.selectOne(title, new String[] { "Yes", "No" }, new String[] { Boolean.TRUE.toString(), Boolean.FALSE.toString() }, defaultValue ? 1 : 2); return Boolean.valueOf(val); }
[ "public", "static", "boolean", "getBoolean", "(", "final", "String", "title", ",", "final", "boolean", "defaultValue", ")", "{", "final", "String", "val", "=", "ConsoleMenu", ".", "selectOne", "(", "title", ",", "new", "String", "[", "]", "{", "\"Yes\"", "...
Gets a boolean from the System.in @param title for the command line @return boolean as selected by the user of the console app
[ "Gets", "a", "boolean", "from", "the", "System", ".", "in" ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/console/ConsoleMenu.java#L244-L249
aoindustries/ao-taglib
src/main/java/com/aoindustries/taglib/AttributeUtils.java
AttributeUtils.resolveValue
public static <T> T resolveValue(Object value, Class<T> type, ELContext elContext) { if(value == null) { return null; } else if(value instanceof ValueExpression) { return resolveValue((ValueExpression)value, type, elContext); } else { return type.cast(value); } }
java
public static <T> T resolveValue(Object value, Class<T> type, ELContext elContext) { if(value == null) { return null; } else if(value instanceof ValueExpression) { return resolveValue((ValueExpression)value, type, elContext); } else { return type.cast(value); } }
[ "public", "static", "<", "T", ">", "T", "resolveValue", "(", "Object", "value", ",", "Class", "<", "T", ">", "type", ",", "ELContext", "elContext", ")", "{", "if", "(", "value", "==", "null", ")", "{", "return", "null", ";", "}", "else", "if", "(",...
Casts or evaluates an expression then casts to the provided type.
[ "Casts", "or", "evaluates", "an", "expression", "then", "casts", "to", "the", "provided", "type", "." ]
train
https://github.com/aoindustries/ao-taglib/blob/5670eba8485196bd42d31d3ff09a42deacb025f8/src/main/java/com/aoindustries/taglib/AttributeUtils.java#L61-L69
eclipse/xtext-extras
org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java
JvmTypesBuilder.newTypeRef
@Deprecated public JvmTypeReference newTypeRef(EObject ctx, Class<?> clazz, JvmTypeReference... typeArgs) { return references.getTypeForName(clazz, ctx, typeArgs); }
java
@Deprecated public JvmTypeReference newTypeRef(EObject ctx, Class<?> clazz, JvmTypeReference... typeArgs) { return references.getTypeForName(clazz, ctx, typeArgs); }
[ "@", "Deprecated", "public", "JvmTypeReference", "newTypeRef", "(", "EObject", "ctx", ",", "Class", "<", "?", ">", "clazz", ",", "JvmTypeReference", "...", "typeArgs", ")", "{", "return", "references", ".", "getTypeForName", "(", "clazz", ",", "ctx", ",", "t...
Creates a new {@link JvmTypeReference} pointing to the given class and containing the given type arguments. @param ctx an EMF context, which is used to look up the {@link org.eclipse.xtext.common.types.JvmType} for the given clazz. @param clazz the class the type reference shall point to. @param typeArgs type arguments @return the newly created {@link JvmTypeReference} @deprecated use {@link JvmTypeReferenceBuilder#typeRef(Class, JvmTypeReference...)}
[ "Creates", "a", "new", "{", "@link", "JvmTypeReference", "}", "pointing", "to", "the", "given", "class", "and", "containing", "the", "given", "type", "arguments", "." ]
train
https://github.com/eclipse/xtext-extras/blob/451359541295323a29f5855e633f770cec02069a/org.eclipse.xtext.xbase/src/org/eclipse/xtext/xbase/jvmmodel/JvmTypesBuilder.java#L1298-L1301
codeprimate-software/cp-elements
src/main/java/org/cp/elements/lang/RunnableUtils.java
RunnableUtils.runWithSleep
public static boolean runWithSleep(long milliseconds, Runnable runnable) { Assert.isTrue(milliseconds > 0, "Milliseconds [%d] must be greater than 0", milliseconds); runnable.run(); return ThreadUtils.sleep(milliseconds, 0); }
java
public static boolean runWithSleep(long milliseconds, Runnable runnable) { Assert.isTrue(milliseconds > 0, "Milliseconds [%d] must be greater than 0", milliseconds); runnable.run(); return ThreadUtils.sleep(milliseconds, 0); }
[ "public", "static", "boolean", "runWithSleep", "(", "long", "milliseconds", ",", "Runnable", "runnable", ")", "{", "Assert", ".", "isTrue", "(", "milliseconds", ">", "0", ",", "\"Milliseconds [%d] must be greater than 0\"", ",", "milliseconds", ")", ";", "runnable",...
Runs the given {@link Runnable} object and then causes the current, calling {@link Thread} to sleep for the given number of milliseconds. This utility method can be used to simulate a long running, expensive operation. @param milliseconds a long value with the number of milliseconds for the current {@link Thread} to sleep. @param runnable {@link Runnable} object to run; must not be {@literal null}. @return a boolean value indicating whether the {@link Runnable} ran successfully and whether the current {@link Thread} slept for the given number of milliseconds. @throws IllegalArgumentException if milliseconds is less than equal to 0. @see org.cp.elements.lang.concurrent.ThreadUtils#sleep(long, int) @see java.lang.Runnable#run()
[ "Runs", "the", "given", "{", "@link", "Runnable", "}", "object", "and", "then", "causes", "the", "current", "calling", "{", "@link", "Thread", "}", "to", "sleep", "for", "the", "given", "number", "of", "milliseconds", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/lang/RunnableUtils.java#L50-L57
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFolder.java
BoxApiFolder.getAddToCollectionRequest
public BoxRequestsFolder.AddFolderToCollection getAddToCollectionRequest(String folderId, String collectionId) { BoxRequestsFolder.AddFolderToCollection request = new BoxRequestsFolder.AddFolderToCollection(folderId, collectionId, getFolderInfoUrl(folderId), mSession); return request; }
java
public BoxRequestsFolder.AddFolderToCollection getAddToCollectionRequest(String folderId, String collectionId) { BoxRequestsFolder.AddFolderToCollection request = new BoxRequestsFolder.AddFolderToCollection(folderId, collectionId, getFolderInfoUrl(folderId), mSession); return request; }
[ "public", "BoxRequestsFolder", ".", "AddFolderToCollection", "getAddToCollectionRequest", "(", "String", "folderId", ",", "String", "collectionId", ")", "{", "BoxRequestsFolder", ".", "AddFolderToCollection", "request", "=", "new", "BoxRequestsFolder", ".", "AddFolderToColl...
Gets a request that adds a folder to a collection @param folderId id of folder to add to collection @param collectionId id of collection to add the folder to @return request to add a folder to a collection
[ "Gets", "a", "request", "that", "adds", "a", "folder", "to", "a", "collection" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFolder.java#L228-L231
looly/hutool
hutool-json/src/main/java/cn/hutool/json/JSONUtil.java
JSONUtil.toBean
public static <T> T toBean(String jsonString, Class<T> beanClass) { return toBean(parseObj(jsonString), beanClass); }
java
public static <T> T toBean(String jsonString, Class<T> beanClass) { return toBean(parseObj(jsonString), beanClass); }
[ "public", "static", "<", "T", ">", "T", "toBean", "(", "String", "jsonString", ",", "Class", "<", "T", ">", "beanClass", ")", "{", "return", "toBean", "(", "parseObj", "(", "jsonString", ")", ",", "beanClass", ")", ";", "}" ]
JSON字符串转为实体类对象,转换异常将被抛出 @param <T> Bean类型 @param jsonString JSON字符串 @param beanClass 实体类对象 @return 实体类对象 @since 3.1.2
[ "JSON字符串转为实体类对象,转换异常将被抛出" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-json/src/main/java/cn/hutool/json/JSONUtil.java#L330-L332
Ordinastie/MalisisCore
src/main/java/net/malisis/core/asm/AsmUtils.java
AsmUtils.changeFieldAccess
public static Field changeFieldAccess(Class<?> clazz, String fieldName) { return changeFieldAccess(clazz, fieldName, fieldName, false); }
java
public static Field changeFieldAccess(Class<?> clazz, String fieldName) { return changeFieldAccess(clazz, fieldName, fieldName, false); }
[ "public", "static", "Field", "changeFieldAccess", "(", "Class", "<", "?", ">", "clazz", ",", "String", "fieldName", ")", "{", "return", "changeFieldAccess", "(", "clazz", ",", "fieldName", ",", "fieldName", ",", "false", ")", ";", "}" ]
Changes the access level for the specified field for a class. @param clazz the clazz @param fieldName the field name @return the field
[ "Changes", "the", "access", "level", "for", "the", "specified", "field", "for", "a", "class", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/asm/AsmUtils.java#L312-L315
biojava/biojava
biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java
ProfeatProperties.getTransition
public static double getTransition(ProteinSequence sequence, ATTRIBUTE attribute, TRANSITION transition) throws Exception{ return new ProfeatPropertiesImpl().getTransition(sequence, attribute, transition); }
java
public static double getTransition(ProteinSequence sequence, ATTRIBUTE attribute, TRANSITION transition) throws Exception{ return new ProfeatPropertiesImpl().getTransition(sequence, attribute, transition); }
[ "public", "static", "double", "getTransition", "(", "ProteinSequence", "sequence", ",", "ATTRIBUTE", "attribute", ",", "TRANSITION", "transition", ")", "throws", "Exception", "{", "return", "new", "ProfeatPropertiesImpl", "(", ")", ".", "getTransition", "(", "sequen...
An adaptor method which returns the number of transition between the specified groups for the given attribute with respect to the length of sequence. @param sequence a protein sequence consisting of non-ambiguous characters only @param attribute one of the seven attributes (Hydrophobicity, Volume, Polarity, Polarizability, Charge, SecondaryStructure or SolventAccessibility) @param transition the interested transition between the groups @return returns the number of transition between the specified groups for the given attribute with respect to the length of sequence. @throws Exception throws Exception if attribute or group are unknown
[ "An", "adaptor", "method", "which", "returns", "the", "number", "of", "transition", "between", "the", "specified", "groups", "for", "the", "given", "attribute", "with", "respect", "to", "the", "length", "of", "sequence", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-aa-prop/src/main/java/org/biojava/nbio/aaproperties/profeat/ProfeatProperties.java#L94-L96
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/StateAssignmentOperation.java
StateAssignmentOperation.checkParallelismPreconditions
private static void checkParallelismPreconditions(OperatorState operatorState, ExecutionJobVertex executionJobVertex) { //----------------------------------------max parallelism preconditions------------------------------------- if (operatorState.getMaxParallelism() < executionJobVertex.getParallelism()) { throw new IllegalStateException("The state for task " + executionJobVertex.getJobVertexId() + " can not be restored. The maximum parallelism (" + operatorState.getMaxParallelism() + ") of the restored state is lower than the configured parallelism (" + executionJobVertex.getParallelism() + "). Please reduce the parallelism of the task to be lower or equal to the maximum parallelism." ); } // check that the number of key groups have not changed or if we need to override it to satisfy the restored state if (operatorState.getMaxParallelism() != executionJobVertex.getMaxParallelism()) { if (!executionJobVertex.isMaxParallelismConfigured()) { // if the max parallelism was not explicitly specified by the user, we derive it from the state LOG.debug("Overriding maximum parallelism for JobVertex {} from {} to {}", executionJobVertex.getJobVertexId(), executionJobVertex.getMaxParallelism(), operatorState.getMaxParallelism()); executionJobVertex.setMaxParallelism(operatorState.getMaxParallelism()); } else { // if the max parallelism was explicitly specified, we complain on mismatch throw new IllegalStateException("The maximum parallelism (" + operatorState.getMaxParallelism() + ") with which the latest " + "checkpoint of the execution job vertex " + executionJobVertex + " has been taken and the current maximum parallelism (" + executionJobVertex.getMaxParallelism() + ") changed. This " + "is currently not supported."); } } }
java
private static void checkParallelismPreconditions(OperatorState operatorState, ExecutionJobVertex executionJobVertex) { //----------------------------------------max parallelism preconditions------------------------------------- if (operatorState.getMaxParallelism() < executionJobVertex.getParallelism()) { throw new IllegalStateException("The state for task " + executionJobVertex.getJobVertexId() + " can not be restored. The maximum parallelism (" + operatorState.getMaxParallelism() + ") of the restored state is lower than the configured parallelism (" + executionJobVertex.getParallelism() + "). Please reduce the parallelism of the task to be lower or equal to the maximum parallelism." ); } // check that the number of key groups have not changed or if we need to override it to satisfy the restored state if (operatorState.getMaxParallelism() != executionJobVertex.getMaxParallelism()) { if (!executionJobVertex.isMaxParallelismConfigured()) { // if the max parallelism was not explicitly specified by the user, we derive it from the state LOG.debug("Overriding maximum parallelism for JobVertex {} from {} to {}", executionJobVertex.getJobVertexId(), executionJobVertex.getMaxParallelism(), operatorState.getMaxParallelism()); executionJobVertex.setMaxParallelism(operatorState.getMaxParallelism()); } else { // if the max parallelism was explicitly specified, we complain on mismatch throw new IllegalStateException("The maximum parallelism (" + operatorState.getMaxParallelism() + ") with which the latest " + "checkpoint of the execution job vertex " + executionJobVertex + " has been taken and the current maximum parallelism (" + executionJobVertex.getMaxParallelism() + ") changed. This " + "is currently not supported."); } } }
[ "private", "static", "void", "checkParallelismPreconditions", "(", "OperatorState", "operatorState", ",", "ExecutionJobVertex", "executionJobVertex", ")", "{", "//----------------------------------------max parallelism preconditions-------------------------------------", "if", "(", "op...
Verifies conditions in regards to parallelism and maxParallelism that must be met when restoring state. @param operatorState state to restore @param executionJobVertex task for which the state should be restored
[ "Verifies", "conditions", "in", "regards", "to", "parallelism", "and", "maxParallelism", "that", "must", "be", "met", "when", "restoring", "state", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/checkpoint/StateAssignmentOperation.java#L510-L541
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java
ApplicationGatewaysInner.beginUpdateTags
public ApplicationGatewayInner beginUpdateTags(String resourceGroupName, String applicationGatewayName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().single().body(); }
java
public ApplicationGatewayInner beginUpdateTags(String resourceGroupName, String applicationGatewayName) { return beginUpdateTagsWithServiceResponseAsync(resourceGroupName, applicationGatewayName).toBlocking().single().body(); }
[ "public", "ApplicationGatewayInner", "beginUpdateTags", "(", "String", "resourceGroupName", ",", "String", "applicationGatewayName", ")", "{", "return", "beginUpdateTagsWithServiceResponseAsync", "(", "resourceGroupName", ",", "applicationGatewayName", ")", ".", "toBlocking", ...
Updates the specified application gateway tags. @param resourceGroupName The name of the resource group. @param applicationGatewayName The name of the application gateway. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ApplicationGatewayInner object if successful.
[ "Updates", "the", "specified", "application", "gateway", "tags", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ApplicationGatewaysInner.java#L716-L718
OpenLiberty/open-liberty
dev/com.ibm.ws.jdbc.management.j2ee/src/com/ibm/ws/jdbc/management/j2ee/internal/JDBCResourceMBeanImpl.java
JDBCResourceMBeanImpl.setDataSourceChild
protected JDBCDataSourceMBeanImpl setDataSourceChild(String key, JDBCDataSourceMBeanImpl ds) { return dataSourceMBeanChildrenList.put(key, ds); }
java
protected JDBCDataSourceMBeanImpl setDataSourceChild(String key, JDBCDataSourceMBeanImpl ds) { return dataSourceMBeanChildrenList.put(key, ds); }
[ "protected", "JDBCDataSourceMBeanImpl", "setDataSourceChild", "(", "String", "key", ",", "JDBCDataSourceMBeanImpl", "ds", ")", "{", "return", "dataSourceMBeanChildrenList", ".", "put", "(", "key", ",", "ds", ")", ";", "}" ]
setDataSourceChild add a child of type JDBCDataSourceMBeanImpl to this MBean. @param key the String value which will be used as the key for the JDBCDataSourceMBeanImpl item @param ds the JDBCDataSourceMBeanImpl value to be associated with the specified key @return The previous value associated with key, or null if there was no mapping for key. (A null return can also indicate that the map previously associated null with key.)
[ "setDataSourceChild", "add", "a", "child", "of", "type", "JDBCDataSourceMBeanImpl", "to", "this", "MBean", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc.management.j2ee/src/com/ibm/ws/jdbc/management/j2ee/internal/JDBCResourceMBeanImpl.java#L234-L236
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/impl/common/DefaultFileCopierUtil.java
DefaultFileCopierUtil.writeTempFile
@Override public File writeTempFile( ExecutionContext context, File original, InputStream input, String script ) throws FileCopierException { File tempfile = null; try { tempfile = ScriptfileUtils.createTempFile(context.getFramework()); } catch (IOException e) { throw new FileCopierException("error writing to tempfile: " + e.getMessage(), StepFailureReason.IOFailure, e); } return writeLocalFile(original, input, script, tempfile); }
java
@Override public File writeTempFile( ExecutionContext context, File original, InputStream input, String script ) throws FileCopierException { File tempfile = null; try { tempfile = ScriptfileUtils.createTempFile(context.getFramework()); } catch (IOException e) { throw new FileCopierException("error writing to tempfile: " + e.getMessage(), StepFailureReason.IOFailure, e); } return writeLocalFile(original, input, script, tempfile); }
[ "@", "Override", "public", "File", "writeTempFile", "(", "ExecutionContext", "context", ",", "File", "original", ",", "InputStream", "input", ",", "String", "script", ")", "throws", "FileCopierException", "{", "File", "tempfile", "=", "null", ";", "try", "{", ...
Write the file, stream, or text to a local temp file and return the file @param context context @param original source file, or null @param input source inputstream or null @param script source text, or null @return temp file, this file should later be cleaned up by calling {@link com.dtolabs.rundeck.core.execution.script.ScriptfileUtils#releaseTempFile(java.io.File)} @throws FileCopierException if IOException occurs
[ "Write", "the", "file", "stream", "or", "text", "to", "a", "local", "temp", "file", "and", "return", "the", "file" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/impl/common/DefaultFileCopierUtil.java#L427-L440
MGunlogson/CuckooFilter4J
src/main/java/com/github/mgunlogson/cuckoofilter4j/RamUsageEstimator.java
RamUsageEstimator.humanReadableUnits
static String humanReadableUnits(long bytes) { return humanReadableUnits(bytes, new DecimalFormat("0.#", DecimalFormatSymbols.getInstance(Locale.ROOT))); }
java
static String humanReadableUnits(long bytes) { return humanReadableUnits(bytes, new DecimalFormat("0.#", DecimalFormatSymbols.getInstance(Locale.ROOT))); }
[ "static", "String", "humanReadableUnits", "(", "long", "bytes", ")", "{", "return", "humanReadableUnits", "(", "bytes", ",", "new", "DecimalFormat", "(", "\"0.#\"", ",", "DecimalFormatSymbols", ".", "getInstance", "(", "Locale", ".", "ROOT", ")", ")", ")", ";"...
Returns <code>size</code> in human-readable units (GB, MB, KB or bytes).
[ "Returns", "<code", ">", "size<", "/", "code", ">", "in", "human", "-", "readable", "units", "(", "GB", "MB", "KB", "or", "bytes", ")", "." ]
train
https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/RamUsageEstimator.java#L386-L389
atomix/atomix
core/src/main/java/io/atomix/core/registry/ClasspathScanningRegistry.java
ClasspathScanningRegistry.newInstance
@SuppressWarnings("unchecked") private static <T> T newInstance(Class<?> type) { try { return (T) type.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ServiceException("Cannot instantiate service class " + type, e); } }
java
@SuppressWarnings("unchecked") private static <T> T newInstance(Class<?> type) { try { return (T) type.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ServiceException("Cannot instantiate service class " + type, e); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "static", "<", "T", ">", "T", "newInstance", "(", "Class", "<", "?", ">", "type", ")", "{", "try", "{", "return", "(", "T", ")", "type", ".", "newInstance", "(", ")", ";", "}", "catch", ...
Instantiates the given type using a no-argument constructor. @param type the type to instantiate @param <T> the generic type @return the instantiated object @throws ServiceException if the type cannot be instantiated
[ "Instantiates", "the", "given", "type", "using", "a", "no", "-", "argument", "constructor", "." ]
train
https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/core/src/main/java/io/atomix/core/registry/ClasspathScanningRegistry.java#L128-L135
phax/ph-masterdata
ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java
CurrencyHelper.parseValueFormat
@Nullable public static BigDecimal parseValueFormat (@Nullable final ECurrency eCurrency, @Nullable final String sTextValue, @Nullable final BigDecimal aDefault) { final PerCurrencySettings aPCS = getSettings (eCurrency); final DecimalFormat aValueFormat = aPCS.getValueFormat (); // Adopt the decimal separator final String sRealTextValue; // In Java 9 onwards, this the separators may be null (e.g. for AED) if (aPCS.getDecimalSeparator () != null && aPCS.getGroupingSeparator () != null) sRealTextValue = _getTextValueForDecimalSeparator (sTextValue, aPCS.getDecimalSeparator (), aPCS.getGroupingSeparator ()); else sRealTextValue = sTextValue; return parseCurrency (sRealTextValue, aValueFormat, aDefault, aPCS.getRoundingMode ()); }
java
@Nullable public static BigDecimal parseValueFormat (@Nullable final ECurrency eCurrency, @Nullable final String sTextValue, @Nullable final BigDecimal aDefault) { final PerCurrencySettings aPCS = getSettings (eCurrency); final DecimalFormat aValueFormat = aPCS.getValueFormat (); // Adopt the decimal separator final String sRealTextValue; // In Java 9 onwards, this the separators may be null (e.g. for AED) if (aPCS.getDecimalSeparator () != null && aPCS.getGroupingSeparator () != null) sRealTextValue = _getTextValueForDecimalSeparator (sTextValue, aPCS.getDecimalSeparator (), aPCS.getGroupingSeparator ()); else sRealTextValue = sTextValue; return parseCurrency (sRealTextValue, aValueFormat, aDefault, aPCS.getRoundingMode ()); }
[ "@", "Nullable", "public", "static", "BigDecimal", "parseValueFormat", "(", "@", "Nullable", "final", "ECurrency", "eCurrency", ",", "@", "Nullable", "final", "String", "sTextValue", ",", "@", "Nullable", "final", "BigDecimal", "aDefault", ")", "{", "final", "Pe...
Try to parse a string value formatted by the {@link DecimalFormat} object returned from {@link #getValueFormat(ECurrency)} @param eCurrency The currency it is about. If <code>null</code> is provided {@link #DEFAULT_CURRENCY} is used instead. @param sTextValue The string value. It will be trimmed, and the decimal separator will be adopted. @param aDefault The default value to be used in case parsing fails. May be <code>null</code>. @return The {@link BigDecimal} value matching the string value or the passed default value.
[ "Try", "to", "parse", "a", "string", "value", "formatted", "by", "the", "{", "@link", "DecimalFormat", "}", "object", "returned", "from", "{", "@link", "#getValueFormat", "(", "ECurrency", ")", "}" ]
train
https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/currency/CurrencyHelper.java#L528-L546
jeremylong/DependencyCheck
utils/src/main/java/org/owasp/dependencycheck/utils/ExpectedObjectInputStream.java
ExpectedObjectInputStream.resolveClass
@Override protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { if (!this.expected.contains(desc.getName())) { throw new InvalidClassException("Unexpected deserialization ", desc.getName()); } return super.resolveClass(desc); }
java
@Override protected Class<?> resolveClass(ObjectStreamClass desc) throws IOException, ClassNotFoundException { if (!this.expected.contains(desc.getName())) { throw new InvalidClassException("Unexpected deserialization ", desc.getName()); } return super.resolveClass(desc); }
[ "@", "Override", "protected", "Class", "<", "?", ">", "resolveClass", "(", "ObjectStreamClass", "desc", ")", "throws", "IOException", ",", "ClassNotFoundException", "{", "if", "(", "!", "this", ".", "expected", ".", "contains", "(", "desc", ".", "getName", "...
{@inheritDoc} Only deserialize instances of expected classes by validating the class name prior to deserialization.
[ "{", "@inheritDoc", "}" ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/utils/src/main/java/org/owasp/dependencycheck/utils/ExpectedObjectInputStream.java#L61-L67
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/LayerValidation.java
LayerValidation.assertNInNOutSet
public static void assertNInNOutSet(String layerType, String layerName, long layerIndex, long nIn, long nOut) { if (nIn <= 0 || nOut <= 0) { if (layerName == null) layerName = "(name not set)"; throw new DL4JInvalidConfigException(layerType + " (index=" + layerIndex + ", name=" + layerName + ") nIn=" + nIn + ", nOut=" + nOut + "; nIn and nOut must be > 0"); } }
java
public static void assertNInNOutSet(String layerType, String layerName, long layerIndex, long nIn, long nOut) { if (nIn <= 0 || nOut <= 0) { if (layerName == null) layerName = "(name not set)"; throw new DL4JInvalidConfigException(layerType + " (index=" + layerIndex + ", name=" + layerName + ") nIn=" + nIn + ", nOut=" + nOut + "; nIn and nOut must be > 0"); } }
[ "public", "static", "void", "assertNInNOutSet", "(", "String", "layerType", ",", "String", "layerName", ",", "long", "layerIndex", ",", "long", "nIn", ",", "long", "nOut", ")", "{", "if", "(", "nIn", "<=", "0", "||", "nOut", "<=", "0", ")", "{", "if", ...
Asserts that the layer nIn and nOut values are set for the layer @param layerType Type of layer ("DenseLayer", etc) @param layerName Name of the layer (may be null if not set) @param layerIndex Index of the layer @param nIn nIn value @param nOut nOut value
[ "Asserts", "that", "the", "layer", "nIn", "and", "nOut", "values", "are", "set", "for", "the", "layer" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/conf/layers/LayerValidation.java#L50-L57
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java
ImplicitObjectUtil.loadOutputFormBean
public static void loadOutputFormBean(ServletRequest request, Object bean) { if(bean != null) request.setAttribute(OUTPUT_FORM_BEAN_OBJECT_KEY, bean); }
java
public static void loadOutputFormBean(ServletRequest request, Object bean) { if(bean != null) request.setAttribute(OUTPUT_FORM_BEAN_OBJECT_KEY, bean); }
[ "public", "static", "void", "loadOutputFormBean", "(", "ServletRequest", "request", ",", "Object", "bean", ")", "{", "if", "(", "bean", "!=", "null", ")", "request", ".", "setAttribute", "(", "OUTPUT_FORM_BEAN_OBJECT_KEY", ",", "bean", ")", ";", "}" ]
Load the output form bean into the request. @param request the request @param bean the output form bean
[ "Load", "the", "output", "form", "bean", "into", "the", "request", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/script/common/ImplicitObjectUtil.java#L165-L168
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/XMLJaspiConfiguration.java
XMLJaspiConfiguration.writeConfigFile
synchronized private void writeConfigFile(final JaspiConfig jaspiConfig) { if (tc.isEntryEnabled()) Tr.entry(tc, "writeConfigFile", new Object[] { jaspiConfig }); if (configFile == null) { // TODO handle persistence //String msg = MessageFormatHelper.getFormattedMessage(msgBundle, AdminConstants.MSG_JASPI_PERSISTENT_FILE, new Object[] { PersistenceManager.JASPI_CONFIG }); //throw new RuntimeException(msg); } PrivilegedExceptionAction<Object> marshalFile = new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { JAXBContext jc = JAXBContext.newInstance(JaspiConfig.class); Marshaller writer = jc.createMarshaller(); writer.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); writer.marshal(jaspiConfig, configFile); return null; } }; try { AccessController.doPrivileged(marshalFile); } catch (PrivilegedActionException e) { FFDCFilter.processException(e, this.getClass().getName() + ".writeConfigFile", "290", this); throw new RuntimeException("Unable to write " + configFile, e); } if (tc.isEntryEnabled()) Tr.exit(tc, "writeConfigFile"); }
java
synchronized private void writeConfigFile(final JaspiConfig jaspiConfig) { if (tc.isEntryEnabled()) Tr.entry(tc, "writeConfigFile", new Object[] { jaspiConfig }); if (configFile == null) { // TODO handle persistence //String msg = MessageFormatHelper.getFormattedMessage(msgBundle, AdminConstants.MSG_JASPI_PERSISTENT_FILE, new Object[] { PersistenceManager.JASPI_CONFIG }); //throw new RuntimeException(msg); } PrivilegedExceptionAction<Object> marshalFile = new PrivilegedExceptionAction<Object>() { @Override public Object run() throws Exception { JAXBContext jc = JAXBContext.newInstance(JaspiConfig.class); Marshaller writer = jc.createMarshaller(); writer.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE); writer.marshal(jaspiConfig, configFile); return null; } }; try { AccessController.doPrivileged(marshalFile); } catch (PrivilegedActionException e) { FFDCFilter.processException(e, this.getClass().getName() + ".writeConfigFile", "290", this); throw new RuntimeException("Unable to write " + configFile, e); } if (tc.isEntryEnabled()) Tr.exit(tc, "writeConfigFile"); }
[ "synchronized", "private", "void", "writeConfigFile", "(", "final", "JaspiConfig", "jaspiConfig", ")", "{", "if", "(", "tc", ".", "isEntryEnabled", "(", ")", ")", "Tr", ".", "entry", "(", "tc", ",", "\"writeConfigFile\"", ",", "new", "Object", "[", "]", "{...
Store the in-memory Java representation of the JASPI persistent providers into the given configuration file. @param jaspiConfig @throws RuntimeException if an exception occurs in method AccessController.doPrivileged.
[ "Store", "the", "in", "-", "memory", "Java", "representation", "of", "the", "JASPI", "persistent", "providers", "into", "the", "given", "configuration", "file", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jaspic/src/com/ibm/ws/security/jaspi/XMLJaspiConfiguration.java#L290-L317
d-michail/jheaps
src/main/java/org/jheaps/tree/ReflectedHeap.java
ReflectedHeap.decreaseKey
@SuppressWarnings("unchecked") private void decreaseKey(ReflectedHandle<K, V> n, K newKey) { if (n.inner == null && free != n) { throw new IllegalArgumentException("Invalid handle!"); } int c; if (comparator == null) { c = ((Comparable<? super K>) newKey).compareTo(n.key); } else { c = comparator.compare(newKey, n.key); } if (c > 0) { throw new IllegalArgumentException("Keys can only be decreased!"); } n.key = newKey; if (c == 0 || free == n) { return; } // actual decrease AddressableHeap.Handle<K, HandleMap<K, V>> nInner = n.inner; if (n.minNotMax) { // we are in the min heap, easy case n.inner.decreaseKey(newKey); } else { // we are in the max heap, remove nInner.delete(); ReflectedHandle<K, V> nOuter = nInner.getValue().outer; nOuter.inner = null; nOuter.minNotMax = false; // remove min AddressableHeap.Handle<K, HandleMap<K, V>> minInner = nInner.getValue().otherInner; ReflectedHandle<K, V> minOuter = minInner.getValue().outer; minInner.delete(); minOuter.inner = null; minOuter.minNotMax = false; // update key nOuter.key = newKey; // reinsert both insertPair(nOuter, minOuter); } }
java
@SuppressWarnings("unchecked") private void decreaseKey(ReflectedHandle<K, V> n, K newKey) { if (n.inner == null && free != n) { throw new IllegalArgumentException("Invalid handle!"); } int c; if (comparator == null) { c = ((Comparable<? super K>) newKey).compareTo(n.key); } else { c = comparator.compare(newKey, n.key); } if (c > 0) { throw new IllegalArgumentException("Keys can only be decreased!"); } n.key = newKey; if (c == 0 || free == n) { return; } // actual decrease AddressableHeap.Handle<K, HandleMap<K, V>> nInner = n.inner; if (n.minNotMax) { // we are in the min heap, easy case n.inner.decreaseKey(newKey); } else { // we are in the max heap, remove nInner.delete(); ReflectedHandle<K, V> nOuter = nInner.getValue().outer; nOuter.inner = null; nOuter.minNotMax = false; // remove min AddressableHeap.Handle<K, HandleMap<K, V>> minInner = nInner.getValue().otherInner; ReflectedHandle<K, V> minOuter = minInner.getValue().outer; minInner.delete(); minOuter.inner = null; minOuter.minNotMax = false; // update key nOuter.key = newKey; // reinsert both insertPair(nOuter, minOuter); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "void", "decreaseKey", "(", "ReflectedHandle", "<", "K", ",", "V", ">", "n", ",", "K", "newKey", ")", "{", "if", "(", "n", ".", "inner", "==", "null", "&&", "free", "!=", "n", ")", "{", ...
Decrease the key of an element. @param n the element @param newKey the new key
[ "Decrease", "the", "key", "of", "an", "element", "." ]
train
https://github.com/d-michail/jheaps/blob/7146451dd6591c2a8559dc564c9c40428c4a2c10/src/main/java/org/jheaps/tree/ReflectedHeap.java#L587-L632
otto-de/edison-hal
src/main/java/de/otto/edison/hal/traverson/Traverson.java
Traverson.streamAs
public <T extends HalRepresentation> Stream<T> streamAs(final Class<T> type) throws IOException { return streamAs(type, null); }
java
public <T extends HalRepresentation> Stream<T> streamAs(final Class<T> type) throws IOException { return streamAs(type, null); }
[ "public", "<", "T", "extends", "HalRepresentation", ">", "Stream", "<", "T", ">", "streamAs", "(", "final", "Class", "<", "T", ">", "type", ")", "throws", "IOException", "{", "return", "streamAs", "(", "type", ",", "null", ")", ";", "}" ]
Follow the {@link Link}s of the current resource, selected by its link-relation type and returns a {@link Stream} containing the returned {@link HalRepresentation HalRepresentations}. <p> Templated links are expanded to URIs using the specified template variables. </p> <p> If the current node has {@link Embedded embedded} items with the specified {@code rel}, these items are used instead of resolving the associated {@link Link}. </p> @param type the specific type of the returned HalRepresentations @param <T> type of the returned HalRepresentations @return this @throws IOException if a low-level I/O problem (unexpected end-of-input, network error) occurs. @throws JsonParseException if the json document can not be parsed by Jackson's ObjectMapper @throws JsonMappingException if the input JSON structure can not be mapped to the specified HalRepresentation type @since 1.0.0
[ "Follow", "the", "{" ]
train
https://github.com/otto-de/edison-hal/blob/1582d2b49d1f0d9103e03bf742f18afa9d166992/src/main/java/de/otto/edison/hal/traverson/Traverson.java#L1004-L1006
ksclarke/freelib-utils
src/main/java/info/freelibrary/util/LoggerFactory.java
LoggerFactory.getLogger
public static Logger getLogger(final Class<?> aClass, final String aBundleName) { return getLogger(aClass.getName(), aBundleName); }
java
public static Logger getLogger(final Class<?> aClass, final String aBundleName) { return getLogger(aClass.getName(), aBundleName); }
[ "public", "static", "Logger", "getLogger", "(", "final", "Class", "<", "?", ">", "aClass", ",", "final", "String", "aBundleName", ")", "{", "return", "getLogger", "(", "aClass", ".", "getName", "(", ")", ",", "aBundleName", ")", ";", "}" ]
Gets an {@link XMLResourceBundle} wrapped SLF4J {@link org.slf4j.Logger}. @param aClass A class to use for the logger name @param aBundleName The name of the resource bundle to use @return A resource bundle aware logger
[ "Gets", "an", "{", "@link", "XMLResourceBundle", "}", "wrapped", "SLF4J", "{", "@link", "org", ".", "slf4j", ".", "Logger", "}", "." ]
train
https://github.com/ksclarke/freelib-utils/blob/54e822ae4c11b3d74793fd82a1a535ffafffaf45/src/main/java/info/freelibrary/util/LoggerFactory.java#L43-L45
ziccardi/jnrpe
jnrpe-lib/src/main/java/it/jnrpe/plugins/PluginBase.java
PluginBase.configureThresholdEvaluatorBuilder
protected void configureThresholdEvaluatorBuilder(final ThresholdsEvaluatorBuilder thrb, final ICommandLine cl) throws BadThresholdException { if (cl.hasOption("th")) { for (Object obj : cl.getOptionValues("th")) { thrb.withThreshold(obj.toString()); } } }
java
protected void configureThresholdEvaluatorBuilder(final ThresholdsEvaluatorBuilder thrb, final ICommandLine cl) throws BadThresholdException { if (cl.hasOption("th")) { for (Object obj : cl.getOptionValues("th")) { thrb.withThreshold(obj.toString()); } } }
[ "protected", "void", "configureThresholdEvaluatorBuilder", "(", "final", "ThresholdsEvaluatorBuilder", "thrb", ",", "final", "ICommandLine", "cl", ")", "throws", "BadThresholdException", "{", "if", "(", "cl", ".", "hasOption", "(", "\"th\"", ")", ")", "{", "for", ...
Override this method if you don't use the new threshold syntax. Here you must tell the threshold evaluator all the threshold it must be able to evaluate. Give a look at the source of the CheckOracle plugin for an example of a plugin that supports both old and new syntax. @param thrb The {@link ThresholdsEvaluatorBuilder} object to be configured @param cl The command line @throws BadThresholdException -
[ "Override", "this", "method", "if", "you", "don", "t", "use", "the", "new", "threshold", "syntax", ".", "Here", "you", "must", "tell", "the", "threshold", "evaluator", "all", "the", "threshold", "it", "must", "be", "able", "to", "evaluate", ".", "Give", ...
train
https://github.com/ziccardi/jnrpe/blob/ac9046355851136994388442b01ba4063305f9c4/jnrpe-lib/src/main/java/it/jnrpe/plugins/PluginBase.java#L81-L87
kiswanij/jk-util
src/main/java/com/jk/util/JKConversionUtil.java
JKConversionUtil.toDouble
public static double toDouble(Object value, double defaultValue) { if (value == null || value.toString().trim().equals("")) { return defaultValue; } if (value instanceof Double) { return (double) value; } if (value instanceof Date) { final Date date = (Date) value; return date.getTime(); } return Double.parseDouble(value.toString()); }
java
public static double toDouble(Object value, double defaultValue) { if (value == null || value.toString().trim().equals("")) { return defaultValue; } if (value instanceof Double) { return (double) value; } if (value instanceof Date) { final Date date = (Date) value; return date.getTime(); } return Double.parseDouble(value.toString()); }
[ "public", "static", "double", "toDouble", "(", "Object", "value", ",", "double", "defaultValue", ")", "{", "if", "(", "value", "==", "null", "||", "value", ".", "toString", "(", ")", ".", "trim", "(", ")", ".", "equals", "(", "\"\"", ")", ")", "{", ...
To double. @param value the value @param defaultValue the default value @return the double
[ "To", "double", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/JKConversionUtil.java#L158-L170
foundation-runtime/logging
logging-log4j/src/main/java/com/cisco/oss/foundation/logging/LoggingHelper.java
LoggingHelper.warn
public static void warn(final Logger logger, final String format, final Object... params) { warn(logger, format, null, params); }
java
public static void warn(final Logger logger, final String format, final Object... params) { warn(logger, format, null, params); }
[ "public", "static", "void", "warn", "(", "final", "Logger", "logger", ",", "final", "String", "format", ",", "final", "Object", "...", "params", ")", "{", "warn", "(", "logger", ",", "format", ",", "null", ",", "params", ")", ";", "}" ]
log message using the String.format API @param logger the logger that will be used to log the message @param format the format string (the template string) @param params the parameters to be formatted into it the string format
[ "log", "message", "using", "the", "String", ".", "format", "API" ]
train
https://github.com/foundation-runtime/logging/blob/cd0a07b3c5b458ecf90ab92a1e0c72a067f5cbd6/logging-log4j/src/main/java/com/cisco/oss/foundation/logging/LoggingHelper.java#L262-L264
jeremylong/DependencyCheck
maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java
BaseDependencyCheckMojo.scanArtifacts
protected ExceptionCollection scanArtifacts(MavenProject project, Engine engine, boolean aggregate) { try { final List<String> filterItems = Collections.singletonList(String.format("%s:%s", project.getGroupId(), project.getArtifactId())); final ProjectBuildingRequest buildingRequest = newResolveArtifactProjectBuildingRequest(project); //For some reason the filter does not filter out the project being analyzed //if we pass in the filter below instead of null to the dependencyGraphBuilder final DependencyNode dn = dependencyGraphBuilder.buildDependencyGraph(buildingRequest, null, reactorProjects); final CollectingDependencyNodeVisitor collectorVisitor = new CollectingDependencyNodeVisitor(); // exclude artifact by pattern and its dependencies final DependencyNodeVisitor transitiveFilterVisitor = new FilteringDependencyTransitiveNodeVisitor(collectorVisitor, new ArtifactDependencyNodeFilter(new PatternExcludesArtifactFilter(getExcludes()))); // exclude exact artifact but not its dependencies, this filter must be appied on the root for first otherwise // in case the exclude has the same groupId of the current bundle its direct dependencies are not visited final DependencyNodeVisitor artifactFilter = new FilteringDependencyNodeVisitor(transitiveFilterVisitor, new ArtifactDependencyNodeFilter(new ExcludesArtifactFilter(filterItems))); dn.accept(artifactFilter); //collect dependencies with the filter - see comment above. final List<DependencyNode> nodes = new ArrayList<>(collectorVisitor.getNodes()); return collectDependencies(engine, project, nodes, buildingRequest, aggregate); } catch (DependencyGraphBuilderException ex) { final String msg = String.format("Unable to build dependency graph on project %s", project.getName()); getLog().debug(msg, ex); return new ExceptionCollection(ex); } }
java
protected ExceptionCollection scanArtifacts(MavenProject project, Engine engine, boolean aggregate) { try { final List<String> filterItems = Collections.singletonList(String.format("%s:%s", project.getGroupId(), project.getArtifactId())); final ProjectBuildingRequest buildingRequest = newResolveArtifactProjectBuildingRequest(project); //For some reason the filter does not filter out the project being analyzed //if we pass in the filter below instead of null to the dependencyGraphBuilder final DependencyNode dn = dependencyGraphBuilder.buildDependencyGraph(buildingRequest, null, reactorProjects); final CollectingDependencyNodeVisitor collectorVisitor = new CollectingDependencyNodeVisitor(); // exclude artifact by pattern and its dependencies final DependencyNodeVisitor transitiveFilterVisitor = new FilteringDependencyTransitiveNodeVisitor(collectorVisitor, new ArtifactDependencyNodeFilter(new PatternExcludesArtifactFilter(getExcludes()))); // exclude exact artifact but not its dependencies, this filter must be appied on the root for first otherwise // in case the exclude has the same groupId of the current bundle its direct dependencies are not visited final DependencyNodeVisitor artifactFilter = new FilteringDependencyNodeVisitor(transitiveFilterVisitor, new ArtifactDependencyNodeFilter(new ExcludesArtifactFilter(filterItems))); dn.accept(artifactFilter); //collect dependencies with the filter - see comment above. final List<DependencyNode> nodes = new ArrayList<>(collectorVisitor.getNodes()); return collectDependencies(engine, project, nodes, buildingRequest, aggregate); } catch (DependencyGraphBuilderException ex) { final String msg = String.format("Unable to build dependency graph on project %s", project.getName()); getLog().debug(msg, ex); return new ExceptionCollection(ex); } }
[ "protected", "ExceptionCollection", "scanArtifacts", "(", "MavenProject", "project", ",", "Engine", "engine", ",", "boolean", "aggregate", ")", "{", "try", "{", "final", "List", "<", "String", ">", "filterItems", "=", "Collections", ".", "singletonList", "(", "S...
Scans the project's artifacts and adds them to the engine's dependency list. @param project the project to scan the dependencies of @param engine the engine to use to scan the dependencies @param aggregate whether the scan is part of an aggregate build @return a collection of exceptions that may have occurred while resolving and scanning the dependencies
[ "Scans", "the", "project", "s", "artifacts", "and", "adds", "them", "to", "the", "engine", "s", "dependency", "list", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/maven/src/main/java/org/owasp/dependencycheck/maven/BaseDependencyCheckMojo.java#L843-L870
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getMonthlyAbsoluteDates
private void getMonthlyAbsoluteDates(Calendar calendar, int frequency, List<Date> dates) { int currentDayNumber = calendar.get(Calendar.DAY_OF_MONTH); calendar.set(Calendar.DAY_OF_MONTH, 1); int requiredDayNumber = NumberHelper.getInt(m_dayNumber); if (requiredDayNumber < currentDayNumber) { calendar.add(Calendar.MONTH, 1); } while (moreDates(calendar, dates)) { int useDayNumber = requiredDayNumber; int maxDayNumber = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); if (useDayNumber > maxDayNumber) { useDayNumber = maxDayNumber; } calendar.set(Calendar.DAY_OF_MONTH, useDayNumber); dates.add(calendar.getTime()); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.MONTH, frequency); } }
java
private void getMonthlyAbsoluteDates(Calendar calendar, int frequency, List<Date> dates) { int currentDayNumber = calendar.get(Calendar.DAY_OF_MONTH); calendar.set(Calendar.DAY_OF_MONTH, 1); int requiredDayNumber = NumberHelper.getInt(m_dayNumber); if (requiredDayNumber < currentDayNumber) { calendar.add(Calendar.MONTH, 1); } while (moreDates(calendar, dates)) { int useDayNumber = requiredDayNumber; int maxDayNumber = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); if (useDayNumber > maxDayNumber) { useDayNumber = maxDayNumber; } calendar.set(Calendar.DAY_OF_MONTH, useDayNumber); dates.add(calendar.getTime()); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.MONTH, frequency); } }
[ "private", "void", "getMonthlyAbsoluteDates", "(", "Calendar", "calendar", ",", "int", "frequency", ",", "List", "<", "Date", ">", "dates", ")", "{", "int", "currentDayNumber", "=", "calendar", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ";", "cal...
Calculate start dates for a monthly absolute recurrence. @param calendar current date @param frequency frequency @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "monthly", "absolute", "recurrence", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L520-L543
podio/podio-java
src/main/java/com/podio/conversation/ConversationAPI.java
ConversationAPI.createConversation
public int createConversation(String subject, String text, List<Integer> participants, Reference reference) { WebResource resource; if (reference != null) { resource = getResourceFactory().getApiResource( "/conversation/" + reference.toURLFragment()); } else { resource = getResourceFactory().getApiResource("/conversation/"); } return resource .entity(new ConversationCreate(subject, text, participants), MediaType.APPLICATION_JSON_TYPE) .post(ConversationCreateResponse.class).getConversationId(); }
java
public int createConversation(String subject, String text, List<Integer> participants, Reference reference) { WebResource resource; if (reference != null) { resource = getResourceFactory().getApiResource( "/conversation/" + reference.toURLFragment()); } else { resource = getResourceFactory().getApiResource("/conversation/"); } return resource .entity(new ConversationCreate(subject, text, participants), MediaType.APPLICATION_JSON_TYPE) .post(ConversationCreateResponse.class).getConversationId(); }
[ "public", "int", "createConversation", "(", "String", "subject", ",", "String", "text", ",", "List", "<", "Integer", ">", "participants", ",", "Reference", "reference", ")", "{", "WebResource", "resource", ";", "if", "(", "reference", "!=", "null", ")", "{",...
Creates a new conversation with a list of users. Once a conversation is started, the participants cannot (yet) be changed. @param subject The subject of the conversation @param text The text of the first message in the conversation @param participants List of participants in the conversation (not including the sender) @param reference The object the conversation should be created on, if any @return The id of the newly created conversation
[ "Creates", "a", "new", "conversation", "with", "a", "list", "of", "users", ".", "Once", "a", "conversation", "is", "started", "the", "participants", "cannot", "(", "yet", ")", "be", "changed", "." ]
train
https://github.com/podio/podio-java/blob/a520b23bac118c957ce02cdd8ff42a6c7d17b49a/src/main/java/com/podio/conversation/ConversationAPI.java#L52-L66
ocelotds/ocelot
ocelot-core/src/main/java/org/ocelotds/messaging/JsTopicInterceptor.java
JsTopicInterceptor.computeTopic
String computeTopic(JsTopicName jsTopicName, String topic) { StringBuilder result = new StringBuilder(); if (!jsTopicName.prefix().isEmpty()) { result.append(jsTopicName.prefix()).append(Constants.Topic.COLON); } result.append(topic); if (!jsTopicName.postfix().isEmpty()) { result.append(Constants.Topic.COLON).append(jsTopicName.postfix()); } return result.toString(); }
java
String computeTopic(JsTopicName jsTopicName, String topic) { StringBuilder result = new StringBuilder(); if (!jsTopicName.prefix().isEmpty()) { result.append(jsTopicName.prefix()).append(Constants.Topic.COLON); } result.append(topic); if (!jsTopicName.postfix().isEmpty()) { result.append(Constants.Topic.COLON).append(jsTopicName.postfix()); } return result.toString(); }
[ "String", "computeTopic", "(", "JsTopicName", "jsTopicName", ",", "String", "topic", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "if", "(", "!", "jsTopicName", ".", "prefix", "(", ")", ".", "isEmpty", "(", ")", ")", "...
Compute full topicname from jsTopicName.prefix, topic and jsTopicName.postfix @param jsTopicName @param topic @return
[ "Compute", "full", "topicname", "from", "jsTopicName", ".", "prefix", "topic", "and", "jsTopicName", ".", "postfix" ]
train
https://github.com/ocelotds/ocelot/blob/5f0ac37afd8fa4dc9f7234a2aac8abbb522128e7/ocelot-core/src/main/java/org/ocelotds/messaging/JsTopicInterceptor.java#L131-L141
spotify/crtauth-java
src/main/java/com/spotify/crtauth/CrtAuthClient.java
CrtAuthClient.createResponse
public String createResponse(String challenge) throws IllegalArgumentException, KeyNotFoundException, ProtocolVersionException { byte[] decodedChallenge = decode(challenge); Challenge deserializedChallenge = CrtAuthCodec.deserializeChallenge(decodedChallenge); if (!deserializedChallenge.getServerName().equals(serverName)) { throw new IllegalArgumentException( String.format("Server name mismatch (%s != %s). Possible MITM attack.", deserializedChallenge.getServerName(), serverName) ); } byte[] signature = signer.sign(decodedChallenge, deserializedChallenge.getFingerprint()); return encode(CrtAuthCodec.serialize(new Response(decodedChallenge, signature))); }
java
public String createResponse(String challenge) throws IllegalArgumentException, KeyNotFoundException, ProtocolVersionException { byte[] decodedChallenge = decode(challenge); Challenge deserializedChallenge = CrtAuthCodec.deserializeChallenge(decodedChallenge); if (!deserializedChallenge.getServerName().equals(serverName)) { throw new IllegalArgumentException( String.format("Server name mismatch (%s != %s). Possible MITM attack.", deserializedChallenge.getServerName(), serverName) ); } byte[] signature = signer.sign(decodedChallenge, deserializedChallenge.getFingerprint()); return encode(CrtAuthCodec.serialize(new Response(decodedChallenge, signature))); }
[ "public", "String", "createResponse", "(", "String", "challenge", ")", "throws", "IllegalArgumentException", ",", "KeyNotFoundException", ",", "ProtocolVersionException", "{", "byte", "[", "]", "decodedChallenge", "=", "decode", "(", "challenge", ")", ";", "Challenge"...
Generate a response String using the Signer of this instance, additionally verifying that the embedded serverName matches the serverName of this instance. @param challenge A challenge String obtained from a server. @return The response String to be returned to the server. @throws IllegalArgumentException if there is something wrong with the challenge.
[ "Generate", "a", "response", "String", "using", "the", "Signer", "of", "this", "instance", "additionally", "verifying", "that", "the", "embedded", "serverName", "matches", "the", "serverName", "of", "this", "instance", "." ]
train
https://github.com/spotify/crtauth-java/blob/90f3b40323848740c915b195ad1b547fbeb41700/src/main/java/com/spotify/crtauth/CrtAuthClient.java#L60-L72
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.updateState
private void updateState(CmsDbContext dbc, CmsResource resource, boolean resourceState) throws CmsDataAccessException { CmsUUID projectId = ((dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) ? dbc.currentProject().getUuid() : dbc.getProjectId(); resource.setUserLastModified(dbc.currentUser().getId()); if (resourceState) { // update the whole resource state getVfsDriver(dbc).writeResource(dbc, projectId, resource, UPDATE_RESOURCE_STATE); } else { // update the structure state getVfsDriver(dbc).writeResource(dbc, projectId, resource, UPDATE_STRUCTURE_STATE); } }
java
private void updateState(CmsDbContext dbc, CmsResource resource, boolean resourceState) throws CmsDataAccessException { CmsUUID projectId = ((dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) ? dbc.currentProject().getUuid() : dbc.getProjectId(); resource.setUserLastModified(dbc.currentUser().getId()); if (resourceState) { // update the whole resource state getVfsDriver(dbc).writeResource(dbc, projectId, resource, UPDATE_RESOURCE_STATE); } else { // update the structure state getVfsDriver(dbc).writeResource(dbc, projectId, resource, UPDATE_STRUCTURE_STATE); } }
[ "private", "void", "updateState", "(", "CmsDbContext", "dbc", ",", "CmsResource", "resource", ",", "boolean", "resourceState", ")", "throws", "CmsDataAccessException", "{", "CmsUUID", "projectId", "=", "(", "(", "dbc", ".", "getProjectId", "(", ")", "==", "null"...
Updates the state of a resource, depending on the <code>resourceState</code> parameter.<p> @param dbc the db context @param resource the resource @param resourceState if <code>true</code> the resource state will be updated, if not just the structure state. @throws CmsDataAccessException if something goes wrong
[ "Updates", "the", "state", "of", "a", "resource", "depending", "on", "the", "<code", ">", "resourceState<", "/", "code", ">", "parameter", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L11962-L11976
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/MutableDocument.java
MutableDocument.setBoolean
@NonNull @Override public MutableDocument setBoolean(@NonNull String key, boolean value) { return setValue(key, value); }
java
@NonNull @Override public MutableDocument setBoolean(@NonNull String key, boolean value) { return setValue(key, value); }
[ "@", "NonNull", "@", "Override", "public", "MutableDocument", "setBoolean", "(", "@", "NonNull", "String", "key", ",", "boolean", "value", ")", "{", "return", "setValue", "(", "key", ",", "value", ")", ";", "}" ]
Set a boolean value for the given key @param key the key. @param key the boolean value. @return this MutableDocument instance
[ "Set", "a", "boolean", "value", "for", "the", "given", "key" ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDocument.java#L236-L240
MenoData/Time4J
base/src/main/java/net/time4j/tz/model/GregorianTimezoneRule.java
GregorianTimezoneRule.ofFixedDay
public static GregorianTimezoneRule ofFixedDay( Month month, int dayOfMonth, int timeOfDay, OffsetIndicator indicator, int savings ) { return new FixedDayPattern(month, dayOfMonth, timeOfDay, indicator, savings); }
java
public static GregorianTimezoneRule ofFixedDay( Month month, int dayOfMonth, int timeOfDay, OffsetIndicator indicator, int savings ) { return new FixedDayPattern(month, dayOfMonth, timeOfDay, indicator, savings); }
[ "public", "static", "GregorianTimezoneRule", "ofFixedDay", "(", "Month", "month", ",", "int", "dayOfMonth", ",", "int", "timeOfDay", ",", "OffsetIndicator", "indicator", ",", "int", "savings", ")", "{", "return", "new", "FixedDayPattern", "(", "month", ",", "day...
/*[deutsch] <p>Konstruiert ein Muster f&uuml;r einen festen Tag im angegebenen Monat. </p> @param month calendar month @param dayOfMonth day of month (1 - 31) @param timeOfDay clock time in seconds after midnight when time switch happens @param indicator offset indicator @param savings fixed DST-offset in seconds @return new daylight saving rule @throws IllegalArgumentException if the last argument is out of range or if the day of month is not valid in context of given month @since 5.0
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Konstruiert", "ein", "Muster", "f&uuml", ";", "r", "einen", "festen", "Tag", "im", "angegebenen", "Monat", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/tz/model/GregorianTimezoneRule.java#L166-L176
mhshams/jnbis
src/main/java/org/jnbis/api/handler/FileHandler.java
FileHandler.asFile
public File asFile(String fileName) { File file = new File(fileName); try (FileOutputStream bos = new FileOutputStream(file)) { bos.write(data); } catch (IOException e) { throw new RuntimeException("unexpected error", e); } return file; }
java
public File asFile(String fileName) { File file = new File(fileName); try (FileOutputStream bos = new FileOutputStream(file)) { bos.write(data); } catch (IOException e) { throw new RuntimeException("unexpected error", e); } return file; }
[ "public", "File", "asFile", "(", "String", "fileName", ")", "{", "File", "file", "=", "new", "File", "(", "fileName", ")", ";", "try", "(", "FileOutputStream", "bos", "=", "new", "FileOutputStream", "(", "file", ")", ")", "{", "bos", ".", "write", "(",...
Writes the file data in the specified file and returns the final <code>File</code>. @param fileName the given file name, not null @return the final File, not null
[ "Writes", "the", "file", "data", "in", "the", "specified", "file", "and", "returns", "the", "final", "<code", ">", "File<", "/", "code", ">", "." ]
train
https://github.com/mhshams/jnbis/blob/e0f4ac750cc98a0363507395a121183fface330e/src/main/java/org/jnbis/api/handler/FileHandler.java#L26-L34
timols/java-gitlab-api
src/main/java/org/gitlab/api/GitlabAPI.java
GitlabAPI.createSSHKey
public GitlabSSHKey createSSHKey(Integer targetUserId, String title, String key) throws IOException { Query query = new Query() .append("title", title) .append("key", key); String tailUrl = GitlabUser.USERS_URL + "/" + targetUserId + GitlabSSHKey.KEYS_URL + query.toString(); return dispatch().to(tailUrl, GitlabSSHKey.class); }
java
public GitlabSSHKey createSSHKey(Integer targetUserId, String title, String key) throws IOException { Query query = new Query() .append("title", title) .append("key", key); String tailUrl = GitlabUser.USERS_URL + "/" + targetUserId + GitlabSSHKey.KEYS_URL + query.toString(); return dispatch().to(tailUrl, GitlabSSHKey.class); }
[ "public", "GitlabSSHKey", "createSSHKey", "(", "Integer", "targetUserId", ",", "String", "title", ",", "String", "key", ")", "throws", "IOException", "{", "Query", "query", "=", "new", "Query", "(", ")", ".", "append", "(", "\"title\"", ",", "title", ")", ...
Create a new ssh key for the user @param targetUserId The id of the Gitlab user @param title The title of the ssh key @param key The public key @return The new GitlabSSHKey @throws IOException on gitlab api call error
[ "Create", "a", "new", "ssh", "key", "for", "the", "user" ]
train
https://github.com/timols/java-gitlab-api/blob/f03eedf952cfbb40306be3bf9234dcf78fab029e/src/main/java/org/gitlab/api/GitlabAPI.java#L385-L394
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java
DeploymentsInner.createOrUpdate
public DeploymentExtendedInner createOrUpdate(String resourceGroupName, String deploymentName, DeploymentProperties properties) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, properties).toBlocking().last().body(); }
java
public DeploymentExtendedInner createOrUpdate(String resourceGroupName, String deploymentName, DeploymentProperties properties) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, properties).toBlocking().last().body(); }
[ "public", "DeploymentExtendedInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "deploymentName", ",", "DeploymentProperties", "properties", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "deploymentName", ...
Deploys resources to a resource group. You can provide the template and parameters directly in the request or link to JSON files. @param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist. @param deploymentName The name of the deployment. @param properties The deployment properties. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DeploymentExtendedInner object if successful.
[ "Deploys", "resources", "to", "a", "resource", "group", ".", "You", "can", "provide", "the", "template", "and", "parameters", "directly", "in", "the", "request", "or", "link", "to", "JSON", "files", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java#L376-L378
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java
PlatformBitmapFactory.createBitmap
public CloseableReference<Bitmap> createBitmap( Bitmap source, int x, int y, int width, int height, @Nullable Object callerContext) { return createBitmap(source, x, y, width, height, null, false, callerContext); }
java
public CloseableReference<Bitmap> createBitmap( Bitmap source, int x, int y, int width, int height, @Nullable Object callerContext) { return createBitmap(source, x, y, width, height, null, false, callerContext); }
[ "public", "CloseableReference", "<", "Bitmap", ">", "createBitmap", "(", "Bitmap", "source", ",", "int", "x", ",", "int", "y", ",", "int", "width", ",", "int", "height", ",", "@", "Nullable", "Object", "callerContext", ")", "{", "return", "createBitmap", "...
Creates a bitmap from the specified subset of the source bitmap. It is initialized with the same density as the original bitmap. @param source The bitmap we are subsetting @param x The x coordinate of the first pixel in source @param y The y coordinate of the first pixel in source @param width The number of pixels in each row @param height The number of rows @param callerContext the Tag to track who create the Bitmap @return a reference to the bitmap @throws IllegalArgumentException if the x, y, width, height values are outside of the dimensions of the source bitmap, or width is <= 0, or height is <= 0 @throws TooManyBitmapsException if the pool is full @throws java.lang.OutOfMemoryError if the Bitmap cannot be allocated
[ "Creates", "a", "bitmap", "from", "the", "specified", "subset", "of", "the", "source", "bitmap", ".", "It", "is", "initialized", "with", "the", "same", "density", "as", "the", "original", "bitmap", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imagepipeline/bitmaps/PlatformBitmapFactory.java#L170-L178
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/BaseWorkflowExecutor.java
BaseWorkflowExecutor.addStepFailureContextData
protected void addStepFailureContextData( StepExecutionResult stepResult, ExecutionContextImpl.Builder builder ) { HashMap<String, String> resultData = new HashMap<>(); if (null != stepResult.getFailureData()) { //convert values to string for (final Map.Entry<String, Object> entry : stepResult.getFailureData().entrySet()) { resultData.put(entry.getKey(), entry.getValue().toString()); } } FailureReason reason = stepResult.getFailureReason(); if (null == reason) { reason = StepFailureReason.Unknown; } resultData.put("reason", reason.toString()); String message = stepResult.getFailureMessage(); if (null == message) { message = "No message"; } resultData.put("message", message); //add to data context builder.setContext("result", resultData); }
java
protected void addStepFailureContextData( StepExecutionResult stepResult, ExecutionContextImpl.Builder builder ) { HashMap<String, String> resultData = new HashMap<>(); if (null != stepResult.getFailureData()) { //convert values to string for (final Map.Entry<String, Object> entry : stepResult.getFailureData().entrySet()) { resultData.put(entry.getKey(), entry.getValue().toString()); } } FailureReason reason = stepResult.getFailureReason(); if (null == reason) { reason = StepFailureReason.Unknown; } resultData.put("reason", reason.toString()); String message = stepResult.getFailureMessage(); if (null == message) { message = "No message"; } resultData.put("message", message); //add to data context builder.setContext("result", resultData); }
[ "protected", "void", "addStepFailureContextData", "(", "StepExecutionResult", "stepResult", ",", "ExecutionContextImpl", ".", "Builder", "builder", ")", "{", "HashMap", "<", "String", ",", "String", ">", "resultData", "=", "new", "HashMap", "<>", "(", ")", ";", ...
Add step result failure information to the data context @param stepResult result @return new context
[ "Add", "step", "result", "failure", "information", "to", "the", "data", "context" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/BaseWorkflowExecutor.java#L381-L407
apache/groovy
src/main/groovy/groovy/lang/GroovyClassLoader.java
GroovyClassLoader.parseClass
public Class parseClass(File file) throws CompilationFailedException, IOException { return parseClass(new GroovyCodeSource(file, config.getSourceEncoding())); }
java
public Class parseClass(File file) throws CompilationFailedException, IOException { return parseClass(new GroovyCodeSource(file, config.getSourceEncoding())); }
[ "public", "Class", "parseClass", "(", "File", "file", ")", "throws", "CompilationFailedException", ",", "IOException", "{", "return", "parseClass", "(", "new", "GroovyCodeSource", "(", "file", ",", "config", ".", "getSourceEncoding", "(", ")", ")", ")", ";", "...
Parses the given file into a Java class capable of being run @param file the file name to parse @return the main class defined in the given script
[ "Parses", "the", "given", "file", "into", "a", "Java", "class", "capable", "of", "being", "run" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/lang/GroovyClassLoader.java#L233-L235
m-m-m/util
validation/src/main/java/net/sf/mmm/util/validation/base/ValidatorJsr303.java
ValidatorJsr303.createValidationFailure
protected ValidationFailure createValidationFailure(ConstraintViolation<?> violation, Object valueSource) { String code = violation.getConstraintDescriptor().getAnnotation().annotationType().getSimpleName(); return new ValidationFailureImpl(code, valueSource, violation.getMessage()); }
java
protected ValidationFailure createValidationFailure(ConstraintViolation<?> violation, Object valueSource) { String code = violation.getConstraintDescriptor().getAnnotation().annotationType().getSimpleName(); return new ValidationFailureImpl(code, valueSource, violation.getMessage()); }
[ "protected", "ValidationFailure", "createValidationFailure", "(", "ConstraintViolation", "<", "?", ">", "violation", ",", "Object", "valueSource", ")", "{", "String", "code", "=", "violation", ".", "getConstraintDescriptor", "(", ")", ".", "getAnnotation", "(", ")",...
Creates a {@link ValidationFailure} for the given {@link ConstraintViolation}. @param violation is the {@link ConstraintViolation}. @param valueSource is the source of the value. May be {@code null}. @return the created {@link ValidationFailure}.
[ "Creates", "a", "{", "@link", "ValidationFailure", "}", "for", "the", "given", "{", "@link", "ConstraintViolation", "}", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/validation/src/main/java/net/sf/mmm/util/validation/base/ValidatorJsr303.java#L226-L230
aws/aws-sdk-java
aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/Step.java
Step.withScreenshots
public Step withScreenshots(java.util.Map<String, String> screenshots) { setScreenshots(screenshots); return this; }
java
public Step withScreenshots(java.util.Map<String, String> screenshots) { setScreenshots(screenshots); return this; }
[ "public", "Step", "withScreenshots", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "screenshots", ")", "{", "setScreenshots", "(", "screenshots", ")", ";", "return", "this", ";", "}" ]
<p> List of screenshot Urls for the execution step, if relevant. </p> @param screenshots List of screenshot Urls for the execution step, if relevant. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "List", "of", "screenshot", "Urls", "for", "the", "execution", "step", "if", "relevant", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-amplify/src/main/java/com/amazonaws/services/amplify/model/Step.java#L367-L370
QNJR-GROUP/EasyTransaction
easytrans-demo/rpc-dubbo/rpcdubbo-order-service/src/main/java/com/yiqiniu/easytrans/demos/order/impl/OrderApplication.java
OrderApplication.dubboConsumerCustomizationer
@Bean public DubboReferanceCustomizationer dubboConsumerCustomizationer() { return new DubboReferanceCustomizationer() { @Override public void customDubboReferance(String appId, String busCode, ReferenceConfig<GenericService> referenceConfig) { Logger logger = LoggerFactory.getLogger(getClass()); logger.info("custom dubbo consumer!"); } }; }
java
@Bean public DubboReferanceCustomizationer dubboConsumerCustomizationer() { return new DubboReferanceCustomizationer() { @Override public void customDubboReferance(String appId, String busCode, ReferenceConfig<GenericService> referenceConfig) { Logger logger = LoggerFactory.getLogger(getClass()); logger.info("custom dubbo consumer!"); } }; }
[ "@", "Bean", "public", "DubboReferanceCustomizationer", "dubboConsumerCustomizationer", "(", ")", "{", "return", "new", "DubboReferanceCustomizationer", "(", ")", "{", "@", "Override", "public", "void", "customDubboReferance", "(", "String", "appId", ",", "String", "b...
This is an optional bean, you can modify Dubbo reference here to change the behavior of consumer @return
[ "This", "is", "an", "optional", "bean", "you", "can", "modify", "Dubbo", "reference", "here", "to", "change", "the", "behavior", "of", "consumer" ]
train
https://github.com/QNJR-GROUP/EasyTransaction/blob/53b031724a3fd1145f32b9a7b5c6fb8138d6a426/easytrans-demo/rpc-dubbo/rpcdubbo-order-service/src/main/java/com/yiqiniu/easytrans/demos/order/impl/OrderApplication.java#L30-L40
aggregateknowledge/java-hll
src/main/java/net/agkn/hll/util/HLLUtil.java
HLLUtil.largeEstimator
public static double largeEstimator(final int log2m, final int registerSizeInBits, final double estimator) { final double twoToL = TWO_TO_L[(REG_WIDTH_INDEX_MULTIPLIER * registerSizeInBits) + log2m]; return -1 * twoToL * Math.log(1.0 - (estimator/twoToL)); }
java
public static double largeEstimator(final int log2m, final int registerSizeInBits, final double estimator) { final double twoToL = TWO_TO_L[(REG_WIDTH_INDEX_MULTIPLIER * registerSizeInBits) + log2m]; return -1 * twoToL * Math.log(1.0 - (estimator/twoToL)); }
[ "public", "static", "double", "largeEstimator", "(", "final", "int", "log2m", ",", "final", "int", "registerSizeInBits", ",", "final", "double", "estimator", ")", "{", "final", "double", "twoToL", "=", "TWO_TO_L", "[", "(", "REG_WIDTH_INDEX_MULTIPLIER", "*", "re...
The "large range correction" formula from the HyperLogLog algorithm, adapted for 64 bit hashes. Only appropriate for estimators whose value exceeds the return of {@link #largeEstimatorCutoff(int, int)}. @param log2m log-base-2 of the number of registers in the HLL. <em>b<em> in the paper. @param registerSizeInBits the size of the HLL registers, in bits. @param estimator the original estimator ("E" in the paper). @return a corrected cardinality estimate. @see <a href='http://research.neustar.biz/2013/01/24/hyperloglog-googles-take-on-engineering-hll/'>Blog post with section on 64 bit hashes and "large range correction"</a>
[ "The", "large", "range", "correction", "formula", "from", "the", "HyperLogLog", "algorithm", "adapted", "for", "64", "bit", "hashes", ".", "Only", "appropriate", "for", "estimators", "whose", "value", "exceeds", "the", "return", "of", "{", "@link", "#largeEstima...
train
https://github.com/aggregateknowledge/java-hll/blob/1f4126e79a85b79581460c75bf1c1634b8a7402d/src/main/java/net/agkn/hll/util/HLLUtil.java#L198-L201
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/JMessageClient.java
JMessageClient.setNoDisturb
public ResponseWrapper setNoDisturb(String username, NoDisturbPayload payload) throws APIConnectionException, APIRequestException { return _userClient.setNoDisturb(username, payload); }
java
public ResponseWrapper setNoDisturb(String username, NoDisturbPayload payload) throws APIConnectionException, APIRequestException { return _userClient.setNoDisturb(username, payload); }
[ "public", "ResponseWrapper", "setNoDisturb", "(", "String", "username", ",", "NoDisturbPayload", "payload", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "return", "_userClient", ".", "setNoDisturb", "(", "username", ",", "payload", ")", ";...
Set don't disturb service while receiving messages. You can Add or remove single conversation or group conversation @param username Necessary @param payload NoDisturbPayload @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Set", "don", "t", "disturb", "service", "while", "receiving", "messages", ".", "You", "can", "Add", "or", "remove", "single", "conversation", "or", "group", "conversation" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/JMessageClient.java#L277-L280
phax/ph-oton
ph-oton-html/src/main/java/com/helger/html/hc/ext/HCConditionalCommentNode.java
HCConditionalCommentNode.getAsConditionalCommentNode
@Nonnull public static HCConditionalCommentNode getAsConditionalCommentNode (@Nonnull @Nonempty final String sCondition, @Nonnull final IHCNode aNode) { if (aNode instanceof HCConditionalCommentNode) return (HCConditionalCommentNode) aNode; return new HCConditionalCommentNode (sCondition, aNode); }
java
@Nonnull public static HCConditionalCommentNode getAsConditionalCommentNode (@Nonnull @Nonempty final String sCondition, @Nonnull final IHCNode aNode) { if (aNode instanceof HCConditionalCommentNode) return (HCConditionalCommentNode) aNode; return new HCConditionalCommentNode (sCondition, aNode); }
[ "@", "Nonnull", "public", "static", "HCConditionalCommentNode", "getAsConditionalCommentNode", "(", "@", "Nonnull", "@", "Nonempty", "final", "String", "sCondition", ",", "@", "Nonnull", "final", "IHCNode", "aNode", ")", "{", "if", "(", "aNode", "instanceof", "HCC...
Get the passed node wrapped in a conditional comment. This is a sanity method for <code>new HCConditionalCommentNode (this, sCondition)</code>. If this node is already an {@link HCConditionalCommentNode} the object is simply casted. @param sCondition The condition to us. May neither be <code>null</code> nor empty. @param aNode The HC node to be wrapped. May not be <code>null</code>. @return Never <code>null</code>.
[ "Get", "the", "passed", "node", "wrapped", "in", "a", "conditional", "comment", ".", "This", "is", "a", "sanity", "method", "for", "<code", ">", "new", "HCConditionalCommentNode", "(", "this", "sCondition", ")", "<", "/", "code", ">", ".", "If", "this", ...
train
https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/ext/HCConditionalCommentNode.java#L423-L430
Azure/azure-sdk-for-java
streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java
StreamingJobsInner.beginCreateOrReplaceAsync
public Observable<StreamingJobInner> beginCreateOrReplaceAsync(String resourceGroupName, String jobName, StreamingJobInner streamingJob, String ifMatch, String ifNoneMatch) { return beginCreateOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, streamingJob, ifMatch, ifNoneMatch).map(new Func1<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders>, StreamingJobInner>() { @Override public StreamingJobInner call(ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders> response) { return response.body(); } }); }
java
public Observable<StreamingJobInner> beginCreateOrReplaceAsync(String resourceGroupName, String jobName, StreamingJobInner streamingJob, String ifMatch, String ifNoneMatch) { return beginCreateOrReplaceWithServiceResponseAsync(resourceGroupName, jobName, streamingJob, ifMatch, ifNoneMatch).map(new Func1<ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders>, StreamingJobInner>() { @Override public StreamingJobInner call(ServiceResponseWithHeaders<StreamingJobInner, StreamingJobsCreateOrReplaceHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "StreamingJobInner", ">", "beginCreateOrReplaceAsync", "(", "String", "resourceGroupName", ",", "String", "jobName", ",", "StreamingJobInner", "streamingJob", ",", "String", "ifMatch", ",", "String", "ifNoneMatch", ")", "{", "return", "beg...
Creates a streaming job or replaces an already existing streaming job. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param jobName The name of the streaming job. @param streamingJob The definition of the streaming job that will be used to create a new streaming job or replace the existing one. @param ifMatch The ETag of the streaming job. Omit this value to always overwrite the current record set. Specify the last-seen ETag value to prevent accidentally overwritting concurrent changes. @param ifNoneMatch Set to '*' to allow a new streaming job to be created, but to prevent updating an existing record set. Other values will result in a 412 Pre-condition Failed response. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the StreamingJobInner object
[ "Creates", "a", "streaming", "job", "or", "replaces", "an", "already", "existing", "streaming", "job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/streamanalytics/resource-manager/v2016_03_01/src/main/java/com/microsoft/azure/management/streamanalytics/v2016_03_01/implementation/StreamingJobsInner.java#L428-L435
op4j/op4j
src/main/java/org/op4j/Op.java
Op.onArrayFor
public static <T> Level0ArrayOperator<Date[],Date> onArrayFor(final Date... elements) { return onArrayOf(Types.DATE, VarArgsUtil.asRequiredObjectArray(elements)); }
java
public static <T> Level0ArrayOperator<Date[],Date> onArrayFor(final Date... elements) { return onArrayOf(Types.DATE, VarArgsUtil.asRequiredObjectArray(elements)); }
[ "public", "static", "<", "T", ">", "Level0ArrayOperator", "<", "Date", "[", "]", ",", "Date", ">", "onArrayFor", "(", "final", "Date", "...", "elements", ")", "{", "return", "onArrayOf", "(", "Types", ".", "DATE", ",", "VarArgsUtil", ".", "asRequiredObject...
<p> Creates an array with the specified elements and an <i>operation expression</i> on it. </p> @param elements the elements of the array being created @return an operator, ready for chaining
[ "<p", ">", "Creates", "an", "array", "with", "the", "specified", "elements", "and", "an", "<i", ">", "operation", "expression<", "/", "i", ">", "on", "it", ".", "<", "/", "p", ">" ]
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/Op.java#L1036-L1038
awslabs/amazon-sqs-java-messaging-lib
src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java
AmazonSQSMessagingClientWrapper.deleteMessage
public void deleteMessage(DeleteMessageRequest deleteMessageRequest) throws JMSException { try { prepareRequest(deleteMessageRequest); amazonSQSClient.deleteMessage(deleteMessageRequest); } catch (AmazonClientException e) { throw handleException(e, "deleteMessage"); } }
java
public void deleteMessage(DeleteMessageRequest deleteMessageRequest) throws JMSException { try { prepareRequest(deleteMessageRequest); amazonSQSClient.deleteMessage(deleteMessageRequest); } catch (AmazonClientException e) { throw handleException(e, "deleteMessage"); } }
[ "public", "void", "deleteMessage", "(", "DeleteMessageRequest", "deleteMessageRequest", ")", "throws", "JMSException", "{", "try", "{", "prepareRequest", "(", "deleteMessageRequest", ")", ";", "amazonSQSClient", ".", "deleteMessage", "(", "deleteMessageRequest", ")", ";...
Calls <code>deleteMessage</code> and wraps <code>AmazonClientException</code>. This is used to acknowledge single messages, so that they can be deleted from SQS queue. @param deleteMessageRequest Container for the necessary parameters to execute the deleteMessage service method on AmazonSQS. @throws JMSException
[ "Calls", "<code", ">", "deleteMessage<", "/", "code", ">", "and", "wraps", "<code", ">", "AmazonClientException<", "/", "code", ">", ".", "This", "is", "used", "to", "acknowledge", "single", "messages", "so", "that", "they", "can", "be", "deleted", "from", ...
train
https://github.com/awslabs/amazon-sqs-java-messaging-lib/blob/efa716d34d51ef1c5572790626cdb795419cb342/src/main/java/com/amazon/sqs/javamessaging/AmazonSQSMessagingClientWrapper.java#L156-L163
sahasbhop/formatted-log
formatted-log/src/main/java/com/github/sahasbhop/flog/FLog.java
FLog.setEnableFileLog
public static void setEnableFileLog(boolean enable, String path, String fileName) { sEnableFileLog = enable; if (enable && path != null && fileName != null) { sLogFilePath = path.trim(); sLogFileName = fileName.trim(); if (!sLogFilePath.endsWith("/")) { sLogFilePath = sLogFilePath + "/"; } } }
java
public static void setEnableFileLog(boolean enable, String path, String fileName) { sEnableFileLog = enable; if (enable && path != null && fileName != null) { sLogFilePath = path.trim(); sLogFileName = fileName.trim(); if (!sLogFilePath.endsWith("/")) { sLogFilePath = sLogFilePath + "/"; } } }
[ "public", "static", "void", "setEnableFileLog", "(", "boolean", "enable", ",", "String", "path", ",", "String", "fileName", ")", "{", "sEnableFileLog", "=", "enable", ";", "if", "(", "enable", "&&", "path", "!=", "null", "&&", "fileName", "!=", "null", ")"...
Enable writing debugging log to a target file @param enable enabling a file log @param path directory path to create and save a log file @param fileName target log file name
[ "Enable", "writing", "debugging", "log", "to", "a", "target", "file" ]
train
https://github.com/sahasbhop/formatted-log/blob/0a3952df6b68fbfa0bbb2c0ea0a8bf9ea26ea6e3/formatted-log/src/main/java/com/github/sahasbhop/flog/FLog.java#L75-L86
selenide/selenide
src/main/java/com/codeborne/selenide/Condition.java
Condition.matchText
public static Condition matchText(final String regex) { return new Condition("match text") { @Override public boolean apply(Driver driver, WebElement element) { return Html.text.matches(element.getText(), regex); } @Override public String toString() { return name + " '" + regex + '\''; } }; }
java
public static Condition matchText(final String regex) { return new Condition("match text") { @Override public boolean apply(Driver driver, WebElement element) { return Html.text.matches(element.getText(), regex); } @Override public String toString() { return name + " '" + regex + '\''; } }; }
[ "public", "static", "Condition", "matchText", "(", "final", "String", "regex", ")", "{", "return", "new", "Condition", "(", "\"match text\"", ")", "{", "@", "Override", "public", "boolean", "apply", "(", "Driver", "driver", ",", "WebElement", "element", ")", ...
Assert that given element's text matches given regular expression <p>Sample: <code>$("h1").should(matchText("Hello\s*John"))</code></p> @param regex e.g. Kicked.*Chuck Norris - in this case ".*" can contain any characters including spaces, tabs, CR etc.
[ "Assert", "that", "given", "element", "s", "text", "matches", "given", "regular", "expression" ]
train
https://github.com/selenide/selenide/blob/b867baf171942cf07725d83a985237428569883f/src/main/java/com/codeborne/selenide/Condition.java#L231-L243
google/flogger
api/src/main/java/com/google/common/flogger/parser/DefaultPrintfMessageParser.java
DefaultPrintfMessageParser.wrapHexParameter
private static Parameter wrapHexParameter(final FormatOptions options, int index) { // %h / %H is really just %x / %X on the hashcode. return new Parameter(options, index) { @Override protected void accept(ParameterVisitor visitor, Object value) { visitor.visit(value.hashCode(), FormatChar.HEX, getFormatOptions()); } @Override public String getFormat() { return options.shouldUpperCase() ? "%H" : "%h"; } }; }
java
private static Parameter wrapHexParameter(final FormatOptions options, int index) { // %h / %H is really just %x / %X on the hashcode. return new Parameter(options, index) { @Override protected void accept(ParameterVisitor visitor, Object value) { visitor.visit(value.hashCode(), FormatChar.HEX, getFormatOptions()); } @Override public String getFormat() { return options.shouldUpperCase() ? "%H" : "%h"; } }; }
[ "private", "static", "Parameter", "wrapHexParameter", "(", "final", "FormatOptions", "options", ",", "int", "index", ")", "{", "// %h / %H is really just %x / %X on the hashcode.", "return", "new", "Parameter", "(", "options", ",", "index", ")", "{", "@", "Override", ...
Static method so the anonymous synthetic parameter is static, rather than an inner class.
[ "Static", "method", "so", "the", "anonymous", "synthetic", "parameter", "is", "static", "rather", "than", "an", "inner", "class", "." ]
train
https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/parser/DefaultPrintfMessageParser.java#L103-L116
JodaOrg/joda-time
src/main/java/org/joda/time/convert/CalendarConverter.java
CalendarConverter.getChronology
public Chronology getChronology(Object object, DateTimeZone zone) { if (object.getClass().getName().endsWith(".BuddhistCalendar")) { return BuddhistChronology.getInstance(zone); } else if (object instanceof GregorianCalendar) { GregorianCalendar gc = (GregorianCalendar) object; long cutover = gc.getGregorianChange().getTime(); if (cutover == Long.MIN_VALUE) { return GregorianChronology.getInstance(zone); } else if (cutover == Long.MAX_VALUE) { return JulianChronology.getInstance(zone); } else { return GJChronology.getInstance(zone, cutover, 4); } } else { return ISOChronology.getInstance(zone); } }
java
public Chronology getChronology(Object object, DateTimeZone zone) { if (object.getClass().getName().endsWith(".BuddhistCalendar")) { return BuddhistChronology.getInstance(zone); } else if (object instanceof GregorianCalendar) { GregorianCalendar gc = (GregorianCalendar) object; long cutover = gc.getGregorianChange().getTime(); if (cutover == Long.MIN_VALUE) { return GregorianChronology.getInstance(zone); } else if (cutover == Long.MAX_VALUE) { return JulianChronology.getInstance(zone); } else { return GJChronology.getInstance(zone, cutover, 4); } } else { return ISOChronology.getInstance(zone); } }
[ "public", "Chronology", "getChronology", "(", "Object", "object", ",", "DateTimeZone", "zone", ")", "{", "if", "(", "object", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "endsWith", "(", "\".BuddhistCalendar\"", ")", ")", "{", "return", "Budd...
Gets the chronology, which is the GJChronology if a GregorianCalendar is used, BuddhistChronology if a BuddhistCalendar is used or ISOChronology otherwise. The time zone specified is used in preference to that on the calendar. @param object the Calendar to convert, must not be null @param zone the specified zone to use, null means default zone @return the chronology, never null @throws NullPointerException if the object is null @throws ClassCastException if the object is an invalid type
[ "Gets", "the", "chronology", "which", "is", "the", "GJChronology", "if", "a", "GregorianCalendar", "is", "used", "BuddhistChronology", "if", "a", "BuddhistCalendar", "is", "used", "or", "ISOChronology", "otherwise", ".", "The", "time", "zone", "specified", "is", ...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/convert/CalendarConverter.java#L93-L109
devnied/EMV-NFC-Paycard-Enrollment
library/src/main/java/com/github/devnied/emvnfccard/parser/impl/EmvParser.java
EmvParser.getGetProcessingOptions
protected byte[] getGetProcessingOptions(final byte[] pPdol) throws CommunicationException { // List Tag and length from PDOL List<TagAndLength> list = TlvUtil.parseTagAndLength(pPdol); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { out.write(EmvTags.COMMAND_TEMPLATE.getTagBytes()); // COMMAND // TEMPLATE out.write(TlvUtil.getLength(list)); // ADD total length if (list != null) { for (TagAndLength tl : list) { out.write(template.get().getTerminal().constructValue(tl)); } } } catch (IOException ioe) { LOGGER.error("Construct GPO Command:" + ioe.getMessage(), ioe); } return template.get().getProvider().transceive(new CommandApdu(CommandEnum.GPO, out.toByteArray(), 0).toBytes()); }
java
protected byte[] getGetProcessingOptions(final byte[] pPdol) throws CommunicationException { // List Tag and length from PDOL List<TagAndLength> list = TlvUtil.parseTagAndLength(pPdol); ByteArrayOutputStream out = new ByteArrayOutputStream(); try { out.write(EmvTags.COMMAND_TEMPLATE.getTagBytes()); // COMMAND // TEMPLATE out.write(TlvUtil.getLength(list)); // ADD total length if (list != null) { for (TagAndLength tl : list) { out.write(template.get().getTerminal().constructValue(tl)); } } } catch (IOException ioe) { LOGGER.error("Construct GPO Command:" + ioe.getMessage(), ioe); } return template.get().getProvider().transceive(new CommandApdu(CommandEnum.GPO, out.toByteArray(), 0).toBytes()); }
[ "protected", "byte", "[", "]", "getGetProcessingOptions", "(", "final", "byte", "[", "]", "pPdol", ")", "throws", "CommunicationException", "{", "// List Tag and length from PDOL", "List", "<", "TagAndLength", ">", "list", "=", "TlvUtil", ".", "parseTagAndLength", "...
Method used to create GPO command and execute it @param pPdol PDOL raw data @return return data @throws CommunicationException communication error
[ "Method", "used", "to", "create", "GPO", "command", "and", "execute", "it" ]
train
https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/bfbd3960708689154a7a75c8a9a934197d738a5b/library/src/main/java/com/github/devnied/emvnfccard/parser/impl/EmvParser.java#L275-L292
sd4324530/fastweixin
src/main/java/com/github/sd4324530/fastweixin/api/OauthAPI.java
OauthAPI.validToken
public boolean validToken(String token, String openid) { BeanUtil.requireNonNull(token, "token is null"); BeanUtil.requireNonNull(openid, "openid is null"); String url = BASE_API_URL + "sns/auth?access_token=" + token + "&openid=" + openid; BaseResponse r = executeGet(url); return isSuccess(r.getErrcode()); }
java
public boolean validToken(String token, String openid) { BeanUtil.requireNonNull(token, "token is null"); BeanUtil.requireNonNull(openid, "openid is null"); String url = BASE_API_URL + "sns/auth?access_token=" + token + "&openid=" + openid; BaseResponse r = executeGet(url); return isSuccess(r.getErrcode()); }
[ "public", "boolean", "validToken", "(", "String", "token", ",", "String", "openid", ")", "{", "BeanUtil", ".", "requireNonNull", "(", "token", ",", "\"token is null\"", ")", ";", "BeanUtil", ".", "requireNonNull", "(", "openid", ",", "\"openid is null\"", ")", ...
校验token是否合法有效 @param token token @param openid 用户openid @return 是否合法有效
[ "校验token是否合法有效" ]
train
https://github.com/sd4324530/fastweixin/blob/6bc0a7abfa23aad0dbad4c3123a47a7fb53f3447/src/main/java/com/github/sd4324530/fastweixin/api/OauthAPI.java#L115-L121
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRecordBrowser.java
LogRecordBrowser.restartRecordsInProcess
private OnePidRecordListImpl restartRecordsInProcess(final RepositoryLogRecord after, long max, final IInternalRecordFilter recFilter) { if (!(after instanceof RepositoryLogRecordImpl)) { throw new IllegalArgumentException("Specified location does not belong to this repository."); } RepositoryLogRecordImpl real = (RepositoryLogRecordImpl)after; File file = fileBrowser.findByMillis(real.getMillis()); // If record's time is not in our repository, take the first file if (file == null) { file = fileBrowser.findNext((File)null, max); } return new OnePidRecordListRecordImpl(file, real, max, recFilter); }
java
private OnePidRecordListImpl restartRecordsInProcess(final RepositoryLogRecord after, long max, final IInternalRecordFilter recFilter) { if (!(after instanceof RepositoryLogRecordImpl)) { throw new IllegalArgumentException("Specified location does not belong to this repository."); } RepositoryLogRecordImpl real = (RepositoryLogRecordImpl)after; File file = fileBrowser.findByMillis(real.getMillis()); // If record's time is not in our repository, take the first file if (file == null) { file = fileBrowser.findNext((File)null, max); } return new OnePidRecordListRecordImpl(file, real, max, recFilter); }
[ "private", "OnePidRecordListImpl", "restartRecordsInProcess", "(", "final", "RepositoryLogRecord", "after", ",", "long", "max", ",", "final", "IInternalRecordFilter", "recFilter", ")", "{", "if", "(", "!", "(", "after", "instanceof", "RepositoryLogRecordImpl", ")", ")...
continue the list of the records after a record from another repository filtered with <code>recFilter</code>
[ "continue", "the", "list", "of", "the", "records", "after", "a", "record", "from", "another", "repository", "filtered", "with", "<code", ">", "recFilter<", "/", "code", ">" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/impl/LogRecordBrowser.java#L180-L191
dita-ot/dita-ot
src/main/java/org/dita/dost/util/FileUtils.java
FileUtils.getRelativeUnixPath
@Deprecated public static String getRelativeUnixPath(final String basePath, final String refPath) { return getRelativePath(basePath, refPath, UNIX_SEPARATOR); }
java
@Deprecated public static String getRelativeUnixPath(final String basePath, final String refPath) { return getRelativePath(basePath, refPath, UNIX_SEPARATOR); }
[ "@", "Deprecated", "public", "static", "String", "getRelativeUnixPath", "(", "final", "String", "basePath", ",", "final", "String", "refPath", ")", "{", "return", "getRelativePath", "(", "basePath", ",", "refPath", ",", "UNIX_SEPARATOR", ")", ";", "}" ]
Resolves a path reference against a base path. @param basePath base path @param refPath reference path @return relative path using {@link Constants#UNIX_SEPARATOR} path separator
[ "Resolves", "a", "path", "reference", "against", "a", "base", "path", "." ]
train
https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/FileUtils.java#L182-L185
Mozu/mozu-java
mozu-java-core/src/main/java/com/mozu/api/urls/platform/entitylists/ListViewUrl.java
ListViewUrl.getEntityListViewUrl
public static MozuUrl getEntityListViewUrl(String entityListFullName, String responseFields, String viewName) { UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}/views/{viewName}?responseFields={responseFields}"); formatter.formatUrl("entityListFullName", entityListFullName); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("viewName", viewName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl getEntityListViewUrl(String entityListFullName, String responseFields, String viewName) { UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}/views/{viewName}?responseFields={responseFields}"); formatter.formatUrl("entityListFullName", entityListFullName); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("viewName", viewName); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "getEntityListViewUrl", "(", "String", "entityListFullName", ",", "String", "responseFields", ",", "String", "viewName", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/entitylists/{entityListFullName}/...
Get Resource Url for GetEntityListView @param entityListFullName The full name of the EntityList including namespace in name@nameSpace format @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param viewName The name for a view. Views are used to render data in , such as document and entity lists. Each view includes a schema, format, name, ID, and associated data types to render. @return String Resource Url
[ "Get", "Resource", "Url", "for", "GetEntityListView" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-java-core/src/main/java/com/mozu/api/urls/platform/entitylists/ListViewUrl.java#L103-L110
HeidelTime/heideltime
src/jvntextpro/util/StringUtils.java
StringUtils.isContained
public static boolean isContained( String[] array, String s ) { for (String string : array) { if( string.equals( s ) ) { return true; } } return false; }
java
public static boolean isContained( String[] array, String s ) { for (String string : array) { if( string.equals( s ) ) { return true; } } return false; }
[ "public", "static", "boolean", "isContained", "(", "String", "[", "]", "array", ",", "String", "s", ")", "{", "for", "(", "String", "string", ":", "array", ")", "{", "if", "(", "string", ".", "equals", "(", "s", ")", ")", "{", "return", "true", ";"...
Indicates whether the specified array of <tt>String</tt>s contains a given <tt>String</tt>. @param array the array @param s the s @return otherwise.
[ "Indicates", "whether", "the", "specified", "array", "of", "<tt", ">", "String<", "/", "tt", ">", "s", "contains", "a", "given", "<tt", ">", "String<", "/", "tt", ">", "." ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/jvntextpro/util/StringUtils.java#L556-L566
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java
ArrayHelper.getAllExceptFirst
@Nullable @ReturnsMutableCopy public static double [] getAllExceptFirst (@Nullable final double [] aArray, @Nonnegative final int nElementsToSkip) { ValueEnforcer.isGE0 (nElementsToSkip, "ElementsToSkip"); if (nElementsToSkip == 0) return aArray; if (aArray == null || nElementsToSkip >= aArray.length) return null; return getCopy (aArray, nElementsToSkip, aArray.length - nElementsToSkip); }
java
@Nullable @ReturnsMutableCopy public static double [] getAllExceptFirst (@Nullable final double [] aArray, @Nonnegative final int nElementsToSkip) { ValueEnforcer.isGE0 (nElementsToSkip, "ElementsToSkip"); if (nElementsToSkip == 0) return aArray; if (aArray == null || nElementsToSkip >= aArray.length) return null; return getCopy (aArray, nElementsToSkip, aArray.length - nElementsToSkip); }
[ "@", "Nullable", "@", "ReturnsMutableCopy", "public", "static", "double", "[", "]", "getAllExceptFirst", "(", "@", "Nullable", "final", "double", "[", "]", "aArray", ",", "@", "Nonnegative", "final", "int", "nElementsToSkip", ")", "{", "ValueEnforcer", ".", "i...
Get an array that contains all elements, except for the first <em>n</em> elements. @param aArray The source array. May be <code>null</code>. @param nElementsToSkip The number of elements to skip. Must be &gt;= 0! @return <code>null</code> if the passed array is <code>null</code> or has &le; elements than elements to be skipped. A non-<code>null</code> copy of the array without the first elements otherwise.
[ "Get", "an", "array", "that", "contains", "all", "elements", "except", "for", "the", "first", "<em", ">", "n<", "/", "em", ">", "elements", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/collection/ArrayHelper.java#L3172-L3183
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java
LocaleUtils.getAvailableLocaleSuffixesForBundle
public static List<String> getAvailableLocaleSuffixesForBundle(String messageBundlePath, String fileSuffix) { return getAvailableLocaleSuffixesForBundle(messageBundlePath, fileSuffix, null); }
java
public static List<String> getAvailableLocaleSuffixesForBundle(String messageBundlePath, String fileSuffix) { return getAvailableLocaleSuffixesForBundle(messageBundlePath, fileSuffix, null); }
[ "public", "static", "List", "<", "String", ">", "getAvailableLocaleSuffixesForBundle", "(", "String", "messageBundlePath", ",", "String", "fileSuffix", ")", "{", "return", "getAvailableLocaleSuffixesForBundle", "(", "messageBundlePath", ",", "fileSuffix", ",", "null", "...
Returns the list of available locale suffixes for a message resource bundle @param messageBundlePath the resource bundle path @param fileSuffix the file suffix @return the list of available locale suffixes for a message resource bundle
[ "Returns", "the", "list", "of", "available", "locale", "suffixes", "for", "a", "message", "resource", "bundle" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/locale/LocaleUtils.java#L129-L131
elki-project/elki
elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/data/synthetic/bymodel/GeneratorSingleCluster.java
GeneratorSingleCluster.addRotation
public void addRotation(int axis1, int axis2, double angle) { if(trans == null) { trans = new AffineTransformation(dim); } trans.addRotation(axis1, axis2, angle); }
java
public void addRotation(int axis1, int axis2, double angle) { if(trans == null) { trans = new AffineTransformation(dim); } trans.addRotation(axis1, axis2, angle); }
[ "public", "void", "addRotation", "(", "int", "axis1", ",", "int", "axis2", ",", "double", "angle", ")", "{", "if", "(", "trans", "==", "null", ")", "{", "trans", "=", "new", "AffineTransformation", "(", "dim", ")", ";", "}", "trans", ".", "addRotation"...
Apply a rotation to the generator @param axis1 First axis (0 &lt;= axis1 &lt; dim) @param axis2 Second axis (0 &lt;= axis2 &lt; dim) @param angle Angle in Radians
[ "Apply", "a", "rotation", "to", "the", "generator" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-data-generator/src/main/java/de/lmu/ifi/dbs/elki/data/synthetic/bymodel/GeneratorSingleCluster.java#L134-L139
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/collection/MapConverter.java
MapConverter.getBoolean
public Boolean getBoolean(Map<String, Object> data, String name) { return get(data, name, Boolean.class); }
java
public Boolean getBoolean(Map<String, Object> data, String name) { return get(data, name, Boolean.class); }
[ "public", "Boolean", "getBoolean", "(", "Map", "<", "String", ",", "Object", ">", "data", ",", "String", "name", ")", "{", "return", "get", "(", "data", ",", "name", ",", "Boolean", ".", "class", ")", ";", "}" ]
<p> getBoolean. </p> @param data a {@link java.util.Map} object. @param name a {@link java.lang.String} object. @return a {@link java.lang.Boolean} object.
[ "<p", ">", "getBoolean", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/collection/MapConverter.java#L191-L193
JavaMoney/jsr354-api
src/main/java/javax/money/format/AmountFormatQuery.java
AmountFormatQuery.of
public static AmountFormatQuery of(Locale locale, String... providers) { return AmountFormatQueryBuilder.of(locale).setProviderNames(providers).build(); }
java
public static AmountFormatQuery of(Locale locale, String... providers) { return AmountFormatQueryBuilder.of(locale).setProviderNames(providers).build(); }
[ "public", "static", "AmountFormatQuery", "of", "(", "Locale", "locale", ",", "String", "...", "providers", ")", "{", "return", "AmountFormatQueryBuilder", ".", "of", "(", "locale", ")", ".", "setProviderNames", "(", "providers", ")", ".", "build", "(", ")", ...
Creates a simple format query based on a single Locale, similar to {@link java.text.DecimalFormat#getInstance (java.util.Locale)}. @param locale the target locale, not null. @param providers the providers to be used, not null. @return a new query instance
[ "Creates", "a", "simple", "format", "query", "based", "on", "a", "single", "Locale", "similar", "to", "{", "@link", "java", ".", "text", ".", "DecimalFormat#getInstance", "(", "java", ".", "util", ".", "Locale", ")", "}", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/format/AmountFormatQuery.java#L96-L98
windup/windup
forks/jdt/src/main/java/org/eclipse/jdt/internal/compiler/Compiler.java
Compiler.accept
@Override public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { // Switch the current policy and compilation result for this unit to the requested one. CompilationResult unitResult = new CompilationResult(sourceUnit, this.totalUnits, this.totalUnits, this.options.maxProblemsPerUnit); unitResult.checkSecondaryTypes = true; try { if (this.options.verbose) { String count = String.valueOf(this.totalUnits + 1); this.out.println( Messages.bind(Messages.compilation_request, new String[] { count, count, new String(sourceUnit.getFileName()) })); } // diet parsing for large collection of unit CompilationUnitDeclaration parsedUnit; if (this.totalUnits < this.parseThreshold) { parsedUnit = this.parser.parse(sourceUnit, unitResult); } else { parsedUnit = this.parser.dietParse(sourceUnit, unitResult); } // initial type binding creation this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction); addCompilationUnit(sourceUnit, parsedUnit); // binding resolution this.lookupEnvironment.completeTypeBindings(parsedUnit); } catch (AbortCompilationUnit e) { // at this point, currentCompilationUnitResult may not be sourceUnit, but some other // one requested further along to resolve sourceUnit. if (unitResult.compilationUnit == sourceUnit) { // only report once this.requestor.acceptResult(unitResult.tagAsAccepted()); } else { throw e; // want to abort enclosing request to compile } } }
java
@Override public void accept(ICompilationUnit sourceUnit, AccessRestriction accessRestriction) { // Switch the current policy and compilation result for this unit to the requested one. CompilationResult unitResult = new CompilationResult(sourceUnit, this.totalUnits, this.totalUnits, this.options.maxProblemsPerUnit); unitResult.checkSecondaryTypes = true; try { if (this.options.verbose) { String count = String.valueOf(this.totalUnits + 1); this.out.println( Messages.bind(Messages.compilation_request, new String[] { count, count, new String(sourceUnit.getFileName()) })); } // diet parsing for large collection of unit CompilationUnitDeclaration parsedUnit; if (this.totalUnits < this.parseThreshold) { parsedUnit = this.parser.parse(sourceUnit, unitResult); } else { parsedUnit = this.parser.dietParse(sourceUnit, unitResult); } // initial type binding creation this.lookupEnvironment.buildTypeBindings(parsedUnit, accessRestriction); addCompilationUnit(sourceUnit, parsedUnit); // binding resolution this.lookupEnvironment.completeTypeBindings(parsedUnit); } catch (AbortCompilationUnit e) { // at this point, currentCompilationUnitResult may not be sourceUnit, but some other // one requested further along to resolve sourceUnit. if (unitResult.compilationUnit == sourceUnit) { // only report once this.requestor.acceptResult(unitResult.tagAsAccepted()); } else { throw e; // want to abort enclosing request to compile } } }
[ "@", "Override", "public", "void", "accept", "(", "ICompilationUnit", "sourceUnit", ",", "AccessRestriction", "accessRestriction", ")", "{", "// Switch the current policy and compilation result for this unit to the requested one.", "CompilationResult", "unitResult", "=", "new", "...
Add an additional compilation unit into the loop -> build compilation unit declarations, their bindings and record their results.
[ "Add", "an", "additional", "compilation", "unit", "into", "the", "loop", "-", ">", "build", "compilation", "unit", "declarations", "their", "bindings", "and", "record", "their", "results", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/forks/jdt/src/main/java/org/eclipse/jdt/internal/compiler/Compiler.java#L329-L368
stripe/stripe-android
stripe/src/main/java/com/stripe/android/model/AccountParams.java
AccountParams.createAccountParams
@NonNull public static AccountParams createAccountParams( boolean tosShownAndAccepted, @NonNull BusinessType businessType, @Nullable Map<String, Object> businessData) { return new AccountParams(businessType, businessData, tosShownAndAccepted); }
java
@NonNull public static AccountParams createAccountParams( boolean tosShownAndAccepted, @NonNull BusinessType businessType, @Nullable Map<String, Object> businessData) { return new AccountParams(businessType, businessData, tosShownAndAccepted); }
[ "@", "NonNull", "public", "static", "AccountParams", "createAccountParams", "(", "boolean", "tosShownAndAccepted", ",", "@", "NonNull", "BusinessType", "businessType", ",", "@", "Nullable", "Map", "<", "String", ",", "Object", ">", "businessData", ")", "{", "retur...
Create an {@link AccountParams} instance for a {@link BusinessType#Individual} or {@link BusinessType#Company} Note: API version {@code 2019-02-19} [0] replaced {@code legal_entity} with {@code individual} and {@code company}. @param tosShownAndAccepted Whether the user described by the data in the token has been shown the Stripe Connected Account Agreement [1]. When creating an account token to create a new Connect account, this value must be true. @param businessType See {@link BusinessType} @param businessData A map of company [2] or individual [3] params. [0] <a href="https://stripe.com/docs/upgrades#2019-02-19"> https://stripe.com/docs/upgrades#2019-02-19</a> [1] https://stripe.com/docs/api/tokens/create_account#create_account_token-account-tos_shown_and_accepted [2] <a href="https://stripe.com/docs/api/accounts/create#create_account-company"> https://stripe.com/docs/api/accounts/create#create_account-company</a> [3] <a href="https://stripe.com/docs/api/accounts/create#create_account-individual"> https://stripe.com/docs/api/accounts/create#create_account-individual</a> @return {@link AccountParams}
[ "Create", "an", "{", "@link", "AccountParams", "}", "instance", "for", "a", "{", "@link", "BusinessType#Individual", "}", "or", "{", "@link", "BusinessType#Company", "}" ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/model/AccountParams.java#L49-L55
lucee/Lucee
core/src/main/java/lucee/runtime/security/SecurityManagerImpl.java
SecurityManagerImpl.toStringAccessValue
public static String toStringAccessValue(short accessValue) throws SecurityException { switch (accessValue) { case VALUE_NONE: return "none"; // case VALUE_NO: return "no"; case VALUE_YES: return "yes"; // case VALUE_ALL: return "all"; case VALUE_LOCAL: return "local"; case VALUE_1: return "1"; case VALUE_2: return "2"; case VALUE_3: return "3"; case VALUE_4: return "4"; case VALUE_5: return "5"; case VALUE_6: return "6"; case VALUE_7: return "7"; case VALUE_8: return "8"; case VALUE_9: return "9"; case VALUE_10: return "10"; } throw new SecurityException("invalid access value", "valid access values are [all,local,no,none,yes,1,...,10]"); }
java
public static String toStringAccessValue(short accessValue) throws SecurityException { switch (accessValue) { case VALUE_NONE: return "none"; // case VALUE_NO: return "no"; case VALUE_YES: return "yes"; // case VALUE_ALL: return "all"; case VALUE_LOCAL: return "local"; case VALUE_1: return "1"; case VALUE_2: return "2"; case VALUE_3: return "3"; case VALUE_4: return "4"; case VALUE_5: return "5"; case VALUE_6: return "6"; case VALUE_7: return "7"; case VALUE_8: return "8"; case VALUE_9: return "9"; case VALUE_10: return "10"; } throw new SecurityException("invalid access value", "valid access values are [all,local,no,none,yes,1,...,10]"); }
[ "public", "static", "String", "toStringAccessValue", "(", "short", "accessValue", ")", "throws", "SecurityException", "{", "switch", "(", "accessValue", ")", "{", "case", "VALUE_NONE", ":", "return", "\"none\"", ";", "// case VALUE_NO: return \"no\";", "case", "VALUE_...
translate a short access value (all,local,none,no,yes) to String type @param accessValue @return return int access value (VALUE_ALL,VALUE_LOCAL,VALUE_NO,VALUE_NONE,VALUE_YES) @throws SecurityException
[ "translate", "a", "short", "access", "value", "(", "all", "local", "none", "no", "yes", ")", "to", "String", "type" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/security/SecurityManagerImpl.java#L263-L296
petergeneric/stdlib
service-manager/configuration/src/main/java/com/peterphi/configuration/service/git/ConfigRepository.java
ConfigRepository.set
public void set(final String name, final String email, final Map<String, Map<String, ConfigPropertyValue>> data, final ConfigChangeMode changeMode, final String message) { try { RepoHelper.write(repo, name, email, data, changeMode, message); } catch (Exception e) { try { RepoHelper.reset(repo); } catch (Exception ee) { throw new RuntimeException("Error writing updated repository, then could not reset work tree", e); } throw new RuntimeException("Error writing updated repository, work tree reset", e); } // Push the changes to the remote if (hasRemote) { try { RepoHelper.push(repo, "origin", credentials); } catch (Throwable t) { throw new RuntimeException("Saved changes to the local repository but push to remote failed!", t); } } }
java
public void set(final String name, final String email, final Map<String, Map<String, ConfigPropertyValue>> data, final ConfigChangeMode changeMode, final String message) { try { RepoHelper.write(repo, name, email, data, changeMode, message); } catch (Exception e) { try { RepoHelper.reset(repo); } catch (Exception ee) { throw new RuntimeException("Error writing updated repository, then could not reset work tree", e); } throw new RuntimeException("Error writing updated repository, work tree reset", e); } // Push the changes to the remote if (hasRemote) { try { RepoHelper.push(repo, "origin", credentials); } catch (Throwable t) { throw new RuntimeException("Saved changes to the local repository but push to remote failed!", t); } } }
[ "public", "void", "set", "(", "final", "String", "name", ",", "final", "String", "email", ",", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "ConfigPropertyValue", ">", ">", "data", ",", "final", "ConfigChangeMode", "changeMode", ",", "fin...
Create a new commit reflecting the provided properties @param name @param email @param data @param erase if true all existing properties will be erased @param message
[ "Create", "a", "new", "commit", "reflecting", "the", "provided", "properties" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/service-manager/configuration/src/main/java/com/peterphi/configuration/service/git/ConfigRepository.java#L101-L137
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSetManipulator.java
ReactionSetManipulator.getRelevantReactions
public static IReactionSet getRelevantReactions(IReactionSet reactSet, IAtomContainer molecule) { IReactionSet newReactSet = reactSet.getBuilder().newInstance(IReactionSet.class); IReactionSet reactSetProd = getRelevantReactionsAsProduct(reactSet, molecule); for (IReaction reaction : reactSetProd.reactions()) newReactSet.addReaction(reaction); IReactionSet reactSetReact = getRelevantReactionsAsReactant(reactSet, molecule); for (IReaction reaction : reactSetReact.reactions()) newReactSet.addReaction(reaction); return newReactSet; }
java
public static IReactionSet getRelevantReactions(IReactionSet reactSet, IAtomContainer molecule) { IReactionSet newReactSet = reactSet.getBuilder().newInstance(IReactionSet.class); IReactionSet reactSetProd = getRelevantReactionsAsProduct(reactSet, molecule); for (IReaction reaction : reactSetProd.reactions()) newReactSet.addReaction(reaction); IReactionSet reactSetReact = getRelevantReactionsAsReactant(reactSet, molecule); for (IReaction reaction : reactSetReact.reactions()) newReactSet.addReaction(reaction); return newReactSet; }
[ "public", "static", "IReactionSet", "getRelevantReactions", "(", "IReactionSet", "reactSet", ",", "IAtomContainer", "molecule", ")", "{", "IReactionSet", "newReactSet", "=", "reactSet", ".", "getBuilder", "(", ")", ".", "newInstance", "(", "IReactionSet", ".", "clas...
Get all Reactions object containing a Molecule from a set of Reactions. @param reactSet The set of reaction to inspect @param molecule The molecule to find @return The IReactionSet
[ "Get", "all", "Reactions", "object", "containing", "a", "Molecule", "from", "a", "set", "of", "Reactions", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ReactionSetManipulator.java#L144-L153
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.findAll
public static <T> List<T> findAll(List<T> self) { return findAll(self, Closure.IDENTITY); }
java
public static <T> List<T> findAll(List<T> self) { return findAll(self, Closure.IDENTITY); }
[ "public", "static", "<", "T", ">", "List", "<", "T", ">", "findAll", "(", "List", "<", "T", ">", "self", ")", "{", "return", "findAll", "(", "self", ",", "Closure", ".", "IDENTITY", ")", ";", "}" ]
Finds the items matching the IDENTITY Closure (i.e.&#160;matching Groovy truth). <p> Example: <pre class="groovyTestCase"> def items = [1, 2, 0, false, true, '', 'foo', [], [4, 5], null] assert items.findAll() == [1, 2, true, 'foo', [4, 5]] </pre> @param self a List @return a List of the values found @since 2.4.0 @see Closure#IDENTITY
[ "Finds", "the", "items", "matching", "the", "IDENTITY", "Closure", "(", "i", ".", "e", ".", "&#160", ";", "matching", "Groovy", "truth", ")", ".", "<p", ">", "Example", ":", "<pre", "class", "=", "groovyTestCase", ">", "def", "items", "=", "[", "1", ...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L4829-L4831
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java
SqlQueryStatement.getIndirectionTableColName
private String getIndirectionTableColName(TableAlias mnAlias, String path) { int dotIdx = path.lastIndexOf("."); String column = path.substring(dotIdx); return mnAlias.alias + column; }
java
private String getIndirectionTableColName(TableAlias mnAlias, String path) { int dotIdx = path.lastIndexOf("."); String column = path.substring(dotIdx); return mnAlias.alias + column; }
[ "private", "String", "getIndirectionTableColName", "(", "TableAlias", "mnAlias", ",", "String", "path", ")", "{", "int", "dotIdx", "=", "path", ".", "lastIndexOf", "(", "\".\"", ")", ";", "String", "column", "=", "path", ".", "substring", "(", "dotIdx", ")",...
Get the column name from the indirection table. @param mnAlias @param path
[ "Get", "the", "column", "name", "from", "the", "indirection", "table", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlQueryStatement.java#L748-L753
Bedework/bw-util
bw-util-directory/src/main/java/org/bedework/util/directory/common/DirRecord.java
DirRecord.addAttr
public void addAttr(String attr, Object val) throws NamingException { // System.out.println("addAttr " + attr); Attribute a = findAttr(attr); if (a == null) { setAttr(attr, val); } else { a.add(val); } }
java
public void addAttr(String attr, Object val) throws NamingException { // System.out.println("addAttr " + attr); Attribute a = findAttr(attr); if (a == null) { setAttr(attr, val); } else { a.add(val); } }
[ "public", "void", "addAttr", "(", "String", "attr", ",", "Object", "val", ")", "throws", "NamingException", "{", "// System.out.println(\"addAttr \" + attr);", "Attribute", "a", "=", "findAttr", "(", "attr", ")", ";", "if", "(", "a", "==", "null", ")", "{", ...
Add the attribute value to the table. If an attribute already exists add it to the end of its values. @param attr String attribute name @param val Object value @throws NamingException
[ "Add", "the", "attribute", "value", "to", "the", "table", ".", "If", "an", "attribute", "already", "exists", "add", "it", "to", "the", "end", "of", "its", "values", "." ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-directory/src/main/java/org/bedework/util/directory/common/DirRecord.java#L479-L489
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.recoverDeletedKeyAsync
public ServiceFuture<KeyBundle> recoverDeletedKeyAsync(String vaultBaseUrl, String keyName, final ServiceCallback<KeyBundle> serviceCallback) { return ServiceFuture.fromResponse(recoverDeletedKeyWithServiceResponseAsync(vaultBaseUrl, keyName), serviceCallback); }
java
public ServiceFuture<KeyBundle> recoverDeletedKeyAsync(String vaultBaseUrl, String keyName, final ServiceCallback<KeyBundle> serviceCallback) { return ServiceFuture.fromResponse(recoverDeletedKeyWithServiceResponseAsync(vaultBaseUrl, keyName), serviceCallback); }
[ "public", "ServiceFuture", "<", "KeyBundle", ">", "recoverDeletedKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "final", "ServiceCallback", "<", "KeyBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", ...
Recovers the deleted key to its latest version. The Recover Deleted Key operation is applicable for deleted keys in soft-delete enabled vaults. It recovers the deleted key back to its latest version under /keys. An attempt to recover an non-deleted key will return an error. Consider this the inverse of the delete operation on soft-delete enabled vaults. This operation requires the keys/recover permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the deleted key. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Recovers", "the", "deleted", "key", "to", "its", "latest", "version", ".", "The", "Recover", "Deleted", "Key", "operation", "is", "applicable", "for", "deleted", "keys", "in", "soft", "-", "delete", "enabled", "vaults", ".", "It", "recovers", "the", "delete...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L3247-L3249
alkacon/opencms-core
src/org/opencms/db/generic/CmsUserDriver.java
CmsUserDriver.internalCreateResourceForOrgUnit
protected CmsResource internalCreateResourceForOrgUnit(CmsDbContext dbc, String path, int flags) throws CmsException { // create the offline folder CmsResource resource = new CmsFolder( new CmsUUID(), new CmsUUID(), path, CmsResourceTypeFolder.RESOURCE_TYPE_ID, (CmsResource.FLAG_INTERNAL | flags), dbc.currentProject().getUuid(), CmsResource.STATE_NEW, 0, dbc.currentUser().getId(), 0, dbc.currentUser().getId(), CmsResource.DATE_RELEASED_DEFAULT, CmsResource.DATE_EXPIRED_DEFAULT, 0); CmsUUID projectId = ((dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) ? dbc.currentProject().getUuid() : dbc.getProjectId(); m_driverManager.getVfsDriver(dbc).createResource(dbc, projectId, resource, null); resource.setState(CmsResource.STATE_UNCHANGED); m_driverManager.getVfsDriver(dbc).writeResource(dbc, projectId, resource, CmsDriverManager.NOTHING_CHANGED); if (!dbc.currentProject().isOnlineProject() && dbc.getProjectId().isNullUUID()) { // online persistence CmsProject onlineProject = m_driverManager.readProject(dbc, CmsProject.ONLINE_PROJECT_ID); m_driverManager.getVfsDriver(dbc).createResource(dbc, onlineProject.getUuid(), resource, null); } // clear the internal caches OpenCms.getMemoryMonitor().clearAccessControlListCache(); OpenCms.getMemoryMonitor().flushCache(CmsMemoryMonitor.CacheType.PROPERTY); OpenCms.getMemoryMonitor().flushCache(CmsMemoryMonitor.CacheType.PROPERTY_LIST); // fire an event that a new resource has been created OpenCms.fireCmsEvent( new CmsEvent( I_CmsEventListener.EVENT_RESOURCE_CREATED, Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, resource))); return resource; }
java
protected CmsResource internalCreateResourceForOrgUnit(CmsDbContext dbc, String path, int flags) throws CmsException { // create the offline folder CmsResource resource = new CmsFolder( new CmsUUID(), new CmsUUID(), path, CmsResourceTypeFolder.RESOURCE_TYPE_ID, (CmsResource.FLAG_INTERNAL | flags), dbc.currentProject().getUuid(), CmsResource.STATE_NEW, 0, dbc.currentUser().getId(), 0, dbc.currentUser().getId(), CmsResource.DATE_RELEASED_DEFAULT, CmsResource.DATE_EXPIRED_DEFAULT, 0); CmsUUID projectId = ((dbc.getProjectId() == null) || dbc.getProjectId().isNullUUID()) ? dbc.currentProject().getUuid() : dbc.getProjectId(); m_driverManager.getVfsDriver(dbc).createResource(dbc, projectId, resource, null); resource.setState(CmsResource.STATE_UNCHANGED); m_driverManager.getVfsDriver(dbc).writeResource(dbc, projectId, resource, CmsDriverManager.NOTHING_CHANGED); if (!dbc.currentProject().isOnlineProject() && dbc.getProjectId().isNullUUID()) { // online persistence CmsProject onlineProject = m_driverManager.readProject(dbc, CmsProject.ONLINE_PROJECT_ID); m_driverManager.getVfsDriver(dbc).createResource(dbc, onlineProject.getUuid(), resource, null); } // clear the internal caches OpenCms.getMemoryMonitor().clearAccessControlListCache(); OpenCms.getMemoryMonitor().flushCache(CmsMemoryMonitor.CacheType.PROPERTY); OpenCms.getMemoryMonitor().flushCache(CmsMemoryMonitor.CacheType.PROPERTY_LIST); // fire an event that a new resource has been created OpenCms.fireCmsEvent( new CmsEvent( I_CmsEventListener.EVENT_RESOURCE_CREATED, Collections.<String, Object> singletonMap(I_CmsEventListener.KEY_RESOURCE, resource))); return resource; }
[ "protected", "CmsResource", "internalCreateResourceForOrgUnit", "(", "CmsDbContext", "dbc", ",", "String", "path", ",", "int", "flags", ")", "throws", "CmsException", "{", "// create the offline folder", "CmsResource", "resource", "=", "new", "CmsFolder", "(", "new", ...
Creates a folder with the given path an properties, offline AND online.<p> @param dbc the current database context @param path the path to create the folder @param flags the resource flags @return the new created offline folder @throws CmsException if something goes wrong
[ "Creates", "a", "folder", "with", "the", "given", "path", "an", "properties", "offline", "AND", "online", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/generic/CmsUserDriver.java#L2449-L2495
lucee/Lucee
core/src/main/java/lucee/runtime/op/Caster.java
Caster.toDate
public static DateTime toDate(Object o, TimeZone tz) throws PageException { return DateCaster.toDateAdvanced(o, tz); }
java
public static DateTime toDate(Object o, TimeZone tz) throws PageException { return DateCaster.toDateAdvanced(o, tz); }
[ "public", "static", "DateTime", "toDate", "(", "Object", "o", ",", "TimeZone", "tz", ")", "throws", "PageException", "{", "return", "DateCaster", ".", "toDateAdvanced", "(", "o", ",", "tz", ")", ";", "}" ]
cast a Object to a DateTime Object @param o Object to cast @param tz @return casted DateTime Object @throws PageException
[ "cast", "a", "Object", "to", "a", "DateTime", "Object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/Caster.java#L2873-L2875
umeding/fuzzer
src/main/java/com/uwemeding/fuzzer/RuleConditions.java
RuleConditions.createAndCondition
public static Node createAndCondition(Node left, Node right) { checkNode(left, IN, AND, OR); checkNode(right, IN, AND, OR); return new Condition(Node.Type.AND, left, right); }
java
public static Node createAndCondition(Node left, Node right) { checkNode(left, IN, AND, OR); checkNode(right, IN, AND, OR); return new Condition(Node.Type.AND, left, right); }
[ "public", "static", "Node", "createAndCondition", "(", "Node", "left", ",", "Node", "right", ")", "{", "checkNode", "(", "left", ",", "IN", ",", "AND", ",", "OR", ")", ";", "checkNode", "(", "right", ",", "IN", ",", "AND", ",", "OR", ")", ";", "ret...
Create an "AND" condition. <p> @param left left side of condition @param right right side of condition @return the "and" condition
[ "Create", "an", "AND", "condition", ".", "<p", ">" ]
train
https://github.com/umeding/fuzzer/blob/e8aa46313bb1d1328865f26f99455124aede828c/src/main/java/com/uwemeding/fuzzer/RuleConditions.java#L52-L56
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/ServerAzureADAdministratorsInner.java
ServerAzureADAdministratorsInner.listByServerAsync
public Observable<List<ServerAzureADAdministratorInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<ServerAzureADAdministratorInner>>, List<ServerAzureADAdministratorInner>>() { @Override public List<ServerAzureADAdministratorInner> call(ServiceResponse<List<ServerAzureADAdministratorInner>> response) { return response.body(); } }); }
java
public Observable<List<ServerAzureADAdministratorInner>> listByServerAsync(String resourceGroupName, String serverName) { return listByServerWithServiceResponseAsync(resourceGroupName, serverName).map(new Func1<ServiceResponse<List<ServerAzureADAdministratorInner>>, List<ServerAzureADAdministratorInner>>() { @Override public List<ServerAzureADAdministratorInner> call(ServiceResponse<List<ServerAzureADAdministratorInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "ServerAzureADAdministratorInner", ">", ">", "listByServerAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ")", "{", "return", "listByServerWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverN...
Returns a list of server Administrators. @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. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;ServerAzureADAdministratorInner&gt; object
[ "Returns", "a", "list", "of", "server", "Administrators", "." ]
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/ServerAzureADAdministratorsInner.java#L542-L549
rhuss/jolokia
agent/core/src/main/java/org/jolokia/util/NetworkUtil.java
NetworkUtil.findLocalAddressListeningOnPort
private static InetAddress findLocalAddressListeningOnPort(String pHost, int pPort) throws UnknownHostException, SocketException { InetAddress address = InetAddress.getByName(pHost); if (address.isLoopbackAddress()) { // First check local address InetAddress localAddress = getLocalAddress(); if (!localAddress.isLoopbackAddress() && isPortOpen(localAddress, pPort)) { return localAddress; } // Then try all addresses attache to all interfaces localAddress = getLocalAddressFromNetworkInterfacesListeningOnPort(pPort); if (localAddress != null) { return localAddress; } } return address; }
java
private static InetAddress findLocalAddressListeningOnPort(String pHost, int pPort) throws UnknownHostException, SocketException { InetAddress address = InetAddress.getByName(pHost); if (address.isLoopbackAddress()) { // First check local address InetAddress localAddress = getLocalAddress(); if (!localAddress.isLoopbackAddress() && isPortOpen(localAddress, pPort)) { return localAddress; } // Then try all addresses attache to all interfaces localAddress = getLocalAddressFromNetworkInterfacesListeningOnPort(pPort); if (localAddress != null) { return localAddress; } } return address; }
[ "private", "static", "InetAddress", "findLocalAddressListeningOnPort", "(", "String", "pHost", ",", "int", "pPort", ")", "throws", "UnknownHostException", ",", "SocketException", "{", "InetAddress", "address", "=", "InetAddress", ".", "getByName", "(", "pHost", ")", ...
Check for an non-loopback, local adress listening on the given port
[ "Check", "for", "an", "non", "-", "loopback", "local", "adress", "listening", "on", "the", "given", "port" ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/util/NetworkUtil.java#L236-L252
aws/aws-sdk-java
aws-java-sdk-core/src/main/java/com/amazonaws/auth/profile/ProfilesConfigFileWriter.java
ProfilesConfigFileWriter.modifyOrInsertProfiles
public static void modifyOrInsertProfiles(File destination, Profile... profiles) { final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>(); for (Profile profile : profiles) { modifications.put(profile.getProfileName(), profile); } modifyProfiles(destination, modifications); }
java
public static void modifyOrInsertProfiles(File destination, Profile... profiles) { final Map<String, Profile> modifications = new LinkedHashMap<String, Profile>(); for (Profile profile : profiles) { modifications.put(profile.getProfileName(), profile); } modifyProfiles(destination, modifications); }
[ "public", "static", "void", "modifyOrInsertProfiles", "(", "File", "destination", ",", "Profile", "...", "profiles", ")", "{", "final", "Map", "<", "String", ",", "Profile", ">", "modifications", "=", "new", "LinkedHashMap", "<", "String", ",", "Profile", ">",...
Modify or insert new profiles into an existing credentials file by in-place modification. Only the properties of the affected profiles will be modified; all the unaffected profiles and comment lines will remain the same. This method does not support renaming a profile. @param destination The destination file to modify @param profiles All the credential profiles to be written.
[ "Modify", "or", "insert", "new", "profiles", "into", "an", "existing", "credentials", "file", "by", "in", "-", "place", "modification", ".", "Only", "the", "properties", "of", "the", "affected", "profiles", "will", "be", "modified", ";", "all", "the", "unaff...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-core/src/main/java/com/amazonaws/auth/profile/ProfilesConfigFileWriter.java#L105-L112