repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
201
func_name
stringlengths
4
126
whole_func_string
stringlengths
75
3.57k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.57k
func_code_tokens
listlengths
21
599
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/string/StringHelper.java
StringHelper.getOccurrenceCount
@Nonnegative public static int getOccurrenceCount (@Nullable final String sText, @Nullable final String sSearch) { int ret = 0; final int nTextLength = getLength (sText); final int nSearchLength = getLength (sSearch); if (nSearchLength > 0 && nTextLength >= nSearchLength) { int nLastIndex = 0; int nIndex; do { // Start searching from the last result nIndex = getIndexOf (sText, nLastIndex, sSearch); if (nIndex != STRING_NOT_FOUND) { // Match found ++ret; // Identify the next starting position (relative index + number of // search strings) nLastIndex = nIndex + nSearchLength; } } while (nIndex != STRING_NOT_FOUND); } return ret; }
java
@Nonnegative public static int getOccurrenceCount (@Nullable final String sText, @Nullable final String sSearch) { int ret = 0; final int nTextLength = getLength (sText); final int nSearchLength = getLength (sSearch); if (nSearchLength > 0 && nTextLength >= nSearchLength) { int nLastIndex = 0; int nIndex; do { // Start searching from the last result nIndex = getIndexOf (sText, nLastIndex, sSearch); if (nIndex != STRING_NOT_FOUND) { // Match found ++ret; // Identify the next starting position (relative index + number of // search strings) nLastIndex = nIndex + nSearchLength; } } while (nIndex != STRING_NOT_FOUND); } return ret; }
[ "@", "Nonnegative", "public", "static", "int", "getOccurrenceCount", "(", "@", "Nullable", "final", "String", "sText", ",", "@", "Nullable", "final", "String", "sSearch", ")", "{", "int", "ret", "=", "0", ";", "final", "int", "nTextLength", "=", "getLength",...
Count the number of occurrences of sSearch within sText. @param sText The text to search in. May be <code>null</code>. @param sSearch The text to search for. May be <code>null</code>. @return A non-negative number of occurrences.
[ "Count", "the", "number", "of", "occurrences", "of", "sSearch", "within", "sText", "." ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/string/StringHelper.java#L3136-L3162
michaelwittig/java-q
src/main/java/info/michaelwittig/javaq/connector/impl/QConnectorFactory.java
QConnectorFactory.create
public static QConnectorSync create(final String host, final int port) { return create(host, port, true, true); }
java
public static QConnectorSync create(final String host, final int port) { return create(host, port, true, true); }
[ "public", "static", "QConnectorSync", "create", "(", "final", "String", "host", ",", "final", "int", "port", ")", "{", "return", "create", "(", "host", ",", "port", ",", "true", ",", "true", ")", ";", "}" ]
Reconnect on error and is thread-safe. @param host Host @param port Port @return QConnector
[ "Reconnect", "on", "error", "and", "is", "thread", "-", "safe", "." ]
train
https://github.com/michaelwittig/java-q/blob/f71fc95b185caa85c6fbdc7179cb4f5f7733b630/src/main/java/info/michaelwittig/javaq/connector/impl/QConnectorFactory.java#L89-L91
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/diagrams/panels/ScatterChartPanel.java
ScatterChartPanel.setTickSpacing
public void setTickSpacing(ValueDimension dim, double minorTickSpacing, boolean repaint) { setTickSpacing(dim, minorTickSpacing, getTickInfo(dim).getTickMultiplicator(), repaint); }
java
public void setTickSpacing(ValueDimension dim, double minorTickSpacing, boolean repaint) { setTickSpacing(dim, minorTickSpacing, getTickInfo(dim).getTickMultiplicator(), repaint); }
[ "public", "void", "setTickSpacing", "(", "ValueDimension", "dim", ",", "double", "minorTickSpacing", ",", "boolean", "repaint", ")", "{", "setTickSpacing", "(", "dim", ",", "minorTickSpacing", ",", "getTickInfo", "(", "dim", ")", ".", "getTickMultiplicator", "(", ...
Sets the tick spacing for the coordinate axis of the given dimension.<br> <value>minorTickSpacing</value> sets the minor tick spacing, major tick spacing is a multiple of minor tick spacing and determined with the help of a multiplicator. @param dim Reference dimension for calculation @param minorTickSpacing Minor tick spacing @see TickInfo#getTickMultiplicator()
[ "Sets", "the", "tick", "spacing", "for", "the", "coordinate", "axis", "of", "the", "given", "dimension", ".", "<br", ">", "<value", ">", "minorTickSpacing<", "/", "value", ">", "sets", "the", "minor", "tick", "spacing", "major", "tick", "spacing", "is", "a...
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/diagrams/panels/ScatterChartPanel.java#L211-L213
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java
Word07Writer.addText
public Word07Writer addText(Font font, String... texts) { return addText(null, font, texts); }
java
public Word07Writer addText(Font font, String... texts) { return addText(null, font, texts); }
[ "public", "Word07Writer", "addText", "(", "Font", "font", ",", "String", "...", "texts", ")", "{", "return", "addText", "(", "null", ",", "font", ",", "texts", ")", ";", "}" ]
增加一个段落 @param font 字体信息{@link Font} @param texts 段落中的文本,支持多个文本作为一个段落 @return this
[ "增加一个段落" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/word/Word07Writer.java#L97-L99
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java
WordVectorSerializer.loadTxtVectors
@Deprecated public static WordVectors loadTxtVectors(@NonNull InputStream stream, boolean skipFirstLine) throws IOException { AbstractCache<VocabWord> cache = new AbstractCache.Builder<VocabWord>().build(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); String line = ""; List<INDArray> arrays = new ArrayList<>(); if (skipFirstLine) reader.readLine(); while ((line = reader.readLine()) != null) { String[] split = line.split(" "); String word = split[0].replaceAll(WHITESPACE_REPLACEMENT, " "); VocabWord word1 = new VocabWord(1.0, word); word1.setIndex(cache.numWords()); cache.addToken(word1); cache.addWordToIndex(word1.getIndex(), word); cache.putVocabWord(word); float[] vector = new float[split.length - 1]; for (int i = 1; i < split.length; i++) { vector[i - 1] = Float.parseFloat(split[i]); } INDArray row = Nd4j.create(vector); arrays.add(row); } InMemoryLookupTable<VocabWord> lookupTable = (InMemoryLookupTable<VocabWord>) new InMemoryLookupTable.Builder<VocabWord>() .vectorLength(arrays.get(0).columns()).cache(cache).build(); INDArray syn = Nd4j.vstack(arrays); Nd4j.clearNans(syn); lookupTable.setSyn0(syn); return fromPair(Pair.makePair((InMemoryLookupTable) lookupTable, (VocabCache) cache)); }
java
@Deprecated public static WordVectors loadTxtVectors(@NonNull InputStream stream, boolean skipFirstLine) throws IOException { AbstractCache<VocabWord> cache = new AbstractCache.Builder<VocabWord>().build(); BufferedReader reader = new BufferedReader(new InputStreamReader(stream)); String line = ""; List<INDArray> arrays = new ArrayList<>(); if (skipFirstLine) reader.readLine(); while ((line = reader.readLine()) != null) { String[] split = line.split(" "); String word = split[0].replaceAll(WHITESPACE_REPLACEMENT, " "); VocabWord word1 = new VocabWord(1.0, word); word1.setIndex(cache.numWords()); cache.addToken(word1); cache.addWordToIndex(word1.getIndex(), word); cache.putVocabWord(word); float[] vector = new float[split.length - 1]; for (int i = 1; i < split.length; i++) { vector[i - 1] = Float.parseFloat(split[i]); } INDArray row = Nd4j.create(vector); arrays.add(row); } InMemoryLookupTable<VocabWord> lookupTable = (InMemoryLookupTable<VocabWord>) new InMemoryLookupTable.Builder<VocabWord>() .vectorLength(arrays.get(0).columns()).cache(cache).build(); INDArray syn = Nd4j.vstack(arrays); Nd4j.clearNans(syn); lookupTable.setSyn0(syn); return fromPair(Pair.makePair((InMemoryLookupTable) lookupTable, (VocabCache) cache)); }
[ "@", "Deprecated", "public", "static", "WordVectors", "loadTxtVectors", "(", "@", "NonNull", "InputStream", "stream", ",", "boolean", "skipFirstLine", ")", "throws", "IOException", "{", "AbstractCache", "<", "VocabWord", ">", "cache", "=", "new", "AbstractCache", ...
This method can be used to load previously saved model from InputStream (like a HDFS-stream) <p> Deprecation note: Please, consider using readWord2VecModel() or loadStaticModel() method instead @param stream InputStream that contains previously serialized model @param skipFirstLine Set this TRUE if first line contains csv header, FALSE otherwise @return @throws IOException @deprecated Use readWord2VecModel() or loadStaticModel() method instead
[ "This", "method", "can", "be", "used", "to", "load", "previously", "saved", "model", "from", "InputStream", "(", "like", "a", "HDFS", "-", "stream", ")", "<p", ">", "Deprecation", "note", ":", "Please", "consider", "using", "readWord2VecModel", "()", "or", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L1764-L1809
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java
SegmentAttributeBTreeIndex.executeConditionallyOnce
private CompletableFuture<Long> executeConditionallyOnce(Function<Duration, CompletableFuture<Long>> indexOperation, TimeoutTimer timer) { return Futures.exceptionallyCompose( indexOperation.apply(timer.getRemaining()), ex -> { if (Exceptions.unwrap(ex) instanceof BadOffsetException) { BadOffsetException boe = (BadOffsetException) Exceptions.unwrap(ex); if (boe.getExpectedOffset() != this.index.getIndexLength()) { log.warn("{}: Conditional Index Update failed (expected {}, given {}). Reinitializing index.", this.traceObjectId, boe.getExpectedOffset(), boe.getGivenOffset()); return this.index.initialize(timer.getRemaining()) .thenCompose(v -> Futures.failedFuture(ex)); } } // Make sure the exception bubbles up. return Futures.failedFuture(ex); }); }
java
private CompletableFuture<Long> executeConditionallyOnce(Function<Duration, CompletableFuture<Long>> indexOperation, TimeoutTimer timer) { return Futures.exceptionallyCompose( indexOperation.apply(timer.getRemaining()), ex -> { if (Exceptions.unwrap(ex) instanceof BadOffsetException) { BadOffsetException boe = (BadOffsetException) Exceptions.unwrap(ex); if (boe.getExpectedOffset() != this.index.getIndexLength()) { log.warn("{}: Conditional Index Update failed (expected {}, given {}). Reinitializing index.", this.traceObjectId, boe.getExpectedOffset(), boe.getGivenOffset()); return this.index.initialize(timer.getRemaining()) .thenCompose(v -> Futures.failedFuture(ex)); } } // Make sure the exception bubbles up. return Futures.failedFuture(ex); }); }
[ "private", "CompletableFuture", "<", "Long", ">", "executeConditionallyOnce", "(", "Function", "<", "Duration", ",", "CompletableFuture", "<", "Long", ">", ">", "indexOperation", ",", "TimeoutTimer", "timer", ")", "{", "return", "Futures", ".", "exceptionallyCompose...
Executes the given Index Operation once, without performing retries. In case of failure with BadOffsetException (which indicates a conditional update failure), the BTreeIndex is reinitialized to the most up-to-date state. @param indexOperation A Function, that, when invoked, returns a CompletableFuture which indicates when the index operation completes. @param timer Timer for the operation. @return A CompletableFuture that will indicate when the operation completes.
[ "Executes", "the", "given", "Index", "Operation", "once", "without", "performing", "retries", ".", "In", "case", "of", "failure", "with", "BadOffsetException", "(", "which", "indicates", "a", "conditional", "update", "failure", ")", "the", "BTreeIndex", "is", "r...
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/attributes/SegmentAttributeBTreeIndex.java#L389-L406
bbossgroups/bboss-elasticsearch
bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java
ConfigRestClientUtil.executeHttp
public String executeHttp(String path, String templateName,Object bean, String action) throws ElasticSearchException{ return super.executeHttp( path, ESTemplateHelper.evalTemplate(esUtil,templateName, bean), action); }
java
public String executeHttp(String path, String templateName,Object bean, String action) throws ElasticSearchException{ return super.executeHttp( path, ESTemplateHelper.evalTemplate(esUtil,templateName, bean), action); }
[ "public", "String", "executeHttp", "(", "String", "path", ",", "String", "templateName", ",", "Object", "bean", ",", "String", "action", ")", "throws", "ElasticSearchException", "{", "return", "super", ".", "executeHttp", "(", "path", ",", "ESTemplateHelper", "....
发送es restful请求,返回String类型json报文 @param path @param templateName 请求报文dsl名称,在配置文件中指定 @param action get,post,put,delete @return @throws ElasticSearchException
[ "发送es", "restful请求,返回String类型json报文" ]
train
https://github.com/bbossgroups/bboss-elasticsearch/blob/31717c8aa2c4c880987be53aeeb8a0cf5183c3a7/bboss-elasticsearch-rest/src/main/java/org/frameworkset/elasticsearch/client/ConfigRestClientUtil.java#L396-L398
m-m-m/util
exception/src/main/java/net/sf/mmm/util/exception/api/ValueOutOfRangeException.java
ValueOutOfRangeException.verifyComparable
@SuppressWarnings({ "rawtypes", "unchecked" }) private <V extends Comparable> void verifyComparable(V value, V minimum, V maximum) { if (minimum != null) { if (maximum != null) { assert ((value.compareTo(minimum) < 0) || (value.compareTo(maximum) > 0)); } else { assert (value.compareTo(minimum) < 0); } } else if (maximum != null) { assert (value.compareTo(maximum) > 0); } else { throw new NlsNullPointerException("minimum & maximum"); } }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) private <V extends Comparable> void verifyComparable(V value, V minimum, V maximum) { if (minimum != null) { if (maximum != null) { assert ((value.compareTo(minimum) < 0) || (value.compareTo(maximum) > 0)); } else { assert (value.compareTo(minimum) < 0); } } else if (maximum != null) { assert (value.compareTo(maximum) > 0); } else { throw new NlsNullPointerException("minimum & maximum"); } }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "private", "<", "V", "extends", "Comparable", ">", "void", "verifyComparable", "(", "V", "value", ",", "V", "minimum", ",", "V", "maximum", ")", "{", "if", "(", "minimum", ...
Verifies that the {@code value} is actually out of range. @param <V> is the generic type of the values. @param value is the number that is out of range. @param minimum is the minimum value allowed @param maximum is the maximum value allowed.
[ "Verifies", "that", "the", "{", "@code", "value", "}", "is", "actually", "out", "of", "range", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/exception/src/main/java/net/sf/mmm/util/exception/api/ValueOutOfRangeException.java#L82-L96
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java
ESFilterBuilder.getAndFilterBuilder
private AndQueryBuilder getAndFilterBuilder(Expression logicalExp, EntityMetadata m) { AndExpression andExp = (AndExpression) logicalExp; Expression leftExpression = andExp.getLeftExpression(); Expression rightExpression = andExp.getRightExpression(); return new AndQueryBuilder(populateFilterBuilder(leftExpression, m), populateFilterBuilder(rightExpression, m)); }
java
private AndQueryBuilder getAndFilterBuilder(Expression logicalExp, EntityMetadata m) { AndExpression andExp = (AndExpression) logicalExp; Expression leftExpression = andExp.getLeftExpression(); Expression rightExpression = andExp.getRightExpression(); return new AndQueryBuilder(populateFilterBuilder(leftExpression, m), populateFilterBuilder(rightExpression, m)); }
[ "private", "AndQueryBuilder", "getAndFilterBuilder", "(", "Expression", "logicalExp", ",", "EntityMetadata", "m", ")", "{", "AndExpression", "andExp", "=", "(", "AndExpression", ")", "logicalExp", ";", "Expression", "leftExpression", "=", "andExp", ".", "getLeftExpres...
Gets the and filter builder. @param logicalExp the logical exp @param m the m @param entity the entity @return the and filter builder
[ "Gets", "the", "and", "filter", "builder", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java#L358-L365
icode/ameba
src/main/java/ameba/db/ebean/support/ModelResourceStructure.java
ModelResourceStructure.fetchHistoryAsOf
public Response fetchHistoryAsOf(@PathParam("id") URI_ID id, @PathParam("asof") final Timestamp asOf) throws Exception { final MODEL_ID mId = tryConvertId(id); matchedFetchHistoryAsOf(mId, asOf); final Query<MODEL> query = server.find(modelType); defaultFindOrderBy(query); Object entity = executeTx(t -> { configDefaultQuery(query); configFetchHistoryAsOfQuery(query, mId, asOf); applyUriQuery(query, false); MODEL model = query.asOf(asOf).setId(mId).findOne(); return processFetchedHistoryAsOfModel(mId, model, asOf); }); if (isEmptyEntity(entity)) { return Response.noContent().build(); } return Response.ok(entity).build(); }
java
public Response fetchHistoryAsOf(@PathParam("id") URI_ID id, @PathParam("asof") final Timestamp asOf) throws Exception { final MODEL_ID mId = tryConvertId(id); matchedFetchHistoryAsOf(mId, asOf); final Query<MODEL> query = server.find(modelType); defaultFindOrderBy(query); Object entity = executeTx(t -> { configDefaultQuery(query); configFetchHistoryAsOfQuery(query, mId, asOf); applyUriQuery(query, false); MODEL model = query.asOf(asOf).setId(mId).findOne(); return processFetchedHistoryAsOfModel(mId, model, asOf); }); if (isEmptyEntity(entity)) { return Response.noContent().build(); } return Response.ok(entity).build(); }
[ "public", "Response", "fetchHistoryAsOf", "(", "@", "PathParam", "(", "\"id\"", ")", "URI_ID", "id", ",", "@", "PathParam", "(", "\"asof\"", ")", "final", "Timestamp", "asOf", ")", "throws", "Exception", "{", "final", "MODEL_ID", "mId", "=", "tryConvertId", ...
find history as of timestamp @param id model id @param asOf Timestamp @return history model @throws java.lang.Exception any error
[ "find", "history", "as", "of", "timestamp" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L904-L924
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java
JobsImpl.listFromJobScheduleNext
public PagedList<CloudJob> listFromJobScheduleNext(final String nextPageLink) { ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders> response = listFromJobScheduleNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<CloudJob>(response.body()) { @Override public Page<CloudJob> nextPage(String nextPageLink) { return listFromJobScheduleNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); } }; }
java
public PagedList<CloudJob> listFromJobScheduleNext(final String nextPageLink) { ServiceResponseWithHeaders<Page<CloudJob>, JobListFromJobScheduleHeaders> response = listFromJobScheduleNextSinglePageAsync(nextPageLink).toBlocking().single(); return new PagedList<CloudJob>(response.body()) { @Override public Page<CloudJob> nextPage(String nextPageLink) { return listFromJobScheduleNextSinglePageAsync(nextPageLink, null).toBlocking().single().body(); } }; }
[ "public", "PagedList", "<", "CloudJob", ">", "listFromJobScheduleNext", "(", "final", "String", "nextPageLink", ")", "{", "ServiceResponseWithHeaders", "<", "Page", "<", "CloudJob", ">", ",", "JobListFromJobScheduleHeaders", ">", "response", "=", "listFromJobScheduleNex...
Lists the jobs that have been created under the specified job schedule. @param nextPageLink The NextLink from the previous successful call to List operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws BatchErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the PagedList&lt;CloudJob&gt; object if successful.
[ "Lists", "the", "jobs", "that", "have", "been", "created", "under", "the", "specified", "job", "schedule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/JobsImpl.java#L3559-L3567
knightliao/disconf
disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java
StringUtil.startsWithChar
public static boolean startsWithChar(String str, char ch) { if (StringUtils.isEmpty(str)) { return false; } return str.charAt(0) == ch; }
java
public static boolean startsWithChar(String str, char ch) { if (StringUtils.isEmpty(str)) { return false; } return str.charAt(0) == ch; }
[ "public", "static", "boolean", "startsWithChar", "(", "String", "str", ",", "char", "ch", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "str", ")", ")", "{", "return", "false", ";", "}", "return", "str", ".", "charAt", "(", "0", ")", "==",...
判断字符串<code>str</code>是否以字符<code>ch</code>开头 @param str 要比较的字符串 @param ch 开头字符 @return 如果字符串<code>str</code>是否以字符<code>ch</code> 开头,则返回<code>true</code>
[ "判断字符串<code", ">", "str<", "/", "code", ">", "是否以字符<code", ">", "ch<", "/", "code", ">", "开头" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-client/src/main/java/com/baidu/disconf/client/support/utils/StringUtil.java#L566-L572
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/BeanUtils.java
BeanUtils.getProperty
public static <T> T getProperty(Object bean, String name, Class<T> clazz) throws Exception { Method method = ReflectUtils.getPropertyGetterMethod(bean.getClass(), name); if (method.isAccessible()) { return (T) method.invoke(bean); } else { try { method.setAccessible(true); return (T) method.invoke(bean); } finally { method.setAccessible(false); } } }
java
public static <T> T getProperty(Object bean, String name, Class<T> clazz) throws Exception { Method method = ReflectUtils.getPropertyGetterMethod(bean.getClass(), name); if (method.isAccessible()) { return (T) method.invoke(bean); } else { try { method.setAccessible(true); return (T) method.invoke(bean); } finally { method.setAccessible(false); } } }
[ "public", "static", "<", "T", ">", "T", "getProperty", "(", "Object", "bean", ",", "String", "name", ",", "Class", "<", "T", ">", "clazz", ")", "throws", "Exception", "{", "Method", "method", "=", "ReflectUtils", ".", "getPropertyGetterMethod", "(", "bean"...
得到属性的值 @param bean 对象 @param name 属性名 @param clazz 设置值的类 @param <T> 和返回值对应的类型 @return 属性值 @throws Exception 取值异常
[ "得到属性的值" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/BeanUtils.java#L71-L83
WiQuery/wiquery
wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/position/PositionAlignmentOptions.java
PositionAlignmentOptions.setHorizontalAlignment
public PositionAlignmentOptions setHorizontalAlignment(PositionRelation horizontalAlignment, int offsetLeft) { switch (horizontalAlignment) { case LEFT: case CENTER: case RIGHT: break; default: throw new IllegalArgumentException("Illegal value for the horizontal alignment property"); } this.horizontalAlignment = horizontalAlignment; this.offsetLeft = offsetLeft; return this; }
java
public PositionAlignmentOptions setHorizontalAlignment(PositionRelation horizontalAlignment, int offsetLeft) { switch (horizontalAlignment) { case LEFT: case CENTER: case RIGHT: break; default: throw new IllegalArgumentException("Illegal value for the horizontal alignment property"); } this.horizontalAlignment = horizontalAlignment; this.offsetLeft = offsetLeft; return this; }
[ "public", "PositionAlignmentOptions", "setHorizontalAlignment", "(", "PositionRelation", "horizontalAlignment", ",", "int", "offsetLeft", ")", "{", "switch", "(", "horizontalAlignment", ")", "{", "case", "LEFT", ":", "case", "CENTER", ":", "case", "RIGHT", ":", "bre...
Set the horizontalAlignment property with an offset. One of LEFT, CENTER, RIGHT. @param horizontalAlignment @param offsetLeft @return the instance
[ "Set", "the", "horizontalAlignment", "property", "with", "an", "offset", ".", "One", "of", "LEFT", "CENTER", "RIGHT", "." ]
train
https://github.com/WiQuery/wiquery/blob/1b8d60c7a3c37b90fd68c9cd0ff97178fcbcbb08/wiquery-jquery-ui/src/main/java/org/odlabs/wiquery/ui/position/PositionAlignmentOptions.java#L208-L223
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/AccountsApi.java
AccountsApi.updateSharedAccess
public AccountSharedAccess updateSharedAccess(String accountId, AccountSharedAccess accountSharedAccess) throws ApiException { return updateSharedAccess(accountId, accountSharedAccess, null); }
java
public AccountSharedAccess updateSharedAccess(String accountId, AccountSharedAccess accountSharedAccess) throws ApiException { return updateSharedAccess(accountId, accountSharedAccess, null); }
[ "public", "AccountSharedAccess", "updateSharedAccess", "(", "String", "accountId", ",", "AccountSharedAccess", "accountSharedAccess", ")", "throws", "ApiException", "{", "return", "updateSharedAccess", "(", "accountId", ",", "accountSharedAccess", ",", "null", ")", ";", ...
Reserved: Sets the shared access information for users. Reserved: Sets the shared access information for one or more users. @param accountId The external account number (int) or account ID Guid. (required) @param accountSharedAccess (optional) @return AccountSharedAccess
[ "Reserved", ":", "Sets", "the", "shared", "access", "information", "for", "users", ".", "Reserved", ":", "Sets", "the", "shared", "access", "information", "for", "one", "or", "more", "users", "." ]
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L3043-L3045
netty/netty
handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java
OpenSslX509KeyManagerFactory.newEngineBased
public static OpenSslX509KeyManagerFactory newEngineBased(File certificateChain, String password) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException { return newEngineBased(SslContext.toX509Certificates(certificateChain), password); }
java
public static OpenSslX509KeyManagerFactory newEngineBased(File certificateChain, String password) throws CertificateException, IOException, KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException { return newEngineBased(SslContext.toX509Certificates(certificateChain), password); }
[ "public", "static", "OpenSslX509KeyManagerFactory", "newEngineBased", "(", "File", "certificateChain", ",", "String", "password", ")", "throws", "CertificateException", ",", "IOException", ",", "KeyStoreException", ",", "NoSuchAlgorithmException", ",", "UnrecoverableKeyExcept...
Create a new initialized {@link OpenSslX509KeyManagerFactory} which loads its {@link PrivateKey} directly from an {@code OpenSSL engine} via the <a href="https://www.openssl.org/docs/man1.1.0/crypto/ENGINE_load_private_key.html">ENGINE_load_private_key</a> function.
[ "Create", "a", "new", "initialized", "{" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/OpenSslX509KeyManagerFactory.java#L240-L244
threerings/nenya
core/src/main/java/com/threerings/media/MediaPanel.java
MediaPanel.paintBits
protected void paintBits (Graphics2D gfx, int layer, Rectangle dirty) { _metamgr.paintMedia(gfx, layer, dirty); }
java
protected void paintBits (Graphics2D gfx, int layer, Rectangle dirty) { _metamgr.paintMedia(gfx, layer, dirty); }
[ "protected", "void", "paintBits", "(", "Graphics2D", "gfx", ",", "int", "layer", ",", "Rectangle", "dirty", ")", "{", "_metamgr", ".", "paintMedia", "(", "gfx", ",", "layer", ",", "dirty", ")", ";", "}" ]
Renders the sprites and animations that intersect the supplied dirty region in the specified layer. Derived classes can override this method if they need to do custom sprite or animation rendering (if they need to do special sprite z-order handling, for example). The clipping region will already be set appropriately.
[ "Renders", "the", "sprites", "and", "animations", "that", "intersect", "the", "supplied", "dirty", "region", "in", "the", "specified", "layer", ".", "Derived", "classes", "can", "override", "this", "method", "if", "they", "need", "to", "do", "custom", "sprite"...
train
https://github.com/threerings/nenya/blob/3165a012fd859009db3367f87bd2a5b820cc760a/core/src/main/java/com/threerings/media/MediaPanel.java#L548-L551
networknt/light-rest-4j
openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java
ResponseValidator.validateResponseContent
public Status validateResponseContent(Object responseContent, String uri, String httpMethod, String statusCode) { return validateResponseContent(responseContent, uri, httpMethod, statusCode, JSON_MEDIA_TYPE); }
java
public Status validateResponseContent(Object responseContent, String uri, String httpMethod, String statusCode) { return validateResponseContent(responseContent, uri, httpMethod, statusCode, JSON_MEDIA_TYPE); }
[ "public", "Status", "validateResponseContent", "(", "Object", "responseContent", ",", "String", "uri", ",", "String", "httpMethod", ",", "String", "statusCode", ")", "{", "return", "validateResponseContent", "(", "responseContent", ",", "uri", ",", "httpMethod", ","...
validate a given response content object with media content type "application/json" uri, httpMethod, statusCode, DEFAULT_MEDIA_TYPE is to locate the schema to validate @param responseContent response content needs to be validated @param uri original uri of the request @param httpMethod eg. "put" or "get" @param statusCode eg. 200, 400 @return Status
[ "validate", "a", "given", "response", "content", "object", "with", "media", "content", "type", "application", "/", "json", "uri", "httpMethod", "statusCode", "DEFAULT_MEDIA_TYPE", "is", "to", "locate", "the", "schema", "to", "validate" ]
train
https://github.com/networknt/light-rest-4j/blob/06b15128e6101351e617284a636ef5d632e6b1fe/openapi-validator/src/main/java/com/networknt/openapi/ResponseValidator.java#L80-L82
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/MainScene.java
MainScene.addChildObjectToCamera
public void addChildObjectToCamera(final GVRSceneObject child, int camera) { switch (camera) { case LEFT_CAMERA: mLeftCameraRootObject.addChildObject(child); break; case RIGHT_CAMERA: mRightCameraRootObject.addChildObject(child); break; default: mMainCameraRootObject.addChildObject(child); break; } }
java
public void addChildObjectToCamera(final GVRSceneObject child, int camera) { switch (camera) { case LEFT_CAMERA: mLeftCameraRootObject.addChildObject(child); break; case RIGHT_CAMERA: mRightCameraRootObject.addChildObject(child); break; default: mMainCameraRootObject.addChildObject(child); break; } }
[ "public", "void", "addChildObjectToCamera", "(", "final", "GVRSceneObject", "child", ",", "int", "camera", ")", "{", "switch", "(", "camera", ")", "{", "case", "LEFT_CAMERA", ":", "mLeftCameraRootObject", ".", "addChildObject", "(", "child", ")", ";", "break", ...
Adds a scene object to one or both of the left and right cameras. @param child The {@link GVRSceneObject} to add. @param camera {@link #LEFT_CAMERA} or {@link #RIGHT_CAMERA}; these can be or'd together to add {@code child} to both cameras.
[ "Adds", "a", "scene", "object", "to", "one", "or", "both", "of", "the", "left", "and", "right", "cameras", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/main/MainScene.java#L311-L323
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_mailingList_mailingListAddress_DELETE
public OvhTask organizationName_service_exchangeService_mailingList_mailingListAddress_DELETE(String organizationName, String exchangeService, String mailingListAddress) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}"; StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTask.class); }
java
public OvhTask organizationName_service_exchangeService_mailingList_mailingListAddress_DELETE(String organizationName, String exchangeService, String mailingListAddress) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress}"; StringBuilder sb = path(qPath, organizationName, exchangeService, mailingListAddress); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "organizationName_service_exchangeService_mailingList_mailingListAddress_DELETE", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "mailingListAddress", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/email/...
Delete mailing list REST: DELETE /email/exchange/{organizationName}/service/{exchangeService}/mailingList/{mailingListAddress} @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service @param mailingListAddress [required] The mailing list address
[ "Delete", "mailing", "list" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L1354-L1359
guardtime/ksi-java-sdk
ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java
ContextAwarePolicyAdapter.createUserProvidedPublicationPolicy
public static ContextAwarePolicy createUserProvidedPublicationPolicy(PublicationData publicationData, Extender extender) { Util.notNull(publicationData, "Publication data"); return new ContextAwarePolicyAdapter(new UserProvidedPublicationBasedVerificationPolicy(), new PolicyContext(publicationData, extender != null ? extender.getExtendingService() : null)); }
java
public static ContextAwarePolicy createUserProvidedPublicationPolicy(PublicationData publicationData, Extender extender) { Util.notNull(publicationData, "Publication data"); return new ContextAwarePolicyAdapter(new UserProvidedPublicationBasedVerificationPolicy(), new PolicyContext(publicationData, extender != null ? extender.getExtendingService() : null)); }
[ "public", "static", "ContextAwarePolicy", "createUserProvidedPublicationPolicy", "(", "PublicationData", "publicationData", ",", "Extender", "extender", ")", "{", "Util", ".", "notNull", "(", "publicationData", ",", "\"Publication data\"", ")", ";", "return", "new", "Co...
Creates context aware policy using {@link UserProvidedPublicationBasedVerificationPolicy} for verification. If extender is set, signature is extended within verification process. @param publicationData User provided publication data. @param extender Extender. @return User provided publication based verification policy with suitable context.
[ "Creates", "context", "aware", "policy", "using", "{", "@link", "UserProvidedPublicationBasedVerificationPolicy", "}", "for", "verification", ".", "If", "extender", "is", "set", "signature", "is", "extended", "within", "verification", "process", "." ]
train
https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java#L128-L132
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraTransaction.java
CassandraTransaction.createMutation
private static Mutation createMutation(byte[] colName, byte[] colValue, long timestamp) { if (colValue == null) { colValue = EMPTY_BYTES; } Column col = new Column(); col.setName(colName); col.setValue(colValue); col.setTimestamp(timestamp); ColumnOrSuperColumn cosc = new ColumnOrSuperColumn(); cosc.setColumn(col); Mutation mutation = new Mutation(); mutation.setColumn_or_supercolumn(cosc); return mutation; }
java
private static Mutation createMutation(byte[] colName, byte[] colValue, long timestamp) { if (colValue == null) { colValue = EMPTY_BYTES; } Column col = new Column(); col.setName(colName); col.setValue(colValue); col.setTimestamp(timestamp); ColumnOrSuperColumn cosc = new ColumnOrSuperColumn(); cosc.setColumn(col); Mutation mutation = new Mutation(); mutation.setColumn_or_supercolumn(cosc); return mutation; }
[ "private", "static", "Mutation", "createMutation", "(", "byte", "[", "]", "colName", ",", "byte", "[", "]", "colValue", ",", "long", "timestamp", ")", "{", "if", "(", "colValue", "==", "null", ")", "{", "colValue", "=", "EMPTY_BYTES", ";", "}", "Column",...
Create a Mutation with the given column name and column value
[ "Create", "a", "Mutation", "with", "the", "given", "column", "name", "and", "column", "value" ]
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/db/thrift/CassandraTransaction.java#L119-L134
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/SecureUberspector.java
SecureUberspector.getIterator
@Override public Iterator getIterator(Object obj, Info i) throws Exception { if (obj != null) { SecureIntrospectorControl sic = (SecureIntrospectorControl) this.introspector; if (sic.checkObjectExecutePermission(obj.getClass(), null)) { return super.getIterator(obj, i); } else { this.log.warn("Cannot retrieve iterator from " + obj.getClass() + " due to security restrictions."); } } return null; }
java
@Override public Iterator getIterator(Object obj, Info i) throws Exception { if (obj != null) { SecureIntrospectorControl sic = (SecureIntrospectorControl) this.introspector; if (sic.checkObjectExecutePermission(obj.getClass(), null)) { return super.getIterator(obj, i); } else { this.log.warn("Cannot retrieve iterator from " + obj.getClass() + " due to security restrictions."); } } return null; }
[ "@", "Override", "public", "Iterator", "getIterator", "(", "Object", "obj", ",", "Info", "i", ")", "throws", "Exception", "{", "if", "(", "obj", "!=", "null", ")", "{", "SecureIntrospectorControl", "sic", "=", "(", "SecureIntrospectorControl", ")", "this", "...
Get an iterator from the given object. Since the superclass method this secure version checks for execute permission. @param obj object to iterate over @param i line, column, template info @return Iterator for object @throws Exception when failing to get iterator
[ "Get", "an", "iterator", "from", "the", "given", "object", ".", "Since", "the", "superclass", "method", "this", "secure", "version", "checks", "for", "execute", "permission", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-velocity/src/main/java/org/xwiki/velocity/introspection/SecureUberspector.java#L63-L75
LearnLib/learnlib
commons/counterexamples/src/main/java/de/learnlib/counterexamples/GlobalSuffixFinders.java
GlobalSuffixFinders.fromLocalFinder
public static <I, D> GlobalSuffixFinder<I, D> fromLocalFinder(LocalSuffixFinder<I, D> localFinder) { return fromLocalFinder(localFinder, false); }
java
public static <I, D> GlobalSuffixFinder<I, D> fromLocalFinder(LocalSuffixFinder<I, D> localFinder) { return fromLocalFinder(localFinder, false); }
[ "public", "static", "<", "I", ",", "D", ">", "GlobalSuffixFinder", "<", "I", ",", "D", ">", "fromLocalFinder", "(", "LocalSuffixFinder", "<", "I", ",", "D", ">", "localFinder", ")", "{", "return", "fromLocalFinder", "(", "localFinder", ",", "false", ")", ...
Transforms a {@link LocalSuffixFinder} into a global one. This is a convenience method, behaving like {@link #fromLocalFinder(LocalSuffixFinder, boolean)}. @see #fromLocalFinder(LocalSuffixFinder, boolean)
[ "Transforms", "a", "{", "@link", "LocalSuffixFinder", "}", "into", "a", "global", "one", ".", "This", "is", "a", "convenience", "method", "behaving", "like", "{", "@link", "#fromLocalFinder", "(", "LocalSuffixFinder", "boolean", ")", "}", "." ]
train
https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/commons/counterexamples/src/main/java/de/learnlib/counterexamples/GlobalSuffixFinders.java#L136-L138
GenesysPureEngage/provisioning-client-java
src/main/java/com/genesys/internal/provisioning/api/SessionApi.java
SessionApi.initializeProvisioning
public LoginSuccessResponse initializeProvisioning(InitProvData authenticationCode, String authorization) throws ApiException { ApiResponse<LoginSuccessResponse> resp = initializeProvisioningWithHttpInfo(authenticationCode, authorization); return resp.getData(); }
java
public LoginSuccessResponse initializeProvisioning(InitProvData authenticationCode, String authorization) throws ApiException { ApiResponse<LoginSuccessResponse> resp = initializeProvisioningWithHttpInfo(authenticationCode, authorization); return resp.getData(); }
[ "public", "LoginSuccessResponse", "initializeProvisioning", "(", "InitProvData", "authenticationCode", ",", "String", "authorization", ")", "throws", "ApiException", "{", "ApiResponse", "<", "LoginSuccessResponse", ">", "resp", "=", "initializeProvisioningWithHttpInfo", "(", ...
Authenticate user Initialize-provisioning operation will create a new sessionId and set default.yml:common.cookieName cookie (PROVISIONING_SESSIONID by default). @param authenticationCode Authentication code received from the Auth service (optional) @param authorization Bearer authorization. For example, &#39;Bearer access_token&#39;. (optional) @return LoginSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Authenticate", "user", "Initialize", "-", "provisioning", "operation", "will", "create", "a", "new", "sessionId", "and", "set", "default", ".", "yml", ":", "common", ".", "cookieName", "cookie", "(", "PROVISIONING_SESSIONID", "by", "default", ")", "." ]
train
https://github.com/GenesysPureEngage/provisioning-client-java/blob/1ad594c3767cec83052168e350994f922a26f75e/src/main/java/com/genesys/internal/provisioning/api/SessionApi.java#L483-L486
kmi/iserve
iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/api/impl/AbstractMatcher.java
AbstractMatcher.listMatchesAtLeastOfType
@Override public Table<URI, URI, MatchResult> listMatchesAtLeastOfType(Set<URI> origins, MatchType minType) { return listMatchesWithinRange(origins, minType, this.matchTypesSupported.getHighest()); }
java
@Override public Table<URI, URI, MatchResult> listMatchesAtLeastOfType(Set<URI> origins, MatchType minType) { return listMatchesWithinRange(origins, minType, this.matchTypesSupported.getHighest()); }
[ "@", "Override", "public", "Table", "<", "URI", ",", "URI", ",", "MatchResult", ">", "listMatchesAtLeastOfType", "(", "Set", "<", "URI", ">", "origins", ",", "MatchType", "minType", ")", "{", "return", "listMatchesWithinRange", "(", "origins", ",", "minType", ...
Obtains all the matching resources that have a MatchType with the URIs of {@code origin} of the type provided (inclusive) or more. @param origins URIs to match @param minType the minimum MatchType we want to obtain @return a {@link com.google.common.collect.Table} with the result of the matching indexed by origin URI and then destination URI.
[ "Obtains", "all", "the", "matching", "resources", "that", "have", "a", "MatchType", "with", "the", "URIs", "of", "{", "@code", "origin", "}", "of", "the", "type", "provided", "(", "inclusive", ")", "or", "more", "." ]
train
https://github.com/kmi/iserve/blob/13e7016e64c1d5a539b838c6debf1a5cc4aefcb7/iserve-discovery-api/src/main/java/uk/ac/open/kmi/iserve/discovery/api/impl/AbstractMatcher.java#L123-L126
JodaOrg/joda-time
src/main/java/org/joda/time/format/PeriodFormatterBuilder.java
PeriodFormatterBuilder.appendSeparatorIfFieldsBefore
public PeriodFormatterBuilder appendSeparatorIfFieldsBefore(String text) { return appendSeparator(text, text, null, true, false); }
java
public PeriodFormatterBuilder appendSeparatorIfFieldsBefore(String text) { return appendSeparator(text, text, null, true, false); }
[ "public", "PeriodFormatterBuilder", "appendSeparatorIfFieldsBefore", "(", "String", "text", ")", "{", "return", "appendSeparator", "(", "text", ",", "text", ",", "null", ",", "true", ",", "false", ")", ";", "}" ]
Append a separator, which is output only if fields are printed before the separator. <p> For example, <code>builder.appendDays().appendSeparatorIfFieldsBefore(",").appendHours()</code> will only output the comma if the days fields is output. <p> The text will be parsed case-insensitively. <p> Note: appending a separator discontinues any further work on the latest appended field. @param text the text to use as a separator @return this PeriodFormatterBuilder @throws IllegalStateException if this separator follows a previous one
[ "Append", "a", "separator", "which", "is", "output", "only", "if", "fields", "are", "printed", "before", "the", "separator", ".", "<p", ">", "For", "example", "<code", ">", "builder", ".", "appendDays", "()", ".", "appendSeparatorIfFieldsBefore", "(", ")", "...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatterBuilder.java#L767-L769
tvesalainen/lpg
src/main/java/org/vesalainen/parser/util/Input.java
Input.parseInt
@Override public int parseInt(long s, int l, int radix) { return Primitives.parseInt(getCharSequence(s, l), radix); }
java
@Override public int parseInt(long s, int l, int radix) { return Primitives.parseInt(getCharSequence(s, l), radix); }
[ "@", "Override", "public", "int", "parseInt", "(", "long", "s", ",", "int", "l", ",", "int", "radix", ")", "{", "return", "Primitives", ".", "parseInt", "(", "getCharSequence", "(", "s", ",", "l", ")", ",", "radix", ")", ";", "}" ]
Converts binary to int @param s @param l @param radix @return
[ "Converts", "binary", "to", "int" ]
train
https://github.com/tvesalainen/lpg/blob/0917b8d295e9772b9f8a0affc258a08530cd567a/src/main/java/org/vesalainen/parser/util/Input.java#L1432-L1436
OpenLiberty/open-liberty
dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/WCApplicationHelper.java
WCApplicationHelper.addEarToServerApps
public static void addEarToServerApps(LibertyServer server, String dir, String earName) throws Exception { server.copyFileToLibertyServerRoot(DIR_PUBLISH + server.getServerName() + "/" + dir, DIR_APPS, earName); }
java
public static void addEarToServerApps(LibertyServer server, String dir, String earName) throws Exception { server.copyFileToLibertyServerRoot(DIR_PUBLISH + server.getServerName() + "/" + dir, DIR_APPS, earName); }
[ "public", "static", "void", "addEarToServerApps", "(", "LibertyServer", "server", ",", "String", "dir", ",", "String", "earName", ")", "throws", "Exception", "{", "server", ".", "copyFileToLibertyServerRoot", "(", "DIR_PUBLISH", "+", "server", ".", "getServerName", ...
/* Helper method to create a ear and placed it to the specified directory which is relative from /publish/servers/ directory.
[ "/", "*", "Helper", "method", "to", "create", "a", "ear", "and", "placed", "it", "to", "the", "specified", "directory", "which", "is", "relative", "from", "/", "publish", "/", "servers", "/", "directory", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.javaeesec_fat/fat/src/com/ibm/ws/security/javaeesec/fat_helper/WCApplicationHelper.java#L187-L189
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getString
public static final String getString(byte[] data, int offset) { StringBuilder buffer = new StringBuilder(); char c; for (int loop = 0; offset + loop < data.length; loop++) { c = (char) data[offset + loop]; if (c == 0) { break; } buffer.append(c); } return (buffer.toString()); }
java
public static final String getString(byte[] data, int offset) { StringBuilder buffer = new StringBuilder(); char c; for (int loop = 0; offset + loop < data.length; loop++) { c = (char) data[offset + loop]; if (c == 0) { break; } buffer.append(c); } return (buffer.toString()); }
[ "public", "static", "final", "String", "getString", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "char", "c", ";", "for", "(", "int", "loop", "=", "0", ";", "off...
Reads a string of single byte characters from the input array. This method assumes that the string finishes either at the end of the array, or when char zero is encountered. Reading begins at the supplied offset into the array. @param data byte array of data @param offset offset into the array @return string value
[ "Reads", "a", "string", "of", "single", "byte", "characters", "from", "the", "input", "array", ".", "This", "method", "assumes", "that", "the", "string", "finishes", "either", "at", "the", "end", "of", "the", "array", "or", "when", "char", "zero", "is", ...
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L492-L510
ModeShape/modeshape
sequencers/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/javafile/AbstractJavaMetadata.java
AbstractJavaMetadata.processSimpleType
protected FieldMetadata processSimpleType( FieldDeclaration fieldDeclaration ) { SimpleType simpleType = (SimpleType)fieldDeclaration.getType(); FieldMetadata simpleTypeFieldMetadata = FieldMetadata.simpleType(JavaMetadataUtil.getName(simpleType.getName())); // modifiers processModifiersOfFieldDeclaration(fieldDeclaration, simpleTypeFieldMetadata); processVariablesOfVariableDeclarationFragment(fieldDeclaration, simpleTypeFieldMetadata); simpleTypeFieldMetadata.setName(getFieldName(fieldDeclaration)); return simpleTypeFieldMetadata; }
java
protected FieldMetadata processSimpleType( FieldDeclaration fieldDeclaration ) { SimpleType simpleType = (SimpleType)fieldDeclaration.getType(); FieldMetadata simpleTypeFieldMetadata = FieldMetadata.simpleType(JavaMetadataUtil.getName(simpleType.getName())); // modifiers processModifiersOfFieldDeclaration(fieldDeclaration, simpleTypeFieldMetadata); processVariablesOfVariableDeclarationFragment(fieldDeclaration, simpleTypeFieldMetadata); simpleTypeFieldMetadata.setName(getFieldName(fieldDeclaration)); return simpleTypeFieldMetadata; }
[ "protected", "FieldMetadata", "processSimpleType", "(", "FieldDeclaration", "fieldDeclaration", ")", "{", "SimpleType", "simpleType", "=", "(", "SimpleType", ")", "fieldDeclaration", ".", "getType", "(", ")", ";", "FieldMetadata", "simpleTypeFieldMetadata", "=", "FieldM...
Process the simple type of a {@link FieldDeclaration}. @param fieldDeclaration - the field declaration. @return SimpleTypeFieldMetadata.
[ "Process", "the", "simple", "type", "of", "a", "{", "@link", "FieldDeclaration", "}", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/sequencers/modeshape-sequencer-java/src/main/java/org/modeshape/sequencer/javafile/AbstractJavaMetadata.java#L589-L598
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java
CFMLExpressionInterpreter.functionArgDeclaration
private Ref functionArgDeclaration() throws PageException { Ref ref = impOp(); if (cfml.forwardIfCurrent(':') || cfml.forwardIfCurrent('=')) { cfml.removeSpace(); ref = new LFunctionValue(ref, assignOp()); } return ref; }
java
private Ref functionArgDeclaration() throws PageException { Ref ref = impOp(); if (cfml.forwardIfCurrent(':') || cfml.forwardIfCurrent('=')) { cfml.removeSpace(); ref = new LFunctionValue(ref, assignOp()); } return ref; }
[ "private", "Ref", "functionArgDeclaration", "(", ")", "throws", "PageException", "{", "Ref", "ref", "=", "impOp", "(", ")", ";", "if", "(", "cfml", ".", "forwardIfCurrent", "(", "'", "'", ")", "||", "cfml", ".", "forwardIfCurrent", "(", "'", "'", ")", ...
Liest einen gelableten Funktionsparamter ein <br /> EBNF:<br /> <code>assignOp [":" spaces assignOp];</code> @return CFXD Element @throws PageException
[ "Liest", "einen", "gelableten", "Funktionsparamter", "ein", "<br", "/", ">", "EBNF", ":", "<br", "/", ">", "<code", ">", "assignOp", "[", ":", "spaces", "assignOp", "]", ";", "<", "/", "code", ">" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/CFMLExpressionInterpreter.java#L285-L292
elki-project/elki
addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/projections/AbstractFullProjection.java
AbstractFullProjection.projectScaledToDataSpace
@Override public <NV extends NumberVector> NV projectScaledToDataSpace(double[] v, NumberVector.Factory<NV> factory) { final int dim = v.length; double[] vec = new double[dim]; for(int d = 0; d < dim; d++) { vec[d] = scales[d].getUnscaled(v[d]); } return factory.newNumberVector(vec); }
java
@Override public <NV extends NumberVector> NV projectScaledToDataSpace(double[] v, NumberVector.Factory<NV> factory) { final int dim = v.length; double[] vec = new double[dim]; for(int d = 0; d < dim; d++) { vec[d] = scales[d].getUnscaled(v[d]); } return factory.newNumberVector(vec); }
[ "@", "Override", "public", "<", "NV", "extends", "NumberVector", ">", "NV", "projectScaledToDataSpace", "(", "double", "[", "]", "v", ",", "NumberVector", ".", "Factory", "<", "NV", ">", "factory", ")", "{", "final", "int", "dim", "=", "v", ".", "length"...
Project a vector from scaled space to data space. @param <NV> Vector type @param v vector in scaled space @param factory Object factory @return vector in data space
[ "Project", "a", "vector", "from", "scaled", "space", "to", "data", "space", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/addons/batikvis/src/main/java/de/lmu/ifi/dbs/elki/visualization/projections/AbstractFullProjection.java#L163-L171
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/Reflector.java
Reflector.getProperty
public static Object getProperty(Object obj, String prop, Object defaultValue) { // first try field Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop, null); if (!ArrayUtil.isEmpty(fields)) { try { return fields[0].get(obj); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } // then getter try { char first = prop.charAt(0); if (first >= '0' && first <= '9') return defaultValue; return getGetter(obj.getClass(), prop).invoke(obj); } catch (Throwable e1) { ExceptionUtil.rethrowIfNecessary(e1); return defaultValue; } }
java
public static Object getProperty(Object obj, String prop, Object defaultValue) { // first try field Field[] fields = getFieldsIgnoreCase(obj.getClass(), prop, null); if (!ArrayUtil.isEmpty(fields)) { try { return fields[0].get(obj); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); } } // then getter try { char first = prop.charAt(0); if (first >= '0' && first <= '9') return defaultValue; return getGetter(obj.getClass(), prop).invoke(obj); } catch (Throwable e1) { ExceptionUtil.rethrowIfNecessary(e1); return defaultValue; } }
[ "public", "static", "Object", "getProperty", "(", "Object", "obj", ",", "String", "prop", ",", "Object", "defaultValue", ")", "{", "// first try field", "Field", "[", "]", "fields", "=", "getFieldsIgnoreCase", "(", "obj", ".", "getClass", "(", ")", ",", "pro...
to get a visible Propety (Field or Getter) of a object @param obj Object to invoke @param prop property to call @return property value
[ "to", "get", "a", "visible", "Propety", "(", "Field", "or", "Getter", ")", "of", "a", "object" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/Reflector.java#L1214-L1237
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DateTimeUtils.java
DateTimeUtils.zonedDateTimeOf
public static ZonedDateTime zonedDateTimeOf(final long time, final ZoneId zoneId) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(time), zoneId); }
java
public static ZonedDateTime zonedDateTimeOf(final long time, final ZoneId zoneId) { return ZonedDateTime.ofInstant(Instant.ofEpochMilli(time), zoneId); }
[ "public", "static", "ZonedDateTime", "zonedDateTimeOf", "(", "final", "long", "time", ",", "final", "ZoneId", "zoneId", ")", "{", "return", "ZonedDateTime", ".", "ofInstant", "(", "Instant", ".", "ofEpochMilli", "(", "time", ")", ",", "zoneId", ")", ";", "}"...
Utility for creating a ZonedDateTime object from a millisecond timestamp. @param time Milliseconds since Epoch @param zoneId Time zone @return ZonedDateTime representing time
[ "Utility", "for", "creating", "a", "ZonedDateTime", "object", "from", "a", "millisecond", "timestamp", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/DateTimeUtils.java#L178-L180
bingoohuang/excel2javabeans
src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java
BeansToExcelOnTemplate.sameValueMergeRows
private void sameValueMergeRows(MergeRow mergeRowAnn, int itemSize, Cell fromCell) { String lastValue = PoiUtil.getCellStringValue(fromCell); int preRow = fromCell.getRowIndex(); val col = fromCell.getColumnIndex(); int i = preRow + 1; for (final int ii = preRow + itemSize; i < ii; ++i) { val cell = sheet.getRow(i).getCell(col); val cellValue = PoiUtil.getCellStringValue(cell); if (StringUtils.equals(cellValue, lastValue)) continue; directMergeRows(mergeRowAnn, preRow, i - 1, col); lastValue = cellValue; preRow = i; } directMergeRows(mergeRowAnn, preRow, i - 1, col); }
java
private void sameValueMergeRows(MergeRow mergeRowAnn, int itemSize, Cell fromCell) { String lastValue = PoiUtil.getCellStringValue(fromCell); int preRow = fromCell.getRowIndex(); val col = fromCell.getColumnIndex(); int i = preRow + 1; for (final int ii = preRow + itemSize; i < ii; ++i) { val cell = sheet.getRow(i).getCell(col); val cellValue = PoiUtil.getCellStringValue(cell); if (StringUtils.equals(cellValue, lastValue)) continue; directMergeRows(mergeRowAnn, preRow, i - 1, col); lastValue = cellValue; preRow = i; } directMergeRows(mergeRowAnn, preRow, i - 1, col); }
[ "private", "void", "sameValueMergeRows", "(", "MergeRow", "mergeRowAnn", ",", "int", "itemSize", ",", "Cell", "fromCell", ")", "{", "String", "lastValue", "=", "PoiUtil", ".", "getCellStringValue", "(", "fromCell", ")", ";", "int", "preRow", "=", "fromCell", "...
同值纵向合并单元格。 @param mergeRowAnn 纵向合并单元格注解。 @param itemSize 纵向合并行数。 @param fromCell 开始合并单元格。
[ "同值纵向合并单元格。" ]
train
https://github.com/bingoohuang/excel2javabeans/blob/db136d460b93b649814366c0d84a982698b96dc3/src/main/java/com/github/bingoohuang/excel2beans/BeansToExcelOnTemplate.java#L152-L169
h2oai/h2o-3
h2o-genmodel/src/main/java/hex/genmodel/tools/MungeCsv.java
MungeCsv.parseDataRow
private static RowData parseDataRow(String line, GenMunger munger) { if( line.isEmpty() || line.equals("") ) return null; String[] inputData = line.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)|(,)", -1); for(int i=0;i<inputData.length;++i) inputData[i]=inputData[i]==null?"":inputData[i]; if( inputData.length != munger.inNames().length ) return null; return munger.fillDefault(inputData); }
java
private static RowData parseDataRow(String line, GenMunger munger) { if( line.isEmpty() || line.equals("") ) return null; String[] inputData = line.split(",(?=([^\"]*\"[^\"]*\")*[^\"]*$)|(,)", -1); for(int i=0;i<inputData.length;++i) inputData[i]=inputData[i]==null?"":inputData[i]; if( inputData.length != munger.inNames().length ) return null; return munger.fillDefault(inputData); }
[ "private", "static", "RowData", "parseDataRow", "(", "String", "line", ",", "GenMunger", "munger", ")", "{", "if", "(", "line", ".", "isEmpty", "(", ")", "||", "line", ".", "equals", "(", "\"\"", ")", ")", "return", "null", ";", "String", "[", "]", "...
This CSV parser is as bare bones as it gets. Our test data doesn't have funny quoting, spacing, or other issues. Can't handle cases where the number of data columns is less than the number of header columns.
[ "This", "CSV", "parser", "is", "as", "bare", "bones", "as", "it", "gets", ".", "Our", "test", "data", "doesn", "t", "have", "funny", "quoting", "spacing", "or", "other", "issues", ".", "Can", "t", "handle", "cases", "where", "the", "number", "of", "dat...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/tools/MungeCsv.java#L92-L101
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/DetectPolygonFromContour.java
DetectPolygonFromContour.configure
private void configure( int width , int height ) { this.imageWidth = width; this.imageHeight = height; // adjust size based parameters based on image size this.minimumContour = minimumContourConfig.computeI(Math.min(width,height)); this.minimumContour = Math.max(4,minimumContour); // This is needed to avoid processing zero or other impossible this.minimumArea = Math.pow(this.minimumContour /4.0,2); contourFinder.setMinContour(minimumContour); if( helper != null ) helper.setImageShape(width,height); }
java
private void configure( int width , int height ) { this.imageWidth = width; this.imageHeight = height; // adjust size based parameters based on image size this.minimumContour = minimumContourConfig.computeI(Math.min(width,height)); this.minimumContour = Math.max(4,minimumContour); // This is needed to avoid processing zero or other impossible this.minimumArea = Math.pow(this.minimumContour /4.0,2); contourFinder.setMinContour(minimumContour); if( helper != null ) helper.setImageShape(width,height); }
[ "private", "void", "configure", "(", "int", "width", ",", "int", "height", ")", "{", "this", ".", "imageWidth", "=", "width", ";", "this", ".", "imageHeight", "=", "height", ";", "// adjust size based parameters based on image size", "this", ".", "minimumContour",...
Specifies the image's intrinsic parameters and target size @param width Width of the input image @param height Height of the input image
[ "Specifies", "the", "image", "s", "intrinsic", "parameters", "and", "target", "size" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polygon/DetectPolygonFromContour.java#L264-L277
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java
KeyedStream.timeWindow
public WindowedStream<T, KEY, TimeWindow> timeWindow(Time size, Time slide) { if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) { return window(SlidingProcessingTimeWindows.of(size, slide)); } else { return window(SlidingEventTimeWindows.of(size, slide)); } }
java
public WindowedStream<T, KEY, TimeWindow> timeWindow(Time size, Time slide) { if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) { return window(SlidingProcessingTimeWindows.of(size, slide)); } else { return window(SlidingEventTimeWindows.of(size, slide)); } }
[ "public", "WindowedStream", "<", "T", ",", "KEY", ",", "TimeWindow", ">", "timeWindow", "(", "Time", "size", ",", "Time", "slide", ")", "{", "if", "(", "environment", ".", "getStreamTimeCharacteristic", "(", ")", "==", "TimeCharacteristic", ".", "ProcessingTim...
Windows this {@code KeyedStream} into sliding time windows. <p>This is a shortcut for either {@code .window(SlidingEventTimeWindows.of(size, slide))} or {@code .window(SlidingProcessingTimeWindows.of(size, slide))} depending on the time characteristic set using {@link org.apache.flink.streaming.api.environment.StreamExecutionEnvironment#setStreamTimeCharacteristic(org.apache.flink.streaming.api.TimeCharacteristic)} @param size The size of the window.
[ "Windows", "this", "{", "@code", "KeyedStream", "}", "into", "sliding", "time", "windows", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/datastream/KeyedStream.java#L629-L635
contentful/contentful-management.java
src/main/java/com/contentful/java/cma/model/rich/RichTextFactory.java
RichTextFactory.resolveRichNode
static CMARichNode resolveRichNode(Map<String, Object> rawNode) { final String type = (String) rawNode.get("nodeType"); if (RESOLVER_MAP.containsKey(type)) { return RESOLVER_MAP.get(type).resolve(rawNode); } else { return null; } }
java
static CMARichNode resolveRichNode(Map<String, Object> rawNode) { final String type = (String) rawNode.get("nodeType"); if (RESOLVER_MAP.containsKey(type)) { return RESOLVER_MAP.get(type).resolve(rawNode); } else { return null; } }
[ "static", "CMARichNode", "resolveRichNode", "(", "Map", "<", "String", ",", "Object", ">", "rawNode", ")", "{", "final", "String", "type", "=", "(", "String", ")", "rawNode", ".", "get", "(", "\"nodeType\"", ")", ";", "if", "(", "RESOLVER_MAP", ".", "con...
Resolve one node. @param rawNode the map response from Contentful @return a CMARichNode from this SDK.
[ "Resolve", "one", "node", "." ]
train
https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/model/rich/RichTextFactory.java#L265-L272
finmath/finmath-lib
src/main/java/net/finmath/montecarlo/interestrate/models/HullWhiteModel.java
HullWhiteModel.getB
private RandomVariable getB(double time, double maturity) { int timeIndexStart = volatilityModel.getTimeDiscretization().getTimeIndex(time); if(timeIndexStart < 0) { timeIndexStart = -timeIndexStart-2; // Get timeIndex corresponding to previous point } int timeIndexEnd =volatilityModel.getTimeDiscretization().getTimeIndex(maturity); if(timeIndexEnd < 0) { timeIndexEnd = -timeIndexEnd-2; // Get timeIndex corresponding to previous point } RandomVariable integral = new Scalar(0.0); double timePrev = time; double timeNext; for(int timeIndex=timeIndexStart+1; timeIndex<=timeIndexEnd; timeIndex++) { timeNext = volatilityModel.getTimeDiscretization().getTime(timeIndex); RandomVariable meanReversion = volatilityModel.getMeanReversion(timeIndex-1); integral = integral.add( getMRTime(timeNext,maturity).mult(-1.0).exp().sub( getMRTime(timePrev,maturity).mult(-1.0).exp()).div(meanReversion)); timePrev = timeNext; } RandomVariable meanReversion = volatilityModel.getMeanReversion(timeIndexEnd); timeNext = maturity; integral = integral.add( getMRTime(timeNext,maturity).mult(-1.0).exp().sub( getMRTime(timePrev,maturity).mult(-1.0).exp()).div(meanReversion)); return integral; }
java
private RandomVariable getB(double time, double maturity) { int timeIndexStart = volatilityModel.getTimeDiscretization().getTimeIndex(time); if(timeIndexStart < 0) { timeIndexStart = -timeIndexStart-2; // Get timeIndex corresponding to previous point } int timeIndexEnd =volatilityModel.getTimeDiscretization().getTimeIndex(maturity); if(timeIndexEnd < 0) { timeIndexEnd = -timeIndexEnd-2; // Get timeIndex corresponding to previous point } RandomVariable integral = new Scalar(0.0); double timePrev = time; double timeNext; for(int timeIndex=timeIndexStart+1; timeIndex<=timeIndexEnd; timeIndex++) { timeNext = volatilityModel.getTimeDiscretization().getTime(timeIndex); RandomVariable meanReversion = volatilityModel.getMeanReversion(timeIndex-1); integral = integral.add( getMRTime(timeNext,maturity).mult(-1.0).exp().sub( getMRTime(timePrev,maturity).mult(-1.0).exp()).div(meanReversion)); timePrev = timeNext; } RandomVariable meanReversion = volatilityModel.getMeanReversion(timeIndexEnd); timeNext = maturity; integral = integral.add( getMRTime(timeNext,maturity).mult(-1.0).exp().sub( getMRTime(timePrev,maturity).mult(-1.0).exp()).div(meanReversion)); return integral; }
[ "private", "RandomVariable", "getB", "(", "double", "time", ",", "double", "maturity", ")", "{", "int", "timeIndexStart", "=", "volatilityModel", ".", "getTimeDiscretization", "(", ")", ".", "getTimeIndex", "(", "time", ")", ";", "if", "(", "timeIndexStart", "...
Calculates \( B(t,T) = \int_{t}^{T} \exp(-\int_{s}^{T} a(\tau) \mathrm{d}\tau) \mathrm{d}s \), where a is the mean reversion parameter. For a constant \( a \) this results in \( \frac{1-\exp(-a (T-t)}{a} \), but the method also supports piecewise constant \( a \)'s. @param time The parameter t. @param maturity The parameter T. @return The value of B(t,T).
[ "Calculates", "\\", "(", "B", "(", "t", "T", ")", "=", "\\", "int_", "{", "t", "}", "^", "{", "T", "}", "\\", "exp", "(", "-", "\\", "int_", "{", "s", "}", "^", "{", "T", "}", "a", "(", "\\", "tau", ")", "\\", "mathrm", "{", "d", "}", ...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/montecarlo/interestrate/models/HullWhiteModel.java#L615-L644
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/datastructures/collections/CouchbaseArraySet.java
CouchbaseArraySet.enforcePrimitive
protected void enforcePrimitive(Object t) throws ClassCastException { if (!JsonValue.checkType(t) || t instanceof JsonValue) { throw new ClassCastException("Only primitive types are supported in CouchbaseArraySet, got a " + t.getClass().getName()); } }
java
protected void enforcePrimitive(Object t) throws ClassCastException { if (!JsonValue.checkType(t) || t instanceof JsonValue) { throw new ClassCastException("Only primitive types are supported in CouchbaseArraySet, got a " + t.getClass().getName()); } }
[ "protected", "void", "enforcePrimitive", "(", "Object", "t", ")", "throws", "ClassCastException", "{", "if", "(", "!", "JsonValue", ".", "checkType", "(", "t", ")", "||", "t", "instanceof", "JsonValue", ")", "{", "throw", "new", "ClassCastException", "(", "\...
Verify that the type of object t is compatible with CouchbaseArraySet storage. @param t the object to check. @throws ClassCastException if the object is incompatible.
[ "Verify", "that", "the", "type", "of", "object", "t", "is", "compatible", "with", "CouchbaseArraySet", "storage", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/datastructures/collections/CouchbaseArraySet.java#L213-L218
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/Expression.java
Expression.isNullOrMissing
@NonNull public Expression isNullOrMissing() { return new UnaryExpression(this, UnaryExpression.OpType.Null) .or(new UnaryExpression(this, UnaryExpression.OpType.Missing)); }
java
@NonNull public Expression isNullOrMissing() { return new UnaryExpression(this, UnaryExpression.OpType.Null) .or(new UnaryExpression(this, UnaryExpression.OpType.Missing)); }
[ "@", "NonNull", "public", "Expression", "isNullOrMissing", "(", ")", "{", "return", "new", "UnaryExpression", "(", "this", ",", "UnaryExpression", ".", "OpType", ".", "Null", ")", ".", "or", "(", "new", "UnaryExpression", "(", "this", ",", "UnaryExpression", ...
Creates an IS NULL OR MISSING expression that evaluates whether or not the current expression is null or missing. @return An IS NULL expression.
[ "Creates", "an", "IS", "NULL", "OR", "MISSING", "expression", "that", "evaluates", "whether", "or", "not", "the", "current", "expression", "is", "null", "or", "missing", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Expression.java#L815-L819
rhuss/jolokia
agent/core/src/main/java/org/jolokia/converter/json/MapExtractor.java
MapExtractor.extractObject
public Object extractObject(ObjectToJsonConverter pConverter, Object pValue, Stack<String> pPathParts,boolean jsonify) throws AttributeNotFoundException { Map<Object,Object> map = (Map<Object,Object>) pValue; int length = pConverter.getCollectionLength(map.size()); String pathParth = pPathParts.isEmpty() ? null : pPathParts.pop(); if (pathParth != null) { return extractMapValueWithPath(pConverter, pValue, pPathParts, jsonify, map, pathParth); } else { return jsonify ? extractMapValues(pConverter, pPathParts, jsonify, map, length) : map; } }
java
public Object extractObject(ObjectToJsonConverter pConverter, Object pValue, Stack<String> pPathParts,boolean jsonify) throws AttributeNotFoundException { Map<Object,Object> map = (Map<Object,Object>) pValue; int length = pConverter.getCollectionLength(map.size()); String pathParth = pPathParts.isEmpty() ? null : pPathParts.pop(); if (pathParth != null) { return extractMapValueWithPath(pConverter, pValue, pPathParts, jsonify, map, pathParth); } else { return jsonify ? extractMapValues(pConverter, pPathParts, jsonify, map, length) : map; } }
[ "public", "Object", "extractObject", "(", "ObjectToJsonConverter", "pConverter", ",", "Object", "pValue", ",", "Stack", "<", "String", ">", "pPathParts", ",", "boolean", "jsonify", ")", "throws", "AttributeNotFoundException", "{", "Map", "<", "Object", ",", "Objec...
Convert a Map to JSON (if <code>jsonify</code> is <code>true</code>). If a path is used, the path is interpreted as a key into the map. The key in the path is a string and is compared agains all keys in the map against their string representation. @param pConverter the global converter in order to be able do dispatch for serializing inner data types @param pValue the value to convert which must be a {@link Map} @param pPathParts extra argument stack which on top must be a key into the map @param jsonify whether to convert to a JSON object/list or whether the plain object should be returned. The later is required for writing an inner value @return the extracted object @throws AttributeNotFoundException
[ "Convert", "a", "Map", "to", "JSON", "(", "if", "<code", ">", "jsonify<", "/", "code", ">", "is", "<code", ">", "true<", "/", "code", ">", ")", ".", "If", "a", "path", "is", "used", "the", "path", "is", "interpreted", "as", "a", "key", "into", "t...
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/json/MapExtractor.java#L57-L67
mapsforge/mapsforge
mapsforge-map/src/main/java/org/mapsforge/map/model/MapViewPosition.java
MapViewPosition.setZoomLevel
@Override public void setZoomLevel(byte zoomLevel, boolean animated) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } synchronized (this) { setZoomLevelInternal(zoomLevel, animated); } notifyObservers(); }
java
@Override public void setZoomLevel(byte zoomLevel, boolean animated) { if (zoomLevel < 0) { throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel); } synchronized (this) { setZoomLevelInternal(zoomLevel, animated); } notifyObservers(); }
[ "@", "Override", "public", "void", "setZoomLevel", "(", "byte", "zoomLevel", ",", "boolean", "animated", ")", "{", "if", "(", "zoomLevel", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"zoomLevel must not be negative: \"", "+", "zoomLevel"...
Sets the new zoom level of the map @param zoomLevel desired zoom level @param animated true if the transition should be animated, false otherwise @throws IllegalArgumentException if the zoom level is negative.
[ "Sets", "the", "new", "zoom", "level", "of", "the", "map" ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-map/src/main/java/org/mapsforge/map/model/MapViewPosition.java#L453-L462
Manabu-GT/EtsyBlur
sample/src/main/java/com/ms/square/android/etsyblurdemo/ui/fragment/PlaceholderFragment.java
PlaceholderFragment.newInstance
public static PlaceholderFragment newInstance(int sectionNumber, @LayoutRes int layoutRes) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); args.putInt(ARG_LAYOUT_RESOURCE, layoutRes); fragment.setArguments(args); return fragment; }
java
public static PlaceholderFragment newInstance(int sectionNumber, @LayoutRes int layoutRes) { PlaceholderFragment fragment = new PlaceholderFragment(); Bundle args = new Bundle(); args.putInt(ARG_SECTION_NUMBER, sectionNumber); args.putInt(ARG_LAYOUT_RESOURCE, layoutRes); fragment.setArguments(args); return fragment; }
[ "public", "static", "PlaceholderFragment", "newInstance", "(", "int", "sectionNumber", ",", "@", "LayoutRes", "int", "layoutRes", ")", "{", "PlaceholderFragment", "fragment", "=", "new", "PlaceholderFragment", "(", ")", ";", "Bundle", "args", "=", "new", "Bundle",...
Returns a new instance of this fragment for the given section number.
[ "Returns", "a", "new", "instance", "of", "this", "fragment", "for", "the", "given", "section", "number", "." ]
train
https://github.com/Manabu-GT/EtsyBlur/blob/b51c9e80e823fce3590cc061e79e267388b4d8e0/sample/src/main/java/com/ms/square/android/etsyblurdemo/ui/fragment/PlaceholderFragment.java#L31-L38
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java
DateTimeUtils.addMonths
public static Calendar addMonths(Calendar origin, int value) { Calendar cal = sync((Calendar) origin.clone()); cal.add(Calendar.MONTH, value); return sync(cal); }
java
public static Calendar addMonths(Calendar origin, int value) { Calendar cal = sync((Calendar) origin.clone()); cal.add(Calendar.MONTH, value); return sync(cal); }
[ "public", "static", "Calendar", "addMonths", "(", "Calendar", "origin", ",", "int", "value", ")", "{", "Calendar", "cal", "=", "sync", "(", "(", "Calendar", ")", "origin", ".", "clone", "(", ")", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "MO...
Add/Subtract the specified amount of months to the given {@link Calendar}. <p> The returned {@link Calendar} has its fields synced. </p> @param origin @param value @return @since 0.9.2
[ "Add", "/", "Subtract", "the", "specified", "amount", "of", "months", "to", "the", "given", "{", "@link", "Calendar", "}", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java#L835-L839
salesforce/Argus
ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java
AlertService.updateTrigger
public Trigger updateTrigger(BigInteger alertId, BigInteger triggerId, Trigger trigger) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + alertId.toString() + "/triggers/" + triggerId.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, trigger); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Trigger.class); }
java
public Trigger updateTrigger(BigInteger alertId, BigInteger triggerId, Trigger trigger) throws IOException, TokenExpiredException { String requestUrl = RESOURCE + "/" + alertId.toString() + "/triggers/" + triggerId.toString(); ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.PUT, requestUrl, trigger); assertValidResponse(response, requestUrl); return fromJson(response.getResult(), Trigger.class); }
[ "public", "Trigger", "updateTrigger", "(", "BigInteger", "alertId", ",", "BigInteger", "triggerId", ",", "Trigger", "trigger", ")", "throws", "IOException", ",", "TokenExpiredException", "{", "String", "requestUrl", "=", "RESOURCE", "+", "\"/\"", "+", "alertId", "...
Updates an existing trigger. @param alertId The ID of the alert owning the trigger. @param triggerId The ID of the trigger to update. @param trigger The updated trigger information. @return The updated trigger. @throws IOException If the server cannot be reached. @throws TokenExpiredException If the token sent along with the request has expired
[ "Updates", "an", "existing", "trigger", "." ]
train
https://github.com/salesforce/Argus/blob/121b59a268da264316cded6a3e9271366a23cd86/ArgusSDK/src/main/java/com/salesforce/dva/argus/sdk/AlertService.java#L317-L323
infinispan/infinispan
query/src/main/java/org/infinispan/query/clustered/commandworkers/CQWorker.java
CQWorker.extractKey
Object extractKey(DocumentExtractor extractor, int docIndex) { String strKey; try { strKey = (String) extractor.extract(docIndex).getId(); } catch (IOException e) { throw new SearchException("Error while extracting key", e); } return keyTransformationHandler.stringToKey(strKey); }
java
Object extractKey(DocumentExtractor extractor, int docIndex) { String strKey; try { strKey = (String) extractor.extract(docIndex).getId(); } catch (IOException e) { throw new SearchException("Error while extracting key", e); } return keyTransformationHandler.stringToKey(strKey); }
[ "Object", "extractKey", "(", "DocumentExtractor", "extractor", ",", "int", "docIndex", ")", "{", "String", "strKey", ";", "try", "{", "strKey", "=", "(", "String", ")", "extractor", ".", "extract", "(", "docIndex", ")", ".", "getId", "(", ")", ";", "}", ...
Utility to extract the cache key of a DocumentExtractor and use the KeyTransformationHandler to turn the string into the actual key object. @param extractor @param docIndex @return
[ "Utility", "to", "extract", "the", "cache", "key", "of", "a", "DocumentExtractor", "and", "use", "the", "KeyTransformationHandler", "to", "turn", "the", "string", "into", "the", "actual", "key", "object", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/query/src/main/java/org/infinispan/query/clustered/commandworkers/CQWorker.java#L71-L80
mnlipp/jgrapes
org.jgrapes.io/src/org/jgrapes/io/InputStreamMonitor.java
InputStreamMonitor.onStart
@Handler public void onStart(Start event) { synchronized (this) { if (runner != null) { return; } buffers = new ManagedBufferPool<>(ManagedBuffer::new, () -> { return ByteBuffer.allocateDirect(bufferSize); }, 2); runner = new Thread(this, Components.simpleObjectName(this)); // Because this cannot reliably be stopped, it doesn't prevent // shutdown. runner.setDaemon(true); runner.start(); } }
java
@Handler public void onStart(Start event) { synchronized (this) { if (runner != null) { return; } buffers = new ManagedBufferPool<>(ManagedBuffer::new, () -> { return ByteBuffer.allocateDirect(bufferSize); }, 2); runner = new Thread(this, Components.simpleObjectName(this)); // Because this cannot reliably be stopped, it doesn't prevent // shutdown. runner.setDaemon(true); runner.start(); } }
[ "@", "Handler", "public", "void", "onStart", "(", "Start", "event", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "runner", "!=", "null", ")", "{", "return", ";", "}", "buffers", "=", "new", "ManagedBufferPool", "<>", "(", "ManagedBuffer", ...
Starts a thread that continuously reads available data from the input stream. @param event the event
[ "Starts", "a", "thread", "that", "continuously", "reads", "available", "data", "from", "the", "input", "stream", "." ]
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/io/InputStreamMonitor.java#L135-L151
lucee/Lucee
core/src/main/java/lucee/commons/management/MemoryInfo.java
MemoryInfo.deepMemoryUsageOfAll
public static long deepMemoryUsageOfAll(Instrumentation inst, final Collection<? extends java.lang.Object> objs) throws IOException { return deepMemoryUsageOfAll(inst, objs, NON_PUBLIC); }
java
public static long deepMemoryUsageOfAll(Instrumentation inst, final Collection<? extends java.lang.Object> objs) throws IOException { return deepMemoryUsageOfAll(inst, objs, NON_PUBLIC); }
[ "public", "static", "long", "deepMemoryUsageOfAll", "(", "Instrumentation", "inst", ",", "final", "Collection", "<", "?", "extends", "java", ".", "lang", ".", "Object", ">", "objs", ")", "throws", "IOException", "{", "return", "deepMemoryUsageOfAll", "(", "inst"...
Returns an estimation, in bytes, of the memory usage of the given objects plus (recursively) objects referenced via non-static references from any of those objects via non-public fields. If two or more of the given objects reference the same Object X, then the memory used by Object X will only be counted once. However, the method guarantees that the memory for a given object (either in the passed-in collection or found while traversing the object graphs from those objects) will not be counted more than once. The estimate for each individual object is provided by the running JVM and is likely to be as accurate a measure as can be reasonably made by the running Java program. It will generally include memory taken up for "housekeeping" of that object. @param objs The collection of objects whose memory usage is to be totalled. @return An estimate, in bytes, of the total heap memory taken up by the obejcts in objs and, recursively, objects referenced by private or protected (non-static) fields. @throws IOException
[ "Returns", "an", "estimation", "in", "bytes", "of", "the", "memory", "usage", "of", "the", "given", "objects", "plus", "(", "recursively", ")", "objects", "referenced", "via", "non", "-", "static", "references", "from", "any", "of", "those", "objects", "via"...
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/management/MemoryInfo.java#L106-L108
katharsis-project/katharsis-framework
katharsis-core/src/main/java/io/katharsis/core/internal/utils/ClassUtils.java
ClassUtils.newInstance
public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz)); } }
java
public static <T> T newInstance(Class<T> clazz) { try { return clazz.newInstance(); } catch (InstantiationException | IllegalAccessException e) { throw new ResourceException(String.format("couldn't create a new instance of %s", clazz)); } }
[ "public", "static", "<", "T", ">", "T", "newInstance", "(", "Class", "<", "T", ">", "clazz", ")", "{", "try", "{", "return", "clazz", ".", "newInstance", "(", ")", ";", "}", "catch", "(", "InstantiationException", "|", "IllegalAccessException", "e", ")",...
Create a new instance of a resource using a default constructor @param clazz new instance class @param <T> new instance class @return new instance
[ "Create", "a", "new", "instance", "of", "a", "resource", "using", "a", "default", "constructor" ]
train
https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/utils/ClassUtils.java#L216-L223
softindex/datakernel
global-common/src/main/java/io/global/util/Utils.java
Utils.nSuccessesOrLess
public static <T> Promise<List<T>> nSuccessesOrLess(int n, Iterator<Promise<T>> promises) { return reduceEx(promises, a -> n - a.size(), new ArrayList<T>(), (a, v) -> { if (v.isSuccess()) { a.add(v.get()); if (a.size() == n) { return Try.of(a); } } return null; }, Try::of, Cancellable::tryCancel); }
java
public static <T> Promise<List<T>> nSuccessesOrLess(int n, Iterator<Promise<T>> promises) { return reduceEx(promises, a -> n - a.size(), new ArrayList<T>(), (a, v) -> { if (v.isSuccess()) { a.add(v.get()); if (a.size() == n) { return Try.of(a); } } return null; }, Try::of, Cancellable::tryCancel); }
[ "public", "static", "<", "T", ">", "Promise", "<", "List", "<", "T", ">", ">", "nSuccessesOrLess", "(", "int", "n", ",", "Iterator", "<", "Promise", "<", "T", ">", ">", "promises", ")", "{", "return", "reduceEx", "(", "promises", ",", "a", "->", "n...
Returns a {@code List} of successfully completed {@code Promise}s. Length of returned {@code List} can't be greater than {@code n}.
[ "Returns", "a", "{" ]
train
https://github.com/softindex/datakernel/blob/090ca1116416c14d463d49d275cb1daaafa69c56/global-common/src/main/java/io/global/util/Utils.java#L31-L45
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java
AbstractEntityReader.onParseRelation
private void onParseRelation(Object entity, final PersistenceDelegator pd, EntityMetadata targetEntityMetadata, Object relationEntity, Relation relation, boolean lazilyloaded, Map<Object, Object> relationStack) { parseRelations(entity, getEntity(relationEntity), getPersistedRelations(relationEntity), pd, targetEntityMetadata, lazilyloaded, relationStack); // if relation ship is unary, no problem else we need to add setRelationToEntity(entity, relationEntity, relation); }
java
private void onParseRelation(Object entity, final PersistenceDelegator pd, EntityMetadata targetEntityMetadata, Object relationEntity, Relation relation, boolean lazilyloaded, Map<Object, Object> relationStack) { parseRelations(entity, getEntity(relationEntity), getPersistedRelations(relationEntity), pd, targetEntityMetadata, lazilyloaded, relationStack); // if relation ship is unary, no problem else we need to add setRelationToEntity(entity, relationEntity, relation); }
[ "private", "void", "onParseRelation", "(", "Object", "entity", ",", "final", "PersistenceDelegator", "pd", ",", "EntityMetadata", "targetEntityMetadata", ",", "Object", "relationEntity", ",", "Relation", "relation", ",", "boolean", "lazilyloaded", ",", "Map", "<", "...
Invokes parseRelations for relation entity and set relational entity within entity @param entity @param pd @param targetEntityMetadata @param relationEntity @param relation @param lazilyloaded @param relationStack
[ "Invokes", "parseRelations", "for", "relation", "entity", "and", "set", "relational", "entity", "within", "entity" ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/AbstractEntityReader.java#L258-L266
galan/commons
src/main/java/de/galan/commons/util/MessageBox.java
MessageBox.printBox
public static void printBox(String title, String message) { printBox(title, Splitter.on(LINEBREAK).splitToList(message)); }
java
public static void printBox(String title, String message) { printBox(title, Splitter.on(LINEBREAK).splitToList(message)); }
[ "public", "static", "void", "printBox", "(", "String", "title", ",", "String", "message", ")", "{", "printBox", "(", "title", ",", "Splitter", ".", "on", "(", "LINEBREAK", ")", ".", "splitToList", "(", "message", ")", ")", ";", "}" ]
Prints a box with the given title and message to the logger, the title can be omitted.
[ "Prints", "a", "box", "with", "the", "given", "title", "and", "message", "to", "the", "logger", "the", "title", "can", "be", "omitted", "." ]
train
https://github.com/galan/commons/blob/45d2f36c69958d3f847e5fed66603ea629471822/src/main/java/de/galan/commons/util/MessageBox.java#L26-L28
xqbase/util
util/src/main/java/com/xqbase/util/Bytes.java
Bytes.toInt
public static int toInt(byte[] b, int off, boolean littleEndian) { if (littleEndian) { return (b[off] & 0xFF) | ((b[off + 1] & 0xFF) << 8) | ((b[off + 2] & 0xFF) << 16) | ((b[off + 3] & 0xFF) << 24); } return ((b[off] & 0xFF) << 24) | ((b[off + 1] & 0xFF) << 16) | ((b[off + 2] & 0xFF) << 8) | (b[off + 3] & 0xFF); }
java
public static int toInt(byte[] b, int off, boolean littleEndian) { if (littleEndian) { return (b[off] & 0xFF) | ((b[off + 1] & 0xFF) << 8) | ((b[off + 2] & 0xFF) << 16) | ((b[off + 3] & 0xFF) << 24); } return ((b[off] & 0xFF) << 24) | ((b[off + 1] & 0xFF) << 16) | ((b[off + 2] & 0xFF) << 8) | (b[off + 3] & 0xFF); }
[ "public", "static", "int", "toInt", "(", "byte", "[", "]", "b", ",", "int", "off", ",", "boolean", "littleEndian", ")", "{", "if", "(", "littleEndian", ")", "{", "return", "(", "b", "[", "off", "]", "&", "0xFF", ")", "|", "(", "(", "b", "[", "o...
Retrieve an <b>int</b> from a byte array in a given byte order
[ "Retrieve", "an", "<b", ">", "int<", "/", "b", ">", "from", "a", "byte", "array", "in", "a", "given", "byte", "order" ]
train
https://github.com/xqbase/util/blob/e7b9167b6c701b9eec988a9d1e68446cef5ef420/util/src/main/java/com/xqbase/util/Bytes.java#L217-L224
molgenis/molgenis
molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java
EntityTypeValidator.validateBackend
void validateBackend(EntityType entityType) { // Validate backend exists String backendName = entityType.getBackend(); if (!dataService.getMeta().hasBackend(backendName)) { throw new MolgenisValidationException( new ConstraintViolation(format("Unknown backend [%s]", backendName))); } }
java
void validateBackend(EntityType entityType) { // Validate backend exists String backendName = entityType.getBackend(); if (!dataService.getMeta().hasBackend(backendName)) { throw new MolgenisValidationException( new ConstraintViolation(format("Unknown backend [%s]", backendName))); } }
[ "void", "validateBackend", "(", "EntityType", "entityType", ")", "{", "// Validate backend exists", "String", "backendName", "=", "entityType", ".", "getBackend", "(", ")", ";", "if", "(", "!", "dataService", ".", "getMeta", "(", ")", ".", "hasBackend", "(", "...
Validate that the entity meta data backend exists @param entityType entity meta data @throws MolgenisValidationException if the entity meta data backend does not exist
[ "Validate", "that", "the", "entity", "meta", "data", "backend", "exists" ]
train
https://github.com/molgenis/molgenis/blob/b4d0d6b27e6f6c8d7505a3863dc03b589601f987/molgenis-data-validation/src/main/java/org/molgenis/data/validation/meta/EntityTypeValidator.java#L95-L102
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/model/JavacTypes.java
JavacTypes.asMemberOf
public TypeMirror asMemberOf(DeclaredType containing, Element element) { Type site = (Type)containing; Symbol sym = (Symbol)element; if (types.asSuper(site, sym.getEnclosingElement()) == null) throw new IllegalArgumentException(sym + "@" + site); return types.memberType(site, sym); }
java
public TypeMirror asMemberOf(DeclaredType containing, Element element) { Type site = (Type)containing; Symbol sym = (Symbol)element; if (types.asSuper(site, sym.getEnclosingElement()) == null) throw new IllegalArgumentException(sym + "@" + site); return types.memberType(site, sym); }
[ "public", "TypeMirror", "asMemberOf", "(", "DeclaredType", "containing", ",", "Element", "element", ")", "{", "Type", "site", "=", "(", "Type", ")", "containing", ";", "Symbol", "sym", "=", "(", "Symbol", ")", "element", ";", "if", "(", "types", ".", "as...
Returns the type of an element when that element is viewed as a member of, or otherwise directly contained by, a given type. For example, when viewed as a member of the parameterized type {@code Set<String>}, the {@code Set.add} method is an {@code ExecutableType} whose parameter is of type {@code String}. @param containing the containing type @param element the element @return the type of the element as viewed from the containing type @throws IllegalArgumentException if the element is not a valid one for the given type
[ "Returns", "the", "type", "of", "an", "element", "when", "that", "element", "is", "viewed", "as", "a", "member", "of", "or", "otherwise", "directly", "contained", "by", "a", "given", "type", ".", "For", "example", "when", "viewed", "as", "a", "member", "...
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/model/JavacTypes.java#L274-L280
gallandarakhneorg/afc
advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/astar/RoadAStar.java
RoadAStar.solve
public RoadPath solve(RoadConnection startPoint, Point2D<?, ?> endPoint, RoadNetwork network) { assert network != null && startPoint != null && endPoint != null; final RoadSegment endSegment = network.getNearestSegment(endPoint); if (endSegment != null) { final VirtualPoint end = new VirtualPoint(endPoint, endSegment); return solve(startPoint, end); } return null; }
java
public RoadPath solve(RoadConnection startPoint, Point2D<?, ?> endPoint, RoadNetwork network) { assert network != null && startPoint != null && endPoint != null; final RoadSegment endSegment = network.getNearestSegment(endPoint); if (endSegment != null) { final VirtualPoint end = new VirtualPoint(endPoint, endSegment); return solve(startPoint, end); } return null; }
[ "public", "RoadPath", "solve", "(", "RoadConnection", "startPoint", ",", "Point2D", "<", "?", ",", "?", ">", "endPoint", ",", "RoadNetwork", "network", ")", "{", "assert", "network", "!=", "null", "&&", "startPoint", "!=", "null", "&&", "endPoint", "!=", "...
Run the A* algorithm from the nearest segment to <var>startPoint</var> to the nearest segment to <var>endPoint</var>. @param startPoint is the starting point. @param endPoint is the point to reach. @param network is the road network to explore. @return the found path, or <code>null</code> if none found.
[ "Run", "the", "A", "*", "algorithm", "from", "the", "nearest", "segment", "to", "<var", ">", "startPoint<", "/", "var", ">", "to", "the", "nearest", "segment", "to", "<var", ">", "endPoint<", "/", "var", ">", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/astar/RoadAStar.java#L183-L191
Jasig/uPortal
uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceIndividualGroupService.java
ReferenceIndividualGroupService.primGetEntity
protected IEntity primGetEntity(String key, Class type) throws GroupsException { return entityFactory.newInstance(key, type); }
java
protected IEntity primGetEntity(String key, Class type) throws GroupsException { return entityFactory.newInstance(key, type); }
[ "protected", "IEntity", "primGetEntity", "(", "String", "key", ",", "Class", "type", ")", "throws", "GroupsException", "{", "return", "entityFactory", ".", "newInstance", "(", "key", ",", "type", ")", ";", "}" ]
Returns an <code>IEntity</code> representing a portal entity. This does not guarantee that the underlying entity actually exists.
[ "Returns", "an", "<code", ">", "IEntity<", "/", "code", ">", "representing", "a", "portal", "entity", ".", "This", "does", "not", "guarantee", "that", "the", "underlying", "entity", "actually", "exists", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-groups/uPortal-groups-core/src/main/java/org/apereo/portal/groups/ReferenceIndividualGroupService.java#L693-L695
Impetus/Kundera
src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java
ESClient.addDiscriminator
private void addDiscriminator(Map<String, Object> values, EntityType entityType) { String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn(); String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue(); // No need to check for empty or blank, as considering it as valid name // for nosql! if (discrColumn != null && discrValue != null) { values.put(discrColumn, discrValue); } }
java
private void addDiscriminator(Map<String, Object> values, EntityType entityType) { String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn(); String discrValue = ((AbstractManagedType) entityType).getDiscriminatorValue(); // No need to check for empty or blank, as considering it as valid name // for nosql! if (discrColumn != null && discrValue != null) { values.put(discrColumn, discrValue); } }
[ "private", "void", "addDiscriminator", "(", "Map", "<", "String", ",", "Object", ">", "values", ",", "EntityType", "entityType", ")", "{", "String", "discrColumn", "=", "(", "(", "AbstractManagedType", ")", "entityType", ")", ".", "getDiscriminatorColumn", "(", ...
Adds the discriminator. @param values the values @param entityType the entity type
[ "Adds", "the", "discriminator", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESClient.java#L193-L204
Netflix/Hystrix
hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/GetUserAccountCommand.java
GetUserAccountCommand.getFallback
@Override protected UserAccount getFallback() { /* * first 3 come from the HttpCookie * next 3 are stubbed defaults */ return new UserAccount(userCookie.userId, userCookie.name, userCookie.accountType, true, true, true); }
java
@Override protected UserAccount getFallback() { /* * first 3 come from the HttpCookie * next 3 are stubbed defaults */ return new UserAccount(userCookie.userId, userCookie.name, userCookie.accountType, true, true, true); }
[ "@", "Override", "protected", "UserAccount", "getFallback", "(", ")", "{", "/*\n * first 3 come from the HttpCookie\n * next 3 are stubbed defaults\n */", "return", "new", "UserAccount", "(", "userCookie", ".", "userId", ",", "userCookie", ".", "name", ...
Fallback that will use data from the UserCookie and stubbed defaults to create a UserAccount if the network call failed.
[ "Fallback", "that", "will", "use", "data", "from", "the", "UserCookie", "and", "stubbed", "defaults", "to", "create", "a", "UserAccount", "if", "the", "network", "call", "failed", "." ]
train
https://github.com/Netflix/Hystrix/blob/3cb21589895e9f8f87cfcdbc9d96d9f63d48b848/hystrix-examples/src/main/java/com/netflix/hystrix/examples/demo/GetUserAccountCommand.java#L87-L94
iipc/openwayback
wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java
GraphEncoder.decode
public static Graph decode(String encodedGraph, boolean noMonth) throws GraphEncodingException { GraphConfiguration config = new GraphConfiguration(); if(noMonth) { config.valueHighlightColor = config.valueColor; } return decode(encodedGraph, config); }
java
public static Graph decode(String encodedGraph, boolean noMonth) throws GraphEncodingException { GraphConfiguration config = new GraphConfiguration(); if(noMonth) { config.valueHighlightColor = config.valueColor; } return decode(encodedGraph, config); }
[ "public", "static", "Graph", "decode", "(", "String", "encodedGraph", ",", "boolean", "noMonth", ")", "throws", "GraphEncodingException", "{", "GraphConfiguration", "config", "=", "new", "GraphConfiguration", "(", ")", ";", "if", "(", "noMonth", ")", "{", "confi...
convert a String-encoded graph into a usable Graph object, using default GraphConfiguration @param encodedGraph String encoded graph, as returned by getEncoded() @param noMonth if true, disable the month highlight color @return a Graph, ready to use @throws GraphEncodingException if there were problems with the encoded data
[ "convert", "a", "String", "-", "encoded", "graph", "into", "a", "usable", "Graph", "object", "using", "default", "GraphConfiguration" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java#L39-L46
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/AbstractAggregatorImpl.java
AbstractAggregatorImpl.callExtensionInitializers
protected void callExtensionInitializers(Iterable<IAggregatorExtension> extensions, ExtensionRegistrar reg) { final String sourceMethod = "callextensionInitializers"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AbstractAggregatorImpl.class.getName(), sourceMethod, new Object[]{extensions, reg}); } for (IAggregatorExtension extension : extensions) { Object instance = extension.getInstance(); if (instance instanceof IExtensionInitializer) { ((IExtensionInitializer)instance).initialize(this, extension, reg); } } if (isTraceLogging) { log.exiting(AbstractAggregatorImpl.class.getName(), sourceMethod); } }
java
protected void callExtensionInitializers(Iterable<IAggregatorExtension> extensions, ExtensionRegistrar reg) { final String sourceMethod = "callextensionInitializers"; //$NON-NLS-1$ boolean isTraceLogging = log.isLoggable(Level.FINER); if (isTraceLogging) { log.entering(AbstractAggregatorImpl.class.getName(), sourceMethod, new Object[]{extensions, reg}); } for (IAggregatorExtension extension : extensions) { Object instance = extension.getInstance(); if (instance instanceof IExtensionInitializer) { ((IExtensionInitializer)instance).initialize(this, extension, reg); } } if (isTraceLogging) { log.exiting(AbstractAggregatorImpl.class.getName(), sourceMethod); } }
[ "protected", "void", "callExtensionInitializers", "(", "Iterable", "<", "IAggregatorExtension", ">", "extensions", ",", "ExtensionRegistrar", "reg", ")", "{", "final", "String", "sourceMethod", "=", "\"callextensionInitializers\"", ";", "//$NON-NLS-1$\r", "boolean", "isTr...
For each extension specified, call the extension's {@link IExtensionInitializer#initialize} method. Note that this can cause additional extensions to be registered though the {@link ExtensionRegistrar}. @param extensions The list of extensions to initialize @param reg The extension registrar.
[ "For", "each", "extension", "specified", "call", "the", "extension", "s", "{", "@link", "IExtensionInitializer#initialize", "}", "method", ".", "Note", "that", "this", "can", "cause", "additional", "extensions", "to", "be", "registered", "though", "the", "{", "@...
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/AbstractAggregatorImpl.java#L1329-L1344
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Mail.java
Mail.setType
public void setType(String type) throws ApplicationException { type = type.toLowerCase().trim(); if (type.equals("text/plain") || type.equals("plain") || type.equals("text")) getPart().isHTML(false); // mail.setType(lucee.runtime.mail.Mail.TYPE_TEXT); else if (type.equals("text/html") || type.equals("html") || type.equals("htm")) getPart().isHTML(true); else throw new ApplicationException("attribute type of tag mail has an invalid values", "valid values are [plain,text,html] but value is now [" + type + "]"); // throw new ApplicationException(("invalid type "+type); }
java
public void setType(String type) throws ApplicationException { type = type.toLowerCase().trim(); if (type.equals("text/plain") || type.equals("plain") || type.equals("text")) getPart().isHTML(false); // mail.setType(lucee.runtime.mail.Mail.TYPE_TEXT); else if (type.equals("text/html") || type.equals("html") || type.equals("htm")) getPart().isHTML(true); else throw new ApplicationException("attribute type of tag mail has an invalid values", "valid values are [plain,text,html] but value is now [" + type + "]"); // throw new ApplicationException(("invalid type "+type); }
[ "public", "void", "setType", "(", "String", "type", ")", "throws", "ApplicationException", "{", "type", "=", "type", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "type", ".", "equals", "(", "\"text/plain\"", ")", "||", "type", "...
set the value type Specifies extended type attributes for the message. @param type value to set @throws ApplicationException
[ "set", "the", "value", "type", "Specifies", "extended", "type", "attributes", "for", "the", "message", "." ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Mail.java#L279-L286
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CertificatesInner.java
CertificatesInner.createOrUpdateAsync
public Observable<CertificateInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String certificateName, CertificateCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, certificateName, parameters).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() { @Override public CertificateInner call(ServiceResponse<CertificateInner> response) { return response.body(); } }); }
java
public Observable<CertificateInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String certificateName, CertificateCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, certificateName, parameters).map(new Func1<ServiceResponse<CertificateInner>, CertificateInner>() { @Override public CertificateInner call(ServiceResponse<CertificateInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CertificateInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "certificateName", ",", "CertificateCreateOrUpdateParameters", "parameters", ")", "{", "return", "createOr...
Create a certificate. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param certificateName The parameters supplied to the create or update certificate operation. @param parameters The parameters supplied to the create or update certificate operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CertificateInner object
[ "Create", "a", "certificate", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/CertificatesInner.java#L315-L322
hypercube1024/firefly
firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java
ScriptUtils.containsSqlScriptDelimiters
public static boolean containsSqlScriptDelimiters(String script, String delim) { boolean inLiteral = false; char[] content = script.toCharArray(); for (int i = 0; i < script.length(); i++) { if (content[i] == '\'') { inLiteral = !inLiteral; } if (!inLiteral && script.startsWith(delim, i)) { return true; } } return false; }
java
public static boolean containsSqlScriptDelimiters(String script, String delim) { boolean inLiteral = false; char[] content = script.toCharArray(); for (int i = 0; i < script.length(); i++) { if (content[i] == '\'') { inLiteral = !inLiteral; } if (!inLiteral && script.startsWith(delim, i)) { return true; } } return false; }
[ "public", "static", "boolean", "containsSqlScriptDelimiters", "(", "String", "script", ",", "String", "delim", ")", "{", "boolean", "inLiteral", "=", "false", ";", "char", "[", "]", "content", "=", "script", ".", "toCharArray", "(", ")", ";", "for", "(", "...
Does the provided SQL script contain the specified delimiter? @param script the SQL script @param delim String delimiting each statement - typically a ';' character
[ "Does", "the", "provided", "SQL", "script", "contain", "the", "specified", "delimiter?" ]
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly-db/src/main/java/com/firefly/db/init/ScriptUtils.java#L335-L347
bignerdranch/expandable-recycler-view
expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java
ExpandableRecyclerAdapter.onBindViewHolder
@Override @SuppressWarnings("unchecked") @UiThread public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int flatPosition) { if (flatPosition > mFlatItemList.size()) { throw new IllegalStateException("Trying to bind item out of bounds, size " + mFlatItemList.size() + " flatPosition " + flatPosition + ". Was the data changed without a call to notify...()?"); } ExpandableWrapper<P, C> listItem = mFlatItemList.get(flatPosition); if (listItem.isParent()) { PVH parentViewHolder = (PVH) holder; if (parentViewHolder.shouldItemViewClickToggleExpansion()) { parentViewHolder.setMainItemClickToExpand(); } parentViewHolder.setExpanded(listItem.isExpanded()); parentViewHolder.mParent = listItem.getParent(); onBindParentViewHolder(parentViewHolder, getNearestParentPosition(flatPosition), listItem.getParent()); } else { CVH childViewHolder = (CVH) holder; childViewHolder.mChild = listItem.getChild(); onBindChildViewHolder(childViewHolder, getNearestParentPosition(flatPosition), getChildPosition(flatPosition), listItem.getChild()); } }
java
@Override @SuppressWarnings("unchecked") @UiThread public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int flatPosition) { if (flatPosition > mFlatItemList.size()) { throw new IllegalStateException("Trying to bind item out of bounds, size " + mFlatItemList.size() + " flatPosition " + flatPosition + ". Was the data changed without a call to notify...()?"); } ExpandableWrapper<P, C> listItem = mFlatItemList.get(flatPosition); if (listItem.isParent()) { PVH parentViewHolder = (PVH) holder; if (parentViewHolder.shouldItemViewClickToggleExpansion()) { parentViewHolder.setMainItemClickToExpand(); } parentViewHolder.setExpanded(listItem.isExpanded()); parentViewHolder.mParent = listItem.getParent(); onBindParentViewHolder(parentViewHolder, getNearestParentPosition(flatPosition), listItem.getParent()); } else { CVH childViewHolder = (CVH) holder; childViewHolder.mChild = listItem.getChild(); onBindChildViewHolder(childViewHolder, getNearestParentPosition(flatPosition), getChildPosition(flatPosition), listItem.getChild()); } }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "UiThread", "public", "void", "onBindViewHolder", "(", "@", "NonNull", "RecyclerView", ".", "ViewHolder", "holder", ",", "int", "flatPosition", ")", "{", "if", "(", "flatPosition", ">", ...
Implementation of Adapter.onBindViewHolder(RecyclerView.ViewHolder, int) that determines if the list item is a parent or a child and calls through to the appropriate implementation of either {@link #onBindParentViewHolder(ParentViewHolder, int, Parent)} or {@link #onBindChildViewHolder(ChildViewHolder, int, int, Object)}. @param holder The RecyclerView.ViewHolder to bind data to @param flatPosition The index in the merged list of children and parents at which to bind
[ "Implementation", "of", "Adapter", ".", "onBindViewHolder", "(", "RecyclerView", ".", "ViewHolder", "int", ")", "that", "determines", "if", "the", "list", "item", "is", "a", "parent", "or", "a", "child", "and", "calls", "through", "to", "the", "appropriate", ...
train
https://github.com/bignerdranch/expandable-recycler-view/blob/930912510620894c531d236856fa79d646e2f1ed/expandablerecyclerview/src/main/java/com/bignerdranch/expandablerecyclerview/ExpandableRecyclerAdapter.java#L163-L188
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/Types.java
Types.appendArrayGenericType
@ObjectiveCName("appendArrayGenericType:types:") public static void appendArrayGenericType(StringBuilder out, Type[] types) { if (types.length == 0) { return; } appendGenericType(out, types[0]); for (int i = 1; i < types.length; i++) { out.append(','); appendGenericType(out, types[i]); } }
java
@ObjectiveCName("appendArrayGenericType:types:") public static void appendArrayGenericType(StringBuilder out, Type[] types) { if (types.length == 0) { return; } appendGenericType(out, types[0]); for (int i = 1; i < types.length; i++) { out.append(','); appendGenericType(out, types[i]); } }
[ "@", "ObjectiveCName", "(", "\"appendArrayGenericType:types:\"", ")", "public", "static", "void", "appendArrayGenericType", "(", "StringBuilder", "out", ",", "Type", "[", "]", "types", ")", "{", "if", "(", "types", ".", "length", "==", "0", ")", "{", "return",...
Appends names of the {@code types} to {@code out} separated by commas.
[ "Appends", "names", "of", "the", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/Types.java#L120-L130
ontop/ontop
client/protege/src/main/java/it/unibz/inf/ontop/protege/utils/TextMessageFrame.java
TextMessageFrame.initComponents
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setMinimumSize(new java.awt.Dimension(700, 550)); getContentPane().setLayout(new java.awt.GridBagLayout()); jPanel1.setLayout(new java.awt.GridBagLayout()); jTextArea1.setColumns(20); jTextArea1.setEditable(false); jTextArea1.setRows(5); jTextArea1.setWrapStyleWord(true); jTextArea1.setBackground(Color.white); jTextArea1.setFont(new Font("Dialog", Font.PLAIN, 12)); jScrollPane1.setViewportView(jTextArea1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel1.add(jScrollPane1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipady = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; jPanel1.add(jLabel1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(jPanel1, gridBagConstraints); jButton1.setText("close"); jButton1.setMinimumSize(new java.awt.Dimension(60, 29)); jButton1.setPreferredSize(new java.awt.Dimension(75, 29)); jButton1.setRolloverEnabled(false); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; getContentPane().add(jButton1, gridBagConstraints); pack(); }
java
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jPanel1 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTextArea1 = new javax.swing.JTextArea(); jLabel1 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setMinimumSize(new java.awt.Dimension(700, 550)); getContentPane().setLayout(new java.awt.GridBagLayout()); jPanel1.setLayout(new java.awt.GridBagLayout()); jTextArea1.setColumns(20); jTextArea1.setEditable(false); jTextArea1.setRows(5); jTextArea1.setWrapStyleWord(true); jTextArea1.setBackground(Color.white); jTextArea1.setFont(new Font("Dialog", Font.PLAIN, 12)); jScrollPane1.setViewportView(jTextArea1); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jPanel1.add(jScrollPane1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.ipady = 5; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; jPanel1.add(jLabel1, gridBagConstraints); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.ipadx = 20; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(jPanel1, gridBagConstraints); jButton1.setText("close"); jButton1.setMinimumSize(new java.awt.Dimension(60, 29)); jButton1.setPreferredSize(new java.awt.Dimension(75, 29)); jButton1.setRolloverEnabled(false); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; getContentPane().add(jButton1, gridBagConstraints); pack(); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "// <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents", "private", "void", "initComponents", "(", ")", "{", "java", ".", "awt", ".", "GridBagConstraints", "gridBagConstraints", ";", "jP...
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
[ "This", "method", "is", "called", "from", "within", "the", "constructor", "to", "initialize", "the", "form", ".", "WARNING", ":", "Do", "NOT", "modify", "this", "code", ".", "The", "content", "of", "this", "method", "is", "always", "regenerated", "by", "th...
train
https://github.com/ontop/ontop/blob/ddf78b26981b6129ee9a1a59310016830f5352e4/client/protege/src/main/java/it/unibz/inf/ontop/protege/utils/TextMessageFrame.java#L56-L124
pvanassen/ns-api
src/main/java/nl/pvanassen/ns/RequestBuilder.java
RequestBuilder.getPrijzen
public static ApiRequest<Prijzen> getPrijzen(String fromStation, String toStation) { return RequestBuilder.getPrijzen(fromStation, toStation, null, null); }
java
public static ApiRequest<Prijzen> getPrijzen(String fromStation, String toStation) { return RequestBuilder.getPrijzen(fromStation, toStation, null, null); }
[ "public", "static", "ApiRequest", "<", "Prijzen", ">", "getPrijzen", "(", "String", "fromStation", ",", "String", "toStation", ")", "{", "return", "RequestBuilder", ".", "getPrijzen", "(", "fromStation", ",", "toStation", ",", "null", ",", "null", ")", ";", ...
Builds a request to get all fares for a ride between station from, to station to. See <a href="http://www.ns.nl/api/api#api-documentatie-prijzen">prijzen</a> @param fromStation Starting point of the trip @param toStation End point of the trip @return Request for getting the fares
[ "Builds", "a", "request", "to", "get", "all", "fares", "for", "a", "ride", "between", "station", "from", "to", "station", "to", ".", "See", "<a", "href", "=", "http", ":", "//", "www", ".", "ns", ".", "nl", "/", "api", "/", "api#api", "-", "documen...
train
https://github.com/pvanassen/ns-api/blob/e90e01028a0eb24006e4fddd4c85e7a25c4fe0ae/src/main/java/nl/pvanassen/ns/RequestBuilder.java#L96-L98
k3po/k3po
specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java
Functions.generateMIC
@Function public static byte[] generateMIC(GSSContext context, MessageProp prop, byte[] message) { try { // Ensure the default Quality-of-Protection is applied. prop.setQOP(0); byte[] initialToken = context.getMIC(message, 0, message.length, prop); return getTokenWithLengthPrefix(initialToken); } catch (GSSException ex) { throw new RuntimeException("Exception generating MIC for message", ex); } }
java
@Function public static byte[] generateMIC(GSSContext context, MessageProp prop, byte[] message) { try { // Ensure the default Quality-of-Protection is applied. prop.setQOP(0); byte[] initialToken = context.getMIC(message, 0, message.length, prop); return getTokenWithLengthPrefix(initialToken); } catch (GSSException ex) { throw new RuntimeException("Exception generating MIC for message", ex); } }
[ "@", "Function", "public", "static", "byte", "[", "]", "generateMIC", "(", "GSSContext", "context", ",", "MessageProp", "prop", ",", "byte", "[", "]", "message", ")", "{", "try", "{", "// Ensure the default Quality-of-Protection is applied.", "prop", ".", "setQOP"...
Generate a message integrity check for a given received message. @param context GSSContext for which a connection has been established to the remote peer @param prop the MessageProp used for exchanging messages @param message the bytes of the received message @return the bytes of the message integrity check (like a checksum) that is sent to a peer for verifying that the message was received correctly
[ "Generate", "a", "message", "integrity", "check", "for", "a", "given", "received", "message", "." ]
train
https://github.com/k3po/k3po/blob/3ca4fd31ab4a397893aa640c62ada0e485c8bbd4/specification/socks5/src/main/java/org/kaazing/specification/socks5/internal/Functions.java#L242-L254
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/util/ErrorUtil.java
ErrorUtil.fatalError
public static void fatalError(Throwable error, String path) { StringWriter msg = new StringWriter(); PrintWriter writer = new PrintWriter(msg); writer.println(String.format("internal error translating \"%s\"", path)); error.printStackTrace(writer); writer.flush(); error(msg.toString()); }
java
public static void fatalError(Throwable error, String path) { StringWriter msg = new StringWriter(); PrintWriter writer = new PrintWriter(msg); writer.println(String.format("internal error translating \"%s\"", path)); error.printStackTrace(writer); writer.flush(); error(msg.toString()); }
[ "public", "static", "void", "fatalError", "(", "Throwable", "error", ",", "String", "path", ")", "{", "StringWriter", "msg", "=", "new", "StringWriter", "(", ")", ";", "PrintWriter", "writer", "=", "new", "PrintWriter", "(", "msg", ")", ";", "writer", ".",...
Report that an internal error happened when translating a specific source.
[ "Report", "that", "an", "internal", "error", "happened", "when", "translating", "a", "specific", "source", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/ErrorUtil.java#L161-L168
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java
EventListenerSupport.addListener
public void addListener(final L listener, final boolean allowDuplicate) { Validate.notNull(listener, "Listener object cannot be null."); if (allowDuplicate) { listeners.add(listener); } else if (!listeners.contains(listener)) { listeners.add(listener); } }
java
public void addListener(final L listener, final boolean allowDuplicate) { Validate.notNull(listener, "Listener object cannot be null."); if (allowDuplicate) { listeners.add(listener); } else if (!listeners.contains(listener)) { listeners.add(listener); } }
[ "public", "void", "addListener", "(", "final", "L", "listener", ",", "final", "boolean", "allowDuplicate", ")", "{", "Validate", ".", "notNull", "(", "listener", ",", "\"Listener object cannot be null.\"", ")", ";", "if", "(", "allowDuplicate", ")", "{", "listen...
Registers an event listener. Will not add a pre-existing listener object to the list if <code>allowDuplicate</code> is false. @param listener the event listener (may not be <code>null</code>). @param allowDuplicate the flag for determining if duplicate listener objects are allowed to be registered. @throws NullPointerException if <code>listener</code> is <code>null</code>. @since 3.5
[ "Registers", "an", "event", "listener", ".", "Will", "not", "add", "a", "pre", "-", "existing", "listener", "object", "to", "the", "list", "if", "<code", ">", "allowDuplicate<", "/", "code", ">", "is", "false", "." ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/event/EventListenerSupport.java#L199-L206
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/base/Preconditions.java
Preconditions.checkState
public static void checkState(boolean b, String message, Object... args) { if (!b) { throwStateEx(message, args); } }
java
public static void checkState(boolean b, String message, Object... args) { if (!b) { throwStateEx(message, args); } }
[ "public", "static", "void", "checkState", "(", "boolean", "b", ",", "String", "message", ",", "Object", "...", "args", ")", "{", "if", "(", "!", "b", ")", "{", "throwStateEx", "(", "message", ",", "args", ")", ";", "}", "}" ]
Check the specified boolean argument. Throws an IllegalStateException with the specified message if {@code b} is false. Note that the message may specify argument locations using "%s" - for example, {@code checkArgument(false, "Got %s values, expected %s", 3, "more"} would throw an IllegalStateException with the message "Got 3 values, expected more" @param b Argument to check @param message Message for exception. May be null. @param args Arguments to place in message
[ "Check", "the", "specified", "boolean", "argument", ".", "Throws", "an", "IllegalStateException", "with", "the", "specified", "message", "if", "{", "@code", "b", "}", "is", "false", ".", "Note", "that", "the", "message", "may", "specify", "argument", "location...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-common/src/main/java/org/nd4j/base/Preconditions.java#L444-L448
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/common/lib/auth/AuthorizationHeaderProvider.java
AuthorizationHeaderProvider.getOAuth2Header
private String getOAuth2Header(OAuth2Compatible oAuth2Compatible) throws OAuthException { if (adsLibConfiguration.isAutoRefreshOAuth2TokenEnabled()) { try { oAuth2Helper.refreshCredential(oAuth2Compatible.getOAuth2Credential()); } catch (IOException e) { throw new OAuthException("OAuth2 token could not be refreshed.", e); } } return oAuth2AuthorizationHeaderProvider.getOAuth2AuthorizationHeader(oAuth2Compatible); }
java
private String getOAuth2Header(OAuth2Compatible oAuth2Compatible) throws OAuthException { if (adsLibConfiguration.isAutoRefreshOAuth2TokenEnabled()) { try { oAuth2Helper.refreshCredential(oAuth2Compatible.getOAuth2Credential()); } catch (IOException e) { throw new OAuthException("OAuth2 token could not be refreshed.", e); } } return oAuth2AuthorizationHeaderProvider.getOAuth2AuthorizationHeader(oAuth2Compatible); }
[ "private", "String", "getOAuth2Header", "(", "OAuth2Compatible", "oAuth2Compatible", ")", "throws", "OAuthException", "{", "if", "(", "adsLibConfiguration", ".", "isAutoRefreshOAuth2TokenEnabled", "(", ")", ")", "{", "try", "{", "oAuth2Helper", ".", "refreshCredential",...
Gets the OAuth2 header. @throws OAuthException if the OAuth2 token could not be refreshed.
[ "Gets", "the", "OAuth2", "header", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/auth/AuthorizationHeaderProvider.java#L86-L96
hawkular/hawkular-commons
hawkular-inventory-parent/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/model/Resource.java
Resource.fromRaw
public static Resource fromRaw(RawResource r, Function<String, Optional<ResourceType>> rtLoader) { return new Resource(r.getId(), r.getName(), r.getFeedId(), rtLoader.apply(r.getTypeId()).orElse(null), r.getParentId(), r.getMetrics(), r.getProperties(), r.getConfig()); }
java
public static Resource fromRaw(RawResource r, Function<String, Optional<ResourceType>> rtLoader) { return new Resource(r.getId(), r.getName(), r.getFeedId(), rtLoader.apply(r.getTypeId()).orElse(null), r.getParentId(), r.getMetrics(), r.getProperties(), r.getConfig()); }
[ "public", "static", "Resource", "fromRaw", "(", "RawResource", "r", ",", "Function", "<", "String", ",", "Optional", "<", "ResourceType", ">", ">", "rtLoader", ")", "{", "return", "new", "Resource", "(", "r", ".", "getId", "(", ")", ",", "r", ".", "get...
Converts {@link RawResource} into {@link Resource} using loader for {@link ResourceType}. The children are not loaded. @param r the resource to convert @param rtLoader loader for {@link ResourceType} @return the node without its subtree
[ "Converts", "{" ]
train
https://github.com/hawkular/hawkular-commons/blob/e4a832862b3446d7f4d629bb05790f2df578e035/hawkular-inventory-parent/hawkular-inventory-api/src/main/java/org/hawkular/inventory/api/model/Resource.java#L112-L115
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/Muxer.java
Muxer.writeSampleData
public void writeSampleData(MediaCodec encoder, int trackIndex, int bufferIndex, ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo){ if ((bufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) { signalEndOfTrack(); } }
java
public void writeSampleData(MediaCodec encoder, int trackIndex, int bufferIndex, ByteBuffer encodedData, MediaCodec.BufferInfo bufferInfo){ if ((bufferInfo.flags & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0) { signalEndOfTrack(); } }
[ "public", "void", "writeSampleData", "(", "MediaCodec", "encoder", ",", "int", "trackIndex", ",", "int", "bufferIndex", ",", "ByteBuffer", "encodedData", ",", "MediaCodec", ".", "BufferInfo", "bufferInfo", ")", "{", "if", "(", "(", "bufferInfo", ".", "flags", ...
Write the MediaCodec output buffer. This method <b>must</b> be overridden by subclasses to release encodedData, transferring ownership back to encoder, by calling encoder.releaseOutputBuffer(bufferIndex, false); @param trackIndex @param encodedData @param bufferInfo
[ "Write", "the", "MediaCodec", "output", "buffer", ".", "This", "method", "<b", ">", "must<", "/", "b", ">", "be", "overridden", "by", "subclasses", "to", "release", "encodedData", "transferring", "ownership", "back", "to", "encoder", "by", "calling", "encoder"...
train
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Muxer.java#L103-L107
OpenLiberty/open-liberty
dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java
ConfigElementList.getBy
public E getBy(String attributeName, String attributeValue) { String methodName = "get" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1); for (E element : this) if (element != null) try { Object value = element.getClass().getMethod(methodName).invoke(element); if (value == attributeValue || value != null && value.equals(attributeValue)) return element; } catch (Exception x) { } return null; }
java
public E getBy(String attributeName, String attributeValue) { String methodName = "get" + Character.toUpperCase(attributeName.charAt(0)) + attributeName.substring(1); for (E element : this) if (element != null) try { Object value = element.getClass().getMethod(methodName).invoke(element); if (value == attributeValue || value != null && value.equals(attributeValue)) return element; } catch (Exception x) { } return null; }
[ "public", "E", "getBy", "(", "String", "attributeName", ",", "String", "attributeValue", ")", "{", "String", "methodName", "=", "\"get\"", "+", "Character", ".", "toUpperCase", "(", "attributeName", ".", "charAt", "(", "0", ")", ")", "+", "attributeName", "....
Returns the first element in this list with a matching attribute value. @param attributeName the attribute for which to search (Example: jndiName) @param attributeValue the value to match @return the first element in this list with a matching attribute name/value, or null of no such element is found
[ "Returns", "the", "first", "element", "in", "this", "list", "with", "a", "matching", "attribute", "value", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.app.manager.springboot/src/com/ibm/ws/app/manager/springboot/container/config/ConfigElementList.java#L69-L80
gallandarakhneorg/afc
advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java
XMLRoadUtil.readRoadSegment
public static RoadSegment readRoadSegment(Element element, PathBuilder pathBuilder, XMLResources resources) throws IOException { return readRoadPolyline(element, pathBuilder, resources); }
java
public static RoadSegment readRoadSegment(Element element, PathBuilder pathBuilder, XMLResources resources) throws IOException { return readRoadPolyline(element, pathBuilder, resources); }
[ "public", "static", "RoadSegment", "readRoadSegment", "(", "Element", "element", ",", "PathBuilder", "pathBuilder", ",", "XMLResources", "resources", ")", "throws", "IOException", "{", "return", "readRoadPolyline", "(", "element", ",", "pathBuilder", ",", "resources",...
Read a road from the XML description. @param element is the XML node to read. @param pathBuilder is the tool to make paths absolute. @param resources is the tool that permits to gather the resources. @return the road. @throws IOException in case of error.
[ "Read", "a", "road", "from", "the", "XML", "description", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadinputoutput/src/main/java/org/arakhne/afc/gis/road/io/XMLRoadUtil.java#L129-L132
finmath/finmath-lib
src/main/java6/net/finmath/montecarlo/interestrate/products/BermudanSwaption.java
BermudanSwaption.getValue
@Override public RandomVariableInterface getValue(double evaluationTime, LIBORModelMonteCarloSimulationInterface model) throws CalculationException { return (RandomVariableInterface) getValues(evaluationTime, model).get("value"); }
java
@Override public RandomVariableInterface getValue(double evaluationTime, LIBORModelMonteCarloSimulationInterface model) throws CalculationException { return (RandomVariableInterface) getValues(evaluationTime, model).get("value"); }
[ "@", "Override", "public", "RandomVariableInterface", "getValue", "(", "double", "evaluationTime", ",", "LIBORModelMonteCarloSimulationInterface", "model", ")", "throws", "CalculationException", "{", "return", "(", "RandomVariableInterface", ")", "getValues", "(", "evaluati...
This method returns the value random variable of the product within the specified model, evaluated at a given evalutationTime. Note: For a lattice this is often the value conditional to evalutationTime, for a Monte-Carlo simulation this is the (sum of) value discounted to evaluation time. Cashflows prior evaluationTime are not considered. @param evaluationTime The time on which this products value should be observed. @param model The model used to price the product. @return The random variable representing the value of the product discounted to evaluation time @throws net.finmath.exception.CalculationException Thrown if the valuation fails, specific cause may be available via the <code>cause()</code> method.
[ "This", "method", "returns", "the", "value", "random", "variable", "of", "the", "product", "within", "the", "specified", "model", "evaluated", "at", "a", "given", "evalutationTime", ".", "Note", ":", "For", "a", "lattice", "this", "is", "often", "the", "valu...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java6/net/finmath/montecarlo/interestrate/products/BermudanSwaption.java#L147-L150
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java
Inet6Address.getByAddress
public static Inet6Address getByAddress(String host, byte[] addr, int scope_id) throws UnknownHostException { if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); } } if (addr != null) { if (addr.length == Inet6Address.INADDRSZ) { return new Inet6Address(host, addr, scope_id); } } throw new UnknownHostException("addr is of illegal length"); }
java
public static Inet6Address getByAddress(String host, byte[] addr, int scope_id) throws UnknownHostException { if (host != null && host.length() > 0 && host.charAt(0) == '[') { if (host.charAt(host.length()-1) == ']') { host = host.substring(1, host.length() -1); } } if (addr != null) { if (addr.length == Inet6Address.INADDRSZ) { return new Inet6Address(host, addr, scope_id); } } throw new UnknownHostException("addr is of illegal length"); }
[ "public", "static", "Inet6Address", "getByAddress", "(", "String", "host", ",", "byte", "[", "]", "addr", ",", "int", "scope_id", ")", "throws", "UnknownHostException", "{", "if", "(", "host", "!=", "null", "&&", "host", ".", "length", "(", ")", ">", "0"...
Create an Inet6Address in the exact manner of {@link InetAddress#getByAddress(String,byte[])} except that the IPv6 scope_id is set to the given numeric value. The scope_id is not checked to determine if it corresponds to any interface on the system. See <a href="Inet6Address.html#scoped">here</a> for a description of IPv6 scoped addresses. @param host the specified host @param addr the raw IP address in network byte order @param scope_id the numeric scope_id for the address. @return an Inet6Address object created from the raw IP address. @exception UnknownHostException if IP address is of illegal length. @since 1.5
[ "Create", "an", "Inet6Address", "in", "the", "exact", "manner", "of", "{", "@link", "InetAddress#getByAddress", "(", "String", "byte", "[]", ")", "}", "except", "that", "the", "IPv6", "scope_id", "is", "set", "to", "the", "given", "numeric", "value", ".", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java#L320-L333
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/TimeLimitDaemon.java
TimeLimitDaemon.valueWasRemoved
public void valueWasRemoved(DCache cache, Object id) { //final String methodName = "valueWasRemoved()"; if ( UNIT_TEST_INACTIVITY ) { System.out.println("valueWasRemoved() - entry"); } ExpirationMetaData expirationMetaData = (ExpirationMetaData)cacheInstancesTable.get(cache); if (expirationMetaData == null) { return; } synchronized (expirationMetaData) { InvalidationTask it = (InvalidationTask) expirationMetaData.expirationTable.remove(id); if (it != null) { expirationMetaData.timeLimitHeap.delete(it); it.reset(); taskPool.add(it); //traceDebug(methodName, "cacheName=" + cache.cacheName + " id=" + id + " expirationTableSize=" + expirationMetaData.expirationTable.size() + " timeLimitHeapSize=" + expirationMetaData.timeLimitHeap.size()); } } }
java
public void valueWasRemoved(DCache cache, Object id) { //final String methodName = "valueWasRemoved()"; if ( UNIT_TEST_INACTIVITY ) { System.out.println("valueWasRemoved() - entry"); } ExpirationMetaData expirationMetaData = (ExpirationMetaData)cacheInstancesTable.get(cache); if (expirationMetaData == null) { return; } synchronized (expirationMetaData) { InvalidationTask it = (InvalidationTask) expirationMetaData.expirationTable.remove(id); if (it != null) { expirationMetaData.timeLimitHeap.delete(it); it.reset(); taskPool.add(it); //traceDebug(methodName, "cacheName=" + cache.cacheName + " id=" + id + " expirationTableSize=" + expirationMetaData.expirationTable.size() + " timeLimitHeapSize=" + expirationMetaData.timeLimitHeap.size()); } } }
[ "public", "void", "valueWasRemoved", "(", "DCache", "cache", ",", "Object", "id", ")", "{", "//final String methodName = \"valueWasRemoved()\";", "if", "(", "UNIT_TEST_INACTIVITY", ")", "{", "System", ".", "out", ".", "println", "(", "\"valueWasRemoved() - entry\"", "...
This notifies this daemon that an entry has removed, It removes the entry from the internal tables. @param cache The cache instance. @param id The cache id.
[ "This", "notifies", "this", "daemon", "that", "an", "entry", "has", "removed", "It", "removes", "the", "entry", "from", "the", "internal", "tables", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/TimeLimitDaemon.java#L277-L295
bi-geek/flink-connector-ethereum
src/main/java/com/bigeek/flink/utils/EthereumWrapper.java
EthereumWrapper.configureInstance
public static Web3j configureInstance(String address, Long timeout) { web3jInstance = EthereumUtils.generateClient(address, timeout); return web3jInstance; }
java
public static Web3j configureInstance(String address, Long timeout) { web3jInstance = EthereumUtils.generateClient(address, timeout); return web3jInstance; }
[ "public", "static", "Web3j", "configureInstance", "(", "String", "address", ",", "Long", "timeout", ")", "{", "web3jInstance", "=", "EthereumUtils", ".", "generateClient", "(", "address", ",", "timeout", ")", ";", "return", "web3jInstance", ";", "}" ]
Get instance with parameters. @param address @param timeout @return web3j client
[ "Get", "instance", "with", "parameters", "." ]
train
https://github.com/bi-geek/flink-connector-ethereum/blob/9ecedbf999fc410e50225c3f69b5041df4c61a33/src/main/java/com/bigeek/flink/utils/EthereumWrapper.java#L19-L22
apache/incubator-druid
processing/src/main/java/org/apache/druid/query/filter/DimFilterUtils.java
DimFilterUtils.filterShards
public static <T> Set<T> filterShards(DimFilter dimFilter, Iterable<T> input, Function<T, ShardSpec> converter) { return filterShards(dimFilter, input, converter, new HashMap<String, Optional<RangeSet<String>>>()); }
java
public static <T> Set<T> filterShards(DimFilter dimFilter, Iterable<T> input, Function<T, ShardSpec> converter) { return filterShards(dimFilter, input, converter, new HashMap<String, Optional<RangeSet<String>>>()); }
[ "public", "static", "<", "T", ">", "Set", "<", "T", ">", "filterShards", "(", "DimFilter", "dimFilter", ",", "Iterable", "<", "T", ">", "input", ",", "Function", "<", "T", ",", "ShardSpec", ">", "converter", ")", "{", "return", "filterShards", "(", "di...
Filter the given iterable of objects by removing any object whose ShardSpec, obtained from the converter function, does not fit in the RangeSet of the dimFilter {@link DimFilter#getDimensionRangeSet(String)}. The returned set contains the filtered objects in the same order as they appear in input. If you plan to call this multiple times with the same dimFilter, consider using {@link #filterShards(DimFilter, Iterable, Function, Map)} instead with a cached map @param dimFilter The filter to use @param input The iterable of objects to be filtered @param converter The function to convert T to ShardSpec that can be filtered by @param <T> This can be any type, as long as transform function is provided to convert this to ShardSpec @return The set of filtered object, in the same order as input
[ "Filter", "the", "given", "iterable", "of", "objects", "by", "removing", "any", "object", "whose", "ShardSpec", "obtained", "from", "the", "converter", "function", "does", "not", "fit", "in", "the", "RangeSet", "of", "the", "dimFilter", "{", "@link", "DimFilte...
train
https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/processing/src/main/java/org/apache/druid/query/filter/DimFilterUtils.java#L95-L98
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/AliasedDiscoveryConfig.java
AliasedDiscoveryConfig.setProperty
public T setProperty(String name, String value) { if (USE_PUBLIC_IP_PROPERTY.equals(name)) { usePublicIp = Boolean.parseBoolean(value); } else if (ENABLED_PROPERTY.equals(name)) { enabled = Boolean.parseBoolean(value); } else { properties.put(name, value); } return (T) this; }
java
public T setProperty(String name, String value) { if (USE_PUBLIC_IP_PROPERTY.equals(name)) { usePublicIp = Boolean.parseBoolean(value); } else if (ENABLED_PROPERTY.equals(name)) { enabled = Boolean.parseBoolean(value); } else { properties.put(name, value); } return (T) this; }
[ "public", "T", "setProperty", "(", "String", "name", ",", "String", "value", ")", "{", "if", "(", "USE_PUBLIC_IP_PROPERTY", ".", "equals", "(", "name", ")", ")", "{", "usePublicIp", "=", "Boolean", ".", "parseBoolean", "(", "value", ")", ";", "}", "else"...
Sets the property understood by the given SPI Discovery Strategy. <p> Note that it interprets and stores as fields the following properties: "enabled", "use-public-ip". @param name property name @param value property value @return the updated discovery config
[ "Sets", "the", "property", "understood", "by", "the", "given", "SPI", "Discovery", "Strategy", ".", "<p", ">", "Note", "that", "it", "interprets", "and", "stores", "as", "fields", "the", "following", "properties", ":", "enabled", "use", "-", "public", "-", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/AliasedDiscoveryConfig.java#L85-L94
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java
ConstructState.addConstructState
public void addConstructState(Constructs construct, ConstructState constructState, String infix) { addConstructState(construct, constructState, Optional.of(infix)); }
java
public void addConstructState(Constructs construct, ConstructState constructState, String infix) { addConstructState(construct, constructState, Optional.of(infix)); }
[ "public", "void", "addConstructState", "(", "Constructs", "construct", ",", "ConstructState", "constructState", ",", "String", "infix", ")", "{", "addConstructState", "(", "construct", ",", "constructState", ",", "Optional", ".", "of", "(", "infix", ")", ")", ";...
See {@link #addConstructState(Constructs, ConstructState, Optional)}. This is a convenience method to pass a String infix.
[ "See", "{" ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/state/ConstructState.java#L90-L92
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java
SuspiciousClusteredSessionSupport.visitCode
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); changedAttributes.clear(); savedAttributes.clear(); super.visitCode(obj); for (Integer pc : changedAttributes.values()) { bugReporter.reportBug(new BugInstance(this, BugType.SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT.name(), NORMAL_PRIORITY).addClass(this) .addMethod(this).addSourceLine(this, pc.intValue())); } }
java
@Override public void visitCode(Code obj) { stack.resetForMethodEntry(this); changedAttributes.clear(); savedAttributes.clear(); super.visitCode(obj); for (Integer pc : changedAttributes.values()) { bugReporter.reportBug(new BugInstance(this, BugType.SCSS_SUSPICIOUS_CLUSTERED_SESSION_SUPPORT.name(), NORMAL_PRIORITY).addClass(this) .addMethod(this).addSourceLine(this, pc.intValue())); } }
[ "@", "Override", "public", "void", "visitCode", "(", "Code", "obj", ")", "{", "stack", ".", "resetForMethodEntry", "(", "this", ")", ";", "changedAttributes", ".", "clear", "(", ")", ";", "savedAttributes", ".", "clear", "(", ")", ";", "super", ".", "vis...
implements the visitor to report on attributes that have changed, without a setAttribute being called on them @param obj the currently parsed method
[ "implements", "the", "visitor", "to", "report", "on", "attributes", "that", "have", "changed", "without", "a", "setAttribute", "being", "called", "on", "them" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SuspiciousClusteredSessionSupport.java#L86-L96
liyiorg/weixin-popular
src/main/java/weixin/popular/api/MessageAPI.java
MessageAPI.messageMassSendall
public static MessageSendResult messageMassSendall(String access_token, MassMessage massMessage) { String str = JsonUtil.toJSONString(massMessage); return messageMassSendall(access_token, str); }
java
public static MessageSendResult messageMassSendall(String access_token, MassMessage massMessage) { String str = JsonUtil.toJSONString(massMessage); return messageMassSendall(access_token, str); }
[ "public", "static", "MessageSendResult", "messageMassSendall", "(", "String", "access_token", ",", "MassMessage", "massMessage", ")", "{", "String", "str", "=", "JsonUtil", ".", "toJSONString", "(", "massMessage", ")", ";", "return", "messageMassSendall", "(", "acce...
高级群发接口 根据 分组或标签 进行群发 @param access_token access_token @param massMessage massMessage @return MessageSendResult
[ "高级群发接口", "根据", "分组或标签", "进行群发" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/MessageAPI.java#L151-L154
anotheria/moskito
moskito-webui/src/main/java/net/anotheria/moskito/webui/shared/action/BaseAJAXMoskitoUIAction.java
BaseAJAXMoskitoUIAction.invokeExecute
protected void invokeExecute(final ActionMapping mapping, final FormBean bean, final HttpServletRequest req, final HttpServletResponse res, final JSONResponse jsonResponse) throws Exception { }
java
protected void invokeExecute(final ActionMapping mapping, final FormBean bean, final HttpServletRequest req, final HttpServletResponse res, final JSONResponse jsonResponse) throws Exception { }
[ "protected", "void", "invokeExecute", "(", "final", "ActionMapping", "mapping", ",", "final", "FormBean", "bean", ",", "final", "HttpServletRequest", "req", ",", "final", "HttpServletResponse", "res", ",", "final", "JSONResponse", "jsonResponse", ")", "throws", "Exc...
Override this method for invoking main action code. @param mapping - action mapping @param bean - bean @param req - request @param res - response @param jsonResponse - JSON Response @throws Exception on errors
[ "Override", "this", "method", "for", "invoking", "main", "action", "code", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-webui/src/main/java/net/anotheria/moskito/webui/shared/action/BaseAJAXMoskitoUIAction.java#L83-L86
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.license_virtuozzo_new_duration_POST
public OvhOrder license_virtuozzo_new_duration_POST(String duration, OvhOrderableVirtuozzoContainerNumberEnum containerNumber, String ip, OvhLicenseTypeEnum serviceType, OvhOrderableVirtuozzoVersionEnum version) throws IOException { String qPath = "/order/license/virtuozzo/new/{duration}"; StringBuilder sb = path(qPath, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "containerNumber", containerNumber); addBody(o, "ip", ip); addBody(o, "serviceType", serviceType); addBody(o, "version", version); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder license_virtuozzo_new_duration_POST(String duration, OvhOrderableVirtuozzoContainerNumberEnum containerNumber, String ip, OvhLicenseTypeEnum serviceType, OvhOrderableVirtuozzoVersionEnum version) throws IOException { String qPath = "/order/license/virtuozzo/new/{duration}"; StringBuilder sb = path(qPath, duration); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "containerNumber", containerNumber); addBody(o, "ip", ip); addBody(o, "serviceType", serviceType); addBody(o, "version", version); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "license_virtuozzo_new_duration_POST", "(", "String", "duration", ",", "OvhOrderableVirtuozzoContainerNumberEnum", "containerNumber", ",", "String", "ip", ",", "OvhLicenseTypeEnum", "serviceType", ",", "OvhOrderableVirtuozzoVersionEnum", "version", ")", "t...
Create order REST: POST /order/license/virtuozzo/new/{duration} @param version [required] This license version @param ip [required] Ip on which this license would be installed @param containerNumber [required] How much container is this license able to manage ... @param serviceType [required] # DEPRECATED # The kind of service on which this license will be used # Will not be used, keeped only for compatibility # @param duration [required] Duration
[ "Create", "order" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L1138-L1148
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.setTime
public static void setTime(Calendar cal, Date time) { if (time != null) { Calendar startCalendar = popCalendar(time); cal.set(Calendar.HOUR_OF_DAY, startCalendar.get(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, startCalendar.get(Calendar.MINUTE)); cal.set(Calendar.SECOND, startCalendar.get(Calendar.SECOND)); pushCalendar(startCalendar); } }
java
public static void setTime(Calendar cal, Date time) { if (time != null) { Calendar startCalendar = popCalendar(time); cal.set(Calendar.HOUR_OF_DAY, startCalendar.get(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, startCalendar.get(Calendar.MINUTE)); cal.set(Calendar.SECOND, startCalendar.get(Calendar.SECOND)); pushCalendar(startCalendar); } }
[ "public", "static", "void", "setTime", "(", "Calendar", "cal", ",", "Date", "time", ")", "{", "if", "(", "time", "!=", "null", ")", "{", "Calendar", "startCalendar", "=", "popCalendar", "(", "time", ")", ";", "cal", ".", "set", "(", "Calendar", ".", ...
Given a date represented by a Calendar instance, set the time component of the date based on the hours and minutes of the time supplied by the Date instance. @param cal Calendar instance representing the date @param time Date instance representing the time of day
[ "Given", "a", "date", "represented", "by", "a", "Calendar", "instance", "set", "the", "time", "component", "of", "the", "date", "based", "on", "the", "hours", "and", "minutes", "of", "the", "time", "supplied", "by", "the", "Date", "instance", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L337-L347
landawn/AbacusUtil
src/com/landawn/abacus/util/MongoDB.java
MongoDB.registerIdProeprty
public static void registerIdProeprty(final Class<?> cls, final String idPropertyName) { if (ClassUtil.getPropGetMethod(cls, idPropertyName) == null || ClassUtil.getPropSetMethod(cls, idPropertyName) == null) { throw new IllegalArgumentException("The specified class: " + ClassUtil.getCanonicalClassName(cls) + " doesn't have getter or setter method for the specified id propery: " + idPropertyName); } final Method setMethod = ClassUtil.getPropSetMethod(cls, idPropertyName); final Class<?> parameterType = setMethod.getParameterTypes()[0]; if (!(String.class.isAssignableFrom(parameterType) || ObjectId.class.isAssignableFrom(parameterType))) { throw new IllegalArgumentException( "The parameter type of the specified id setter method must be 'String' or 'ObjectId': " + setMethod.toGenericString()); } classIdSetMethodPool.put(cls, setMethod); }
java
public static void registerIdProeprty(final Class<?> cls, final String idPropertyName) { if (ClassUtil.getPropGetMethod(cls, idPropertyName) == null || ClassUtil.getPropSetMethod(cls, idPropertyName) == null) { throw new IllegalArgumentException("The specified class: " + ClassUtil.getCanonicalClassName(cls) + " doesn't have getter or setter method for the specified id propery: " + idPropertyName); } final Method setMethod = ClassUtil.getPropSetMethod(cls, idPropertyName); final Class<?> parameterType = setMethod.getParameterTypes()[0]; if (!(String.class.isAssignableFrom(parameterType) || ObjectId.class.isAssignableFrom(parameterType))) { throw new IllegalArgumentException( "The parameter type of the specified id setter method must be 'String' or 'ObjectId': " + setMethod.toGenericString()); } classIdSetMethodPool.put(cls, setMethod); }
[ "public", "static", "void", "registerIdProeprty", "(", "final", "Class", "<", "?", ">", "cls", ",", "final", "String", "idPropertyName", ")", "{", "if", "(", "ClassUtil", ".", "getPropGetMethod", "(", "cls", ",", "idPropertyName", ")", "==", "null", "||", ...
The object id ("_id") property will be read from/write to the specified property @param cls @param idPropertyName
[ "The", "object", "id", "(", "_id", ")", "property", "will", "be", "read", "from", "/", "write", "to", "the", "specified", "property" ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/MongoDB.java#L165-L180
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
BundlesHandlerFactory.buildDirMappedResourceBundle
private JoinableResourceBundle buildDirMappedResourceBundle(String bundleId, String pathMapping) { List<String> path = Collections.singletonList(pathMapping); JoinableResourceBundle newBundle = new JoinableResourceBundleImpl(bundleId, generateBundleNameFromBundleId(bundleId), null, fileExtension, new InclusionPattern(), path, resourceReaderHandler, jawrConfig.getGeneratorRegistry()); return newBundle; }
java
private JoinableResourceBundle buildDirMappedResourceBundle(String bundleId, String pathMapping) { List<String> path = Collections.singletonList(pathMapping); JoinableResourceBundle newBundle = new JoinableResourceBundleImpl(bundleId, generateBundleNameFromBundleId(bundleId), null, fileExtension, new InclusionPattern(), path, resourceReaderHandler, jawrConfig.getGeneratorRegistry()); return newBundle; }
[ "private", "JoinableResourceBundle", "buildDirMappedResourceBundle", "(", "String", "bundleId", ",", "String", "pathMapping", ")", "{", "List", "<", "String", ">", "path", "=", "Collections", ".", "singletonList", "(", "pathMapping", ")", ";", "JoinableResourceBundle"...
Build a bundle based on a mapping returned by the ResourceBundleDirMapperFactory. @param bundleId the bundle Id @param pathMapping the path mapping @return a bundle based on a mapping returned by the ResourceBundleDirMapperFactory
[ "Build", "a", "bundle", "based", "on", "a", "mapping", "returned", "by", "the", "ResourceBundleDirMapperFactory", "." ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L747-L753
querydsl/querydsl
querydsl-sql/src/main/java/com/querydsl/sql/ProjectableSQLQuery.java
ProjectableSQLQuery.addJoinFlag
@Override public Q addJoinFlag(String flag) { return addJoinFlag(flag, JoinFlag.Position.BEFORE_TARGET); }
java
@Override public Q addJoinFlag(String flag) { return addJoinFlag(flag, JoinFlag.Position.BEFORE_TARGET); }
[ "@", "Override", "public", "Q", "addJoinFlag", "(", "String", "flag", ")", "{", "return", "addJoinFlag", "(", "flag", ",", "JoinFlag", ".", "Position", ".", "BEFORE_TARGET", ")", ";", "}" ]
Add the given String literal as a join flag to the last added join with the position BEFORE_TARGET @param flag join flag @return the current object
[ "Add", "the", "given", "String", "literal", "as", "a", "join", "flag", "to", "the", "last", "added", "join", "with", "the", "position", "BEFORE_TARGET" ]
train
https://github.com/querydsl/querydsl/blob/2bf234caf78549813a1e0f44d9c30ecc5ef734e3/querydsl-sql/src/main/java/com/querydsl/sql/ProjectableSQLQuery.java#L83-L86
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/AbstractSelectCodeGenerator.java
AbstractSelectCodeGenerator.checkUnusedParameters
public static void checkUnusedParameters(SQLiteModelMethod method, Set<String> usedMethodParameters, TypeName excludedClasses) { int paramsCount = method.getParameters().size(); int usedCount = usedMethodParameters.size(); if (paramsCount > usedCount) { StringBuilder sb = new StringBuilder(); String separator = ""; for (Pair<String, TypeName> item : method.getParameters()) { if (excludedClasses != null && item.value1.equals(excludedClasses)) { usedCount++; } else { if (!usedMethodParameters.contains(item.value0)) { sb.append(separator + "'" + item.value0 + "'"); separator = ", "; } } } if (paramsCount > usedCount) { throw (new InvalidMethodSignException(method, "unused parameter(s) " + sb.toString())); } } }
java
public static void checkUnusedParameters(SQLiteModelMethod method, Set<String> usedMethodParameters, TypeName excludedClasses) { int paramsCount = method.getParameters().size(); int usedCount = usedMethodParameters.size(); if (paramsCount > usedCount) { StringBuilder sb = new StringBuilder(); String separator = ""; for (Pair<String, TypeName> item : method.getParameters()) { if (excludedClasses != null && item.value1.equals(excludedClasses)) { usedCount++; } else { if (!usedMethodParameters.contains(item.value0)) { sb.append(separator + "'" + item.value0 + "'"); separator = ", "; } } } if (paramsCount > usedCount) { throw (new InvalidMethodSignException(method, "unused parameter(s) " + sb.toString())); } } }
[ "public", "static", "void", "checkUnusedParameters", "(", "SQLiteModelMethod", "method", ",", "Set", "<", "String", ">", "usedMethodParameters", ",", "TypeName", "excludedClasses", ")", "{", "int", "paramsCount", "=", "method", ".", "getParameters", "(", ")", ".",...
Check if there are unused method parameters. In this case an exception was throws. @param method the method @param usedMethodParameters the used method parameters @param excludedClasses the excluded classes
[ "Check", "if", "there", "are", "unused", "method", "parameters", ".", "In", "this", "case", "an", "exception", "was", "throws", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/AbstractSelectCodeGenerator.java#L789-L811
undertow-io/undertow
core/src/main/java/io/undertow/server/HttpServerExchange.java
HttpServerExchange.upgradeChannel
public HttpServerExchange upgradeChannel(String productName, final HttpUpgradeListener listener) { if (!connection.isUpgradeSupported()) { throw UndertowMessages.MESSAGES.upgradeNotSupported(); } UndertowLogger.REQUEST_LOGGER.debugf("Upgrading request %s", this); connection.setUpgradeListener(listener); setStatusCode(StatusCodes.SWITCHING_PROTOCOLS); final HeaderMap headers = getResponseHeaders(); headers.put(Headers.UPGRADE, productName); headers.put(Headers.CONNECTION, Headers.UPGRADE_STRING); return this; }
java
public HttpServerExchange upgradeChannel(String productName, final HttpUpgradeListener listener) { if (!connection.isUpgradeSupported()) { throw UndertowMessages.MESSAGES.upgradeNotSupported(); } UndertowLogger.REQUEST_LOGGER.debugf("Upgrading request %s", this); connection.setUpgradeListener(listener); setStatusCode(StatusCodes.SWITCHING_PROTOCOLS); final HeaderMap headers = getResponseHeaders(); headers.put(Headers.UPGRADE, productName); headers.put(Headers.CONNECTION, Headers.UPGRADE_STRING); return this; }
[ "public", "HttpServerExchange", "upgradeChannel", "(", "String", "productName", ",", "final", "HttpUpgradeListener", "listener", ")", "{", "if", "(", "!", "connection", ".", "isUpgradeSupported", "(", ")", ")", "{", "throw", "UndertowMessages", ".", "MESSAGES", "....
Upgrade the channel to a raw socket. This method set the response code to 101, and then marks both the request and response as terminated, which means that once the current request is completed the raw channel can be obtained from {@link io.undertow.server.protocol.http.HttpServerConnection#getChannel()} @param productName the product name to report to the client @throws IllegalStateException if a response or upgrade was already sent, or if the request body is already being read
[ "Upgrade", "the", "channel", "to", "a", "raw", "socket", ".", "This", "method", "set", "the", "response", "code", "to", "101", "and", "then", "marks", "both", "the", "request", "and", "response", "as", "terminated", "which", "means", "that", "once", "the",...
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/HttpServerExchange.java#L912-L923
btc-ag/redg
redg-runtime/src/main/java/com/btc/redg/runtime/jdbc/RedGDatabaseUtil.java
RedGDatabaseUtil.distinctByKey
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { final Map<Object, Boolean> seen = new ConcurrentHashMap<>(); return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; }
java
public static <T> Predicate<T> distinctByKey(Function<? super T, ?> keyExtractor) { final Map<Object, Boolean> seen = new ConcurrentHashMap<>(); return t -> seen.putIfAbsent(keyExtractor.apply(t), Boolean.TRUE) == null; }
[ "public", "static", "<", "T", ">", "Predicate", "<", "T", ">", "distinctByKey", "(", "Function", "<", "?", "super", "T", ",", "?", ">", "keyExtractor", ")", "{", "final", "Map", "<", "Object", ",", "Boolean", ">", "seen", "=", "new", "ConcurrentHashMap...
Taken from http://stackoverflow.com/a/27872852 @param keyExtractor The key extractor function @param <T> the generic type @return a predicate for filtering
[ "Taken", "from", "http", ":", "//", "stackoverflow", ".", "com", "/", "a", "/", "27872852" ]
train
https://github.com/btc-ag/redg/blob/416a68639d002512cabfebff09afd2e1909e27df/redg-runtime/src/main/java/com/btc/redg/runtime/jdbc/RedGDatabaseUtil.java#L147-L150
vdmeer/asciitable
src/main/java/de/vandermeer/asciitable/AsciiTable.java
AsciiTable.setPaddingTopBottom
public AsciiTable setPaddingTopBottom(int paddingTop, int paddingBottom){ for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingTopBottom(paddingTop, paddingBottom); } } return this; }
java
public AsciiTable setPaddingTopBottom(int paddingTop, int paddingBottom){ for(AT_Row row : this.rows){ if(row.getType()==TableRowType.CONTENT){ row.setPaddingTopBottom(paddingTop, paddingBottom); } } return this; }
[ "public", "AsciiTable", "setPaddingTopBottom", "(", "int", "paddingTop", ",", "int", "paddingBottom", ")", "{", "for", "(", "AT_Row", "row", ":", "this", ".", "rows", ")", "{", "if", "(", "row", ".", "getType", "(", ")", "==", "TableRowType", ".", "CONTE...
Sets top and bottom padding for all cells in the table (only if both values are not smaller than 0). @param paddingTop new top padding, ignored if smaller than 0 @param paddingBottom new bottom padding, ignored if smaller than 0 @return this to allow chaining
[ "Sets", "top", "and", "bottom", "padding", "for", "all", "cells", "in", "the", "table", "(", "only", "if", "both", "values", "are", "not", "smaller", "than", "0", ")", "." ]
train
https://github.com/vdmeer/asciitable/blob/b6a73710271c89f9c749603be856ba84a969ed5f/src/main/java/de/vandermeer/asciitable/AsciiTable.java#L400-L407
Azure/azure-sdk-for-java
datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java
StorageAccountsInner.listStorageContainersWithServiceResponseAsync
public Observable<ServiceResponse<Page<StorageContainerInner>>> listStorageContainersWithServiceResponseAsync(final String resourceGroupName, final String accountName, final String storageAccountName) { return listStorageContainersSinglePageAsync(resourceGroupName, accountName, storageAccountName) .concatMap(new Func1<ServiceResponse<Page<StorageContainerInner>>, Observable<ServiceResponse<Page<StorageContainerInner>>>>() { @Override public Observable<ServiceResponse<Page<StorageContainerInner>>> call(ServiceResponse<Page<StorageContainerInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listStorageContainersNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<StorageContainerInner>>> listStorageContainersWithServiceResponseAsync(final String resourceGroupName, final String accountName, final String storageAccountName) { return listStorageContainersSinglePageAsync(resourceGroupName, accountName, storageAccountName) .concatMap(new Func1<ServiceResponse<Page<StorageContainerInner>>, Observable<ServiceResponse<Page<StorageContainerInner>>>>() { @Override public Observable<ServiceResponse<Page<StorageContainerInner>>> call(ServiceResponse<Page<StorageContainerInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listStorageContainersNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "StorageContainerInner", ">", ">", ">", "listStorageContainersWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "accountName", ",", "final", "String", "storag...
Lists the Azure Storage containers, if any, associated with the specified Data Lake Analytics and Azure Storage account combination. The response includes a link to the next page of results, if any. @param resourceGroupName The name of the Azure resource group. @param accountName The name of the Data Lake Analytics account. @param storageAccountName The name of the Azure storage account from which to list blob containers. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;StorageContainerInner&gt; object
[ "Lists", "the", "Azure", "Storage", "containers", "if", "any", "associated", "with", "the", "specified", "Data", "Lake", "Analytics", "and", "Azure", "Storage", "account", "combination", ".", "The", "response", "includes", "a", "link", "to", "the", "next", "pa...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datalakeanalytics/resource-manager/v2016_11_01/src/main/java/com/microsoft/azure/management/datalakeanalytics/v2016_11_01/implementation/StorageAccountsInner.java#L928-L940