repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
alkacon/opencms-core
src/org/opencms/widgets/CmsCategoryWidget.java
CmsCategoryWidget.getDefaultLocale
protected Locale getDefaultLocale(CmsObject cms, String resource) { Locale locale = OpenCms.getLocaleManager().getDefaultLocale(cms, resource); if (locale == null) { List<Locale> locales = OpenCms.getLocaleManager().getAvailableLocales(); if (locales.size() > 0) { locale = locales.get(0); } else { locale = Locale.ENGLISH; } } return locale; }
java
protected Locale getDefaultLocale(CmsObject cms, String resource) { Locale locale = OpenCms.getLocaleManager().getDefaultLocale(cms, resource); if (locale == null) { List<Locale> locales = OpenCms.getLocaleManager().getAvailableLocales(); if (locales.size() > 0) { locale = locales.get(0); } else { locale = Locale.ENGLISH; } } return locale; }
[ "protected", "Locale", "getDefaultLocale", "(", "CmsObject", "cms", ",", "String", "resource", ")", "{", "Locale", "locale", "=", "OpenCms", ".", "getLocaleManager", "(", ")", ".", "getDefaultLocale", "(", "cms", ",", "resource", ")", ";", "if", "(", "locale...
Returns the default locale in the content of the given resource.<p> @param cms the cms context @param resource the resource path to get the default locale for @return the default locale of the resource
[ "Returns", "the", "default", "locale", "in", "the", "content", "of", "the", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsCategoryWidget.java#L581-L593
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/RedisStorage.java
RedisStorage.getTriggerState
@Override public Trigger.TriggerState getTriggerState(TriggerKey triggerKey, Jedis jedis){ final String triggerHashKey = redisSchema.triggerHashKey(triggerKey); Pipeline pipe = jedis.pipelined(); Map<RedisTriggerState, Response<Double>> scores = new HashMap<>(RedisTriggerState.values().length); for (RedisTriggerState redisTriggerState : RedisTriggerState.values()) { scores.put(redisTriggerState, pipe.zscore(redisSchema.triggerStateKey(redisTriggerState), triggerHashKey)); } pipe.sync(); for (Map.Entry<RedisTriggerState, Response<Double>> entry : scores.entrySet()) { if(entry.getValue().get() != null){ return entry.getKey().getTriggerState(); } } return Trigger.TriggerState.NONE; }
java
@Override public Trigger.TriggerState getTriggerState(TriggerKey triggerKey, Jedis jedis){ final String triggerHashKey = redisSchema.triggerHashKey(triggerKey); Pipeline pipe = jedis.pipelined(); Map<RedisTriggerState, Response<Double>> scores = new HashMap<>(RedisTriggerState.values().length); for (RedisTriggerState redisTriggerState : RedisTriggerState.values()) { scores.put(redisTriggerState, pipe.zscore(redisSchema.triggerStateKey(redisTriggerState), triggerHashKey)); } pipe.sync(); for (Map.Entry<RedisTriggerState, Response<Double>> entry : scores.entrySet()) { if(entry.getValue().get() != null){ return entry.getKey().getTriggerState(); } } return Trigger.TriggerState.NONE; }
[ "@", "Override", "public", "Trigger", ".", "TriggerState", "getTriggerState", "(", "TriggerKey", "triggerKey", ",", "Jedis", "jedis", ")", "{", "final", "String", "triggerHashKey", "=", "redisSchema", ".", "triggerHashKey", "(", "triggerKey", ")", ";", "Pipeline",...
Get the current state of the identified <code>{@link org.quartz.Trigger}</code>. @param triggerKey the key of the desired trigger @param jedis a thread-safe Redis connection @return the state of the trigger
[ "Get", "the", "current", "state", "of", "the", "identified", "<code", ">", "{" ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisStorage.java#L421-L436
apache/incubator-gobblin
gobblin-salesforce/src/main/java/org/apache/gobblin/salesforce/SalesforceExtractor.java
SalesforceExtractor.fetchResultBatch
private void fetchResultBatch(RecordSetList<JsonElement> rs, int initialRecordCount) throws DataRecordException, IOException { int recordCount = initialRecordCount; // Stream the resultset through CSV reader to identify columns in each record InputStreamCSVReader reader = new InputStreamCSVReader(this.bulkBufferedReader); // Get header if it is first run of a new resultset if (this.isNewBulkResultSet()) { this.bulkRecordHeader = reader.nextRecord(); this.bulkResultColumCount = this.bulkRecordHeader.size(); this.setNewBulkResultSet(false); } // Get record from CSV reader stream while ((this.csvRecord = reader.nextRecord()) != null) { // Convert CSV record to JsonObject JsonObject jsonObject = Utils.csvToJsonObject(this.bulkRecordHeader, this.csvRecord, this.bulkResultColumCount); rs.add(jsonObject); recordCount++; this.bulkRecordCount++; // Insert records in record set until it reaches the batch size if (recordCount >= batchSize) { log.info("Total number of records processed so far: " + this.bulkRecordCount); break; } } }
java
private void fetchResultBatch(RecordSetList<JsonElement> rs, int initialRecordCount) throws DataRecordException, IOException { int recordCount = initialRecordCount; // Stream the resultset through CSV reader to identify columns in each record InputStreamCSVReader reader = new InputStreamCSVReader(this.bulkBufferedReader); // Get header if it is first run of a new resultset if (this.isNewBulkResultSet()) { this.bulkRecordHeader = reader.nextRecord(); this.bulkResultColumCount = this.bulkRecordHeader.size(); this.setNewBulkResultSet(false); } // Get record from CSV reader stream while ((this.csvRecord = reader.nextRecord()) != null) { // Convert CSV record to JsonObject JsonObject jsonObject = Utils.csvToJsonObject(this.bulkRecordHeader, this.csvRecord, this.bulkResultColumCount); rs.add(jsonObject); recordCount++; this.bulkRecordCount++; // Insert records in record set until it reaches the batch size if (recordCount >= batchSize) { log.info("Total number of records processed so far: " + this.bulkRecordCount); break; } } }
[ "private", "void", "fetchResultBatch", "(", "RecordSetList", "<", "JsonElement", ">", "rs", ",", "int", "initialRecordCount", ")", "throws", "DataRecordException", ",", "IOException", "{", "int", "recordCount", "=", "initialRecordCount", ";", "// Stream the resultset th...
Fetch records into a {@link RecordSetList} up to the configured batch size {@link #batchSize}. This batch is not the entire Salesforce result batch. It is an internal batch in the extractor for buffering a subset of the result stream that comes from a Salesforce batch for more efficient processing. @param rs the record set to fetch into @param initialRecordCount Initial record count to use. This should correspond to the number of records already in rs. This is used to limit the number of records returned in rs to {@link #batchSize}. @throws DataRecordException @throws IOException
[ "Fetch", "records", "into", "a", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-salesforce/src/main/java/org/apache/gobblin/salesforce/SalesforceExtractor.java#L842-L870
j256/simplecsv
src/main/java/com/j256/simplecsv/processor/CsvProcessor.java
CsvProcessor.writeAll
public void writeAll(Writer writer, Collection<T> entities, boolean writeHeader) throws IOException { checkEntityConfig(); BufferedWriter bufferedWriter = new BufferedWriter(writer); try { if (writeHeader) { writeHeader(bufferedWriter, true); } for (T entity : entities) { writeRow(bufferedWriter, entity, true); } } finally { bufferedWriter.close(); } }
java
public void writeAll(Writer writer, Collection<T> entities, boolean writeHeader) throws IOException { checkEntityConfig(); BufferedWriter bufferedWriter = new BufferedWriter(writer); try { if (writeHeader) { writeHeader(bufferedWriter, true); } for (T entity : entities) { writeRow(bufferedWriter, entity, true); } } finally { bufferedWriter.close(); } }
[ "public", "void", "writeAll", "(", "Writer", "writer", ",", "Collection", "<", "T", ">", "entities", ",", "boolean", "writeHeader", ")", "throws", "IOException", "{", "checkEntityConfig", "(", ")", ";", "BufferedWriter", "bufferedWriter", "=", "new", "BufferedWr...
Write a header and then the collection of entities to the writer. @param writer Where to write the header and entities. It will be closed before this method returns. @param entities Collection of entities to write to the writer. @param writeHeader Set to true to write header at the start of the writer. @throws IOException If there are any IO exceptions thrown when writing.
[ "Write", "a", "header", "and", "then", "the", "collection", "of", "entities", "to", "the", "writer", "." ]
train
https://github.com/j256/simplecsv/blob/964fe53073c43e2a311341e3f8fd2c94372f60cb/src/main/java/com/j256/simplecsv/processor/CsvProcessor.java#L426-L439
cdk/cdk
legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKRGraph.java
CDKRGraph.mustContinue
private boolean mustContinue(BitSet potentialNode) { boolean result = true; boolean cancel = false; BitSet projG1 = projectG1(potentialNode); BitSet projG2 = projectG2(potentialNode); // if we reached the maximum number of // search iterations than do not continue if (getMaxIteration() != -1 && getNbIteration() >= getMaxIteration()) { return false; } // if constrains may no more be fulfilled then stop. if (!isContainedIn(sourceBitSet, projG1) || !isContainedIn(targetBitSet, projG2)) { return false; } // check if the solution potential is not included in an already // existing solution for (Iterator<BitSet> i = getSolutionList().iterator(); i.hasNext() && !cancel;) { BitSet sol = i.next(); // if we want every 'mappings' do not stop if (isFindAllMap() && (projG1.equals(projectG1(sol)) || projG2.equals(projectG2(sol)))) { // do nothing } // if maxIterator is not possible to do better than an already existing solution than stop. else if (isContainedIn(projG1, projectG1(sol)) || isContainedIn(projG2, projectG2(sol))) { result = false; cancel = true; } } return result; }
java
private boolean mustContinue(BitSet potentialNode) { boolean result = true; boolean cancel = false; BitSet projG1 = projectG1(potentialNode); BitSet projG2 = projectG2(potentialNode); // if we reached the maximum number of // search iterations than do not continue if (getMaxIteration() != -1 && getNbIteration() >= getMaxIteration()) { return false; } // if constrains may no more be fulfilled then stop. if (!isContainedIn(sourceBitSet, projG1) || !isContainedIn(targetBitSet, projG2)) { return false; } // check if the solution potential is not included in an already // existing solution for (Iterator<BitSet> i = getSolutionList().iterator(); i.hasNext() && !cancel;) { BitSet sol = i.next(); // if we want every 'mappings' do not stop if (isFindAllMap() && (projG1.equals(projectG1(sol)) || projG2.equals(projectG2(sol)))) { // do nothing } // if maxIterator is not possible to do better than an already existing solution than stop. else if (isContainedIn(projG1, projectG1(sol)) || isContainedIn(projG2, projectG2(sol))) { result = false; cancel = true; } } return result; }
[ "private", "boolean", "mustContinue", "(", "BitSet", "potentialNode", ")", "{", "boolean", "result", "=", "true", ";", "boolean", "cancel", "=", "false", ";", "BitSet", "projG1", "=", "projectG1", "(", "potentialNode", ")", ";", "BitSet", "projG2", "=", "pro...
Determine if there are potential solution remaining. @param potentialNode set of remaining potential nodes @return true if maxIterator is worse to continue the search
[ "Determine", "if", "there", "are", "potential", "solution", "remaining", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/smsd/algorithm/rgraph/CDKRGraph.java#L382-L415
apache/groovy
subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java
SwingGroovyMethods.leftShift
public static JPopupMenu leftShift(JPopupMenu self, String str) { self.add(str); return self; }
java
public static JPopupMenu leftShift(JPopupMenu self, String str) { self.add(str); return self; }
[ "public", "static", "JPopupMenu", "leftShift", "(", "JPopupMenu", "self", ",", "String", "str", ")", "{", "self", ".", "add", "(", "str", ")", ";", "return", "self", ";", "}" ]
Overloads the left shift operator to provide an easy way to add components to a popupMenu.<p> @param self a JPopupMenu @param str a String to be added to the popupMenu. @return same popupMenu, after the value was added to it. @since 1.6.4
[ "Overloads", "the", "left", "shift", "operator", "to", "provide", "an", "easy", "way", "to", "add", "components", "to", "a", "popupMenu", ".", "<p", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-swing/src/main/java/org/codehaus/groovy/runtime/SwingGroovyMethods.java#L938-L941
czyzby/gdx-lml
kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/collection/GdxMaps.java
GdxMaps.putIfAbsent
public static <Key, Value> Value putIfAbsent(final ObjectMap<Key, Value> map, final Key key, final Value value) { if (!map.containsKey(key)) { map.put(key, value); return value; } return map.get(key); }
java
public static <Key, Value> Value putIfAbsent(final ObjectMap<Key, Value> map, final Key key, final Value value) { if (!map.containsKey(key)) { map.put(key, value); return value; } return map.get(key); }
[ "public", "static", "<", "Key", ",", "Value", ">", "Value", "putIfAbsent", "(", "final", "ObjectMap", "<", "Key", ",", "Value", ">", "map", ",", "final", "Key", "key", ",", "final", "Value", "value", ")", "{", "if", "(", "!", "map", ".", "containsKey...
Puts a value with the given key in the passed map, provided that the passed key isn't already present in the map. @param map may contain a value associated with the key. @param key map key. @param value map value to add. @return value associated with the key in the map (recently added or the previous one). @param <Key> type of map keys. @param <Value> type of map values.
[ "Puts", "a", "value", "with", "the", "given", "key", "in", "the", "passed", "map", "provided", "that", "the", "passed", "key", "isn", "t", "already", "present", "in", "the", "map", "." ]
train
https://github.com/czyzby/gdx-lml/blob/7623b322e6afe49ad4dd636c80c230150a1cfa4e/kiwi/src/main/java/com/github/czyzby/kiwi/util/gdx/collection/GdxMaps.java#L250-L256
drewnoakes/metadata-extractor
Source/com/drew/metadata/exif/ExifSubIFDDirectory.java
ExifSubIFDDirectory.getDateDigitized
@Nullable public Date getDateDigitized(@Nullable TimeZone timeZone) { TimeZone timeZoneDigitized = getTimeZone(TAG_OFFSET_TIME_DIGITIZED); return getDate(TAG_DATETIME_DIGITIZED, getString(TAG_SUBSECOND_TIME_DIGITIZED), (timeZoneDigitized != null) ? timeZoneDigitized : timeZone); }
java
@Nullable public Date getDateDigitized(@Nullable TimeZone timeZone) { TimeZone timeZoneDigitized = getTimeZone(TAG_OFFSET_TIME_DIGITIZED); return getDate(TAG_DATETIME_DIGITIZED, getString(TAG_SUBSECOND_TIME_DIGITIZED), (timeZoneDigitized != null) ? timeZoneDigitized : timeZone); }
[ "@", "Nullable", "public", "Date", "getDateDigitized", "(", "@", "Nullable", "TimeZone", "timeZone", ")", "{", "TimeZone", "timeZoneDigitized", "=", "getTimeZone", "(", "TAG_OFFSET_TIME_DIGITIZED", ")", ";", "return", "getDate", "(", "TAG_DATETIME_DIGITIZED", ",", "...
Parses the date/time tag, the subsecond tag and the time offset tag to obtain a single Date object with milliseconds representing the date and time when this image was digitized. If the time offset tag does not exist, attempts will be made to parse the values as though it is in the {@link TimeZone} represented by the {@code timeZone} parameter (if it is non-null). @param timeZone the time zone to use @return A Date object representing when this image was digitized, if possible, otherwise null
[ "Parses", "the", "date", "/", "time", "tag", "the", "subsecond", "tag", "and", "the", "time", "offset", "tag", "to", "obtain", "a", "single", "Date", "object", "with", "milliseconds", "representing", "the", "date", "and", "time", "when", "this", "image", "...
train
https://github.com/drewnoakes/metadata-extractor/blob/a958e0b61b50e590731b3be1dca8df8e21ebd43c/Source/com/drew/metadata/exif/ExifSubIFDDirectory.java#L159-L165
apache/reef
lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyChannelHandler.java
NettyChannelHandler.exceptionCaught
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) { final Channel channel = ctx.channel(); LOG.log(Level.INFO, "Unexpected exception from downstream. channel: {0} local: {1} remote: {2}", new Object[]{channel, channel.localAddress(), channel.remoteAddress()}); LOG.log(Level.WARNING, "Unexpected exception from downstream.", cause); channel.close(); this.listener.exceptionCaught(ctx, cause); }
java
@Override public void exceptionCaught(final ChannelHandlerContext ctx, final Throwable cause) { final Channel channel = ctx.channel(); LOG.log(Level.INFO, "Unexpected exception from downstream. channel: {0} local: {1} remote: {2}", new Object[]{channel, channel.localAddress(), channel.remoteAddress()}); LOG.log(Level.WARNING, "Unexpected exception from downstream.", cause); channel.close(); this.listener.exceptionCaught(ctx, cause); }
[ "@", "Override", "public", "void", "exceptionCaught", "(", "final", "ChannelHandlerContext", "ctx", ",", "final", "Throwable", "cause", ")", "{", "final", "Channel", "channel", "=", "ctx", ".", "channel", "(", ")", ";", "LOG", ".", "log", "(", "Level", "."...
Handles the exception event. @param ctx the context object for this handler @param cause the cause @throws Exception
[ "Handles", "the", "exception", "event", "." ]
train
https://github.com/apache/reef/blob/e2c47121cde21108a602c560cf76565a40d0e916/lang/java/reef-wake/wake/src/main/java/org/apache/reef/wake/remote/transport/netty/NettyChannelHandler.java#L104-L113
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/download/ImageDownloader.java
ImageDownloader.submitHadoopDownloadTask
public void submitHadoopDownloadTask(String URL, String id) { Callable<ImageDownloadResult> call = new HadoopImageDownload(URL, id, followRedirects); pool.submit(call); numPendingTasks++; }
java
public void submitHadoopDownloadTask(String URL, String id) { Callable<ImageDownloadResult> call = new HadoopImageDownload(URL, id, followRedirects); pool.submit(call); numPendingTasks++; }
[ "public", "void", "submitHadoopDownloadTask", "(", "String", "URL", ",", "String", "id", ")", "{", "Callable", "<", "ImageDownloadResult", ">", "call", "=", "new", "HadoopImageDownload", "(", "URL", ",", "id", ",", "followRedirects", ")", ";", "pool", ".", "...
Submits a new hadoop image download task. @param URL The url of the image @param id The id of the image (used to name the image file after download)
[ "Submits", "a", "new", "hadoop", "image", "download", "task", "." ]
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/download/ImageDownloader.java#L100-L104
google/j2objc
jre_emul/android/frameworks/base/core/java/android/util/Base64OutputStream.java
Base64OutputStream.internalWrite
private void internalWrite(byte[] b, int off, int len, boolean finish) throws IOException { coder.output = embiggen(coder.output, coder.maxOutputSize(len)); if (!coder.process(b, off, len, finish)) { throw new Base64DataException("bad base-64"); } out.write(coder.output, 0, coder.op); }
java
private void internalWrite(byte[] b, int off, int len, boolean finish) throws IOException { coder.output = embiggen(coder.output, coder.maxOutputSize(len)); if (!coder.process(b, off, len, finish)) { throw new Base64DataException("bad base-64"); } out.write(coder.output, 0, coder.op); }
[ "private", "void", "internalWrite", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ",", "boolean", "finish", ")", "throws", "IOException", "{", "coder", ".", "output", "=", "embiggen", "(", "coder", ".", "output", ",", "coder", ".", ...
Write the given bytes to the encoder/decoder. @param finish true if this is the last batch of input, to cause encoder/decoder state to be finalized.
[ "Write", "the", "given", "bytes", "to", "the", "encoder", "/", "decoder", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/Base64OutputStream.java#L136-L142
javabits/yar
yar-api/src/main/java/org/javabits/yar/TimeoutException.java
TimeoutException.newTimeoutException
public static TimeoutException newTimeoutException(long timeout, TimeUnit unit, java.util.concurrent.TimeoutException cause) { return new TimeoutException(timeout, unit, cause); }
java
public static TimeoutException newTimeoutException(long timeout, TimeUnit unit, java.util.concurrent.TimeoutException cause) { return new TimeoutException(timeout, unit, cause); }
[ "public", "static", "TimeoutException", "newTimeoutException", "(", "long", "timeout", ",", "TimeUnit", "unit", ",", "java", ".", "util", ".", "concurrent", ".", "TimeoutException", "cause", ")", "{", "return", "new", "TimeoutException", "(", "timeout", ",", "un...
Constructs a <tt>TimeoutException</tt> with the specified detail timeout value. @param timeout the maximum time to wait. @param unit the time unit of the timeout argument @param cause the original {@code TimeoutException}
[ "Constructs", "a", "<tt", ">", "TimeoutException<", "/", "tt", ">", "with", "the", "specified", "detail", "timeout", "value", "." ]
train
https://github.com/javabits/yar/blob/e146a86611ca4831e8334c9a98fd7086cee9c03e/yar-api/src/main/java/org/javabits/yar/TimeoutException.java#L103-L105
ops4j/org.ops4j.pax.exam2
core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/reactors/ReactorManager.java
ReactorManager.prepareReactor
public synchronized ExamReactor prepareReactor(Class<?> _testClass, Object testClassInstance) { this.currentTestClass = _testClass; this.reactor = createReactor(_testClass); testClasses.add(_testClass); try { addConfigurationsToReactor(_testClass, testClassInstance); } catch (IllegalAccessException exc) { throw new TestContainerException(exc); } catch (InvocationTargetException exc) { Throwable cause = exc.getCause(); if (cause instanceof AssertionError) { throw (AssertionError)cause; } else { throw new TestContainerException(cause); } } return reactor; }
java
public synchronized ExamReactor prepareReactor(Class<?> _testClass, Object testClassInstance) { this.currentTestClass = _testClass; this.reactor = createReactor(_testClass); testClasses.add(_testClass); try { addConfigurationsToReactor(_testClass, testClassInstance); } catch (IllegalAccessException exc) { throw new TestContainerException(exc); } catch (InvocationTargetException exc) { Throwable cause = exc.getCause(); if (cause instanceof AssertionError) { throw (AssertionError)cause; } else { throw new TestContainerException(cause); } } return reactor; }
[ "public", "synchronized", "ExamReactor", "prepareReactor", "(", "Class", "<", "?", ">", "_testClass", ",", "Object", "testClassInstance", ")", "{", "this", ".", "currentTestClass", "=", "_testClass", ";", "this", ".", "reactor", "=", "createReactor", "(", "_test...
Prepares the unstaged reactor for the given test class instance. Any configurations from {@code Configuration} methods of the class are added to the reactor. @param _testClass test class @param testClassInstance instance of test class @return reactor
[ "Prepares", "the", "unstaged", "reactor", "for", "the", "given", "test", "class", "instance", ".", "Any", "configurations", "from", "{", "@code", "Configuration", "}", "methods", "of", "the", "class", "are", "added", "to", "the", "reactor", "." ]
train
https://github.com/ops4j/org.ops4j.pax.exam2/blob/7f83796cbbb857123d8fc7fe817a7637218d5d77/core/pax-exam-spi/src/main/java/org/ops4j/pax/exam/spi/reactors/ReactorManager.java#L166-L186
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/css/CSSClass.java
CSSClass.setStatement
public void setStatement(String key, String value) { if (value != null && !checkCSSStatement(key, value)) { throw new InvalidCSS("Invalid CSS statement."); } for (Pair<String, String> pair : statements) { if (pair.getFirst().equals(key)) { if (value != null) { pair.setSecond(value); } else { statements.remove(pair); } return; } } if (value != null) { statements.add(new Pair<>(key, value)); } }
java
public void setStatement(String key, String value) { if (value != null && !checkCSSStatement(key, value)) { throw new InvalidCSS("Invalid CSS statement."); } for (Pair<String, String> pair : statements) { if (pair.getFirst().equals(key)) { if (value != null) { pair.setSecond(value); } else { statements.remove(pair); } return; } } if (value != null) { statements.add(new Pair<>(key, value)); } }
[ "public", "void", "setStatement", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "value", "!=", "null", "&&", "!", "checkCSSStatement", "(", "key", ",", "value", ")", ")", "{", "throw", "new", "InvalidCSS", "(", "\"Invalid CSS statement...
Set a CSS statement. @param key Statement key. @param value Value or null (to unset)
[ "Set", "a", "CSS", "statement", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/css/CSSClass.java#L213-L230
aws/aws-sdk-java
aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/util/TableUtils.java
TableUtils.waitUntilActive
public static void waitUntilActive(final AmazonDynamoDB dynamo, final String tableName, final int timeout, final int interval) throws InterruptedException, TableNeverTransitionedToStateException { TableDescription table = waitForTableDescription(dynamo, tableName, TableStatus.ACTIVE, timeout, interval); if (table == null || !table.getTableStatus().equals(TableStatus.ACTIVE.toString())) { throw new TableNeverTransitionedToStateException(tableName, TableStatus.ACTIVE); } }
java
public static void waitUntilActive(final AmazonDynamoDB dynamo, final String tableName, final int timeout, final int interval) throws InterruptedException, TableNeverTransitionedToStateException { TableDescription table = waitForTableDescription(dynamo, tableName, TableStatus.ACTIVE, timeout, interval); if (table == null || !table.getTableStatus().equals(TableStatus.ACTIVE.toString())) { throw new TableNeverTransitionedToStateException(tableName, TableStatus.ACTIVE); } }
[ "public", "static", "void", "waitUntilActive", "(", "final", "AmazonDynamoDB", "dynamo", ",", "final", "String", "tableName", ",", "final", "int", "timeout", ",", "final", "int", "interval", ")", "throws", "InterruptedException", ",", "TableNeverTransitionedToStateExc...
Waits up to a specified amount of time for a specified DynamoDB table to move into the <code>ACTIVE</code> state. If the table does not exist or does not transition to the <code>ACTIVE</code> state after this time, then a SdkClientException is thrown. @param dynamo The DynamoDB client to use to make requests. @param tableName The name of the table whose status is being checked. @param timeout The maximum number of milliseconds to wait. @param interval The poll interval in milliseconds. @throws TableNeverTransitionedToStateException If the specified table does not exist or does not transition into the <code>ACTIVE</code> state before this method times out and stops polling. @throws InterruptedException If the thread is interrupted while waiting for the table to transition into the <code>ACTIVE</code> state.
[ "Waits", "up", "to", "a", "specified", "amount", "of", "time", "for", "a", "specified", "DynamoDB", "table", "to", "move", "into", "the", "<code", ">", "ACTIVE<", "/", "code", ">", "state", ".", "If", "the", "table", "does", "not", "exist", "or", "does...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-dynamodb/src/main/java/com/amazonaws/services/dynamodbv2/util/TableUtils.java#L165-L172
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/ServletUtil.java
ServletUtil.checkResourceRequest
public static boolean checkResourceRequest(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { // Static resource if (isStaticResourceRequest(request)) { handleStaticResourceRequest(request, response); return false; } else if (isThemeResourceRequest(request)) { // Theme resource handleThemeResourceRequest(request, response); return false; } String method = request.getMethod(); if ("HEAD".equals(method)) { response.setContentType(WebUtilities.CONTENT_TYPE_XML); return false; } else if (!"POST".equals(method) && !"GET".equals(method)) { response.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED); return false; } return true; }
java
public static boolean checkResourceRequest(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { // Static resource if (isStaticResourceRequest(request)) { handleStaticResourceRequest(request, response); return false; } else if (isThemeResourceRequest(request)) { // Theme resource handleThemeResourceRequest(request, response); return false; } String method = request.getMethod(); if ("HEAD".equals(method)) { response.setContentType(WebUtilities.CONTENT_TYPE_XML); return false; } else if (!"POST".equals(method) && !"GET".equals(method)) { response.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED); return false; } return true; }
[ "public", "static", "boolean", "checkResourceRequest", "(", "final", "HttpServletRequest", "request", ",", "final", "HttpServletResponse", "response", ")", "throws", "ServletException", ",", "IOException", "{", "// Static resource", "if", "(", "isStaticResourceRequest", "...
Check if the request is for a resource (eg static, theme...). @param request the http servlet request. @param response the http servlet response. @return true to continue processing @throws ServletException a servlet exception @throws IOException an IO Exception
[ "Check", "if", "the", "request", "is", "for", "a", "resource", "(", "eg", "static", "theme", "...", ")", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/ServletUtil.java#L138-L161
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/Timebase.java
Timebase.resample
public double resample(final double samples, final Timebase oldRate) { if (samples == 0) { return 0; } else if (!this.equals(oldRate)) { final double resampled = resample(samples, oldRate, this); return resampled; } else { return samples; } }
java
public double resample(final double samples, final Timebase oldRate) { if (samples == 0) { return 0; } else if (!this.equals(oldRate)) { final double resampled = resample(samples, oldRate, this); return resampled; } else { return samples; } }
[ "public", "double", "resample", "(", "final", "double", "samples", ",", "final", "Timebase", "oldRate", ")", "{", "if", "(", "samples", "==", "0", ")", "{", "return", "0", ";", "}", "else", "if", "(", "!", "this", ".", "equals", "(", "oldRate", ")", ...
Convert a sample count from one timebase to another @param samples @param oldRate @return
[ "Convert", "a", "sample", "count", "from", "one", "timebase", "to", "another" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/Timebase.java#L247-L263
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.errorv
public void errorv(String format, Object param1) { if (isEnabled(Level.ERROR)) { doLog(Level.ERROR, FQCN, format, new Object[] { param1 }, null); } }
java
public void errorv(String format, Object param1) { if (isEnabled(Level.ERROR)) { doLog(Level.ERROR, FQCN, format, new Object[] { param1 }, null); } }
[ "public", "void", "errorv", "(", "String", "format", ",", "Object", "param1", ")", "{", "if", "(", "isEnabled", "(", "Level", ".", "ERROR", ")", ")", "{", "doLog", "(", "Level", ".", "ERROR", ",", "FQCN", ",", "format", ",", "new", "Object", "[", "...
Issue a log message with a level of ERROR using {@link java.text.MessageFormat}-style formatting. @param format the message format string @param param1 the sole parameter
[ "Issue", "a", "log", "message", "with", "a", "level", "of", "ERROR", "using", "{", "@link", "java", ".", "text", ".", "MessageFormat", "}", "-", "style", "formatting", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1574-L1578
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java
SerializationUtils.fromByteArrayKryo
public static <T> T fromByteArrayKryo(byte[] data, Class<T> clazz) { return fromByteArrayKryo(data, clazz, null); }
java
public static <T> T fromByteArrayKryo(byte[] data, Class<T> clazz) { return fromByteArrayKryo(data, clazz, null); }
[ "public", "static", "<", "T", ">", "T", "fromByteArrayKryo", "(", "byte", "[", "]", "data", ",", "Class", "<", "T", ">", "clazz", ")", "{", "return", "fromByteArrayKryo", "(", "data", ",", "clazz", ",", "null", ")", ";", "}" ]
Deserialize a byte array back to an object. <p> This method uses Kryo lib. </p> @param data @param clazz @return
[ "Deserialize", "a", "byte", "array", "back", "to", "an", "object", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/SerializationUtils.java#L283-L285
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ServerUpgradeCodec.java
Http2ServerUpgradeCodec.decodeSettingsHeader
private Http2Settings decodeSettingsHeader(ChannelHandlerContext ctx, CharSequence settingsHeader) throws Http2Exception { ByteBuf header = ByteBufUtil.encodeString(ctx.alloc(), CharBuffer.wrap(settingsHeader), CharsetUtil.UTF_8); try { // Decode the SETTINGS payload. ByteBuf payload = Base64.decode(header, URL_SAFE); // Create an HTTP/2 frame for the settings. ByteBuf frame = createSettingsFrame(ctx, payload); // Decode the SETTINGS frame and return the settings object. return decodeSettings(ctx, frame); } finally { header.release(); } }
java
private Http2Settings decodeSettingsHeader(ChannelHandlerContext ctx, CharSequence settingsHeader) throws Http2Exception { ByteBuf header = ByteBufUtil.encodeString(ctx.alloc(), CharBuffer.wrap(settingsHeader), CharsetUtil.UTF_8); try { // Decode the SETTINGS payload. ByteBuf payload = Base64.decode(header, URL_SAFE); // Create an HTTP/2 frame for the settings. ByteBuf frame = createSettingsFrame(ctx, payload); // Decode the SETTINGS frame and return the settings object. return decodeSettings(ctx, frame); } finally { header.release(); } }
[ "private", "Http2Settings", "decodeSettingsHeader", "(", "ChannelHandlerContext", "ctx", ",", "CharSequence", "settingsHeader", ")", "throws", "Http2Exception", "{", "ByteBuf", "header", "=", "ByteBufUtil", ".", "encodeString", "(", "ctx", ".", "alloc", "(", ")", ",...
Decodes the settings header and returns a {@link Http2Settings} object.
[ "Decodes", "the", "settings", "header", "and", "returns", "a", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2ServerUpgradeCodec.java#L170-L185
duracloud/duracloud
durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java
SpaceRest.addSpacePropertiesToResponse
private Response addSpacePropertiesToResponse(ResponseBuilder response, String spaceID, String storeID) throws ResourceException { Map<String, String> properties = spaceResource.getSpaceProperties(spaceID, storeID); return addPropertiesToResponse(response, properties); }
java
private Response addSpacePropertiesToResponse(ResponseBuilder response, String spaceID, String storeID) throws ResourceException { Map<String, String> properties = spaceResource.getSpaceProperties(spaceID, storeID); return addPropertiesToResponse(response, properties); }
[ "private", "Response", "addSpacePropertiesToResponse", "(", "ResponseBuilder", "response", ",", "String", "spaceID", ",", "String", "storeID", ")", "throws", "ResourceException", "{", "Map", "<", "String", ",", "String", ">", "properties", "=", "spaceResource", ".",...
Adds the properties of a space as header values to the response
[ "Adds", "the", "properties", "of", "a", "space", "as", "header", "values", "to", "the", "response" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/durastore/src/main/java/org/duracloud/durastore/rest/SpaceRest.java#L171-L179
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java
GVRShader.bindShader
public int bindShader(GVRContext context, GVRShaderData material, String vertexDesc) { String signature = getClass().getSimpleName(); GVRShaderManager shaderManager = context.getShaderManager(); synchronized (shaderManager) { int nativeShader = shaderManager.getShader(signature); if (nativeShader == 0) { nativeShader = addShader(shaderManager, signature, material); } return nativeShader; } }
java
public int bindShader(GVRContext context, GVRShaderData material, String vertexDesc) { String signature = getClass().getSimpleName(); GVRShaderManager shaderManager = context.getShaderManager(); synchronized (shaderManager) { int nativeShader = shaderManager.getShader(signature); if (nativeShader == 0) { nativeShader = addShader(shaderManager, signature, material); } return nativeShader; } }
[ "public", "int", "bindShader", "(", "GVRContext", "context", ",", "GVRShaderData", "material", ",", "String", "vertexDesc", ")", "{", "String", "signature", "=", "getClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "GVRShaderManager", "shaderManager", "=",...
Select the specific vertex and fragment shader to use with this material. The shader template is used to generate the sources for the vertex and fragment shader based on the material properties only. It will ignore the mesh attributes and all lights. @param context GVRContext @param material material to use with the shader @return ID of vertex/fragment shader set
[ "Select", "the", "specific", "vertex", "and", "fragment", "shader", "to", "use", "with", "this", "material", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShader.java#L340-L354
groupon/odo
proxyui/src/main/java/com/groupon/odo/controllers/ServerMappingController.java
ServerMappingController.getCert
@RequestMapping(value = "/cert/{hostname:.+}", method = {RequestMethod.GET, RequestMethod.HEAD}) public @ResponseBody void getCert(Locale locale, Model model, HttpServletResponse response, @PathVariable String hostname) throws Exception { // Set the appropriate headers so the browser thinks this is a file response.reset(); response.setContentType("application/x-x509-ca-cert"); response.setHeader("Content-Disposition", "attachment;filename=" + hostname + ".cer"); // special handling for hostname=="root" // return the CyberVillians Root Cert in this case if (hostname.equals("root")) { hostname = "cybervillainsCA"; response.setContentType("application/pkix-cert "); } // get the cert for the hostname KeyStoreManager keyStoreManager = com.groupon.odo.bmp.Utils.getKeyStoreManager(hostname); if (hostname.equals("cybervillainsCA")) { // get the cybervillians cert from resources File root = new File("seleniumSslSupport" + File.separator + hostname); // return the root cert Files.copy(new File(root.getAbsolutePath() + File.separator + hostname + ".cer").toPath(), response.getOutputStream()); response.flushBuffer(); } else { // return the cert for the appropriate alias response.getOutputStream().write(keyStoreManager.getCertificateByAlias(hostname).getEncoded()); response.flushBuffer(); } }
java
@RequestMapping(value = "/cert/{hostname:.+}", method = {RequestMethod.GET, RequestMethod.HEAD}) public @ResponseBody void getCert(Locale locale, Model model, HttpServletResponse response, @PathVariable String hostname) throws Exception { // Set the appropriate headers so the browser thinks this is a file response.reset(); response.setContentType("application/x-x509-ca-cert"); response.setHeader("Content-Disposition", "attachment;filename=" + hostname + ".cer"); // special handling for hostname=="root" // return the CyberVillians Root Cert in this case if (hostname.equals("root")) { hostname = "cybervillainsCA"; response.setContentType("application/pkix-cert "); } // get the cert for the hostname KeyStoreManager keyStoreManager = com.groupon.odo.bmp.Utils.getKeyStoreManager(hostname); if (hostname.equals("cybervillainsCA")) { // get the cybervillians cert from resources File root = new File("seleniumSslSupport" + File.separator + hostname); // return the root cert Files.copy(new File(root.getAbsolutePath() + File.separator + hostname + ".cer").toPath(), response.getOutputStream()); response.flushBuffer(); } else { // return the cert for the appropriate alias response.getOutputStream().write(keyStoreManager.getCertificateByAlias(hostname).getEncoded()); response.flushBuffer(); } }
[ "@", "RequestMapping", "(", "value", "=", "\"/cert/{hostname:.+}\"", ",", "method", "=", "{", "RequestMethod", ".", "GET", ",", "RequestMethod", ".", "HEAD", "}", ")", "public", "@", "ResponseBody", "void", "getCert", "(", "Locale", "locale", ",", "Model", "...
Returns a X509 binary certificate for a given domain name if a certificate has been generated for it @param locale @param model @param response @param hostname @throws Exception
[ "Returns", "a", "X509", "binary", "certificate", "for", "a", "given", "domain", "name", "if", "a", "certificate", "has", "been", "generated", "for", "it" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/proxyui/src/main/java/com/groupon/odo/controllers/ServerMappingController.java#L399-L432
hypercube1024/firefly
firefly-common/src/main/java/com/firefly/utils/function/Actions.java
Actions.toFunc
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9> Func9<T1, T2, T3, T4, T5, T6, T7, T8, T9, Void> toFunc( final Action9<T1, T2, T3, T4, T5, T6, T7, T8, T9> action) { return toFunc(action, (Void) null); }
java
public static <T1, T2, T3, T4, T5, T6, T7, T8, T9> Func9<T1, T2, T3, T4, T5, T6, T7, T8, T9, Void> toFunc( final Action9<T1, T2, T3, T4, T5, T6, T7, T8, T9> action) { return toFunc(action, (Void) null); }
[ "public", "static", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "T8", ",", "T9", ">", "Func9", "<", "T1", ",", "T2", ",", "T3", ",", "T4", ",", "T5", ",", "T6", ",", "T7", ",", "T8", ",", "T9", ",",...
Converts an {@link Action9} to a function that calls the action and returns {@code null}. @param action the {@link Action9} to convert @return a {@link Func9} that calls {@code action} and returns {@code null}
[ "Converts", "an", "{", "@link", "Action9", "}", "to", "a", "function", "that", "calls", "the", "action", "and", "returns", "{", "@code", "null", "}", "." ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-common/src/main/java/com/firefly/utils/function/Actions.java#L179-L182
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java
ResourceGroovyMethods.withWriter
public static <T> T withWriter(File file, @ClosureParams(value = SimpleType.class, options = "java.io.BufferedWriter") Closure<T> closure) throws IOException { return IOGroovyMethods.withWriter(newWriter(file), closure); }
java
public static <T> T withWriter(File file, @ClosureParams(value = SimpleType.class, options = "java.io.BufferedWriter") Closure<T> closure) throws IOException { return IOGroovyMethods.withWriter(newWriter(file), closure); }
[ "public", "static", "<", "T", ">", "T", "withWriter", "(", "File", "file", ",", "@", "ClosureParams", "(", "value", "=", "SimpleType", ".", "class", ",", "options", "=", "\"java.io.BufferedWriter\"", ")", "Closure", "<", "T", ">", "closure", ")", "throws",...
Creates a new BufferedWriter for this file, passes it to the closure, and ensures the stream is flushed and closed after the closure returns. @param file a File @param closure a closure @return the value returned by the closure @throws IOException if an IOException occurs. @since 1.5.2
[ "Creates", "a", "new", "BufferedWriter", "for", "this", "file", "passes", "it", "to", "the", "closure", "and", "ensures", "the", "stream", "is", "flushed", "and", "closed", "after", "the", "closure", "returns", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ResourceGroovyMethods.java#L1986-L1988
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java
HttpConversionUtil.addHttp2ToHttpHeaders
public static void addHttp2ToHttpHeaders(int streamId, Http2Headers inputHeaders, HttpHeaders outputHeaders, HttpVersion httpVersion, boolean isTrailer, boolean isRequest) throws Http2Exception { Http2ToHttpHeaderTranslator translator = new Http2ToHttpHeaderTranslator(streamId, outputHeaders, isRequest); try { for (Entry<CharSequence, CharSequence> entry : inputHeaders) { translator.translate(entry); } } catch (Http2Exception ex) { throw ex; } catch (Throwable t) { throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error"); } outputHeaders.remove(HttpHeaderNames.TRANSFER_ENCODING); outputHeaders.remove(HttpHeaderNames.TRAILER); if (!isTrailer) { outputHeaders.setInt(ExtensionHeaderNames.STREAM_ID.text(), streamId); HttpUtil.setKeepAlive(outputHeaders, httpVersion, true); } }
java
public static void addHttp2ToHttpHeaders(int streamId, Http2Headers inputHeaders, HttpHeaders outputHeaders, HttpVersion httpVersion, boolean isTrailer, boolean isRequest) throws Http2Exception { Http2ToHttpHeaderTranslator translator = new Http2ToHttpHeaderTranslator(streamId, outputHeaders, isRequest); try { for (Entry<CharSequence, CharSequence> entry : inputHeaders) { translator.translate(entry); } } catch (Http2Exception ex) { throw ex; } catch (Throwable t) { throw streamError(streamId, PROTOCOL_ERROR, t, "HTTP/2 to HTTP/1.x headers conversion error"); } outputHeaders.remove(HttpHeaderNames.TRANSFER_ENCODING); outputHeaders.remove(HttpHeaderNames.TRAILER); if (!isTrailer) { outputHeaders.setInt(ExtensionHeaderNames.STREAM_ID.text(), streamId); HttpUtil.setKeepAlive(outputHeaders, httpVersion, true); } }
[ "public", "static", "void", "addHttp2ToHttpHeaders", "(", "int", "streamId", ",", "Http2Headers", "inputHeaders", ",", "HttpHeaders", "outputHeaders", ",", "HttpVersion", "httpVersion", ",", "boolean", "isTrailer", ",", "boolean", "isRequest", ")", "throws", "Http2Exc...
Translate and add HTTP/2 headers to HTTP/1.x headers. @param streamId The stream associated with {@code sourceHeaders}. @param inputHeaders The HTTP/2 headers to convert. @param outputHeaders The object which will contain the resulting HTTP/1.x headers.. @param httpVersion What HTTP/1.x version {@code outputHeaders} should be treated as when doing the conversion. @param isTrailer {@code true} if {@code outputHeaders} should be treated as trailing headers. {@code false} otherwise. @param isRequest {@code true} if the {@code outputHeaders} will be used in a request message. {@code false} for response message. @throws Http2Exception If not all HTTP/2 headers can be translated to HTTP/1.x.
[ "Translate", "and", "add", "HTTP", "/", "2", "headers", "to", "HTTP", "/", "1", ".", "x", "headers", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HttpConversionUtil.java#L359-L378
dlemmermann/CalendarFX
CalendarFXRecurrence/src/main/java/com/google/ical/iter/Util.java
Util.invertWeekdayNum
static int invertWeekdayNum( WeekdayNum weekdayNum, Weekday dow0, int nDays) { assert weekdayNum.num < 0; // how many are there of that week? return countInPeriod(weekdayNum.wday, dow0, nDays) + weekdayNum.num + 1; }
java
static int invertWeekdayNum( WeekdayNum weekdayNum, Weekday dow0, int nDays) { assert weekdayNum.num < 0; // how many are there of that week? return countInPeriod(weekdayNum.wday, dow0, nDays) + weekdayNum.num + 1; }
[ "static", "int", "invertWeekdayNum", "(", "WeekdayNum", "weekdayNum", ",", "Weekday", "dow0", ",", "int", "nDays", ")", "{", "assert", "weekdayNum", ".", "num", "<", "0", ";", "// how many are there of that week?", "return", "countInPeriod", "(", "weekdayNum", "."...
Compute an absolute week number given a relative one. The day number -1SU refers to the last Sunday, so if there are 5 Sundays in a period that starts on dow0 with nDays, then -1SU is 5SU. Depending on where its used it may refer to the last Sunday of the year or of the month. @param weekdayNum -1SU in the example above. @param dow0 the day of the week of the first day of the week or month. One of the RRULE_WDAY_* constants. @param nDays the number of days in the month or year. @return an abolute week number, e.g. 5 in the example above. Valid if in [1,53].
[ "Compute", "an", "absolute", "week", "number", "given", "a", "relative", "one", ".", "The", "day", "number", "-", "1SU", "refers", "to", "the", "last", "Sunday", "so", "if", "there", "are", "5", "Sundays", "in", "a", "period", "that", "starts", "on", "...
train
https://github.com/dlemmermann/CalendarFX/blob/f2b91c2622c3f29d004485b6426b23b86c331f96/CalendarFXRecurrence/src/main/java/com/google/ical/iter/Util.java#L124-L129
casmi/casmi
src/main/java/casmi/graphics/element/Element.java
Element.setRotation
public void setRotation(double angle, double x, double y, double z) { this.rotateX = angle * x; this.rotateY = angle * y; this.rotate = angle * z; }
java
public void setRotation(double angle, double x, double y, double z) { this.rotateX = angle * x; this.rotateY = angle * y; this.rotate = angle * z; }
[ "public", "void", "setRotation", "(", "double", "angle", ",", "double", "x", ",", "double", "y", ",", "double", "z", ")", "{", "this", ".", "rotateX", "=", "angle", "*", "x", ";", "this", ".", "rotateY", "=", "angle", "*", "y", ";", "this", ".", ...
Sets the rotation angle of the Element. This method wraps the glRotate method. @param angle The angle of rotation @param x The rate of rotation angle round x-axis @param y The rate of rotation angle round x-axis @param z The rate of rotation angle round x-axis
[ "Sets", "the", "rotation", "angle", "of", "the", "Element", ".", "This", "method", "wraps", "the", "glRotate", "method", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Element.java#L496-L500
haraldk/TwelveMonkeys
contrib/src/main/java/com/twelvemonkeys/contrib/tiff/TIFFUtilities.java
TIFFUtilities.rotatePages
public static void rotatePages(ImageInputStream imageInput, ImageOutputStream imageOutput, int degree) throws IOException { rotatePage(imageInput, imageOutput, degree, -1); }
java
public static void rotatePages(ImageInputStream imageInput, ImageOutputStream imageOutput, int degree) throws IOException { rotatePage(imageInput, imageOutput, degree, -1); }
[ "public", "static", "void", "rotatePages", "(", "ImageInputStream", "imageInput", ",", "ImageOutputStream", "imageOutput", ",", "int", "degree", ")", "throws", "IOException", "{", "rotatePage", "(", "imageInput", ",", "imageOutput", ",", "degree", ",", "-", "1", ...
Rotates all pages of a TIFF file by changing TIFF.TAG_ORIENTATION. <p> NOTICE: TIFF.TAG_ORIENTATION is an advice how the image is meant do be displayed. Other metadata, such as width and height, relate to the image as how it is stored. The ImageIO TIFF plugin does not handle orientation. Use {@link TIFFUtilities#applyOrientation(BufferedImage, int)} for applying TIFF.TAG_ORIENTATION. </p> @param imageInput @param imageOutput @param degree Rotation amount, supports 90�, 180� and 270�. @throws IOException
[ "Rotates", "all", "pages", "of", "a", "TIFF", "file", "by", "changing", "TIFF", ".", "TAG_ORIENTATION", ".", "<p", ">", "NOTICE", ":", "TIFF", ".", "TAG_ORIENTATION", "is", "an", "advice", "how", "the", "image", "is", "meant", "do", "be", "displayed", "....
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/contrib/src/main/java/com/twelvemonkeys/contrib/tiff/TIFFUtilities.java#L159-L162
gallandarakhneorg/afc
core/text/src/main/java/org/arakhne/afc/text/TextUtil.java
TextUtil.formatDouble
@Pure public static String formatDouble(double amount, int decimalCount) { final int dc = (decimalCount < 0) ? 0 : decimalCount; final StringBuilder str = new StringBuilder("#0"); //$NON-NLS-1$ if (dc > 0) { str.append('.'); for (int i = 0; i < dc; ++i) { str.append('0'); } } final DecimalFormat fmt = new DecimalFormat(str.toString()); return fmt.format(amount); }
java
@Pure public static String formatDouble(double amount, int decimalCount) { final int dc = (decimalCount < 0) ? 0 : decimalCount; final StringBuilder str = new StringBuilder("#0"); //$NON-NLS-1$ if (dc > 0) { str.append('.'); for (int i = 0; i < dc; ++i) { str.append('0'); } } final DecimalFormat fmt = new DecimalFormat(str.toString()); return fmt.format(amount); }
[ "@", "Pure", "public", "static", "String", "formatDouble", "(", "double", "amount", ",", "int", "decimalCount", ")", "{", "final", "int", "dc", "=", "(", "decimalCount", "<", "0", ")", "?", "0", ":", "decimalCount", ";", "final", "StringBuilder", "str", ...
Format the given double value. @param amount the value to convert. @param decimalCount is the maximal count of decimal to put in the string. @return a string representation of the given value.
[ "Format", "the", "given", "double", "value", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/TextUtil.java#L1639-L1654
apereo/cas
support/cas-server-support-ws-sts-api/src/main/java/org/apereo/cas/support/util/CryptoUtils.java
CryptoUtils.getSecurityProperties
public static Properties getSecurityProperties(final String file, final String psw) { return getSecurityProperties(file, psw, null); }
java
public static Properties getSecurityProperties(final String file, final String psw) { return getSecurityProperties(file, psw, null); }
[ "public", "static", "Properties", "getSecurityProperties", "(", "final", "String", "file", ",", "final", "String", "psw", ")", "{", "return", "getSecurityProperties", "(", "file", ",", "psw", ",", "null", ")", ";", "}" ]
Gets security properties. @param file the file @param psw the psw @return the security properties
[ "Gets", "security", "properties", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-ws-sts-api/src/main/java/org/apereo/cas/support/util/CryptoUtils.java#L25-L27
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.beginConvertToManagedDisks
public OperationStatusResponseInner beginConvertToManagedDisks(String resourceGroupName, String vmName) { return beginConvertToManagedDisksWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().single().body(); }
java
public OperationStatusResponseInner beginConvertToManagedDisks(String resourceGroupName, String vmName) { return beginConvertToManagedDisksWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().single().body(); }
[ "public", "OperationStatusResponseInner", "beginConvertToManagedDisks", "(", "String", "resourceGroupName", ",", "String", "vmName", ")", "{", "return", "beginConvertToManagedDisksWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ")", ".", "toBlocking", "(",...
Converts virtual machine disks from blob-based to managed disks. Virtual machine must be stop-deallocated before invoking this operation. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the OperationStatusResponseInner object if successful.
[ "Converts", "virtual", "machine", "disks", "from", "blob", "-", "based", "to", "managed", "disks", ".", "Virtual", "machine", "must", "be", "stop", "-", "deallocated", "before", "invoking", "this", "operation", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L1203-L1205
vincentk/joptimizer
src/main/java/com/joptimizer/functions/SDPLogarithmicBarrier.java
SDPLogarithmicBarrier.calculatePhase1InitialFeasiblePoint
@Override public double calculatePhase1InitialFeasiblePoint(double[] originalNotFeasiblePoint, double tolerance){ RealMatrix F = this.buildS(originalNotFeasiblePoint).scalarMultiply(-1); RealMatrix S = F.scalarMultiply(-1); try{ new CholeskyDecomposition(S); //already feasible return -1; }catch(NonPositiveDefiniteMatrixException ee){ //it does NOT mean that F is negative, it can be not definite EigenDecomposition eFact = new EigenDecomposition(F); double[] eValues = eFact.getRealEigenvalues(); double minEigenValue = eValues[Utils.getMinIndex(DoubleFactory1D.dense.make(eValues))]; return -Math.min(minEigenValue * Math.pow(tolerance, -0.5), 0.); } }
java
@Override public double calculatePhase1InitialFeasiblePoint(double[] originalNotFeasiblePoint, double tolerance){ RealMatrix F = this.buildS(originalNotFeasiblePoint).scalarMultiply(-1); RealMatrix S = F.scalarMultiply(-1); try{ new CholeskyDecomposition(S); //already feasible return -1; }catch(NonPositiveDefiniteMatrixException ee){ //it does NOT mean that F is negative, it can be not definite EigenDecomposition eFact = new EigenDecomposition(F); double[] eValues = eFact.getRealEigenvalues(); double minEigenValue = eValues[Utils.getMinIndex(DoubleFactory1D.dense.make(eValues))]; return -Math.min(minEigenValue * Math.pow(tolerance, -0.5), 0.); } }
[ "@", "Override", "public", "double", "calculatePhase1InitialFeasiblePoint", "(", "double", "[", "]", "originalNotFeasiblePoint", ",", "double", "tolerance", ")", "{", "RealMatrix", "F", "=", "this", ".", "buildS", "(", "originalNotFeasiblePoint", ")", ".", "scalarMu...
Calculates the initial value for the s parameter in Phase I. Return s so that F(x)-s.I is negative definite @see "S.Boyd and L.Vandenberghe, Convex Optimization, 11.6.2" @see "S.Boyd and L.Vandenberghe, Semidefinite programming, 6.1"
[ "Calculates", "the", "initial", "value", "for", "the", "s", "parameter", "in", "Phase", "I", ".", "Return", "s", "so", "that", "F", "(", "x", ")", "-", "s", ".", "I", "is", "negative", "definite" ]
train
https://github.com/vincentk/joptimizer/blob/65064c1bb0b26c7261358021e4c93d06dd43564f/src/main/java/com/joptimizer/functions/SDPLogarithmicBarrier.java#L145-L160
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/Messages.java
Messages.getStringFromBundle
public static String getStringFromBundle(String resourceBundleName, String msgKey, Locale tmpLocale, String rawMessage) { return getStringFromBundle(null, resourceBundleName, msgKey, tmpLocale, rawMessage); }
java
public static String getStringFromBundle(String resourceBundleName, String msgKey, Locale tmpLocale, String rawMessage) { return getStringFromBundle(null, resourceBundleName, msgKey, tmpLocale, rawMessage); }
[ "public", "static", "String", "getStringFromBundle", "(", "String", "resourceBundleName", ",", "String", "msgKey", ",", "Locale", "tmpLocale", ",", "String", "rawMessage", ")", "{", "return", "getStringFromBundle", "(", "null", ",", "resourceBundleName", ",", "msgKe...
Retrieve a string from the bundle @param resourceBundleName the package-qualified name of the ResourceBundle. Must NOT be null @param msgKey the key to lookup in the bundle, if null rawMessage will be returned @param tmpLocale Locale to use for the bundle, can be null @param rawMessage The default message to use if the message key is not found @return The value of msg key lookup, or the value of raw message
[ "Retrieve", "a", "string", "from", "the", "bundle" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ejs/ras/hpel/Messages.java#L80-L82
jenkinsci/artifactory-plugin
src/main/java/org/jfrog/hudson/action/ActionableHelper.java
ActionableHelper.deleteFilePath
public static void deleteFilePath(FilePath workspace, String path) throws IOException { if (StringUtils.isNotBlank(path)) { try { FilePath propertiesFile = new FilePath(workspace, path); propertiesFile.delete(); } catch (Exception e) { throw new IOException("Could not delete temp file: " + path); } } }
java
public static void deleteFilePath(FilePath workspace, String path) throws IOException { if (StringUtils.isNotBlank(path)) { try { FilePath propertiesFile = new FilePath(workspace, path); propertiesFile.delete(); } catch (Exception e) { throw new IOException("Could not delete temp file: " + path); } } }
[ "public", "static", "void", "deleteFilePath", "(", "FilePath", "workspace", ",", "String", "path", ")", "throws", "IOException", "{", "if", "(", "StringUtils", ".", "isNotBlank", "(", "path", ")", ")", "{", "try", "{", "FilePath", "propertiesFile", "=", "new...
Deletes a FilePath file. @param workspace The build workspace. @param path The path in the workspace. @throws IOException In case of missing file.
[ "Deletes", "a", "FilePath", "file", "." ]
train
https://github.com/jenkinsci/artifactory-plugin/blob/f5fcfff6a5a50be5374813e49d1fe3aaf6422333/src/main/java/org/jfrog/hudson/action/ActionableHelper.java#L277-L286
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/ModelControllerLock.java
ModelControllerLock.lockShared
boolean lockShared(final Integer permit, final long timeout, final TimeUnit unit) { boolean result = false; try { result = lockSharedInterruptibly(permit, timeout, unit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } return result; }
java
boolean lockShared(final Integer permit, final long timeout, final TimeUnit unit) { boolean result = false; try { result = lockSharedInterruptibly(permit, timeout, unit); } catch (InterruptedException e) { Thread.currentThread().interrupt(); } return result; }
[ "boolean", "lockShared", "(", "final", "Integer", "permit", ",", "final", "long", "timeout", ",", "final", "TimeUnit", "unit", ")", "{", "boolean", "result", "=", "false", ";", "try", "{", "result", "=", "lockSharedInterruptibly", "(", "permit", ",", "timeou...
Attempts shared acquisition with a max wait time. @param permit - the permit Integer for this operation. May not be {@code null}. @param timeout - the time value to wait for acquiring the lock @param unit - See {@code TimeUnit} for valid values @return {@code boolean} true on success.
[ "Attempts", "shared", "acquisition", "with", "a", "max", "wait", "time", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ModelControllerLock.java#L90-L98
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.regenerateStorageAccountKeyAsync
public ServiceFuture<StorageBundle> regenerateStorageAccountKeyAsync(String vaultBaseUrl, String storageAccountName, String keyName, final ServiceCallback<StorageBundle> serviceCallback) { return ServiceFuture.fromResponse(regenerateStorageAccountKeyWithServiceResponseAsync(vaultBaseUrl, storageAccountName, keyName), serviceCallback); }
java
public ServiceFuture<StorageBundle> regenerateStorageAccountKeyAsync(String vaultBaseUrl, String storageAccountName, String keyName, final ServiceCallback<StorageBundle> serviceCallback) { return ServiceFuture.fromResponse(regenerateStorageAccountKeyWithServiceResponseAsync(vaultBaseUrl, storageAccountName, keyName), serviceCallback); }
[ "public", "ServiceFuture", "<", "StorageBundle", ">", "regenerateStorageAccountKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "String", "keyName", ",", "final", "ServiceCallback", "<", "StorageBundle", ">", "serviceCallback", ")", "{...
Regenerates the specified key value for the given storage account. This operation requires the storage/regeneratekey permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param keyName The storage account key name. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Regenerates", "the", "specified", "key", "value", "for", "the", "given", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "regeneratekey", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L10308-L10310
OpenLiberty/open-liberty
dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java
AppClassLoader.findClass
@Override @FFDCIgnore(ClassNotFoundException.class) protected final Class<?> findClass(String name) throws ClassNotFoundException { if (transformers.isEmpty()) { Class<?> clazz = null; Object token = ThreadIdentityManager.runAsServer(); try { synchronized (getClassLoadingLock(name)) { // This method may be invoked directly instead of via loadClass // (e.g. when doing a "shallow" scan of the common library classloaders). // So we first must check whether we've already defined/loaded the class. // Otherwise we'll get a LinkageError on the second findClass call because // it will attempt to define the class a 2nd time. clazz = findLoadedClass(name); if (clazz == null) { ByteResourceInformation byteResInfo = this.findClassBytes(name); clazz = definePackageAndClass(name, byteResInfo, byteResInfo.getBytes()); } } } catch (ClassNotFoundException cnfe) { // Check the common libraries. clazz = findClassCommonLibraryClassLoaders(name); } finally { ThreadIdentityManager.reset(token); } return clazz; } ByteResourceInformation byteResourceInformation; try { byteResourceInformation = findClassBytes(name); } catch (ClassNotFoundException cnfe) { // Check the common libraries. return findClassCommonLibraryClassLoaders(name); } byte[] bytes = transformClassBytes(byteResourceInformation.getBytes(), name); return definePackageAndClass(name, byteResourceInformation, bytes); }
java
@Override @FFDCIgnore(ClassNotFoundException.class) protected final Class<?> findClass(String name) throws ClassNotFoundException { if (transformers.isEmpty()) { Class<?> clazz = null; Object token = ThreadIdentityManager.runAsServer(); try { synchronized (getClassLoadingLock(name)) { // This method may be invoked directly instead of via loadClass // (e.g. when doing a "shallow" scan of the common library classloaders). // So we first must check whether we've already defined/loaded the class. // Otherwise we'll get a LinkageError on the second findClass call because // it will attempt to define the class a 2nd time. clazz = findLoadedClass(name); if (clazz == null) { ByteResourceInformation byteResInfo = this.findClassBytes(name); clazz = definePackageAndClass(name, byteResInfo, byteResInfo.getBytes()); } } } catch (ClassNotFoundException cnfe) { // Check the common libraries. clazz = findClassCommonLibraryClassLoaders(name); } finally { ThreadIdentityManager.reset(token); } return clazz; } ByteResourceInformation byteResourceInformation; try { byteResourceInformation = findClassBytes(name); } catch (ClassNotFoundException cnfe) { // Check the common libraries. return findClassCommonLibraryClassLoaders(name); } byte[] bytes = transformClassBytes(byteResourceInformation.getBytes(), name); return definePackageAndClass(name, byteResourceInformation, bytes); }
[ "@", "Override", "@", "FFDCIgnore", "(", "ClassNotFoundException", ".", "class", ")", "protected", "final", "Class", "<", "?", ">", "findClass", "(", "String", "name", ")", "throws", "ClassNotFoundException", "{", "if", "(", "transformers", ".", "isEmpty", "("...
@{inheritDoc Search order: 1. This classloader. 2. The common library classloaders. Note: the method is marked 'final' so that derived classes (such as ParentLastClassLoader) don't override this method and lose the common library classloader support.
[ "@", "{", "inheritDoc" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.classloading/src/com/ibm/ws/classloading/internal/AppClassLoader.java#L265-L305
apache/flink
flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java
CliFrontend.setJobManagerAddressInConfig
static void setJobManagerAddressInConfig(Configuration config, InetSocketAddress address) { config.setString(JobManagerOptions.ADDRESS, address.getHostString()); config.setInteger(JobManagerOptions.PORT, address.getPort()); config.setString(RestOptions.ADDRESS, address.getHostString()); config.setInteger(RestOptions.PORT, address.getPort()); }
java
static void setJobManagerAddressInConfig(Configuration config, InetSocketAddress address) { config.setString(JobManagerOptions.ADDRESS, address.getHostString()); config.setInteger(JobManagerOptions.PORT, address.getPort()); config.setString(RestOptions.ADDRESS, address.getHostString()); config.setInteger(RestOptions.PORT, address.getPort()); }
[ "static", "void", "setJobManagerAddressInConfig", "(", "Configuration", "config", ",", "InetSocketAddress", "address", ")", "{", "config", ".", "setString", "(", "JobManagerOptions", ".", "ADDRESS", ",", "address", ".", "getHostString", "(", ")", ")", ";", "config...
Writes the given job manager address to the associated configuration object. @param address Address to write to the configuration @param config The configuration to write to
[ "Writes", "the", "given", "job", "manager", "address", "to", "the", "associated", "configuration", "object", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java#L1103-L1108
alibaba/jstorm
jstorm-core/src/main/java/com/alibaba/jstorm/metric/JStormMetricsReporter.java
JStormMetricsReporter.updateMetricMeta
public void updateMetricMeta(Map<String, Long> nameIdMap) { if (nameIdMap != null) { for (String name : nameIdMap.keySet()) { AsmMetric metric = JStormMetrics.find(name); if (metric != null) { long id = nameIdMap.get(name); metric.setMetricId(id); LOG.debug("set metric id, {}:{}", name, id); } } } }
java
public void updateMetricMeta(Map<String, Long> nameIdMap) { if (nameIdMap != null) { for (String name : nameIdMap.keySet()) { AsmMetric metric = JStormMetrics.find(name); if (metric != null) { long id = nameIdMap.get(name); metric.setMetricId(id); LOG.debug("set metric id, {}:{}", name, id); } } } }
[ "public", "void", "updateMetricMeta", "(", "Map", "<", "String", ",", "Long", ">", "nameIdMap", ")", "{", "if", "(", "nameIdMap", "!=", "null", ")", "{", "for", "(", "String", "name", ":", "nameIdMap", ".", "keySet", "(", ")", ")", "{", "AsmMetric", ...
Register metric meta callback. Called in SpoutExecutors/BoltExecutors within topology workers. JStormMetricsReporter first sends a TOPOLOGY_MASTER_REGISTER_METRICS_STREAM_ID stream to TM to register metrics, on success TM will return a TOPOLOGY_MASTER_REGISTER_METRICS_RESP_STREAM_ID stream which contains registered metric meta and then call this method to update local meta.
[ "Register", "metric", "meta", "callback", ".", "Called", "in", "SpoutExecutors", "/", "BoltExecutors", "within", "topology", "workers", "." ]
train
https://github.com/alibaba/jstorm/blob/5d6cde22dbca7df3d6e6830bf94f98a6639ab559/jstorm-core/src/main/java/com/alibaba/jstorm/metric/JStormMetricsReporter.java#L447-L459
alkacon/opencms-core
src/org/opencms/i18n/CmsMultiMessages.java
CmsMultiMessages.addMessages
public void addMessages(CmsMessages messages) throws CmsIllegalArgumentException { Locale locale = messages.getLocale(); if (!getLocale().equals(locale)) { // not the same locale, try to change the locale if this is a simple CmsMessage object if (!(messages instanceof CmsMultiMessages)) { // match locale of multi bundle String bundleName = messages.getBundleName(); messages = new CmsMessages(bundleName, getLocale()); } else { // multi bundles with wrong locales can't be added this way throw new CmsIllegalArgumentException(Messages.get().container( Messages.ERR_MULTIMSG_LOCALE_DOES_NOT_MATCH_2, messages.getLocale(), getLocale())); } } if (!m_messages.contains(messages)) { if ((m_messageCache != null) && (m_messageCache.size() > 0)) { // cache has already been used, must flush because of newly added keys m_messageCache = new Hashtable<String, String>(); } m_messages.add(messages); } }
java
public void addMessages(CmsMessages messages) throws CmsIllegalArgumentException { Locale locale = messages.getLocale(); if (!getLocale().equals(locale)) { // not the same locale, try to change the locale if this is a simple CmsMessage object if (!(messages instanceof CmsMultiMessages)) { // match locale of multi bundle String bundleName = messages.getBundleName(); messages = new CmsMessages(bundleName, getLocale()); } else { // multi bundles with wrong locales can't be added this way throw new CmsIllegalArgumentException(Messages.get().container( Messages.ERR_MULTIMSG_LOCALE_DOES_NOT_MATCH_2, messages.getLocale(), getLocale())); } } if (!m_messages.contains(messages)) { if ((m_messageCache != null) && (m_messageCache.size() > 0)) { // cache has already been used, must flush because of newly added keys m_messageCache = new Hashtable<String, String>(); } m_messages.add(messages); } }
[ "public", "void", "addMessages", "(", "CmsMessages", "messages", ")", "throws", "CmsIllegalArgumentException", "{", "Locale", "locale", "=", "messages", ".", "getLocale", "(", ")", ";", "if", "(", "!", "getLocale", "(", ")", ".", "equals", "(", "locale", ")"...
Adds a messages instance to this multi message bundle.<p> The messages instance should have been initialized with the same locale as this multi bundle, if not, the locale of the messages instance is automatically replaced. However, this will not work if the added messages instance is in face also of type <code>{@link CmsMultiMessages}</code>.<p> @param messages the messages instance to add @throws CmsIllegalArgumentException if the locale of the given <code>{@link CmsMultiMessages}</code> does not match the locale of this multi messages
[ "Adds", "a", "messages", "instance", "to", "this", "multi", "message", "bundle", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsMultiMessages.java#L129-L153
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/StandardResponsesApi.java
StandardResponsesApi.deleteStandardResponseFavorite
public ApiSuccessResponse deleteStandardResponseFavorite(String id, RemoveFavoritesData removeFavoritesData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = deleteStandardResponseFavoriteWithHttpInfo(id, removeFavoritesData); return resp.getData(); }
java
public ApiSuccessResponse deleteStandardResponseFavorite(String id, RemoveFavoritesData removeFavoritesData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = deleteStandardResponseFavoriteWithHttpInfo(id, removeFavoritesData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "deleteStandardResponseFavorite", "(", "String", "id", ",", "RemoveFavoritesData", "removeFavoritesData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "deleteStandardResponseFavoriteWithHttpInfo"...
Remove a Standard Response from Favorites @param id id of the Standard Response to remove from Favorites (required) @param removeFavoritesData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Remove", "a", "Standard", "Response", "from", "Favorites" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/StandardResponsesApi.java#L385-L388
rometools/rome
rome-fetcher/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java
AbstractFeedFetcher.combineFeeds
public static SyndFeed combineFeeds(final SyndFeed originalFeed, final SyndFeed newFeed) { try { final SyndFeed result = (SyndFeed) newFeed.clone(); result.getEntries().addAll(result.getEntries().size(), originalFeed.getEntries()); return result; } catch (final CloneNotSupportedException e) { final IllegalArgumentException iae = new IllegalArgumentException("Cannot clone feed"); iae.initCause(e); throw iae; } }
java
public static SyndFeed combineFeeds(final SyndFeed originalFeed, final SyndFeed newFeed) { try { final SyndFeed result = (SyndFeed) newFeed.clone(); result.getEntries().addAll(result.getEntries().size(), originalFeed.getEntries()); return result; } catch (final CloneNotSupportedException e) { final IllegalArgumentException iae = new IllegalArgumentException("Cannot clone feed"); iae.initCause(e); throw iae; } }
[ "public", "static", "SyndFeed", "combineFeeds", "(", "final", "SyndFeed", "originalFeed", ",", "final", "SyndFeed", "newFeed", ")", "{", "try", "{", "final", "SyndFeed", "result", "=", "(", "SyndFeed", ")", "newFeed", ".", "clone", "(", ")", ";", "result", ...
<p> Combine the entries in two feeds into a single feed. </p> <p> The returned feed will have the same data as the newFeed parameter, with the entries from originalFeed appended to the end of its entries. </p> @param originalFeed @param newFeed @return
[ "<p", ">", "Combine", "the", "entries", "in", "two", "feeds", "into", "a", "single", "feed", ".", "<", "/", "p", ">" ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-fetcher/src/main/java/com/rometools/fetcher/impl/AbstractFeedFetcher.java#L210-L220
zandero/rest.vertx
src/main/java/com/zandero/rest/RestRouter.java
RestRouter.notFound
public static void notFound(Router router, String regExPath, Class<? extends NotFoundResponseWriter> notFound) { Assert.notNull(router, "Missing router!"); Assert.notNull(notFound, "Missing not found handler!"); addLastHandler(router, regExPath, getNotFoundHandler(notFound)); }
java
public static void notFound(Router router, String regExPath, Class<? extends NotFoundResponseWriter> notFound) { Assert.notNull(router, "Missing router!"); Assert.notNull(notFound, "Missing not found handler!"); addLastHandler(router, regExPath, getNotFoundHandler(notFound)); }
[ "public", "static", "void", "notFound", "(", "Router", "router", ",", "String", "regExPath", ",", "Class", "<", "?", "extends", "NotFoundResponseWriter", ">", "notFound", ")", "{", "Assert", ".", "notNull", "(", "router", ",", "\"Missing router!\"", ")", ";", ...
Handles not found route in case request regExPath mathes given regExPath prefix @param router to add route to @param regExPath prefix @param notFound hander
[ "Handles", "not", "found", "route", "in", "case", "request", "regExPath", "mathes", "given", "regExPath", "prefix" ]
train
https://github.com/zandero/rest.vertx/blob/ba458720cf59e076953eab9dac7227eeaf9e58ce/src/main/java/com/zandero/rest/RestRouter.java#L304-L310
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/UtilLepetitEPnP.java
UtilLepetitEPnP.constraintMatrix6x3
public static void constraintMatrix6x3( DMatrixRMaj L_6x10 , DMatrixRMaj L_6x3 ) { int index = 0; for( int i = 0; i < 6; i++ ) { L_6x3.data[index++] = L_6x10.get(i,0); L_6x3.data[index++] = L_6x10.get(i,1); L_6x3.data[index++] = L_6x10.get(i,4); } }
java
public static void constraintMatrix6x3( DMatrixRMaj L_6x10 , DMatrixRMaj L_6x3 ) { int index = 0; for( int i = 0; i < 6; i++ ) { L_6x3.data[index++] = L_6x10.get(i,0); L_6x3.data[index++] = L_6x10.get(i,1); L_6x3.data[index++] = L_6x10.get(i,4); } }
[ "public", "static", "void", "constraintMatrix6x3", "(", "DMatrixRMaj", "L_6x10", ",", "DMatrixRMaj", "L_6x3", ")", "{", "int", "index", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "6", ";", "i", "++", ")", "{", "L_6x3", ".", "da...
Extracts the linear constraint matrix for case 2 from the full 6x10 constraint matrix.
[ "Extracts", "the", "linear", "constraint", "matrix", "for", "case", "2", "from", "the", "full", "6x10", "constraint", "matrix", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/pose/UtilLepetitEPnP.java#L82-L90
Azure/azure-sdk-for-java
sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java
BackupShortTermRetentionPoliciesInner.beginCreateOrUpdate
public BackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); }
java
public BackupShortTermRetentionPolicyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String databaseName) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName).toBlocking().single().body(); }
[ "public", "BackupShortTermRetentionPolicyInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName"...
Updates a database's short term retention policy. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the BackupShortTermRetentionPolicyInner object if successful.
[ "Updates", "a", "database", "s", "short", "term", "retention", "policy", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_10_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_10_01_preview/implementation/BackupShortTermRetentionPoliciesInner.java#L360-L362
liyiorg/weixin-popular
src/main/java/weixin/popular/api/TicketAPI.java
TicketAPI.ticketGetticket
public static Ticket ticketGetticket(String access_token,String type){ HttpUriRequest httpUriRequest = RequestBuilder.get() .setUri(BASE_URI + "/cgi-bin/ticket/getticket") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .addParameter("type", type) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,Ticket.class); }
java
public static Ticket ticketGetticket(String access_token,String type){ HttpUriRequest httpUriRequest = RequestBuilder.get() .setUri(BASE_URI + "/cgi-bin/ticket/getticket") .addParameter(PARAM_ACCESS_TOKEN, API.accessToken(access_token)) .addParameter("type", type) .build(); return LocalHttpClient.executeJsonResult(httpUriRequest,Ticket.class); }
[ "public", "static", "Ticket", "ticketGetticket", "(", "String", "access_token", ",", "String", "type", ")", "{", "HttpUriRequest", "httpUriRequest", "=", "RequestBuilder", ".", "get", "(", ")", ".", "setUri", "(", "BASE_URI", "+", "\"/cgi-bin/ticket/getticket\"", ...
获取 ticket @param access_token access_token @param type jsapi or wx_card @return ticket
[ "获取", "ticket" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/TicketAPI.java#L31-L38
wisdom-framework/wisdom
core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/WatcherUtils.java
WatcherUtils.isInDirectory
public static boolean isInDirectory(File file, File directory) { try { return FilenameUtils.directoryContains(directory.getCanonicalPath(), file.getCanonicalPath()); } catch (IOException e) { //NOSONAR return false; } }
java
public static boolean isInDirectory(File file, File directory) { try { return FilenameUtils.directoryContains(directory.getCanonicalPath(), file.getCanonicalPath()); } catch (IOException e) { //NOSONAR return false; } }
[ "public", "static", "boolean", "isInDirectory", "(", "File", "file", ",", "File", "directory", ")", "{", "try", "{", "return", "FilenameUtils", ".", "directoryContains", "(", "directory", ".", "getCanonicalPath", "(", ")", ",", "file", ".", "getCanonicalPath", ...
Checks whether the given file is inside the given directory. @param file the file @param directory the directory @return {@literal true} if the file is in the directory (or any subdirectories), {@literal false} otherwise.
[ "Checks", "whether", "the", "given", "file", "is", "inside", "the", "given", "directory", "." ]
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/wisdom-maven-plugin/src/main/java/org/wisdom/maven/utils/WatcherUtils.java#L44-L50
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java
GenericIHEAuditEventMessage.addDocumentUriParticipantObject
public void addDocumentUriParticipantObject(String documentRetrieveUri, String documentUniqueId) { List<TypeValuePairType> tvp = new LinkedList<>(); if (documentUniqueId != null) { tvp.add(getTypeValuePair("XDSDocumentEntry.uniqueId", documentUniqueId.getBytes())); } addParticipantObjectIdentification( new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.URI(), null, null, tvp, documentRetrieveUri, RFC3881ParticipantObjectTypeCodes.SYSTEM, RFC3881ParticipantObjectTypeRoleCodes.REPORT, null, null); }
java
public void addDocumentUriParticipantObject(String documentRetrieveUri, String documentUniqueId) { List<TypeValuePairType> tvp = new LinkedList<>(); if (documentUniqueId != null) { tvp.add(getTypeValuePair("XDSDocumentEntry.uniqueId", documentUniqueId.getBytes())); } addParticipantObjectIdentification( new RFC3881ParticipantObjectCodes.RFC3881ParticipantObjectIDTypeCodes.URI(), null, null, tvp, documentRetrieveUri, RFC3881ParticipantObjectTypeCodes.SYSTEM, RFC3881ParticipantObjectTypeRoleCodes.REPORT, null, null); }
[ "public", "void", "addDocumentUriParticipantObject", "(", "String", "documentRetrieveUri", ",", "String", "documentUniqueId", ")", "{", "List", "<", "TypeValuePairType", ">", "tvp", "=", "new", "LinkedList", "<>", "(", ")", ";", "if", "(", "documentUniqueId", "!="...
Adds a Participant Object representing a URI @param documentRetrieveUri The URI of the Participant Object @param documentUniqueId The Document Entry Unique ID
[ "Adds", "a", "Participant", "Object", "representing", "a", "URI" ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/events/ihe/GenericIHEAuditEventMessage.java#L208-L224
korpling/ANNIS
annis-libgui/src/main/java/annis/libgui/AnnisBaseUI.java
AnnisBaseUI.injectUniqueCSS
public void injectUniqueCSS(String cssContent, String wrapperClass) { if(alreadyAddedCSS == null) { alreadyAddedCSS = new TreeSet<String>(); } if(wrapperClass != null) { cssContent = wrapCSS(cssContent, wrapperClass); } String hashForCssContent = Hashing.md5().hashString(cssContent, Charsets.UTF_8).toString(); if(!alreadyAddedCSS.contains(hashForCssContent)) { // CSSInject cssInject = new CSSInject(UI.getCurrent()); // cssInject.setStyles(cssContent); Page.getCurrent().getStyles().add(cssContent); alreadyAddedCSS.add(hashForCssContent); } }
java
public void injectUniqueCSS(String cssContent, String wrapperClass) { if(alreadyAddedCSS == null) { alreadyAddedCSS = new TreeSet<String>(); } if(wrapperClass != null) { cssContent = wrapCSS(cssContent, wrapperClass); } String hashForCssContent = Hashing.md5().hashString(cssContent, Charsets.UTF_8).toString(); if(!alreadyAddedCSS.contains(hashForCssContent)) { // CSSInject cssInject = new CSSInject(UI.getCurrent()); // cssInject.setStyles(cssContent); Page.getCurrent().getStyles().add(cssContent); alreadyAddedCSS.add(hashForCssContent); } }
[ "public", "void", "injectUniqueCSS", "(", "String", "cssContent", ",", "String", "wrapperClass", ")", "{", "if", "(", "alreadyAddedCSS", "==", "null", ")", "{", "alreadyAddedCSS", "=", "new", "TreeSet", "<", "String", ">", "(", ")", ";", "}", "if", "(", ...
Inject CSS into the UI. This function will not add multiple style-elements if the exact CSS string was already added. @param cssContent @param wrapperClass Name of the wrapper class (a CSS class that is applied to a parent element)
[ "Inject", "CSS", "into", "the", "UI", ".", "This", "function", "will", "not", "add", "multiple", "style", "-", "elements", "if", "the", "exact", "CSS", "string", "was", "already", "added", "." ]
train
https://github.com/korpling/ANNIS/blob/152a2e34832e015f73ac8ce8a7d4c32641641324/annis-libgui/src/main/java/annis/libgui/AnnisBaseUI.java#L441-L461
spothero/volley-jackson-extension
Library/src/com/spothero/volley/JacksonNetwork.java
JacksonNetwork.newRequestQueue
public static RequestQueue newRequestQueue(Context context, HttpStack stack) { RequestQueue queue = new RequestQueue(new DiskBasedCache(new File(context.getCacheDir(), "volley")), new JacksonNetwork(stack)); queue.start(); return queue; }
java
public static RequestQueue newRequestQueue(Context context, HttpStack stack) { RequestQueue queue = new RequestQueue(new DiskBasedCache(new File(context.getCacheDir(), "volley")), new JacksonNetwork(stack)); queue.start(); return queue; }
[ "public", "static", "RequestQueue", "newRequestQueue", "(", "Context", "context", ",", "HttpStack", "stack", ")", "{", "RequestQueue", "queue", "=", "new", "RequestQueue", "(", "new", "DiskBasedCache", "(", "new", "File", "(", "context", ".", "getCacheDir", "(",...
Creates a default instance of the worker pool and calls {@link RequestQueue#start()} on it. @param context A {@link Context} to use for creating the cache dir. @param stack An {@link com.android.volley.toolbox.HttpStack} to use for handling network calls @return A started {@link RequestQueue} instance.
[ "Creates", "a", "default", "instance", "of", "the", "worker", "pool", "and", "calls", "{", "@link", "RequestQueue#start", "()", "}", "on", "it", "." ]
train
https://github.com/spothero/volley-jackson-extension/blob/9b02df3e3e8fc648c80aec2dfae456de949fb74b/Library/src/com/spothero/volley/JacksonNetwork.java#L192-L196
abel533/EasyXls
src/main/java/com/github/abel533/easyxls/EasyXls.java
EasyXls.list2Xls
public static boolean list2Xls(List<?> list, String xmlPath, OutputStream outputStream) throws Exception { return XlsUtil.list2Xls(list, xmlPath, outputStream); }
java
public static boolean list2Xls(List<?> list, String xmlPath, OutputStream outputStream) throws Exception { return XlsUtil.list2Xls(list, xmlPath, outputStream); }
[ "public", "static", "boolean", "list2Xls", "(", "List", "<", "?", ">", "list", ",", "String", "xmlPath", ",", "OutputStream", "outputStream", ")", "throws", "Exception", "{", "return", "XlsUtil", ".", "list2Xls", "(", "list", ",", "xmlPath", ",", "outputStre...
导出list对象到excel @param list 导出的list @param xmlPath xml完整路径 @param outputStream 输出流 @return 处理结果,true成功,false失败 @throws Exception
[ "导出list对象到excel" ]
train
https://github.com/abel533/EasyXls/blob/f73be23745c2180d7c0b8f0a510e72e61cc37d5d/src/main/java/com/github/abel533/easyxls/EasyXls.java#L109-L111
steveohara/j2mod
src/main/java/com/ghgande/j2mod/modbus/io/ModbusSerialTransport.java
ModbusSerialTransport.writeBytes
final int writeBytes(byte[] buffer, long bytesToWrite) throws IOException { if (commPort != null && commPort.isOpen()) { return commPort.writeBytes(buffer, bytesToWrite); } else { throw new IOException("Comm port is not valid or not open"); } }
java
final int writeBytes(byte[] buffer, long bytesToWrite) throws IOException { if (commPort != null && commPort.isOpen()) { return commPort.writeBytes(buffer, bytesToWrite); } else { throw new IOException("Comm port is not valid or not open"); } }
[ "final", "int", "writeBytes", "(", "byte", "[", "]", "buffer", ",", "long", "bytesToWrite", ")", "throws", "IOException", "{", "if", "(", "commPort", "!=", "null", "&&", "commPort", ".", "isOpen", "(", ")", ")", "{", "return", "commPort", ".", "writeByte...
Writes the bytes to the output stream @param buffer Buffer to write @param bytesToWrite Number of bytes to write @return Number of bytes written @throws java.io.IOException if writing to invalid port
[ "Writes", "the", "bytes", "to", "the", "output", "stream" ]
train
https://github.com/steveohara/j2mod/blob/67162c55d7c02564e50211a9df06b8314953b5f2/src/main/java/com/ghgande/j2mod/modbus/io/ModbusSerialTransport.java#L439-L446
dashorst/wicket-stuff-markup-validator
isorelax/src/main/java/org/iso_relax/verifier/VerifierFactory.java
VerifierFactory.compileSchema
public Schema compileSchema( InputStream stream, String systemId ) throws VerifierConfigurationException, SAXException, IOException { InputSource is = new InputSource(stream); is.setSystemId(systemId); return compileSchema(is); }
java
public Schema compileSchema( InputStream stream, String systemId ) throws VerifierConfigurationException, SAXException, IOException { InputSource is = new InputSource(stream); is.setSystemId(systemId); return compileSchema(is); }
[ "public", "Schema", "compileSchema", "(", "InputStream", "stream", ",", "String", "systemId", ")", "throws", "VerifierConfigurationException", ",", "SAXException", ",", "IOException", "{", "InputSource", "is", "=", "new", "InputSource", "(", "stream", ")", ";", "i...
processes a schema into a Schema object, which is a compiled representation of a schema. The obtained schema object can then be used concurrently across multiple threads. @param systemId The system Id of this input stream.
[ "processes", "a", "schema", "into", "a", "Schema", "object", "which", "is", "a", "compiled", "representation", "of", "a", "schema", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/isorelax/src/main/java/org/iso_relax/verifier/VerifierFactory.java#L152-L158
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java
JobOperations.terminateJob
public void terminateJob(String jobId, String terminateReason) throws BatchErrorException, IOException { terminateJob(jobId, terminateReason, null); }
java
public void terminateJob(String jobId, String terminateReason) throws BatchErrorException, IOException { terminateJob(jobId, terminateReason, null); }
[ "public", "void", "terminateJob", "(", "String", "jobId", ",", "String", "terminateReason", ")", "throws", "BatchErrorException", ",", "IOException", "{", "terminateJob", "(", "jobId", ",", "terminateReason", ",", "null", ")", ";", "}" ]
Terminates the specified job, marking it as completed. @param jobId The ID of the job. @param terminateReason The message to describe the reason the job has terminated. This text will appear when you call {@link JobExecutionInformation#terminateReason()}. @throws BatchErrorException Exception thrown when an error response is received from the Batch service. @throws IOException Exception thrown when there is an error in serialization/deserialization of data sent to/received from the Batch service.
[ "Terminates", "the", "specified", "job", "marking", "it", "as", "completed", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/JobOperations.java#L370-L372
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.mergeCertificateAsync
public ServiceFuture<CertificateBundle> mergeCertificateAsync(String vaultBaseUrl, String certificateName, List<byte[]> x509Certificates, final ServiceCallback<CertificateBundle> serviceCallback) { return ServiceFuture.fromResponse(mergeCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, x509Certificates), serviceCallback); }
java
public ServiceFuture<CertificateBundle> mergeCertificateAsync(String vaultBaseUrl, String certificateName, List<byte[]> x509Certificates, final ServiceCallback<CertificateBundle> serviceCallback) { return ServiceFuture.fromResponse(mergeCertificateWithServiceResponseAsync(vaultBaseUrl, certificateName, x509Certificates), serviceCallback); }
[ "public", "ServiceFuture", "<", "CertificateBundle", ">", "mergeCertificateAsync", "(", "String", "vaultBaseUrl", ",", "String", "certificateName", ",", "List", "<", "byte", "[", "]", ">", "x509Certificates", ",", "final", "ServiceCallback", "<", "CertificateBundle", ...
Merges a certificate or a certificate chain with a key pair existing on the server. The MergeCertificate operation performs the merging of a certificate or certificate chain with a key pair currently available in the service. This operation requires the certificates/create permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param certificateName The name of the certificate. @param x509Certificates The certificate or the certificate chain to merge. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Merges", "a", "certificate", "or", "a", "certificate", "chain", "with", "a", "key", "pair", "existing", "on", "the", "server", ".", "The", "MergeCertificate", "operation", "performs", "the", "merging", "of", "a", "certificate", "or", "certificate", "chain", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L7926-L7928
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRules.java
PluralRules.matches
@Deprecated public boolean matches(FixedDecimal sample, String keyword) { return rules.select(sample, keyword); }
java
@Deprecated public boolean matches(FixedDecimal sample, String keyword) { return rules.select(sample, keyword); }
[ "@", "Deprecated", "public", "boolean", "matches", "(", "FixedDecimal", "sample", ",", "String", "keyword", ")", "{", "return", "rules", ".", "select", "(", "sample", ",", "keyword", ")", ";", "}" ]
Given a number information, and keyword, return whether the keyword would match the number. @param sample The number information for which the rule has to be determined. @param keyword The keyword to filter on @deprecated This API is ICU internal only. @hide original deprecated declaration @hide draft / provisional / internal are hidden on Android
[ "Given", "a", "number", "information", "and", "keyword", "return", "whether", "the", "keyword", "would", "match", "the", "number", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRules.java#L2029-L2032
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/xml/XMLOutputUtil.java
XMLOutputUtil.writeFileList
public static void writeFileList(XMLOutput xmlOutput, String tagName, Iterator<File> listValueIterator) throws IOException { while (listValueIterator.hasNext()) { xmlOutput.openTag(tagName); xmlOutput.writeText(listValueIterator.next().getPath()); xmlOutput.closeTag(tagName); } }
java
public static void writeFileList(XMLOutput xmlOutput, String tagName, Iterator<File> listValueIterator) throws IOException { while (listValueIterator.hasNext()) { xmlOutput.openTag(tagName); xmlOutput.writeText(listValueIterator.next().getPath()); xmlOutput.closeTag(tagName); } }
[ "public", "static", "void", "writeFileList", "(", "XMLOutput", "xmlOutput", ",", "String", "tagName", ",", "Iterator", "<", "File", ">", "listValueIterator", ")", "throws", "IOException", "{", "while", "(", "listValueIterator", ".", "hasNext", "(", ")", ")", "...
Write a list of Strings to document as elements with given tag name. @param xmlOutput the XMLOutput object to write to @param tagName the tag name @param listValueIterator Iterator over String values to write
[ "Write", "a", "list", "of", "Strings", "to", "document", "as", "elements", "with", "given", "tag", "name", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/xml/XMLOutputUtil.java#L93-L99
google/error-prone-javac
src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java
MemoryFileManager.inferBinaryName
@Override public String inferBinaryName(JavaFileManager.Location location, JavaFileObject file) { if (file instanceof OutputMemoryJavaFileObject) { OutputMemoryJavaFileObject ofo = (OutputMemoryJavaFileObject) file; proc.debug(DBG_FMGR, "inferBinaryName %s => %s\n", file, ofo.getName()); return ofo.getName(); } else { return stdFileManager.inferBinaryName(location, file); } }
java
@Override public String inferBinaryName(JavaFileManager.Location location, JavaFileObject file) { if (file instanceof OutputMemoryJavaFileObject) { OutputMemoryJavaFileObject ofo = (OutputMemoryJavaFileObject) file; proc.debug(DBG_FMGR, "inferBinaryName %s => %s\n", file, ofo.getName()); return ofo.getName(); } else { return stdFileManager.inferBinaryName(location, file); } }
[ "@", "Override", "public", "String", "inferBinaryName", "(", "JavaFileManager", ".", "Location", "location", ",", "JavaFileObject", "file", ")", "{", "if", "(", "file", "instanceof", "OutputMemoryJavaFileObject", ")", "{", "OutputMemoryJavaFileObject", "ofo", "=", "...
Infers a binary name of a file object based on a location. The binary name returned might not be a valid binary name according to <cite>The Java&trade { throw new UnsupportedOperationException("Not supported yet."); } Language Specification</cite>. @param location a location @param file a file object @return a binary name or {@code null} the file object is not found in the given location @throws IllegalStateException if {@link #close} has been called and this file manager cannot be reopened
[ "Infers", "a", "binary", "name", "of", "a", "file", "object", "based", "on", "a", "location", ".", "The", "binary", "name", "returned", "might", "not", "be", "a", "valid", "binary", "name", "according", "to", "<cite", ">", "The", "Java&trade", "{", "thro...
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jshell/share/classes/jdk/jshell/MemoryFileManager.java#L282-L291
gallandarakhneorg/afc
core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d2/Transform2D.java
Transform2D.makeScaleMatrix
public void makeScaleMatrix(double scaleX, double scaleY) { this.m00 = scaleX; this.m01 = 0.; this.m02 = 0.; this.m10 = 0.; this.m11 = scaleY; this.m12 = 0.; this.m20 = 0.; this.m21 = 0.; this.m22 = 1.; }
java
public void makeScaleMatrix(double scaleX, double scaleY) { this.m00 = scaleX; this.m01 = 0.; this.m02 = 0.; this.m10 = 0.; this.m11 = scaleY; this.m12 = 0.; this.m20 = 0.; this.m21 = 0.; this.m22 = 1.; }
[ "public", "void", "makeScaleMatrix", "(", "double", "scaleX", ",", "double", "scaleY", ")", "{", "this", ".", "m00", "=", "scaleX", ";", "this", ".", "m01", "=", "0.", ";", "this", ".", "m02", "=", "0.", ";", "this", ".", "m10", "=", "0.", ";", "...
Sets the value of this matrix to the given scaling, without rotation. <p>This function changes all the elements of the matrix, including the shearing and the translation. <p>After a call to this function, the matrix will contains (? means any value): <pre> [ sx 0 0 ] [ 0 sy 0 ] [ 0 0 1 ] </pre> @param scaleX is the scaling along X. @param scaleY is the scaling along Y. @see #setScale(double, double) @see #setScale(Tuple2D)
[ "Sets", "the", "value", "of", "this", "matrix", "to", "the", "given", "scaling", "without", "rotation", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d2/Transform2D.java#L639-L651
alkacon/opencms-core
src/org/opencms/db/CmsSecurityManager.java
CmsSecurityManager.getProjectId
public CmsUUID getProjectId(CmsRequestContext context, int id) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsUUID result = null; try { result = m_driverManager.getProjectId(dbc, id); } catch (CmsException e) { dbc.report(null, e.getMessageContainer(), e); } finally { dbc.clear(); } return result; }
java
public CmsUUID getProjectId(CmsRequestContext context, int id) throws CmsException { CmsDbContext dbc = m_dbContextFactory.getDbContext(context); CmsUUID result = null; try { result = m_driverManager.getProjectId(dbc, id); } catch (CmsException e) { dbc.report(null, e.getMessageContainer(), e); } finally { dbc.clear(); } return result; }
[ "public", "CmsUUID", "getProjectId", "(", "CmsRequestContext", "context", ",", "int", "id", ")", "throws", "CmsException", "{", "CmsDbContext", "dbc", "=", "m_dbContextFactory", ".", "getDbContext", "(", "context", ")", ";", "CmsUUID", "result", "=", "null", ";"...
Returns the uuid id for the given id, remove this method as soon as possible.<p> @param context the current cms context @param id the old project id @return the new uuid for the given id @throws CmsException if something goes wrong
[ "Returns", "the", "uuid", "id", "for", "the", "given", "id", "remove", "this", "method", "as", "soon", "as", "possible", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L2548-L2560
lessthanoptimal/ejml
main/ejml-simple/src/org/ejml/equation/Equation.java
Equation.alias
public void alias(DMatrixRMaj variable , String name ) { if( isReserved(name)) throw new RuntimeException("Reserved word or contains a reserved character"); VariableMatrix old = (VariableMatrix)variables.get(name); if( old == null ) { variables.put(name, new VariableMatrix(variable)); }else { old.matrix = variable; } }
java
public void alias(DMatrixRMaj variable , String name ) { if( isReserved(name)) throw new RuntimeException("Reserved word or contains a reserved character"); VariableMatrix old = (VariableMatrix)variables.get(name); if( old == null ) { variables.put(name, new VariableMatrix(variable)); }else { old.matrix = variable; } }
[ "public", "void", "alias", "(", "DMatrixRMaj", "variable", ",", "String", "name", ")", "{", "if", "(", "isReserved", "(", "name", ")", ")", "throw", "new", "RuntimeException", "(", "\"Reserved word or contains a reserved character\"", ")", ";", "VariableMatrix", "...
Adds a new Matrix variable. If one already has the same name it is written over. While more verbose for multiple variables, this function doesn't require new memory be declared each time it's called. @param variable Matrix which is to be assigned to name @param name The name of the variable
[ "Adds", "a", "new", "Matrix", "variable", ".", "If", "one", "already", "has", "the", "same", "name", "it", "is", "written", "over", "." ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-simple/src/org/ejml/equation/Equation.java#L288-L297
sdl/environment-api
src/main/java/com/fredhopper/lifecycle/AbstractLifeCycle.java
AbstractLifeCycle.changeState
protected void changeState(State from, State to) throws Exception { if (!this.state.compareAndSet(from, to)) { throw new Exception("Cannot change state from " + from + " to " + to + " for " + this); } publishState(from, to); }
java
protected void changeState(State from, State to) throws Exception { if (!this.state.compareAndSet(from, to)) { throw new Exception("Cannot change state from " + from + " to " + to + " for " + this); } publishState(from, to); }
[ "protected", "void", "changeState", "(", "State", "from", ",", "State", "to", ")", "throws", "Exception", "{", "if", "(", "!", "this", ".", "state", ".", "compareAndSet", "(", "from", ",", "to", ")", ")", "{", "throw", "new", "Exception", "(", "\"Canno...
First changes the state from a current value to a target value. Second, publishes the change of state to all the listeners through {@link #getStateListeners()}. @param from the current state @param to the new state @throws Exception if the state cannot be changed or some {@link StateListener}failed to apply the same change.
[ "First", "changes", "the", "state", "from", "a", "current", "value", "to", "a", "target", "value", ".", "Second", "publishes", "the", "change", "of", "state", "to", "all", "the", "listeners", "through", "{", "@link", "#getStateListeners", "()", "}", "." ]
train
https://github.com/sdl/environment-api/blob/7ec346022675a21fec301f88ab2856acd1201f7d/src/main/java/com/fredhopper/lifecycle/AbstractLifeCycle.java#L92-L97
grails/grails-core
grails-spring/src/main/groovy/org/grails/spring/GrailsApplicationContext.java
GrailsApplicationContext.registerSingleton
public void registerSingleton(String name, Class<?> clazz, MutablePropertyValues pvs) throws BeansException { GenericBeanDefinition bd = new GenericBeanDefinition(); bd.setBeanClass(clazz); bd.setPropertyValues(pvs); getDefaultListableBeanFactory().registerBeanDefinition(name, bd); }
java
public void registerSingleton(String name, Class<?> clazz, MutablePropertyValues pvs) throws BeansException { GenericBeanDefinition bd = new GenericBeanDefinition(); bd.setBeanClass(clazz); bd.setPropertyValues(pvs); getDefaultListableBeanFactory().registerBeanDefinition(name, bd); }
[ "public", "void", "registerSingleton", "(", "String", "name", ",", "Class", "<", "?", ">", "clazz", ",", "MutablePropertyValues", "pvs", ")", "throws", "BeansException", "{", "GenericBeanDefinition", "bd", "=", "new", "GenericBeanDefinition", "(", ")", ";", "bd"...
Register a singleton bean with the underlying bean factory. <p>For more advanced needs, register with the underlying BeanFactory directly. @see #getDefaultListableBeanFactory
[ "Register", "a", "singleton", "bean", "with", "the", "underlying", "bean", "factory", ".", "<p", ">", "For", "more", "advanced", "needs", "register", "with", "the", "underlying", "BeanFactory", "directly", "." ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-spring/src/main/groovy/org/grails/spring/GrailsApplicationContext.java#L143-L148
SeaCloudsEU/SeaCloudsPlatform
sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/EnforcementJobRest.java
EnforcementJobRest.createEnforcementJob
@POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response createEnforcementJob(@Context HttpHeaders hh, String payload){ logger.debug("StartOf createEnforcementJob - REQUEST Insert /enforcement"); EnforcementJobHelper enforcementJobService = getHelper(); String location; try { location = enforcementJobService.createEnforcementJob( hh, _uriInfo.getAbsolutePath().toString(), payload); } catch (HelperException e) { logger.info("createEnforcementJob exception", e); return buildResponse(e); } logger.debug("EndOf createEnforcementJob"); return buildResponsePOST( HttpStatus.CREATED, printMessage( HttpStatus.CREATED, "The enforcementJob has been stored successfully in the SLA Repository Database"), location); }
java
@POST @Consumes(MediaType.APPLICATION_XML) @Produces(MediaType.APPLICATION_XML) public Response createEnforcementJob(@Context HttpHeaders hh, String payload){ logger.debug("StartOf createEnforcementJob - REQUEST Insert /enforcement"); EnforcementJobHelper enforcementJobService = getHelper(); String location; try { location = enforcementJobService.createEnforcementJob( hh, _uriInfo.getAbsolutePath().toString(), payload); } catch (HelperException e) { logger.info("createEnforcementJob exception", e); return buildResponse(e); } logger.debug("EndOf createEnforcementJob"); return buildResponsePOST( HttpStatus.CREATED, printMessage( HttpStatus.CREATED, "The enforcementJob has been stored successfully in the SLA Repository Database"), location); }
[ "@", "POST", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_XML", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_XML", ")", "public", "Response", "createEnforcementJob", "(", "@", "Context", "HttpHeaders", "hh", ",", "String", "payload", ")", ...
Creates a new enforcement <pre> POST /enforcements Request: POST /agreements HTTP/1.1 Accept: application/xml Response: {@code <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <message code="201" message= "The enforcementJob has been stored successfully in the SLA Repository Database"/> } </pre> Example: <li>curl -H "Content-type: application/xml" -X POST -d @enforcement.xml localhost:8080/sla-service/enforcements</li> @param id of the agreement @return XML information with the different details of the agreement
[ "Creates", "a", "new", "enforcement" ]
train
https://github.com/SeaCloudsEU/SeaCloudsPlatform/blob/b199fe6de2c63b808cb248d3aca947d802375df8/sla/sla-core/sla-service/src/main/java/eu/atos/sla/service/rest/EnforcementJobRest.java#L300-L322
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/util/ClassPathUtil.java
ClassPathUtil.findCodeBaseInClassPath
public static String findCodeBaseInClassPath(@Nonnull String codeBaseName, String classPath) { if (classPath == null) { return null; } StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator); while (tok.hasMoreTokens()) { String t = tok.nextToken(); File f = new File(t); if (f.getName().equals(codeBaseName)) { return t; } } return null; }
java
public static String findCodeBaseInClassPath(@Nonnull String codeBaseName, String classPath) { if (classPath == null) { return null; } StringTokenizer tok = new StringTokenizer(classPath, File.pathSeparator); while (tok.hasMoreTokens()) { String t = tok.nextToken(); File f = new File(t); if (f.getName().equals(codeBaseName)) { return t; } } return null; }
[ "public", "static", "String", "findCodeBaseInClassPath", "(", "@", "Nonnull", "String", "codeBaseName", ",", "String", "classPath", ")", "{", "if", "(", "classPath", "==", "null", ")", "{", "return", "null", ";", "}", "StringTokenizer", "tok", "=", "new", "S...
Try to find a codebase with the given name in the given class path string. @param codeBaseName name of a codebase (e.g., "findbugs.jar") @param classPath a classpath @return full path of named codebase, or null if the codebase couldn't be found
[ "Try", "to", "find", "a", "codebase", "with", "the", "given", "name", "in", "the", "given", "class", "path", "string", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/util/ClassPathUtil.java#L46-L61
ag-gipp/MathMLTools
mathml-gold/src/main/java/com/formulasearchengine/mathmltools/gold/pojo/JsonGouldiBean.java
JsonGouldiBean.deserializeDefinitionsField
@SuppressWarnings("unchecked") // bla bla, we know what we are doing here... @JsonProperty("definitions") private void deserializeDefinitionsField(Map<String, Object> defs) { definitionsBean = new JsonGouldiDefinitionsBean(); LinkedList<JsonGouldiIdentifierDefinienBean> list = new LinkedList<>(); definitionsBean.setIdentifierDefiniens(list); for (String key : defs.keySet()) { JsonGouldiIdentifierDefinienBean bean = new JsonGouldiIdentifierDefinienBean(); ArrayList<JsonGouldiWikidataDefinienBean> arrList = new ArrayList<>(); bean.setName(key); ArrayList<Object> identifierList = (ArrayList<Object>) defs.get(key); for (Object obj : identifierList) { if (obj instanceof String) { JsonGouldiTextDefinienBean textBean = new JsonGouldiTextDefinienBean(); textBean.setDiscription((String) obj); arrList.add(textBean); } else { Map<String, String> qidMappings = (Map<String, String>) obj; for (String qID : qidMappings.keySet()) { JsonGouldiWikidataDefinienBean wikidefbean = new JsonGouldiWikidataDefinienBean(); wikidefbean.setWikiID(qID); wikidefbean.setDiscription(qidMappings.get(qID)); arrList.add(wikidefbean); } } } JsonGouldiWikidataDefinienBean[] arr = new JsonGouldiWikidataDefinienBean[arrList.size()]; arr = arrList.toArray(arr); bean.setDefiniens(arr); list.add(bean); } }
java
@SuppressWarnings("unchecked") // bla bla, we know what we are doing here... @JsonProperty("definitions") private void deserializeDefinitionsField(Map<String, Object> defs) { definitionsBean = new JsonGouldiDefinitionsBean(); LinkedList<JsonGouldiIdentifierDefinienBean> list = new LinkedList<>(); definitionsBean.setIdentifierDefiniens(list); for (String key : defs.keySet()) { JsonGouldiIdentifierDefinienBean bean = new JsonGouldiIdentifierDefinienBean(); ArrayList<JsonGouldiWikidataDefinienBean> arrList = new ArrayList<>(); bean.setName(key); ArrayList<Object> identifierList = (ArrayList<Object>) defs.get(key); for (Object obj : identifierList) { if (obj instanceof String) { JsonGouldiTextDefinienBean textBean = new JsonGouldiTextDefinienBean(); textBean.setDiscription((String) obj); arrList.add(textBean); } else { Map<String, String> qidMappings = (Map<String, String>) obj; for (String qID : qidMappings.keySet()) { JsonGouldiWikidataDefinienBean wikidefbean = new JsonGouldiWikidataDefinienBean(); wikidefbean.setWikiID(qID); wikidefbean.setDiscription(qidMappings.get(qID)); arrList.add(wikidefbean); } } } JsonGouldiWikidataDefinienBean[] arr = new JsonGouldiWikidataDefinienBean[arrList.size()]; arr = arrList.toArray(arr); bean.setDefiniens(arr); list.add(bean); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// bla bla, we know what we are doing here...", "@", "JsonProperty", "(", "\"definitions\"", ")", "private", "void", "deserializeDefinitionsField", "(", "Map", "<", "String", ",", "Object", ">", "defs", ")", "{", "d...
Provide a custom deserialization for definitions @param defs the generic object for definitions field in gouldi
[ "Provide", "a", "custom", "deserialization", "for", "definitions" ]
train
https://github.com/ag-gipp/MathMLTools/blob/77c69b6366a5b8720796d1cd9d155ba26c2f1b20/mathml-gold/src/main/java/com/formulasearchengine/mathmltools/gold/pojo/JsonGouldiBean.java#L79-L113
openbaton/openbaton-client
sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java
RestRequest.requestGet
public Object requestGet(final String id, Class type) throws SDKException { String url = this.pathUrl; if (id != null) { url += "/" + id; return requestGetWithStatus(url, null, type); } else { return requestGetAll(url, type, null); } }
java
public Object requestGet(final String id, Class type) throws SDKException { String url = this.pathUrl; if (id != null) { url += "/" + id; return requestGetWithStatus(url, null, type); } else { return requestGetAll(url, type, null); } }
[ "public", "Object", "requestGet", "(", "final", "String", "id", ",", "Class", "type", ")", "throws", "SDKException", "{", "String", "url", "=", "this", ".", "pathUrl", ";", "if", "(", "id", "!=", "null", ")", "{", "url", "+=", "\"/\"", "+", "id", ";"...
Executes a http get with to a given id @param id the id path used for the api request @param type the class of the requested entity @return a string containing he response content @throws SDKException if the request fails
[ "Executes", "a", "http", "get", "with", "to", "a", "given", "id" ]
train
https://github.com/openbaton/openbaton-client/blob/6ca6dd6b62a23940d312213d6fa489d5b636061a/sdk/src/main/java/org/openbaton/sdk/api/util/RestRequest.java#L715-L723
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/service/nitro_service.java
nitro_service.forcehasync
public base_response forcehasync(Boolean force, String save) throws Exception { hasync resource = new hasync(); resource.set_force(force) ; resource.set_save(save); options option = new options(); option.set_action("force"); base_response result = resource.perform_operation(this,option); return result; }
java
public base_response forcehasync(Boolean force, String save) throws Exception { hasync resource = new hasync(); resource.set_force(force) ; resource.set_save(save); options option = new options(); option.set_action("force"); base_response result = resource.perform_operation(this,option); return result; }
[ "public", "base_response", "forcehasync", "(", "Boolean", "force", ",", "String", "save", ")", "throws", "Exception", "{", "hasync", "resource", "=", "new", "hasync", "(", ")", ";", "resource", ".", "set_force", "(", "force", ")", ";", "resource", ".", "se...
<pre> Use this API to force the sync in secondary Netscaler. @param force set this to true for forcesync @param save set this to YES,if want to save the configuration after sync. @return status of the operation performed. </pre>
[ "<pre", ">", "Use", "this", "API", "to", "force", "the", "sync", "in", "secondary", "Netscaler", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/service/nitro_service.java#L311-L320
rometools/rome
rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedAtomHandler.java
FileBasedAtomHandler.postEntry
@Override public Entry postEntry(final AtomRequest areq, final Entry entry) throws AtomException { LOG.debug("postEntry"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String handle = pathInfo[0]; final String collection = pathInfo[1]; final FileBasedCollection col = service.findCollectionByHandle(handle, collection); try { return col.addEntry(entry); } catch (final Exception fe) { fe.printStackTrace(); throw new AtomException(fe); } }
java
@Override public Entry postEntry(final AtomRequest areq, final Entry entry) throws AtomException { LOG.debug("postEntry"); final String[] pathInfo = StringUtils.split(areq.getPathInfo(), "/"); final String handle = pathInfo[0]; final String collection = pathInfo[1]; final FileBasedCollection col = service.findCollectionByHandle(handle, collection); try { return col.addEntry(entry); } catch (final Exception fe) { fe.printStackTrace(); throw new AtomException(fe); } }
[ "@", "Override", "public", "Entry", "postEntry", "(", "final", "AtomRequest", "areq", ",", "final", "Entry", "entry", ")", "throws", "AtomException", "{", "LOG", ".", "debug", "(", "\"postEntry\"", ")", ";", "final", "String", "[", "]", "pathInfo", "=", "S...
Create a new entry specified by pathInfo and posted entry. We save the submitted Atom entry verbatim, but we do set the id and reset the update time. @param entry Entry to be added to collection. @param areq Details of HTTP request @throws com.rometools.rome.propono.atom.server.AtomException On invalid collection or other error. @return Entry as represented on server.
[ "Create", "a", "new", "entry", "specified", "by", "pathInfo", "and", "posted", "entry", ".", "We", "save", "the", "submitted", "Atom", "entry", "verbatim", "but", "we", "do", "set", "the", "id", "and", "reset", "the", "update", "time", "." ]
train
https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/server/impl/FileBasedAtomHandler.java#L176-L191
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.isText
public static boolean isText(ByteBuf buf, int index, int length, Charset charset) { checkNotNull(buf, "buf"); checkNotNull(charset, "charset"); final int maxIndex = buf.readerIndex() + buf.readableBytes(); if (index < 0 || length < 0 || index > maxIndex - length) { throw new IndexOutOfBoundsException("index: " + index + " length: " + length); } if (charset.equals(CharsetUtil.UTF_8)) { return isUtf8(buf, index, length); } else if (charset.equals(CharsetUtil.US_ASCII)) { return isAscii(buf, index, length); } else { CharsetDecoder decoder = CharsetUtil.decoder(charset, CodingErrorAction.REPORT, CodingErrorAction.REPORT); try { if (buf.nioBufferCount() == 1) { decoder.decode(buf.nioBuffer(index, length)); } else { ByteBuf heapBuffer = buf.alloc().heapBuffer(length); try { heapBuffer.writeBytes(buf, index, length); decoder.decode(heapBuffer.internalNioBuffer(heapBuffer.readerIndex(), length)); } finally { heapBuffer.release(); } } return true; } catch (CharacterCodingException ignore) { return false; } } }
java
public static boolean isText(ByteBuf buf, int index, int length, Charset charset) { checkNotNull(buf, "buf"); checkNotNull(charset, "charset"); final int maxIndex = buf.readerIndex() + buf.readableBytes(); if (index < 0 || length < 0 || index > maxIndex - length) { throw new IndexOutOfBoundsException("index: " + index + " length: " + length); } if (charset.equals(CharsetUtil.UTF_8)) { return isUtf8(buf, index, length); } else if (charset.equals(CharsetUtil.US_ASCII)) { return isAscii(buf, index, length); } else { CharsetDecoder decoder = CharsetUtil.decoder(charset, CodingErrorAction.REPORT, CodingErrorAction.REPORT); try { if (buf.nioBufferCount() == 1) { decoder.decode(buf.nioBuffer(index, length)); } else { ByteBuf heapBuffer = buf.alloc().heapBuffer(length); try { heapBuffer.writeBytes(buf, index, length); decoder.decode(heapBuffer.internalNioBuffer(heapBuffer.readerIndex(), length)); } finally { heapBuffer.release(); } } return true; } catch (CharacterCodingException ignore) { return false; } } }
[ "public", "static", "boolean", "isText", "(", "ByteBuf", "buf", ",", "int", "index", ",", "int", "length", ",", "Charset", "charset", ")", "{", "checkNotNull", "(", "buf", ",", "\"buf\"", ")", ";", "checkNotNull", "(", "charset", ",", "\"charset\"", ")", ...
Returns {@code true} if the specified {@link ByteBuf} starting at {@code index} with {@code length} is valid text using the given {@link Charset}, otherwise return {@code false}. @param buf The given {@link ByteBuf}. @param index The start index of the specified buffer. @param length The length of the specified buffer. @param charset The specified {@link Charset}. @throws IndexOutOfBoundsException if {@code index} + {@code length} is greater than {@code buf.readableBytes}
[ "Returns", "{", "@code", "true", "}", "if", "the", "specified", "{", "@link", "ByteBuf", "}", "starting", "at", "{", "@code", "index", "}", "with", "{", "@code", "length", "}", "is", "valid", "text", "using", "the", "given", "{", "@link", "Charset", "}...
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L1219-L1249
enasequence/sequencetools
src/main/java/uk/ac/ebi/embl/api/entry/sequence/AbstractSequence.java
AbstractSequence.getSequence
public String getSequence(Long beginPosition, Long endPosition) { byte[] sequenceByte = getSequenceByte(beginPosition, endPosition); if (sequenceByte != null) return new String(sequenceByte); return null; }
java
public String getSequence(Long beginPosition, Long endPosition) { byte[] sequenceByte = getSequenceByte(beginPosition, endPosition); if (sequenceByte != null) return new String(sequenceByte); return null; }
[ "public", "String", "getSequence", "(", "Long", "beginPosition", ",", "Long", "endPosition", ")", "{", "byte", "[", "]", "sequenceByte", "=", "getSequenceByte", "(", "beginPosition", ",", "endPosition", ")", ";", "if", "(", "sequenceByte", "!=", "null", ")", ...
Returns a subsequence string or null if the location is not valid. @param beginPosition the sequence begin position. @param endPosition the sequence end position. @return a subsequence string or null if the location is not valid.
[ "Returns", "a", "subsequence", "string", "or", "null", "if", "the", "location", "is", "not", "valid", "." ]
train
https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/entry/sequence/AbstractSequence.java#L36-L42
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.getTimephasedCostMultipleRates
private List<TimephasedCost> getTimephasedCostMultipleRates(List<TimephasedWork> standardWorkList, List<TimephasedWork> overtimeWorkList) { List<TimephasedWork> standardWorkResult = new LinkedList<TimephasedWork>(); List<TimephasedWork> overtimeWorkResult = new LinkedList<TimephasedWork>(); CostRateTable table = getCostRateTable(); ProjectCalendar calendar = getCalendar(); Iterator<TimephasedWork> iter = overtimeWorkList.iterator(); for (TimephasedWork standardWork : standardWorkList) { TimephasedWork overtimeWork = iter.hasNext() ? iter.next() : null; int startIndex = getCostRateTableEntryIndex(standardWork.getStart()); int finishIndex = getCostRateTableEntryIndex(standardWork.getFinish()); if (startIndex == finishIndex) { standardWorkResult.add(standardWork); if (overtimeWork != null) { overtimeWorkResult.add(overtimeWork); } } else { standardWorkResult.addAll(splitWork(table, calendar, standardWork, startIndex)); if (overtimeWork != null) { overtimeWorkResult.addAll(splitWork(table, calendar, overtimeWork, startIndex)); } } } return getTimephasedCostSingleRate(standardWorkResult, overtimeWorkResult); }
java
private List<TimephasedCost> getTimephasedCostMultipleRates(List<TimephasedWork> standardWorkList, List<TimephasedWork> overtimeWorkList) { List<TimephasedWork> standardWorkResult = new LinkedList<TimephasedWork>(); List<TimephasedWork> overtimeWorkResult = new LinkedList<TimephasedWork>(); CostRateTable table = getCostRateTable(); ProjectCalendar calendar = getCalendar(); Iterator<TimephasedWork> iter = overtimeWorkList.iterator(); for (TimephasedWork standardWork : standardWorkList) { TimephasedWork overtimeWork = iter.hasNext() ? iter.next() : null; int startIndex = getCostRateTableEntryIndex(standardWork.getStart()); int finishIndex = getCostRateTableEntryIndex(standardWork.getFinish()); if (startIndex == finishIndex) { standardWorkResult.add(standardWork); if (overtimeWork != null) { overtimeWorkResult.add(overtimeWork); } } else { standardWorkResult.addAll(splitWork(table, calendar, standardWork, startIndex)); if (overtimeWork != null) { overtimeWorkResult.addAll(splitWork(table, calendar, overtimeWork, startIndex)); } } } return getTimephasedCostSingleRate(standardWorkResult, overtimeWorkResult); }
[ "private", "List", "<", "TimephasedCost", ">", "getTimephasedCostMultipleRates", "(", "List", "<", "TimephasedWork", ">", "standardWorkList", ",", "List", "<", "TimephasedWork", ">", "overtimeWorkList", ")", "{", "List", "<", "TimephasedWork", ">", "standardWorkResult...
Generates timephased costs from timephased work where multiple cost rates apply to the assignment. @param standardWorkList timephased work @param overtimeWorkList timephased work @return timephased cost
[ "Generates", "timephased", "costs", "from", "timephased", "work", "where", "multiple", "cost", "rates", "apply", "to", "the", "assignment", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L805-L839
apache/flink
flink-core/src/main/java/org/apache/flink/configuration/Configuration.java
Configuration.setBoolean
@PublicEvolving public void setBoolean(ConfigOption<Boolean> key, boolean value) { setValueInternal(key.key(), value); }
java
@PublicEvolving public void setBoolean(ConfigOption<Boolean> key, boolean value) { setValueInternal(key.key(), value); }
[ "@", "PublicEvolving", "public", "void", "setBoolean", "(", "ConfigOption", "<", "Boolean", ">", "key", ",", "boolean", "value", ")", "{", "setValueInternal", "(", "key", ".", "key", "(", ")", ",", "value", ")", ";", "}" ]
Adds the given value to the configuration object. The main key of the config option will be used to map the value. @param key the option specifying the key to be added @param value the value of the key/value pair to be added
[ "Adds", "the", "given", "value", "to", "the", "configuration", "object", ".", "The", "main", "key", "of", "the", "config", "option", "will", "be", "used", "to", "map", "the", "value", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/configuration/Configuration.java#L412-L415
symphonyoss/messageml-utils
src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownParser.java
MarkdownParser.validateEntities
private void validateEntities(JsonNode data) throws InvalidInputException { for (JsonNode node : data.findParents(INDEX_START)) { for (String key : new String[] {INDEX_START, INDEX_END, ID, TYPE}) { if (node.path(key).isMissingNode()) { throw new InvalidInputException("Required field \"" + key + "\" missing from the entity payload"); } } int startIndex = node.get(INDEX_START).intValue(); int endIndex = node.get(INDEX_END).intValue(); if (endIndex <= startIndex) { throw new InvalidInputException(String.format("Invalid entity payload: %s (start index: %s, end index: %s)", node.get(ID).textValue(), startIndex, endIndex)); } } }
java
private void validateEntities(JsonNode data) throws InvalidInputException { for (JsonNode node : data.findParents(INDEX_START)) { for (String key : new String[] {INDEX_START, INDEX_END, ID, TYPE}) { if (node.path(key).isMissingNode()) { throw new InvalidInputException("Required field \"" + key + "\" missing from the entity payload"); } } int startIndex = node.get(INDEX_START).intValue(); int endIndex = node.get(INDEX_END).intValue(); if (endIndex <= startIndex) { throw new InvalidInputException(String.format("Invalid entity payload: %s (start index: %s, end index: %s)", node.get(ID).textValue(), startIndex, endIndex)); } } }
[ "private", "void", "validateEntities", "(", "JsonNode", "data", ")", "throws", "InvalidInputException", "{", "for", "(", "JsonNode", "node", ":", "data", ".", "findParents", "(", "INDEX_START", ")", ")", "{", "for", "(", "String", "key", ":", "new", "String"...
Verify that JSON entities contain the required fields and that entity indices are correct.
[ "Verify", "that", "JSON", "entities", "contain", "the", "required", "fields", "and", "that", "entity", "indices", "are", "correct", "." ]
train
https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/markdown/MarkdownParser.java#L351-L369
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/data/SparkDataValidation.java
SparkDataValidation.deleteInvalidMultiDataSets
public static ValidationResult deleteInvalidMultiDataSets(JavaSparkContext sc, String path, List<int[]> featuresShape, List<int[]> labelsShape) { return validateMultiDataSets(sc, path, true, true, (featuresShape == null ? -1 : featuresShape.size()), (labelsShape == null ? -1 : labelsShape.size()), featuresShape, labelsShape); }
java
public static ValidationResult deleteInvalidMultiDataSets(JavaSparkContext sc, String path, List<int[]> featuresShape, List<int[]> labelsShape) { return validateMultiDataSets(sc, path, true, true, (featuresShape == null ? -1 : featuresShape.size()), (labelsShape == null ? -1 : labelsShape.size()), featuresShape, labelsShape); }
[ "public", "static", "ValidationResult", "deleteInvalidMultiDataSets", "(", "JavaSparkContext", "sc", ",", "String", "path", ",", "List", "<", "int", "[", "]", ">", "featuresShape", ",", "List", "<", "int", "[", "]", ">", "labelsShape", ")", "{", "return", "v...
Validate MultiDataSet objects - <b>and delete any invalid MultiDataSets</b> - that have been previously saved to the specified directory on HDFS by attempting to load them and checking their contents. Assumes MultiDataSets were saved using {@link org.nd4j.linalg.dataset.MultiDataSet#save(OutputStream)}.<br> This method (optionally) additionally validates the arrays using the specified shapes for the features and labels, Note: this method will also consider all files in subdirectories (i.e., is recursive). @param sc Spark context @param path HDFS path of the directory containing the saved DataSet objects @param featuresShape May be null. If non-null: feature arrays must match the specified shapes, for all values with shape > 0. For example, if featuresShape = {{-1,10}} then there must be 1 features array, features array 0 must be rank 2, can have any size for the first dimension, but must have size 10 for the second dimension. @param labelsShape As per featuresShape, but for the labels instead @return Results of the validation
[ "Validate", "MultiDataSet", "objects", "-", "<b", ">", "and", "delete", "any", "invalid", "MultiDataSets<", "/", "b", ">", "-", "that", "have", "been", "previously", "saved", "to", "the", "specified", "directory", "on", "HDFS", "by", "attempting", "to", "loa...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-scaleout/spark/dl4j-spark/src/main/java/org/deeplearning4j/spark/util/data/SparkDataValidation.java#L207-L211
morimekta/providence
providence-reflect/src/main/java/net/morimekta/providence/reflect/util/RecursiveTypeRegistry.java
RecursiveTypeRegistry.registerInclude
public void registerInclude(String programName, RecursiveTypeRegistry registry) { if (registry == this) { throw new IllegalArgumentException("Registering include back to itself: " + programName); } if (includes.containsKey(programName)) { return; } includes.put(programName, registry); }
java
public void registerInclude(String programName, RecursiveTypeRegistry registry) { if (registry == this) { throw new IllegalArgumentException("Registering include back to itself: " + programName); } if (includes.containsKey(programName)) { return; } includes.put(programName, registry); }
[ "public", "void", "registerInclude", "(", "String", "programName", ",", "RecursiveTypeRegistry", "registry", ")", "{", "if", "(", "registry", "==", "this", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Registering include back to itself: \"", "+", "pro...
Register a recursive included registry. @param programName The program to be included. @param registry The registry for the given program.
[ "Register", "a", "recursive", "included", "registry", "." ]
train
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-reflect/src/main/java/net/morimekta/providence/reflect/util/RecursiveTypeRegistry.java#L67-L75
Azure/azure-sdk-for-java
servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java
ClientFactory.createMessageReceiverFromEntityPath
public static IMessageReceiver createMessageReceiverFromEntityPath(MessagingFactory messagingFactory, String entityPath, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException { return Utils.completeFuture(createMessageReceiverFromEntityPathAsync(messagingFactory, entityPath, receiveMode)); }
java
public static IMessageReceiver createMessageReceiverFromEntityPath(MessagingFactory messagingFactory, String entityPath, ReceiveMode receiveMode) throws InterruptedException, ServiceBusException { return Utils.completeFuture(createMessageReceiverFromEntityPathAsync(messagingFactory, entityPath, receiveMode)); }
[ "public", "static", "IMessageReceiver", "createMessageReceiverFromEntityPath", "(", "MessagingFactory", "messagingFactory", ",", "String", "entityPath", ",", "ReceiveMode", "receiveMode", ")", "throws", "InterruptedException", ",", "ServiceBusException", "{", "return", "Utils...
Creates a message receiver to the entity. @param messagingFactory messaging factory (which represents a connection) on which receiver needs to be created @param entityPath path of the entity @param receiveMode PeekLock or ReceiveAndDelete @return IMessageReceiver instance @throws InterruptedException if the current thread was interrupted while waiting @throws ServiceBusException if the receiver cannot be created
[ "Creates", "a", "message", "receiver", "to", "the", "entity", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/servicebus/data-plane/azure-servicebus/src/main/java/com/microsoft/azure/servicebus/ClientFactory.java#L347-L349
code4everything/util
src/main/java/com/zhazhapan/util/Formatter.java
Formatter.stringToCustomDateTime
public static Date stringToCustomDateTime(SimpleDateFormat sdf, String datetime) throws ParseException { return sdf.parse(datetime.trim()); }
java
public static Date stringToCustomDateTime(SimpleDateFormat sdf, String datetime) throws ParseException { return sdf.parse(datetime.trim()); }
[ "public", "static", "Date", "stringToCustomDateTime", "(", "SimpleDateFormat", "sdf", ",", "String", "datetime", ")", "throws", "ParseException", "{", "return", "sdf", ".", "parse", "(", "datetime", ".", "trim", "(", ")", ")", ";", "}" ]
将字符串转换成自定义格式的日期 @param datetime 日期格式的字符串 @param sdf 自定义的格式 @return 自定义格式的日期 @throws ParseException 异常
[ "将字符串转换成自定义格式的日期" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/Formatter.java#L552-L554
adamfisk/littleshoot-commons-id
src/main/java/org/apache/commons/id/uuid/UUID.java
UUID.nameUUIDFromString
public static UUID nameUUIDFromString(String name, UUID namespace, String encoding) { byte[] nameAsBytes = name.getBytes(); byte[] concat = new byte[UUID_BYTE_LENGTH + nameAsBytes.length]; System.arraycopy(namespace.getRawBytes(), 0, concat, 0, UUID_BYTE_LENGTH); System.arraycopy(nameAsBytes, 0, concat, UUID_BYTE_LENGTH, nameAsBytes.length); byte[] raw = null; if(encoding.equals(UUID.MD5_ENCODING)) { raw = DigestUtils.md5(concat); } else if(encoding.equals(UUID.SHA1_ENCODING)) { byte[] shaDigest = DigestUtils.sha(concat); // Truncate digest to 16 bytes (SHA-1 returns a 20-byte digest) raw = new byte[16]; System.arraycopy(shaDigest, 0, raw, 0, 16); } else { throw new RuntimeException("Unsupported encoding " + encoding); } //Set version (version 3 and version 5 are identical on a bit-level, //thus we only need ever set one of them raw[TIME_HI_AND_VERSION_BYTE_6] &= 0x0F; raw[TIME_HI_AND_VERSION_BYTE_6] |= (UUID.VERSION_THREE << 4); //Set variant raw[CLOCK_SEQ_HI_AND_RESERVED_BYTE_8] &= 0x3F; //0011 1111 raw[CLOCK_SEQ_HI_AND_RESERVED_BYTE_8] |= 0x80; //1000 0000 return new UUID(raw); }
java
public static UUID nameUUIDFromString(String name, UUID namespace, String encoding) { byte[] nameAsBytes = name.getBytes(); byte[] concat = new byte[UUID_BYTE_LENGTH + nameAsBytes.length]; System.arraycopy(namespace.getRawBytes(), 0, concat, 0, UUID_BYTE_LENGTH); System.arraycopy(nameAsBytes, 0, concat, UUID_BYTE_LENGTH, nameAsBytes.length); byte[] raw = null; if(encoding.equals(UUID.MD5_ENCODING)) { raw = DigestUtils.md5(concat); } else if(encoding.equals(UUID.SHA1_ENCODING)) { byte[] shaDigest = DigestUtils.sha(concat); // Truncate digest to 16 bytes (SHA-1 returns a 20-byte digest) raw = new byte[16]; System.arraycopy(shaDigest, 0, raw, 0, 16); } else { throw new RuntimeException("Unsupported encoding " + encoding); } //Set version (version 3 and version 5 are identical on a bit-level, //thus we only need ever set one of them raw[TIME_HI_AND_VERSION_BYTE_6] &= 0x0F; raw[TIME_HI_AND_VERSION_BYTE_6] |= (UUID.VERSION_THREE << 4); //Set variant raw[CLOCK_SEQ_HI_AND_RESERVED_BYTE_8] &= 0x3F; //0011 1111 raw[CLOCK_SEQ_HI_AND_RESERVED_BYTE_8] |= 0x80; //1000 0000 return new UUID(raw); }
[ "public", "static", "UUID", "nameUUIDFromString", "(", "String", "name", ",", "UUID", "namespace", ",", "String", "encoding", ")", "{", "byte", "[", "]", "nameAsBytes", "=", "name", ".", "getBytes", "(", ")", ";", "byte", "[", "]", "concat", "=", "new", ...
<p>Returns a new version three (MD5) or five (SHA-1) UUID, using the specified encoding given a name and the namespace's UUID.</p> @param name String the name to calculate the UUID for. @param namespace UUID assigned to this namespace. @param encoding The encoding to use, either #{link UUID.MD5_ENCODING} or #{link UUID.SHA1_ENCODING} @return a new version three UUID given a name and the namespace's UUID.
[ "<p", ">", "Returns", "a", "new", "version", "three", "(", "MD5", ")", "or", "five", "(", "SHA", "-", "1", ")", "UUID", "using", "the", "specified", "encoding", "given", "a", "name", "and", "the", "namespace", "s", "UUID", ".", "<", "/", "p", ">" ]
train
https://github.com/adamfisk/littleshoot-commons-id/blob/49a8f5f2b10831c509876ca463bf1a87e1e49ae9/src/main/java/org/apache/commons/id/uuid/UUID.java#L429-L461
js-lib-com/commons
src/main/java/js/util/Params.java
Params.isNumeric
public static void isNumeric(String parameter, String name) { if (!Strings.isNumeric(parameter)) { throw new IllegalArgumentException(String.format("%s |%s| is not numeric.", name, parameter)); } }
java
public static void isNumeric(String parameter, String name) { if (!Strings.isNumeric(parameter)) { throw new IllegalArgumentException(String.format("%s |%s| is not numeric.", name, parameter)); } }
[ "public", "static", "void", "isNumeric", "(", "String", "parameter", ",", "String", "name", ")", "{", "if", "(", "!", "Strings", ".", "isNumeric", "(", "parameter", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "String", ".", "format", "(...
Check if string parameter is numeric. This validator throws illegal argument if parameter value is not numeric. See {@link Strings#isNumeric(String)} for <code>numeric</code> definition. @param parameter invocation parameter value, @param name parameter name. @throws IllegalArgumentException if <code>parameter</code> is not numeric.
[ "Check", "if", "string", "parameter", "is", "numeric", ".", "This", "validator", "throws", "illegal", "argument", "if", "parameter", "value", "is", "not", "numeric", ".", "See", "{", "@link", "Strings#isNumeric", "(", "String", ")", "}", "for", "<code", ">",...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Params.java#L162-L166
elki-project/elki
elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/PoissonDistribution.java
PoissonDistribution.logpoissonPDFm1
public static double logpoissonPDFm1(double x_plus_1, double lambda) { if(Double.isInfinite(lambda)) { return Double.NEGATIVE_INFINITY; } if(x_plus_1 > 1) { return rawLogProbability(x_plus_1 - 1, lambda); } if(lambda > Math.abs(x_plus_1 - 1) * MathUtil.LOG2 * Double.MAX_EXPONENT / 1e-14) { return -lambda - GammaDistribution.logGamma(x_plus_1); } else { return rawLogProbability(x_plus_1, lambda) + FastMath.log(x_plus_1 / lambda); } }
java
public static double logpoissonPDFm1(double x_plus_1, double lambda) { if(Double.isInfinite(lambda)) { return Double.NEGATIVE_INFINITY; } if(x_plus_1 > 1) { return rawLogProbability(x_plus_1 - 1, lambda); } if(lambda > Math.abs(x_plus_1 - 1) * MathUtil.LOG2 * Double.MAX_EXPONENT / 1e-14) { return -lambda - GammaDistribution.logGamma(x_plus_1); } else { return rawLogProbability(x_plus_1, lambda) + FastMath.log(x_plus_1 / lambda); } }
[ "public", "static", "double", "logpoissonPDFm1", "(", "double", "x_plus_1", ",", "double", "lambda", ")", "{", "if", "(", "Double", ".", "isInfinite", "(", "lambda", ")", ")", "{", "return", "Double", ".", "NEGATIVE_INFINITY", ";", "}", "if", "(", "x_plus_...
Compute the poisson distribution PDF with an offset of + 1 <p> log pdf(x_plus_1 - 1, lambda) @param x_plus_1 x+1 @param lambda Lambda @return pdf
[ "Compute", "the", "poisson", "distribution", "PDF", "with", "an", "offset", "of", "+", "1", "<p", ">", "log", "pdf", "(", "x_plus_1", "-", "1", "lambda", ")" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/distribution/PoissonDistribution.java#L312-L325
mikepenz/FastAdapter
library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java
ModelAdapter.getModels
public List<Model> getModels() { ArrayList<Model> list = new ArrayList<>(mItems.size()); for (Item item : mItems.getItems()) { if (mReverseInterceptor != null) { list.add(mReverseInterceptor.intercept(item)); } else if (item instanceof IModelItem) { list.add((Model) ((IModelItem) item).getModel()); } else { throw new RuntimeException("to get the list of models, the item either needs to implement `IModelItem` or you have to provide a `reverseInterceptor`"); } } return list; }
java
public List<Model> getModels() { ArrayList<Model> list = new ArrayList<>(mItems.size()); for (Item item : mItems.getItems()) { if (mReverseInterceptor != null) { list.add(mReverseInterceptor.intercept(item)); } else if (item instanceof IModelItem) { list.add((Model) ((IModelItem) item).getModel()); } else { throw new RuntimeException("to get the list of models, the item either needs to implement `IModelItem` or you have to provide a `reverseInterceptor`"); } } return list; }
[ "public", "List", "<", "Model", ">", "getModels", "(", ")", "{", "ArrayList", "<", "Model", ">", "list", "=", "new", "ArrayList", "<>", "(", "mItems", ".", "size", "(", ")", ")", ";", "for", "(", "Item", "item", ":", "mItems", ".", "getItems", "(",...
the ModelAdapter does not keep a list of input model's to get retrieve them a `reverseInterceptor` is required usually it is used to get the `Model` from a `IModelItem` @return a List of initial Model's
[ "the", "ModelAdapter", "does", "not", "keep", "a", "list", "of", "input", "model", "s", "to", "get", "retrieve", "them", "a", "reverseInterceptor", "is", "required", "usually", "it", "is", "used", "to", "get", "the", "Model", "from", "a", "IModelItem" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library-core/src/main/java/com/mikepenz/fastadapter/adapters/ModelAdapter.java#L198-L210
google/error-prone-javac
src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java
AbstractTypeVisitor6.visitUnknown
@Override public R visitUnknown(TypeMirror t, P p) { throw new UnknownTypeException(t, p); }
java
@Override public R visitUnknown(TypeMirror t, P p) { throw new UnknownTypeException(t, p); }
[ "@", "Override", "public", "R", "visitUnknown", "(", "TypeMirror", "t", ",", "P", "p", ")", "{", "throw", "new", "UnknownTypeException", "(", "t", ",", "p", ")", ";", "}" ]
{@inheritDoc} @implSpec The default implementation of this method in {@code AbstractTypeVisitor6} will always throw {@code new UnknownTypeException(t, p)}. This behavior is not required of a subclass. @param t {@inheritDoc} @param p {@inheritDoc} @return a visitor-specified result @throws UnknownTypeException a visitor implementation may optionally throw this exception
[ "{", "@inheritDoc", "}" ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/AbstractTypeVisitor6.java#L154-L157
HanSolo/SteelSeries-Swing
src/main/java/eu/hansolo/steelseries/gauges/SparkLine.java
SparkLine.cosInterpolate
private double cosInterpolate(final double Y1, final double Y2, final double MU) { final double MU2; MU2 = (1 - Math.cos(MU * Math.PI)) / 2; return (Y1 * (1 - MU2) + Y2 * MU2); }
java
private double cosInterpolate(final double Y1, final double Y2, final double MU) { final double MU2; MU2 = (1 - Math.cos(MU * Math.PI)) / 2; return (Y1 * (1 - MU2) + Y2 * MU2); }
[ "private", "double", "cosInterpolate", "(", "final", "double", "Y1", ",", "final", "double", "Y2", ",", "final", "double", "MU", ")", "{", "final", "double", "MU2", ";", "MU2", "=", "(", "1", "-", "Math", ".", "cos", "(", "MU", "*", "Math", ".", "P...
Returns the value smoothed by a cosinus interpolation function @param Y1 @param Y2 @param MU @return the value smoothed by a cosinus interpolation function
[ "Returns", "the", "value", "smoothed", "by", "a", "cosinus", "interpolation", "function" ]
train
https://github.com/HanSolo/SteelSeries-Swing/blob/c2f7b45a477757ef21bbb6a1174ddedb2250ae57/src/main/java/eu/hansolo/steelseries/gauges/SparkLine.java#L1108-L1113
liyiorg/weixin-popular
src/main/java/weixin/popular/api/SemanticAPI.java
SemanticAPI.addvoicetorecofortext
public static BaseResult addvoicetorecofortext(String accessToken, String voiceId, File voice) { return addvoicetorecofortext(accessToken, voiceId, null, voice); }
java
public static BaseResult addvoicetorecofortext(String accessToken, String voiceId, File voice) { return addvoicetorecofortext(accessToken, voiceId, null, voice); }
[ "public", "static", "BaseResult", "addvoicetorecofortext", "(", "String", "accessToken", ",", "String", "voiceId", ",", "File", "voice", ")", "{", "return", "addvoicetorecofortext", "(", "accessToken", ",", "voiceId", ",", "null", ",", "voice", ")", ";", "}" ]
提交语音 @param accessToken 接口调用凭证 @param voiceId 语音唯一标识 @param voice 文件格式 只支持mp3,16k,单声道,最大1M @return BaseResult @since 2.8.22
[ "提交语音" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/SemanticAPI.java#L84-L86
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java
SARLJvmModelInferrer.copyTypeParametersFromJvmOperation
protected void copyTypeParametersFromJvmOperation(JvmOperation fromOperation, JvmOperation toOperation) { Utils.copyTypeParametersFromJvmOperation(fromOperation, toOperation, this._typeReferenceBuilder, this.typeBuilder, this.typeReferences, this.typesFactory); }
java
protected void copyTypeParametersFromJvmOperation(JvmOperation fromOperation, JvmOperation toOperation) { Utils.copyTypeParametersFromJvmOperation(fromOperation, toOperation, this._typeReferenceBuilder, this.typeBuilder, this.typeReferences, this.typesFactory); }
[ "protected", "void", "copyTypeParametersFromJvmOperation", "(", "JvmOperation", "fromOperation", ",", "JvmOperation", "toOperation", ")", "{", "Utils", ".", "copyTypeParametersFromJvmOperation", "(", "fromOperation", ",", "toOperation", ",", "this", ".", "_typeReferenceBuil...
Copy the type parameters from a JvmOperation. <p>This function differs from {@link #copyAndFixTypeParameters(List, org.eclipse.xtext.common.types.JvmTypeParameterDeclarator)} and {@link #copyTypeParameters(List, org.eclipse.xtext.common.types.JvmTypeParameterDeclarator)} in the fact that the type parameters were already generated and fixed. The current function supper generic types by clone the types references with {@link #cloneWithTypeParametersAndProxies(JvmTypeReference, JvmExecutable)}. @param fromOperation the operation from which the type parameters are copied. @param toOperation the operation that will receives the new type parameters. @see Utils#copyTypeParametersFromJvmOperation(JvmOperation, JvmOperation, org.eclipse.xtext.xbase.jvmmodel.JvmTypeReferenceBuilder, JvmTypesBuilder, TypeReferences, TypesFactory)
[ "Copy", "the", "type", "parameters", "from", "a", "JvmOperation", "." ]
train
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/jvmmodel/SARLJvmModelInferrer.java#L3435-L3438
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java
ContextItems.setItem
public void setItem(String itemName, Object value) { if (value == null) { setItem(itemName, (String) null); } else { @SuppressWarnings("unchecked") ISerializer<Object> contextSerializer = (ISerializer<Object>) ContextSerializerRegistry.getInstance() .get(value.getClass()); if (contextSerializer == null) { throw new ContextException("No serializer found for type " + value.getClass().getName()); } setItem(itemName, contextSerializer.serialize(value)); } }
java
public void setItem(String itemName, Object value) { if (value == null) { setItem(itemName, (String) null); } else { @SuppressWarnings("unchecked") ISerializer<Object> contextSerializer = (ISerializer<Object>) ContextSerializerRegistry.getInstance() .get(value.getClass()); if (contextSerializer == null) { throw new ContextException("No serializer found for type " + value.getClass().getName()); } setItem(itemName, contextSerializer.serialize(value)); } }
[ "public", "void", "setItem", "(", "String", "itemName", ",", "Object", "value", ")", "{", "if", "(", "value", "==", "null", ")", "{", "setItem", "(", "itemName", ",", "(", "String", ")", "null", ")", ";", "}", "else", "{", "@", "SuppressWarnings", "(...
Sets a context item value. @param itemName Item name. @param value The value to set. The value's class must have an associated context serializer registered for it.
[ "Sets", "a", "context", "item", "value", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/context/ContextItems.java#L250-L264
michael-rapp/AndroidUtil
library/src/main/java/de/mrapp/android/util/BitmapUtil.java
BitmapUtil.clipSquare
@SuppressWarnings("SuspiciousNameCombination") public static Bitmap clipSquare(@NonNull final Bitmap bitmap, final int size) { Condition.INSTANCE.ensureNotNull(bitmap, "The bitmap may not be null"); Condition.INSTANCE.ensureAtLeast(size, 1, "The size must be at least 1"); Bitmap clippedBitmap = bitmap; int width = bitmap.getWidth(); int height = bitmap.getHeight(); if (width > height) { clippedBitmap = Bitmap.createBitmap(bitmap, width / 2 - height / 2, 0, height, height); } else if (bitmap.getWidth() < bitmap.getHeight()) { clippedBitmap = Bitmap.createBitmap(bitmap, 0, bitmap.getHeight() / 2 - width / 2, width, width); } if (clippedBitmap.getWidth() != size) { clippedBitmap = resize(clippedBitmap, size, size); } return clippedBitmap; }
java
@SuppressWarnings("SuspiciousNameCombination") public static Bitmap clipSquare(@NonNull final Bitmap bitmap, final int size) { Condition.INSTANCE.ensureNotNull(bitmap, "The bitmap may not be null"); Condition.INSTANCE.ensureAtLeast(size, 1, "The size must be at least 1"); Bitmap clippedBitmap = bitmap; int width = bitmap.getWidth(); int height = bitmap.getHeight(); if (width > height) { clippedBitmap = Bitmap.createBitmap(bitmap, width / 2 - height / 2, 0, height, height); } else if (bitmap.getWidth() < bitmap.getHeight()) { clippedBitmap = Bitmap.createBitmap(bitmap, 0, bitmap.getHeight() / 2 - width / 2, width, width); } if (clippedBitmap.getWidth() != size) { clippedBitmap = resize(clippedBitmap, size, size); } return clippedBitmap; }
[ "@", "SuppressWarnings", "(", "\"SuspiciousNameCombination\"", ")", "public", "static", "Bitmap", "clipSquare", "(", "@", "NonNull", "final", "Bitmap", "bitmap", ",", "final", "int", "size", ")", "{", "Condition", ".", "INSTANCE", ".", "ensureNotNull", "(", "bit...
Clips the long edge of a bitmap, if its width and height are not equal, in order to form it into a square. Additionally, the bitmap is resized to a specific size. @param bitmap The bitmap, which should be clipped, as an instance of the class {@link Bitmap}. The bitmap may not be null @param size The size, the bitmap should be resized to, as an {@link Integer} value in pixels. The size must be at least 1 @return The clipped bitmap as an instance of the class {@link Bitmap}
[ "Clips", "the", "long", "edge", "of", "a", "bitmap", "if", "its", "width", "and", "height", "are", "not", "equal", "in", "order", "to", "form", "it", "into", "a", "square", ".", "Additionally", "the", "bitmap", "is", "resized", "to", "a", "specific", "...
train
https://github.com/michael-rapp/AndroidUtil/blob/67ec0e5732344eeb4d946dd1f96d782939e449f4/library/src/main/java/de/mrapp/android/util/BitmapUtil.java#L248-L269
TGIO/RNCryptorNative
jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptorOutputStream.java
AES256JNCryptorOutputStream.createStreams
private void createStreams(SecretKey encryptionKey, SecretKey hmacKey, byte[] iv, OutputStream out) throws CryptorException { this.iv = iv; try { Cipher cipher = Cipher.getInstance(AES256JNCryptor.AES_CIPHER_ALGORITHM); cipher.init(Cipher.ENCRYPT_MODE, encryptionKey, new IvParameterSpec(iv)); try { Mac mac = Mac.getInstance(AES256JNCryptor.HMAC_ALGORITHM); mac.init(hmacKey); macOutputStream = new MacOutputStream(out, mac); cipherStream = new CipherOutputStream(macOutputStream, cipher); } catch (GeneralSecurityException e) { throw new CryptorException("Failed to initialize HMac", e); } } catch (GeneralSecurityException e) { throw new CryptorException("Failed to initialize AES cipher", e); } }
java
private void createStreams(SecretKey encryptionKey, SecretKey hmacKey, byte[] iv, OutputStream out) throws CryptorException { this.iv = iv; try { Cipher cipher = Cipher.getInstance(AES256JNCryptor.AES_CIPHER_ALGORITHM); cipher.init(Cipher.ENCRYPT_MODE, encryptionKey, new IvParameterSpec(iv)); try { Mac mac = Mac.getInstance(AES256JNCryptor.HMAC_ALGORITHM); mac.init(hmacKey); macOutputStream = new MacOutputStream(out, mac); cipherStream = new CipherOutputStream(macOutputStream, cipher); } catch (GeneralSecurityException e) { throw new CryptorException("Failed to initialize HMac", e); } } catch (GeneralSecurityException e) { throw new CryptorException("Failed to initialize AES cipher", e); } }
[ "private", "void", "createStreams", "(", "SecretKey", "encryptionKey", ",", "SecretKey", "hmacKey", ",", "byte", "[", "]", "iv", ",", "OutputStream", "out", ")", "throws", "CryptorException", "{", "this", ".", "iv", "=", "iv", ";", "try", "{", "Cipher", "c...
Creates the cipher and MAC streams required, @param encryptionKey the encryption key @param hmacKey the HMAC key @param iv the IV @param out the output stream we are wrapping @throws CryptorException
[ "Creates", "the", "cipher", "and", "MAC", "streams", "required" ]
train
https://github.com/TGIO/RNCryptorNative/blob/5209f10b988e4033c0b769a40b0d6cc99ea16af7/jncryptor/src/main/java/org/cryptonode/jncryptor/AES256JNCryptorOutputStream.java#L128-L151
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java
ObjectCacheTwoLevelImpl.doInternalCache
public void doInternalCache(Identity oid, Object obj, int type) { processQueue(); // pass new materialized objects immediately to application cache if(type == TYPE_NEW_MATERIALIZED) { boolean result = putToApplicationCache(oid, obj, true); CacheEntry entry = new CacheEntry(oid, obj, TYPE_CACHED_READ, queue); if(result) { // as current session says this object is new, put it // in session cache putToSessionCache(oid, entry, false); } else { // object is not new, but if not in session cache // put it in putToSessionCache(oid, entry, true); if(log.isDebugEnabled()) { log.debug("The 'new' materialized object was already in cache," + " will not push it to application cache: " + oid); } } } else { // other types of cached objects will only be put to the session // cache. CacheEntry entry = new CacheEntry(oid, obj, type, queue); putToSessionCache(oid, entry, false); } }
java
public void doInternalCache(Identity oid, Object obj, int type) { processQueue(); // pass new materialized objects immediately to application cache if(type == TYPE_NEW_MATERIALIZED) { boolean result = putToApplicationCache(oid, obj, true); CacheEntry entry = new CacheEntry(oid, obj, TYPE_CACHED_READ, queue); if(result) { // as current session says this object is new, put it // in session cache putToSessionCache(oid, entry, false); } else { // object is not new, but if not in session cache // put it in putToSessionCache(oid, entry, true); if(log.isDebugEnabled()) { log.debug("The 'new' materialized object was already in cache," + " will not push it to application cache: " + oid); } } } else { // other types of cached objects will only be put to the session // cache. CacheEntry entry = new CacheEntry(oid, obj, type, queue); putToSessionCache(oid, entry, false); } }
[ "public", "void", "doInternalCache", "(", "Identity", "oid", ",", "Object", "obj", ",", "int", "type", ")", "{", "processQueue", "(", ")", ";", "// pass new materialized objects immediately to application cache\r", "if", "(", "type", "==", "TYPE_NEW_MATERIALIZED", ")"...
Cache the given object. Creates a {@link org.apache.ojb.broker.cache.ObjectCacheTwoLevelImpl.CacheEntry} and put it to session cache. If the specified object to cache is of type {@link #TYPE_NEW_MATERIALIZED} it will be immediately pushed to the application cache.
[ "Cache", "the", "given", "object", ".", "Creates", "a", "{" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/cache/ObjectCacheTwoLevelImpl.java#L322-L355
jetty-project/jetty-npn
npn-boot/src/main/java/sun/security/ssl/ServerHandshaker.java
ServerHandshaker.setupEphemeralECDHKeys
private boolean setupEphemeralECDHKeys() { int index = -1; if (supportedCurves != null) { // if the client sent the supported curves extension, pick the // first one that we support; for (int curveId : supportedCurves.curveIds()) { if (SupportedEllipticCurvesExtension.isSupported(curveId)) { index = curveId; break; } } if (index < 0) { // no match found, cannot use this ciphersuite return false; } } else { // pick our preference index = SupportedEllipticCurvesExtension.DEFAULT.curveIds()[0]; } String oid = SupportedEllipticCurvesExtension.getCurveOid(index); ecdh = new ECDHCrypt(oid, sslContext.getSecureRandom()); return true; }
java
private boolean setupEphemeralECDHKeys() { int index = -1; if (supportedCurves != null) { // if the client sent the supported curves extension, pick the // first one that we support; for (int curveId : supportedCurves.curveIds()) { if (SupportedEllipticCurvesExtension.isSupported(curveId)) { index = curveId; break; } } if (index < 0) { // no match found, cannot use this ciphersuite return false; } } else { // pick our preference index = SupportedEllipticCurvesExtension.DEFAULT.curveIds()[0]; } String oid = SupportedEllipticCurvesExtension.getCurveOid(index); ecdh = new ECDHCrypt(oid, sslContext.getSecureRandom()); return true; }
[ "private", "boolean", "setupEphemeralECDHKeys", "(", ")", "{", "int", "index", "=", "-", "1", ";", "if", "(", "supportedCurves", "!=", "null", ")", "{", "// if the client sent the supported curves extension, pick the", "// first one that we support;", "for", "(", "int",...
the client requested, return false. Otherwise (all is well), return true.
[ "the", "client", "requested", "return", "false", ".", "Otherwise", "(", "all", "is", "well", ")", "return", "true", "." ]
train
https://github.com/jetty-project/jetty-npn/blob/a26a7a5eabeeb57a63c6ee08fcf9b8cec1fa6c0d/npn-boot/src/main/java/sun/security/ssl/ServerHandshaker.java#L1249-L1271
ModeShape/modeshape
sequencers/modeshape-sequencer-ddl/src/main/java/org/modeshape/sequencer/ddl/StandardDdlParser.java
StandardDdlParser.mergeNodes
public void mergeNodes( DdlTokenStream tokens, AstNode firstNode, AstNode secondNode ) { assert tokens != null; assert firstNode != null; assert secondNode != null; int firstStartIndex = (Integer)firstNode.getProperty(DDL_START_CHAR_INDEX); int secondStartIndex = (Integer)secondNode.getProperty(DDL_START_CHAR_INDEX); int deltaLength = ((String)secondNode.getProperty(DDL_EXPRESSION)).length(); Position startPosition = new Position(firstStartIndex, 1, 0); Position endPosition = new Position((secondStartIndex + deltaLength), 1, 0); String source = tokens.getContentBetween(startPosition, endPosition); firstNode.setProperty(DDL_EXPRESSION, source); firstNode.setProperty(DDL_LENGTH, source.length()); }
java
public void mergeNodes( DdlTokenStream tokens, AstNode firstNode, AstNode secondNode ) { assert tokens != null; assert firstNode != null; assert secondNode != null; int firstStartIndex = (Integer)firstNode.getProperty(DDL_START_CHAR_INDEX); int secondStartIndex = (Integer)secondNode.getProperty(DDL_START_CHAR_INDEX); int deltaLength = ((String)secondNode.getProperty(DDL_EXPRESSION)).length(); Position startPosition = new Position(firstStartIndex, 1, 0); Position endPosition = new Position((secondStartIndex + deltaLength), 1, 0); String source = tokens.getContentBetween(startPosition, endPosition); firstNode.setProperty(DDL_EXPRESSION, source); firstNode.setProperty(DDL_LENGTH, source.length()); }
[ "public", "void", "mergeNodes", "(", "DdlTokenStream", "tokens", ",", "AstNode", "firstNode", ",", "AstNode", "secondNode", ")", "{", "assert", "tokens", "!=", "null", ";", "assert", "firstNode", "!=", "null", ";", "assert", "secondNode", "!=", "null", ";", ...
Merges second node into first node by re-setting expression source and length. @param tokens the {@link DdlTokenStream} representing the tokenized DDL content; may not be null @param firstNode the node to merge into; may not be null @param secondNode the node to merge into first node; may not be null
[ "Merges", "second", "node", "into", "first", "node", "by", "re", "-", "setting", "expression", "source", "and", "length", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/sequencers/modeshape-sequencer-ddl/src/main/java/org/modeshape/sequencer/ddl/StandardDdlParser.java#L500-L515
Red5/red5-server-common
src/main/java/org/red5/server/messaging/PipeConnectionEvent.java
PipeConnectionEvent.setParamMap
public void setParamMap(Map<String, Object> paramMap) { if (paramMap != null && !paramMap.isEmpty()) { this.paramMap.putAll(paramMap); } }
java
public void setParamMap(Map<String, Object> paramMap) { if (paramMap != null && !paramMap.isEmpty()) { this.paramMap.putAll(paramMap); } }
[ "public", "void", "setParamMap", "(", "Map", "<", "String", ",", "Object", ">", "paramMap", ")", "{", "if", "(", "paramMap", "!=", "null", "&&", "!", "paramMap", ".", "isEmpty", "(", ")", ")", "{", "this", ".", "paramMap", ".", "putAll", "(", "paramM...
Setter for event parameters map @param paramMap Event parameters as Map
[ "Setter", "for", "event", "parameters", "map" ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/messaging/PipeConnectionEvent.java#L155-L159
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/SerializationUtils.java
SerializationUtils.deserializeAndCheckObject
public static <T extends Serializable> T deserializeAndCheckObject(final byte[] object, final Class<T> type) { val result = deserialize(object, type); if (!type.isAssignableFrom(result.getClass())) { throw new ClassCastException("Decoded object is of type " + result.getClass() + " when we were expecting " + type); } return (T) result; }
java
public static <T extends Serializable> T deserializeAndCheckObject(final byte[] object, final Class<T> type) { val result = deserialize(object, type); if (!type.isAssignableFrom(result.getClass())) { throw new ClassCastException("Decoded object is of type " + result.getClass() + " when we were expecting " + type); } return (T) result; }
[ "public", "static", "<", "T", "extends", "Serializable", ">", "T", "deserializeAndCheckObject", "(", "final", "byte", "[", "]", "object", ",", "final", "Class", "<", "T", ">", "type", ")", "{", "val", "result", "=", "deserialize", "(", "object", ",", "ty...
Decode and serialize object. @param <T> the type parameter @param object the object @param type the type @return the t @since 4.2
[ "Decode", "and", "serialize", "object", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/serialization/SerializationUtils.java#L166-L172
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.addLatLngToMap
public static Marker addLatLngToMap(GoogleMap map, LatLng latLng) { return addLatLngToMap(map, latLng, new MarkerOptions()); }
java
public static Marker addLatLngToMap(GoogleMap map, LatLng latLng) { return addLatLngToMap(map, latLng, new MarkerOptions()); }
[ "public", "static", "Marker", "addLatLngToMap", "(", "GoogleMap", "map", ",", "LatLng", "latLng", ")", "{", "return", "addLatLngToMap", "(", "map", ",", "latLng", ",", "new", "MarkerOptions", "(", ")", ")", ";", "}" ]
Add a LatLng to the map @param map google map @param latLng lat lng @return marker
[ "Add", "a", "LatLng", "to", "the", "map" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L1533-L1535
ZuInnoTe/hadoopoffice
fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/HadoopUtil.java
HadoopUtil.getDataOutputStream
public static DataOutputStream getDataOutputStream(Configuration conf,Path file, Progressable progress, boolean compressed, Class<? extends CompressionCodec> compressorClass) throws IOException { if (!compressed) { // uncompressed FileSystem fs = file.getFileSystem(conf); return fs.create(file, progress); } else { // compressed (note partially adapted from TextOutputFormat) Class<? extends CompressionCodec> codecClass = compressorClass; // create the named codec CompressionCodec codec = ReflectionUtils.newInstance(codecClass, conf); // provide proper file extension Path compressedFile = file.suffix(codec.getDefaultExtension()); // build the filename including the extension FileSystem fs = compressedFile.getFileSystem(conf); return new DataOutputStream(codec.createOutputStream(fs.create(compressedFile, progress))); } }
java
public static DataOutputStream getDataOutputStream(Configuration conf,Path file, Progressable progress, boolean compressed, Class<? extends CompressionCodec> compressorClass) throws IOException { if (!compressed) { // uncompressed FileSystem fs = file.getFileSystem(conf); return fs.create(file, progress); } else { // compressed (note partially adapted from TextOutputFormat) Class<? extends CompressionCodec> codecClass = compressorClass; // create the named codec CompressionCodec codec = ReflectionUtils.newInstance(codecClass, conf); // provide proper file extension Path compressedFile = file.suffix(codec.getDefaultExtension()); // build the filename including the extension FileSystem fs = compressedFile.getFileSystem(conf); return new DataOutputStream(codec.createOutputStream(fs.create(compressedFile, progress))); } }
[ "public", "static", "DataOutputStream", "getDataOutputStream", "(", "Configuration", "conf", ",", "Path", "file", ",", "Progressable", "progress", ",", "boolean", "compressed", ",", "Class", "<", "?", "extends", "CompressionCodec", ">", "compressorClass", ")", "thro...
/* Creates for the file to be written and outputstream and takes - depending on the configuration - take of compression. Set for compression the following options: mapreduce.output.fileoutputformat.compress true/false mapreduce.output.fileoutputformat.compress.codec java class of compression codec Note that some formats may use already internal compression so that additional compression does not lead to many benefits @param conf Configuration of Job @param file file to be written @return outputstream of the file
[ "/", "*", "Creates", "for", "the", "file", "to", "be", "written", "and", "outputstream", "and", "takes", "-", "depending", "on", "the", "configuration", "-", "take", "of", "compression", ".", "Set", "for", "compression", "the", "following", "options", ":", ...
train
https://github.com/ZuInnoTe/hadoopoffice/blob/58fc9223ee290bcb14847aaaff3fadf39c465e46/fileformat/src/main/java/org/zuinnote/hadoop/office/format/common/HadoopUtil.java#L77-L91
braintree/browser-switch-android
browser-switch/src/main/java/com/braintreepayments/browserswitch/ChromeCustomTabs.java
ChromeCustomTabs.isAvailable
public static boolean isAvailable(Context context) { if (SDK_INT < JELLY_BEAN_MR2) { return false; } Intent serviceIntent = new Intent("android.support.customtabs.action.CustomTabsService") .setPackage("com.android.chrome"); ServiceConnection connection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) {} @Override public void onServiceDisconnected(ComponentName name) {} }; boolean available = context.bindService(serviceIntent, connection, Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY); context.unbindService(connection); return available; }
java
public static boolean isAvailable(Context context) { if (SDK_INT < JELLY_BEAN_MR2) { return false; } Intent serviceIntent = new Intent("android.support.customtabs.action.CustomTabsService") .setPackage("com.android.chrome"); ServiceConnection connection = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) {} @Override public void onServiceDisconnected(ComponentName name) {} }; boolean available = context.bindService(serviceIntent, connection, Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY); context.unbindService(connection); return available; }
[ "public", "static", "boolean", "isAvailable", "(", "Context", "context", ")", "{", "if", "(", "SDK_INT", "<", "JELLY_BEAN_MR2", ")", "{", "return", "false", ";", "}", "Intent", "serviceIntent", "=", "new", "Intent", "(", "\"android.support.customtabs.action.Custom...
Checks to see if this device supports Chrome Custom Tabs and if Chrome Custom Tabs are available. @param context @return {@code true} if Chrome Custom Tabs are supported and available.
[ "Checks", "to", "see", "if", "this", "device", "supports", "Chrome", "Custom", "Tabs", "and", "if", "Chrome", "Custom", "Tabs", "are", "available", "." ]
train
https://github.com/braintree/browser-switch-android/blob/d830de21bc732b51e658e7296aad7b9037842a19/browser-switch/src/main/java/com/braintreepayments/browserswitch/ChromeCustomTabs.java#L24-L44
b3dgs/lionengine
lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFile.java
UtilFile.deleteFile
public static void deleteFile(File file) { Check.notNull(file); try { Files.delete(file.toPath()); } catch (final IOException exception) { throw new LionEngineException(exception, ERROR_DELETE_FILE + file.getAbsolutePath()); } }
java
public static void deleteFile(File file) { Check.notNull(file); try { Files.delete(file.toPath()); } catch (final IOException exception) { throw new LionEngineException(exception, ERROR_DELETE_FILE + file.getAbsolutePath()); } }
[ "public", "static", "void", "deleteFile", "(", "File", "file", ")", "{", "Check", ".", "notNull", "(", "file", ")", ";", "try", "{", "Files", ".", "delete", "(", "file", ".", "toPath", "(", ")", ")", ";", "}", "catch", "(", "final", "IOException", ...
Delete a file. @param file The file to delete (must not be <code>null</code>). @throws LionEngineException If invalid argument or unable to remove file.
[ "Delete", "a", "file", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core/src/main/java/com/b3dgs/lionengine/UtilFile.java#L189-L201
Wikidata/Wikidata-Toolkit
wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/EntityDocumentBuilder.java
EntityDocumentBuilder.withAlias
public T withAlias(String text, String languageCode) { withAlias(factory.getMonolingualTextValue(text, languageCode)); return getThis(); }
java
public T withAlias(String text, String languageCode) { withAlias(factory.getMonolingualTextValue(text, languageCode)); return getThis(); }
[ "public", "T", "withAlias", "(", "String", "text", ",", "String", "languageCode", ")", "{", "withAlias", "(", "factory", ".", "getMonolingualTextValue", "(", "text", ",", "languageCode", ")", ")", ";", "return", "getThis", "(", ")", ";", "}" ]
Adds an additional alias to the constructed document. @param text the text of the alias @param languageCode the language code of the alias @return builder object to continue construction
[ "Adds", "an", "additional", "alias", "to", "the", "constructed", "document", "." ]
train
https://github.com/Wikidata/Wikidata-Toolkit/blob/7732851dda47e1febff406fba27bfec023f4786e/wdtk-datamodel/src/main/java/org/wikidata/wdtk/datamodel/helpers/EntityDocumentBuilder.java#L175-L178