id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
145,900
|
astrapi69/jaulp-wicket
|
jaulp-wicket-annotated-header-contributors/src/main/java/de/alpharogroup/wicket/header/contributors/HeaderResponseExtensions.java
|
HeaderResponseExtensions.renderHeaderResponse
|
public static void renderHeaderResponse(final IHeaderResponse response,
final Class<?> componentClass)
{
final Set<PackageResourceReferenceWrapper> headerContributors = PackageResourceReferences
.getInstance().getPackageResourceReference(componentClass);
if ((null != headerContributors) && !headerContributors.isEmpty())
{
for (final PackageResourceReferenceWrapper packageResourceReference : headerContributors)
{
if (packageResourceReference.getType().equals(ResourceReferenceType.JS))
{
final JavaScriptResourceReference reference = new JavaScriptResourceReference(
componentClass,
packageResourceReference.getPackageResourceReference().getName());
if (!response.wasRendered(reference))
{
final JavaScriptReferenceHeaderItem headerItem = JavaScriptHeaderItem
.forReference(reference);
response.render(headerItem);
}
}
if (packageResourceReference.getType().equals(ResourceReferenceType.CSS))
{
final CssResourceReference reference = new CssResourceReference(componentClass,
packageResourceReference.getPackageResourceReference().getName());
if (!response.wasRendered(reference))
{
final CssReferenceHeaderItem headerItem = CssHeaderItem
.forReference(reference);
response.render(headerItem);
}
}
}
}
}
|
java
|
public static void renderHeaderResponse(final IHeaderResponse response,
final Class<?> componentClass)
{
final Set<PackageResourceReferenceWrapper> headerContributors = PackageResourceReferences
.getInstance().getPackageResourceReference(componentClass);
if ((null != headerContributors) && !headerContributors.isEmpty())
{
for (final PackageResourceReferenceWrapper packageResourceReference : headerContributors)
{
if (packageResourceReference.getType().equals(ResourceReferenceType.JS))
{
final JavaScriptResourceReference reference = new JavaScriptResourceReference(
componentClass,
packageResourceReference.getPackageResourceReference().getName());
if (!response.wasRendered(reference))
{
final JavaScriptReferenceHeaderItem headerItem = JavaScriptHeaderItem
.forReference(reference);
response.render(headerItem);
}
}
if (packageResourceReference.getType().equals(ResourceReferenceType.CSS))
{
final CssResourceReference reference = new CssResourceReference(componentClass,
packageResourceReference.getPackageResourceReference().getName());
if (!response.wasRendered(reference))
{
final CssReferenceHeaderItem headerItem = CssHeaderItem
.forReference(reference);
response.render(headerItem);
}
}
}
}
}
|
[
"public",
"static",
"void",
"renderHeaderResponse",
"(",
"final",
"IHeaderResponse",
"response",
",",
"final",
"Class",
"<",
"?",
">",
"componentClass",
")",
"{",
"final",
"Set",
"<",
"PackageResourceReferenceWrapper",
">",
"headerContributors",
"=",
"PackageResourceReferences",
".",
"getInstance",
"(",
")",
".",
"getPackageResourceReference",
"(",
"componentClass",
")",
";",
"if",
"(",
"(",
"null",
"!=",
"headerContributors",
")",
"&&",
"!",
"headerContributors",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"final",
"PackageResourceReferenceWrapper",
"packageResourceReference",
":",
"headerContributors",
")",
"{",
"if",
"(",
"packageResourceReference",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"ResourceReferenceType",
".",
"JS",
")",
")",
"{",
"final",
"JavaScriptResourceReference",
"reference",
"=",
"new",
"JavaScriptResourceReference",
"(",
"componentClass",
",",
"packageResourceReference",
".",
"getPackageResourceReference",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"!",
"response",
".",
"wasRendered",
"(",
"reference",
")",
")",
"{",
"final",
"JavaScriptReferenceHeaderItem",
"headerItem",
"=",
"JavaScriptHeaderItem",
".",
"forReference",
"(",
"reference",
")",
";",
"response",
".",
"render",
"(",
"headerItem",
")",
";",
"}",
"}",
"if",
"(",
"packageResourceReference",
".",
"getType",
"(",
")",
".",
"equals",
"(",
"ResourceReferenceType",
".",
"CSS",
")",
")",
"{",
"final",
"CssResourceReference",
"reference",
"=",
"new",
"CssResourceReference",
"(",
"componentClass",
",",
"packageResourceReference",
".",
"getPackageResourceReference",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"!",
"response",
".",
"wasRendered",
"(",
"reference",
")",
")",
"{",
"final",
"CssReferenceHeaderItem",
"headerItem",
"=",
"CssHeaderItem",
".",
"forReference",
"(",
"reference",
")",
";",
"response",
".",
"render",
"(",
"headerItem",
")",
";",
"}",
"}",
"}",
"}",
"}"
] |
Render header response.
@param response
the response
@param componentClass
the component class
|
[
"Render",
"header",
"response",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-annotated-header-contributors/src/main/java/de/alpharogroup/wicket/header/contributors/HeaderResponseExtensions.java#L49-L83
|
145,901
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/pm/SignatureUtils.java
|
SignatureUtils.getSignatureHexCode
|
public static String getSignatureHexCode(Context context, String targetPackageName) {
if (TextUtils.isEmpty(targetPackageName)) {
return null;
}
try {
PackageInfo info = PackageManagerUtils.getSignaturePackageInfo(context, targetPackageName);
if (info.signatures.length != 1) {
// multiple signature would not treated
return null;
}
Signature sig = info.signatures[0];
byte[] sha256 = MessageDigestUtils.computeSha256(sig.toByteArray());
return StringUtils.byteToHex(sha256);
} catch (NameNotFoundException e) {
Log.e(TAG, "target package not found: ", e);
return null;
}
}
|
java
|
public static String getSignatureHexCode(Context context, String targetPackageName) {
if (TextUtils.isEmpty(targetPackageName)) {
return null;
}
try {
PackageInfo info = PackageManagerUtils.getSignaturePackageInfo(context, targetPackageName);
if (info.signatures.length != 1) {
// multiple signature would not treated
return null;
}
Signature sig = info.signatures[0];
byte[] sha256 = MessageDigestUtils.computeSha256(sig.toByteArray());
return StringUtils.byteToHex(sha256);
} catch (NameNotFoundException e) {
Log.e(TAG, "target package not found: ", e);
return null;
}
}
|
[
"public",
"static",
"String",
"getSignatureHexCode",
"(",
"Context",
"context",
",",
"String",
"targetPackageName",
")",
"{",
"if",
"(",
"TextUtils",
".",
"isEmpty",
"(",
"targetPackageName",
")",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"PackageInfo",
"info",
"=",
"PackageManagerUtils",
".",
"getSignaturePackageInfo",
"(",
"context",
",",
"targetPackageName",
")",
";",
"if",
"(",
"info",
".",
"signatures",
".",
"length",
"!=",
"1",
")",
"{",
"// multiple signature would not treated",
"return",
"null",
";",
"}",
"Signature",
"sig",
"=",
"info",
".",
"signatures",
"[",
"0",
"]",
";",
"byte",
"[",
"]",
"sha256",
"=",
"MessageDigestUtils",
".",
"computeSha256",
"(",
"sig",
".",
"toByteArray",
"(",
")",
")",
";",
"return",
"StringUtils",
".",
"byteToHex",
"(",
"sha256",
")",
";",
"}",
"catch",
"(",
"NameNotFoundException",
"e",
")",
"{",
"Log",
".",
"e",
"(",
"TAG",
",",
"\"target package not found: \"",
",",
"e",
")",
";",
"return",
"null",
";",
"}",
"}"
] |
Obtains the signature hex code.
@param context the context.
@param targetPackageName the target package name.
@return the hex code of the signature.
|
[
"Obtains",
"the",
"signature",
"hex",
"code",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/pm/SignatureUtils.java#L80-L97
|
145,902
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/view/DisplayUtils.java
|
DisplayUtils.getDisplaySize
|
@SuppressLint("NewApi")
public static Point getDisplaySize(WindowManager manager) {
Display display = manager.getDefaultDisplay();
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB_MR2) {
Point size = new Point();
display.getSize(size);
return size;
} else {
Point size = new Point();
size.x = getDisplayWidth(manager);
size.y = getDisplayHeight(manager);
return size;
}
}
|
java
|
@SuppressLint("NewApi")
public static Point getDisplaySize(WindowManager manager) {
Display display = manager.getDefaultDisplay();
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB_MR2) {
Point size = new Point();
display.getSize(size);
return size;
} else {
Point size = new Point();
size.x = getDisplayWidth(manager);
size.y = getDisplayHeight(manager);
return size;
}
}
|
[
"@",
"SuppressLint",
"(",
"\"NewApi\"",
")",
"public",
"static",
"Point",
"getDisplaySize",
"(",
"WindowManager",
"manager",
")",
"{",
"Display",
"display",
"=",
"manager",
".",
"getDefaultDisplay",
"(",
")",
";",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB_MR2",
")",
"{",
"Point",
"size",
"=",
"new",
"Point",
"(",
")",
";",
"display",
".",
"getSize",
"(",
"size",
")",
";",
"return",
"size",
";",
"}",
"else",
"{",
"Point",
"size",
"=",
"new",
"Point",
"(",
")",
";",
"size",
".",
"x",
"=",
"getDisplayWidth",
"(",
"manager",
")",
";",
"size",
".",
"y",
"=",
"getDisplayHeight",
"(",
"manager",
")",
";",
"return",
"size",
";",
"}",
"}"
] |
Get the display width and height.
@param manager the window manager.
@return the display size.
|
[
"Get",
"the",
"display",
"width",
"and",
"height",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/DisplayUtils.java#L40-L53
|
145,903
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/view/DisplayUtils.java
|
DisplayUtils.getDisplayWidth
|
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public static int getDisplayWidth(WindowManager manager) {
Display display = manager.getDefaultDisplay();
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB_MR2) {
Point size = new Point();
display.getSize(size);
return size.x;
} else {
return display.getWidth();
}
}
|
java
|
@SuppressLint("NewApi")
@SuppressWarnings("deprecation")
public static int getDisplayWidth(WindowManager manager) {
Display display = manager.getDefaultDisplay();
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB_MR2) {
Point size = new Point();
display.getSize(size);
return size.x;
} else {
return display.getWidth();
}
}
|
[
"@",
"SuppressLint",
"(",
"\"NewApi\"",
")",
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"public",
"static",
"int",
"getDisplayWidth",
"(",
"WindowManager",
"manager",
")",
"{",
"Display",
"display",
"=",
"manager",
".",
"getDefaultDisplay",
"(",
")",
";",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_INT",
">",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB_MR2",
")",
"{",
"Point",
"size",
"=",
"new",
"Point",
"(",
")",
";",
"display",
".",
"getSize",
"(",
"size",
")",
";",
"return",
"size",
".",
"x",
";",
"}",
"else",
"{",
"return",
"display",
".",
"getWidth",
"(",
")",
";",
"}",
"}"
] |
Get the display width.
@param manager the window manager.
@return the display width.
|
[
"Get",
"the",
"display",
"width",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/DisplayUtils.java#L60-L72
|
145,904
|
OpenBEL/openbel-framework
|
org.openbel.framework.ws/src/main/java/org/openbel/framework/ws/dialect/CustomDialect.java
|
CustomDialect.initialize
|
void initialize() {
if (initialized) {
throw new IllegalStateException(
"Dialect already initialized; re-initialization not allowed");
}
this.hashCode = new HashCodeBuilder().append(geneNamespaces)
.append(bpNamespaces).append(chemNamespaces)
.append(displayLongForm).append(removeNamespacePrefix)
.toHashCode();
this.initialized = true;
}
|
java
|
void initialize() {
if (initialized) {
throw new IllegalStateException(
"Dialect already initialized; re-initialization not allowed");
}
this.hashCode = new HashCodeBuilder().append(geneNamespaces)
.append(bpNamespaces).append(chemNamespaces)
.append(displayLongForm).append(removeNamespacePrefix)
.toHashCode();
this.initialized = true;
}
|
[
"void",
"initialize",
"(",
")",
"{",
"if",
"(",
"initialized",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Dialect already initialized; re-initialization not allowed\"",
")",
";",
"}",
"this",
".",
"hashCode",
"=",
"new",
"HashCodeBuilder",
"(",
")",
".",
"append",
"(",
"geneNamespaces",
")",
".",
"append",
"(",
"bpNamespaces",
")",
".",
"append",
"(",
"chemNamespaces",
")",
".",
"append",
"(",
"displayLongForm",
")",
".",
"append",
"(",
"removeNamespacePrefix",
")",
".",
"toHashCode",
"(",
")",
";",
"this",
".",
"initialized",
"=",
"true",
";",
"}"
] |
Initialize the dialect. Must be invoked post-mutation.
|
[
"Initialize",
"the",
"dialect",
".",
"Must",
"be",
"invoked",
"post",
"-",
"mutation",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.ws/src/main/java/org/openbel/framework/ws/dialect/CustomDialect.java#L218-L228
|
145,905
|
OpenBEL/openbel-framework
|
org.openbel.framework.ws/src/main/java/org/openbel/framework/ws/dialect/CustomDialect.java
|
CustomDialect.convert
|
protected Parameter convert(Parameter orig) {
if (orig.getNamespace() == null) {
return orig;
}
// determine domain of parameter namespace
NamespaceDomain domain = nsDomains.get(orig.getNamespace().getPrefix());
if (domain == null) {
return orig;
}
// iterate appropriate collection to find equiv
List<Namespace> coll;
switch (domain) {
case BiologicalProcess:
coll = bpNamespaces;
break;
case Chemical:
coll = chemNamespaces;
break;
case Gene:
coll = geneNamespaces;
break;
default:
throw new UnsupportedOperationException("Unknown domain: " + domain);
}
try {
SkinnyUUID uuid = equivalencer.getUUID(
getNamespace(orig.getNamespace()), orig.getValue());
if (uuid == null) {
// no equivalents anywhere
return orig;
}
// find first equivalent in list of desired
for (Namespace ns : coll) {
String v = equivalencer.equivalence(uuid, ns);
if (v != null) {
return removeNamespacePrefix ? new Parameter(null, v)
: new Parameter(ns, v);
}
}
} catch (EquivalencerException e) {
// TODO exception
return null;
}
// if no equiv, use param as-is
return orig;
}
|
java
|
protected Parameter convert(Parameter orig) {
if (orig.getNamespace() == null) {
return orig;
}
// determine domain of parameter namespace
NamespaceDomain domain = nsDomains.get(orig.getNamespace().getPrefix());
if (domain == null) {
return orig;
}
// iterate appropriate collection to find equiv
List<Namespace> coll;
switch (domain) {
case BiologicalProcess:
coll = bpNamespaces;
break;
case Chemical:
coll = chemNamespaces;
break;
case Gene:
coll = geneNamespaces;
break;
default:
throw new UnsupportedOperationException("Unknown domain: " + domain);
}
try {
SkinnyUUID uuid = equivalencer.getUUID(
getNamespace(orig.getNamespace()), orig.getValue());
if (uuid == null) {
// no equivalents anywhere
return orig;
}
// find first equivalent in list of desired
for (Namespace ns : coll) {
String v = equivalencer.equivalence(uuid, ns);
if (v != null) {
return removeNamespacePrefix ? new Parameter(null, v)
: new Parameter(ns, v);
}
}
} catch (EquivalencerException e) {
// TODO exception
return null;
}
// if no equiv, use param as-is
return orig;
}
|
[
"protected",
"Parameter",
"convert",
"(",
"Parameter",
"orig",
")",
"{",
"if",
"(",
"orig",
".",
"getNamespace",
"(",
")",
"==",
"null",
")",
"{",
"return",
"orig",
";",
"}",
"// determine domain of parameter namespace",
"NamespaceDomain",
"domain",
"=",
"nsDomains",
".",
"get",
"(",
"orig",
".",
"getNamespace",
"(",
")",
".",
"getPrefix",
"(",
")",
")",
";",
"if",
"(",
"domain",
"==",
"null",
")",
"{",
"return",
"orig",
";",
"}",
"// iterate appropriate collection to find equiv",
"List",
"<",
"Namespace",
">",
"coll",
";",
"switch",
"(",
"domain",
")",
"{",
"case",
"BiologicalProcess",
":",
"coll",
"=",
"bpNamespaces",
";",
"break",
";",
"case",
"Chemical",
":",
"coll",
"=",
"chemNamespaces",
";",
"break",
";",
"case",
"Gene",
":",
"coll",
"=",
"geneNamespaces",
";",
"break",
";",
"default",
":",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Unknown domain: \"",
"+",
"domain",
")",
";",
"}",
"try",
"{",
"SkinnyUUID",
"uuid",
"=",
"equivalencer",
".",
"getUUID",
"(",
"getNamespace",
"(",
"orig",
".",
"getNamespace",
"(",
")",
")",
",",
"orig",
".",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"uuid",
"==",
"null",
")",
"{",
"// no equivalents anywhere",
"return",
"orig",
";",
"}",
"// find first equivalent in list of desired",
"for",
"(",
"Namespace",
"ns",
":",
"coll",
")",
"{",
"String",
"v",
"=",
"equivalencer",
".",
"equivalence",
"(",
"uuid",
",",
"ns",
")",
";",
"if",
"(",
"v",
"!=",
"null",
")",
"{",
"return",
"removeNamespacePrefix",
"?",
"new",
"Parameter",
"(",
"null",
",",
"v",
")",
":",
"new",
"Parameter",
"(",
"ns",
",",
"v",
")",
";",
"}",
"}",
"}",
"catch",
"(",
"EquivalencerException",
"e",
")",
"{",
"// TODO exception",
"return",
"null",
";",
"}",
"// if no equiv, use param as-is",
"return",
"orig",
";",
"}"
] |
Convert a parameter to the preferred namespaces.
@param orig
@return the converted {@link Parameter} or the original parameter if no
conversion was possible
|
[
"Convert",
"a",
"parameter",
"to",
"the",
"preferred",
"namespaces",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.ws/src/main/java/org/openbel/framework/ws/dialect/CustomDialect.java#L318-L366
|
145,906
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/view/ViewUtils.java
|
ViewUtils.dipToPixel
|
public static int dipToPixel(Resources resources, int dip) {
final float scale = resources.getDisplayMetrics().density;
// add 0.5f to round the figure up to the nearest whole number
return (int) (dip * scale + 0.5f);
}
|
java
|
public static int dipToPixel(Resources resources, int dip) {
final float scale = resources.getDisplayMetrics().density;
// add 0.5f to round the figure up to the nearest whole number
return (int) (dip * scale + 0.5f);
}
|
[
"public",
"static",
"int",
"dipToPixel",
"(",
"Resources",
"resources",
",",
"int",
"dip",
")",
"{",
"final",
"float",
"scale",
"=",
"resources",
".",
"getDisplayMetrics",
"(",
")",
".",
"density",
";",
"// add 0.5f to round the figure up to the nearest whole number",
"return",
"(",
"int",
")",
"(",
"dip",
"*",
"scale",
"+",
"0.5f",
")",
";",
"}"
] |
Convert the dips to pixels, based on density scale.
@param resources application resources.
@param dip to be converted value.
@return converted value(px).
|
[
"Convert",
"the",
"dips",
"to",
"pixels",
"based",
"on",
"density",
"scale",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/ViewUtils.java#L53-L57
|
145,907
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/view/ViewUtils.java
|
ViewUtils.pixelToDip
|
public static float pixelToDip(WindowManager windowManager, int pixel) {
DisplayMetrics metrics = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(metrics);
return metrics.scaledDensity * pixel;
}
|
java
|
public static float pixelToDip(WindowManager windowManager, int pixel) {
DisplayMetrics metrics = new DisplayMetrics();
windowManager.getDefaultDisplay().getMetrics(metrics);
return metrics.scaledDensity * pixel;
}
|
[
"public",
"static",
"float",
"pixelToDip",
"(",
"WindowManager",
"windowManager",
",",
"int",
"pixel",
")",
"{",
"DisplayMetrics",
"metrics",
"=",
"new",
"DisplayMetrics",
"(",
")",
";",
"windowManager",
".",
"getDefaultDisplay",
"(",
")",
".",
"getMetrics",
"(",
"metrics",
")",
";",
"return",
"metrics",
".",
"scaledDensity",
"*",
"pixel",
";",
"}"
] |
Convert the pixels to dips, based on density scale
@param windowManager the window manager of the display to use the scale density of.
@param pixel to be converted value.
@return converted value(dip).
|
[
"Convert",
"the",
"pixels",
"to",
"dips",
"based",
"on",
"density",
"scale"
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/ViewUtils.java#L75-L79
|
145,908
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/view/ViewUtils.java
|
ViewUtils.sipToPixel
|
public static float sipToPixel(Resources resources, float sip) {
float density = resources.getDisplayMetrics().scaledDensity;
return sip * density;
}
|
java
|
public static float sipToPixel(Resources resources, float sip) {
float density = resources.getDisplayMetrics().scaledDensity;
return sip * density;
}
|
[
"public",
"static",
"float",
"sipToPixel",
"(",
"Resources",
"resources",
",",
"float",
"sip",
")",
"{",
"float",
"density",
"=",
"resources",
".",
"getDisplayMetrics",
"(",
")",
".",
"scaledDensity",
";",
"return",
"sip",
"*",
"density",
";",
"}"
] |
Convert the sip to pixels, based on density scale.
@param resources application resources.
@param sip to be converted value.
@return converted value(px)
|
[
"Convert",
"the",
"sip",
"to",
"pixels",
"based",
"on",
"density",
"scale",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/ViewUtils.java#L97-L100
|
145,909
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/view/ViewUtils.java
|
ViewUtils.pixelToSip
|
public static float pixelToSip(Context context, float pixels) {
DisplayMetrics metrics = new DisplayMetrics();
float scaledDensity = metrics.scaledDensity;
if (pixels == 0 || scaledDensity == 0) {
return 1;
}
return pixels/scaledDensity;
}
|
java
|
public static float pixelToSip(Context context, float pixels) {
DisplayMetrics metrics = new DisplayMetrics();
float scaledDensity = metrics.scaledDensity;
if (pixels == 0 || scaledDensity == 0) {
return 1;
}
return pixels/scaledDensity;
}
|
[
"public",
"static",
"float",
"pixelToSip",
"(",
"Context",
"context",
",",
"float",
"pixels",
")",
"{",
"DisplayMetrics",
"metrics",
"=",
"new",
"DisplayMetrics",
"(",
")",
";",
"float",
"scaledDensity",
"=",
"metrics",
".",
"scaledDensity",
";",
"if",
"(",
"pixels",
"==",
"0",
"||",
"scaledDensity",
"==",
"0",
")",
"{",
"return",
"1",
";",
"}",
"return",
"pixels",
"/",
"scaledDensity",
";",
"}"
] |
Convert the pixels to sips, based on density scale.
@param context the context.
@param pixels to be converted value.
@return converted value(sip)
|
[
"Convert",
"the",
"pixels",
"to",
"sips",
"based",
"on",
"density",
"scale",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/ViewUtils.java#L108-L115
|
145,910
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/view/ViewUtils.java
|
ViewUtils.findViewById
|
@SuppressWarnings("unchecked") // we know that return value type is a child of view, and V is bound to a child of view.
public static <V extends View> V findViewById(View view, int id) {
return (V) view.findViewById(id);
}
|
java
|
@SuppressWarnings("unchecked") // we know that return value type is a child of view, and V is bound to a child of view.
public static <V extends View> V findViewById(View view, int id) {
return (V) view.findViewById(id);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// we know that return value type is a child of view, and V is bound to a child of view.",
"public",
"static",
"<",
"V",
"extends",
"View",
">",
"V",
"findViewById",
"(",
"View",
"view",
",",
"int",
"id",
")",
"{",
"return",
"(",
"V",
")",
"view",
".",
"findViewById",
"(",
"id",
")",
";",
"}"
] |
Find the specific view from the view as traversal root.
Returning value type is bound to your variable type.
@param view the root view to find the view.
@param id the view id.
@param <V> the view class type parameter.
@return the view, null if not found.
|
[
"Find",
"the",
"specific",
"view",
"from",
"the",
"view",
"as",
"traversal",
"root",
".",
"Returning",
"value",
"type",
"is",
"bound",
"to",
"your",
"variable",
"type",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/view/ViewUtils.java#L137-L140
|
145,911
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/models/CUploadRequest.java
|
CUploadRequest.getByteSource
|
public ByteSource getByteSource()
{
ByteSource bs = byteSource;
if ( progressListener != null ) {
bs = new ProgressByteSource( bs, progressListener );
}
return bs;
}
|
java
|
public ByteSource getByteSource()
{
ByteSource bs = byteSource;
if ( progressListener != null ) {
bs = new ProgressByteSource( bs, progressListener );
}
return bs;
}
|
[
"public",
"ByteSource",
"getByteSource",
"(",
")",
"{",
"ByteSource",
"bs",
"=",
"byteSource",
";",
"if",
"(",
"progressListener",
"!=",
"null",
")",
"{",
"bs",
"=",
"new",
"ProgressByteSource",
"(",
"bs",
",",
"progressListener",
")",
";",
"}",
"return",
"bs",
";",
"}"
] |
If no progress listener has been set, return the byte source set in constructor, otherwise decorate it for
progress.
@return the byte source to be used for upload operation.
|
[
"If",
"no",
"progress",
"listener",
"has",
"been",
"set",
"return",
"the",
"byte",
"source",
"set",
"in",
"constructor",
"otherwise",
"decorate",
"it",
"for",
"progress",
"."
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/CUploadRequest.java#L114-L121
|
145,912
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/velocity/VelocityFieldsPanel.java
|
VelocityFieldsPanel.addChildComponent
|
public void addChildComponent(final WicketField<?> parent)
{
if ((parent.getChildren() != null) && !parent.getChildren().isEmpty())
{
for (final SimpleTag iterable_element : parent.getChildren())
{
final WicketField<?> field = (WicketField<?>)iterable_element;
final Component c = parent.getComponent();
if (c instanceof MarkupContainer)
{
final MarkupContainer mc = (MarkupContainer)c;
mc.add(field.getComponent());
}
addChildComponent(field);
}
}
}
|
java
|
public void addChildComponent(final WicketField<?> parent)
{
if ((parent.getChildren() != null) && !parent.getChildren().isEmpty())
{
for (final SimpleTag iterable_element : parent.getChildren())
{
final WicketField<?> field = (WicketField<?>)iterable_element;
final Component c = parent.getComponent();
if (c instanceof MarkupContainer)
{
final MarkupContainer mc = (MarkupContainer)c;
mc.add(field.getComponent());
}
addChildComponent(field);
}
}
}
|
[
"public",
"void",
"addChildComponent",
"(",
"final",
"WicketField",
"<",
"?",
">",
"parent",
")",
"{",
"if",
"(",
"(",
"parent",
".",
"getChildren",
"(",
")",
"!=",
"null",
")",
"&&",
"!",
"parent",
".",
"getChildren",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"final",
"SimpleTag",
"iterable_element",
":",
"parent",
".",
"getChildren",
"(",
")",
")",
"{",
"final",
"WicketField",
"<",
"?",
">",
"field",
"=",
"(",
"WicketField",
"<",
"?",
">",
")",
"iterable_element",
";",
"final",
"Component",
"c",
"=",
"parent",
".",
"getComponent",
"(",
")",
";",
"if",
"(",
"c",
"instanceof",
"MarkupContainer",
")",
"{",
"final",
"MarkupContainer",
"mc",
"=",
"(",
"MarkupContainer",
")",
"c",
";",
"mc",
".",
"add",
"(",
"field",
".",
"getComponent",
"(",
")",
")",
";",
"}",
"addChildComponent",
"(",
"field",
")",
";",
"}",
"}",
"}"
] |
Adds recursive the child components.
@param parent
the parent
|
[
"Adds",
"recursive",
"the",
"child",
"components",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/velocity/VelocityFieldsPanel.java#L120-L136
|
145,913
|
geomajas/geomajas-project-client-gwt2
|
plugin/editing/server-extension/src/main/java/org/geomajas/plugin/editing/client/split/GeometrySplitService.java
|
GeometrySplitService.start
|
public void start(Geometry geometry) {
this.geometry = geometry;
splitLine = new Geometry(Geometry.LINE_STRING, 0, 0);
service.start(splitLine);
service.setEditingState(GeometryEditState.INSERTING);
service.setInsertIndex(service.getIndexService().create(GeometryIndexType.TYPE_VERTEX, 0));
started = true;
eventBus.fireEvent(new GeometrySplitStartEvent(geometry));
}
|
java
|
public void start(Geometry geometry) {
this.geometry = geometry;
splitLine = new Geometry(Geometry.LINE_STRING, 0, 0);
service.start(splitLine);
service.setEditingState(GeometryEditState.INSERTING);
service.setInsertIndex(service.getIndexService().create(GeometryIndexType.TYPE_VERTEX, 0));
started = true;
eventBus.fireEvent(new GeometrySplitStartEvent(geometry));
}
|
[
"public",
"void",
"start",
"(",
"Geometry",
"geometry",
")",
"{",
"this",
".",
"geometry",
"=",
"geometry",
";",
"splitLine",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"LINE_STRING",
",",
"0",
",",
"0",
")",
";",
"service",
".",
"start",
"(",
"splitLine",
")",
";",
"service",
".",
"setEditingState",
"(",
"GeometryEditState",
".",
"INSERTING",
")",
";",
"service",
".",
"setInsertIndex",
"(",
"service",
".",
"getIndexService",
"(",
")",
".",
"create",
"(",
"GeometryIndexType",
".",
"TYPE_VERTEX",
",",
"0",
")",
")",
";",
"started",
"=",
"true",
";",
"eventBus",
".",
"fireEvent",
"(",
"new",
"GeometrySplitStartEvent",
"(",
"geometry",
")",
")",
";",
"}"
] |
Start splitting the given geometry.
@param geometry
to be split
|
[
"Start",
"splitting",
"the",
"given",
"geometry",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/editing/server-extension/src/main/java/org/geomajas/plugin/editing/client/split/GeometrySplitService.java#L112-L122
|
145,914
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/models/CPath.java
|
CPath.check
|
private void check( String pathName )
{
for ( char c : pathName.toCharArray() ) {
if ( c < 32 || FORBIDDEN_CHAR == c ) {
throw new IllegalArgumentException( "Pathname contains invalid char " + c + " : " + pathName );
}
}
// Check each component :
for ( String comp : pathName.split( "/" ) ) {
if ( !comp.trim().equals( comp ) ) {
throw new IllegalArgumentException( "Pathname contains leading or trailing spaces : " + pathName );
}
}
}
|
java
|
private void check( String pathName )
{
for ( char c : pathName.toCharArray() ) {
if ( c < 32 || FORBIDDEN_CHAR == c ) {
throw new IllegalArgumentException( "Pathname contains invalid char " + c + " : " + pathName );
}
}
// Check each component :
for ( String comp : pathName.split( "/" ) ) {
if ( !comp.trim().equals( comp ) ) {
throw new IllegalArgumentException( "Pathname contains leading or trailing spaces : " + pathName );
}
}
}
|
[
"private",
"void",
"check",
"(",
"String",
"pathName",
")",
"{",
"for",
"(",
"char",
"c",
":",
"pathName",
".",
"toCharArray",
"(",
")",
")",
"{",
"if",
"(",
"c",
"<",
"32",
"||",
"FORBIDDEN_CHAR",
"==",
"c",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Pathname contains invalid char \"",
"+",
"c",
"+",
"\" : \"",
"+",
"pathName",
")",
";",
"}",
"}",
"// Check each component :",
"for",
"(",
"String",
"comp",
":",
"pathName",
".",
"split",
"(",
"\"/\"",
")",
")",
"{",
"if",
"(",
"!",
"comp",
".",
"trim",
"(",
")",
".",
"equals",
"(",
"comp",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Pathname contains leading or trailing spaces : \"",
"+",
"pathName",
")",
";",
"}",
"}",
"}"
] |
Check pathname is valid
@param pathName
|
[
"Check",
"pathname",
"is",
"valid"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/models/CPath.java#L72-L85
|
145,915
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseFourApplication.java
|
PhaseFourApplication.processOutputDirectory
|
private void processOutputDirectory() {
// Phase IV may have to use the proto network output of phase II if
// phase III is skipped.
final String outputPath = outputDirectory.getAbsolutePath();
final String[] args = getCommandLineArguments();
final PhaseThreeApplication p3App = new PhaseThreeApplication(args);
String folder;
// if phase III was skipped or no orthology documents were merged
if (p3App.isSkipped()) {
folder = PhaseTwoApplication.DIR_ARTIFACT;
} else {
folder = PhaseThreeApplication.DIR_ARTIFACT;
}
final File pnPath = new File(asPath(outputPath, folder));
// Fail if path is not a directory
if (!pnPath.isDirectory()) {
error(NOT_A_DIRECTORY + ": " + pnPath);
failUsage();
}
final File[] files = pnPath.listFiles(new GlobalProtonetworkFilter());
if (files.length == 0 || files.length > 1) {
bail(ExitCode.NO_GLOBAL_PROTO_NETWORK);
}
processFiles(files[0]);
}
|
java
|
private void processOutputDirectory() {
// Phase IV may have to use the proto network output of phase II if
// phase III is skipped.
final String outputPath = outputDirectory.getAbsolutePath();
final String[] args = getCommandLineArguments();
final PhaseThreeApplication p3App = new PhaseThreeApplication(args);
String folder;
// if phase III was skipped or no orthology documents were merged
if (p3App.isSkipped()) {
folder = PhaseTwoApplication.DIR_ARTIFACT;
} else {
folder = PhaseThreeApplication.DIR_ARTIFACT;
}
final File pnPath = new File(asPath(outputPath, folder));
// Fail if path is not a directory
if (!pnPath.isDirectory()) {
error(NOT_A_DIRECTORY + ": " + pnPath);
failUsage();
}
final File[] files = pnPath.listFiles(new GlobalProtonetworkFilter());
if (files.length == 0 || files.length > 1) {
bail(ExitCode.NO_GLOBAL_PROTO_NETWORK);
}
processFiles(files[0]);
}
|
[
"private",
"void",
"processOutputDirectory",
"(",
")",
"{",
"// Phase IV may have to use the proto network output of phase II if",
"// phase III is skipped.",
"final",
"String",
"outputPath",
"=",
"outputDirectory",
".",
"getAbsolutePath",
"(",
")",
";",
"final",
"String",
"[",
"]",
"args",
"=",
"getCommandLineArguments",
"(",
")",
";",
"final",
"PhaseThreeApplication",
"p3App",
"=",
"new",
"PhaseThreeApplication",
"(",
"args",
")",
";",
"String",
"folder",
";",
"// if phase III was skipped or no orthology documents were merged",
"if",
"(",
"p3App",
".",
"isSkipped",
"(",
")",
")",
"{",
"folder",
"=",
"PhaseTwoApplication",
".",
"DIR_ARTIFACT",
";",
"}",
"else",
"{",
"folder",
"=",
"PhaseThreeApplication",
".",
"DIR_ARTIFACT",
";",
"}",
"final",
"File",
"pnPath",
"=",
"new",
"File",
"(",
"asPath",
"(",
"outputPath",
",",
"folder",
")",
")",
";",
"// Fail if path is not a directory",
"if",
"(",
"!",
"pnPath",
".",
"isDirectory",
"(",
")",
")",
"{",
"error",
"(",
"NOT_A_DIRECTORY",
"+",
"\": \"",
"+",
"pnPath",
")",
";",
"failUsage",
"(",
")",
";",
"}",
"final",
"File",
"[",
"]",
"files",
"=",
"pnPath",
".",
"listFiles",
"(",
"new",
"GlobalProtonetworkFilter",
"(",
")",
")",
";",
"if",
"(",
"files",
".",
"length",
"==",
"0",
"||",
"files",
".",
"length",
">",
"1",
")",
"{",
"bail",
"(",
"ExitCode",
".",
"NO_GLOBAL_PROTO_NETWORK",
")",
";",
"}",
"processFiles",
"(",
"files",
"[",
"0",
"]",
")",
";",
"}"
] |
Process output directory.
|
[
"Process",
"output",
"directory",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseFourApplication.java#L110-L142
|
145,916
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseFourApplication.java
|
PhaseFourApplication.processFiles
|
private void processFiles(File protoNetwork) {
// final StringBuilder bldr = new StringBuilder();
// bldr.append("Executing ");
// bldr.append(getApplicationName());
// bldr.append(" of ");
// bldr.append(protoNetwork);
// phaseOutput(bldr.toString());
phaseOutput(format("=== %s ===", getApplicationName()));
ProtoNetworkDescriptor pnd = new BinaryProtoNetworkDescriptor(
protoNetwork);
BinaryProtoNetworkExternalizer bpne =
new BinaryProtoNetworkExternalizer();
ProtoNetwork gpn = null;
try {
gpn = bpne.readProtoNetwork(pnd);
} catch (ProtoNetworkError e) {
error("Unable to read merged network.");
exit(ExitCode.NO_GLOBAL_PROTO_NETWORK);
}
stage1(gpn);
}
|
java
|
private void processFiles(File protoNetwork) {
// final StringBuilder bldr = new StringBuilder();
// bldr.append("Executing ");
// bldr.append(getApplicationName());
// bldr.append(" of ");
// bldr.append(protoNetwork);
// phaseOutput(bldr.toString());
phaseOutput(format("=== %s ===", getApplicationName()));
ProtoNetworkDescriptor pnd = new BinaryProtoNetworkDescriptor(
protoNetwork);
BinaryProtoNetworkExternalizer bpne =
new BinaryProtoNetworkExternalizer();
ProtoNetwork gpn = null;
try {
gpn = bpne.readProtoNetwork(pnd);
} catch (ProtoNetworkError e) {
error("Unable to read merged network.");
exit(ExitCode.NO_GLOBAL_PROTO_NETWORK);
}
stage1(gpn);
}
|
[
"private",
"void",
"processFiles",
"(",
"File",
"protoNetwork",
")",
"{",
"// final StringBuilder bldr = new StringBuilder();",
"// bldr.append(\"Executing \");",
"// bldr.append(getApplicationName());",
"// bldr.append(\" of \");",
"// bldr.append(protoNetwork);",
"// phaseOutput(bldr.toString());",
"phaseOutput",
"(",
"format",
"(",
"\"=== %s ===\"",
",",
"getApplicationName",
"(",
")",
")",
")",
";",
"ProtoNetworkDescriptor",
"pnd",
"=",
"new",
"BinaryProtoNetworkDescriptor",
"(",
"protoNetwork",
")",
";",
"BinaryProtoNetworkExternalizer",
"bpne",
"=",
"new",
"BinaryProtoNetworkExternalizer",
"(",
")",
";",
"ProtoNetwork",
"gpn",
"=",
"null",
";",
"try",
"{",
"gpn",
"=",
"bpne",
".",
"readProtoNetwork",
"(",
"pnd",
")",
";",
"}",
"catch",
"(",
"ProtoNetworkError",
"e",
")",
"{",
"error",
"(",
"\"Unable to read merged network.\"",
")",
";",
"exit",
"(",
"ExitCode",
".",
"NO_GLOBAL_PROTO_NETWORK",
")",
";",
"}",
"stage1",
"(",
"gpn",
")",
";",
"}"
] |
Starts phase four creation of KAM.
@param protoNetwork {@link File}, the proto network file
|
[
"Starts",
"phase",
"four",
"creation",
"of",
"KAM",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseFourApplication.java#L150-L174
|
145,917
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseFourApplication.java
|
PhaseFourApplication.stage1
|
private void stage1(ProtoNetwork gpn) {
beginStage(PHASE4_STAGE1_HDR, "1", numPhases);
final StringBuilder bldr = new StringBuilder();
final String kamURL = sysconfig.getKamURL();
final String kamUser = sysconfig.getKamUser();
final String kamPass = sysconfig.getKamPassword();
// stageOutput("Building KAM at - " + kamURL);
DBConnection dbc = null;
try {
dbc = p4.stage1ConnectKAMStore(kamURL, kamUser, kamPass);
} catch (DBConnectionFailure e) {
e.printStackTrace();
stageError(e.getUserFacingMessage());
exit(ExitCode.KAM_CONNECTION_FAILURE);
}
KamDbObject kamDb = new KamDbObject(null, kamName, kamDescription,
new Date(), null);
String kamSchemaName = null;
try {
kamSchemaName = p4.stage2SaveToKAMCatalog(kamDb);
} catch (KAMCatalogFailure e) {
e.printStackTrace();
stageError(e.getUserFacingMessage());
exit(ExitCode.KAM_CONNECTION_FAILURE);
}
try {
p4.stage3CreateKAMstore(dbc, kamSchemaName);
} catch (CreateKAMFailure e) {
e.printStackTrace();
stageError("Unable to build KAM store - " + e.getMessage());
exit(ExitCode.KAM_CONNECTION_FAILURE);
}
try {
p4.stage4LoadKAM(dbc, gpn, kamSchemaName);
} catch (DatabaseError e) {
stageError("Unable to load KAM.");
stageError(e.getUserFacingMessage());
exit(ExitCode.KAM_LOAD_FAILURE);
} catch (CreateKAMFailure e) {
stageError("Unable to build KAM store - " + e.getMessage());
exit(ExitCode.KAM_CONNECTION_FAILURE);
}
markEndStage(bldr);
}
|
java
|
private void stage1(ProtoNetwork gpn) {
beginStage(PHASE4_STAGE1_HDR, "1", numPhases);
final StringBuilder bldr = new StringBuilder();
final String kamURL = sysconfig.getKamURL();
final String kamUser = sysconfig.getKamUser();
final String kamPass = sysconfig.getKamPassword();
// stageOutput("Building KAM at - " + kamURL);
DBConnection dbc = null;
try {
dbc = p4.stage1ConnectKAMStore(kamURL, kamUser, kamPass);
} catch (DBConnectionFailure e) {
e.printStackTrace();
stageError(e.getUserFacingMessage());
exit(ExitCode.KAM_CONNECTION_FAILURE);
}
KamDbObject kamDb = new KamDbObject(null, kamName, kamDescription,
new Date(), null);
String kamSchemaName = null;
try {
kamSchemaName = p4.stage2SaveToKAMCatalog(kamDb);
} catch (KAMCatalogFailure e) {
e.printStackTrace();
stageError(e.getUserFacingMessage());
exit(ExitCode.KAM_CONNECTION_FAILURE);
}
try {
p4.stage3CreateKAMstore(dbc, kamSchemaName);
} catch (CreateKAMFailure e) {
e.printStackTrace();
stageError("Unable to build KAM store - " + e.getMessage());
exit(ExitCode.KAM_CONNECTION_FAILURE);
}
try {
p4.stage4LoadKAM(dbc, gpn, kamSchemaName);
} catch (DatabaseError e) {
stageError("Unable to load KAM.");
stageError(e.getUserFacingMessage());
exit(ExitCode.KAM_LOAD_FAILURE);
} catch (CreateKAMFailure e) {
stageError("Unable to build KAM store - " + e.getMessage());
exit(ExitCode.KAM_CONNECTION_FAILURE);
}
markEndStage(bldr);
}
|
[
"private",
"void",
"stage1",
"(",
"ProtoNetwork",
"gpn",
")",
"{",
"beginStage",
"(",
"PHASE4_STAGE1_HDR",
",",
"\"1\"",
",",
"numPhases",
")",
";",
"final",
"StringBuilder",
"bldr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"final",
"String",
"kamURL",
"=",
"sysconfig",
".",
"getKamURL",
"(",
")",
";",
"final",
"String",
"kamUser",
"=",
"sysconfig",
".",
"getKamUser",
"(",
")",
";",
"final",
"String",
"kamPass",
"=",
"sysconfig",
".",
"getKamPassword",
"(",
")",
";",
"// stageOutput(\"Building KAM at - \" + kamURL);",
"DBConnection",
"dbc",
"=",
"null",
";",
"try",
"{",
"dbc",
"=",
"p4",
".",
"stage1ConnectKAMStore",
"(",
"kamURL",
",",
"kamUser",
",",
"kamPass",
")",
";",
"}",
"catch",
"(",
"DBConnectionFailure",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"stageError",
"(",
"e",
".",
"getUserFacingMessage",
"(",
")",
")",
";",
"exit",
"(",
"ExitCode",
".",
"KAM_CONNECTION_FAILURE",
")",
";",
"}",
"KamDbObject",
"kamDb",
"=",
"new",
"KamDbObject",
"(",
"null",
",",
"kamName",
",",
"kamDescription",
",",
"new",
"Date",
"(",
")",
",",
"null",
")",
";",
"String",
"kamSchemaName",
"=",
"null",
";",
"try",
"{",
"kamSchemaName",
"=",
"p4",
".",
"stage2SaveToKAMCatalog",
"(",
"kamDb",
")",
";",
"}",
"catch",
"(",
"KAMCatalogFailure",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"stageError",
"(",
"e",
".",
"getUserFacingMessage",
"(",
")",
")",
";",
"exit",
"(",
"ExitCode",
".",
"KAM_CONNECTION_FAILURE",
")",
";",
"}",
"try",
"{",
"p4",
".",
"stage3CreateKAMstore",
"(",
"dbc",
",",
"kamSchemaName",
")",
";",
"}",
"catch",
"(",
"CreateKAMFailure",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"stageError",
"(",
"\"Unable to build KAM store - \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"exit",
"(",
"ExitCode",
".",
"KAM_CONNECTION_FAILURE",
")",
";",
"}",
"try",
"{",
"p4",
".",
"stage4LoadKAM",
"(",
"dbc",
",",
"gpn",
",",
"kamSchemaName",
")",
";",
"}",
"catch",
"(",
"DatabaseError",
"e",
")",
"{",
"stageError",
"(",
"\"Unable to load KAM.\"",
")",
";",
"stageError",
"(",
"e",
".",
"getUserFacingMessage",
"(",
")",
")",
";",
"exit",
"(",
"ExitCode",
".",
"KAM_LOAD_FAILURE",
")",
";",
"}",
"catch",
"(",
"CreateKAMFailure",
"e",
")",
"{",
"stageError",
"(",
"\"Unable to build KAM store - \"",
"+",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"exit",
"(",
"ExitCode",
".",
"KAM_CONNECTION_FAILURE",
")",
";",
"}",
"markEndStage",
"(",
"bldr",
")",
";",
"}"
] |
Stage one connection to KAM store.
@return {@link DBConnection}, the KAM DB connection
|
[
"Stage",
"one",
"connection",
"to",
"KAM",
"store",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/PhaseFourApplication.java#L181-L231
|
145,918
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/CookieExtensions.java
|
CookieExtensions.getCookie
|
public static Cookie getCookie(final String name)
{
return ((WebRequest)RequestCycle.get().getRequest()).getCookie(name);
}
|
java
|
public static Cookie getCookie(final String name)
{
return ((WebRequest)RequestCycle.get().getRequest()).getCookie(name);
}
|
[
"public",
"static",
"Cookie",
"getCookie",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"(",
"(",
"WebRequest",
")",
"RequestCycle",
".",
"get",
"(",
")",
".",
"getRequest",
"(",
")",
")",
".",
"getCookie",
"(",
"name",
")",
";",
"}"
] |
Gets the cookie form the given name.
@param name
the name
@return the cookie
|
[
"Gets",
"the",
"cookie",
"form",
"the",
"given",
"name",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/CookieExtensions.java#L59-L62
|
145,919
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/CookieExtensions.java
|
CookieExtensions.newCookie
|
public static Cookie newCookie(final String name, final String value, final String purpose,
final String domain, final int maxAge, final String path, final boolean secure)
{
final Cookie cookie = new Cookie(name, value);
cookie.setComment(purpose);
cookie.setDomain(domain);
cookie.setMaxAge(maxAge);
cookie.setPath(path);
return cookie;
}
|
java
|
public static Cookie newCookie(final String name, final String value, final String purpose,
final String domain, final int maxAge, final String path, final boolean secure)
{
final Cookie cookie = new Cookie(name, value);
cookie.setComment(purpose);
cookie.setDomain(domain);
cookie.setMaxAge(maxAge);
cookie.setPath(path);
return cookie;
}
|
[
"public",
"static",
"Cookie",
"newCookie",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
",",
"final",
"String",
"purpose",
",",
"final",
"String",
"domain",
",",
"final",
"int",
"maxAge",
",",
"final",
"String",
"path",
",",
"final",
"boolean",
"secure",
")",
"{",
"final",
"Cookie",
"cookie",
"=",
"new",
"Cookie",
"(",
"name",
",",
"value",
")",
";",
"cookie",
".",
"setComment",
"(",
"purpose",
")",
";",
"cookie",
".",
"setDomain",
"(",
"domain",
")",
";",
"cookie",
".",
"setMaxAge",
"(",
"maxAge",
")",
";",
"cookie",
".",
"setPath",
"(",
"path",
")",
";",
"return",
"cookie",
";",
"}"
] |
Creates a new cookie.
@param name
the name
@param value
the value
@param purpose
the purpose
@param domain
the domain
@param maxAge
the max age
@param path
the path
@param secure
the secure
@return the cookie
|
[
"Creates",
"a",
"new",
"cookie",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/CookieExtensions.java#L83-L93
|
145,920
|
ops4j/org.ops4j.pax.exam1
|
ops4j-quickbuild-core/src/main/java/org/ops4j/pax/exam/quickbuild/internal/DefaultSnapshotBuilder.java
|
DefaultSnapshotBuilder.newSnapshotElement
|
private SnapshotElement newSnapshotElement( String name, Handle handle, QType type )
throws IOException
{
return new DefaultSnapshotElement( name, m_store.getLocation( handle ), type, handle.getIdentification() );
}
|
java
|
private SnapshotElement newSnapshotElement( String name, Handle handle, QType type )
throws IOException
{
return new DefaultSnapshotElement( name, m_store.getLocation( handle ), type, handle.getIdentification() );
}
|
[
"private",
"SnapshotElement",
"newSnapshotElement",
"(",
"String",
"name",
",",
"Handle",
"handle",
",",
"QType",
"type",
")",
"throws",
"IOException",
"{",
"return",
"new",
"DefaultSnapshotElement",
"(",
"name",
",",
"m_store",
".",
"getLocation",
"(",
"handle",
")",
",",
"type",
",",
"handle",
".",
"getIdentification",
"(",
")",
")",
";",
"}"
] |
Create a new SnapshotElement instance of name, handle and type.
Helper method.
@param name name identifier of a snapshot entry
@param handle store handle
@param type the type
@return new instance of type {@link SnapshotElement}
@throws IOException in case something goes wrong when dealing with you supplied handle
|
[
"Create",
"a",
"new",
"SnapshotElement",
"instance",
"of",
"name",
"handle",
"and",
"type",
".",
"Helper",
"method",
"."
] |
7c8742208117ff91bd24bcd3a185d2d019f7000f
|
https://github.com/ops4j/org.ops4j.pax.exam1/blob/7c8742208117ff91bd24bcd3a185d2d019f7000f/ops4j-quickbuild-core/src/main/java/org/ops4j/pax/exam/quickbuild/internal/DefaultSnapshotBuilder.java#L97-L101
|
145,921
|
astrapi69/jaulp-wicket
|
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/captcha/draw/CaptchaPanel.java
|
CaptchaPanel.newRequiredTextField
|
protected RequiredTextField<String> newRequiredTextField(final String id,
final IModel<CaptchaModelBean> model)
{
// Create an TextField for the input...
final RequiredTextField<String> captchaInput = new RequiredTextField<String>("captchaInput",
new PropertyModel<>(model, "captchaInput"))
{
/**
* The serialVersionUID.
*/
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected final void onComponentTag(final ComponentTag tag)
{
super.onComponentTag(tag);
// clear the field after each render
tag.put("value", "");
}
};
captchaInput.setType(String.class);
return captchaInput;
}
|
java
|
protected RequiredTextField<String> newRequiredTextField(final String id,
final IModel<CaptchaModelBean> model)
{
// Create an TextField for the input...
final RequiredTextField<String> captchaInput = new RequiredTextField<String>("captchaInput",
new PropertyModel<>(model, "captchaInput"))
{
/**
* The serialVersionUID.
*/
private static final long serialVersionUID = 1L;
/**
* {@inheritDoc}
*/
@Override
protected final void onComponentTag(final ComponentTag tag)
{
super.onComponentTag(tag);
// clear the field after each render
tag.put("value", "");
}
};
captchaInput.setType(String.class);
return captchaInput;
}
|
[
"protected",
"RequiredTextField",
"<",
"String",
">",
"newRequiredTextField",
"(",
"final",
"String",
"id",
",",
"final",
"IModel",
"<",
"CaptchaModelBean",
">",
"model",
")",
"{",
"// Create an TextField for the input...",
"final",
"RequiredTextField",
"<",
"String",
">",
"captchaInput",
"=",
"new",
"RequiredTextField",
"<",
"String",
">",
"(",
"\"captchaInput\"",
",",
"new",
"PropertyModel",
"<>",
"(",
"model",
",",
"\"captchaInput\"",
")",
")",
"{",
"/**\n\t\t\t * The serialVersionUID.\n\t\t\t */",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"/**\n\t\t\t * {@inheritDoc}\n\t\t\t */",
"@",
"Override",
"protected",
"final",
"void",
"onComponentTag",
"(",
"final",
"ComponentTag",
"tag",
")",
"{",
"super",
".",
"onComponentTag",
"(",
"tag",
")",
";",
"// clear the field after each render",
"tag",
".",
"put",
"(",
"\"value\"",
",",
"\"\"",
")",
";",
"}",
"}",
";",
"captchaInput",
".",
"setType",
"(",
"String",
".",
"class",
")",
";",
"return",
"captchaInput",
";",
"}"
] |
Factory method for creating a new RequiredTextField. This method is invoked in the
constructor from the derived classes and can be overridden so users can provide their own
version of a RequiredTextField.
@param id
the id
@param model
the captchaModelBean
@return the new RequiredTextField
|
[
"Factory",
"method",
"for",
"creating",
"a",
"new",
"RequiredTextField",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"constructor",
"from",
"the",
"derived",
"classes",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"RequiredTextField",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/captcha/draw/CaptchaPanel.java#L108-L134
|
145,922
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/eval/SequenceLabelerEvaluate.java
|
SequenceLabelerEvaluate.detailEvaluate
|
public final void detailEvaluate() throws IOException {
final List<EvaluationMonitor<SequenceLabelSample>> listeners = new LinkedList<EvaluationMonitor<SequenceLabelSample>>();
final SequenceLabelerDetailedFMeasureListener detailedFListener = new SequenceLabelerDetailedFMeasureListener();
listeners.add(detailedFListener);
final SequenceLabelerEvaluator evaluator = new SequenceLabelerEvaluator(this.corpusFormat,
this.sequenceLabeler, listeners
.toArray(new SequenceLabelerEvaluationMonitor[listeners.size()]));
evaluator.evaluate(this.testSamples);
System.out.println(detailedFListener.toString());
}
|
java
|
public final void detailEvaluate() throws IOException {
final List<EvaluationMonitor<SequenceLabelSample>> listeners = new LinkedList<EvaluationMonitor<SequenceLabelSample>>();
final SequenceLabelerDetailedFMeasureListener detailedFListener = new SequenceLabelerDetailedFMeasureListener();
listeners.add(detailedFListener);
final SequenceLabelerEvaluator evaluator = new SequenceLabelerEvaluator(this.corpusFormat,
this.sequenceLabeler, listeners
.toArray(new SequenceLabelerEvaluationMonitor[listeners.size()]));
evaluator.evaluate(this.testSamples);
System.out.println(detailedFListener.toString());
}
|
[
"public",
"final",
"void",
"detailEvaluate",
"(",
")",
"throws",
"IOException",
"{",
"final",
"List",
"<",
"EvaluationMonitor",
"<",
"SequenceLabelSample",
">",
">",
"listeners",
"=",
"new",
"LinkedList",
"<",
"EvaluationMonitor",
"<",
"SequenceLabelSample",
">",
">",
"(",
")",
";",
"final",
"SequenceLabelerDetailedFMeasureListener",
"detailedFListener",
"=",
"new",
"SequenceLabelerDetailedFMeasureListener",
"(",
")",
";",
"listeners",
".",
"add",
"(",
"detailedFListener",
")",
";",
"final",
"SequenceLabelerEvaluator",
"evaluator",
"=",
"new",
"SequenceLabelerEvaluator",
"(",
"this",
".",
"corpusFormat",
",",
"this",
".",
"sequenceLabeler",
",",
"listeners",
".",
"toArray",
"(",
"new",
"SequenceLabelerEvaluationMonitor",
"[",
"listeners",
".",
"size",
"(",
")",
"]",
")",
")",
";",
"evaluator",
".",
"evaluate",
"(",
"this",
".",
"testSamples",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"detailedFListener",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Evaluate and print the precision, recall and F measure per sequence class.
@throws IOException
if test corpus not loaded
|
[
"Evaluate",
"and",
"print",
"the",
"precision",
"recall",
"and",
"F",
"measure",
"per",
"sequence",
"class",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/eval/SequenceLabelerEvaluate.java#L146-L155
|
145,923
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java
|
Document.getAllAnnotations
|
public List<Annotation> getAllAnnotations() {
List<Annotation> ret = new ArrayList<Annotation>();
for (StatementGroup sg : statementGroups) {
ret.addAll(sg.getAllAnnotations());
}
return ret;
}
|
java
|
public List<Annotation> getAllAnnotations() {
List<Annotation> ret = new ArrayList<Annotation>();
for (StatementGroup sg : statementGroups) {
ret.addAll(sg.getAllAnnotations());
}
return ret;
}
|
[
"public",
"List",
"<",
"Annotation",
">",
"getAllAnnotations",
"(",
")",
"{",
"List",
"<",
"Annotation",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"Annotation",
">",
"(",
")",
";",
"for",
"(",
"StatementGroup",
"sg",
":",
"statementGroups",
")",
"{",
"ret",
".",
"addAll",
"(",
"sg",
".",
"getAllAnnotations",
"(",
")",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Returns all annotations contained within the document.
@return List of annotations, which may be empty
|
[
"Returns",
"all",
"annotations",
"contained",
"within",
"the",
"document",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java#L169-L175
|
145,924
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java
|
Document.getAllNamespaces
|
public Set<Namespace> getAllNamespaces() {
if (namespaceGroup == null) {
return emptySet();
}
return new HashSet<Namespace>(namespaceGroup.getAllNamespaces());
}
|
java
|
public Set<Namespace> getAllNamespaces() {
if (namespaceGroup == null) {
return emptySet();
}
return new HashSet<Namespace>(namespaceGroup.getAllNamespaces());
}
|
[
"public",
"Set",
"<",
"Namespace",
">",
"getAllNamespaces",
"(",
")",
"{",
"if",
"(",
"namespaceGroup",
"==",
"null",
")",
"{",
"return",
"emptySet",
"(",
")",
";",
"}",
"return",
"new",
"HashSet",
"<",
"Namespace",
">",
"(",
"namespaceGroup",
".",
"getAllNamespaces",
"(",
")",
")",
";",
"}"
] |
Returns the set of all namespaces contained within the document.
@return Set of namespaces, which may be empty
|
[
"Returns",
"the",
"set",
"of",
"all",
"namespaces",
"contained",
"within",
"the",
"document",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java#L182-L187
|
145,925
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java
|
Document.getAllTerms
|
public Set<Term> getAllTerms() {
final Set<Term> ret = new HashSet<Term>();
for (final StatementGroup sg : statementGroups) {
for (final Statement stmt : sg.getAllStatements()) {
ret.addAll(stmt.getAllTerms());
}
}
return ret;
}
|
java
|
public Set<Term> getAllTerms() {
final Set<Term> ret = new HashSet<Term>();
for (final StatementGroup sg : statementGroups) {
for (final Statement stmt : sg.getAllStatements()) {
ret.addAll(stmt.getAllTerms());
}
}
return ret;
}
|
[
"public",
"Set",
"<",
"Term",
">",
"getAllTerms",
"(",
")",
"{",
"final",
"Set",
"<",
"Term",
">",
"ret",
"=",
"new",
"HashSet",
"<",
"Term",
">",
"(",
")",
";",
"for",
"(",
"final",
"StatementGroup",
"sg",
":",
"statementGroups",
")",
"{",
"for",
"(",
"final",
"Statement",
"stmt",
":",
"sg",
".",
"getAllStatements",
"(",
")",
")",
"{",
"ret",
".",
"addAll",
"(",
"stmt",
".",
"getAllTerms",
"(",
")",
")",
";",
"}",
"}",
"return",
"ret",
";",
"}"
] |
Returns the set of all terms contained within the document.
@return Set of terms, which may be empty
|
[
"Returns",
"the",
"set",
"of",
"all",
"terms",
"contained",
"within",
"the",
"document",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java#L194-L202
|
145,926
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java
|
Document.getAllParameters
|
public Set<Parameter> getAllParameters() {
final Set<Parameter> ret = new HashSet<Parameter>();
for (final Term term : getAllTerms()) {
List<Parameter> params = term.getParameters();
if (params == null) {
continue;
}
ret.addAll(params);
}
return ret;
}
|
java
|
public Set<Parameter> getAllParameters() {
final Set<Parameter> ret = new HashSet<Parameter>();
for (final Term term : getAllTerms()) {
List<Parameter> params = term.getParameters();
if (params == null) {
continue;
}
ret.addAll(params);
}
return ret;
}
|
[
"public",
"Set",
"<",
"Parameter",
">",
"getAllParameters",
"(",
")",
"{",
"final",
"Set",
"<",
"Parameter",
">",
"ret",
"=",
"new",
"HashSet",
"<",
"Parameter",
">",
"(",
")",
";",
"for",
"(",
"final",
"Term",
"term",
":",
"getAllTerms",
"(",
")",
")",
"{",
"List",
"<",
"Parameter",
">",
"params",
"=",
"term",
".",
"getParameters",
"(",
")",
";",
"if",
"(",
"params",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"ret",
".",
"addAll",
"(",
"params",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Returns the set of all parameters contained within the document.
@return Set of parameters, which may be empty
|
[
"Returns",
"the",
"set",
"of",
"all",
"parameters",
"contained",
"within",
"the",
"document",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java#L209-L219
|
145,927
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java
|
Document.getAllStatementGroups
|
public List<StatementGroup> getAllStatementGroups() {
final List<StatementGroup> ret = new ArrayList<StatementGroup>();
ret.addAll(statementGroups);
for (final StatementGroup sg : statementGroups) {
ret.addAll(sg.getAllStatementGroups());
}
return ret;
}
|
java
|
public List<StatementGroup> getAllStatementGroups() {
final List<StatementGroup> ret = new ArrayList<StatementGroup>();
ret.addAll(statementGroups);
for (final StatementGroup sg : statementGroups) {
ret.addAll(sg.getAllStatementGroups());
}
return ret;
}
|
[
"public",
"List",
"<",
"StatementGroup",
">",
"getAllStatementGroups",
"(",
")",
"{",
"final",
"List",
"<",
"StatementGroup",
">",
"ret",
"=",
"new",
"ArrayList",
"<",
"StatementGroup",
">",
"(",
")",
";",
"ret",
".",
"addAll",
"(",
"statementGroups",
")",
";",
"for",
"(",
"final",
"StatementGroup",
"sg",
":",
"statementGroups",
")",
"{",
"ret",
".",
"addAll",
"(",
"sg",
".",
"getAllStatementGroups",
"(",
")",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Returns a list of all statement groups contained within the document.
@return List of statement groups
|
[
"Returns",
"a",
"list",
"of",
"all",
"statement",
"groups",
"contained",
"within",
"the",
"document",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java#L226-L233
|
145,928
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java
|
Document.getAllStatements
|
public List<Statement> getAllStatements() {
final List<Statement> ret = new LinkedList<Statement>();
for (final StatementGroup sg : statementGroups) {
ret.addAll(sg.getAllStatements());
}
return ret;
}
|
java
|
public List<Statement> getAllStatements() {
final List<Statement> ret = new LinkedList<Statement>();
for (final StatementGroup sg : statementGroups) {
ret.addAll(sg.getAllStatements());
}
return ret;
}
|
[
"public",
"List",
"<",
"Statement",
">",
"getAllStatements",
"(",
")",
"{",
"final",
"List",
"<",
"Statement",
">",
"ret",
"=",
"new",
"LinkedList",
"<",
"Statement",
">",
"(",
")",
";",
"for",
"(",
"final",
"StatementGroup",
"sg",
":",
"statementGroups",
")",
"{",
"ret",
".",
"addAll",
"(",
"sg",
".",
"getAllStatements",
"(",
")",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Returns a list of all statements contained within the document.
@return List of statements, which may be empty
|
[
"Returns",
"a",
"list",
"of",
"all",
"statements",
"contained",
"within",
"the",
"document",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java#L240-L246
|
145,929
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java
|
Document.getStatementCount
|
public int getStatementCount() {
int ret = 0;
for (final StatementGroup sg : statementGroups) {
ret += sg.getAllStatements().size();
}
return ret;
}
|
java
|
public int getStatementCount() {
int ret = 0;
for (final StatementGroup sg : statementGroups) {
ret += sg.getAllStatements().size();
}
return ret;
}
|
[
"public",
"int",
"getStatementCount",
"(",
")",
"{",
"int",
"ret",
"=",
"0",
";",
"for",
"(",
"final",
"StatementGroup",
"sg",
":",
"statementGroups",
")",
"{",
"ret",
"+=",
"sg",
".",
"getAllStatements",
"(",
")",
".",
"size",
"(",
")",
";",
"}",
"return",
"ret",
";",
"}"
] |
Returns the count of statements contained within the document.
@return int
|
[
"Returns",
"the",
"count",
"of",
"statements",
"contained",
"within",
"the",
"document",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java#L298-L304
|
145,930
|
OpenBEL/openbel-framework
|
org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java
|
Document.resolveReferences
|
public void resolveReferences() {
// Resolve annotations to their definitions
Map<String, AnnotationDefinition> defs = getDefinitionMap();
final List<Annotation> annos = new ArrayList<Annotation>();
// Get all the annotation used by the document's statement groups
for (final StatementGroup sg : statementGroups) {
annos.addAll(sg.getAllAnnotations());
}
// Resolve the references
for (final Annotation a : annos) {
AnnotationDefinition ad = a.getDefinition();
// Skip annotations without definitions
if (ad == null) {
continue;
}
final String id = ad.getId();
AnnotationDefinition documentDefinition = defs.get(id);
// BEL document annotations must reference valid definitions...
assert documentDefinition != null;
// ... so sanity check that for now.
// Resolve the reference to the instance
a.setDefinition(documentDefinition);
}
// Resolve parameters to their namespaces
Map<String, Namespace> nspcs = getNamespaceMap();
final List<Parameter> params = new ArrayList<Parameter>();
// Get all the parameters within the document
for (final StatementGroup sg : statementGroups) {
params.addAll(sg.getAllParameters());
}
// Get the default namespace if present
final Namespace defaultNS = nspcs.get(DEFAULT_NAMESPACE_PREFIX);
// Resolve the references
for (final Parameter av : params) {
Namespace ns = av.getNamespace();
// Skip parameters without namespaces
if (ns == null) {
if (defaultNS != null) {
av.setNamespace(defaultNS);
}
continue;
}
final String prefix = ns.getPrefix();
Namespace documentNamespace = nspcs.get(prefix);
// BEL document parameters must reference valid namespaces...
assert documentNamespace != null;
// ... so sanity check that for now.
// Resolve the reference to the instance
av.setNamespace(documentNamespace);
}
}
|
java
|
public void resolveReferences() {
// Resolve annotations to their definitions
Map<String, AnnotationDefinition> defs = getDefinitionMap();
final List<Annotation> annos = new ArrayList<Annotation>();
// Get all the annotation used by the document's statement groups
for (final StatementGroup sg : statementGroups) {
annos.addAll(sg.getAllAnnotations());
}
// Resolve the references
for (final Annotation a : annos) {
AnnotationDefinition ad = a.getDefinition();
// Skip annotations without definitions
if (ad == null) {
continue;
}
final String id = ad.getId();
AnnotationDefinition documentDefinition = defs.get(id);
// BEL document annotations must reference valid definitions...
assert documentDefinition != null;
// ... so sanity check that for now.
// Resolve the reference to the instance
a.setDefinition(documentDefinition);
}
// Resolve parameters to their namespaces
Map<String, Namespace> nspcs = getNamespaceMap();
final List<Parameter> params = new ArrayList<Parameter>();
// Get all the parameters within the document
for (final StatementGroup sg : statementGroups) {
params.addAll(sg.getAllParameters());
}
// Get the default namespace if present
final Namespace defaultNS = nspcs.get(DEFAULT_NAMESPACE_PREFIX);
// Resolve the references
for (final Parameter av : params) {
Namespace ns = av.getNamespace();
// Skip parameters without namespaces
if (ns == null) {
if (defaultNS != null) {
av.setNamespace(defaultNS);
}
continue;
}
final String prefix = ns.getPrefix();
Namespace documentNamespace = nspcs.get(prefix);
// BEL document parameters must reference valid namespaces...
assert documentNamespace != null;
// ... so sanity check that for now.
// Resolve the reference to the instance
av.setNamespace(documentNamespace);
}
}
|
[
"public",
"void",
"resolveReferences",
"(",
")",
"{",
"// Resolve annotations to their definitions",
"Map",
"<",
"String",
",",
"AnnotationDefinition",
">",
"defs",
"=",
"getDefinitionMap",
"(",
")",
";",
"final",
"List",
"<",
"Annotation",
">",
"annos",
"=",
"new",
"ArrayList",
"<",
"Annotation",
">",
"(",
")",
";",
"// Get all the annotation used by the document's statement groups",
"for",
"(",
"final",
"StatementGroup",
"sg",
":",
"statementGroups",
")",
"{",
"annos",
".",
"addAll",
"(",
"sg",
".",
"getAllAnnotations",
"(",
")",
")",
";",
"}",
"// Resolve the references",
"for",
"(",
"final",
"Annotation",
"a",
":",
"annos",
")",
"{",
"AnnotationDefinition",
"ad",
"=",
"a",
".",
"getDefinition",
"(",
")",
";",
"// Skip annotations without definitions",
"if",
"(",
"ad",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"final",
"String",
"id",
"=",
"ad",
".",
"getId",
"(",
")",
";",
"AnnotationDefinition",
"documentDefinition",
"=",
"defs",
".",
"get",
"(",
"id",
")",
";",
"// BEL document annotations must reference valid definitions...",
"assert",
"documentDefinition",
"!=",
"null",
";",
"// ... so sanity check that for now.",
"// Resolve the reference to the instance",
"a",
".",
"setDefinition",
"(",
"documentDefinition",
")",
";",
"}",
"// Resolve parameters to their namespaces",
"Map",
"<",
"String",
",",
"Namespace",
">",
"nspcs",
"=",
"getNamespaceMap",
"(",
")",
";",
"final",
"List",
"<",
"Parameter",
">",
"params",
"=",
"new",
"ArrayList",
"<",
"Parameter",
">",
"(",
")",
";",
"// Get all the parameters within the document",
"for",
"(",
"final",
"StatementGroup",
"sg",
":",
"statementGroups",
")",
"{",
"params",
".",
"addAll",
"(",
"sg",
".",
"getAllParameters",
"(",
")",
")",
";",
"}",
"// Get the default namespace if present",
"final",
"Namespace",
"defaultNS",
"=",
"nspcs",
".",
"get",
"(",
"DEFAULT_NAMESPACE_PREFIX",
")",
";",
"// Resolve the references",
"for",
"(",
"final",
"Parameter",
"av",
":",
"params",
")",
"{",
"Namespace",
"ns",
"=",
"av",
".",
"getNamespace",
"(",
")",
";",
"// Skip parameters without namespaces",
"if",
"(",
"ns",
"==",
"null",
")",
"{",
"if",
"(",
"defaultNS",
"!=",
"null",
")",
"{",
"av",
".",
"setNamespace",
"(",
"defaultNS",
")",
";",
"}",
"continue",
";",
"}",
"final",
"String",
"prefix",
"=",
"ns",
".",
"getPrefix",
"(",
")",
";",
"Namespace",
"documentNamespace",
"=",
"nspcs",
".",
"get",
"(",
"prefix",
")",
";",
"// BEL document parameters must reference valid namespaces...",
"assert",
"documentNamespace",
"!=",
"null",
";",
"// ... so sanity check that for now.",
"// Resolve the reference to the instance",
"av",
".",
"setNamespace",
"(",
"documentNamespace",
")",
";",
"}",
"}"
] |
Resolves any property references in use within the document to their
corresponding instances.
|
[
"Resolves",
"any",
"property",
"references",
"in",
"use",
"within",
"the",
"document",
"to",
"their",
"corresponding",
"instances",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/model/Document.java#L389-L452
|
145,931
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/GenericBasePage.java
|
GenericBasePage.newDescription
|
protected IModel<String> newDescription()
{
return ResourceModelFactory.newResourceModel(
ResourceBundleKey.builder().key("page.meta.description").defaultValue("").build(),
this);
}
|
java
|
protected IModel<String> newDescription()
{
return ResourceModelFactory.newResourceModel(
ResourceBundleKey.builder().key("page.meta.description").defaultValue("").build(),
this);
}
|
[
"protected",
"IModel",
"<",
"String",
">",
"newDescription",
"(",
")",
"{",
"return",
"ResourceModelFactory",
".",
"newResourceModel",
"(",
"ResourceBundleKey",
".",
"builder",
"(",
")",
".",
"key",
"(",
"\"page.meta.description\"",
")",
".",
"defaultValue",
"(",
"\"\"",
")",
".",
"build",
"(",
")",
",",
"this",
")",
";",
"}"
] |
Factory method that can be overwritten for new meta tag content for description.
@return the new <code>{@link IModel}</code> for the meta tag content for description.
|
[
"Factory",
"method",
"that",
"can",
"be",
"overwritten",
"for",
"new",
"meta",
"tag",
"content",
"for",
"description",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/GenericBasePage.java#L88-L93
|
145,932
|
alb-i986/selenium-tinafw
|
src/main/java/me/alb_i986/selenium/tinafw/tasks/WebTasks.java
|
WebTasks.sleepFor
|
public static WebTask sleepFor(int seconds) {
return new BaseWebTask() {
@Override
public WebPage run(WebPage initialPage) {
try {
Thread.sleep(seconds * 1000);
} catch (InterruptedException e) {
logger.warn("sleep interrupted");
}
return initialPage;
}
};
}
|
java
|
public static WebTask sleepFor(int seconds) {
return new BaseWebTask() {
@Override
public WebPage run(WebPage initialPage) {
try {
Thread.sleep(seconds * 1000);
} catch (InterruptedException e) {
logger.warn("sleep interrupted");
}
return initialPage;
}
};
}
|
[
"public",
"static",
"WebTask",
"sleepFor",
"(",
"int",
"seconds",
")",
"{",
"return",
"new",
"BaseWebTask",
"(",
")",
"{",
"@",
"Override",
"public",
"WebPage",
"run",
"(",
"WebPage",
"initialPage",
")",
"{",
"try",
"{",
"Thread",
".",
"sleep",
"(",
"seconds",
"*",
"1000",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"logger",
".",
"warn",
"(",
"\"sleep interrupted\"",
")",
";",
"}",
"return",
"initialPage",
";",
"}",
"}",
";",
"}"
] |
Task that sleeps for the given number of seconds,
and finally returns the very initial page.
|
[
"Task",
"that",
"sleeps",
"for",
"the",
"given",
"number",
"of",
"seconds",
"and",
"finally",
"returns",
"the",
"very",
"initial",
"page",
"."
] |
91c66720cda9f69751f96c58c0a0624b2222186e
|
https://github.com/alb-i986/selenium-tinafw/blob/91c66720cda9f69751f96c58c0a0624b2222186e/src/main/java/me/alb_i986/selenium/tinafw/tasks/WebTasks.java#L51-L64
|
145,933
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java
|
Dropbox.buildUrl
|
private String buildUrl( String methodPath, CPath path )
{
StringBuilder sb = new StringBuilder();
sb.append( END_POINT ).append( '/' ).append( methodPath );
if ( path != null ) {
sb.append( '/' ).append( scope ).append( path.getUrlEncoded() );
}
return sb.toString();
}
|
java
|
private String buildUrl( String methodPath, CPath path )
{
StringBuilder sb = new StringBuilder();
sb.append( END_POINT ).append( '/' ).append( methodPath );
if ( path != null ) {
sb.append( '/' ).append( scope ).append( path.getUrlEncoded() );
}
return sb.toString();
}
|
[
"private",
"String",
"buildUrl",
"(",
"String",
"methodPath",
",",
"CPath",
"path",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"END_POINT",
")",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"methodPath",
")",
";",
"if",
"(",
"path",
"!=",
"null",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
".",
"append",
"(",
"scope",
")",
".",
"append",
"(",
"path",
".",
"getUrlEncoded",
"(",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Url encodes object path, and concatenate to API endpoint and method to get full URL
@param methodPath API method path
@param path path
@return built url
|
[
"Url",
"encodes",
"object",
"path",
"and",
"concatenate",
"to",
"API",
"endpoint",
"and",
"method",
"to",
"get",
"full",
"URL"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java#L227-L238
|
145,934
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java
|
Dropbox.buildContentUrl
|
private String buildContentUrl( String methodPath, CPath path )
{
return CONTENT_END_POINT + '/' + methodPath + '/' + scope + path.getUrlEncoded();
}
|
java
|
private String buildContentUrl( String methodPath, CPath path )
{
return CONTENT_END_POINT + '/' + methodPath + '/' + scope + path.getUrlEncoded();
}
|
[
"private",
"String",
"buildContentUrl",
"(",
"String",
"methodPath",
",",
"CPath",
"path",
")",
"{",
"return",
"CONTENT_END_POINT",
"+",
"'",
"'",
"+",
"methodPath",
"+",
"'",
"'",
"+",
"scope",
"+",
"path",
".",
"getUrlEncoded",
"(",
")",
";",
"}"
] |
Url encodes blob path, and concatenate to content endpoint to get full URL
@param methodPath
@param path
@return URL
|
[
"Url",
"encodes",
"blob",
"path",
"and",
"concatenate",
"to",
"content",
"endpoint",
"to",
"get",
"full",
"URL"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java#L407-L410
|
145,935
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java
|
Dropbox.parseCFile
|
private CFile parseCFile( JSONObject jObj )
{
CFile cfile;
if ( jObj.optBoolean( "is_dir", false ) ) {
cfile = new CFolder( new CPath( jObj.getString( "path" ) ) );
} else {
cfile = new CBlob( new CPath( jObj.getString( "path" ) ), jObj.getLong( "bytes" ), jObj.getString( "mime_type" ) );
String stringDate = jObj.getString( "modified" );
try {
// stringDate looks like: "Fri, 07 Mar 2014 17:47:55 +0000"
SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z", Locale.US );
Date modified = sdf.parse( stringDate );
cfile.setModificationDate( modified );
} catch ( ParseException ex ) {
throw new CStorageException( "Can't parse date modified: " + stringDate + " (" + ex.getMessage() + ")", ex );
}
}
return cfile;
}
|
java
|
private CFile parseCFile( JSONObject jObj )
{
CFile cfile;
if ( jObj.optBoolean( "is_dir", false ) ) {
cfile = new CFolder( new CPath( jObj.getString( "path" ) ) );
} else {
cfile = new CBlob( new CPath( jObj.getString( "path" ) ), jObj.getLong( "bytes" ), jObj.getString( "mime_type" ) );
String stringDate = jObj.getString( "modified" );
try {
// stringDate looks like: "Fri, 07 Mar 2014 17:47:55 +0000"
SimpleDateFormat sdf = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss Z", Locale.US );
Date modified = sdf.parse( stringDate );
cfile.setModificationDate( modified );
} catch ( ParseException ex ) {
throw new CStorageException( "Can't parse date modified: " + stringDate + " (" + ex.getMessage() + ")", ex );
}
}
return cfile;
}
|
[
"private",
"CFile",
"parseCFile",
"(",
"JSONObject",
"jObj",
")",
"{",
"CFile",
"cfile",
";",
"if",
"(",
"jObj",
".",
"optBoolean",
"(",
"\"is_dir\"",
",",
"false",
")",
")",
"{",
"cfile",
"=",
"new",
"CFolder",
"(",
"new",
"CPath",
"(",
"jObj",
".",
"getString",
"(",
"\"path\"",
")",
")",
")",
";",
"}",
"else",
"{",
"cfile",
"=",
"new",
"CBlob",
"(",
"new",
"CPath",
"(",
"jObj",
".",
"getString",
"(",
"\"path\"",
")",
")",
",",
"jObj",
".",
"getLong",
"(",
"\"bytes\"",
")",
",",
"jObj",
".",
"getString",
"(",
"\"mime_type\"",
")",
")",
";",
"String",
"stringDate",
"=",
"jObj",
".",
"getString",
"(",
"\"modified\"",
")",
";",
"try",
"{",
"// stringDate looks like: \"Fri, 07 Mar 2014 17:47:55 +0000\"",
"SimpleDateFormat",
"sdf",
"=",
"new",
"SimpleDateFormat",
"(",
"\"EEE, dd MMM yyyy HH:mm:ss Z\"",
",",
"Locale",
".",
"US",
")",
";",
"Date",
"modified",
"=",
"sdf",
".",
"parse",
"(",
"stringDate",
")",
";",
"cfile",
".",
"setModificationDate",
"(",
"modified",
")",
";",
"}",
"catch",
"(",
"ParseException",
"ex",
")",
"{",
"throw",
"new",
"CStorageException",
"(",
"\"Can't parse date modified: \"",
"+",
"stringDate",
"+",
"\" (\"",
"+",
"ex",
".",
"getMessage",
"(",
")",
"+",
"\")\"",
",",
"ex",
")",
";",
"}",
"}",
"return",
"cfile",
";",
"}"
] |
Generates a CFile from its json representation
@param jObj JSON object representing a CFile
@return the CFile object corresponding to the JSON object
|
[
"Generates",
"a",
"CFile",
"from",
"its",
"json",
"representation"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/dropbox/Dropbox.java#L447-L470
|
145,936
|
OpenBEL/openbel-framework
|
org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/cache/CacheUtil.java
|
CacheUtil.resolveResource
|
public static File resolveResource(String resourceLocation,
String localPath,
String localFileName)
throws ResourceDownloadError {
if (nulls(resourceLocation, localPath, localFileName)) {
throw new InvalidArgument("null argument(s) provided");
}
createDirectories(localPath);
StringBuilder builder = new StringBuilder();
builder.append(localPath).append(File.separator).append(localFileName);
// resolve resource
File resourceFile = resolver.resolveResource(resourceLocation,
builder.toString());
return resourceFile;
}
|
java
|
public static File resolveResource(String resourceLocation,
String localPath,
String localFileName)
throws ResourceDownloadError {
if (nulls(resourceLocation, localPath, localFileName)) {
throw new InvalidArgument("null argument(s) provided");
}
createDirectories(localPath);
StringBuilder builder = new StringBuilder();
builder.append(localPath).append(File.separator).append(localFileName);
// resolve resource
File resourceFile = resolver.resolveResource(resourceLocation,
builder.toString());
return resourceFile;
}
|
[
"public",
"static",
"File",
"resolveResource",
"(",
"String",
"resourceLocation",
",",
"String",
"localPath",
",",
"String",
"localFileName",
")",
"throws",
"ResourceDownloadError",
"{",
"if",
"(",
"nulls",
"(",
"resourceLocation",
",",
"localPath",
",",
"localFileName",
")",
")",
"{",
"throw",
"new",
"InvalidArgument",
"(",
"\"null argument(s) provided\"",
")",
";",
"}",
"createDirectories",
"(",
"localPath",
")",
";",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"localPath",
")",
".",
"append",
"(",
"File",
".",
"separator",
")",
".",
"append",
"(",
"localFileName",
")",
";",
"// resolve resource",
"File",
"resourceFile",
"=",
"resolver",
".",
"resolveResource",
"(",
"resourceLocation",
",",
"builder",
".",
"toString",
"(",
")",
")",
";",
"return",
"resourceFile",
";",
"}"
] |
Resolves a resource location to a local path.
@param resourceLocation {@link String}, the resource location that
defines where to pull the file, which cannot be null
@param localPath {@link String}, the local path to store the resource
at, which cannot be null
@param localFileName {@link String}, the local file name to store the
resource as, which cannot be null
@return {@link File}, the resource resolved to a local file
@throws ResourceDownloadError Thrown if a resource download error
occurred while resolving the resource location
@throw {@link InvalidArgument} Thrown if any arguments are null
|
[
"Resolves",
"a",
"resource",
"location",
"to",
"a",
"local",
"path",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.core/src/main/java/org/openbel/framework/core/df/cache/CacheUtil.java#L108-L125
|
145,937
|
geomajas/geomajas-project-client-gwt2
|
plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/layer/OsmLayer.java
|
OsmLayer.addUrl
|
public void addUrl(String url) {
if (url != null && !url.isEmpty()) {
renderer.addUrl(url);
}
}
|
java
|
public void addUrl(String url) {
if (url != null && !url.isEmpty()) {
renderer.addUrl(url);
}
}
|
[
"public",
"void",
"addUrl",
"(",
"String",
"url",
")",
"{",
"if",
"(",
"url",
"!=",
"null",
"&&",
"!",
"url",
".",
"isEmpty",
"(",
")",
")",
"{",
"renderer",
".",
"addUrl",
"(",
"url",
")",
";",
"}",
"}"
] |
Add an URL to the tile service.
@param url The URL to the tile service.
|
[
"Add",
"an",
"URL",
"to",
"the",
"tile",
"service",
"."
] |
bd8d7904e861fa80522eed7b83c4ea99844180c7
|
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tilebasedlayer/impl/src/main/java/org/geomajas/gwt2/plugin/tilebasedlayer/client/layer/OsmLayer.java#L52-L56
|
145,938
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/request/mapper/HighScoreRequestMapper.java
|
HighScoreRequestMapper.initializeRequestMappers
|
private Collection<RequestMapperBean> initializeRequestMappers(final Request request)
{
final Set<RequestMapperBean> mapperBeans = new TreeSet<>(getComparator());
for (final IRequestMapper requestMapper : this.requestMappers)
{
mapperBeans.add(
new RequestMapperBean(requestMapper, requestMapper.getCompatibilityScore(request)));
}
return mapperBeans;
}
|
java
|
private Collection<RequestMapperBean> initializeRequestMappers(final Request request)
{
final Set<RequestMapperBean> mapperBeans = new TreeSet<>(getComparator());
for (final IRequestMapper requestMapper : this.requestMappers)
{
mapperBeans.add(
new RequestMapperBean(requestMapper, requestMapper.getCompatibilityScore(request)));
}
return mapperBeans;
}
|
[
"private",
"Collection",
"<",
"RequestMapperBean",
">",
"initializeRequestMappers",
"(",
"final",
"Request",
"request",
")",
"{",
"final",
"Set",
"<",
"RequestMapperBean",
">",
"mapperBeans",
"=",
"new",
"TreeSet",
"<>",
"(",
"getComparator",
"(",
")",
")",
";",
"for",
"(",
"final",
"IRequestMapper",
"requestMapper",
":",
"this",
".",
"requestMappers",
")",
"{",
"mapperBeans",
".",
"add",
"(",
"new",
"RequestMapperBean",
"(",
"requestMapper",
",",
"requestMapper",
".",
"getCompatibilityScore",
"(",
"request",
")",
")",
")",
";",
"}",
"return",
"mapperBeans",
";",
"}"
] |
Initialize request mappers.
@param request
the request
@return the collection
|
[
"Initialize",
"request",
"mappers",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/request/mapper/HighScoreRequestMapper.java#L116-L125
|
145,939
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/request/mapper/HighScoreRequestMapper.java
|
HighScoreRequestMapper.newComparator
|
protected Comparator<RequestMapperBean> newComparator()
{
return new Comparator<RequestMapperBean>()
{
@Override
public int compare(final RequestMapperBean o1, final RequestMapperBean o2)
{
return o1.getCompatibilityScore() - o2.getCompatibilityScore();
}
};
}
|
java
|
protected Comparator<RequestMapperBean> newComparator()
{
return new Comparator<RequestMapperBean>()
{
@Override
public int compare(final RequestMapperBean o1, final RequestMapperBean o2)
{
return o1.getCompatibilityScore() - o2.getCompatibilityScore();
}
};
}
|
[
"protected",
"Comparator",
"<",
"RequestMapperBean",
">",
"newComparator",
"(",
")",
"{",
"return",
"new",
"Comparator",
"<",
"RequestMapperBean",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"final",
"RequestMapperBean",
"o1",
",",
"final",
"RequestMapperBean",
"o2",
")",
"{",
"return",
"o1",
".",
"getCompatibilityScore",
"(",
")",
"-",
"o2",
".",
"getCompatibilityScore",
"(",
")",
";",
"}",
"}",
";",
"}"
] |
Factory method for creating a new Comparator for sort the compatibility score. This method is
invoked in the method initializeRequestMappers and can be overridden so users can provide
their own version of a Comparator.
@return the new Comparator.
|
[
"Factory",
"method",
"for",
"creating",
"a",
"new",
"Comparator",
"for",
"sort",
"the",
"compatibility",
"score",
".",
"This",
"method",
"is",
"invoked",
"in",
"the",
"method",
"initializeRequestMappers",
"and",
"can",
"be",
"overridden",
"so",
"users",
"can",
"provide",
"their",
"own",
"version",
"of",
"a",
"Comparator",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/request/mapper/HighScoreRequestMapper.java#L168-L178
|
145,940
|
astrapi69/jaulp-wicket
|
jaulp-wicket-behaviors/src/main/java/de/alpharogroup/wicket/behaviors/models/MailtoBean.java
|
MailtoBean.buildMailtoContent
|
public String buildMailtoContent() {
StringBuilder sb = new StringBuilder();
sb.append(email);
if (StringUtils.isNotEmpty(subject)) {
sb.append("?").append("subject").append("=").append(subject);
}
if (StringUtils.isNotEmpty(body)) {
sb.append(StringUtils.isNotEmpty(subject) ? "&" : "?").append("body").append("=").append(body);
}
return sb.toString().trim();
}
|
java
|
public String buildMailtoContent() {
StringBuilder sb = new StringBuilder();
sb.append(email);
if (StringUtils.isNotEmpty(subject)) {
sb.append("?").append("subject").append("=").append(subject);
}
if (StringUtils.isNotEmpty(body)) {
sb.append(StringUtils.isNotEmpty(subject) ? "&" : "?").append("body").append("=").append(body);
}
return sb.toString().trim();
}
|
[
"public",
"String",
"buildMailtoContent",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"email",
")",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"subject",
")",
")",
"{",
"sb",
".",
"append",
"(",
"\"?\"",
")",
".",
"append",
"(",
"\"subject\"",
")",
".",
"append",
"(",
"\"=\"",
")",
".",
"append",
"(",
"subject",
")",
";",
"}",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"body",
")",
")",
"{",
"sb",
".",
"append",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"subject",
")",
"?",
"\"&\"",
":",
"\"?\"",
")",
".",
"append",
"(",
"\"body\"",
")",
".",
"append",
"(",
"\"=\"",
")",
".",
"append",
"(",
"body",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
".",
"trim",
"(",
")",
";",
"}"
] |
Builds the mailto content.
@return the result of this bean as a {@link String} object.
|
[
"Builds",
"the",
"mailto",
"content",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-behaviors/src/main/java/de/alpharogroup/wicket/behaviors/models/MailtoBean.java#L60-L70
|
145,941
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java
|
Swift.headOrNull
|
private Headers headOrNull( CPath path )
{
try {
String url = getObjectUrl( path );
HttpHead request = new HttpHead( url );
RequestInvoker<CResponse> ri = getBasicRequestInvoker( request, path );
CResponse response = retryStrategy.invokeRetry( ri );
return response.getHeaders();
} catch ( CFileNotFoundException ex ) {
return null;
}
}
|
java
|
private Headers headOrNull( CPath path )
{
try {
String url = getObjectUrl( path );
HttpHead request = new HttpHead( url );
RequestInvoker<CResponse> ri = getBasicRequestInvoker( request, path );
CResponse response = retryStrategy.invokeRetry( ri );
return response.getHeaders();
} catch ( CFileNotFoundException ex ) {
return null;
}
}
|
[
"private",
"Headers",
"headOrNull",
"(",
"CPath",
"path",
")",
"{",
"try",
"{",
"String",
"url",
"=",
"getObjectUrl",
"(",
"path",
")",
";",
"HttpHead",
"request",
"=",
"new",
"HttpHead",
"(",
"url",
")",
";",
"RequestInvoker",
"<",
"CResponse",
">",
"ri",
"=",
"getBasicRequestInvoker",
"(",
"request",
",",
"path",
")",
";",
"CResponse",
"response",
"=",
"retryStrategy",
".",
"invokeRetry",
"(",
"ri",
")",
";",
"return",
"response",
".",
"getHeaders",
"(",
")",
";",
"}",
"catch",
"(",
"CFileNotFoundException",
"ex",
")",
"{",
"return",
"null",
";",
"}",
"}"
] |
Perform a quick HEAD request on the given object, to check existence and type.
|
[
"Perform",
"a",
"quick",
"HEAD",
"request",
"on",
"the",
"given",
"object",
"to",
"check",
"existence",
"and",
"type",
"."
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java#L137-L150
|
145,942
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java
|
Swift.rawCreateFolder
|
private void rawCreateFolder( CPath path )
throws CStorageException
{
CResponse response = null;
try {
String url = getObjectUrl( path );
HttpPut request = new HttpPut( url );
request.addHeader( "Content-Type", CONTENT_TYPE_DIRECTORY );
RequestInvoker<CResponse> ri = getApiRequestInvoker( request, path );
response = retryStrategy.invokeRetry( ri );
} finally {
PcsUtils.closeQuietly( response );
}
}
|
java
|
private void rawCreateFolder( CPath path )
throws CStorageException
{
CResponse response = null;
try {
String url = getObjectUrl( path );
HttpPut request = new HttpPut( url );
request.addHeader( "Content-Type", CONTENT_TYPE_DIRECTORY );
RequestInvoker<CResponse> ri = getApiRequestInvoker( request, path );
response = retryStrategy.invokeRetry( ri );
} finally {
PcsUtils.closeQuietly( response );
}
}
|
[
"private",
"void",
"rawCreateFolder",
"(",
"CPath",
"path",
")",
"throws",
"CStorageException",
"{",
"CResponse",
"response",
"=",
"null",
";",
"try",
"{",
"String",
"url",
"=",
"getObjectUrl",
"(",
"path",
")",
";",
"HttpPut",
"request",
"=",
"new",
"HttpPut",
"(",
"url",
")",
";",
"request",
".",
"addHeader",
"(",
"\"Content-Type\"",
",",
"CONTENT_TYPE_DIRECTORY",
")",
";",
"RequestInvoker",
"<",
"CResponse",
">",
"ri",
"=",
"getApiRequestInvoker",
"(",
"request",
",",
"path",
")",
";",
"response",
"=",
"retryStrategy",
".",
"invokeRetry",
"(",
"ri",
")",
";",
"}",
"finally",
"{",
"PcsUtils",
".",
"closeQuietly",
"(",
"response",
")",
";",
"}",
"}"
] |
Create a folder without creating any higher level intermediate folders.
@param path The folder path
|
[
"Create",
"a",
"folder",
"without",
"creating",
"any",
"higher",
"level",
"intermediate",
"folders",
"."
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java#L193-L208
|
145,943
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java
|
Swift.getFile
|
public CFile getFile( CPath path )
{
Headers headers = headOrNull( path );
if ( headers == null ) {
return null;
}
if ( !headers.contains( "Content-Type" ) ) {
LOGGER.warn( "{} object has no content type ?!", path );
return null;
}
CFile file;
if ( !CONTENT_TYPE_DIRECTORY.equals( headers.getHeaderValue( "Content-Type" ) ) ) {
file = new CBlob( path,
Long.parseLong( headers.getHeaderValue( "Content-Length" ) ),
headers.getHeaderValue( "Content-Type" ),
parseTimestamp( headers ),
parseMetaHeaders( headers ) );
} else {
file = new CFolder( path,
parseTimestamp( headers ),
parseMetaHeaders( headers ) );
}
return file;
}
|
java
|
public CFile getFile( CPath path )
{
Headers headers = headOrNull( path );
if ( headers == null ) {
return null;
}
if ( !headers.contains( "Content-Type" ) ) {
LOGGER.warn( "{} object has no content type ?!", path );
return null;
}
CFile file;
if ( !CONTENT_TYPE_DIRECTORY.equals( headers.getHeaderValue( "Content-Type" ) ) ) {
file = new CBlob( path,
Long.parseLong( headers.getHeaderValue( "Content-Length" ) ),
headers.getHeaderValue( "Content-Type" ),
parseTimestamp( headers ),
parseMetaHeaders( headers ) );
} else {
file = new CFolder( path,
parseTimestamp( headers ),
parseMetaHeaders( headers ) );
}
return file;
}
|
[
"public",
"CFile",
"getFile",
"(",
"CPath",
"path",
")",
"{",
"Headers",
"headers",
"=",
"headOrNull",
"(",
"path",
")",
";",
"if",
"(",
"headers",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"!",
"headers",
".",
"contains",
"(",
"\"Content-Type\"",
")",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"{} object has no content type ?!\"",
",",
"path",
")",
";",
"return",
"null",
";",
"}",
"CFile",
"file",
";",
"if",
"(",
"!",
"CONTENT_TYPE_DIRECTORY",
".",
"equals",
"(",
"headers",
".",
"getHeaderValue",
"(",
"\"Content-Type\"",
")",
")",
")",
"{",
"file",
"=",
"new",
"CBlob",
"(",
"path",
",",
"Long",
".",
"parseLong",
"(",
"headers",
".",
"getHeaderValue",
"(",
"\"Content-Length\"",
")",
")",
",",
"headers",
".",
"getHeaderValue",
"(",
"\"Content-Type\"",
")",
",",
"parseTimestamp",
"(",
"headers",
")",
",",
"parseMetaHeaders",
"(",
"headers",
")",
")",
";",
"}",
"else",
"{",
"file",
"=",
"new",
"CFolder",
"(",
"path",
",",
"parseTimestamp",
"(",
"headers",
")",
",",
"parseMetaHeaders",
"(",
"headers",
")",
")",
";",
"}",
"return",
"file",
";",
"}"
] |
Inquire details about object at given path.
@param path The file path
@return a CFolder, CBlob or None if no object exist at this path
|
[
"Inquire",
"details",
"about",
"object",
"at",
"given",
"path",
"."
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java#L259-L282
|
145,944
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java
|
Swift.listFolder
|
public CFolderContent listFolder( CPath path )
throws CStorageException
{
JSONArray array = listObjectsWithinFolder( path, "/" );
CFile file;
if ( array == null || array.length() == 0 ) {
// List is empty ; can be caused by a really empty folder,
// a non existing folder, or a blob
// Distinguish the different cases :
file = getFile( path );
if ( file == null ) { // Nothing at that path
return null;
}
if ( file.isBlob() ) { // It is a blob : error !
throw new CInvalidFileTypeException( path, false );
}
return new CFolderContent( Collections.EMPTY_MAP );
}
Map<CPath, CFile> ret = new HashMap<CPath, CFile>();
boolean detailed;
JSONObject obj;
for ( int i = 0; i < array.length(); i++ ) {
obj = array.getJSONObject( i );
if ( obj.has( "subdir" ) ) {
// indicates a non empty sub directory
// There are two cases here : provider uses directory-markers, or not.
// - if yes, another entry should exist in json with more detailed informations.
// - if not, this will be the only entry that indicates a sub folder,
// so we keep this file, but we'll memorize it only if it is not already present
// in returned value.
file = new CFolder( new CPath( obj.getString( "subdir" ) ) );
detailed = false;
} else {
detailed = true;
if ( !CONTENT_TYPE_DIRECTORY.equals( obj.getString( "content_type" ) ) ) {
file = new CBlob( new CPath( obj.getString( "name" ) ),
obj.getLong( "bytes" ),
obj.getString( "content_type" ),
parseLastModified( obj ),
null ); // we do not have this detailed information
} else {
file = new CFolder( new CPath( obj.getString( "name" ) ),
parseLastModified( obj ),
null ); // we do not have this detailed information
}
}
if ( detailed || !ret.containsKey( path ) ) {
// If we got a detailed file, we always store it
// If we got only rough description, we keep it only if no detailed info already exists
ret.put( file.getPath(), file );
}
}
return new CFolderContent( ret );
}
|
java
|
public CFolderContent listFolder( CPath path )
throws CStorageException
{
JSONArray array = listObjectsWithinFolder( path, "/" );
CFile file;
if ( array == null || array.length() == 0 ) {
// List is empty ; can be caused by a really empty folder,
// a non existing folder, or a blob
// Distinguish the different cases :
file = getFile( path );
if ( file == null ) { // Nothing at that path
return null;
}
if ( file.isBlob() ) { // It is a blob : error !
throw new CInvalidFileTypeException( path, false );
}
return new CFolderContent( Collections.EMPTY_MAP );
}
Map<CPath, CFile> ret = new HashMap<CPath, CFile>();
boolean detailed;
JSONObject obj;
for ( int i = 0; i < array.length(); i++ ) {
obj = array.getJSONObject( i );
if ( obj.has( "subdir" ) ) {
// indicates a non empty sub directory
// There are two cases here : provider uses directory-markers, or not.
// - if yes, another entry should exist in json with more detailed informations.
// - if not, this will be the only entry that indicates a sub folder,
// so we keep this file, but we'll memorize it only if it is not already present
// in returned value.
file = new CFolder( new CPath( obj.getString( "subdir" ) ) );
detailed = false;
} else {
detailed = true;
if ( !CONTENT_TYPE_DIRECTORY.equals( obj.getString( "content_type" ) ) ) {
file = new CBlob( new CPath( obj.getString( "name" ) ),
obj.getLong( "bytes" ),
obj.getString( "content_type" ),
parseLastModified( obj ),
null ); // we do not have this detailed information
} else {
file = new CFolder( new CPath( obj.getString( "name" ) ),
parseLastModified( obj ),
null ); // we do not have this detailed information
}
}
if ( detailed || !ret.containsKey( path ) ) {
// If we got a detailed file, we always store it
// If we got only rough description, we keep it only if no detailed info already exists
ret.put( file.getPath(), file );
}
}
return new CFolderContent( ret );
}
|
[
"public",
"CFolderContent",
"listFolder",
"(",
"CPath",
"path",
")",
"throws",
"CStorageException",
"{",
"JSONArray",
"array",
"=",
"listObjectsWithinFolder",
"(",
"path",
",",
"\"/\"",
")",
";",
"CFile",
"file",
";",
"if",
"(",
"array",
"==",
"null",
"||",
"array",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"// List is empty ; can be caused by a really empty folder,",
"// a non existing folder, or a blob",
"// Distinguish the different cases :",
"file",
"=",
"getFile",
"(",
"path",
")",
";",
"if",
"(",
"file",
"==",
"null",
")",
"{",
"// Nothing at that path",
"return",
"null",
";",
"}",
"if",
"(",
"file",
".",
"isBlob",
"(",
")",
")",
"{",
"// It is a blob : error !",
"throw",
"new",
"CInvalidFileTypeException",
"(",
"path",
",",
"false",
")",
";",
"}",
"return",
"new",
"CFolderContent",
"(",
"Collections",
".",
"EMPTY_MAP",
")",
";",
"}",
"Map",
"<",
"CPath",
",",
"CFile",
">",
"ret",
"=",
"new",
"HashMap",
"<",
"CPath",
",",
"CFile",
">",
"(",
")",
";",
"boolean",
"detailed",
";",
"JSONObject",
"obj",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"obj",
"=",
"array",
".",
"getJSONObject",
"(",
"i",
")",
";",
"if",
"(",
"obj",
".",
"has",
"(",
"\"subdir\"",
")",
")",
"{",
"// indicates a non empty sub directory",
"// There are two cases here : provider uses directory-markers, or not.",
"// - if yes, another entry should exist in json with more detailed informations.",
"// - if not, this will be the only entry that indicates a sub folder,",
"// so we keep this file, but we'll memorize it only if it is not already present",
"// in returned value.",
"file",
"=",
"new",
"CFolder",
"(",
"new",
"CPath",
"(",
"obj",
".",
"getString",
"(",
"\"subdir\"",
")",
")",
")",
";",
"detailed",
"=",
"false",
";",
"}",
"else",
"{",
"detailed",
"=",
"true",
";",
"if",
"(",
"!",
"CONTENT_TYPE_DIRECTORY",
".",
"equals",
"(",
"obj",
".",
"getString",
"(",
"\"content_type\"",
")",
")",
")",
"{",
"file",
"=",
"new",
"CBlob",
"(",
"new",
"CPath",
"(",
"obj",
".",
"getString",
"(",
"\"name\"",
")",
")",
",",
"obj",
".",
"getLong",
"(",
"\"bytes\"",
")",
",",
"obj",
".",
"getString",
"(",
"\"content_type\"",
")",
",",
"parseLastModified",
"(",
"obj",
")",
",",
"null",
")",
";",
"// we do not have this detailed information",
"}",
"else",
"{",
"file",
"=",
"new",
"CFolder",
"(",
"new",
"CPath",
"(",
"obj",
".",
"getString",
"(",
"\"name\"",
")",
")",
",",
"parseLastModified",
"(",
"obj",
")",
",",
"null",
")",
";",
"// we do not have this detailed information",
"}",
"}",
"if",
"(",
"detailed",
"||",
"!",
"ret",
".",
"containsKey",
"(",
"path",
")",
")",
"{",
"// If we got a detailed file, we always store it",
"// If we got only rough description, we keep it only if no detailed info already exists",
"ret",
".",
"put",
"(",
"file",
".",
"getPath",
"(",
")",
",",
"file",
")",
";",
"}",
"}",
"return",
"new",
"CFolderContent",
"(",
"ret",
")",
";",
"}"
] |
Return map of CFile in given folder. Key is file CPath
@param path the CFolder object or CPath to be listed
@return
|
[
"Return",
"map",
"of",
"CFile",
"in",
"given",
"folder",
".",
"Key",
"is",
"file",
"CPath"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java#L312-L369
|
145,945
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java
|
Swift.getObjectUrl
|
private String getObjectUrl( CPath path )
{
String containerUrl = getCurrentContainerUrl();
return containerUrl + path.getUrlEncoded();
}
|
java
|
private String getObjectUrl( CPath path )
{
String containerUrl = getCurrentContainerUrl();
return containerUrl + path.getUrlEncoded();
}
|
[
"private",
"String",
"getObjectUrl",
"(",
"CPath",
"path",
")",
"{",
"String",
"containerUrl",
"=",
"getCurrentContainerUrl",
"(",
")",
";",
"return",
"containerUrl",
"+",
"path",
".",
"getUrlEncoded",
"(",
")",
";",
"}"
] |
Url encode object path, and concatenate to current container URL to get full URL
@param path The object path
@return The object url
|
[
"Url",
"encode",
"object",
"path",
"and",
"concatenate",
"to",
"current",
"container",
"URL",
"to",
"get",
"full",
"URL"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/hubic/Swift.java#L474-L478
|
145,946
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/storage/StorageBuilder.java
|
StorageBuilder.setAppInfoRepository
|
public StorageBuilder setAppInfoRepository( AppInfoRepository appInfoRepo, String appName )
{
this.appInfoRepo = appInfoRepo;
this.appName = appName;
return this;
}
|
java
|
public StorageBuilder setAppInfoRepository( AppInfoRepository appInfoRepo, String appName )
{
this.appInfoRepo = appInfoRepo;
this.appName = appName;
return this;
}
|
[
"public",
"StorageBuilder",
"setAppInfoRepository",
"(",
"AppInfoRepository",
"appInfoRepo",
",",
"String",
"appName",
")",
"{",
"this",
".",
"appInfoRepo",
"=",
"appInfoRepo",
";",
"this",
".",
"appName",
"=",
"appName",
";",
"return",
"this",
";",
"}"
] |
Set the app informations repository. This setter must always be called during the build
@param appInfoRepo The repository to use
@param appName The application name
@return The builder
|
[
"Set",
"the",
"app",
"informations",
"repository",
".",
"This",
"setter",
"must",
"always",
"be",
"called",
"during",
"the",
"build"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/storage/StorageBuilder.java#L66-L72
|
145,947
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/storage/StorageBuilder.java
|
StorageBuilder.setUserCredentialsRepository
|
public StorageBuilder setUserCredentialsRepository( UserCredentialsRepository userCredentialsRepo, String userId )
{
this.userCredentialsRepo = userCredentialsRepo;
this.userId = userId;
return this;
}
|
java
|
public StorageBuilder setUserCredentialsRepository( UserCredentialsRepository userCredentialsRepo, String userId )
{
this.userCredentialsRepo = userCredentialsRepo;
this.userId = userId;
return this;
}
|
[
"public",
"StorageBuilder",
"setUserCredentialsRepository",
"(",
"UserCredentialsRepository",
"userCredentialsRepo",
",",
"String",
"userId",
")",
"{",
"this",
".",
"userCredentialsRepo",
"=",
"userCredentialsRepo",
";",
"this",
".",
"userId",
"=",
"userId",
";",
"return",
"this",
";",
"}"
] |
Set the user credentials repository. This setter must always be called during the build
@param userCredentialsRepo The repository
@param userId The user identifier (may be null if the identifier is unknown)
@return The builder
|
[
"Set",
"the",
"user",
"credentials",
"repository",
".",
"This",
"setter",
"must",
"always",
"be",
"called",
"during",
"the",
"build"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/storage/StorageBuilder.java#L81-L87
|
145,948
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/storage/StorageBuilder.java
|
StorageBuilder.build
|
public IStorageProvider build()
{
if ( appInfoRepo == null ) {
throw new IllegalStateException( "Undefined application information repository" );
}
if ( userCredentialsRepo == null ) {
throw new IllegalStateException( "Undefined user credentials repository" );
}
try {
Constructor providerConstructor = providerClass.getConstructor( StorageBuilder.class );
StorageProvider providerInstance = ( StorageProvider ) providerConstructor.newInstance( this );
return providerInstance;
} catch ( InvocationTargetException itex ) {
Throwable cause = itex.getCause();
if ( cause instanceof RuntimeException ) {
throw ( RuntimeException ) cause;
}
// should not happen, providers constructors do not throw checked exceptions:
throw new UnsupportedOperationException( "Error instantiating the provider " + providerClass.getSimpleName(), itex );
} catch ( Exception ex ) {
throw new UnsupportedOperationException( "Error instantiating the provider " + providerClass.getSimpleName(), ex );
}
}
|
java
|
public IStorageProvider build()
{
if ( appInfoRepo == null ) {
throw new IllegalStateException( "Undefined application information repository" );
}
if ( userCredentialsRepo == null ) {
throw new IllegalStateException( "Undefined user credentials repository" );
}
try {
Constructor providerConstructor = providerClass.getConstructor( StorageBuilder.class );
StorageProvider providerInstance = ( StorageProvider ) providerConstructor.newInstance( this );
return providerInstance;
} catch ( InvocationTargetException itex ) {
Throwable cause = itex.getCause();
if ( cause instanceof RuntimeException ) {
throw ( RuntimeException ) cause;
}
// should not happen, providers constructors do not throw checked exceptions:
throw new UnsupportedOperationException( "Error instantiating the provider " + providerClass.getSimpleName(), itex );
} catch ( Exception ex ) {
throw new UnsupportedOperationException( "Error instantiating the provider " + providerClass.getSimpleName(), ex );
}
}
|
[
"public",
"IStorageProvider",
"build",
"(",
")",
"{",
"if",
"(",
"appInfoRepo",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Undefined application information repository\"",
")",
";",
"}",
"if",
"(",
"userCredentialsRepo",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Undefined user credentials repository\"",
")",
";",
"}",
"try",
"{",
"Constructor",
"providerConstructor",
"=",
"providerClass",
".",
"getConstructor",
"(",
"StorageBuilder",
".",
"class",
")",
";",
"StorageProvider",
"providerInstance",
"=",
"(",
"StorageProvider",
")",
"providerConstructor",
".",
"newInstance",
"(",
"this",
")",
";",
"return",
"providerInstance",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"itex",
")",
"{",
"Throwable",
"cause",
"=",
"itex",
".",
"getCause",
"(",
")",
";",
"if",
"(",
"cause",
"instanceof",
"RuntimeException",
")",
"{",
"throw",
"(",
"RuntimeException",
")",
"cause",
";",
"}",
"// should not happen, providers constructors do not throw checked exceptions:",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Error instantiating the provider \"",
"+",
"providerClass",
".",
"getSimpleName",
"(",
")",
",",
"itex",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Error instantiating the provider \"",
"+",
"providerClass",
".",
"getSimpleName",
"(",
")",
",",
"ex",
")",
";",
"}",
"}"
] |
Builds a provider-specific storage implementation, by passing this builder in constructor. Each implementation
gets its required information from builder.
@return The storage builder
|
[
"Builds",
"a",
"provider",
"-",
"specific",
"storage",
"implementation",
"by",
"passing",
"this",
"builder",
"in",
"constructor",
".",
"Each",
"implementation",
"gets",
"its",
"required",
"information",
"from",
"builder",
"."
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/storage/StorageBuilder.java#L110-L134
|
145,949
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/pages/AbstractSiteMapPage.java
|
AbstractSiteMapPage.getAllPageClassesQuietly
|
@SuppressWarnings("unchecked")
protected List<? extends Class<? extends WebPage>> getAllPageClassesQuietly()
{
final List<Class<? extends WebPage>> pages = new ArrayList<>();
try
{
final Set<Class<?>> set = AnnotationExtensions.getAllAnnotatedClasses(getPackageName(),
MountPath.class);
for (final Class<?> class1 : set)
{
pages.add((Class<? extends WebPage>)class1);
}
}
catch (final ClassCastException e)
{
LOGGER.error(
e.getClass().getName() + " occured while scanning for MountPath annotations.", e);
}
catch (final ClassNotFoundException e)
{
LOGGER.error(
e.getClass().getName() + " occured while scanning for MountPath annotations.", e);
}
catch (final IOException e)
{
LOGGER.error(
e.getClass().getName() + " occured while scanning for MountPath annotations.", e);
} catch (URISyntaxException e) {
LOGGER.error(
e.getClass().getName() + " occured while scanning for MountPath annotations.", e);
}
return pages;
}
|
java
|
@SuppressWarnings("unchecked")
protected List<? extends Class<? extends WebPage>> getAllPageClassesQuietly()
{
final List<Class<? extends WebPage>> pages = new ArrayList<>();
try
{
final Set<Class<?>> set = AnnotationExtensions.getAllAnnotatedClasses(getPackageName(),
MountPath.class);
for (final Class<?> class1 : set)
{
pages.add((Class<? extends WebPage>)class1);
}
}
catch (final ClassCastException e)
{
LOGGER.error(
e.getClass().getName() + " occured while scanning for MountPath annotations.", e);
}
catch (final ClassNotFoundException e)
{
LOGGER.error(
e.getClass().getName() + " occured while scanning for MountPath annotations.", e);
}
catch (final IOException e)
{
LOGGER.error(
e.getClass().getName() + " occured while scanning for MountPath annotations.", e);
} catch (URISyntaxException e) {
LOGGER.error(
e.getClass().getName() + " occured while scanning for MountPath annotations.", e);
}
return pages;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"List",
"<",
"?",
"extends",
"Class",
"<",
"?",
"extends",
"WebPage",
">",
">",
"getAllPageClassesQuietly",
"(",
")",
"{",
"final",
"List",
"<",
"Class",
"<",
"?",
"extends",
"WebPage",
">",
">",
"pages",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"final",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"set",
"=",
"AnnotationExtensions",
".",
"getAllAnnotatedClasses",
"(",
"getPackageName",
"(",
")",
",",
"MountPath",
".",
"class",
")",
";",
"for",
"(",
"final",
"Class",
"<",
"?",
">",
"class1",
":",
"set",
")",
"{",
"pages",
".",
"add",
"(",
"(",
"Class",
"<",
"?",
"extends",
"WebPage",
">",
")",
"class1",
")",
";",
"}",
"}",
"catch",
"(",
"final",
"ClassCastException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"e",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" occured while scanning for MountPath annotations.\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"final",
"ClassNotFoundException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"e",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" occured while scanning for MountPath annotations.\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"final",
"IOException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"e",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" occured while scanning for MountPath annotations.\"",
",",
"e",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"LOGGER",
".",
"error",
"(",
"e",
".",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\" occured while scanning for MountPath annotations.\"",
",",
"e",
")",
";",
"}",
"return",
"pages",
";",
"}"
] |
Gets the all page classes quietly.
@return the all page classes quietly
|
[
"Gets",
"the",
"all",
"page",
"classes",
"quietly",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/pages/AbstractSiteMapPage.java#L86-L118
|
145,950
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/pages/AbstractSiteMapPage.java
|
AbstractSiteMapPage.newListModel
|
private IModel<List<SiteUrl>> newListModel()
{
return new LoadableDetachableModel<List<SiteUrl>>()
{
private static final long serialVersionUID = 1L;
@Override
protected List<SiteUrl> load()
{
final List<SiteUrl> list = new ArrayList<>();
for (final Class<? extends WebPage> type : getAllPageClasses())
{
String loc = PATTERN.matcher(AbstractSiteMapPage.this.urlFor(type, null))
.replaceFirst(getBaseUrl());
if (loc.endsWith("/."))
{
loc = loc.replace("/.", "");
}
list.add(new SiteUrl(loc));
}
return list;
}
};
}
|
java
|
private IModel<List<SiteUrl>> newListModel()
{
return new LoadableDetachableModel<List<SiteUrl>>()
{
private static final long serialVersionUID = 1L;
@Override
protected List<SiteUrl> load()
{
final List<SiteUrl> list = new ArrayList<>();
for (final Class<? extends WebPage> type : getAllPageClasses())
{
String loc = PATTERN.matcher(AbstractSiteMapPage.this.urlFor(type, null))
.replaceFirst(getBaseUrl());
if (loc.endsWith("/."))
{
loc = loc.replace("/.", "");
}
list.add(new SiteUrl(loc));
}
return list;
}
};
}
|
[
"private",
"IModel",
"<",
"List",
"<",
"SiteUrl",
">",
">",
"newListModel",
"(",
")",
"{",
"return",
"new",
"LoadableDetachableModel",
"<",
"List",
"<",
"SiteUrl",
">",
">",
"(",
")",
"{",
"private",
"static",
"final",
"long",
"serialVersionUID",
"=",
"1L",
";",
"@",
"Override",
"protected",
"List",
"<",
"SiteUrl",
">",
"load",
"(",
")",
"{",
"final",
"List",
"<",
"SiteUrl",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"Class",
"<",
"?",
"extends",
"WebPage",
">",
"type",
":",
"getAllPageClasses",
"(",
")",
")",
"{",
"String",
"loc",
"=",
"PATTERN",
".",
"matcher",
"(",
"AbstractSiteMapPage",
".",
"this",
".",
"urlFor",
"(",
"type",
",",
"null",
")",
")",
".",
"replaceFirst",
"(",
"getBaseUrl",
"(",
")",
")",
";",
"if",
"(",
"loc",
".",
"endsWith",
"(",
"\"/.\"",
")",
")",
"{",
"loc",
"=",
"loc",
".",
"replace",
"(",
"\"/.\"",
",",
"\"\"",
")",
";",
"}",
"list",
".",
"add",
"(",
"new",
"SiteUrl",
"(",
"loc",
")",
")",
";",
"}",
"return",
"list",
";",
"}",
"}",
";",
"}"
] |
New list model.
@return the i model
|
[
"New",
"list",
"model",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/pages/AbstractSiteMapPage.java#L151-L179
|
145,951
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierModel.java
|
DocumentClassifierModel.createArtifactSerializers
|
@SuppressWarnings("rawtypes")
public static Map<String, ArtifactSerializer> createArtifactSerializers() {
final Map<String, ArtifactSerializer> serializers = BaseModel
.createArtifactSerializers();
serializers.put("featuregen", new ByteArraySerializer());
return serializers;
}
|
java
|
@SuppressWarnings("rawtypes")
public static Map<String, ArtifactSerializer> createArtifactSerializers() {
final Map<String, ArtifactSerializer> serializers = BaseModel
.createArtifactSerializers();
serializers.put("featuregen", new ByteArraySerializer());
return serializers;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"static",
"Map",
"<",
"String",
",",
"ArtifactSerializer",
">",
"createArtifactSerializers",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"ArtifactSerializer",
">",
"serializers",
"=",
"BaseModel",
".",
"createArtifactSerializers",
"(",
")",
";",
"serializers",
".",
"put",
"(",
"\"featuregen\"",
",",
"new",
"ByteArraySerializer",
"(",
")",
")",
";",
"return",
"serializers",
";",
"}"
] |
Create the artifact serializers. The DefaultTrainer deals with any other
Custom serializers.
@return the map containing the added serializers
|
[
"Create",
"the",
"artifact",
"serializers",
".",
"The",
"DefaultTrainer",
"deals",
"with",
"any",
"other",
"Custom",
"serializers",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/document/DocumentClassifierModel.java#L143-L150
|
145,952
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
|
CursorUtils.getBoolean
|
public static boolean getBoolean(Cursor cursor, String columnName) {
return cursor != null && cursor.getInt(cursor.getColumnIndex(columnName)) == TRUE;
}
|
java
|
public static boolean getBoolean(Cursor cursor, String columnName) {
return cursor != null && cursor.getInt(cursor.getColumnIndex(columnName)) == TRUE;
}
|
[
"public",
"static",
"boolean",
"getBoolean",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"return",
"cursor",
"!=",
"null",
"&&",
"cursor",
".",
"getInt",
"(",
"cursor",
".",
"getColumnIndex",
"(",
"columnName",
")",
")",
"==",
"TRUE",
";",
"}"
] |
Read the boolean data for the column.
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the boolean value.
|
[
"Read",
"the",
"boolean",
"data",
"for",
"the",
"column",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L52-L54
|
145,953
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
|
CursorUtils.getInt
|
public static int getInt(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getInt(cursor.getColumnIndex(columnName));
}
|
java
|
public static int getInt(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getInt(cursor.getColumnIndex(columnName));
}
|
[
"public",
"static",
"int",
"getInt",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"cursor",
".",
"getInt",
"(",
"cursor",
".",
"getColumnIndex",
"(",
"columnName",
")",
")",
";",
"}"
] |
Read the int data for the column.
@see android.database.Cursor#getInt(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the int value.
|
[
"Read",
"the",
"int",
"data",
"for",
"the",
"column",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L64-L70
|
145,954
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
|
CursorUtils.getString
|
public static String getString(Cursor cursor, String columnName) {
if (cursor == null) {
return null;
}
return cursor.getString(cursor.getColumnIndex(columnName));
}
|
java
|
public static String getString(Cursor cursor, String columnName) {
if (cursor == null) {
return null;
}
return cursor.getString(cursor.getColumnIndex(columnName));
}
|
[
"public",
"static",
"String",
"getString",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"cursor",
".",
"getString",
"(",
"cursor",
".",
"getColumnIndex",
"(",
"columnName",
")",
")",
";",
"}"
] |
Read the String data for the column.
@see android.database.Cursor#getString(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the String value.
|
[
"Read",
"the",
"String",
"data",
"for",
"the",
"column",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L80-L86
|
145,955
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
|
CursorUtils.getShort
|
public static short getShort(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getShort(cursor.getColumnIndex(columnName));
}
|
java
|
public static short getShort(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getShort(cursor.getColumnIndex(columnName));
}
|
[
"public",
"static",
"short",
"getShort",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"cursor",
".",
"getShort",
"(",
"cursor",
".",
"getColumnIndex",
"(",
"columnName",
")",
")",
";",
"}"
] |
Read the short data for the column.
@see android.database.Cursor#getShort(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the short value.
|
[
"Read",
"the",
"short",
"data",
"for",
"the",
"column",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L96-L102
|
145,956
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
|
CursorUtils.getLong
|
public static long getLong(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getLong(cursor.getColumnIndex(columnName));
}
|
java
|
public static long getLong(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getLong(cursor.getColumnIndex(columnName));
}
|
[
"public",
"static",
"long",
"getLong",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"cursor",
".",
"getLong",
"(",
"cursor",
".",
"getColumnIndex",
"(",
"columnName",
")",
")",
";",
"}"
] |
Read the long data for the column.
@see android.database.Cursor#getLong(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the long value.
|
[
"Read",
"the",
"long",
"data",
"for",
"the",
"column",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L112-L118
|
145,957
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
|
CursorUtils.getDouble
|
public static double getDouble(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getDouble(cursor.getColumnIndex(columnName));
}
|
java
|
public static double getDouble(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getDouble(cursor.getColumnIndex(columnName));
}
|
[
"public",
"static",
"double",
"getDouble",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"cursor",
".",
"getDouble",
"(",
"cursor",
".",
"getColumnIndex",
"(",
"columnName",
")",
")",
";",
"}"
] |
Read the double data for the column.
@see android.database.Cursor#getDouble(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the double value.
|
[
"Read",
"the",
"double",
"data",
"for",
"the",
"column",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L128-L134
|
145,958
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
|
CursorUtils.getFloat
|
public static float getFloat(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getFloat(cursor.getColumnIndex(columnName));
}
|
java
|
public static float getFloat(Cursor cursor, String columnName) {
if (cursor == null) {
return -1;
}
return cursor.getFloat(cursor.getColumnIndex(columnName));
}
|
[
"public",
"static",
"float",
"getFloat",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"return",
"cursor",
".",
"getFloat",
"(",
"cursor",
".",
"getColumnIndex",
"(",
"columnName",
")",
")",
";",
"}"
] |
Read the float data for the column.
@see android.database.Cursor#getFloat(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the float value.
|
[
"Read",
"the",
"float",
"data",
"for",
"the",
"column",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L144-L150
|
145,959
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
|
CursorUtils.getBlob
|
public static byte[] getBlob(Cursor cursor, String columnName) {
if (cursor == null) {
return null;
}
return cursor.getBlob(cursor.getColumnIndex(columnName));
}
|
java
|
public static byte[] getBlob(Cursor cursor, String columnName) {
if (cursor == null) {
return null;
}
return cursor.getBlob(cursor.getColumnIndex(columnName));
}
|
[
"public",
"static",
"byte",
"[",
"]",
"getBlob",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"cursor",
".",
"getBlob",
"(",
"cursor",
".",
"getColumnIndex",
"(",
"columnName",
")",
")",
";",
"}"
] |
Read the blob data for the column.
@see android.database.Cursor#getBlob(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the blob value.
|
[
"Read",
"the",
"blob",
"data",
"for",
"the",
"column",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L160-L166
|
145,960
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
|
CursorUtils.getType
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static int getType(Cursor cursor, String columnName) {
if (cursor == null) {
return Cursor.FIELD_TYPE_NULL;
}
return cursor.getType(cursor.getColumnIndex(columnName));
}
|
java
|
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static int getType(Cursor cursor, String columnName) {
if (cursor == null) {
return Cursor.FIELD_TYPE_NULL;
}
return cursor.getType(cursor.getColumnIndex(columnName));
}
|
[
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"HONEYCOMB",
")",
"public",
"static",
"int",
"getType",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"if",
"(",
"cursor",
"==",
"null",
")",
"{",
"return",
"Cursor",
".",
"FIELD_TYPE_NULL",
";",
"}",
"return",
"cursor",
".",
"getType",
"(",
"cursor",
".",
"getColumnIndex",
"(",
"columnName",
")",
")",
";",
"}"
] |
Checks the type of the column.
@see android.database.Cursor#getType(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return the type of the column.
|
[
"Checks",
"the",
"type",
"of",
"the",
"column",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L176-L183
|
145,961
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/database/CursorUtils.java
|
CursorUtils.isNull
|
public static boolean isNull(Cursor cursor, String columnName) {
return cursor != null && cursor.isNull(cursor.getColumnIndex(columnName));
}
|
java
|
public static boolean isNull(Cursor cursor, String columnName) {
return cursor != null && cursor.isNull(cursor.getColumnIndex(columnName));
}
|
[
"public",
"static",
"boolean",
"isNull",
"(",
"Cursor",
"cursor",
",",
"String",
"columnName",
")",
"{",
"return",
"cursor",
"!=",
"null",
"&&",
"cursor",
".",
"isNull",
"(",
"cursor",
".",
"getColumnIndex",
"(",
"columnName",
")",
")",
";",
"}"
] |
Checks if the column value is null or not.
@see android.database.Cursor#isNull(int).
@see android.database.Cursor#getColumnIndex(String).
@param cursor the cursor.
@param columnName the column name.
@return true if the column value is null.
|
[
"Checks",
"if",
"the",
"column",
"value",
"is",
"null",
"or",
"not",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/database/CursorUtils.java#L193-L196
|
145,962
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java
|
ComponentFinder.findParent
|
public static Component findParent(final Component childComponent,
final Class<? extends Component> parentClass, final boolean byClassname)
{
Component parent = childComponent.getParent();
while (parent != null)
{
if (parent.getClass().equals(parentClass))
{
break;
}
parent = parent.getParent();
}
if ((parent == null) && byClassname)
{
return findParentByClassname(childComponent, parentClass);
}
return parent;
}
|
java
|
public static Component findParent(final Component childComponent,
final Class<? extends Component> parentClass, final boolean byClassname)
{
Component parent = childComponent.getParent();
while (parent != null)
{
if (parent.getClass().equals(parentClass))
{
break;
}
parent = parent.getParent();
}
if ((parent == null) && byClassname)
{
return findParentByClassname(childComponent, parentClass);
}
return parent;
}
|
[
"public",
"static",
"Component",
"findParent",
"(",
"final",
"Component",
"childComponent",
",",
"final",
"Class",
"<",
"?",
"extends",
"Component",
">",
"parentClass",
",",
"final",
"boolean",
"byClassname",
")",
"{",
"Component",
"parent",
"=",
"childComponent",
".",
"getParent",
"(",
")",
";",
"while",
"(",
"parent",
"!=",
"null",
")",
"{",
"if",
"(",
"parent",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"parentClass",
")",
")",
"{",
"break",
";",
"}",
"parent",
"=",
"parent",
".",
"getParent",
"(",
")",
";",
"}",
"if",
"(",
"(",
"parent",
"==",
"null",
")",
"&&",
"byClassname",
")",
"{",
"return",
"findParentByClassname",
"(",
"childComponent",
",",
"parentClass",
")",
";",
"}",
"return",
"parent",
";",
"}"
] |
Finds the first parent of the given childComponent from the given parentClass and a flag if
the search shell be continued with the class name if the search with the given parentClass
returns null.
@param childComponent
the child component
@param parentClass
the parent class
@param byClassname
the flag to search by classname if the search with given parentClass returns null.
@return the component
|
[
"Finds",
"the",
"first",
"parent",
"of",
"the",
"given",
"childComponent",
"from",
"the",
"given",
"parentClass",
"and",
"a",
"flag",
"if",
"the",
"search",
"shell",
"be",
"continued",
"with",
"the",
"class",
"name",
"if",
"the",
"search",
"with",
"the",
"given",
"parentClass",
"returns",
"null",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java#L112-L129
|
145,963
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java
|
ComponentFinder.findParentForm
|
public static Component findParentForm(final Component childComponent)
{
final Component parent = findParent(childComponent, Form.class);
if ((parent != null) && parent.getClass().equals(Form.class))
{
return parent;
}
return null;
}
|
java
|
public static Component findParentForm(final Component childComponent)
{
final Component parent = findParent(childComponent, Form.class);
if ((parent != null) && parent.getClass().equals(Form.class))
{
return parent;
}
return null;
}
|
[
"public",
"static",
"Component",
"findParentForm",
"(",
"final",
"Component",
"childComponent",
")",
"{",
"final",
"Component",
"parent",
"=",
"findParent",
"(",
"childComponent",
",",
"Form",
".",
"class",
")",
";",
"if",
"(",
"(",
"parent",
"!=",
"null",
")",
"&&",
"parent",
".",
"getClass",
"(",
")",
".",
"equals",
"(",
"Form",
".",
"class",
")",
")",
"{",
"return",
"parent",
";",
"}",
"return",
"null",
";",
"}"
] |
Finds the parent form of the given childComponent.
@param childComponent
the child component
@return the component or null if no form is found.
|
[
"Finds",
"the",
"parent",
"form",
"of",
"the",
"given",
"childComponent",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java#L162-L170
|
145,964
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java
|
ComponentFinder.getCurrentPage
|
public static Page getCurrentPage()
{
final IRequestHandler requestHandler = RequestCycle.get().getActiveRequestHandler();
final Page page = getPage(requestHandler);
if (page != null)
{
return page;
}
if (requestHandler instanceof RequestSettingRequestHandler)
{
final RequestSettingRequestHandler requestSettingRequestHandler = (RequestSettingRequestHandler)requestHandler;
return getPage(requestSettingRequestHandler.getDelegateHandler());
}
return null;
}
|
java
|
public static Page getCurrentPage()
{
final IRequestHandler requestHandler = RequestCycle.get().getActiveRequestHandler();
final Page page = getPage(requestHandler);
if (page != null)
{
return page;
}
if (requestHandler instanceof RequestSettingRequestHandler)
{
final RequestSettingRequestHandler requestSettingRequestHandler = (RequestSettingRequestHandler)requestHandler;
return getPage(requestSettingRequestHandler.getDelegateHandler());
}
return null;
}
|
[
"public",
"static",
"Page",
"getCurrentPage",
"(",
")",
"{",
"final",
"IRequestHandler",
"requestHandler",
"=",
"RequestCycle",
".",
"get",
"(",
")",
".",
"getActiveRequestHandler",
"(",
")",
";",
"final",
"Page",
"page",
"=",
"getPage",
"(",
"requestHandler",
")",
";",
"if",
"(",
"page",
"!=",
"null",
")",
"{",
"return",
"page",
";",
"}",
"if",
"(",
"requestHandler",
"instanceof",
"RequestSettingRequestHandler",
")",
"{",
"final",
"RequestSettingRequestHandler",
"requestSettingRequestHandler",
"=",
"(",
"RequestSettingRequestHandler",
")",
"requestHandler",
";",
"return",
"getPage",
"(",
"requestSettingRequestHandler",
".",
"getDelegateHandler",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Gets the current page.
@return the current page
|
[
"Gets",
"the",
"current",
"page",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java#L177-L191
|
145,965
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java
|
ComponentFinder.getPage
|
public static Page getPage(final IRequestHandler requestHandler)
{
if (requestHandler instanceof IPageRequestHandler)
{
final IPageRequestHandler pageRequestHandler = (IPageRequestHandler)requestHandler;
return (Page)pageRequestHandler.getPage();
}
return null;
}
|
java
|
public static Page getPage(final IRequestHandler requestHandler)
{
if (requestHandler instanceof IPageRequestHandler)
{
final IPageRequestHandler pageRequestHandler = (IPageRequestHandler)requestHandler;
return (Page)pageRequestHandler.getPage();
}
return null;
}
|
[
"public",
"static",
"Page",
"getPage",
"(",
"final",
"IRequestHandler",
"requestHandler",
")",
"{",
"if",
"(",
"requestHandler",
"instanceof",
"IPageRequestHandler",
")",
"{",
"final",
"IPageRequestHandler",
"pageRequestHandler",
"=",
"(",
"IPageRequestHandler",
")",
"requestHandler",
";",
"return",
"(",
"Page",
")",
"pageRequestHandler",
".",
"getPage",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Gets the page if the request handler is instance of IPageRequestHandler.
@param requestHandler
The {@link IRequestHandler} to get the page.
@return The page or null if not found.
|
[
"Gets",
"the",
"page",
"if",
"the",
"request",
"handler",
"is",
"instance",
"of",
"IPageRequestHandler",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java#L200-L208
|
145,966
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java
|
ComponentFinder.newAjaxRequestTarget
|
@SuppressWarnings("javadoc")
public static AjaxRequestTarget newAjaxRequestTarget(final WebApplication application,
final Page page)
{
return application.newAjaxRequestTarget(page);
}
|
java
|
@SuppressWarnings("javadoc")
public static AjaxRequestTarget newAjaxRequestTarget(final WebApplication application,
final Page page)
{
return application.newAjaxRequestTarget(page);
}
|
[
"@",
"SuppressWarnings",
"(",
"\"javadoc\"",
")",
"public",
"static",
"AjaxRequestTarget",
"newAjaxRequestTarget",
"(",
"final",
"WebApplication",
"application",
",",
"final",
"Page",
"page",
")",
"{",
"return",
"application",
".",
"newAjaxRequestTarget",
"(",
"page",
")",
";",
"}"
] |
Creates a new ajax request target from the given Page.
@param application
the web application
@param page
page on which ajax response is made
@return an AjaxRequestTarget instance
@see WebApplication#newAjaxRequestTarget(Page)
|
[
"Creates",
"a",
"new",
"ajax",
"request",
"target",
"from",
"the",
"given",
"Page",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/ComponentFinder.java#L222-L227
|
145,967
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/lexer/NumericNameLexer.java
|
NumericNameLexer.getNumericNames
|
public List<SequenceLabel> getNumericNames() {
final List<SequenceLabel> result = new ArrayList<SequenceLabel>();
while (hasNextToken()) {
result.add(getNextToken());
}
return result;
}
|
java
|
public List<SequenceLabel> getNumericNames() {
final List<SequenceLabel> result = new ArrayList<SequenceLabel>();
while (hasNextToken()) {
result.add(getNextToken());
}
return result;
}
|
[
"public",
"List",
"<",
"SequenceLabel",
">",
"getNumericNames",
"(",
")",
"{",
"final",
"List",
"<",
"SequenceLabel",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"SequenceLabel",
">",
"(",
")",
";",
"while",
"(",
"hasNextToken",
"(",
")",
")",
"{",
"result",
".",
"add",
"(",
"getNextToken",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns found expressions as a List of names.
@return A list of all tokens remaining in the underlying Reader
|
[
"Returns",
"found",
"expressions",
"as",
"a",
"List",
"of",
"names",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/lexer/NumericNameLexer.java#L69-L75
|
145,968
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamComparison.java
|
KamComparison.getAverageKamNodeDegree
|
public double getAverageKamNodeDegree(String kamName) {
final int nodes = getKamNodeCount(kamName);
return (nodes != 0 ? ((double) 2 * getKamEdgeCount(kamName)) / nodes
: 0.0);
}
|
java
|
public double getAverageKamNodeDegree(String kamName) {
final int nodes = getKamNodeCount(kamName);
return (nodes != 0 ? ((double) 2 * getKamEdgeCount(kamName)) / nodes
: 0.0);
}
|
[
"public",
"double",
"getAverageKamNodeDegree",
"(",
"String",
"kamName",
")",
"{",
"final",
"int",
"nodes",
"=",
"getKamNodeCount",
"(",
"kamName",
")",
";",
"return",
"(",
"nodes",
"!=",
"0",
"?",
"(",
"(",
"double",
")",
"2",
"*",
"getKamEdgeCount",
"(",
"kamName",
")",
")",
"/",
"nodes",
":",
"0.0",
")",
";",
"}"
] |
Returns the average KAM node degree.
Zero is returned if the average is undefined (in case
the number of KAM nodes is zero).
|
[
"Returns",
"the",
"average",
"KAM",
"node",
"degree",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamComparison.java#L103-L107
|
145,969
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamComparison.java
|
KamComparison.getAverageKamNodeInDegree
|
public double getAverageKamNodeInDegree(String kamName) {
final int nodes = getKamNodeCount(kamName);
return (nodes != 0 ? ((double) getKamEdgeCount(kamName)) / nodes : 0.0);
}
|
java
|
public double getAverageKamNodeInDegree(String kamName) {
final int nodes = getKamNodeCount(kamName);
return (nodes != 0 ? ((double) getKamEdgeCount(kamName)) / nodes : 0.0);
}
|
[
"public",
"double",
"getAverageKamNodeInDegree",
"(",
"String",
"kamName",
")",
"{",
"final",
"int",
"nodes",
"=",
"getKamNodeCount",
"(",
"kamName",
")",
";",
"return",
"(",
"nodes",
"!=",
"0",
"?",
"(",
"(",
"double",
")",
"getKamEdgeCount",
"(",
"kamName",
")",
")",
"/",
"nodes",
":",
"0.0",
")",
";",
"}"
] |
Returns the average KAM node in degree.
Zero is returned if the average is undefined (in case
the number of KAM nodes is zero).
|
[
"Returns",
"the",
"average",
"KAM",
"node",
"in",
"degree",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamComparison.java#L115-L118
|
145,970
|
OpenBEL/openbel-framework
|
org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamComparison.java
|
KamComparison.getAverageKamNodeOutDegree
|
public double getAverageKamNodeOutDegree(String kamName) {
final int nodes = getKamNodeCount(kamName);
return (nodes != 0 ? ((double) getKamEdgeCount(kamName)) / nodes : 0.0);
}
|
java
|
public double getAverageKamNodeOutDegree(String kamName) {
final int nodes = getKamNodeCount(kamName);
return (nodes != 0 ? ((double) getKamEdgeCount(kamName)) / nodes : 0.0);
}
|
[
"public",
"double",
"getAverageKamNodeOutDegree",
"(",
"String",
"kamName",
")",
"{",
"final",
"int",
"nodes",
"=",
"getKamNodeCount",
"(",
"kamName",
")",
";",
"return",
"(",
"nodes",
"!=",
"0",
"?",
"(",
"(",
"double",
")",
"getKamEdgeCount",
"(",
"kamName",
")",
")",
"/",
"nodes",
":",
"0.0",
")",
";",
"}"
] |
Returns the average KAM node out degree.
Zero is returned if the average is undefined (in case
the number of KAM nodes is zero).
|
[
"Returns",
"the",
"average",
"KAM",
"node",
"out",
"degree",
"."
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.tools/src/main/java/org/openbel/framework/tools/kamstore/KamComparison.java#L126-L129
|
145,971
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.addFilePatternsToPackageResourceGuard
|
public static void addFilePatternsToPackageResourceGuard(final Application application,
final String... patterns)
{
final IPackageResourceGuard packageResourceGuard = application.getResourceSettings()
.getPackageResourceGuard();
if (packageResourceGuard instanceof SecurePackageResourceGuard)
{
final SecurePackageResourceGuard guard = (SecurePackageResourceGuard)packageResourceGuard;
for (final String pattern : patterns)
{
guard.addPattern(pattern);
}
}
}
|
java
|
public static void addFilePatternsToPackageResourceGuard(final Application application,
final String... patterns)
{
final IPackageResourceGuard packageResourceGuard = application.getResourceSettings()
.getPackageResourceGuard();
if (packageResourceGuard instanceof SecurePackageResourceGuard)
{
final SecurePackageResourceGuard guard = (SecurePackageResourceGuard)packageResourceGuard;
for (final String pattern : patterns)
{
guard.addPattern(pattern);
}
}
}
|
[
"public",
"static",
"void",
"addFilePatternsToPackageResourceGuard",
"(",
"final",
"Application",
"application",
",",
"final",
"String",
"...",
"patterns",
")",
"{",
"final",
"IPackageResourceGuard",
"packageResourceGuard",
"=",
"application",
".",
"getResourceSettings",
"(",
")",
".",
"getPackageResourceGuard",
"(",
")",
";",
"if",
"(",
"packageResourceGuard",
"instanceof",
"SecurePackageResourceGuard",
")",
"{",
"final",
"SecurePackageResourceGuard",
"guard",
"=",
"(",
"SecurePackageResourceGuard",
")",
"packageResourceGuard",
";",
"for",
"(",
"final",
"String",
"pattern",
":",
"patterns",
")",
"{",
"guard",
".",
"addPattern",
"(",
"pattern",
")",
";",
"}",
"}",
"}"
] |
Adds the given file patterns to package resource guard from the given application.
@param application
the application
@param patterns
the patterns
|
[
"Adds",
"the",
"given",
"file",
"patterns",
"to",
"package",
"resource",
"guard",
"from",
"the",
"given",
"application",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L68-L81
|
145,972
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.addResourceFinder
|
public static void addResourceFinder(final WebApplication application,
final String resourcePath)
{
application.getResourceSettings().getResourceFinders()
.add(new WebApplicationPath(application.getServletContext(), resourcePath));
}
|
java
|
public static void addResourceFinder(final WebApplication application,
final String resourcePath)
{
application.getResourceSettings().getResourceFinders()
.add(new WebApplicationPath(application.getServletContext(), resourcePath));
}
|
[
"public",
"static",
"void",
"addResourceFinder",
"(",
"final",
"WebApplication",
"application",
",",
"final",
"String",
"resourcePath",
")",
"{",
"application",
".",
"getResourceSettings",
"(",
")",
".",
"getResourceFinders",
"(",
")",
".",
"add",
"(",
"new",
"WebApplicationPath",
"(",
"application",
".",
"getServletContext",
"(",
")",
",",
"resourcePath",
")",
")",
";",
"}"
] |
Adds the given resourcePath to the resource finder from the given application.
@param application
the application
@param resourcePath
the resource path
@see org.apache.wicket.settings.ResourceSettings#getResourceFinders()
|
[
"Adds",
"the",
"given",
"resourcePath",
"to",
"the",
"resource",
"finder",
"from",
"the",
"given",
"application",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L92-L97
|
145,973
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.replaceJQueryReference
|
public static void replaceJQueryReference(final WebApplication application,
final String cdnjsUrl)
{
application.getJavaScriptLibrarySettings()
.setJQueryReference(new UrlResourceReference(Url.parse(cdnjsUrl)));
}
|
java
|
public static void replaceJQueryReference(final WebApplication application,
final String cdnjsUrl)
{
application.getJavaScriptLibrarySettings()
.setJQueryReference(new UrlResourceReference(Url.parse(cdnjsUrl)));
}
|
[
"public",
"static",
"void",
"replaceJQueryReference",
"(",
"final",
"WebApplication",
"application",
",",
"final",
"String",
"cdnjsUrl",
")",
"{",
"application",
".",
"getJavaScriptLibrarySettings",
"(",
")",
".",
"setJQueryReference",
"(",
"new",
"UrlResourceReference",
"(",
"Url",
".",
"parse",
"(",
"cdnjsUrl",
")",
")",
")",
";",
"}"
] |
Replace the default jquery resource reference from the given application with the given cdn
url.
@param application
the WebApplication
@param cdnjsUrl
the given cdn url.
|
[
"Replace",
"the",
"default",
"jquery",
"resource",
"reference",
"from",
"the",
"given",
"application",
"with",
"the",
"given",
"cdn",
"url",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L282-L287
|
145,974
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.setDebugSettingsForDevelopment
|
public static void setDebugSettingsForDevelopment(final Application application)
{
application.getDebugSettings().setComponentUseCheck(true);
application.getDebugSettings().setOutputMarkupContainerClassName(true);
application.getDebugSettings().setLinePreciseReportingOnAddComponentEnabled(true);
application.getDebugSettings().setLinePreciseReportingOnNewComponentEnabled(true);
application.getDebugSettings().setAjaxDebugModeEnabled(true);
application.getDebugSettings().setDevelopmentUtilitiesEnabled(true);
}
|
java
|
public static void setDebugSettingsForDevelopment(final Application application)
{
application.getDebugSettings().setComponentUseCheck(true);
application.getDebugSettings().setOutputMarkupContainerClassName(true);
application.getDebugSettings().setLinePreciseReportingOnAddComponentEnabled(true);
application.getDebugSettings().setLinePreciseReportingOnNewComponentEnabled(true);
application.getDebugSettings().setAjaxDebugModeEnabled(true);
application.getDebugSettings().setDevelopmentUtilitiesEnabled(true);
}
|
[
"public",
"static",
"void",
"setDebugSettingsForDevelopment",
"(",
"final",
"Application",
"application",
")",
"{",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setComponentUseCheck",
"(",
"true",
")",
";",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setOutputMarkupContainerClassName",
"(",
"true",
")",
";",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setLinePreciseReportingOnAddComponentEnabled",
"(",
"true",
")",
";",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setLinePreciseReportingOnNewComponentEnabled",
"(",
"true",
")",
";",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setAjaxDebugModeEnabled",
"(",
"true",
")",
";",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setDevelopmentUtilitiesEnabled",
"(",
"true",
")",
";",
"}"
] |
Sets the debug settings for development mode for the given application.
@param application
the new debug settings for development
|
[
"Sets",
"the",
"debug",
"settings",
"for",
"development",
"mode",
"for",
"the",
"given",
"application",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L309-L317
|
145,975
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.setDefaultDebugSettingsForDevelopment
|
public static void setDefaultDebugSettingsForDevelopment(final WebApplication application)
{
ApplicationExtensions.setHtmlHotDeploy(application);
ApplicationExtensions.setDebugSettingsForDevelopment(application);
ApplicationExtensions.setExceptionSettingsForDevelopment(application);
// set the behavior if an missing resource is found...
application.getResourceSettings().setThrowExceptionOnMissingResource(true);
}
|
java
|
public static void setDefaultDebugSettingsForDevelopment(final WebApplication application)
{
ApplicationExtensions.setHtmlHotDeploy(application);
ApplicationExtensions.setDebugSettingsForDevelopment(application);
ApplicationExtensions.setExceptionSettingsForDevelopment(application);
// set the behavior if an missing resource is found...
application.getResourceSettings().setThrowExceptionOnMissingResource(true);
}
|
[
"public",
"static",
"void",
"setDefaultDebugSettingsForDevelopment",
"(",
"final",
"WebApplication",
"application",
")",
"{",
"ApplicationExtensions",
".",
"setHtmlHotDeploy",
"(",
"application",
")",
";",
"ApplicationExtensions",
".",
"setDebugSettingsForDevelopment",
"(",
"application",
")",
";",
"ApplicationExtensions",
".",
"setExceptionSettingsForDevelopment",
"(",
"application",
")",
";",
"// set the behavior if an missing resource is found...",
"application",
".",
"getResourceSettings",
"(",
")",
".",
"setThrowExceptionOnMissingResource",
"(",
"true",
")",
";",
"}"
] |
Sets a set of default development settings for development mode for the given application.
@param application
the new debug settings for development
|
[
"Sets",
"a",
"set",
"of",
"default",
"development",
"settings",
"for",
"development",
"mode",
"for",
"the",
"given",
"application",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L325-L332
|
145,976
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.setDefaultDeploymentModeConfiguration
|
public static void setDefaultDeploymentModeConfiguration(final Application application,
final AbstractRequestCycleListener applicationRequestCycleListener)
{
if (applicationRequestCycleListener != null)
{
ApplicationExtensions.setExceptionSettingsForDeployment(application,
applicationRequestCycleListener);
}
ApplicationExtensions.setDeploymentModeConfiguration(application);
}
|
java
|
public static void setDefaultDeploymentModeConfiguration(final Application application,
final AbstractRequestCycleListener applicationRequestCycleListener)
{
if (applicationRequestCycleListener != null)
{
ApplicationExtensions.setExceptionSettingsForDeployment(application,
applicationRequestCycleListener);
}
ApplicationExtensions.setDeploymentModeConfiguration(application);
}
|
[
"public",
"static",
"void",
"setDefaultDeploymentModeConfiguration",
"(",
"final",
"Application",
"application",
",",
"final",
"AbstractRequestCycleListener",
"applicationRequestCycleListener",
")",
"{",
"if",
"(",
"applicationRequestCycleListener",
"!=",
"null",
")",
"{",
"ApplicationExtensions",
".",
"setExceptionSettingsForDeployment",
"(",
"application",
",",
"applicationRequestCycleListener",
")",
";",
"}",
"ApplicationExtensions",
".",
"setDeploymentModeConfiguration",
"(",
"application",
")",
";",
"}"
] |
Sets a set of default deployment settings for deployment mode for the given application.
@param application
the application to set the settings
@param applicationRequestCycleListener
the {@link AbstractRequestCycleListener} to set.
|
[
"Sets",
"a",
"set",
"of",
"default",
"deployment",
"settings",
"for",
"deployment",
"mode",
"for",
"the",
"given",
"application",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L342-L351
|
145,977
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.setDeploymentModeConfiguration
|
public static void setDeploymentModeConfiguration(final Application application)
{
application.getMarkupSettings().setStripComments(true);
// The resources are never polled. This are properties, html,
// css, js files.
application.getResourceSettings().setResourcePollFrequency(null);
application.getResourceSettings()
.setJavaScriptCompressor(new DefaultJavaScriptCompressor());
// set the behavior if an missing resource is found...
application.getResourceSettings().setThrowExceptionOnMissingResource(false);
// debug settings...
application.getDebugSettings().setComponentUseCheck(false);
application.getDebugSettings().setAjaxDebugModeEnabled(false);
application.getDebugSettings().setDevelopmentUtilitiesEnabled(false);
application.getDebugSettings().setOutputMarkupContainerClassName(false);
application.getDebugSettings().setLinePreciseReportingOnAddComponentEnabled(false);
application.getDebugSettings().setLinePreciseReportingOnNewComponentEnabled(false);
}
|
java
|
public static void setDeploymentModeConfiguration(final Application application)
{
application.getMarkupSettings().setStripComments(true);
// The resources are never polled. This are properties, html,
// css, js files.
application.getResourceSettings().setResourcePollFrequency(null);
application.getResourceSettings()
.setJavaScriptCompressor(new DefaultJavaScriptCompressor());
// set the behavior if an missing resource is found...
application.getResourceSettings().setThrowExceptionOnMissingResource(false);
// debug settings...
application.getDebugSettings().setComponentUseCheck(false);
application.getDebugSettings().setAjaxDebugModeEnabled(false);
application.getDebugSettings().setDevelopmentUtilitiesEnabled(false);
application.getDebugSettings().setOutputMarkupContainerClassName(false);
application.getDebugSettings().setLinePreciseReportingOnAddComponentEnabled(false);
application.getDebugSettings().setLinePreciseReportingOnNewComponentEnabled(false);
}
|
[
"public",
"static",
"void",
"setDeploymentModeConfiguration",
"(",
"final",
"Application",
"application",
")",
"{",
"application",
".",
"getMarkupSettings",
"(",
")",
".",
"setStripComments",
"(",
"true",
")",
";",
"// The resources are never polled. This are properties, html,",
"// css, js files.",
"application",
".",
"getResourceSettings",
"(",
")",
".",
"setResourcePollFrequency",
"(",
"null",
")",
";",
"application",
".",
"getResourceSettings",
"(",
")",
".",
"setJavaScriptCompressor",
"(",
"new",
"DefaultJavaScriptCompressor",
"(",
")",
")",
";",
"// set the behavior if an missing resource is found...",
"application",
".",
"getResourceSettings",
"(",
")",
".",
"setThrowExceptionOnMissingResource",
"(",
"false",
")",
";",
"// debug settings...",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setComponentUseCheck",
"(",
"false",
")",
";",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setAjaxDebugModeEnabled",
"(",
"false",
")",
";",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setDevelopmentUtilitiesEnabled",
"(",
"false",
")",
";",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setOutputMarkupContainerClassName",
"(",
"false",
")",
";",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setLinePreciseReportingOnAddComponentEnabled",
"(",
"false",
")",
";",
"application",
".",
"getDebugSettings",
"(",
")",
".",
"setLinePreciseReportingOnNewComponentEnabled",
"(",
"false",
")",
";",
"}"
] |
Sets the deployment settings for deployment mode for the given application.
@param application
the application to set the settings
|
[
"Sets",
"the",
"deployment",
"settings",
"for",
"deployment",
"mode",
"for",
"the",
"given",
"application",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L359-L377
|
145,978
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.setExceptionSettingsForDeployment
|
public static void setExceptionSettingsForDeployment(final Application application,
final AbstractRequestCycleListener applicationRequestCycleListener)
{
// show the exception page from us...
application.getExceptionSettings()
.setUnexpectedExceptionDisplay(ExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
// In case of unhandled exception redirect it to a custom page
application.getRequestCycleListeners().add(applicationRequestCycleListener);
}
|
java
|
public static void setExceptionSettingsForDeployment(final Application application,
final AbstractRequestCycleListener applicationRequestCycleListener)
{
// show the exception page from us...
application.getExceptionSettings()
.setUnexpectedExceptionDisplay(ExceptionSettings.SHOW_INTERNAL_ERROR_PAGE);
// In case of unhandled exception redirect it to a custom page
application.getRequestCycleListeners().add(applicationRequestCycleListener);
}
|
[
"public",
"static",
"void",
"setExceptionSettingsForDeployment",
"(",
"final",
"Application",
"application",
",",
"final",
"AbstractRequestCycleListener",
"applicationRequestCycleListener",
")",
"{",
"// show the exception page from us...",
"application",
".",
"getExceptionSettings",
"(",
")",
".",
"setUnexpectedExceptionDisplay",
"(",
"ExceptionSettings",
".",
"SHOW_INTERNAL_ERROR_PAGE",
")",
";",
"// In case of unhandled exception redirect it to a custom page",
"application",
".",
"getRequestCycleListeners",
"(",
")",
".",
"add",
"(",
"applicationRequestCycleListener",
")",
";",
"}"
] |
Sets the deployment exception settings for the given application.
@param application
the application
@param applicationRequestCycleListener
the application request cycle listener
|
[
"Sets",
"the",
"deployment",
"exception",
"settings",
"for",
"the",
"given",
"application",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L387-L395
|
145,979
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.setGlobalSettings
|
public static void setGlobalSettings(final WebApplication application, final int httpPort,
final int httpsPort, final String footerFilterName, final String encoding,
final String... patterns)
{
// Standard-Encoding for Markup-Files
application.getMarkupSettings().setDefaultMarkupEncoding(encoding);
// Sets the Response-Header to Character encoding
// this means Content-Type text/html;charset=<encoding>
application.getRequestCycleSettings().setResponseRequestEncoding(encoding);
// set footer scripts...
ApplicationExtensions.setHeaderResponseDecorator(application, footerFilterName);
// set up ports for http and https...
ApplicationExtensions.setRootRequestMapper(application, httpPort, httpsPort);
// add file patterns to the resource guard...
ApplicationExtensions.addFilePatternsToPackageResourceGuard(application, patterns);
// Removes(strips) all wicket tags like <wicket:panel>, <wicket:extend> and <wicket:child>.
// This is very important to set to true if you use the library wicket-jquery-ui
application.getMarkupSettings().setStripWicketTags(true);
}
|
java
|
public static void setGlobalSettings(final WebApplication application, final int httpPort,
final int httpsPort, final String footerFilterName, final String encoding,
final String... patterns)
{
// Standard-Encoding for Markup-Files
application.getMarkupSettings().setDefaultMarkupEncoding(encoding);
// Sets the Response-Header to Character encoding
// this means Content-Type text/html;charset=<encoding>
application.getRequestCycleSettings().setResponseRequestEncoding(encoding);
// set footer scripts...
ApplicationExtensions.setHeaderResponseDecorator(application, footerFilterName);
// set up ports for http and https...
ApplicationExtensions.setRootRequestMapper(application, httpPort, httpsPort);
// add file patterns to the resource guard...
ApplicationExtensions.addFilePatternsToPackageResourceGuard(application, patterns);
// Removes(strips) all wicket tags like <wicket:panel>, <wicket:extend> and <wicket:child>.
// This is very important to set to true if you use the library wicket-jquery-ui
application.getMarkupSettings().setStripWicketTags(true);
}
|
[
"public",
"static",
"void",
"setGlobalSettings",
"(",
"final",
"WebApplication",
"application",
",",
"final",
"int",
"httpPort",
",",
"final",
"int",
"httpsPort",
",",
"final",
"String",
"footerFilterName",
",",
"final",
"String",
"encoding",
",",
"final",
"String",
"...",
"patterns",
")",
"{",
"// Standard-Encoding for Markup-Files",
"application",
".",
"getMarkupSettings",
"(",
")",
".",
"setDefaultMarkupEncoding",
"(",
"encoding",
")",
";",
"// Sets the Response-Header to Character encoding",
"// this means Content-Type text/html;charset=<encoding>",
"application",
".",
"getRequestCycleSettings",
"(",
")",
".",
"setResponseRequestEncoding",
"(",
"encoding",
")",
";",
"// set footer scripts...",
"ApplicationExtensions",
".",
"setHeaderResponseDecorator",
"(",
"application",
",",
"footerFilterName",
")",
";",
"// set up ports for http and https...",
"ApplicationExtensions",
".",
"setRootRequestMapper",
"(",
"application",
",",
"httpPort",
",",
"httpsPort",
")",
";",
"// add file patterns to the resource guard...",
"ApplicationExtensions",
".",
"addFilePatternsToPackageResourceGuard",
"(",
"application",
",",
"patterns",
")",
";",
"// Removes(strips) all wicket tags like <wicket:panel>, <wicket:extend> and <wicket:child>.",
"// This is very important to set to true if you use the library wicket-jquery-ui",
"application",
".",
"getMarkupSettings",
"(",
")",
".",
"setStripWicketTags",
"(",
"true",
")",
";",
"}"
] |
Can be used to set the global settings for development and deployment mode for the given
application.
@param application
the application
@param httpPort
the http port
@param httpsPort
the https port
@param footerFilterName
the footer filter name
@param encoding
the encoding
@param patterns
the patterns
|
[
"Can",
"be",
"used",
"to",
"set",
"the",
"global",
"settings",
"for",
"development",
"and",
"deployment",
"mode",
"for",
"the",
"given",
"application",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L444-L462
|
145,980
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.setHtmlHotDeploy
|
public static void setHtmlHotDeploy(final WebApplication application)
{
application.getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
final String slash = "/";
String realPath = application.getServletContext().getRealPath(slash);
if ((realPath != null) && !realPath.endsWith(slash))
{
realPath += slash;
}
final String javaSourcePath = realPath + "../java";
final String resourcesPath = realPath + "../resources";
addResourceFinder(application, javaSourcePath);
addResourceFinder(application, resourcesPath);
}
|
java
|
public static void setHtmlHotDeploy(final WebApplication application)
{
application.getResourceSettings().setResourcePollFrequency(Duration.ONE_SECOND);
final String slash = "/";
String realPath = application.getServletContext().getRealPath(slash);
if ((realPath != null) && !realPath.endsWith(slash))
{
realPath += slash;
}
final String javaSourcePath = realPath + "../java";
final String resourcesPath = realPath + "../resources";
addResourceFinder(application, javaSourcePath);
addResourceFinder(application, resourcesPath);
}
|
[
"public",
"static",
"void",
"setHtmlHotDeploy",
"(",
"final",
"WebApplication",
"application",
")",
"{",
"application",
".",
"getResourceSettings",
"(",
")",
".",
"setResourcePollFrequency",
"(",
"Duration",
".",
"ONE_SECOND",
")",
";",
"final",
"String",
"slash",
"=",
"\"/\"",
";",
"String",
"realPath",
"=",
"application",
".",
"getServletContext",
"(",
")",
".",
"getRealPath",
"(",
"slash",
")",
";",
"if",
"(",
"(",
"realPath",
"!=",
"null",
")",
"&&",
"!",
"realPath",
".",
"endsWith",
"(",
"slash",
")",
")",
"{",
"realPath",
"+=",
"slash",
";",
"}",
"final",
"String",
"javaSourcePath",
"=",
"realPath",
"+",
"\"../java\"",
";",
"final",
"String",
"resourcesPath",
"=",
"realPath",
"+",
"\"../resources\"",
";",
"addResourceFinder",
"(",
"application",
",",
"javaSourcePath",
")",
";",
"addResourceFinder",
"(",
"application",
",",
"resourcesPath",
")",
";",
"}"
] |
Use this method to enable hot deploy of your html templates on development. Works only with
jetty. Only for
@param application
the new html hot deploy
|
[
"Use",
"this",
"method",
"to",
"enable",
"hot",
"deploy",
"of",
"your",
"html",
"templates",
"on",
"development",
".",
"Works",
"only",
"with",
"jetty",
".",
"Only",
"for"
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L493-L506
|
145,981
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java
|
ApplicationExtensions.setRootRequestMapper
|
public static IRequestMapper setRootRequestMapper(final Application application,
final int httpPort, final int httpsPort)
{
final IRequestMapper httpsMapper = new HttpsMapper(application.getRootRequestMapper(),
new HttpsConfig(httpPort, httpsPort));
application.setRootRequestMapper(httpsMapper);
return httpsMapper;
}
|
java
|
public static IRequestMapper setRootRequestMapper(final Application application,
final int httpPort, final int httpsPort)
{
final IRequestMapper httpsMapper = new HttpsMapper(application.getRootRequestMapper(),
new HttpsConfig(httpPort, httpsPort));
application.setRootRequestMapper(httpsMapper);
return httpsMapper;
}
|
[
"public",
"static",
"IRequestMapper",
"setRootRequestMapper",
"(",
"final",
"Application",
"application",
",",
"final",
"int",
"httpPort",
",",
"final",
"int",
"httpsPort",
")",
"{",
"final",
"IRequestMapper",
"httpsMapper",
"=",
"new",
"HttpsMapper",
"(",
"application",
".",
"getRootRequestMapper",
"(",
")",
",",
"new",
"HttpsConfig",
"(",
"httpPort",
",",
"httpsPort",
")",
")",
";",
"application",
".",
"setRootRequestMapper",
"(",
"httpsMapper",
")",
";",
"return",
"httpsMapper",
";",
"}"
] |
Sets the root request mapper for the given application from the given httpPort and httpsPort.
@param application
the application
@param httpPort
the http port
@param httpsPort
the https port
@return the i request mapper
|
[
"Sets",
"the",
"root",
"request",
"mapper",
"for",
"the",
"given",
"application",
"from",
"the",
"given",
"httpPort",
"and",
"httpsPort",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/util/application/ApplicationExtensions.java#L519-L526
|
145,982
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/cloudme/CMFolder.java
|
CMFolder.addChild
|
public CMFolder addChild( String id, String name )
{
CMFolder childFolder = new CMFolder( id, name );
childFolder.parent = this;
this.children.put( name, childFolder );
return childFolder;
}
|
java
|
public CMFolder addChild( String id, String name )
{
CMFolder childFolder = new CMFolder( id, name );
childFolder.parent = this;
this.children.put( name, childFolder );
return childFolder;
}
|
[
"public",
"CMFolder",
"addChild",
"(",
"String",
"id",
",",
"String",
"name",
")",
"{",
"CMFolder",
"childFolder",
"=",
"new",
"CMFolder",
"(",
"id",
",",
"name",
")",
";",
"childFolder",
".",
"parent",
"=",
"this",
";",
"this",
".",
"children",
".",
"put",
"(",
"name",
",",
"childFolder",
")",
";",
"return",
"childFolder",
";",
"}"
] |
Adds a child folder
@param id id of the child folder
@param name name of the child folder
@return the added folder
|
[
"Adds",
"a",
"child",
"folder"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CMFolder.java#L64-L70
|
145,983
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/cloudme/CMFolder.java
|
CMFolder.getFolder
|
public CMFolder getFolder( CPath path )
{
List<String> baseNames = path.split();
if (path.isRoot() ){
return this;
}
CMFolder currentFolder = this;
CMFolder subFolder = null;
for ( String baseName : baseNames ) {
subFolder = currentFolder.getChildByName( baseName );
if ( subFolder == null ) {
return null;
}
currentFolder = subFolder;
}
return subFolder;
}
|
java
|
public CMFolder getFolder( CPath path )
{
List<String> baseNames = path.split();
if (path.isRoot() ){
return this;
}
CMFolder currentFolder = this;
CMFolder subFolder = null;
for ( String baseName : baseNames ) {
subFolder = currentFolder.getChildByName( baseName );
if ( subFolder == null ) {
return null;
}
currentFolder = subFolder;
}
return subFolder;
}
|
[
"public",
"CMFolder",
"getFolder",
"(",
"CPath",
"path",
")",
"{",
"List",
"<",
"String",
">",
"baseNames",
"=",
"path",
".",
"split",
"(",
")",
";",
"if",
"(",
"path",
".",
"isRoot",
"(",
")",
")",
"{",
"return",
"this",
";",
"}",
"CMFolder",
"currentFolder",
"=",
"this",
";",
"CMFolder",
"subFolder",
"=",
"null",
";",
"for",
"(",
"String",
"baseName",
":",
"baseNames",
")",
"{",
"subFolder",
"=",
"currentFolder",
".",
"getChildByName",
"(",
"baseName",
")",
";",
"if",
"(",
"subFolder",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"currentFolder",
"=",
"subFolder",
";",
"}",
"return",
"subFolder",
";",
"}"
] |
Gets the CloudMe folder corresponding to a given CPath
Returns null if the folder does not exist
@param path
@return CMFolder
|
[
"Gets",
"the",
"CloudMe",
"folder",
"corresponding",
"to",
"a",
"given",
"CPath",
"Returns",
"null",
"if",
"the",
"folder",
"does",
"not",
"exist"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CMFolder.java#L96-L118
|
145,984
|
netheosgithub/pcs_api
|
java/src/main/java/net/netheos/pcsapi/providers/cloudme/CMFolder.java
|
CMFolder.getCPath
|
public CPath getCPath()
{
if ( parent == null ) {
return CPath.ROOT;
}
CMFolder currentFolder = this;
StringBuilder path = new StringBuilder( );
while ( currentFolder.parent != null ) {
path.insert( 0, currentFolder.name );
path.insert( 0, '/' );
currentFolder = currentFolder.parent;
}
return new CPath( path.toString() );
}
|
java
|
public CPath getCPath()
{
if ( parent == null ) {
return CPath.ROOT;
}
CMFolder currentFolder = this;
StringBuilder path = new StringBuilder( );
while ( currentFolder.parent != null ) {
path.insert( 0, currentFolder.name );
path.insert( 0, '/' );
currentFolder = currentFolder.parent;
}
return new CPath( path.toString() );
}
|
[
"public",
"CPath",
"getCPath",
"(",
")",
"{",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"return",
"CPath",
".",
"ROOT",
";",
"}",
"CMFolder",
"currentFolder",
"=",
"this",
";",
"StringBuilder",
"path",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"while",
"(",
"currentFolder",
".",
"parent",
"!=",
"null",
")",
"{",
"path",
".",
"insert",
"(",
"0",
",",
"currentFolder",
".",
"name",
")",
";",
"path",
".",
"insert",
"(",
"0",
",",
"'",
"'",
")",
";",
"currentFolder",
"=",
"currentFolder",
".",
"parent",
";",
"}",
"return",
"new",
"CPath",
"(",
"path",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Gets the CPath corresponding to this folder
@return CPath
|
[
"Gets",
"the",
"CPath",
"corresponding",
"to",
"this",
"folder"
] |
20691e52e144014f99ca75cb7dedc7ba0c18586c
|
https://github.com/netheosgithub/pcs_api/blob/20691e52e144014f99ca75cb7dedc7ba0c18586c/java/src/main/java/net/netheos/pcsapi/providers/cloudme/CMFolder.java#L125-L142
|
145,985
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/ContextUtils.java
|
ContextUtils.getExternalFilesDirForMusic
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForMusic(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_MUSIC);
}
|
java
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForMusic(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_MUSIC);
}
|
[
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"FROYO",
")",
"public",
"static",
"File",
"getExternalFilesDirForMusic",
"(",
"Context",
"context",
")",
"{",
"return",
"context",
".",
"getExternalFilesDir",
"(",
"Environment",
".",
"DIRECTORY_MUSIC",
")",
";",
"}"
] |
Get the file points to an external music directory.
@param context the context.
@return the {@link java.io.File}.
|
[
"Get",
"the",
"file",
"points",
"to",
"an",
"external",
"music",
"directory",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/ContextUtils.java#L94-L97
|
145,986
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/ContextUtils.java
|
ContextUtils.getExternalFilesDirForMovies
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForMovies(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_MOVIES);
}
|
java
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForMovies(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_MOVIES);
}
|
[
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"FROYO",
")",
"public",
"static",
"File",
"getExternalFilesDirForMovies",
"(",
"Context",
"context",
")",
"{",
"return",
"context",
".",
"getExternalFilesDir",
"(",
"Environment",
".",
"DIRECTORY_MOVIES",
")",
";",
"}"
] |
Get the file points to an external movies directory.
@param context the context.
@return the {@link java.io.File}.
|
[
"Get",
"the",
"file",
"points",
"to",
"an",
"external",
"movies",
"directory",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/ContextUtils.java#L104-L107
|
145,987
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/ContextUtils.java
|
ContextUtils.getExternalFilesDirForAlarms
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForAlarms(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_ALARMS);
}
|
java
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForAlarms(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_ALARMS);
}
|
[
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"FROYO",
")",
"public",
"static",
"File",
"getExternalFilesDirForAlarms",
"(",
"Context",
"context",
")",
"{",
"return",
"context",
".",
"getExternalFilesDir",
"(",
"Environment",
".",
"DIRECTORY_ALARMS",
")",
";",
"}"
] |
Get the file points to an external alarms directory.
@param context the context.
@return the {@link java.io.File}.
|
[
"Get",
"the",
"file",
"points",
"to",
"an",
"external",
"alarms",
"directory",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/ContextUtils.java#L114-L117
|
145,988
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/ContextUtils.java
|
ContextUtils.getExternalFilesDirForDcim
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForDcim(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_DCIM);
}
|
java
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForDcim(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_DCIM);
}
|
[
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"FROYO",
")",
"public",
"static",
"File",
"getExternalFilesDirForDcim",
"(",
"Context",
"context",
")",
"{",
"return",
"context",
".",
"getExternalFilesDir",
"(",
"Environment",
".",
"DIRECTORY_DCIM",
")",
";",
"}"
] |
Get the file points to an external dcim directory.
@param context the context.
@return the {@link java.io.File}.
|
[
"Get",
"the",
"file",
"points",
"to",
"an",
"external",
"dcim",
"directory",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/ContextUtils.java#L124-L127
|
145,989
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/ContextUtils.java
|
ContextUtils.getExternalFilesDirForNotifications
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForNotifications(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_NOTIFICATIONS);
}
|
java
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForNotifications(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_NOTIFICATIONS);
}
|
[
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"FROYO",
")",
"public",
"static",
"File",
"getExternalFilesDirForNotifications",
"(",
"Context",
"context",
")",
"{",
"return",
"context",
".",
"getExternalFilesDir",
"(",
"Environment",
".",
"DIRECTORY_NOTIFICATIONS",
")",
";",
"}"
] |
Get the file points to an external notifications directory.
@param context the context.
@return the {@link java.io.File}.
|
[
"Get",
"the",
"file",
"points",
"to",
"an",
"external",
"notifications",
"directory",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/ContextUtils.java#L134-L137
|
145,990
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/ContextUtils.java
|
ContextUtils.getExternalFilesDirForDownloads
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForDownloads(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
}
|
java
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForDownloads(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS);
}
|
[
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"FROYO",
")",
"public",
"static",
"File",
"getExternalFilesDirForDownloads",
"(",
"Context",
"context",
")",
"{",
"return",
"context",
".",
"getExternalFilesDir",
"(",
"Environment",
".",
"DIRECTORY_DOWNLOADS",
")",
";",
"}"
] |
Get the file points to an external downloads directory.
@param context the context.
@return the {@link java.io.File}.
|
[
"Get",
"the",
"file",
"points",
"to",
"an",
"external",
"downloads",
"directory",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/ContextUtils.java#L144-L147
|
145,991
|
nohana/Amalgam
|
amalgam/src/main/java/com/amalgam/content/ContextUtils.java
|
ContextUtils.getExternalFilesDirForRingtones
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForRingtones(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_RINGTONES);
}
|
java
|
@TargetApi(Build.VERSION_CODES.FROYO)
public static File getExternalFilesDirForRingtones(Context context) {
return context.getExternalFilesDir(Environment.DIRECTORY_RINGTONES);
}
|
[
"@",
"TargetApi",
"(",
"Build",
".",
"VERSION_CODES",
".",
"FROYO",
")",
"public",
"static",
"File",
"getExternalFilesDirForRingtones",
"(",
"Context",
"context",
")",
"{",
"return",
"context",
".",
"getExternalFilesDir",
"(",
"Environment",
".",
"DIRECTORY_RINGTONES",
")",
";",
"}"
] |
Get the file points to an external ringtones directory.
@param context the context.
@return the {@link java.io.File}.
|
[
"Get",
"the",
"file",
"points",
"to",
"an",
"external",
"ringtones",
"directory",
"."
] |
57809ddbfe7897e979cf507982ce0b3aa5e0ed8a
|
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/content/ContextUtils.java#L164-L167
|
145,992
|
optimaize/command4j
|
src/main/java/com/optimaize/command4j/ext/extensions/timeout/configurabletimeout/Util.java
|
Util.newExecutor
|
@NotNull
static ExecutorService newExecutor() {
ThreadPoolExecutor tpe = new ThreadPoolExecutor(0, 1, 10, TimeUnit.SECONDS, new SynchronousQueue<Runnable>());
tpe.allowCoreThreadTimeOut(true);
return tpe;
}
|
java
|
@NotNull
static ExecutorService newExecutor() {
ThreadPoolExecutor tpe = new ThreadPoolExecutor(0, 1, 10, TimeUnit.SECONDS, new SynchronousQueue<Runnable>());
tpe.allowCoreThreadTimeOut(true);
return tpe;
}
|
[
"@",
"NotNull",
"static",
"ExecutorService",
"newExecutor",
"(",
")",
"{",
"ThreadPoolExecutor",
"tpe",
"=",
"new",
"ThreadPoolExecutor",
"(",
"0",
",",
"1",
",",
"10",
",",
"TimeUnit",
".",
"SECONDS",
",",
"new",
"SynchronousQueue",
"<",
"Runnable",
">",
"(",
")",
")",
";",
"tpe",
".",
"allowCoreThreadTimeOut",
"(",
"true",
")",
";",
"return",
"tpe",
";",
"}"
] |
Creates an executor service with one thread that is removed automatically after 10 second idle time.
The pool is therefore garbage collected and shutdown automatically.
<p>This executor service can be used for situations, where a task should be executed immediately
in a separate thread and the pool is not kept around.</p>
impl notes: eike couldn't find a good place to put this class. thus for now it lives just here.
maybe in the future the same code will be used in other places too ... then it may be moved.
|
[
"Creates",
"an",
"executor",
"service",
"with",
"one",
"thread",
"that",
"is",
"removed",
"automatically",
"after",
"10",
"second",
"idle",
"time",
".",
"The",
"pool",
"is",
"therefore",
"garbage",
"collected",
"and",
"shutdown",
"automatically",
"."
] |
6d550759a4593c7941a1e0d760b407fa88833d71
|
https://github.com/optimaize/command4j/blob/6d550759a4593c7941a1e0d760b407fa88833d71/src/main/java/com/optimaize/command4j/ext/extensions/timeout/configurabletimeout/Util.java#L25-L30
|
145,993
|
OpenBEL/openbel-framework
|
org.openbel.framework.compiler/src/main/java/org/openbel/framework/compiler/kam/KAMStoreSchemaServiceImpl.java
|
KAMStoreSchemaServiceImpl.getSchemaManagementStatus
|
private boolean getSchemaManagementStatus(DBConnection dbc) {
boolean createSchemas = false;
if (dbc.isDerby()) {
createSchemas = true;
} else if (dbc.isMysql() || dbc.isPostgresql()) {
createSchemas = getSystemConfiguration().getSystemManagedSchemas();
}
return createSchemas;
}
|
java
|
private boolean getSchemaManagementStatus(DBConnection dbc) {
boolean createSchemas = false;
if (dbc.isDerby()) {
createSchemas = true;
} else if (dbc.isMysql() || dbc.isPostgresql()) {
createSchemas = getSystemConfiguration().getSystemManagedSchemas();
}
return createSchemas;
}
|
[
"private",
"boolean",
"getSchemaManagementStatus",
"(",
"DBConnection",
"dbc",
")",
"{",
"boolean",
"createSchemas",
"=",
"false",
";",
"if",
"(",
"dbc",
".",
"isDerby",
"(",
")",
")",
"{",
"createSchemas",
"=",
"true",
";",
"}",
"else",
"if",
"(",
"dbc",
".",
"isMysql",
"(",
")",
"||",
"dbc",
".",
"isPostgresql",
"(",
")",
")",
"{",
"createSchemas",
"=",
"getSystemConfiguration",
"(",
")",
".",
"getSystemManagedSchemas",
"(",
")",
";",
"}",
"return",
"createSchemas",
";",
"}"
] |
Check to see if the system is managing the KAMStore schemas. The system manages Derby schemas
by default. Oracle is only DBA managed and MySQL can be either although the default is to
enable system managed
@param dbc
@return
|
[
"Check",
"to",
"see",
"if",
"the",
"system",
"is",
"managing",
"the",
"KAMStore",
"schemas",
".",
"The",
"system",
"manages",
"Derby",
"schemas",
"by",
"default",
".",
"Oracle",
"is",
"only",
"DBA",
"managed",
"and",
"MySQL",
"can",
"be",
"either",
"although",
"the",
"default",
"is",
"to",
"enable",
"system",
"managed"
] |
149f80b1d6eabb15ab15815b6f745b0afa9fd2d3
|
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.compiler/src/main/java/org/openbel/framework/compiler/kam/KAMStoreSchemaServiceImpl.java#L167-L176
|
145,994
|
ops4j/org.ops4j.pax.exam1
|
pax-exam/src/main/java/org/ops4j/pax/exam/OptionUtils.java
|
OptionUtils.combine
|
public static Option[] combine( final Option[] options1,
final Option... options2 )
{
int size1 = 0;
if( options1 != null && options1.length > 0 )
{
size1 += options1.length;
}
int size2 = 0;
if( options2 != null && options2.length > 0 )
{
size2 += options2.length;
}
final Option[] combined = new Option[size1 + size2];
if( size1 > 0 )
{
System.arraycopy( options1, 0, combined, 0, size1 );
}
if( size2 > 0 )
{
System.arraycopy( options2, 0, combined, size1, size2 );
}
return combined;
}
|
java
|
public static Option[] combine( final Option[] options1,
final Option... options2 )
{
int size1 = 0;
if( options1 != null && options1.length > 0 )
{
size1 += options1.length;
}
int size2 = 0;
if( options2 != null && options2.length > 0 )
{
size2 += options2.length;
}
final Option[] combined = new Option[size1 + size2];
if( size1 > 0 )
{
System.arraycopy( options1, 0, combined, 0, size1 );
}
if( size2 > 0 )
{
System.arraycopy( options2, 0, combined, size1, size2 );
}
return combined;
}
|
[
"public",
"static",
"Option",
"[",
"]",
"combine",
"(",
"final",
"Option",
"[",
"]",
"options1",
",",
"final",
"Option",
"...",
"options2",
")",
"{",
"int",
"size1",
"=",
"0",
";",
"if",
"(",
"options1",
"!=",
"null",
"&&",
"options1",
".",
"length",
">",
"0",
")",
"{",
"size1",
"+=",
"options1",
".",
"length",
";",
"}",
"int",
"size2",
"=",
"0",
";",
"if",
"(",
"options2",
"!=",
"null",
"&&",
"options2",
".",
"length",
">",
"0",
")",
"{",
"size2",
"+=",
"options2",
".",
"length",
";",
"}",
"final",
"Option",
"[",
"]",
"combined",
"=",
"new",
"Option",
"[",
"size1",
"+",
"size2",
"]",
";",
"if",
"(",
"size1",
">",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"options1",
",",
"0",
",",
"combined",
",",
"0",
",",
"size1",
")",
";",
"}",
"if",
"(",
"size2",
">",
"0",
")",
"{",
"System",
".",
"arraycopy",
"(",
"options2",
",",
"0",
",",
"combined",
",",
"size1",
",",
"size2",
")",
";",
"}",
"return",
"combined",
";",
"}"
] |
Combines two arrays of options in one array containing both provided arrays in order they are provided.
@param options1 array of options (can be null or empty array)
@param options2 array of options (can be null or empty array)
@return combined array of options (never null). In case that both arrays are null or empty an empty array is
returned
|
[
"Combines",
"two",
"arrays",
"of",
"options",
"in",
"one",
"array",
"containing",
"both",
"provided",
"arrays",
"in",
"order",
"they",
"are",
"provided",
"."
] |
7c8742208117ff91bd24bcd3a185d2d019f7000f
|
https://github.com/ops4j/org.ops4j.pax.exam1/blob/7c8742208117ff91bd24bcd3a185d2d019f7000f/pax-exam/src/main/java/org/ops4j/pax/exam/OptionUtils.java#L83-L106
|
145,995
|
ops4j/org.ops4j.pax.exam1
|
pax-exam/src/main/java/org/ops4j/pax/exam/OptionUtils.java
|
OptionUtils.remove
|
public static Option[] remove( final Class<? extends Option> optionType,
final Option... options )
{
final List<Option> filtered = new ArrayList<Option>();
for( Option option : expand( options ) )
{
if( !optionType.isAssignableFrom( option.getClass() ) )
{
filtered.add( option );
}
}
return filtered.toArray( new Option[filtered.size()] );
}
|
java
|
public static Option[] remove( final Class<? extends Option> optionType,
final Option... options )
{
final List<Option> filtered = new ArrayList<Option>();
for( Option option : expand( options ) )
{
if( !optionType.isAssignableFrom( option.getClass() ) )
{
filtered.add( option );
}
}
return filtered.toArray( new Option[filtered.size()] );
}
|
[
"public",
"static",
"Option",
"[",
"]",
"remove",
"(",
"final",
"Class",
"<",
"?",
"extends",
"Option",
">",
"optionType",
",",
"final",
"Option",
"...",
"options",
")",
"{",
"final",
"List",
"<",
"Option",
">",
"filtered",
"=",
"new",
"ArrayList",
"<",
"Option",
">",
"(",
")",
";",
"for",
"(",
"Option",
"option",
":",
"expand",
"(",
"options",
")",
")",
"{",
"if",
"(",
"!",
"optionType",
".",
"isAssignableFrom",
"(",
"option",
".",
"getClass",
"(",
")",
")",
")",
"{",
"filtered",
".",
"add",
"(",
"option",
")",
";",
"}",
"}",
"return",
"filtered",
".",
"toArray",
"(",
"new",
"Option",
"[",
"filtered",
".",
"size",
"(",
")",
"]",
")",
";",
"}"
] |
Removes from the provided options all options that are instance of the provided class, returning the remaining
options.
@param optionType class of the desired options to be removed
@param options options to be filtered (can be null or empty array)
@return array of remaining options (never null) after removing the desired type
|
[
"Removes",
"from",
"the",
"provided",
"options",
"all",
"options",
"that",
"are",
"instance",
"of",
"the",
"provided",
"class",
"returning",
"the",
"remaining",
"options",
"."
] |
7c8742208117ff91bd24bcd3a185d2d019f7000f
|
https://github.com/ops4j/org.ops4j.pax.exam1/blob/7c8742208117ff91bd24bcd3a185d2d019f7000f/pax-exam/src/main/java/org/ops4j/pax/exam/OptionUtils.java#L145-L157
|
145,996
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/resources/MFSResource.java
|
MFSResource.createSpan
|
private String createSpan(final List<String> lemmas, final int from,
final int to) {
String lemmaSpan = "";
for (int i = from; i < to; i++) {
lemmaSpan += lemmas.get(i) + "_";
}
lemmaSpan += lemmas.get(to);
return lemmaSpan;
}
|
java
|
private String createSpan(final List<String> lemmas, final int from,
final int to) {
String lemmaSpan = "";
for (int i = from; i < to; i++) {
lemmaSpan += lemmas.get(i) + "_";
}
lemmaSpan += lemmas.get(to);
return lemmaSpan;
}
|
[
"private",
"String",
"createSpan",
"(",
"final",
"List",
"<",
"String",
">",
"lemmas",
",",
"final",
"int",
"from",
",",
"final",
"int",
"to",
")",
"{",
"String",
"lemmaSpan",
"=",
"\"\"",
";",
"for",
"(",
"int",
"i",
"=",
"from",
";",
"i",
"<",
"to",
";",
"i",
"++",
")",
"{",
"lemmaSpan",
"+=",
"lemmas",
".",
"get",
"(",
"i",
")",
"+",
"\"_\"",
";",
"}",
"lemmaSpan",
"+=",
"lemmas",
".",
"get",
"(",
"to",
")",
";",
"return",
"lemmaSpan",
";",
"}"
] |
Create lemma span for search of multiwords in MFS dictionary.
@param lemmas
the lemmas of the sentence
@param from
the starting index
@param to
the end index
@return the string representing a perhaps multi word entry
|
[
"Create",
"lemma",
"span",
"for",
"search",
"of",
"multiwords",
"in",
"MFS",
"dictionary",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/resources/MFSResource.java#L244-L252
|
145,997
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/resources/MFSResource.java
|
MFSResource.getMFSRanking
|
public TreeMultimap<Integer, String> getMFSRanking(final String lemmaPOSClass,
final Integer rankSize) {
final TreeMultimap<Integer, String> mfsResultsMap = getOrderedMap(
lemmaPOSClass);
final TreeMultimap<Integer, String> mfsRankMap = TreeMultimap
.create(Ordering.natural().reverse(), Ordering.natural());
for (final Map.Entry<Integer, String> freqSenseEntry : Iterables
.limit(mfsResultsMap.entries(), rankSize)) {
mfsRankMap.put(freqSenseEntry.getKey(), freqSenseEntry.getValue());
}
return mfsRankMap;
}
|
java
|
public TreeMultimap<Integer, String> getMFSRanking(final String lemmaPOSClass,
final Integer rankSize) {
final TreeMultimap<Integer, String> mfsResultsMap = getOrderedMap(
lemmaPOSClass);
final TreeMultimap<Integer, String> mfsRankMap = TreeMultimap
.create(Ordering.natural().reverse(), Ordering.natural());
for (final Map.Entry<Integer, String> freqSenseEntry : Iterables
.limit(mfsResultsMap.entries(), rankSize)) {
mfsRankMap.put(freqSenseEntry.getKey(), freqSenseEntry.getValue());
}
return mfsRankMap;
}
|
[
"public",
"TreeMultimap",
"<",
"Integer",
",",
"String",
">",
"getMFSRanking",
"(",
"final",
"String",
"lemmaPOSClass",
",",
"final",
"Integer",
"rankSize",
")",
"{",
"final",
"TreeMultimap",
"<",
"Integer",
",",
"String",
">",
"mfsResultsMap",
"=",
"getOrderedMap",
"(",
"lemmaPOSClass",
")",
";",
"final",
"TreeMultimap",
"<",
"Integer",
",",
"String",
">",
"mfsRankMap",
"=",
"TreeMultimap",
".",
"create",
"(",
"Ordering",
".",
"natural",
"(",
")",
".",
"reverse",
"(",
")",
",",
"Ordering",
".",
"natural",
"(",
")",
")",
";",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"String",
">",
"freqSenseEntry",
":",
"Iterables",
".",
"limit",
"(",
"mfsResultsMap",
".",
"entries",
"(",
")",
",",
"rankSize",
")",
")",
"{",
"mfsRankMap",
".",
"put",
"(",
"freqSenseEntry",
".",
"getKey",
"(",
")",
",",
"freqSenseEntry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"mfsRankMap",
";",
"}"
] |
Get a rank of senses ordered by MFS.
@param lemmaPOSClass
the lemma#pos entry
@param rankSize
the size of the rank
@return the ordered multimap containing the rank
|
[
"Get",
"a",
"rank",
"of",
"senses",
"ordered",
"by",
"MFS",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/resources/MFSResource.java#L311-L323
|
145,998
|
ixa-ehu/ixa-pipe-ml
|
src/main/java/eus/ixa/ixa/pipe/ml/resources/MFSResource.java
|
MFSResource.serialize
|
public void serialize(final OutputStream out) throws IOException {
final Writer writer = new BufferedWriter(new OutputStreamWriter(out));
for (final Map.Entry<String, String> entry : this.multiMap.entries()) {
writer.write(
entry.getKey() + IOUtils.TAB_DELIMITER + entry.getValue() + "\n");
}
writer.flush();
}
|
java
|
public void serialize(final OutputStream out) throws IOException {
final Writer writer = new BufferedWriter(new OutputStreamWriter(out));
for (final Map.Entry<String, String> entry : this.multiMap.entries()) {
writer.write(
entry.getKey() + IOUtils.TAB_DELIMITER + entry.getValue() + "\n");
}
writer.flush();
}
|
[
"public",
"void",
"serialize",
"(",
"final",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"final",
"Writer",
"writer",
"=",
"new",
"BufferedWriter",
"(",
"new",
"OutputStreamWriter",
"(",
"out",
")",
")",
";",
"for",
"(",
"final",
"Map",
".",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
":",
"this",
".",
"multiMap",
".",
"entries",
"(",
")",
")",
"{",
"writer",
".",
"write",
"(",
"entry",
".",
"getKey",
"(",
")",
"+",
"IOUtils",
".",
"TAB_DELIMITER",
"+",
"entry",
".",
"getValue",
"(",
")",
"+",
"\"\\n\"",
")",
";",
"}",
"writer",
".",
"flush",
"(",
")",
";",
"}"
] |
Serialize the lexicon in the original format.
@param out
the output stream
@throws IOException
if io problems
|
[
"Serialize",
"the",
"lexicon",
"in",
"the",
"original",
"format",
"."
] |
c817fa1e40e96ed15fc79d22c3a7c25f1a40d172
|
https://github.com/ixa-ehu/ixa-pipe-ml/blob/c817fa1e40e96ed15fc79d22c3a7c25f1a40d172/src/main/java/eus/ixa/ixa/pipe/ml/resources/MFSResource.java#L333-L340
|
145,999
|
astrapi69/jaulp-wicket
|
jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/application/OnlineSessionUsers.java
|
OnlineSessionUsers.replaceSessionId
|
public synchronized ID replaceSessionId(final USER user, final ID oldSessionId,
final ID newSessionId, final SESSION newSession)
{
remove(oldSessionId);
return addOnline(user, newSessionId, newSession);
}
|
java
|
public synchronized ID replaceSessionId(final USER user, final ID oldSessionId,
final ID newSessionId, final SESSION newSession)
{
remove(oldSessionId);
return addOnline(user, newSessionId, newSession);
}
|
[
"public",
"synchronized",
"ID",
"replaceSessionId",
"(",
"final",
"USER",
"user",
",",
"final",
"ID",
"oldSessionId",
",",
"final",
"ID",
"newSessionId",
",",
"final",
"SESSION",
"newSession",
")",
"{",
"remove",
"(",
"oldSessionId",
")",
";",
"return",
"addOnline",
"(",
"user",
",",
"newSessionId",
",",
"newSession",
")",
";",
"}"
] |
Replace the given old session id with the new one.
@param user
the user
@param oldSessionId
the old session id
@param newSessionId
the new session id
@param newSession
the new session object
@return the new session id that is associated with the given user.
|
[
"Replace",
"the",
"given",
"old",
"session",
"id",
"with",
"the",
"new",
"one",
"."
] |
85d74368d00abd9bb97659b5794e38c0f8a013d4
|
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-base/src/main/java/de/alpharogroup/wicket/base/application/OnlineSessionUsers.java#L129-L134
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.