repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 218 | func_name stringlengths 4 140 | whole_func_string stringlengths 153 5.32k | language stringclasses 1
value | func_code_string stringlengths 72 4k | func_code_tokens listlengths 20 832 | func_documentation_string stringlengths 61 2k | func_documentation_tokens listlengths 1 647 | split_name stringclasses 1
value | func_code_url stringlengths 102 339 |
|---|---|---|---|---|---|---|---|---|---|---|
ngageoint/geopackage-android-map | geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java | FeatureInfoBuilder.buildResultsInfoMessage | public String buildResultsInfoMessage(FeatureIndexResults results, double tolerance, Projection projection) {
"""
Build a feature results information message
@param results feature index results
@param tolerance distance tolerance
@param projection desired geometry projection
@return results message or null if no results
"""
return buildResultsInfoMessage(results, tolerance, null, projection);
} | java | public String buildResultsInfoMessage(FeatureIndexResults results, double tolerance, Projection projection) {
return buildResultsInfoMessage(results, tolerance, null, projection);
} | [
"public",
"String",
"buildResultsInfoMessage",
"(",
"FeatureIndexResults",
"results",
",",
"double",
"tolerance",
",",
"Projection",
"projection",
")",
"{",
"return",
"buildResultsInfoMessage",
"(",
"results",
",",
"tolerance",
",",
"null",
",",
"projection",
")",
"... | Build a feature results information message
@param results feature index results
@param tolerance distance tolerance
@param projection desired geometry projection
@return results message or null if no results | [
"Build",
"a",
"feature",
"results",
"information",
"message"
] | train | https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/FeatureInfoBuilder.java#L307-L309 |
hdbeukel/james-core | src/main/java/org/jamesframework/core/search/algo/vns/VariableNeighbourhoodSearch.java | VariableNeighbourhoodSearch.searchStep | @Override
protected void searchStep() {
"""
Performs a step of VNS. One step consists of:
<ol>
<li>Shaking using the current shaking neighbourhood</li>
<li>Modification using a new instance of the local search algorithm</li>
<li>
Acceptance of modified solution if it is a global improvement. In such case, the search continues
with the first shaking neighbourhood; else, the next shaking neighbourhood will be used (cyclically).
</li>
</ol>
@throws JamesRuntimeException if depending on malfunctioning components (problem, neighbourhood, ...)
"""
// cyclically reset s to zero if no more shaking neighbourhoods are available
if(s >= getNeighbourhoods().size()){
s = 0;
}
// create copy of current solution to shake and modify by applying local search procedure
SolutionType shakedSolution = Solution.checkedCopy(getCurrentSolution());
// 1) SHAKING
// get random move from current shaking neighbourhood
Move<? super SolutionType> shakeMove = getNeighbourhoods().get(s).getRandomMove(shakedSolution, getRandom());
// shake (only if a move was obtained)
Evaluation shakedEval = getCurrentSolutionEvaluation();
Validation shakedVal = getCurrentSolutionValidation();
if(shakeMove != null){
shakedEval = evaluate(shakeMove);
shakedVal = validate(shakeMove);
shakeMove.apply(shakedSolution);
}
// 2) LOCAL SEARCH
// create instance of local search algorithm
LocalSearch<SolutionType> localSearch = localSearchFactory.create(getProblem());
// set initial solution to be modified
localSearch.setCurrentSolution(shakedSolution, shakedEval, shakedVal);
// interrupt local search algorithm when main VNS search wants to terminate
localSearch.addStopCriterion(_search -> getStatus() == SearchStatus.TERMINATING);
// run local search
localSearch.start();
// dispose local search when completed
localSearch.dispose();
// 3) ACCEPTANCE
SolutionType lsBestSolution = localSearch.getBestSolution();
Evaluation lsBestSolutionEvaluation = localSearch.getBestSolutionEvaluation();
Validation lsBestSolutionValidation = localSearch.getBestSolutionValidation();
// check improvement
if(lsBestSolution != null
&& lsBestSolutionValidation.passed() // should always be true but it doesn't hurt to check
&& computeDelta(lsBestSolutionEvaluation, getCurrentSolutionEvaluation()) > 0){
// improvement: increase number of accepted moves
incNumAcceptedMoves(1);
// update current and best solution
updateCurrentAndBestSolution(lsBestSolution, lsBestSolutionEvaluation, lsBestSolutionValidation);
// reset shaking neighbourhood
s = 0;
} else {
// no improvement: stick with current solution, adopt next shaking neighbourhood
incNumRejectedMoves(1);
s++;
}
} | java | @Override
protected void searchStep() {
// cyclically reset s to zero if no more shaking neighbourhoods are available
if(s >= getNeighbourhoods().size()){
s = 0;
}
// create copy of current solution to shake and modify by applying local search procedure
SolutionType shakedSolution = Solution.checkedCopy(getCurrentSolution());
// 1) SHAKING
// get random move from current shaking neighbourhood
Move<? super SolutionType> shakeMove = getNeighbourhoods().get(s).getRandomMove(shakedSolution, getRandom());
// shake (only if a move was obtained)
Evaluation shakedEval = getCurrentSolutionEvaluation();
Validation shakedVal = getCurrentSolutionValidation();
if(shakeMove != null){
shakedEval = evaluate(shakeMove);
shakedVal = validate(shakeMove);
shakeMove.apply(shakedSolution);
}
// 2) LOCAL SEARCH
// create instance of local search algorithm
LocalSearch<SolutionType> localSearch = localSearchFactory.create(getProblem());
// set initial solution to be modified
localSearch.setCurrentSolution(shakedSolution, shakedEval, shakedVal);
// interrupt local search algorithm when main VNS search wants to terminate
localSearch.addStopCriterion(_search -> getStatus() == SearchStatus.TERMINATING);
// run local search
localSearch.start();
// dispose local search when completed
localSearch.dispose();
// 3) ACCEPTANCE
SolutionType lsBestSolution = localSearch.getBestSolution();
Evaluation lsBestSolutionEvaluation = localSearch.getBestSolutionEvaluation();
Validation lsBestSolutionValidation = localSearch.getBestSolutionValidation();
// check improvement
if(lsBestSolution != null
&& lsBestSolutionValidation.passed() // should always be true but it doesn't hurt to check
&& computeDelta(lsBestSolutionEvaluation, getCurrentSolutionEvaluation()) > 0){
// improvement: increase number of accepted moves
incNumAcceptedMoves(1);
// update current and best solution
updateCurrentAndBestSolution(lsBestSolution, lsBestSolutionEvaluation, lsBestSolutionValidation);
// reset shaking neighbourhood
s = 0;
} else {
// no improvement: stick with current solution, adopt next shaking neighbourhood
incNumRejectedMoves(1);
s++;
}
} | [
"@",
"Override",
"protected",
"void",
"searchStep",
"(",
")",
"{",
"// cyclically reset s to zero if no more shaking neighbourhoods are available",
"if",
"(",
"s",
">=",
"getNeighbourhoods",
"(",
")",
".",
"size",
"(",
")",
")",
"{",
"s",
"=",
"0",
";",
"}",
"//... | Performs a step of VNS. One step consists of:
<ol>
<li>Shaking using the current shaking neighbourhood</li>
<li>Modification using a new instance of the local search algorithm</li>
<li>
Acceptance of modified solution if it is a global improvement. In such case, the search continues
with the first shaking neighbourhood; else, the next shaking neighbourhood will be used (cyclically).
</li>
</ol>
@throws JamesRuntimeException if depending on malfunctioning components (problem, neighbourhood, ...) | [
"Performs",
"a",
"step",
"of",
"VNS",
".",
"One",
"step",
"consists",
"of",
":",
"<ol",
">",
"<li",
">",
"Shaking",
"using",
"the",
"current",
"shaking",
"neighbourhood<",
"/",
"li",
">",
"<li",
">",
"Modification",
"using",
"a",
"new",
"instance",
"of",... | train | https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/algo/vns/VariableNeighbourhoodSearch.java#L209-L267 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cp/internal/session/AbstractProxySessionManager.java | AbstractProxySessionManager.invalidateSession | public final void invalidateSession(RaftGroupId groupId, long id) {
"""
Invalidates the given session.
No more heartbeats will be sent for the given session.
"""
SessionState session = sessions.get(groupId);
if (session != null && session.id == id) {
sessions.remove(groupId, session);
}
} | java | public final void invalidateSession(RaftGroupId groupId, long id) {
SessionState session = sessions.get(groupId);
if (session != null && session.id == id) {
sessions.remove(groupId, session);
}
} | [
"public",
"final",
"void",
"invalidateSession",
"(",
"RaftGroupId",
"groupId",
",",
"long",
"id",
")",
"{",
"SessionState",
"session",
"=",
"sessions",
".",
"get",
"(",
"groupId",
")",
";",
"if",
"(",
"session",
"!=",
"null",
"&&",
"session",
".",
"id",
... | Invalidates the given session.
No more heartbeats will be sent for the given session. | [
"Invalidates",
"the",
"given",
"session",
".",
"No",
"more",
"heartbeats",
"will",
"be",
"sent",
"for",
"the",
"given",
"session",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/session/AbstractProxySessionManager.java#L156-L161 |
cdk/cdk | storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java | CxSmilesParser.processPositionalVariation | private static boolean processPositionalVariation(CharIter iter, CxSmilesState state) {
"""
Positional variation/multi centre bonding. Describe as a begin atom and one or more end points.
@param iter input characters, iterator is progressed by this method
@param state output CXSMILES state
@return parse was a success (or not)
"""
if (state.positionVar == null)
state.positionVar = new TreeMap<>();
while (iter.hasNext()) {
if (isDigit(iter.curr())) {
final int beg = processUnsignedInt(iter);
if (!iter.nextIf(':'))
return false;
List<Integer> endpoints = new ArrayList<>(6);
if (!processIntList(iter, DOT_SEPARATOR, endpoints))
return false;
iter.nextIf(',');
state.positionVar.put(beg, endpoints);
} else {
return true;
}
}
return false;
} | java | private static boolean processPositionalVariation(CharIter iter, CxSmilesState state) {
if (state.positionVar == null)
state.positionVar = new TreeMap<>();
while (iter.hasNext()) {
if (isDigit(iter.curr())) {
final int beg = processUnsignedInt(iter);
if (!iter.nextIf(':'))
return false;
List<Integer> endpoints = new ArrayList<>(6);
if (!processIntList(iter, DOT_SEPARATOR, endpoints))
return false;
iter.nextIf(',');
state.positionVar.put(beg, endpoints);
} else {
return true;
}
}
return false;
} | [
"private",
"static",
"boolean",
"processPositionalVariation",
"(",
"CharIter",
"iter",
",",
"CxSmilesState",
"state",
")",
"{",
"if",
"(",
"state",
".",
"positionVar",
"==",
"null",
")",
"state",
".",
"positionVar",
"=",
"new",
"TreeMap",
"<>",
"(",
")",
";"... | Positional variation/multi centre bonding. Describe as a begin atom and one or more end points.
@param iter input characters, iterator is progressed by this method
@param state output CXSMILES state
@return parse was a success (or not) | [
"Positional",
"variation",
"/",
"multi",
"centre",
"bonding",
".",
"Describe",
"as",
"a",
"begin",
"atom",
"and",
"one",
"or",
"more",
"end",
"points",
"."
] | train | https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/smiles/src/main/java/org/openscience/cdk/smiles/CxSmilesParser.java#L337-L355 |
deeplearning4j/deeplearning4j | nd4j/nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/factory/DefaultDataBufferFactory.java | DefaultDataBufferFactory.createSame | @Override
public DataBuffer createSame(DataBuffer buffer, boolean init, MemoryWorkspace workspace) {
"""
This method will create new DataBuffer of the same dataType & same length
@param buffer
@param workspace
@return
"""
return create(buffer.dataType(), buffer.length(), init, workspace);
} | java | @Override
public DataBuffer createSame(DataBuffer buffer, boolean init, MemoryWorkspace workspace) {
return create(buffer.dataType(), buffer.length(), init, workspace);
} | [
"@",
"Override",
"public",
"DataBuffer",
"createSame",
"(",
"DataBuffer",
"buffer",
",",
"boolean",
"init",
",",
"MemoryWorkspace",
"workspace",
")",
"{",
"return",
"create",
"(",
"buffer",
".",
"dataType",
"(",
")",
",",
"buffer",
".",
"length",
"(",
")",
... | This method will create new DataBuffer of the same dataType & same length
@param buffer
@param workspace
@return | [
"This",
"method",
"will",
"create",
"new",
"DataBuffer",
"of",
"the",
"same",
"dataType",
"&",
"same",
"length"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-buffer/src/main/java/org/nd4j/linalg/api/buffer/factory/DefaultDataBufferFactory.java#L361-L364 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/endpoint/healthcheck/HttpHealthCheckedEndpointGroup.java | HttpHealthCheckedEndpointGroup.of | @Deprecated
public static HttpHealthCheckedEndpointGroup of(ClientFactory clientFactory,
EndpointGroup delegate,
String healthCheckPath,
Duration healthCheckRetryInterval) {
"""
Creates a new {@link HttpHealthCheckedEndpointGroup} instance.
@deprecated Use {@link HttpHealthCheckedEndpointGroupBuilder}.
"""
return new HttpHealthCheckedEndpointGroupBuilder(delegate, healthCheckPath)
.clientFactory(clientFactory)
.retryInterval(healthCheckRetryInterval)
.build();
} | java | @Deprecated
public static HttpHealthCheckedEndpointGroup of(ClientFactory clientFactory,
EndpointGroup delegate,
String healthCheckPath,
Duration healthCheckRetryInterval) {
return new HttpHealthCheckedEndpointGroupBuilder(delegate, healthCheckPath)
.clientFactory(clientFactory)
.retryInterval(healthCheckRetryInterval)
.build();
} | [
"@",
"Deprecated",
"public",
"static",
"HttpHealthCheckedEndpointGroup",
"of",
"(",
"ClientFactory",
"clientFactory",
",",
"EndpointGroup",
"delegate",
",",
"String",
"healthCheckPath",
",",
"Duration",
"healthCheckRetryInterval",
")",
"{",
"return",
"new",
"HttpHealthChe... | Creates a new {@link HttpHealthCheckedEndpointGroup} instance.
@deprecated Use {@link HttpHealthCheckedEndpointGroupBuilder}. | [
"Creates",
"a",
"new",
"{",
"@link",
"HttpHealthCheckedEndpointGroup",
"}",
"instance",
"."
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/endpoint/healthcheck/HttpHealthCheckedEndpointGroup.java#L65-L74 |
spring-projects/spring-data-solr | src/main/java/org/springframework/data/solr/core/query/Criteria.java | Criteria.between | public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound, boolean includeLowerBound, boolean includeUppderBound) {
"""
Crates new {@link Predicate} for {@code RANGE [lowerBound TO upperBound]}
@param lowerBound
@param upperBound
@param includeLowerBound
@param includeUppderBound
@return
"""
predicates.add(new Predicate(OperationKey.BETWEEN,
new Object[] { lowerBound, upperBound, includeLowerBound, includeUppderBound }));
return this;
} | java | public Criteria between(@Nullable Object lowerBound, @Nullable Object upperBound, boolean includeLowerBound, boolean includeUppderBound) {
predicates.add(new Predicate(OperationKey.BETWEEN,
new Object[] { lowerBound, upperBound, includeLowerBound, includeUppderBound }));
return this;
} | [
"public",
"Criteria",
"between",
"(",
"@",
"Nullable",
"Object",
"lowerBound",
",",
"@",
"Nullable",
"Object",
"upperBound",
",",
"boolean",
"includeLowerBound",
",",
"boolean",
"includeUppderBound",
")",
"{",
"predicates",
".",
"add",
"(",
"new",
"Predicate",
"... | Crates new {@link Predicate} for {@code RANGE [lowerBound TO upperBound]}
@param lowerBound
@param upperBound
@param includeLowerBound
@param includeUppderBound
@return | [
"Crates",
"new",
"{",
"@link",
"Predicate",
"}",
"for",
"{",
"@code",
"RANGE",
"[",
"lowerBound",
"TO",
"upperBound",
"]",
"}"
] | train | https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/Criteria.java#L414-L418 |
knowm/XChange | xchange-paymium/src/main/java/org/knowm/xchange/paymium/PaymiumAdapters.java | PaymiumAdapters.adaptTicker | public static Ticker adaptTicker(PaymiumTicker PaymiumTicker, CurrencyPair currencyPair) {
"""
Adapts a PaymiumTicker to a Ticker Object
@param PaymiumTicker The exchange specific ticker
@param currencyPair (e.g. BTC/USD)
@return The ticker
"""
BigDecimal bid = PaymiumTicker.getBid();
BigDecimal ask = PaymiumTicker.getAsk();
BigDecimal high = PaymiumTicker.getHigh();
BigDecimal low = PaymiumTicker.getLow();
BigDecimal last = PaymiumTicker.getPrice();
BigDecimal volume = PaymiumTicker.getVolume();
Date timestamp = new Date(PaymiumTicker.getAt() * 1000L);
return new Ticker.Builder()
.currencyPair(currencyPair)
.bid(bid)
.ask(ask)
.high(high)
.low(low)
.last(last)
.volume(volume)
.timestamp(timestamp)
.build();
} | java | public static Ticker adaptTicker(PaymiumTicker PaymiumTicker, CurrencyPair currencyPair) {
BigDecimal bid = PaymiumTicker.getBid();
BigDecimal ask = PaymiumTicker.getAsk();
BigDecimal high = PaymiumTicker.getHigh();
BigDecimal low = PaymiumTicker.getLow();
BigDecimal last = PaymiumTicker.getPrice();
BigDecimal volume = PaymiumTicker.getVolume();
Date timestamp = new Date(PaymiumTicker.getAt() * 1000L);
return new Ticker.Builder()
.currencyPair(currencyPair)
.bid(bid)
.ask(ask)
.high(high)
.low(low)
.last(last)
.volume(volume)
.timestamp(timestamp)
.build();
} | [
"public",
"static",
"Ticker",
"adaptTicker",
"(",
"PaymiumTicker",
"PaymiumTicker",
",",
"CurrencyPair",
"currencyPair",
")",
"{",
"BigDecimal",
"bid",
"=",
"PaymiumTicker",
".",
"getBid",
"(",
")",
";",
"BigDecimal",
"ask",
"=",
"PaymiumTicker",
".",
"getAsk",
... | Adapts a PaymiumTicker to a Ticker Object
@param PaymiumTicker The exchange specific ticker
@param currencyPair (e.g. BTC/USD)
@return The ticker | [
"Adapts",
"a",
"PaymiumTicker",
"to",
"a",
"Ticker",
"Object"
] | train | https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-paymium/src/main/java/org/knowm/xchange/paymium/PaymiumAdapters.java#L36-L56 |
dita-ot/dita-ot | src/main/java/org/dita/dost/util/URLUtils.java | URLUtils.setScheme | public static URI setScheme(final URI orig, final String scheme) {
"""
Create new URI with a given scheme.
@param orig URI to set scheme on
@param scheme new scheme, {@code null} for no scheme
@return new URI instance with given path
"""
try {
return new URI(scheme, orig.getUserInfo(), orig.getHost(), orig.getPort(), orig.getPath(), orig.getQuery(), orig.getFragment());
} catch (final URISyntaxException e) {
throw new RuntimeException(e.getMessage(), e);
}
} | java | public static URI setScheme(final URI orig, final String scheme) {
try {
return new URI(scheme, orig.getUserInfo(), orig.getHost(), orig.getPort(), orig.getPath(), orig.getQuery(), orig.getFragment());
} catch (final URISyntaxException e) {
throw new RuntimeException(e.getMessage(), e);
}
} | [
"public",
"static",
"URI",
"setScheme",
"(",
"final",
"URI",
"orig",
",",
"final",
"String",
"scheme",
")",
"{",
"try",
"{",
"return",
"new",
"URI",
"(",
"scheme",
",",
"orig",
".",
"getUserInfo",
"(",
")",
",",
"orig",
".",
"getHost",
"(",
")",
",",... | Create new URI with a given scheme.
@param orig URI to set scheme on
@param scheme new scheme, {@code null} for no scheme
@return new URI instance with given path | [
"Create",
"new",
"URI",
"with",
"a",
"given",
"scheme",
"."
] | train | https://github.com/dita-ot/dita-ot/blob/ea776b3c60c03d9f033b6f7ea072349e49dbcdd2/src/main/java/org/dita/dost/util/URLUtils.java#L585-L591 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/Swagger2MarkupProperties.java | Swagger2MarkupProperties.getRequiredBoolean | public boolean getRequiredBoolean(String key) {
"""
Return the boolean property value associated with the given key (never {@code null}).
@return The boolean property
@throws IllegalStateException if the key cannot be resolved
"""
Boolean value = configuration.getBoolean(key, null);
if (value != null) {
return value;
} else {
throw new IllegalStateException(String.format("required key [%s] not found", key));
}
} | java | public boolean getRequiredBoolean(String key) {
Boolean value = configuration.getBoolean(key, null);
if (value != null) {
return value;
} else {
throw new IllegalStateException(String.format("required key [%s] not found", key));
}
} | [
"public",
"boolean",
"getRequiredBoolean",
"(",
"String",
"key",
")",
"{",
"Boolean",
"value",
"=",
"configuration",
".",
"getBoolean",
"(",
"key",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"return",
"value",
";",
"}",
"else",
... | Return the boolean property value associated with the given key (never {@code null}).
@return The boolean property
@throws IllegalStateException if the key cannot be resolved | [
"Return",
"the",
"boolean",
"property",
"value",
"associated",
"with",
"the",
"given",
"key",
"(",
"never",
"{",
"@code",
"null",
"}",
")",
"."
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/Swagger2MarkupProperties.java#L157-L164 |
google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Bidi.java | Bidi.setLine | public Bidi setLine(int start, int limit) {
"""
<code>setLine()</code> returns a <code>Bidi</code> object to
contain the reordering information, especially the resolved levels,
for all the characters in a line of text. This line of text is
specified by referring to a <code>Bidi</code> object representing
this information for a piece of text containing one or more paragraphs,
and by specifying a range of indexes in this text.<p>
In the new line object, the indexes will range from 0 to <code>limit-start-1</code>.<p>
This is used after calling <code>setPara()</code>
for a piece of text, and after line-breaking on that text.
It is not necessary if each paragraph is treated as a single line.<p>
After line-breaking, rules (L1) and (L2) for the treatment of
trailing WS and for reordering are performed on
a <code>Bidi</code> object that represents a line.<p>
<strong>Important: </strong>the line <code>Bidi</code> object may
reference data within the global text <code>Bidi</code> object.
You should not alter the content of the global text object until
you are finished using the line object.
@param start is the line's first index into the text.
@param limit is just behind the line's last index into the text
(its last index +1).
@return a <code>Bidi</code> object that will now represent a line of the text.
@throws IllegalStateException if this call is not preceded by a successful
call to <code>setPara</code>
@throws IllegalArgumentException if start and limit are not in the range
<code>0<=start<limit<=getProcessedLength()</code>,
or if the specified line crosses a paragraph boundary
@see #setPara
@see #getProcessedLength
"""
verifyValidPara();
verifyRange(start, 0, limit);
verifyRange(limit, 0, length+1);
if (getParagraphIndex(start) != getParagraphIndex(limit - 1)) {
/* the line crosses a paragraph boundary */
throw new IllegalArgumentException();
}
return BidiLine.setLine(this, start, limit);
} | java | public Bidi setLine(int start, int limit)
{
verifyValidPara();
verifyRange(start, 0, limit);
verifyRange(limit, 0, length+1);
if (getParagraphIndex(start) != getParagraphIndex(limit - 1)) {
/* the line crosses a paragraph boundary */
throw new IllegalArgumentException();
}
return BidiLine.setLine(this, start, limit);
} | [
"public",
"Bidi",
"setLine",
"(",
"int",
"start",
",",
"int",
"limit",
")",
"{",
"verifyValidPara",
"(",
")",
";",
"verifyRange",
"(",
"start",
",",
"0",
",",
"limit",
")",
";",
"verifyRange",
"(",
"limit",
",",
"0",
",",
"length",
"+",
"1",
")",
"... | <code>setLine()</code> returns a <code>Bidi</code> object to
contain the reordering information, especially the resolved levels,
for all the characters in a line of text. This line of text is
specified by referring to a <code>Bidi</code> object representing
this information for a piece of text containing one or more paragraphs,
and by specifying a range of indexes in this text.<p>
In the new line object, the indexes will range from 0 to <code>limit-start-1</code>.<p>
This is used after calling <code>setPara()</code>
for a piece of text, and after line-breaking on that text.
It is not necessary if each paragraph is treated as a single line.<p>
After line-breaking, rules (L1) and (L2) for the treatment of
trailing WS and for reordering are performed on
a <code>Bidi</code> object that represents a line.<p>
<strong>Important: </strong>the line <code>Bidi</code> object may
reference data within the global text <code>Bidi</code> object.
You should not alter the content of the global text object until
you are finished using the line object.
@param start is the line's first index into the text.
@param limit is just behind the line's last index into the text
(its last index +1).
@return a <code>Bidi</code> object that will now represent a line of the text.
@throws IllegalStateException if this call is not preceded by a successful
call to <code>setPara</code>
@throws IllegalArgumentException if start and limit are not in the range
<code>0<=start<limit<=getProcessedLength()</code>,
or if the specified line crosses a paragraph boundary
@see #setPara
@see #getProcessedLength | [
"<code",
">",
"setLine",
"()",
"<",
"/",
"code",
">",
"returns",
"a",
"<code",
">",
"Bidi<",
"/",
"code",
">",
"object",
"to",
"contain",
"the",
"reordering",
"information",
"especially",
"the",
"resolved",
"levels",
"for",
"all",
"the",
"characters",
"in"... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Bidi.java#L4682-L4692 |
jenkinsci/jenkins | core/src/main/java/hudson/model/Items.java | Items.verifyItemDoesNotAlreadyExist | static void verifyItemDoesNotAlreadyExist(@Nonnull ItemGroup<?> parent, @Nonnull String newName, @CheckForNull Item variant) throws IllegalArgumentException, Failure {
"""
Securely check for the existence of an item before trying to create one with the same name.
@param parent the folder where we are about to create/rename/move an item
@param newName the proposed new name
@param variant if not null, an existing item which we accept could be there
@throws IllegalArgumentException if there is already something there, which you were supposed to know about
@throws Failure if there is already something there but you should not be told details
"""
Item existing;
try (ACLContext ctxt = ACL.as(ACL.SYSTEM)) {
existing = parent.getItem(newName);
}
if (existing != null && existing != variant) {
if (existing.hasPermission(Item.DISCOVER)) {
String prefix = parent.getFullName();
throw new IllegalArgumentException((prefix.isEmpty() ? "" : prefix + "/") + newName + " already exists");
} else {
// Cannot hide its existence, so at least be as vague as possible.
throw new Failure("");
}
}
} | java | static void verifyItemDoesNotAlreadyExist(@Nonnull ItemGroup<?> parent, @Nonnull String newName, @CheckForNull Item variant) throws IllegalArgumentException, Failure {
Item existing;
try (ACLContext ctxt = ACL.as(ACL.SYSTEM)) {
existing = parent.getItem(newName);
}
if (existing != null && existing != variant) {
if (existing.hasPermission(Item.DISCOVER)) {
String prefix = parent.getFullName();
throw new IllegalArgumentException((prefix.isEmpty() ? "" : prefix + "/") + newName + " already exists");
} else {
// Cannot hide its existence, so at least be as vague as possible.
throw new Failure("");
}
}
} | [
"static",
"void",
"verifyItemDoesNotAlreadyExist",
"(",
"@",
"Nonnull",
"ItemGroup",
"<",
"?",
">",
"parent",
",",
"@",
"Nonnull",
"String",
"newName",
",",
"@",
"CheckForNull",
"Item",
"variant",
")",
"throws",
"IllegalArgumentException",
",",
"Failure",
"{",
"... | Securely check for the existence of an item before trying to create one with the same name.
@param parent the folder where we are about to create/rename/move an item
@param newName the proposed new name
@param variant if not null, an existing item which we accept could be there
@throws IllegalArgumentException if there is already something there, which you were supposed to know about
@throws Failure if there is already something there but you should not be told details | [
"Securely",
"check",
"for",
"the",
"existence",
"of",
"an",
"item",
"before",
"trying",
"to",
"create",
"one",
"with",
"the",
"same",
"name",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/hudson/model/Items.java#L633-L647 |
amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.groupRuns | public StreamEx<List<T>> groupRuns(BiPredicate<? super T, ? super T> sameGroup) {
"""
Returns a stream consisting of lists of elements of this stream where
adjacent elements are grouped according to supplied predicate.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate</a>
partial reduction operation.
<p>
There are no guarantees on the type, mutability, serializability, or
thread-safety of the {@code List} objects of the resulting stream.
<p>
This operation is equivalent to
{@code collapse(sameGroup, Collectors.toList())}, but more efficient.
@param sameGroup a non-interfering, stateless predicate to apply to the
pair of adjacent elements which returns true for elements which
belong to the same group.
@return the new stream
@since 0.3.1
"""
return collapseInternal(sameGroup, Collections::singletonList, (acc, t) -> {
if (!(acc instanceof ArrayList)) {
T old = acc.get(0);
acc = new ArrayList<>();
acc.add(old);
}
acc.add(t);
return acc;
}, (acc1, acc2) -> {
if (!(acc1 instanceof ArrayList)) {
T old = acc1.get(0);
acc1 = new ArrayList<>();
acc1.add(old);
}
acc1.addAll(acc2);
return acc1;
});
} | java | public StreamEx<List<T>> groupRuns(BiPredicate<? super T, ? super T> sameGroup) {
return collapseInternal(sameGroup, Collections::singletonList, (acc, t) -> {
if (!(acc instanceof ArrayList)) {
T old = acc.get(0);
acc = new ArrayList<>();
acc.add(old);
}
acc.add(t);
return acc;
}, (acc1, acc2) -> {
if (!(acc1 instanceof ArrayList)) {
T old = acc1.get(0);
acc1 = new ArrayList<>();
acc1.add(old);
}
acc1.addAll(acc2);
return acc1;
});
} | [
"public",
"StreamEx",
"<",
"List",
"<",
"T",
">",
">",
"groupRuns",
"(",
"BiPredicate",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"T",
">",
"sameGroup",
")",
"{",
"return",
"collapseInternal",
"(",
"sameGroup",
",",
"Collections",
"::",
"singletonList",
... | Returns a stream consisting of lists of elements of this stream where
adjacent elements are grouped according to supplied predicate.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate</a>
partial reduction operation.
<p>
There are no guarantees on the type, mutability, serializability, or
thread-safety of the {@code List} objects of the resulting stream.
<p>
This operation is equivalent to
{@code collapse(sameGroup, Collectors.toList())}, but more efficient.
@param sameGroup a non-interfering, stateless predicate to apply to the
pair of adjacent elements which returns true for elements which
belong to the same group.
@return the new stream
@since 0.3.1 | [
"Returns",
"a",
"stream",
"consisting",
"of",
"lists",
"of",
"elements",
"of",
"this",
"stream",
"where",
"adjacent",
"elements",
"are",
"grouped",
"according",
"to",
"supplied",
"predicate",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1693-L1711 |
OpenLiberty/open-liberty | dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigEvaluator.java | ConfigEvaluator.processReference | private ConfigElement.Reference processReference(ConfigElement.Reference reference, EvaluationContext context, boolean ignoreWarnings) throws ConfigEvaluatorException {
"""
Note, the "reference" here is something of the form:
<parent>
<child ref="someOtherElement"/>
</parent>
<otherElement id="someOtherElement"/>
This is not called for ibm:type="pid" references.
This method will resolve any variables in the ref attribute and return a new ConfigElement.Reference if anything changed.
@param reference The ConfigElement reference. Contains the element name and the ref attribute value
@param context
@param ignoreWarnings
@return
@throws ConfigEvaluatorException
"""
// Note, ref attributes don't correspond to an attribute definition, so we will always resolve variables (ie, there is no way to specify
// substitution="deferred" for a ref attribute.
String resolvedId = context.resolveString(reference.getId(), ignoreWarnings);
if (reference.getId().equals(resolvedId)) {
return reference;
} else {
return new ConfigElement.Reference(reference.getPid(), resolvedId);
}
} | java | private ConfigElement.Reference processReference(ConfigElement.Reference reference, EvaluationContext context, boolean ignoreWarnings) throws ConfigEvaluatorException {
// Note, ref attributes don't correspond to an attribute definition, so we will always resolve variables (ie, there is no way to specify
// substitution="deferred" for a ref attribute.
String resolvedId = context.resolveString(reference.getId(), ignoreWarnings);
if (reference.getId().equals(resolvedId)) {
return reference;
} else {
return new ConfigElement.Reference(reference.getPid(), resolvedId);
}
} | [
"private",
"ConfigElement",
".",
"Reference",
"processReference",
"(",
"ConfigElement",
".",
"Reference",
"reference",
",",
"EvaluationContext",
"context",
",",
"boolean",
"ignoreWarnings",
")",
"throws",
"ConfigEvaluatorException",
"{",
"// Note, ref attributes don't corresp... | Note, the "reference" here is something of the form:
<parent>
<child ref="someOtherElement"/>
</parent>
<otherElement id="someOtherElement"/>
This is not called for ibm:type="pid" references.
This method will resolve any variables in the ref attribute and return a new ConfigElement.Reference if anything changed.
@param reference The ConfigElement reference. Contains the element name and the ref attribute value
@param context
@param ignoreWarnings
@return
@throws ConfigEvaluatorException | [
"Note",
"the",
"reference",
"here",
"is",
"something",
"of",
"the",
"form",
":",
"<parent",
">",
"<child",
"ref",
"=",
"someOtherElement",
"/",
">",
"<",
"/",
"parent",
">"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigEvaluator.java#L1363-L1372 |
grpc/grpc-java | android/src/main/java/io/grpc/android/AndroidChannelBuilder.java | AndroidChannelBuilder.transportExecutor | @Deprecated
public AndroidChannelBuilder transportExecutor(@Nullable Executor transportExecutor) {
"""
Set the delegate channel builder's transportExecutor.
@deprecated Use {@link #fromBuilder(ManagedChannelBuilder)} with a pre-configured
ManagedChannelBuilder instead.
"""
try {
OKHTTP_CHANNEL_BUILDER_CLASS
.getMethod("transportExecutor", Executor.class)
.invoke(delegateBuilder, transportExecutor);
return this;
} catch (Exception e) {
throw new RuntimeException("Failed to invoke transportExecutor on delegate builder", e);
}
} | java | @Deprecated
public AndroidChannelBuilder transportExecutor(@Nullable Executor transportExecutor) {
try {
OKHTTP_CHANNEL_BUILDER_CLASS
.getMethod("transportExecutor", Executor.class)
.invoke(delegateBuilder, transportExecutor);
return this;
} catch (Exception e) {
throw new RuntimeException("Failed to invoke transportExecutor on delegate builder", e);
}
} | [
"@",
"Deprecated",
"public",
"AndroidChannelBuilder",
"transportExecutor",
"(",
"@",
"Nullable",
"Executor",
"transportExecutor",
")",
"{",
"try",
"{",
"OKHTTP_CHANNEL_BUILDER_CLASS",
".",
"getMethod",
"(",
"\"transportExecutor\"",
",",
"Executor",
".",
"class",
")",
... | Set the delegate channel builder's transportExecutor.
@deprecated Use {@link #fromBuilder(ManagedChannelBuilder)} with a pre-configured
ManagedChannelBuilder instead. | [
"Set",
"the",
"delegate",
"channel",
"builder",
"s",
"transportExecutor",
"."
] | train | https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/android/src/main/java/io/grpc/android/AndroidChannelBuilder.java#L119-L129 |
liferay/com-liferay-commerce | commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java | CommerceCurrencyPersistenceImpl.findAll | @Override
public List<CommerceCurrency> findAll(int start, int end) {
"""
Returns a range of all the commerce currencies.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceCurrencyModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce currencies
@param end the upper bound of the range of commerce currencies (not inclusive)
@return the range of commerce currencies
"""
return findAll(start, end, null);
} | java | @Override
public List<CommerceCurrency> findAll(int start, int end) {
return findAll(start, end, null);
} | [
"@",
"Override",
"public",
"List",
"<",
"CommerceCurrency",
">",
"findAll",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"return",
"findAll",
"(",
"start",
",",
"end",
",",
"null",
")",
";",
"}"
] | Returns a range of all the commerce currencies.
<p>
Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceCurrencyModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.
</p>
@param start the lower bound of the range of commerce currencies
@param end the upper bound of the range of commerce currencies (not inclusive)
@return the range of commerce currencies | [
"Returns",
"a",
"range",
"of",
"all",
"the",
"commerce",
"currencies",
"."
] | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-currency-service/src/main/java/com/liferay/commerce/currency/service/persistence/impl/CommerceCurrencyPersistenceImpl.java#L4690-L4693 |
FasterXML/woodstox | src/main/java/com/ctc/wstx/stax/WstxInputFactory.java | WstxInputFactory.createSR | public XMLStreamReader2 createSR(ReaderConfig cfg, String systemId, InputBootstrapper bs,
boolean forER, boolean autoCloseInput)
throws XMLStreamException {
"""
Method that is eventually called to create a (full) stream read
instance.
<p>
Note: defined as public method because it needs to be called by
SAX implementation.
@param systemId System id used for this reader (if any)
@param bs Bootstrapper to use for creating actual underlying
physical reader
@param forER Flag to indicate whether it will be used via
Event API (will affect some configuration settings), true if it
will be, false if not (or not known)
@param autoCloseInput Whether the underlying input source should be
actually closed when encountering EOF, or when <code>close()</code>
is called. Will be true for input sources that are automatically
managed by stream reader (input streams created for
{@link java.net.URL} and {@link java.io.File} arguments, or when
configuration settings indicate auto-closing is to be enabled
(the default value is false as per Stax 1.0 specs).
"""
// 16-Aug-2004, TSa: Maybe we have a context?
URL src = cfg.getBaseURL();
// If not, maybe we can derive it from system id?
if ((src == null) && (systemId != null && systemId.length() > 0)) {
try {
src = URLUtil.urlFromSystemId(systemId);
} catch (IOException ie) {
throw new WstxIOException(ie);
}
}
return doCreateSR(cfg, SystemId.construct(systemId, src), bs, forER, autoCloseInput);
} | java | public XMLStreamReader2 createSR(ReaderConfig cfg, String systemId, InputBootstrapper bs,
boolean forER, boolean autoCloseInput)
throws XMLStreamException
{
// 16-Aug-2004, TSa: Maybe we have a context?
URL src = cfg.getBaseURL();
// If not, maybe we can derive it from system id?
if ((src == null) && (systemId != null && systemId.length() > 0)) {
try {
src = URLUtil.urlFromSystemId(systemId);
} catch (IOException ie) {
throw new WstxIOException(ie);
}
}
return doCreateSR(cfg, SystemId.construct(systemId, src), bs, forER, autoCloseInput);
} | [
"public",
"XMLStreamReader2",
"createSR",
"(",
"ReaderConfig",
"cfg",
",",
"String",
"systemId",
",",
"InputBootstrapper",
"bs",
",",
"boolean",
"forER",
",",
"boolean",
"autoCloseInput",
")",
"throws",
"XMLStreamException",
"{",
"// 16-Aug-2004, TSa: Maybe we have a cont... | Method that is eventually called to create a (full) stream read
instance.
<p>
Note: defined as public method because it needs to be called by
SAX implementation.
@param systemId System id used for this reader (if any)
@param bs Bootstrapper to use for creating actual underlying
physical reader
@param forER Flag to indicate whether it will be used via
Event API (will affect some configuration settings), true if it
will be, false if not (or not known)
@param autoCloseInput Whether the underlying input source should be
actually closed when encountering EOF, or when <code>close()</code>
is called. Will be true for input sources that are automatically
managed by stream reader (input streams created for
{@link java.net.URL} and {@link java.io.File} arguments, or when
configuration settings indicate auto-closing is to be enabled
(the default value is false as per Stax 1.0 specs). | [
"Method",
"that",
"is",
"eventually",
"called",
"to",
"create",
"a",
"(",
"full",
")",
"stream",
"read",
"instance",
".",
"<p",
">",
"Note",
":",
"defined",
"as",
"public",
"method",
"because",
"it",
"needs",
"to",
"be",
"called",
"by",
"SAX",
"implement... | train | https://github.com/FasterXML/woodstox/blob/ffcaabdc06672d9564c48c25d601d029b7fd6548/src/main/java/com/ctc/wstx/stax/WstxInputFactory.java#L611-L627 |
Azure/azure-sdk-for-java | cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java | DatabaseAccountsInner.listConnectionStrings | public DatabaseAccountListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, String accountName) {
"""
Lists the connection strings for the specified Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DatabaseAccountListConnectionStringsResultInner object if successful.
"""
return listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body();
} | java | public DatabaseAccountListConnectionStringsResultInner listConnectionStrings(String resourceGroupName, String accountName) {
return listConnectionStringsWithServiceResponseAsync(resourceGroupName, accountName).toBlocking().single().body();
} | [
"public",
"DatabaseAccountListConnectionStringsResultInner",
"listConnectionStrings",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
")",
"{",
"return",
"listConnectionStringsWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
")",
".",
"... | Lists the connection strings for the specified Azure Cosmos DB database account.
@param resourceGroupName Name of an Azure resource group.
@param accountName Cosmos DB database account name.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DatabaseAccountListConnectionStringsResultInner object if successful. | [
"Lists",
"the",
"connection",
"strings",
"for",
"the",
"specified",
"Azure",
"Cosmos",
"DB",
"database",
"account",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/DatabaseAccountsInner.java#L1198-L1200 |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java | SourceLineAnnotation.fromVisitedMethod | public static SourceLineAnnotation fromVisitedMethod(MethodGen methodGen, String sourceFile) {
"""
Factory method for creating a source line annotation describing an entire
method.
@param methodGen
the method being visited
@return the SourceLineAnnotation, or null if we do not have line number
information for the method
"""
LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool());
String className = methodGen.getClassName();
int codeSize = methodGen.getInstructionList().getLength();
if (lineNumberTable == null) {
return createUnknown(className, sourceFile, 0, codeSize - 1);
}
return forEntireMethod(className, sourceFile, lineNumberTable, codeSize);
} | java | public static SourceLineAnnotation fromVisitedMethod(MethodGen methodGen, String sourceFile) {
LineNumberTable lineNumberTable = methodGen.getLineNumberTable(methodGen.getConstantPool());
String className = methodGen.getClassName();
int codeSize = methodGen.getInstructionList().getLength();
if (lineNumberTable == null) {
return createUnknown(className, sourceFile, 0, codeSize - 1);
}
return forEntireMethod(className, sourceFile, lineNumberTable, codeSize);
} | [
"public",
"static",
"SourceLineAnnotation",
"fromVisitedMethod",
"(",
"MethodGen",
"methodGen",
",",
"String",
"sourceFile",
")",
"{",
"LineNumberTable",
"lineNumberTable",
"=",
"methodGen",
".",
"getLineNumberTable",
"(",
"methodGen",
".",
"getConstantPool",
"(",
")",
... | Factory method for creating a source line annotation describing an entire
method.
@param methodGen
the method being visited
@return the SourceLineAnnotation, or null if we do not have line number
information for the method | [
"Factory",
"method",
"for",
"creating",
"a",
"source",
"line",
"annotation",
"describing",
"an",
"entire",
"method",
"."
] | train | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/SourceLineAnnotation.java#L237-L245 |
fuinorg/units4j | src/main/java/org/fuin/units4j/dependency/Utils.java | Utils.findAllowedByName | public static DependsOn findAllowedByName(final List<DependsOn> allowed, final String pkgName) {
"""
Find a dependency in a list by a package name.
@param allowed
List to search.
@param pkgName
Name of the package to find - Cannot be <code>null</code>.
@return Entry or <code>null</code> if nothing was found.
"""
if (allowed == null) {
return null;
}
Utils4J.checkNotNull("pkgName", pkgName);
for (int i = 0; i < allowed.size(); i++) {
final DependsOn dep = allowed.get(i);
if (pkgName.startsWith(dep.getPackageName())) {
if (dep.isIncludeSubPackages()) {
return dep;
} else {
if (pkgName.equals(dep.getPackageName())) {
return dep;
}
}
}
}
return null;
} | java | public static DependsOn findAllowedByName(final List<DependsOn> allowed, final String pkgName) {
if (allowed == null) {
return null;
}
Utils4J.checkNotNull("pkgName", pkgName);
for (int i = 0; i < allowed.size(); i++) {
final DependsOn dep = allowed.get(i);
if (pkgName.startsWith(dep.getPackageName())) {
if (dep.isIncludeSubPackages()) {
return dep;
} else {
if (pkgName.equals(dep.getPackageName())) {
return dep;
}
}
}
}
return null;
} | [
"public",
"static",
"DependsOn",
"findAllowedByName",
"(",
"final",
"List",
"<",
"DependsOn",
">",
"allowed",
",",
"final",
"String",
"pkgName",
")",
"{",
"if",
"(",
"allowed",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Utils4J",
".",
"checkNotNu... | Find a dependency in a list by a package name.
@param allowed
List to search.
@param pkgName
Name of the package to find - Cannot be <code>null</code>.
@return Entry or <code>null</code> if nothing was found. | [
"Find",
"a",
"dependency",
"in",
"a",
"list",
"by",
"a",
"package",
"name",
"."
] | train | https://github.com/fuinorg/units4j/blob/29383e30b0f9c246b309e734df9cc63dc5d5499e/src/main/java/org/fuin/units4j/dependency/Utils.java#L175-L193 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java | CmsSitemapController.createSitemapSubEntry | public void createSitemapSubEntry(final CmsClientSitemapEntry newEntry, CmsUUID parentId, String sitemapType) {
"""
Creates a sitemap folder.<p>
@param newEntry the new entry
@param parentId the entry parent id
@param sitemapType the resource type for the subsitemap folder
"""
CmsUUID structureId = m_data.getDefaultNewElementInfo().getCopyResourceId();
newEntry.setResourceTypeName(sitemapType);
create(newEntry, parentId, m_data.getDefaultNewElementInfo().getId(), structureId, null, true);
} | java | public void createSitemapSubEntry(final CmsClientSitemapEntry newEntry, CmsUUID parentId, String sitemapType) {
CmsUUID structureId = m_data.getDefaultNewElementInfo().getCopyResourceId();
newEntry.setResourceTypeName(sitemapType);
create(newEntry, parentId, m_data.getDefaultNewElementInfo().getId(), structureId, null, true);
} | [
"public",
"void",
"createSitemapSubEntry",
"(",
"final",
"CmsClientSitemapEntry",
"newEntry",
",",
"CmsUUID",
"parentId",
",",
"String",
"sitemapType",
")",
"{",
"CmsUUID",
"structureId",
"=",
"m_data",
".",
"getDefaultNewElementInfo",
"(",
")",
".",
"getCopyResourceI... | Creates a sitemap folder.<p>
@param newEntry the new entry
@param parentId the entry parent id
@param sitemapType the resource type for the subsitemap folder | [
"Creates",
"a",
"sitemap",
"folder",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L595-L600 |
snowflakedb/snowflake-jdbc | src/main/java/net/snowflake/client/core/EventHandler.java | EventHandler.pushEvent | private synchronized void pushEvent(Event event, boolean flushBuffer) {
"""
/*
Pushes an event onto the event buffer and flushes if specified or if
the buffer has reached maximum capacity.
"""
eventBuffer.add(event);
if (flushBuffer || eventBuffer.size() >= maxEntries)
{
this.flushEventBuffer();
}
} | java | private synchronized void pushEvent(Event event, boolean flushBuffer)
{
eventBuffer.add(event);
if (flushBuffer || eventBuffer.size() >= maxEntries)
{
this.flushEventBuffer();
}
} | [
"private",
"synchronized",
"void",
"pushEvent",
"(",
"Event",
"event",
",",
"boolean",
"flushBuffer",
")",
"{",
"eventBuffer",
".",
"add",
"(",
"event",
")",
";",
"if",
"(",
"flushBuffer",
"||",
"eventBuffer",
".",
"size",
"(",
")",
">=",
"maxEntries",
")"... | /*
Pushes an event onto the event buffer and flushes if specified or if
the buffer has reached maximum capacity. | [
"/",
"*",
"Pushes",
"an",
"event",
"onto",
"the",
"event",
"buffer",
"and",
"flushes",
"if",
"specified",
"or",
"if",
"the",
"buffer",
"has",
"reached",
"maximum",
"capacity",
"."
] | train | https://github.com/snowflakedb/snowflake-jdbc/blob/98567b5a57753f29d51446809640b969a099658f/src/main/java/net/snowflake/client/core/EventHandler.java#L234-L242 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/jumbotron/JumbotronRenderer.java | JumbotronRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
"""
This methods generates the HTML code of the current b:jumbotron.
<code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:jumbotron.
@throws IOException thrown if something goes wrong when writing the HTML code.
"""
if (!component.isRendered()) {
return;
}
Jumbotron jumbotron = (Jumbotron) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = jumbotron.getClientId();
rw.startElement("div", jumbotron);
rw.writeAttribute("id",clientId,"id");
if(BsfUtils.isStringValued(jumbotron.getStyle()))
rw.writeAttribute("style", jumbotron.getStyle(), "style");
Tooltip.generateTooltip(context, jumbotron, rw);
String styleClass = "jumbotron";
if(BsfUtils.isStringValued(jumbotron.getStyleClass()))
styleClass = styleClass + " " + jumbotron.getStyleClass();
rw.writeAttribute("class", styleClass, "class");
beginDisabledFieldset(jumbotron, rw);
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Jumbotron jumbotron = (Jumbotron) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = jumbotron.getClientId();
rw.startElement("div", jumbotron);
rw.writeAttribute("id",clientId,"id");
if(BsfUtils.isStringValued(jumbotron.getStyle()))
rw.writeAttribute("style", jumbotron.getStyle(), "style");
Tooltip.generateTooltip(context, jumbotron, rw);
String styleClass = "jumbotron";
if(BsfUtils.isStringValued(jumbotron.getStyleClass()))
styleClass = styleClass + " " + jumbotron.getStyleClass();
rw.writeAttribute("class", styleClass, "class");
beginDisabledFieldset(jumbotron, rw);
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Jumbotron",
"jumbot... | This methods generates the HTML code of the current b:jumbotron.
<code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:jumbotron.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"jumbotron",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framework"... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/jumbotron/JumbotronRenderer.java#L47-L69 |
rapidpro/expressions | java/src/main/java/io/rapidpro/expressions/utils/ExpressionUtils.java | ExpressionUtils.getDateFormatter | public static DateTimeFormatter getDateFormatter(DateStyle dateStyle, boolean incTime) {
"""
Gets a formatter for dates or datetimes
@param dateStyle whether parsing should be day-first or month-first
@param incTime whether to include time
@return the formatter
"""
String format = dateStyle.equals(DateStyle.DAY_FIRST) ? "dd-MM-yyyy" : "MM-dd-yyyy";
return DateTimeFormatter.ofPattern(incTime ? format + " HH:mm" : format);
} | java | public static DateTimeFormatter getDateFormatter(DateStyle dateStyle, boolean incTime) {
String format = dateStyle.equals(DateStyle.DAY_FIRST) ? "dd-MM-yyyy" : "MM-dd-yyyy";
return DateTimeFormatter.ofPattern(incTime ? format + " HH:mm" : format);
} | [
"public",
"static",
"DateTimeFormatter",
"getDateFormatter",
"(",
"DateStyle",
"dateStyle",
",",
"boolean",
"incTime",
")",
"{",
"String",
"format",
"=",
"dateStyle",
".",
"equals",
"(",
"DateStyle",
".",
"DAY_FIRST",
")",
"?",
"\"dd-MM-yyyy\"",
":",
"\"MM-dd-yyyy... | Gets a formatter for dates or datetimes
@param dateStyle whether parsing should be day-first or month-first
@param incTime whether to include time
@return the formatter | [
"Gets",
"a",
"formatter",
"for",
"dates",
"or",
"datetimes"
] | train | https://github.com/rapidpro/expressions/blob/b03d91ec58fc328960bce90ecb5fa49dcf467627/java/src/main/java/io/rapidpro/expressions/utils/ExpressionUtils.java#L105-L108 |
xcesco/kripton | kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java | PrimitiveUtils.readBoolean | public static Boolean readBoolean(String value, Boolean defaultValue) {
"""
Read boolean.
@param value the value
@param defaultValue the default value
@return the boolean
"""
if (!StringUtils.hasText(value)) return defaultValue;
return Boolean.valueOf(value);
} | java | public static Boolean readBoolean(String value, Boolean defaultValue) {
if (!StringUtils.hasText(value)) return defaultValue;
return Boolean.valueOf(value);
} | [
"public",
"static",
"Boolean",
"readBoolean",
"(",
"String",
"value",
",",
"Boolean",
"defaultValue",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"hasText",
"(",
"value",
")",
")",
"return",
"defaultValue",
";",
"return",
"Boolean",
".",
"valueOf",
"(",
... | Read boolean.
@param value the value
@param defaultValue the default value
@return the boolean | [
"Read",
"boolean",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/PrimitiveUtils.java#L31-L35 |
Metatavu/edelphi | edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java | GoogleDriveUtils.exportFile | public static DownloadResponse exportFile(Drive drive, File file, String format) throws IOException {
"""
Exports file in requested format
@param drive drive client
@param file file to be exported
@param format target format
@return exported data
@throws IOException thrown when exporting fails unexpectedly
"""
return exportFile(drive, file.getId(), format);
} | java | public static DownloadResponse exportFile(Drive drive, File file, String format) throws IOException {
return exportFile(drive, file.getId(), format);
} | [
"public",
"static",
"DownloadResponse",
"exportFile",
"(",
"Drive",
"drive",
",",
"File",
"file",
",",
"String",
"format",
")",
"throws",
"IOException",
"{",
"return",
"exportFile",
"(",
"drive",
",",
"file",
".",
"getId",
"(",
")",
",",
"format",
")",
";"... | Exports file in requested format
@param drive drive client
@param file file to be exported
@param format target format
@return exported data
@throws IOException thrown when exporting fails unexpectedly | [
"Exports",
"file",
"in",
"requested",
"format"
] | train | https://github.com/Metatavu/edelphi/blob/d91a0b54f954b33b4ee674a1bdf03612d76c3305/edelphi/src/main/java/fi/metatavu/edelphi/utils/GoogleDriveUtils.java#L245-L247 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java | MercatorProjection.pixelYToLatitudeWithScaleFactor | public static double pixelYToLatitudeWithScaleFactor(double pixelY, double scaleFactor, int tileSize) {
"""
Converts a pixel Y coordinate at a certain scale to a latitude coordinate.
@param pixelY the pixel Y coordinate that should be converted.
@param scaleFactor the scale factor at which the coordinate should be converted.
@return the latitude value of the pixel Y coordinate.
@throws IllegalArgumentException if the given pixelY coordinate is invalid.
"""
long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize);
if (pixelY < 0 || pixelY > mapSize) {
throw new IllegalArgumentException("invalid pixelY coordinate at scale " + scaleFactor + ": " + pixelY);
}
double y = 0.5 - (pixelY / mapSize);
return 90 - 360 * Math.atan(Math.exp(-y * (2 * Math.PI))) / Math.PI;
} | java | public static double pixelYToLatitudeWithScaleFactor(double pixelY, double scaleFactor, int tileSize) {
long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize);
if (pixelY < 0 || pixelY > mapSize) {
throw new IllegalArgumentException("invalid pixelY coordinate at scale " + scaleFactor + ": " + pixelY);
}
double y = 0.5 - (pixelY / mapSize);
return 90 - 360 * Math.atan(Math.exp(-y * (2 * Math.PI))) / Math.PI;
} | [
"public",
"static",
"double",
"pixelYToLatitudeWithScaleFactor",
"(",
"double",
"pixelY",
",",
"double",
"scaleFactor",
",",
"int",
"tileSize",
")",
"{",
"long",
"mapSize",
"=",
"getMapSizeWithScaleFactor",
"(",
"scaleFactor",
",",
"tileSize",
")",
";",
"if",
"(",... | Converts a pixel Y coordinate at a certain scale to a latitude coordinate.
@param pixelY the pixel Y coordinate that should be converted.
@param scaleFactor the scale factor at which the coordinate should be converted.
@return the latitude value of the pixel Y coordinate.
@throws IllegalArgumentException if the given pixelY coordinate is invalid. | [
"Converts",
"a",
"pixel",
"Y",
"coordinate",
"at",
"a",
"certain",
"scale",
"to",
"a",
"latitude",
"coordinate",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L390-L397 |
facebookarchive/hadoop-20 | src/core/org/apache/hadoop/conf/Configuration.java | Configuration.getBoolean | public boolean getBoolean(String name, boolean defaultValue) {
"""
Get the value of the <code>name</code> property as a <code>boolean</code>.
If no such property is specified, or if the specified value is not a valid
<code>boolean</code>, then <code>defaultValue</code> is returned.
@param name property name.
@param defaultValue default value.
@return property value as a <code>boolean</code>,
or <code>defaultValue</code>.
"""
String valueString = get(name);
if (valueString == null) {
return defaultValue;
}
valueString = valueString.toLowerCase();
if ("true".equals(valueString)) {
return true;
} else if ("false".equals(valueString)) {
return false;
}
throw new IllegalArgumentException("Invalid value of boolean conf option " + name + ": " +
valueString);
} | java | public boolean getBoolean(String name, boolean defaultValue) {
String valueString = get(name);
if (valueString == null) {
return defaultValue;
}
valueString = valueString.toLowerCase();
if ("true".equals(valueString)) {
return true;
} else if ("false".equals(valueString)) {
return false;
}
throw new IllegalArgumentException("Invalid value of boolean conf option " + name + ": " +
valueString);
} | [
"public",
"boolean",
"getBoolean",
"(",
"String",
"name",
",",
"boolean",
"defaultValue",
")",
"{",
"String",
"valueString",
"=",
"get",
"(",
"name",
")",
";",
"if",
"(",
"valueString",
"==",
"null",
")",
"{",
"return",
"defaultValue",
";",
"}",
"valueStri... | Get the value of the <code>name</code> property as a <code>boolean</code>.
If no such property is specified, or if the specified value is not a valid
<code>boolean</code>, then <code>defaultValue</code> is returned.
@param name property name.
@param defaultValue default value.
@return property value as a <code>boolean</code>,
or <code>defaultValue</code>. | [
"Get",
"the",
"value",
"of",
"the",
"<code",
">",
"name<",
"/",
"code",
">",
"property",
"as",
"a",
"<code",
">",
"boolean<",
"/",
"code",
">",
".",
"If",
"no",
"such",
"property",
"is",
"specified",
"or",
"if",
"the",
"specified",
"value",
"is",
"no... | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/conf/Configuration.java#L650-L665 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java | GVRPointLight.setDiffuseIntensity | public void setDiffuseIntensity(float r, float g, float b, float a) {
"""
Set the diffuse light intensity.
This designates the color of the diffuse reflection.
It is multiplied by the material diffuse color to derive
the hue of the diffuse reflection for that material.
The built-in phong shader {@link GVRPhongShader} uses a {@code vec4} uniform named
{@code diffuse_intensity} to control the intensity of diffuse light reflected.
@param r red component (0 to 1)
@param g green component (0 to 1)
@param b blue component (0 to 1)
@param a alpha component (0 to 1)
"""
setVec4("diffuse_intensity", r, g, b, a);
} | java | public void setDiffuseIntensity(float r, float g, float b, float a) {
setVec4("diffuse_intensity", r, g, b, a);
} | [
"public",
"void",
"setDiffuseIntensity",
"(",
"float",
"r",
",",
"float",
"g",
",",
"float",
"b",
",",
"float",
"a",
")",
"{",
"setVec4",
"(",
"\"diffuse_intensity\"",
",",
"r",
",",
"g",
",",
"b",
",",
"a",
")",
";",
"}"
] | Set the diffuse light intensity.
This designates the color of the diffuse reflection.
It is multiplied by the material diffuse color to derive
the hue of the diffuse reflection for that material.
The built-in phong shader {@link GVRPhongShader} uses a {@code vec4} uniform named
{@code diffuse_intensity} to control the intensity of diffuse light reflected.
@param r red component (0 to 1)
@param g green component (0 to 1)
@param b blue component (0 to 1)
@param a alpha component (0 to 1) | [
"Set",
"the",
"diffuse",
"light",
"intensity",
"."
] | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRPointLight.java#L150-L152 |
james-hu/jabb-core | src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java | AbstractHibernateDao.getAllBySql | public List< T> getAllBySql(String fullSql, Object paramValue, Type paramType) {
"""
Get all by SQL with one pair of parameterType-value
@param fullSql
@param paramValue
@param paramType
@return the query result
"""
return getAllBySql(fullSql, new Object[]{paramValue}, new Type[]{paramType}, null, null);
} | java | public List< T> getAllBySql(String fullSql, Object paramValue, Type paramType) {
return getAllBySql(fullSql, new Object[]{paramValue}, new Type[]{paramType}, null, null);
} | [
"public",
"List",
"<",
"T",
">",
"getAllBySql",
"(",
"String",
"fullSql",
",",
"Object",
"paramValue",
",",
"Type",
"paramType",
")",
"{",
"return",
"getAllBySql",
"(",
"fullSql",
",",
"new",
"Object",
"[",
"]",
"{",
"paramValue",
"}",
",",
"new",
"Type"... | Get all by SQL with one pair of parameterType-value
@param fullSql
@param paramValue
@param paramType
@return the query result | [
"Get",
"all",
"by",
"SQL",
"with",
"one",
"pair",
"of",
"parameterType",
"-",
"value"
] | train | https://github.com/james-hu/jabb-core/blob/bceed441595c5e5195a7418795f03b69fa7b61e4/src/main/java/net/sf/jabb/util/db/dao/AbstractHibernateDao.java#L254-L256 |
calimero-project/calimero-core | src/tuwien/auto/calimero/dptxlator/DPTXlatorDateTime.java | DPTXlatorDateTime.setValidField | public final void setValidField(final int field, final boolean valid) {
"""
Sets a date/time field of the first translation item to valid or not valid.
<p>
A field which is valid, i.e., contains valid data, has to be set <code>true</code>,
otherwise the field should be set not valid with <code>false</code>.<br>
Possible fields allowed to be set valid or not valid are {@link #YEAR},
{@link #DATE}, {@link #TIME}, {@link #DAY_OF_WEEK} and {@link #WORKDAY}.
@param field field number
@param valid <code>true</code> if field is supported and contains valid data,
<code>false</code> otherwise
"""
if (field < 0 || field >= FIELD_MASKS.length)
throw new KNXIllegalArgumentException("illegal field");
setBit(0, FIELD_MASKS[field], !valid);
} | java | public final void setValidField(final int field, final boolean valid)
{
if (field < 0 || field >= FIELD_MASKS.length)
throw new KNXIllegalArgumentException("illegal field");
setBit(0, FIELD_MASKS[field], !valid);
} | [
"public",
"final",
"void",
"setValidField",
"(",
"final",
"int",
"field",
",",
"final",
"boolean",
"valid",
")",
"{",
"if",
"(",
"field",
"<",
"0",
"||",
"field",
">=",
"FIELD_MASKS",
".",
"length",
")",
"throw",
"new",
"KNXIllegalArgumentException",
"(",
... | Sets a date/time field of the first translation item to valid or not valid.
<p>
A field which is valid, i.e., contains valid data, has to be set <code>true</code>,
otherwise the field should be set not valid with <code>false</code>.<br>
Possible fields allowed to be set valid or not valid are {@link #YEAR},
{@link #DATE}, {@link #TIME}, {@link #DAY_OF_WEEK} and {@link #WORKDAY}.
@param field field number
@param valid <code>true</code> if field is supported and contains valid data,
<code>false</code> otherwise | [
"Sets",
"a",
"date",
"/",
"time",
"field",
"of",
"the",
"first",
"translation",
"item",
"to",
"valid",
"or",
"not",
"valid",
".",
"<p",
">",
"A",
"field",
"which",
"is",
"valid",
"i",
".",
"e",
".",
"contains",
"valid",
"data",
"has",
"to",
"be",
"... | train | https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/dptxlator/DPTXlatorDateTime.java#L525-L530 |
maxmind/geoip-api-java | src/main/java/com/maxmind/geoip/LookupService.java | LookupService.getCountryV6 | public synchronized Country getCountryV6(InetAddress addr) {
"""
Returns the country the IP address is in.
@param addr
the IP address as Inet6Address.
@return the country the IP address is from.
"""
if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) {
throw new IllegalStateException("Database has been closed.");
}
int ret = seekCountryV6(addr) - COUNTRY_BEGIN;
if (ret == 0) {
return UNKNOWN_COUNTRY;
} else {
return new Country(countryCode[ret], countryName[ret]);
}
} | java | public synchronized Country getCountryV6(InetAddress addr) {
if (file == null && (dboptions & GEOIP_MEMORY_CACHE) == 0) {
throw new IllegalStateException("Database has been closed.");
}
int ret = seekCountryV6(addr) - COUNTRY_BEGIN;
if (ret == 0) {
return UNKNOWN_COUNTRY;
} else {
return new Country(countryCode[ret], countryName[ret]);
}
} | [
"public",
"synchronized",
"Country",
"getCountryV6",
"(",
"InetAddress",
"addr",
")",
"{",
"if",
"(",
"file",
"==",
"null",
"&&",
"(",
"dboptions",
"&",
"GEOIP_MEMORY_CACHE",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Database h... | Returns the country the IP address is in.
@param addr
the IP address as Inet6Address.
@return the country the IP address is from. | [
"Returns",
"the",
"country",
"the",
"IP",
"address",
"is",
"in",
"."
] | train | https://github.com/maxmind/geoip-api-java/blob/baae36617ba6c5004370642716bc6e526774ba87/src/main/java/com/maxmind/geoip/LookupService.java#L472-L482 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.attachSession | public void attachSession(List<ServiceInstanceToken> instanceTokens) {
"""
Attach ServiceInstance to the Session.
@param instanceTokens
the instance list.
"""
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.AttachSession);
String sessionId = connection.getSessionId();
AttachSessionProtocol protocol = new AttachSessionProtocol(instanceTokens, sessionId);
connection.submitRequest(header, protocol, null);
} | java | public void attachSession(List<ServiceInstanceToken> instanceTokens){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.AttachSession);
String sessionId = connection.getSessionId();
AttachSessionProtocol protocol = new AttachSessionProtocol(instanceTokens, sessionId);
connection.submitRequest(header, protocol, null);
} | [
"public",
"void",
"attachSession",
"(",
"List",
"<",
"ServiceInstanceToken",
">",
"instanceTokens",
")",
"{",
"ProtocolHeader",
"header",
"=",
"new",
"ProtocolHeader",
"(",
")",
";",
"header",
".",
"setType",
"(",
"ProtocolType",
".",
"AttachSession",
")",
";",
... | Attach ServiceInstance to the Session.
@param instanceTokens
the instance list. | [
"Attach",
"ServiceInstance",
"to",
"the",
"Session",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L531-L539 |
alkacon/opencms-core | src/org/opencms/ade/publish/CmsDirectPublishProject.java | CmsDirectPublishProject.addSubResources | protected void addSubResources(CmsObject cms, Set<CmsResource> resources) throws CmsException {
"""
Adds contents of folders to a list of resources.<p>
@param cms the CMS context to use
@param resources the resource list to which to add the folder contents
@throws CmsException if something goes wrong
"""
List<CmsResource> subResources = new ArrayList<CmsResource>();
CmsObject rootCms = OpenCms.initCmsObject(cms);
rootCms.getRequestContext().setSiteRoot("");
for (CmsResource res : resources) {
if (res.isFolder()) {
try {
List<CmsResource> childrenOfCurrentResource = rootCms.readResources(
res.getRootPath(),
CmsResourceFilter.ALL,
true);
subResources.addAll(childrenOfCurrentResource);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
resources.addAll(subResources);
} | java | protected void addSubResources(CmsObject cms, Set<CmsResource> resources) throws CmsException {
List<CmsResource> subResources = new ArrayList<CmsResource>();
CmsObject rootCms = OpenCms.initCmsObject(cms);
rootCms.getRequestContext().setSiteRoot("");
for (CmsResource res : resources) {
if (res.isFolder()) {
try {
List<CmsResource> childrenOfCurrentResource = rootCms.readResources(
res.getRootPath(),
CmsResourceFilter.ALL,
true);
subResources.addAll(childrenOfCurrentResource);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
}
resources.addAll(subResources);
} | [
"protected",
"void",
"addSubResources",
"(",
"CmsObject",
"cms",
",",
"Set",
"<",
"CmsResource",
">",
"resources",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"CmsResource",
">",
"subResources",
"=",
"new",
"ArrayList",
"<",
"CmsResource",
">",
"(",
")",
... | Adds contents of folders to a list of resources.<p>
@param cms the CMS context to use
@param resources the resource list to which to add the folder contents
@throws CmsException if something goes wrong | [
"Adds",
"contents",
"of",
"folders",
"to",
"a",
"list",
"of",
"resources",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/publish/CmsDirectPublishProject.java#L146-L165 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/ScanAPI.java | ScanAPI.productUpdate | public static ProductCreateResult productUpdate(String accessToken, ProductUpdate productUpdate) {
"""
更新商品信息
@param accessToken accessToken
@param productUpdate productUpdate
@return ProductCreateResult
"""
return productUpdate(accessToken, JsonUtil.toJSONString(productUpdate));
} | java | public static ProductCreateResult productUpdate(String accessToken, ProductUpdate productUpdate) {
return productUpdate(accessToken, JsonUtil.toJSONString(productUpdate));
} | [
"public",
"static",
"ProductCreateResult",
"productUpdate",
"(",
"String",
"accessToken",
",",
"ProductUpdate",
"productUpdate",
")",
"{",
"return",
"productUpdate",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"productUpdate",
")",
")",
";",
"}"
] | 更新商品信息
@param accessToken accessToken
@param productUpdate productUpdate
@return ProductCreateResult | [
"更新商品信息"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/ScanAPI.java#L220-L222 |
pressgang-ccms/PressGangCCMSContentSpec | src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java | CSTransformer.transformFileList | protected static FileList transformFileList(final CSNodeWrapper node) {
"""
Transforms a MetaData CSNode into a FileList that can be added to a ContentSpec object.
@param node The CSNode to be transformed.
@return The transformed FileList object.
"""
final List<File> files = new LinkedList<File>();
// Add all the child files
if (node.getChildren() != null && node.getChildren().getItems() != null) {
final List<CSNodeWrapper> childNodes = node.getChildren().getItems();
final HashMap<CSNodeWrapper, File> fileNodes = new HashMap<CSNodeWrapper, File>();
for (final CSNodeWrapper childNode : childNodes) {
fileNodes.put(childNode, transformFile(childNode));
}
// Sort the file list nodes so that they are in the right order based on next/prev values.
final LinkedHashMap<CSNodeWrapper, File> sortedMap = CSNodeSorter.sortMap(fileNodes);
// Add the child nodes to the file list now that they are in the right order.
final Iterator<Map.Entry<CSNodeWrapper, File>> iter = sortedMap.entrySet().iterator();
while (iter.hasNext()) {
final Map.Entry<CSNodeWrapper, File> entry = iter.next();
files.add(entry.getValue());
}
}
return new FileList(CommonConstants.CS_FILE_TITLE, files);
} | java | protected static FileList transformFileList(final CSNodeWrapper node) {
final List<File> files = new LinkedList<File>();
// Add all the child files
if (node.getChildren() != null && node.getChildren().getItems() != null) {
final List<CSNodeWrapper> childNodes = node.getChildren().getItems();
final HashMap<CSNodeWrapper, File> fileNodes = new HashMap<CSNodeWrapper, File>();
for (final CSNodeWrapper childNode : childNodes) {
fileNodes.put(childNode, transformFile(childNode));
}
// Sort the file list nodes so that they are in the right order based on next/prev values.
final LinkedHashMap<CSNodeWrapper, File> sortedMap = CSNodeSorter.sortMap(fileNodes);
// Add the child nodes to the file list now that they are in the right order.
final Iterator<Map.Entry<CSNodeWrapper, File>> iter = sortedMap.entrySet().iterator();
while (iter.hasNext()) {
final Map.Entry<CSNodeWrapper, File> entry = iter.next();
files.add(entry.getValue());
}
}
return new FileList(CommonConstants.CS_FILE_TITLE, files);
} | [
"protected",
"static",
"FileList",
"transformFileList",
"(",
"final",
"CSNodeWrapper",
"node",
")",
"{",
"final",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"LinkedList",
"<",
"File",
">",
"(",
")",
";",
"// Add all the child files",
"if",
"(",
"node",
"... | Transforms a MetaData CSNode into a FileList that can be added to a ContentSpec object.
@param node The CSNode to be transformed.
@return The transformed FileList object. | [
"Transforms",
"a",
"MetaData",
"CSNode",
"into",
"a",
"FileList",
"that",
"can",
"be",
"added",
"to",
"a",
"ContentSpec",
"object",
"."
] | train | https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java#L299-L322 |
mapfish/mapfish-print | core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java | PAbstractObject.getBool | @Override
public final boolean getBool(final String key) {
"""
Get a property as a boolean or throw exception.
@param key the property name
"""
Boolean result = optBool(key);
if (result == null) {
throw new ObjectMissingException(this, key);
}
return result;
} | java | @Override
public final boolean getBool(final String key) {
Boolean result = optBool(key);
if (result == null) {
throw new ObjectMissingException(this, key);
}
return result;
} | [
"@",
"Override",
"public",
"final",
"boolean",
"getBool",
"(",
"final",
"String",
"key",
")",
"{",
"Boolean",
"result",
"=",
"optBool",
"(",
"key",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"throw",
"new",
"ObjectMissingException",
"(",
"thi... | Get a property as a boolean or throw exception.
@param key the property name | [
"Get",
"a",
"property",
"as",
"a",
"boolean",
"or",
"throw",
"exception",
"."
] | train | https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/wrapper/PAbstractObject.java#L154-L161 |
jqno/equalsverifier | src/main/java/nl/jqno/equalsverifier/internal/reflection/ObjectAccessor.java | ObjectAccessor.scramble | public void scramble(PrefabValues prefabValues, TypeTag enclosingType) {
"""
Modifies all fields of the wrapped object that are declared in T and in
its superclasses.
This method is consistent: given two equal objects; after scrambling
both objects, they remain equal to each other.
It cannot modifiy:
1. static final fields, and
2. final fields that are initialized to a compile-time constant in the
field declaration.
These fields will be left unmodified.
@param prefabValues Prefabricated values to take values from.
@param enclosingType Describes the type that contains this object as a
field, to determine any generic parameters it may
contain.
"""
for (Field field : FieldIterable.of(type)) {
FieldAccessor accessor = new FieldAccessor(object, field);
accessor.changeField(prefabValues, enclosingType);
}
} | java | public void scramble(PrefabValues prefabValues, TypeTag enclosingType) {
for (Field field : FieldIterable.of(type)) {
FieldAccessor accessor = new FieldAccessor(object, field);
accessor.changeField(prefabValues, enclosingType);
}
} | [
"public",
"void",
"scramble",
"(",
"PrefabValues",
"prefabValues",
",",
"TypeTag",
"enclosingType",
")",
"{",
"for",
"(",
"Field",
"field",
":",
"FieldIterable",
".",
"of",
"(",
"type",
")",
")",
"{",
"FieldAccessor",
"accessor",
"=",
"new",
"FieldAccessor",
... | Modifies all fields of the wrapped object that are declared in T and in
its superclasses.
This method is consistent: given two equal objects; after scrambling
both objects, they remain equal to each other.
It cannot modifiy:
1. static final fields, and
2. final fields that are initialized to a compile-time constant in the
field declaration.
These fields will be left unmodified.
@param prefabValues Prefabricated values to take values from.
@param enclosingType Describes the type that contains this object as a
field, to determine any generic parameters it may
contain. | [
"Modifies",
"all",
"fields",
"of",
"the",
"wrapped",
"object",
"that",
"are",
"declared",
"in",
"T",
"and",
"in",
"its",
"superclasses",
"."
] | train | https://github.com/jqno/equalsverifier/blob/25d73c9cb801c8b20b257d1d1283ac6e0585ef1d/src/main/java/nl/jqno/equalsverifier/internal/reflection/ObjectAccessor.java#L140-L145 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/CloudSchedulerClient.java | CloudSchedulerClient.createJob | public final Job createJob(LocationName parent, Job job) {
"""
Creates a job.
<p>Sample code:
<pre><code>
try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Job job = Job.newBuilder().build();
Job response = cloudSchedulerClient.createJob(parent, job);
}
</code></pre>
@param parent Required.
<p>The location name. For example: `projects/PROJECT_ID/locations/LOCATION_ID`.
@param job Required.
<p>The job to add. The user can optionally specify a name for the job in
[name][google.cloud.scheduler.v1beta1.Job.name].
[name][google.cloud.scheduler.v1beta1.Job.name] cannot be the same as an existing job. If a
name is not specified then the system will generate a random unique name that will be
returned ([name][google.cloud.scheduler.v1beta1.Job.name]) in the response.
@throws com.google.api.gax.rpc.ApiException if the remote call fails
"""
CreateJobRequest request =
CreateJobRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setJob(job)
.build();
return createJob(request);
} | java | public final Job createJob(LocationName parent, Job job) {
CreateJobRequest request =
CreateJobRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setJob(job)
.build();
return createJob(request);
} | [
"public",
"final",
"Job",
"createJob",
"(",
"LocationName",
"parent",
",",
"Job",
"job",
")",
"{",
"CreateJobRequest",
"request",
"=",
"CreateJobRequest",
".",
"newBuilder",
"(",
")",
".",
"setParent",
"(",
"parent",
"==",
"null",
"?",
"null",
":",
"parent",... | Creates a job.
<p>Sample code:
<pre><code>
try (CloudSchedulerClient cloudSchedulerClient = CloudSchedulerClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
Job job = Job.newBuilder().build();
Job response = cloudSchedulerClient.createJob(parent, job);
}
</code></pre>
@param parent Required.
<p>The location name. For example: `projects/PROJECT_ID/locations/LOCATION_ID`.
@param job Required.
<p>The job to add. The user can optionally specify a name for the job in
[name][google.cloud.scheduler.v1beta1.Job.name].
[name][google.cloud.scheduler.v1beta1.Job.name] cannot be the same as an existing job. If a
name is not specified then the system will generate a random unique name that will be
returned ([name][google.cloud.scheduler.v1beta1.Job.name]) in the response.
@throws com.google.api.gax.rpc.ApiException if the remote call fails | [
"Creates",
"a",
"job",
"."
] | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-scheduler/src/main/java/com/google/cloud/scheduler/v1beta1/CloudSchedulerClient.java#L404-L412 |
imsweb/naaccr-xml | src/main/java/com/imsweb/naaccrxml/NaaccrXmlUtils.java | NaaccrXmlUtils.createReader | public static Reader createReader(File file) throws NaaccrIOException {
"""
Returns a generic reader for the provided file, taking care of the optional GZ compression.
@param file file to create the reader from, cannot be null
@return a generic reader to the file, never null
@throws NaaccrIOException if the reader cannot be created
"""
InputStream is = null;
try {
is = new FileInputStream(file);
if (file.getName().endsWith(".gz"))
is = new GZIPInputStream(is);
return new InputStreamReader(is, StandardCharsets.UTF_8);
}
catch (IOException e) {
if (is != null) {
try {
is.close();
}
catch (IOException e1) {
// give up
}
}
throw new NaaccrIOException(e.getMessage());
}
} | java | public static Reader createReader(File file) throws NaaccrIOException {
InputStream is = null;
try {
is = new FileInputStream(file);
if (file.getName().endsWith(".gz"))
is = new GZIPInputStream(is);
return new InputStreamReader(is, StandardCharsets.UTF_8);
}
catch (IOException e) {
if (is != null) {
try {
is.close();
}
catch (IOException e1) {
// give up
}
}
throw new NaaccrIOException(e.getMessage());
}
} | [
"public",
"static",
"Reader",
"createReader",
"(",
"File",
"file",
")",
"throws",
"NaaccrIOException",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"if",
"(",
"file",
".",
"getName",
... | Returns a generic reader for the provided file, taking care of the optional GZ compression.
@param file file to create the reader from, cannot be null
@return a generic reader to the file, never null
@throws NaaccrIOException if the reader cannot be created | [
"Returns",
"a",
"generic",
"reader",
"for",
"the",
"provided",
"file",
"taking",
"care",
"of",
"the",
"optional",
"GZ",
"compression",
"."
] | train | https://github.com/imsweb/naaccr-xml/blob/a3a501faa2a0c3411dd5248b2c1379f279131696/src/main/java/com/imsweb/naaccrxml/NaaccrXmlUtils.java#L475-L496 |
lessthanoptimal/BoofCV | main/boofcv-types/src/main/java/boofcv/alg/InputSanityCheck.java | InputSanityCheck.checkDeclare | public static <T extends ImageBase<T>> T checkDeclare(T input, T output) {
"""
If the output has not been declared a new instance is declared. If an instance of the output
is provided its bounds are checked.
"""
if (output == null) {
output = (T) input.createNew(input.width, input.height);
} else {
output.reshape(input.width, input.height);
}
return output;
} | java | public static <T extends ImageBase<T>> T checkDeclare(T input, T output) {
if (output == null) {
output = (T) input.createNew(input.width, input.height);
} else {
output.reshape(input.width, input.height);
}
return output;
} | [
"public",
"static",
"<",
"T",
"extends",
"ImageBase",
"<",
"T",
">",
">",
"T",
"checkDeclare",
"(",
"T",
"input",
",",
"T",
"output",
")",
"{",
"if",
"(",
"output",
"==",
"null",
")",
"{",
"output",
"=",
"(",
"T",
")",
"input",
".",
"createNew",
... | If the output has not been declared a new instance is declared. If an instance of the output
is provided its bounds are checked. | [
"If",
"the",
"output",
"has",
"not",
"been",
"declared",
"a",
"new",
"instance",
"is",
"declared",
".",
"If",
"an",
"instance",
"of",
"the",
"output",
"is",
"provided",
"its",
"bounds",
"are",
"checked",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-types/src/main/java/boofcv/alg/InputSanityCheck.java#L58-L65 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/hc/HCHelper.java | HCHelper.iterateChildren | public static void iterateChildren (@Nonnull final IHCNode aNode, @Nonnull final IHCIteratorCallback aCallback) {
"""
Recursively iterate all child nodes of the passed node.
@param aNode
The node who's children should be iterated.
@param aCallback
The callback to be invoked on every child
"""
ValueEnforcer.notNull (aNode, "node");
ValueEnforcer.notNull (aCallback, "callback");
_recursiveIterateTreeBreakable (aNode, aCallback);
} | java | public static void iterateChildren (@Nonnull final IHCNode aNode, @Nonnull final IHCIteratorCallback aCallback)
{
ValueEnforcer.notNull (aNode, "node");
ValueEnforcer.notNull (aCallback, "callback");
_recursiveIterateTreeBreakable (aNode, aCallback);
} | [
"public",
"static",
"void",
"iterateChildren",
"(",
"@",
"Nonnull",
"final",
"IHCNode",
"aNode",
",",
"@",
"Nonnull",
"final",
"IHCIteratorCallback",
"aCallback",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"aNode",
",",
"\"node\"",
")",
";",
"ValueEnforcer"... | Recursively iterate all child nodes of the passed node.
@param aNode
The node who's children should be iterated.
@param aCallback
The callback to be invoked on every child | [
"Recursively",
"iterate",
"all",
"child",
"nodes",
"of",
"the",
"passed",
"node",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/hc/HCHelper.java#L138-L144 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java | TileSystem.getX01FromLongitude | public double getX01FromLongitude(double longitude, boolean wrapEnabled) {
"""
Converts a longitude to its "X01" value,
id est a double between 0 and 1 for the whole longitude range
@since 6.0.0
"""
longitude = wrapEnabled ? Clip(longitude, getMinLongitude(), getMaxLongitude()) : longitude;
final double result = getX01FromLongitude(longitude);
return wrapEnabled ? Clip(result, 0, 1) : result;
} | java | public double getX01FromLongitude(double longitude, boolean wrapEnabled) {
longitude = wrapEnabled ? Clip(longitude, getMinLongitude(), getMaxLongitude()) : longitude;
final double result = getX01FromLongitude(longitude);
return wrapEnabled ? Clip(result, 0, 1) : result;
} | [
"public",
"double",
"getX01FromLongitude",
"(",
"double",
"longitude",
",",
"boolean",
"wrapEnabled",
")",
"{",
"longitude",
"=",
"wrapEnabled",
"?",
"Clip",
"(",
"longitude",
",",
"getMinLongitude",
"(",
")",
",",
"getMaxLongitude",
"(",
")",
")",
":",
"longi... | Converts a longitude to its "X01" value,
id est a double between 0 and 1 for the whole longitude range
@since 6.0.0 | [
"Converts",
"a",
"longitude",
"to",
"its",
"X01",
"value",
"id",
"est",
"a",
"double",
"between",
"0",
"and",
"1",
"for",
"the",
"whole",
"longitude",
"range"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java#L219-L223 |
Impetus/Kundera | src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java | CassandraSchemaManager.updateTable | private void updateTable(KsDef ksDef, TableInfo tableInfo) throws Exception {
"""
Update table.
@param ksDef
the ks def
@param tableInfo
the table info
@throws Exception
the exception
"""
for (CfDef cfDef : ksDef.getCf_defs())
{
if (cfDef.getName().equals(tableInfo.getTableName())
&& cfDef.getColumn_type().equals(ColumnFamilyType.getInstanceOf(tableInfo.getType()).name()))
{
boolean toUpdate = false;
if (cfDef.getColumn_type().equals(STANDARDCOLUMNFAMILY))
{
for (ColumnInfo columnInfo : tableInfo.getColumnMetadatas())
{
toUpdate = isCfDefUpdated(columnInfo, cfDef, isCql3Enabled(tableInfo),
isCounterColumnType(tableInfo, null), tableInfo) ? true : toUpdate;
}
}
if (toUpdate)
{
cassandra_client.system_update_column_family(cfDef);
}
createIndexUsingThrift(tableInfo, cfDef);
break;
}
}
} | java | private void updateTable(KsDef ksDef, TableInfo tableInfo) throws Exception
{
for (CfDef cfDef : ksDef.getCf_defs())
{
if (cfDef.getName().equals(tableInfo.getTableName())
&& cfDef.getColumn_type().equals(ColumnFamilyType.getInstanceOf(tableInfo.getType()).name()))
{
boolean toUpdate = false;
if (cfDef.getColumn_type().equals(STANDARDCOLUMNFAMILY))
{
for (ColumnInfo columnInfo : tableInfo.getColumnMetadatas())
{
toUpdate = isCfDefUpdated(columnInfo, cfDef, isCql3Enabled(tableInfo),
isCounterColumnType(tableInfo, null), tableInfo) ? true : toUpdate;
}
}
if (toUpdate)
{
cassandra_client.system_update_column_family(cfDef);
}
createIndexUsingThrift(tableInfo, cfDef);
break;
}
}
} | [
"private",
"void",
"updateTable",
"(",
"KsDef",
"ksDef",
",",
"TableInfo",
"tableInfo",
")",
"throws",
"Exception",
"{",
"for",
"(",
"CfDef",
"cfDef",
":",
"ksDef",
".",
"getCf_defs",
"(",
")",
")",
"{",
"if",
"(",
"cfDef",
".",
"getName",
"(",
")",
".... | Update table.
@param ksDef
the ks def
@param tableInfo
the table info
@throws Exception
the exception | [
"Update",
"table",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-cassandra/cassandra-core/src/main/java/com/impetus/client/cassandra/schemamanager/CassandraSchemaManager.java#L1969-L1993 |
Azure/azure-sdk-for-java | kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java | DatabasesInner.listByClusterAsync | public Observable<List<DatabaseInner>> listByClusterAsync(String resourceGroupName, String clusterName) {
"""
Returns the list of databases of the given Kusto cluster.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<DatabaseInner> object
"""
return listByClusterWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<List<DatabaseInner>>, List<DatabaseInner>>() {
@Override
public List<DatabaseInner> call(ServiceResponse<List<DatabaseInner>> response) {
return response.body();
}
});
} | java | public Observable<List<DatabaseInner>> listByClusterAsync(String resourceGroupName, String clusterName) {
return listByClusterWithServiceResponseAsync(resourceGroupName, clusterName).map(new Func1<ServiceResponse<List<DatabaseInner>>, List<DatabaseInner>>() {
@Override
public List<DatabaseInner> call(ServiceResponse<List<DatabaseInner>> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"List",
"<",
"DatabaseInner",
">",
">",
"listByClusterAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"clusterName",
")",
"{",
"return",
"listByClusterWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"clusterName",
")",
... | Returns the list of databases of the given Kusto cluster.
@param resourceGroupName The name of the resource group containing the Kusto cluster.
@param clusterName The name of the Kusto cluster.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the List<DatabaseInner> object | [
"Returns",
"the",
"list",
"of",
"databases",
"of",
"the",
"given",
"Kusto",
"cluster",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L244-L251 |
Azure/azure-sdk-for-java | network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java | ExpressRoutePortsInner.createOrUpdate | public ExpressRoutePortInner createOrUpdate(String resourceGroupName, String expressRoutePortName, ExpressRoutePortInner parameters) {
"""
Creates or updates the specified ExpressRoutePort resource.
@param resourceGroupName The name of the resource group.
@param expressRoutePortName The name of the ExpressRoutePort resource.
@param parameters Parameters supplied to the create ExpressRoutePort operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRoutePortInner object if successful.
"""
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRoutePortName, parameters).toBlocking().last().body();
} | java | public ExpressRoutePortInner createOrUpdate(String resourceGroupName, String expressRoutePortName, ExpressRoutePortInner parameters) {
return createOrUpdateWithServiceResponseAsync(resourceGroupName, expressRoutePortName, parameters).toBlocking().last().body();
} | [
"public",
"ExpressRoutePortInner",
"createOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"expressRoutePortName",
",",
"ExpressRoutePortInner",
"parameters",
")",
"{",
"return",
"createOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"expressRoute... | Creates or updates the specified ExpressRoutePort resource.
@param resourceGroupName The name of the resource group.
@param expressRoutePortName The name of the ExpressRoutePort resource.
@param parameters Parameters supplied to the create ExpressRoutePort operation.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the ExpressRoutePortInner object if successful. | [
"Creates",
"or",
"updates",
"the",
"specified",
"ExpressRoutePort",
"resource",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRoutePortsInner.java#L362-L364 |
UrielCh/ovh-java-sdk | ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java | ApiOvhMe.identity_user_user_GET | public OvhUser identity_user_user_GET(String user) throws IOException {
"""
Get this object properties
REST: GET /me/identity/user/{user}
@param user [required] User's login
"""
String qPath = "/me/identity/user/{user}";
StringBuilder sb = path(qPath, user);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhUser.class);
} | java | public OvhUser identity_user_user_GET(String user) throws IOException {
String qPath = "/me/identity/user/{user}";
StringBuilder sb = path(qPath, user);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, OvhUser.class);
} | [
"public",
"OvhUser",
"identity_user_user_GET",
"(",
"String",
"user",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/me/identity/user/{user}\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
"user",
")",
";",
"String",
"resp",
"=",
... | Get this object properties
REST: GET /me/identity/user/{user}
@param user [required] User's login | [
"Get",
"this",
"object",
"properties"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L204-L209 |
mfornos/humanize | humanize-slim/src/main/java/humanize/Humanize.java | Humanize.parseSmartDateWithSeparator | public static Date parseSmartDateWithSeparator(final String dateStr, final String separator, final String... fmts) {
"""
<p>
Tries to parse a date string applying an array of non lenient format
patterns. The formats are automatically cached.
</p>
@param dateStr
The date string
@param separator
The separator regexp
@param fmts
An array of formats
@return the converted Date
@see #parseSmartDate(String, String...)
"""
String tmp = dateStr.replaceAll(separator, "/");
for (String fmt : fmts)
{
try
{
DateFormat df = dateFormat(fmt); // cached
df.setLenient(false);
return df.parse(tmp);
} catch (ParseException ignored)
{
//
}
}
throw new IllegalArgumentException("Unable to parse date '" + dateStr + "'");
} | java | public static Date parseSmartDateWithSeparator(final String dateStr, final String separator, final String... fmts)
{
String tmp = dateStr.replaceAll(separator, "/");
for (String fmt : fmts)
{
try
{
DateFormat df = dateFormat(fmt); // cached
df.setLenient(false);
return df.parse(tmp);
} catch (ParseException ignored)
{
//
}
}
throw new IllegalArgumentException("Unable to parse date '" + dateStr + "'");
} | [
"public",
"static",
"Date",
"parseSmartDateWithSeparator",
"(",
"final",
"String",
"dateStr",
",",
"final",
"String",
"separator",
",",
"final",
"String",
"...",
"fmts",
")",
"{",
"String",
"tmp",
"=",
"dateStr",
".",
"replaceAll",
"(",
"separator",
",",
"\"/\... | <p>
Tries to parse a date string applying an array of non lenient format
patterns. The formats are automatically cached.
</p>
@param dateStr
The date string
@param separator
The separator regexp
@param fmts
An array of formats
@return the converted Date
@see #parseSmartDate(String, String...) | [
"<p",
">",
"Tries",
"to",
"parse",
"a",
"date",
"string",
"applying",
"an",
"array",
"of",
"non",
"lenient",
"format",
"patterns",
".",
"The",
"formats",
"are",
"automatically",
"cached",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/mfornos/humanize/blob/59fc103045de9d217c9e77dbcb7621f992f46c63/humanize-slim/src/main/java/humanize/Humanize.java#L2216-L2234 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java | AppServicePlansInner.createOrUpdateVnetRouteAsync | public Observable<VnetRouteInner> createOrUpdateVnetRouteAsync(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) {
"""
Create or update a Virtual Network route in an App Service plan.
Create or update a Virtual Network route in an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param vnetName Name of the Virtual Network.
@param routeName Name of the Virtual Network route.
@param route Definition of the Virtual Network route.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VnetRouteInner object
"""
return createOrUpdateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route).map(new Func1<ServiceResponse<VnetRouteInner>, VnetRouteInner>() {
@Override
public VnetRouteInner call(ServiceResponse<VnetRouteInner> response) {
return response.body();
}
});
} | java | public Observable<VnetRouteInner> createOrUpdateVnetRouteAsync(String resourceGroupName, String name, String vnetName, String routeName, VnetRouteInner route) {
return createOrUpdateVnetRouteWithServiceResponseAsync(resourceGroupName, name, vnetName, routeName, route).map(new Func1<ServiceResponse<VnetRouteInner>, VnetRouteInner>() {
@Override
public VnetRouteInner call(ServiceResponse<VnetRouteInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"VnetRouteInner",
">",
"createOrUpdateVnetRouteAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
",",
"String",
"vnetName",
",",
"String",
"routeName",
",",
"VnetRouteInner",
"route",
")",
"{",
"return",
"createOrUpdateVne... | Create or update a Virtual Network route in an App Service plan.
Create or update a Virtual Network route in an App Service plan.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service plan.
@param vnetName Name of the Virtual Network.
@param routeName Name of the Virtual Network route.
@param route Definition of the Virtual Network route.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the VnetRouteInner object | [
"Create",
"or",
"update",
"a",
"Virtual",
"Network",
"route",
"in",
"an",
"App",
"Service",
"plan",
".",
"Create",
"or",
"update",
"a",
"Virtual",
"Network",
"route",
"in",
"an",
"App",
"Service",
"plan",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServicePlansInner.java#L3626-L3633 |
line/armeria | core/src/main/java/com/linecorp/armeria/client/limit/ConcurrencyLimitingHttpClient.java | ConcurrencyLimitingHttpClient.newDecorator | public static Function<Client<HttpRequest, HttpResponse>, ConcurrencyLimitingHttpClient> newDecorator(
int maxConcurrency, long timeout, TimeUnit unit) {
"""
Creates a new {@link Client} decorator that limits the concurrent number of active HTTP requests.
"""
validateAll(maxConcurrency, timeout, unit);
return delegate -> new ConcurrencyLimitingHttpClient(delegate, maxConcurrency, timeout, unit);
} | java | public static Function<Client<HttpRequest, HttpResponse>, ConcurrencyLimitingHttpClient> newDecorator(
int maxConcurrency, long timeout, TimeUnit unit) {
validateAll(maxConcurrency, timeout, unit);
return delegate -> new ConcurrencyLimitingHttpClient(delegate, maxConcurrency, timeout, unit);
} | [
"public",
"static",
"Function",
"<",
"Client",
"<",
"HttpRequest",
",",
"HttpResponse",
">",
",",
"ConcurrencyLimitingHttpClient",
">",
"newDecorator",
"(",
"int",
"maxConcurrency",
",",
"long",
"timeout",
",",
"TimeUnit",
"unit",
")",
"{",
"validateAll",
"(",
"... | Creates a new {@link Client} decorator that limits the concurrent number of active HTTP requests. | [
"Creates",
"a",
"new",
"{"
] | train | https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/client/limit/ConcurrencyLimitingHttpClient.java#L53-L57 |
OpenLiberty/open-liberty | dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/WSKeyStore.java | WSKeyStore.printWarning | public void printWarning(int daysBeforeExpireWarning, String keyStoreName, String alias, X509Certificate cert) {
"""
Print a warning about a certificate being expired or soon to be expired in
the keystore.
@param daysBeforeExpireWarning
@param keyStoreName
@param alias
@param cert
"""
try {
long millisDelta = ((((daysBeforeExpireWarning * 24L) * 60L) * 60L) * 1000L);
long millisBeforeExpiration = cert.getNotAfter().getTime() - System.currentTimeMillis();
long daysLeft = ((((millisBeforeExpiration / 1000L) / 60L) / 60L) / 24L);
// cert is already expired
if (millisBeforeExpiration < 0) {
Tr.error(tc, "ssl.expiration.expired.CWPKI0017E", new Object[] { alias, keyStoreName });
} else if (millisBeforeExpiration < millisDelta) {
Tr.warning(tc, "ssl.expiration.warning.CWPKI0016W", new Object[] { alias, keyStoreName, Long.valueOf(daysLeft) });
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "The certificate with alias " + alias + " from keyStore " + keyStoreName + " has " + daysLeft + " days left before expiring.");
}
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Exception reading KeyStore certificates during expiration check; " + e);
FFDCFilter.processException(e, getClass().getName(), "printWarning", this);
}
} | java | public void printWarning(int daysBeforeExpireWarning, String keyStoreName, String alias, X509Certificate cert) {
try {
long millisDelta = ((((daysBeforeExpireWarning * 24L) * 60L) * 60L) * 1000L);
long millisBeforeExpiration = cert.getNotAfter().getTime() - System.currentTimeMillis();
long daysLeft = ((((millisBeforeExpiration / 1000L) / 60L) / 60L) / 24L);
// cert is already expired
if (millisBeforeExpiration < 0) {
Tr.error(tc, "ssl.expiration.expired.CWPKI0017E", new Object[] { alias, keyStoreName });
} else if (millisBeforeExpiration < millisDelta) {
Tr.warning(tc, "ssl.expiration.warning.CWPKI0016W", new Object[] { alias, keyStoreName, Long.valueOf(daysLeft) });
} else {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "The certificate with alias " + alias + " from keyStore " + keyStoreName + " has " + daysLeft + " days left before expiring.");
}
} catch (Exception e) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(tc, "Exception reading KeyStore certificates during expiration check; " + e);
FFDCFilter.processException(e, getClass().getName(), "printWarning", this);
}
} | [
"public",
"void",
"printWarning",
"(",
"int",
"daysBeforeExpireWarning",
",",
"String",
"keyStoreName",
",",
"String",
"alias",
",",
"X509Certificate",
"cert",
")",
"{",
"try",
"{",
"long",
"millisDelta",
"=",
"(",
"(",
"(",
"(",
"daysBeforeExpireWarning",
"*",
... | Print a warning about a certificate being expired or soon to be expired in
the keystore.
@param daysBeforeExpireWarning
@param keyStoreName
@param alias
@param cert | [
"Print",
"a",
"warning",
"about",
"a",
"certificate",
"being",
"expired",
"or",
"soon",
"to",
"be",
"expired",
"in",
"the",
"keystore",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.ssl/src/com/ibm/ws/ssl/config/WSKeyStore.java#L1062-L1082 |
ist-dresden/composum | sling/core/commons/src/main/java/com/composum/sling/clientlibs/servlet/ClientlibServlet.java | ClientlibServlet.appendHashSuffix | public static String appendHashSuffix(String url, String hash) {
"""
Appends a suffix containing the hash code, if given. The file name is repeated to satisfy browsers
with the correct type and file name, though it is not used by the servlet.
@param url an url to which we append the suffix
@param hash optional, the hash code
@return the url with suffix /{hash}/{filename} appended, where {filename} is the last part of a / separated url.
"""
if (null == hash) return url;
Matcher matcher = FILENAME_PATTERN.matcher(url);
String fname = "";
if (matcher.find()) fname = matcher.group(0);
return url + "/" + hash + "/" + fname;
} | java | public static String appendHashSuffix(String url, String hash) {
if (null == hash) return url;
Matcher matcher = FILENAME_PATTERN.matcher(url);
String fname = "";
if (matcher.find()) fname = matcher.group(0);
return url + "/" + hash + "/" + fname;
} | [
"public",
"static",
"String",
"appendHashSuffix",
"(",
"String",
"url",
",",
"String",
"hash",
")",
"{",
"if",
"(",
"null",
"==",
"hash",
")",
"return",
"url",
";",
"Matcher",
"matcher",
"=",
"FILENAME_PATTERN",
".",
"matcher",
"(",
"url",
")",
";",
"Str... | Appends a suffix containing the hash code, if given. The file name is repeated to satisfy browsers
with the correct type and file name, though it is not used by the servlet.
@param url an url to which we append the suffix
@param hash optional, the hash code
@return the url with suffix /{hash}/{filename} appended, where {filename} is the last part of a / separated url. | [
"Appends",
"a",
"suffix",
"containing",
"the",
"hash",
"code",
"if",
"given",
".",
"The",
"file",
"name",
"is",
"repeated",
"to",
"satisfy",
"browsers",
"with",
"the",
"correct",
"type",
"and",
"file",
"name",
"though",
"it",
"is",
"not",
"used",
"by",
"... | train | https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/clientlibs/servlet/ClientlibServlet.java#L86-L92 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/WaitForFieldChangeHandler.java | WaitForFieldChangeHandler.setOwner | public void setOwner(ListenerOwner owner) {
"""
Set the field that owns this listener.
@owner The field that this listener is being added to (if null, this listener is being removed).
"""
if (owner == null)
{
if (m_messageListener != null)
{
m_messageListener.free();
m_messageListener = null;
}
}
super.setOwner(owner);
if (owner != null)
{
Record record = this.getOwner().getRecord();
MessageManager messageManager = ((Application)record.getTask().getApplication()).getMessageManager();
if (messageManager != null)
{
BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, this, null);
messageManager.addMessageFilter(messageFilter);
m_messageListener = new WaitForFieldChangeMessageListener(messageFilter, this);
record.setupRecordListener(m_messageListener, false, false); // I need to listen for record changes
}
}
} | java | public void setOwner(ListenerOwner owner)
{
if (owner == null)
{
if (m_messageListener != null)
{
m_messageListener.free();
m_messageListener = null;
}
}
super.setOwner(owner);
if (owner != null)
{
Record record = this.getOwner().getRecord();
MessageManager messageManager = ((Application)record.getTask().getApplication()).getMessageManager();
if (messageManager != null)
{
BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, this, null);
messageManager.addMessageFilter(messageFilter);
m_messageListener = new WaitForFieldChangeMessageListener(messageFilter, this);
record.setupRecordListener(m_messageListener, false, false); // I need to listen for record changes
}
}
} | [
"public",
"void",
"setOwner",
"(",
"ListenerOwner",
"owner",
")",
"{",
"if",
"(",
"owner",
"==",
"null",
")",
"{",
"if",
"(",
"m_messageListener",
"!=",
"null",
")",
"{",
"m_messageListener",
".",
"free",
"(",
")",
";",
"m_messageListener",
"=",
"null",
... | Set the field that owns this listener.
@owner The field that this listener is being added to (if null, this listener is being removed). | [
"Set",
"the",
"field",
"that",
"owns",
"this",
"listener",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/WaitForFieldChangeHandler.java#L77-L100 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java | DocFile.readResource | private static int readResource(DocPath resource, InputStream in, byte[] buf) throws ResourceIOException {
"""
Reads from an input stream opened from a given resource into a given buffer.
If an IOException occurs, it is wrapped in a ResourceIOException.
@param resource the resource for the stream
@param in the stream
@param buf the buffer
@return the number of bytes read, or -1 if at end of file
@throws ResourceIOException if an exception occurred while reading the stream
"""
try {
return in.read(buf);
} catch (IOException e) {
throw new ResourceIOException(resource, e);
}
} | java | private static int readResource(DocPath resource, InputStream in, byte[] buf) throws ResourceIOException {
try {
return in.read(buf);
} catch (IOException e) {
throw new ResourceIOException(resource, e);
}
} | [
"private",
"static",
"int",
"readResource",
"(",
"DocPath",
"resource",
",",
"InputStream",
"in",
",",
"byte",
"[",
"]",
"buf",
")",
"throws",
"ResourceIOException",
"{",
"try",
"{",
"return",
"in",
".",
"read",
"(",
"buf",
")",
";",
"}",
"catch",
"(",
... | Reads from an input stream opened from a given resource into a given buffer.
If an IOException occurs, it is wrapped in a ResourceIOException.
@param resource the resource for the stream
@param in the stream
@param buf the buffer
@return the number of bytes read, or -1 if at end of file
@throws ResourceIOException if an exception occurred while reading the stream | [
"Reads",
"from",
"an",
"input",
"stream",
"opened",
"from",
"a",
"given",
"resource",
"into",
"a",
"given",
"buffer",
".",
"If",
"an",
"IOException",
"occurs",
"it",
"is",
"wrapped",
"in",
"a",
"ResourceIOException",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/DocFile.java#L335-L341 |
comapi/comapi-sdk-android | COMAPI/foundation/src/main/java/com/comapi/internal/CallbackAdapter.java | CallbackAdapter.adapt | public <T> void adapt(@NonNull final Observable<T> subscriber, @Nullable final Callback<T> callback) {
"""
Changes observables into callbacks.
@param subscriber Observable to subscribe to.
@param callback Callback where onError and onNext from Observable will be delivered
@param <T> Class of the result.
"""
subscriber.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<T>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
if (callback != null) {
callback.error(e);
}
}
@Override
public void onNext(T result) {
if (callback != null) {
callback.success(result);
}
}
});
} | java | public <T> void adapt(@NonNull final Observable<T> subscriber, @Nullable final Callback<T> callback) {
subscriber.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Subscriber<T>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
if (callback != null) {
callback.error(e);
}
}
@Override
public void onNext(T result) {
if (callback != null) {
callback.success(result);
}
}
});
} | [
"public",
"<",
"T",
">",
"void",
"adapt",
"(",
"@",
"NonNull",
"final",
"Observable",
"<",
"T",
">",
"subscriber",
",",
"@",
"Nullable",
"final",
"Callback",
"<",
"T",
">",
"callback",
")",
"{",
"subscriber",
".",
"subscribeOn",
"(",
"Schedulers",
".",
... | Changes observables into callbacks.
@param subscriber Observable to subscribe to.
@param callback Callback where onError and onNext from Observable will be delivered
@param <T> Class of the result. | [
"Changes",
"observables",
"into",
"callbacks",
"."
] | train | https://github.com/comapi/comapi-sdk-android/blob/53140a58d5a62afe196047ccc5120bfe090ef211/COMAPI/foundation/src/main/java/com/comapi/internal/CallbackAdapter.java#L49-L73 |
facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java | FSDirectory.updateSpaceConsumed | void updateSpaceConsumed(String path, long nsDelta, long dsDelta)
throws QuotaExceededException,
FileNotFoundException {
"""
Updates namespace and diskspace consumed for all
directories until the parent directory of file represented by path.
@param path path for the file.
@param nsDelta the delta change of namespace
@param dsDelta the delta change of diskspace
@throws QuotaExceededException if the new count violates any quota limit
@throws FileNotFound if path does not exist.
"""
updateSpaceConsumed(path, null, nsDelta, dsDelta);
} | java | void updateSpaceConsumed(String path, long nsDelta, long dsDelta)
throws QuotaExceededException,
FileNotFoundException {
updateSpaceConsumed(path, null, nsDelta, dsDelta);
} | [
"void",
"updateSpaceConsumed",
"(",
"String",
"path",
",",
"long",
"nsDelta",
",",
"long",
"dsDelta",
")",
"throws",
"QuotaExceededException",
",",
"FileNotFoundException",
"{",
"updateSpaceConsumed",
"(",
"path",
",",
"null",
",",
"nsDelta",
",",
"dsDelta",
")",
... | Updates namespace and diskspace consumed for all
directories until the parent directory of file represented by path.
@param path path for the file.
@param nsDelta the delta change of namespace
@param dsDelta the delta change of diskspace
@throws QuotaExceededException if the new count violates any quota limit
@throws FileNotFound if path does not exist. | [
"Updates",
"namespace",
"and",
"diskspace",
"consumed",
"for",
"all",
"directories",
"until",
"the",
"parent",
"directory",
"of",
"file",
"represented",
"by",
"path",
"."
] | train | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSDirectory.java#L2054-L2058 |
UrielCh/ovh-java-sdk | ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java | ApiOvhCaasregistry.serviceName_users_POST | public OvhUser serviceName_users_POST(String serviceName, OvhInputUser body) throws IOException {
"""
Create user
REST: POST /caas/registry/{serviceName}/users
@param body [required] A registry user account
@param serviceName [required] Service name
API beta
"""
String qPath = "/caas/registry/{serviceName}/users";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "POST", sb.toString(), body);
return convertTo(resp, OvhUser.class);
} | java | public OvhUser serviceName_users_POST(String serviceName, OvhInputUser body) throws IOException {
String qPath = "/caas/registry/{serviceName}/users";
StringBuilder sb = path(qPath, serviceName);
String resp = exec(qPath, "POST", sb.toString(), body);
return convertTo(resp, OvhUser.class);
} | [
"public",
"OvhUser",
"serviceName_users_POST",
"(",
"String",
"serviceName",
",",
"OvhInputUser",
"body",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
"=",
"\"/caas/registry/{serviceName}/users\"",
";",
"StringBuilder",
"sb",
"=",
"path",
"(",
"qPath",
",",
... | Create user
REST: POST /caas/registry/{serviceName}/users
@param body [required] A registry user account
@param serviceName [required] Service name
API beta | [
"Create",
"user"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-caasregistry/src/main/java/net/minidev/ovh/api/ApiOvhCaasregistry.java#L92-L97 |
jblas-project/jblas | src/main/java/org/jblas/ComplexDouble.java | ComplexDouble.addi | public ComplexDouble addi(ComplexDouble c, ComplexDouble result) {
"""
Add two complex numbers in-place
@param c other complex number
@param result complex number where result is stored
@return same as result
"""
if (this == result) {
r += c.r;
i += c.i;
} else {
result.r = r + c.r;
result.i = i + c.i;
}
return result;
} | java | public ComplexDouble addi(ComplexDouble c, ComplexDouble result) {
if (this == result) {
r += c.r;
i += c.i;
} else {
result.r = r + c.r;
result.i = i + c.i;
}
return result;
} | [
"public",
"ComplexDouble",
"addi",
"(",
"ComplexDouble",
"c",
",",
"ComplexDouble",
"result",
")",
"{",
"if",
"(",
"this",
"==",
"result",
")",
"{",
"r",
"+=",
"c",
".",
"r",
";",
"i",
"+=",
"c",
".",
"i",
";",
"}",
"else",
"{",
"result",
".",
"r... | Add two complex numbers in-place
@param c other complex number
@param result complex number where result is stored
@return same as result | [
"Add",
"two",
"complex",
"numbers",
"in",
"-",
"place"
] | train | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/ComplexDouble.java#L101-L110 |
op4j/op4j | src/main/java/org/op4j/functions/Call.java | Call.bigInteger | public static Function<Object,BigInteger> bigInteger(final String methodName, final Object... optionalParameters) {
"""
<p>
Abbreviation for {{@link #methodForBigInteger(String, Object...)}.
</p>
@since 1.1
@param methodName the name of the method
@param optionalParameters the (optional) parameters of the method.
@return the result of the method execution
"""
return methodForBigInteger(methodName, optionalParameters);
} | java | public static Function<Object,BigInteger> bigInteger(final String methodName, final Object... optionalParameters) {
return methodForBigInteger(methodName, optionalParameters);
} | [
"public",
"static",
"Function",
"<",
"Object",
",",
"BigInteger",
">",
"bigInteger",
"(",
"final",
"String",
"methodName",
",",
"final",
"Object",
"...",
"optionalParameters",
")",
"{",
"return",
"methodForBigInteger",
"(",
"methodName",
",",
"optionalParameters",
... | <p>
Abbreviation for {{@link #methodForBigInteger(String, Object...)}.
</p>
@since 1.1
@param methodName the name of the method
@param optionalParameters the (optional) parameters of the method.
@return the result of the method execution | [
"<p",
">",
"Abbreviation",
"for",
"{{",
"@link",
"#methodForBigInteger",
"(",
"String",
"Object",
"...",
")",
"}",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/Call.java#L147-L149 |
jfoenixadmin/JFoenix | jfoenix/src/main/java/com/jfoenix/controls/JFXTooltip.java | JFXTooltip.install | public static void install(Node node, JFXTooltip tooltip, Pos pos) {
"""
Associates the given {@link JFXTooltip} tooltip to the given node.
The tooltip will be shown according to the given {@link Pos} pos
@param node
@param tooltip
"""
tooltip.setPos(pos);
BEHAVIOR.install(node, tooltip);
} | java | public static void install(Node node, JFXTooltip tooltip, Pos pos) {
tooltip.setPos(pos);
BEHAVIOR.install(node, tooltip);
} | [
"public",
"static",
"void",
"install",
"(",
"Node",
"node",
",",
"JFXTooltip",
"tooltip",
",",
"Pos",
"pos",
")",
"{",
"tooltip",
".",
"setPos",
"(",
"pos",
")",
";",
"BEHAVIOR",
".",
"install",
"(",
"node",
",",
"tooltip",
")",
";",
"}"
] | Associates the given {@link JFXTooltip} tooltip to the given node.
The tooltip will be shown according to the given {@link Pos} pos
@param node
@param tooltip | [
"Associates",
"the",
"given",
"{",
"@link",
"JFXTooltip",
"}",
"tooltip",
"to",
"the",
"given",
"node",
".",
"The",
"tooltip",
"will",
"be",
"shown",
"according",
"to",
"the",
"given",
"{",
"@link",
"Pos",
"}",
"pos"
] | train | https://github.com/jfoenixadmin/JFoenix/blob/53235b5f561da4a515ef716059b8a8df5239ffa1/jfoenix/src/main/java/com/jfoenix/controls/JFXTooltip.java#L102-L105 |
google/j2objc | translator/src/main/java/com/google/devtools/j2objc/gen/SignatureGenerator.java | SignatureGenerator.genMethodTypeSignature | private void genMethodTypeSignature(ExecutableElement method, StringBuilder sb) {
"""
MethodTypeSignature ::= [FormalTypeParameters]
"(" {TypeSignature} ")" ReturnType {ThrowsSignature}.
"""
genOptFormalTypeParameters(method.getTypeParameters(), sb);
sb.append('(');
for (VariableElement param : method.getParameters()) {
genTypeSignature(param.asType(), sb);
}
sb.append(')');
genTypeSignature(method.getReturnType(), sb);
List<? extends TypeMirror> thrownTypes = method.getThrownTypes();
if (hasGenericSignature(thrownTypes)) {
for (TypeMirror thrownType : thrownTypes) {
sb.append('^');
genTypeSignature(thrownType, sb);
}
}
} | java | private void genMethodTypeSignature(ExecutableElement method, StringBuilder sb) {
genOptFormalTypeParameters(method.getTypeParameters(), sb);
sb.append('(');
for (VariableElement param : method.getParameters()) {
genTypeSignature(param.asType(), sb);
}
sb.append(')');
genTypeSignature(method.getReturnType(), sb);
List<? extends TypeMirror> thrownTypes = method.getThrownTypes();
if (hasGenericSignature(thrownTypes)) {
for (TypeMirror thrownType : thrownTypes) {
sb.append('^');
genTypeSignature(thrownType, sb);
}
}
} | [
"private",
"void",
"genMethodTypeSignature",
"(",
"ExecutableElement",
"method",
",",
"StringBuilder",
"sb",
")",
"{",
"genOptFormalTypeParameters",
"(",
"method",
".",
"getTypeParameters",
"(",
")",
",",
"sb",
")",
";",
"sb",
".",
"append",
"(",
"'",
"'",
")"... | MethodTypeSignature ::= [FormalTypeParameters]
"(" {TypeSignature} ")" ReturnType {ThrowsSignature}. | [
"MethodTypeSignature",
"::",
"=",
"[",
"FormalTypeParameters",
"]",
"(",
"{",
"TypeSignature",
"}",
")",
"ReturnType",
"{",
"ThrowsSignature",
"}",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/gen/SignatureGenerator.java#L347-L362 |
apache/groovy | subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java | DateTimeExtensions.plus | public static DayOfWeek plus(final DayOfWeek self, int days) {
"""
Returns the {@link java.time.DayOfWeek} that is {@code days} many days after this day of the week.
@param self a DayOfWeek
@param days the number of days to move forward
@return the DayOfWeek
@since 2.5.0
"""
int daysPerWeek = DayOfWeek.values().length;
int val = ((self.getValue() + days - 1) % daysPerWeek) + 1;
return DayOfWeek.of(val > 0 ? val : daysPerWeek + val);
} | java | public static DayOfWeek plus(final DayOfWeek self, int days) {
int daysPerWeek = DayOfWeek.values().length;
int val = ((self.getValue() + days - 1) % daysPerWeek) + 1;
return DayOfWeek.of(val > 0 ? val : daysPerWeek + val);
} | [
"public",
"static",
"DayOfWeek",
"plus",
"(",
"final",
"DayOfWeek",
"self",
",",
"int",
"days",
")",
"{",
"int",
"daysPerWeek",
"=",
"DayOfWeek",
".",
"values",
"(",
")",
".",
"length",
";",
"int",
"val",
"=",
"(",
"(",
"self",
".",
"getValue",
"(",
... | Returns the {@link java.time.DayOfWeek} that is {@code days} many days after this day of the week.
@param self a DayOfWeek
@param days the number of days to move forward
@return the DayOfWeek
@since 2.5.0 | [
"Returns",
"the",
"{",
"@link",
"java",
".",
"time",
".",
"DayOfWeek",
"}",
"that",
"is",
"{",
"@code",
"days",
"}",
"many",
"days",
"after",
"this",
"day",
"of",
"the",
"week",
"."
] | train | https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-datetime/src/main/java/org/apache/groovy/datetime/extensions/DateTimeExtensions.java#L1980-L1984 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.node2String | public static String node2String(final Node node, boolean prettyPrint, String encoding) throws UnsupportedEncodingException {
"""
Converts XML node in specified pretty mode and encoding to string.
@param node XML document or element
@param prettyPrint whether XML have to be pretty formated
@param encoding to use
@return XML string
@throws UnsupportedEncodingException
"""
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
new DOMWriter(new PrintWriter(baos), encoding).setPrettyprint(prettyPrint).print(node);
return baos.toString(encoding);
} | java | public static String node2String(final Node node, boolean prettyPrint, String encoding) throws UnsupportedEncodingException
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
new DOMWriter(new PrintWriter(baos), encoding).setPrettyprint(prettyPrint).print(node);
return baos.toString(encoding);
} | [
"public",
"static",
"String",
"node2String",
"(",
"final",
"Node",
"node",
",",
"boolean",
"prettyPrint",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"final",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",... | Converts XML node in specified pretty mode and encoding to string.
@param node XML document or element
@param prettyPrint whether XML have to be pretty formated
@param encoding to use
@return XML string
@throws UnsupportedEncodingException | [
"Converts",
"XML",
"node",
"in",
"specified",
"pretty",
"mode",
"and",
"encoding",
"to",
"string",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L471-L476 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java | WSJdbcResultSet.updateObject | public void updateObject(int arg0, Object arg1, int arg2) throws SQLException {
"""
Updates a column with an Object value. The updateXXX methods are used to update column values in
the current row, or the insert row. The updateXXX methods do not update the underlying database; instead the
updateRow or insertRow methods are called to update the database.
@param columnIndex - the first column is 1, the second is 2, ...
x - the new column value
scale - For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types this is the number of digits after
the decimal. For all other types this value will be ignored.
@throws SQLException if a database access error occurs.
"""
try {
rsetImpl.updateObject(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateObject", "3737", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | java | public void updateObject(int arg0, Object arg1, int arg2) throws SQLException {
try {
rsetImpl.updateObject(arg0, arg1, arg2);
} catch (SQLException ex) {
FFDCFilter.processException(ex, "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.updateObject", "3737", this);
throw WSJdbcUtil.mapException(this, ex);
} catch (NullPointerException nullX) {
// No FFDC code needed; we might be closed.
throw runtimeXIfNotClosed(nullX);
}
} | [
"public",
"void",
"updateObject",
"(",
"int",
"arg0",
",",
"Object",
"arg1",
",",
"int",
"arg2",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"rsetImpl",
".",
"updateObject",
"(",
"arg0",
",",
"arg1",
",",
"arg2",
")",
";",
"}",
"catch",
"(",
"SQLEx... | Updates a column with an Object value. The updateXXX methods are used to update column values in
the current row, or the insert row. The updateXXX methods do not update the underlying database; instead the
updateRow or insertRow methods are called to update the database.
@param columnIndex - the first column is 1, the second is 2, ...
x - the new column value
scale - For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types this is the number of digits after
the decimal. For all other types this value will be ignored.
@throws SQLException if a database access error occurs. | [
"Updates",
"a",
"column",
"with",
"an",
"Object",
"value",
".",
"The",
"updateXXX",
"methods",
"are",
"used",
"to",
"update",
"column",
"values",
"in",
"the",
"current",
"row",
"or",
"the",
"insert",
"row",
".",
"The",
"updateXXX",
"methods",
"do",
"not",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/jdbc/WSJdbcResultSet.java#L4113-L4123 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptor.java | RequestInterceptor.postInvoke | public void postInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException {
"""
Callback invoked after the request is processed. {@link #postRequest} may be used instead.
"""
postRequest( ( RequestInterceptorContext ) context, chain );
} | java | public void postInvoke( InterceptorContext context, InterceptorChain chain ) throws InterceptorException
{
postRequest( ( RequestInterceptorContext ) context, chain );
} | [
"public",
"void",
"postInvoke",
"(",
"InterceptorContext",
"context",
",",
"InterceptorChain",
"chain",
")",
"throws",
"InterceptorException",
"{",
"postRequest",
"(",
"(",
"RequestInterceptorContext",
")",
"context",
",",
"chain",
")",
";",
"}"
] | Callback invoked after the request is processed. {@link #postRequest} may be used instead. | [
"Callback",
"invoked",
"after",
"the",
"request",
"is",
"processed",
".",
"{"
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/request/RequestInterceptor.java#L64-L67 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java | MappedParametrizedObjectEntry.getParameterTime | public Long getParameterTime(String name, Long defaultValue) {
"""
Parse named parameter using {@link StringNumberParser#parseTime(String)} and return time in
milliseconds (Long value).
@param name
parameter name
@param defaultValue
default time value
@return
"""
String value = getParameterValue(name, null);
if (value != null)
{
try
{
return StringNumberParser.parseTime(value);
}
catch (NumberFormatException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
}
return defaultValue;
} | java | public Long getParameterTime(String name, Long defaultValue)
{
String value = getParameterValue(name, null);
if (value != null)
{
try
{
return StringNumberParser.parseTime(value);
}
catch (NumberFormatException e)
{
if (LOG.isTraceEnabled())
{
LOG.trace("An exception occurred: " + e.getMessage());
}
}
}
return defaultValue;
} | [
"public",
"Long",
"getParameterTime",
"(",
"String",
"name",
",",
"Long",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getParameterValue",
"(",
"name",
",",
"null",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"String... | Parse named parameter using {@link StringNumberParser#parseTime(String)} and return time in
milliseconds (Long value).
@param name
parameter name
@param defaultValue
default time value
@return | [
"Parse",
"named",
"parameter",
"using",
"{",
"@link",
"StringNumberParser#parseTime",
"(",
"String",
")",
"}",
"and",
"return",
"time",
"in",
"milliseconds",
"(",
"Long",
"value",
")",
"."
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java#L298-L317 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformpolicylabel.java | transformpolicylabel.get | public static transformpolicylabel get(nitro_service service, String labelname) throws Exception {
"""
Use this API to fetch transformpolicylabel resource of given name .
"""
transformpolicylabel obj = new transformpolicylabel();
obj.set_labelname(labelname);
transformpolicylabel response = (transformpolicylabel) obj.get_resource(service);
return response;
} | java | public static transformpolicylabel get(nitro_service service, String labelname) throws Exception{
transformpolicylabel obj = new transformpolicylabel();
obj.set_labelname(labelname);
transformpolicylabel response = (transformpolicylabel) obj.get_resource(service);
return response;
} | [
"public",
"static",
"transformpolicylabel",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"labelname",
")",
"throws",
"Exception",
"{",
"transformpolicylabel",
"obj",
"=",
"new",
"transformpolicylabel",
"(",
")",
";",
"obj",
".",
"set_labelname",
"(",
"la... | Use this API to fetch transformpolicylabel resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"transformpolicylabel",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/transform/transformpolicylabel.java#L331-L336 |
lightblueseas/file-worker | src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java | CopyFileExtensions.copyDirectory | public static boolean copyDirectory(final File source, final File destination)
throws FileIsSecurityRestrictedException, IOException, FileIsADirectoryException,
FileIsNotADirectoryException, DirectoryAlreadyExistsException {
"""
Copies the given source directory to the given destination directory.
@param source
The source directory.
@param destination
The destination directory.
@return 's true if the directory is copied, otherwise false.
@throws FileIsSecurityRestrictedException
Is thrown if the source file is security restricted.
@throws IOException
Is thrown if an error occurs by reading or writing.
@throws FileIsADirectoryException
Is thrown if the destination file is a directory.
@throws FileIsNotADirectoryException
Is thrown if the source file is not a directory.
@throws DirectoryAlreadyExistsException
Is thrown if the directory all ready exists.
"""
return copyDirectory(source, destination, true);
} | java | public static boolean copyDirectory(final File source, final File destination)
throws FileIsSecurityRestrictedException, IOException, FileIsADirectoryException,
FileIsNotADirectoryException, DirectoryAlreadyExistsException
{
return copyDirectory(source, destination, true);
} | [
"public",
"static",
"boolean",
"copyDirectory",
"(",
"final",
"File",
"source",
",",
"final",
"File",
"destination",
")",
"throws",
"FileIsSecurityRestrictedException",
",",
"IOException",
",",
"FileIsADirectoryException",
",",
"FileIsNotADirectoryException",
",",
"Direct... | Copies the given source directory to the given destination directory.
@param source
The source directory.
@param destination
The destination directory.
@return 's true if the directory is copied, otherwise false.
@throws FileIsSecurityRestrictedException
Is thrown if the source file is security restricted.
@throws IOException
Is thrown if an error occurs by reading or writing.
@throws FileIsADirectoryException
Is thrown if the destination file is a directory.
@throws FileIsNotADirectoryException
Is thrown if the source file is not a directory.
@throws DirectoryAlreadyExistsException
Is thrown if the directory all ready exists. | [
"Copies",
"the",
"given",
"source",
"directory",
"to",
"the",
"given",
"destination",
"directory",
"."
] | train | https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L80-L85 |
getsentry/sentry-java | sentry/src/main/java/io/sentry/util/Util.java | Util.parseLong | public static Long parseLong(String value, Long defaultValue) {
"""
Parses the provided string value into a long value.
<p>If the string is null or empty this returns the default value.</p>
@param value value to parse
@param defaultValue default value
@return long representation of provided value or default value.
"""
if (isNullOrEmpty(value)) {
return defaultValue;
}
return Long.parseLong(value);
} | java | public static Long parseLong(String value, Long defaultValue) {
if (isNullOrEmpty(value)) {
return defaultValue;
}
return Long.parseLong(value);
} | [
"public",
"static",
"Long",
"parseLong",
"(",
"String",
"value",
",",
"Long",
"defaultValue",
")",
"{",
"if",
"(",
"isNullOrEmpty",
"(",
"value",
")",
")",
"{",
"return",
"defaultValue",
";",
"}",
"return",
"Long",
".",
"parseLong",
"(",
"value",
")",
";... | Parses the provided string value into a long value.
<p>If the string is null or empty this returns the default value.</p>
@param value value to parse
@param defaultValue default value
@return long representation of provided value or default value. | [
"Parses",
"the",
"provided",
"string",
"value",
"into",
"a",
"long",
"value",
".",
"<p",
">",
"If",
"the",
"string",
"is",
"null",
"or",
"empty",
"this",
"returns",
"the",
"default",
"value",
".",
"<",
"/",
"p",
">"
] | train | https://github.com/getsentry/sentry-java/blob/2e01461775cbd5951ff82b566069c349146d8aca/sentry/src/main/java/io/sentry/util/Util.java#L117-L122 |
Nexmo/nexmo-java | src/main/java/com/nexmo/client/auth/MD5Util.java | MD5Util.calculateMd5 | public static String calculateMd5(String input) throws NoSuchAlgorithmException {
"""
Calculates MD5 hash for string. assume string is UTF-8 encoded
@param input string which is going to be encoded into MD5 format
@return MD5 representation of the input string
@throws NoSuchAlgorithmException if the MD5 algorithm is not available.
"""
try {
return calculateMd5(input, "UTF-8");
} catch (UnsupportedEncodingException e) {
return null; // -- impossible --
}
} | java | public static String calculateMd5(String input) throws NoSuchAlgorithmException {
try {
return calculateMd5(input, "UTF-8");
} catch (UnsupportedEncodingException e) {
return null; // -- impossible --
}
} | [
"public",
"static",
"String",
"calculateMd5",
"(",
"String",
"input",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"try",
"{",
"return",
"calculateMd5",
"(",
"input",
",",
"\"UTF-8\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{"... | Calculates MD5 hash for string. assume string is UTF-8 encoded
@param input string which is going to be encoded into MD5 format
@return MD5 representation of the input string
@throws NoSuchAlgorithmException if the MD5 algorithm is not available. | [
"Calculates",
"MD5",
"hash",
"for",
"string",
".",
"assume",
"string",
"is",
"UTF",
"-",
"8",
"encoded"
] | train | https://github.com/Nexmo/nexmo-java/blob/7427eff6d6baa5a5bd9197fa096bcf2564191cf5/src/main/java/com/nexmo/client/auth/MD5Util.java#L42-L48 |
Azure/azure-sdk-for-java | keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java | KeyVaultClientBaseImpl.wrapKeyAsync | public ServiceFuture<KeyOperationResult> wrapKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value, final ServiceCallback<KeyOperationResult> serviceCallback) {
"""
Wraps a symmetric key using a specified key.
The WRAP operation supports encryption of a symmetric key using a key encryption key that has previously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation requires the keys/wrapKey permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key.
@param keyVersion The version of the key.
@param algorithm algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'
@param value the Base64Url value
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object
"""
return ServiceFuture.fromResponse(wrapKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value), serviceCallback);
} | java | public ServiceFuture<KeyOperationResult> wrapKeyAsync(String vaultBaseUrl, String keyName, String keyVersion, JsonWebKeyEncryptionAlgorithm algorithm, byte[] value, final ServiceCallback<KeyOperationResult> serviceCallback) {
return ServiceFuture.fromResponse(wrapKeyWithServiceResponseAsync(vaultBaseUrl, keyName, keyVersion, algorithm, value), serviceCallback);
} | [
"public",
"ServiceFuture",
"<",
"KeyOperationResult",
">",
"wrapKeyAsync",
"(",
"String",
"vaultBaseUrl",
",",
"String",
"keyName",
",",
"String",
"keyVersion",
",",
"JsonWebKeyEncryptionAlgorithm",
"algorithm",
",",
"byte",
"[",
"]",
"value",
",",
"final",
"Service... | Wraps a symmetric key using a specified key.
The WRAP operation supports encryption of a symmetric key using a key encryption key that has previously been stored in an Azure Key Vault. The WRAP operation is only strictly necessary for symmetric keys stored in Azure Key Vault since protection with an asymmetric key can be performed using the public portion of the key. This operation is supported for asymmetric keys as a convenience for callers that have a key-reference but do not have access to the public key material. This operation requires the keys/wrapKey permission.
@param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net.
@param keyName The name of the key.
@param keyVersion The version of the key.
@param algorithm algorithm identifier. Possible values include: 'RSA-OAEP', 'RSA-OAEP-256', 'RSA1_5'
@param value the Base64Url value
@param serviceCallback the async ServiceCallback to handle successful and failed responses.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceFuture} object | [
"Wraps",
"a",
"symmetric",
"key",
"using",
"a",
"specified",
"key",
".",
"The",
"WRAP",
"operation",
"supports",
"encryption",
"of",
"a",
"symmetric",
"key",
"using",
"a",
"key",
"encryption",
"key",
"that",
"has",
"previously",
"been",
"stored",
"in",
"an",... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L2619-L2621 |
lukas-krecan/json2xml | src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java | JsonXmlHelper.convertElement | private static void convertElement(JsonGenerator generator, Element element, boolean isArrayItem, ElementNameConverter converter) throws IOException {
"""
Convert a DOM element to Json, with special handling for arrays since arrays don't exist in XML.
@param generator
@param element
@param isArrayItem
@throws IOException
"""
TYPE type = toTYPE(element.getAttribute("type"));
String name = element.getTagName();
if (!isArrayItem) {
generator.writeFieldName(converter.convertName(name));
}
switch (type) {
case OBJECT:
generator.writeStartObject();
convertChildren(generator, element, false, converter);
generator.writeEndObject();
break;
case ARRAY:
generator.writeStartArray();
convertChildren(generator, element, true, converter);
generator.writeEndArray();
break;
case STRING:
generator.writeString(element.getTextContent());
break;
case INT:
case FLOAT:
generator.writeNumber(new BigDecimal(element.getTextContent()));
break;
case BOOLEAN:
generator.writeBoolean(Boolean.parseBoolean(element.getTextContent()));
break;
case NULL:
generator.writeNull();
break;
}
} | java | private static void convertElement(JsonGenerator generator, Element element, boolean isArrayItem, ElementNameConverter converter) throws IOException {
TYPE type = toTYPE(element.getAttribute("type"));
String name = element.getTagName();
if (!isArrayItem) {
generator.writeFieldName(converter.convertName(name));
}
switch (type) {
case OBJECT:
generator.writeStartObject();
convertChildren(generator, element, false, converter);
generator.writeEndObject();
break;
case ARRAY:
generator.writeStartArray();
convertChildren(generator, element, true, converter);
generator.writeEndArray();
break;
case STRING:
generator.writeString(element.getTextContent());
break;
case INT:
case FLOAT:
generator.writeNumber(new BigDecimal(element.getTextContent()));
break;
case BOOLEAN:
generator.writeBoolean(Boolean.parseBoolean(element.getTextContent()));
break;
case NULL:
generator.writeNull();
break;
}
} | [
"private",
"static",
"void",
"convertElement",
"(",
"JsonGenerator",
"generator",
",",
"Element",
"element",
",",
"boolean",
"isArrayItem",
",",
"ElementNameConverter",
"converter",
")",
"throws",
"IOException",
"{",
"TYPE",
"type",
"=",
"toTYPE",
"(",
"element",
... | Convert a DOM element to Json, with special handling for arrays since arrays don't exist in XML.
@param generator
@param element
@param isArrayItem
@throws IOException | [
"Convert",
"a",
"DOM",
"element",
"to",
"Json",
"with",
"special",
"handling",
"for",
"arrays",
"since",
"arrays",
"don",
"t",
"exist",
"in",
"XML",
"."
] | train | https://github.com/lukas-krecan/json2xml/blob/8fba4f942ebed5d6f7ad851390c634fff8559cac/src/main/java/net/javacrumbs/json2xml/JsonXmlHelper.java#L130-L163 |
kumuluz/kumuluzee | common/src/main/java/com/kumuluz/ee/common/utils/StringUtils.java | StringUtils.camelCaseToHyphenCase | public static String camelCaseToHyphenCase(String s) {
"""
Parse upper camel case to lower hyphen case.
@param s string in upper camel case format
@return string in lower hyphen case format
"""
StringBuilder parsedString = new StringBuilder(s.substring(0, 1).toLowerCase());
for (char c : s.substring(1).toCharArray()) {
if (Character.isUpperCase(c)) {
parsedString.append("-").append(Character.toLowerCase(c));
} else {
parsedString.append(c);
}
}
return parsedString.toString();
} | java | public static String camelCaseToHyphenCase(String s) {
StringBuilder parsedString = new StringBuilder(s.substring(0, 1).toLowerCase());
for (char c : s.substring(1).toCharArray()) {
if (Character.isUpperCase(c)) {
parsedString.append("-").append(Character.toLowerCase(c));
} else {
parsedString.append(c);
}
}
return parsedString.toString();
} | [
"public",
"static",
"String",
"camelCaseToHyphenCase",
"(",
"String",
"s",
")",
"{",
"StringBuilder",
"parsedString",
"=",
"new",
"StringBuilder",
"(",
"s",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"for",
"(",
"c... | Parse upper camel case to lower hyphen case.
@param s string in upper camel case format
@return string in lower hyphen case format | [
"Parse",
"upper",
"camel",
"case",
"to",
"lower",
"hyphen",
"case",
"."
] | train | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/common/src/main/java/com/kumuluz/ee/common/utils/StringUtils.java#L39-L53 |
aws/aws-sdk-java | aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/AmazonEC2Client.java | AmazonEC2Client.dryRun | public <X extends AmazonWebServiceRequest> DryRunResult<X> dryRun(DryRunSupportedRequest<X> request) throws AmazonServiceException, AmazonClientException {
"""
Checks whether you have the required permissions for the provided Amazon EC2 operation, without actually running
it. The returned DryRunResult object contains the information of whether the dry-run was successful. This method
will throw exception when the service response does not clearly indicate whether you have the permission.
@param request
The request object for any Amazon EC2 operation supported with dry-run.
@return A DryRunResult object that contains the information of whether the dry-run was successful.
@throws AmazonClientException
If any internal errors are encountered inside the client while attempting to make the request or handle
the response. Or if the service response does not clearly indicate whether you have the permission.
@throws AmazonServiceException
If an error response is returned by Amazon EC2 indicating either a problem with the data in the request,
or a server side issue.
"""
Request<X> dryRunRequest = request.getDryRunRequest();
ExecutionContext executionContext = createExecutionContext(dryRunRequest);
try {
invoke(dryRunRequest, new StaxResponseHandler<Void>(new VoidStaxUnmarshaller<Void>()), executionContext);
throw new AmazonClientException("Unrecognized service response for the dry-run request.");
} catch (AmazonServiceException ase) {
if (ase.getErrorCode().equals("DryRunOperation") && ase.getStatusCode() == 412) {
return new DryRunResult<X>(true, request, ase.getMessage(), ase);
} else if (ase.getErrorCode().equals("UnauthorizedOperation") && ase.getStatusCode() == 403) {
return new DryRunResult<X>(false, request, ase.getMessage(), ase);
} else if (ase.getErrorCode().equals("AuthFailure")) {
return new DryRunResult<X>(false, request, ase.getMessage(), ase);
}
throw new AmazonClientException("Unrecognized service response for the dry-run request.", ase);
}
} | java | public <X extends AmazonWebServiceRequest> DryRunResult<X> dryRun(DryRunSupportedRequest<X> request) throws AmazonServiceException, AmazonClientException {
Request<X> dryRunRequest = request.getDryRunRequest();
ExecutionContext executionContext = createExecutionContext(dryRunRequest);
try {
invoke(dryRunRequest, new StaxResponseHandler<Void>(new VoidStaxUnmarshaller<Void>()), executionContext);
throw new AmazonClientException("Unrecognized service response for the dry-run request.");
} catch (AmazonServiceException ase) {
if (ase.getErrorCode().equals("DryRunOperation") && ase.getStatusCode() == 412) {
return new DryRunResult<X>(true, request, ase.getMessage(), ase);
} else if (ase.getErrorCode().equals("UnauthorizedOperation") && ase.getStatusCode() == 403) {
return new DryRunResult<X>(false, request, ase.getMessage(), ase);
} else if (ase.getErrorCode().equals("AuthFailure")) {
return new DryRunResult<X>(false, request, ase.getMessage(), ase);
}
throw new AmazonClientException("Unrecognized service response for the dry-run request.", ase);
}
} | [
"public",
"<",
"X",
"extends",
"AmazonWebServiceRequest",
">",
"DryRunResult",
"<",
"X",
">",
"dryRun",
"(",
"DryRunSupportedRequest",
"<",
"X",
">",
"request",
")",
"throws",
"AmazonServiceException",
",",
"AmazonClientException",
"{",
"Request",
"<",
"X",
">",
... | Checks whether you have the required permissions for the provided Amazon EC2 operation, without actually running
it. The returned DryRunResult object contains the information of whether the dry-run was successful. This method
will throw exception when the service response does not clearly indicate whether you have the permission.
@param request
The request object for any Amazon EC2 operation supported with dry-run.
@return A DryRunResult object that contains the information of whether the dry-run was successful.
@throws AmazonClientException
If any internal errors are encountered inside the client while attempting to make the request or handle
the response. Or if the service response does not clearly indicate whether you have the permission.
@throws AmazonServiceException
If an error response is returned by Amazon EC2 indicating either a problem with the data in the request,
or a server side issue. | [
"Checks",
"whether",
"you",
"have",
"the",
"required",
"permissions",
"for",
"the",
"provided",
"Amazon",
"EC2",
"operation",
"without",
"actually",
"running",
"it",
".",
"The",
"returned",
"DryRunResult",
"object",
"contains",
"the",
"information",
"of",
"whether... | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/AmazonEC2Client.java#L20301-L20317 |
centic9/commons-dost | src/main/java/org/dstadler/commons/zip/ZipUtils.java | ZipUtils.replaceInZip | public static void replaceInZip(String zipFile, String data, String encoding) throws IOException {
"""
Replace the file denoted by the zipFile with the provided data. The zipFile specifies
both the zip and the file inside the zip using '!' as separator.
@param zipFile The zip-file to process
@param data The string-data to replace
@param encoding The encoding that should be used when writing the string data to the file
@throws IOException Thrown if files can not be read or any other error occurs while handling the Zip-files
"""
if(!isFileInZip(zipFile)) {
throw new IOException("Parameter should specify a file inside a ZIP file, but had: " + zipFile);
}
File zip = new File(zipFile.substring(0, zipFile.indexOf(ZIP_DELIMITER)));
String zipOut = zipFile.substring(zipFile.indexOf(ZIP_DELIMITER)+1);
logger.info("Updating containing Zip " + zip + " to " + zipOut);
// replace in zip
ZipUtils.replaceInZip(zip, zipOut, data, encoding);
} | java | public static void replaceInZip(String zipFile, String data, String encoding) throws IOException {
if(!isFileInZip(zipFile)) {
throw new IOException("Parameter should specify a file inside a ZIP file, but had: " + zipFile);
}
File zip = new File(zipFile.substring(0, zipFile.indexOf(ZIP_DELIMITER)));
String zipOut = zipFile.substring(zipFile.indexOf(ZIP_DELIMITER)+1);
logger.info("Updating containing Zip " + zip + " to " + zipOut);
// replace in zip
ZipUtils.replaceInZip(zip, zipOut, data, encoding);
} | [
"public",
"static",
"void",
"replaceInZip",
"(",
"String",
"zipFile",
",",
"String",
"data",
",",
"String",
"encoding",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"isFileInZip",
"(",
"zipFile",
")",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"... | Replace the file denoted by the zipFile with the provided data. The zipFile specifies
both the zip and the file inside the zip using '!' as separator.
@param zipFile The zip-file to process
@param data The string-data to replace
@param encoding The encoding that should be used when writing the string data to the file
@throws IOException Thrown if files can not be read or any other error occurs while handling the Zip-files | [
"Replace",
"the",
"file",
"denoted",
"by",
"the",
"zipFile",
"with",
"the",
"provided",
"data",
".",
"The",
"zipFile",
"specifies",
"both",
"the",
"zip",
"and",
"the",
"file",
"inside",
"the",
"zip",
"using",
"!",
"as",
"separator",
"."
] | train | https://github.com/centic9/commons-dost/blob/f6fa4e3e0b943ff103f918824319d8abf33d0e0f/src/main/java/org/dstadler/commons/zip/ZipUtils.java#L437-L449 |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java | DefaultIncrementalAttributesMapper.lookupAttributes | public static Attributes lookupAttributes(LdapOperations ldapOperations, String dn, String attribute) {
"""
Lookup all values for the specified attribute, looping through the results incrementally if necessary.
@param ldapOperations The instance to use for performing the actual lookup.
@param dn The distinguished name of the object to find.
@param attribute name of the attribute to request.
@return an Attributes instance, populated with all found values for the requested attribute.
Never <code>null</code>, though the actual attribute may not be set if it was not
set on the requested object.
"""
return lookupAttributes(ldapOperations, LdapUtils.newLdapName(dn), attribute);
} | java | public static Attributes lookupAttributes(LdapOperations ldapOperations, String dn, String attribute) {
return lookupAttributes(ldapOperations, LdapUtils.newLdapName(dn), attribute);
} | [
"public",
"static",
"Attributes",
"lookupAttributes",
"(",
"LdapOperations",
"ldapOperations",
",",
"String",
"dn",
",",
"String",
"attribute",
")",
"{",
"return",
"lookupAttributes",
"(",
"ldapOperations",
",",
"LdapUtils",
".",
"newLdapName",
"(",
"dn",
")",
","... | Lookup all values for the specified attribute, looping through the results incrementally if necessary.
@param ldapOperations The instance to use for performing the actual lookup.
@param dn The distinguished name of the object to find.
@param attribute name of the attribute to request.
@return an Attributes instance, populated with all found values for the requested attribute.
Never <code>null</code>, though the actual attribute may not be set if it was not
set on the requested object. | [
"Lookup",
"all",
"values",
"for",
"the",
"specified",
"attribute",
"looping",
"through",
"the",
"results",
"incrementally",
"if",
"necessary",
"."
] | train | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/support/DefaultIncrementalAttributesMapper.java#L262-L264 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/mult/VectorVectorMult_DDRM.java | VectorVectorMult_DDRM.addOuterProd | public static void addOuterProd(double gamma , DMatrixD1 x, DMatrixD1 y, DMatrix1Row A ) {
"""
<p>
Adds to A ∈ ℜ <sup>m × n</sup> the results of an outer product multiplication
of the two vectors. This is also known as a rank 1 update.<br>
<br>
A = A + γ x * y<sup>T</sup>
where x ∈ ℜ <sup>m</sup> and y ∈ ℜ <sup>n</sup> are vectors.
</p>
<p>
Which is equivalent to: A<sub>ij</sub> = A<sub>ij</sub> + γ x<sub>i</sub>*y<sub>j</sub>
</p>
<p>
These functions are often used inside of highly optimized code and therefor sanity checks are
kept to a minimum. It is not recommended that any of these functions be used directly.
</p>
@param gamma A multiplication factor for the outer product.
@param x A vector with m elements. Not modified.
@param y A vector with n elements. Not modified.
@param A A Matrix with m by n elements. Modified.
"""
int m = A.numRows;
int n = A.numCols;
int index = 0;
if( gamma == 1.0 ) {
for( int i = 0; i < m; i++ ) {
double xdat = x.get(i);
for( int j = 0; j < n; j++ ) {
A.plus( index++ , xdat*y.get(j) );
}
}
} else {
for( int i = 0; i < m; i++ ) {
double xdat = x.get(i);
for( int j = 0; j < n; j++ ) {
A.plus( index++ , gamma*xdat*y.get(j));
}
}
}
} | java | public static void addOuterProd(double gamma , DMatrixD1 x, DMatrixD1 y, DMatrix1Row A ) {
int m = A.numRows;
int n = A.numCols;
int index = 0;
if( gamma == 1.0 ) {
for( int i = 0; i < m; i++ ) {
double xdat = x.get(i);
for( int j = 0; j < n; j++ ) {
A.plus( index++ , xdat*y.get(j) );
}
}
} else {
for( int i = 0; i < m; i++ ) {
double xdat = x.get(i);
for( int j = 0; j < n; j++ ) {
A.plus( index++ , gamma*xdat*y.get(j));
}
}
}
} | [
"public",
"static",
"void",
"addOuterProd",
"(",
"double",
"gamma",
",",
"DMatrixD1",
"x",
",",
"DMatrixD1",
"y",
",",
"DMatrix1Row",
"A",
")",
"{",
"int",
"m",
"=",
"A",
".",
"numRows",
";",
"int",
"n",
"=",
"A",
".",
"numCols",
";",
"int",
"index",... | <p>
Adds to A ∈ ℜ <sup>m × n</sup> the results of an outer product multiplication
of the two vectors. This is also known as a rank 1 update.<br>
<br>
A = A + γ x * y<sup>T</sup>
where x ∈ ℜ <sup>m</sup> and y ∈ ℜ <sup>n</sup> are vectors.
</p>
<p>
Which is equivalent to: A<sub>ij</sub> = A<sub>ij</sub> + γ x<sub>i</sub>*y<sub>j</sub>
</p>
<p>
These functions are often used inside of highly optimized code and therefor sanity checks are
kept to a minimum. It is not recommended that any of these functions be used directly.
</p>
@param gamma A multiplication factor for the outer product.
@param x A vector with m elements. Not modified.
@param y A vector with n elements. Not modified.
@param A A Matrix with m by n elements. Modified. | [
"<p",
">",
"Adds",
"to",
"A",
"&isin",
";",
"&real",
";",
"<sup",
">",
"m",
"×",
";",
"n<",
"/",
"sup",
">",
"the",
"results",
"of",
"an",
"outer",
"product",
"multiplication",
"of",
"the",
"two",
"vectors",
".",
"This",
"is",
"also",
"known",
... | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/mult/VectorVectorMult_DDRM.java#L192-L212 |
LearnLib/learnlib | commons/counterexamples/src/main/java/de/learnlib/counterexamples/GlobalSuffixFinders.java | GlobalSuffixFinders.fromLocalFinder | public static <I, D> GlobalSuffixFinder<I, D> fromLocalFinder(final LocalSuffixFinder<I, D> localFinder,
final boolean allSuffixes) {
"""
Transforms a {@link LocalSuffixFinder} into a global one. Since local suffix finders only return a single suffix,
suffix-closedness of the set of distinguishing suffixes might not be preserved. Note that for correctly
implemented local suffix finders, this does not impair correctness of the learning algorithm. However, without
suffix closedness, intermediate hypothesis models might be non-canonical, if no additional precautions are taken.
For that reasons, the {@code allSuffixes} parameter can be specified to control whether or not the list returned
by {@link GlobalSuffixFinder#findSuffixes(Query, AccessSequenceTransformer, SuffixOutput, MembershipOracle)} of
the returned global suffix finder should not only contain the single suffix, but also all of its suffixes,
ensuring suffix-closedness.
@param localFinder
the local suffix finder
@param allSuffixes
whether or not all suffixes of the found local suffix should be added
@return a global suffix finder using the analysis method from the specified local suffix finder
"""
return new GlobalSuffixFinder<I, D>() {
@Override
public <RI extends I, RD extends D> List<Word<RI>> findSuffixes(Query<RI, RD> ceQuery,
AccessSequenceTransformer<RI> asTransformer,
SuffixOutput<RI, RD> hypOutput,
MembershipOracle<RI, RD> oracle) {
int idx = localFinder.findSuffixIndex(ceQuery, asTransformer, hypOutput, oracle);
return suffixesForLocalOutput(ceQuery, idx, allSuffixes);
}
@Override
public String toString() {
return localFinder.toString() + (allSuffixes ? "-AllSuffixes" : "");
}
};
} | java | public static <I, D> GlobalSuffixFinder<I, D> fromLocalFinder(final LocalSuffixFinder<I, D> localFinder,
final boolean allSuffixes) {
return new GlobalSuffixFinder<I, D>() {
@Override
public <RI extends I, RD extends D> List<Word<RI>> findSuffixes(Query<RI, RD> ceQuery,
AccessSequenceTransformer<RI> asTransformer,
SuffixOutput<RI, RD> hypOutput,
MembershipOracle<RI, RD> oracle) {
int idx = localFinder.findSuffixIndex(ceQuery, asTransformer, hypOutput, oracle);
return suffixesForLocalOutput(ceQuery, idx, allSuffixes);
}
@Override
public String toString() {
return localFinder.toString() + (allSuffixes ? "-AllSuffixes" : "");
}
};
} | [
"public",
"static",
"<",
"I",
",",
"D",
">",
"GlobalSuffixFinder",
"<",
"I",
",",
"D",
">",
"fromLocalFinder",
"(",
"final",
"LocalSuffixFinder",
"<",
"I",
",",
"D",
">",
"localFinder",
",",
"final",
"boolean",
"allSuffixes",
")",
"{",
"return",
"new",
"... | Transforms a {@link LocalSuffixFinder} into a global one. Since local suffix finders only return a single suffix,
suffix-closedness of the set of distinguishing suffixes might not be preserved. Note that for correctly
implemented local suffix finders, this does not impair correctness of the learning algorithm. However, without
suffix closedness, intermediate hypothesis models might be non-canonical, if no additional precautions are taken.
For that reasons, the {@code allSuffixes} parameter can be specified to control whether or not the list returned
by {@link GlobalSuffixFinder#findSuffixes(Query, AccessSequenceTransformer, SuffixOutput, MembershipOracle)} of
the returned global suffix finder should not only contain the single suffix, but also all of its suffixes,
ensuring suffix-closedness.
@param localFinder
the local suffix finder
@param allSuffixes
whether or not all suffixes of the found local suffix should be added
@return a global suffix finder using the analysis method from the specified local suffix finder | [
"Transforms",
"a",
"{",
"@link",
"LocalSuffixFinder",
"}",
"into",
"a",
"global",
"one",
".",
"Since",
"local",
"suffix",
"finders",
"only",
"return",
"a",
"single",
"suffix",
"suffix",
"-",
"closedness",
"of",
"the",
"set",
"of",
"distinguishing",
"suffixes",... | train | https://github.com/LearnLib/learnlib/blob/fa38a14adcc0664099f180d671ffa42480318d7b/commons/counterexamples/src/main/java/de/learnlib/counterexamples/GlobalSuffixFinders.java#L157-L176 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java | FileUtil.loadUtf8 | public static <T> T loadUtf8(String path, ReaderHandler<T> readerHandler) throws IORuntimeException {
"""
按照给定的readerHandler读取文件中的数据
@param <T> 集合类型
@param readerHandler Reader处理类
@param path 文件的绝对路径
@return 从文件中load出的数据
@throws IORuntimeException IO异常
@since 3.1.1
"""
return load(path, CharsetUtil.CHARSET_UTF_8, readerHandler);
} | java | public static <T> T loadUtf8(String path, ReaderHandler<T> readerHandler) throws IORuntimeException {
return load(path, CharsetUtil.CHARSET_UTF_8, readerHandler);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"loadUtf8",
"(",
"String",
"path",
",",
"ReaderHandler",
"<",
"T",
">",
"readerHandler",
")",
"throws",
"IORuntimeException",
"{",
"return",
"load",
"(",
"path",
",",
"CharsetUtil",
".",
"CHARSET_UTF_8",
",",
"readerHa... | 按照给定的readerHandler读取文件中的数据
@param <T> 集合类型
@param readerHandler Reader处理类
@param path 文件的绝对路径
@return 从文件中load出的数据
@throws IORuntimeException IO异常
@since 3.1.1 | [
"按照给定的readerHandler读取文件中的数据"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/io/FileUtil.java#L2486-L2488 |
vipshop/vjtools | vjkit/src/main/java/com/vip/vjtools/vjkit/io/FileUtil.java | FileUtil.copyFile | public static void copyFile(@NotNull File from, @NotNull File to) throws IOException {
"""
文件复制.
@see {@link Files#copy}
@param from 如果为null,或文件不存在或者是目录,,抛出异常
@param to 如果to为null,或文件存在但是一个目录,抛出异常
"""
Validate.notNull(from);
Validate.notNull(to);
copyFile(from.toPath(), to.toPath());
} | java | public static void copyFile(@NotNull File from, @NotNull File to) throws IOException {
Validate.notNull(from);
Validate.notNull(to);
copyFile(from.toPath(), to.toPath());
} | [
"public",
"static",
"void",
"copyFile",
"(",
"@",
"NotNull",
"File",
"from",
",",
"@",
"NotNull",
"File",
"to",
")",
"throws",
"IOException",
"{",
"Validate",
".",
"notNull",
"(",
"from",
")",
";",
"Validate",
".",
"notNull",
"(",
"to",
")",
";",
"copy... | 文件复制.
@see {@link Files#copy}
@param from 如果为null,或文件不存在或者是目录,,抛出异常
@param to 如果to为null,或文件存在但是一个目录,抛出异常 | [
"文件复制",
"."
] | train | https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/io/FileUtil.java#L239-L243 |
vigna/Sux4J | src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java | HypergraphSorter.bitVectorToEdge | public static void bitVectorToEdge(final BitVector bv, final long seed, final int numVertices, final int e[]) {
"""
Turns a bit vector into a 3-hyperedge.
@param bv a bit vector.
@param seed the seed for the hash function.
@param numVertices the number of vertices in the underlying hypergraph.
@param e an array to store the resulting edge.
@see #bitVectorToEdge(BitVector, long, int, int, int[])
"""
bitVectorToEdge(bv, seed, numVertices, (int)(numVertices * 0xAAAAAAABL >>> 33), e); // Fast division by 3
} | java | public static void bitVectorToEdge(final BitVector bv, final long seed, final int numVertices, final int e[]) {
bitVectorToEdge(bv, seed, numVertices, (int)(numVertices * 0xAAAAAAABL >>> 33), e); // Fast division by 3
} | [
"public",
"static",
"void",
"bitVectorToEdge",
"(",
"final",
"BitVector",
"bv",
",",
"final",
"long",
"seed",
",",
"final",
"int",
"numVertices",
",",
"final",
"int",
"e",
"[",
"]",
")",
"{",
"bitVectorToEdge",
"(",
"bv",
",",
"seed",
",",
"numVertices",
... | Turns a bit vector into a 3-hyperedge.
@param bv a bit vector.
@param seed the seed for the hash function.
@param numVertices the number of vertices in the underlying hypergraph.
@param e an array to store the resulting edge.
@see #bitVectorToEdge(BitVector, long, int, int, int[]) | [
"Turns",
"a",
"bit",
"vector",
"into",
"a",
"3",
"-",
"hyperedge",
"."
] | train | https://github.com/vigna/Sux4J/blob/d57de8fa897c7d273e0e6dae7a3274174f175a5f/src/it/unimi/dsi/sux4j/mph/HypergraphSorter.java#L219-L221 |
dnsjava/dnsjava | org/xbill/DNS/Cache.java | Cache.lookupRecords | public SetResponse
lookupRecords(Name name, int type, int minCred) {
"""
Looks up Records in the Cache. This follows CNAMEs and handles negatively
cached data.
@param name The name to look up
@param type The type to look up
@param minCred The minimum acceptable credibility
@return A SetResponse object
@see SetResponse
@see Credibility
"""
return lookup(name, type, minCred);
} | java | public SetResponse
lookupRecords(Name name, int type, int minCred) {
return lookup(name, type, minCred);
} | [
"public",
"SetResponse",
"lookupRecords",
"(",
"Name",
"name",
",",
"int",
"type",
",",
"int",
"minCred",
")",
"{",
"return",
"lookup",
"(",
"name",
",",
"type",
",",
"minCred",
")",
";",
"}"
] | Looks up Records in the Cache. This follows CNAMEs and handles negatively
cached data.
@param name The name to look up
@param type The type to look up
@param minCred The minimum acceptable credibility
@return A SetResponse object
@see SetResponse
@see Credibility | [
"Looks",
"up",
"Records",
"in",
"the",
"Cache",
".",
"This",
"follows",
"CNAMEs",
"and",
"handles",
"negatively",
"cached",
"data",
"."
] | train | https://github.com/dnsjava/dnsjava/blob/d97b6a0685d59143372bb392ab591dd8dd840b61/org/xbill/DNS/Cache.java#L511-L514 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java | FDBigInteger.mult | private static void mult(int[] src, int srcLen, int v0, int v1, int[] dst) {
"""
/*@
@ requires src != dst;
@ requires src.length >= srcLen && dst.length >= srcLen + 2;
@ assignable dst[0 .. srcLen + 1];
@ ensures AP(dst, srcLen + 2) == \old(AP(src, srcLen) * (UNSIGNED(v0) + (UNSIGNED(v1) << 32)));
@
"""
long v = v0 & LONG_MASK;
long carry = 0;
for (int j = 0; j < srcLen; j++) {
long product = v * (src[j] & LONG_MASK) + carry;
dst[j] = (int) product;
carry = product >>> 32;
}
dst[srcLen] = (int) carry;
v = v1 & LONG_MASK;
carry = 0;
for (int j = 0; j < srcLen; j++) {
long product = (dst[j + 1] & LONG_MASK) + v * (src[j] & LONG_MASK) + carry;
dst[j + 1] = (int) product;
carry = product >>> 32;
}
dst[srcLen + 1] = (int) carry;
} | java | private static void mult(int[] src, int srcLen, int v0, int v1, int[] dst) {
long v = v0 & LONG_MASK;
long carry = 0;
for (int j = 0; j < srcLen; j++) {
long product = v * (src[j] & LONG_MASK) + carry;
dst[j] = (int) product;
carry = product >>> 32;
}
dst[srcLen] = (int) carry;
v = v1 & LONG_MASK;
carry = 0;
for (int j = 0; j < srcLen; j++) {
long product = (dst[j + 1] & LONG_MASK) + v * (src[j] & LONG_MASK) + carry;
dst[j + 1] = (int) product;
carry = product >>> 32;
}
dst[srcLen + 1] = (int) carry;
} | [
"private",
"static",
"void",
"mult",
"(",
"int",
"[",
"]",
"src",
",",
"int",
"srcLen",
",",
"int",
"v0",
",",
"int",
"v1",
",",
"int",
"[",
"]",
"dst",
")",
"{",
"long",
"v",
"=",
"v0",
"&",
"LONG_MASK",
";",
"long",
"carry",
"=",
"0",
";",
... | /*@
@ requires src != dst;
@ requires src.length >= srcLen && dst.length >= srcLen + 2;
@ assignable dst[0 .. srcLen + 1];
@ ensures AP(dst, srcLen + 2) == \old(AP(src, srcLen) * (UNSIGNED(v0) + (UNSIGNED(v1) << 32)));
@ | [
"/",
"*"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java#L1394-L1411 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.updateServiceInstanceUri | public void updateServiceInstanceUri(String serviceName, String instanceId, String uri, final RegistrationCallback cb, Object context) {
"""
Update ServiceInstance URI in Callback.
@param serviceName
the service name.
@param instanceId
the instanceId.
@param uri
the new URI.
@param cb
the Callback.
@param context
the object context.
"""
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.UpdateServiceInstanceUri);
UpdateServiceInstanceUriProtocol p = new UpdateServiceInstanceUriProtocol(serviceName, instanceId, uri);
ProtocolCallback pcb = new ProtocolCallback(){
@Override
public void call(boolean result, Response response,
ErrorCode error, Object ctx) {
cb.call(result, error, ctx);
}
};
connection.submitCallbackRequest(header, p, pcb, context);
} | java | public void updateServiceInstanceUri(String serviceName, String instanceId, String uri, final RegistrationCallback cb, Object context){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.UpdateServiceInstanceUri);
UpdateServiceInstanceUriProtocol p = new UpdateServiceInstanceUriProtocol(serviceName, instanceId, uri);
ProtocolCallback pcb = new ProtocolCallback(){
@Override
public void call(boolean result, Response response,
ErrorCode error, Object ctx) {
cb.call(result, error, ctx);
}
};
connection.submitCallbackRequest(header, p, pcb, context);
} | [
"public",
"void",
"updateServiceInstanceUri",
"(",
"String",
"serviceName",
",",
"String",
"instanceId",
",",
"String",
"uri",
",",
"final",
"RegistrationCallback",
"cb",
",",
"Object",
"context",
")",
"{",
"ProtocolHeader",
"header",
"=",
"new",
"ProtocolHeader",
... | Update ServiceInstance URI in Callback.
@param serviceName
the service name.
@param instanceId
the instanceId.
@param uri
the new URI.
@param cb
the Callback.
@param context
the object context. | [
"Update",
"ServiceInstance",
"URI",
"in",
"Callback",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L614-L629 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/util/factory/ConfigurableFactory.java | ConfigurableFactory.createNewInstance | public Object createNewInstance(Class type, Object arg) {
"""
factory method for creating new instances
the Class to be instantiated is defined by getClassToServe().
@return Object the created instance
"""
if (type != null)
return createNewInstance(new Class[]{type}, new Object[]{arg});
else
return createNewInstance((Class[]) null, (Object[]) null);
} | java | public Object createNewInstance(Class type, Object arg)
{
if (type != null)
return createNewInstance(new Class[]{type}, new Object[]{arg});
else
return createNewInstance((Class[]) null, (Object[]) null);
} | [
"public",
"Object",
"createNewInstance",
"(",
"Class",
"type",
",",
"Object",
"arg",
")",
"{",
"if",
"(",
"type",
"!=",
"null",
")",
"return",
"createNewInstance",
"(",
"new",
"Class",
"[",
"]",
"{",
"type",
"}",
",",
"new",
"Object",
"[",
"]",
"{",
... | factory method for creating new instances
the Class to be instantiated is defined by getClassToServe().
@return Object the created instance | [
"factory",
"method",
"for",
"creating",
"new",
"instances",
"the",
"Class",
"to",
"be",
"instantiated",
"is",
"defined",
"by",
"getClassToServe",
"()",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/factory/ConfigurableFactory.java#L178-L184 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java | ObjectEnvelopeOrdering.addObjectReferenceEdges | private void addObjectReferenceEdges(Vertex vertex, ObjectReferenceDescriptor rds) {
"""
Finds edges based to a specific object reference descriptor and
adds them to the edge map.
@param vertex the object envelope vertex holding the object reference
@param rds the object reference descriptor
"""
Object refObject = rds.getPersistentField().get(vertex.getEnvelope().getRealObject());
Class refClass = rds.getItemClass();
for (int i = 0; i < vertices.length; i++)
{
Edge edge = null;
// ObjectEnvelope envelope = vertex.getEnvelope();
Vertex refVertex = vertices[i];
ObjectEnvelope refEnvelope = refVertex.getEnvelope();
if (refObject == refEnvelope.getRealObject())
{
edge = buildConcrete11Edge(vertex, refVertex, rds.hasConstraint());
}
else if (refClass.isInstance(refVertex.getEnvelope().getRealObject()))
{
edge = buildPotential11Edge(vertex, refVertex, rds.hasConstraint());
}
if (edge != null)
{
if (!edgeList.contains(edge))
{
edgeList.add(edge);
}
else
{
edge.increaseWeightTo(edge.getWeight());
}
}
}
} | java | private void addObjectReferenceEdges(Vertex vertex, ObjectReferenceDescriptor rds)
{
Object refObject = rds.getPersistentField().get(vertex.getEnvelope().getRealObject());
Class refClass = rds.getItemClass();
for (int i = 0; i < vertices.length; i++)
{
Edge edge = null;
// ObjectEnvelope envelope = vertex.getEnvelope();
Vertex refVertex = vertices[i];
ObjectEnvelope refEnvelope = refVertex.getEnvelope();
if (refObject == refEnvelope.getRealObject())
{
edge = buildConcrete11Edge(vertex, refVertex, rds.hasConstraint());
}
else if (refClass.isInstance(refVertex.getEnvelope().getRealObject()))
{
edge = buildPotential11Edge(vertex, refVertex, rds.hasConstraint());
}
if (edge != null)
{
if (!edgeList.contains(edge))
{
edgeList.add(edge);
}
else
{
edge.increaseWeightTo(edge.getWeight());
}
}
}
} | [
"private",
"void",
"addObjectReferenceEdges",
"(",
"Vertex",
"vertex",
",",
"ObjectReferenceDescriptor",
"rds",
")",
"{",
"Object",
"refObject",
"=",
"rds",
".",
"getPersistentField",
"(",
")",
".",
"get",
"(",
"vertex",
".",
"getEnvelope",
"(",
")",
".",
"get... | Finds edges based to a specific object reference descriptor and
adds them to the edge map.
@param vertex the object envelope vertex holding the object reference
@param rds the object reference descriptor | [
"Finds",
"edges",
"based",
"to",
"a",
"specific",
"object",
"reference",
"descriptor",
"and",
"adds",
"them",
"to",
"the",
"edge",
"map",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeOrdering.java#L284-L314 |
PeterisP/LVTagger | src/main/java/edu/stanford/nlp/classify/LinearClassifier.java | LinearClassifier.scoreOf | @Deprecated
public double scoreOf(RVFDatum<L, F> example, L label) {
"""
Returns the score of the RVFDatum for the specified label.
Ignores the true label of the RVFDatum.
"""
int iLabel = labelIndex.indexOf(label);
double score = 0.0;
Counter<F> features = example.asFeaturesCounter();
for (F f : features.keySet()) {
score += weight(f, iLabel) * features.getCount(f);
}
return score + thresholds[iLabel];
} | java | @Deprecated
public double scoreOf(RVFDatum<L, F> example, L label) {
int iLabel = labelIndex.indexOf(label);
double score = 0.0;
Counter<F> features = example.asFeaturesCounter();
for (F f : features.keySet()) {
score += weight(f, iLabel) * features.getCount(f);
}
return score + thresholds[iLabel];
} | [
"@",
"Deprecated",
"public",
"double",
"scoreOf",
"(",
"RVFDatum",
"<",
"L",
",",
"F",
">",
"example",
",",
"L",
"label",
")",
"{",
"int",
"iLabel",
"=",
"labelIndex",
".",
"indexOf",
"(",
"label",
")",
";",
"double",
"score",
"=",
"0.0",
";",
"Count... | Returns the score of the RVFDatum for the specified label.
Ignores the true label of the RVFDatum. | [
"Returns",
"the",
"score",
"of",
"the",
"RVFDatum",
"for",
"the",
"specified",
"label",
".",
"Ignores",
"the",
"true",
"label",
"of",
"the",
"RVFDatum",
"."
] | train | https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/classify/LinearClassifier.java#L205-L214 |
datumbox/datumbox-framework | datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java | PHPMethods.preg_replace | public static String preg_replace(Pattern pattern, String replacement, String subject) {
"""
Matches a string with a pattern and replaces the matched components with
a provided string.
@param pattern
@param replacement
@param subject
@return
"""
Matcher m = pattern.matcher(subject);
StringBuffer sb = new StringBuffer(subject.length());
while(m.find()){
m.appendReplacement(sb, replacement);
}
m.appendTail(sb);
return sb.toString();
} | java | public static String preg_replace(Pattern pattern, String replacement, String subject) {
Matcher m = pattern.matcher(subject);
StringBuffer sb = new StringBuffer(subject.length());
while(m.find()){
m.appendReplacement(sb, replacement);
}
m.appendTail(sb);
return sb.toString();
} | [
"public",
"static",
"String",
"preg_replace",
"(",
"Pattern",
"pattern",
",",
"String",
"replacement",
",",
"String",
"subject",
")",
"{",
"Matcher",
"m",
"=",
"pattern",
".",
"matcher",
"(",
"subject",
")",
";",
"StringBuffer",
"sb",
"=",
"new",
"StringBuff... | Matches a string with a pattern and replaces the matched components with
a provided string.
@param pattern
@param replacement
@param subject
@return | [
"Matches",
"a",
"string",
"with",
"a",
"pattern",
"and",
"replaces",
"the",
"matched",
"components",
"with",
"a",
"provided",
"string",
"."
] | train | https://github.com/datumbox/datumbox-framework/blob/909dff0476e80834f05ecdde0624dd2390e9b0ca/datumbox-framework-core/src/main/java/com/datumbox/framework/core/common/utilities/PHPMethods.java#L120-L128 |
groupby/api-java | src/main/java/com/groupbyinc/api/Query.java | Query.addQueryUrlParams | public Query addQueryUrlParams(String key, String value) {
"""
<code>
See {@link Query#setQueryUrlParams(Map)}.
</code>
@param key
The key of the url parameter
@param value
The value of the url parameter
"""
this.queryUrlParams.put(key, value);
return this;
} | java | public Query addQueryUrlParams(String key, String value) {
this.queryUrlParams.put(key, value);
return this;
} | [
"public",
"Query",
"addQueryUrlParams",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"this",
".",
"queryUrlParams",
".",
"put",
"(",
"key",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] | <code>
See {@link Query#setQueryUrlParams(Map)}.
</code>
@param key
The key of the url parameter
@param value
The value of the url parameter | [
"<code",
">"
] | train | https://github.com/groupby/api-java/blob/257c4ed0777221e5e4ade3b29b9921300fac4e2e/src/main/java/com/groupbyinc/api/Query.java#L1352-L1355 |
h2oai/h2o-3 | h2o-core/src/main/java/water/util/EnumUtils.java | EnumUtils.getNames | public static String[] getNames(Class<? extends Enum<?>> e) {
"""
Return an array of Strings of all the enum levels.
<p>
Taken from http://stackoverflow.com/questions/13783295/getting-all-names-in-an-enum-as-a-string.
"""
return Arrays.toString(e.getEnumConstants()).replaceAll("^.|.$", "").split(", ");
} | java | public static String[] getNames(Class<? extends Enum<?>> e) {
return Arrays.toString(e.getEnumConstants()).replaceAll("^.|.$", "").split(", ");
} | [
"public",
"static",
"String",
"[",
"]",
"getNames",
"(",
"Class",
"<",
"?",
"extends",
"Enum",
"<",
"?",
">",
">",
"e",
")",
"{",
"return",
"Arrays",
".",
"toString",
"(",
"e",
".",
"getEnumConstants",
"(",
")",
")",
".",
"replaceAll",
"(",
"\"^.|.$\... | Return an array of Strings of all the enum levels.
<p>
Taken from http://stackoverflow.com/questions/13783295/getting-all-names-in-an-enum-as-a-string. | [
"Return",
"an",
"array",
"of",
"Strings",
"of",
"all",
"the",
"enum",
"levels",
".",
"<p",
">",
"Taken",
"from",
"http",
":",
"//",
"stackoverflow",
".",
"com",
"/",
"questions",
"/",
"13783295",
"/",
"getting",
"-",
"all",
"-",
"names",
"-",
"in",
"... | train | https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/util/EnumUtils.java#L25-L27 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/StatementManager.java | StatementManager.setObjectForStatement | private void setObjectForStatement(PreparedStatement stmt, int index, Object value, int sqlType)
throws SQLException {
"""
Sets object for statement at specific index, adhering to platform- and null-rules.
@param stmt the statement
@param index the current parameter index
@param value the value to set
@param sqlType the JDBC SQL-type of the value
@throws SQLException on platform error
"""
if (value == null)
{
m_platform.setNullForStatement(stmt, index, sqlType);
}
else
{
m_platform.setObjectForStatement(stmt, index, value, sqlType);
}
} | java | private void setObjectForStatement(PreparedStatement stmt, int index, Object value, int sqlType)
throws SQLException
{
if (value == null)
{
m_platform.setNullForStatement(stmt, index, sqlType);
}
else
{
m_platform.setObjectForStatement(stmt, index, value, sqlType);
}
} | [
"private",
"void",
"setObjectForStatement",
"(",
"PreparedStatement",
"stmt",
",",
"int",
"index",
",",
"Object",
"value",
",",
"int",
"sqlType",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"m_platform",
".",
"setNullForStat... | Sets object for statement at specific index, adhering to platform- and null-rules.
@param stmt the statement
@param index the current parameter index
@param value the value to set
@param sqlType the JDBC SQL-type of the value
@throws SQLException on platform error | [
"Sets",
"object",
"for",
"statement",
"at",
"specific",
"index",
"adhering",
"to",
"platform",
"-",
"and",
"null",
"-",
"rules",
"."
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/StatementManager.java#L764-L775 |
OpenLiberty/open-liberty | dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java | TypeConversion.bytesToShort | public static short bytesToShort(byte[] bytes, int offset) {
"""
A utility method to convert the short from the byte array to a short.
@param bytes
The byte array containing the short.
@param offset
The index at which the short is located.
@return The short value.
"""
short result = 0x0;
for (int i = offset; i < offset + 2; ++i) {
result = (short) ((result) << 8);
result |= (bytes[i] & 0x00FF);
}
return result;
} | java | public static short bytesToShort(byte[] bytes, int offset) {
short result = 0x0;
for (int i = offset; i < offset + 2; ++i) {
result = (short) ((result) << 8);
result |= (bytes[i] & 0x00FF);
}
return result;
} | [
"public",
"static",
"short",
"bytesToShort",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
")",
"{",
"short",
"result",
"=",
"0x0",
";",
"for",
"(",
"int",
"i",
"=",
"offset",
";",
"i",
"<",
"offset",
"+",
"2",
";",
"++",
"i",
")",
"{",
... | A utility method to convert the short from the byte array to a short.
@param bytes
The byte array containing the short.
@param offset
The index at which the short is located.
@return The short value. | [
"A",
"utility",
"method",
"to",
"convert",
"the",
"short",
"from",
"the",
"byte",
"array",
"to",
"a",
"short",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.session.cache/src/com/ibm/ws/session/store/cache/TypeConversion.java#L47-L54 |
apache/flink | flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/ConfluentRegistryAvroDeserializationSchema.java | ConfluentRegistryAvroDeserializationSchema.forSpecific | public static <T extends SpecificRecord> ConfluentRegistryAvroDeserializationSchema<T> forSpecific(Class<T> tClass,
String url, int identityMapCapacity) {
"""
Creates {@link AvroDeserializationSchema} that produces classes that were generated from avro
schema and looks up writer schema in Confluent Schema Registry.
@param tClass class of record to be produced
@param url url of schema registry to connect
@param identityMapCapacity maximum number of cached schema versions (default: 1000)
@return deserialized record
"""
return new ConfluentRegistryAvroDeserializationSchema<>(
tClass,
null,
new CachedSchemaCoderProvider(url, identityMapCapacity)
);
} | java | public static <T extends SpecificRecord> ConfluentRegistryAvroDeserializationSchema<T> forSpecific(Class<T> tClass,
String url, int identityMapCapacity) {
return new ConfluentRegistryAvroDeserializationSchema<>(
tClass,
null,
new CachedSchemaCoderProvider(url, identityMapCapacity)
);
} | [
"public",
"static",
"<",
"T",
"extends",
"SpecificRecord",
">",
"ConfluentRegistryAvroDeserializationSchema",
"<",
"T",
">",
"forSpecific",
"(",
"Class",
"<",
"T",
">",
"tClass",
",",
"String",
"url",
",",
"int",
"identityMapCapacity",
")",
"{",
"return",
"new",... | Creates {@link AvroDeserializationSchema} that produces classes that were generated from avro
schema and looks up writer schema in Confluent Schema Registry.
@param tClass class of record to be produced
@param url url of schema registry to connect
@param identityMapCapacity maximum number of cached schema versions (default: 1000)
@return deserialized record | [
"Creates",
"{",
"@link",
"AvroDeserializationSchema",
"}",
"that",
"produces",
"classes",
"that",
"were",
"generated",
"from",
"avro",
"schema",
"and",
"looks",
"up",
"writer",
"schema",
"in",
"Confluent",
"Schema",
"Registry",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/ConfluentRegistryAvroDeserializationSchema.java#L109-L116 |
JakeWharton/ActionBarSherlock | actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/BaseMenuPresenter.java | BaseMenuPresenter.getItemView | public View getItemView(MenuItemImpl item, View convertView, ViewGroup parent) {
"""
Prepare an item view for use. See AdapterView for the basic idea at work here.
This may require creating a new item view, but well-behaved implementations will
re-use the view passed as convertView if present. The returned view will be populated
with data from the item parameter.
@param item Item to present
@param convertView Existing view to reuse
@param parent Intended parent view - use for inflation.
@return View that presents the requested menu item
"""
MenuView.ItemView itemView;
if (convertView instanceof MenuView.ItemView) {
itemView = (MenuView.ItemView) convertView;
} else {
itemView = createItemView(parent);
}
bindItemView(item, itemView);
return (View) itemView;
} | java | public View getItemView(MenuItemImpl item, View convertView, ViewGroup parent) {
MenuView.ItemView itemView;
if (convertView instanceof MenuView.ItemView) {
itemView = (MenuView.ItemView) convertView;
} else {
itemView = createItemView(parent);
}
bindItemView(item, itemView);
return (View) itemView;
} | [
"public",
"View",
"getItemView",
"(",
"MenuItemImpl",
"item",
",",
"View",
"convertView",
",",
"ViewGroup",
"parent",
")",
"{",
"MenuView",
".",
"ItemView",
"itemView",
";",
"if",
"(",
"convertView",
"instanceof",
"MenuView",
".",
"ItemView",
")",
"{",
"itemVi... | Prepare an item view for use. See AdapterView for the basic idea at work here.
This may require creating a new item view, but well-behaved implementations will
re-use the view passed as convertView if present. The returned view will be populated
with data from the item parameter.
@param item Item to present
@param convertView Existing view to reuse
@param parent Intended parent view - use for inflation.
@return View that presents the requested menu item | [
"Prepare",
"an",
"item",
"view",
"for",
"use",
".",
"See",
"AdapterView",
"for",
"the",
"basic",
"idea",
"at",
"work",
"here",
".",
"This",
"may",
"require",
"creating",
"a",
"new",
"item",
"view",
"but",
"well",
"-",
"behaved",
"implementations",
"will",
... | train | https://github.com/JakeWharton/ActionBarSherlock/blob/2c71339e756bcc0b1424c4525680549ba3a2dc97/actionbarsherlock/src/com/actionbarsherlock/internal/view/menu/BaseMenuPresenter.java#L169-L178 |
Azure/azure-sdk-for-java | logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/MapsInner.java | MapsInner.getAsync | public Observable<IntegrationAccountMapInner> getAsync(String resourceGroupName, String integrationAccountName, String mapName) {
"""
Gets an integration account map.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param mapName The integration account map name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the IntegrationAccountMapInner object
"""
return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, mapName).map(new Func1<ServiceResponse<IntegrationAccountMapInner>, IntegrationAccountMapInner>() {
@Override
public IntegrationAccountMapInner call(ServiceResponse<IntegrationAccountMapInner> response) {
return response.body();
}
});
} | java | public Observable<IntegrationAccountMapInner> getAsync(String resourceGroupName, String integrationAccountName, String mapName) {
return getWithServiceResponseAsync(resourceGroupName, integrationAccountName, mapName).map(new Func1<ServiceResponse<IntegrationAccountMapInner>, IntegrationAccountMapInner>() {
@Override
public IntegrationAccountMapInner call(ServiceResponse<IntegrationAccountMapInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"IntegrationAccountMapInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"integrationAccountName",
",",
"String",
"mapName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"integratio... | Gets an integration account map.
@param resourceGroupName The resource group name.
@param integrationAccountName The integration account name.
@param mapName The integration account map name.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the IntegrationAccountMapInner object | [
"Gets",
"an",
"integration",
"account",
"map",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/MapsInner.java#L381-L388 |
VoltDB/voltdb | third_party/java/src/org/HdrHistogram_voltpatches/SingleWriterRecorder.java | SingleWriterRecorder.recordValueWithCount | public void recordValueWithCount(final long value, final long count) throws ArrayIndexOutOfBoundsException {
"""
Record a value in the histogram (adding to the value's current count)
@param value The value to be recorded
@param count The number of occurrences of this value to record
@throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue
"""
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValueWithCount(value, count);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
} | java | public void recordValueWithCount(final long value, final long count) throws ArrayIndexOutOfBoundsException {
long criticalValueAtEnter = recordingPhaser.writerCriticalSectionEnter();
try {
activeHistogram.recordValueWithCount(value, count);
} finally {
recordingPhaser.writerCriticalSectionExit(criticalValueAtEnter);
}
} | [
"public",
"void",
"recordValueWithCount",
"(",
"final",
"long",
"value",
",",
"final",
"long",
"count",
")",
"throws",
"ArrayIndexOutOfBoundsException",
"{",
"long",
"criticalValueAtEnter",
"=",
"recordingPhaser",
".",
"writerCriticalSectionEnter",
"(",
")",
";",
"try... | Record a value in the histogram (adding to the value's current count)
@param value The value to be recorded
@param count The number of occurrences of this value to record
@throws ArrayIndexOutOfBoundsException (may throw) if value is exceeds highestTrackableValue | [
"Record",
"a",
"value",
"in",
"the",
"histogram",
"(",
"adding",
"to",
"the",
"value",
"s",
"current",
"count",
")"
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/SingleWriterRecorder.java#L112-L119 |
biojava/biojava | biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java | SeqRes2AtomAligner.alignProteinChains | private boolean alignProteinChains(List<Group> seqRes, List<Group> atomRes) {
"""
Aligns two chains of groups, where the first parent is representing the
list of amino acids as obtained from the SEQRES records, and the second parent
represents the groups obtained from the ATOM records (and containing the actual ATOM information).
This does the actual alignment and if a group can be mapped to a position in the SEQRES then the corresponding
position is replaced with the group that contains the atoms.
@param seqRes
@param atomRes
@return true if no match has been found
"""
Map<Integer,Integer> seqresIndexPosition = new HashMap<Integer, Integer>();
Map<Integer,Integer> atomIndexPosition = new HashMap<Integer, Integer>();
String seq1 = getFullAtomSequence(seqRes, seqresIndexPosition, false);
//
String seq2 = getFullAtomSequence(atomRes, atomIndexPosition, false);
logger.debug("Protein seq1 to align (length "+ seq1.length()+"): " + seq1);
logger.debug("Protein seq2 to align (length "+ seq2.length()+"): " + seq2);
ProteinSequence s1;
ProteinSequence s2;
try {
s1 = new ProteinSequence(seq1);
s2 = new ProteinSequence(seq2);
} catch (CompoundNotFoundException e) {
logger.warn("Could not create protein sequences ({}) to align ATOM and SEQRES groups, they will remain unaligned.", e.getMessage());
return true;
}
SubstitutionMatrix<AminoAcidCompound> matrix = SubstitutionMatrixHelper.getBlosum65();
GapPenalty penalty = new SimpleGapPenalty(8, 1);
PairwiseSequenceAligner<ProteinSequence, AminoAcidCompound> smithWaterman =
Alignments.getPairwiseAligner(s1, s2, PairwiseSequenceAlignerType.LOCAL, penalty, matrix);
SequencePair<ProteinSequence, AminoAcidCompound> pair = smithWaterman.getPair();
// sequences that are only X (e.g. 1jnv chain A) produced empty alignments, because nothing aligns to nothing and thus the local alignment is empty
// to avoid those empty alignments we catch them here with pair.getLength()==0
if ( pair == null || pair.getLength()==0) {
logger.warn("Could not align protein sequences. ATOM and SEQRES groups will not be aligned.");
logger.warn("Sequences: ");
logger.warn(seq1);
logger.warn(seq2);
return true;
}
logger.debug("Alignment:\n"+pair.toString(100));
boolean noMatchFound = mapChains(seqRes,atomRes,pair,seqresIndexPosition, atomIndexPosition );
return noMatchFound;
} | java | private boolean alignProteinChains(List<Group> seqRes, List<Group> atomRes) {
Map<Integer,Integer> seqresIndexPosition = new HashMap<Integer, Integer>();
Map<Integer,Integer> atomIndexPosition = new HashMap<Integer, Integer>();
String seq1 = getFullAtomSequence(seqRes, seqresIndexPosition, false);
//
String seq2 = getFullAtomSequence(atomRes, atomIndexPosition, false);
logger.debug("Protein seq1 to align (length "+ seq1.length()+"): " + seq1);
logger.debug("Protein seq2 to align (length "+ seq2.length()+"): " + seq2);
ProteinSequence s1;
ProteinSequence s2;
try {
s1 = new ProteinSequence(seq1);
s2 = new ProteinSequence(seq2);
} catch (CompoundNotFoundException e) {
logger.warn("Could not create protein sequences ({}) to align ATOM and SEQRES groups, they will remain unaligned.", e.getMessage());
return true;
}
SubstitutionMatrix<AminoAcidCompound> matrix = SubstitutionMatrixHelper.getBlosum65();
GapPenalty penalty = new SimpleGapPenalty(8, 1);
PairwiseSequenceAligner<ProteinSequence, AminoAcidCompound> smithWaterman =
Alignments.getPairwiseAligner(s1, s2, PairwiseSequenceAlignerType.LOCAL, penalty, matrix);
SequencePair<ProteinSequence, AminoAcidCompound> pair = smithWaterman.getPair();
// sequences that are only X (e.g. 1jnv chain A) produced empty alignments, because nothing aligns to nothing and thus the local alignment is empty
// to avoid those empty alignments we catch them here with pair.getLength()==0
if ( pair == null || pair.getLength()==0) {
logger.warn("Could not align protein sequences. ATOM and SEQRES groups will not be aligned.");
logger.warn("Sequences: ");
logger.warn(seq1);
logger.warn(seq2);
return true;
}
logger.debug("Alignment:\n"+pair.toString(100));
boolean noMatchFound = mapChains(seqRes,atomRes,pair,seqresIndexPosition, atomIndexPosition );
return noMatchFound;
} | [
"private",
"boolean",
"alignProteinChains",
"(",
"List",
"<",
"Group",
">",
"seqRes",
",",
"List",
"<",
"Group",
">",
"atomRes",
")",
"{",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"seqresIndexPosition",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"Integ... | Aligns two chains of groups, where the first parent is representing the
list of amino acids as obtained from the SEQRES records, and the second parent
represents the groups obtained from the ATOM records (and containing the actual ATOM information).
This does the actual alignment and if a group can be mapped to a position in the SEQRES then the corresponding
position is replaced with the group that contains the atoms.
@param seqRes
@param atomRes
@return true if no match has been found | [
"Aligns",
"two",
"chains",
"of",
"groups",
"where",
"the",
"first",
"parent",
"is",
"representing",
"the",
"list",
"of",
"amino",
"acids",
"as",
"obtained",
"from",
"the",
"SEQRES",
"records",
"and",
"the",
"second",
"parent",
"represents",
"the",
"groups",
... | train | https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/io/SeqRes2AtomAligner.java#L574-L628 |
jbundle/jbundle | thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/SyncRemoteTable.java | SyncRemoteTable.set | public void set(Object data, int iOpenMode) throws DBException, RemoteException {
"""
Update the current record.
@param The data to update.
@exception DBException File exception.
"""
synchronized(m_objSync)
{
m_tableRemote.set(data, iOpenMode);
}
} | java | public void set(Object data, int iOpenMode) throws DBException, RemoteException
{
synchronized(m_objSync)
{
m_tableRemote.set(data, iOpenMode);
}
} | [
"public",
"void",
"set",
"(",
"Object",
"data",
",",
"int",
"iOpenMode",
")",
"throws",
"DBException",
",",
"RemoteException",
"{",
"synchronized",
"(",
"m_objSync",
")",
"{",
"m_tableRemote",
".",
"set",
"(",
"data",
",",
"iOpenMode",
")",
";",
"}",
"}"
] | Update the current record.
@param The data to update.
@exception DBException File exception. | [
"Update",
"the",
"current",
"record",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/client/SyncRemoteTable.java#L136-L142 |
exoplatform/jcr | exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java | NullItemData.readExternal | public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
"""
{@inheritDoc}
We need to make it serializable mostly for distributed cache in case we
don't allow local caching
"""
byte[] buf = new byte[in.readInt()];
in.readFully(buf);
id = new String(buf, Constants.DEFAULT_ENCODING);
int length = in.readInt();
if (length > 0)
{
buf = new byte[length];
in.readFully(buf);
parentId = new String(buf, Constants.DEFAULT_ENCODING);
}
length = in.readInt();
if (length > 0)
{
buf = new byte[length];
in.readFully(buf);
try
{
name = QPathEntry.parse(new String(buf, Constants.DEFAULT_ENCODING));
}
catch (Exception e)
{
throw new IOException("Deserialization error, could not parse the name. ", e);
}
}
length = in.readInt();
if (length > 0)
{
buf = new byte[length];
in.readFully(buf);
try
{
path = QPath.parse(new String(buf, Constants.DEFAULT_ENCODING));
}
catch (Exception e)
{
throw new IOException("Deserialization error, could not parse the path. ", e);
}
}
} | java | public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
{
byte[] buf = new byte[in.readInt()];
in.readFully(buf);
id = new String(buf, Constants.DEFAULT_ENCODING);
int length = in.readInt();
if (length > 0)
{
buf = new byte[length];
in.readFully(buf);
parentId = new String(buf, Constants.DEFAULT_ENCODING);
}
length = in.readInt();
if (length > 0)
{
buf = new byte[length];
in.readFully(buf);
try
{
name = QPathEntry.parse(new String(buf, Constants.DEFAULT_ENCODING));
}
catch (Exception e)
{
throw new IOException("Deserialization error, could not parse the name. ", e);
}
}
length = in.readInt();
if (length > 0)
{
buf = new byte[length];
in.readFully(buf);
try
{
path = QPath.parse(new String(buf, Constants.DEFAULT_ENCODING));
}
catch (Exception e)
{
throw new IOException("Deserialization error, could not parse the path. ", e);
}
}
} | [
"public",
"void",
"readExternal",
"(",
"ObjectInput",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"in",
".",
"readInt",
"(",
")",
"]",
";",
"in",
".",
"readFully",
"(",
"buf",
... | {@inheritDoc}
We need to make it serializable mostly for distributed cache in case we
don't allow local caching | [
"{",
"@inheritDoc",
"}"
] | train | https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/datamodel/NullItemData.java#L103-L143 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/modules/utils/HelixUtils.java | HelixUtils.buildHelixManager | public static HelixManager buildHelixManager(String helixInstanceName, String helixClusterName, String zkConnectionString) {
"""
*
Build a Helix Manager (Helix Controller instance).
@param helixInstanceName the Helix Instance name.
@param helixClusterName the Helix Cluster name.
@param zkConnectionString the ZooKeeper connection string.
@return HelixManager
"""
return HelixManagerFactory.getZKHelixManager(helixClusterName, helixInstanceName,
InstanceType.CONTROLLER, zkConnectionString);
} | java | public static HelixManager buildHelixManager(String helixInstanceName, String helixClusterName, String zkConnectionString) {
return HelixManagerFactory.getZKHelixManager(helixClusterName, helixInstanceName,
InstanceType.CONTROLLER, zkConnectionString);
} | [
"public",
"static",
"HelixManager",
"buildHelixManager",
"(",
"String",
"helixInstanceName",
",",
"String",
"helixClusterName",
",",
"String",
"zkConnectionString",
")",
"{",
"return",
"HelixManagerFactory",
".",
"getZKHelixManager",
"(",
"helixClusterName",
",",
"helixIn... | *
Build a Helix Manager (Helix Controller instance).
@param helixInstanceName the Helix Instance name.
@param helixClusterName the Helix Cluster name.
@param zkConnectionString the ZooKeeper connection string.
@return HelixManager | [
"*",
"Build",
"a",
"Helix",
"Manager",
"(",
"Helix",
"Controller",
"instance",
")",
"."
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/utils/HelixUtils.java#L46-L49 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.