repository_name stringlengths 7 58 | func_path_in_repository stringlengths 11 204 | func_name stringlengths 5 103 | whole_func_string stringlengths 87 3.44k | language stringclasses 1
value | func_code_string stringlengths 87 3.44k | func_code_tokens listlengths 21 714 | func_documentation_string stringlengths 61 1.95k | func_documentation_tokens listlengths 1 482 | split_name stringclasses 1
value | func_code_url stringlengths 102 309 |
|---|---|---|---|---|---|---|---|---|---|---|
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java | MenuExtensions.setAccelerator | public static void setAccelerator(final JMenuItem jmi, final int keyCode, final int modifiers)
{
jmi.setAccelerator(KeyStroke.getKeyStroke(keyCode, modifiers));
} | java | public static void setAccelerator(final JMenuItem jmi, final int keyCode, final int modifiers)
{
jmi.setAccelerator(KeyStroke.getKeyStroke(keyCode, modifiers));
} | [
"public",
"static",
"void",
"setAccelerator",
"(",
"final",
"JMenuItem",
"jmi",
",",
"final",
"int",
"keyCode",
",",
"final",
"int",
"modifiers",
")",
"{",
"jmi",
".",
"setAccelerator",
"(",
"KeyStroke",
".",
"getKeyStroke",
"(",
"keyCode",
",",
"modifiers",
... | Sets the accelerator for the given menuitem and the given key code and the given modifiers.
@param jmi
The JMenuItem.
@param keyCode
the key code
@param modifiers
the modifiers | [
"Sets",
"the",
"accelerator",
"for",
"the",
"given",
"menuitem",
"and",
"the",
"given",
"key",
"code",
"and",
"the",
"given",
"modifiers",
"."
] | train | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java#L77-L80 |
google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java | NodeSet.addNodes | public void addNodes(NodeSet ns)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
addNodes((NodeIterator) ns);
} | java | public void addNodes(NodeSet ns)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
addNodes((NodeIterator) ns);
} | [
"public",
"void",
"addNodes",
"(",
"NodeSet",
"ns",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER_NODESET_NOT_MUTABLE",
",",
"null",
")",
")",
... | <p>Copy NodeList members into this nodelist, adding in
document order. Only genuine node references will be copied;
nulls appearing in the source NodeSet will
not be added to this one. </p>
<p> In case you're wondering why this function is needed: NodeSet
implements both NodeIterator and NodeList. If this method isn't
provided, Java can't decide which of those to use when addNodes()
is invoked. Providing the more-explicit match avoids that
ambiguity.)</p>
@param ns NodeSet whose members should be merged into this NodeSet.
@throws RuntimeException thrown if this NodeSet is not of
a mutable type. | [
"<p",
">",
"Copy",
"NodeList",
"members",
"into",
"this",
"nodelist",
"adding",
"in",
"document",
"order",
".",
"Only",
"genuine",
"node",
"references",
"will",
"be",
"copied",
";",
"nulls",
"appearing",
"in",
"the",
"source",
"NodeSet",
"will",
"not",
"be",... | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L471-L478 |
nmorel/gwt-jackson | gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonDeserializer.java | JsonDeserializer.deserializeNullValue | protected T deserializeNullValue( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params ) {
reader.skipValue();
return null;
} | java | protected T deserializeNullValue( JsonReader reader, JsonDeserializationContext ctx, JsonDeserializerParameters params ) {
reader.skipValue();
return null;
} | [
"protected",
"T",
"deserializeNullValue",
"(",
"JsonReader",
"reader",
",",
"JsonDeserializationContext",
"ctx",
",",
"JsonDeserializerParameters",
"params",
")",
"{",
"reader",
".",
"skipValue",
"(",
")",
";",
"return",
"null",
";",
"}"
] | Deserialize the null value. This method allows children to override the default behaviour.
@param reader {@link JsonReader} used to read the JSON input
@param ctx Context for the full deserialization process
@param params Parameters for this deserialization
@return the deserialized object | [
"Deserialize",
"the",
"null",
"value",
".",
"This",
"method",
"allows",
"children",
"to",
"override",
"the",
"default",
"behaviour",
"."
] | train | https://github.com/nmorel/gwt-jackson/blob/3fdc4350a27a9b64fc437d5fe516bf9191b74824/gwt-jackson/src/main/java/com/github/nmorel/gwtjackson/client/JsonDeserializer.java#L68-L71 |
Samsung/GearVRf | GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java | GVRPose.setWorldMatrix | public void setWorldMatrix(int boneindex, Matrix4f mtx)
{
Bone bone = mBones[boneindex];
bone.WorldMatrix.set(mtx);
if (mSkeleton.getParentBoneIndex(boneindex) >= 0)
{
calcLocal(bone, mSkeleton.getParentBoneIndex(boneindex));
}
else
{
bone.LocalMatrix.set(mtx);
}
mNeedSync = true;
bone.Changed = Bone.WORLD_POS | Bone.WORLD_ROT;
if (sDebug)
{
Log.d("BONE", "setWorldMatrix: %s %s", mSkeleton.getBoneName(boneindex), bone.toString());
}
} | java | public void setWorldMatrix(int boneindex, Matrix4f mtx)
{
Bone bone = mBones[boneindex];
bone.WorldMatrix.set(mtx);
if (mSkeleton.getParentBoneIndex(boneindex) >= 0)
{
calcLocal(bone, mSkeleton.getParentBoneIndex(boneindex));
}
else
{
bone.LocalMatrix.set(mtx);
}
mNeedSync = true;
bone.Changed = Bone.WORLD_POS | Bone.WORLD_ROT;
if (sDebug)
{
Log.d("BONE", "setWorldMatrix: %s %s", mSkeleton.getBoneName(boneindex), bone.toString());
}
} | [
"public",
"void",
"setWorldMatrix",
"(",
"int",
"boneindex",
",",
"Matrix4f",
"mtx",
")",
"{",
"Bone",
"bone",
"=",
"mBones",
"[",
"boneindex",
"]",
";",
"bone",
".",
"WorldMatrix",
".",
"set",
"(",
"mtx",
")",
";",
"if",
"(",
"mSkeleton",
".",
"getPar... | Set the world matrix for this bone (relative to skeleton root).
<p>
Sets the world matrix for the designated bone.
All bones in the skeleton start out at the origin oriented along the bone axis (usually 0,0,1).
The pose orients and positions each bone in the skeleton with respect to this initial state.
The world bone matrix expresses the orientation and position of the bone relative
to the root of the skeleton.
@param boneindex zero based index of bone to set matrix for.
@param mtx new bone matrix.
@see #getWorldRotation
@see #setLocalRotation
@see #getWorldMatrix
@see #getWorldPositions
@see GVRSkeleton#setBoneAxis | [
"Set",
"the",
"world",
"matrix",
"for",
"this",
"bone",
"(",
"relative",
"to",
"skeleton",
"root",
")",
".",
"<p",
">",
"Sets",
"the",
"world",
"matrix",
"for",
"the",
"designated",
"bone",
".",
"All",
"bones",
"in",
"the",
"skeleton",
"start",
"out",
... | train | https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/animation/GVRPose.java#L356-L375 |
looly/hutool | hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java | KeyUtil.getCertificate | public static Certificate getCertificate(KeyStore keyStore, String alias) {
try {
return keyStore.getCertificate(alias);
} catch (Exception e) {
throw new CryptoException(e);
}
} | java | public static Certificate getCertificate(KeyStore keyStore, String alias) {
try {
return keyStore.getCertificate(alias);
} catch (Exception e) {
throw new CryptoException(e);
}
} | [
"public",
"static",
"Certificate",
"getCertificate",
"(",
"KeyStore",
"keyStore",
",",
"String",
"alias",
")",
"{",
"try",
"{",
"return",
"keyStore",
".",
"getCertificate",
"(",
"alias",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"ne... | 获得 Certification
@param keyStore {@link KeyStore}
@param alias 别名
@return {@link Certificate} | [
"获得",
"Certification"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/KeyUtil.java#L708-L714 |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java | CmsAttributeHandler.changeValue | public void changeValue(String value, int valueIndex) {
m_attributeValueViews.get(valueIndex).getValueWidget().setValue(value, false);
changeEntityValue(value, valueIndex);
} | java | public void changeValue(String value, int valueIndex) {
m_attributeValueViews.get(valueIndex).getValueWidget().setValue(value, false);
changeEntityValue(value, valueIndex);
} | [
"public",
"void",
"changeValue",
"(",
"String",
"value",
",",
"int",
"valueIndex",
")",
"{",
"m_attributeValueViews",
".",
"get",
"(",
"valueIndex",
")",
".",
"getValueWidget",
"(",
")",
".",
"setValue",
"(",
"value",
",",
"false",
")",
";",
"changeEntityVal... | Applies a value change to the entity data as well as to the value view widget.<p>
@param value the value
@param valueIndex the value index | [
"Applies",
"a",
"value",
"change",
"to",
"the",
"entity",
"data",
"as",
"well",
"as",
"to",
"the",
"value",
"view",
"widget",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java#L391-L395 |
protostuff/protostuff | protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java | MsgpackIOUtil.writeTo | public static <T> void writeTo(MessageBufferOutput out, T message, Schema<T> schema, boolean numeric)
throws IOException
{
MessagePacker packer = MessagePack.newDefaultPacker(out);
try
{
writeTo(packer, message, schema, numeric);
}
finally
{
packer.flush();
}
} | java | public static <T> void writeTo(MessageBufferOutput out, T message, Schema<T> schema, boolean numeric)
throws IOException
{
MessagePacker packer = MessagePack.newDefaultPacker(out);
try
{
writeTo(packer, message, schema, numeric);
}
finally
{
packer.flush();
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"writeTo",
"(",
"MessageBufferOutput",
"out",
",",
"T",
"message",
",",
"Schema",
"<",
"T",
">",
"schema",
",",
"boolean",
"numeric",
")",
"throws",
"IOException",
"{",
"MessagePacker",
"packer",
"=",
"MessagePack",... | Serializes the {@code message} into an {@link MessageBufferOutput} using the given {@code schema}. | [
"Serializes",
"the",
"{"
] | train | https://github.com/protostuff/protostuff/blob/af669cf089057d0ec83220266131ce411854af7b/protostuff-msgpack/src/main/java/io/protostuff/MsgpackIOUtil.java#L208-L222 |
alkacon/opencms-core | src/org/opencms/site/CmsSite.java | CmsSite.getServerPrefix | public String getServerPrefix(CmsObject cms, CmsResource resource) {
return getServerPrefix(cms, resource.getRootPath());
} | java | public String getServerPrefix(CmsObject cms, CmsResource resource) {
return getServerPrefix(cms, resource.getRootPath());
} | [
"public",
"String",
"getServerPrefix",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"{",
"return",
"getServerPrefix",
"(",
"cms",
",",
"resource",
".",
"getRootPath",
"(",
")",
")",
";",
"}"
] | Returns the server prefix for the given resource in this site, used to distinguish between
secure (https) and non-secure (http) sites.<p>
This is required since a resource may have an individual "secure" setting using the property
{@link org.opencms.file.CmsPropertyDefinition#PROPERTY_SECURE}, which means this resource
must be delivered only using a secure protocol.<p>
The result will look like <code>http://site.enterprise.com:8080/</code> or <code>https://site.enterprise.com/</code>.<p>
@param cms the current users OpenCms context
@param resource the resource to use
@return the server prefix for the given resource in this site
@see #getServerPrefix(CmsObject, String) | [
"Returns",
"the",
"server",
"prefix",
"for",
"the",
"given",
"resource",
"in",
"this",
"site",
"used",
"to",
"distinguish",
"between",
"secure",
"(",
"https",
")",
"and",
"non",
"-",
"secure",
"(",
"http",
")",
"sites",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/site/CmsSite.java#L491-L494 |
landawn/AbacusUtil | src/com/landawn/abacus/util/Fn.java | Fn.sc | @Beta
public static <T, U> BiConsumer<T, U> sc(final Object mutex, final BiConsumer<T, U> biConsumer) {
N.checkArgNotNull(mutex, "mutex");
N.checkArgNotNull(biConsumer, "biConsumer");
return new BiConsumer<T, U>() {
@Override
public void accept(T t, U u) {
synchronized (mutex) {
biConsumer.accept(t, u);
}
}
};
} | java | @Beta
public static <T, U> BiConsumer<T, U> sc(final Object mutex, final BiConsumer<T, U> biConsumer) {
N.checkArgNotNull(mutex, "mutex");
N.checkArgNotNull(biConsumer, "biConsumer");
return new BiConsumer<T, U>() {
@Override
public void accept(T t, U u) {
synchronized (mutex) {
biConsumer.accept(t, u);
}
}
};
} | [
"@",
"Beta",
"public",
"static",
"<",
"T",
",",
"U",
">",
"BiConsumer",
"<",
"T",
",",
"U",
">",
"sc",
"(",
"final",
"Object",
"mutex",
",",
"final",
"BiConsumer",
"<",
"T",
",",
"U",
">",
"biConsumer",
")",
"{",
"N",
".",
"checkArgNotNull",
"(",
... | Synchronized {@code BiConsumer}
@param mutex to synchronized on
@param biConsumer
@return | [
"Synchronized",
"{",
"@code",
"BiConsumer",
"}"
] | train | https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Fn.java#L2886-L2899 |
gocd/gocd | server/src/main/java/com/thoughtworks/go/server/service/ScheduleService.java | ScheduleService.isStageActive | private boolean isStageActive(Pipeline pipeline, StageConfig nextStage) {
return stageDao.isStageActive(pipeline.getName(), CaseInsensitiveString.str(nextStage.name()));
} | java | private boolean isStageActive(Pipeline pipeline, StageConfig nextStage) {
return stageDao.isStageActive(pipeline.getName(), CaseInsensitiveString.str(nextStage.name()));
} | [
"private",
"boolean",
"isStageActive",
"(",
"Pipeline",
"pipeline",
",",
"StageConfig",
"nextStage",
")",
"{",
"return",
"stageDao",
".",
"isStageActive",
"(",
"pipeline",
".",
"getName",
"(",
")",
",",
"CaseInsensitiveString",
".",
"str",
"(",
"nextStage",
".",... | this method checks if specified stage is active in all pipelines | [
"this",
"method",
"checks",
"if",
"specified",
"stage",
"is",
"active",
"in",
"all",
"pipelines"
] | train | https://github.com/gocd/gocd/blob/59a8480e23d6c06de39127635108dff57603cb71/server/src/main/java/com/thoughtworks/go/server/service/ScheduleService.java#L403-L405 |
OpenLiberty/open-liberty | dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java | MethodFinder.findMatchingMethod | private static Method findMatchingMethod(Method originalMethod, String methodName, Type classToSearch, ResolutionContext ctx, Class<?> originalClass) {
// Check self
Method result = findMethodOnClass(originalMethod, methodName, classToSearch, ctx, originalClass);
// Check interfaces
if (result == null) {
for (Type iface : getClass(classToSearch).getGenericInterfaces()) {
ctx.push(iface);
result = findMatchingMethod(originalMethod, methodName, iface, ctx, originalClass);
ctx.pop();
if (result != null) {
break;
}
}
}
// Check superclass
if (result == null) {
Type superclass = getClass(classToSearch).getGenericSuperclass();
if (superclass != null) {
ctx.push(superclass);
result = findMatchingMethod(originalMethod, methodName, superclass, ctx, originalClass);
ctx.pop();
}
}
return result;
} | java | private static Method findMatchingMethod(Method originalMethod, String methodName, Type classToSearch, ResolutionContext ctx, Class<?> originalClass) {
// Check self
Method result = findMethodOnClass(originalMethod, methodName, classToSearch, ctx, originalClass);
// Check interfaces
if (result == null) {
for (Type iface : getClass(classToSearch).getGenericInterfaces()) {
ctx.push(iface);
result = findMatchingMethod(originalMethod, methodName, iface, ctx, originalClass);
ctx.pop();
if (result != null) {
break;
}
}
}
// Check superclass
if (result == null) {
Type superclass = getClass(classToSearch).getGenericSuperclass();
if (superclass != null) {
ctx.push(superclass);
result = findMatchingMethod(originalMethod, methodName, superclass, ctx, originalClass);
ctx.pop();
}
}
return result;
} | [
"private",
"static",
"Method",
"findMatchingMethod",
"(",
"Method",
"originalMethod",
",",
"String",
"methodName",
",",
"Type",
"classToSearch",
",",
"ResolutionContext",
"ctx",
",",
"Class",
"<",
"?",
">",
"originalClass",
")",
"{",
"// Check self",
"Method",
"re... | Recursively search the class hierarchy of {@code clazzToCheck} to find a method named {@code methodName} with the same signature as {@code originalMethod}
@param originalMethod the original method
@param methodName the name of the method to search for
@param classToSearch the class to search
@param ctx the resolution context
@param originalClass the class which declared {@code originalMethod}
@return a method named {@code methodName}, in the class hierarchy of {@code clazzToCheck}, which matches the signature of {@code originalMethod}, or {@code null} if one
cannot be found | [
"Recursively",
"search",
"the",
"class",
"hierarchy",
"of",
"{",
"@code",
"clazzToCheck",
"}",
"to",
"find",
"a",
"method",
"named",
"{",
"@code",
"methodName",
"}",
"with",
"the",
"same",
"signature",
"as",
"{",
"@code",
"originalMethod",
"}"
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.faulttolerance.cdi/src/com/ibm/ws/microprofile/faulttolerance/cdi/config/MethodFinder.java#L62-L89 |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java | RadialPickerLayout.roundToValidTime | private Timepoint roundToValidTime(Timepoint newSelection, int currentItemShowing) {
switch(currentItemShowing) {
case HOUR_INDEX:
return mController.roundToNearest(newSelection, null);
case MINUTE_INDEX:
return mController.roundToNearest(newSelection, Timepoint.TYPE.HOUR);
default:
return mController.roundToNearest(newSelection, Timepoint.TYPE.MINUTE);
}
} | java | private Timepoint roundToValidTime(Timepoint newSelection, int currentItemShowing) {
switch(currentItemShowing) {
case HOUR_INDEX:
return mController.roundToNearest(newSelection, null);
case MINUTE_INDEX:
return mController.roundToNearest(newSelection, Timepoint.TYPE.HOUR);
default:
return mController.roundToNearest(newSelection, Timepoint.TYPE.MINUTE);
}
} | [
"private",
"Timepoint",
"roundToValidTime",
"(",
"Timepoint",
"newSelection",
",",
"int",
"currentItemShowing",
")",
"{",
"switch",
"(",
"currentItemShowing",
")",
"{",
"case",
"HOUR_INDEX",
":",
"return",
"mController",
".",
"roundToNearest",
"(",
"newSelection",
"... | Snap the input to a selectable value
@param newSelection Timepoint - Time which should be rounded
@param currentItemShowing int - The index of the current view
@return Timepoint - the rounded value | [
"Snap",
"the",
"input",
"to",
"a",
"selectable",
"value"
] | train | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java#L438-L447 |
crowmagnumb/s6-util | src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java | AbstractMultipartUtility.addFilePart | public void addFilePart(final String fieldName, final InputStream stream, final String contentType)
throws IOException
{
addFilePart(fieldName, stream, null, contentType);
} | java | public void addFilePart(final String fieldName, final InputStream stream, final String contentType)
throws IOException
{
addFilePart(fieldName, stream, null, contentType);
} | [
"public",
"void",
"addFilePart",
"(",
"final",
"String",
"fieldName",
",",
"final",
"InputStream",
"stream",
",",
"final",
"String",
"contentType",
")",
"throws",
"IOException",
"{",
"addFilePart",
"(",
"fieldName",
",",
"stream",
",",
"null",
",",
"contentType"... | Adds a upload file section to the request by stream
@param fieldName name attribute in <input type="file" name="..." />
@param stream input stream of data to upload
@param contentType content type of data
@throws IOException if problems | [
"Adds",
"a",
"upload",
"file",
"section",
"to",
"the",
"request",
"by",
"stream"
] | train | https://github.com/crowmagnumb/s6-util/blob/0f9969bc0809e8a617501fa57c135e9b3984fae0/src/main/java/net/crowmagnumb/util/net/AbstractMultipartUtility.java#L71-L75 |
LearnLib/automatalib | visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java | DOT.runDOT | public static InputStream runDOT(String dotText, String format, String... additionalOpts) throws IOException {
StringReader sr = new StringReader(dotText);
return runDOT(sr, format, additionalOpts);
} | java | public static InputStream runDOT(String dotText, String format, String... additionalOpts) throws IOException {
StringReader sr = new StringReader(dotText);
return runDOT(sr, format, additionalOpts);
} | [
"public",
"static",
"InputStream",
"runDOT",
"(",
"String",
"dotText",
",",
"String",
"format",
",",
"String",
"...",
"additionalOpts",
")",
"throws",
"IOException",
"{",
"StringReader",
"sr",
"=",
"new",
"StringReader",
"(",
"dotText",
")",
";",
"return",
"ru... | Invokes the DOT utility on a string. Convenience method, see {@link #runDOT(Reader, String, String...)} | [
"Invokes",
"the",
"DOT",
"utility",
"on",
"a",
"string",
".",
"Convenience",
"method",
"see",
"{"
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/visualization/dot-visualizer/src/main/java/net/automatalib/visualization/dot/DOT.java#L120-L123 |
OpenLiberty/open-liberty | dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java | TraceNLS.getStringFromBundle | public static String getStringFromBundle(Class<?> caller, String bundleName, String key, String defaultString) {
if (resolver == null)
resolver = TraceNLSResolver.getInstance();
return resolver.getMessage(caller, null, bundleName, key, null, defaultString, false, null, false);
} | java | public static String getStringFromBundle(Class<?> caller, String bundleName, String key, String defaultString) {
if (resolver == null)
resolver = TraceNLSResolver.getInstance();
return resolver.getMessage(caller, null, bundleName, key, null, defaultString, false, null, false);
} | [
"public",
"static",
"String",
"getStringFromBundle",
"(",
"Class",
"<",
"?",
">",
"caller",
",",
"String",
"bundleName",
",",
"String",
"key",
",",
"String",
"defaultString",
")",
"{",
"if",
"(",
"resolver",
"==",
"null",
")",
"resolver",
"=",
"TraceNLSResol... | Retrieve the localized text corresponding to the specified key in the
specified ResourceBundle. If the text cannot be found for any reason, the
defaultString is returned. If an error is encountered, an appropriate
error message is returned instead.
<p>
@param caller
Class object calling this method
@param bundleName
the fully qualified name of the ResourceBundle. Must not be
null.
@param key
the key to use in the ResourceBundle lookup. Must not be null.
@param defaultString
text to return if text cannot be found. Must not be null.
@return the value corresponding to the specified key in the specified
ResourceBundle, or the appropriate non-null error message. | [
"Retrieve",
"the",
"localized",
"text",
"corresponding",
"to",
"the",
"specified",
"key",
"in",
"the",
"specified",
"ResourceBundle",
".",
"If",
"the",
"text",
"cannot",
"be",
"found",
"for",
"any",
"reason",
"the",
"defaultString",
"is",
"returned",
".",
"If"... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.core/src/com/ibm/ejs/ras/TraceNLS.java#L288-L293 |
jbundle/jbundle | base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java | BaseConvertToMessage.unmarshalRootElement | public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception
{
// Override this! (If you can!)
TransformerFactory tFact = TransformerFactory.newInstance();
Source source = new DOMSource(node);
Writer writer = new StringWriter();
Result result = new StreamResult(writer);
Transformer transformer = tFact.newTransformer();
transformer.transform(source, result);
writer.flush();
writer.close();
String strXMLBody = writer.toString();
Reader inStream = new StringReader(strXMLBody);
Object msg = this.unmarshalRootElement(inStream, soapTrxMessage);
inStream.close();
return msg;
} | java | public Object unmarshalRootElement(Node node, BaseXmlTrxMessageIn soapTrxMessage) throws Exception
{
// Override this! (If you can!)
TransformerFactory tFact = TransformerFactory.newInstance();
Source source = new DOMSource(node);
Writer writer = new StringWriter();
Result result = new StreamResult(writer);
Transformer transformer = tFact.newTransformer();
transformer.transform(source, result);
writer.flush();
writer.close();
String strXMLBody = writer.toString();
Reader inStream = new StringReader(strXMLBody);
Object msg = this.unmarshalRootElement(inStream, soapTrxMessage);
inStream.close();
return msg;
} | [
"public",
"Object",
"unmarshalRootElement",
"(",
"Node",
"node",
",",
"BaseXmlTrxMessageIn",
"soapTrxMessage",
")",
"throws",
"Exception",
"{",
"// Override this! (If you can!)",
"TransformerFactory",
"tFact",
"=",
"TransformerFactory",
".",
"newInstance",
"(",
")",
";",
... | Create the root element for this message.
You SHOULD override this if the unmarshaller has a native method to unmarshall a dom node.
@return The root element. | [
"Create",
"the",
"root",
"element",
"for",
"this",
"message",
".",
"You",
"SHOULD",
"override",
"this",
"if",
"the",
"unmarshaller",
"has",
"a",
"native",
"method",
"to",
"unmarshall",
"a",
"dom",
"node",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToMessage.java#L105-L128 |
OpenLiberty/open-liberty | dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/SymbolRegistry.java | SymbolRegistry.resolveSymbolicString | String resolveSymbolicString(String symbolicPath) {
if (symbolicPath == null)
throw new NullPointerException("Path must be non-null");
return resolveStringSymbols(symbolicPath, symbolicPath, true, 0, true);
} | java | String resolveSymbolicString(String symbolicPath) {
if (symbolicPath == null)
throw new NullPointerException("Path must be non-null");
return resolveStringSymbols(symbolicPath, symbolicPath, true, 0, true);
} | [
"String",
"resolveSymbolicString",
"(",
"String",
"symbolicPath",
")",
"{",
"if",
"(",
"symbolicPath",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"Path must be non-null\"",
")",
";",
"return",
"resolveStringSymbols",
"(",
"symbolicPath",
",",
... | Resolves the given string, evaluating all symbols, and path-normalizes
the value.
@param symbolicPath
@return The resolved value, path-normalized. | [
"Resolves",
"the",
"given",
"string",
"evaluating",
"all",
"symbols",
"and",
"path",
"-",
"normalizes",
"the",
"value",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.service.location/src/com/ibm/ws/kernel/service/location/internal/SymbolRegistry.java#L200-L205 |
carewebframework/carewebframework-core | org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/StopWatchFactory.java | StopWatchFactory.create | public static IStopWatch create() {
if (factory == null) {
throw new IllegalStateException("No stopwatch factory registered.");
}
try {
return factory.clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException("Could not create stopwatch instance.", e);
}
} | java | public static IStopWatch create() {
if (factory == null) {
throw new IllegalStateException("No stopwatch factory registered.");
}
try {
return factory.clazz.newInstance();
} catch (Exception e) {
throw new RuntimeException("Could not create stopwatch instance.", e);
}
} | [
"public",
"static",
"IStopWatch",
"create",
"(",
")",
"{",
"if",
"(",
"factory",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No stopwatch factory registered.\"",
")",
";",
"}",
"try",
"{",
"return",
"factory",
".",
"clazz",
".",
... | Returns an uninitialized stopwatch instance.
@return An uninitialized stopwatch instance. Will be null if the factory has not been
initialized. | [
"Returns",
"an",
"uninitialized",
"stopwatch",
"instance",
"."
] | train | https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/StopWatchFactory.java#L91-L101 |
petergeneric/stdlib | stdlib/src/main/java/com/peterphi/std/io/StreamUtil.java | StreamUtil.streamCopy | public static void streamCopy(InputStream input, Writer output) throws IOException
{
if (input == null)
throw new IllegalArgumentException("Must provide something to read from");
if (output == null)
throw new IllegalArgumentException("Must provide something to write to");
streamCopy(new InputStreamReader(input), output);
} | java | public static void streamCopy(InputStream input, Writer output) throws IOException
{
if (input == null)
throw new IllegalArgumentException("Must provide something to read from");
if (output == null)
throw new IllegalArgumentException("Must provide something to write to");
streamCopy(new InputStreamReader(input), output);
} | [
"public",
"static",
"void",
"streamCopy",
"(",
"InputStream",
"input",
",",
"Writer",
"output",
")",
"throws",
"IOException",
"{",
"if",
"(",
"input",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Must provide something to read from\"",
")",... | Copies the contents of an InputStream, using the default encoding, into a Writer
@param input
@param output
@throws IOException | [
"Copies",
"the",
"contents",
"of",
"an",
"InputStream",
"using",
"the",
"default",
"encoding",
"into",
"a",
"Writer"
] | train | https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/io/StreamUtil.java#L343-L351 |
atomix/atomix | protocols/primary-backup/src/main/java/io/atomix/protocols/backup/PrimaryBackupClient.java | PrimaryBackupClient.sessionBuilder | public PrimaryBackupSessionClient.Builder sessionBuilder(String primitiveName, PrimitiveType primitiveType, ServiceConfig serviceConfig) {
byte[] configBytes = Serializer.using(primitiveType.namespace()).encode(serviceConfig);
return new PrimaryBackupSessionClient.Builder() {
@Override
public SessionClient build() {
Supplier<CompletableFuture<SessionClient>> proxyBuilder = () -> sessionIdService.nextSessionId()
.thenApply(sessionId -> new PrimaryBackupSessionClient(
clientName,
partitionId,
sessionId,
primitiveType,
new PrimitiveDescriptor(
primitiveName,
primitiveType.name(),
configBytes,
numBackups,
replication),
clusterMembershipService,
PrimaryBackupClient.this.protocol,
primaryElection,
threadContextFactory.createContext()));
SessionClient proxy;
ThreadContext context = threadContextFactory.createContext();
if (recovery == Recovery.RECOVER) {
proxy = new RecoveringSessionClient(
clientName,
partitionId,
primitiveName,
primitiveType,
proxyBuilder,
context);
} else {
proxy = Futures.get(proxyBuilder.get());
}
// If max retries is set, wrap the client in a retrying proxy client.
if (maxRetries > 0) {
proxy = new RetryingSessionClient(
proxy,
context,
maxRetries,
retryDelay);
}
return new BlockingAwareSessionClient(proxy, context);
}
};
} | java | public PrimaryBackupSessionClient.Builder sessionBuilder(String primitiveName, PrimitiveType primitiveType, ServiceConfig serviceConfig) {
byte[] configBytes = Serializer.using(primitiveType.namespace()).encode(serviceConfig);
return new PrimaryBackupSessionClient.Builder() {
@Override
public SessionClient build() {
Supplier<CompletableFuture<SessionClient>> proxyBuilder = () -> sessionIdService.nextSessionId()
.thenApply(sessionId -> new PrimaryBackupSessionClient(
clientName,
partitionId,
sessionId,
primitiveType,
new PrimitiveDescriptor(
primitiveName,
primitiveType.name(),
configBytes,
numBackups,
replication),
clusterMembershipService,
PrimaryBackupClient.this.protocol,
primaryElection,
threadContextFactory.createContext()));
SessionClient proxy;
ThreadContext context = threadContextFactory.createContext();
if (recovery == Recovery.RECOVER) {
proxy = new RecoveringSessionClient(
clientName,
partitionId,
primitiveName,
primitiveType,
proxyBuilder,
context);
} else {
proxy = Futures.get(proxyBuilder.get());
}
// If max retries is set, wrap the client in a retrying proxy client.
if (maxRetries > 0) {
proxy = new RetryingSessionClient(
proxy,
context,
maxRetries,
retryDelay);
}
return new BlockingAwareSessionClient(proxy, context);
}
};
} | [
"public",
"PrimaryBackupSessionClient",
".",
"Builder",
"sessionBuilder",
"(",
"String",
"primitiveName",
",",
"PrimitiveType",
"primitiveType",
",",
"ServiceConfig",
"serviceConfig",
")",
"{",
"byte",
"[",
"]",
"configBytes",
"=",
"Serializer",
".",
"using",
"(",
"... | Creates a new primary backup proxy session builder.
@param primitiveName the primitive name
@param primitiveType the primitive type
@param serviceConfig the service configuration
@return a new primary-backup proxy session builder | [
"Creates",
"a",
"new",
"primary",
"backup",
"proxy",
"session",
"builder",
"."
] | train | https://github.com/atomix/atomix/blob/3a94b7c80576d762dd0d396d4645df07a0b37c31/protocols/primary-backup/src/main/java/io/atomix/protocols/backup/PrimaryBackupClient.java#L99-L146 |
bazaarvoice/emodb | auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java | ApiKeyRealm.createAuthenticationInfo | private ApiKeyAuthenticationInfo createAuthenticationInfo(String authenticationId, ApiKey apiKey) {
return new ApiKeyAuthenticationInfo(authenticationId, apiKey, getName());
} | java | private ApiKeyAuthenticationInfo createAuthenticationInfo(String authenticationId, ApiKey apiKey) {
return new ApiKeyAuthenticationInfo(authenticationId, apiKey, getName());
} | [
"private",
"ApiKeyAuthenticationInfo",
"createAuthenticationInfo",
"(",
"String",
"authenticationId",
",",
"ApiKey",
"apiKey",
")",
"{",
"return",
"new",
"ApiKeyAuthenticationInfo",
"(",
"authenticationId",
",",
"apiKey",
",",
"getName",
"(",
")",
")",
";",
"}"
] | Simple method to build and AuthenticationInfo instance from an API key. | [
"Simple",
"method",
"to",
"build",
"and",
"AuthenticationInfo",
"instance",
"from",
"an",
"API",
"key",
"."
] | train | https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/auth/auth-core/src/main/java/com/bazaarvoice/emodb/auth/apikey/ApiKeyRealm.java#L225-L227 |
Azure/azure-sdk-for-java | mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java | LiveEventsInner.getAsync | public Observable<LiveEventInner> getAsync(String resourceGroupName, String accountName, String liveEventName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, liveEventName).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() {
@Override
public LiveEventInner call(ServiceResponse<LiveEventInner> response) {
return response.body();
}
});
} | java | public Observable<LiveEventInner> getAsync(String resourceGroupName, String accountName, String liveEventName) {
return getWithServiceResponseAsync(resourceGroupName, accountName, liveEventName).map(new Func1<ServiceResponse<LiveEventInner>, LiveEventInner>() {
@Override
public LiveEventInner call(ServiceResponse<LiveEventInner> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"LiveEventInner",
">",
"getAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"accountName",
",",
"String",
"liveEventName",
")",
"{",
"return",
"getWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"accountName",
",",
"liv... | Get Live Event.
Gets a Live Event.
@param resourceGroupName The name of the resource group within the Azure subscription.
@param accountName The Media Services account name.
@param liveEventName The name of the Live Event.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the LiveEventInner object | [
"Get",
"Live",
"Event",
".",
"Gets",
"a",
"Live",
"Event",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_06_01_preview/implementation/LiveEventsInner.java#L298-L305 |
phax/ph-oton | ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java | JSEventMap.prependHandler | public void prependHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler)
{
ValueEnforcer.notNull (eJSEvent, "JSEvent");
ValueEnforcer.notNull (aNewHandler, "NewHandler");
CollectingJSCodeProvider aCode = m_aEvents.get (eJSEvent);
if (aCode == null)
{
aCode = new CollectingJSCodeProvider ();
m_aEvents.put (eJSEvent, aCode);
}
aCode.prepend (aNewHandler);
} | java | public void prependHandler (@Nonnull final EJSEvent eJSEvent, @Nonnull final IHasJSCode aNewHandler)
{
ValueEnforcer.notNull (eJSEvent, "JSEvent");
ValueEnforcer.notNull (aNewHandler, "NewHandler");
CollectingJSCodeProvider aCode = m_aEvents.get (eJSEvent);
if (aCode == null)
{
aCode = new CollectingJSCodeProvider ();
m_aEvents.put (eJSEvent, aCode);
}
aCode.prepend (aNewHandler);
} | [
"public",
"void",
"prependHandler",
"(",
"@",
"Nonnull",
"final",
"EJSEvent",
"eJSEvent",
",",
"@",
"Nonnull",
"final",
"IHasJSCode",
"aNewHandler",
")",
"{",
"ValueEnforcer",
".",
"notNull",
"(",
"eJSEvent",
",",
"\"JSEvent\"",
")",
";",
"ValueEnforcer",
".",
... | Add an additional handler for the given JS event. If an existing handler is
present, the new handler is appended at front.
@param eJSEvent
The JS event. May not be <code>null</code>.
@param aNewHandler
The new handler to be added. May not be <code>null</code>. | [
"Add",
"an",
"additional",
"handler",
"for",
"the",
"given",
"JS",
"event",
".",
"If",
"an",
"existing",
"handler",
"is",
"present",
"the",
"new",
"handler",
"is",
"appended",
"at",
"front",
"."
] | train | https://github.com/phax/ph-oton/blob/f3aaacbbc02a9f3e4f32fe8db8e4adf7b9c1d3ef/ph-oton-html/src/main/java/com/helger/html/js/JSEventMap.java#L76-L88 |
Azure/azure-sdk-for-java | cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java | PredictionsImpl.predictImageAsync | public Observable<ImagePrediction> predictImageAsync(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter) {
return predictImageWithServiceResponseAsync(projectId, imageData, predictImageOptionalParameter).map(new Func1<ServiceResponse<ImagePrediction>, ImagePrediction>() {
@Override
public ImagePrediction call(ServiceResponse<ImagePrediction> response) {
return response.body();
}
});
} | java | public Observable<ImagePrediction> predictImageAsync(UUID projectId, byte[] imageData, PredictImageOptionalParameter predictImageOptionalParameter) {
return predictImageWithServiceResponseAsync(projectId, imageData, predictImageOptionalParameter).map(new Func1<ServiceResponse<ImagePrediction>, ImagePrediction>() {
@Override
public ImagePrediction call(ServiceResponse<ImagePrediction> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"ImagePrediction",
">",
"predictImageAsync",
"(",
"UUID",
"projectId",
",",
"byte",
"[",
"]",
"imageData",
",",
"PredictImageOptionalParameter",
"predictImageOptionalParameter",
")",
"{",
"return",
"predictImageWithServiceResponseAsync",
"(",
... | Predict an image and saves the result.
@param projectId The project id
@param imageData the InputStream value
@param predictImageOptionalParameter the object representing the optional parameters to be set before calling this API
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the ImagePrediction object | [
"Predict",
"an",
"image",
"and",
"saves",
"the",
"result",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/prediction/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/prediction/implementation/PredictionsImpl.java#L474-L481 |
CloudSlang/cs-actions | cs-rft/src/main/java/io/cloudslang/content/rft/actions/RemoteSecureCopyAction.java | RemoteSecureCopyAction.copyTo | @Action(name = "Remote Secure Copy",
outputs = {
@Output(Constants.OutputNames.RETURN_CODE),
@Output(Constants.OutputNames.RETURN_RESULT),
@Output(Constants.OutputNames.EXCEPTION)
},
responses = {
@Response(text = Constants.ResponseNames.SUCCESS, field = Constants.OutputNames.RETURN_CODE, value = Constants.ReturnCodes.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = Constants.ResponseNames.FAILURE, field = Constants.OutputNames.RETURN_CODE, value = Constants.ReturnCodes.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
}
)
public Map<String, String> copyTo(
@Param(value = Constants.InputNames.SOURCE_HOST) String sourceHost,
@Param(value = Constants.InputNames.SOURCE_PATH, required = true) String sourcePath,
@Param(Constants.InputNames.SOURCE_PORT) String sourcePort,
@Param(Constants.InputNames.SOURCE_USERNAME) String sourceUsername,
@Param(value = Constants.InputNames.SOURCE_PASSWORD, encrypted = true) String sourcePassword,
@Param(Constants.InputNames.SOURCE_PRIVATE_KEY_FILE) String sourcePrivateKeyFile,
@Param(value = Constants.InputNames.DESTINATION_HOST) String destinationHost,
@Param(value = Constants.InputNames.DESTINATION_PATH, required = true) String destinationPath,
@Param(Constants.InputNames.DESTINATION_PORT) String destinationPort,
@Param(value = Constants.InputNames.DESTINATION_USERNAME) String destinationUsername,
@Param(value = Constants.InputNames.DESTINATION_PASSWORD, encrypted = true) String destinationPassword,
@Param(Constants.InputNames.DESTINATION_PRIVATE_KEY_FILE) String destinationPrivateKeyFile,
@Param(Constants.InputNames.KNOWN_HOSTS_POLICY) String knownHostsPolicy,
@Param(Constants.InputNames.KNOWN_HOSTS_PATH) String knownHostsPath,
@Param(Constants.InputNames.TIMEOUT) String timeout,
@Param(Constants.InputNames.PROXY_HOST) String proxyHost,
@Param(Constants.InputNames.PROXY_PORT) String proxyPort) {
RemoteSecureCopyInputs remoteSecureCopyInputs = new RemoteSecureCopyInputs(sourcePath, destinationHost, destinationPath, destinationUsername);
remoteSecureCopyInputs.setSrcHost(sourceHost);
remoteSecureCopyInputs.setSrcPort(sourcePort);
remoteSecureCopyInputs.setSrcPrivateKeyFile(sourcePrivateKeyFile);
remoteSecureCopyInputs.setSrcUsername(sourceUsername);
remoteSecureCopyInputs.setSrcPassword(sourcePassword);
remoteSecureCopyInputs.setDestPort(destinationPort);
remoteSecureCopyInputs.setDestPrivateKeyFile(destinationPrivateKeyFile);
remoteSecureCopyInputs.setDestPassword(destinationPassword);
remoteSecureCopyInputs.setKnownHostsPolicy(knownHostsPolicy);
remoteSecureCopyInputs.setKnownHostsPath(knownHostsPath);
remoteSecureCopyInputs.setTimeout(timeout);
remoteSecureCopyInputs.setProxyHost(proxyHost);
remoteSecureCopyInputs.setProxyPort(proxyPort);
return new RemoteSecureCopyService().execute(remoteSecureCopyInputs);
} | java | @Action(name = "Remote Secure Copy",
outputs = {
@Output(Constants.OutputNames.RETURN_CODE),
@Output(Constants.OutputNames.RETURN_RESULT),
@Output(Constants.OutputNames.EXCEPTION)
},
responses = {
@Response(text = Constants.ResponseNames.SUCCESS, field = Constants.OutputNames.RETURN_CODE, value = Constants.ReturnCodes.RETURN_CODE_SUCCESS, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.RESOLVED),
@Response(text = Constants.ResponseNames.FAILURE, field = Constants.OutputNames.RETURN_CODE, value = Constants.ReturnCodes.RETURN_CODE_FAILURE, matchType = MatchType.COMPARE_EQUAL, responseType = ResponseType.ERROR, isOnFail = true)
}
)
public Map<String, String> copyTo(
@Param(value = Constants.InputNames.SOURCE_HOST) String sourceHost,
@Param(value = Constants.InputNames.SOURCE_PATH, required = true) String sourcePath,
@Param(Constants.InputNames.SOURCE_PORT) String sourcePort,
@Param(Constants.InputNames.SOURCE_USERNAME) String sourceUsername,
@Param(value = Constants.InputNames.SOURCE_PASSWORD, encrypted = true) String sourcePassword,
@Param(Constants.InputNames.SOURCE_PRIVATE_KEY_FILE) String sourcePrivateKeyFile,
@Param(value = Constants.InputNames.DESTINATION_HOST) String destinationHost,
@Param(value = Constants.InputNames.DESTINATION_PATH, required = true) String destinationPath,
@Param(Constants.InputNames.DESTINATION_PORT) String destinationPort,
@Param(value = Constants.InputNames.DESTINATION_USERNAME) String destinationUsername,
@Param(value = Constants.InputNames.DESTINATION_PASSWORD, encrypted = true) String destinationPassword,
@Param(Constants.InputNames.DESTINATION_PRIVATE_KEY_FILE) String destinationPrivateKeyFile,
@Param(Constants.InputNames.KNOWN_HOSTS_POLICY) String knownHostsPolicy,
@Param(Constants.InputNames.KNOWN_HOSTS_PATH) String knownHostsPath,
@Param(Constants.InputNames.TIMEOUT) String timeout,
@Param(Constants.InputNames.PROXY_HOST) String proxyHost,
@Param(Constants.InputNames.PROXY_PORT) String proxyPort) {
RemoteSecureCopyInputs remoteSecureCopyInputs = new RemoteSecureCopyInputs(sourcePath, destinationHost, destinationPath, destinationUsername);
remoteSecureCopyInputs.setSrcHost(sourceHost);
remoteSecureCopyInputs.setSrcPort(sourcePort);
remoteSecureCopyInputs.setSrcPrivateKeyFile(sourcePrivateKeyFile);
remoteSecureCopyInputs.setSrcUsername(sourceUsername);
remoteSecureCopyInputs.setSrcPassword(sourcePassword);
remoteSecureCopyInputs.setDestPort(destinationPort);
remoteSecureCopyInputs.setDestPrivateKeyFile(destinationPrivateKeyFile);
remoteSecureCopyInputs.setDestPassword(destinationPassword);
remoteSecureCopyInputs.setKnownHostsPolicy(knownHostsPolicy);
remoteSecureCopyInputs.setKnownHostsPath(knownHostsPath);
remoteSecureCopyInputs.setTimeout(timeout);
remoteSecureCopyInputs.setProxyHost(proxyHost);
remoteSecureCopyInputs.setProxyPort(proxyPort);
return new RemoteSecureCopyService().execute(remoteSecureCopyInputs);
} | [
"@",
"Action",
"(",
"name",
"=",
"\"Remote Secure Copy\"",
",",
"outputs",
"=",
"{",
"@",
"Output",
"(",
"Constants",
".",
"OutputNames",
".",
"RETURN_CODE",
")",
",",
"@",
"Output",
"(",
"Constants",
".",
"OutputNames",
".",
"RETURN_RESULT",
")",
",",
"@"... | Executes a Shell command(s) on the remote machine using the SSH protocol.
@param sourceHost The hostname or ip address of the source remote machine.
@param sourcePath The path to the file that needs to be copied from the source remote machine.
@param sourcePort The port number for running the command on the source remote machine.
@param sourceUsername The username of the account on the source remote machine.
@param sourcePassword The password of the user for the source remote machine.
@param sourcePrivateKeyFile The path to the private key file (OpenSSH type) on the source machine.
@param destinationHost The hostname or ip address of the destination remote machine.
@param destinationPath The path to the location where the file will be copied on the destination remote machine.
@param destinationPort The port number for running the command on the destination remote machine.
@param destinationUsername The username of the account on the destination remote machine.
@param destinationPassword The password of the user for the destination remote machine.
@param destinationPrivateKeyFile The path to the private key file (OpenSSH type) on the destination machine.
@param knownHostsPolicy The policy used for managing known_hosts file. Valid values: allow, strict, add. Default value: strict
@param knownHostsPath The path to the known hosts file.
@param timeout Time in milliseconds to wait for the command to complete. Default value is 90000 (90 seconds)
@param proxyHost The HTTP proxy host
@param proxyPort The HTTP proxy port
@return - a map containing the output of the operation. Keys present in the map are:
<br><b>returnResult</b> - The primary output.
<br><b>returnCode</b> - the return code of the operation. 0 if the operation goes to success, -1 if the operation goes to failure.
<br><b>exception</b> - the exception message if the operation goes to failure. | [
"Executes",
"a",
"Shell",
"command",
"(",
"s",
")",
"on",
"the",
"remote",
"machine",
"using",
"the",
"SSH",
"protocol",
"."
] | train | https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-rft/src/main/java/io/cloudslang/content/rft/actions/RemoteSecureCopyAction.java#L71-L118 |
spockframework/spock | spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java | SpecRewriter.moveInitializer | private void moveInitializer(Field field, Method method, int position) {
method.getFirstBlock().getAst().add(position,
new ExpressionStatement(
new FieldInitializationExpression(field.getAst())));
field.getAst().setInitialValueExpression(null);
} | java | private void moveInitializer(Field field, Method method, int position) {
method.getFirstBlock().getAst().add(position,
new ExpressionStatement(
new FieldInitializationExpression(field.getAst())));
field.getAst().setInitialValueExpression(null);
} | [
"private",
"void",
"moveInitializer",
"(",
"Field",
"field",
",",
"Method",
"method",
",",
"int",
"position",
")",
"{",
"method",
".",
"getFirstBlock",
"(",
")",
".",
"getAst",
"(",
")",
".",
"add",
"(",
"position",
",",
"new",
"ExpressionStatement",
"(",
... | /*
Moves initialization of the given field to the given position of the first block of the given method. | [
"/",
"*",
"Moves",
"initialization",
"of",
"the",
"given",
"field",
"to",
"the",
"given",
"position",
"of",
"the",
"first",
"block",
"of",
"the",
"given",
"method",
"."
] | train | https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-core/src/main/java/org/spockframework/compiler/SpecRewriter.java#L224-L229 |
Azure/azure-sdk-for-java | resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java | DeploymentsInner.beginCreateOrUpdate | public DeploymentExtendedInner beginCreateOrUpdate(String resourceGroupName, String deploymentName, DeploymentProperties properties) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, properties).toBlocking().single().body();
} | java | public DeploymentExtendedInner beginCreateOrUpdate(String resourceGroupName, String deploymentName, DeploymentProperties properties) {
return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, deploymentName, properties).toBlocking().single().body();
} | [
"public",
"DeploymentExtendedInner",
"beginCreateOrUpdate",
"(",
"String",
"resourceGroupName",
",",
"String",
"deploymentName",
",",
"DeploymentProperties",
"properties",
")",
"{",
"return",
"beginCreateOrUpdateWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"deploym... | Deploys resources to a resource group.
You can provide the template and parameters directly in the request or link to JSON files.
@param resourceGroupName The name of the resource group to deploy the resources to. The name is case insensitive. The resource group must already exist.
@param deploymentName The name of the deployment.
@param properties The deployment properties.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the DeploymentExtendedInner object if successful. | [
"Deploys",
"resources",
"to",
"a",
"resource",
"group",
".",
"You",
"can",
"provide",
"the",
"template",
"and",
"parameters",
"directly",
"in",
"the",
"request",
"or",
"link",
"to",
"JSON",
"files",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/DeploymentsInner.java#L459-L461 |
bitcoinj/bitcoinj | core/src/main/java/org/bitcoinj/core/ECKey.java | ECKey.toASN1 | public byte[] toASN1() {
try {
byte[] privKeyBytes = getPrivKeyBytes();
ByteArrayOutputStream baos = new ByteArrayOutputStream(400);
// ASN1_SEQUENCE(EC_PRIVATEKEY) = {
// ASN1_SIMPLE(EC_PRIVATEKEY, version, LONG),
// ASN1_SIMPLE(EC_PRIVATEKEY, privateKey, ASN1_OCTET_STRING),
// ASN1_EXP_OPT(EC_PRIVATEKEY, parameters, ECPKPARAMETERS, 0),
// ASN1_EXP_OPT(EC_PRIVATEKEY, publicKey, ASN1_BIT_STRING, 1)
// } ASN1_SEQUENCE_END(EC_PRIVATEKEY)
DERSequenceGenerator seq = new DERSequenceGenerator(baos);
seq.addObject(new ASN1Integer(1)); // version
seq.addObject(new DEROctetString(privKeyBytes));
seq.addObject(new DERTaggedObject(0, CURVE_PARAMS.toASN1Primitive()));
seq.addObject(new DERTaggedObject(1, new DERBitString(getPubKey())));
seq.close();
return baos.toByteArray();
} catch (IOException e) {
throw new RuntimeException(e); // Cannot happen, writing to memory stream.
}
} | java | public byte[] toASN1() {
try {
byte[] privKeyBytes = getPrivKeyBytes();
ByteArrayOutputStream baos = new ByteArrayOutputStream(400);
// ASN1_SEQUENCE(EC_PRIVATEKEY) = {
// ASN1_SIMPLE(EC_PRIVATEKEY, version, LONG),
// ASN1_SIMPLE(EC_PRIVATEKEY, privateKey, ASN1_OCTET_STRING),
// ASN1_EXP_OPT(EC_PRIVATEKEY, parameters, ECPKPARAMETERS, 0),
// ASN1_EXP_OPT(EC_PRIVATEKEY, publicKey, ASN1_BIT_STRING, 1)
// } ASN1_SEQUENCE_END(EC_PRIVATEKEY)
DERSequenceGenerator seq = new DERSequenceGenerator(baos);
seq.addObject(new ASN1Integer(1)); // version
seq.addObject(new DEROctetString(privKeyBytes));
seq.addObject(new DERTaggedObject(0, CURVE_PARAMS.toASN1Primitive()));
seq.addObject(new DERTaggedObject(1, new DERBitString(getPubKey())));
seq.close();
return baos.toByteArray();
} catch (IOException e) {
throw new RuntimeException(e); // Cannot happen, writing to memory stream.
}
} | [
"public",
"byte",
"[",
"]",
"toASN1",
"(",
")",
"{",
"try",
"{",
"byte",
"[",
"]",
"privKeyBytes",
"=",
"getPrivKeyBytes",
"(",
")",
";",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
"400",
")",
";",
"// ASN1_SEQUENCE(EC_PRIVATEKE... | Output this ECKey as an ASN.1 encoded private key, as understood by OpenSSL or used by Bitcoin Core
in its wallet storage format.
@throws org.bitcoinj.core.ECKey.MissingPrivateKeyException if the private key is missing or encrypted. | [
"Output",
"this",
"ECKey",
"as",
"an",
"ASN",
".",
"1",
"encoded",
"private",
"key",
"as",
"understood",
"by",
"OpenSSL",
"or",
"used",
"by",
"Bitcoin",
"Core",
"in",
"its",
"wallet",
"storage",
"format",
"."
] | train | https://github.com/bitcoinj/bitcoinj/blob/9cf13d29315014ed59cf4fc5944e5f227e8df9a6/core/src/main/java/org/bitcoinj/core/ECKey.java#L425-L446 |
tango-controls/JTango | server/src/main/java/org/tango/server/attribute/AttributeValue.java | AttributeValue.setValue | @Override
public void setValue(final Object value, final long time) throws DevFailed {
this.setValue(value);
this.setTime(time);
} | java | @Override
public void setValue(final Object value, final long time) throws DevFailed {
this.setValue(value);
this.setTime(time);
} | [
"@",
"Override",
"public",
"void",
"setValue",
"(",
"final",
"Object",
"value",
",",
"final",
"long",
"time",
")",
"throws",
"DevFailed",
"{",
"this",
".",
"setValue",
"(",
"value",
")",
";",
"this",
".",
"setTime",
"(",
"time",
")",
";",
"}"
] | Set Value and time. cf {@link #setValue(Object)} for details
@param value
@param time
@throws DevFailed | [
"Set",
"Value",
"and",
"time",
".",
"cf",
"{",
"@link",
"#setValue",
"(",
"Object",
")",
"}",
"for",
"details"
] | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/attribute/AttributeValue.java#L156-L160 |
rterp/GMapsFX | GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptArray.java | JavascriptArray.indexOf | public int indexOf(Object obj) {
if (obj instanceof JavascriptObject) {
return checkInteger(invokeJavascript("indexOf", ((JavascriptObject) obj).getJSObject()), -1);
}
return checkInteger(invokeJavascript("indexOf", obj), -1);
} | java | public int indexOf(Object obj) {
if (obj instanceof JavascriptObject) {
return checkInteger(invokeJavascript("indexOf", ((JavascriptObject) obj).getJSObject()), -1);
}
return checkInteger(invokeJavascript("indexOf", obj), -1);
} | [
"public",
"int",
"indexOf",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"JavascriptObject",
")",
"{",
"return",
"checkInteger",
"(",
"invokeJavascript",
"(",
"\"indexOf\"",
",",
"(",
"(",
"JavascriptObject",
")",
"obj",
")",
".",
"getJSOb... | indexOf() Search the array for an element and returns its position | [
"indexOf",
"()",
"Search",
"the",
"array",
"for",
"an",
"element",
"and",
"returns",
"its",
"position"
] | train | https://github.com/rterp/GMapsFX/blob/4623d3f768e8ad78fc50ee32dd204d236e01059f/GMapsFX/src/main/java/com/lynden/gmapsfx/javascript/JavascriptArray.java#L53-L58 |
lucee/Lucee | core/src/main/java/lucee/transformer/library/tag/TagLib.java | TagLib.setELClass | protected void setELClass(String eLClass, Identification id, Attributes attributes) {
this.ELClass = ClassDefinitionImpl.toClassDefinition(eLClass, id, attributes);
} | java | protected void setELClass(String eLClass, Identification id, Attributes attributes) {
this.ELClass = ClassDefinitionImpl.toClassDefinition(eLClass, id, attributes);
} | [
"protected",
"void",
"setELClass",
"(",
"String",
"eLClass",
",",
"Identification",
"id",
",",
"Attributes",
"attributes",
")",
"{",
"this",
".",
"ELClass",
"=",
"ClassDefinitionImpl",
".",
"toClassDefinition",
"(",
"eLClass",
",",
"id",
",",
"attributes",
")",
... | Fuegt der TagLib die Evaluator Klassendefinition als Zeichenkette hinzu. Diese Methode wird durch
die Klasse TagLibFactory verwendet.
@param eLClass Zeichenkette der Evaluator Klassendefinition. | [
"Fuegt",
"der",
"TagLib",
"die",
"Evaluator",
"Klassendefinition",
"als",
"Zeichenkette",
"hinzu",
".",
"Diese",
"Methode",
"wird",
"durch",
"die",
"Klasse",
"TagLibFactory",
"verwendet",
"."
] | train | https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLib.java#L244-L246 |
Javen205/IJPay | src/main/java/com/jpay/ext/kit/PaymentKit.java | PaymentKit.buildShortUrlParasMap | public static Map<String, String> buildShortUrlParasMap(String appid, String sub_appid, String mch_id,
String sub_mch_id, String long_url, String paternerKey) {
Map<String, String> params = new HashMap<String, String>();
params.put("appid", appid);
params.put("sub_appid", sub_appid);
params.put("mch_id", mch_id);
params.put("sub_mch_id", sub_mch_id);
params.put("long_url", long_url);
return buildSignAfterParasMap(params, paternerKey);
} | java | public static Map<String, String> buildShortUrlParasMap(String appid, String sub_appid, String mch_id,
String sub_mch_id, String long_url, String paternerKey) {
Map<String, String> params = new HashMap<String, String>();
params.put("appid", appid);
params.put("sub_appid", sub_appid);
params.put("mch_id", mch_id);
params.put("sub_mch_id", sub_mch_id);
params.put("long_url", long_url);
return buildSignAfterParasMap(params, paternerKey);
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"buildShortUrlParasMap",
"(",
"String",
"appid",
",",
"String",
"sub_appid",
",",
"String",
"mch_id",
",",
"String",
"sub_mch_id",
",",
"String",
"long_url",
",",
"String",
"paternerKey",
")",
"{",
... | 构建短链接参数
@param appid
@param sub_appid
@param mch_id
@param sub_mch_id
@param long_url
@param paternerKey
@return <Map<String, String>> | [
"构建短链接参数"
] | train | https://github.com/Javen205/IJPay/blob/78da6be4b70675abc6a41df74817532fa257ef29/src/main/java/com/jpay/ext/kit/PaymentKit.java#L37-L48 |
tango-controls/JTango | server/src/main/java/org/tango/server/events/EventUtilities.java | EventUtilities.sendToSocket | static void sendToSocket(final ZMQ.Socket eventSocket, final String fullName, int counter, boolean isException, byte[] data) throws DevFailed {
XLOGGER.entry();
sendContextData(eventSocket, fullName, counter, isException);
eventSocket.send(data);
LOGGER.debug("event {} sent", fullName);
XLOGGER.exit();
} | java | static void sendToSocket(final ZMQ.Socket eventSocket, final String fullName, int counter, boolean isException, byte[] data) throws DevFailed {
XLOGGER.entry();
sendContextData(eventSocket, fullName, counter, isException);
eventSocket.send(data);
LOGGER.debug("event {} sent", fullName);
XLOGGER.exit();
} | [
"static",
"void",
"sendToSocket",
"(",
"final",
"ZMQ",
".",
"Socket",
"eventSocket",
",",
"final",
"String",
"fullName",
",",
"int",
"counter",
",",
"boolean",
"isException",
",",
"byte",
"[",
"]",
"data",
")",
"throws",
"DevFailed",
"{",
"XLOGGER",
".",
"... | Send data so ZMQ Socket. <br>
Warning. See http://zeromq.org/area:faq. "ZeroMQ sockets are not thread-safe.<br>
The short version is that sockets should not be shared between threads. We recommend creating a dedicated socket for each thread. <br>
For those situations where a dedicated socket per thread is infeasible, a socket may be shared if and only if each thread executes a full memory barrier before accessing the socket.
Most languages support a Mutex or Spinlock which will execute the full memory barrier on your behalf."
@param eventSocket
@param fullName
@param counter
@param isException
@param data
@throws DevFailed | [
"Send",
"data",
"so",
"ZMQ",
"Socket",
".",
"<br",
">",
"Warning",
".",
"See",
"http",
":",
"//",
"zeromq",
".",
"org",
"/",
"area",
":",
"faq",
".",
"ZeroMQ",
"sockets",
"are",
"not",
"thread",
"-",
"safe",
".",
"<br",
">",
"The",
"short",
"versio... | train | https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/events/EventUtilities.java#L438-L444 |
igniterealtime/REST-API-Client | src/main/java/org/igniterealtime/restclient/RestApiClient.java | RestApiClient.addUserToGroups | public Response addUserToGroups(String username, UserGroupsEntity userGroupsEntity) {
return restClient.post("users/" + username + "/groups/", userGroupsEntity,
new HashMap<String, String>());
} | java | public Response addUserToGroups(String username, UserGroupsEntity userGroupsEntity) {
return restClient.post("users/" + username + "/groups/", userGroupsEntity,
new HashMap<String, String>());
} | [
"public",
"Response",
"addUserToGroups",
"(",
"String",
"username",
",",
"UserGroupsEntity",
"userGroupsEntity",
")",
"{",
"return",
"restClient",
".",
"post",
"(",
"\"users/\"",
"+",
"username",
"+",
"\"/groups/\"",
",",
"userGroupsEntity",
",",
"new",
"HashMap",
... | Adds the user to groups.
@param username
the username
@param userGroupsEntity
the user groups entity
@return the response | [
"Adds",
"the",
"user",
"to",
"groups",
"."
] | train | https://github.com/igniterealtime/REST-API-Client/blob/fd544dd770ec2ababa47fef51579522ddce09f05/src/main/java/org/igniterealtime/restclient/RestApiClient.java#L511-L514 |
erlang/otp | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java | OtpErlangList.stringValue | public String stringValue() throws OtpErlangException {
if (!isProper()) {
throw new OtpErlangException("Non-proper list: " + this);
}
final int[] values = new int[arity()];
for (int i = 0; i < values.length; ++i) {
final OtpErlangObject o = elementAt(i);
if (!(o instanceof OtpErlangLong)) {
throw new OtpErlangException("Non-integer term: " + o);
}
final OtpErlangLong l = (OtpErlangLong) o;
values[i] = l.intValue();
}
return new String(values, 0, values.length);
} | java | public String stringValue() throws OtpErlangException {
if (!isProper()) {
throw new OtpErlangException("Non-proper list: " + this);
}
final int[] values = new int[arity()];
for (int i = 0; i < values.length; ++i) {
final OtpErlangObject o = elementAt(i);
if (!(o instanceof OtpErlangLong)) {
throw new OtpErlangException("Non-integer term: " + o);
}
final OtpErlangLong l = (OtpErlangLong) o;
values[i] = l.intValue();
}
return new String(values, 0, values.length);
} | [
"public",
"String",
"stringValue",
"(",
")",
"throws",
"OtpErlangException",
"{",
"if",
"(",
"!",
"isProper",
"(",
")",
")",
"{",
"throw",
"new",
"OtpErlangException",
"(",
"\"Non-proper list: \"",
"+",
"this",
")",
";",
"}",
"final",
"int",
"[",
"]",
"val... | Convert a list of integers into a Unicode string, interpreting each
integer as a Unicode code point value.
@return A java.lang.String object created through its constructor
String(int[], int, int).
@exception OtpErlangException
for non-proper and non-integer lists.
@exception OtpErlangRangeException
if any integer does not fit into a Java int.
@exception java.security.InvalidParameterException
if any integer is not within the Unicode range.
@see String#String(int[], int, int) | [
"Convert",
"a",
"list",
"of",
"integers",
"into",
"a",
"Unicode",
"string",
"interpreting",
"each",
"integer",
"as",
"a",
"Unicode",
"code",
"point",
"value",
"."
] | train | https://github.com/erlang/otp/blob/ac6084fd83240355f72e94adbf303e57832d1fab/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangList.java#L437-L451 |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Path2dfx.java | Path2dfx.isCurvedProperty | public BooleanProperty isCurvedProperty() {
if (this.isCurved == null) {
this.isCurved = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_CURVED, false);
this.isCurved.bind(Bindings.createBooleanBinding(() -> {
for (final PathElementType type : innerTypesProperty()) {
if (type == PathElementType.CURVE_TO || type == PathElementType.QUAD_TO) {
return true;
}
}
return false;
},
innerTypesProperty()));
}
return this.isCurved;
} | java | public BooleanProperty isCurvedProperty() {
if (this.isCurved == null) {
this.isCurved = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_CURVED, false);
this.isCurved.bind(Bindings.createBooleanBinding(() -> {
for (final PathElementType type : innerTypesProperty()) {
if (type == PathElementType.CURVE_TO || type == PathElementType.QUAD_TO) {
return true;
}
}
return false;
},
innerTypesProperty()));
}
return this.isCurved;
} | [
"public",
"BooleanProperty",
"isCurvedProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isCurved",
"==",
"null",
")",
"{",
"this",
".",
"isCurved",
"=",
"new",
"ReadOnlyBooleanWrapper",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"IS_CURVED",
",",
"false",... | Replies the isCurved property.
@return the isCurved property. | [
"Replies",
"the",
"isCurved",
"property",
"."
] | train | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Path2dfx.java#L333-L347 |
paypal/SeLion | dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/DataProviderHelper.java | DataProviderHelper.parseIndexString | public static int[] parseIndexString(String value) {
logger.entering(value);
List<Integer> indexes = new ArrayList<>();
int begin;
int end;
String[] parsed;
String[] parsedIndex = value.split(",");
for (String index : parsedIndex) {
if (index.contains("-")) {
parsed = index.split("-");
begin = Integer.parseInt(parsed[0].trim());
end = Integer.parseInt(parsed[1].trim());
for (int i = begin; i <= end; i++) {
indexes.add(i);
}
} else {
try {
indexes.add(Integer.parseInt(index.trim()));
} catch (NumberFormatException e) {
String msg = new StringBuilder("Index '").append(index)
.append("' is invalid. Please provide either individual numbers or ranges.")
.append("\n Range needs to be de-marked by '-'").toString();
throw new DataProviderException(msg, e);
}
}
}
int[] indexArray = Ints.toArray(indexes);
logger.exiting(indexArray);
return indexArray;
} | java | public static int[] parseIndexString(String value) {
logger.entering(value);
List<Integer> indexes = new ArrayList<>();
int begin;
int end;
String[] parsed;
String[] parsedIndex = value.split(",");
for (String index : parsedIndex) {
if (index.contains("-")) {
parsed = index.split("-");
begin = Integer.parseInt(parsed[0].trim());
end = Integer.parseInt(parsed[1].trim());
for (int i = begin; i <= end; i++) {
indexes.add(i);
}
} else {
try {
indexes.add(Integer.parseInt(index.trim()));
} catch (NumberFormatException e) {
String msg = new StringBuilder("Index '").append(index)
.append("' is invalid. Please provide either individual numbers or ranges.")
.append("\n Range needs to be de-marked by '-'").toString();
throw new DataProviderException(msg, e);
}
}
}
int[] indexArray = Ints.toArray(indexes);
logger.exiting(indexArray);
return indexArray;
} | [
"public",
"static",
"int",
"[",
"]",
"parseIndexString",
"(",
"String",
"value",
")",
"{",
"logger",
".",
"entering",
"(",
"value",
")",
";",
"List",
"<",
"Integer",
">",
"indexes",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"begin",
";",
"... | This function will parse the index string into separated individual indexes as needed. Calling the method with a
string containing "1, 3, 5-7, 11, 12-14, 8" would return an list of integers {1, 3, 5, 6, 7, 11, 12, 13, 14, 8}.
Use ',' to separate values, and use '-' to specify a continuous range. Presence of an invalid character would
result in {@link DataProviderException}.
@param value
the input string represent the indexes to be parse.
@return a list of indexes as an integer array | [
"This",
"function",
"will",
"parse",
"the",
"index",
"string",
"into",
"separated",
"individual",
"indexes",
"as",
"needed",
".",
"Calling",
"the",
"method",
"with",
"a",
"string",
"containing",
"1",
"3",
"5",
"-",
"7",
"11",
"12",
"-",
"14",
"8",
"would... | train | https://github.com/paypal/SeLion/blob/694d12d0df76db48d0360b16192770c6a4fbdfd2/dataproviders/src/main/java/com/paypal/selion/platform/dataprovider/impl/DataProviderHelper.java#L70-L101 |
OpenLiberty/open-liberty | dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java | ParserBase.explodeArtifact | public ArtifactMetadata explodeArtifact(File archiveFile, File metadataFile) throws RepositoryArchiveException {
String path;
try {
path = archiveFile.getCanonicalPath();
} catch (IOException e) {
throw new RepositoryArchiveException("Failed to get the path for the archive", archiveFile, e);
}
String zipPath;
if (metadataFile != null) {
try {
zipPath = metadataFile.getCanonicalPath();
} catch (IOException e) {
throw new RepositoryArchiveException("Failed to get the path for the metadata file", metadataFile, e);
}
} else {
zipPath = path + ".metadata.zip";
}
File zip = new File(zipPath);
if (!zip.exists()) {
return null;
}
return explodeZip(zip);
} | java | public ArtifactMetadata explodeArtifact(File archiveFile, File metadataFile) throws RepositoryArchiveException {
String path;
try {
path = archiveFile.getCanonicalPath();
} catch (IOException e) {
throw new RepositoryArchiveException("Failed to get the path for the archive", archiveFile, e);
}
String zipPath;
if (metadataFile != null) {
try {
zipPath = metadataFile.getCanonicalPath();
} catch (IOException e) {
throw new RepositoryArchiveException("Failed to get the path for the metadata file", metadataFile, e);
}
} else {
zipPath = path + ".metadata.zip";
}
File zip = new File(zipPath);
if (!zip.exists()) {
return null;
}
return explodeZip(zip);
} | [
"public",
"ArtifactMetadata",
"explodeArtifact",
"(",
"File",
"archiveFile",
",",
"File",
"metadataFile",
")",
"throws",
"RepositoryArchiveException",
"{",
"String",
"path",
";",
"try",
"{",
"path",
"=",
"archiveFile",
".",
"getCanonicalPath",
"(",
")",
";",
"}",
... | This signature of explodeArtifact is called directly if the archive file
and the metadata file may not be co-located e.g. when pulling them out
of different parts of the build.
@param archiveFile - the .jar or .esa file to look for a sibling zip for
@param metadataFile - the *.metadata.zip file or null to use one
co-located with the archiveFile
@return The artifact metadata from the sibling zip or <code>null</code>
if none was found
@throws IOException
@throws RepositoryArchiveException | [
"This",
"signature",
"of",
"explodeArtifact",
"is",
"called",
"directly",
"if",
"the",
"archive",
"file",
"and",
"the",
"metadata",
"file",
"may",
"not",
"be",
"co",
"-",
"located",
"e",
".",
"g",
".",
"when",
"pulling",
"them",
"out",
"of",
"different",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.repository.parsers/src/com/ibm/ws/repository/parsers/ParserBase.java#L434-L459 |
maguro/aunit | junit/src/main/java/com/toolazydogs/aunit/Assert.java | Assert.assertToken | public static void assertToken(int expectedType, String expectedText, LexerResults lexerResults)
{
assertToken(expectedType, expectedText, lexerResults.getToken());
} | java | public static void assertToken(int expectedType, String expectedText, LexerResults lexerResults)
{
assertToken(expectedType, expectedText, lexerResults.getToken());
} | [
"public",
"static",
"void",
"assertToken",
"(",
"int",
"expectedType",
",",
"String",
"expectedText",
",",
"LexerResults",
"lexerResults",
")",
"{",
"assertToken",
"(",
"expectedType",
",",
"expectedText",
",",
"lexerResults",
".",
"getToken",
"(",
")",
")",
";"... | Asserts the token produced by an ANTLR tester.
@param expectedType the expected type of the token.
@param expectedText the expected text of the token.
@param lexerResults the result of {@link Work#scan(String)} which will
produce the token to assert. | [
"Asserts",
"the",
"token",
"produced",
"by",
"an",
"ANTLR",
"tester",
"."
] | train | https://github.com/maguro/aunit/blob/1f972e35b28327e5e2e7881befc928df0546d74c/junit/src/main/java/com/toolazydogs/aunit/Assert.java#L74-L77 |
nats-io/java-nats | src/main/java/io/nats/client/NKey.java | NKey.getPublicKey | public char[] getPublicKey() throws GeneralSecurityException, IOException {
if (publicKey != null) {
return publicKey;
}
KeyPair keys = getKeyPair();
EdDSAPublicKey pubKey = (EdDSAPublicKey) keys.getPublic();
byte[] pubBytes = pubKey.getAbyte();
return encode(this.type, pubBytes);
} | java | public char[] getPublicKey() throws GeneralSecurityException, IOException {
if (publicKey != null) {
return publicKey;
}
KeyPair keys = getKeyPair();
EdDSAPublicKey pubKey = (EdDSAPublicKey) keys.getPublic();
byte[] pubBytes = pubKey.getAbyte();
return encode(this.type, pubBytes);
} | [
"public",
"char",
"[",
"]",
"getPublicKey",
"(",
")",
"throws",
"GeneralSecurityException",
",",
"IOException",
"{",
"if",
"(",
"publicKey",
"!=",
"null",
")",
"{",
"return",
"publicKey",
";",
"}",
"KeyPair",
"keys",
"=",
"getKeyPair",
"(",
")",
";",
"EdDS... | @return the encoded public key for this NKey
@throws GeneralSecurityException if there is an encryption problem
@throws IOException if there is a problem encoding the public
key | [
"@return",
"the",
"encoded",
"public",
"key",
"for",
"this",
"NKey"
] | train | https://github.com/nats-io/java-nats/blob/5f291048fd30192ba39b3fe2925ecd60aaad6b48/src/main/java/io/nats/client/NKey.java#L698-L708 |
seancfoley/IPAddress | IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java | IPAddress.toAddressString | @Override
public IPAddressString toAddressString() {
if(fromString == null) {
IPAddressStringParameters params = createFromStringParams();
fromString = new IPAddressString(this, params); /* address string creation */
}
return getAddressfromString();
} | java | @Override
public IPAddressString toAddressString() {
if(fromString == null) {
IPAddressStringParameters params = createFromStringParams();
fromString = new IPAddressString(this, params); /* address string creation */
}
return getAddressfromString();
} | [
"@",
"Override",
"public",
"IPAddressString",
"toAddressString",
"(",
")",
"{",
"if",
"(",
"fromString",
"==",
"null",
")",
"{",
"IPAddressStringParameters",
"params",
"=",
"createFromStringParams",
"(",
")",
";",
"fromString",
"=",
"new",
"IPAddressString",
"(",
... | Generates an IPAddressString object for this IPAddress object.
<p>
This same IPAddress object can be retrieved from the resulting IPAddressString object using {@link IPAddressString#getAddress()}
<p>
In general, users are intended to create IPAddress objects from IPAddressString objects,
while the reverse direction is generally not all that useful.
<p>
However, the reverse direction can be useful under certain circumstances.
<p>
Not all IPAddressString objects can be converted to IPAddress objects,
as is the case with IPAddressString objects corresponding to the types IPType.INVALID and IPType.EMPTY.
<p>
Not all IPAddressString objects can be converted to IPAddress objects without specifying the IP version,
as is the case with IPAddressString objects corresponding to the types IPType.PREFIX and IPType.ALL.
<p>
So in the event you wish to store a collection of IPAddress objects with a collection of IPAddressString objects,
and not all the IPAddressString objects can be converted to IPAddress objects, then you may wish to use a collection
of only IPAddressString objects, in which case this method is useful.
@return an IPAddressString object for this IPAddress. | [
"Generates",
"an",
"IPAddressString",
"object",
"for",
"this",
"IPAddress",
"object",
".",
"<p",
">",
"This",
"same",
"IPAddress",
"object",
"can",
"be",
"retrieved",
"from",
"the",
"resulting",
"IPAddressString",
"object",
"using",
"{",
"@link",
"IPAddressString#... | train | https://github.com/seancfoley/IPAddress/blob/90493d0673511d673100c36d020dd93dd870111a/IPAddress/src/inet.ipaddr/inet/ipaddr/IPAddress.java#L1016-L1023 |
TakahikoKawasaki/nv-cipher | src/main/java/com/neovisionaries/security/AESCipher.java | AESCipher.setKey | public AESCipher setKey(String key, byte[] iv)
{
byte[] key2 = Utils.getBytesUTF8(key);
return setKey(key2, iv);
} | java | public AESCipher setKey(String key, byte[] iv)
{
byte[] key2 = Utils.getBytesUTF8(key);
return setKey(key2, iv);
} | [
"public",
"AESCipher",
"setKey",
"(",
"String",
"key",
",",
"byte",
"[",
"]",
"iv",
")",
"{",
"byte",
"[",
"]",
"key2",
"=",
"Utils",
".",
"getBytesUTF8",
"(",
"key",
")",
";",
"return",
"setKey",
"(",
"key2",
",",
"iv",
")",
";",
"}"
] | Set cipher initialization parameters.
@param key
Secret key. The value is converted to a byte array
by {@code key.getBytes("UTF-8")} and used as the
first argument of {@link #setKey(byte[], byte[])}.
If {@code null} is given, {@code null} is passed
to {@link #setKey(byte[], byte[])}.
@param iv
Initial vector. The value is pass to {@link
#setKey(byte[], byte[])} as the second argument
as is.
@return
{@code this} object.
@since 1.2 | [
"Set",
"cipher",
"initialization",
"parameters",
"."
] | train | https://github.com/TakahikoKawasaki/nv-cipher/blob/d01aa4f53611e2724ae03633060f55bacf549175/src/main/java/com/neovisionaries/security/AESCipher.java#L308-L313 |
diffplug/durian | src/com/diffplug/common/base/TreeQuery.java | TreeQuery.findByPath | public static <T> Optional<T> findByPath(TreeDef<T> treeDef, T node, List<T> path, Function<? super T, ?> mapper) {
return findByPath(treeDef, node, mapper, path, mapper);
} | java | public static <T> Optional<T> findByPath(TreeDef<T> treeDef, T node, List<T> path, Function<? super T, ?> mapper) {
return findByPath(treeDef, node, mapper, path, mapper);
} | [
"public",
"static",
"<",
"T",
">",
"Optional",
"<",
"T",
">",
"findByPath",
"(",
"TreeDef",
"<",
"T",
">",
"treeDef",
",",
"T",
"node",
",",
"List",
"<",
"T",
">",
"path",
",",
"Function",
"<",
"?",
"super",
"T",
",",
"?",
">",
"mapper",
")",
"... | Finds a child TreeNode based on its path.
<p>
Searches the child nodes for the first element, then that
node's children for the second element, etc.
@param treeDef defines a tree
@param node starting point for the search
@param path the path of nodes which we're looking
@param mapper maps elements to some value for comparison between the tree and the path | [
"Finds",
"a",
"child",
"TreeNode",
"based",
"on",
"its",
"path",
".",
"<p",
">",
"Searches",
"the",
"child",
"nodes",
"for",
"the",
"first",
"element",
"then",
"that",
"node",
"s",
"children",
"for",
"the",
"second",
"element",
"etc",
"."
] | train | https://github.com/diffplug/durian/blob/10631a3480e5491eb6eb6ee06e752d8596914232/src/com/diffplug/common/base/TreeQuery.java#L304-L306 |
Azure/azure-sdk-for-java | batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java | JobsInner.beginTerminateAsync | public Observable<Void> beginTerminateAsync(String resourceGroupName, String workspaceName, String experimentName, String jobName) {
return beginTerminateWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | java | public Observable<Void> beginTerminateAsync(String resourceGroupName, String workspaceName, String experimentName, String jobName) {
return beginTerminateWithServiceResponseAsync(resourceGroupName, workspaceName, experimentName, jobName).map(new Func1<ServiceResponse<Void>, Void>() {
@Override
public Void call(ServiceResponse<Void> response) {
return response.body();
}
});
} | [
"public",
"Observable",
"<",
"Void",
">",
"beginTerminateAsync",
"(",
"String",
"resourceGroupName",
",",
"String",
"workspaceName",
",",
"String",
"experimentName",
",",
"String",
"jobName",
")",
"{",
"return",
"beginTerminateWithServiceResponseAsync",
"(",
"resourceGr... | Terminates a job.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param workspaceName The name of the workspace. Workspace names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param experimentName The name of the experiment. Experiment names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@param jobName The name of the job within the specified resource group. Job names can only contain a combination of alphanumeric characters along with dash (-) and underscore (_). The name must be from 1 through 64 characters long.
@throws IllegalArgumentException thrown if parameters fail the validation
@return the {@link ServiceResponse} object if successful. | [
"Terminates",
"a",
"job",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batchai/resource-manager/v2018_05_01/src/main/java/com/microsoft/azure/management/batchai/v2018_05_01/implementation/JobsInner.java#L1285-L1292 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/listeners/AddResourcesListener.java | AddResourcesListener.addBasicJSResource | public static void addBasicJSResource(String library, String resource) {
addResource(resource, library, resource, BASIC_JS_RESOURCE_KEY);
} | java | public static void addBasicJSResource(String library, String resource) {
addResource(resource, library, resource, BASIC_JS_RESOURCE_KEY);
} | [
"public",
"static",
"void",
"addBasicJSResource",
"(",
"String",
"library",
",",
"String",
"resource",
")",
"{",
"addResource",
"(",
"resource",
",",
"library",
",",
"resource",
",",
"BASIC_JS_RESOURCE_KEY",
")",
";",
"}"
] | Registers a core JS file that needs to be included in the header of the HTML
file, but after jQuery and AngularJS.
@param library The name of the sub-folder of the resources folder.
@param resource The name of the resource file within the library folder. | [
"Registers",
"a",
"core",
"JS",
"file",
"that",
"needs",
"to",
"be",
"included",
"in",
"the",
"header",
"of",
"the",
"HTML",
"file",
"but",
"after",
"jQuery",
"and",
"AngularJS",
"."
] | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/listeners/AddResourcesListener.java#L849-L851 |
Alluxio/alluxio | core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java | CompletableFuture.delayedExecutor | public static Executor delayedExecutor(long delay, TimeUnit unit) {
return new DelayedExecutor(delay, Objects.requireNonNull(unit), ASYNC_POOL);
} | java | public static Executor delayedExecutor(long delay, TimeUnit unit) {
return new DelayedExecutor(delay, Objects.requireNonNull(unit), ASYNC_POOL);
} | [
"public",
"static",
"Executor",
"delayedExecutor",
"(",
"long",
"delay",
",",
"TimeUnit",
"unit",
")",
"{",
"return",
"new",
"DelayedExecutor",
"(",
"delay",
",",
"Objects",
".",
"requireNonNull",
"(",
"unit",
")",
",",
"ASYNC_POOL",
")",
";",
"}"
] | Returns a new Executor that submits a task to the default executor after the given delay (or no
delay if non-positive). Each delay commences upon invocation of the returned executor's
{@code execute} method.
@param delay how long to delay, in units of {@code unit}
@param unit a {@code TimeUnit} determining how to interpret the {@code delay} parameter
@return the new delayed executor
@since 9 | [
"Returns",
"a",
"new",
"Executor",
"that",
"submits",
"a",
"task",
"to",
"the",
"default",
"executor",
"after",
"the",
"given",
"delay",
"(",
"or",
"no",
"delay",
"if",
"non",
"-",
"positive",
")",
".",
"Each",
"delay",
"commences",
"upon",
"invocation",
... | train | https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/concurrent/jsr/CompletableFuture.java#L536-L538 |
Harium/keel | src/main/java/com/harium/keel/catalano/math/distance/Distance.java | Distance.Minkowski | public static double Minkowski(IntPoint p, IntPoint q, int r) {
return Minkowski(p.x, p.y, q.x, q.y, r);
} | java | public static double Minkowski(IntPoint p, IntPoint q, int r) {
return Minkowski(p.x, p.y, q.x, q.y, r);
} | [
"public",
"static",
"double",
"Minkowski",
"(",
"IntPoint",
"p",
",",
"IntPoint",
"q",
",",
"int",
"r",
")",
"{",
"return",
"Minkowski",
"(",
"p",
".",
"x",
",",
"p",
".",
"y",
",",
"q",
".",
"x",
",",
"q",
".",
"y",
",",
"r",
")",
";",
"}"
] | Gets the Minkowski distance between two points.
@param p IntPoint with X and Y axis coordinates.
@param q IntPoint with X and Y axis coordinates.
@param r Order between two points.
@return The Minkowski distance between x and y. | [
"Gets",
"the",
"Minkowski",
"distance",
"between",
"two",
"points",
"."
] | train | https://github.com/Harium/keel/blob/0369ae674f9e664bccc5f9e161ae7e7a3b949a1e/src/main/java/com/harium/keel/catalano/math/distance/Distance.java#L745-L747 |
camunda/camunda-xml-model | src/main/java/org/camunda/bpm/model/xml/impl/util/IoUtil.java | IoUtil.writeDocumentToOutputStream | public static void writeDocumentToOutputStream(DomDocument document, OutputStream outputStream) {
StreamResult result = new StreamResult(outputStream);
transformDocumentToXml(document, result);
} | java | public static void writeDocumentToOutputStream(DomDocument document, OutputStream outputStream) {
StreamResult result = new StreamResult(outputStream);
transformDocumentToXml(document, result);
} | [
"public",
"static",
"void",
"writeDocumentToOutputStream",
"(",
"DomDocument",
"document",
",",
"OutputStream",
"outputStream",
")",
"{",
"StreamResult",
"result",
"=",
"new",
"StreamResult",
"(",
"outputStream",
")",
";",
"transformDocumentToXml",
"(",
"document",
",... | Writes a {@link DomDocument} to an {@link OutputStream} by transforming the DOM to XML.
@param document the DOM document to write
@param outputStream the {@link OutputStream} to write to | [
"Writes",
"a",
"{",
"@link",
"DomDocument",
"}",
"to",
"an",
"{",
"@link",
"OutputStream",
"}",
"by",
"transforming",
"the",
"DOM",
"to",
"XML",
"."
] | train | https://github.com/camunda/camunda-xml-model/blob/85b3f879e26d063f71c94cfd21ac17d9ff6baf4d/src/main/java/org/camunda/bpm/model/xml/impl/util/IoUtil.java#L113-L116 |
ineunetOS/knife-commons | knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java | StringUtils.lastOrdinalIndexOf | public static int lastOrdinalIndexOf(String str, String searchStr, int ordinal) {
return ordinalIndexOf(str, searchStr, ordinal, true);
} | java | public static int lastOrdinalIndexOf(String str, String searchStr, int ordinal) {
return ordinalIndexOf(str, searchStr, ordinal, true);
} | [
"public",
"static",
"int",
"lastOrdinalIndexOf",
"(",
"String",
"str",
",",
"String",
"searchStr",
",",
"int",
"ordinal",
")",
"{",
"return",
"ordinalIndexOf",
"(",
"str",
",",
"searchStr",
",",
"ordinal",
",",
"true",
")",
";",
"}"
] | <p>Finds the n-th last index within a String, handling <code>null</code>.
This method uses {@link String#lastIndexOf(String)}.</p>
<p>A <code>null</code> String will return <code>-1</code>.</p>
<pre>
StringUtils.lastOrdinalIndexOf(null, *, *) = -1
StringUtils.lastOrdinalIndexOf(*, null, *) = -1
StringUtils.lastOrdinalIndexOf("", "", *) = 0
StringUtils.lastOrdinalIndexOf("aabaabaa", "a", 1) = 7
StringUtils.lastOrdinalIndexOf("aabaabaa", "a", 2) = 6
StringUtils.lastOrdinalIndexOf("aabaabaa", "b", 1) = 5
StringUtils.lastOrdinalIndexOf("aabaabaa", "b", 2) = 2
StringUtils.lastOrdinalIndexOf("aabaabaa", "ab", 1) = 4
StringUtils.lastOrdinalIndexOf("aabaabaa", "ab", 2) = 1
StringUtils.lastOrdinalIndexOf("aabaabaa", "", 1) = 8
StringUtils.lastOrdinalIndexOf("aabaabaa", "", 2) = 8
</pre>
<p>Note that 'tail(String str, int n)' may be implemented as: </p>
<pre>
str.substring(lastOrdinalIndexOf(str, "\n", n) + 1)
</pre>
@param str the String to check, may be null
@param searchStr the String to find, may be null
@param ordinal the n-th last <code>searchStr</code> to find
@return the n-th last index of the search String,
<code>-1</code> (<code>INDEX_NOT_FOUND</code>) if no match or <code>null</code> string input
@since 2.5 | [
"<p",
">",
"Finds",
"the",
"n",
"-",
"th",
"last",
"index",
"within",
"a",
"String",
"handling",
"<code",
">",
"null<",
"/",
"code",
">",
".",
"This",
"method",
"uses",
"{",
"@link",
"String#lastIndexOf",
"(",
"String",
")",
"}",
".",
"<",
"/",
"p",
... | train | https://github.com/ineunetOS/knife-commons/blob/eae9e59afa020a00ae8977c10d43ac8ae46ae236/knife-commons-utils/src/main/java/com/ineunet/knife/util/StringUtils.java#L1068-L1070 |
fhoeben/hsac-fitnesse-fixtures | src/main/java/nl/hsac/fitnesse/junit/JUnitXMLPerPageListener.java | JUnitXMLPerPageListener.writeResult | protected void writeResult(String testName, String resultXml) throws IOException {
String finalPath = getXmlFileName(testName);
Writer fw = null;
try {
fw = new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(finalPath),
"UTF-8"));
fw.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fw.write(resultXml);
} finally {
if (fw != null) {
fw.close();
}
}
} | java | protected void writeResult(String testName, String resultXml) throws IOException {
String finalPath = getXmlFileName(testName);
Writer fw = null;
try {
fw = new BufferedWriter(
new OutputStreamWriter(
new FileOutputStream(finalPath),
"UTF-8"));
fw.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fw.write(resultXml);
} finally {
if (fw != null) {
fw.close();
}
}
} | [
"protected",
"void",
"writeResult",
"(",
"String",
"testName",
",",
"String",
"resultXml",
")",
"throws",
"IOException",
"{",
"String",
"finalPath",
"=",
"getXmlFileName",
"(",
"testName",
")",
";",
"Writer",
"fw",
"=",
"null",
";",
"try",
"{",
"fw",
"=",
... | Writes XML result to disk.
@param testName name of test.
@param resultXml XML description of test outcome.
@throws IOException if unable to write result. | [
"Writes",
"XML",
"result",
"to",
"disk",
"."
] | train | https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/junit/JUnitXMLPerPageListener.java#L119-L134 |
scireum/server-sass | src/main/java/org/serversass/Functions.java | Functions.darken | public static Expression darken(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int decrease = input.getExpectedIntParam(1);
return changeLighteness(color, -decrease);
} | java | public static Expression darken(Generator generator, FunctionCall input) {
Color color = input.getExpectedColorParam(0);
int decrease = input.getExpectedIntParam(1);
return changeLighteness(color, -decrease);
} | [
"public",
"static",
"Expression",
"darken",
"(",
"Generator",
"generator",
",",
"FunctionCall",
"input",
")",
"{",
"Color",
"color",
"=",
"input",
".",
"getExpectedColorParam",
"(",
"0",
")",
";",
"int",
"decrease",
"=",
"input",
".",
"getExpectedIntParam",
"(... | Decreases the lightness of the given color by N percent.
@param generator the surrounding generator
@param input the function call to evaluate
@return the result of the evaluation | [
"Decreases",
"the",
"lightness",
"of",
"the",
"given",
"color",
"by",
"N",
"percent",
"."
] | train | https://github.com/scireum/server-sass/blob/e74af983567f10c43420d70cd31165dd080ba8fc/src/main/java/org/serversass/Functions.java#L130-L134 |
raphw/byte-buddy | byte-buddy-dep/src/main/java/net/bytebuddy/asm/ModifierAdjustment.java | ModifierAdjustment.withTypeModifiers | public ModifierAdjustment withTypeModifiers(ElementMatcher<? super TypeDescription> matcher,
ModifierContributor.ForType... modifierContributor) {
return withTypeModifiers(matcher, Arrays.asList(modifierContributor));
} | java | public ModifierAdjustment withTypeModifiers(ElementMatcher<? super TypeDescription> matcher,
ModifierContributor.ForType... modifierContributor) {
return withTypeModifiers(matcher, Arrays.asList(modifierContributor));
} | [
"public",
"ModifierAdjustment",
"withTypeModifiers",
"(",
"ElementMatcher",
"<",
"?",
"super",
"TypeDescription",
">",
"matcher",
",",
"ModifierContributor",
".",
"ForType",
"...",
"modifierContributor",
")",
"{",
"return",
"withTypeModifiers",
"(",
"matcher",
",",
"A... | Adjusts an instrumented type's modifiers if it matches the supplied matcher.
@param matcher The matcher that determines a type's eligibility.
@param modifierContributor The modifier contributors to enforce.
@return A new modifier adjustment that enforces the given modifier contributors and any previous adjustments. | [
"Adjusts",
"an",
"instrumented",
"type",
"s",
"modifiers",
"if",
"it",
"matches",
"the",
"supplied",
"matcher",
"."
] | train | https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/asm/ModifierAdjustment.java#L119-L122 |
netscaler/nitro | src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationvserver_binding.java | authenticationvserver_binding.get | public static authenticationvserver_binding get(nitro_service service, String name) throws Exception{
authenticationvserver_binding obj = new authenticationvserver_binding();
obj.set_name(name);
authenticationvserver_binding response = (authenticationvserver_binding) obj.get_resource(service);
return response;
} | java | public static authenticationvserver_binding get(nitro_service service, String name) throws Exception{
authenticationvserver_binding obj = new authenticationvserver_binding();
obj.set_name(name);
authenticationvserver_binding response = (authenticationvserver_binding) obj.get_resource(service);
return response;
} | [
"public",
"static",
"authenticationvserver_binding",
"get",
"(",
"nitro_service",
"service",
",",
"String",
"name",
")",
"throws",
"Exception",
"{",
"authenticationvserver_binding",
"obj",
"=",
"new",
"authenticationvserver_binding",
"(",
")",
";",
"obj",
".",
"set_na... | Use this API to fetch authenticationvserver_binding resource of given name . | [
"Use",
"this",
"API",
"to",
"fetch",
"authenticationvserver_binding",
"resource",
"of",
"given",
"name",
"."
] | train | https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/authentication/authenticationvserver_binding.java#L202-L207 |
opendatatrentino/s-match | src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java | MatcherLibrary.getRelation | protected char getRelation(IAtomicConceptOfLabel sourceACoL, IAtomicConceptOfLabel targetACoL) throws MatcherLibraryException {
try {
char relation = senseMatcher.getRelation(sourceACoL.getSenseList(), targetACoL.getSenseList());
//if WN matcher did not find relation
if (IMappingElement.IDK == relation) {
if (useWeakSemanticsElementLevelMatchersLibrary) {
//use string based matchers
relation = getRelationFromStringMatchers(sourceACoL.getLemma(), targetACoL.getLemma());
//if they did not find relation
if (IMappingElement.IDK == relation) {
//use sense and gloss based matchers
relation = getRelationFromSenseGlossMatchers(sourceACoL.getSenseList(), targetACoL.getSenseList());
}
}
}
return relation;
} catch (SenseMatcherException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new MatcherLibraryException(errMessage, e);
}
} | java | protected char getRelation(IAtomicConceptOfLabel sourceACoL, IAtomicConceptOfLabel targetACoL) throws MatcherLibraryException {
try {
char relation = senseMatcher.getRelation(sourceACoL.getSenseList(), targetACoL.getSenseList());
//if WN matcher did not find relation
if (IMappingElement.IDK == relation) {
if (useWeakSemanticsElementLevelMatchersLibrary) {
//use string based matchers
relation = getRelationFromStringMatchers(sourceACoL.getLemma(), targetACoL.getLemma());
//if they did not find relation
if (IMappingElement.IDK == relation) {
//use sense and gloss based matchers
relation = getRelationFromSenseGlossMatchers(sourceACoL.getSenseList(), targetACoL.getSenseList());
}
}
}
return relation;
} catch (SenseMatcherException e) {
final String errMessage = e.getClass().getSimpleName() + ": " + e.getMessage();
log.error(errMessage, e);
throw new MatcherLibraryException(errMessage, e);
}
} | [
"protected",
"char",
"getRelation",
"(",
"IAtomicConceptOfLabel",
"sourceACoL",
",",
"IAtomicConceptOfLabel",
"targetACoL",
")",
"throws",
"MatcherLibraryException",
"{",
"try",
"{",
"char",
"relation",
"=",
"senseMatcher",
".",
"getRelation",
"(",
"sourceACoL",
".",
... | Returns a semantic relation between two atomic concepts.
@param sourceACoL source concept
@param targetACoL target concept
@return relation between concepts
@throws MatcherLibraryException MatcherLibraryException | [
"Returns",
"a",
"semantic",
"relation",
"between",
"two",
"atomic",
"concepts",
"."
] | train | https://github.com/opendatatrentino/s-match/blob/ba5982ef406b7010c2f92592e43887a485935aa1/src/main/java/it/unitn/disi/smatch/matchers/element/MatcherLibrary.java#L178-L201 |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/externallink/CmsEditExternalLinkDialog.java | CmsEditExternalLinkDialog.setOkEnabled | protected void setOkEnabled(boolean enabled, String message) {
if (enabled) {
m_okButton.enable();
} else {
m_okButton.disable(message);
}
} | java | protected void setOkEnabled(boolean enabled, String message) {
if (enabled) {
m_okButton.enable();
} else {
m_okButton.disable(message);
}
} | [
"protected",
"void",
"setOkEnabled",
"(",
"boolean",
"enabled",
",",
"String",
"message",
")",
"{",
"if",
"(",
"enabled",
")",
"{",
"m_okButton",
".",
"enable",
"(",
")",
";",
"}",
"else",
"{",
"m_okButton",
".",
"disable",
"(",
"message",
")",
";",
"}... | Enables or disables the OK button.<p>
@param enabled <code>true</code> to enable the button
@param message the disabled reason | [
"Enables",
"or",
"disables",
"the",
"OK",
"button",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/externallink/CmsEditExternalLinkDialog.java#L371-L378 |
elki-project/elki | elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/clustering/CBLOF.java | CBLOF.getClusterBoundary | private int getClusterBoundary(Relation<O> relation, List<? extends Cluster<MeanModel>> clusters) {
int totalSize = relation.size();
int clusterBoundary = clusters.size() - 1;
int cumulativeSize = 0;
for(int i = 0; i < clusters.size() - 1; i++) {
cumulativeSize += clusters.get(i).size();
// Given majority covered by large cluster
if(cumulativeSize >= totalSize * alpha) {
clusterBoundary = i;
break;
}
// Relative difference in cluster size between two consecutive clusters
if(clusters.get(i).size() / (double) clusters.get(i + 1).size() >= beta) {
clusterBoundary = i;
break;
}
}
return clusterBoundary;
} | java | private int getClusterBoundary(Relation<O> relation, List<? extends Cluster<MeanModel>> clusters) {
int totalSize = relation.size();
int clusterBoundary = clusters.size() - 1;
int cumulativeSize = 0;
for(int i = 0; i < clusters.size() - 1; i++) {
cumulativeSize += clusters.get(i).size();
// Given majority covered by large cluster
if(cumulativeSize >= totalSize * alpha) {
clusterBoundary = i;
break;
}
// Relative difference in cluster size between two consecutive clusters
if(clusters.get(i).size() / (double) clusters.get(i + 1).size() >= beta) {
clusterBoundary = i;
break;
}
}
return clusterBoundary;
} | [
"private",
"int",
"getClusterBoundary",
"(",
"Relation",
"<",
"O",
">",
"relation",
",",
"List",
"<",
"?",
"extends",
"Cluster",
"<",
"MeanModel",
">",
">",
"clusters",
")",
"{",
"int",
"totalSize",
"=",
"relation",
".",
"size",
"(",
")",
";",
"int",
"... | Compute the boundary index separating the large cluster from the small
cluster.
@param relation Data to process
@param clusters All clusters that were found
@return Index of boundary between large and small cluster. | [
"Compute",
"the",
"boundary",
"index",
"separating",
"the",
"large",
"cluster",
"from",
"the",
"small",
"cluster",
"."
] | train | https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/clustering/CBLOF.java#L191-L211 |
OpenLiberty/open-liberty | dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/RequestIdTable.java | RequestIdTable.getListener | public synchronized ReceiveListener getListener(int requestId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getListener", ""+requestId);
if (!containsId(requestId))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceTable("id ("+requestId+") not in table");
throw new SIErrorException(nls.getFormattedMessage("REQIDTABLE_INTERNAL_SICJ0058", null, "REQIDTABLE_INTERNAL_SICJ0058")); // D226223
}
testReqIdTableEntry.requestId = requestId;
RequestIdTableEntry entry = table.get(testReqIdTableEntry);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getListener", entry.receiveListener);
return entry.receiveListener;
} | java | public synchronized ReceiveListener getListener(int requestId)
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "getListener", ""+requestId);
if (!containsId(requestId))
{
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) debugTraceTable("id ("+requestId+") not in table");
throw new SIErrorException(nls.getFormattedMessage("REQIDTABLE_INTERNAL_SICJ0058", null, "REQIDTABLE_INTERNAL_SICJ0058")); // D226223
}
testReqIdTableEntry.requestId = requestId;
RequestIdTableEntry entry = table.get(testReqIdTableEntry);
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "getListener", entry.receiveListener);
return entry.receiveListener;
} | [
"public",
"synchronized",
"ReceiveListener",
"getListener",
"(",
"int",
"requestId",
")",
"{",
"if",
"(",
"TraceComponent",
".",
"isAnyTracingEnabled",
"(",
")",
"&&",
"tc",
".",
"isEntryEnabled",
"(",
")",
")",
"SibTr",
".",
"entry",
"(",
"this",
",",
"tc",... | Returns the receive listener associated with the specified request ID.
The request ID must be present in the table otherwise a runtime
exception will be thrown.
@param requestId The request ID to retrieve the receive listener for.
@return ReceiveListener The receive listener received. | [
"Returns",
"the",
"receive",
"listener",
"associated",
"with",
"the",
"specified",
"request",
"ID",
".",
"The",
"request",
"ID",
"must",
"be",
"present",
"in",
"the",
"table",
"otherwise",
"a",
"runtime",
"exception",
"will",
"be",
"thrown",
"."
] | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/jfapchannel/impl/RequestIdTable.java#L188-L203 |
OpenLiberty/open-liberty | dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java | WSRdbManagedConnectionImpl.setAutoCommit | public final void setAutoCommit(boolean value) throws SQLException
{
if (value != currentAutoCommit || helper.alwaysSetAutoCommit())
{
if( (dsConfig.get().isolationLevel == Connection.TRANSACTION_NONE) && (value == false) )
throw new SQLException(AdapterUtil.getNLSMessage("DSRA4010.tran.none.autocommit.required", dsConfig.get().id));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Set AutoCommit to " + value);
// Don't update values until AFTER the operation completes successfully on the
// underlying Connection.
sqlConn.setAutoCommit(value);
currentAutoCommit = value;
}
if (cachedConnection != null)
cachedConnection.setCurrentAutoCommit(currentAutoCommit, key);
} | java | public final void setAutoCommit(boolean value) throws SQLException
{
if (value != currentAutoCommit || helper.alwaysSetAutoCommit())
{
if( (dsConfig.get().isolationLevel == Connection.TRANSACTION_NONE) && (value == false) )
throw new SQLException(AdapterUtil.getNLSMessage("DSRA4010.tran.none.autocommit.required", dsConfig.get().id));
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
Tr.debug(this, tc, "Set AutoCommit to " + value);
// Don't update values until AFTER the operation completes successfully on the
// underlying Connection.
sqlConn.setAutoCommit(value);
currentAutoCommit = value;
}
if (cachedConnection != null)
cachedConnection.setCurrentAutoCommit(currentAutoCommit, key);
} | [
"public",
"final",
"void",
"setAutoCommit",
"(",
"boolean",
"value",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"value",
"!=",
"currentAutoCommit",
"||",
"helper",
".",
"alwaysSetAutoCommit",
"(",
")",
")",
"{",
"if",
"(",
"(",
"dsConfig",
".",
"get",
... | /*
Sets the requested autocommit value for the underlying connection if different than
the currently requested value or if required to always set the autocommit value as
a workaround. 346032.2
@param value the newly requested autocommit value. | [
"/",
"*",
"Sets",
"the",
"requested",
"autocommit",
"value",
"for",
"the",
"underlying",
"connection",
"if",
"different",
"than",
"the",
"currently",
"requested",
"value",
"or",
"if",
"required",
"to",
"always",
"set",
"the",
"autocommit",
"value",
"as",
"a",
... | train | https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jdbc/src/com/ibm/ws/rsadapter/impl/WSRdbManagedConnectionImpl.java#L3950-L3967 |
alkacon/opencms-core | src/org/opencms/db/CmsSecurityManager.java | CmsSecurityManager.readChildResources | public List<CmsResource> readChildResources(
CmsRequestContext context,
CmsResource resource,
CmsResourceFilter filter,
boolean getFolders,
boolean getFiles)
throws CmsException, CmsSecurityException {
List<CmsResource> result = null;
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
// check the access permissions
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL);
result = m_driverManager.readChildResources(dbc, resource, filter, getFolders, getFiles, true);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_READ_CHILD_RESOURCES_1, context.getSitePath(resource)),
e);
} finally {
dbc.clear();
}
return result;
} | java | public List<CmsResource> readChildResources(
CmsRequestContext context,
CmsResource resource,
CmsResourceFilter filter,
boolean getFolders,
boolean getFiles)
throws CmsException, CmsSecurityException {
List<CmsResource> result = null;
CmsDbContext dbc = m_dbContextFactory.getDbContext(context);
try {
// check the access permissions
checkPermissions(dbc, resource, CmsPermissionSet.ACCESS_READ, true, CmsResourceFilter.ALL);
result = m_driverManager.readChildResources(dbc, resource, filter, getFolders, getFiles, true);
} catch (Exception e) {
dbc.report(
null,
Messages.get().container(Messages.ERR_READ_CHILD_RESOURCES_1, context.getSitePath(resource)),
e);
} finally {
dbc.clear();
}
return result;
} | [
"public",
"List",
"<",
"CmsResource",
">",
"readChildResources",
"(",
"CmsRequestContext",
"context",
",",
"CmsResource",
"resource",
",",
"CmsResourceFilter",
"filter",
",",
"boolean",
"getFolders",
",",
"boolean",
"getFiles",
")",
"throws",
"CmsException",
",",
"C... | Returns the child resources of a resource, that is the resources
contained in a folder.<p>
With the parameters <code>getFolders</code> and <code>getFiles</code>
you can control what type of resources you want in the result list:
files, folders, or both.<p>
This method is mainly used by the workplace explorer.<p>
@param context the current request context
@param resource the resource to return the child resources for
@param filter the resource filter to use
@param getFolders if true the child folders are included in the result
@param getFiles if true the child files are included in the result
@return a list of all child resources
@throws CmsException if something goes wrong
@throws CmsSecurityException if the user has insufficient permission for the given resource (read is required) | [
"Returns",
"the",
"child",
"resources",
"of",
"a",
"resource",
"that",
"is",
"the",
"resources",
"contained",
"in",
"a",
"folder",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsSecurityManager.java#L4134-L4157 |
datasift/datasift-java | src/main/java/com/datasift/client/FutureData.java | FutureData.sync | public T sync() {
//if data is present there's no need to block
if (data != null) {
return data;
}
synchronized (this) {
try {
// wait();
block.take();
} catch (InterruptedException e) {
if (interruptCause == null) {
interruptCause = e;
}
}
if (interruptCause != null) {
if (interruptCause instanceof DataSiftException) {
throw (DataSiftException) interruptCause;
} else {
throw new DataSiftException("Interrupted while waiting for response", interruptCause);
}
}
return data;
}
} | java | public T sync() {
//if data is present there's no need to block
if (data != null) {
return data;
}
synchronized (this) {
try {
// wait();
block.take();
} catch (InterruptedException e) {
if (interruptCause == null) {
interruptCause = e;
}
}
if (interruptCause != null) {
if (interruptCause instanceof DataSiftException) {
throw (DataSiftException) interruptCause;
} else {
throw new DataSiftException("Interrupted while waiting for response", interruptCause);
}
}
return data;
}
} | [
"public",
"T",
"sync",
"(",
")",
"{",
"//if data is present there's no need to block",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"return",
"data",
";",
"}",
"synchronized",
"(",
"this",
")",
"{",
"try",
"{",
"// wait();",
"block",
".",
"take",
"(",
")",
... | /*
Forces the client to wait until a response is received before returning
@return a result instance - if an interrupt exception is thrown it is possible that a response isn't available
yet the user must check to ensure null isn't returned | [
"/",
"*",
"Forces",
"the",
"client",
"to",
"wait",
"until",
"a",
"response",
"is",
"received",
"before",
"returning"
] | train | https://github.com/datasift/datasift-java/blob/09de124f2a1a507ff6181e59875c6f325290850e/src/main/java/com/datasift/client/FutureData.java#L89-L112 |
jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/sql/SqlKit.java | SqlKit.getSqlParaByString | public SqlPara getSqlParaByString(String content, Object... paras) {
Template template = engine.getTemplateByString(content);
SqlPara sqlPara = new SqlPara();
Map data = new HashMap();
data.put(SQL_PARA_KEY, sqlPara);
data.put(PARA_ARRAY_KEY, paras);
sqlPara.setSql(template.renderToString(data));
// data 为本方法中创建,不会污染用户数据,无需移除 SQL_PARA_KEY、PARA_ARRAY_KEY
return sqlPara;
} | java | public SqlPara getSqlParaByString(String content, Object... paras) {
Template template = engine.getTemplateByString(content);
SqlPara sqlPara = new SqlPara();
Map data = new HashMap();
data.put(SQL_PARA_KEY, sqlPara);
data.put(PARA_ARRAY_KEY, paras);
sqlPara.setSql(template.renderToString(data));
// data 为本方法中创建,不会污染用户数据,无需移除 SQL_PARA_KEY、PARA_ARRAY_KEY
return sqlPara;
} | [
"public",
"SqlPara",
"getSqlParaByString",
"(",
"String",
"content",
",",
"Object",
"...",
"paras",
")",
"{",
"Template",
"template",
"=",
"engine",
".",
"getTemplateByString",
"(",
"content",
")",
";",
"SqlPara",
"sqlPara",
"=",
"new",
"SqlPara",
"(",
")",
... | 通过 String 内容获取 SqlPara 对象
<pre>
例子:
String content = "select * from user where id = #para(0)";
SqlPara sqlPara = getSqlParaByString(content, 123);
特别注意:content 参数中不能包含 #sql 指令
</pre> | [
"通过",
"String",
"内容获取",
"SqlPara",
"对象"
] | train | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/sql/SqlKit.java#L240-L250 |
alkacon/opencms-core | src/org/opencms/db/CmsDriverManager.java | CmsDriverManager.canReadRoleInOu | private boolean canReadRoleInOu(CmsOrganizationalUnit ou, CmsRole role) {
if (ou.hasFlagWebuser() && !role.getRoleName().equals(CmsRole.ACCOUNT_MANAGER.getRoleName())) {
return false;
}
return true;
} | java | private boolean canReadRoleInOu(CmsOrganizationalUnit ou, CmsRole role) {
if (ou.hasFlagWebuser() && !role.getRoleName().equals(CmsRole.ACCOUNT_MANAGER.getRoleName())) {
return false;
}
return true;
} | [
"private",
"boolean",
"canReadRoleInOu",
"(",
"CmsOrganizationalUnit",
"ou",
",",
"CmsRole",
"role",
")",
"{",
"if",
"(",
"ou",
".",
"hasFlagWebuser",
"(",
")",
"&&",
"!",
"role",
".",
"getRoleName",
"(",
")",
".",
"equals",
"(",
"CmsRole",
".",
"ACCOUNT_M... | Helper method to check whether we should bother with reading the group for a given role in a given OU.<p>
This is important because webuser OUs don't have most role groups, and their absence is not cached, so we want to avoid reading them.
@param ou the OU
@param role the role
@return true if we should read the role in the OU | [
"Helper",
"method",
"to",
"check",
"whether",
"we",
"should",
"bother",
"with",
"reading",
"the",
"group",
"for",
"a",
"given",
"role",
"in",
"a",
"given",
"OU",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L10713-L10719 |
LearnLib/automatalib | commons/util/src/main/java/net/automatalib/commons/util/UnionFind.java | UnionFind.link | @Override
public int link(int x, int y) {
int rx = rank[x], ry = rank[y];
if (rx > ry) {
p[y] = x;
return x;
}
p[x] = y;
if (rx == ry) {
rank[y] = ry + 1;
}
return y;
} | java | @Override
public int link(int x, int y) {
int rx = rank[x], ry = rank[y];
if (rx > ry) {
p[y] = x;
return x;
}
p[x] = y;
if (rx == ry) {
rank[y] = ry + 1;
}
return y;
} | [
"@",
"Override",
"public",
"int",
"link",
"(",
"int",
"x",
",",
"int",
"y",
")",
"{",
"int",
"rx",
"=",
"rank",
"[",
"x",
"]",
",",
"ry",
"=",
"rank",
"[",
"y",
"]",
";",
"if",
"(",
"rx",
">",
"ry",
")",
"{",
"p",
"[",
"y",
"]",
"=",
"x... | Unites two given sets. Note that the behavior of this method is not specified if the given parameters are normal
elements and no set identifiers.
@param x
the first set
@param y
the second set
@return the identifier of the resulting set (either {@code x} or {@code y}) | [
"Unites",
"two",
"given",
"sets",
".",
"Note",
"that",
"the",
"behavior",
"of",
"this",
"method",
"is",
"not",
"specified",
"if",
"the",
"given",
"parameters",
"are",
"normal",
"elements",
"and",
"no",
"set",
"identifiers",
"."
] | train | https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/commons/util/src/main/java/net/automatalib/commons/util/UnionFind.java#L89-L101 |
fabric8io/ipaas-quickstarts | archetype-builder/src/main/java/io/fabric8/tooling/archetype/builder/ArchetypeBuilder.java | ArchetypeBuilder.generateArchetypesFromGithubOrganisation | public void generateArchetypesFromGithubOrganisation(String githubOrg, File outputDir, List<String> dirs) throws IOException {
GitHub github = GitHub.connectAnonymously();
GHOrganization organization = github.getOrganization(githubOrg);
Objects.notNull(organization, "No github organisation found for: " + githubOrg);
Map<String, GHRepository> repositories = organization.getRepositories();
Set<Map.Entry<String, GHRepository>> entries = repositories.entrySet();
File cloneParentDir = new File(outputDir, "../git-clones");
if (cloneParentDir.exists()) {
Files.recursiveDelete(cloneParentDir);
}
for (Map.Entry<String, GHRepository> entry : entries) {
String repoName = entry.getKey();
GHRepository repo = entry.getValue();
String url = repo.getGitTransportUrl();
generateArchetypeFromGitRepo(outputDir, dirs, cloneParentDir, repoName, url, null);
}
} | java | public void generateArchetypesFromGithubOrganisation(String githubOrg, File outputDir, List<String> dirs) throws IOException {
GitHub github = GitHub.connectAnonymously();
GHOrganization organization = github.getOrganization(githubOrg);
Objects.notNull(organization, "No github organisation found for: " + githubOrg);
Map<String, GHRepository> repositories = organization.getRepositories();
Set<Map.Entry<String, GHRepository>> entries = repositories.entrySet();
File cloneParentDir = new File(outputDir, "../git-clones");
if (cloneParentDir.exists()) {
Files.recursiveDelete(cloneParentDir);
}
for (Map.Entry<String, GHRepository> entry : entries) {
String repoName = entry.getKey();
GHRepository repo = entry.getValue();
String url = repo.getGitTransportUrl();
generateArchetypeFromGitRepo(outputDir, dirs, cloneParentDir, repoName, url, null);
}
} | [
"public",
"void",
"generateArchetypesFromGithubOrganisation",
"(",
"String",
"githubOrg",
",",
"File",
"outputDir",
",",
"List",
"<",
"String",
">",
"dirs",
")",
"throws",
"IOException",
"{",
"GitHub",
"github",
"=",
"GitHub",
".",
"connectAnonymously",
"(",
")",
... | Iterates through all projects in the given github organisation and generates an archetype for it | [
"Iterates",
"through",
"all",
"projects",
"in",
"the",
"given",
"github",
"organisation",
"and",
"generates",
"an",
"archetype",
"for",
"it"
] | train | https://github.com/fabric8io/ipaas-quickstarts/blob/cf9a9aa09204a82ac996304ab8c96791f7e5db22/archetype-builder/src/main/java/io/fabric8/tooling/archetype/builder/ArchetypeBuilder.java#L87-L105 |
census-instrumentation/opencensus-java | contrib/zpages/src/main/java/io/opencensus/contrib/zpages/TracezZPageHandler.java | TracezZPageHandler.create | static TracezZPageHandler create(
@javax.annotation.Nullable RunningSpanStore runningSpanStore,
@javax.annotation.Nullable SampledSpanStore sampledSpanStore) {
return new TracezZPageHandler(runningSpanStore, sampledSpanStore);
} | java | static TracezZPageHandler create(
@javax.annotation.Nullable RunningSpanStore runningSpanStore,
@javax.annotation.Nullable SampledSpanStore sampledSpanStore) {
return new TracezZPageHandler(runningSpanStore, sampledSpanStore);
} | [
"static",
"TracezZPageHandler",
"create",
"(",
"@",
"javax",
".",
"annotation",
".",
"Nullable",
"RunningSpanStore",
"runningSpanStore",
",",
"@",
"javax",
".",
"annotation",
".",
"Nullable",
"SampledSpanStore",
"sampledSpanStore",
")",
"{",
"return",
"new",
"Tracez... | Constructs a new {@code TracezZPageHandler}.
@param runningSpanStore the instance of the {@code RunningSpanStore} to be used.
@param sampledSpanStore the instance of the {@code SampledSpanStore} to be used.
@return a new {@code TracezZPageHandler}. | [
"Constructs",
"a",
"new",
"{",
"@code",
"TracezZPageHandler",
"}",
"."
] | train | https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/contrib/zpages/src/main/java/io/opencensus/contrib/zpages/TracezZPageHandler.java#L145-L149 |
nextreports/nextreports-server | src/ro/nextreports/server/aop/MethodProfilerAdvice.java | MethodProfilerAdvice.profileMethod | @Around("isProfileAnnotation(profile)")
public Object profileMethod(ProceedingJoinPoint joinPoint, Profile profile) throws Throwable {
String logPrefix = null;
boolean debug = LOG.isDebugEnabled();
long time = System.currentTimeMillis();
// parse out the first arg
String arg1 = "";
Object[] args = joinPoint.getArgs();
if ((args != null) && (args.length > 0) && (args[0] != null)) {
arg1 = args[0].toString();
}
if (debug) {
logPrefix = joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName() + " " + arg1;
LOG.debug(logPrefix + " START");
}
Object returnValue = joinPoint.proceed();
time = System.currentTimeMillis() - time;
if (debug) {
LOG.debug(logPrefix + " EXECUTED in " + time + " ms");
}
return returnValue;
} | java | @Around("isProfileAnnotation(profile)")
public Object profileMethod(ProceedingJoinPoint joinPoint, Profile profile) throws Throwable {
String logPrefix = null;
boolean debug = LOG.isDebugEnabled();
long time = System.currentTimeMillis();
// parse out the first arg
String arg1 = "";
Object[] args = joinPoint.getArgs();
if ((args != null) && (args.length > 0) && (args[0] != null)) {
arg1 = args[0].toString();
}
if (debug) {
logPrefix = joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName() + " " + arg1;
LOG.debug(logPrefix + " START");
}
Object returnValue = joinPoint.proceed();
time = System.currentTimeMillis() - time;
if (debug) {
LOG.debug(logPrefix + " EXECUTED in " + time + " ms");
}
return returnValue;
} | [
"@",
"Around",
"(",
"\"isProfileAnnotation(profile)\"",
")",
"public",
"Object",
"profileMethod",
"(",
"ProceedingJoinPoint",
"joinPoint",
",",
"Profile",
"profile",
")",
"throws",
"Throwable",
"{",
"String",
"logPrefix",
"=",
"null",
";",
"boolean",
"debug",
"=",
... | Intercepts methods that declare Profile annotation and prints out the time it takes to complete/
@param joinPoint proceeding join point
@return the intercepted method returned object
@throws Throwable in case something goes wrong in the actual method call | [
"Intercepts",
"methods",
"that",
"declare",
"Profile",
"annotation",
"and",
"prints",
"out",
"the",
"time",
"it",
"takes",
"to",
"complete",
"/"
] | train | https://github.com/nextreports/nextreports-server/blob/cfce12f5c6d52cb6a739388d50142c6e2e07c55e/src/ro/nextreports/server/aop/MethodProfilerAdvice.java#L45-L69 |
mapcode-foundation/mapcode-java | src/main/java/com/mapcode/MapcodeCodec.java | MapcodeCodec.encodeRestrictToCountryISO3 | @Nonnull
public static List<Mapcode> encodeRestrictToCountryISO3(final double latDeg, final double lonDeg,
@Nonnull final String countryISO3)
throws IllegalArgumentException {
checkNonnull("countryISO3", countryISO3);
return encodeRestrictToCountryISO2(latDeg, lonDeg, Territory.getCountryISO2FromISO3(countryISO3));
} | java | @Nonnull
public static List<Mapcode> encodeRestrictToCountryISO3(final double latDeg, final double lonDeg,
@Nonnull final String countryISO3)
throws IllegalArgumentException {
checkNonnull("countryISO3", countryISO3);
return encodeRestrictToCountryISO2(latDeg, lonDeg, Territory.getCountryISO2FromISO3(countryISO3));
} | [
"@",
"Nonnull",
"public",
"static",
"List",
"<",
"Mapcode",
">",
"encodeRestrictToCountryISO3",
"(",
"final",
"double",
"latDeg",
",",
"final",
"double",
"lonDeg",
",",
"@",
"Nonnull",
"final",
"String",
"countryISO3",
")",
"throws",
"IllegalArgumentException",
"{... | Encode a lat/lon pair to a list of mapcodes, like {@link #encode(double, double)}.
The result list is limited to those mapcodes that belong to the provided ISO 3166 country code, 3 characters.
For example, if you wish to restrict the list to Mexican mapcodes, use "MEX". This would
produce a result list of mapcodes with territories that start with "MEX" (note that
mapcode that starts with "MX-" are not returned in that case.)
@param latDeg Latitude, accepted range: -90..90.
@param lonDeg Longitude, accepted range: -180..180.
@param countryISO3 ISO 3166 country code, 3 characters.
@return Possibly empty, ordered list of mapcode information records, see {@link Mapcode}.
@throws IllegalArgumentException Thrown if latitude or longitude are out of range, or if the ISO code is invalid. | [
"Encode",
"a",
"lat",
"/",
"lon",
"pair",
"to",
"a",
"list",
"of",
"mapcodes",
"like",
"{",
"@link",
"#encode",
"(",
"double",
"double",
")",
"}",
".",
"The",
"result",
"list",
"is",
"limited",
"to",
"those",
"mapcodes",
"that",
"belong",
"to",
"the",
... | train | https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/MapcodeCodec.java#L173-L179 |
alkacon/opencms-core | src/org/opencms/ade/sitemap/CmsVfsSitemapService.java | CmsVfsSitemapService.generateInheritProperties | private List<CmsProperty> generateInheritProperties(CmsSitemapChange change, CmsResource entryFolder) {
List<CmsProperty> result = new ArrayList<CmsProperty>();
Map<String, CmsClientProperty> clientProps = change.getOwnInternalProperties();
boolean hasTitle = false;
if (clientProps != null) {
for (CmsClientProperty clientProp : clientProps.values()) {
if (CmsPropertyDefinition.PROPERTY_TITLE.equals(clientProp.getName())) {
hasTitle = true;
}
CmsProperty prop = new CmsProperty(
clientProp.getName(),
clientProp.getStructureValue(),
clientProp.getResourceValue());
result.add(prop);
}
}
if (!hasTitle) {
result.add(new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, change.getName(), null));
}
return result;
} | java | private List<CmsProperty> generateInheritProperties(CmsSitemapChange change, CmsResource entryFolder) {
List<CmsProperty> result = new ArrayList<CmsProperty>();
Map<String, CmsClientProperty> clientProps = change.getOwnInternalProperties();
boolean hasTitle = false;
if (clientProps != null) {
for (CmsClientProperty clientProp : clientProps.values()) {
if (CmsPropertyDefinition.PROPERTY_TITLE.equals(clientProp.getName())) {
hasTitle = true;
}
CmsProperty prop = new CmsProperty(
clientProp.getName(),
clientProp.getStructureValue(),
clientProp.getResourceValue());
result.add(prop);
}
}
if (!hasTitle) {
result.add(new CmsProperty(CmsPropertyDefinition.PROPERTY_TITLE, change.getName(), null));
}
return result;
} | [
"private",
"List",
"<",
"CmsProperty",
">",
"generateInheritProperties",
"(",
"CmsSitemapChange",
"change",
",",
"CmsResource",
"entryFolder",
")",
"{",
"List",
"<",
"CmsProperty",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"CmsProperty",
">",
"(",
")",
";",
... | Generates a list of property object to save to the sitemap entry folder to apply the given change.<p>
@param change the change
@param entryFolder the entry folder
@return the property objects | [
"Generates",
"a",
"list",
"of",
"property",
"object",
"to",
"save",
"to",
"the",
"sitemap",
"entry",
"folder",
"to",
"apply",
"the",
"given",
"change",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L2108-L2129 |
ops4j/org.ops4j.base | ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java | StreamUtils.copyStream | public static void copyStream( InputStream src, OutputStream dest, boolean closeStreams )
throws IOException, NullArgumentException
{
copyStream( null, null, 0, src, dest, closeStreams );
} | java | public static void copyStream( InputStream src, OutputStream dest, boolean closeStreams )
throws IOException, NullArgumentException
{
copyStream( null, null, 0, src, dest, closeStreams );
} | [
"public",
"static",
"void",
"copyStream",
"(",
"InputStream",
"src",
",",
"OutputStream",
"dest",
",",
"boolean",
"closeStreams",
")",
"throws",
"IOException",
",",
"NullArgumentException",
"{",
"copyStream",
"(",
"null",
",",
"null",
",",
"0",
",",
"src",
","... | Copy a stream.
@param src the source input stream
@param dest the destination output stream
@param closeStreams TRUE if the streams should be closed on completion
@throws IOException if an IO error occurs
@throws NullArgumentException if either the src or dest arguments are null. | [
"Copy",
"a",
"stream",
"."
] | train | https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-io/src/main/java/org/ops4j/io/StreamUtils.java#L65-L69 |
lessthanoptimal/ejml | main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java | CommonOps_DDRM.scaleRow | public static void scaleRow( double alpha , DMatrixRMaj A , int row ) {
int idx = row*A.numCols;
for (int col = 0; col < A.numCols; col++) {
A.data[idx++] *= alpha;
}
} | java | public static void scaleRow( double alpha , DMatrixRMaj A , int row ) {
int idx = row*A.numCols;
for (int col = 0; col < A.numCols; col++) {
A.data[idx++] *= alpha;
}
} | [
"public",
"static",
"void",
"scaleRow",
"(",
"double",
"alpha",
",",
"DMatrixRMaj",
"A",
",",
"int",
"row",
")",
"{",
"int",
"idx",
"=",
"row",
"*",
"A",
".",
"numCols",
";",
"for",
"(",
"int",
"col",
"=",
"0",
";",
"col",
"<",
"A",
".",
"numCols... | In-place scaling of a row in A
@param alpha scale factor
@param A matrix
@param row which row in A | [
"In",
"-",
"place",
"scaling",
"of",
"a",
"row",
"in",
"A"
] | train | https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/CommonOps_DDRM.java#L2398-L2403 |
hazelcast/hazelcast | hazelcast/src/main/java/com/hazelcast/cp/internal/session/AbstractProxySessionManager.java | AbstractProxySessionManager.invalidateSession | public final void invalidateSession(RaftGroupId groupId, long id) {
SessionState session = sessions.get(groupId);
if (session != null && session.id == id) {
sessions.remove(groupId, session);
}
} | java | public final void invalidateSession(RaftGroupId groupId, long id) {
SessionState session = sessions.get(groupId);
if (session != null && session.id == id) {
sessions.remove(groupId, session);
}
} | [
"public",
"final",
"void",
"invalidateSession",
"(",
"RaftGroupId",
"groupId",
",",
"long",
"id",
")",
"{",
"SessionState",
"session",
"=",
"sessions",
".",
"get",
"(",
"groupId",
")",
";",
"if",
"(",
"session",
"!=",
"null",
"&&",
"session",
".",
"id",
... | Invalidates the given session.
No more heartbeats will be sent for the given session. | [
"Invalidates",
"the",
"given",
"session",
".",
"No",
"more",
"heartbeats",
"will",
"be",
"sent",
"for",
"the",
"given",
"session",
"."
] | train | https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/session/AbstractProxySessionManager.java#L156-L161 |
amaembo/streamex | src/main/java/one/util/streamex/StreamEx.java | StreamEx.groupRuns | public StreamEx<List<T>> groupRuns(BiPredicate<? super T, ? super T> sameGroup) {
return collapseInternal(sameGroup, Collections::singletonList, (acc, t) -> {
if (!(acc instanceof ArrayList)) {
T old = acc.get(0);
acc = new ArrayList<>();
acc.add(old);
}
acc.add(t);
return acc;
}, (acc1, acc2) -> {
if (!(acc1 instanceof ArrayList)) {
T old = acc1.get(0);
acc1 = new ArrayList<>();
acc1.add(old);
}
acc1.addAll(acc2);
return acc1;
});
} | java | public StreamEx<List<T>> groupRuns(BiPredicate<? super T, ? super T> sameGroup) {
return collapseInternal(sameGroup, Collections::singletonList, (acc, t) -> {
if (!(acc instanceof ArrayList)) {
T old = acc.get(0);
acc = new ArrayList<>();
acc.add(old);
}
acc.add(t);
return acc;
}, (acc1, acc2) -> {
if (!(acc1 instanceof ArrayList)) {
T old = acc1.get(0);
acc1 = new ArrayList<>();
acc1.add(old);
}
acc1.addAll(acc2);
return acc1;
});
} | [
"public",
"StreamEx",
"<",
"List",
"<",
"T",
">",
">",
"groupRuns",
"(",
"BiPredicate",
"<",
"?",
"super",
"T",
",",
"?",
"super",
"T",
">",
"sameGroup",
")",
"{",
"return",
"collapseInternal",
"(",
"sameGroup",
",",
"Collections",
"::",
"singletonList",
... | Returns a stream consisting of lists of elements of this stream where
adjacent elements are grouped according to supplied predicate.
<p>
This is a <a href="package-summary.html#StreamOps">quasi-intermediate</a>
partial reduction operation.
<p>
There are no guarantees on the type, mutability, serializability, or
thread-safety of the {@code List} objects of the resulting stream.
<p>
This operation is equivalent to
{@code collapse(sameGroup, Collectors.toList())}, but more efficient.
@param sameGroup a non-interfering, stateless predicate to apply to the
pair of adjacent elements which returns true for elements which
belong to the same group.
@return the new stream
@since 0.3.1 | [
"Returns",
"a",
"stream",
"consisting",
"of",
"lists",
"of",
"elements",
"of",
"this",
"stream",
"where",
"adjacent",
"elements",
"are",
"grouped",
"according",
"to",
"supplied",
"predicate",
"."
] | train | https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L1693-L1711 |
TheCoder4eu/BootsFaces-OSP | src/main/java/net/bootsfaces/component/jumbotron/JumbotronRenderer.java | JumbotronRenderer.encodeBegin | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Jumbotron jumbotron = (Jumbotron) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = jumbotron.getClientId();
rw.startElement("div", jumbotron);
rw.writeAttribute("id",clientId,"id");
if(BsfUtils.isStringValued(jumbotron.getStyle()))
rw.writeAttribute("style", jumbotron.getStyle(), "style");
Tooltip.generateTooltip(context, jumbotron, rw);
String styleClass = "jumbotron";
if(BsfUtils.isStringValued(jumbotron.getStyleClass()))
styleClass = styleClass + " " + jumbotron.getStyleClass();
rw.writeAttribute("class", styleClass, "class");
beginDisabledFieldset(jumbotron, rw);
} | java | @Override
public void encodeBegin(FacesContext context, UIComponent component) throws IOException {
if (!component.isRendered()) {
return;
}
Jumbotron jumbotron = (Jumbotron) component;
ResponseWriter rw = context.getResponseWriter();
String clientId = jumbotron.getClientId();
rw.startElement("div", jumbotron);
rw.writeAttribute("id",clientId,"id");
if(BsfUtils.isStringValued(jumbotron.getStyle()))
rw.writeAttribute("style", jumbotron.getStyle(), "style");
Tooltip.generateTooltip(context, jumbotron, rw);
String styleClass = "jumbotron";
if(BsfUtils.isStringValued(jumbotron.getStyleClass()))
styleClass = styleClass + " " + jumbotron.getStyleClass();
rw.writeAttribute("class", styleClass, "class");
beginDisabledFieldset(jumbotron, rw);
} | [
"@",
"Override",
"public",
"void",
"encodeBegin",
"(",
"FacesContext",
"context",
",",
"UIComponent",
"component",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"component",
".",
"isRendered",
"(",
")",
")",
"{",
"return",
";",
"}",
"Jumbotron",
"jumbot... | This methods generates the HTML code of the current b:jumbotron.
<code>encodeBegin</code> generates the start of the component. After the, the JSF framework calls <code>encodeChildren()</code>
to generate the HTML code between the beginning and the end of the component. For instance, in the case of a panel component
the content of the panel is generated by <code>encodeChildren()</code>. After that, <code>encodeEnd()</code> is called
to generate the rest of the HTML code.
@param context the FacesContext.
@param component the current b:jumbotron.
@throws IOException thrown if something goes wrong when writing the HTML code. | [
"This",
"methods",
"generates",
"the",
"HTML",
"code",
"of",
"the",
"current",
"b",
":",
"jumbotron",
".",
"<code",
">",
"encodeBegin<",
"/",
"code",
">",
"generates",
"the",
"start",
"of",
"the",
"component",
".",
"After",
"the",
"the",
"JSF",
"framework"... | train | https://github.com/TheCoder4eu/BootsFaces-OSP/blob/d1a70952bc240979b5272fa4fe1c7f100873add0/src/main/java/net/bootsfaces/component/jumbotron/JumbotronRenderer.java#L47-L69 |
foundation-runtime/service-directory | 2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java | DirectoryServiceClient.attachSession | public void attachSession(List<ServiceInstanceToken> instanceTokens){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.AttachSession);
String sessionId = connection.getSessionId();
AttachSessionProtocol protocol = new AttachSessionProtocol(instanceTokens, sessionId);
connection.submitRequest(header, protocol, null);
} | java | public void attachSession(List<ServiceInstanceToken> instanceTokens){
ProtocolHeader header = new ProtocolHeader();
header.setType(ProtocolType.AttachSession);
String sessionId = connection.getSessionId();
AttachSessionProtocol protocol = new AttachSessionProtocol(instanceTokens, sessionId);
connection.submitRequest(header, protocol, null);
} | [
"public",
"void",
"attachSession",
"(",
"List",
"<",
"ServiceInstanceToken",
">",
"instanceTokens",
")",
"{",
"ProtocolHeader",
"header",
"=",
"new",
"ProtocolHeader",
"(",
")",
";",
"header",
".",
"setType",
"(",
"ProtocolType",
".",
"AttachSession",
")",
";",
... | Attach ServiceInstance to the Session.
@param instanceTokens
the instance list. | [
"Attach",
"ServiceInstance",
"to",
"the",
"Session",
"."
] | train | https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/impl/DirectoryServiceClient.java#L531-L539 |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java | TileSystem.getX01FromLongitude | public double getX01FromLongitude(double longitude, boolean wrapEnabled) {
longitude = wrapEnabled ? Clip(longitude, getMinLongitude(), getMaxLongitude()) : longitude;
final double result = getX01FromLongitude(longitude);
return wrapEnabled ? Clip(result, 0, 1) : result;
} | java | public double getX01FromLongitude(double longitude, boolean wrapEnabled) {
longitude = wrapEnabled ? Clip(longitude, getMinLongitude(), getMaxLongitude()) : longitude;
final double result = getX01FromLongitude(longitude);
return wrapEnabled ? Clip(result, 0, 1) : result;
} | [
"public",
"double",
"getX01FromLongitude",
"(",
"double",
"longitude",
",",
"boolean",
"wrapEnabled",
")",
"{",
"longitude",
"=",
"wrapEnabled",
"?",
"Clip",
"(",
"longitude",
",",
"getMinLongitude",
"(",
")",
",",
"getMaxLongitude",
"(",
")",
")",
":",
"longi... | Converts a longitude to its "X01" value,
id est a double between 0 and 1 for the whole longitude range
@since 6.0.0 | [
"Converts",
"a",
"longitude",
"to",
"its",
"X01",
"value",
"id",
"est",
"a",
"double",
"between",
"0",
"and",
"1",
"for",
"the",
"whole",
"longitude",
"range"
] | train | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java#L219-L223 |
jbundle/jbundle | base/base/src/main/java/org/jbundle/base/field/event/WaitForFieldChangeHandler.java | WaitForFieldChangeHandler.setOwner | public void setOwner(ListenerOwner owner)
{
if (owner == null)
{
if (m_messageListener != null)
{
m_messageListener.free();
m_messageListener = null;
}
}
super.setOwner(owner);
if (owner != null)
{
Record record = this.getOwner().getRecord();
MessageManager messageManager = ((Application)record.getTask().getApplication()).getMessageManager();
if (messageManager != null)
{
BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, this, null);
messageManager.addMessageFilter(messageFilter);
m_messageListener = new WaitForFieldChangeMessageListener(messageFilter, this);
record.setupRecordListener(m_messageListener, false, false); // I need to listen for record changes
}
}
} | java | public void setOwner(ListenerOwner owner)
{
if (owner == null)
{
if (m_messageListener != null)
{
m_messageListener.free();
m_messageListener = null;
}
}
super.setOwner(owner);
if (owner != null)
{
Record record = this.getOwner().getRecord();
MessageManager messageManager = ((Application)record.getTask().getApplication()).getMessageManager();
if (messageManager != null)
{
BaseMessageFilter messageFilter = new BaseMessageFilter(MessageConstants.TRX_RETURN_QUEUE, MessageConstants.INTERNET_QUEUE, this, null);
messageManager.addMessageFilter(messageFilter);
m_messageListener = new WaitForFieldChangeMessageListener(messageFilter, this);
record.setupRecordListener(m_messageListener, false, false); // I need to listen for record changes
}
}
} | [
"public",
"void",
"setOwner",
"(",
"ListenerOwner",
"owner",
")",
"{",
"if",
"(",
"owner",
"==",
"null",
")",
"{",
"if",
"(",
"m_messageListener",
"!=",
"null",
")",
"{",
"m_messageListener",
".",
"free",
"(",
")",
";",
"m_messageListener",
"=",
"null",
... | Set the field that owns this listener.
@owner The field that this listener is being added to (if null, this listener is being removed). | [
"Set",
"the",
"field",
"that",
"owns",
"this",
"listener",
"."
] | train | https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/WaitForFieldChangeHandler.java#L77-L100 |
jbossws/jbossws-common | src/main/java/org/jboss/ws/common/DOMUtils.java | DOMUtils.node2String | public static String node2String(final Node node, boolean prettyPrint, String encoding) throws UnsupportedEncodingException
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
new DOMWriter(new PrintWriter(baos), encoding).setPrettyprint(prettyPrint).print(node);
return baos.toString(encoding);
} | java | public static String node2String(final Node node, boolean prettyPrint, String encoding) throws UnsupportedEncodingException
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
new DOMWriter(new PrintWriter(baos), encoding).setPrettyprint(prettyPrint).print(node);
return baos.toString(encoding);
} | [
"public",
"static",
"String",
"node2String",
"(",
"final",
"Node",
"node",
",",
"boolean",
"prettyPrint",
",",
"String",
"encoding",
")",
"throws",
"UnsupportedEncodingException",
"{",
"final",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",... | Converts XML node in specified pretty mode and encoding to string.
@param node XML document or element
@param prettyPrint whether XML have to be pretty formated
@param encoding to use
@return XML string
@throws UnsupportedEncodingException | [
"Converts",
"XML",
"node",
"in",
"specified",
"pretty",
"mode",
"and",
"encoding",
"to",
"string",
"."
] | train | https://github.com/jbossws/jbossws-common/blob/fcff8a3ef9bfe046d6fa8c855a3fe4f62841add7/src/main/java/org/jboss/ws/common/DOMUtils.java#L471-L476 |
kumuluz/kumuluzee | common/src/main/java/com/kumuluz/ee/common/utils/StringUtils.java | StringUtils.camelCaseToHyphenCase | public static String camelCaseToHyphenCase(String s) {
StringBuilder parsedString = new StringBuilder(s.substring(0, 1).toLowerCase());
for (char c : s.substring(1).toCharArray()) {
if (Character.isUpperCase(c)) {
parsedString.append("-").append(Character.toLowerCase(c));
} else {
parsedString.append(c);
}
}
return parsedString.toString();
} | java | public static String camelCaseToHyphenCase(String s) {
StringBuilder parsedString = new StringBuilder(s.substring(0, 1).toLowerCase());
for (char c : s.substring(1).toCharArray()) {
if (Character.isUpperCase(c)) {
parsedString.append("-").append(Character.toLowerCase(c));
} else {
parsedString.append(c);
}
}
return parsedString.toString();
} | [
"public",
"static",
"String",
"camelCaseToHyphenCase",
"(",
"String",
"s",
")",
"{",
"StringBuilder",
"parsedString",
"=",
"new",
"StringBuilder",
"(",
"s",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toLowerCase",
"(",
")",
")",
";",
"for",
"(",
"c... | Parse upper camel case to lower hyphen case.
@param s string in upper camel case format
@return string in lower hyphen case format | [
"Parse",
"upper",
"camel",
"case",
"to",
"lower",
"hyphen",
"case",
"."
] | train | https://github.com/kumuluz/kumuluzee/blob/86fbce2acc04264f20d548173d5d9f28d79cb415/common/src/main/java/com/kumuluz/ee/common/utils/StringUtils.java#L39-L53 |
google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java | FDBigInteger.mult | private static void mult(int[] src, int srcLen, int v0, int v1, int[] dst) {
long v = v0 & LONG_MASK;
long carry = 0;
for (int j = 0; j < srcLen; j++) {
long product = v * (src[j] & LONG_MASK) + carry;
dst[j] = (int) product;
carry = product >>> 32;
}
dst[srcLen] = (int) carry;
v = v1 & LONG_MASK;
carry = 0;
for (int j = 0; j < srcLen; j++) {
long product = (dst[j + 1] & LONG_MASK) + v * (src[j] & LONG_MASK) + carry;
dst[j + 1] = (int) product;
carry = product >>> 32;
}
dst[srcLen + 1] = (int) carry;
} | java | private static void mult(int[] src, int srcLen, int v0, int v1, int[] dst) {
long v = v0 & LONG_MASK;
long carry = 0;
for (int j = 0; j < srcLen; j++) {
long product = v * (src[j] & LONG_MASK) + carry;
dst[j] = (int) product;
carry = product >>> 32;
}
dst[srcLen] = (int) carry;
v = v1 & LONG_MASK;
carry = 0;
for (int j = 0; j < srcLen; j++) {
long product = (dst[j + 1] & LONG_MASK) + v * (src[j] & LONG_MASK) + carry;
dst[j + 1] = (int) product;
carry = product >>> 32;
}
dst[srcLen + 1] = (int) carry;
} | [
"private",
"static",
"void",
"mult",
"(",
"int",
"[",
"]",
"src",
",",
"int",
"srcLen",
",",
"int",
"v0",
",",
"int",
"v1",
",",
"int",
"[",
"]",
"dst",
")",
"{",
"long",
"v",
"=",
"v0",
"&",
"LONG_MASK",
";",
"long",
"carry",
"=",
"0",
";",
... | /*@
@ requires src != dst;
@ requires src.length >= srcLen && dst.length >= srcLen + 2;
@ assignable dst[0 .. srcLen + 1];
@ ensures AP(dst, srcLen + 2) == \old(AP(src, srcLen) * (UNSIGNED(v0) + (UNSIGNED(v1) << 32)));
@ | [
"/",
"*"
] | train | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FDBigInteger.java#L1394-L1411 |
apache/flink | flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/ConfluentRegistryAvroDeserializationSchema.java | ConfluentRegistryAvroDeserializationSchema.forSpecific | public static <T extends SpecificRecord> ConfluentRegistryAvroDeserializationSchema<T> forSpecific(Class<T> tClass,
String url, int identityMapCapacity) {
return new ConfluentRegistryAvroDeserializationSchema<>(
tClass,
null,
new CachedSchemaCoderProvider(url, identityMapCapacity)
);
} | java | public static <T extends SpecificRecord> ConfluentRegistryAvroDeserializationSchema<T> forSpecific(Class<T> tClass,
String url, int identityMapCapacity) {
return new ConfluentRegistryAvroDeserializationSchema<>(
tClass,
null,
new CachedSchemaCoderProvider(url, identityMapCapacity)
);
} | [
"public",
"static",
"<",
"T",
"extends",
"SpecificRecord",
">",
"ConfluentRegistryAvroDeserializationSchema",
"<",
"T",
">",
"forSpecific",
"(",
"Class",
"<",
"T",
">",
"tClass",
",",
"String",
"url",
",",
"int",
"identityMapCapacity",
")",
"{",
"return",
"new",... | Creates {@link AvroDeserializationSchema} that produces classes that were generated from avro
schema and looks up writer schema in Confluent Schema Registry.
@param tClass class of record to be produced
@param url url of schema registry to connect
@param identityMapCapacity maximum number of cached schema versions (default: 1000)
@return deserialized record | [
"Creates",
"{",
"@link",
"AvroDeserializationSchema",
"}",
"that",
"produces",
"classes",
"that",
"were",
"generated",
"from",
"avro",
"schema",
"and",
"looks",
"up",
"writer",
"schema",
"in",
"Confluent",
"Schema",
"Registry",
"."
] | train | https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-formats/flink-avro-confluent-registry/src/main/java/org/apache/flink/formats/avro/registry/confluent/ConfluentRegistryAvroDeserializationSchema.java#L109-L116 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java | DiagnosticsInner.getSiteDetectorWithServiceResponseAsync | public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> getSiteDetectorWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String detectorName) {
return getSiteDetectorSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, detectorName)
.concatMap(new Func1<ServiceResponse<Page<DetectorDefinitionInner>>, Observable<ServiceResponse<Page<DetectorDefinitionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> call(ServiceResponse<Page<DetectorDefinitionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getSiteDetectorNextWithServiceResponseAsync(nextPageLink));
}
});
} | java | public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> getSiteDetectorWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String detectorName) {
return getSiteDetectorSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, detectorName)
.concatMap(new Func1<ServiceResponse<Page<DetectorDefinitionInner>>, Observable<ServiceResponse<Page<DetectorDefinitionInner>>>>() {
@Override
public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> call(ServiceResponse<Page<DetectorDefinitionInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(getSiteDetectorNextWithServiceResponseAsync(nextPageLink));
}
});
} | [
"public",
"Observable",
"<",
"ServiceResponse",
"<",
"Page",
"<",
"DetectorDefinitionInner",
">",
">",
">",
"getSiteDetectorWithServiceResponseAsync",
"(",
"final",
"String",
"resourceGroupName",
",",
"final",
"String",
"siteName",
",",
"final",
"String",
"diagnosticCat... | Get Detector.
Get Detector.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param siteName Site Name
@param diagnosticCategory Diagnostic Category
@param detectorName Detector Name
@throws IllegalArgumentException thrown if parameters fail the validation
@return the observable to the PagedList<DetectorDefinitionInner> object | [
"Get",
"Detector",
".",
"Get",
"Detector",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1056-L1068 |
JadiraOrg/jadira | cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java | UnsafeOperations.deepCopy | public <T> T deepCopy(final T obj) {
return deepCopy(obj, new IdentityHashMap<Object, Object>(10));
} | java | public <T> T deepCopy(final T obj) {
return deepCopy(obj, new IdentityHashMap<Object, Object>(10));
} | [
"public",
"<",
"T",
">",
"T",
"deepCopy",
"(",
"final",
"T",
"obj",
")",
"{",
"return",
"deepCopy",
"(",
"obj",
",",
"new",
"IdentityHashMap",
"<",
"Object",
",",
"Object",
">",
"(",
"10",
")",
")",
";",
"}"
] | Performs a deep copy of the object. With a deep copy all references from the object are also copied.
The identity of referenced objects is preserved, so, for example, if the object graph contains two
references to the same object, the cloned object will preserve this structure.
@param obj The object to perform a deep copy for.
@param <T> The type being copied
@return A deep copy of the original object. | [
"Performs",
"a",
"deep",
"copy",
"of",
"the",
"object",
".",
"With",
"a",
"deep",
"copy",
"all",
"references",
"from",
"the",
"object",
"are",
"also",
"copied",
".",
"The",
"identity",
"of",
"referenced",
"objects",
"is",
"preserved",
"so",
"for",
"example... | train | https://github.com/JadiraOrg/jadira/blob/d55d0238395f0cb900531f1f08b4b2d87fa9a4f6/cloning/src/main/java/org/jadira/reflection/access/unsafe/UnsafeOperations.java#L271-L273 |
googleads/googleads-java-lib | examples/admanager_axis/src/main/java/admanager/axis/v201902/userservice/GetAllRoles.java | GetAllRoles.runExample | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the UserService.
UserServiceInterface userService = adManagerServices.get(session, UserServiceInterface.class);
// Get all roles.
Role[] roles = userService.getAllRoles();
int i = 0;
for (Role role : roles) {
System.out.printf(
"%d) Role with ID %d and name '%s' was found.%n", i++, role.getId(), role.getName());
}
System.out.printf("Number of results found: %d%n", roles.length);
} | java | public static void runExample(AdManagerServices adManagerServices, AdManagerSession session)
throws RemoteException {
// Get the UserService.
UserServiceInterface userService = adManagerServices.get(session, UserServiceInterface.class);
// Get all roles.
Role[] roles = userService.getAllRoles();
int i = 0;
for (Role role : roles) {
System.out.printf(
"%d) Role with ID %d and name '%s' was found.%n", i++, role.getId(), role.getName());
}
System.out.printf("Number of results found: %d%n", roles.length);
} | [
"public",
"static",
"void",
"runExample",
"(",
"AdManagerServices",
"adManagerServices",
",",
"AdManagerSession",
"session",
")",
"throws",
"RemoteException",
"{",
"// Get the UserService.",
"UserServiceInterface",
"userService",
"=",
"adManagerServices",
".",
"get",
"(",
... | 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/v201902/userservice/GetAllRoles.java#L49-L64 |
stapler/stapler | groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/SimpleTemplateParser.java | SimpleTemplateParser.groovyExpression | private void groovyExpression(Reader reader, StringWriter sw) throws IOException {
sw.write("${");
int c;
while ((c = reader.read()) != -1) {
if (c == '%') {
c = reader.read();
if (c != '>') {
sw.write('%');
} else {
break;
}
}
if (c != '\n' && c != '\r') {
sw.write(c);
}
}
sw.write("}");
} | java | private void groovyExpression(Reader reader, StringWriter sw) throws IOException {
sw.write("${");
int c;
while ((c = reader.read()) != -1) {
if (c == '%') {
c = reader.read();
if (c != '>') {
sw.write('%');
} else {
break;
}
}
if (c != '\n' && c != '\r') {
sw.write(c);
}
}
sw.write("}");
} | [
"private",
"void",
"groovyExpression",
"(",
"Reader",
"reader",
",",
"StringWriter",
"sw",
")",
"throws",
"IOException",
"{",
"sw",
".",
"write",
"(",
"\"${\"",
")",
";",
"int",
"c",
";",
"while",
"(",
"(",
"c",
"=",
"reader",
".",
"read",
"(",
")",
... | Closes the currently open write and writes out the following text as a GString expression until it reaches an end %>.
@param reader a reader for the template text
@param sw a StringWriter to write expression content
@throws IOException if something goes wrong | [
"Closes",
"the",
"currently",
"open",
"write",
"and",
"writes",
"out",
"the",
"following",
"text",
"as",
"a",
"GString",
"expression",
"until",
"it",
"reaches",
"an",
"end",
"%",
">",
"."
] | train | https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/groovy/src/main/java/org/kohsuke/stapler/jelly/groovy/SimpleTemplateParser.java#L135-L152 |
alkacon/opencms-core | src-gwt/org/opencms/ui/client/CmsSitemapExtensionConnector.java | CmsSitemapExtensionConnector.openPageCopyDialog | public void openPageCopyDialog(String id, JavaScriptObject callback) {
openPageCopyDialog(id, CmsJsUtil.wrapCallback(callback));
} | java | public void openPageCopyDialog(String id, JavaScriptObject callback) {
openPageCopyDialog(id, CmsJsUtil.wrapCallback(callback));
} | [
"public",
"void",
"openPageCopyDialog",
"(",
"String",
"id",
",",
"JavaScriptObject",
"callback",
")",
"{",
"openPageCopyDialog",
"(",
"id",
",",
"CmsJsUtil",
".",
"wrapCallback",
"(",
"callback",
")",
")",
";",
"}"
] | Opens the page copy dialog.<p>
@param id the structure id of the resource for which to open the dialog
@param callback the native callback to call with the result when the dialog has finished | [
"Opens",
"the",
"page",
"copy",
"dialog",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ui/client/CmsSitemapExtensionConnector.java#L125-L128 |
powermock/powermock | powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java | WhiteboxImpl.isPotentialVarArgsMethod | private static boolean isPotentialVarArgsMethod(Method method, Object[] arguments) {
return doesParameterTypesMatchForVarArgsInvocation(method.isVarArgs(), method.getParameterTypes(), arguments);
} | java | private static boolean isPotentialVarArgsMethod(Method method, Object[] arguments) {
return doesParameterTypesMatchForVarArgsInvocation(method.isVarArgs(), method.getParameterTypes(), arguments);
} | [
"private",
"static",
"boolean",
"isPotentialVarArgsMethod",
"(",
"Method",
"method",
",",
"Object",
"[",
"]",
"arguments",
")",
"{",
"return",
"doesParameterTypesMatchForVarArgsInvocation",
"(",
"method",
".",
"isVarArgs",
"(",
")",
",",
"method",
".",
"getParameter... | Checks if is potential var args method.
@param method the method
@param arguments the arguments
@return true, if is potential var args method | [
"Checks",
"if",
"is",
"potential",
"var",
"args",
"method",
"."
] | train | https://github.com/powermock/powermock/blob/e8cd68026c284c6a7efe66959809eeebd8d1f9ad/powermock-reflect/src/main/java/org/powermock/reflect/internal/WhiteboxImpl.java#L2387-L2389 |
phax/ph-commons | ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java | StreamHelper.readStreamLines | @Nullable
@ReturnsMutableCopy
public static ICommonsList <String> readStreamLines (@Nullable final IHasInputStream aISP,
@Nonnull final Charset aCharset)
{
return readStreamLines (aISP, aCharset, 0, CGlobal.ILLEGAL_UINT);
} | java | @Nullable
@ReturnsMutableCopy
public static ICommonsList <String> readStreamLines (@Nullable final IHasInputStream aISP,
@Nonnull final Charset aCharset)
{
return readStreamLines (aISP, aCharset, 0, CGlobal.ILLEGAL_UINT);
} | [
"@",
"Nullable",
"@",
"ReturnsMutableCopy",
"public",
"static",
"ICommonsList",
"<",
"String",
">",
"readStreamLines",
"(",
"@",
"Nullable",
"final",
"IHasInputStream",
"aISP",
",",
"@",
"Nonnull",
"final",
"Charset",
"aCharset",
")",
"{",
"return",
"readStreamLin... | Get the content of the passed Spring resource as one big string in the passed
character set.
@param aISP
The resource to read. May not be <code>null</code>.
@param aCharset
The character set to use. May not be <code>null</code>.
@return <code>null</code> if the resolved input stream is <code>null</code> ,
the content otherwise. | [
"Get",
"the",
"content",
"of",
"the",
"passed",
"Spring",
"resource",
"as",
"one",
"big",
"string",
"in",
"the",
"passed",
"character",
"set",
"."
] | train | https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/io/stream/StreamHelper.java#L1019-L1025 |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/AccrueTypeUtility.java | AccrueTypeUtility.getInstance | public static AccrueType getInstance(String type, Locale locale)
{
AccrueType result = null;
String[] typeNames = LocaleData.getStringArray(locale, LocaleData.ACCRUE_TYPES);
for (int loop = 0; loop < typeNames.length; loop++)
{
if (typeNames[loop].equalsIgnoreCase(type) == true)
{
result = AccrueType.getInstance(loop + 1);
break;
}
}
if (result == null)
{
result = AccrueType.PRORATED;
}
return (result);
} | java | public static AccrueType getInstance(String type, Locale locale)
{
AccrueType result = null;
String[] typeNames = LocaleData.getStringArray(locale, LocaleData.ACCRUE_TYPES);
for (int loop = 0; loop < typeNames.length; loop++)
{
if (typeNames[loop].equalsIgnoreCase(type) == true)
{
result = AccrueType.getInstance(loop + 1);
break;
}
}
if (result == null)
{
result = AccrueType.PRORATED;
}
return (result);
} | [
"public",
"static",
"AccrueType",
"getInstance",
"(",
"String",
"type",
",",
"Locale",
"locale",
")",
"{",
"AccrueType",
"result",
"=",
"null",
";",
"String",
"[",
"]",
"typeNames",
"=",
"LocaleData",
".",
"getStringArray",
"(",
"locale",
",",
"LocaleData",
... | This method takes the textual version of an accrue type name
and populates the class instance appropriately. Note that unrecognised
values are treated as "Prorated".
@param type text version of the accrue type
@param locale target locale
@return AccrueType class instance | [
"This",
"method",
"takes",
"the",
"textual",
"version",
"of",
"an",
"accrue",
"type",
"name",
"and",
"populates",
"the",
"class",
"instance",
"appropriately",
".",
"Note",
"that",
"unrecognised",
"values",
"are",
"treated",
"as",
"Prorated",
"."
] | train | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/AccrueTypeUtility.java#L53-L74 |
prolificinteractive/material-calendarview | sample/src/main/java/com/prolificinteractive/materialcalendarview/sample/decorators/RangeDayDecorator.java | RangeDayDecorator.addFirstAndLast | public void addFirstAndLast(final CalendarDay first, final CalendarDay last) {
list.clear();
list.add(first);
list.add(last);
} | java | public void addFirstAndLast(final CalendarDay first, final CalendarDay last) {
list.clear();
list.add(first);
list.add(last);
} | [
"public",
"void",
"addFirstAndLast",
"(",
"final",
"CalendarDay",
"first",
",",
"final",
"CalendarDay",
"last",
")",
"{",
"list",
".",
"clear",
"(",
")",
";",
"list",
".",
"add",
"(",
"first",
")",
";",
"list",
".",
"add",
"(",
"last",
")",
";",
"}"
... | We're changing the dates, so make sure to call {@linkplain MaterialCalendarView#invalidateDecorators()} | [
"We",
"re",
"changing",
"the",
"dates",
"so",
"make",
"sure",
"to",
"call",
"{"
] | train | https://github.com/prolificinteractive/material-calendarview/blob/04fae8175fd034d0a7131f8cb253cae883a88aa2/sample/src/main/java/com/prolificinteractive/materialcalendarview/sample/decorators/RangeDayDecorator.java#L37-L41 |
alkacon/opencms-core | src/org/opencms/ugc/CmsUgcSession.java | CmsUgcSession.saveContent | public CmsXmlContentErrorHandler saveContent(Map<String, String> contentValues) throws CmsUgcException {
checkNotFinished();
try {
CmsFile file = m_cms.readFile(m_editResource);
CmsXmlContent content = addContentValues(file, contentValues);
CmsXmlContentErrorHandler errorHandler = content.validate(m_cms);
if (!errorHandler.hasErrors()) {
file.setContents(content.marshal());
// the file content might have been modified during the write operation
file = m_cms.writeFile(file);
}
return errorHandler;
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage());
}
} | java | public CmsXmlContentErrorHandler saveContent(Map<String, String> contentValues) throws CmsUgcException {
checkNotFinished();
try {
CmsFile file = m_cms.readFile(m_editResource);
CmsXmlContent content = addContentValues(file, contentValues);
CmsXmlContentErrorHandler errorHandler = content.validate(m_cms);
if (!errorHandler.hasErrors()) {
file.setContents(content.marshal());
// the file content might have been modified during the write operation
file = m_cms.writeFile(file);
}
return errorHandler;
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage());
}
} | [
"public",
"CmsXmlContentErrorHandler",
"saveContent",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"contentValues",
")",
"throws",
"CmsUgcException",
"{",
"checkNotFinished",
"(",
")",
";",
"try",
"{",
"CmsFile",
"file",
"=",
"m_cms",
".",
"readFile",
"(",
"... | Saves the content values to the sessions edit resource.<p>
@param contentValues the content values by XPath
@return the validation handler
@throws CmsUgcException if writing the content fails | [
"Saves",
"the",
"content",
"values",
"to",
"the",
"sessions",
"edit",
"resource",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L499-L518 |
kuali/ojb-1.0.4 | src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java | SqlGeneratorDefaultImpl.getSelectMNStatement | public String getSelectMNStatement(String table, String[] selectColumns, String[] columns)
{
SqlStatement sql;
String result;
sql = new SqlSelectMNStatement(table, selectColumns, columns, logger);
result = sql.getStatement();
if (logger.isDebugEnabled())
{
logger.debug("SQL:" + result);
}
return result;
} | java | public String getSelectMNStatement(String table, String[] selectColumns, String[] columns)
{
SqlStatement sql;
String result;
sql = new SqlSelectMNStatement(table, selectColumns, columns, logger);
result = sql.getStatement();
if (logger.isDebugEnabled())
{
logger.debug("SQL:" + result);
}
return result;
} | [
"public",
"String",
"getSelectMNStatement",
"(",
"String",
"table",
",",
"String",
"[",
"]",
"selectColumns",
",",
"String",
"[",
"]",
"columns",
")",
"{",
"SqlStatement",
"sql",
";",
"String",
"result",
";",
"sql",
"=",
"new",
"SqlSelectMNStatement",
"(",
"... | generate a SELECT-Statement for M:N indirection table
@param table the indirection table
@param selectColumns selected columns
@param columns for where | [
"generate",
"a",
"SELECT",
"-",
"Statement",
"for",
"M",
":",
"N",
"indirection",
"table"
] | train | https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/accesslayer/sql/SqlGeneratorDefaultImpl.java#L261-L274 |
alkacon/opencms-core | src-gwt/org/opencms/ade/sitemap/client/CmsSitemapTreeItem.java | CmsSitemapTreeItem.setAdditionalStyles | private static void setAdditionalStyles(CmsClientSitemapEntry entry, CmsListItemWidget itemWidget) {
if (!entry.isResleasedAndNotExpired()
|| ((CmsSitemapView.getInstance().getEditorMode() == EditorMode.navigation)
&& !entry.isDefaultFileReleased())) {
itemWidget.getContentPanel().addStyleName(
I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().expiredOrNotReleased());
} else {
itemWidget.getContentPanel().removeStyleName(
I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().expiredOrNotReleased());
}
if (entry.isHiddenNavigationEntry()) {
itemWidget.getContentPanel().addStyleName(
I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().hiddenNavEntry());
} else {
itemWidget.getContentPanel().removeStyleName(
I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().hiddenNavEntry());
}
} | java | private static void setAdditionalStyles(CmsClientSitemapEntry entry, CmsListItemWidget itemWidget) {
if (!entry.isResleasedAndNotExpired()
|| ((CmsSitemapView.getInstance().getEditorMode() == EditorMode.navigation)
&& !entry.isDefaultFileReleased())) {
itemWidget.getContentPanel().addStyleName(
I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().expiredOrNotReleased());
} else {
itemWidget.getContentPanel().removeStyleName(
I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().expiredOrNotReleased());
}
if (entry.isHiddenNavigationEntry()) {
itemWidget.getContentPanel().addStyleName(
I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().hiddenNavEntry());
} else {
itemWidget.getContentPanel().removeStyleName(
I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().hiddenNavEntry());
}
} | [
"private",
"static",
"void",
"setAdditionalStyles",
"(",
"CmsClientSitemapEntry",
"entry",
",",
"CmsListItemWidget",
"itemWidget",
")",
"{",
"if",
"(",
"!",
"entry",
".",
"isResleasedAndNotExpired",
"(",
")",
"||",
"(",
"(",
"CmsSitemapView",
".",
"getInstance",
"... | Sets the additional style to mark expired entries or those that have the hide in navigation property set.<p>
@param entry the sitemap entry
@param itemWidget the item widget | [
"Sets",
"the",
"additional",
"style",
"to",
"mark",
"expired",
"entries",
"or",
"those",
"that",
"have",
"the",
"hide",
"in",
"navigation",
"property",
"set",
".",
"<p",
">"
] | train | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/CmsSitemapTreeItem.java#L384-L402 |
TakahikoKawasaki/nv-websocket-client | src/main/java/com/neovisionaries/ws/client/ProxySettings.java | ProxySettings.setCredentials | public ProxySettings setCredentials(String id, String password)
{
return setId(id).setPassword(password);
} | java | public ProxySettings setCredentials(String id, String password)
{
return setId(id).setPassword(password);
} | [
"public",
"ProxySettings",
"setCredentials",
"(",
"String",
"id",
",",
"String",
"password",
")",
"{",
"return",
"setId",
"(",
"id",
")",
".",
"setPassword",
"(",
"password",
")",
";",
"}"
] | Set credentials for authentication at the proxy server.
This method is an alias of {@link #setId(String) setId}{@code
(id).}{@link #setPassword(String) setPassword}{@code
(password)}.
@param id
The ID.
@param password
The password.
@return
{@code this} object. | [
"Set",
"credentials",
"for",
"authentication",
"at",
"the",
"proxy",
"server",
".",
"This",
"method",
"is",
"an",
"alias",
"of",
"{",
"@link",
"#setId",
"(",
"String",
")",
"setId",
"}",
"{",
"@code",
"(",
"id",
")",
".",
"}",
"{",
"@link",
"#setPasswo... | train | https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/ProxySettings.java#L384-L387 |
looly/hutool | hutool-core/src/main/java/cn/hutool/core/lang/Assert.java | Assert.notBlank | public static String notBlank(String text, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (StrUtil.isBlank(text)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return text;
} | java | public static String notBlank(String text, String errorMsgTemplate, Object... params) throws IllegalArgumentException {
if (StrUtil.isBlank(text)) {
throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params));
}
return text;
} | [
"public",
"static",
"String",
"notBlank",
"(",
"String",
"text",
",",
"String",
"errorMsgTemplate",
",",
"Object",
"...",
"params",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"StrUtil",
".",
"isBlank",
"(",
"text",
")",
")",
"{",
"throw",
"ne... | 检查给定字符串是否为空白(null、空串或只包含空白符),为空抛出 {@link IllegalArgumentException}
<pre class="code">
Assert.notBlank(name, "Name must not be blank");
</pre>
@param text 被检查字符串
@param errorMsgTemplate 错误消息模板,变量使用{}表示
@param params 参数
@return 非空字符串
@see StrUtil#isNotBlank(CharSequence)
@throws IllegalArgumentException 被检查字符串为空白 | [
"检查给定字符串是否为空白(null、空串或只包含空白符),为空抛出",
"{",
"@link",
"IllegalArgumentException",
"}"
] | train | https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L205-L210 |
artikcloud/artikcloud-java | src/main/java/cloud/artik/api/RulesApi.java | RulesApi.updateRule | public RuleEnvelope updateRule(String ruleId, RuleUpdateInfo ruleInfo) throws ApiException {
ApiResponse<RuleEnvelope> resp = updateRuleWithHttpInfo(ruleId, ruleInfo);
return resp.getData();
} | java | public RuleEnvelope updateRule(String ruleId, RuleUpdateInfo ruleInfo) throws ApiException {
ApiResponse<RuleEnvelope> resp = updateRuleWithHttpInfo(ruleId, ruleInfo);
return resp.getData();
} | [
"public",
"RuleEnvelope",
"updateRule",
"(",
"String",
"ruleId",
",",
"RuleUpdateInfo",
"ruleInfo",
")",
"throws",
"ApiException",
"{",
"ApiResponse",
"<",
"RuleEnvelope",
">",
"resp",
"=",
"updateRuleWithHttpInfo",
"(",
"ruleId",
",",
"ruleInfo",
")",
";",
"retur... | Update Rule
Update an existing Rule
@param ruleId Rule ID. (required)
@param ruleInfo Rule object that needs to be updated (required)
@return RuleEnvelope
@throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body | [
"Update",
"Rule",
"Update",
"an",
"existing",
"Rule"
] | train | https://github.com/artikcloud/artikcloud-java/blob/412f447573e7796ab4f685c0bdd5eb76185a365c/src/main/java/cloud/artik/api/RulesApi.java#L498-L501 |
Azure/azure-sdk-for-java | appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java | AppServiceEnvironmentsInner.getMultiRolePool | public WorkerPoolResourceInner getMultiRolePool(String resourceGroupName, String name) {
return getMultiRolePoolWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | java | public WorkerPoolResourceInner getMultiRolePool(String resourceGroupName, String name) {
return getMultiRolePoolWithServiceResponseAsync(resourceGroupName, name).toBlocking().single().body();
} | [
"public",
"WorkerPoolResourceInner",
"getMultiRolePool",
"(",
"String",
"resourceGroupName",
",",
"String",
"name",
")",
"{",
"return",
"getMultiRolePoolWithServiceResponseAsync",
"(",
"resourceGroupName",
",",
"name",
")",
".",
"toBlocking",
"(",
")",
".",
"single",
... | Get properties of a multi-role pool.
Get properties of a multi-role pool.
@param resourceGroupName Name of the resource group to which the resource belongs.
@param name Name of the App Service Environment.
@throws IllegalArgumentException thrown if parameters fail the validation
@throws CloudException thrown if the request is rejected by server
@throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
@return the WorkerPoolResourceInner object if successful. | [
"Get",
"properties",
"of",
"a",
"multi",
"-",
"role",
"pool",
".",
"Get",
"properties",
"of",
"a",
"multi",
"-",
"role",
"pool",
"."
] | train | https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L2182-L2184 |
matthewhorridge/owlapi-gwt | owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyRangeAxiomImpl_CustomFieldSerializer.java | OWLObjectPropertyRangeAxiomImpl_CustomFieldSerializer.deserializeInstance | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectPropertyRangeAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | java | @Override
public void deserializeInstance(SerializationStreamReader streamReader, OWLObjectPropertyRangeAxiomImpl instance) throws SerializationException {
deserialize(streamReader, instance);
} | [
"@",
"Override",
"public",
"void",
"deserializeInstance",
"(",
"SerializationStreamReader",
"streamReader",
",",
"OWLObjectPropertyRangeAxiomImpl",
"instance",
")",
"throws",
"SerializationException",
"{",
"deserialize",
"(",
"streamReader",
",",
"instance",
")",
";",
"}"... | Deserializes the content of the object from the
{@link com.google.gwt.user.client.rpc.SerializationStreamReader}.
@param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the
object's content from
@param instance the object instance to deserialize
@throws com.google.gwt.user.client.rpc.SerializationException
if the deserialization operation is not
successful | [
"Deserializes",
"the",
"content",
"of",
"the",
"object",
"from",
"the",
"{",
"@link",
"com",
".",
"google",
".",
"gwt",
".",
"user",
".",
"client",
".",
"rpc",
".",
"SerializationStreamReader",
"}",
"."
] | train | https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLObjectPropertyRangeAxiomImpl_CustomFieldSerializer.java#L98-L101 |
btrplace/scheduler | api/src/main/java/org/btrplace/model/view/ShareableResource.java | ShareableResource.setCapacity | public ShareableResource setCapacity(int val, Node... nodes) {
Stream.of(nodes).forEach(n -> this.setCapacity(n, val));
return this;
} | java | public ShareableResource setCapacity(int val, Node... nodes) {
Stream.of(nodes).forEach(n -> this.setCapacity(n, val));
return this;
} | [
"public",
"ShareableResource",
"setCapacity",
"(",
"int",
"val",
",",
"Node",
"...",
"nodes",
")",
"{",
"Stream",
".",
"of",
"(",
"nodes",
")",
".",
"forEach",
"(",
"n",
"->",
"this",
".",
"setCapacity",
"(",
"n",
",",
"val",
")",
")",
";",
"return",... | Set the resource consumption of nodes.
@param val the value to set
@param nodes the nodes
@return the current resource | [
"Set",
"the",
"resource",
"consumption",
"of",
"nodes",
"."
] | train | https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/api/src/main/java/org/btrplace/model/view/ShareableResource.java#L192-L195 |
xcesco/kripton | kripton-core/src/main/java/com/abubusoft/kripton/common/TypeAdapterUtils.java | TypeAdapterUtils.toData | @SuppressWarnings("unchecked")
public static <D, J> D toData(Class<? extends TypeAdapter<J, D>> clazz, J javaValue) {
TypeAdapter<J, D> adapter = cache.get(clazz);
if (adapter == null) {
adapter = generateAdapter(cache, lock, clazz);
}
return adapter.toData(javaValue);
} | java | @SuppressWarnings("unchecked")
public static <D, J> D toData(Class<? extends TypeAdapter<J, D>> clazz, J javaValue) {
TypeAdapter<J, D> adapter = cache.get(clazz);
if (adapter == null) {
adapter = generateAdapter(cache, lock, clazz);
}
return adapter.toData(javaValue);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"D",
",",
"J",
">",
"D",
"toData",
"(",
"Class",
"<",
"?",
"extends",
"TypeAdapter",
"<",
"J",
",",
"D",
">",
">",
"clazz",
",",
"J",
"javaValue",
")",
"{",
"TypeAdapter",
"... | To data.
@param <D> the generic type
@param <J> the generic type
@param clazz the clazz
@param javaValue the java value
@return the d | [
"To",
"data",
"."
] | train | https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-core/src/main/java/com/abubusoft/kripton/common/TypeAdapterUtils.java#L66-L75 |
symphonyoss/messageml-utils | src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java | XmlPrintStream.printElement | public void printElement(String elementName, String value, Map<String, String> attributes) {
print("<" + elementName);
for (Entry<String, String> entry : attributes.entrySet()) {
print(" " + entry.getKey() + "=\"" + escape(entry.getValue()) + "\"");
}
if (value != null) {
println(">" + escape(value) + "</" + elementName + ">");
} else {
println("/>");
}
} | java | public void printElement(String elementName, String value, Map<String, String> attributes) {
print("<" + elementName);
for (Entry<String, String> entry : attributes.entrySet()) {
print(" " + entry.getKey() + "=\"" + escape(entry.getValue()) + "\"");
}
if (value != null) {
println(">" + escape(value) + "</" + elementName + ">");
} else {
println("/>");
}
} | [
"public",
"void",
"printElement",
"(",
"String",
"elementName",
",",
"String",
"value",
",",
"Map",
"<",
"String",
",",
"String",
">",
"attributes",
")",
"{",
"print",
"(",
"\"<\"",
"+",
"elementName",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
... | Output a complete element with the given content and attributes.
@param elementName Name of element.
@param value Content of element.
@param attributes A map of name value pairs which will be used to add attributes to
the element. | [
"Output",
"a",
"complete",
"element",
"with",
"the",
"given",
"content",
"and",
"attributes",
"."
] | train | https://github.com/symphonyoss/messageml-utils/blob/68daed66267062d144a05b3ee9a9bf4b715e3f95/src/main/java/org/symphonyoss/symphony/messageml/util/XmlPrintStream.java#L133-L145 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.