repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
shamanland/xdroid
lib-core/src/main/java/xdroid/core/ThreadUtils.java
ThreadUtils.newHandler
public static Handler newHandler(Handler original, Handler.Callback callback) { return new Handler(original.getLooper(), callback); }
java
public static Handler newHandler(Handler original, Handler.Callback callback) { return new Handler(original.getLooper(), callback); }
[ "public", "static", "Handler", "newHandler", "(", "Handler", "original", ",", "Handler", ".", "Callback", "callback", ")", "{", "return", "new", "Handler", "(", "original", ".", "getLooper", "(", ")", ",", "callback", ")", ";", "}" ]
Creates new {@link Handler} with the same {@link Looper} as the original handler. @param original original handler, can not be null @param callback message handling callback, may be null @return new instance
[ "Creates", "new", "{", "@link", "Handler", "}", "with", "the", "same", "{", "@link", "Looper", "}", "as", "the", "original", "handler", "." ]
train
https://github.com/shamanland/xdroid/blob/5330811114afaf6a7b8f9a10f3bbe19d37995d89/lib-core/src/main/java/xdroid/core/ThreadUtils.java#L67-L69
actorapp/actor-platform
actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java
Messenger.deleteMessages
@ObjectiveCName("deleteMessagesWithPeer:withRids:") public void deleteMessages(Peer peer, long[] rids) { modules.getMessagesModule().deleteMessages(peer, rids); }
java
@ObjectiveCName("deleteMessagesWithPeer:withRids:") public void deleteMessages(Peer peer, long[] rids) { modules.getMessagesModule().deleteMessages(peer, rids); }
[ "@", "ObjectiveCName", "(", "\"deleteMessagesWithPeer:withRids:\"", ")", "public", "void", "deleteMessages", "(", "Peer", "peer", ",", "long", "[", "]", "rids", ")", "{", "modules", ".", "getMessagesModule", "(", ")", ".", "deleteMessages", "(", "peer", ",", "...
Delete messages @param peer destination peer @param rids rids of messages
[ "Delete", "messages" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core/core/core-shared/src/main/java/im/actor/core/Messenger.java#L980-L983
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/timing/StopWatch.java
StopWatch.runMeasured
@Nonnull public static TimeValue runMeasured (@Nonnull final Runnable aRunnable) { final StopWatch aSW = createdStarted (); aRunnable.run (); final long nNanos = aSW.stopAndGetNanos (); return new TimeValue (TimeUnit.NANOSECONDS, nNanos); }
java
@Nonnull public static TimeValue runMeasured (@Nonnull final Runnable aRunnable) { final StopWatch aSW = createdStarted (); aRunnable.run (); final long nNanos = aSW.stopAndGetNanos (); return new TimeValue (TimeUnit.NANOSECONDS, nNanos); }
[ "@", "Nonnull", "public", "static", "TimeValue", "runMeasured", "(", "@", "Nonnull", "final", "Runnable", "aRunnable", ")", "{", "final", "StopWatch", "aSW", "=", "createdStarted", "(", ")", ";", "aRunnable", ".", "run", "(", ")", ";", "final", "long", "nN...
Run the passed runnable and measure the time. @param aRunnable The runnable to be executed. May not be <code>null</code>. @return The elapsed time. Never <code>null</code>.
[ "Run", "the", "passed", "runnable", "and", "measure", "the", "time", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/timing/StopWatch.java#L274-L281
iipc/webarchive-commons
src/main/java/org/archive/util/DateUtils.java
DateUtils.formatBytesForDisplay
public static String formatBytesForDisplay(long amount) { double displayAmount = (double) amount; int unitPowerOf1024 = 0; if(amount <= 0){ return "0 B"; } while(displayAmount>=1024 && unitPowerOf1024 < 4) { displayAmount = displayAmount / 1024; unitPowerOf1024++; } final String[] units = { " B", " KiB", " MiB", " GiB", " TiB" }; // ensure at least 2 significant digits (#.#) for small displayValues int fractionDigits = (displayAmount < 10) ? 1 : 0; return doubleToString(displayAmount, fractionDigits, fractionDigits) + units[unitPowerOf1024]; }
java
public static String formatBytesForDisplay(long amount) { double displayAmount = (double) amount; int unitPowerOf1024 = 0; if(amount <= 0){ return "0 B"; } while(displayAmount>=1024 && unitPowerOf1024 < 4) { displayAmount = displayAmount / 1024; unitPowerOf1024++; } final String[] units = { " B", " KiB", " MiB", " GiB", " TiB" }; // ensure at least 2 significant digits (#.#) for small displayValues int fractionDigits = (displayAmount < 10) ? 1 : 0; return doubleToString(displayAmount, fractionDigits, fractionDigits) + units[unitPowerOf1024]; }
[ "public", "static", "String", "formatBytesForDisplay", "(", "long", "amount", ")", "{", "double", "displayAmount", "=", "(", "double", ")", "amount", ";", "int", "unitPowerOf1024", "=", "0", ";", "if", "(", "amount", "<=", "0", ")", "{", "return", "\"0 B\"...
Takes a byte size and formats it for display with 'friendly' units. <p> This involves converting it to the largest unit (of B, KiB, MiB, GiB, TiB) for which the amount will be > 1. <p> Additionally, at least 2 significant digits are always displayed. <p> Negative numbers will be returned as '0 B'. @param amount the amount of bytes @return A string containing the amount, properly formated.
[ "Takes", "a", "byte", "size", "and", "formats", "it", "for", "display", "with", "friendly", "units", ".", "<p", ">", "This", "involves", "converting", "it", "to", "the", "largest", "unit", "(", "of", "B", "KiB", "MiB", "GiB", "TiB", ")", "for", "which"...
train
https://github.com/iipc/webarchive-commons/blob/988bec707c27a01333becfc3bd502af4441ea1e1/src/main/java/org/archive/util/DateUtils.java#L569-L588
alkacon/opencms-core
src/org/opencms/loader/CmsResourceManager.java
CmsResourceManager.initHtmlConverters
private void initHtmlConverters() { // check if any HTML converter configuration were found if (m_configuredHtmlConverters.size() == 0) { // no converters configured, add default JTidy converter configuration String classJTidy = CmsHtmlConverterJTidy.class.getName(); m_configuredHtmlConverters.add( new CmsHtmlConverterOption(CmsHtmlConverter.PARAM_ENABLED, classJTidy, true)); m_configuredHtmlConverters.add(new CmsHtmlConverterOption(CmsHtmlConverter.PARAM_XHTML, classJTidy, true)); m_configuredHtmlConverters.add(new CmsHtmlConverterOption(CmsHtmlConverter.PARAM_WORD, classJTidy, true)); m_configuredHtmlConverters.add( new CmsHtmlConverterOption(CmsHtmlConverter.PARAM_REPLACE_PARAGRAPHS, classJTidy, true)); } // initialize lookup map of configured HTML converters m_htmlConverters = new HashMap<String, String>(m_configuredHtmlConverters.size()); for (Iterator<CmsHtmlConverterOption> i = m_configuredHtmlConverters.iterator(); i.hasNext();) { CmsHtmlConverterOption converterOption = i.next(); m_htmlConverters.put(converterOption.getName(), converterOption.getClassName()); } }
java
private void initHtmlConverters() { // check if any HTML converter configuration were found if (m_configuredHtmlConverters.size() == 0) { // no converters configured, add default JTidy converter configuration String classJTidy = CmsHtmlConverterJTidy.class.getName(); m_configuredHtmlConverters.add( new CmsHtmlConverterOption(CmsHtmlConverter.PARAM_ENABLED, classJTidy, true)); m_configuredHtmlConverters.add(new CmsHtmlConverterOption(CmsHtmlConverter.PARAM_XHTML, classJTidy, true)); m_configuredHtmlConverters.add(new CmsHtmlConverterOption(CmsHtmlConverter.PARAM_WORD, classJTidy, true)); m_configuredHtmlConverters.add( new CmsHtmlConverterOption(CmsHtmlConverter.PARAM_REPLACE_PARAGRAPHS, classJTidy, true)); } // initialize lookup map of configured HTML converters m_htmlConverters = new HashMap<String, String>(m_configuredHtmlConverters.size()); for (Iterator<CmsHtmlConverterOption> i = m_configuredHtmlConverters.iterator(); i.hasNext();) { CmsHtmlConverterOption converterOption = i.next(); m_htmlConverters.put(converterOption.getName(), converterOption.getClassName()); } }
[ "private", "void", "initHtmlConverters", "(", ")", "{", "// check if any HTML converter configuration were found", "if", "(", "m_configuredHtmlConverters", ".", "size", "(", ")", "==", "0", ")", "{", "// no converters configured, add default JTidy converter configuration", "Str...
Initialize the HTML converters.<p> HTML converters are configured in the OpenCms <code>opencms-vfs.xml</code> configuration file.<p> For legacy reasons, the default JTidy HTML converter has to be loaded if no explicit HTML converters are configured in the configuration file.<p>
[ "Initialize", "the", "HTML", "converters", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/loader/CmsResourceManager.java#L1319-L1339
Stratio/bdt
src/main/java/com/stratio/qa/specs/FileSpec.java
FileSpec.readFileToVariable
@When("^I read file '(.+?)' as '(.+?)' and save it in environment variable '(.+?)' with:$") public void readFileToVariable(String baseData, String type, String envVar, DataTable modifications) throws Exception { // Retrieve data String retrievedData = commonspec.retrieveData(baseData, type); // Modify data commonspec.getLogger().debug("Modifying data {} as {}", retrievedData, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); // Save in environment variable ThreadProperty.set(envVar, modifiedData); }
java
@When("^I read file '(.+?)' as '(.+?)' and save it in environment variable '(.+?)' with:$") public void readFileToVariable(String baseData, String type, String envVar, DataTable modifications) throws Exception { // Retrieve data String retrievedData = commonspec.retrieveData(baseData, type); // Modify data commonspec.getLogger().debug("Modifying data {} as {}", retrievedData, type); String modifiedData = commonspec.modifyData(retrievedData, type, modifications).toString(); // Save in environment variable ThreadProperty.set(envVar, modifiedData); }
[ "@", "When", "(", "\"^I read file '(.+?)' as '(.+?)' and save it in environment variable '(.+?)' with:$\"", ")", "public", "void", "readFileToVariable", "(", "String", "baseData", ",", "String", "type", ",", "String", "envVar", ",", "DataTable", "modifications", ")", "throw...
Read the file passed as parameter, perform the modifications specified and save the result in the environment variable passed as parameter. @param baseData file to read @param type whether the info in the file is a 'json' or a simple 'string' @param envVar name of the variable where to store the result @param modifications modifications to perform in the content of the file
[ "Read", "the", "file", "passed", "as", "parameter", "perform", "the", "modifications", "specified", "and", "save", "the", "result", "in", "the", "environment", "variable", "passed", "as", "parameter", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/specs/FileSpec.java#L171-L182
haifengl/smile
data/src/main/java/smile/data/parser/DelimitedTextParser.java
DelimitedTextParser.setResponseIndex
public DelimitedTextParser setResponseIndex(Attribute response, int index) { if (response.getType() != Attribute.Type.NOMINAL && response.getType() != Attribute.Type.NUMERIC) { throw new IllegalArgumentException("The response variable is not numeric or nominal."); } this.response = response; this.responseIndex = index; return this; }
java
public DelimitedTextParser setResponseIndex(Attribute response, int index) { if (response.getType() != Attribute.Type.NOMINAL && response.getType() != Attribute.Type.NUMERIC) { throw new IllegalArgumentException("The response variable is not numeric or nominal."); } this.response = response; this.responseIndex = index; return this; }
[ "public", "DelimitedTextParser", "setResponseIndex", "(", "Attribute", "response", ",", "int", "index", ")", "{", "if", "(", "response", ".", "getType", "(", ")", "!=", "Attribute", ".", "Type", ".", "NOMINAL", "&&", "response", ".", "getType", "(", ")", "...
Sets the attribute and column index (starting at 0) of dependent/response variable.
[ "Sets", "the", "attribute", "and", "column", "index", "(", "starting", "at", "0", ")", "of", "dependent", "/", "response", "variable", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/data/src/main/java/smile/data/parser/DelimitedTextParser.java#L137-L145
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftClientFactory.java
ThriftClientFactory.getConnection
Connection getConnection(ConnectionPool pool) { ConnectionPool connectionPool = pool; boolean success = false; while (!success) { try { success = true; Cassandra.Client client = connectionPool.getConnection(); if (logger.isDebugEnabled()) { logger.debug("Returning connection of {} :{} .", pool.getPoolProperties().getHost(), pool .getPoolProperties().getPort()); } return new Connection(client, connectionPool); } catch (TException te) { success = false; logger.warn("{} :{} host appears to be down, trying for next ", pool.getPoolProperties().getHost(), pool.getPoolProperties().getPort()); connectionPool = getNewPool(pool.getPoolProperties().getHost(), pool.getPoolProperties().getPort()); } } throw new KunderaException("All hosts are down. please check servers manully."); }
java
Connection getConnection(ConnectionPool pool) { ConnectionPool connectionPool = pool; boolean success = false; while (!success) { try { success = true; Cassandra.Client client = connectionPool.getConnection(); if (logger.isDebugEnabled()) { logger.debug("Returning connection of {} :{} .", pool.getPoolProperties().getHost(), pool .getPoolProperties().getPort()); } return new Connection(client, connectionPool); } catch (TException te) { success = false; logger.warn("{} :{} host appears to be down, trying for next ", pool.getPoolProperties().getHost(), pool.getPoolProperties().getPort()); connectionPool = getNewPool(pool.getPoolProperties().getHost(), pool.getPoolProperties().getPort()); } } throw new KunderaException("All hosts are down. please check servers manully."); }
[ "Connection", "getConnection", "(", "ConnectionPool", "pool", ")", "{", "ConnectionPool", "connectionPool", "=", "pool", ";", "boolean", "success", "=", "false", ";", "while", "(", "!", "success", ")", "{", "try", "{", "success", "=", "true", ";", "Cassandra...
Gets the connection. @param pool the pool @return the connection
[ "Gets", "the", "connection", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/thrift/ThriftClientFactory.java#L278-L307
wcm-io/wcm-io-tooling
commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/PackageManagerHelper.java
PackageManagerHelper.executePackageManagerMethodHtml
public String executePackageManagerMethodHtml(CloseableHttpClient httpClient, HttpRequestBase method) { PackageManagerHtmlCall call = new PackageManagerHtmlCall(httpClient, method, log); String message = executeHttpCallWithRetry(call, 0); return message; }
java
public String executePackageManagerMethodHtml(CloseableHttpClient httpClient, HttpRequestBase method) { PackageManagerHtmlCall call = new PackageManagerHtmlCall(httpClient, method, log); String message = executeHttpCallWithRetry(call, 0); return message; }
[ "public", "String", "executePackageManagerMethodHtml", "(", "CloseableHttpClient", "httpClient", ",", "HttpRequestBase", "method", ")", "{", "PackageManagerHtmlCall", "call", "=", "new", "PackageManagerHtmlCall", "(", "httpClient", ",", "method", ",", "log", ")", ";", ...
Execute CRX HTTP Package manager method and get HTML response. @param httpClient Http client @param method Get or Post method @return Response from HTML server
[ "Execute", "CRX", "HTTP", "Package", "manager", "method", "and", "get", "HTML", "response", "." ]
train
https://github.com/wcm-io/wcm-io-tooling/blob/1abcd01dd3ad4cc248f03b431f929573d84fa9b4/commons/crx-packmgr-helper/src/main/java/io/wcm/tooling/commons/packmgr/PackageManagerHelper.java#L242-L246
Impetus/Kundera
src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraDataTranslator.java
CassandraDataTranslator.marshalMap
public static Map marshalMap(List<Class<?>> mapGenericClasses, Class keyClass, Class valueClass, Map rawMap) { Map dataCollection = new HashMap(); if (keyClass.isAssignableFrom(BytesType.class) || valueClass.isAssignableFrom(BytesType.class)) { Iterator iter = rawMap.keySet().iterator(); while (iter.hasNext()) { Object key = iter.next(); Object value = rawMap.get(key); if (keyClass.isAssignableFrom(BytesType.class)) { byte[] keyAsBytes = new byte[((ByteBuffer) value).remaining()]; ((ByteBuffer) key).get(keyAsBytes); key = PropertyAccessorHelper.getObject(mapGenericClasses.get(0), keyAsBytes); } if (valueClass.isAssignableFrom(BytesType.class)) { byte[] valueAsBytes = new byte[((ByteBuffer) value).remaining()]; ((ByteBuffer) value).get(valueAsBytes); value = PropertyAccessorHelper.getObject(mapGenericClasses.get(1), valueAsBytes); } dataCollection.put(key, value); } } return dataCollection; }
java
public static Map marshalMap(List<Class<?>> mapGenericClasses, Class keyClass, Class valueClass, Map rawMap) { Map dataCollection = new HashMap(); if (keyClass.isAssignableFrom(BytesType.class) || valueClass.isAssignableFrom(BytesType.class)) { Iterator iter = rawMap.keySet().iterator(); while (iter.hasNext()) { Object key = iter.next(); Object value = rawMap.get(key); if (keyClass.isAssignableFrom(BytesType.class)) { byte[] keyAsBytes = new byte[((ByteBuffer) value).remaining()]; ((ByteBuffer) key).get(keyAsBytes); key = PropertyAccessorHelper.getObject(mapGenericClasses.get(0), keyAsBytes); } if (valueClass.isAssignableFrom(BytesType.class)) { byte[] valueAsBytes = new byte[((ByteBuffer) value).remaining()]; ((ByteBuffer) value).get(valueAsBytes); value = PropertyAccessorHelper.getObject(mapGenericClasses.get(1), valueAsBytes); } dataCollection.put(key, value); } } return dataCollection; }
[ "public", "static", "Map", "marshalMap", "(", "List", "<", "Class", "<", "?", ">", ">", "mapGenericClasses", ",", "Class", "keyClass", ",", "Class", "valueClass", ",", "Map", "rawMap", ")", "{", "Map", "dataCollection", "=", "new", "HashMap", "(", ")", "...
In case, key or value class is of type blob. Iterate and populate corresponding byte[] @param mapGenericClasses the map generic classes @param keyClass the key class @param valueClass the value class @param rawMap the raw map @return the map
[ "In", "case", "key", "or", "value", "class", "is", "of", "type", "blob", ".", "Iterate", "and", "populate", "corresponding", "byte", "[]" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraDataTranslator.java#L560-L592
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/builder/Swagger2MarkupConfigBuilder.java
Swagger2MarkupConfigBuilder.getDefaultConfiguration
private Configuration getDefaultConfiguration() { Configurations configs = new Configurations(); try { return configs.properties(PROPERTIES_DEFAULT); } catch (ConfigurationException e) { throw new RuntimeException(String.format("Can't load default properties '%s'", PROPERTIES_DEFAULT), e); } }
java
private Configuration getDefaultConfiguration() { Configurations configs = new Configurations(); try { return configs.properties(PROPERTIES_DEFAULT); } catch (ConfigurationException e) { throw new RuntimeException(String.format("Can't load default properties '%s'", PROPERTIES_DEFAULT), e); } }
[ "private", "Configuration", "getDefaultConfiguration", "(", ")", "{", "Configurations", "configs", "=", "new", "Configurations", "(", ")", ";", "try", "{", "return", "configs", ".", "properties", "(", "PROPERTIES_DEFAULT", ")", ";", "}", "catch", "(", "Configura...
Loads the default properties from the classpath. @return the default properties
[ "Loads", "the", "default", "properties", "from", "the", "classpath", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/builder/Swagger2MarkupConfigBuilder.java#L134-L141
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java
DataFormatHelper.formatTime
public static final String formatTime(long timestamp, boolean useIsoDateFormat) { DateFormat df = dateformats.get(); if (df == null) { df = getDateFormat(); dateformats.set(df); } try { // Get and store the locale Date pattern that was retrieved from getDateTimeInstance, to be used later. // This is to prevent creating multiple new instances of SimpleDateFormat, which is expensive. String ddp = localeDatePattern.get(); if (ddp == null) { ddp = ((SimpleDateFormat) df).toPattern(); localeDatePattern.set(ddp); } if (useIsoDateFormat) { ((SimpleDateFormat) df).applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); } else { ((SimpleDateFormat) df).applyPattern(ddp); } } catch (Exception e) { // Use the default pattern, instead. } return df.format(timestamp); }
java
public static final String formatTime(long timestamp, boolean useIsoDateFormat) { DateFormat df = dateformats.get(); if (df == null) { df = getDateFormat(); dateformats.set(df); } try { // Get and store the locale Date pattern that was retrieved from getDateTimeInstance, to be used later. // This is to prevent creating multiple new instances of SimpleDateFormat, which is expensive. String ddp = localeDatePattern.get(); if (ddp == null) { ddp = ((SimpleDateFormat) df).toPattern(); localeDatePattern.set(ddp); } if (useIsoDateFormat) { ((SimpleDateFormat) df).applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); } else { ((SimpleDateFormat) df).applyPattern(ddp); } } catch (Exception e) { // Use the default pattern, instead. } return df.format(timestamp); }
[ "public", "static", "final", "String", "formatTime", "(", "long", "timestamp", ",", "boolean", "useIsoDateFormat", ")", "{", "DateFormat", "df", "=", "dateformats", ".", "get", "(", ")", ";", "if", "(", "df", "==", "null", ")", "{", "df", "=", "getDateFo...
Return the given time formatted, based on the provided format structure @param timestamp A timestamp as a long, e.g. what would be returned from <code>System.currentTimeMillis()</code> @param useIsoDateFormat A boolean, if true, the given date and time will be formatted in ISO-8601, e.g. yyyy-MM-dd'T'HH:mm:ss.SSSZ if false, the date and time will be formatted as the current locale, @return formated date string
[ "Return", "the", "given", "time", "formatted", "based", "on", "the", "provided", "format", "structure" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/websphere/ras/DataFormatHelper.java#L103-L129
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipAssert.java
SipAssert.assertRequestReceived
public static void assertRequestReceived(String method, long sequenceNumber, MessageListener obj) { assertRequestReceived(null, method, sequenceNumber, obj); }
java
public static void assertRequestReceived(String method, long sequenceNumber, MessageListener obj) { assertRequestReceived(null, method, sequenceNumber, obj); }
[ "public", "static", "void", "assertRequestReceived", "(", "String", "method", ",", "long", "sequenceNumber", ",", "MessageListener", "obj", ")", "{", "assertRequestReceived", "(", "null", ",", "method", ",", "sequenceNumber", ",", "obj", ")", ";", "}" ]
Asserts that the given message listener object received a request with the indicated CSeq method and CSeq sequence number. @param method The CSeq method to look for (SipRequest.REGISTER, etc.) @param sequenceNumber The CSeq sequence number to look for @param obj The MessageListener object (ie, SipCall, Subscription, etc.).
[ "Asserts", "that", "the", "given", "message", "listener", "object", "received", "a", "request", "with", "the", "indicated", "CSeq", "method", "and", "CSeq", "sequence", "number", "." ]
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipAssert.java#L430-L432
geomajas/geomajas-project-client-gwt2
plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/TileBasedLayerClient.java
TileBasedLayerClient.createOsmLayer
public OsmLayer createOsmLayer(String id, int nrOfLevels, String... urls) { OsmLayer layer = new OsmLayer(id, createOsmTileConfiguration(nrOfLevels)); layer.addUrls(Arrays.asList(urls)); return layer; }
java
public OsmLayer createOsmLayer(String id, int nrOfLevels, String... urls) { OsmLayer layer = new OsmLayer(id, createOsmTileConfiguration(nrOfLevels)); layer.addUrls(Arrays.asList(urls)); return layer; }
[ "public", "OsmLayer", "createOsmLayer", "(", "String", "id", ",", "int", "nrOfLevels", ",", "String", "...", "urls", ")", "{", "OsmLayer", "layer", "=", "new", "OsmLayer", "(", "id", ",", "createOsmTileConfiguration", "(", "nrOfLevels", ")", ")", ";", "layer...
Create a new OSM layer with URLs to OSM tile services. <p/> The URLs should have placeholders for the x- and y-coordinate and tile level in the form of {x}, {y}, {z}. The file extension of the tiles should be part of the URL. @param id The unique ID of the layer. @param conf The tile configuration. @param urls The URL to the tile services. @return A new OSM layer. @since 2.2.1
[ "Create", "a", "new", "OSM", "layer", "with", "URLs", "to", "OSM", "tile", "services", ".", "<p", "/", ">", "The", "URLs", "should", "have", "placeholders", "for", "the", "x", "-", "and", "y", "-", "coordinate", "and", "tile", "level", "in", "the", "...
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/TileBasedLayerClient.java#L188-L192
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/clustering/SpectralClustering.java
SpectralClustering.scaleMatrix
private Matrix scaleMatrix(Matrix matrix) { // Scale every data point such that it has a dot product of 1 with // itself. This will make further calculations easier since the dot // product distrubutes when the cosine similarity does not. if (matrix instanceof SparseMatrix) { List<SparseDoubleVector> scaledVectors = new ArrayList<SparseDoubleVector>(matrix.rows()); SparseMatrix sm = (SparseMatrix) matrix; for (int r = 0; r < matrix.rows(); ++r) { SparseDoubleVector v = sm.getRowVector(r); scaledVectors.add(new ScaledSparseDoubleVector( v, 1/v.magnitude())); } return Matrices.asSparseMatrix(scaledVectors); } else { List<DoubleVector> scaledVectors = new ArrayList<DoubleVector>(matrix.rows()); for (int r = 0; r < matrix.rows(); ++r) { DoubleVector v = matrix.getRowVector(r); scaledVectors.add(new ScaledDoubleVector(v, 1/v.magnitude())); } return Matrices.asMatrix(scaledVectors); } }
java
private Matrix scaleMatrix(Matrix matrix) { // Scale every data point such that it has a dot product of 1 with // itself. This will make further calculations easier since the dot // product distrubutes when the cosine similarity does not. if (matrix instanceof SparseMatrix) { List<SparseDoubleVector> scaledVectors = new ArrayList<SparseDoubleVector>(matrix.rows()); SparseMatrix sm = (SparseMatrix) matrix; for (int r = 0; r < matrix.rows(); ++r) { SparseDoubleVector v = sm.getRowVector(r); scaledVectors.add(new ScaledSparseDoubleVector( v, 1/v.magnitude())); } return Matrices.asSparseMatrix(scaledVectors); } else { List<DoubleVector> scaledVectors = new ArrayList<DoubleVector>(matrix.rows()); for (int r = 0; r < matrix.rows(); ++r) { DoubleVector v = matrix.getRowVector(r); scaledVectors.add(new ScaledDoubleVector(v, 1/v.magnitude())); } return Matrices.asMatrix(scaledVectors); } }
[ "private", "Matrix", "scaleMatrix", "(", "Matrix", "matrix", ")", "{", "// Scale every data point such that it has a dot product of 1 with", "// itself. This will make further calculations easier since the dot", "// product distrubutes when the cosine similarity does not.", "if", "(", "ma...
Returns a scaled {@link Matrix}, where each row is the unit magnitude version of the corresponding row vector in {@link matrix}. This is required so that dot product computations over a large number of data points can be distributed, wherease the cosine similarity cannot be.
[ "Returns", "a", "scaled", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/clustering/SpectralClustering.java#L178-L201
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/JobsInner.java
JobsInner.cancelJobAsync
public Observable<Void> cancelJobAsync(String resourceGroupName, String accountName, String transformName, String jobName) { return cancelJobWithServiceResponseAsync(resourceGroupName, accountName, transformName, jobName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> cancelJobAsync(String resourceGroupName, String accountName, String transformName, String jobName) { return cancelJobWithServiceResponseAsync(resourceGroupName, accountName, transformName, jobName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "cancelJobAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "transformName", ",", "String", "jobName", ")", "{", "return", "cancelJobWithServiceResponseAsync", "(", "resourceGroupName", "...
Cancel Job. Cancel a Job. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param transformName The Transform name. @param jobName The Job name. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Cancel", "Job", ".", "Cancel", "a", "Job", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/JobsInner.java#L738-L745
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleUserSegmentRelPersistenceImpl.java
CPRuleUserSegmentRelPersistenceImpl.findAll
@Override public List<CPRuleUserSegmentRel> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CPRuleUserSegmentRel> findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CPRuleUserSegmentRel", ">", "findAll", "(", ")", "{", "return", "findAll", "(", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the cp rule user segment rels. @return the cp rule user segment rels
[ "Returns", "all", "the", "cp", "rule", "user", "segment", "rels", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleUserSegmentRelPersistenceImpl.java#L1665-L1668
OpenLiberty/open-liberty
dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java
ELHelper.removeBrackets
@Trivial static String removeBrackets(String expression, boolean mask) { final String methodName = "removeBrackets"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask }); } expression = expression.trim(); if ((expression.startsWith("${") || expression.startsWith("#{")) && expression.endsWith("}")) { expression = expression.substring(2, expression.length() - 1); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression); } return expression; }
java
@Trivial static String removeBrackets(String expression, boolean mask) { final String methodName = "removeBrackets"; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.entry(tc, methodName, new Object[] { (expression == null) ? null : mask ? OBFUSCATED_STRING : expression, mask }); } expression = expression.trim(); if ((expression.startsWith("${") || expression.startsWith("#{")) && expression.endsWith("}")) { expression = expression.substring(2, expression.length() - 1); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) { Tr.exit(tc, methodName, (expression == null) ? null : mask ? OBFUSCATED_STRING : expression); } return expression; }
[ "@", "Trivial", "static", "String", "removeBrackets", "(", "String", "expression", ",", "boolean", "mask", ")", "{", "final", "String", "methodName", "=", "\"removeBrackets\"", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ...
Remove the brackets from an EL expression. @param expression The expression to remove the brackets from. @param mask Set whether to mask the expression and result. Useful for when passwords might be contained in either the expression or the result. @return The EL expression without the brackets.
[ "Remove", "the", "brackets", "from", "an", "EL", "expression", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec/src/com/ibm/ws/security/javaeesec/identitystore/ELHelper.java#L459-L475
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java
ImageLoading.loadReuseExact
public static ReuseResult loadReuseExact(String fileName, Bitmap dest) throws ImageLoadException { return loadBitmapReuseExact(new FileSource(fileName), dest); }
java
public static ReuseResult loadReuseExact(String fileName, Bitmap dest) throws ImageLoadException { return loadBitmapReuseExact(new FileSource(fileName), dest); }
[ "public", "static", "ReuseResult", "loadReuseExact", "(", "String", "fileName", ",", "Bitmap", "dest", ")", "throws", "ImageLoadException", "{", "return", "loadBitmapReuseExact", "(", "new", "FileSource", "(", "fileName", ")", ",", "dest", ")", ";", "}" ]
Loading bitmap with using reuse bitmap with the same size of source image. If it is unable to load with reuse method tries to load without it. Reuse works only in 3.0+ @param fileName Image file name @param dest reuse bitmap @return result of loading @throws ImageLoadException if it is unable to load file
[ "Loading", "bitmap", "with", "using", "reuse", "bitmap", "with", "the", "same", "size", "of", "source", "image", ".", "If", "it", "is", "unable", "to", "load", "with", "reuse", "method", "tries", "to", "load", "without", "it", ".", "Reuse", "works", "onl...
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L159-L161
gallandarakhneorg/afc
advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java
ClusteredRoadPath.removeRoadSegmentAt
public RoadSegment removeRoadSegmentAt(int index) { if (index >= 0) { int b = 0; for (final RoadPath p : this.paths) { int end = b + p.size(); if (index < end) { end = index - b; return removeRoadSegmentAt(p, end, null); } b = end; } } throw new IndexOutOfBoundsException(); }
java
public RoadSegment removeRoadSegmentAt(int index) { if (index >= 0) { int b = 0; for (final RoadPath p : this.paths) { int end = b + p.size(); if (index < end) { end = index - b; return removeRoadSegmentAt(p, end, null); } b = end; } } throw new IndexOutOfBoundsException(); }
[ "public", "RoadSegment", "removeRoadSegmentAt", "(", "int", "index", ")", "{", "if", "(", "index", ">=", "0", ")", "{", "int", "b", "=", "0", ";", "for", "(", "final", "RoadPath", "p", ":", "this", ".", "paths", ")", "{", "int", "end", "=", "b", ...
Remove the road segment at the given index. @param index an index. @return the removed road segment.
[ "Remove", "the", "road", "segment", "at", "the", "given", "index", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java#L255-L268
b3dgs/lionengine
lionengine-game/src/it/java/com/b3dgs/lionengine/game/it/background/Foreground.java
Foreground.setScreenSize
public final void setScreenSize(int width, int height) { screenWidth = width; screenHeight = height; final double scaleH = width / (double) Scene.NATIVE.getWidth(); final double scaleV = height / (double) Scene.NATIVE.getHeight(); this.scaleH = scaleH; this.scaleV = scaleV; primary.updateMainY(); secondary.updateMainY(); }
java
public final void setScreenSize(int width, int height) { screenWidth = width; screenHeight = height; final double scaleH = width / (double) Scene.NATIVE.getWidth(); final double scaleV = height / (double) Scene.NATIVE.getHeight(); this.scaleH = scaleH; this.scaleV = scaleV; primary.updateMainY(); secondary.updateMainY(); }
[ "public", "final", "void", "setScreenSize", "(", "int", "width", ",", "int", "height", ")", "{", "screenWidth", "=", "width", ";", "screenHeight", "=", "height", ";", "final", "double", "scaleH", "=", "width", "/", "(", "double", ")", "Scene", ".", "NATI...
Called when the resolution changed. @param width The new width. @param height The new height.
[ "Called", "when", "the", "resolution", "changed", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/it/java/com/b3dgs/lionengine/game/it/background/Foreground.java#L105-L115
find-sec-bugs/find-sec-bugs
findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java
Taint.addLocation
public void addLocation(TaintLocation location, boolean isKnownTaintSource) { Objects.requireNonNull(location, "location is null"); if (isKnownTaintSource) { taintLocations.add(location); } else { unknownLocations.add(location); } }
java
public void addLocation(TaintLocation location, boolean isKnownTaintSource) { Objects.requireNonNull(location, "location is null"); if (isKnownTaintSource) { taintLocations.add(location); } else { unknownLocations.add(location); } }
[ "public", "void", "addLocation", "(", "TaintLocation", "location", ",", "boolean", "isKnownTaintSource", ")", "{", "Objects", ".", "requireNonNull", "(", "location", ",", "\"location is null\"", ")", ";", "if", "(", "isKnownTaintSource", ")", "{", "taintLocations", ...
Adds location for a taint source or path to remember for reporting @param location location to remember @param isKnownTaintSource true for tainted value, false if just not safe @throws NullPointerException if location is null
[ "Adds", "location", "for", "a", "taint", "source", "or", "path", "to", "remember", "for", "reporting" ]
train
https://github.com/find-sec-bugs/find-sec-bugs/blob/362da013cef4925e6a1506dd3511fe5bdcc5fba3/findsecbugs-plugin/src/main/java/com/h3xstream/findsecbugs/taintanalysis/Taint.java#L239-L246
jurmous/etcd4j
src/main/java/mousio/etcd4j/transport/EtcdNettyClient.java
EtcdNettyClient.modifyPipeLine
private <R> void modifyPipeLine(final EtcdRequest<R> req, final ChannelPipeline pipeline) { final EtcdResponseHandler<R> handler = new EtcdResponseHandler<>(this, req); if (req.hasTimeout()) { pipeline.addFirst(new ReadTimeoutHandler(req.getTimeout(), req.getTimeoutUnit())); } pipeline.addLast(handler); pipeline.addLast(new ChannelHandlerAdapter() { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { handler.retried(true); req.getPromise().handleRetry(cause); } }); }
java
private <R> void modifyPipeLine(final EtcdRequest<R> req, final ChannelPipeline pipeline) { final EtcdResponseHandler<R> handler = new EtcdResponseHandler<>(this, req); if (req.hasTimeout()) { pipeline.addFirst(new ReadTimeoutHandler(req.getTimeout(), req.getTimeoutUnit())); } pipeline.addLast(handler); pipeline.addLast(new ChannelHandlerAdapter() { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { handler.retried(true); req.getPromise().handleRetry(cause); } }); }
[ "private", "<", "R", ">", "void", "modifyPipeLine", "(", "final", "EtcdRequest", "<", "R", ">", "req", ",", "final", "ChannelPipeline", "pipeline", ")", "{", "final", "EtcdResponseHandler", "<", "R", ">", "handler", "=", "new", "EtcdResponseHandler", "<>", "...
Modify the pipeline for the request @param req to process @param pipeline to modify @param <R> Type of Response
[ "Modify", "the", "pipeline", "for", "the", "request" ]
train
https://github.com/jurmous/etcd4j/blob/ffb1d574cf85bbab025dd566ce250f1860bbcbc7/src/main/java/mousio/etcd4j/transport/EtcdNettyClient.java#L331-L346
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java
AiMaterial.getTextureMapModeU
public AiTextureMapMode getTextureMapModeU(AiTextureType type, int index) { checkTexRange(type, index); Property p = getProperty(PropertyKey.TEX_MAP_MODE_U.m_key); if (null == p || null == p.getData()) { return (AiTextureMapMode) m_defaults.get( PropertyKey.TEX_MAP_MODE_U); } return AiTextureMapMode.fromRawValue(p.getData()); }
java
public AiTextureMapMode getTextureMapModeU(AiTextureType type, int index) { checkTexRange(type, index); Property p = getProperty(PropertyKey.TEX_MAP_MODE_U.m_key); if (null == p || null == p.getData()) { return (AiTextureMapMode) m_defaults.get( PropertyKey.TEX_MAP_MODE_U); } return AiTextureMapMode.fromRawValue(p.getData()); }
[ "public", "AiTextureMapMode", "getTextureMapModeU", "(", "AiTextureType", "type", ",", "int", "index", ")", "{", "checkTexRange", "(", "type", ",", "index", ")", ";", "Property", "p", "=", "getProperty", "(", "PropertyKey", ".", "TEX_MAP_MODE_U", ".", "m_key", ...
Returns the texture mapping mode for the u axis.<p> If missing, defaults to {@link AiTextureMapMode#CLAMP} @param type the texture type @param index the index in the texture stack @return the texture mapping mode
[ "Returns", "the", "texture", "mapping", "mode", "for", "the", "u", "axis", ".", "<p", ">" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/AiMaterial.java#L977-L988
fuinorg/utils4j
src/main/java/org/fuin/utils4j/WaitHelper.java
WaitHelper.waitUntilResult
public <T> T waitUntilResult(final Callable<T> function, final List<T> expectedValues) throws Exception { final List<T> actualResults = new ArrayList<>(); int tries = 0; while (tries < maxTries) { final T result = function.call(); if (expectedValues.contains(result)) { return result; } actualResults.add(result); tries++; Utils4J.sleep(sleepMillis); } throw new IllegalStateException( "Waited too long for one of the expected results: " + expectedValues + ", Actual results: " + actualResults); }
java
public <T> T waitUntilResult(final Callable<T> function, final List<T> expectedValues) throws Exception { final List<T> actualResults = new ArrayList<>(); int tries = 0; while (tries < maxTries) { final T result = function.call(); if (expectedValues.contains(result)) { return result; } actualResults.add(result); tries++; Utils4J.sleep(sleepMillis); } throw new IllegalStateException( "Waited too long for one of the expected results: " + expectedValues + ", Actual results: " + actualResults); }
[ "public", "<", "T", ">", "T", "waitUntilResult", "(", "final", "Callable", "<", "T", ">", "function", ",", "final", "List", "<", "T", ">", "expectedValues", ")", "throws", "Exception", "{", "final", "List", "<", "T", ">", "actualResults", "=", "new", "...
Wait until one of the expected values was returned or the number of wait cycles has been exceeded. Throws {@link IllegalStateException} if the timeout is reached. @param function Function to read the value from. @param expectedValues List of values that are acceptable. @return Result. @throws Exception The function raised an exception. @param <T> Expected return type that must be an object that support equals/hasCode that is not the {@link Object}'s default method.
[ "Wait", "until", "one", "of", "the", "expected", "values", "was", "returned", "or", "the", "number", "of", "wait", "cycles", "has", "been", "exceeded", ".", "Throws", "{", "@link", "IllegalStateException", "}", "if", "the", "timeout", "is", "reached", "." ]
train
https://github.com/fuinorg/utils4j/blob/71cf88e0a8d8ed67bbac513bf3cab165cd7e3280/src/main/java/org/fuin/utils4j/WaitHelper.java#L94-L110
tencentyun/cos-java-sdk
src/main/java/com/qcloud/cos/sign/Sign.java
Sign.getDownLoadSign
public static String getDownLoadSign(String bucketName, String cosPath, Credentials cred, long expired) throws AbstractCosException { return appSignatureBase(cred, bucketName, cosPath, expired, false); }
java
public static String getDownLoadSign(String bucketName, String cosPath, Credentials cred, long expired) throws AbstractCosException { return appSignatureBase(cred, bucketName, cosPath, expired, false); }
[ "public", "static", "String", "getDownLoadSign", "(", "String", "bucketName", ",", "String", "cosPath", ",", "Credentials", "cred", ",", "long", "expired", ")", "throws", "AbstractCosException", "{", "return", "appSignatureBase", "(", "cred", ",", "bucketName", ",...
下载签名, 用于获取后拼接成下载链接,下载私有bucket的文件 @param bucketName bucket名称 @param cosPath 要签名的cos路径 @param cred 用户的身份信息, 包括appid, secret_id和secret_key @param expired 签名过期时间, UNIX时间戳。如想让签名在30秒后过期, 即可将expired设成当前时间加上30秒 @return base64编码的字符串 @throws AbstractCosException
[ "下载签名", "用于获取后拼接成下载链接,下载私有bucket的文件" ]
train
https://github.com/tencentyun/cos-java-sdk/blob/6709a48f67c1ea7b82a7215f5037d6ccf218b630/src/main/java/com/qcloud/cos/sign/Sign.java#L111-L114
ModeShape/modeshape
modeshape-common/src/main/java/org/modeshape/common/util/SecureHash.java
SecureHash.createHashingStream
public static HashingInputStream createHashingStream( String digestName, InputStream inputStream ) throws NoSuchAlgorithmException { MessageDigest digest = MessageDigest.getInstance(digestName); return new HashingInputStream(digest, inputStream); }
java
public static HashingInputStream createHashingStream( String digestName, InputStream inputStream ) throws NoSuchAlgorithmException { MessageDigest digest = MessageDigest.getInstance(digestName); return new HashingInputStream(digest, inputStream); }
[ "public", "static", "HashingInputStream", "createHashingStream", "(", "String", "digestName", ",", "InputStream", "inputStream", ")", "throws", "NoSuchAlgorithmException", "{", "MessageDigest", "digest", "=", "MessageDigest", ".", "getInstance", "(", "digestName", ")", ...
Create an InputStream instance that wraps another stream and that computes the secure hash (using the algorithm with the supplied name) as the returned stream is used. This can be used to compute the hash of a stream while the stream is being processed by another reader, and saves from having to process the same stream twice. @param digestName the name of the hashing function (or {@link MessageDigest message digest}) that should be used @param inputStream the stream containing the content that is to be hashed @return the hash of the contents as a byte array @throws NoSuchAlgorithmException
[ "Create", "an", "InputStream", "instance", "that", "wraps", "another", "stream", "and", "that", "computes", "the", "secure", "hash", "(", "using", "the", "algorithm", "with", "the", "supplied", "name", ")", "as", "the", "returned", "stream", "is", "used", "....
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-common/src/main/java/org/modeshape/common/util/SecureHash.java#L280-L284
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_hunting_agent_agentId_bannerAccess_GET
public OvhBannerAccess billingAccount_ovhPabx_serviceName_hunting_agent_agentId_bannerAccess_GET(String billingAccount, String serviceName, Long agentId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}/bannerAccess"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBannerAccess.class); }
java
public OvhBannerAccess billingAccount_ovhPabx_serviceName_hunting_agent_agentId_bannerAccess_GET(String billingAccount, String serviceName, Long agentId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}/bannerAccess"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBannerAccess.class); }
[ "public", "OvhBannerAccess", "billingAccount_ovhPabx_serviceName_hunting_agent_agentId_bannerAccess_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "agentId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAcco...
Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}/bannerAccess @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param agentId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6163-L6168
krummas/DrizzleJDBC
src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java
DrizzlePreparedStatement.setAsciiStream
public void setAsciiStream(final int parameterIndex, final InputStream x, final int length) throws SQLException { if(x == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new StreamParameter(x, length)); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read stream", e); } }
java
public void setAsciiStream(final int parameterIndex, final InputStream x, final int length) throws SQLException { if(x == null) { setNull(parameterIndex, Types.BLOB); return; } try { setParameter(parameterIndex, new StreamParameter(x, length)); } catch (IOException e) { throw SQLExceptionMapper.getSQLException("Could not read stream", e); } }
[ "public", "void", "setAsciiStream", "(", "final", "int", "parameterIndex", ",", "final", "InputStream", "x", ",", "final", "int", "length", ")", "throws", "SQLException", "{", "if", "(", "x", "==", "null", ")", "{", "setNull", "(", "parameterIndex", ",", "...
Sets the designated parameter to the given input stream, which will have the specified number of bytes. When a very large ASCII value is input to a <code>LONGVARCHAR</code> parameter, it may be more practical to send it via a <code>java.io.InputStream</code>. Data will be read from the stream as needed until end-of-file is reached. The JDBC driver will do any necessary conversion from ASCII to the database char format. <p/> <P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface. @param parameterIndex the first parameter is 1, the second is 2, ... @param x the Java input stream that contains the ASCII parameter value @param length the number of bytes in the stream @throws java.sql.SQLException if parameterIndex does not correspond to a parameter marker in the SQL statement; if a database access error occurs or this method is called on a closed <code>PreparedStatement</code>
[ "Sets", "the", "designated", "parameter", "to", "the", "given", "input", "stream", "which", "will", "have", "the", "specified", "number", "of", "bytes", ".", "When", "a", "very", "large", "ASCII", "value", "is", "input", "to", "a", "<code", ">", "LONGVARCH...
train
https://github.com/krummas/DrizzleJDBC/blob/716f31fd71f3cc289edf69844d8117deb86d98d6/src/main/java/org/drizzle/jdbc/DrizzlePreparedStatement.java#L1200-L1212
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/Validator.java
Validator.demapProperties
public static Map<String, String> demapProperties(final Map<String, String> input, final Description desc) { final Map<String, String> mapping = desc.getPropertiesMapping(); return demapProperties(input, mapping, true); }
java
public static Map<String, String> demapProperties(final Map<String, String> input, final Description desc) { final Map<String, String> mapping = desc.getPropertiesMapping(); return demapProperties(input, mapping, true); }
[ "public", "static", "Map", "<", "String", ",", "String", ">", "demapProperties", "(", "final", "Map", "<", "String", ",", "String", ">", "input", ",", "final", "Description", "desc", ")", "{", "final", "Map", "<", "String", ",", "String", ">", "mapping",...
Reverses a set of properties mapped using the description's configuration to property mapping, or the same input if the description has no mapping @param input input map @param desc plugin description @return mapped values
[ "Reverses", "a", "set", "of", "properties", "mapped", "using", "the", "description", "s", "configuration", "to", "property", "mapping", "or", "the", "same", "input", "if", "the", "description", "has", "no", "mapping" ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/configuration/Validator.java#L277-L280
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/access/defaultdisseminator/DefaultDisseminatorImpl.java
DefaultDisseminatorImpl.viewObjectProfile
public MIMETypedStream viewObjectProfile() throws ServerException { try { ObjectProfile profile = m_access.getObjectProfile(context, reader.GetObjectPID(), asOfDateTime); Reader in = null; try { ReadableCharArrayWriter out = new ReadableCharArrayWriter(1024); DefaultSerializer.objectProfileToXML(profile, asOfDateTime, out); out.close(); in = out.toReader(); } catch (IOException ioe) { throw new GeneralException("[DefaultDisseminatorImpl] An error has occurred. " + "The error was a \"" + ioe.getClass().getName() + "\" . The " + "Reason was \"" + ioe.getMessage() + "\" ."); } //InputStream in = getObjectProfile().getStream(); ReadableByteArrayOutputStream bytes = new ReadableByteArrayOutputStream(4096); PrintWriter out = new PrintWriter( new OutputStreamWriter(bytes, Charset.forName("UTF-8"))); File xslFile = new File(reposHomeDir, "access/viewObjectProfile.xslt"); Templates template = XmlTransformUtility.getTemplates(xslFile); Transformer transformer = template.newTransformer(); transformer.setParameter("fedora", context .getEnvironmentValue(Constants.FEDORA_APP_CONTEXT_NAME)); transformer.transform(new StreamSource(in), new StreamResult(out)); out.close(); return new MIMETypedStream("text/html", bytes.toInputStream(), null, bytes.length()); } catch (Exception e) { throw new DisseminationException("[DefaultDisseminatorImpl] had an error " + "in transforming xml for viewObjectProfile. " + "Underlying exception was: " + e.getMessage()); } }
java
public MIMETypedStream viewObjectProfile() throws ServerException { try { ObjectProfile profile = m_access.getObjectProfile(context, reader.GetObjectPID(), asOfDateTime); Reader in = null; try { ReadableCharArrayWriter out = new ReadableCharArrayWriter(1024); DefaultSerializer.objectProfileToXML(profile, asOfDateTime, out); out.close(); in = out.toReader(); } catch (IOException ioe) { throw new GeneralException("[DefaultDisseminatorImpl] An error has occurred. " + "The error was a \"" + ioe.getClass().getName() + "\" . The " + "Reason was \"" + ioe.getMessage() + "\" ."); } //InputStream in = getObjectProfile().getStream(); ReadableByteArrayOutputStream bytes = new ReadableByteArrayOutputStream(4096); PrintWriter out = new PrintWriter( new OutputStreamWriter(bytes, Charset.forName("UTF-8"))); File xslFile = new File(reposHomeDir, "access/viewObjectProfile.xslt"); Templates template = XmlTransformUtility.getTemplates(xslFile); Transformer transformer = template.newTransformer(); transformer.setParameter("fedora", context .getEnvironmentValue(Constants.FEDORA_APP_CONTEXT_NAME)); transformer.transform(new StreamSource(in), new StreamResult(out)); out.close(); return new MIMETypedStream("text/html", bytes.toInputStream(), null, bytes.length()); } catch (Exception e) { throw new DisseminationException("[DefaultDisseminatorImpl] had an error " + "in transforming xml for viewObjectProfile. " + "Underlying exception was: " + e.getMessage()); } }
[ "public", "MIMETypedStream", "viewObjectProfile", "(", ")", "throws", "ServerException", "{", "try", "{", "ObjectProfile", "profile", "=", "m_access", ".", "getObjectProfile", "(", "context", ",", "reader", ".", "GetObjectPID", "(", ")", ",", "asOfDateTime", ")", ...
Returns an HTML rendering of the object profile which contains key metadata from the object, plus URLs for the object's Dissemination Index and Item Index. The data is returned as HTML in a presentation-oriented format. This is accomplished by doing an XSLT transform on the XML that is obtained from getObjectProfile in API-A. @return html packaged as a MIMETypedStream @throws ServerException
[ "Returns", "an", "HTML", "rendering", "of", "the", "object", "profile", "which", "contains", "key", "metadata", "from", "the", "object", "plus", "URLs", "for", "the", "object", "s", "Dissemination", "Index", "and", "Item", "Index", ".", "The", "data", "is", ...
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/access/defaultdisseminator/DefaultDisseminatorImpl.java#L102-L145
doanduyhai/Achilles
achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java
AbstractProperty.encodeField
public VALUETO encodeField(ENTITY entity, Optional<CassandraOptions> cassandraOptions) { return encodeFromJava(getJavaValue(entity), cassandraOptions); }
java
public VALUETO encodeField(ENTITY entity, Optional<CassandraOptions> cassandraOptions) { return encodeFromJava(getJavaValue(entity), cassandraOptions); }
[ "public", "VALUETO", "encodeField", "(", "ENTITY", "entity", ",", "Optional", "<", "CassandraOptions", ">", "cassandraOptions", ")", "{", "return", "encodeFromJava", "(", "getJavaValue", "(", "entity", ")", ",", "cassandraOptions", ")", ";", "}" ]
Encode the field of the given entity into CQL-compatible value using Achilles codec system and a CassandraOptions containing a runtime SchemaNameProvider. Use the <br/> <br/> <pre class="code"><code class="java"> CassandraOptions.withSchemaNameProvider(SchemaNameProvider provider) </code></pre> <br/> static method to build such a CassandraOptions instance @param entity @return
[ "Encode", "the", "field", "of", "the", "given", "entity", "into", "CQL", "-", "compatible", "value", "using", "Achilles", "codec", "system", "and", "a", "CassandraOptions", "containing", "a", "runtime", "SchemaNameProvider", ".", "Use", "the", "<br", "/", ">",...
train
https://github.com/doanduyhai/Achilles/blob/8281c33100e72c993e570592ae1a5306afac6813/achilles-core/src/main/java/info/archinnov/achilles/internals/metamodel/AbstractProperty.java#L188-L190
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscConfigurationsInner.java
DscConfigurationsInner.createOrUpdateAsync
public Observable<DscConfigurationInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String configurationName, DscConfigurationCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, configurationName, parameters).map(new Func1<ServiceResponse<DscConfigurationInner>, DscConfigurationInner>() { @Override public DscConfigurationInner call(ServiceResponse<DscConfigurationInner> response) { return response.body(); } }); }
java
public Observable<DscConfigurationInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String configurationName, DscConfigurationCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, configurationName, parameters).map(new Func1<ServiceResponse<DscConfigurationInner>, DscConfigurationInner>() { @Override public DscConfigurationInner call(ServiceResponse<DscConfigurationInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DscConfigurationInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "configurationName", ",", "DscConfigurationCreateOrUpdateParameters", "parameters", ")", "{", "return",...
Create the configuration identified by configuration name. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param configurationName The create or update parameters for configuration. @param parameters The create or update parameters for configuration. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DscConfigurationInner object
[ "Create", "the", "configuration", "identified", "by", "configuration", "name", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/DscConfigurationsInner.java#L320-L327
hibernate/hibernate-ogm
neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java
EmbeddedNeo4jEntityQueries.createEmbedded
public Node createEmbedded(GraphDatabaseService executionEngine, Object[] columnValues) { Map<String, Object> params = params( columnValues ); Result result = executionEngine.execute( getCreateEmbeddedNodeQuery(), params ); return singleResult( result ); }
java
public Node createEmbedded(GraphDatabaseService executionEngine, Object[] columnValues) { Map<String, Object> params = params( columnValues ); Result result = executionEngine.execute( getCreateEmbeddedNodeQuery(), params ); return singleResult( result ); }
[ "public", "Node", "createEmbedded", "(", "GraphDatabaseService", "executionEngine", ",", "Object", "[", "]", "columnValues", ")", "{", "Map", "<", "String", ",", "Object", ">", "params", "=", "params", "(", "columnValues", ")", ";", "Result", "result", "=", ...
Create a single node representing an embedded element. @param executionEngine the {@link GraphDatabaseService} used to run the query @param columnValues the values in {@link org.hibernate.ogm.model.key.spi.EntityKey#getColumnValues()} @return the corresponding node;
[ "Create", "a", "single", "node", "representing", "an", "embedded", "element", "." ]
train
https://github.com/hibernate/hibernate-ogm/blob/9ea971df7c27277029006a6f748d8272fb1d69d2/neo4j/src/main/java/org/hibernate/ogm/datastore/neo4j/embedded/dialect/impl/EmbeddedNeo4jEntityQueries.java#L66-L70
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java
Excel07SaxReader.fillBlankCell
private void fillBlankCell(String preCoordinate, String curCoordinate, boolean isEnd) { if (false == curCoordinate.equals(preCoordinate)) { int len = ExcelSaxUtil.countNullCell(preCoordinate, curCoordinate); if (isEnd) { len++; } while (len-- > 0) { rowCellList.add(curCell++, ""); } } }
java
private void fillBlankCell(String preCoordinate, String curCoordinate, boolean isEnd) { if (false == curCoordinate.equals(preCoordinate)) { int len = ExcelSaxUtil.countNullCell(preCoordinate, curCoordinate); if (isEnd) { len++; } while (len-- > 0) { rowCellList.add(curCell++, ""); } } }
[ "private", "void", "fillBlankCell", "(", "String", "preCoordinate", ",", "String", "curCoordinate", ",", "boolean", "isEnd", ")", "{", "if", "(", "false", "==", "curCoordinate", ".", "equals", "(", "preCoordinate", ")", ")", "{", "int", "len", "=", "ExcelSax...
填充空白单元格,如果前一个单元格大于后一个,不需要填充<br> @param preCoordinate 前一个单元格坐标 @param curCoordinate 当前单元格坐标 @param isEnd 是否为最后一个单元格
[ "填充空白单元格,如果前一个单元格大于后一个,不需要填充<br", ">" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/sax/Excel07SaxReader.java#L347-L357
pmayweg/sonar-groovy
sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/jacoco/JaCoCoReportReader.java
JaCoCoReportReader.readJacocoReport
public JaCoCoReportReader readJacocoReport(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoStore) { if (jacocoExecutionData == null) { return this; } JaCoCoExtensions.logger().info("Analysing {}", jacocoExecutionData); try (InputStream inputStream = new BufferedInputStream(new FileInputStream(jacocoExecutionData))) { if (useCurrentBinaryFormat) { ExecutionDataReader reader = new ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataVisitor); reader.read(); } else { org.jacoco.previous.core.data.ExecutionDataReader reader = new org.jacoco.previous.core.data.ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataVisitor); reader.read(); } } catch (IOException e) { throw new IllegalArgumentException(String.format("Unable to read %s", jacocoExecutionData.getAbsolutePath()), e); } return this; }
java
public JaCoCoReportReader readJacocoReport(IExecutionDataVisitor executionDataVisitor, ISessionInfoVisitor sessionInfoStore) { if (jacocoExecutionData == null) { return this; } JaCoCoExtensions.logger().info("Analysing {}", jacocoExecutionData); try (InputStream inputStream = new BufferedInputStream(new FileInputStream(jacocoExecutionData))) { if (useCurrentBinaryFormat) { ExecutionDataReader reader = new ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataVisitor); reader.read(); } else { org.jacoco.previous.core.data.ExecutionDataReader reader = new org.jacoco.previous.core.data.ExecutionDataReader(inputStream); reader.setSessionInfoVisitor(sessionInfoStore); reader.setExecutionDataVisitor(executionDataVisitor); reader.read(); } } catch (IOException e) { throw new IllegalArgumentException(String.format("Unable to read %s", jacocoExecutionData.getAbsolutePath()), e); } return this; }
[ "public", "JaCoCoReportReader", "readJacocoReport", "(", "IExecutionDataVisitor", "executionDataVisitor", ",", "ISessionInfoVisitor", "sessionInfoStore", ")", "{", "if", "(", "jacocoExecutionData", "==", "null", ")", "{", "return", "this", ";", "}", "JaCoCoExtensions", ...
Read JaCoCo report determining the format to be used. @param executionDataVisitor visitor to store execution data. @param sessionInfoStore visitor to store info session. @return true if binary format is the latest one. @throws IOException in case of error or binary format not supported.
[ "Read", "JaCoCo", "report", "determining", "the", "format", "to", "be", "used", "." ]
train
https://github.com/pmayweg/sonar-groovy/blob/2d78d6578304601613db928795d81de340e6fa34/sonar-groovy-plugin/src/main/java/org/sonar/plugins/groovy/jacoco/JaCoCoReportReader.java#L56-L78
acromusashi/acromusashi-stream
src/main/java/acromusashi/stream/bolt/AmBaseBolt.java
AmBaseBolt.emitWithOnlyAnchorAndGroupingStream
protected void emitWithOnlyAnchorAndGroupingStream(StreamMessage message, String groupingKey, String streamId) { getCollector().emit(streamId, this.getExecutingTuple(), new Values(groupingKey, message)); }
java
protected void emitWithOnlyAnchorAndGroupingStream(StreamMessage message, String groupingKey, String streamId) { getCollector().emit(streamId, this.getExecutingTuple(), new Values(groupingKey, message)); }
[ "protected", "void", "emitWithOnlyAnchorAndGroupingStream", "(", "StreamMessage", "message", ",", "String", "groupingKey", ",", "String", "streamId", ")", "{", "getCollector", "(", ")", ".", "emit", "(", "streamId", ",", "this", ".", "getExecutingTuple", "(", ")",...
Use anchor function(child message failed. notify fail to parent message.), and not use this class's key history function.<br> Send message to downstream component with grouping key.<br> Use following situation. <ol> <li>Not use this class's key history function.</li> <li>Use storm's fault detect function.</li> </ol> @param message sending message @param groupingKey grouping key @param streamId streamId
[ "Use", "anchor", "function", "(", "child", "message", "failed", ".", "notify", "fail", "to", "parent", "message", ".", ")", "and", "not", "use", "this", "class", "s", "key", "history", "function", ".", "<br", ">", "Send", "message", "to", "downstream", "...
train
https://github.com/acromusashi/acromusashi-stream/blob/65b1f335d771d657c5640a2056ab5c8546eddec9/src/main/java/acromusashi/stream/bolt/AmBaseBolt.java#L723-L727
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/BiLevelCacheMap.java
BiLevelCacheMap.put
public Object put(Object key, Object value) { synchronized (_cacheL2) { _cacheL2.put(key, value); // not really a miss, but merge to avoid big increase in L2 size // (it cannot be reallocated, it is final) mergeIfNeeded(); } return value; }
java
public Object put(Object key, Object value) { synchronized (_cacheL2) { _cacheL2.put(key, value); // not really a miss, but merge to avoid big increase in L2 size // (it cannot be reallocated, it is final) mergeIfNeeded(); } return value; }
[ "public", "Object", "put", "(", "Object", "key", ",", "Object", "value", ")", "{", "synchronized", "(", "_cacheL2", ")", "{", "_cacheL2", ".", "put", "(", "key", ",", "value", ")", ";", "// not really a miss, but merge to avoid big increase in L2 size", "// (it ca...
If key is already in cacheL1, the new value will show with a delay, since merge L2->L1 may not happen immediately. To force the merge sooner, call <code>size()<code>.
[ "If", "key", "is", "already", "in", "cacheL1", "the", "new", "value", "will", "show", "with", "a", "delay", "since", "merge", "L2", "-", ">", "L1", "may", "not", "happen", "immediately", ".", "To", "force", "the", "merge", "sooner", "call", "<code", ">...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/shared/util/BiLevelCacheMap.java#L162-L174
google/closure-compiler
src/com/google/javascript/jscomp/CheckSuspiciousCode.java
CheckSuspiciousCode.checkLeftOperandOfLogicalOperator
private void checkLeftOperandOfLogicalOperator(NodeTraversal t, Node n) { if (n.isOr() || n.isAnd()) { String operator = n.isOr() ? "||" : "&&"; TernaryValue v = getBooleanValueWithTypes(n.getFirstChild()); if (v != TernaryValue.UNKNOWN) { String result = v == TernaryValue.TRUE ? "truthy" : "falsy"; t.report(n, SUSPICIOUS_LEFT_OPERAND_OF_LOGICAL_OPERATOR, operator, result); } } }
java
private void checkLeftOperandOfLogicalOperator(NodeTraversal t, Node n) { if (n.isOr() || n.isAnd()) { String operator = n.isOr() ? "||" : "&&"; TernaryValue v = getBooleanValueWithTypes(n.getFirstChild()); if (v != TernaryValue.UNKNOWN) { String result = v == TernaryValue.TRUE ? "truthy" : "falsy"; t.report(n, SUSPICIOUS_LEFT_OPERAND_OF_LOGICAL_OPERATOR, operator, result); } } }
[ "private", "void", "checkLeftOperandOfLogicalOperator", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "if", "(", "n", ".", "isOr", "(", ")", "||", "n", ".", "isAnd", "(", ")", ")", "{", "String", "operator", "=", "n", ".", "isOr", "(", ")", ...
Check for the LHS of a logical operator (&amp;&amp; and ||) being deterministically truthy or falsy, using both syntactic and type information. This is always suspicious (though for different reasons: "truthy and" means the LHS is always ignored and should be removed, "falsy and" means the RHS is dead code, and vice versa for "or". However, there are a number of legitimate use cases where we need to back off from using type information (see {@link #getBooleanValueWithTypes} for more details on these back offs).
[ "Check", "for", "the", "LHS", "of", "a", "logical", "operator", "(", "&amp", ";", "&amp", ";", "and", "||", ")", "being", "deterministically", "truthy", "or", "falsy", "using", "both", "syntactic", "and", "type", "information", ".", "This", "is", "always",...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckSuspiciousCode.java#L174-L183
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.getPatternAnyEntityRolesAsync
public Observable<List<EntityRole>> getPatternAnyEntityRolesAsync(UUID appId, String versionId, UUID entityId) { return getPatternAnyEntityRolesWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() { @Override public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) { return response.body(); } }); }
java
public Observable<List<EntityRole>> getPatternAnyEntityRolesAsync(UUID appId, String versionId, UUID entityId) { return getPatternAnyEntityRolesWithServiceResponseAsync(appId, versionId, entityId).map(new Func1<ServiceResponse<List<EntityRole>>, List<EntityRole>>() { @Override public List<EntityRole> call(ServiceResponse<List<EntityRole>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "EntityRole", ">", ">", "getPatternAnyEntityRolesAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "UUID", "entityId", ")", "{", "return", "getPatternAnyEntityRolesWithServiceResponseAsync", "(", "appId", ",", "...
Get All Entity Roles for a given entity. @param appId The application ID. @param versionId The version ID. @param entityId entity Id @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;EntityRole&gt; object
[ "Get", "All", "Entity", "Roles", "for", "a", "given", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L9086-L9093
forge/javaee-descriptors
impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/jobXML10/JobXMLDescriptorImpl.java
JobXMLDescriptorImpl.addNamespace
public JobXMLDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
java
public JobXMLDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
[ "public", "JobXMLDescriptor", "addNamespace", "(", "String", "name", ",", "String", "value", ")", "{", "model", ".", "attribute", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a new namespace @return the current instance of <code>JobXMLDescriptor</code>
[ "Adds", "a", "new", "namespace" ]
train
https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/jobXML10/JobXMLDescriptorImpl.java#L88-L92
jenkinsci/jenkins
core/src/main/java/hudson/Util.java
Util.isDescendant
public static boolean isDescendant(File forParent, File potentialChild) throws IOException { Path child = fileToPath(potentialChild.getAbsoluteFile()).normalize(); Path parent = fileToPath(forParent.getAbsoluteFile()).normalize(); return child.startsWith(parent); }
java
public static boolean isDescendant(File forParent, File potentialChild) throws IOException { Path child = fileToPath(potentialChild.getAbsoluteFile()).normalize(); Path parent = fileToPath(forParent.getAbsoluteFile()).normalize(); return child.startsWith(parent); }
[ "public", "static", "boolean", "isDescendant", "(", "File", "forParent", ",", "File", "potentialChild", ")", "throws", "IOException", "{", "Path", "child", "=", "fileToPath", "(", "potentialChild", ".", "getAbsoluteFile", "(", ")", ")", ".", "normalize", "(", ...
A check if a file path is a descendant of a parent path @param forParent the parent the child should be a descendant of @param potentialChild the path to check @return true if so @throws IOException for invalid paths @since 2.80 @see InvalidPathException
[ "A", "check", "if", "a", "file", "path", "is", "a", "descendant", "of", "a", "parent", "path" ]
train
https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/Util.java#L375-L379
mapsforge/mapsforge
mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/MapFile.java
MapFile.readLabels
@Override public MapReadResult readLabels(Tile upperLeft, Tile lowerRight) { return readMapData(upperLeft, lowerRight, Selector.LABELS); }
java
@Override public MapReadResult readLabels(Tile upperLeft, Tile lowerRight) { return readMapData(upperLeft, lowerRight, Selector.LABELS); }
[ "@", "Override", "public", "MapReadResult", "readLabels", "(", "Tile", "upperLeft", ",", "Tile", "lowerRight", ")", "{", "return", "readMapData", "(", "upperLeft", ",", "lowerRight", ",", "Selector", ".", "LABELS", ")", ";", "}" ]
Reads data for an area defined by the tile in the upper left and the tile in the lower right corner. Precondition: upperLeft.tileX <= lowerRight.tileX && upperLeft.tileY <= lowerRight.tileY @param upperLeft tile that defines the upper left corner of the requested area. @param lowerRight tile that defines the lower right corner of the requested area. @return map data for the tile.
[ "Reads", "data", "for", "an", "area", "defined", "by", "the", "tile", "in", "the", "upper", "left", "and", "the", "tile", "in", "the", "lower", "right", "corner", ".", "Precondition", ":", "upperLeft", ".", "tileX", "<", "=", "lowerRight", ".", "tileX", ...
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map-reader/src/main/java/org/mapsforge/map/reader/MapFile.java#L851-L854
windup/windup
rules-java/api/src/main/java/org/jboss/windup/rules/apps/mavenize/MavenStructureRenderer.java
MavenStructureRenderer.renderFreemarkerTemplate
private static void renderFreemarkerTemplate(Path templatePath, Map vars, Path outputPath) throws IOException, TemplateException { if(templatePath == null) throw new WindupException("templatePath is null"); freemarker.template.Configuration freemarkerConfig = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_26); DefaultObjectWrapperBuilder objectWrapperBuilder = new DefaultObjectWrapperBuilder(freemarker.template.Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); objectWrapperBuilder.setUseAdaptersForContainers(true); objectWrapperBuilder.setIterableSupport(true); freemarkerConfig.setObjectWrapper(objectWrapperBuilder.build()); freemarkerConfig.setTemplateLoader(new FurnaceFreeMarkerTemplateLoader()); Template template = freemarkerConfig.getTemplate(templatePath.toString().replace('\\', '/')); try (FileWriter fw = new FileWriter(outputPath.toFile())) { template.process(vars, fw); } }
java
private static void renderFreemarkerTemplate(Path templatePath, Map vars, Path outputPath) throws IOException, TemplateException { if(templatePath == null) throw new WindupException("templatePath is null"); freemarker.template.Configuration freemarkerConfig = new freemarker.template.Configuration(freemarker.template.Configuration.VERSION_2_3_26); DefaultObjectWrapperBuilder objectWrapperBuilder = new DefaultObjectWrapperBuilder(freemarker.template.Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); objectWrapperBuilder.setUseAdaptersForContainers(true); objectWrapperBuilder.setIterableSupport(true); freemarkerConfig.setObjectWrapper(objectWrapperBuilder.build()); freemarkerConfig.setTemplateLoader(new FurnaceFreeMarkerTemplateLoader()); Template template = freemarkerConfig.getTemplate(templatePath.toString().replace('\\', '/')); try (FileWriter fw = new FileWriter(outputPath.toFile())) { template.process(vars, fw); } }
[ "private", "static", "void", "renderFreemarkerTemplate", "(", "Path", "templatePath", ",", "Map", "vars", ",", "Path", "outputPath", ")", "throws", "IOException", ",", "TemplateException", "{", "if", "(", "templatePath", "==", "null", ")", "throw", "new", "Windu...
Renders the given FreeMarker template to given directory, using given variables.
[ "Renders", "the", "given", "FreeMarker", "template", "to", "given", "directory", "using", "given", "variables", "." ]
train
https://github.com/windup/windup/blob/6668f09e7f012d24a0b4212ada8809417225b2ad/rules-java/api/src/main/java/org/jboss/windup/rules/apps/mavenize/MavenStructureRenderer.java#L120-L137
finmath/finmath-lib
src/main/java/net/finmath/marketdata/products/Cap.java
Cap.getImpliedVolatility
public double getImpliedVolatility(double evaluationTime, AnalyticModel model, VolatilitySurface.QuotingConvention quotingConvention) { double lowerBound = Double.MAX_VALUE; double upperBound = -Double.MAX_VALUE; for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods(); periodIndex++) { double fixingDate = schedule.getFixing(periodIndex); double periodLength = schedule.getPeriodLength(periodIndex); if(periodLength == 0) { continue; } double effektiveStrike = strike; if(isStrikeMoneyness) { effektiveStrike += getATMForward(model, true); } VolatilitySurface volatilitySurface = model.getVolatilitySurface(volatiltiySufaceName); double volatility = volatilitySurface.getValue(model, fixingDate, effektiveStrike, quotingConvention); lowerBound = Math.min(volatility, lowerBound); upperBound = Math.max(volatility, upperBound); } double value = getValueAsPrice(evaluationTime, model); int maxIterations = 100; double maxAccuracy = 0.0; GoldenSectionSearch solver = new GoldenSectionSearch(lowerBound, upperBound); while(solver.getAccuracy() > maxAccuracy && !solver.isDone() && solver.getNumberOfIterations() < maxIterations) { double volatility = solver.getNextPoint(); double[] maturities = { 1.0 }; double[] strikes = { 0.0 }; double[] volatilities = { volatility }; VolatilitySurface flatSurface = new CapletVolatilities(model.getVolatilitySurface(volatiltiySufaceName).getName(), model.getVolatilitySurface(volatiltiySufaceName).getReferenceDate(), model.getForwardCurve(forwardCurveName), maturities, strikes, volatilities, quotingConvention, model.getDiscountCurve(discountCurveName)); AnalyticModel flatModel = model.clone(); flatModel = flatModel.addVolatilitySurfaces(flatSurface); double flatModelValue = this.getValueAsPrice(evaluationTime, flatModel); double error = value-flatModelValue; solver.setValue(error*error); } return solver.getBestPoint(); }
java
public double getImpliedVolatility(double evaluationTime, AnalyticModel model, VolatilitySurface.QuotingConvention quotingConvention) { double lowerBound = Double.MAX_VALUE; double upperBound = -Double.MAX_VALUE; for(int periodIndex=0; periodIndex<schedule.getNumberOfPeriods(); periodIndex++) { double fixingDate = schedule.getFixing(periodIndex); double periodLength = schedule.getPeriodLength(periodIndex); if(periodLength == 0) { continue; } double effektiveStrike = strike; if(isStrikeMoneyness) { effektiveStrike += getATMForward(model, true); } VolatilitySurface volatilitySurface = model.getVolatilitySurface(volatiltiySufaceName); double volatility = volatilitySurface.getValue(model, fixingDate, effektiveStrike, quotingConvention); lowerBound = Math.min(volatility, lowerBound); upperBound = Math.max(volatility, upperBound); } double value = getValueAsPrice(evaluationTime, model); int maxIterations = 100; double maxAccuracy = 0.0; GoldenSectionSearch solver = new GoldenSectionSearch(lowerBound, upperBound); while(solver.getAccuracy() > maxAccuracy && !solver.isDone() && solver.getNumberOfIterations() < maxIterations) { double volatility = solver.getNextPoint(); double[] maturities = { 1.0 }; double[] strikes = { 0.0 }; double[] volatilities = { volatility }; VolatilitySurface flatSurface = new CapletVolatilities(model.getVolatilitySurface(volatiltiySufaceName).getName(), model.getVolatilitySurface(volatiltiySufaceName).getReferenceDate(), model.getForwardCurve(forwardCurveName), maturities, strikes, volatilities, quotingConvention, model.getDiscountCurve(discountCurveName)); AnalyticModel flatModel = model.clone(); flatModel = flatModel.addVolatilitySurfaces(flatSurface); double flatModelValue = this.getValueAsPrice(evaluationTime, flatModel); double error = value-flatModelValue; solver.setValue(error*error); } return solver.getBestPoint(); }
[ "public", "double", "getImpliedVolatility", "(", "double", "evaluationTime", ",", "AnalyticModel", "model", ",", "VolatilitySurface", ".", "QuotingConvention", "quotingConvention", ")", "{", "double", "lowerBound", "=", "Double", ".", "MAX_VALUE", ";", "double", "uppe...
Returns the value of this cap in terms of an implied volatility (of a flat caplet surface). @param evaluationTime The evaluation time as double. Cash flows prior and including this time are not considered. @param model The model under which the product is valued. @param quotingConvention The quoting convention requested for the return value. @return The value of the product using the given model in terms of a implied volatility.
[ "Returns", "the", "value", "of", "this", "cap", "in", "terms", "of", "an", "implied", "volatility", "(", "of", "a", "flat", "caplet", "surface", ")", "." ]
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/marketdata/products/Cap.java#L232-L272
Azure/azure-sdk-for-java
network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerLoadBalancingRulesInner.java
LoadBalancerLoadBalancingRulesInner.listAsync
public Observable<Page<LoadBalancingRuleInner>> listAsync(final String resourceGroupName, final String loadBalancerName) { return listWithServiceResponseAsync(resourceGroupName, loadBalancerName) .map(new Func1<ServiceResponse<Page<LoadBalancingRuleInner>>, Page<LoadBalancingRuleInner>>() { @Override public Page<LoadBalancingRuleInner> call(ServiceResponse<Page<LoadBalancingRuleInner>> response) { return response.body(); } }); }
java
public Observable<Page<LoadBalancingRuleInner>> listAsync(final String resourceGroupName, final String loadBalancerName) { return listWithServiceResponseAsync(resourceGroupName, loadBalancerName) .map(new Func1<ServiceResponse<Page<LoadBalancingRuleInner>>, Page<LoadBalancingRuleInner>>() { @Override public Page<LoadBalancingRuleInner> call(ServiceResponse<Page<LoadBalancingRuleInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "LoadBalancingRuleInner", ">", ">", "listAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "loadBalancerName", ")", "{", "return", "listWithServiceResponseAsync", "(", "resourceGroupName", ",", "load...
Gets all the load balancing rules in a load balancer. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;LoadBalancingRuleInner&gt; object
[ "Gets", "all", "the", "load", "balancing", "rules", "in", "a", "load", "balancer", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_06_01/src/main/java/com/microsoft/azure/management/network/v2018_06_01/implementation/LoadBalancerLoadBalancingRulesInner.java#L123-L131
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/stat/gslb/gslbdomain_stats.java
gslbdomain_stats.get
public static gslbdomain_stats get(nitro_service service, String name) throws Exception{ gslbdomain_stats obj = new gslbdomain_stats(); obj.set_name(name); gslbdomain_stats response = (gslbdomain_stats) obj.stat_resource(service); return response; }
java
public static gslbdomain_stats get(nitro_service service, String name) throws Exception{ gslbdomain_stats obj = new gslbdomain_stats(); obj.set_name(name); gslbdomain_stats response = (gslbdomain_stats) obj.stat_resource(service); return response; }
[ "public", "static", "gslbdomain_stats", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "gslbdomain_stats", "obj", "=", "new", "gslbdomain_stats", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", "...
Use this API to fetch statistics of gslbdomain_stats resource of given name .
[ "Use", "this", "API", "to", "fetch", "statistics", "of", "gslbdomain_stats", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/stat/gslb/gslbdomain_stats.java#L149-L154
infinispan/infinispan
core/src/main/java/org/infinispan/transaction/impl/TransactionTable.java
TransactionTable.markTransactionCompleted
public void markTransactionCompleted(GlobalTransaction gtx, boolean successful) { if (completedTransactionsInfo != null) { completedTransactionsInfo.markTransactionCompleted(gtx, successful); } }
java
public void markTransactionCompleted(GlobalTransaction gtx, boolean successful) { if (completedTransactionsInfo != null) { completedTransactionsInfo.markTransactionCompleted(gtx, successful); } }
[ "public", "void", "markTransactionCompleted", "(", "GlobalTransaction", "gtx", ",", "boolean", "successful", ")", "{", "if", "(", "completedTransactionsInfo", "!=", "null", ")", "{", "completedTransactionsInfo", ".", "markTransactionCompleted", "(", "gtx", ",", "succe...
With the current state transfer implementation it is possible for a transaction to be prepared several times on a remote node. This might cause leaks, e.g. if the transaction is prepared, committed and prepared again. Once marked as completed (because of commit or rollback) any further prepare received on that transaction are discarded.
[ "With", "the", "current", "state", "transfer", "implementation", "it", "is", "possible", "for", "a", "transaction", "to", "be", "prepared", "several", "times", "on", "a", "remote", "node", ".", "This", "might", "cause", "leaks", "e", ".", "g", ".", "if", ...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/transaction/impl/TransactionTable.java#L692-L696
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.unsubscribeResourceFor
public void unsubscribeResourceFor(CmsDbContext dbc, String poolName, CmsPrincipal principal, CmsResource resource) throws CmsException { getSubscriptionDriver().unsubscribeResourceFor(dbc, poolName, principal, resource); }
java
public void unsubscribeResourceFor(CmsDbContext dbc, String poolName, CmsPrincipal principal, CmsResource resource) throws CmsException { getSubscriptionDriver().unsubscribeResourceFor(dbc, poolName, principal, resource); }
[ "public", "void", "unsubscribeResourceFor", "(", "CmsDbContext", "dbc", ",", "String", "poolName", ",", "CmsPrincipal", "principal", ",", "CmsResource", "resource", ")", "throws", "CmsException", "{", "getSubscriptionDriver", "(", ")", ".", "unsubscribeResourceFor", "...
Unsubscribes the principal from the resource.<p> @param dbc the database context @param poolName the name of the database pool to use @param principal the principal that unsubscribes from the resource @param resource the resource to unsubscribe from @throws CmsException if something goes wrong
[ "Unsubscribes", "the", "principal", "from", "the", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L9279-L9283
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/ExternalScriptable.java
ExternalScriptable.has
public synchronized boolean has(int index, Scriptable start) { Integer key = new Integer(index); return indexedProps.containsKey(key); }
java
public synchronized boolean has(int index, Scriptable start) { Integer key = new Integer(index); return indexedProps.containsKey(key); }
[ "public", "synchronized", "boolean", "has", "(", "int", "index", ",", "Scriptable", "start", ")", "{", "Integer", "key", "=", "new", "Integer", "(", "index", ")", ";", "return", "indexedProps", ".", "containsKey", "(", "key", ")", ";", "}" ]
Returns true if the property index is defined. @param index the numeric index for the property @param start the object in which the lookup began @return true if and only if the property was found in the object
[ "Returns", "true", "if", "the", "property", "index", "is", "defined", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/javascript/ExternalScriptable.java#L161-L164
biojava/biojava
biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/GUIFarmJobRunnable.java
GUIFarmJobRunnable.createAndShowGUI
private static void createAndShowGUI(GUIAlignmentProgressListener progressListener) { //Create and set up the window. JFrame frame = new JFrame("Monitor alignment process"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = progressListener; newContentPane.setOpaque(true); //content panes must be opaque newContentPane.setSize(new Dimension(400,400)); frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
java
private static void createAndShowGUI(GUIAlignmentProgressListener progressListener) { //Create and set up the window. JFrame frame = new JFrame("Monitor alignment process"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Create and set up the content pane. JComponent newContentPane = progressListener; newContentPane.setOpaque(true); //content panes must be opaque newContentPane.setSize(new Dimension(400,400)); frame.setContentPane(newContentPane); //Display the window. frame.pack(); frame.setVisible(true); }
[ "private", "static", "void", "createAndShowGUI", "(", "GUIAlignmentProgressListener", "progressListener", ")", "{", "//Create and set up the window.", "JFrame", "frame", "=", "new", "JFrame", "(", "\"Monitor alignment process\"", ")", ";", "frame", ".", "setDefaultCloseOper...
Create the GUI and show it. As with all GUI code, this must run on the event-dispatching thread.
[ "Create", "the", "GUI", "and", "show", "it", ".", "As", "with", "all", "GUI", "code", "this", "must", "run", "on", "the", "event", "-", "dispatching", "thread", "." ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure-gui/src/main/java/org/biojava/nbio/structure/align/gui/GUIFarmJobRunnable.java#L42-L56
killbill/killbill
profiles/killbill/src/main/java/org/killbill/billing/server/log/obfuscators/LuhnMaskingObfuscator.java
LuhnMaskingObfuscator.stripSeparators
@VisibleForTesting String stripSeparators(final String cardNumber) { final int length = cardNumber.length(); final char[] result = new char[length]; int count = 0; char cur; for (int i = 0; i < length; i++) { cur = cardNumber.charAt(i); if (!(cur == ' ' || cur == '-')) { result[count++] = cur; } } if (count == length) { return cardNumber; } return new String(result, 0, count); }
java
@VisibleForTesting String stripSeparators(final String cardNumber) { final int length = cardNumber.length(); final char[] result = new char[length]; int count = 0; char cur; for (int i = 0; i < length; i++) { cur = cardNumber.charAt(i); if (!(cur == ' ' || cur == '-')) { result[count++] = cur; } } if (count == length) { return cardNumber; } return new String(result, 0, count); }
[ "@", "VisibleForTesting", "String", "stripSeparators", "(", "final", "String", "cardNumber", ")", "{", "final", "int", "length", "=", "cardNumber", ".", "length", "(", ")", ";", "final", "char", "[", "]", "result", "=", "new", "char", "[", "length", "]", ...
Remove any ` ` and `-` characters from the given string. @param cardNumber the number to clean up @return if the given string contains no ` ` or `-` characters, the string itself is returned, otherwise a new string containing no ` ` or `-` characters is returned
[ "Remove", "any", "and", "-", "characters", "from", "the", "given", "string", "." ]
train
https://github.com/killbill/killbill/blob/6457b485fb32a182c76197a83f428123331f1380/profiles/killbill/src/main/java/org/killbill/billing/server/log/obfuscators/LuhnMaskingObfuscator.java#L181-L197
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Ftp.java
Ftp.actionGetFile
private AFTPClient actionGetFile() throws PageException, IOException { required("remotefile", remotefile); required("localfile", localfile); AFTPClient client = getClient(); Resource local = ResourceUtil.toResourceExistingParent(pageContext, localfile);// new File(localfile); pageContext.getConfig().getSecurityManager().checkFileLocation(local); if (failifexists && local.exists()) throw new ApplicationException("File [" + local + "] already exist, if you want to overwrite, set attribute failIfExists to false"); OutputStream fos = null; client.setFileType(getType(local)); boolean success = false; try { fos = IOUtil.toBufferedOutputStream(local.getOutputStream()); success = client.retrieveFile(remotefile, fos); } finally { IOUtil.closeEL(fos); if (!success) local.delete(); } writeCfftp(client); return client; }
java
private AFTPClient actionGetFile() throws PageException, IOException { required("remotefile", remotefile); required("localfile", localfile); AFTPClient client = getClient(); Resource local = ResourceUtil.toResourceExistingParent(pageContext, localfile);// new File(localfile); pageContext.getConfig().getSecurityManager().checkFileLocation(local); if (failifexists && local.exists()) throw new ApplicationException("File [" + local + "] already exist, if you want to overwrite, set attribute failIfExists to false"); OutputStream fos = null; client.setFileType(getType(local)); boolean success = false; try { fos = IOUtil.toBufferedOutputStream(local.getOutputStream()); success = client.retrieveFile(remotefile, fos); } finally { IOUtil.closeEL(fos); if (!success) local.delete(); } writeCfftp(client); return client; }
[ "private", "AFTPClient", "actionGetFile", "(", ")", "throws", "PageException", ",", "IOException", "{", "required", "(", "\"remotefile\"", ",", "remotefile", ")", ";", "required", "(", "\"localfile\"", ",", "localfile", ")", ";", "AFTPClient", "client", "=", "ge...
gets a file from server and copy it local @return FTPCLient @throws PageException @throws IOException
[ "gets", "a", "file", "from", "server", "and", "copy", "it", "local" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ftp.java#L424-L446
spring-projects/spring-flex
spring-flex-core/src/main/java/org/springframework/flex/core/AbstractServiceConfigProcessor.java
AbstractServiceConfigProcessor.addDefaultChannels
private void addDefaultChannels(MessageBroker broker, Service service) { List<String> defaultChannelList = new ArrayList<String>(); for (String channelId : this.defaultChannels) { Assert.isTrue(broker.getChannelIds().contains(channelId), "The channel " + channelId + " is not known to the MessageBroker " + broker.getId() + " and cannot be set as a default channel" + " on the " + getServiceClassName()); defaultChannelList.add(channelId); } service.setDefaultChannels(defaultChannelList); }
java
private void addDefaultChannels(MessageBroker broker, Service service) { List<String> defaultChannelList = new ArrayList<String>(); for (String channelId : this.defaultChannels) { Assert.isTrue(broker.getChannelIds().contains(channelId), "The channel " + channelId + " is not known to the MessageBroker " + broker.getId() + " and cannot be set as a default channel" + " on the " + getServiceClassName()); defaultChannelList.add(channelId); } service.setDefaultChannels(defaultChannelList); }
[ "private", "void", "addDefaultChannels", "(", "MessageBroker", "broker", ",", "Service", "service", ")", "{", "List", "<", "String", ">", "defaultChannelList", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "String", "channelId", ":"...
Adds the default channels to the {@link Service} being configured. The <code>defaultChannels</code> will be validated to ensure they exist in the {@link MessageBroker} before they are set. @param broker the newly configured MessageBroker @param remotingService the newly created Service
[ "Adds", "the", "default", "channels", "to", "the", "{", "@link", "Service", "}", "being", "configured", ".", "The", "<code", ">", "defaultChannels<", "/", "code", ">", "will", "be", "validated", "to", "ensure", "they", "exist", "in", "the", "{", "@link", ...
train
https://github.com/spring-projects/spring-flex/blob/85f2bff300d74e2d77d565f97a09d12d18e19adc/spring-flex-core/src/main/java/org/springframework/flex/core/AbstractServiceConfigProcessor.java#L166-L174
alkacon/opencms-core
src/org/opencms/ui/apps/CmsWorkplaceAppManager.java
CmsWorkplaceAppManager.getEditorForResource
public I_CmsEditor getEditorForResource(CmsResource resource, boolean plainText) { List<I_CmsEditor> editors = new ArrayList<I_CmsEditor>(); for (int i = 0; i < EDITORS.length; i++) { if (EDITORS[i].matchesResource(resource, plainText)) { editors.add(EDITORS[i]); } } I_CmsEditor result = null; if (editors.size() == 1) { result = editors.get(0); } else if (editors.size() > 1) { Collections.sort(editors, new Comparator<I_CmsEditor>() { public int compare(I_CmsEditor o1, I_CmsEditor o2) { return o1.getPriority() > o2.getPriority() ? -1 : 1; } }); result = editors.get(0); } return result; }
java
public I_CmsEditor getEditorForResource(CmsResource resource, boolean plainText) { List<I_CmsEditor> editors = new ArrayList<I_CmsEditor>(); for (int i = 0; i < EDITORS.length; i++) { if (EDITORS[i].matchesResource(resource, plainText)) { editors.add(EDITORS[i]); } } I_CmsEditor result = null; if (editors.size() == 1) { result = editors.get(0); } else if (editors.size() > 1) { Collections.sort(editors, new Comparator<I_CmsEditor>() { public int compare(I_CmsEditor o1, I_CmsEditor o2) { return o1.getPriority() > o2.getPriority() ? -1 : 1; } }); result = editors.get(0); } return result; }
[ "public", "I_CmsEditor", "getEditorForResource", "(", "CmsResource", "resource", ",", "boolean", "plainText", ")", "{", "List", "<", "I_CmsEditor", ">", "editors", "=", "new", "ArrayList", "<", "I_CmsEditor", ">", "(", ")", ";", "for", "(", "int", "i", "=", ...
Returns the editor for the given resource.<p> @param resource the resource to edit @param plainText if plain text editing is required @return the editor
[ "Returns", "the", "editor", "for", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsWorkplaceAppManager.java#L467-L489
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_IsValidReason.java
ST_IsValidReason.isValidReason
public static String isValidReason(Geometry geometry, int flag) { if (geometry != null) { if (flag == 0) { return validReason(geometry, false); } else if (flag == 1) { return validReason(geometry, true); } else { throw new IllegalArgumentException("Supported arguments are 0 or 1."); } } return "Null Geometry"; }
java
public static String isValidReason(Geometry geometry, int flag) { if (geometry != null) { if (flag == 0) { return validReason(geometry, false); } else if (flag == 1) { return validReason(geometry, true); } else { throw new IllegalArgumentException("Supported arguments are 0 or 1."); } } return "Null Geometry"; }
[ "public", "static", "String", "isValidReason", "(", "Geometry", "geometry", ",", "int", "flag", ")", "{", "if", "(", "geometry", "!=", "null", ")", "{", "if", "(", "flag", "==", "0", ")", "{", "return", "validReason", "(", "geometry", ",", "false", ")"...
Returns text stating whether a geometry is valid. If not, returns a reason why. @param geometry @param flag @return
[ "Returns", "text", "stating", "whether", "a", "geometry", "is", "valid", ".", "If", "not", "returns", "a", "reason", "why", "." ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/properties/ST_IsValidReason.java#L67-L78
apache/incubator-gobblin
gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableFile.java
CopyableFile.resolveReplicatedOwnerAndPermission
public static OwnerAndPermission resolveReplicatedOwnerAndPermission(FileSystem fs, Path path, CopyConfiguration copyConfiguration) throws IOException { PreserveAttributes preserve = copyConfiguration.getPreserve(); Optional<FileStatus> originFileStatus = copyConfiguration.getCopyContext().getFileStatus(fs, path); if (!originFileStatus.isPresent()) { throw new IOException(String.format("Origin path %s does not exist.", path)); } String group = null; if (copyConfiguration.getTargetGroup().isPresent()) { group = copyConfiguration.getTargetGroup().get(); } else if (preserve.preserve(Option.GROUP)) { group = originFileStatus.get().getGroup(); } return new OwnerAndPermission(preserve.preserve(Option.OWNER) ? originFileStatus.get().getOwner() : null, group, preserve.preserve(Option.PERMISSION) ? originFileStatus.get().getPermission() : null); }
java
public static OwnerAndPermission resolveReplicatedOwnerAndPermission(FileSystem fs, Path path, CopyConfiguration copyConfiguration) throws IOException { PreserveAttributes preserve = copyConfiguration.getPreserve(); Optional<FileStatus> originFileStatus = copyConfiguration.getCopyContext().getFileStatus(fs, path); if (!originFileStatus.isPresent()) { throw new IOException(String.format("Origin path %s does not exist.", path)); } String group = null; if (copyConfiguration.getTargetGroup().isPresent()) { group = copyConfiguration.getTargetGroup().get(); } else if (preserve.preserve(Option.GROUP)) { group = originFileStatus.get().getGroup(); } return new OwnerAndPermission(preserve.preserve(Option.OWNER) ? originFileStatus.get().getOwner() : null, group, preserve.preserve(Option.PERMISSION) ? originFileStatus.get().getPermission() : null); }
[ "public", "static", "OwnerAndPermission", "resolveReplicatedOwnerAndPermission", "(", "FileSystem", "fs", ",", "Path", "path", ",", "CopyConfiguration", "copyConfiguration", ")", "throws", "IOException", "{", "PreserveAttributes", "preserve", "=", "copyConfiguration", ".", ...
Computes the correct {@link OwnerAndPermission} obtained from replicating source owner and permissions and applying the {@link PreserveAttributes} rules in copyConfiguration. @throws IOException
[ "Computes", "the", "correct", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-data-management/src/main/java/org/apache/gobblin/data/management/copy/CopyableFile.java#L307-L326
misha/iroh
src/main/java/com/github/msoliter/iroh/container/services/Injector.java
Injector.eagerlyInject
public void eagerlyInject(Object target, Field field) { /** * We only ever inject fields marked with the correct annotation. */ if (field.getAnnotation(Autowired.class) != null) { field.setAccessible(true); Autowired autowired = field.getAnnotation(Autowired.class); /** * If the field isn't marked for lazy injection, go ahead and inject * it immediately. Otherwise, nullify it with a local "null" * reference of the field's required type. */ if (autowired.lazy() == false) { inject(target, field); } else { nullify(target, field); } } }
java
public void eagerlyInject(Object target, Field field) { /** * We only ever inject fields marked with the correct annotation. */ if (field.getAnnotation(Autowired.class) != null) { field.setAccessible(true); Autowired autowired = field.getAnnotation(Autowired.class); /** * If the field isn't marked for lazy injection, go ahead and inject * it immediately. Otherwise, nullify it with a local "null" * reference of the field's required type. */ if (autowired.lazy() == false) { inject(target, field); } else { nullify(target, field); } } }
[ "public", "void", "eagerlyInject", "(", "Object", "target", ",", "Field", "field", ")", "{", "/**\n * We only ever inject fields marked with the correct annotation.\n */", "if", "(", "field", ".", "getAnnotation", "(", "Autowired", ".", "class", ")", "!=",...
Eagerly injects the target object's target field. Note that if the field is marked for lazy injection, we still inject it, but with a "null" reference. This reference is never seen by user code, and is used internally by Iroh to detect when eager injection has delegated the injection process to lazy injection, thus preventing multiple injection. @param target The target object containing the field to be injected. @param field The target field to be injected in the target object.
[ "Eagerly", "injects", "the", "target", "object", "s", "target", "field", ".", "Note", "that", "if", "the", "field", "is", "marked", "for", "lazy", "injection", "we", "still", "inject", "it", "but", "with", "a", "null", "reference", ".", "This", "reference"...
train
https://github.com/misha/iroh/blob/5dc92a01d3b2f3ba63e8ad1bf9b5fe342d0b679a/src/main/java/com/github/msoliter/iroh/container/services/Injector.java#L75-L96
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryRunner.java
QueryRunner.runPartitionIndexOrPartitionScanQueryOnGivenOwnedPartition
public Result runPartitionIndexOrPartitionScanQueryOnGivenOwnedPartition(Query query, int partitionId) { MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName()); PartitionIdSet partitions = singletonPartitionIdSet(partitionCount, partitionId); // first we optimize the query Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes(partitionId)); Collection<QueryableEntry> entries = null; Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes != null && !indexes.isGlobal()) { entries = indexes.query(predicate); } Result result; if (entries == null) { result = createResult(query, partitions); partitionScanExecutor.execute(query.getMapName(), predicate, partitions, result); result.completeConstruction(partitions); } else { result = populateNonEmptyResult(query, entries, partitions); } return result; }
java
public Result runPartitionIndexOrPartitionScanQueryOnGivenOwnedPartition(Query query, int partitionId) { MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName()); PartitionIdSet partitions = singletonPartitionIdSet(partitionCount, partitionId); // first we optimize the query Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes(partitionId)); Collection<QueryableEntry> entries = null; Indexes indexes = mapContainer.getIndexes(partitionId); if (indexes != null && !indexes.isGlobal()) { entries = indexes.query(predicate); } Result result; if (entries == null) { result = createResult(query, partitions); partitionScanExecutor.execute(query.getMapName(), predicate, partitions, result); result.completeConstruction(partitions); } else { result = populateNonEmptyResult(query, entries, partitions); } return result; }
[ "public", "Result", "runPartitionIndexOrPartitionScanQueryOnGivenOwnedPartition", "(", "Query", "query", ",", "int", "partitionId", ")", "{", "MapContainer", "mapContainer", "=", "mapServiceContext", ".", "getMapContainer", "(", "query", ".", "getMapName", "(", ")", ")"...
for a single partition. If the index is global it won't be asked
[ "for", "a", "single", "partition", ".", "If", "the", "index", "is", "global", "it", "won", "t", "be", "asked" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryRunner.java#L180-L203
looly/hutool
hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java
MapUtil.getBool
public static Boolean getBool(Map<?, ?> map, Object key) { return get(map, key, Boolean.class); }
java
public static Boolean getBool(Map<?, ?> map, Object key) { return get(map, key, Boolean.class); }
[ "public", "static", "Boolean", "getBool", "(", "Map", "<", "?", ",", "?", ">", "map", ",", "Object", "key", ")", "{", "return", "get", "(", "map", ",", "key", ",", "Boolean", ".", "class", ")", ";", "}" ]
获取Map指定key的值,并转换为Bool @param map Map @param key 键 @return 值 @since 4.0.6
[ "获取Map指定key的值,并转换为Bool" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/map/MapUtil.java#L816-L818
MenoData/Time4J
base/src/main/java/net/time4j/range/MomentInterval.java
MomentInterval.toLocalInterval
public TimestampInterval toLocalInterval() { Boundary<PlainTimestamp> b1; Boundary<PlainTimestamp> b2; if (this.getStart().isInfinite()) { b1 = Boundary.infinitePast(); } else { PlainTimestamp t1 = this.getStart().getTemporal().toLocalTimestamp(); b1 = Boundary.of(this.getStart().getEdge(), t1); } if (this.getEnd().isInfinite()) { b2 = Boundary.infiniteFuture(); } else { PlainTimestamp t2 = this.getEnd().getTemporal().toLocalTimestamp(); b2 = Boundary.of(this.getEnd().getEdge(), t2); } return new TimestampInterval(b1, b2); }
java
public TimestampInterval toLocalInterval() { Boundary<PlainTimestamp> b1; Boundary<PlainTimestamp> b2; if (this.getStart().isInfinite()) { b1 = Boundary.infinitePast(); } else { PlainTimestamp t1 = this.getStart().getTemporal().toLocalTimestamp(); b1 = Boundary.of(this.getStart().getEdge(), t1); } if (this.getEnd().isInfinite()) { b2 = Boundary.infiniteFuture(); } else { PlainTimestamp t2 = this.getEnd().getTemporal().toLocalTimestamp(); b2 = Boundary.of(this.getEnd().getEdge(), t2); } return new TimestampInterval(b1, b2); }
[ "public", "TimestampInterval", "toLocalInterval", "(", ")", "{", "Boundary", "<", "PlainTimestamp", ">", "b1", ";", "Boundary", "<", "PlainTimestamp", ">", "b2", ";", "if", "(", "this", ".", "getStart", "(", ")", ".", "isInfinite", "(", ")", ")", "{", "b...
/*[deutsch] <p>Wandelt diese Instanz in ein lokales Zeitstempelintervall um. </p> @return local timestamp interval in system timezone (leap seconds will always be lost) @since 2.0 @see Timezone#ofSystem() @see #toZonalInterval(TZID) @see #toZonalInterval(String)
[ "/", "*", "[", "deutsch", "]", "<p", ">", "Wandelt", "diese", "Instanz", "in", "ein", "lokales", "Zeitstempelintervall", "um", ".", "<", "/", "p", ">" ]
train
https://github.com/MenoData/Time4J/blob/08b2eda6b2dbb140b92011cf7071bb087edd46a5/base/src/main/java/net/time4j/range/MomentInterval.java#L573-L595
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
JavacParser.earlier
static int earlier(int pos1, int pos2) { if (pos1 == Position.NOPOS) return pos2; if (pos2 == Position.NOPOS) return pos1; return (pos1 < pos2 ? pos1 : pos2); }
java
static int earlier(int pos1, int pos2) { if (pos1 == Position.NOPOS) return pos2; if (pos2 == Position.NOPOS) return pos1; return (pos1 < pos2 ? pos1 : pos2); }
[ "static", "int", "earlier", "(", "int", "pos1", ",", "int", "pos2", ")", "{", "if", "(", "pos1", "==", "Position", ".", "NOPOS", ")", "return", "pos2", ";", "if", "(", "pos2", "==", "Position", ".", "NOPOS", ")", "return", "pos1", ";", "return", "(...
Return the lesser of two positions, making allowance for either one being unset.
[ "Return", "the", "lesser", "of", "two", "positions", "making", "allowance", "for", "either", "one", "being", "unset", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java#L4017-L4023
googleapis/google-cloud-java
google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java
ClusterManagerClient.getServerConfig
public final ServerConfig getServerConfig(String projectId, String zone) { GetServerConfigRequest request = GetServerConfigRequest.newBuilder().setProjectId(projectId).setZone(zone).build(); return getServerConfig(request); }
java
public final ServerConfig getServerConfig(String projectId, String zone) { GetServerConfigRequest request = GetServerConfigRequest.newBuilder().setProjectId(projectId).setZone(zone).build(); return getServerConfig(request); }
[ "public", "final", "ServerConfig", "getServerConfig", "(", "String", "projectId", ",", "String", "zone", ")", "{", "GetServerConfigRequest", "request", "=", "GetServerConfigRequest", ".", "newBuilder", "(", ")", ".", "setProjectId", "(", "projectId", ")", ".", "se...
Returns configuration info about the Kubernetes Engine service. <p>Sample code: <pre><code> try (ClusterManagerClient clusterManagerClient = ClusterManagerClient.create()) { String projectId = ""; String zone = ""; ServerConfig response = clusterManagerClient.getServerConfig(projectId, zone); } </code></pre> @param projectId Deprecated. The Google Developers Console [project ID or project number](https://support.google.com/cloud/answer/6158840). This field has been deprecated and replaced by the name field. @param zone Deprecated. The name of the Google Compute Engine [zone](/compute/docs/zones#available) to return operations for. This field has been deprecated and replaced by the name field. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Returns", "configuration", "info", "about", "the", "Kubernetes", "Engine", "service", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-container/src/main/java/com/google/cloud/container/v1/ClusterManagerClient.java#L1653-L1658
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.WSG84_L1
@Pure public static Point2d WSG84_L1(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_1_N, LAMBERT_1_C, LAMBERT_1_XS, LAMBERT_1_YS); }
java
@Pure public static Point2d WSG84_L1(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_1_N, LAMBERT_1_C, LAMBERT_1_XS, LAMBERT_1_YS); }
[ "@", "Pure", "public", "static", "Point2d", "WSG84_L1", "(", "double", "lambda", ",", "double", "phi", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "WSG84_NTFLamdaPhi", "(", "lambda", ",", "phi", ")", ";", "return", "NTFLambdaPhi_NTFLambert", "(", "ntfLa...
This function convert WSG84 GPS coordinate to France Lambert I coordinate. @param lambda in degrees. @param phi in degrees. @return the France Lambert I coordinates.
[ "This", "function", "convert", "WSG84", "GPS", "coordinate", "to", "France", "Lambert", "I", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1061-L1070
aoindustries/aocode-public
src/main/java/com/aoindustries/servlet/jsp/tagext/JspTagUtils.java
JspTagUtils.findAncestor
public static <T> T findAncestor(JspTag from, Class<? extends T> clazz) throws JspException { T parent = clazz.cast(SimpleTagSupport.findAncestorWithClass(from, clazz)); if(parent==null) throw new LocalizedJspException(accessor, "JspTagUtils.findAncestor.notFound", getClassName(from.getClass()), getClassName(clazz)); return parent; }
java
public static <T> T findAncestor(JspTag from, Class<? extends T> clazz) throws JspException { T parent = clazz.cast(SimpleTagSupport.findAncestorWithClass(from, clazz)); if(parent==null) throw new LocalizedJspException(accessor, "JspTagUtils.findAncestor.notFound", getClassName(from.getClass()), getClassName(clazz)); return parent; }
[ "public", "static", "<", "T", ">", "T", "findAncestor", "(", "JspTag", "from", ",", "Class", "<", "?", "extends", "T", ">", "clazz", ")", "throws", "JspException", "{", "T", "parent", "=", "clazz", ".", "cast", "(", "SimpleTagSupport", ".", "findAncestor...
Finds the first parent tag of the provided class (or subclass) or implementing the provided interface. @return the parent tag @exception JspException if parent not found
[ "Finds", "the", "first", "parent", "tag", "of", "the", "provided", "class", "(", "or", "subclass", ")", "or", "implementing", "the", "provided", "interface", "." ]
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/servlet/jsp/tagext/JspTagUtils.java#L53-L57
overturetool/overture
ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/VdmBreakpointPropertyPage.java
VdmBreakpointPropertyPage.createText
protected Text createText(Composite parent, String initialValue) { Text t = SWTFactory.createText(parent, SWT.SINGLE | SWT.BORDER, 1); t.setText(initialValue); return t; }
java
protected Text createText(Composite parent, String initialValue) { Text t = SWTFactory.createText(parent, SWT.SINGLE | SWT.BORDER, 1); t.setText(initialValue); return t; }
[ "protected", "Text", "createText", "(", "Composite", "parent", ",", "String", "initialValue", ")", "{", "Text", "t", "=", "SWTFactory", ".", "createText", "(", "parent", ",", "SWT", ".", "SINGLE", "|", "SWT", ".", "BORDER", ",", "1", ")", ";", "t", "."...
Creates a fully configured text editor with the given initial value @param parent @param initialValue @return the configured text editor
[ "Creates", "a", "fully", "configured", "text", "editor", "with", "the", "given", "initial", "value" ]
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/debug/src/main/java/org/overture/ide/debug/ui/propertypages/VdmBreakpointPropertyPage.java#L476-L481
Teddy-Zhu/SilentGo
utils/src/main/java/com/silentgo/utils/asm/Type.java
Type.getClassName
public String getClassName() { switch (sort) { case VOID: return "void"; case BOOLEAN: return "boolean"; case CHAR: return "char"; case BYTE: return "byte"; case SHORT: return "short"; case INT: return "int"; case FLOAT: return "float"; case LONG: return "long"; case DOUBLE: return "double"; case ARRAY: StringBuilder sb = new StringBuilder(getElementType().getClassName()); for (int i = getDimensions(); i > 0; --i) { sb.append("[]"); } return sb.toString(); case OBJECT: return new String(buf, off, len).replace('/', '.').intern(); default: return null; } }
java
public String getClassName() { switch (sort) { case VOID: return "void"; case BOOLEAN: return "boolean"; case CHAR: return "char"; case BYTE: return "byte"; case SHORT: return "short"; case INT: return "int"; case FLOAT: return "float"; case LONG: return "long"; case DOUBLE: return "double"; case ARRAY: StringBuilder sb = new StringBuilder(getElementType().getClassName()); for (int i = getDimensions(); i > 0; --i) { sb.append("[]"); } return sb.toString(); case OBJECT: return new String(buf, off, len).replace('/', '.').intern(); default: return null; } }
[ "public", "String", "getClassName", "(", ")", "{", "switch", "(", "sort", ")", "{", "case", "VOID", ":", "return", "\"void\"", ";", "case", "BOOLEAN", ":", "return", "\"boolean\"", ";", "case", "CHAR", ":", "return", "\"char\"", ";", "case", "BYTE", ":",...
Returns the binary name of the class corresponding to this type. This method must not be used on method types. @return the binary name of the class corresponding to this type.
[ "Returns", "the", "binary", "name", "of", "the", "class", "corresponding", "to", "this", "type", ".", "This", "method", "must", "not", "be", "used", "on", "method", "types", "." ]
train
https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/asm/Type.java#L547-L578
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/StreamSupport.java
StreamSupport.intStream
public static IntStream intStream(Spliterator.OfInt spliterator, boolean parallel) { return new IntPipeline.Head<>(spliterator, StreamOpFlag.fromCharacteristics(spliterator), parallel); }
java
public static IntStream intStream(Spliterator.OfInt spliterator, boolean parallel) { return new IntPipeline.Head<>(spliterator, StreamOpFlag.fromCharacteristics(spliterator), parallel); }
[ "public", "static", "IntStream", "intStream", "(", "Spliterator", ".", "OfInt", "spliterator", ",", "boolean", "parallel", ")", "{", "return", "new", "IntPipeline", ".", "Head", "<>", "(", "spliterator", ",", "StreamOpFlag", ".", "fromCharacteristics", "(", "spl...
Creates a new sequential or parallel {@code IntStream} from a {@code Spliterator.OfInt}. <p>The spliterator is only traversed, split, or queried for estimated size after the terminal operation of the stream pipeline commences. <p>It is strongly recommended the spliterator report a characteristic of {@code IMMUTABLE} or {@code CONCURRENT}, or be <a href="../Spliterator.html#binding">late-binding</a>. Otherwise, {@link #intStream(java.util.function.Supplier, int, boolean)} should be used to reduce the scope of potential interference with the source. See <a href="package-summary.html#NonInterference">Non-Interference</a> for more details. @param spliterator a {@code Spliterator.OfInt} describing the stream elements @param parallel if {@code true} then the returned stream is a parallel stream; if {@code false} the returned stream is a sequential stream. @return a new sequential or parallel {@code IntStream}
[ "Creates", "a", "new", "sequential", "or", "parallel", "{", "@code", "IntStream", "}", "from", "a", "{", "@code", "Spliterator", ".", "OfInt", "}", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/StreamSupport.java#L137-L141
phax/ph-commons
ph-charset/src/main/java/com/helger/charset/utf7/UTF7StyleCharsetEncoder.java
UTF7StyleCharsetEncoder._unshift
private void _unshift (final ByteBuffer out, final char ch) { if (!m_bBase64mode) return; if (m_nBitsToOutput != 0) out.put (m_aBase64.getChar (m_nSextet)); if (m_aBase64.contains (ch) || ch == m_nUnshift || m_bStrict) out.put (m_nUnshift); m_bBase64mode = false; m_nSextet = 0; m_nBitsToOutput = 0; }
java
private void _unshift (final ByteBuffer out, final char ch) { if (!m_bBase64mode) return; if (m_nBitsToOutput != 0) out.put (m_aBase64.getChar (m_nSextet)); if (m_aBase64.contains (ch) || ch == m_nUnshift || m_bStrict) out.put (m_nUnshift); m_bBase64mode = false; m_nSextet = 0; m_nBitsToOutput = 0; }
[ "private", "void", "_unshift", "(", "final", "ByteBuffer", "out", ",", "final", "char", "ch", ")", "{", "if", "(", "!", "m_bBase64mode", ")", "return", ";", "if", "(", "m_nBitsToOutput", "!=", "0", ")", "out", ".", "put", "(", "m_aBase64", ".", "getCha...
<p> Writes the bytes necessary to leave <i>base 64 mode</i>. This might include an unshift character. </p> @param out @param ch
[ "<p", ">", "Writes", "the", "bytes", "necessary", "to", "leave", "<i", ">", "base", "64", "mode<", "/", "i", ">", ".", "This", "might", "include", "an", "unshift", "character", ".", "<", "/", "p", ">" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-charset/src/main/java/com/helger/charset/utf7/UTF7StyleCharsetEncoder.java#L172-L183
juebanlin/util4j
util4j/src/main/java/net/jueb/util4j/proxy/methodProxy/MethodHandleUtil.java
MethodHandleUtil.proxyMethod
public static MethodHandleProxy proxyMethod(Object target,String methodName,Object ...args) { MethodHandle mh=findMethodHandle(target, methodName, args); if(mh!=null) { return new MethodHandleProxy(target, mh, args); } return null; }
java
public static MethodHandleProxy proxyMethod(Object target,String methodName,Object ...args) { MethodHandle mh=findMethodHandle(target, methodName, args); if(mh!=null) { return new MethodHandleProxy(target, mh, args); } return null; }
[ "public", "static", "MethodHandleProxy", "proxyMethod", "(", "Object", "target", ",", "String", "methodName", ",", "Object", "...", "args", ")", "{", "MethodHandle", "mh", "=", "findMethodHandle", "(", "target", ",", "methodName", ",", "args", ")", ";", "if", ...
代理对象方法 会根据方法名和方法参数严格匹配 @param target 代理对象 @param methodName 对象方法名 @param args 对象方法参数 @return
[ "代理对象方法", "会根据方法名和方法参数严格匹配" ]
train
https://github.com/juebanlin/util4j/blob/c404b2dbdedf7a8890533b351257fa8af4f1439f/util4j/src/main/java/net/jueb/util4j/proxy/methodProxy/MethodHandleUtil.java#L34-L42
GeoLatte/geolatte-common
src/main/java/org/geolatte/common/expressions/Expressions.java
Expressions.isEqual
public static BooleanIsEqual isEqual(ComparableExpression<Boolean> left, Boolean constant) { return new BooleanIsEqual(left, constant(constant)); }
java
public static BooleanIsEqual isEqual(ComparableExpression<Boolean> left, Boolean constant) { return new BooleanIsEqual(left, constant(constant)); }
[ "public", "static", "BooleanIsEqual", "isEqual", "(", "ComparableExpression", "<", "Boolean", ">", "left", ",", "Boolean", "constant", ")", "{", "return", "new", "BooleanIsEqual", "(", "left", ",", "constant", "(", "constant", ")", ")", ";", "}" ]
Creates a BooleanIsEqual expression from the given expression and constant. @param left The left expression. @param constant The constant to compare to. @return A new BooleanIsEqual binary expression.
[ "Creates", "a", "BooleanIsEqual", "expression", "from", "the", "given", "expression", "and", "constant", "." ]
train
https://github.com/GeoLatte/geolatte-common/blob/dc7f92b04d8c6cb706e78cb95e746d8f12089d95/src/main/java/org/geolatte/common/expressions/Expressions.java#L186-L188
phax/ph-schedule
ph-mini-quartz/src/main/java/com/helger/quartz/JobBuilder.java
JobBuilder.withIdentity
public JobBuilder withIdentity (final String name, final String group) { m_aKey = new JobKey (name, group); return this; }
java
public JobBuilder withIdentity (final String name, final String group) { m_aKey = new JobKey (name, group); return this; }
[ "public", "JobBuilder", "withIdentity", "(", "final", "String", "name", ",", "final", "String", "group", ")", "{", "m_aKey", "=", "new", "JobKey", "(", "name", ",", "group", ")", ";", "return", "this", ";", "}" ]
Use a <code>JobKey</code> with the given name and group to identify the JobDetail. <p> If none of the 'withIdentity' methods are set on the JobBuilder, then a random, unique JobKey will be generated. </p> @param name the name element for the Job's JobKey @param group the group element for the Job's JobKey @return the updated JobBuilder @see JobKey @see IJobDetail#getKey()
[ "Use", "a", "<code", ">", "JobKey<", "/", "code", ">", "with", "the", "given", "name", "and", "group", "to", "identify", "the", "JobDetail", ".", "<p", ">", "If", "none", "of", "the", "withIdentity", "methods", "are", "set", "on", "the", "JobBuilder", ...
train
https://github.com/phax/ph-schedule/blob/b000790b46a9f8d23ad44cc20591f753d07c0229/ph-mini-quartz/src/main/java/com/helger/quartz/JobBuilder.java#L153-L157
ManfredTremmel/gwt-bean-validators
gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/impl/GroupChainGenerator.java
GroupChainGenerator.insertInheritedGroups
private void insertInheritedGroups(final Class<?> clazz, final GroupChain chain) { validationGroupsMetadata.getParentsOfGroup(clazz).forEach(inheritedGroup -> { final Group group = new Group(inheritedGroup); chain.insertGroup(group); insertInheritedGroups(inheritedGroup, chain); }); }
java
private void insertInheritedGroups(final Class<?> clazz, final GroupChain chain) { validationGroupsMetadata.getParentsOfGroup(clazz).forEach(inheritedGroup -> { final Group group = new Group(inheritedGroup); chain.insertGroup(group); insertInheritedGroups(inheritedGroup, chain); }); }
[ "private", "void", "insertInheritedGroups", "(", "final", "Class", "<", "?", ">", "clazz", ",", "final", "GroupChain", "chain", ")", "{", "validationGroupsMetadata", ".", "getParentsOfGroup", "(", "clazz", ")", ".", "forEach", "(", "inheritedGroup", "->", "{", ...
Recursively add inherited groups into the group chain. @param clazz The group interface @param chain The group chain we are currently building.
[ "Recursively", "add", "inherited", "groups", "into", "the", "group", "chain", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/gwt-bean-validators/src/main/java/de/knightsoftnet/validators/client/impl/GroupChainGenerator.java#L128-L134
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/ToolScreen.java
ToolScreen.getNextLocation
public ScreenLocation getNextLocation(short position, short setNewAnchor) { if (position == ScreenConstants.FIRST_LOCATION) position = ScreenConstants.FIRST_FIELD_BUTTON_LOCATION; if (position == ScreenConstants.NEXT_LOGICAL) position = ScreenConstants.RIGHT_OF_LAST_BUTTON; return super.getNextLocation(position, setNewAnchor); }
java
public ScreenLocation getNextLocation(short position, short setNewAnchor) { if (position == ScreenConstants.FIRST_LOCATION) position = ScreenConstants.FIRST_FIELD_BUTTON_LOCATION; if (position == ScreenConstants.NEXT_LOGICAL) position = ScreenConstants.RIGHT_OF_LAST_BUTTON; return super.getNextLocation(position, setNewAnchor); }
[ "public", "ScreenLocation", "getNextLocation", "(", "short", "position", ",", "short", "setNewAnchor", ")", "{", "if", "(", "position", "==", "ScreenConstants", ".", "FIRST_LOCATION", ")", "position", "=", "ScreenConstants", ".", "FIRST_FIELD_BUTTON_LOCATION", ";", ...
Code this position and Anchor to add it to the LayoutManager. @param position The location constant (see ScreenConstants). @param setNewAnchor The anchor constant. @return The new screen location object.
[ "Code", "this", "position", "and", "Anchor", "to", "add", "it", "to", "the", "LayoutManager", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/ToolScreen.java#L99-L106
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/GridRowSet.java
GridRowSet.getCellPolygon
private Polygon getCellPolygon() { final Coordinate[] summits = new Coordinate[5]; double x1 = minX + cellI * deltaX; double y1 = minY + cellJ * deltaY; double x2 = minX + (cellI + 1) * deltaX; double y2 = minY + (cellJ + 1) * deltaY; summits[0] = new Coordinate(x1, y1); summits[1] = new Coordinate(x2, y1); summits[2] = new Coordinate(x2, y2); summits[3] = new Coordinate(x1, y2); summits[4] = new Coordinate(x1, y1); final LinearRing g = GF.createLinearRing(summits); final Polygon gg = GF.createPolygon(g, null); cellI++; return gg; }
java
private Polygon getCellPolygon() { final Coordinate[] summits = new Coordinate[5]; double x1 = minX + cellI * deltaX; double y1 = minY + cellJ * deltaY; double x2 = minX + (cellI + 1) * deltaX; double y2 = minY + (cellJ + 1) * deltaY; summits[0] = new Coordinate(x1, y1); summits[1] = new Coordinate(x2, y1); summits[2] = new Coordinate(x2, y2); summits[3] = new Coordinate(x1, y2); summits[4] = new Coordinate(x1, y1); final LinearRing g = GF.createLinearRing(summits); final Polygon gg = GF.createPolygon(g, null); cellI++; return gg; }
[ "private", "Polygon", "getCellPolygon", "(", ")", "{", "final", "Coordinate", "[", "]", "summits", "=", "new", "Coordinate", "[", "5", "]", ";", "double", "x1", "=", "minX", "+", "cellI", "*", "deltaX", ";", "double", "y1", "=", "minY", "+", "cellJ", ...
Compute the polygon corresponding to the cell @return Polygon of the cell
[ "Compute", "the", "polygon", "corresponding", "to", "the", "cell" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/create/GridRowSet.java#L143-L158
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/GeneralizedCounter.java
GeneralizedCounter.incrementCount2D
public void incrementCount2D(K first, K second, double count) { if (depth != 2) { wrongDepth(); //throws exception } this.addToTotal(count); GeneralizedCounter<K> next = this.conditionalizeHelper(first); next.incrementCount1D(second, count); }
java
public void incrementCount2D(K first, K second, double count) { if (depth != 2) { wrongDepth(); //throws exception } this.addToTotal(count); GeneralizedCounter<K> next = this.conditionalizeHelper(first); next.incrementCount1D(second, count); }
[ "public", "void", "incrementCount2D", "(", "K", "first", ",", "K", "second", ",", "double", "count", ")", "{", "if", "(", "depth", "!=", "2", ")", "{", "wrongDepth", "(", ")", ";", "//throws exception\r", "}", "this", ".", "addToTotal", "(", "count", "...
Equivalent to incrementCount( new Object[] { first, second }, count ). Makes the special case easier, and also more efficient.
[ "Equivalent", "to", "incrementCount", "(", "new", "Object", "[]", "{", "first", "second", "}", "count", ")", ".", "Makes", "the", "special", "case", "easier", "and", "also", "more", "efficient", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/GeneralizedCounter.java#L492-L500
apollographql/apollo-android
apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java
ResponseField.forLong
public static ResponseField forLong(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.LONG, responseName, fieldName, arguments, optional, conditions); }
java
public static ResponseField forLong(String responseName, String fieldName, Map<String, Object> arguments, boolean optional, List<Condition> conditions) { return new ResponseField(Type.LONG, responseName, fieldName, arguments, optional, conditions); }
[ "public", "static", "ResponseField", "forLong", "(", "String", "responseName", ",", "String", "fieldName", ",", "Map", "<", "String", ",", "Object", ">", "arguments", ",", "boolean", "optional", ",", "List", "<", "Condition", ">", "conditions", ")", "{", "re...
Factory method for creating a Field instance representing {@link Type#LONG}. @param responseName alias for the result of a field @param fieldName name of the field in the GraphQL operation @param arguments arguments to be passed along with the field @param optional whether the arguments passed along are optional or required @param conditions list of conditions for this field @return Field instance representing {@link Type#LONG}
[ "Factory", "method", "for", "creating", "a", "Field", "instance", "representing", "{", "@link", "Type#LONG", "}", "." ]
train
https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-api/src/main/java/com/apollographql/apollo/api/ResponseField.java#L70-L73
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/rest/RegisteredCommand.java
RegisteredCommand.compareNodes
private static int compareNodes(String node1, String node2) { assert node1 != null; assert node2 != null; if (node1.equals(node2)) { return 0; } if (node1.length() > 0 && node1.charAt(0) == '{') { if (node2.length() > 0 && node2.charAt(0) == '{') { return 0; // Both nodes are parameters; names are irrelevant } return 1; // r1 is a parameter but r2 is not, so r2 should come first } if (node2.length() > 0 && node2.charAt(0) == '{') { return -1; // r2 is a parameter but r1 is not, so r1 should come first } return node1.compareTo(node2); // neither node is a parameter }
java
private static int compareNodes(String node1, String node2) { assert node1 != null; assert node2 != null; if (node1.equals(node2)) { return 0; } if (node1.length() > 0 && node1.charAt(0) == '{') { if (node2.length() > 0 && node2.charAt(0) == '{') { return 0; // Both nodes are parameters; names are irrelevant } return 1; // r1 is a parameter but r2 is not, so r2 should come first } if (node2.length() > 0 && node2.charAt(0) == '{') { return -1; // r2 is a parameter but r1 is not, so r1 should come first } return node1.compareTo(node2); // neither node is a parameter }
[ "private", "static", "int", "compareNodes", "(", "String", "node1", ",", "String", "node2", ")", "{", "assert", "node1", "!=", "null", ";", "assert", "node2", "!=", "null", ";", "if", "(", "node1", ".", "equals", "(", "node2", ")", ")", "{", "return", ...
path nodes are query parameters. Either node can be empty, but not null.
[ "path", "nodes", "are", "query", "parameters", ".", "Either", "node", "can", "be", "empty", "but", "not", "null", "." ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/rest/RegisteredCommand.java#L223-L240
Stratio/cassandra-lucene-index
plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilder.java
SearchBuilder.toJson
public String toJson() { build(); try { return JsonSerializer.toString(this); } catch (IOException e) { throw new IndexException(e, "Unformateable JSON search: {}", e.getMessage()); } }
java
public String toJson() { build(); try { return JsonSerializer.toString(this); } catch (IOException e) { throw new IndexException(e, "Unformateable JSON search: {}", e.getMessage()); } }
[ "public", "String", "toJson", "(", ")", "{", "build", "(", ")", ";", "try", "{", "return", "JsonSerializer", ".", "toString", "(", "this", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IndexException", "(", "e", ",", "\"...
Returns the JSON representation of this object. @return a JSON representation of this object
[ "Returns", "the", "JSON", "representation", "of", "this", "object", "." ]
train
https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/plugin/src/main/java/com/stratio/cassandra/lucene/search/SearchBuilder.java#L140-L147
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java
DeprecatedAPIListBuilder.composeDeprecatedList
private void composeDeprecatedList(List<Doc> list, MemberDoc[] members) { for (int i = 0; i < members.length; i++) { if (Util.isDeprecated(members[i])) { list.add(members[i]); } } }
java
private void composeDeprecatedList(List<Doc> list, MemberDoc[] members) { for (int i = 0; i < members.length; i++) { if (Util.isDeprecated(members[i])) { list.add(members[i]); } } }
[ "private", "void", "composeDeprecatedList", "(", "List", "<", "Doc", ">", "list", ",", "MemberDoc", "[", "]", "members", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "members", ".", "length", ";", "i", "++", ")", "{", "if", "(", "Ut...
Add the members into a single list of deprecated members. @param list List of all the particular deprecated members, e.g. methods. @param members members to be added in the list.
[ "Add", "the", "members", "into", "a", "single", "list", "of", "deprecated", "members", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java#L133-L139
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/CmsGalleryTreeItem.java
CmsGalleryTreeItem.createListWidget
private CmsListItemWidget createListWidget(CmsGalleryFolderEntry galleryFolder) { String title; if (galleryFolder.getOwnProperties().containsKey(CmsClientProperty.PROPERTY_TITLE)) { title = galleryFolder.getOwnProperties().get(CmsClientProperty.PROPERTY_TITLE).getStructureValue(); } else { title = CmsResource.getName(galleryFolder.getSitePath()); if (title.endsWith("/")) { title = title.substring(0, title.length() - 1); } } CmsListInfoBean infoBean = new CmsListInfoBean(title, galleryFolder.getSitePath(), null); CmsListItemWidget result = new CmsGalleryListItemWidget(infoBean); result.setIcon(galleryFolder.getIconClasses()); result.addIconClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { CmsSitemapView.getInstance().getController().loadPath( getSitePath(), new AsyncCallback<CmsClientSitemapEntry>() { public void onFailure(Throwable caught) { // nothing to do } public void onSuccess(CmsClientSitemapEntry entry) { showGallery(entry); } }); } }); if ((CmsSitemapView.getInstance().getController().getEntryById(galleryFolder.getStructureId()) == null) || CmsSitemapView.getInstance().getController().getEntryById(galleryFolder.getStructureId()).isEditable()) { result.addTitleStyleName(I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().itemTitle()); result.setTitleEditable(true); result.setTitleEditHandler(new I_CmsTitleEditHandler() { /** * @see org.opencms.gwt.client.ui.CmsListItemWidget.I_CmsTitleEditHandler#handleEdit(org.opencms.gwt.client.ui.input.CmsLabel, com.google.gwt.user.client.ui.TextBox) */ public void handleEdit(final CmsLabel titleLabel, final TextBox box) { CmsSitemapView.getInstance().getController().loadPath( getSitePath(), new AsyncCallback<CmsClientSitemapEntry>() { public void onFailure(Throwable caught) { // nothing to do } public void onSuccess(CmsClientSitemapEntry editEntry) { CmsGalleryTreeItem.this.handleEdit(editEntry, box.getText()); box.removeFromParent(); titleLabel.setVisible(true); } }); } }); } return result; }
java
private CmsListItemWidget createListWidget(CmsGalleryFolderEntry galleryFolder) { String title; if (galleryFolder.getOwnProperties().containsKey(CmsClientProperty.PROPERTY_TITLE)) { title = galleryFolder.getOwnProperties().get(CmsClientProperty.PROPERTY_TITLE).getStructureValue(); } else { title = CmsResource.getName(galleryFolder.getSitePath()); if (title.endsWith("/")) { title = title.substring(0, title.length() - 1); } } CmsListInfoBean infoBean = new CmsListInfoBean(title, galleryFolder.getSitePath(), null); CmsListItemWidget result = new CmsGalleryListItemWidget(infoBean); result.setIcon(galleryFolder.getIconClasses()); result.addIconClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { CmsSitemapView.getInstance().getController().loadPath( getSitePath(), new AsyncCallback<CmsClientSitemapEntry>() { public void onFailure(Throwable caught) { // nothing to do } public void onSuccess(CmsClientSitemapEntry entry) { showGallery(entry); } }); } }); if ((CmsSitemapView.getInstance().getController().getEntryById(galleryFolder.getStructureId()) == null) || CmsSitemapView.getInstance().getController().getEntryById(galleryFolder.getStructureId()).isEditable()) { result.addTitleStyleName(I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().itemTitle()); result.setTitleEditable(true); result.setTitleEditHandler(new I_CmsTitleEditHandler() { /** * @see org.opencms.gwt.client.ui.CmsListItemWidget.I_CmsTitleEditHandler#handleEdit(org.opencms.gwt.client.ui.input.CmsLabel, com.google.gwt.user.client.ui.TextBox) */ public void handleEdit(final CmsLabel titleLabel, final TextBox box) { CmsSitemapView.getInstance().getController().loadPath( getSitePath(), new AsyncCallback<CmsClientSitemapEntry>() { public void onFailure(Throwable caught) { // nothing to do } public void onSuccess(CmsClientSitemapEntry editEntry) { CmsGalleryTreeItem.this.handleEdit(editEntry, box.getText()); box.removeFromParent(); titleLabel.setVisible(true); } }); } }); } return result; }
[ "private", "CmsListItemWidget", "createListWidget", "(", "CmsGalleryFolderEntry", "galleryFolder", ")", "{", "String", "title", ";", "if", "(", "galleryFolder", ".", "getOwnProperties", "(", ")", ".", "containsKey", "(", "CmsClientProperty", ".", "PROPERTY_TITLE", ")"...
Creates the list item widget for the given folder.<p> @param galleryFolder the gallery folder @return the list item widget
[ "Creates", "the", "list", "item", "widget", "for", "the", "given", "folder", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsGalleryTreeItem.java#L240-L306
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java
JDBCResultSet.updateTime
public void updateTime(String columnLabel, Time x) throws SQLException { updateTime(findColumn(columnLabel), x); }
java
public void updateTime(String columnLabel, Time x) throws SQLException { updateTime(findColumn(columnLabel), x); }
[ "public", "void", "updateTime", "(", "String", "columnLabel", ",", "Time", "x", ")", "throws", "SQLException", "{", "updateTime", "(", "findColumn", "(", "columnLabel", ")", ",", "x", ")", ";", "}" ]
<!-- start generic documentation --> Updates the designated column with a <code>java.sql.Time</code> value. The updater methods are used to update column values in the current row or the insert row. The updater methods do not update the underlying database; instead the <code>updateRow</code> or <code>insertRow</code> methods are called to update the database. <!-- end generic documentation --> <!-- start release-specific documentation --> <div class="ReleaseSpecificDocumentation"> <h3>HSQLDB-Specific Information:</h3> <p> HSQLDB supports this feature. <p> </div> <!-- end release-specific documentation --> @param columnLabel the label for the column specified with the SQL AS clause. If the SQL AS clause was not specified, then the label is the name of the column @param x the new column value @exception SQLException if a database access error occurs, the result set concurrency is <code>CONCUR_READ_ONLY</code> or this method is called on a closed result set @exception SQLFeatureNotSupportedException if the JDBC driver does not support this method @since JDK 1.2 (JDK 1.1.x developers: read the overview for JDBCResultSet)
[ "<!", "--", "start", "generic", "documentation", "--", ">", "Updates", "the", "designated", "column", "with", "a", "<code", ">", "java", ".", "sql", ".", "Time<", "/", "code", ">", "value", ".", "The", "updater", "methods", "are", "used", "to", "update",...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCResultSet.java#L3641-L3643
Waikato/moa
moa/src/main/java/moa/classifiers/lazy/neighboursearch/EuclideanDistance.java
EuclideanDistance.updateDistance
protected double updateDistance(double currDist, double diff) { double result; result = currDist; result += diff * diff; return result; }
java
protected double updateDistance(double currDist, double diff) { double result; result = currDist; result += diff * diff; return result; }
[ "protected", "double", "updateDistance", "(", "double", "currDist", ",", "double", "diff", ")", "{", "double", "result", ";", "result", "=", "currDist", ";", "result", "+=", "diff", "*", "diff", ";", "return", "result", ";", "}" ]
Updates the current distance calculated so far with the new difference between two attributes. The difference between the attributes was calculated with the difference(int,double,double) method. @param currDist the current distance calculated so far @param diff the difference between two new attributes @return the update distance @see #difference(int, double, double)
[ "Updates", "the", "current", "distance", "calculated", "so", "far", "with", "the", "new", "difference", "between", "two", "attributes", ".", "The", "difference", "between", "the", "attributes", "was", "calculated", "with", "the", "difference", "(", "int", "doubl...
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/lazy/neighboursearch/EuclideanDistance.java#L138-L145
qspin/qtaste
kernel/src/main/java/com/qspin/qtaste/tcom/jmx/impl/JMXClient.java
JMXClient.addNotificationListener
public boolean addNotificationListener(String mbeanName, NotificationListener listener) throws Exception { if (isConnected()) { ObjectName objectName = new ObjectName(mbeanName); jmxc.addConnectionNotificationListener(listener, null, null); mbsc.addNotificationListener(objectName, listener, null, null); return true; } else { return false; } }
java
public boolean addNotificationListener(String mbeanName, NotificationListener listener) throws Exception { if (isConnected()) { ObjectName objectName = new ObjectName(mbeanName); jmxc.addConnectionNotificationListener(listener, null, null); mbsc.addNotificationListener(objectName, listener, null, null); return true; } else { return false; } }
[ "public", "boolean", "addNotificationListener", "(", "String", "mbeanName", ",", "NotificationListener", "listener", ")", "throws", "Exception", "{", "if", "(", "isConnected", "(", ")", ")", "{", "ObjectName", "objectName", "=", "new", "ObjectName", "(", "mbeanNam...
/* Adds listener as notification and connection notification listener. @return true if successful, false otherwise @throws java.lang.Exception
[ "/", "*", "Adds", "listener", "as", "notification", "and", "connection", "notification", "listener", "." ]
train
https://github.com/qspin/qtaste/blob/ba45d4d86eb29b92f157c6e98536dee2002ddfdc/kernel/src/main/java/com/qspin/qtaste/tcom/jmx/impl/JMXClient.java#L96-L105
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java
UnitQuaternions.orientationAngle
public static double orientationAngle(Point3d[] fixed, Point3d[] moved, boolean centered) { if (!centered) { fixed = CalcPoint.clonePoint3dArray(fixed); moved = CalcPoint.clonePoint3dArray(moved); CalcPoint.center(fixed); CalcPoint.center(moved); } return orientationAngle(fixed, moved); }
java
public static double orientationAngle(Point3d[] fixed, Point3d[] moved, boolean centered) { if (!centered) { fixed = CalcPoint.clonePoint3dArray(fixed); moved = CalcPoint.clonePoint3dArray(moved); CalcPoint.center(fixed); CalcPoint.center(moved); } return orientationAngle(fixed, moved); }
[ "public", "static", "double", "orientationAngle", "(", "Point3d", "[", "]", "fixed", ",", "Point3d", "[", "]", "moved", ",", "boolean", "centered", ")", "{", "if", "(", "!", "centered", ")", "{", "fixed", "=", "CalcPoint", ".", "clonePoint3dArray", "(", ...
The angle of the relative orientation of the two sets of points in 3D. Equivalent to {@link #angle(Quat4d)} of the unit quaternion obtained by {@link #relativeOrientation(Point3d[], Point3d[])}. @param fixed array of Point3d. Original coordinates will not be modified. @param moved array of Point3d. Original coordinates will not be modified. @param centered true if the points are already centered at the origin @return the angle in radians of the relative orientation of the points, angle to rotate moved to bring it to the same orientation as fixed.
[ "The", "angle", "of", "the", "relative", "orientation", "of", "the", "two", "sets", "of", "points", "in", "3D", ".", "Equivalent", "to", "{", "@link", "#angle", "(", "Quat4d", ")", "}", "of", "the", "unit", "quaternion", "obtained", "by", "{", "@link", ...
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/geometry/UnitQuaternions.java#L178-L187
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/DateContext.java
DateContext.compareDate
public boolean compareDate(Date date1, Date date2) { if (date1 == null || date2 == null) { return false; } boolean result; GregorianCalendar cal1 = new GregorianCalendar(); GregorianCalendar cal2 = new GregorianCalendar(); cal1.setTime(date1); cal2.setTime(date2); if (cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && cal1.get(Calendar.DATE) == cal2.get(Calendar.DATE)) { result = true; } else { result = false; } return result; }
java
public boolean compareDate(Date date1, Date date2) { if (date1 == null || date2 == null) { return false; } boolean result; GregorianCalendar cal1 = new GregorianCalendar(); GregorianCalendar cal2 = new GregorianCalendar(); cal1.setTime(date1); cal2.setTime(date2); if (cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && cal1.get(Calendar.DATE) == cal2.get(Calendar.DATE)) { result = true; } else { result = false; } return result; }
[ "public", "boolean", "compareDate", "(", "Date", "date1", ",", "Date", "date2", ")", "{", "if", "(", "date1", "==", "null", "||", "date2", "==", "null", ")", "{", "return", "false", ";", "}", "boolean", "result", ";", "GregorianCalendar", "cal1", "=", ...
Compare one date to another for equality in year, month and date. Note that this ignores all other values including the time. If either value is <code>null</code>, including if both are <code>null</code>, then <code>false</code> is returned. @param date1 The first date to compare. @param date2 The second date to compare. @return <code>true</code> if both dates have the same year/month/date, <code>false</code> if not.
[ "Compare", "one", "date", "to", "another", "for", "equality", "in", "year", "month", "and", "date", ".", "Note", "that", "this", "ignores", "all", "other", "values", "including", "the", "time", ".", "If", "either", "value", "is", "<code", ">", "null<", "...
train
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/DateContext.java#L485-L505
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java
NodeSet.setElementAt
public void setElementAt(Node node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } m_map[index] = node; }
java
public void setElementAt(Node node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!"); if (null == m_map) { m_map = new Node[m_blocksize]; m_mapSize = m_blocksize; } m_map[index] = node; }
[ "public", "void", "setElementAt", "(", "Node", "node", ",", "int", "index", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESET_NOT_MUTABLE", ...
Sets the component at the specified index of this vector to be the specified object. The previous component at that position is discarded. The index must be a value greater than or equal to 0 and less than the current size of the vector. @param node Node to set @param index Index of where to set the node
[ "Sets", "the", "component", "at", "the", "specified", "index", "of", "this", "vector", "to", "be", "the", "specified", "object", ".", "The", "previous", "component", "at", "that", "position", "is", "discarded", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L1258-L1270
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.L2_WSG84
@Pure public static GeodesicPosition L2_WSG84(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2_N, LAMBERT_2_C, LAMBERT_2_XS, LAMBERT_2_YS); return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY()); }
java
@Pure public static GeodesicPosition L2_WSG84(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_2_N, LAMBERT_2_C, LAMBERT_2_XS, LAMBERT_2_YS); return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY()); }
[ "@", "Pure", "public", "static", "GeodesicPosition", "L2_WSG84", "(", "double", "x", ",", "double", "y", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "NTFLambert_NTFLambdaPhi", "(", "x", ",", "y", ",", "LAMBERT_2_N", ",", "LAMBERT_2_C", ",", "LAMBERT_2_X...
This function convert France Lambert II coordinate to geographic WSG84 Data. @param x is the coordinate in France Lambert II @param y is the coordinate in France Lambert II @return lambda and phi in geographic WSG84 in degrees.
[ "This", "function", "convert", "France", "Lambert", "II", "coordinate", "to", "geographic", "WSG84", "Data", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L419-L427
Ordinastie/MalisisCore
src/main/java/net/malisis/core/util/raytrace/Raytrace.java
Raytrace.getClosestHit
public static RayTraceResult getClosestHit(RayTraceResult.Type hitType, Point src, RayTraceResult result1, RayTraceResult result2) { if (result1 == null) return result2; if (result2 == null) return result1; if (result1.typeOfHit == RayTraceResult.Type.MISS && result2.typeOfHit == hitType) return result2; if (result1.typeOfHit == hitType && result2.typeOfHit == RayTraceResult.Type.MISS) return result1; if (Point.distanceSquared(src, new Point(result1.hitVec)) > Point.distanceSquared(src, new Point(result2.hitVec))) return result2; return result1; }
java
public static RayTraceResult getClosestHit(RayTraceResult.Type hitType, Point src, RayTraceResult result1, RayTraceResult result2) { if (result1 == null) return result2; if (result2 == null) return result1; if (result1.typeOfHit == RayTraceResult.Type.MISS && result2.typeOfHit == hitType) return result2; if (result1.typeOfHit == hitType && result2.typeOfHit == RayTraceResult.Type.MISS) return result1; if (Point.distanceSquared(src, new Point(result1.hitVec)) > Point.distanceSquared(src, new Point(result2.hitVec))) return result2; return result1; }
[ "public", "static", "RayTraceResult", "getClosestHit", "(", "RayTraceResult", ".", "Type", "hitType", ",", "Point", "src", ",", "RayTraceResult", "result1", ",", "RayTraceResult", "result2", ")", "{", "if", "(", "result1", "==", "null", ")", "return", "result2",...
Gets the closest {@link RayTraceResult} to the source. @param src the src @param result1 the mop1 @param result2 the mop2 @return the closest
[ "Gets", "the", "closest", "{", "@link", "RayTraceResult", "}", "to", "the", "source", "." ]
train
https://github.com/Ordinastie/MalisisCore/blob/4f8e1fa462d5c372fc23414482ba9f429881cc54/src/main/java/net/malisis/core/util/raytrace/Raytrace.java#L195-L210
apache/incubator-atlas
repository/src/main/java/org/apache/atlas/gremlin/optimizer/GremlinQueryOptimizer.java
GremlinQueryOptimizer.copyWithNewLeafNode
public static GroovyExpression copyWithNewLeafNode(AbstractFunctionExpression expr, GroovyExpression newLeaf) { AbstractFunctionExpression result = (AbstractFunctionExpression)expr.copy(); //remove leading anonymous traversal expression, if there is one if(FACTORY.isLeafAnonymousTraversalExpression(expr)) { result = (AbstractFunctionExpression)newLeaf; } else { GroovyExpression newCaller = null; if (expr.getCaller() == null) { newCaller = newLeaf; } else { newCaller = copyWithNewLeafNode((AbstractFunctionExpression)result.getCaller(), newLeaf); } result.setCaller(newCaller); } return result; }
java
public static GroovyExpression copyWithNewLeafNode(AbstractFunctionExpression expr, GroovyExpression newLeaf) { AbstractFunctionExpression result = (AbstractFunctionExpression)expr.copy(); //remove leading anonymous traversal expression, if there is one if(FACTORY.isLeafAnonymousTraversalExpression(expr)) { result = (AbstractFunctionExpression)newLeaf; } else { GroovyExpression newCaller = null; if (expr.getCaller() == null) { newCaller = newLeaf; } else { newCaller = copyWithNewLeafNode((AbstractFunctionExpression)result.getCaller(), newLeaf); } result.setCaller(newCaller); } return result; }
[ "public", "static", "GroovyExpression", "copyWithNewLeafNode", "(", "AbstractFunctionExpression", "expr", ",", "GroovyExpression", "newLeaf", ")", "{", "AbstractFunctionExpression", "result", "=", "(", "AbstractFunctionExpression", ")", "expr", ".", "copy", "(", ")", ";...
Recursively copies and follows the caller hierarchy of the expression until we come to a function call with a null caller. The caller of that expression is set to newLeaf. @param expr @param newLeaf @return the updated (/copied) expression
[ "Recursively", "copies", "and", "follows", "the", "caller", "hierarchy", "of", "the", "expression", "until", "we", "come", "to", "a", "function", "call", "with", "a", "null", "caller", ".", "The", "caller", "of", "that", "expression", "is", "set", "to", "n...
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/repository/src/main/java/org/apache/atlas/gremlin/optimizer/GremlinQueryOptimizer.java#L242-L260
roboconf/roboconf-platform
core/roboconf-dm-rest-commons/src/main/java/net/roboconf/dm/rest/commons/security/AuthenticationManager.java
AuthenticationManager.isSessionValid
public boolean isSessionValid( final String token, long validityPeriod ) { boolean valid = false; Long loginTime = null; if( token != null ) loginTime = this.tokenToLoginTime.get( token ); if( validityPeriod < 0 ) { valid = loginTime != null; } else if( loginTime != null ) { long now = new Date().getTime(); valid = (now - loginTime) <= validityPeriod * 1000; // Invalid sessions should be deleted if( ! valid ) logout( token ); } return valid; }
java
public boolean isSessionValid( final String token, long validityPeriod ) { boolean valid = false; Long loginTime = null; if( token != null ) loginTime = this.tokenToLoginTime.get( token ); if( validityPeriod < 0 ) { valid = loginTime != null; } else if( loginTime != null ) { long now = new Date().getTime(); valid = (now - loginTime) <= validityPeriod * 1000; // Invalid sessions should be deleted if( ! valid ) logout( token ); } return valid; }
[ "public", "boolean", "isSessionValid", "(", "final", "String", "token", ",", "long", "validityPeriod", ")", "{", "boolean", "valid", "=", "false", ";", "Long", "loginTime", "=", "null", ";", "if", "(", "token", "!=", "null", ")", "loginTime", "=", "this", ...
Determines whether a session is valid. @param token a token @param validityPeriod the validity period for a session (in seconds, < 0 for unbound) @return true if the session is valid, false otherwise
[ "Determines", "whether", "a", "session", "is", "valid", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-dm-rest-commons/src/main/java/net/roboconf/dm/rest/commons/security/AuthenticationManager.java#L128-L148
sputnikdev/bluetooth-utils
src/main/java/org/sputnikdev/bluetooth/URL.java
URL.copyWith
public URL copyWith(String serviceUUID, String characteristicUUID, String fieldName) { return new URL(this.protocol, this.adapterAddress, this.deviceAddress, this.deviceAttributes, serviceUUID, characteristicUUID, fieldName); }
java
public URL copyWith(String serviceUUID, String characteristicUUID, String fieldName) { return new URL(this.protocol, this.adapterAddress, this.deviceAddress, this.deviceAttributes, serviceUUID, characteristicUUID, fieldName); }
[ "public", "URL", "copyWith", "(", "String", "serviceUUID", ",", "String", "characteristicUUID", ",", "String", "fieldName", ")", "{", "return", "new", "URL", "(", "this", ".", "protocol", ",", "this", ".", "adapterAddress", ",", "this", ".", "deviceAddress", ...
Makes a copy of a given URL with some additional components. @param serviceUUID UUID of a GATT service @param characteristicUUID UUID of a GATT characteristic @param fieldName name of a field of the characteristic @return a copy of a given URL with some additional components
[ "Makes", "a", "copy", "of", "a", "given", "URL", "with", "some", "additional", "components", "." ]
train
https://github.com/sputnikdev/bluetooth-utils/blob/794e4a8644c1eed54cd043de2bc967f4ef58acca/src/main/java/org/sputnikdev/bluetooth/URL.java#L321-L324
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Threads.java
Threads.assertUnlocked
public static void assertUnlocked(Object object, String name) { if (RUNTIME_ASSERTIONS) { if (Thread.holdsLock(object)) { throw new RuntimeAssertion("Recursive lock of %s", name); } } }
java
public static void assertUnlocked(Object object, String name) { if (RUNTIME_ASSERTIONS) { if (Thread.holdsLock(object)) { throw new RuntimeAssertion("Recursive lock of %s", name); } } }
[ "public", "static", "void", "assertUnlocked", "(", "Object", "object", ",", "String", "name", ")", "{", "if", "(", "RUNTIME_ASSERTIONS", ")", "{", "if", "(", "Thread", ".", "holdsLock", "(", "object", ")", ")", "{", "throw", "new", "RuntimeAssertion", "(",...
This is an assertion method that can be used by a thread to confirm that the thread isn't already holding lock for an object, before acquiring a lock @param object object to test for lock @param name tag associated with the lock
[ "This", "is", "an", "assertion", "method", "that", "can", "be", "used", "by", "a", "thread", "to", "confirm", "that", "the", "thread", "isn", "t", "already", "holding", "lock", "for", "an", "object", "before", "acquiring", "a", "lock" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/utility/Threads.java#L703-L709
liyiorg/weixin-popular
src/main/java/weixin/popular/api/ScanAPI.java
ScanAPI.productCreate
public static ProductCreateResult productCreate(String accessToken, ProductCreate productCreate) { return productCreate(accessToken, JsonUtil.toJSONString(productCreate)); }
java
public static ProductCreateResult productCreate(String accessToken, ProductCreate productCreate) { return productCreate(accessToken, JsonUtil.toJSONString(productCreate)); }
[ "public", "static", "ProductCreateResult", "productCreate", "(", "String", "accessToken", ",", "ProductCreate", "productCreate", ")", "{", "return", "productCreate", "(", "accessToken", ",", "JsonUtil", ".", "toJSONString", "(", "productCreate", ")", ")", ";", "}" ]
创建商品 @param accessToken accessToken @param productCreate productCreate @return ProductCreateResult
[ "创建商品" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ScanAPI.java#L46-L48
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalInfo.java
DateIntervalInfo.genPatternInfo
@Deprecated public static PatternInfo genPatternInfo(String intervalPattern, boolean laterDateFirst) { int splitPoint = splitPatternInto2Part(intervalPattern); String firstPart = intervalPattern.substring(0, splitPoint); String secondPart = null; if ( splitPoint < intervalPattern.length() ) { secondPart = intervalPattern.substring(splitPoint, intervalPattern.length()); } return new PatternInfo(firstPart, secondPart, laterDateFirst); }
java
@Deprecated public static PatternInfo genPatternInfo(String intervalPattern, boolean laterDateFirst) { int splitPoint = splitPatternInto2Part(intervalPattern); String firstPart = intervalPattern.substring(0, splitPoint); String secondPart = null; if ( splitPoint < intervalPattern.length() ) { secondPart = intervalPattern.substring(splitPoint, intervalPattern.length()); } return new PatternInfo(firstPart, secondPart, laterDateFirst); }
[ "@", "Deprecated", "public", "static", "PatternInfo", "genPatternInfo", "(", "String", "intervalPattern", ",", "boolean", "laterDateFirst", ")", "{", "int", "splitPoint", "=", "splitPatternInto2Part", "(", "intervalPattern", ")", ";", "String", "firstPart", "=", "in...
Break interval patterns as 2 part and save them into pattern info. @param intervalPattern interval pattern @param laterDateFirst whether the first date in intervalPattern is earlier date or later date @return pattern info object @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Break", "interval", "patterns", "as", "2", "part", "and", "save", "them", "into", "pattern", "info", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateIntervalInfo.java#L818-L830
RestComm/Restcomm-Connect
restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/SecurityFilter.java
SecurityFilter.filter
@Override public ContainerRequest filter(ContainerRequest cr) { final DaoManager storage = (DaoManager) servletRequest.getServletContext().getAttribute(DaoManager.class.getName()); AccountsDao accountsDao = storage.getAccountsDao(); UserIdentityContext userIdentityContext = new UserIdentityContext(servletRequest, accountsDao); // exclude recording file https://telestax.atlassian.net/browse/RESTCOMM-1736 logger.info("cr.getPath(): " + cr.getPath()); if (!isUnprotected(cr)) { checkAuthenticatedAccount(userIdentityContext); filterClosedAccounts(userIdentityContext, cr.getPath()); //TODO temporarely disable organization domain validation - https://telestax.atlassian.net/browse/BS-408 // validateOrganizationAccess(userIdentityContext, storage, cr); } String scheme = cr.getAuthenticationScheme(); AccountPrincipal aPrincipal = new AccountPrincipal(userIdentityContext); cr.setSecurityContext(new RCSecContext(aPrincipal, scheme)); return cr; }
java
@Override public ContainerRequest filter(ContainerRequest cr) { final DaoManager storage = (DaoManager) servletRequest.getServletContext().getAttribute(DaoManager.class.getName()); AccountsDao accountsDao = storage.getAccountsDao(); UserIdentityContext userIdentityContext = new UserIdentityContext(servletRequest, accountsDao); // exclude recording file https://telestax.atlassian.net/browse/RESTCOMM-1736 logger.info("cr.getPath(): " + cr.getPath()); if (!isUnprotected(cr)) { checkAuthenticatedAccount(userIdentityContext); filterClosedAccounts(userIdentityContext, cr.getPath()); //TODO temporarely disable organization domain validation - https://telestax.atlassian.net/browse/BS-408 // validateOrganizationAccess(userIdentityContext, storage, cr); } String scheme = cr.getAuthenticationScheme(); AccountPrincipal aPrincipal = new AccountPrincipal(userIdentityContext); cr.setSecurityContext(new RCSecContext(aPrincipal, scheme)); return cr; }
[ "@", "Override", "public", "ContainerRequest", "filter", "(", "ContainerRequest", "cr", ")", "{", "final", "DaoManager", "storage", "=", "(", "DaoManager", ")", "servletRequest", ".", "getServletContext", "(", ")", ".", "getAttribute", "(", "DaoManager", ".", "c...
We return Access-* headers only in case allowedOrigin is present and equals to the 'Origin' header.
[ "We", "return", "Access", "-", "*", "headers", "only", "in", "case", "allowedOrigin", "is", "present", "and", "equals", "to", "the", "Origin", "header", "." ]
train
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/security/SecurityFilter.java#L61-L78
schallee/alib4j
core/src/main/java/net/darkmist/alib/res/PkgRes.java
PkgRes.getStringFor
public static String getStringFor(String name, Object obj) { if(obj == null) throw new NullPointerException("obj is null"); return getStringFor(name,obj.getClass()); }
java
public static String getStringFor(String name, Object obj) { if(obj == null) throw new NullPointerException("obj is null"); return getStringFor(name,obj.getClass()); }
[ "public", "static", "String", "getStringFor", "(", "String", "name", ",", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"obj is null\"", ")", ";", "return", "getStringFor", "(", "name", ",", ...
Get a resource as a String. @param name The name of the resource @return The contents of the resource converted to a string with the default encoding. @throws NullPointerException if name or obj are null. ResourceException if the resource cannot be found.
[ "Get", "a", "resource", "as", "a", "String", "." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/core/src/main/java/net/darkmist/alib/res/PkgRes.java#L312-L317
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java
SecureUtil.signParams
public static String signParams(SymmetricCrypto crypto, Map<?, ?> params, String separator, String keyValueSeparator, boolean isIgnoreNull) { if (MapUtil.isEmpty(params)) { return null; } String paramsStr = MapUtil.join(MapUtil.sort(params), separator, keyValueSeparator, isIgnoreNull); return crypto.encryptHex(paramsStr); }
java
public static String signParams(SymmetricCrypto crypto, Map<?, ?> params, String separator, String keyValueSeparator, boolean isIgnoreNull) { if (MapUtil.isEmpty(params)) { return null; } String paramsStr = MapUtil.join(MapUtil.sort(params), separator, keyValueSeparator, isIgnoreNull); return crypto.encryptHex(paramsStr); }
[ "public", "static", "String", "signParams", "(", "SymmetricCrypto", "crypto", ",", "Map", "<", "?", ",", "?", ">", "params", ",", "String", "separator", ",", "String", "keyValueSeparator", ",", "boolean", "isIgnoreNull", ")", "{", "if", "(", "MapUtil", ".", ...
对参数做签名<br> 参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串 @param crypto 对称加密算法 @param params 参数 @param separator entry之间的连接符 @param keyValueSeparator kv之间的连接符 @param isIgnoreNull 是否忽略null的键和值 @return 签名 @since 4.0.1
[ "对参数做签名<br", ">", "参数签名为对Map参数按照key的顺序排序后拼接为字符串,然后根据提供的签名算法生成签名字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/SecureUtil.java#L847-L853
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.processLevelRelationships
protected void processLevelRelationships(final ParserData parserData, final Level level, final HashMap<ParserType, String[]> variableMap, final String line, int lineNumber) throws ParsingException { // Process the relationships final String uniqueId = level.getUniqueId(); final ArrayList<Relationship> levelRelationships = new ArrayList<Relationship>(); // Refer-To relationships processRelationshipList(ParserType.REFER_TO, level, variableMap, levelRelationships, lineNumber); // Prerequisite relationships processRelationshipList(ParserType.PREREQUISITE, level, variableMap, levelRelationships, lineNumber); // Link-List relationships processRelationshipList(ParserType.LINKLIST, level, variableMap, levelRelationships, lineNumber); // Next and Previous relationships should only be created internally and shouldn't be specified by the user if (variableMap.containsKey(ParserType.NEXT) || variableMap.containsKey(ParserType.PREVIOUS)) { throw new ParsingException(format(ProcessorConstants.ERROR_TOPIC_NEXT_PREV_MSG, lineNumber, line)); } // Add the relationships to the global list if any exist if (!levelRelationships.isEmpty()) { parserData.getLevelRelationships().put(uniqueId, levelRelationships); } }
java
protected void processLevelRelationships(final ParserData parserData, final Level level, final HashMap<ParserType, String[]> variableMap, final String line, int lineNumber) throws ParsingException { // Process the relationships final String uniqueId = level.getUniqueId(); final ArrayList<Relationship> levelRelationships = new ArrayList<Relationship>(); // Refer-To relationships processRelationshipList(ParserType.REFER_TO, level, variableMap, levelRelationships, lineNumber); // Prerequisite relationships processRelationshipList(ParserType.PREREQUISITE, level, variableMap, levelRelationships, lineNumber); // Link-List relationships processRelationshipList(ParserType.LINKLIST, level, variableMap, levelRelationships, lineNumber); // Next and Previous relationships should only be created internally and shouldn't be specified by the user if (variableMap.containsKey(ParserType.NEXT) || variableMap.containsKey(ParserType.PREVIOUS)) { throw new ParsingException(format(ProcessorConstants.ERROR_TOPIC_NEXT_PREV_MSG, lineNumber, line)); } // Add the relationships to the global list if any exist if (!levelRelationships.isEmpty()) { parserData.getLevelRelationships().put(uniqueId, levelRelationships); } }
[ "protected", "void", "processLevelRelationships", "(", "final", "ParserData", "parserData", ",", "final", "Level", "level", ",", "final", "HashMap", "<", "ParserType", ",", "String", "[", "]", ">", "variableMap", ",", "final", "String", "line", ",", "int", "li...
Process the relationships parsed for a topic. @param parserData @param level The temporary topic that will be turned into a full topic once fully parsed. @param variableMap The list of variables containing the parsed relationships. @param line The line representing the topic and it's relationships. @param lineNumber The number of the line the relationships are on. @throws ParsingException Thrown if the variables can't be parsed due to incorrect syntax.
[ "Process", "the", "relationships", "parsed", "for", "a", "topic", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L1402-L1426
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/utils/FastDateFormat.java
FastDateFormat.getTimeZoneDisplay
static synchronized String getTimeZoneDisplay(TimeZone tz, boolean daylight, int style, Locale locale) { Object key = new TimeZoneDisplayKey(tz, daylight, style, locale); String value = (String) cTimeZoneDisplayCache.get(key); if (value == null) { // This is a very slow call, so cache the results. value = tz.getDisplayName(daylight, style, locale); cTimeZoneDisplayCache.put(key, value); } return value; }
java
static synchronized String getTimeZoneDisplay(TimeZone tz, boolean daylight, int style, Locale locale) { Object key = new TimeZoneDisplayKey(tz, daylight, style, locale); String value = (String) cTimeZoneDisplayCache.get(key); if (value == null) { // This is a very slow call, so cache the results. value = tz.getDisplayName(daylight, style, locale); cTimeZoneDisplayCache.put(key, value); } return value; }
[ "static", "synchronized", "String", "getTimeZoneDisplay", "(", "TimeZone", "tz", ",", "boolean", "daylight", ",", "int", "style", ",", "Locale", "locale", ")", "{", "Object", "key", "=", "new", "TimeZoneDisplayKey", "(", "tz", ",", "daylight", ",", "style", ...
<p>Gets the time zone display name, using a cache for performance.</p> @param tz the zone to query @param daylight true if daylight savings @param style the style to use <code>TimeZone.LONG</code> or <code>TimeZone.SHORT</code> @param locale the locale to use @return the textual name of the time zone
[ "<p", ">", "Gets", "the", "time", "zone", "display", "name", "using", "a", "cache", "for", "performance", ".", "<", "/", "p", ">" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/utils/FastDateFormat.java#L497-L506