repository_name stringlengths 7 58 | func_path_in_repository stringlengths 18 188 | func_name stringlengths 7 127 | whole_func_string stringlengths 77 3.91k | language stringclasses 1
value | func_code_string stringlengths 77 3.91k | func_code_tokens listlengths 20 745 | func_documentation_string stringlengths 61 1.98k | func_documentation_tokens listlengths 1 477 | split_name stringclasses 1
value | func_code_url stringlengths 111 288 |
|---|---|---|---|---|---|---|---|---|---|---|
jbundle/jbundle | base/screen/model/src/main/java/org/jbundle/base/screen/model/SButtonBox.java | SButtonBox.setSFieldValue | public int setSFieldValue(String strParamValue, boolean bDisplayOption, int iMoveMode)
{
String strButtonDesc = this.getButtonDesc();
String strButtonCommand = this.getButtonCommand();
if (strButtonCommand != null)
if (strButtonDesc != null)
if (strButtonDesc.equals(strParamValue))
{ // Button was pressed, do command
this.handleCommand(strButtonCommand, this, ScreenConstants.USE_NEW_WINDOW);
return DBConstants.NORMAL_RETURN;
}
// Often this is called in a report needing a value set, so set it:
return super.setSFieldValue(strParamValue, bDisplayOption, iMoveMode);
} | java | public int setSFieldValue(String strParamValue, boolean bDisplayOption, int iMoveMode)
{
String strButtonDesc = this.getButtonDesc();
String strButtonCommand = this.getButtonCommand();
if (strButtonCommand != null)
if (strButtonDesc != null)
if (strButtonDesc.equals(strParamValue))
{ // Button was pressed, do command
this.handleCommand(strButtonCommand, this, ScreenConstants.USE_NEW_WINDOW);
return DBConstants.NORMAL_RETURN;
}
// Often this is called in a report needing a value set, so set it:
return super.setSFieldValue(strParamValue, bDisplayOption, iMoveMode);
} | [
"public",
"int",
"setSFieldValue",
"(",
"String",
"strParamValue",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"String",
"strButtonDesc",
"=",
"this",
".",
"getButtonDesc",
"(",
")",
";",
"String",
"strButtonCommand",
"=",
"this",
".",
... | Set this control's converter to this HTML param.
ie., Check to see if this button was pressed. | [
"Set",
"this",
"control",
"s",
"converter",
"to",
"this",
"HTML",
"param",
".",
"ie",
".",
"Check",
"to",
"see",
"if",
"this",
"button",
"was",
"pressed",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/SButtonBox.java#L177-L190 |
Azure/azure-sdk-for-java | compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java | VirtualMachineScaleSetsInner.beginDeallocateAsync | public Observable<OperationStatusResponseInner> beginDeallocateAsync(String resourceGroupName, String vmScaleSetName) {
return beginDeallocateWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | java | public Observable<OperationStatusResponseInner> beginDeallocateAsync(String resourceGroupName, String vmScaleSetName) {
return beginDeallocateWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<OperationStatusResponseInner>, OperationStatusResponseInner>() {
@Override
public OperationStatusResponseInner call(ServiceResponse<OperationStatusResponseInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"OperationStatusResponseInner",
">",
"beginDeallocateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"vmScaleSetName",
")",
"{",
"return",
"beginDeallocateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"vmScaleSetName",
")",
... | Deallocates specific virtual machines in a VM scale set. Shuts down the virtual machines and releases the compute resources. You are not billed for the compute resources that this virtual machine scale set deallocates.
@param resourceGroupName The name of the resource group.
@param vmScaleSetName The name of the VM scale set.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the OperationStatusResponseInner object | [
"Deallocates",
"specific",
"virtual",
"machines",
"in",
"a",
"VM",
"scale",
"set",
".",
"Shuts",
"down",
"the",
"virtual",
"machines",
"and",
"releases",
"the",
"compute",
"resources",
".",
"You",
"are",
"not",
"billed",
"for",
"the",
"compute",
"resources",
... | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L965-L972 |
VoltDB/voltdb | third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java | DoubleHistogram.getCountBetweenValues | public double getCountBetweenValues(final double lowValue, final double highValue)
throws ArrayIndexOutOfBoundsException {
return integerValuesHistogram.getCountBetweenValues(
(long)(lowValue * doubleToIntegerValueConversionRatio),
(long)(highValue * doubleToIntegerValueConversionRatio)
);
} | java | public double getCountBetweenValues(final double lowValue, final double highValue)
throws ArrayIndexOutOfBoundsException {
return integerValuesHistogram.getCountBetweenValues(
(long)(lowValue * doubleToIntegerValueConversionRatio),
(long)(highValue * doubleToIntegerValueConversionRatio)
);
} | [
"public",
"double",
"getCountBetweenValues",
"(",
"final",
"double",
"lowValue",
",",
"final",
"double",
"highValue",
")",
"throws",
"ArrayIndexOutOfBoundsException",
"{",
"return",
"integerValuesHistogram",
".",
"getCountBetweenValues",
"(",
"(",
"long",
")",
"(",
"l... | Get the count of recorded values within a range of value levels (inclusive to within the histogram's resolution).
@param lowValue The lower value bound on the range for which
to provide the recorded count. Will be rounded down with
{@link DoubleHistogram#lowestEquivalentValue lowestEquivalentValue}.
@param highValue The higher value bound on the range for which to provide the recorded count.
Will be rounded up with {@link DoubleHistogram#highestEquivalentValue highestEquivalentValue}.
@return the total count of values recorded in the histogram within the value range that is
{@literal >=} lowestEquivalentValue(<i>lowValue</i>) and {@literal <=} highestEquivalentValue(<i>highValue</i>) | [
"Get",
"the",
"count",
"of",
"recorded",
"values",
"within",
"a",
"range",
"of",
"value",
"levels",
"(",
"inclusive",
"to",
"within",
"the",
"histogram",
"s",
"resolution",
")",
"."
] | train | https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/HdrHistogram_voltpatches/DoubleHistogram.java#L1078-L1084 |
google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.multiplyAndRound | private static BigDecimal multiplyAndRound(long x, long y, int scale, MathContext mc) {
long product = multiply(x, y);
if(product!=INFLATED) {
return doRound(product, scale, mc);
}
// attempt to do it in 128 bits
int rsign = 1;
if(x < 0) {
x = -x;
rsign = -1;
}
if(y < 0) {
y = -y;
rsign *= -1;
}
// multiply dividend0 * dividend1
long m0_hi = x >>> 32;
long m0_lo = x & LONG_MASK;
long m1_hi = y >>> 32;
long m1_lo = y & LONG_MASK;
product = m0_lo * m1_lo;
long m0 = product & LONG_MASK;
long m1 = product >>> 32;
product = m0_hi * m1_lo + m1;
m1 = product & LONG_MASK;
long m2 = product >>> 32;
product = m0_lo * m1_hi + m1;
m1 = product & LONG_MASK;
m2 += product >>> 32;
long m3 = m2>>>32;
m2 &= LONG_MASK;
product = m0_hi*m1_hi + m2;
m2 = product & LONG_MASK;
m3 = ((product>>>32) + m3) & LONG_MASK;
final long mHi = make64(m3,m2);
final long mLo = make64(m1,m0);
BigDecimal res = doRound128(mHi, mLo, rsign, scale, mc);
if(res!=null) {
return res;
}
res = new BigDecimal(BigInteger.valueOf(x).multiply(y*rsign), INFLATED, scale, 0);
return doRound(res,mc);
} | java | private static BigDecimal multiplyAndRound(long x, long y, int scale, MathContext mc) {
long product = multiply(x, y);
if(product!=INFLATED) {
return doRound(product, scale, mc);
}
// attempt to do it in 128 bits
int rsign = 1;
if(x < 0) {
x = -x;
rsign = -1;
}
if(y < 0) {
y = -y;
rsign *= -1;
}
// multiply dividend0 * dividend1
long m0_hi = x >>> 32;
long m0_lo = x & LONG_MASK;
long m1_hi = y >>> 32;
long m1_lo = y & LONG_MASK;
product = m0_lo * m1_lo;
long m0 = product & LONG_MASK;
long m1 = product >>> 32;
product = m0_hi * m1_lo + m1;
m1 = product & LONG_MASK;
long m2 = product >>> 32;
product = m0_lo * m1_hi + m1;
m1 = product & LONG_MASK;
m2 += product >>> 32;
long m3 = m2>>>32;
m2 &= LONG_MASK;
product = m0_hi*m1_hi + m2;
m2 = product & LONG_MASK;
m3 = ((product>>>32) + m3) & LONG_MASK;
final long mHi = make64(m3,m2);
final long mLo = make64(m1,m0);
BigDecimal res = doRound128(mHi, mLo, rsign, scale, mc);
if(res!=null) {
return res;
}
res = new BigDecimal(BigInteger.valueOf(x).multiply(y*rsign), INFLATED, scale, 0);
return doRound(res,mc);
} | [
"private",
"static",
"BigDecimal",
"multiplyAndRound",
"(",
"long",
"x",
",",
"long",
"y",
",",
"int",
"scale",
",",
"MathContext",
"mc",
")",
"{",
"long",
"product",
"=",
"multiply",
"(",
"x",
",",
"y",
")",
";",
"if",
"(",
"product",
"!=",
"INFLATED"... | Multiplies two long values and rounds according {@code MathContext} | [
"Multiplies",
"two",
"long",
"values",
"and",
"rounds",
"according",
"{"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L5024-L5066 |
moparisthebest/beehive | beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java | PageFlowTagUtils.rewriteActionURL | public static String rewriteActionURL(PageContext pageContext, String action, Map params, String location)
throws URISyntaxException
{
ServletContext servletContext = pageContext.getServletContext();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
boolean forXML = TagRenderingBase.Factory.isXHTML(request);
if (action.length() > 0 && action.charAt(0) == '/') action = action.substring(1);
return PageFlowUtils.getRewrittenActionURI(servletContext, request, response, action, params, location, forXML);
} | java | public static String rewriteActionURL(PageContext pageContext, String action, Map params, String location)
throws URISyntaxException
{
ServletContext servletContext = pageContext.getServletContext();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse) pageContext.getResponse();
boolean forXML = TagRenderingBase.Factory.isXHTML(request);
if (action.length() > 0 && action.charAt(0) == '/') action = action.substring(1);
return PageFlowUtils.getRewrittenActionURI(servletContext, request, response, action, params, location, forXML);
} | [
"public",
"static",
"String",
"rewriteActionURL",
"(",
"PageContext",
"pageContext",
",",
"String",
"action",
",",
"Map",
"params",
",",
"String",
"location",
")",
"throws",
"URISyntaxException",
"{",
"ServletContext",
"servletContext",
"=",
"pageContext",
".",
"get... | Create a fully-rewritten url from an initial action url with query parameters
and an anchor (location on page), checking if it needs to be secure then call
the rewriter service using a type of {@link org.apache.beehive.netui.core.urls.URLType#ACTION}.
@param pageContext the current PageContext.
@param action the action url to rewrite.
@param params the query parameters for this url.
@param location the location (anchor or fragment) for this url.
@return a uri that has been run through the URL rewriter service. | [
"Create",
"a",
"fully",
"-",
"rewritten",
"url",
"from",
"an",
"initial",
"action",
"url",
"with",
"query",
"parameters",
"and",
"an",
"anchor",
"(",
"location",
"on",
"page",
")",
"checking",
"if",
"it",
"needs",
"to",
"be",
"secure",
"then",
"call",
"t... | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-tags/src/main/java/org/apache/beehive/netui/tags/internal/PageFlowTagUtils.java#L60-L69 |
deeplearning4j/deeplearning4j | deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasSimpleRnn.java | KerasSimpleRnn.setWeights | @Override
public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException {
this.weights = new HashMap<>();
INDArray W;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_W()))
W = weights.get(conf.getKERAS_PARAM_NAME_W());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_W());
this.weights.put(SimpleRnnParamInitializer.WEIGHT_KEY, W);
INDArray RW;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_RW()))
RW = weights.get(conf.getKERAS_PARAM_NAME_RW());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_RW());
this.weights.put(SimpleRnnParamInitializer.RECURRENT_WEIGHT_KEY, RW);
INDArray b;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_B()))
b = weights.get(conf.getKERAS_PARAM_NAME_B());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_B());
this.weights.put(SimpleRnnParamInitializer.BIAS_KEY, b);
if (weights.size() > NUM_TRAINABLE_PARAMS) {
Set<String> paramNames = weights.keySet();
paramNames.remove(conf.getKERAS_PARAM_NAME_B());
paramNames.remove(conf.getKERAS_PARAM_NAME_W());
paramNames.remove(conf.getKERAS_PARAM_NAME_RW());
String unknownParamNames = paramNames.toString();
log.warn("Attemping to set weights for unknown parameters: "
+ unknownParamNames.substring(1, unknownParamNames.length() - 1));
}
} | java | @Override
public void setWeights(Map<String, INDArray> weights) throws InvalidKerasConfigurationException {
this.weights = new HashMap<>();
INDArray W;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_W()))
W = weights.get(conf.getKERAS_PARAM_NAME_W());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_W());
this.weights.put(SimpleRnnParamInitializer.WEIGHT_KEY, W);
INDArray RW;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_RW()))
RW = weights.get(conf.getKERAS_PARAM_NAME_RW());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_RW());
this.weights.put(SimpleRnnParamInitializer.RECURRENT_WEIGHT_KEY, RW);
INDArray b;
if (weights.containsKey(conf.getKERAS_PARAM_NAME_B()))
b = weights.get(conf.getKERAS_PARAM_NAME_B());
else
throw new InvalidKerasConfigurationException(
"Keras SimpleRNN layer does not contain parameter " + conf.getKERAS_PARAM_NAME_B());
this.weights.put(SimpleRnnParamInitializer.BIAS_KEY, b);
if (weights.size() > NUM_TRAINABLE_PARAMS) {
Set<String> paramNames = weights.keySet();
paramNames.remove(conf.getKERAS_PARAM_NAME_B());
paramNames.remove(conf.getKERAS_PARAM_NAME_W());
paramNames.remove(conf.getKERAS_PARAM_NAME_RW());
String unknownParamNames = paramNames.toString();
log.warn("Attemping to set weights for unknown parameters: "
+ unknownParamNames.substring(1, unknownParamNames.length() - 1));
}
} | [
"@",
"Override",
"public",
"void",
"setWeights",
"(",
"Map",
"<",
"String",
",",
"INDArray",
">",
"weights",
")",
"throws",
"InvalidKerasConfigurationException",
"{",
"this",
".",
"weights",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"INDArray",
"W",
";",
... | Set weights for layer.
@param weights Simple RNN weights
@throws InvalidKerasConfigurationException Invalid Keras configuration exception | [
"Set",
"weights",
"for",
"layer",
"."
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/layers/recurrent/KerasSimpleRnn.java#L249-L290 |
Swagger2Markup/swagger2markup | src/main/java/io/github/swagger2markup/spi/SecurityDocumentExtension.java | SecurityDocumentExtension.levelOffset | protected int levelOffset(Context context) {
//TODO: Unused method, make sure this is never used and then remove it.
int levelOffset;
switch (context.position) {
case DOCUMENT_BEFORE:
case DOCUMENT_AFTER:
levelOffset = 0;
break;
case DOCUMENT_BEGIN:
case DOCUMENT_END:
case SECURITY_SCHEME_BEFORE:
case SECURITY_SCHEME_AFTER:
levelOffset = 1;
break;
case SECURITY_SCHEME_BEGIN:
case SECURITY_SCHEME_END:
levelOffset = 2;
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", context.position));
}
return levelOffset;
} | java | protected int levelOffset(Context context) {
//TODO: Unused method, make sure this is never used and then remove it.
int levelOffset;
switch (context.position) {
case DOCUMENT_BEFORE:
case DOCUMENT_AFTER:
levelOffset = 0;
break;
case DOCUMENT_BEGIN:
case DOCUMENT_END:
case SECURITY_SCHEME_BEFORE:
case SECURITY_SCHEME_AFTER:
levelOffset = 1;
break;
case SECURITY_SCHEME_BEGIN:
case SECURITY_SCHEME_END:
levelOffset = 2;
break;
default:
throw new RuntimeException(String.format("Unknown position '%s'", context.position));
}
return levelOffset;
} | [
"protected",
"int",
"levelOffset",
"(",
"Context",
"context",
")",
"{",
"//TODO: Unused method, make sure this is never used and then remove it.",
"int",
"levelOffset",
";",
"switch",
"(",
"context",
".",
"position",
")",
"{",
"case",
"DOCUMENT_BEFORE",
":",
"case",
"DO... | Returns title level offset from 1 to apply to content
@param context context
@return title level offset | [
"Returns",
"title",
"level",
"offset",
"from",
"1",
"to",
"apply",
"to",
"content"
] | train | https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/spi/SecurityDocumentExtension.java#L38-L61 |
basho/riak-java-client | src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java | AnnotationUtil.populateUsermeta | public static <T> T populateUsermeta(RiakUserMetadata usermetaData, T domainObject)
{
return AnnotationHelper.getInstance().setUsermetaData(usermetaData, domainObject);
} | java | public static <T> T populateUsermeta(RiakUserMetadata usermetaData, T domainObject)
{
return AnnotationHelper.getInstance().setUsermetaData(usermetaData, domainObject);
} | [
"public",
"static",
"<",
"T",
">",
"T",
"populateUsermeta",
"(",
"RiakUserMetadata",
"usermetaData",
",",
"T",
"domainObject",
")",
"{",
"return",
"AnnotationHelper",
".",
"getInstance",
"(",
")",
".",
"setUsermetaData",
"(",
"usermetaData",
",",
"domainObject",
... | Attempts to populate a domain object with user metadata by looking for a
{@literal @RiakUsermeta} annotated member.
@param <T> the type of the domain object
@param usermetaData a Map of user metadata.
@param domainObject the domain object.
@return the domain object. | [
"Attempts",
"to",
"populate",
"a",
"domain",
"object",
"with",
"user",
"metadata",
"by",
"looking",
"for",
"a",
"{",
"@literal",
"@RiakUsermeta",
"}",
"annotated",
"member",
"."
] | train | https://github.com/basho/riak-java-client/blob/bed6cd60f360bacf1b873ab92dd74f2526651e71/src/main/java/com/basho/riak/client/api/convert/reflection/AnnotationUtil.java#L279-L282 |
lessthanoptimal/BoofCV | main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java | PolylineSplitMerge.computePotentialSplitScore | void computePotentialSplitScore( List<Point2D_I32> contour , Element<Corner> e0 , boolean mustSplit )
{
Element<Corner> e1 = next(e0);
e0.object.splitable = canBeSplit(contour,e0,mustSplit);
if( e0.object.splitable ) {
setSplitVariables(contour, e0, e1);
}
} | java | void computePotentialSplitScore( List<Point2D_I32> contour , Element<Corner> e0 , boolean mustSplit )
{
Element<Corner> e1 = next(e0);
e0.object.splitable = canBeSplit(contour,e0,mustSplit);
if( e0.object.splitable ) {
setSplitVariables(contour, e0, e1);
}
} | [
"void",
"computePotentialSplitScore",
"(",
"List",
"<",
"Point2D_I32",
">",
"contour",
",",
"Element",
"<",
"Corner",
">",
"e0",
",",
"boolean",
"mustSplit",
")",
"{",
"Element",
"<",
"Corner",
">",
"e1",
"=",
"next",
"(",
"e0",
")",
";",
"e0",
".",
"o... | Computes the split location and the score of the two new sides if it's split there | [
"Computes",
"the",
"split",
"location",
"and",
"the",
"score",
"of",
"the",
"two",
"new",
"sides",
"if",
"it",
"s",
"split",
"there"
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/shapes/polyline/splitmerge/PolylineSplitMerge.java#L663-L672 |
js-lib-com/commons | src/main/java/js/io/FilesOutputStream.java | FilesOutputStream.putMeta | public void putMeta(String key, Object value) {
manifest.getMainAttributes().putValue(key, ConverterRegistry.getConverter().asString(value));
} | java | public void putMeta(String key, Object value) {
manifest.getMainAttributes().putValue(key, ConverterRegistry.getConverter().asString(value));
} | [
"public",
"void",
"putMeta",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"manifest",
".",
"getMainAttributes",
"(",
")",
".",
"putValue",
"(",
"key",
",",
"ConverterRegistry",
".",
"getConverter",
"(",
")",
".",
"asString",
"(",
"value",
")",
... | Put meta data to this archive manifest. If <code>key</code> already exists is overridden. Meta <code>value</code> is
converted to string and can be any type for which there is a {@link Converter} registered.
@param key meta data key,
@param value meta data value. | [
"Put",
"meta",
"data",
"to",
"this",
"archive",
"manifest",
".",
"If",
"<code",
">",
"key<",
"/",
"code",
">",
"already",
"exists",
"is",
"overridden",
".",
"Meta",
"<code",
">",
"value<",
"/",
"code",
">",
"is",
"converted",
"to",
"string",
"and",
"ca... | train | https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesOutputStream.java#L100-L102 |
Azure/azure-sdk-for-java | sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesInner.java | DatabaseTableAuditingPoliciesInner.listByDatabaseAsync | public Observable<DatabaseTableAuditingPolicyListResultInner> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) {
return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseTableAuditingPolicyListResultInner>, DatabaseTableAuditingPolicyListResultInner>() {
@Override
public DatabaseTableAuditingPolicyListResultInner call(ServiceResponse<DatabaseTableAuditingPolicyListResultInner> response) {
return response.body();
}
});
} | java | public Observable<DatabaseTableAuditingPolicyListResultInner> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) {
return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<DatabaseTableAuditingPolicyListResultInner>, DatabaseTableAuditingPolicyListResultInner>() {
@Override
public DatabaseTableAuditingPolicyListResultInner call(ServiceResponse<DatabaseTableAuditingPolicyListResultInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"DatabaseTableAuditingPolicyListResultInner",
">",
"listByDatabaseAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"serverName",
",",
"String",
"databaseName",
")",
"{",
"return",
"listByDatabaseWithServiceResponseAsync",
"(",
"resourceG... | Lists a database's table auditing policies. Table auditing is deprecated, use blob auditing instead.
@param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal.
@param serverName The name of the server.
@param databaseName The name of the database for which the table audit policy is defined.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the DatabaseTableAuditingPolicyListResultInner object | [
"Lists",
"a",
"database",
"s",
"table",
"auditing",
"policies",
".",
"Table",
"auditing",
"is",
"deprecated",
"use",
"blob",
"auditing",
"instead",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseTableAuditingPoliciesInner.java#L306-L313 |
rometools/rome | rome-propono/src/main/java/com/rometools/propono/atom/client/ClientCollection.java | ClientCollection.createMediaEntry | public ClientMediaEntry createMediaEntry(final String title, final String slug, final String contentType, final byte[] bytes) throws ProponoException {
if (!isWritable()) {
throw new ProponoException("Collection is not writable");
}
return new ClientMediaEntry(service, this, title, slug, contentType, bytes);
} | java | public ClientMediaEntry createMediaEntry(final String title, final String slug, final String contentType, final byte[] bytes) throws ProponoException {
if (!isWritable()) {
throw new ProponoException("Collection is not writable");
}
return new ClientMediaEntry(service, this, title, slug, contentType, bytes);
} | [
"public",
"ClientMediaEntry",
"createMediaEntry",
"(",
"final",
"String",
"title",
",",
"final",
"String",
"slug",
",",
"final",
"String",
"contentType",
",",
"final",
"byte",
"[",
"]",
"bytes",
")",
"throws",
"ProponoException",
"{",
"if",
"(",
"!",
"isWritab... | Create new media entry assocaited with collection, but do not save. server. Depending on the
Atom server, you may or may not be able to persist the properties of the entry that is
returned.
@param title Title to used for uploaded file.
@param slug String to be used in file-name of stored file
@param contentType MIME content-type of file.
@param bytes Data to be uploaded as byte array.
@throws ProponoException if collecton is not writable | [
"Create",
"new",
"media",
"entry",
"assocaited",
"with",
"collection",
"but",
"do",
"not",
"save",
".",
"server",
".",
"Depending",
"on",
"the",
"Atom",
"server",
"you",
"may",
"or",
"may",
"not",
"be",
"able",
"to",
"persist",
"the",
"properties",
"of",
... | train | https://github.com/rometools/rome/blob/5fcf0b1a9a6cdedbe253a45ad9468c54a0f97010/rome-propono/src/main/java/com/rometools/propono/atom/client/ClientCollection.java#L158-L163 |
aalmiray/Json-lib | src/main/java/net/sf/json/JSONArray.java | JSONArray.element | public JSONArray element( Map value, JsonConfig jsonConfig ) {
if( value instanceof JSONObject ){
elements.add( value );
return this;
}else{
return element( JSONObject.fromObject( value, jsonConfig ) );
}
} | java | public JSONArray element( Map value, JsonConfig jsonConfig ) {
if( value instanceof JSONObject ){
elements.add( value );
return this;
}else{
return element( JSONObject.fromObject( value, jsonConfig ) );
}
} | [
"public",
"JSONArray",
"element",
"(",
"Map",
"value",
",",
"JsonConfig",
"jsonConfig",
")",
"{",
"if",
"(",
"value",
"instanceof",
"JSONObject",
")",
"{",
"elements",
".",
"add",
"(",
"value",
")",
";",
"return",
"this",
";",
"}",
"else",
"{",
"return",... | Put a value in the JSONArray, where the value will be a JSONObject which
is produced from a Map.
@param value A Map value.
@return this. | [
"Put",
"a",
"value",
"in",
"the",
"JSONArray",
"where",
"the",
"value",
"will",
"be",
"a",
"JSONObject",
"which",
"is",
"produced",
"from",
"a",
"Map",
"."
] | train | https://github.com/aalmiray/Json-lib/blob/9e2b3376ee8f511a48aa7ac05f75a7414e02280f/src/main/java/net/sf/json/JSONArray.java#L1534-L1541 |
hawkular/hawkular-agent | hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/protocol/platform/OshiPlatformCache.java | OshiPlatformCache.getFileStoreMetric | public Double getFileStoreMetric(String fileStoreNameName, ID metricToCollect) {
Map<String, OSFileStore> cache = getFileStores();
OSFileStore fileStore = cache.get(fileStoreNameName);
if (fileStore == null) {
return null;
}
if (PlatformMetricType.FILE_STORE_TOTAL_SPACE.getMetricTypeId().equals(metricToCollect)) {
return Double.valueOf(fileStore.getTotalSpace());
} else if (PlatformMetricType.FILE_STORE_USABLE_SPACE.getMetricTypeId().equals(metricToCollect)) {
return Double.valueOf(fileStore.getUsableSpace());
} else {
throw new UnsupportedOperationException("Invalid file store metric to collect: " + metricToCollect);
}
} | java | public Double getFileStoreMetric(String fileStoreNameName, ID metricToCollect) {
Map<String, OSFileStore> cache = getFileStores();
OSFileStore fileStore = cache.get(fileStoreNameName);
if (fileStore == null) {
return null;
}
if (PlatformMetricType.FILE_STORE_TOTAL_SPACE.getMetricTypeId().equals(metricToCollect)) {
return Double.valueOf(fileStore.getTotalSpace());
} else if (PlatformMetricType.FILE_STORE_USABLE_SPACE.getMetricTypeId().equals(metricToCollect)) {
return Double.valueOf(fileStore.getUsableSpace());
} else {
throw new UnsupportedOperationException("Invalid file store metric to collect: " + metricToCollect);
}
} | [
"public",
"Double",
"getFileStoreMetric",
"(",
"String",
"fileStoreNameName",
",",
"ID",
"metricToCollect",
")",
"{",
"Map",
"<",
"String",
",",
"OSFileStore",
">",
"cache",
"=",
"getFileStores",
"(",
")",
";",
"OSFileStore",
"fileStore",
"=",
"cache",
".",
"g... | Returns the given metric's value, or null if there is no file store with the given name.
@param fileStoreNameName name of file store
@param metricToCollect the metric to collect
@return the value of the metric, or null if there is no file store with the given name | [
"Returns",
"the",
"given",
"metric",
"s",
"value",
"or",
"null",
"if",
"there",
"is",
"no",
"file",
"store",
"with",
"the",
"given",
"name",
"."
] | train | https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-agent-core/src/main/java/org/hawkular/agent/monitor/protocol/platform/OshiPlatformCache.java#L309-L324 |
google/error-prone-javac | src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java | PackageSummaryBuilder.buildPackageTags | public void buildPackageTags(XMLNode node, Content packageContentTree) {
if (configuration.nocomment) {
return;
}
packageWriter.addPackageTags(packageContentTree);
} | java | public void buildPackageTags(XMLNode node, Content packageContentTree) {
if (configuration.nocomment) {
return;
}
packageWriter.addPackageTags(packageContentTree);
} | [
"public",
"void",
"buildPackageTags",
"(",
"XMLNode",
"node",
",",
"Content",
"packageContentTree",
")",
"{",
"if",
"(",
"configuration",
".",
"nocomment",
")",
"{",
"return",
";",
"}",
"packageWriter",
".",
"addPackageTags",
"(",
"packageContentTree",
")",
";",... | Build the tags of the summary.
@param node the XML element that specifies which components to document
@param packageContentTree the tree to which the package tags will be added | [
"Build",
"the",
"tags",
"of",
"the",
"summary",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/builders/PackageSummaryBuilder.java#L347-L352 |
mqlight/java-mqlight | mqlight/src/main/java/com/ibm/mqlight/api/security/KeyStoreUtils.java | KeyStoreUtils.addPrivateKey | public static void addPrivateKey(KeyStore keyStore, File pemKeyFile, char[] passwordChars, List<Certificate> certChain) throws IOException, GeneralSecurityException {
final String methodName = "addPrivateKey";
logger.entry(methodName, pemKeyFile, certChain);
PrivateKey privateKey = createPrivateKey(pemKeyFile, passwordChars);
keyStore.setKeyEntry("key", privateKey, passwordChars, certChain.toArray(new Certificate[certChain.size()]));
logger.exit(methodName);
} | java | public static void addPrivateKey(KeyStore keyStore, File pemKeyFile, char[] passwordChars, List<Certificate> certChain) throws IOException, GeneralSecurityException {
final String methodName = "addPrivateKey";
logger.entry(methodName, pemKeyFile, certChain);
PrivateKey privateKey = createPrivateKey(pemKeyFile, passwordChars);
keyStore.setKeyEntry("key", privateKey, passwordChars, certChain.toArray(new Certificate[certChain.size()]));
logger.exit(methodName);
} | [
"public",
"static",
"void",
"addPrivateKey",
"(",
"KeyStore",
"keyStore",
",",
"File",
"pemKeyFile",
",",
"char",
"[",
"]",
"passwordChars",
",",
"List",
"<",
"Certificate",
">",
"certChain",
")",
"throws",
"IOException",
",",
"GeneralSecurityException",
"{",
"f... | Adds a private key to the specified key store from the passed private key file and certificate chain.
@param keyStore
The key store to receive the private key.
@param pemKeyFile
A PEM format file containing the private key.
@param passwordChars
The password that protects the private key.
@param certChain The certificate chain to associate with the private key.
@throws IOException if the key store file cannot be read
@throws GeneralSecurityException if a cryptography problem is encountered. | [
"Adds",
"a",
"private",
"key",
"to",
"the",
"specified",
"key",
"store",
"from",
"the",
"passed",
"private",
"key",
"file",
"and",
"certificate",
"chain",
"."
] | train | https://github.com/mqlight/java-mqlight/blob/a565dfa6044050826d1221697da9e3268b557aeb/mqlight/src/main/java/com/ibm/mqlight/api/security/KeyStoreUtils.java#L125-L134 |
duracloud/duracloud | security/src/main/java/org/duracloud/security/vote/SpaceAccessVoter.java | SpaceAccessVoter.getSpaceACLs | protected Map<String, AclType> getSpaceACLs(HttpServletRequest request) {
String storeId = getStoreId(request);
String spaceId = getSpaceId(request);
return getSpaceACLs(storeId, spaceId);
} | java | protected Map<String, AclType> getSpaceACLs(HttpServletRequest request) {
String storeId = getStoreId(request);
String spaceId = getSpaceId(request);
return getSpaceACLs(storeId, spaceId);
} | [
"protected",
"Map",
"<",
"String",
",",
"AclType",
">",
"getSpaceACLs",
"(",
"HttpServletRequest",
"request",
")",
"{",
"String",
"storeId",
"=",
"getStoreId",
"(",
"request",
")",
";",
"String",
"spaceId",
"=",
"getSpaceId",
"(",
"request",
")",
";",
"retur... | This method returns the ACLs of the requested space, or an empty-map if
there is an error or for certain 'keyword' spaces, or null if the space
does not exist.
@param request containing spaceId and storeId
@return ACLs, empty-map, or null | [
"This",
"method",
"returns",
"the",
"ACLs",
"of",
"the",
"requested",
"space",
"or",
"an",
"empty",
"-",
"map",
"if",
"there",
"is",
"an",
"error",
"or",
"for",
"certain",
"keyword",
"spaces",
"or",
"null",
"if",
"the",
"space",
"does",
"not",
"exist",
... | train | https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/security/src/main/java/org/duracloud/security/vote/SpaceAccessVoter.java#L140-L144 |
alkacon/opencms-core | src/org/opencms/xml/containerpage/CmsADECache.java | CmsADECache.getCacheGroupContainer | public CmsXmlGroupContainer getCacheGroupContainer(String key, boolean online) {
try {
m_lock.readLock().lock();
CmsXmlGroupContainer retValue;
if (online) {
retValue = m_groupContainersOnline.get(key);
if (LOG.isDebugEnabled()) {
if (retValue == null) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_DEBUG_CACHE_MISSED_ONLINE_1,
new Object[] {key}));
} else {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_DEBUG_CACHE_MATCHED_ONLINE_2,
new Object[] {key, retValue}));
}
}
} else {
retValue = m_groupContainersOffline.get(key);
if (LOG.isDebugEnabled()) {
if (retValue == null) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_DEBUG_CACHE_MISSED_OFFLINE_1,
new Object[] {key}));
} else {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_DEBUG_CACHE_MATCHED_OFFLINE_2,
new Object[] {key, retValue}));
}
}
}
return retValue;
} finally {
m_lock.readLock().unlock();
}
} | java | public CmsXmlGroupContainer getCacheGroupContainer(String key, boolean online) {
try {
m_lock.readLock().lock();
CmsXmlGroupContainer retValue;
if (online) {
retValue = m_groupContainersOnline.get(key);
if (LOG.isDebugEnabled()) {
if (retValue == null) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_DEBUG_CACHE_MISSED_ONLINE_1,
new Object[] {key}));
} else {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_DEBUG_CACHE_MATCHED_ONLINE_2,
new Object[] {key, retValue}));
}
}
} else {
retValue = m_groupContainersOffline.get(key);
if (LOG.isDebugEnabled()) {
if (retValue == null) {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_DEBUG_CACHE_MISSED_OFFLINE_1,
new Object[] {key}));
} else {
LOG.debug(
Messages.get().getBundle().key(
Messages.LOG_DEBUG_CACHE_MATCHED_OFFLINE_2,
new Object[] {key, retValue}));
}
}
}
return retValue;
} finally {
m_lock.readLock().unlock();
}
} | [
"public",
"CmsXmlGroupContainer",
"getCacheGroupContainer",
"(",
"String",
"key",
",",
"boolean",
"online",
")",
"{",
"try",
"{",
"m_lock",
".",
"readLock",
"(",
")",
".",
"lock",
"(",
")",
";",
"CmsXmlGroupContainer",
"retValue",
";",
"if",
"(",
"online",
"... | Returns the cached group container under the given key and for the given project.<p>
@param key the cache key
@param online if cached in online or offline project
@return the cached group container or <code>null</code> if not found | [
"Returns",
"the",
"cached",
"group",
"container",
"under",
"the",
"given",
"key",
"and",
"for",
"the",
"given",
"project",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/containerpage/CmsADECache.java#L185-L227 |
codelibs/fess | src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java | FessMessages.addSuccessUpdateDesignJspFile | public FessMessages addSuccessUpdateDesignJspFile(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(SUCCESS_update_design_jsp_file, arg0));
return this;
} | java | public FessMessages addSuccessUpdateDesignJspFile(String property, String arg0) {
assertPropertyNotNull(property);
add(property, new UserMessage(SUCCESS_update_design_jsp_file, arg0));
return this;
} | [
"public",
"FessMessages",
"addSuccessUpdateDesignJspFile",
"(",
"String",
"property",
",",
"String",
"arg0",
")",
"{",
"assertPropertyNotNull",
"(",
"property",
")",
";",
"add",
"(",
"property",
",",
"new",
"UserMessage",
"(",
"SUCCESS_update_design_jsp_file",
",",
... | Add the created action message for the key 'success.update_design_jsp_file' with parameters.
<pre>
message: Updated {0}.
</pre>
@param property The property name for the message. (NotNull)
@param arg0 The parameter arg0 for message. (NotNull)
@return this. (NotNull) | [
"Add",
"the",
"created",
"action",
"message",
"for",
"the",
"key",
"success",
".",
"update_design_jsp_file",
"with",
"parameters",
".",
"<pre",
">",
"message",
":",
"Updated",
"{",
"0",
"}",
".",
"<",
"/",
"pre",
">"
] | train | https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L2346-L2350 |
JCTools/JCTools | jctools-experimental/src/main/java/org/jctools/sets/SingleWriterHashSet.java | SingleWriterHashSet.compactAndRemove | private void compactAndRemove(final E[] buffer, final long mask, int removeHashIndex) {
// remove(9a): [9a,9b,10a,9c,10b,11a,null] -> [9b,10a,9c,10b,11a,null,null]
removeHashIndex = (int) (removeHashIndex & mask);
int j = removeHashIndex;
// every compaction is guarded by two mod count increments: one before and one after actual compaction
UNSAFE.putOrderedLong(this, MC_OFFSET, modCount + 1);
while (true) {
int k;
E slotJ;
// skip elements which belong where they are
do {
// j := (j+1) modulo num_slots
j = (int) ((j + 1) & mask);
slotJ = lpElement(buffer, calcElementOffset(j, mask));
// if slot[j] is unoccupied exit
if (slotJ == null) {
// delete last duplicate slot
soElement(buffer, calcElementOffset(removeHashIndex, mask), null);
UNSAFE.putOrderedLong(this, MC_OFFSET, modCount + 1);
return;
}
// k := hash(slot[j].key) modulo num_slots
k = (int) (rehash(slotJ.hashCode()) & mask);
// determine if k lies cyclically in [i,j]
// | i.k.j |
// |....j i.k.| or |.k..j i...|
}
while ( (removeHashIndex <= j) ?
((removeHashIndex < k) && (k <= j)) :
((removeHashIndex < k) || (k <= j)) );
// slot[removeHashIndex] := slot[j]
soElement(buffer, calcElementOffset(removeHashIndex, mask), slotJ);
// removeHashIndex := j
removeHashIndex = j;
}
} | java | private void compactAndRemove(final E[] buffer, final long mask, int removeHashIndex) {
// remove(9a): [9a,9b,10a,9c,10b,11a,null] -> [9b,10a,9c,10b,11a,null,null]
removeHashIndex = (int) (removeHashIndex & mask);
int j = removeHashIndex;
// every compaction is guarded by two mod count increments: one before and one after actual compaction
UNSAFE.putOrderedLong(this, MC_OFFSET, modCount + 1);
while (true) {
int k;
E slotJ;
// skip elements which belong where they are
do {
// j := (j+1) modulo num_slots
j = (int) ((j + 1) & mask);
slotJ = lpElement(buffer, calcElementOffset(j, mask));
// if slot[j] is unoccupied exit
if (slotJ == null) {
// delete last duplicate slot
soElement(buffer, calcElementOffset(removeHashIndex, mask), null);
UNSAFE.putOrderedLong(this, MC_OFFSET, modCount + 1);
return;
}
// k := hash(slot[j].key) modulo num_slots
k = (int) (rehash(slotJ.hashCode()) & mask);
// determine if k lies cyclically in [i,j]
// | i.k.j |
// |....j i.k.| or |.k..j i...|
}
while ( (removeHashIndex <= j) ?
((removeHashIndex < k) && (k <= j)) :
((removeHashIndex < k) || (k <= j)) );
// slot[removeHashIndex] := slot[j]
soElement(buffer, calcElementOffset(removeHashIndex, mask), slotJ);
// removeHashIndex := j
removeHashIndex = j;
}
} | [
"private",
"void",
"compactAndRemove",
"(",
"final",
"E",
"[",
"]",
"buffer",
",",
"final",
"long",
"mask",
",",
"int",
"removeHashIndex",
")",
"{",
"// remove(9a): [9a,9b,10a,9c,10b,11a,null] -> [9b,10a,9c,10b,11a,null,null]",
"removeHashIndex",
"=",
"(",
"int",
")",
... | /*
implemented as per wiki suggested algo with minor adjustments. | [
"/",
"*",
"implemented",
"as",
"per",
"wiki",
"suggested",
"algo",
"with",
"minor",
"adjustments",
"."
] | train | https://github.com/JCTools/JCTools/blob/9250fe316ec84209cbba0a41682f341256df781e/jctools-experimental/src/main/java/org/jctools/sets/SingleWriterHashSet.java#L158-L194 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/UniverseApi.java | UniverseApi.getUniverseMoonsMoonId | public MoonResponse getUniverseMoonsMoonId(Integer moonId, String datasource, String ifNoneMatch)
throws ApiException {
ApiResponse<MoonResponse> resp = getUniverseMoonsMoonIdWithHttpInfo(moonId, datasource, ifNoneMatch);
return resp.getData();
} | java | public MoonResponse getUniverseMoonsMoonId(Integer moonId, String datasource, String ifNoneMatch)
throws ApiException {
ApiResponse<MoonResponse> resp = getUniverseMoonsMoonIdWithHttpInfo(moonId, datasource, ifNoneMatch);
return resp.getData();
} | [
"public",
"MoonResponse",
"getUniverseMoonsMoonId",
"(",
"Integer",
"moonId",
",",
"String",
"datasource",
",",
"String",
"ifNoneMatch",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"MoonResponse",
">",
"resp",
"=",
"getUniverseMoonsMoonIdWithHttpInfo",
"(",
... | Get moon information Get information on a moon --- This route expires
daily at 11:05
@param moonId
moon_id integer (required)
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param ifNoneMatch
ETag from a previous request. A 304 will be returned if this
matches the current ETag (optional)
@return MoonResponse
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Get",
"moon",
"information",
"Get",
"information",
"on",
"a",
"moon",
"---",
"This",
"route",
"expires",
"daily",
"at",
"11",
":",
"05"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/UniverseApi.java#L2020-L2024 |
moparisthebest/beehive | beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java | PageFlowUtils.getNestingPageFlow | public static PageFlowController getNestingPageFlow( HttpServletRequest request, ServletContext servletContext )
{
PageFlowStack jpfStack = PageFlowStack.get( request, servletContext, false );
if ( jpfStack != null && ! jpfStack.isEmpty() )
{
PageFlowController top = jpfStack.peek().getPageFlow();
return top;
}
return null;
} | java | public static PageFlowController getNestingPageFlow( HttpServletRequest request, ServletContext servletContext )
{
PageFlowStack jpfStack = PageFlowStack.get( request, servletContext, false );
if ( jpfStack != null && ! jpfStack.isEmpty() )
{
PageFlowController top = jpfStack.peek().getPageFlow();
return top;
}
return null;
} | [
"public",
"static",
"PageFlowController",
"getNestingPageFlow",
"(",
"HttpServletRequest",
"request",
",",
"ServletContext",
"servletContext",
")",
"{",
"PageFlowStack",
"jpfStack",
"=",
"PageFlowStack",
".",
"get",
"(",
"request",
",",
"servletContext",
",",
"false",
... | Get the {@link PageFlowController} that is nesting the current one.
@param request the current HttpServletRequest.
@param servletContext the current ServletContext.
@return the nesting {@link PageFlowController}, or <code>null</code> if the current one
is not being nested. | [
"Get",
"the",
"{",
"@link",
"PageFlowController",
"}",
"that",
"is",
"nesting",
"the",
"current",
"one",
"."
] | train | https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/PageFlowUtils.java#L231-L242 |
roboconf/roboconf-platform | core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2IaasHandler.java | Ec2IaasHandler.prepareEC2RequestNode | private RunInstancesRequest prepareEC2RequestNode( Map<String,String> targetProperties, String userData )
throws UnsupportedEncodingException {
RunInstancesRequest runInstancesRequest = new RunInstancesRequest();
String flavor = targetProperties.get(Ec2Constants.VM_INSTANCE_TYPE);
if( Utils.isEmptyOrWhitespaces( flavor ))
flavor = "t1.micro";
runInstancesRequest.setInstanceType( flavor );
runInstancesRequest.setImageId( targetProperties.get( Ec2Constants.AMI_VM_NODE ));
runInstancesRequest.setMinCount( 1 );
runInstancesRequest.setMaxCount( 1 );
runInstancesRequest.setKeyName( targetProperties.get(Ec2Constants.SSH_KEY_NAME));
String secGroup = targetProperties.get(Ec2Constants.SECURITY_GROUP_NAME);
if( Utils.isEmptyOrWhitespaces(secGroup))
secGroup = "default";
runInstancesRequest.setSecurityGroups(Collections.singletonList(secGroup));
String availabilityZone = targetProperties.get(Ec2Constants.AVAILABILITY_ZONE);
if(! Utils.isEmptyOrWhitespaces(availabilityZone))
runInstancesRequest.setPlacement(new Placement(availabilityZone));
// The following part enables to transmit data to the VM.
// When the VM is up, it will be able to read this data.
String encodedUserData = new String( Base64.encodeBase64( userData.getBytes( StandardCharsets.UTF_8 )), "UTF-8" );
runInstancesRequest.setUserData( encodedUserData );
return runInstancesRequest;
} | java | private RunInstancesRequest prepareEC2RequestNode( Map<String,String> targetProperties, String userData )
throws UnsupportedEncodingException {
RunInstancesRequest runInstancesRequest = new RunInstancesRequest();
String flavor = targetProperties.get(Ec2Constants.VM_INSTANCE_TYPE);
if( Utils.isEmptyOrWhitespaces( flavor ))
flavor = "t1.micro";
runInstancesRequest.setInstanceType( flavor );
runInstancesRequest.setImageId( targetProperties.get( Ec2Constants.AMI_VM_NODE ));
runInstancesRequest.setMinCount( 1 );
runInstancesRequest.setMaxCount( 1 );
runInstancesRequest.setKeyName( targetProperties.get(Ec2Constants.SSH_KEY_NAME));
String secGroup = targetProperties.get(Ec2Constants.SECURITY_GROUP_NAME);
if( Utils.isEmptyOrWhitespaces(secGroup))
secGroup = "default";
runInstancesRequest.setSecurityGroups(Collections.singletonList(secGroup));
String availabilityZone = targetProperties.get(Ec2Constants.AVAILABILITY_ZONE);
if(! Utils.isEmptyOrWhitespaces(availabilityZone))
runInstancesRequest.setPlacement(new Placement(availabilityZone));
// The following part enables to transmit data to the VM.
// When the VM is up, it will be able to read this data.
String encodedUserData = new String( Base64.encodeBase64( userData.getBytes( StandardCharsets.UTF_8 )), "UTF-8" );
runInstancesRequest.setUserData( encodedUserData );
return runInstancesRequest;
} | [
"private",
"RunInstancesRequest",
"prepareEC2RequestNode",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"targetProperties",
",",
"String",
"userData",
")",
"throws",
"UnsupportedEncodingException",
"{",
"RunInstancesRequest",
"runInstancesRequest",
"=",
"new",
"RunInsta... | Prepares the request.
@param targetProperties the target properties
@param userData the user data to pass
@return a request
@throws UnsupportedEncodingException | [
"Prepares",
"the",
"request",
"."
] | train | https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-target-iaas-ec2/src/main/java/net/roboconf/target/ec2/internal/Ec2IaasHandler.java#L291-L322 |
JOML-CI/JOML | src/org/joml/Matrix4d.java | Matrix4d.setOrthoSymmetricLH | public Matrix4d setOrthoSymmetricLH(double width, double height, double zNear, double zFar) {
return setOrthoSymmetricLH(width, height, zNear, zFar, false);
} | java | public Matrix4d setOrthoSymmetricLH(double width, double height, double zNear, double zFar) {
return setOrthoSymmetricLH(width, height, zNear, zFar, false);
} | [
"public",
"Matrix4d",
"setOrthoSymmetricLH",
"(",
"double",
"width",
",",
"double",
"height",
",",
"double",
"zNear",
",",
"double",
"zFar",
")",
"{",
"return",
"setOrthoSymmetricLH",
"(",
"width",
",",
"height",
",",
"zNear",
",",
"zFar",
",",
"false",
")",... | Set this matrix to be a symmetric orthographic projection transformation for a left-handed coordinate system
using OpenGL's NDC z range of <code>[-1..+1]</code>.
<p>
This method is equivalent to calling {@link #setOrthoLH(double, double, double, double, double, double) setOrthoLH()} with
<code>left=-width/2</code>, <code>right=+width/2</code>, <code>bottom=-height/2</code> and <code>top=+height/2</code>.
<p>
In order to apply the symmetric orthographic projection to an already existing transformation,
use {@link #orthoSymmetricLH(double, double, double, double) orthoSymmetricLH()}.
<p>
Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a>
@see #orthoSymmetricLH(double, double, double, double)
@param width
the distance between the right and left frustum edges
@param height
the distance between the top and bottom frustum edges
@param zNear
near clipping plane distance
@param zFar
far clipping plane distance
@return this | [
"Set",
"this",
"matrix",
"to",
"be",
"a",
"symmetric",
"orthographic",
"projection",
"transformation",
"for",
"a",
"left",
"-",
"handed",
"coordinate",
"system",
"using",
"OpenGL",
"s",
"NDC",
"z",
"range",
"of",
"<code",
">",
"[",
"-",
"1",
"..",
"+",
"... | train | https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L10525-L10527 |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.deleteStaticExportPublishedResource | public void deleteStaticExportPublishedResource(String resourceName, int linkType, String linkParameter)
throws CmsException {
m_securityManager.deleteStaticExportPublishedResource(m_context, resourceName, linkType, linkParameter);
} | java | public void deleteStaticExportPublishedResource(String resourceName, int linkType, String linkParameter)
throws CmsException {
m_securityManager.deleteStaticExportPublishedResource(m_context, resourceName, linkType, linkParameter);
} | [
"public",
"void",
"deleteStaticExportPublishedResource",
"(",
"String",
"resourceName",
",",
"int",
"linkType",
",",
"String",
"linkParameter",
")",
"throws",
"CmsException",
"{",
"m_securityManager",
".",
"deleteStaticExportPublishedResource",
"(",
"m_context",
",",
"res... | Deletes a published resource entry.<p>
@param resourceName The name of the resource to be deleted in the static export
@param linkType the type of resource deleted (0= non-parameter, 1=parameter)
@param linkParameter the parameters of the resource
@throws CmsException if something goes wrong | [
"Deletes",
"a",
"published",
"resource",
"entry",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1084-L1088 |
Impetus/Kundera | src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java | ESFilterBuilder.getOrFilterBuilder | private OrQueryBuilder getOrFilterBuilder(Expression logicalExp, EntityMetadata m)
{
OrExpression orExp = (OrExpression) logicalExp;
Expression leftExpression = orExp.getLeftExpression();
Expression rightExpression = orExp.getRightExpression();
return new OrQueryBuilder(populateFilterBuilder(leftExpression, m), populateFilterBuilder(rightExpression, m));
} | java | private OrQueryBuilder getOrFilterBuilder(Expression logicalExp, EntityMetadata m)
{
OrExpression orExp = (OrExpression) logicalExp;
Expression leftExpression = orExp.getLeftExpression();
Expression rightExpression = orExp.getRightExpression();
return new OrQueryBuilder(populateFilterBuilder(leftExpression, m), populateFilterBuilder(rightExpression, m));
} | [
"private",
"OrQueryBuilder",
"getOrFilterBuilder",
"(",
"Expression",
"logicalExp",
",",
"EntityMetadata",
"m",
")",
"{",
"OrExpression",
"orExp",
"=",
"(",
"OrExpression",
")",
"logicalExp",
";",
"Expression",
"leftExpression",
"=",
"orExp",
".",
"getLeftExpression",... | Gets the or filter builder.
@param logicalExp
the logical exp
@param m
the m
@param entity
the entity
@return the or filter builder | [
"Gets",
"the",
"or",
"filter",
"builder",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-elastic-search/src/main/java/com/impetus/client/es/ESFilterBuilder.java#L378-L385 |
mapsforge/mapsforge | mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java | MercatorProjection.pixelYToTileYWithScaleFactor | public static int pixelYToTileYWithScaleFactor(double pixelY, double scaleFactor, int tileSize) {
return (int) Math.min(Math.max(pixelY / tileSize, 0), scaleFactor - 1);
} | java | public static int pixelYToTileYWithScaleFactor(double pixelY, double scaleFactor, int tileSize) {
return (int) Math.min(Math.max(pixelY / tileSize, 0), scaleFactor - 1);
} | [
"public",
"static",
"int",
"pixelYToTileYWithScaleFactor",
"(",
"double",
"pixelY",
",",
"double",
"scaleFactor",
",",
"int",
"tileSize",
")",
"{",
"return",
"(",
"int",
")",
"Math",
".",
"min",
"(",
"Math",
".",
"max",
"(",
"pixelY",
"/",
"tileSize",
",",... | Converts a pixel Y coordinate to the tile Y number.
@param pixelY the pixel Y coordinate that should be converted.
@param scaleFactor the scale factor at which the coordinate should be converted.
@return the tile Y number. | [
"Converts",
"a",
"pixel",
"Y",
"coordinate",
"to",
"the",
"tile",
"Y",
"number",
"."
] | train | https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/util/MercatorProjection.java#L422-L424 |
Impetus/Kundera | src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java | MongoDBQuery.createMongoQuery | public BasicDBObject createMongoQuery(EntityMetadata m, Queue filterClauseQueue)
{
QueryComponent sq = getQueryComponent(filterClauseQueue);
populateQueryComponents(m, sq);
return sq.actualQuery == null ? new BasicDBObject() : sq.actualQuery;
} | java | public BasicDBObject createMongoQuery(EntityMetadata m, Queue filterClauseQueue)
{
QueryComponent sq = getQueryComponent(filterClauseQueue);
populateQueryComponents(m, sq);
return sq.actualQuery == null ? new BasicDBObject() : sq.actualQuery;
} | [
"public",
"BasicDBObject",
"createMongoQuery",
"(",
"EntityMetadata",
"m",
",",
"Queue",
"filterClauseQueue",
")",
"{",
"QueryComponent",
"sq",
"=",
"getQueryComponent",
"(",
"filterClauseQueue",
")",
";",
"populateQueryComponents",
"(",
"m",
",",
"sq",
")",
";",
... | Creates the mongo query.
@param m
the m
@param filterClauseQueue
the filter clause queue
@return the basic db object | [
"Creates",
"the",
"mongo",
"query",
"."
] | train | https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/kundera-mongo/src/main/java/com/impetus/client/mongodb/query/MongoDBQuery.java#L442-L447 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java | Character.toChars | public static int toChars(int codePoint, char[] dst, int dstIndex) {
if (isBmpCodePoint(codePoint)) {
dst[dstIndex] = (char) codePoint;
return 1;
} else if (isValidCodePoint(codePoint)) {
toSurrogates(codePoint, dst, dstIndex);
return 2;
} else {
throw new IllegalArgumentException();
}
} | java | public static int toChars(int codePoint, char[] dst, int dstIndex) {
if (isBmpCodePoint(codePoint)) {
dst[dstIndex] = (char) codePoint;
return 1;
} else if (isValidCodePoint(codePoint)) {
toSurrogates(codePoint, dst, dstIndex);
return 2;
} else {
throw new IllegalArgumentException();
}
} | [
"public",
"static",
"int",
"toChars",
"(",
"int",
"codePoint",
",",
"char",
"[",
"]",
"dst",
",",
"int",
"dstIndex",
")",
"{",
"if",
"(",
"isBmpCodePoint",
"(",
"codePoint",
")",
")",
"{",
"dst",
"[",
"dstIndex",
"]",
"=",
"(",
"char",
")",
"codePoin... | Converts the specified character (Unicode code point) to its
UTF-16 representation. If the specified code point is a BMP
(Basic Multilingual Plane or Plane 0) value, the same value is
stored in {@code dst[dstIndex]}, and 1 is returned. If the
specified code point is a supplementary character, its
surrogate values are stored in {@code dst[dstIndex]}
(high-surrogate) and {@code dst[dstIndex+1]}
(low-surrogate), and 2 is returned.
@param codePoint the character (Unicode code point) to be converted.
@param dst an array of {@code char} in which the
{@code codePoint}'s UTF-16 value is stored.
@param dstIndex the start index into the {@code dst}
array where the converted value is stored.
@return 1 if the code point is a BMP code point, 2 if the
code point is a supplementary code point.
@exception IllegalArgumentException if the specified
{@code codePoint} is not a valid Unicode code point.
@exception NullPointerException if the specified {@code dst} is null.
@exception IndexOutOfBoundsException if {@code dstIndex}
is negative or not less than {@code dst.length}, or if
{@code dst} at {@code dstIndex} doesn't have enough
array element(s) to store the resulting {@code char}
value(s). (If {@code dstIndex} is equal to
{@code dst.length-1} and the specified
{@code codePoint} is a supplementary character, the
high-surrogate value is not stored in
{@code dst[dstIndex]}.)
@since 1.5 | [
"Converts",
"the",
"specified",
"character",
"(",
"Unicode",
"code",
"point",
")",
"to",
"its",
"UTF",
"-",
"16",
"representation",
".",
"If",
"the",
"specified",
"code",
"point",
"is",
"a",
"BMP",
"(",
"Basic",
"Multilingual",
"Plane",
"or",
"Plane",
"0",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L5197-L5207 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java | LSSerializerImpl.canSetParameter | public boolean canSetParameter(String name, Object value) {
if (value instanceof Boolean){
if ( name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS)
|| name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS)
|| name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES)
|| name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)
|| name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)
|| name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES)
|| name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS)
|| name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA)
|| name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED)
|| name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT)
|| name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)
|| name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)){
// both values supported
return true;
}
else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM)
|| name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION)
|| name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION)
|| name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)
|| name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE)
// || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS)
) {
// true is not supported
return !((Boolean)value).booleanValue();
}
else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) {
// false is not supported
return ((Boolean)value).booleanValue();
}
}
else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER) &&
value == null || value instanceof DOMErrorHandler){
return true;
}
return false;
} | java | public boolean canSetParameter(String name, Object value) {
if (value instanceof Boolean){
if ( name.equalsIgnoreCase(DOMConstants.DOM_CDATA_SECTIONS)
|| name.equalsIgnoreCase(DOMConstants.DOM_COMMENTS)
|| name.equalsIgnoreCase(DOMConstants.DOM_ENTITIES)
|| name.equalsIgnoreCase(DOMConstants.DOM_INFOSET)
|| name.equalsIgnoreCase(DOMConstants.DOM_ELEMENT_CONTENT_WHITESPACE)
|| name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACES)
|| name.equalsIgnoreCase(DOMConstants.DOM_NAMESPACE_DECLARATIONS)
|| name.equalsIgnoreCase(DOMConstants.DOM_SPLIT_CDATA)
|| name.equalsIgnoreCase(DOMConstants.DOM_WELLFORMED)
|| name.equalsIgnoreCase(DOMConstants.DOM_DISCARD_DEFAULT_CONTENT)
|| name.equalsIgnoreCase(DOMConstants.DOM_FORMAT_PRETTY_PRINT)
|| name.equalsIgnoreCase(DOMConstants.DOM_XMLDECL)){
// both values supported
return true;
}
else if (name.equalsIgnoreCase(DOMConstants.DOM_CANONICAL_FORM)
|| name.equalsIgnoreCase(DOMConstants.DOM_CHECK_CHAR_NORMALIZATION)
|| name.equalsIgnoreCase(DOMConstants.DOM_DATATYPE_NORMALIZATION)
|| name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE_IF_SCHEMA)
|| name.equalsIgnoreCase(DOMConstants.DOM_VALIDATE)
// || name.equalsIgnoreCase(DOMConstants.DOM_NORMALIZE_CHARACTERS)
) {
// true is not supported
return !((Boolean)value).booleanValue();
}
else if (name.equalsIgnoreCase(DOMConstants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) {
// false is not supported
return ((Boolean)value).booleanValue();
}
}
else if (name.equalsIgnoreCase(DOMConstants.DOM_ERROR_HANDLER) &&
value == null || value instanceof DOMErrorHandler){
return true;
}
return false;
} | [
"public",
"boolean",
"canSetParameter",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Boolean",
")",
"{",
"if",
"(",
"name",
".",
"equalsIgnoreCase",
"(",
"DOMConstants",
".",
"DOM_CDATA_SECTIONS",
")",
"||",
"na... | Checks if setting a parameter to a specific value is supported.
@see org.w3c.dom.DOMConfiguration#canSetParameter(java.lang.String, java.lang.Object)
@since DOM Level 3
@param name A String containing the DOMConfiguration parameter name.
@param value An Object specifying the value of the corresponding parameter. | [
"Checks",
"if",
"setting",
"a",
"parameter",
"to",
"a",
"specific",
"value",
"is",
"supported",
"."
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/LSSerializerImpl.java#L390-L427 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201811/inventoryservice/CreateAdUnits.java | CreateAdUnits.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the InventoryService.
InventoryServiceInterface inventoryService =
adManagerServices.get(session, InventoryServiceInterface.class);
// Get the NetworkService.
NetworkServiceInterface networkService =
adManagerServices.get(session, NetworkServiceInterface.class);
// Set the parent ad unit's ID for all ad units to be created under.
String parentAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();
// Create a 300x250 web ad unit size.
Size webSize = new Size();
webSize.setWidth(300);
webSize.setHeight(250);
webSize.setIsAspectRatio(false);
AdUnitSize webAdUnitSize = new AdUnitSize();
webAdUnitSize.setSize(webSize);
webAdUnitSize.setEnvironmentType(EnvironmentType.BROWSER);
// Create a 640x360v video ad unit size with a companion.
Size videoSize = new Size();
videoSize.setWidth(640);
videoSize.setHeight(360);
videoSize.setIsAspectRatio(false);
AdUnitSize videoAdUnitSize = new AdUnitSize();
videoAdUnitSize.setSize(videoSize);
videoAdUnitSize.setCompanions(new AdUnitSize[] {webAdUnitSize});
videoAdUnitSize.setEnvironmentType(EnvironmentType.VIDEO_PLAYER);
// Create a web ad unit.
AdUnit webAdUnit = new AdUnit();
webAdUnit.setName("web_ad_unit_" + new Random().nextInt(Integer.MAX_VALUE));
webAdUnit.setDescription(webAdUnit.getName());
webAdUnit.setParentId(parentAdUnitId);
webAdUnit.setTargetWindow(AdUnitTargetWindow.BLANK);
webAdUnit.setAdUnitSizes(new AdUnitSize[] {webAdUnitSize});
// Create a video ad unit.
AdUnit videoAdUnit = new AdUnit();
videoAdUnit.setName("video_ad_unit_" + new Random().nextInt(Integer.MAX_VALUE));
videoAdUnit.setDescription(videoAdUnit.getName());
videoAdUnit.setParentId(parentAdUnitId);
videoAdUnit.setTargetWindow(AdUnitTargetWindow.BLANK);
videoAdUnit.setAdUnitSizes(new AdUnitSize[] {videoAdUnitSize});
// Create the ad units on the server.
AdUnit[] adUnits = inventoryService.createAdUnits(new AdUnit[] {webAdUnit, videoAdUnit});
for (AdUnit adUnit : adUnits) {
System.out.printf(
"An ad unit with ID '%s', name '%s' was created.%n", adUnit.getId(), adUnit.getName());
}
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the InventoryService.
InventoryServiceInterface inventoryService =
adManagerServices.get(session, InventoryServiceInterface.class);
// Get the NetworkService.
NetworkServiceInterface networkService =
adManagerServices.get(session, NetworkServiceInterface.class);
// Set the parent ad unit's ID for all ad units to be created under.
String parentAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId();
// Create a 300x250 web ad unit size.
Size webSize = new Size();
webSize.setWidth(300);
webSize.setHeight(250);
webSize.setIsAspectRatio(false);
AdUnitSize webAdUnitSize = new AdUnitSize();
webAdUnitSize.setSize(webSize);
webAdUnitSize.setEnvironmentType(EnvironmentType.BROWSER);
// Create a 640x360v video ad unit size with a companion.
Size videoSize = new Size();
videoSize.setWidth(640);
videoSize.setHeight(360);
videoSize.setIsAspectRatio(false);
AdUnitSize videoAdUnitSize = new AdUnitSize();
videoAdUnitSize.setSize(videoSize);
videoAdUnitSize.setCompanions(new AdUnitSize[] {webAdUnitSize});
videoAdUnitSize.setEnvironmentType(EnvironmentType.VIDEO_PLAYER);
// Create a web ad unit.
AdUnit webAdUnit = new AdUnit();
webAdUnit.setName("web_ad_unit_" + new Random().nextInt(Integer.MAX_VALUE));
webAdUnit.setDescription(webAdUnit.getName());
webAdUnit.setParentId(parentAdUnitId);
webAdUnit.setTargetWindow(AdUnitTargetWindow.BLANK);
webAdUnit.setAdUnitSizes(new AdUnitSize[] {webAdUnitSize});
// Create a video ad unit.
AdUnit videoAdUnit = new AdUnit();
videoAdUnit.setName("video_ad_unit_" + new Random().nextInt(Integer.MAX_VALUE));
videoAdUnit.setDescription(videoAdUnit.getName());
videoAdUnit.setParentId(parentAdUnitId);
videoAdUnit.setTargetWindow(AdUnitTargetWindow.BLANK);
videoAdUnit.setAdUnitSizes(new AdUnitSize[] {videoAdUnitSize});
// Create the ad units on the server.
AdUnit[] adUnits = inventoryService.createAdUnits(new AdUnit[] {webAdUnit, videoAdUnit});
for (AdUnit adUnit : adUnits) {
System.out.printf(
"An ad unit with ID '%s', name '%s' was created.%n", adUnit.getId(), adUnit.getName());
}
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the InventoryService.",
"InventoryServiceInterface",
"inventoryService",
"=",
"adManagerServices",
".",
... | Runs the example.
@param adManagerServices the services factory.
@param session the session.
@throws ApiException if the API request failed with one or more service errors.
@throws RemoteException if the API request failed due to other errors. | [
"Runs",
"the",
"example",
"."
] | train | https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201811/inventoryservice/CreateAdUnits.java#L55-L112 |
OpenLiberty/open-liberty | dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/spi/DistributedMapFactory.java | DistributedMapFactory.getMap | @Deprecated
public static DistributedMap getMap(String name, Properties properties) {
return DistributedObjectCacheFactory.getMap(name, properties);
} | java | @Deprecated
public static DistributedMap getMap(String name, Properties properties) {
return DistributedObjectCacheFactory.getMap(name, properties);
} | [
"@",
"Deprecated",
"public",
"static",
"DistributedMap",
"getMap",
"(",
"String",
"name",
",",
"Properties",
"properties",
")",
"{",
"return",
"DistributedObjectCacheFactory",
".",
"getMap",
"(",
"name",
",",
"properties",
")",
";",
"}"
] | Returns the DistributedMap instance specified by the given id, using the
the parameters specified in properties. If the given instance has
not yet been created, then a new instance is created using the parameters
specified in the properties object.
<br>Properties:
<table role="presentation">
<tr><td>com.ibm.ws.cache.CacheConfig.CACHE_SIZE</td><td>integer the maximum number of cache entries</td></tr>
<tr><td>com.ibm.ws.cache.CacheConfig.ENABLE_DISK_OFFLOAD</td><td> boolean true to enable disk offload</td></tr>
<tr><td>com.ibm.ws.cache.CacheConfig.DISK_OFFLOAD_LOCATION</td><td>directory to contain offloaded cache entries</td></tr>
</table>
@param name instance name of the DistributedMap
@param properties
@return A DistributedMap instance
@see DistributedObjectCacheFactory
@deprecated Use DistributedObjectCacheFactory
@ibm-private-in-use | [
"Returns",
"the",
"DistributedMap",
"instance",
"specified",
"by",
"the",
"given",
"id",
"using",
"the",
"the",
"parameters",
"specified",
"in",
"properties",
".",
"If",
"the",
"given",
"instance",
"has",
"not",
"yet",
"been",
"created",
"then",
"a",
"new",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/spi/DistributedMapFactory.java#L64-L67 |
DataSketches/sketches-core | src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java | DoublesSketch.getCompactStorageBytes | public static int getCompactStorageBytes(final int k, final long n) {
if (n == 0) { return 8; }
final int metaPreLongs = DoublesSketch.MAX_PRELONGS + 2; //plus min, max
return ((metaPreLongs + Util.computeRetainedItems(k, n)) << 3);
} | java | public static int getCompactStorageBytes(final int k, final long n) {
if (n == 0) { return 8; }
final int metaPreLongs = DoublesSketch.MAX_PRELONGS + 2; //plus min, max
return ((metaPreLongs + Util.computeRetainedItems(k, n)) << 3);
} | [
"public",
"static",
"int",
"getCompactStorageBytes",
"(",
"final",
"int",
"k",
",",
"final",
"long",
"n",
")",
"{",
"if",
"(",
"n",
"==",
"0",
")",
"{",
"return",
"8",
";",
"}",
"final",
"int",
"metaPreLongs",
"=",
"DoublesSketch",
".",
"MAX_PRELONGS",
... | Returns the number of bytes a DoublesSketch would require to store in compact form
given the values of <i>k</i> and <i>n</i>. The compact form is not updatable.
@param k the size configuration parameter for the sketch
@param n the number of items input into the sketch
@return the number of bytes required to store this sketch in compact form. | [
"Returns",
"the",
"number",
"of",
"bytes",
"a",
"DoublesSketch",
"would",
"require",
"to",
"store",
"in",
"compact",
"form",
"given",
"the",
"values",
"of",
"<i",
">",
"k<",
"/",
"i",
">",
"and",
"<i",
">",
"n<",
"/",
"i",
">",
".",
"The",
"compact",... | train | https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/quantiles/DoublesSketch.java#L630-L634 |
elki-project/elki | elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/HSMDependenceMeasure.java | HSMDependenceMeasure.countAboveThreshold | private int countAboveThreshold(int[][] mat, double threshold) {
int ret = 0;
for(int i = 0; i < mat.length; i++) {
int[] row = mat[i];
for(int j = 0; j < row.length; j++) {
if(row[j] >= threshold) {
ret++;
}
}
}
return ret;
} | java | private int countAboveThreshold(int[][] mat, double threshold) {
int ret = 0;
for(int i = 0; i < mat.length; i++) {
int[] row = mat[i];
for(int j = 0; j < row.length; j++) {
if(row[j] >= threshold) {
ret++;
}
}
}
return ret;
} | [
"private",
"int",
"countAboveThreshold",
"(",
"int",
"[",
"]",
"[",
"]",
"mat",
",",
"double",
"threshold",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mat",
".",
"length",
";",
"i",
"++",
")",
"{",
... | Count the number of cells above the threshold.
@param mat Matrix
@param threshold Threshold
@return Number of elements above the threshold. | [
"Count",
"the",
"number",
"of",
"cells",
"above",
"the",
"threshold",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-math/src/main/java/de/lmu/ifi/dbs/elki/math/statistics/dependence/HSMDependenceMeasure.java#L147-L158 |
marvinlabs/android-intents | library/src/main/java/com/marvinlabs/intents/PhoneIntents.java | PhoneIntents.newEmptySmsIntent | public static Intent newEmptySmsIntent(Context context, String phoneNumber) {
return newSmsIntent(context, null, new String[]{phoneNumber});
} | java | public static Intent newEmptySmsIntent(Context context, String phoneNumber) {
return newSmsIntent(context, null, new String[]{phoneNumber});
} | [
"public",
"static",
"Intent",
"newEmptySmsIntent",
"(",
"Context",
"context",
",",
"String",
"phoneNumber",
")",
"{",
"return",
"newSmsIntent",
"(",
"context",
",",
"null",
",",
"new",
"String",
"[",
"]",
"{",
"phoneNumber",
"}",
")",
";",
"}"
] | Creates an intent that will allow to send an SMS without specifying the phone number
@param phoneNumber The phone number to send the SMS to
@return the intent | [
"Creates",
"an",
"intent",
"that",
"will",
"allow",
"to",
"send",
"an",
"SMS",
"without",
"specifying",
"the",
"phone",
"number"
] | train | https://github.com/marvinlabs/android-intents/blob/33e79c825188b6a97601869522533cc825801f6e/library/src/main/java/com/marvinlabs/intents/PhoneIntents.java#L51-L53 |
kotcrab/vis-ui | ui/src/main/java/com/kotcrab/vis/ui/util/ColorUtils.java | ColorUtils.RGBtoHSV | public static int[] RGBtoHSV (Color c) {
return RGBtoHSV(c.r, c.g, c.b);
} | java | public static int[] RGBtoHSV (Color c) {
return RGBtoHSV(c.r, c.g, c.b);
} | [
"public",
"static",
"int",
"[",
"]",
"RGBtoHSV",
"(",
"Color",
"c",
")",
"{",
"return",
"RGBtoHSV",
"(",
"c",
".",
"r",
",",
"c",
".",
"g",
",",
"c",
".",
"b",
")",
";",
"}"
] | Converts {@link Color} to HSV color system
@return 3 element int array with hue (0-360), saturation (0-100) and value (0-100) | [
"Converts",
"{"
] | train | https://github.com/kotcrab/vis-ui/blob/3b68f82d94ae32bffa2a3399c63f432e0f4908e0/ui/src/main/java/com/kotcrab/vis/ui/util/ColorUtils.java#L119-L121 |
GenesysPureEngage/workspace-client-java | src/main/java/com/genesys/internal/workspace/api/MediaApi.java | MediaApi.addAttachment | public ApiSuccessResponse addAttachment(String mediatype, String id, File attachment, String operationId) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = addAttachmentWithHttpInfo(mediatype, id, attachment, operationId);
return resp.getData();
} | java | public ApiSuccessResponse addAttachment(String mediatype, String id, File attachment, String operationId) throws ApiException {
ApiResponse<ApiSuccessResponse> resp = addAttachmentWithHttpInfo(mediatype, id, attachment, operationId);
return resp.getData();
} | [
"public",
"ApiSuccessResponse",
"addAttachment",
"(",
"String",
"mediatype",
",",
"String",
"id",
",",
"File",
"attachment",
",",
"String",
"operationId",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"ApiSuccessResponse",
">",
"resp",
"=",
"addAttachmentW... | Add an attachment to the open-media interaction
Add an attachment to the interaction specified in the id path parameter
@param mediatype media-type of interaction to add attachment (required)
@param id id of interaction (required)
@param attachment The file to upload. (optional)
@param operationId operationId associated to the request (optional)
@return ApiSuccessResponse
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Add",
"an",
"attachment",
"to",
"the",
"open",
"-",
"media",
"interaction",
"Add",
"an",
"attachment",
"to",
"the",
"interaction",
"specified",
"in",
"the",
"id",
"path",
"parameter"
] | train | https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/MediaApi.java#L313-L316 |
deeplearning4j/deeplearning4j | nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/FeatureUtil.java | FeatureUtil.scaleMinMax | public static void scaleMinMax(double min, double max, INDArray toScale) {
//X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min
INDArray min2 = toScale.min(0);
INDArray max2 = toScale.max(0);
INDArray std = toScale.subRowVector(min2).diviRowVector(max2.sub(min2));
INDArray scaled = std.mul(max - min).addi(min);
toScale.assign(scaled);
} | java | public static void scaleMinMax(double min, double max, INDArray toScale) {
//X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min
INDArray min2 = toScale.min(0);
INDArray max2 = toScale.max(0);
INDArray std = toScale.subRowVector(min2).diviRowVector(max2.sub(min2));
INDArray scaled = std.mul(max - min).addi(min);
toScale.assign(scaled);
} | [
"public",
"static",
"void",
"scaleMinMax",
"(",
"double",
"min",
",",
"double",
"max",
",",
"INDArray",
"toScale",
")",
"{",
"//X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0)) X_scaled = X_std * (max - min) + min",
"INDArray",
"min2",
"=",
"toScale",
".",
"min... | Scales the ndarray columns
to the given min/max values
@param min the minimum number
@param max the max number | [
"Scales",
"the",
"ndarray",
"columns",
"to",
"the",
"given",
"min",
"/",
"max",
"values"
] | train | https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/util/FeatureUtil.java#L91-L101 |
OrienteerBAP/wicket-orientdb | wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/converter/AbstractJointConverter.java | AbstractJointConverter.of | public static <F> AbstractJointConverter<F> of(final SerializableFunction<? super F, String> to,
final SerializableFunction<String, ? extends F> from) {
return new AbstractJointConverter<F>() {
@Override
public String convertToString(F value, Locale locale) {
return to.apply(value);
}
@Override
public F convertToObject(String value, Locale locale) throws ConversionException {
return from.apply(value);
}
};
} | java | public static <F> AbstractJointConverter<F> of(final SerializableFunction<? super F, String> to,
final SerializableFunction<String, ? extends F> from) {
return new AbstractJointConverter<F>() {
@Override
public String convertToString(F value, Locale locale) {
return to.apply(value);
}
@Override
public F convertToObject(String value, Locale locale) throws ConversionException {
return from.apply(value);
}
};
} | [
"public",
"static",
"<",
"F",
">",
"AbstractJointConverter",
"<",
"F",
">",
"of",
"(",
"final",
"SerializableFunction",
"<",
"?",
"super",
"F",
",",
"String",
">",
"to",
",",
"final",
"SerializableFunction",
"<",
"String",
",",
"?",
"extends",
"F",
">",
... | Utility method to construct converter from 2 functions
@param <F> type to convert from
@param to function to convert to String
@param from function to convert from String
@return converter | [
"Utility",
"method",
"to",
"construct",
"converter",
"from",
"2",
"functions"
] | train | https://github.com/OrienteerBAP/wicket-orientdb/blob/eb1d94f00a6bff9e266c5c032baa6043afc1db92/wicket-orientdb/src/main/java/ru/ydn/wicket/wicketorientdb/converter/AbstractJointConverter.java#L47-L60 |
aoindustries/aocode-public | src/main/java/com/aoindustries/net/UrlUtils.java | UrlUtils.decodeUrlPath | public static String decodeUrlPath(String href, String encoding) throws UnsupportedEncodingException {
if(href.startsWith("tel:")) return href;
int len = href.length();
int pos = 0;
StringBuilder SB = new StringBuilder(href.length()*2); // Leave a little room for encoding
while(pos<len) {
int nextPos = StringUtility.indexOf(href, noEncodeCharacters, pos);
if(nextPos==-1) {
SB.append(URLDecoder.decode(href.substring(pos, len), encoding));
pos = len;
} else {
SB.append(URLDecoder.decode(href.substring(pos, nextPos), encoding));
char nextChar = href.charAt(nextPos);
if(nextChar=='?') {
// End decoding
SB.append(href, nextPos, len);
pos = len;
} else {
SB.append(nextChar);
pos = nextPos+1;
}
}
}
return SB.toString();
} | java | public static String decodeUrlPath(String href, String encoding) throws UnsupportedEncodingException {
if(href.startsWith("tel:")) return href;
int len = href.length();
int pos = 0;
StringBuilder SB = new StringBuilder(href.length()*2); // Leave a little room for encoding
while(pos<len) {
int nextPos = StringUtility.indexOf(href, noEncodeCharacters, pos);
if(nextPos==-1) {
SB.append(URLDecoder.decode(href.substring(pos, len), encoding));
pos = len;
} else {
SB.append(URLDecoder.decode(href.substring(pos, nextPos), encoding));
char nextChar = href.charAt(nextPos);
if(nextChar=='?') {
// End decoding
SB.append(href, nextPos, len);
pos = len;
} else {
SB.append(nextChar);
pos = nextPos+1;
}
}
}
return SB.toString();
} | [
"public",
"static",
"String",
"decodeUrlPath",
"(",
"String",
"href",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"if",
"(",
"href",
".",
"startsWith",
"(",
"\"tel:\"",
")",
")",
"return",
"href",
";",
"int",
"len",
"=",
"h... | Decodes the URL up to the first ?, if present. Does not decode
any characters in the set { '?', ':', '/', ';', '#', '+' }.
Does not decode tel: urls (case-sensitive).
@see #encodeUrlPath(java.lang.String) | [
"Decodes",
"the",
"URL",
"up",
"to",
"the",
"first",
"?",
"if",
"present",
".",
"Does",
"not",
"decode",
"any",
"characters",
"in",
"the",
"set",
"{",
"?",
":",
"/",
";",
"#",
"+",
"}",
"."
] | train | https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/net/UrlUtils.java#L105-L129 |
ops4j/org.ops4j.pax.swissbox | pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java | BndUtils.parseInstructions | public static Properties parseInstructions( final String query )
throws MalformedURLException
{
final Properties instructions = new Properties();
if( query != null )
{
try
{
// just ignore for the moment and try out if we have valid properties separated by "&"
final String segments[] = query.split( "&" );
for( String segment : segments )
{
// do not parse empty strings
if( segment.trim().length() > 0 )
{
final Matcher matcher = INSTRUCTIONS_PATTERN.matcher( segment );
if( matcher.matches() )
{
String key = matcher.group( 1 );
String val = matcher.group( 2 );
instructions.setProperty(
verifyKey(key),
val != null ? URLDecoder.decode( val, "UTF-8" ) : ""
);
}
else
{
throw new MalformedURLException( "Invalid syntax for instruction [" + segment
+ "]. Take a look at http://www.aqute.biz/Code/Bnd."
);
}
}
}
}
catch( UnsupportedEncodingException e )
{
// thrown by URLDecoder but it should never happen
throwAsMalformedURLException( "Could not retrieve the instructions from [" + query + "]", e );
}
}
return instructions;
} | java | public static Properties parseInstructions( final String query )
throws MalformedURLException
{
final Properties instructions = new Properties();
if( query != null )
{
try
{
// just ignore for the moment and try out if we have valid properties separated by "&"
final String segments[] = query.split( "&" );
for( String segment : segments )
{
// do not parse empty strings
if( segment.trim().length() > 0 )
{
final Matcher matcher = INSTRUCTIONS_PATTERN.matcher( segment );
if( matcher.matches() )
{
String key = matcher.group( 1 );
String val = matcher.group( 2 );
instructions.setProperty(
verifyKey(key),
val != null ? URLDecoder.decode( val, "UTF-8" ) : ""
);
}
else
{
throw new MalformedURLException( "Invalid syntax for instruction [" + segment
+ "]. Take a look at http://www.aqute.biz/Code/Bnd."
);
}
}
}
}
catch( UnsupportedEncodingException e )
{
// thrown by URLDecoder but it should never happen
throwAsMalformedURLException( "Could not retrieve the instructions from [" + query + "]", e );
}
}
return instructions;
} | [
"public",
"static",
"Properties",
"parseInstructions",
"(",
"final",
"String",
"query",
")",
"throws",
"MalformedURLException",
"{",
"final",
"Properties",
"instructions",
"=",
"new",
"Properties",
"(",
")",
";",
"if",
"(",
"query",
"!=",
"null",
")",
"{",
"tr... | Parses bnd instructions out of an url query string.
@param query query part of an url.
@return parsed instructions as properties
@throws java.net.MalformedURLException if provided path does not comply to syntax. | [
"Parses",
"bnd",
"instructions",
"out",
"of",
"an",
"url",
"query",
"string",
"."
] | train | https://github.com/ops4j/org.ops4j.pax.swissbox/blob/00b0ee16cdbe8017984a4d7ba808b10d985c5b5c/pax-swissbox-bnd/src/main/java/org/ops4j/pax/swissbox/bnd/BndUtils.java#L275-L316 |
googleapis/google-cloud-java | google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java | CloudStorageFileSystemProvider.newFileChannel | @Override
public FileChannel newFileChannel(
Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
checkNotNull(path);
initStorage();
CloudStorageUtil.checkNotNullArray(attrs);
if (options.contains(StandardOpenOption.CREATE_NEW)) {
Files.createFile(path, attrs);
} else if (options.contains(StandardOpenOption.CREATE) && !Files.exists(path)) {
Files.createFile(path, attrs);
}
if (options.contains(StandardOpenOption.WRITE)
|| options.contains(StandardOpenOption.CREATE)
|| options.contains(StandardOpenOption.CREATE_NEW)
|| options.contains(StandardOpenOption.TRUNCATE_EXISTING)) {
return new CloudStorageWriteFileChannel(newWriteChannel(path, options));
} else {
return new CloudStorageReadFileChannel(newReadChannel(path, options));
}
} | java | @Override
public FileChannel newFileChannel(
Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IOException {
checkNotNull(path);
initStorage();
CloudStorageUtil.checkNotNullArray(attrs);
if (options.contains(StandardOpenOption.CREATE_NEW)) {
Files.createFile(path, attrs);
} else if (options.contains(StandardOpenOption.CREATE) && !Files.exists(path)) {
Files.createFile(path, attrs);
}
if (options.contains(StandardOpenOption.WRITE)
|| options.contains(StandardOpenOption.CREATE)
|| options.contains(StandardOpenOption.CREATE_NEW)
|| options.contains(StandardOpenOption.TRUNCATE_EXISTING)) {
return new CloudStorageWriteFileChannel(newWriteChannel(path, options));
} else {
return new CloudStorageReadFileChannel(newReadChannel(path, options));
}
} | [
"@",
"Override",
"public",
"FileChannel",
"newFileChannel",
"(",
"Path",
"path",
",",
"Set",
"<",
"?",
"extends",
"OpenOption",
">",
"options",
",",
"FileAttribute",
"<",
"?",
">",
"...",
"attrs",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"path... | Open a file for reading OR writing. The {@link FileChannel} that is returned will only allow
reads or writes depending on the {@link OpenOption}s that are specified. If any of the
following have been specified, the {@link FileChannel} will be write-only: {@link
StandardOpenOption#CREATE}
<ul>
<li>{@link StandardOpenOption#CREATE}
<li>{@link StandardOpenOption#CREATE_NEW}
<li>{@link StandardOpenOption#WRITE}
<li>{@link StandardOpenOption#TRUNCATE_EXISTING}
</ul>
In all other cases the {@link FileChannel} will be read-only.
@param path The path to the file to open or create
@param options The options specifying how the file should be opened, and whether the {@link
FileChannel} should be read-only or write-only.
@param attrs (not supported, the values will be ignored)
@throws IOException | [
"Open",
"a",
"file",
"for",
"reading",
"OR",
"writing",
".",
"The",
"{",
"@link",
"FileChannel",
"}",
"that",
"is",
"returned",
"will",
"only",
"allow",
"reads",
"or",
"writes",
"depending",
"on",
"the",
"{",
"@link",
"OpenOption",
"}",
"s",
"that",
"are... | train | https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java#L330-L349 |
dropwizard/dropwizard | dropwizard-jersey/src/main/java/io/dropwizard/jersey/filter/RequestIdFilter.java | RequestIdFilter.generateRandomUuid | private static UUID generateRandomUuid() {
final Random rnd = ThreadLocalRandom.current();
long mostSig = rnd.nextLong();
long leastSig = rnd.nextLong();
// Identify this as a version 4 UUID, that is one based on a random value.
mostSig &= 0xffffffffffff0fffL;
mostSig |= 0x0000000000004000L;
// Set the variant identifier as specified for version 4 UUID values. The two
// high order bits of the lower word are required to be one and zero, respectively.
leastSig &= 0x3fffffffffffffffL;
leastSig |= 0x8000000000000000L;
return new UUID(mostSig, leastSig);
} | java | private static UUID generateRandomUuid() {
final Random rnd = ThreadLocalRandom.current();
long mostSig = rnd.nextLong();
long leastSig = rnd.nextLong();
// Identify this as a version 4 UUID, that is one based on a random value.
mostSig &= 0xffffffffffff0fffL;
mostSig |= 0x0000000000004000L;
// Set the variant identifier as specified for version 4 UUID values. The two
// high order bits of the lower word are required to be one and zero, respectively.
leastSig &= 0x3fffffffffffffffL;
leastSig |= 0x8000000000000000L;
return new UUID(mostSig, leastSig);
} | [
"private",
"static",
"UUID",
"generateRandomUuid",
"(",
")",
"{",
"final",
"Random",
"rnd",
"=",
"ThreadLocalRandom",
".",
"current",
"(",
")",
";",
"long",
"mostSig",
"=",
"rnd",
".",
"nextLong",
"(",
")",
";",
"long",
"leastSig",
"=",
"rnd",
".",
"next... | Generate a random UUID v4 that will perform reasonably when used by
multiple threads under load.
@see <a href="https://github.com/Netflix/netflix-commons/blob/v0.3.0/netflix-commons-util/src/main/java/com/netflix/util/concurrent/ConcurrentUUIDFactory.java">ConcurrentUUIDFactory</a>
@return random UUID | [
"Generate",
"a",
"random",
"UUID",
"v4",
"that",
"will",
"perform",
"reasonably",
"when",
"used",
"by",
"multiple",
"threads",
"under",
"load",
"."
] | train | https://github.com/dropwizard/dropwizard/blob/7ee09a410476b9681e8072ab684788bb440877bd/dropwizard-jersey/src/main/java/io/dropwizard/jersey/filter/RequestIdFilter.java#L59-L74 |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusHub | @Pure
public BusHub getBusHub(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusHub busHub : this.validBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
for (final BusHub busHub : this.invalidBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
return null;
} | java | @Pure
public BusHub getBusHub(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusHub busHub : this.validBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
for (final BusHub busHub : this.invalidBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
return null;
} | [
"@",
"Pure",
"public",
"BusHub",
"getBusHub",
"(",
"String",
"name",
",",
"Comparator",
"<",
"String",
">",
"nameComparator",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Comparator",
"<",
"String",
">",
"c... | Replies the bus hub with the specified name.
@param name is the desired name
@param nameComparator is used to compare the names.
@return a bus hub or <code>null</code> | [
"Replies",
"the",
"bus",
"hub",
"with",
"the",
"specified",
"name",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1288-L1305 |
liyiorg/weixin-popular | src/main/java/weixin/popular/api/BizwifiAPI.java | BizwifiAPI.deviceList | public static DeviceListResult deviceList(String accessToken, DeviceList deviceList) {
return deviceList(accessToken, JsonUtil.toJSONString(deviceList));
} | java | public static DeviceListResult deviceList(String accessToken, DeviceList deviceList) {
return deviceList(accessToken, JsonUtil.toJSONString(deviceList));
} | [
"public",
"static",
"DeviceListResult",
"deviceList",
"(",
"String",
"accessToken",
",",
"DeviceList",
"deviceList",
")",
"{",
"return",
"deviceList",
"(",
"accessToken",
",",
"JsonUtil",
".",
"toJSONString",
"(",
"deviceList",
")",
")",
";",
"}"
] | Wi-Fi设备管理-查询设备
可通过指定分页或具体门店ID的方式,查询当前MP账号下指定门店连网成功的设备信息。一次最多能查询20个门店的设备信息。
@param accessToken accessToken
@param deviceList deviceList
@return DeviceListResult | [
"Wi",
"-",
"Fi设备管理",
"-",
"查询设备",
"可通过指定分页或具体门店ID的方式,查询当前MP账号下指定门店连网成功的设备信息。一次最多能查询20个门店的设备信息。"
] | train | https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/BizwifiAPI.java#L379-L381 |
DiUS/pact-jvm | pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java | PactDslJsonArray.arrayMinMaxLike | public static PactDslJsonArray arrayMinMaxLike(int minSize, int maxSize, PactDslJsonRootValue value) {
return arrayMinMaxLike(minSize, maxSize, minSize, value);
} | java | public static PactDslJsonArray arrayMinMaxLike(int minSize, int maxSize, PactDslJsonRootValue value) {
return arrayMinMaxLike(minSize, maxSize, minSize, value);
} | [
"public",
"static",
"PactDslJsonArray",
"arrayMinMaxLike",
"(",
"int",
"minSize",
",",
"int",
"maxSize",
",",
"PactDslJsonRootValue",
"value",
")",
"{",
"return",
"arrayMinMaxLike",
"(",
"minSize",
",",
"maxSize",
",",
"minSize",
",",
"value",
")",
";",
"}"
] | Root level array with minimum and maximum size where each item must match the provided matcher
@param minSize minimum size
@param maxSize maximum size | [
"Root",
"level",
"array",
"with",
"minimum",
"and",
"maximum",
"size",
"where",
"each",
"item",
"must",
"match",
"the",
"provided",
"matcher"
] | train | https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer/src/main/java/au/com/dius/pact/consumer/dsl/PactDslJsonArray.java#L897-L899 |
apache/incubator-druid | server/src/main/java/org/apache/druid/initialization/Initialization.java | Initialization.getExtensionFilesToLoad | public static File[] getExtensionFilesToLoad(ExtensionsConfig config)
{
final File rootExtensionsDir = new File(config.getDirectory());
if (rootExtensionsDir.exists() && !rootExtensionsDir.isDirectory()) {
throw new ISE("Root extensions directory [%s] is not a directory!?", rootExtensionsDir);
}
File[] extensionsToLoad;
final LinkedHashSet<String> toLoad = config.getLoadList();
if (toLoad == null) {
extensionsToLoad = rootExtensionsDir.listFiles();
} else {
int i = 0;
extensionsToLoad = new File[toLoad.size()];
for (final String extensionName : toLoad) {
File extensionDir = new File(extensionName);
if (!extensionDir.isAbsolute()) {
extensionDir = new File(rootExtensionsDir, extensionName);
}
if (!extensionDir.isDirectory()) {
throw new ISE(
"Extension [%s] specified in \"druid.extensions.loadList\" didn't exist!?",
extensionDir.getAbsolutePath()
);
}
extensionsToLoad[i++] = extensionDir;
}
}
return extensionsToLoad == null ? new File[]{} : extensionsToLoad;
} | java | public static File[] getExtensionFilesToLoad(ExtensionsConfig config)
{
final File rootExtensionsDir = new File(config.getDirectory());
if (rootExtensionsDir.exists() && !rootExtensionsDir.isDirectory()) {
throw new ISE("Root extensions directory [%s] is not a directory!?", rootExtensionsDir);
}
File[] extensionsToLoad;
final LinkedHashSet<String> toLoad = config.getLoadList();
if (toLoad == null) {
extensionsToLoad = rootExtensionsDir.listFiles();
} else {
int i = 0;
extensionsToLoad = new File[toLoad.size()];
for (final String extensionName : toLoad) {
File extensionDir = new File(extensionName);
if (!extensionDir.isAbsolute()) {
extensionDir = new File(rootExtensionsDir, extensionName);
}
if (!extensionDir.isDirectory()) {
throw new ISE(
"Extension [%s] specified in \"druid.extensions.loadList\" didn't exist!?",
extensionDir.getAbsolutePath()
);
}
extensionsToLoad[i++] = extensionDir;
}
}
return extensionsToLoad == null ? new File[]{} : extensionsToLoad;
} | [
"public",
"static",
"File",
"[",
"]",
"getExtensionFilesToLoad",
"(",
"ExtensionsConfig",
"config",
")",
"{",
"final",
"File",
"rootExtensionsDir",
"=",
"new",
"File",
"(",
"config",
".",
"getDirectory",
"(",
")",
")",
";",
"if",
"(",
"rootExtensionsDir",
".",... | Find all the extension files that should be loaded by druid.
<p/>
If user explicitly specifies druid.extensions.loadList, then it will look for those extensions under root
extensions directory. If one of them is not found, druid will fail loudly.
<p/>
If user doesn't specify druid.extension.toLoad (or its value is empty), druid will load all the extensions
under the root extensions directory.
@param config ExtensionsConfig configured by druid.extensions.xxx
@return an array of druid extension files that will be loaded by druid process | [
"Find",
"all",
"the",
"extension",
"files",
"that",
"should",
"be",
"loaded",
"by",
"druid",
".",
"<p",
"/",
">",
"If",
"user",
"explicitly",
"specifies",
"druid",
".",
"extensions",
".",
"loadList",
"then",
"it",
"will",
"look",
"for",
"those",
"extension... | train | https://github.com/apache/incubator-druid/blob/f776b9408962b9006cfcfe4d6c1794751972cc8e/server/src/main/java/org/apache/druid/initialization/Initialization.java#L225-L254 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryRunner.java | QueryRunner.runPartitionScanQueryOnPartitionChunk | public ResultSegment runPartitionScanQueryOnPartitionChunk(Query query, int partitionId, int tableIndex, int fetchSize) {
MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName());
Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes(partitionId));
QueryableEntriesSegment entries = partitionScanExecutor
.execute(query.getMapName(), predicate, partitionId, tableIndex, fetchSize);
ResultProcessor processor = resultProcessorRegistry.get(query.getResultType());
Result result = processor.populateResult(query, Long.MAX_VALUE, entries.getEntries(),
singletonPartitionIdSet(partitionCount, partitionId));
return new ResultSegment(result, entries.getNextTableIndexToReadFrom());
} | java | public ResultSegment runPartitionScanQueryOnPartitionChunk(Query query, int partitionId, int tableIndex, int fetchSize) {
MapContainer mapContainer = mapServiceContext.getMapContainer(query.getMapName());
Predicate predicate = queryOptimizer.optimize(query.getPredicate(), mapContainer.getIndexes(partitionId));
QueryableEntriesSegment entries = partitionScanExecutor
.execute(query.getMapName(), predicate, partitionId, tableIndex, fetchSize);
ResultProcessor processor = resultProcessorRegistry.get(query.getResultType());
Result result = processor.populateResult(query, Long.MAX_VALUE, entries.getEntries(),
singletonPartitionIdSet(partitionCount, partitionId));
return new ResultSegment(result, entries.getNextTableIndexToReadFrom());
} | [
"public",
"ResultSegment",
"runPartitionScanQueryOnPartitionChunk",
"(",
"Query",
"query",
",",
"int",
"partitionId",
",",
"int",
"tableIndex",
",",
"int",
"fetchSize",
")",
"{",
"MapContainer",
"mapContainer",
"=",
"mapServiceContext",
".",
"getMapContainer",
"(",
"q... | Runs a query on a chunk of a single partition. The chunk is defined by the offset {@code tableIndex}
and the soft limit {@code fetchSize}.
@param query the query
@param partitionId the partition which is queried
@param tableIndex the index at which to start querying
@param fetchSize the soft limit for the number of items to be queried
@return the queried entries along with the next {@code tableIndex} to resume querying | [
"Runs",
"a",
"query",
"on",
"a",
"chunk",
"of",
"a",
"single",
"partition",
".",
"The",
"chunk",
"is",
"defined",
"by",
"the",
"offset",
"{",
"@code",
"tableIndex",
"}",
"and",
"the",
"soft",
"limit",
"{",
"@code",
"fetchSize",
"}",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/map/impl/query/QueryRunner.java#L88-L99 |
Azure/azure-sdk-for-java | containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RegistriesInner.java | RegistriesInner.scheduleRunAsync | public Observable<RunInner> scheduleRunAsync(String resourceGroupName, String registryName, RunRequest runRequest) {
return scheduleRunWithServiceResponseAsync(resourceGroupName, registryName, runRequest).map(new Func1<ServiceResponse<RunInner>, RunInner>() {
@Override
public RunInner call(ServiceResponse<RunInner> response) {
return response.body();
}
});
} | java | public Observable<RunInner> scheduleRunAsync(String resourceGroupName, String registryName, RunRequest runRequest) {
return scheduleRunWithServiceResponseAsync(resourceGroupName, registryName, runRequest).map(new Func1<ServiceResponse<RunInner>, RunInner>() {
@Override
public RunInner call(ServiceResponse<RunInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"RunInner",
">",
"scheduleRunAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"registryName",
",",
"RunRequest",
"runRequest",
")",
"{",
"return",
"scheduleRunWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"registryName",
... | Schedules a new run based on the request parameters and add it to the run queue.
@param resourceGroupName The name of the resource group to which the container registry belongs.
@param registryName The name of the container registry.
@param runRequest The parameters of a run that needs to scheduled.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable for the request | [
"Schedules",
"a",
"new",
"run",
"based",
"on",
"the",
"request",
"parameters",
"and",
"add",
"it",
"to",
"the",
"run",
"queue",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/RegistriesInner.java#L1754-L1761 |
shekhargulati/strman-java | src/main/java/strman/Strman.java | Strman.ensureRight | public static String ensureRight(final String value, final String suffix, boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return endsWith(value, suffix, caseSensitive) ? value : append(value, suffix);
} | java | public static String ensureRight(final String value, final String suffix, boolean caseSensitive) {
validate(value, NULL_STRING_PREDICATE, NULL_STRING_MSG_SUPPLIER);
return endsWith(value, suffix, caseSensitive) ? value : append(value, suffix);
} | [
"public",
"static",
"String",
"ensureRight",
"(",
"final",
"String",
"value",
",",
"final",
"String",
"suffix",
",",
"boolean",
"caseSensitive",
")",
"{",
"validate",
"(",
"value",
",",
"NULL_STRING_PREDICATE",
",",
"NULL_STRING_MSG_SUPPLIER",
")",
";",
"return",
... | Ensures that the value ends with suffix. If it doesn't, it's appended.
@param value The input String
@param suffix The substr to be ensured to be right
@param caseSensitive Use case (in-)sensitive matching for determining if value already ends with suffix
@return The string which is guarenteed to start with substr | [
"Ensures",
"that",
"the",
"value",
"ends",
"with",
"suffix",
".",
"If",
"it",
"doesn",
"t",
"it",
"s",
"appended",
"."
] | train | https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L403-L406 |
http-builder-ng/http-builder-ng | http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java | Download.toStream | public static void toStream(final HttpConfig config, final String contentType, final OutputStream ostream) {
config.context(contentType, ID, ostream);
config.getResponse().parser(contentType, Download::streamParser);
} | java | public static void toStream(final HttpConfig config, final String contentType, final OutputStream ostream) {
config.context(contentType, ID, ostream);
config.getResponse().parser(contentType, Download::streamParser);
} | [
"public",
"static",
"void",
"toStream",
"(",
"final",
"HttpConfig",
"config",
",",
"final",
"String",
"contentType",
",",
"final",
"OutputStream",
"ostream",
")",
"{",
"config",
".",
"context",
"(",
"contentType",
",",
"ID",
",",
"ostream",
")",
";",
"config... | Downloads the content into an `OutputStream` with the specified content type.
@param config the `HttpConfig` instance
@param ostream the `OutputStream` to contain the content.
@param contentType the content type | [
"Downloads",
"the",
"content",
"into",
"an",
"OutputStream",
"with",
"the",
"specified",
"content",
"type",
"."
] | train | https://github.com/http-builder-ng/http-builder-ng/blob/865f37732c102c748d3db8b905199dac9222a525/http-builder-ng-core/src/main/java/groovyx/net/http/optional/Download.java#L114-L117 |
mygreen/super-csv-annotation | src/main/java/com/github/mygreen/supercsv/cellprocessor/ConversionProcessorHandler.java | ConversionProcessorHandler.register | public <A extends Annotation> void register(final Class<A> anno, final ConversionProcessorFactory<A> factory) {
factoryMap.put(anno, factory);
} | java | public <A extends Annotation> void register(final Class<A> anno, final ConversionProcessorFactory<A> factory) {
factoryMap.put(anno, factory);
} | [
"public",
"<",
"A",
"extends",
"Annotation",
">",
"void",
"register",
"(",
"final",
"Class",
"<",
"A",
">",
"anno",
",",
"final",
"ConversionProcessorFactory",
"<",
"A",
">",
"factory",
")",
"{",
"factoryMap",
".",
"put",
"(",
"anno",
",",
"factory",
")"... | アノテーションに対する{@link ConversionProcessorFactory}を登録する。
@param <A> アノテーションのタイプ
@param anno 関連づけるアノテーション
@param factory 制約の{@link CellProcessor}を作成する{@link ConversionProcessorFactory}の実装。 | [
"アノテーションに対する",
"{",
"@link",
"ConversionProcessorFactory",
"}",
"を登録する。"
] | train | https://github.com/mygreen/super-csv-annotation/blob/9910320cb6dc143be972c7d10d9ab5ffb09c3b84/src/main/java/com/github/mygreen/supercsv/cellprocessor/ConversionProcessorHandler.java#L88-L90 |
greese/dasein-cloud-cloudstack | src/main/java/org/dasein/cloud/cloudstack/network/LoadBalancers.java | LoadBalancers.uploadSslCertificate | private Document uploadSslCertificate(SSLCertificateCreateOptions opts, boolean cs44hack) throws InternalException, CloudException {
// TODO: add trace
final List<Param> params = new ArrayList<Param>();
try {
params.add(new Param("certificate",
cs44hack ? URLEncoder.encode(opts.getCertificateBody(), "UTF-8") : opts.getCertificateBody()));
params.add(new Param("privatekey",
cs44hack ? URLEncoder.encode(opts.getPrivateKey(), "UTF-8") : opts.getPrivateKey()));
if( opts.getCertificateChain() != null ) {
params.add(new Param("certchain",
cs44hack ? URLEncoder.encode(opts.getCertificateChain(), "UTF-8") : opts.getCertificateChain()));
}
} catch (UnsupportedEncodingException e) {
throw new InternalException(e);
}
return new CSMethod(getProvider()).get(UPLOAD_SSL_CERTIFICATE, params);
} | java | private Document uploadSslCertificate(SSLCertificateCreateOptions opts, boolean cs44hack) throws InternalException, CloudException {
// TODO: add trace
final List<Param> params = new ArrayList<Param>();
try {
params.add(new Param("certificate",
cs44hack ? URLEncoder.encode(opts.getCertificateBody(), "UTF-8") : opts.getCertificateBody()));
params.add(new Param("privatekey",
cs44hack ? URLEncoder.encode(opts.getPrivateKey(), "UTF-8") : opts.getPrivateKey()));
if( opts.getCertificateChain() != null ) {
params.add(new Param("certchain",
cs44hack ? URLEncoder.encode(opts.getCertificateChain(), "UTF-8") : opts.getCertificateChain()));
}
} catch (UnsupportedEncodingException e) {
throw new InternalException(e);
}
return new CSMethod(getProvider()).get(UPLOAD_SSL_CERTIFICATE, params);
} | [
"private",
"Document",
"uploadSslCertificate",
"(",
"SSLCertificateCreateOptions",
"opts",
",",
"boolean",
"cs44hack",
")",
"throws",
"InternalException",
",",
"CloudException",
"{",
"// TODO: add trace",
"final",
"List",
"<",
"Param",
">",
"params",
"=",
"new",
"Arra... | Upload SSL certificate, optionally using parameter double encoding to address CLOUDSTACK-6864 found in 4.4
@param opts
@param cs44hack
@return Document | [
"Upload",
"SSL",
"certificate",
"optionally",
"using",
"parameter",
"double",
"encoding",
"to",
"address",
"CLOUDSTACK",
"-",
"6864",
"found",
"in",
"4",
".",
"4"
] | train | https://github.com/greese/dasein-cloud-cloudstack/blob/d86d42abbe4f277290b2c6b5d38ced506c57fee6/src/main/java/org/dasein/cloud/cloudstack/network/LoadBalancers.java#L788-L804 |
alkacon/opencms-core | src/org/opencms/i18n/CmsVfsBundleManager.java | CmsVfsBundleManager.addPropertyBundle | private void addPropertyBundle(CmsResource bundleResource) {
NameAndLocale nameAndLocale = getNameAndLocale(bundleResource);
Locale locale = nameAndLocale.getLocale();
String baseName = nameAndLocale.getName();
m_bundleBaseNames.add(baseName);
LOG.info(
String.format(
"Adding property VFS bundle (path=%s, name=%s, locale=%s)",
bundleResource.getRootPath(),
baseName,
"" + locale));
Locale paramLocale = locale != null ? locale : CmsLocaleManager.getDefaultLocale();
CmsVfsBundleParameters params = new CmsVfsBundleParameters(
nameAndLocale.getName(),
bundleResource.getRootPath(),
paramLocale,
locale == null,
CmsVfsResourceBundle.TYPE_PROPERTIES);
CmsVfsResourceBundle bundle = new CmsVfsResourceBundle(params);
addBundle(baseName, locale, bundle);
} | java | private void addPropertyBundle(CmsResource bundleResource) {
NameAndLocale nameAndLocale = getNameAndLocale(bundleResource);
Locale locale = nameAndLocale.getLocale();
String baseName = nameAndLocale.getName();
m_bundleBaseNames.add(baseName);
LOG.info(
String.format(
"Adding property VFS bundle (path=%s, name=%s, locale=%s)",
bundleResource.getRootPath(),
baseName,
"" + locale));
Locale paramLocale = locale != null ? locale : CmsLocaleManager.getDefaultLocale();
CmsVfsBundleParameters params = new CmsVfsBundleParameters(
nameAndLocale.getName(),
bundleResource.getRootPath(),
paramLocale,
locale == null,
CmsVfsResourceBundle.TYPE_PROPERTIES);
CmsVfsResourceBundle bundle = new CmsVfsResourceBundle(params);
addBundle(baseName, locale, bundle);
} | [
"private",
"void",
"addPropertyBundle",
"(",
"CmsResource",
"bundleResource",
")",
"{",
"NameAndLocale",
"nameAndLocale",
"=",
"getNameAndLocale",
"(",
"bundleResource",
")",
";",
"Locale",
"locale",
"=",
"nameAndLocale",
".",
"getLocale",
"(",
")",
";",
"String",
... | Adds a resource bundle based on a properties file in the VFS.<p>
@param bundleResource the properties file | [
"Adds",
"a",
"resource",
"bundle",
"based",
"on",
"a",
"properties",
"file",
"in",
"the",
"VFS",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/i18n/CmsVfsBundleManager.java#L285-L307 |
b3dgs/lionengine | lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/MouseMoveAwt.java | MouseMoveAwt.robotTeleport | void robotTeleport(int nx, int ny)
{
oldX = nx;
oldY = ny;
x = nx;
y = ny;
wx = nx;
wy = ny;
mx = 0;
my = 0;
moved = false;
} | java | void robotTeleport(int nx, int ny)
{
oldX = nx;
oldY = ny;
x = nx;
y = ny;
wx = nx;
wy = ny;
mx = 0;
my = 0;
moved = false;
} | [
"void",
"robotTeleport",
"(",
"int",
"nx",
",",
"int",
"ny",
")",
"{",
"oldX",
"=",
"nx",
";",
"oldY",
"=",
"ny",
";",
"x",
"=",
"nx",
";",
"y",
"=",
"ny",
";",
"wx",
"=",
"nx",
";",
"wy",
"=",
"ny",
";",
"mx",
"=",
"0",
";",
"my",
"=",
... | Teleport mouse with robot.
@param nx The new X.
@param ny The new Y. | [
"Teleport",
"mouse",
"with",
"robot",
"."
] | train | https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/MouseMoveAwt.java#L118-L129 |
Stratio/cassandra-lucene-index | builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java | Builder.partitionerOnColumn | public static Partitioner.OnColumn partitionerOnColumn(int partitions, String column) {
return new Partitioner.OnColumn(partitions, column);
} | java | public static Partitioner.OnColumn partitionerOnColumn(int partitions, String column) {
return new Partitioner.OnColumn(partitions, column);
} | [
"public",
"static",
"Partitioner",
".",
"OnColumn",
"partitionerOnColumn",
"(",
"int",
"partitions",
",",
"String",
"column",
")",
"{",
"return",
"new",
"Partitioner",
".",
"OnColumn",
"(",
"partitions",
",",
"column",
")",
";",
"}"
] | Returns a new {@link Partitioner.OnColumn} based on the specified partition key column. Rows will be stored in an
index partition determined by the hash of the specified partition key column. Both partition-directed as well as
token range searches containing an CQL equality filter over the selected partition key column will be routed to a
single partition, increasing performance. However, token range searches without filters over the partitioning
column will be routed to all the partitions, with a slightly lower performance.
Load balancing depends on the cardinality and distribution of the values of the partitioning column. Both high
cardinalities and uniform distributions will provide better load balancing between partitions.
@param partitions the number of index partitions per node
@param column the name of the partition key column
@return a new partitioner based on a partitioning key column | [
"Returns",
"a",
"new",
"{",
"@link",
"Partitioner",
".",
"OnColumn",
"}",
"based",
"on",
"the",
"specified",
"partition",
"key",
"column",
".",
"Rows",
"will",
"be",
"stored",
"in",
"an",
"index",
"partition",
"determined",
"by",
"the",
"hash",
"of",
"the"... | train | https://github.com/Stratio/cassandra-lucene-index/blob/a94a4d9af6c25d40e1108729974c35c27c54441c/builder/src/main/java/com/stratio/cassandra/lucene/builder/Builder.java#L801-L803 |
DDTH/ddth-commons | ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java | DPathUtils.getValue | public static Object getValue(Object target, String dPath) {
if (target instanceof JsonNode) {
return getValue((JsonNode) target, dPath);
}
String[] paths = splitDpath(dPath);
Object result = target;
for (String path : paths) {
result = extractValue(result, path);
}
return result instanceof POJONode ? extractValue((POJONode) result) : result;
} | java | public static Object getValue(Object target, String dPath) {
if (target instanceof JsonNode) {
return getValue((JsonNode) target, dPath);
}
String[] paths = splitDpath(dPath);
Object result = target;
for (String path : paths) {
result = extractValue(result, path);
}
return result instanceof POJONode ? extractValue((POJONode) result) : result;
} | [
"public",
"static",
"Object",
"getValue",
"(",
"Object",
"target",
",",
"String",
"dPath",
")",
"{",
"if",
"(",
"target",
"instanceof",
"JsonNode",
")",
"{",
"return",
"getValue",
"(",
"(",
"JsonNode",
")",
"target",
",",
"dPath",
")",
";",
"}",
"String"... | Extract a value from the target object using DPath expression.
@param target
@param dPath | [
"Extract",
"a",
"value",
"from",
"the",
"target",
"object",
"using",
"DPath",
"expression",
"."
] | train | https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DPathUtils.java#L411-L421 |
liferay/com-liferay-commerce | commerce-product-type-virtual-service/src/main/java/com/liferay/commerce/product/type/virtual/service/persistence/impl/CPDefinitionVirtualSettingPersistenceImpl.java | CPDefinitionVirtualSettingPersistenceImpl.findByC_C | @Override
public CPDefinitionVirtualSetting findByC_C(long classNameId, long classPK)
throws NoSuchCPDefinitionVirtualSettingException {
CPDefinitionVirtualSetting cpDefinitionVirtualSetting = fetchByC_C(classNameId,
classPK);
if (cpDefinitionVirtualSetting == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("classNameId=");
msg.append(classNameId);
msg.append(", classPK=");
msg.append(classPK);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPDefinitionVirtualSettingException(msg.toString());
}
return cpDefinitionVirtualSetting;
} | java | @Override
public CPDefinitionVirtualSetting findByC_C(long classNameId, long classPK)
throws NoSuchCPDefinitionVirtualSettingException {
CPDefinitionVirtualSetting cpDefinitionVirtualSetting = fetchByC_C(classNameId,
classPK);
if (cpDefinitionVirtualSetting == null) {
StringBundler msg = new StringBundler(6);
msg.append(_NO_SUCH_ENTITY_WITH_KEY);
msg.append("classNameId=");
msg.append(classNameId);
msg.append(", classPK=");
msg.append(classPK);
msg.append("}");
if (_log.isDebugEnabled()) {
_log.debug(msg.toString());
}
throw new NoSuchCPDefinitionVirtualSettingException(msg.toString());
}
return cpDefinitionVirtualSetting;
} | [
"@",
"Override",
"public",
"CPDefinitionVirtualSetting",
"findByC_C",
"(",
"long",
"classNameId",
",",
"long",
"classPK",
")",
"throws",
"NoSuchCPDefinitionVirtualSettingException",
"{",
"CPDefinitionVirtualSetting",
"cpDefinitionVirtualSetting",
"=",
"fetchByC_C",
"(",
"clas... | Returns the cp definition virtual setting where classNameId = ? and classPK = ? or throws a {@link NoSuchCPDefinitionVirtualSettingException} if it could not be found.
@param classNameId the class name ID
@param classPK the class pk
@return the matching cp definition virtual setting
@throws NoSuchCPDefinitionVirtualSettingException if a matching cp definition virtual setting could not be found | [
"Returns",
"the",
"cp",
"definition",
"virtual",
"setting",
"where",
"classNameId",
"=",
"?",
";",
"and",
"classPK",
"=",
"?",
";",
"or",
"throws",
"a",
"{",
"@link",
"NoSuchCPDefinitionVirtualSettingException",
"}",
"if",
"it",
"could",
"not",
"be",
"fo... | train | https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-type-virtual-service/src/main/java/com/liferay/commerce/product/type/virtual/service/persistence/impl/CPDefinitionVirtualSettingPersistenceImpl.java#L1527-L1554 |
SeleniumHQ/selenium | java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java | RemoteWebDriverBuilder.setCapability | public RemoteWebDriverBuilder setCapability(String capabilityName, String value) {
if (!OK_KEYS.test(capabilityName)) {
throw new IllegalArgumentException("Capability is not valid");
}
if (value == null) {
throw new IllegalArgumentException("Null values are not allowed");
}
additionalCapabilities.put(capabilityName, value);
return this;
} | java | public RemoteWebDriverBuilder setCapability(String capabilityName, String value) {
if (!OK_KEYS.test(capabilityName)) {
throw new IllegalArgumentException("Capability is not valid");
}
if (value == null) {
throw new IllegalArgumentException("Null values are not allowed");
}
additionalCapabilities.put(capabilityName, value);
return this;
} | [
"public",
"RemoteWebDriverBuilder",
"setCapability",
"(",
"String",
"capabilityName",
",",
"String",
"value",
")",
"{",
"if",
"(",
"!",
"OK_KEYS",
".",
"test",
"(",
"capabilityName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Capability is ... | Sets a capability for every single alternative when the session is created. These capabilities
are only set once the session is created, so this will be set on capabilities added via
{@link #addAlternative(Capabilities)} or {@link #oneOf(Capabilities, Capabilities...)} even
after this method call. | [
"Sets",
"a",
"capability",
"for",
"every",
"single",
"alternative",
"when",
"the",
"session",
"is",
"created",
".",
"These",
"capabilities",
"are",
"only",
"set",
"once",
"the",
"session",
"is",
"created",
"so",
"this",
"will",
"be",
"set",
"on",
"capabiliti... | train | https://github.com/SeleniumHQ/selenium/blob/7af172729f17b20269c8ca4ea6f788db48616535/java/client/src/org/openqa/selenium/remote/RemoteWebDriverBuilder.java#L146-L156 |
jmxtrans/embedded-jmxtrans | src/main/java/org/jmxtrans/embedded/output/StackdriverWriter.java | StackdriverWriter.start | @Override
public void start() {
try {
url = new URL(getStringSetting(SETTING_URL, DEFAULT_STACKDRIVER_API_URL));
} catch (MalformedURLException e) {
throw new EmbeddedJmxTransException(e);
}
apiKey = getStringSetting(SETTING_TOKEN);
if (getStringSetting(SETTING_PROXY_HOST, null) != null && !getStringSetting(SETTING_PROXY_HOST).isEmpty()) {
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(getStringSetting(SETTING_PROXY_HOST), getIntSetting(SETTING_PROXY_PORT)));
}
logger.info("Starting Stackdriver writer connected to '{}', proxy {} ...", url, proxy);
stackdriverApiTimeoutInMillis = getIntSetting(SETTING_STACKDRIVER_API_TIMEOUT_IN_MILLIS, DEFAULT_STACKDRIVER_API_TIMEOUT_IN_MILLIS);
// try to get and instance ID
if (getStringSetting(SETTING_SOURCE_INSTANCE, null) != null && !getStringSetting(SETTING_SOURCE_INSTANCE).isEmpty()) {
// if one is set directly use that
instanceId = getStringSetting(SETTING_SOURCE_INSTANCE);
logger.info("Using instance ID {} from setting {}", instanceId, SETTING_SOURCE_INSTANCE);
} else if (getStringSetting(SETTING_DETECT_INSTANCE, null) != null && "AWS".equalsIgnoreCase(getStringSetting(SETTING_DETECT_INSTANCE))) {
// if setting is to detect, look on the local machine URL
logger.info("Detect instance set to AWS, trying to determine AWS instance ID");
instanceId = getLocalAwsInstanceId();
if (instanceId != null) {
logger.info("Detected instance ID as {}", instanceId);
} else {
logger.info("Unable to detect AWS instance ID for this machine, sending metrics without an instance ID");
}
} else {
// no instance ID, the metrics will be sent as "bare" custom metrics and not associated with an instance
instanceId = null;
logger.info("No source instance ID passed, and not set to detect, sending metrics without and instance ID");
}
} | java | @Override
public void start() {
try {
url = new URL(getStringSetting(SETTING_URL, DEFAULT_STACKDRIVER_API_URL));
} catch (MalformedURLException e) {
throw new EmbeddedJmxTransException(e);
}
apiKey = getStringSetting(SETTING_TOKEN);
if (getStringSetting(SETTING_PROXY_HOST, null) != null && !getStringSetting(SETTING_PROXY_HOST).isEmpty()) {
proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(getStringSetting(SETTING_PROXY_HOST), getIntSetting(SETTING_PROXY_PORT)));
}
logger.info("Starting Stackdriver writer connected to '{}', proxy {} ...", url, proxy);
stackdriverApiTimeoutInMillis = getIntSetting(SETTING_STACKDRIVER_API_TIMEOUT_IN_MILLIS, DEFAULT_STACKDRIVER_API_TIMEOUT_IN_MILLIS);
// try to get and instance ID
if (getStringSetting(SETTING_SOURCE_INSTANCE, null) != null && !getStringSetting(SETTING_SOURCE_INSTANCE).isEmpty()) {
// if one is set directly use that
instanceId = getStringSetting(SETTING_SOURCE_INSTANCE);
logger.info("Using instance ID {} from setting {}", instanceId, SETTING_SOURCE_INSTANCE);
} else if (getStringSetting(SETTING_DETECT_INSTANCE, null) != null && "AWS".equalsIgnoreCase(getStringSetting(SETTING_DETECT_INSTANCE))) {
// if setting is to detect, look on the local machine URL
logger.info("Detect instance set to AWS, trying to determine AWS instance ID");
instanceId = getLocalAwsInstanceId();
if (instanceId != null) {
logger.info("Detected instance ID as {}", instanceId);
} else {
logger.info("Unable to detect AWS instance ID for this machine, sending metrics without an instance ID");
}
} else {
// no instance ID, the metrics will be sent as "bare" custom metrics and not associated with an instance
instanceId = null;
logger.info("No source instance ID passed, and not set to detect, sending metrics without and instance ID");
}
} | [
"@",
"Override",
"public",
"void",
"start",
"(",
")",
"{",
"try",
"{",
"url",
"=",
"new",
"URL",
"(",
"getStringSetting",
"(",
"SETTING_URL",
",",
"DEFAULT_STACKDRIVER_API_URL",
")",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"e",
")",
"{",
"thr... | Initial setup for the writer class. Loads in settings and initializes one-time setup variables like instanceId. | [
"Initial",
"setup",
"for",
"the",
"writer",
"class",
".",
"Loads",
"in",
"settings",
"and",
"initializes",
"one",
"-",
"time",
"setup",
"variables",
"like",
"instanceId",
"."
] | train | https://github.com/jmxtrans/embedded-jmxtrans/blob/17224389e7d8323284cabc2a5167fc03bed6d223/src/main/java/org/jmxtrans/embedded/output/StackdriverWriter.java#L110-L149 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nslimitselector.java | nslimitselector.get | public static nslimitselector get(nitro_service service, String selectorname) throws Exception{
nslimitselector obj = new nslimitselector();
obj.set_selectorname(selectorname);
nslimitselector response = (nslimitselector) obj.get_resource(service);
return response;
} | java | public static nslimitselector get(nitro_service service, String selectorname) throws Exception{
nslimitselector obj = new nslimitselector();
obj.set_selectorname(selectorname);
nslimitselector response = (nslimitselector) obj.get_resource(service);
return response;
} | [
"public",
"static",
"nslimitselector",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"selectorname",
")",
"throws",
"Exception",
"{",
"nslimitselector",
"obj",
"=",
"new",
"nslimitselector",
"(",
")",
";",
"obj",
".",
"set_selectorname",
"(",
"selectornam... | Use this API to fetch nslimitselector resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"nslimitselector",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/ns/nslimitselector.java#L276-L281 |
RestComm/media-core | ice/src/main/java/org/restcomm/media/core/ice/harvest/HostCandidateHarvester.java | HostCandidateHarvester.openUdpChannel | private DatagramChannel openUdpChannel(InetAddress localAddress, int port, Selector selector) throws IOException {
DatagramChannel channel = DatagramChannel.open();
channel.configureBlocking(false);
// Register selector for reading operations
channel.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE);
channel.bind(new InetSocketAddress(localAddress, port));
return channel;
} | java | private DatagramChannel openUdpChannel(InetAddress localAddress, int port, Selector selector) throws IOException {
DatagramChannel channel = DatagramChannel.open();
channel.configureBlocking(false);
// Register selector for reading operations
channel.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE);
channel.bind(new InetSocketAddress(localAddress, port));
return channel;
} | [
"private",
"DatagramChannel",
"openUdpChannel",
"(",
"InetAddress",
"localAddress",
",",
"int",
"port",
",",
"Selector",
"selector",
")",
"throws",
"IOException",
"{",
"DatagramChannel",
"channel",
"=",
"DatagramChannel",
".",
"open",
"(",
")",
";",
"channel",
"."... | Opens a datagram channel and binds it to an address.
@param localAddress
The address to bind the channel to.
@param port
The port to use
@return The bound datagram channel
@throws IOException
When an error occurs while binding the datagram channel. | [
"Opens",
"a",
"datagram",
"channel",
"and",
"binds",
"it",
"to",
"an",
"address",
"."
] | train | https://github.com/RestComm/media-core/blob/07b8703343708599f60af66bae62aded77ee81b5/ice/src/main/java/org/restcomm/media/core/ice/harvest/HostCandidateHarvester.java#L150-L157 |
UrielCh/ovh-java-sdk | ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java | ApiOvhDedicatedserver.serviceName_virtualNetworkInterface_GET | public ArrayList<String> serviceName_virtualNetworkInterface_GET(String serviceName, OvhVirtualNetworkInterfaceModeEnum mode, String name, String vrack) throws IOException {
String qPath = "/dedicated/server/{serviceName}/virtualNetworkInterface";
StringBuilder sb = path(qPath, serviceName);
query(sb, "mode", mode);
query(sb, "name", name);
query(sb, "vrack", vrack);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | java | public ArrayList<String> serviceName_virtualNetworkInterface_GET(String serviceName, OvhVirtualNetworkInterfaceModeEnum mode, String name, String vrack) throws IOException {
String qPath = "/dedicated/server/{serviceName}/virtualNetworkInterface";
StringBuilder sb = path(qPath, serviceName);
query(sb, "mode", mode);
query(sb, "name", name);
query(sb, "vrack", vrack);
String resp = exec(qPath, "GET", sb.toString(), null);
return convertTo(resp, t1);
} | [
"public",
"ArrayList",
"<",
"String",
">",
"serviceName_virtualNetworkInterface_GET",
"(",
"String",
"serviceName",
",",
"OvhVirtualNetworkInterfaceModeEnum",
"mode",
",",
"String",
"name",
",",
"String",
"vrack",
")",
"throws",
"IOException",
"{",
"String",
"qPath",
... | List server VirtualNetworkInterfaces
REST: GET /dedicated/server/{serviceName}/virtualNetworkInterface
@param name [required] Filter the value of name property (=)
@param vrack [required] Filter the value of vrack property (=)
@param mode [required] Filter the value of mode property (=)
@param serviceName [required] The internal name of your dedicated server
API beta | [
"List",
"server",
"VirtualNetworkInterfaces"
] | train | https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedserver/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedserver.java#L185-L193 |
apereo/cas | support/cas-server-support-shell/src/main/java/org/apereo/cas/shell/commands/util/ValidateLdapConnectionCommand.java | ValidateLdapConnectionCommand.validateLdap | @ShellMethod(key = "validate-ldap", value = "Test connections to an LDAP server to verify connectivity, SSL, etc")
public static void validateLdap(
@ShellOption(value = {"url"},
help = "LDAP URL to test, comma-separated.") final String url,
@ShellOption(value = {"bindDn"},
help = "bindDn to use when testing the LDAP server") final String bindDn,
@ShellOption(value = {"bindCredential"},
help = "bindCredential to use when testing the LDAP server") final String bindCredential,
@ShellOption(value = {"baseDn"},
help = "baseDn to use when testing the LDAP server, searching for accounts (i.e. OU=some,DC=org,DC=edu)") final String baseDn,
@ShellOption(value = {"searchFilter"},
help = "Filter to use when searching for accounts (i.e. (&(objectClass=*) (sAMAccountName=user)))") final String searchFilter,
@ShellOption(value = {"userPassword"},
help = "Password for the user found in the search result, to attempt authentication") final String userPassword,
@ShellOption(value = {"userAttributes"},
help = "User attributes, comma-separated, to fetch for the user found in the search result") final String userAttributes) {
try {
connect(url, bindDn, bindCredential, baseDn, searchFilter, userAttributes, userPassword);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
} | java | @ShellMethod(key = "validate-ldap", value = "Test connections to an LDAP server to verify connectivity, SSL, etc")
public static void validateLdap(
@ShellOption(value = {"url"},
help = "LDAP URL to test, comma-separated.") final String url,
@ShellOption(value = {"bindDn"},
help = "bindDn to use when testing the LDAP server") final String bindDn,
@ShellOption(value = {"bindCredential"},
help = "bindCredential to use when testing the LDAP server") final String bindCredential,
@ShellOption(value = {"baseDn"},
help = "baseDn to use when testing the LDAP server, searching for accounts (i.e. OU=some,DC=org,DC=edu)") final String baseDn,
@ShellOption(value = {"searchFilter"},
help = "Filter to use when searching for accounts (i.e. (&(objectClass=*) (sAMAccountName=user)))") final String searchFilter,
@ShellOption(value = {"userPassword"},
help = "Password for the user found in the search result, to attempt authentication") final String userPassword,
@ShellOption(value = {"userAttributes"},
help = "User attributes, comma-separated, to fetch for the user found in the search result") final String userAttributes) {
try {
connect(url, bindDn, bindCredential, baseDn, searchFilter, userAttributes, userPassword);
} catch (final Exception e) {
LOGGER.error(e.getMessage(), e);
}
} | [
"@",
"ShellMethod",
"(",
"key",
"=",
"\"validate-ldap\"",
",",
"value",
"=",
"\"Test connections to an LDAP server to verify connectivity, SSL, etc\"",
")",
"public",
"static",
"void",
"validateLdap",
"(",
"@",
"ShellOption",
"(",
"value",
"=",
"{",
"\"url\"",
"}",
",... | Validate endpoint.
@param url the url
@param bindDn the bind dn
@param bindCredential the bind credential
@param baseDn the base dn
@param searchFilter the search filter
@param userPassword the user password
@param userAttributes the user attributes | [
"Validate",
"endpoint",
"."
] | train | https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/support/cas-server-support-shell/src/main/java/org/apereo/cas/shell/commands/util/ValidateLdapConnectionCommand.java#L42-L63 |
fcrepo4/fcrepo4 | fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/ContainerServiceImpl.java | ContainerServiceImpl.find | @Override
public Container find(final FedoraSession session, final String path) {
final Node node = findNode(session, path);
return cast(node);
} | java | @Override
public Container find(final FedoraSession session, final String path) {
final Node node = findNode(session, path);
return cast(node);
} | [
"@",
"Override",
"public",
"Container",
"find",
"(",
"final",
"FedoraSession",
"session",
",",
"final",
"String",
"path",
")",
"{",
"final",
"Node",
"node",
"=",
"findNode",
"(",
"session",
",",
"path",
")",
";",
"return",
"cast",
"(",
"node",
")",
";",
... | Retrieve a {@link org.fcrepo.kernel.api.models.Container} instance by pid and dsid
@param path the path
@param session the session
@return A {@link org.fcrepo.kernel.api.models.Container} with the proffered PID | [
"Retrieve",
"a",
"{",
"@link",
"org",
".",
"fcrepo",
".",
"kernel",
".",
"api",
".",
"models",
".",
"Container",
"}",
"instance",
"by",
"pid",
"and",
"dsid"
] | train | https://github.com/fcrepo4/fcrepo4/blob/7489ad5bc8fb44e2442c93eceb7d97ac54553ab6/fcrepo-kernel-modeshape/src/main/java/org/fcrepo/kernel/modeshape/services/ContainerServiceImpl.java#L119-L124 |
lessthanoptimal/BoofCV | main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java | PerspectiveOps.projectionSplit | public static void projectionSplit( DMatrixRMaj P , DMatrixRMaj M , Vector3D_F64 T ) {
CommonOps_DDRM.extract(P,0,3,0,3,M,0,0);
T.x = P.get(0,3);
T.y = P.get(1,3);
T.z = P.get(2,3);
} | java | public static void projectionSplit( DMatrixRMaj P , DMatrixRMaj M , Vector3D_F64 T ) {
CommonOps_DDRM.extract(P,0,3,0,3,M,0,0);
T.x = P.get(0,3);
T.y = P.get(1,3);
T.z = P.get(2,3);
} | [
"public",
"static",
"void",
"projectionSplit",
"(",
"DMatrixRMaj",
"P",
",",
"DMatrixRMaj",
"M",
",",
"Vector3D_F64",
"T",
")",
"{",
"CommonOps_DDRM",
".",
"extract",
"(",
"P",
",",
"0",
",",
"3",
",",
"0",
",",
"3",
",",
"M",
",",
"0",
",",
"0",
"... | Splits the projection matrix into a 3x3 matrix and 3x1 vector.
@param P (Input) 3x4 projection matirx
@param M (Output) M = P(:,0:2)
@param T (Output) T = P(:,3) | [
"Splits",
"the",
"projection",
"matrix",
"into",
"a",
"3x3",
"matrix",
"and",
"3x1",
"vector",
"."
] | train | https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L650-L655 |
revapi/revapi | revapi-java-spi/src/main/java/org/revapi/java/spi/CheckBase.java | CheckBase.isBothAccessible | public boolean isBothAccessible(@Nullable JavaModelElement a, @Nullable JavaModelElement b) {
if (a == null || b == null) {
return false;
}
return isAccessible(a) && isAccessible(b);
} | java | public boolean isBothAccessible(@Nullable JavaModelElement a, @Nullable JavaModelElement b) {
if (a == null || b == null) {
return false;
}
return isAccessible(a) && isAccessible(b);
} | [
"public",
"boolean",
"isBothAccessible",
"(",
"@",
"Nullable",
"JavaModelElement",
"a",
",",
"@",
"Nullable",
"JavaModelElement",
"b",
")",
"{",
"if",
"(",
"a",
"==",
"null",
"||",
"b",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"isAc... | Checks whether both provided elements are public or protected. If one at least one of them is null, the method
returns false, because the accessibility cannot be truthfully detected in that case.
@param a first element
@param b second element
@return true if both elements are not null and accessible (i.e. public or protected) | [
"Checks",
"whether",
"both",
"provided",
"elements",
"are",
"public",
"or",
"protected",
".",
"If",
"one",
"at",
"least",
"one",
"of",
"them",
"is",
"null",
"the",
"method",
"returns",
"false",
"because",
"the",
"accessibility",
"cannot",
"be",
"truthfully",
... | train | https://github.com/revapi/revapi/blob/e070b136d977441ab96fdce067a13e7e0423295b/revapi-java-spi/src/main/java/org/revapi/java/spi/CheckBase.java#L83-L89 |
OpenLiberty/open-liberty | dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLoginAuthenticator.java | FormLoginAuthenticator.handleRedirect | private AuthenticationResult handleRedirect(HttpServletRequest req,
HttpServletResponse res,
WebRequest webRequest) {
AuthenticationResult authResult;
String loginURL = getFormLoginURL(req, webRequest, webAppSecurityConfig);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "form login URL: " + loginURL);
}
authResult = new AuthenticationResult(AuthResult.REDIRECT, loginURL);
if (allowToAddCookieToResponse(webAppSecurityConfig, req)) {
postParameterHelper.save(req, res, authResult);
ReferrerURLCookieHandler referrerURLHandler = webAppSecurityConfig.createReferrerURLCookieHandler();
// referrerURLHandler.setReferrerURLCookie(authResult, getReqURL(req));
Cookie c = referrerURLHandler.createReferrerURLCookie(ReferrerURLCookieHandler.REFERRER_URL_COOKIENAME, getReqURL(req), req);
authResult.setCookie(c);
}
return authResult;
} | java | private AuthenticationResult handleRedirect(HttpServletRequest req,
HttpServletResponse res,
WebRequest webRequest) {
AuthenticationResult authResult;
String loginURL = getFormLoginURL(req, webRequest, webAppSecurityConfig);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "form login URL: " + loginURL);
}
authResult = new AuthenticationResult(AuthResult.REDIRECT, loginURL);
if (allowToAddCookieToResponse(webAppSecurityConfig, req)) {
postParameterHelper.save(req, res, authResult);
ReferrerURLCookieHandler referrerURLHandler = webAppSecurityConfig.createReferrerURLCookieHandler();
// referrerURLHandler.setReferrerURLCookie(authResult, getReqURL(req));
Cookie c = referrerURLHandler.createReferrerURLCookie(ReferrerURLCookieHandler.REFERRER_URL_COOKIENAME, getReqURL(req), req);
authResult.setCookie(c);
}
return authResult;
} | [
"private",
"AuthenticationResult",
"handleRedirect",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"res",
",",
"WebRequest",
"webRequest",
")",
"{",
"AuthenticationResult",
"authResult",
";",
"String",
"loginURL",
"=",
"getFormLoginURL",
"(",
"req",
",",... | This method save post parameters in the cookie or session and
redirect to a login page.
@param req
@param res
@param loginURL
@return authenticationResult | [
"This",
"method",
"save",
"post",
"parameters",
"in",
"the",
"cookie",
"or",
"session",
"and",
"redirect",
"to",
"a",
"login",
"page",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.webcontainer.security/src/com/ibm/ws/webcontainer/security/internal/FormLoginAuthenticator.java#L126-L147 |
google/error-prone-javac | src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java | ClassReader.sigToType | Type sigToType(byte[] sig, int offset, int len) {
signature = sig;
sigp = offset;
siglimit = offset + len;
return sigToType();
} | java | Type sigToType(byte[] sig, int offset, int len) {
signature = sig;
sigp = offset;
siglimit = offset + len;
return sigToType();
} | [
"Type",
"sigToType",
"(",
"byte",
"[",
"]",
"sig",
",",
"int",
"offset",
",",
"int",
"len",
")",
"{",
"signature",
"=",
"sig",
";",
"sigp",
"=",
"offset",
";",
"siglimit",
"=",
"offset",
"+",
"len",
";",
"return",
"sigToType",
"(",
")",
";",
"}"
] | Convert signature to type, where signature is a byte array segment. | [
"Convert",
"signature",
"to",
"type",
"where",
"signature",
"is",
"a",
"byte",
"array",
"segment",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java#L652-L657 |
phax/ph-masterdata | ph-masterdata/src/main/java/com/helger/masterdata/ean/AbstractUPCEAN.java | AbstractUPCEAN.calcChecksumChar | protected static char calcChecksumChar (@Nonnull final String sMsg, @Nonnegative final int nLength)
{
ValueEnforcer.notNull (sMsg, "Msg");
ValueEnforcer.isBetweenInclusive (nLength, "Length", 0, sMsg.length ());
return asChar (calcChecksum (sMsg.toCharArray (), nLength));
} | java | protected static char calcChecksumChar (@Nonnull final String sMsg, @Nonnegative final int nLength)
{
ValueEnforcer.notNull (sMsg, "Msg");
ValueEnforcer.isBetweenInclusive (nLength, "Length", 0, sMsg.length ());
return asChar (calcChecksum (sMsg.toCharArray (), nLength));
} | [
"protected",
"static",
"char",
"calcChecksumChar",
"(",
"@",
"Nonnull",
"final",
"String",
"sMsg",
",",
"@",
"Nonnegative",
"final",
"int",
"nLength",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"sMsg",
",",
"\"Msg\"",
")",
";",
"ValueEnforcer",
".",
"is... | Calculates the check character for a given message
@param sMsg
the message
@param nLength
The number of characters to be checked. Must be ≥ 0 and <
message.length
@return char the check character | [
"Calculates",
"the",
"check",
"character",
"for",
"a",
"given",
"message"
] | train | https://github.com/phax/ph-masterdata/blob/ca5e0b03c735b30b47930c018bfb5e71f00d0ff4/ph-masterdata/src/main/java/com/helger/masterdata/ean/AbstractUPCEAN.java#L144-L150 |
couchbase/couchbase-lite-java | src/main/java/com/couchbase/lite/Expression.java | Expression.notEqualTo | @NonNull
public Expression notEqualTo(@NonNull Expression expression) {
if (expression == null) {
throw new IllegalArgumentException("expression cannot be null.");
}
return new BinaryExpression(this, expression, BinaryExpression.OpType.NotEqualTo);
} | java | @NonNull
public Expression notEqualTo(@NonNull Expression expression) {
if (expression == null) {
throw new IllegalArgumentException("expression cannot be null.");
}
return new BinaryExpression(this, expression, BinaryExpression.OpType.NotEqualTo);
} | [
"@",
"NonNull",
"public",
"Expression",
"notEqualTo",
"(",
"@",
"NonNull",
"Expression",
"expression",
")",
"{",
"if",
"(",
"expression",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"expression cannot be null.\"",
")",
";",
"}",
"r... | Create a NOT equal to expression that evaluates whether or not the current expression
is not equal to the given expression.
@param expression the expression to compare with the current expression.
@return a NOT equal to exprssion. | [
"Create",
"a",
"NOT",
"equal",
"to",
"expression",
"that",
"evaluates",
"whether",
"or",
"not",
"the",
"current",
"expression",
"is",
"not",
"equal",
"to",
"the",
"given",
"expression",
"."
] | train | https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/Expression.java#L692-L698 |
netty/netty | codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java | HttpPostRequestEncoder.encodeAttribute | @SuppressWarnings("unchecked")
private String encodeAttribute(String s, Charset charset) throws ErrorDataEncoderException {
if (s == null) {
return "";
}
try {
String encoded = URLEncoder.encode(s, charset.name());
if (encoderMode == EncoderMode.RFC3986) {
for (Map.Entry<Pattern, String> entry : percentEncodings) {
String replacement = entry.getValue();
encoded = entry.getKey().matcher(encoded).replaceAll(replacement);
}
}
return encoded;
} catch (UnsupportedEncodingException e) {
throw new ErrorDataEncoderException(charset.name(), e);
}
} | java | @SuppressWarnings("unchecked")
private String encodeAttribute(String s, Charset charset) throws ErrorDataEncoderException {
if (s == null) {
return "";
}
try {
String encoded = URLEncoder.encode(s, charset.name());
if (encoderMode == EncoderMode.RFC3986) {
for (Map.Entry<Pattern, String> entry : percentEncodings) {
String replacement = entry.getValue();
encoded = entry.getKey().matcher(encoded).replaceAll(replacement);
}
}
return encoded;
} catch (UnsupportedEncodingException e) {
throw new ErrorDataEncoderException(charset.name(), e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"String",
"encodeAttribute",
"(",
"String",
"s",
",",
"Charset",
"charset",
")",
"throws",
"ErrorDataEncoderException",
"{",
"if",
"(",
"s",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"t... | Encode one attribute
@return the encoded attribute
@throws ErrorDataEncoderException
if the encoding is in error | [
"Encode",
"one",
"attribute"
] | train | https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostRequestEncoder.java#L836-L853 |
TNG/JGiven | jgiven-core/src/main/java/com/tngtech/jgiven/attachment/MediaType.java | MediaType.nonBinary | public static MediaType nonBinary( MediaType.Type type, String subType, Charset charSet ) {
ApiUtil.notNull( charSet, "charset must not be null" );
return new MediaType( type, subType, charSet );
} | java | public static MediaType nonBinary( MediaType.Type type, String subType, Charset charSet ) {
ApiUtil.notNull( charSet, "charset must not be null" );
return new MediaType( type, subType, charSet );
} | [
"public",
"static",
"MediaType",
"nonBinary",
"(",
"MediaType",
".",
"Type",
"type",
",",
"String",
"subType",
",",
"Charset",
"charSet",
")",
"{",
"ApiUtil",
".",
"notNull",
"(",
"charSet",
",",
"\"charset must not be null\"",
")",
";",
"return",
"new",
"Medi... | Creates a non-binary media type with the given type, subtype, and charSet
@throws com.tngtech.jgiven.exception.JGivenWrongUsageException if any of the given arguments is {@code null} | [
"Creates",
"a",
"non",
"-",
"binary",
"media",
"type",
"with",
"the",
"given",
"type",
"subtype",
"and",
"charSet"
] | train | https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/attachment/MediaType.java#L185-L188 |
landawn/AbacusUtil | src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java | PoolablePreparedStatement.setNClob | @Override
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
internalStmt.setNClob(parameterIndex, reader);
} | java | @Override
public void setNClob(int parameterIndex, Reader reader) throws SQLException {
internalStmt.setNClob(parameterIndex, reader);
} | [
"@",
"Override",
"public",
"void",
"setNClob",
"(",
"int",
"parameterIndex",
",",
"Reader",
"reader",
")",
"throws",
"SQLException",
"{",
"internalStmt",
".",
"setNClob",
"(",
"parameterIndex",
",",
"reader",
")",
";",
"}"
] | Method setNClob.
@param parameterIndex
@param reader
@throws SQLException
@see java.sql.PreparedStatement#setNClob(int, Reader) | [
"Method",
"setNClob",
"."
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/dataSource/PoolablePreparedStatement.java#L830-L833 |
contentful/contentful-management.java | src/main/java/com/contentful/java/cma/ModuleEditorInterfaces.java | ModuleEditorInterfaces.fetchOne | public CMAEditorInterface fetchOne(String spaceId, String environmentId, String contentTypeId) {
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
assertNotNull(contentTypeId, "contentTypeId");
return service.fetchOne(spaceId, environmentId, contentTypeId).blockingFirst();
} | java | public CMAEditorInterface fetchOne(String spaceId, String environmentId, String contentTypeId) {
assertNotNull(spaceId, "spaceId");
assertNotNull(environmentId, "environmentId");
assertNotNull(contentTypeId, "contentTypeId");
return service.fetchOne(spaceId, environmentId, contentTypeId).blockingFirst();
} | [
"public",
"CMAEditorInterface",
"fetchOne",
"(",
"String",
"spaceId",
",",
"String",
"environmentId",
",",
"String",
"contentTypeId",
")",
"{",
"assertNotNull",
"(",
"spaceId",
",",
"\"spaceId\"",
")",
";",
"assertNotNull",
"(",
"environmentId",
",",
"\"environmentI... | Get the editor interface by id, using the given space and environment.
<p>
This method will override the configuration specified through
{@link CMAClient.Builder#setSpaceId(String)} and
{@link CMAClient.Builder#setEnvironmentId(String)}.
@param spaceId the id of the space this environment is part of.
@param environmentId the id of the environment this editor interface is valid on.
@param contentTypeId the contentTypeId this editor interface is valid on.
@return the editor interface for a specific content type on a specific space.
@throws IllegalArgumentException if space id is null.
@throws IllegalArgumentException if environment id is null.
@throws IllegalArgumentException if content type id is null. | [
"Get",
"the",
"editor",
"interface",
"by",
"id",
"using",
"the",
"given",
"space",
"and",
"environment",
".",
"<p",
">",
"This",
"method",
"will",
"override",
"the",
"configuration",
"specified",
"through",
"{",
"@link",
"CMAClient",
".",
"Builder#setSpaceId",
... | train | https://github.com/contentful/contentful-management.java/blob/ca310fb9ea9577fcff0ca57949ab7c2315fa2534/src/main/java/com/contentful/java/cma/ModuleEditorInterfaces.java#L86-L92 |
jenkinsci/jenkins | core/src/main/java/jenkins/model/Nodes.java | Nodes.replaceNode | public boolean replaceNode(final Node oldOne, final @Nonnull Node newOne) throws IOException {
if (oldOne == nodes.get(oldOne.getNodeName())) {
// use the queue lock until Nodes has a way of directly modifying a single node.
Queue.withLock(new Runnable() {
public void run() {
Nodes.this.nodes.remove(oldOne.getNodeName());
Nodes.this.nodes.put(newOne.getNodeName(), newOne);
jenkins.updateComputerList();
jenkins.trimLabels();
}
});
updateNode(newOne);
if (!newOne.getNodeName().equals(oldOne.getNodeName())) {
Util.deleteRecursive(new File(getNodesDir(), oldOne.getNodeName()));
}
NodeListener.fireOnUpdated(oldOne, newOne);
return true;
} else {
return false;
}
} | java | public boolean replaceNode(final Node oldOne, final @Nonnull Node newOne) throws IOException {
if (oldOne == nodes.get(oldOne.getNodeName())) {
// use the queue lock until Nodes has a way of directly modifying a single node.
Queue.withLock(new Runnable() {
public void run() {
Nodes.this.nodes.remove(oldOne.getNodeName());
Nodes.this.nodes.put(newOne.getNodeName(), newOne);
jenkins.updateComputerList();
jenkins.trimLabels();
}
});
updateNode(newOne);
if (!newOne.getNodeName().equals(oldOne.getNodeName())) {
Util.deleteRecursive(new File(getNodesDir(), oldOne.getNodeName()));
}
NodeListener.fireOnUpdated(oldOne, newOne);
return true;
} else {
return false;
}
} | [
"public",
"boolean",
"replaceNode",
"(",
"final",
"Node",
"oldOne",
",",
"final",
"@",
"Nonnull",
"Node",
"newOne",
")",
"throws",
"IOException",
"{",
"if",
"(",
"oldOne",
"==",
"nodes",
".",
"get",
"(",
"oldOne",
".",
"getNodeName",
"(",
")",
")",
")",
... | Replace node of given name.
@return {@code true} if node was replaced.
@since 2.8 | [
"Replace",
"node",
"of",
"given",
"name",
"."
] | train | https://github.com/jenkinsci/jenkins/blob/44c4d3989232082c254d27ae360aa810669f44b7/core/src/main/java/jenkins/model/Nodes.java#L224-L245 |
pedrovgs/DraggablePanel | draggablepanel/src/main/java/com/github/pedrovgs/DraggableViewCallback.java | DraggableViewCallback.clampViewPositionHorizontal | @Override public int clampViewPositionHorizontal(View child, int left, int dx) {
int newLeft = draggedView.getLeft();
if ((draggableView.isMinimized() && Math.abs(dx) > MINIMUM_DX_FOR_HORIZONTAL_DRAG) || (
draggableView.isDragViewAtBottom()
&& !draggableView.isDragViewAtRight())) {
newLeft = left;
}
return newLeft;
} | java | @Override public int clampViewPositionHorizontal(View child, int left, int dx) {
int newLeft = draggedView.getLeft();
if ((draggableView.isMinimized() && Math.abs(dx) > MINIMUM_DX_FOR_HORIZONTAL_DRAG) || (
draggableView.isDragViewAtBottom()
&& !draggableView.isDragViewAtRight())) {
newLeft = left;
}
return newLeft;
} | [
"@",
"Override",
"public",
"int",
"clampViewPositionHorizontal",
"(",
"View",
"child",
",",
"int",
"left",
",",
"int",
"dx",
")",
"{",
"int",
"newLeft",
"=",
"draggedView",
".",
"getLeft",
"(",
")",
";",
"if",
"(",
"(",
"draggableView",
".",
"isMinimized",... | Override method used to configure the horizontal drag. Restrict the motion of the dragged
child view along the horizontal axis.
@param child child view being dragged.
@param left attempted motion along the X axis.
@param dx proposed change in position for left.
@return the new clamped position for left. | [
"Override",
"method",
"used",
"to",
"configure",
"the",
"horizontal",
"drag",
".",
"Restrict",
"the",
"motion",
"of",
"the",
"dragged",
"child",
"view",
"along",
"the",
"horizontal",
"axis",
"."
] | train | https://github.com/pedrovgs/DraggablePanel/blob/6b6d1806fa4140113f31307a2571bf02435aa53a/draggablepanel/src/main/java/com/github/pedrovgs/DraggableViewCallback.java#L108-L116 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java | Stylesheet.containsExcludeResultPrefix | public boolean containsExcludeResultPrefix(String prefix, String uri)
{
if (null == m_ExcludeResultPrefixs || uri == null )
return false;
// This loop is ok here because this code only runs during
// stylesheet compile time.
for (int i =0; i< m_ExcludeResultPrefixs.size(); i++)
{
if (uri.equals(getNamespaceForPrefix(m_ExcludeResultPrefixs.elementAt(i))))
return true;
}
return false;
/* if (prefix.length() == 0)
prefix = Constants.ATTRVAL_DEFAULT_PREFIX;
return m_ExcludeResultPrefixs.contains(prefix); */
} | java | public boolean containsExcludeResultPrefix(String prefix, String uri)
{
if (null == m_ExcludeResultPrefixs || uri == null )
return false;
// This loop is ok here because this code only runs during
// stylesheet compile time.
for (int i =0; i< m_ExcludeResultPrefixs.size(); i++)
{
if (uri.equals(getNamespaceForPrefix(m_ExcludeResultPrefixs.elementAt(i))))
return true;
}
return false;
/* if (prefix.length() == 0)
prefix = Constants.ATTRVAL_DEFAULT_PREFIX;
return m_ExcludeResultPrefixs.contains(prefix); */
} | [
"public",
"boolean",
"containsExcludeResultPrefix",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"{",
"if",
"(",
"null",
"==",
"m_ExcludeResultPrefixs",
"||",
"uri",
"==",
"null",
")",
"return",
"false",
";",
"// This loop is ok here because this code only runs... | Get whether or not the passed prefix is contained flagged by
the "exclude-result-prefixes" property.
@see <a href="http://www.w3.org/TR/xslt#literal-result-element">literal-result-element in XSLT Specification</a>
@param prefix non-null reference to prefix that might be excluded.
@param uri reference to namespace that prefix maps to
@return true if the prefix should normally be excluded.> | [
"Get",
"whether",
"or",
"not",
"the",
"passed",
"prefix",
"is",
"contained",
"flagged",
"by",
"the",
"exclude",
"-",
"result",
"-",
"prefixes",
"property",
".",
"@see",
"<a",
"href",
"=",
"http",
":",
"//",
"www",
".",
"w3",
".",
"org",
"/",
"TR",
"/... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java#L348-L368 |
burberius/eve-esi | src/main/java/net/troja/eve/esi/api/UserInterfaceApi.java | UserInterfaceApi.postUiOpenwindowNewmail | public void postUiOpenwindowNewmail(String datasource, String token, UiNewMail uiNewMail) throws ApiException {
postUiOpenwindowNewmailWithHttpInfo(datasource, token, uiNewMail);
} | java | public void postUiOpenwindowNewmail(String datasource, String token, UiNewMail uiNewMail) throws ApiException {
postUiOpenwindowNewmailWithHttpInfo(datasource, token, uiNewMail);
} | [
"public",
"void",
"postUiOpenwindowNewmail",
"(",
"String",
"datasource",
",",
"String",
"token",
",",
"UiNewMail",
"uiNewMail",
")",
"throws",
"ApiException",
"{",
"postUiOpenwindowNewmailWithHttpInfo",
"(",
"datasource",
",",
"token",
",",
"uiNewMail",
")",
";",
"... | Open New Mail Window Open the New Mail window, according to settings from
the request if applicable --- SSO Scope: esi-ui.open_window.v1
@param datasource
The server name you would like data from (optional, default to
tranquility)
@param token
Access token to use if unable to set a header (optional)
@param uiNewMail
(optional)
@throws ApiException
If fail to call the API, e.g. server error or cannot
deserialize the response body | [
"Open",
"New",
"Mail",
"Window",
"Open",
"the",
"New",
"Mail",
"window",
"according",
"to",
"settings",
"from",
"the",
"request",
"if",
"applicable",
"---",
"SSO",
"Scope",
":",
"esi",
"-",
"ui",
".",
"open_window",
".",
"v1"
] | train | https://github.com/burberius/eve-esi/blob/24a941c592cfc15f23471ef849b282fbc582ca13/src/main/java/net/troja/eve/esi/api/UserInterfaceApi.java#L749-L751 |
soi-toolkit/soi-toolkit-mule | commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/util/MuleUtil.java | MuleUtil.getImmutableEndpoint | public static ImmutableEndpoint getImmutableEndpoint(MuleContext muleContext, String endpointName) throws IOException {
ImmutableEndpoint endpoint = null;
Object o = muleContext.getRegistry().lookupObject(endpointName);
if (o instanceof ImmutableEndpoint) {
// For Inbound and Outbound Endpoints
endpoint = (ImmutableEndpoint) o;
} else if (o instanceof EndpointBuilder) {
// For Endpoint-references
EndpointBuilder eb = (EndpointBuilder) o;
try {
endpoint = eb.buildInboundEndpoint();
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
return endpoint;
} | java | public static ImmutableEndpoint getImmutableEndpoint(MuleContext muleContext, String endpointName) throws IOException {
ImmutableEndpoint endpoint = null;
Object o = muleContext.getRegistry().lookupObject(endpointName);
if (o instanceof ImmutableEndpoint) {
// For Inbound and Outbound Endpoints
endpoint = (ImmutableEndpoint) o;
} else if (o instanceof EndpointBuilder) {
// For Endpoint-references
EndpointBuilder eb = (EndpointBuilder) o;
try {
endpoint = eb.buildInboundEndpoint();
} catch (Exception e) {
throw new IOException(e.getMessage());
}
}
return endpoint;
} | [
"public",
"static",
"ImmutableEndpoint",
"getImmutableEndpoint",
"(",
"MuleContext",
"muleContext",
",",
"String",
"endpointName",
")",
"throws",
"IOException",
"{",
"ImmutableEndpoint",
"endpoint",
"=",
"null",
";",
"Object",
"o",
"=",
"muleContext",
".",
"getRegistr... | Lookup an ImmutableEndpoint based on its name
@param muleContext
@param endpointName
@return
@throws IOException | [
"Lookup",
"an",
"ImmutableEndpoint",
"based",
"on",
"its",
"name"
] | train | https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/util/MuleUtil.java#L100-L118 |
strator-dev/greenpepper | greenpepper/extensions/src/main/java/com/greenpepper/runner/repository/VFSRepository.java | VFSRepository.addProvider | public void addProvider(String urlScheme, FileProvider provider) throws FileSystemException
{
((DefaultFileSystemManager)fileSystemManager).addProvider(urlScheme, provider);
} | java | public void addProvider(String urlScheme, FileProvider provider) throws FileSystemException
{
((DefaultFileSystemManager)fileSystemManager).addProvider(urlScheme, provider);
} | [
"public",
"void",
"addProvider",
"(",
"String",
"urlScheme",
",",
"FileProvider",
"provider",
")",
"throws",
"FileSystemException",
"{",
"(",
"(",
"DefaultFileSystemManager",
")",
"fileSystemManager",
")",
".",
"addProvider",
"(",
"urlScheme",
",",
"provider",
")",
... | For testing purpose of new VFS providers (eg. Confluence, ...)
@param urlScheme a {@link java.lang.String} object.
@param provider a {@link org.apache.commons.vfs.provider.FileProvider} object.
@throws org.apache.commons.vfs.FileSystemException if any. | [
"For",
"testing",
"purpose",
"of",
"new",
"VFS",
"providers",
"(",
"eg",
".",
"Confluence",
"...",
")"
] | train | https://github.com/strator-dev/greenpepper/blob/2a61e6c179b74085babcc559d677490b0cad2d30/greenpepper/extensions/src/main/java/com/greenpepper/runner/repository/VFSRepository.java#L127-L130 |
zaproxy/zaproxy | src/org/parosproxy/paros/view/AbstractParamContainerPanel.java | AbstractParamContainerPanel.getPanelHeadline | private JPanel getPanelHeadline() {
if (panelHeadline == null) {
panelHeadline = new JPanel();
panelHeadline.setLayout(new BorderLayout(0, 0));
txtHeadline = getTxtHeadline();
panelHeadline.add(txtHeadline, BorderLayout.CENTER);
JButton button = getHelpButton();
panelHeadline.add(button, BorderLayout.EAST);
}
return panelHeadline;
} | java | private JPanel getPanelHeadline() {
if (panelHeadline == null) {
panelHeadline = new JPanel();
panelHeadline.setLayout(new BorderLayout(0, 0));
txtHeadline = getTxtHeadline();
panelHeadline.add(txtHeadline, BorderLayout.CENTER);
JButton button = getHelpButton();
panelHeadline.add(button, BorderLayout.EAST);
}
return panelHeadline;
} | [
"private",
"JPanel",
"getPanelHeadline",
"(",
")",
"{",
"if",
"(",
"panelHeadline",
"==",
"null",
")",
"{",
"panelHeadline",
"=",
"new",
"JPanel",
"(",
")",
";",
"panelHeadline",
".",
"setLayout",
"(",
"new",
"BorderLayout",
"(",
"0",
",",
"0",
")",
")",... | Gets the headline panel, that shows the name of the (selected) panel and has the help button.
@return the headline panel, never {@code null}.
@see #getTxtHeadline()
@see #getHelpButton() | [
"Gets",
"the",
"headline",
"panel",
"that",
"shows",
"the",
"name",
"of",
"the",
"(",
"selected",
")",
"panel",
"and",
"has",
"the",
"help",
"button",
"."
] | train | https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/parosproxy/paros/view/AbstractParamContainerPanel.java#L268-L281 |
google/error-prone-javac | src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java | ElementScanner9.visitModule | @Override
public R visitModule(ModuleElement e, P p) {
return scan(e.getEnclosedElements(), p); // TODO: Hmmm, this might not be right
} | java | @Override
public R visitModule(ModuleElement e, P p) {
return scan(e.getEnclosedElements(), p); // TODO: Hmmm, this might not be right
} | [
"@",
"Override",
"public",
"R",
"visitModule",
"(",
"ModuleElement",
"e",
",",
"P",
"p",
")",
"{",
"return",
"scan",
"(",
"e",
".",
"getEnclosedElements",
"(",
")",
",",
"p",
")",
";",
"// TODO: Hmmm, this might not be right",
"}"
] | Visits a {@code ModuleElement} by scanning the enclosed
elements.
@param e the element to visit
@param p a visitor-specified parameter
@return the result of the scan | [
"Visits",
"a",
"{",
"@code",
"ModuleElement",
"}",
"by",
"scanning",
"the",
"enclosed",
"elements",
"."
] | train | https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner9.java#L121-L124 |
apache/incubator-gobblin | gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/FlowGraphPath.java | FlowGraphPath.updateJobDependencies | private void updateJobDependencies(List<JobExecutionPlan> jobExecutionPlans, Map<String, String> templateToJobNameMap) {
for (JobExecutionPlan jobExecutionPlan: jobExecutionPlans) {
JobSpec jobSpec = jobExecutionPlan.getJobSpec();
List<String> updatedDependenciesList = new ArrayList<>();
if (jobSpec.getConfig().hasPath(ConfigurationKeys.JOB_DEPENDENCIES)) {
for (String dependency : ConfigUtils.getStringList(jobSpec.getConfig(), ConfigurationKeys.JOB_DEPENDENCIES)) {
if (!templateToJobNameMap.containsKey(dependency)) {
//We should never hit this condition. The logic here is a safety check.
throw new RuntimeException("TemplateToJobNameMap does not contain dependency " + dependency);
}
updatedDependenciesList.add(templateToJobNameMap.get(dependency));
}
String updatedDependencies = Joiner.on(",").join(updatedDependenciesList);
jobSpec.setConfig(jobSpec.getConfig().withValue(ConfigurationKeys.JOB_DEPENDENCIES, ConfigValueFactory.fromAnyRef(updatedDependencies)));
}
}
} | java | private void updateJobDependencies(List<JobExecutionPlan> jobExecutionPlans, Map<String, String> templateToJobNameMap) {
for (JobExecutionPlan jobExecutionPlan: jobExecutionPlans) {
JobSpec jobSpec = jobExecutionPlan.getJobSpec();
List<String> updatedDependenciesList = new ArrayList<>();
if (jobSpec.getConfig().hasPath(ConfigurationKeys.JOB_DEPENDENCIES)) {
for (String dependency : ConfigUtils.getStringList(jobSpec.getConfig(), ConfigurationKeys.JOB_DEPENDENCIES)) {
if (!templateToJobNameMap.containsKey(dependency)) {
//We should never hit this condition. The logic here is a safety check.
throw new RuntimeException("TemplateToJobNameMap does not contain dependency " + dependency);
}
updatedDependenciesList.add(templateToJobNameMap.get(dependency));
}
String updatedDependencies = Joiner.on(",").join(updatedDependenciesList);
jobSpec.setConfig(jobSpec.getConfig().withValue(ConfigurationKeys.JOB_DEPENDENCIES, ConfigValueFactory.fromAnyRef(updatedDependencies)));
}
}
} | [
"private",
"void",
"updateJobDependencies",
"(",
"List",
"<",
"JobExecutionPlan",
">",
"jobExecutionPlans",
",",
"Map",
"<",
"String",
",",
"String",
">",
"templateToJobNameMap",
")",
"{",
"for",
"(",
"JobExecutionPlan",
"jobExecutionPlan",
":",
"jobExecutionPlans",
... | A method to modify the {@link ConfigurationKeys#JOB_DEPENDENCIES} specified in a {@link JobTemplate} to those
which are usable in a {@link JobSpec}.
The {@link ConfigurationKeys#JOB_DEPENDENCIES} specified in a JobTemplate use the JobTemplate names
(i.e. the file names of the templates without the extension). However, the same {@link FlowTemplate} may be used
across multiple {@link FlowEdge}s. To ensure that we capture dependencies between jobs correctly as Dags from
successive hops are merged, we translate the {@link JobTemplate} name specified in the dependencies config to
{@link ConfigurationKeys#JOB_NAME_KEY} from the corresponding {@link JobSpec}, which is guaranteed to be globally unique.
For example, consider a {@link JobTemplate} with URI job1.job which has "job.dependencies=job2,job3" (where job2.job and job3.job are
URIs of other {@link JobTemplate}s). Also, let the job.name config for the three jobs (after {@link JobSpec} is compiled) be as follows:
"job.name=flowgrp1_flowName1_jobName1_1111", "job.name=flowgrp1_flowName1_jobName2_1121", and "job.name=flowgrp1_flowName1_jobName3_1131". Then,
for job1, this method will set "job.dependencies=flowgrp1_flowName1_jobName2_1121, flowgrp1_flowName1_jobName3_1131".
@param jobExecutionPlans a list of {@link JobExecutionPlan}s
@param templateToJobNameMap a HashMap that has the mapping from the {@link JobTemplate} names to job.name in corresponding
{@link JobSpec} | [
"A",
"method",
"to",
"modify",
"the",
"{"
] | train | https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-service/src/main/java/org/apache/gobblin/service/modules/flow/FlowGraphPath.java#L198-L214 |
aws/aws-sdk-java | aws-java-sdk-sts/src/main/java/com/amazonaws/auth/SessionCredentialsProviderFactory.java | SessionCredentialsProviderFactory.getSessionCredentialsProvider | public static synchronized STSSessionCredentialsProvider getSessionCredentialsProvider(AWSCredentials longTermCredentials,
String serviceEndpoint,
ClientConfiguration stsClientConfiguration) {
Key key = new Key(longTermCredentials.getAWSAccessKeyId(), serviceEndpoint);
if ( !cache.containsKey(key) ) {
cache.put(key, new STSSessionCredentialsProvider(longTermCredentials, stsClientConfiguration));
}
return cache.get(key);
} | java | public static synchronized STSSessionCredentialsProvider getSessionCredentialsProvider(AWSCredentials longTermCredentials,
String serviceEndpoint,
ClientConfiguration stsClientConfiguration) {
Key key = new Key(longTermCredentials.getAWSAccessKeyId(), serviceEndpoint);
if ( !cache.containsKey(key) ) {
cache.put(key, new STSSessionCredentialsProvider(longTermCredentials, stsClientConfiguration));
}
return cache.get(key);
} | [
"public",
"static",
"synchronized",
"STSSessionCredentialsProvider",
"getSessionCredentialsProvider",
"(",
"AWSCredentials",
"longTermCredentials",
",",
"String",
"serviceEndpoint",
",",
"ClientConfiguration",
"stsClientConfiguration",
")",
"{",
"Key",
"key",
"=",
"new",
"Key... | Gets a session credentials provider for the long-term credentials and
service endpoint given. These are shared globally to support reuse of
session tokens.
@param longTermCredentials
The long-term AWS account credentials used to initiate a
session.
@param serviceEndpoint
The service endpoint for the service the session credentials
will be used to access.
@param stsClientConfiguration
Client configuration for the {@link AWSSecurityTokenService}
used to fetch session credentials. | [
"Gets",
"a",
"session",
"credentials",
"provider",
"for",
"the",
"long",
"-",
"term",
"credentials",
"and",
"service",
"endpoint",
"given",
".",
"These",
"are",
"shared",
"globally",
"to",
"support",
"reuse",
"of",
"session",
"tokens",
"."
] | train | https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-sts/src/main/java/com/amazonaws/auth/SessionCredentialsProviderFactory.java#L91-L99 |
infinispan/infinispan | core/src/main/java/org/infinispan/jmx/ComponentsJmxRegistration.java | ComponentsJmxRegistration.unregisterMBeans | public void unregisterMBeans(Collection<ResourceDMBean> resourceDMBeans) throws CacheException {
log.trace("Unregistering jmx resources..");
try {
for (ResourceDMBean resource : resourceDMBeans) {
JmxUtil.unregisterMBean(getObjectName(resource), mBeanServer);
}
}
catch (Exception e) {
throw new CacheException("Failure while unregistering mbeans", e);
}
} | java | public void unregisterMBeans(Collection<ResourceDMBean> resourceDMBeans) throws CacheException {
log.trace("Unregistering jmx resources..");
try {
for (ResourceDMBean resource : resourceDMBeans) {
JmxUtil.unregisterMBean(getObjectName(resource), mBeanServer);
}
}
catch (Exception e) {
throw new CacheException("Failure while unregistering mbeans", e);
}
} | [
"public",
"void",
"unregisterMBeans",
"(",
"Collection",
"<",
"ResourceDMBean",
">",
"resourceDMBeans",
")",
"throws",
"CacheException",
"{",
"log",
".",
"trace",
"(",
"\"Unregistering jmx resources..\"",
")",
";",
"try",
"{",
"for",
"(",
"ResourceDMBean",
"resource... | Unregisters all the MBeans registered through {@link #registerMBeans(Collection)}.
@param resourceDMBeans | [
"Unregisters",
"all",
"the",
"MBeans",
"registered",
"through",
"{"
] | train | https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/jmx/ComponentsJmxRegistration.java#L68-L78 |
google/closure-templates | java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java | GenJsCodeVisitor.addCodeToRequireCss | private static void addCodeToRequireCss(JsDoc.Builder header, SoyFileNode soyFile) {
SortedSet<String> requiredCssNamespaces = new TreeSet<>();
requiredCssNamespaces.addAll(soyFile.getRequiredCssNamespaces());
for (TemplateNode template : soyFile.getChildren()) {
requiredCssNamespaces.addAll(template.getRequiredCssNamespaces());
}
// NOTE: CSS requires in JS can only be done on a file by file basis at this time. Perhaps in
// the future, this might be supported per function.
for (String requiredCssNamespace : requiredCssNamespaces) {
header.addParameterizedAnnotation("requirecss", requiredCssNamespace);
}
} | java | private static void addCodeToRequireCss(JsDoc.Builder header, SoyFileNode soyFile) {
SortedSet<String> requiredCssNamespaces = new TreeSet<>();
requiredCssNamespaces.addAll(soyFile.getRequiredCssNamespaces());
for (TemplateNode template : soyFile.getChildren()) {
requiredCssNamespaces.addAll(template.getRequiredCssNamespaces());
}
// NOTE: CSS requires in JS can only be done on a file by file basis at this time. Perhaps in
// the future, this might be supported per function.
for (String requiredCssNamespace : requiredCssNamespaces) {
header.addParameterizedAnnotation("requirecss", requiredCssNamespace);
}
} | [
"private",
"static",
"void",
"addCodeToRequireCss",
"(",
"JsDoc",
".",
"Builder",
"header",
",",
"SoyFileNode",
"soyFile",
")",
"{",
"SortedSet",
"<",
"String",
">",
"requiredCssNamespaces",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"requiredCssNamespaces",
".... | Appends requirecss jsdoc tags in the file header section.
@param soyFile The file with the templates.. | [
"Appends",
"requirecss",
"jsdoc",
"tags",
"in",
"the",
"file",
"header",
"section",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java#L487-L500 |
comapi/comapi-chat-sdk-android | COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java | PersistenceController.updateConversations | public Observable<Boolean> updateConversations(List<ChatConversation> conversationsToUpdate) {
return asObservable(new Executor<Boolean>() {
@Override
void execute(ChatStore store, Emitter<Boolean> emitter) {
store.beginTransaction();
boolean isSuccess = true;
for (ChatConversationBase conversation : conversationsToUpdate) {
ChatConversationBase.Builder toSave = ChatConversationBase.baseBuilder();
ChatConversationBase saved = store.getConversation(conversation.getConversationId());
if (saved != null) {
toSave.setConversationId(saved.getConversationId());
toSave.setFirstLocalEventId(saved.getFirstLocalEventId());
toSave.setLastLocalEventId(saved.getLastLocalEventId());
if (conversation.getLastRemoteEventId() == null) {
toSave.setLastRemoteEventId(saved.getLastRemoteEventId());
} else {
toSave.setLastRemoteEventId(Math.max(saved.getLastRemoteEventId(), conversation.getLastRemoteEventId()));
}
if (conversation.getUpdatedOn() == null) {
toSave.setUpdatedOn(System.currentTimeMillis());
} else {
toSave.setUpdatedOn(conversation.getUpdatedOn());
}
toSave.setETag(conversation.getETag());
}
isSuccess = isSuccess && store.update(toSave.build());
}
store.endTransaction();
emitter.onNext(isSuccess);
emitter.onCompleted();
}
});
} | java | public Observable<Boolean> updateConversations(List<ChatConversation> conversationsToUpdate) {
return asObservable(new Executor<Boolean>() {
@Override
void execute(ChatStore store, Emitter<Boolean> emitter) {
store.beginTransaction();
boolean isSuccess = true;
for (ChatConversationBase conversation : conversationsToUpdate) {
ChatConversationBase.Builder toSave = ChatConversationBase.baseBuilder();
ChatConversationBase saved = store.getConversation(conversation.getConversationId());
if (saved != null) {
toSave.setConversationId(saved.getConversationId());
toSave.setFirstLocalEventId(saved.getFirstLocalEventId());
toSave.setLastLocalEventId(saved.getLastLocalEventId());
if (conversation.getLastRemoteEventId() == null) {
toSave.setLastRemoteEventId(saved.getLastRemoteEventId());
} else {
toSave.setLastRemoteEventId(Math.max(saved.getLastRemoteEventId(), conversation.getLastRemoteEventId()));
}
if (conversation.getUpdatedOn() == null) {
toSave.setUpdatedOn(System.currentTimeMillis());
} else {
toSave.setUpdatedOn(conversation.getUpdatedOn());
}
toSave.setETag(conversation.getETag());
}
isSuccess = isSuccess && store.update(toSave.build());
}
store.endTransaction();
emitter.onNext(isSuccess);
emitter.onCompleted();
}
});
} | [
"public",
"Observable",
"<",
"Boolean",
">",
"updateConversations",
"(",
"List",
"<",
"ChatConversation",
">",
"conversationsToUpdate",
")",
"{",
"return",
"asObservable",
"(",
"new",
"Executor",
"<",
"Boolean",
">",
"(",
")",
"{",
"@",
"Override",
"void",
"ex... | Update conversations.
@param conversationsToUpdate List of conversations to apply an update.
@return Observable emitting result. | [
"Update",
"conversations",
"."
] | train | https://github.com/comapi/comapi-chat-sdk-android/blob/388f37bfacb7793ce30c92ab70e5f32848bbe460/COMAPI/chat/src/main/java/com/comapi/chat/PersistenceController.java#L497-L537 |
google/closure-templates | java/src/com/google/template/soy/pysrc/internal/TranslateToPyExprVisitor.java | TranslateToPyExprVisitor.genTernaryConditional | private PyExpr genTernaryConditional(PyExpr conditionalExpr, PyExpr trueExpr, PyExpr falseExpr) {
// Python's ternary operator switches the order from <conditional> ? <true> : <false> to
// <true> if <conditional> else <false>.
int conditionalPrecedence = PyExprUtils.pyPrecedenceForOperator(Operator.CONDITIONAL);
StringBuilder exprSb =
new StringBuilder()
.append(PyExprUtils.maybeProtect(trueExpr, conditionalPrecedence).getText())
.append(" if ")
.append(PyExprUtils.maybeProtect(conditionalExpr, conditionalPrecedence).getText())
.append(" else ")
.append(PyExprUtils.maybeProtect(falseExpr, conditionalPrecedence).getText());
return new PyExpr(exprSb.toString(), conditionalPrecedence);
} | java | private PyExpr genTernaryConditional(PyExpr conditionalExpr, PyExpr trueExpr, PyExpr falseExpr) {
// Python's ternary operator switches the order from <conditional> ? <true> : <false> to
// <true> if <conditional> else <false>.
int conditionalPrecedence = PyExprUtils.pyPrecedenceForOperator(Operator.CONDITIONAL);
StringBuilder exprSb =
new StringBuilder()
.append(PyExprUtils.maybeProtect(trueExpr, conditionalPrecedence).getText())
.append(" if ")
.append(PyExprUtils.maybeProtect(conditionalExpr, conditionalPrecedence).getText())
.append(" else ")
.append(PyExprUtils.maybeProtect(falseExpr, conditionalPrecedence).getText());
return new PyExpr(exprSb.toString(), conditionalPrecedence);
} | [
"private",
"PyExpr",
"genTernaryConditional",
"(",
"PyExpr",
"conditionalExpr",
",",
"PyExpr",
"trueExpr",
",",
"PyExpr",
"falseExpr",
")",
"{",
"// Python's ternary operator switches the order from <conditional> ? <true> : <false> to",
"// <true> if <conditional> else <false>.",
"in... | Generates a ternary conditional Python expression given the conditional and true/false
expressions.
@param conditionalExpr the conditional expression
@param trueExpr the expression to execute if the conditional executes to true
@param falseExpr the expression to execute if the conditional executes to false
@return a ternary conditional expression | [
"Generates",
"a",
"ternary",
"conditional",
"Python",
"expression",
"given",
"the",
"conditional",
"and",
"true",
"/",
"false",
"expressions",
"."
] | train | https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/pysrc/internal/TranslateToPyExprVisitor.java#L657-L670 |
briandilley/jsonrpc4j | src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java | JsonRpcBasicServer.writeAndFlushValue | private void writeAndFlushValue(OutputStream output, ObjectNode value) throws IOException {
logger.debug("Response: {}", value);
for (JsonRpcInterceptor interceptor : interceptorList) {
interceptor.postHandleJson(value);
}
mapper.writeValue(new NoCloseOutputStream(output), value);
output.write('\n');
} | java | private void writeAndFlushValue(OutputStream output, ObjectNode value) throws IOException {
logger.debug("Response: {}", value);
for (JsonRpcInterceptor interceptor : interceptorList) {
interceptor.postHandleJson(value);
}
mapper.writeValue(new NoCloseOutputStream(output), value);
output.write('\n');
} | [
"private",
"void",
"writeAndFlushValue",
"(",
"OutputStream",
"output",
",",
"ObjectNode",
"value",
")",
"throws",
"IOException",
"{",
"logger",
".",
"debug",
"(",
"\"Response: {}\"",
",",
"value",
")",
";",
"for",
"(",
"JsonRpcInterceptor",
"interceptor",
":",
... | Writes and flushes a value to the given {@link OutputStream}
and prevents Jackson from closing it. Also writes newline.
@param output the {@link OutputStream}
@param value the value to write
@throws IOException on error | [
"Writes",
"and",
"flushes",
"a",
"value",
"to",
"the",
"given",
"{",
"@link",
"OutputStream",
"}",
"and",
"prevents",
"Jackson",
"from",
"closing",
"it",
".",
"Also",
"writes",
"newline",
"."
] | train | https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcBasicServer.java#L866-L874 |
lucee/Lucee | core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java | XMLConfigAdmin.updateCustomTag | public void updateCustomTag(String virtual, String physical, String archive, String primary, short inspect) throws ExpressionException, SecurityException {
checkWriteAccess();
_updateCustomTag(virtual, physical, archive, primary, inspect);
} | java | public void updateCustomTag(String virtual, String physical, String archive, String primary, short inspect) throws ExpressionException, SecurityException {
checkWriteAccess();
_updateCustomTag(virtual, physical, archive, primary, inspect);
} | [
"public",
"void",
"updateCustomTag",
"(",
"String",
"virtual",
",",
"String",
"physical",
",",
"String",
"archive",
",",
"String",
"primary",
",",
"short",
"inspect",
")",
"throws",
"ExpressionException",
",",
"SecurityException",
"{",
"checkWriteAccess",
"(",
")"... | insert or update a mapping for Custom Tag
@param virtual
@param physical
@param archive
@param primary
@param trusted
@throws ExpressionException
@throws SecurityException | [
"insert",
"or",
"update",
"a",
"mapping",
"for",
"Custom",
"Tag"
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/config/XMLConfigAdmin.java#L867-L870 |
jalkanen/speed4j | src/main/java/com/ecyrd/speed4j/util/Percentile.java | Percentile.evaluate | public double evaluate(final double[] values, final double p) {
test(values, 0, 0);
return evaluate(values, 0, values.length, p);
} | java | public double evaluate(final double[] values, final double p) {
test(values, 0, 0);
return evaluate(values, 0, values.length, p);
} | [
"public",
"double",
"evaluate",
"(",
"final",
"double",
"[",
"]",
"values",
",",
"final",
"double",
"p",
")",
"{",
"test",
"(",
"values",
",",
"0",
",",
"0",
")",
";",
"return",
"evaluate",
"(",
"values",
",",
"0",
",",
"values",
".",
"length",
","... | Returns an estimate of the <code>p</code>th percentile of the values
in the <code>values</code> array.
<p>
Calls to this method do not modify the internal <code>quantile</code>
state of this statistic.
<p>
<ul>
<li>Returns <code>Double.NaN</code> if <code>values</code> has length
<code>0</code></li>
<li>Returns (for any value of <code>p</code>) <code>values[0]</code>
if <code>values</code> has length <code>1</code></li>
<li>Throws <code>IllegalArgumentException</code> if <code>values</code>
is null </li>
</ul>
<p>
See {@link Percentile} for a description of the percentile estimation
algorithm used.
@param values input array of values
@param p the percentile value to compute
@return the result of the evaluation or Double.NaN if the array is empty
@throws IllegalArgumentException if <code>values</code> is null | [
"Returns",
"an",
"estimate",
"of",
"the",
"<code",
">",
"p<",
"/",
"code",
">",
"th",
"percentile",
"of",
"the",
"values",
"in",
"the",
"<code",
">",
"values<",
"/",
"code",
">",
"array",
".",
"<p",
">",
"Calls",
"to",
"this",
"method",
"do",
"not",
... | train | https://github.com/jalkanen/speed4j/blob/1d2db9c9b9def869c25fedb9bbd7cf95c39023bd/src/main/java/com/ecyrd/speed4j/util/Percentile.java#L127-L130 |
ironjacamar/ironjacamar | validator/src/main/java/org/ironjacamar/validator/Validation.java | Validation.createResourceAdapter | private static List<Validate> createResourceAdapter(Connector cmd,
List<Failure> failures, ResourceBundle rb, ClassLoader cl)
{
List<Validate> result = new ArrayList<Validate>();
if (cmd.getVersion() != Version.V_10 && cmd.getResourceadapter() != null &&
cmd.getResourceadapter().getResourceadapterClass() != null)
{
try
{
Class<?> clazz = Class.forName(cmd.getResourceadapter().getResourceadapterClass(),
true, cl);
List<ConfigProperty> configProperties = cmd.getResourceadapter().getConfigProperties();
ValidateClass vc = new ValidateClass(Key.RESOURCE_ADAPTER, clazz, configProperties);
result.add(vc);
}
catch (ClassNotFoundException e)
{
Failure failure = new Failure(Severity.ERROR,
rb.getString("uncategorized"),
rb.getString("ra.cnfe"),
e.getMessage());
failures.add(failure);
}
}
return result;
} | java | private static List<Validate> createResourceAdapter(Connector cmd,
List<Failure> failures, ResourceBundle rb, ClassLoader cl)
{
List<Validate> result = new ArrayList<Validate>();
if (cmd.getVersion() != Version.V_10 && cmd.getResourceadapter() != null &&
cmd.getResourceadapter().getResourceadapterClass() != null)
{
try
{
Class<?> clazz = Class.forName(cmd.getResourceadapter().getResourceadapterClass(),
true, cl);
List<ConfigProperty> configProperties = cmd.getResourceadapter().getConfigProperties();
ValidateClass vc = new ValidateClass(Key.RESOURCE_ADAPTER, clazz, configProperties);
result.add(vc);
}
catch (ClassNotFoundException e)
{
Failure failure = new Failure(Severity.ERROR,
rb.getString("uncategorized"),
rb.getString("ra.cnfe"),
e.getMessage());
failures.add(failure);
}
}
return result;
} | [
"private",
"static",
"List",
"<",
"Validate",
">",
"createResourceAdapter",
"(",
"Connector",
"cmd",
",",
"List",
"<",
"Failure",
">",
"failures",
",",
"ResourceBundle",
"rb",
",",
"ClassLoader",
"cl",
")",
"{",
"List",
"<",
"Validate",
">",
"result",
"=",
... | createResourceAdapter
@param cmd connector metadata
@param failures list of failures
@param rb ResourceBundle
@param cl classloador
@return list of validate objects | [
"createResourceAdapter"
] | train | https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/validator/src/main/java/org/ironjacamar/validator/Validation.java#L298-L325 |
DDTH/ddth-tsc | ddth-tsc-core/src/main/java/com/github/ddth/tsc/AbstractCounter.java | AbstractCounter.getAllInRange | protected DataPoint[] getAllInRange(long timestampStartMs, long timestampEndMs) {
SortedSet<DataPoint> result = new TreeSet<DataPoint>(new Comparator<DataPoint>() {
@Override
public int compare(DataPoint block1, DataPoint block2) {
return Longs.compare(block1.timestamp(), block2.timestamp());
}
});
long keyStart = toTimeSeriesPoint(timestampStartMs);
long keyEnd = toTimeSeriesPoint(timestampEndMs);
if (keyEnd == timestampStartMs) {
keyEnd = toTimeSeriesPoint(timestampEndMs - 1);
}
for (long timestamp = keyStart, _end = keyEnd; timestamp <= _end; timestamp += RESOLUTION_MS) {
DataPoint block = get(timestamp);
result.add(block);
}
return result.toArray(DataPoint.EMPTY_ARR);
} | java | protected DataPoint[] getAllInRange(long timestampStartMs, long timestampEndMs) {
SortedSet<DataPoint> result = new TreeSet<DataPoint>(new Comparator<DataPoint>() {
@Override
public int compare(DataPoint block1, DataPoint block2) {
return Longs.compare(block1.timestamp(), block2.timestamp());
}
});
long keyStart = toTimeSeriesPoint(timestampStartMs);
long keyEnd = toTimeSeriesPoint(timestampEndMs);
if (keyEnd == timestampStartMs) {
keyEnd = toTimeSeriesPoint(timestampEndMs - 1);
}
for (long timestamp = keyStart, _end = keyEnd; timestamp <= _end; timestamp += RESOLUTION_MS) {
DataPoint block = get(timestamp);
result.add(block);
}
return result.toArray(DataPoint.EMPTY_ARR);
} | [
"protected",
"DataPoint",
"[",
"]",
"getAllInRange",
"(",
"long",
"timestampStartMs",
",",
"long",
"timestampEndMs",
")",
"{",
"SortedSet",
"<",
"DataPoint",
">",
"result",
"=",
"new",
"TreeSet",
"<",
"DataPoint",
">",
"(",
"new",
"Comparator",
"<",
"DataPoint... | Gets all data points in range [{@code timestampStartMs},
{@code timestampEndMs}).
@param timestampStartMs
@param timestampEndMs
@return
@since 0.3.2 | [
"Gets",
"all",
"data",
"points",
"in",
"range",
"[",
"{",
"@code",
"timestampStartMs",
"}",
"{",
"@code",
"timestampEndMs",
"}",
")",
"."
] | train | https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/AbstractCounter.java#L213-L230 |
Netflix/karyon | karyon2-admin-web/src/main/java/netflix/adminresources/tableview/DataTableHelper.java | DataTableHelper.applyQueryParams | private static void applyQueryParams(TableViewResource resource, MultivaluedMap<String, String> queryParams) {
final String allColsSearch = queryParams.getFirst("sSearch");
final String displayStart = queryParams.getFirst("iDisplayStart");
final String displayLen = queryParams.getFirst("iDisplayLength");
String sortColumnIndex = queryParams.getFirst("iSortCol_0");
String sortColumnDir = queryParams.getFirst("sSortDir_0");
if (sortColumnDir == null || sortColumnIndex == null) {
// defaults
sortColumnDir = "asc";
sortColumnIndex = "0";
}
int colIndex = Integer.parseInt(sortColumnIndex);
String sortColumnName = resource.getColumns().get(colIndex);
if (displayLen != null && displayStart != null) {
final int iDisplayLen = Integer.parseInt(displayLen);
final int iDisplayStart = Integer.parseInt(displayStart);
resource.setAllColumnsSearchTerm(allColsSearch)
.setCurrentPageInfo(iDisplayStart, iDisplayLen)
.enableColumnSort(sortColumnName, !(sortColumnDir.equalsIgnoreCase("asc")));
}
} | java | private static void applyQueryParams(TableViewResource resource, MultivaluedMap<String, String> queryParams) {
final String allColsSearch = queryParams.getFirst("sSearch");
final String displayStart = queryParams.getFirst("iDisplayStart");
final String displayLen = queryParams.getFirst("iDisplayLength");
String sortColumnIndex = queryParams.getFirst("iSortCol_0");
String sortColumnDir = queryParams.getFirst("sSortDir_0");
if (sortColumnDir == null || sortColumnIndex == null) {
// defaults
sortColumnDir = "asc";
sortColumnIndex = "0";
}
int colIndex = Integer.parseInt(sortColumnIndex);
String sortColumnName = resource.getColumns().get(colIndex);
if (displayLen != null && displayStart != null) {
final int iDisplayLen = Integer.parseInt(displayLen);
final int iDisplayStart = Integer.parseInt(displayStart);
resource.setAllColumnsSearchTerm(allColsSearch)
.setCurrentPageInfo(iDisplayStart, iDisplayLen)
.enableColumnSort(sortColumnName, !(sortColumnDir.equalsIgnoreCase("asc")));
}
} | [
"private",
"static",
"void",
"applyQueryParams",
"(",
"TableViewResource",
"resource",
",",
"MultivaluedMap",
"<",
"String",
",",
"String",
">",
"queryParams",
")",
"{",
"final",
"String",
"allColsSearch",
"=",
"queryParams",
".",
"getFirst",
"(",
"\"sSearch\"",
"... | apply pagination, search, sort params
<p/>
Sample query from DataTables -
sEcho=1&iColumns=2&sColumns=&iDisplayStart=0&iDisplayLength=25&mDataProp_0=0&mDataProp_1=1&sSearch=&
bRegex=false&sSearch_0=&bRegex_0=false&bSearchable_0=true&sSearch_1=&bRegex_1=false&bSearchable_1=true&
iSortingCols=1&iSortCol_0=0&sSortDir_0=asc&bSortable_0=true&bSortable_1=true | [
"apply",
"pagination",
"search",
"sort",
"params",
"<p",
"/",
">",
"Sample",
"query",
"from",
"DataTables",
"-",
"sEcho",
"=",
"1&iColumns",
"=",
"2&sColumns",
"=",
"&iDisplayStart",
"=",
"0&iDisplayLength",
"=",
"25&mDataProp_0",
"=",
"0&mDataProp_1",
"=",
"1&s... | train | https://github.com/Netflix/karyon/blob/d50bc0ff37693ef3fbda373e90a109d1f92e0b9a/karyon2-admin-web/src/main/java/netflix/adminresources/tableview/DataTableHelper.java#L31-L56 |
BorderTech/wcomponents | wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/WServlet.java | WServlet.createServletHelper | protected WServletHelper createServletHelper(final HttpServletRequest httpServletRequest,
final HttpServletResponse httpServletResponse) {
LOG.debug("Creating a new WServletHelper instance");
WServletHelper helper = new WServletHelper(this, httpServletRequest, httpServletResponse);
return helper;
} | java | protected WServletHelper createServletHelper(final HttpServletRequest httpServletRequest,
final HttpServletResponse httpServletResponse) {
LOG.debug("Creating a new WServletHelper instance");
WServletHelper helper = new WServletHelper(this, httpServletRequest, httpServletResponse);
return helper;
} | [
"protected",
"WServletHelper",
"createServletHelper",
"(",
"final",
"HttpServletRequest",
"httpServletRequest",
",",
"final",
"HttpServletResponse",
"httpServletResponse",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Creating a new WServletHelper instance\"",
")",
";",
"WServletHel... | Create a support class to coordinate the web request.
@param httpServletRequest the request being processed
@param httpServletResponse the servlet response
@return the servlet helper | [
"Create",
"a",
"support",
"class",
"to",
"coordinate",
"the",
"web",
"request",
"."
] | train | https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/servlet/WServlet.java#L189-L194 |
sjamesr/jfreesane | src/main/java/au/com/southsky/jfreesane/SaneSession.java | SaneSession.withRemoteSane | public static SaneSession withRemoteSane(InetAddress saneAddress, long timeout, TimeUnit timeUnit)
throws IOException {
return withRemoteSane(saneAddress, DEFAULT_PORT, timeout, timeUnit, 0, TimeUnit.MILLISECONDS);
} | java | public static SaneSession withRemoteSane(InetAddress saneAddress, long timeout, TimeUnit timeUnit)
throws IOException {
return withRemoteSane(saneAddress, DEFAULT_PORT, timeout, timeUnit, 0, TimeUnit.MILLISECONDS);
} | [
"public",
"static",
"SaneSession",
"withRemoteSane",
"(",
"InetAddress",
"saneAddress",
",",
"long",
"timeout",
",",
"TimeUnit",
"timeUnit",
")",
"throws",
"IOException",
"{",
"return",
"withRemoteSane",
"(",
"saneAddress",
",",
"DEFAULT_PORT",
",",
"timeout",
",",
... | Establishes a connection to the SANE daemon running on the given host on the default SANE port
with the given connection timeout. | [
"Establishes",
"a",
"connection",
"to",
"the",
"SANE",
"daemon",
"running",
"on",
"the",
"given",
"host",
"on",
"the",
"default",
"SANE",
"port",
"with",
"the",
"given",
"connection",
"timeout",
"."
] | train | https://github.com/sjamesr/jfreesane/blob/15ad0f73df0a8d0efec5167a2141cbd53afd862d/src/main/java/au/com/southsky/jfreesane/SaneSession.java#L77-L80 |
Netflix/eureka | eureka-client/src/main/java/com/netflix/discovery/shared/Applications.java | Applications.populateInstanceCountMap | public void populateInstanceCountMap(Map<String, AtomicInteger> instanceCountMap) {
for (Application app : this.getRegisteredApplications()) {
for (InstanceInfo info : app.getInstancesAsIsFromEureka()) {
AtomicInteger instanceCount = instanceCountMap.computeIfAbsent(info.getStatus().name(),
k -> new AtomicInteger(0));
instanceCount.incrementAndGet();
}
}
} | java | public void populateInstanceCountMap(Map<String, AtomicInteger> instanceCountMap) {
for (Application app : this.getRegisteredApplications()) {
for (InstanceInfo info : app.getInstancesAsIsFromEureka()) {
AtomicInteger instanceCount = instanceCountMap.computeIfAbsent(info.getStatus().name(),
k -> new AtomicInteger(0));
instanceCount.incrementAndGet();
}
}
} | [
"public",
"void",
"populateInstanceCountMap",
"(",
"Map",
"<",
"String",
",",
"AtomicInteger",
">",
"instanceCountMap",
")",
"{",
"for",
"(",
"Application",
"app",
":",
"this",
".",
"getRegisteredApplications",
"(",
")",
")",
"{",
"for",
"(",
"InstanceInfo",
"... | Populates the provided instance count map. The instance count map is used
as part of the general app list synchronization mechanism.
@param instanceCountMap
the map to populate | [
"Populates",
"the",
"provided",
"instance",
"count",
"map",
".",
"The",
"instance",
"count",
"map",
"is",
"used",
"as",
"part",
"of",
"the",
"general",
"app",
"list",
"synchronization",
"mechanism",
"."
] | train | https://github.com/Netflix/eureka/blob/48446d956be09df6650a3c00b7ebd7e2d1e1544f/eureka-client/src/main/java/com/netflix/discovery/shared/Applications.java#L246-L254 |
ModeShape/modeshape | modeshape-jcr/src/main/java/org/modeshape/jcr/value/binary/DatabaseBinaryStore.java | DatabaseBinaryStore.getInputStream | @Override
public InputStream getInputStream( BinaryKey key ) throws BinaryStoreException {
Connection connection = newConnection();
try {
InputStream inputStream = database.readContent(key, connection);
if (inputStream == null) {
// if we didn't find anything, the connection should've been closed already
throw new BinaryStoreException(JcrI18n.unableToFindBinaryValue.text(key, database.getTableName()));
}
// the connection & statement will be left open until the stream is closed !
return inputStream;
} catch (SQLException e) {
throw new BinaryStoreException(e);
}
} | java | @Override
public InputStream getInputStream( BinaryKey key ) throws BinaryStoreException {
Connection connection = newConnection();
try {
InputStream inputStream = database.readContent(key, connection);
if (inputStream == null) {
// if we didn't find anything, the connection should've been closed already
throw new BinaryStoreException(JcrI18n.unableToFindBinaryValue.text(key, database.getTableName()));
}
// the connection & statement will be left open until the stream is closed !
return inputStream;
} catch (SQLException e) {
throw new BinaryStoreException(e);
}
} | [
"@",
"Override",
"public",
"InputStream",
"getInputStream",
"(",
"BinaryKey",
"key",
")",
"throws",
"BinaryStoreException",
"{",
"Connection",
"connection",
"=",
"newConnection",
"(",
")",
";",
"try",
"{",
"InputStream",
"inputStream",
"=",
"database",
".",
"readC... | @inheritDoc
In addition to the generic contract from {@link BinaryStore}, this implementation will use a database connection to read
the contents of a binary stream from the database. If such a stream cannot be found or an unexpected exception occurs,
the connection is always closed.
<p/>
However, if the content is found in the database, the {@link Connection} <b>is not closed</b> until the {@code InputStream}
is closed because otherwise actual streaming from the database could not be possible. | [
"@inheritDoc"
] | train | https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/modeshape-jcr/src/main/java/org/modeshape/jcr/value/binary/DatabaseBinaryStore.java#L216-L230 |
rjeschke/txtmark | src/main/java/com/github/rjeschke/txtmark/Utils.java | Utils.skipSpaces | public final static int skipSpaces(final String in, final int start)
{
int pos = start;
while (pos < in.length() && (in.charAt(pos) == ' ' || in.charAt(pos) == '\n'))
{
pos++;
}
return pos < in.length() ? pos : -1;
} | java | public final static int skipSpaces(final String in, final int start)
{
int pos = start;
while (pos < in.length() && (in.charAt(pos) == ' ' || in.charAt(pos) == '\n'))
{
pos++;
}
return pos < in.length() ? pos : -1;
} | [
"public",
"final",
"static",
"int",
"skipSpaces",
"(",
"final",
"String",
"in",
",",
"final",
"int",
"start",
")",
"{",
"int",
"pos",
"=",
"start",
";",
"while",
"(",
"pos",
"<",
"in",
".",
"length",
"(",
")",
"&&",
"(",
"in",
".",
"charAt",
"(",
... | Skips spaces in the given String.
@param in
Input String.
@param start
Starting position.
@return The new position or -1 if EOL has been reached. | [
"Skips",
"spaces",
"in",
"the",
"given",
"String",
"."
] | train | https://github.com/rjeschke/txtmark/blob/108cee6b209a362843729c032c2d982625d12d98/src/main/java/com/github/rjeschke/txtmark/Utils.java#L47-L55 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.