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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
11,600
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/ByteArrayHolder.java
|
ByteArrayHolder.ensureHasSpace
|
public void ensureHasSpace(int numBytesToAdd) {
if (numBytesToAdd < 0) {
throw new IllegalArgumentException("Number of bytes can't be negative");
}
int capacityLeft = getCapacityLeft();
if (capacityLeft < numBytesToAdd) {
grow(numBytesToAdd - capacityLeft, true);
}
}
|
java
|
public void ensureHasSpace(int numBytesToAdd) {
if (numBytesToAdd < 0) {
throw new IllegalArgumentException("Number of bytes can't be negative");
}
int capacityLeft = getCapacityLeft();
if (capacityLeft < numBytesToAdd) {
grow(numBytesToAdd - capacityLeft, true);
}
}
|
[
"public",
"void",
"ensureHasSpace",
"(",
"int",
"numBytesToAdd",
")",
"{",
"if",
"(",
"numBytesToAdd",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Number of bytes can't be negative\"",
")",
";",
"}",
"int",
"capacityLeft",
"=",
"getCapacityLeft",
"(",
")",
";",
"if",
"(",
"capacityLeft",
"<",
"numBytesToAdd",
")",
"{",
"grow",
"(",
"numBytesToAdd",
"-",
"capacityLeft",
",",
"true",
")",
";",
"}",
"}"
] |
Checks if there is enough space in the buffer to write N additional bytes. Will grow the buffer
if necessary. It takes current position in the buffer into account.
@param numBytesToAdd the number of bytes you want to add to the buffer
|
[
"Checks",
"if",
"there",
"is",
"enough",
"space",
"in",
"the",
"buffer",
"to",
"write",
"N",
"additional",
"bytes",
".",
"Will",
"grow",
"the",
"buffer",
"if",
"necessary",
".",
"It",
"takes",
"current",
"position",
"in",
"the",
"buffer",
"into",
"account",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/ByteArrayHolder.java#L322-L330
|
11,601
|
jboss/jboss-el-api_spec
|
src/main/java/javax/el/BeanNameELResolver.java
|
BeanNameELResolver.setValue
|
@Override
public void setValue(ELContext context, Object base, Object property,
Object value) {
if (context == null) {
throw new NullPointerException();
}
if (base == null && property instanceof String) {
String beanName = (String) property;
if (beanNameResolver.isNameResolved(beanName) ||
beanNameResolver.canCreateBean(beanName)) {
beanNameResolver.setBeanValue(beanName, value);
context.setPropertyResolved(base, property);
}
}
}
|
java
|
@Override
public void setValue(ELContext context, Object base, Object property,
Object value) {
if (context == null) {
throw new NullPointerException();
}
if (base == null && property instanceof String) {
String beanName = (String) property;
if (beanNameResolver.isNameResolved(beanName) ||
beanNameResolver.canCreateBean(beanName)) {
beanNameResolver.setBeanValue(beanName, value);
context.setPropertyResolved(base, property);
}
}
}
|
[
"@",
"Override",
"public",
"void",
"setValue",
"(",
"ELContext",
"context",
",",
"Object",
"base",
",",
"Object",
"property",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"if",
"(",
"base",
"==",
"null",
"&&",
"property",
"instanceof",
"String",
")",
"{",
"String",
"beanName",
"=",
"(",
"String",
")",
"property",
";",
"if",
"(",
"beanNameResolver",
".",
"isNameResolved",
"(",
"beanName",
")",
"||",
"beanNameResolver",
".",
"canCreateBean",
"(",
"beanName",
")",
")",
"{",
"beanNameResolver",
".",
"setBeanValue",
"(",
"beanName",
",",
"value",
")",
";",
"context",
".",
"setPropertyResolved",
"(",
"base",
",",
"property",
")",
";",
"}",
"}",
"}"
] |
If the base is null and the property is a name that is resolvable by
the BeanNameResolver, the bean in the BeanNameResolver is set to the
given value.
<p>If the name is resolvable by the BeanNameResolver, or if the
BeanNameResolver allows creating a new bean,
the <code>propertyResolved</code> property of the
<code>ELContext</code> object must be set to <code>true</code>
by the resolver, before returning. If this property is not
<code>true</code> after this method is called, the caller can
safely assume no value has been set.</p>
@param context The context of this evaluation.
@param base <code>null</code>
@param property The name of the bean
@param value The value to set the bean with the given name to.
@throws NullPointerException if context is <code>null</code>
@throws PropertyNotWritableException if the BeanNameResolver does not
allow the bean to be modified.
@throws ELException if an exception was thrown while attempting to
set the bean with the given name. The thrown exception
must be included as the cause property of this exception, if
available.
|
[
"If",
"the",
"base",
"is",
"null",
"and",
"the",
"property",
"is",
"a",
"name",
"that",
"is",
"resolvable",
"by",
"the",
"BeanNameResolver",
"the",
"bean",
"in",
"the",
"BeanNameResolver",
"is",
"set",
"to",
"the",
"given",
"value",
"."
] |
4cef117cae3ccf9f76439845687a8d219ad2eb43
|
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/BeanNameELResolver.java#L139-L154
|
11,602
|
jboss/jboss-el-api_spec
|
src/main/java/javax/el/BeanNameELResolver.java
|
BeanNameELResolver.getType
|
@Override
public Class<?> getType(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
if (base == null && property instanceof String) {
if (beanNameResolver.isNameResolved((String) property)) {
context.setPropertyResolved(true);
return beanNameResolver.getBean((String) property).getClass();
}
}
return null;
}
|
java
|
@Override
public Class<?> getType(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
if (base == null && property instanceof String) {
if (beanNameResolver.isNameResolved((String) property)) {
context.setPropertyResolved(true);
return beanNameResolver.getBean((String) property).getClass();
}
}
return null;
}
|
[
"@",
"Override",
"public",
"Class",
"<",
"?",
">",
"getType",
"(",
"ELContext",
"context",
",",
"Object",
"base",
",",
"Object",
"property",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"if",
"(",
"base",
"==",
"null",
"&&",
"property",
"instanceof",
"String",
")",
"{",
"if",
"(",
"beanNameResolver",
".",
"isNameResolved",
"(",
"(",
"String",
")",
"property",
")",
")",
"{",
"context",
".",
"setPropertyResolved",
"(",
"true",
")",
";",
"return",
"beanNameResolver",
".",
"getBean",
"(",
"(",
"String",
")",
"property",
")",
".",
"getClass",
"(",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
If the base is null and the property is a name resolvable by
the BeanNameResolver, return the type of the bean.
<p>If the name is resolvable by the BeanNameResolver,
the <code>propertyResolved</code> property of the
<code>ELContext</code> object must be set to <code>true</code>
by the resolver, before returning. If this property is not
<code>true</code> after this method is called, the caller can
safely assume no value has been set.</p>
@param context The context of this evaluation.
@param base <code>null</code>
@param property The name of the bean.
@return If the <code>propertyResolved</code> property of
<code>ELContext</code> was set to <code>true</code>, then
the type of the bean with the given name. Otherwise, undefined.
@throws NullPointerException if context is <code>null</code>.
@throws ELException if an exception was thrown while performing
the property or variable resolution. The thrown exception
must be included as the cause property of this exception, if
available.
|
[
"If",
"the",
"base",
"is",
"null",
"and",
"the",
"property",
"is",
"a",
"name",
"resolvable",
"by",
"the",
"BeanNameResolver",
"return",
"the",
"type",
"of",
"the",
"bean",
"."
] |
4cef117cae3ccf9f76439845687a8d219ad2eb43
|
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/BeanNameELResolver.java#L179-L193
|
11,603
|
jboss/jboss-el-api_spec
|
src/main/java/javax/el/BeanNameELResolver.java
|
BeanNameELResolver.isReadOnly
|
@Override
public boolean isReadOnly(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
if (base == null && property instanceof String) {
if (beanNameResolver.isNameResolved((String) property)) {
context.setPropertyResolved(true);
return beanNameResolver.isReadOnly((String) property);
}
}
return false;
}
|
java
|
@Override
public boolean isReadOnly(ELContext context, Object base, Object property) {
if (context == null) {
throw new NullPointerException();
}
if (base == null && property instanceof String) {
if (beanNameResolver.isNameResolved((String) property)) {
context.setPropertyResolved(true);
return beanNameResolver.isReadOnly((String) property);
}
}
return false;
}
|
[
"@",
"Override",
"public",
"boolean",
"isReadOnly",
"(",
"ELContext",
"context",
",",
"Object",
"base",
",",
"Object",
"property",
")",
"{",
"if",
"(",
"context",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"if",
"(",
"base",
"==",
"null",
"&&",
"property",
"instanceof",
"String",
")",
"{",
"if",
"(",
"beanNameResolver",
".",
"isNameResolved",
"(",
"(",
"String",
")",
"property",
")",
")",
"{",
"context",
".",
"setPropertyResolved",
"(",
"true",
")",
";",
"return",
"beanNameResolver",
".",
"isReadOnly",
"(",
"(",
"String",
")",
"property",
")",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
If the base is null and the property is a name resolvable by
the BeanNameResolver, attempts to determine if the bean is writable.
<p>If the name is resolvable by the BeanNameResolver,
the <code>propertyResolved</code> property of the
<code>ELContext</code> object must be set to <code>true</code>
by the resolver, before returning. If this property is not
<code>true</code> after this method is called, the caller can
safely assume no value has been set.</p>
@param context The context of this evaluation.
@param base <code>null</code>
@param property The name of the bean.
@return If the <code>propertyResolved</code> property of
<code>ELContext</code> was set to <code>true</code>, then
<code>true</code> if the property is read-only or
<code>false</code> if not; otherwise undefined.
@throws NullPointerException if context is <code>null</code>.
@throws ELException if an exception was thrown while performing
the property or variable resolution. The thrown exception
must be included as the cause property of this exception, if
available.
|
[
"If",
"the",
"base",
"is",
"null",
"and",
"the",
"property",
"is",
"a",
"name",
"resolvable",
"by",
"the",
"BeanNameResolver",
"attempts",
"to",
"determine",
"if",
"the",
"bean",
"is",
"writable",
"."
] |
4cef117cae3ccf9f76439845687a8d219ad2eb43
|
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/BeanNameELResolver.java#L219-L232
|
11,604
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
|
TiffITProfile.validateIfdLW
|
private void validateIfdLW(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
if (p == 0) {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{4});
} else {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8});
}
checkRequiredTag(metadata, "Compression", 1, new long[]{32896});
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
}
if (p == 1) {
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ColorTable", -1);
}
|
java
|
private void validateIfdLW(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
if (p == 0) {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{4});
} else {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8});
}
checkRequiredTag(metadata, "Compression", 1, new long[]{32896});
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
}
if (p == 1) {
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ColorTable", -1);
}
|
[
"private",
"void",
"validateIfdLW",
"(",
"IFD",
"ifd",
",",
"int",
"p",
")",
"{",
"IfdTags",
"metadata",
"=",
"ifd",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NewSubfileType\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageLength\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageWidth\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"SamplesPerPixel\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BitsPerSample\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"4",
"}",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BitsPerSample\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"8",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Compression\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"32896",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PhotometricInterpretation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"5",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripOffsets\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"1",
"||",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripBYTECount\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"XResolution\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"YResolution\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"1",
"||",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ResolutionUnit\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"2",
",",
"3",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"InkSet\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NumberOfInks\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"4",
"}",
")",
";",
"}",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"DotRange\"",
",",
"2",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"255",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ColorTable\"",
",",
"-",
"1",
")",
";",
"}"
] |
Validate Line Work.
@param ifd the ifd
@param p the profile (default = 0, P1 = 1, P2 = 2)
|
[
"Validate",
"Line",
"Work",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L332-L364
|
11,605
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
|
TiffITProfile.validateIfdHC
|
private void validateIfdHC(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
int spp = -1;
if (metadata.containsTagId(TiffTags.getTagId("SampesPerPixel"))) {
spp = (int)metadata.get(TiffTags.getTagId("SampesPerPixel")).getFirstNumericValue();
}
if (p == 1) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "BitsPerSample", spp);
if (p == 1) {
checkRequiredTag(metadata, "BitsPerSample", 4, new long[]{8});
}
checkRequiredTag(metadata, "Compression", 1, new long[]{32897});
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
if (p == 1) {
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{4});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{1});
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "TransparencyIndicator", 1, new long[]{0, 1});
}
|
java
|
private void validateIfdHC(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
int spp = -1;
if (metadata.containsTagId(TiffTags.getTagId("SampesPerPixel"))) {
spp = (int)metadata.get(TiffTags.getTagId("SampesPerPixel")).getFirstNumericValue();
}
if (p == 1) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "BitsPerSample", spp);
if (p == 1) {
checkRequiredTag(metadata, "BitsPerSample", 4, new long[]{8});
}
checkRequiredTag(metadata, "Compression", 1, new long[]{32897});
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
if (p == 1) {
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{4});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{1});
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "TransparencyIndicator", 1, new long[]{0, 1});
}
|
[
"private",
"void",
"validateIfdHC",
"(",
"IFD",
"ifd",
",",
"int",
"p",
")",
"{",
"IfdTags",
"metadata",
"=",
"ifd",
".",
"getMetadata",
"(",
")",
";",
"int",
"spp",
"=",
"-",
"1",
";",
"if",
"(",
"metadata",
".",
"containsTagId",
"(",
"TiffTags",
".",
"getTagId",
"(",
"\"SampesPerPixel\"",
")",
")",
")",
"{",
"spp",
"=",
"(",
"int",
")",
"metadata",
".",
"get",
"(",
"TiffTags",
".",
"getTagId",
"(",
"\"SampesPerPixel\"",
")",
")",
".",
"getFirstNumericValue",
"(",
")",
";",
"}",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NewSubfileType\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageLength\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageWidth\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BitsPerSample\"",
",",
"spp",
")",
";",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BitsPerSample\"",
",",
"4",
",",
"new",
"long",
"[",
"]",
"{",
"8",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Compression\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"32897",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PhotometricInterpretation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"5",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripOffsets\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"1",
"||",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"SamplesPerPixel\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"4",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripBYTECount\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"XResolution\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"YResolution\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PlanarConfiguration\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"if",
"(",
"p",
"==",
"1",
"||",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ResolutionUnit\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"2",
",",
"3",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"InkSet\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NumberOfInks\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"4",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"DotRange\"",
",",
"2",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"255",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"TransparencyIndicator\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"1",
"}",
")",
";",
"}"
] |
Validate High-Resolution Continuous-Tone.
@param ifd the ifd
@param p the profile (default = 0, P1 = 1, P2 = 2)
|
[
"Validate",
"High",
"-",
"Resolution",
"Continuous",
"-",
"Tone",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L372-L408
|
11,606
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
|
TiffITProfile.validateIfdMP
|
private void validateIfdMP(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
if (p == 1) {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8, 16});
} else {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8});
}
if (p == 0) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,7,8,32895});
} else if (p == 1) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1});
} else {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,7,8});
}
if (p == 0) {
checkRequiredTag(metadata, "PhotometricInterpretation", 1);
} else {
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {0});
}
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
if (p == 1) {
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
checkRequiredTag(metadata, "PixelIntensityRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ImageColorIndicator", 1, new long[]{0, 1});
}
|
java
|
private void validateIfdMP(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
if (p == 1) {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8, 16});
} else {
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{8});
}
if (p == 0) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,7,8,32895});
} else if (p == 1) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1});
} else {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,7,8});
}
if (p == 0) {
checkRequiredTag(metadata, "PhotometricInterpretation", 1);
} else {
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {0});
}
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
if (p == 1) {
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
checkRequiredTag(metadata, "PixelIntensityRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ImageColorIndicator", 1, new long[]{0, 1});
}
|
[
"private",
"void",
"validateIfdMP",
"(",
"IFD",
"ifd",
",",
"int",
"p",
")",
"{",
"IfdTags",
"metadata",
"=",
"ifd",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"p",
"==",
"1",
"||",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NewSubfileType\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageLength\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageWidth\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BitsPerSample\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"8",
",",
"16",
"}",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BitsPerSample\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"8",
"}",
")",
";",
"}",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Compression\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"7",
",",
"8",
",",
"32895",
"}",
")",
";",
"}",
"else",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Compression\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Compression\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"7",
",",
"8",
"}",
")",
";",
"}",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PhotometricInterpretation\"",
",",
"1",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PhotometricInterpretation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripOffsets\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"4",
",",
"5",
",",
"8",
"}",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"SamplesPerPixel\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripBYTECount\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"XResolution\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"YResolution\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"1",
"||",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ResolutionUnit\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"2",
",",
"3",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"DotRange\"",
",",
"2",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"255",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PixelIntensityRange\"",
",",
"2",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"255",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageColorIndicator\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"1",
"}",
")",
";",
"}"
] |
Validate Monochrome Picture.
@param ifd the ifd
@param p the profile (default = 0, P1 = 1, P2 = 2)
|
[
"Validate",
"Monochrome",
"Picture",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L416-L459
|
11,607
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
|
TiffITProfile.validateIfdBP
|
private void validateIfdBP(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{1});
if (p == 0) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,4,8});
} else if (p == 1) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1});
} else {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,4,8});
}
if (p == 0) {
checkRequiredTag(metadata, "PhotometricInterpretation", 1);
} else {
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {0});
}
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ImageColorIndicator", 1, new long[]{0, 1, 2});
checkRequiredTag(metadata, "BackgroundColorIndicator", 1, new long[]{0, 1, 2});
}
|
java
|
private void validateIfdBP(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{1});
if (p == 0) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,4,8});
} else if (p == 1) {
checkRequiredTag(metadata, "Compression", 1, new long[]{1});
} else {
checkRequiredTag(metadata, "Compression", 1, new long[]{1,4,8});
}
if (p == 0) {
checkRequiredTag(metadata, "PhotometricInterpretation", 1);
} else {
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {0});
}
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ImageColorIndicator", 1, new long[]{0, 1, 2});
checkRequiredTag(metadata, "BackgroundColorIndicator", 1, new long[]{0, 1, 2});
}
|
[
"private",
"void",
"validateIfdBP",
"(",
"IFD",
"ifd",
",",
"int",
"p",
")",
"{",
"IfdTags",
"metadata",
"=",
"ifd",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"p",
"==",
"1",
"||",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NewSubfileType\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageLength\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageWidth\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BitsPerSample\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Compression\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"4",
",",
"8",
"}",
")",
";",
"}",
"else",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Compression\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Compression\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"4",
",",
"8",
"}",
")",
";",
"}",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PhotometricInterpretation\"",
",",
"1",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PhotometricInterpretation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripOffsets\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"4",
",",
"5",
",",
"8",
"}",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"SamplesPerPixel\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripBYTECount\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"XResolution\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"YResolution\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"1",
"||",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ResolutionUnit\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"2",
",",
"3",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"DotRange\"",
",",
"2",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"255",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageColorIndicator\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"1",
",",
"2",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BackgroundColorIndicator\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"1",
",",
"2",
"}",
")",
";",
"}"
] |
Validate Binary Picture.
@param ifd the ifd
@param p the profile (default = 0, P1 = 1, P2 = 2)
|
[
"Validate",
"Binary",
"Picture",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L467-L504
|
11,608
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
|
TiffITProfile.validateIfdBL
|
private void validateIfdBL(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{1});
checkRequiredTag(metadata, "Compression", 1, new long[]{32898});
if (p == 0) {
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {0, 1});
} else {
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {0});
}
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ImageColorIndicator", 1, new long[]{0, 1, 2});
checkRequiredTag(metadata, "BackgroundColorIndicator", 1, new long[]{0, 1, 2});
}
|
java
|
private void validateIfdBL(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 1) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{1});
checkRequiredTag(metadata, "Compression", 1, new long[]{32898});
if (p == 0) {
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {0, 1});
} else {
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {0});
}
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1});
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
if (p == 1) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "DotRange", 2, new long[]{0, 255});
}
checkRequiredTag(metadata, "ImageColorIndicator", 1, new long[]{0, 1, 2});
checkRequiredTag(metadata, "BackgroundColorIndicator", 1, new long[]{0, 1, 2});
}
|
[
"private",
"void",
"validateIfdBL",
"(",
"IFD",
"ifd",
",",
"int",
"p",
")",
"{",
"IfdTags",
"metadata",
"=",
"ifd",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NewSubfileType\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageLength\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageWidth\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BitsPerSample\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Compression\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"32898",
"}",
")",
";",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PhotometricInterpretation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"1",
"}",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PhotometricInterpretation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripOffsets\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"4",
",",
"5",
",",
"8",
"}",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"SamplesPerPixel\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripBYTECount\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"XResolution\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"YResolution\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"1",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ResolutionUnit\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"2",
",",
"3",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"DotRange\"",
",",
"2",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"255",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageColorIndicator\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"1",
",",
"2",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BackgroundColorIndicator\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"1",
",",
"2",
"}",
")",
";",
"}"
] |
Validate Binary Lineart.
@param ifd the ifd
@param p the profile (default = 0, P1 = 1)
|
[
"Validate",
"Binary",
"Lineart",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L512-L543
|
11,609
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
|
TiffITProfile.validateIfdSD
|
private void validateIfdSD(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 2) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{1});
checkRequiredTag(metadata, "Compression", 1, new long[]{1,4,8});
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
if (p == 2) {
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1,4});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2});
if (p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
}
checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
checkRequiredTag(metadata, "BackgroundColorIndicator", 1, new long[]{0, 1, 2});
}
|
java
|
private void validateIfdSD(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
if (p == 2) {
checkRequiredTag(metadata, "NewSubfileType", 1, new long[]{0});
}
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "BitsPerSample", 1, new long[]{1});
checkRequiredTag(metadata, "Compression", 1, new long[]{1,4,8});
checkRequiredTag(metadata, "PhotometricInterpretation", 1, new long[] {5});
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
if (p == 2) {
checkRequiredTag(metadata, "SamplesPerPixel", 1, new long[]{1,4});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2});
if (p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
}
checkRequiredTag(metadata, "InkSet", 1, new long[]{1});
checkRequiredTag(metadata, "BackgroundColorIndicator", 1, new long[]{0, 1, 2});
}
|
[
"private",
"void",
"validateIfdSD",
"(",
"IFD",
"ifd",
",",
"int",
"p",
")",
"{",
"IfdTags",
"metadata",
"=",
"ifd",
".",
"getMetadata",
"(",
")",
";",
"if",
"(",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NewSubfileType\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageLength\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageWidth\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BitsPerSample\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Compression\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"4",
",",
"8",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PhotometricInterpretation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"5",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripOffsets\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"4",
",",
"5",
",",
"8",
"}",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"if",
"(",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"SamplesPerPixel\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"4",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripBYTECount\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"XResolution\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"YResolution\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PlanarConfiguration\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"2",
"}",
")",
";",
"if",
"(",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ResolutionUnit\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"2",
",",
"3",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NumberOfInks\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"4",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"InkSet\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"BackgroundColorIndicator\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
",",
"1",
",",
"2",
"}",
")",
";",
"}"
] |
Validate Screened Data image.
@param ifd the ifd
@param p the profile (default = 0, P2 = 2)
|
[
"Validate",
"Screened",
"Data",
"image",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L551-L581
|
11,610
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
|
TiffITProfile.validateIfdFP
|
private void validateIfdFP(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
checkRequiredTag(metadata, "ImageDescription", 1);
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "StripOffsets", 1, new long[]{0});
}
checkRequiredTag(metadata, "NewSubfileType", 1);
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2});
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
}
}
|
java
|
private void validateIfdFP(IFD ifd, int p) {
IfdTags metadata = ifd.getMetadata();
checkRequiredTag(metadata, "ImageDescription", 1);
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "StripOffsets", 1, new long[]{0});
}
checkRequiredTag(metadata, "NewSubfileType", 1);
checkRequiredTag(metadata, "ImageLength", 1);
checkRequiredTag(metadata, "ImageWidth", 1);
checkRequiredTag(metadata, "StripOffsets", 1);
if (p == 0) {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1,4,5,8});
} else {
checkRequiredTag(metadata, "Orientation", 1, new long[]{1});
}
checkRequiredTag(metadata, "StripBYTECount", 1);
checkRequiredTag(metadata, "XResolution", 1);
checkRequiredTag(metadata, "YResolution", 1);
checkRequiredTag(metadata, "PlanarConfiguration", 1, new long[]{2});
if (p == 1 || p == 2) {
checkRequiredTag(metadata, "ResolutionUnit", 1, new long[]{2, 3});
checkRequiredTag(metadata, "NumberOfInks", 1, new long[]{4});
}
}
|
[
"private",
"void",
"validateIfdFP",
"(",
"IFD",
"ifd",
",",
"int",
"p",
")",
"{",
"IfdTags",
"metadata",
"=",
"ifd",
".",
"getMetadata",
"(",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageDescription\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripOffsets\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"1",
"||",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripOffsets\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"0",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NewSubfileType\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageLength\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ImageWidth\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripOffsets\"",
",",
"1",
")",
";",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
",",
"4",
",",
"5",
",",
"8",
"}",
")",
";",
"}",
"else",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"Orientation\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"1",
"}",
")",
";",
"}",
"checkRequiredTag",
"(",
"metadata",
",",
"\"StripBYTECount\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"XResolution\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"YResolution\"",
",",
"1",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"PlanarConfiguration\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"2",
"}",
")",
";",
"if",
"(",
"p",
"==",
"1",
"||",
"p",
"==",
"2",
")",
"{",
"checkRequiredTag",
"(",
"metadata",
",",
"\"ResolutionUnit\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"2",
",",
"3",
"}",
")",
";",
"checkRequiredTag",
"(",
"metadata",
",",
"\"NumberOfInks\"",
",",
"1",
",",
"new",
"long",
"[",
"]",
"{",
"4",
"}",
")",
";",
"}",
"}"
] |
Validate Final Page.
@param ifd the ifd
@param p the profile (default = 0, P1 = 1, P2 = 2)
|
[
"Validate",
"Final",
"Page",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L589-L614
|
11,611
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
|
TiffITProfile.checkRequiredTag
|
private boolean checkRequiredTag(IfdTags metadata, String tagName, int cardinality,
long[] possibleValues) {
boolean ok = true;
int tagid = TiffTags.getTagId(tagName);
if (!metadata.containsTagId(tagid)) {
validation.addErrorLoc("Missing required tag for TiffIT" + profile + " " + tagName, "IFD"
+ currentIfd);
ok = false;
} else if (cardinality != -1 && metadata.get(tagid).getCardinality() != cardinality) {
validation.addError("Invalid cardinality for TiffIT" + profile + " tag " + tagName, "IFD"
+ currentIfd,
metadata.get(tagid)
.getCardinality());
} else if (cardinality == 1 && possibleValues != null) {
long val = metadata.get(tagid).getFirstNumericValue();
boolean contained = false;
int i = 0;
while (i < possibleValues.length && !contained) {
contained = possibleValues[i] == val;
i++;
}
if (!contained)
validation.addError("Invalid value for TiffIT" + profile + " tag " + tagName, "IFD"
+ currentIfd, val);
}
return ok;
}
|
java
|
private boolean checkRequiredTag(IfdTags metadata, String tagName, int cardinality,
long[] possibleValues) {
boolean ok = true;
int tagid = TiffTags.getTagId(tagName);
if (!metadata.containsTagId(tagid)) {
validation.addErrorLoc("Missing required tag for TiffIT" + profile + " " + tagName, "IFD"
+ currentIfd);
ok = false;
} else if (cardinality != -1 && metadata.get(tagid).getCardinality() != cardinality) {
validation.addError("Invalid cardinality for TiffIT" + profile + " tag " + tagName, "IFD"
+ currentIfd,
metadata.get(tagid)
.getCardinality());
} else if (cardinality == 1 && possibleValues != null) {
long val = metadata.get(tagid).getFirstNumericValue();
boolean contained = false;
int i = 0;
while (i < possibleValues.length && !contained) {
contained = possibleValues[i] == val;
i++;
}
if (!contained)
validation.addError("Invalid value for TiffIT" + profile + " tag " + tagName, "IFD"
+ currentIfd, val);
}
return ok;
}
|
[
"private",
"boolean",
"checkRequiredTag",
"(",
"IfdTags",
"metadata",
",",
"String",
"tagName",
",",
"int",
"cardinality",
",",
"long",
"[",
"]",
"possibleValues",
")",
"{",
"boolean",
"ok",
"=",
"true",
";",
"int",
"tagid",
"=",
"TiffTags",
".",
"getTagId",
"(",
"tagName",
")",
";",
"if",
"(",
"!",
"metadata",
".",
"containsTagId",
"(",
"tagid",
")",
")",
"{",
"validation",
".",
"addErrorLoc",
"(",
"\"Missing required tag for TiffIT\"",
"+",
"profile",
"+",
"\" \"",
"+",
"tagName",
",",
"\"IFD\"",
"+",
"currentIfd",
")",
";",
"ok",
"=",
"false",
";",
"}",
"else",
"if",
"(",
"cardinality",
"!=",
"-",
"1",
"&&",
"metadata",
".",
"get",
"(",
"tagid",
")",
".",
"getCardinality",
"(",
")",
"!=",
"cardinality",
")",
"{",
"validation",
".",
"addError",
"(",
"\"Invalid cardinality for TiffIT\"",
"+",
"profile",
"+",
"\" tag \"",
"+",
"tagName",
",",
"\"IFD\"",
"+",
"currentIfd",
",",
"metadata",
".",
"get",
"(",
"tagid",
")",
".",
"getCardinality",
"(",
")",
")",
";",
"}",
"else",
"if",
"(",
"cardinality",
"==",
"1",
"&&",
"possibleValues",
"!=",
"null",
")",
"{",
"long",
"val",
"=",
"metadata",
".",
"get",
"(",
"tagid",
")",
".",
"getFirstNumericValue",
"(",
")",
";",
"boolean",
"contained",
"=",
"false",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"i",
"<",
"possibleValues",
".",
"length",
"&&",
"!",
"contained",
")",
"{",
"contained",
"=",
"possibleValues",
"[",
"i",
"]",
"==",
"val",
";",
"i",
"++",
";",
"}",
"if",
"(",
"!",
"contained",
")",
"validation",
".",
"addError",
"(",
"\"Invalid value for TiffIT\"",
"+",
"profile",
"+",
"\" tag \"",
"+",
"tagName",
",",
"\"IFD\"",
"+",
"currentIfd",
",",
"val",
")",
";",
"}",
"return",
"ok",
";",
"}"
] |
Check required tag is present, and its cardinality and value is correct.
@param metadata the metadata
@param tagName the name of the mandatory tag
@param cardinality the mandatory cardinality
@param possibleValues the possible tag values
@return true, if tag is found
|
[
"Check",
"required",
"tag",
"is",
"present",
"and",
"its",
"cardinality",
"and",
"value",
"is",
"correct",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L625-L651
|
11,612
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java
|
TiffITProfile.checkRequiredTag
|
private boolean checkRequiredTag(IfdTags metadata, String tagName, int cardinality) {
return checkRequiredTag(metadata, tagName, cardinality, null);
}
|
java
|
private boolean checkRequiredTag(IfdTags metadata, String tagName, int cardinality) {
return checkRequiredTag(metadata, tagName, cardinality, null);
}
|
[
"private",
"boolean",
"checkRequiredTag",
"(",
"IfdTags",
"metadata",
",",
"String",
"tagName",
",",
"int",
"cardinality",
")",
"{",
"return",
"checkRequiredTag",
"(",
"metadata",
",",
"tagName",
",",
"cardinality",
",",
"null",
")",
";",
"}"
] |
Check a required tag is present.
@param metadata the metadata
@param tagName the name of the mandatory tag
@param cardinality the mandatory cardinality
@return true, if tag is present
|
[
"Check",
"a",
"required",
"tag",
"is",
"present",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/TiffITProfile.java#L661-L663
|
11,613
|
jboss/jboss-el-api_spec
|
src/main/java/javax/el/ImportHandler.java
|
ImportHandler.importStatic
|
public void importStatic(String name) throws ELException {
int i = name.lastIndexOf('.');
if (i <= 0) {
throw new ELException(
"The name " + name + " is not a full static member name");
}
String memberName = name.substring(i+1);
String className = name.substring(0, i);
staticNameMap.put(memberName, className);
}
|
java
|
public void importStatic(String name) throws ELException {
int i = name.lastIndexOf('.');
if (i <= 0) {
throw new ELException(
"The name " + name + " is not a full static member name");
}
String memberName = name.substring(i+1);
String className = name.substring(0, i);
staticNameMap.put(memberName, className);
}
|
[
"public",
"void",
"importStatic",
"(",
"String",
"name",
")",
"throws",
"ELException",
"{",
"int",
"i",
"=",
"name",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"i",
"<=",
"0",
")",
"{",
"throw",
"new",
"ELException",
"(",
"\"The name \"",
"+",
"name",
"+",
"\" is not a full static member name\"",
")",
";",
"}",
"String",
"memberName",
"=",
"name",
".",
"substring",
"(",
"i",
"+",
"1",
")",
";",
"String",
"className",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"i",
")",
";",
"staticNameMap",
".",
"put",
"(",
"memberName",
",",
"className",
")",
";",
"}"
] |
Import a static field or method.
@param name The static member name, including the full class name,
to be imported
@throws ELException if the name does not include a ".".
|
[
"Import",
"a",
"static",
"field",
"or",
"method",
"."
] |
4cef117cae3ccf9f76439845687a8d219ad2eb43
|
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ImportHandler.java#L75-L84
|
11,614
|
jboss/jboss-el-api_spec
|
src/main/java/javax/el/ImportHandler.java
|
ImportHandler.importClass
|
public void importClass(String name) throws ELException {
int i = name.lastIndexOf('.');
if (i <= 0) {
throw new ELException(
"The name " + name + " is not a full class name");
}
String className = name.substring(i+1);
classNameMap.put(className, name);
}
|
java
|
public void importClass(String name) throws ELException {
int i = name.lastIndexOf('.');
if (i <= 0) {
throw new ELException(
"The name " + name + " is not a full class name");
}
String className = name.substring(i+1);
classNameMap.put(className, name);
}
|
[
"public",
"void",
"importClass",
"(",
"String",
"name",
")",
"throws",
"ELException",
"{",
"int",
"i",
"=",
"name",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"i",
"<=",
"0",
")",
"{",
"throw",
"new",
"ELException",
"(",
"\"The name \"",
"+",
"name",
"+",
"\" is not a full class name\"",
")",
";",
"}",
"String",
"className",
"=",
"name",
".",
"substring",
"(",
"i",
"+",
"1",
")",
";",
"classNameMap",
".",
"put",
"(",
"className",
",",
"name",
")",
";",
"}"
] |
Import a class.
@param name The full class name of the class to be imported
@throws ELException if the name does not include a ".".
|
[
"Import",
"a",
"class",
"."
] |
4cef117cae3ccf9f76439845687a8d219ad2eb43
|
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ImportHandler.java#L91-L99
|
11,615
|
jboss/jboss-el-api_spec
|
src/main/java/javax/el/ImportHandler.java
|
ImportHandler.resolveClass
|
public Class<?> resolveClass(String name) {
String className = classNameMap.get(name);
if (className != null) {
return resolveClassFor(className);
}
for (String packageName: packages) {
String fullClassName = packageName + "." + name;
Class<?>c = resolveClassFor(fullClassName);
if (c != null) {
classNameMap.put(name, fullClassName);
return c;
}
}
return null;
}
|
java
|
public Class<?> resolveClass(String name) {
String className = classNameMap.get(name);
if (className != null) {
return resolveClassFor(className);
}
for (String packageName: packages) {
String fullClassName = packageName + "." + name;
Class<?>c = resolveClassFor(fullClassName);
if (c != null) {
classNameMap.put(name, fullClassName);
return c;
}
}
return null;
}
|
[
"public",
"Class",
"<",
"?",
">",
"resolveClass",
"(",
"String",
"name",
")",
"{",
"String",
"className",
"=",
"classNameMap",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"className",
"!=",
"null",
")",
"{",
"return",
"resolveClassFor",
"(",
"className",
")",
";",
"}",
"for",
"(",
"String",
"packageName",
":",
"packages",
")",
"{",
"String",
"fullClassName",
"=",
"packageName",
"+",
"\".\"",
"+",
"name",
";",
"Class",
"<",
"?",
">",
"c",
"=",
"resolveClassFor",
"(",
"fullClassName",
")",
";",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"classNameMap",
".",
"put",
"(",
"name",
",",
"fullClassName",
")",
";",
"return",
"c",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Resolve a class name.
@param name The name of the class (without package name) to be resolved.
@return If the class has been imported previously, with
{@link #importClass} or {@link #importPackage}, then its
Class instance. Otherwise <code>null</code>.
@throws ELException if the class is abstract or is an interface, or
not public.
|
[
"Resolve",
"a",
"class",
"name",
"."
] |
4cef117cae3ccf9f76439845687a8d219ad2eb43
|
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ImportHandler.java#L119-L135
|
11,616
|
jboss/jboss-el-api_spec
|
src/main/java/javax/el/ImportHandler.java
|
ImportHandler.resolveStatic
|
public Class<?> resolveStatic(String name) {
String className = staticNameMap.get(name);
if (className != null) {
Class<?> c = resolveClassFor(className);
if (c != null) {
return c;
}
}
return null;
}
|
java
|
public Class<?> resolveStatic(String name) {
String className = staticNameMap.get(name);
if (className != null) {
Class<?> c = resolveClassFor(className);
if (c != null) {
return c;
}
}
return null;
}
|
[
"public",
"Class",
"<",
"?",
">",
"resolveStatic",
"(",
"String",
"name",
")",
"{",
"String",
"className",
"=",
"staticNameMap",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"className",
"!=",
"null",
")",
"{",
"Class",
"<",
"?",
">",
"c",
"=",
"resolveClassFor",
"(",
"className",
")",
";",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"return",
"c",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Resolve a static field or method name.
@param name The name of the member(without package and class name)
to be resolved.
@return If the field or method has been imported previously, with
{@link #importStatic}, then the class object representing the class that
declares the static field or method.
Otherwise <code>null</code>.
@throws ELException if the class is not public, or is abstract or
is an interface.
|
[
"Resolve",
"a",
"static",
"field",
"or",
"method",
"name",
"."
] |
4cef117cae3ccf9f76439845687a8d219ad2eb43
|
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/ImportHandler.java#L149-L158
|
11,617
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.createXmlStreamReader
|
public static XMLStreamReader createXmlStreamReader(Path path, boolean namespaceAware)
throws JAXBException {
XMLInputFactory xif = getXmlInputFactory(namespaceAware);
XMLStreamReader xsr = null;
try {
xsr = xif.createXMLStreamReader(new StreamSource(path.toFile()));
} catch (XMLStreamException e) {
throw new JAXBException(e);
}
return xsr;
}
|
java
|
public static XMLStreamReader createXmlStreamReader(Path path, boolean namespaceAware)
throws JAXBException {
XMLInputFactory xif = getXmlInputFactory(namespaceAware);
XMLStreamReader xsr = null;
try {
xsr = xif.createXMLStreamReader(new StreamSource(path.toFile()));
} catch (XMLStreamException e) {
throw new JAXBException(e);
}
return xsr;
}
|
[
"public",
"static",
"XMLStreamReader",
"createXmlStreamReader",
"(",
"Path",
"path",
",",
"boolean",
"namespaceAware",
")",
"throws",
"JAXBException",
"{",
"XMLInputFactory",
"xif",
"=",
"getXmlInputFactory",
"(",
"namespaceAware",
")",
";",
"XMLStreamReader",
"xsr",
"=",
"null",
";",
"try",
"{",
"xsr",
"=",
"xif",
".",
"createXMLStreamReader",
"(",
"new",
"StreamSource",
"(",
"path",
".",
"toFile",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"XMLStreamException",
"e",
")",
"{",
"throw",
"new",
"JAXBException",
"(",
"e",
")",
";",
"}",
"return",
"xsr",
";",
"}"
] |
Creates an XMLStreamReader based on a file path.
@param path the path to the file to be parsed
@param namespaceAware if {@code false} the XMLStreamReader will remove all namespaces from all
XML elements
@return platform-specific XMLStreamReader implementation
@throws JAXBException if the XMLStreamReader could not be created
|
[
"Creates",
"an",
"XMLStreamReader",
"based",
"on",
"a",
"file",
"path",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L95-L105
|
11,618
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.createXmlStreamReader
|
public static XMLStreamReader createXmlStreamReader(InputStream is, boolean namespaceAware)
throws JAXBException {
XMLInputFactory xif = getXmlInputFactory(namespaceAware);
XMLStreamReader xsr = null;
try {
xsr = xif.createXMLStreamReader(is);
} catch (XMLStreamException e) {
throw new JAXBException(e);
}
return xsr;
}
|
java
|
public static XMLStreamReader createXmlStreamReader(InputStream is, boolean namespaceAware)
throws JAXBException {
XMLInputFactory xif = getXmlInputFactory(namespaceAware);
XMLStreamReader xsr = null;
try {
xsr = xif.createXMLStreamReader(is);
} catch (XMLStreamException e) {
throw new JAXBException(e);
}
return xsr;
}
|
[
"public",
"static",
"XMLStreamReader",
"createXmlStreamReader",
"(",
"InputStream",
"is",
",",
"boolean",
"namespaceAware",
")",
"throws",
"JAXBException",
"{",
"XMLInputFactory",
"xif",
"=",
"getXmlInputFactory",
"(",
"namespaceAware",
")",
";",
"XMLStreamReader",
"xsr",
"=",
"null",
";",
"try",
"{",
"xsr",
"=",
"xif",
".",
"createXMLStreamReader",
"(",
"is",
")",
";",
"}",
"catch",
"(",
"XMLStreamException",
"e",
")",
"{",
"throw",
"new",
"JAXBException",
"(",
"e",
")",
";",
"}",
"return",
"xsr",
";",
"}"
] |
Creates an XMLStreamReader based on an input stream.
@param is the input stream from which the data to be parsed will be taken
@param namespaceAware if {@code false} the XMLStreamReader will remove all namespaces from all
XML elements
@return platform-specific XMLStreamReader implementation
@throws JAXBException if the XMLStreamReader could not be created
|
[
"Creates",
"an",
"XMLStreamReader",
"based",
"on",
"an",
"input",
"stream",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L134-L144
|
11,619
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.createXmlStreamReader
|
public static XMLStreamReader createXmlStreamReader(Reader reader, boolean namespaceAware)
throws JAXBException {
XMLInputFactory xif = getXmlInputFactory(namespaceAware);
XMLStreamReader xsr = null;
try {
xsr = xif.createXMLStreamReader(reader);
} catch (XMLStreamException e) {
throw new JAXBException(e);
}
return xsr;
}
|
java
|
public static XMLStreamReader createXmlStreamReader(Reader reader, boolean namespaceAware)
throws JAXBException {
XMLInputFactory xif = getXmlInputFactory(namespaceAware);
XMLStreamReader xsr = null;
try {
xsr = xif.createXMLStreamReader(reader);
} catch (XMLStreamException e) {
throw new JAXBException(e);
}
return xsr;
}
|
[
"public",
"static",
"XMLStreamReader",
"createXmlStreamReader",
"(",
"Reader",
"reader",
",",
"boolean",
"namespaceAware",
")",
"throws",
"JAXBException",
"{",
"XMLInputFactory",
"xif",
"=",
"getXmlInputFactory",
"(",
"namespaceAware",
")",
";",
"XMLStreamReader",
"xsr",
"=",
"null",
";",
"try",
"{",
"xsr",
"=",
"xif",
".",
"createXMLStreamReader",
"(",
"reader",
")",
";",
"}",
"catch",
"(",
"XMLStreamException",
"e",
")",
"{",
"throw",
"new",
"JAXBException",
"(",
"e",
")",
";",
"}",
"return",
"xsr",
";",
"}"
] |
Creates an XMLStreamReader based on a Reader.
@param reader Note that XMLStreamReader, despite the name, does not implement the Reader
interface!
@param namespaceAware if {@code false} the XMLStreamReader will remove all namespaces from all
XML elements
@return platform-specific XMLStreamReader implementation
@throws JAXBException if the XMLStreamReader could not be created
|
[
"Creates",
"an",
"XMLStreamReader",
"based",
"on",
"a",
"Reader",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L174-L184
|
11,620
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.unmarshal
|
public static <T> T unmarshal(Class<T> cl, String s) throws JAXBException {
return unmarshal(cl, new StringReader(s));
}
|
java
|
public static <T> T unmarshal(Class<T> cl, String s) throws JAXBException {
return unmarshal(cl, new StringReader(s));
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"unmarshal",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"String",
"s",
")",
"throws",
"JAXBException",
"{",
"return",
"unmarshal",
"(",
"cl",
",",
"new",
"StringReader",
"(",
"s",
")",
")",
";",
"}"
] |
Convert a string to an object of a given class.
@param cl Type of object
@param s Input string
@return Object of the given type
|
[
"Convert",
"a",
"string",
"to",
"an",
"object",
"of",
"a",
"given",
"class",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L242-L244
|
11,621
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.unmarshal
|
public static <T> T unmarshal(Class<T> cl, File f) throws JAXBException {
return unmarshal(cl, new StreamSource(f));
}
|
java
|
public static <T> T unmarshal(Class<T> cl, File f) throws JAXBException {
return unmarshal(cl, new StreamSource(f));
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"unmarshal",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"File",
"f",
")",
"throws",
"JAXBException",
"{",
"return",
"unmarshal",
"(",
"cl",
",",
"new",
"StreamSource",
"(",
"f",
")",
")",
";",
"}"
] |
Convert the contents of a file to an object of a given class.
@param cl Type of object
@param f File to be read
@return Object of the given type
|
[
"Convert",
"the",
"contents",
"of",
"a",
"file",
"to",
"an",
"object",
"of",
"a",
"given",
"class",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L253-L255
|
11,622
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.unmarshal
|
public static <T> T unmarshal(Class<T> cl, Reader r) throws JAXBException {
return unmarshal(cl, new StreamSource(r));
}
|
java
|
public static <T> T unmarshal(Class<T> cl, Reader r) throws JAXBException {
return unmarshal(cl, new StreamSource(r));
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"unmarshal",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"Reader",
"r",
")",
"throws",
"JAXBException",
"{",
"return",
"unmarshal",
"(",
"cl",
",",
"new",
"StreamSource",
"(",
"r",
")",
")",
";",
"}"
] |
Convert the contents of a Reader to an object of a given class.
@param cl Type of object
@param r Reader to be read
@return Object of the given type
|
[
"Convert",
"the",
"contents",
"of",
"a",
"Reader",
"to",
"an",
"object",
"of",
"a",
"given",
"class",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L264-L266
|
11,623
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.unmarshal
|
public static <T> T unmarshal(Class<T> cl, InputStream s) throws JAXBException {
return unmarshal(cl, new StreamSource(s));
}
|
java
|
public static <T> T unmarshal(Class<T> cl, InputStream s) throws JAXBException {
return unmarshal(cl, new StreamSource(s));
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"unmarshal",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"InputStream",
"s",
")",
"throws",
"JAXBException",
"{",
"return",
"unmarshal",
"(",
"cl",
",",
"new",
"StreamSource",
"(",
"s",
")",
")",
";",
"}"
] |
Convert the contents of an InputStream to an object of a given class.
@param cl Type of object
@param s InputStream to be read
@return Object of the given type
|
[
"Convert",
"the",
"contents",
"of",
"an",
"InputStream",
"to",
"an",
"object",
"of",
"a",
"given",
"class",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L275-L277
|
11,624
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.unmarshal
|
public static <T> T unmarshal(Class<T> cl, Source s) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(cl);
Unmarshaller u = ctx.createUnmarshaller();
return u.unmarshal(s, cl).getValue();
}
|
java
|
public static <T> T unmarshal(Class<T> cl, Source s) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(cl);
Unmarshaller u = ctx.createUnmarshaller();
return u.unmarshal(s, cl).getValue();
}
|
[
"public",
"static",
"<",
"T",
">",
"T",
"unmarshal",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"Source",
"s",
")",
"throws",
"JAXBException",
"{",
"JAXBContext",
"ctx",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"cl",
")",
";",
"Unmarshaller",
"u",
"=",
"ctx",
".",
"createUnmarshaller",
"(",
")",
";",
"return",
"u",
".",
"unmarshal",
"(",
"s",
",",
"cl",
")",
".",
"getValue",
"(",
")",
";",
"}"
] |
Convert the contents of a Source to an object of a given class.
@param cl Type of object
@param s Source to be used
@return Object of the given type
|
[
"Convert",
"the",
"contents",
"of",
"a",
"Source",
"to",
"an",
"object",
"of",
"a",
"given",
"class",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L286-L290
|
11,625
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.unmarshalCollection
|
public static <T> List<T> unmarshalCollection(Class<T> cl, String s) throws JAXBException {
return unmarshalCollection(cl, new StringReader(s));
}
|
java
|
public static <T> List<T> unmarshalCollection(Class<T> cl, String s) throws JAXBException {
return unmarshalCollection(cl, new StringReader(s));
}
|
[
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"unmarshalCollection",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"String",
"s",
")",
"throws",
"JAXBException",
"{",
"return",
"unmarshalCollection",
"(",
"cl",
",",
"new",
"StringReader",
"(",
"s",
")",
")",
";",
"}"
] |
Converts the contents of the string to a List with objects of the given class.
@param cl Type to be used
@param s Input string
@return List with objects of the given type
|
[
"Converts",
"the",
"contents",
"of",
"the",
"string",
"to",
"a",
"List",
"with",
"objects",
"of",
"the",
"given",
"class",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L299-L301
|
11,626
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.unmarshalCollection
|
public static <T> List<T> unmarshalCollection(Class<T> cl, Reader r) throws JAXBException {
return unmarshalCollection(cl, new StreamSource(r));
}
|
java
|
public static <T> List<T> unmarshalCollection(Class<T> cl, Reader r) throws JAXBException {
return unmarshalCollection(cl, new StreamSource(r));
}
|
[
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"unmarshalCollection",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"Reader",
"r",
")",
"throws",
"JAXBException",
"{",
"return",
"unmarshalCollection",
"(",
"cl",
",",
"new",
"StreamSource",
"(",
"r",
")",
")",
";",
"}"
] |
Converts the contents of the Reader to a List with objects of the given class.
@param cl Type to be used
@param r Input
@return List with objects of the given type
|
[
"Converts",
"the",
"contents",
"of",
"the",
"Reader",
"to",
"a",
"List",
"with",
"objects",
"of",
"the",
"given",
"class",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L310-L312
|
11,627
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.unmarshalCollection
|
public static <T> List<T> unmarshalCollection(Class<T> cl, InputStream s) throws JAXBException {
return unmarshalCollection(cl, new StreamSource(s));
}
|
java
|
public static <T> List<T> unmarshalCollection(Class<T> cl, InputStream s) throws JAXBException {
return unmarshalCollection(cl, new StreamSource(s));
}
|
[
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"unmarshalCollection",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"InputStream",
"s",
")",
"throws",
"JAXBException",
"{",
"return",
"unmarshalCollection",
"(",
"cl",
",",
"new",
"StreamSource",
"(",
"s",
")",
")",
";",
"}"
] |
Converts the contents of the InputStream to a List with objects of the given class.
@param cl Type to be used
@param s Input
@return List with objects of the given type
|
[
"Converts",
"the",
"contents",
"of",
"the",
"InputStream",
"to",
"a",
"List",
"with",
"objects",
"of",
"the",
"given",
"class",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L321-L323
|
11,628
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.unmarshalCollection
|
public static <T> List<T> unmarshalCollection(Class<T> cl, Source s) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(JAXBCollection.class, cl);
Unmarshaller u = ctx.createUnmarshaller();
JAXBCollection<T> collection = u.unmarshal(s, JAXBCollection.class).getValue();
return collection.getItems();
}
|
java
|
public static <T> List<T> unmarshalCollection(Class<T> cl, Source s) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(JAXBCollection.class, cl);
Unmarshaller u = ctx.createUnmarshaller();
JAXBCollection<T> collection = u.unmarshal(s, JAXBCollection.class).getValue();
return collection.getItems();
}
|
[
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"unmarshalCollection",
"(",
"Class",
"<",
"T",
">",
"cl",
",",
"Source",
"s",
")",
"throws",
"JAXBException",
"{",
"JAXBContext",
"ctx",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"JAXBCollection",
".",
"class",
",",
"cl",
")",
";",
"Unmarshaller",
"u",
"=",
"ctx",
".",
"createUnmarshaller",
"(",
")",
";",
"JAXBCollection",
"<",
"T",
">",
"collection",
"=",
"u",
".",
"unmarshal",
"(",
"s",
",",
"JAXBCollection",
".",
"class",
")",
".",
"getValue",
"(",
")",
";",
"return",
"collection",
".",
"getItems",
"(",
")",
";",
"}"
] |
Converts the contents of the Source to a List with objects of the given class.
@param cl Type to be used
@param s Input
@return List with objects of the given type
|
[
"Converts",
"the",
"contents",
"of",
"the",
"Source",
"to",
"a",
"List",
"with",
"objects",
"of",
"the",
"given",
"class",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L332-L337
|
11,629
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.marshal
|
public static <T> String marshal(T obj) throws JAXBException {
StringWriter sw = new StringWriter();
marshal(obj, sw);
return sw.toString();
}
|
java
|
public static <T> String marshal(T obj) throws JAXBException {
StringWriter sw = new StringWriter();
marshal(obj, sw);
return sw.toString();
}
|
[
"public",
"static",
"<",
"T",
">",
"String",
"marshal",
"(",
"T",
"obj",
")",
"throws",
"JAXBException",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"marshal",
"(",
"obj",
",",
"sw",
")",
";",
"return",
"sw",
".",
"toString",
"(",
")",
";",
"}"
] |
Convert an object to a string.
@param obj Object that needs to be serialized / marshalled.
@return String representation of obj
|
[
"Convert",
"an",
"object",
"to",
"a",
"string",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L345-L349
|
11,630
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.marshal
|
public static <T> void marshal(T obj, Writer wr) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(obj.getClass());
Marshaller m = ctx.createMarshaller();
m.marshal(obj, wr);
}
|
java
|
public static <T> void marshal(T obj, Writer wr) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(obj.getClass());
Marshaller m = ctx.createMarshaller();
m.marshal(obj, wr);
}
|
[
"public",
"static",
"<",
"T",
">",
"void",
"marshal",
"(",
"T",
"obj",
",",
"Writer",
"wr",
")",
"throws",
"JAXBException",
"{",
"JAXBContext",
"ctx",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"obj",
".",
"getClass",
"(",
")",
")",
";",
"Marshaller",
"m",
"=",
"ctx",
".",
"createMarshaller",
"(",
")",
";",
"m",
".",
"marshal",
"(",
"obj",
",",
"wr",
")",
";",
"}"
] |
Convert an object to a string and send it to a Writer.
@param obj Object that needs to be serialized / marshalled
@param wr Writer used for outputting the marshalled object
|
[
"Convert",
"an",
"object",
"to",
"a",
"string",
"and",
"send",
"it",
"to",
"a",
"Writer",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L357-L361
|
11,631
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.marshal
|
public static <T> void marshal(T obj, File f) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(obj.getClass());
Marshaller m = ctx.createMarshaller();
m.marshal(obj, f);
}
|
java
|
public static <T> void marshal(T obj, File f) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(obj.getClass());
Marshaller m = ctx.createMarshaller();
m.marshal(obj, f);
}
|
[
"public",
"static",
"<",
"T",
">",
"void",
"marshal",
"(",
"T",
"obj",
",",
"File",
"f",
")",
"throws",
"JAXBException",
"{",
"JAXBContext",
"ctx",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"obj",
".",
"getClass",
"(",
")",
")",
";",
"Marshaller",
"m",
"=",
"ctx",
".",
"createMarshaller",
"(",
")",
";",
"m",
".",
"marshal",
"(",
"obj",
",",
"f",
")",
";",
"}"
] |
Convert an object to a string and save it to a File.
@param obj Object that needs to be serialized / marshalled
@param f Save file
|
[
"Convert",
"an",
"object",
"to",
"a",
"string",
"and",
"save",
"it",
"to",
"a",
"File",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L369-L373
|
11,632
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.marshal
|
public static <T> void marshal(T obj, OutputStream s) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(obj.getClass());
Marshaller m = ctx.createMarshaller();
m.marshal(obj, s);
}
|
java
|
public static <T> void marshal(T obj, OutputStream s) throws JAXBException {
JAXBContext ctx = JAXBContext.newInstance(obj.getClass());
Marshaller m = ctx.createMarshaller();
m.marshal(obj, s);
}
|
[
"public",
"static",
"<",
"T",
">",
"void",
"marshal",
"(",
"T",
"obj",
",",
"OutputStream",
"s",
")",
"throws",
"JAXBException",
"{",
"JAXBContext",
"ctx",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"obj",
".",
"getClass",
"(",
")",
")",
";",
"Marshaller",
"m",
"=",
"ctx",
".",
"createMarshaller",
"(",
")",
";",
"m",
".",
"marshal",
"(",
"obj",
",",
"s",
")",
";",
"}"
] |
Convert an object to a string and send it to an OutputStream.
@param obj Object that needs to be serialized / marshalled
@param s Stream used for output
|
[
"Convert",
"an",
"object",
"to",
"a",
"string",
"and",
"send",
"it",
"to",
"an",
"OutputStream",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L381-L385
|
11,633
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.marshal
|
public static <T> String marshal(String rootName, Collection<T> c) throws JAXBException {
StringWriter sw = new StringWriter();
marshal(rootName, c, sw);
return sw.toString();
}
|
java
|
public static <T> String marshal(String rootName, Collection<T> c) throws JAXBException {
StringWriter sw = new StringWriter();
marshal(rootName, c, sw);
return sw.toString();
}
|
[
"public",
"static",
"<",
"T",
">",
"String",
"marshal",
"(",
"String",
"rootName",
",",
"Collection",
"<",
"T",
">",
"c",
")",
"throws",
"JAXBException",
"{",
"StringWriter",
"sw",
"=",
"new",
"StringWriter",
"(",
")",
";",
"marshal",
"(",
"rootName",
",",
"c",
",",
"sw",
")",
";",
"return",
"sw",
".",
"toString",
"(",
")",
";",
"}"
] |
Convert a collection to a string.
@param rootName Name of the XML root element
@param c Collection that needs to be marshalled
@return String representation of the collection
|
[
"Convert",
"a",
"collection",
"to",
"a",
"string",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L394-L398
|
11,634
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.marshal
|
public static <T> void marshal(String rootName, Collection<T> c, Writer w) throws JAXBException {
// Create context with generic type
JAXBContext ctx = JAXBContext.newInstance(findTypes(c));
Marshaller m = ctx.createMarshaller();
// Create wrapper collection
JAXBElement element = createCollectionElement(rootName, c);
m.marshal(element, w);
}
|
java
|
public static <T> void marshal(String rootName, Collection<T> c, Writer w) throws JAXBException {
// Create context with generic type
JAXBContext ctx = JAXBContext.newInstance(findTypes(c));
Marshaller m = ctx.createMarshaller();
// Create wrapper collection
JAXBElement element = createCollectionElement(rootName, c);
m.marshal(element, w);
}
|
[
"public",
"static",
"<",
"T",
">",
"void",
"marshal",
"(",
"String",
"rootName",
",",
"Collection",
"<",
"T",
">",
"c",
",",
"Writer",
"w",
")",
"throws",
"JAXBException",
"{",
"// Create context with generic type\r",
"JAXBContext",
"ctx",
"=",
"JAXBContext",
".",
"newInstance",
"(",
"findTypes",
"(",
"c",
")",
")",
";",
"Marshaller",
"m",
"=",
"ctx",
".",
"createMarshaller",
"(",
")",
";",
"// Create wrapper collection\r",
"JAXBElement",
"element",
"=",
"createCollectionElement",
"(",
"rootName",
",",
"c",
")",
";",
"m",
".",
"marshal",
"(",
"element",
",",
"w",
")",
";",
"}"
] |
Convert a collection to a string and sends it to the Writer.
@param rootName Name of the XML root element
@param c Collection that needs to be marshalled
@param w Output
|
[
"Convert",
"a",
"collection",
"to",
"a",
"string",
"and",
"sends",
"it",
"to",
"the",
"Writer",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L407-L415
|
11,635
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.findTypes
|
protected static <T> Class[] findTypes(Collection<T> c) {
Set<Class> types = new HashSet<>();
types.add(JAXBCollection.class);
for (T o : c) {
if (o != null) {
types.add(o.getClass());
}
}
return types.toArray(new Class[0]);
}
|
java
|
protected static <T> Class[] findTypes(Collection<T> c) {
Set<Class> types = new HashSet<>();
types.add(JAXBCollection.class);
for (T o : c) {
if (o != null) {
types.add(o.getClass());
}
}
return types.toArray(new Class[0]);
}
|
[
"protected",
"static",
"<",
"T",
">",
"Class",
"[",
"]",
"findTypes",
"(",
"Collection",
"<",
"T",
">",
"c",
")",
"{",
"Set",
"<",
"Class",
">",
"types",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"types",
".",
"add",
"(",
"JAXBCollection",
".",
"class",
")",
";",
"for",
"(",
"T",
"o",
":",
"c",
")",
"{",
"if",
"(",
"o",
"!=",
"null",
")",
"{",
"types",
".",
"add",
"(",
"o",
".",
"getClass",
"(",
")",
")",
";",
"}",
"}",
"return",
"types",
".",
"toArray",
"(",
"new",
"Class",
"[",
"0",
"]",
")",
";",
"}"
] |
Discovers all the classes in the given Collection. These need to be in the JAXBContext if you
want to marshal those objects. Unfortunatly there's no way of getting the generic type at
runtime.
@param c Collection that needs to be scanned
@return Classes found in the collection, including JAXBCollection.
|
[
"Discovers",
"all",
"the",
"classes",
"in",
"the",
"given",
"Collection",
".",
"These",
"need",
"to",
"be",
"in",
"the",
"JAXBContext",
"if",
"you",
"want",
"to",
"marshal",
"those",
"objects",
".",
"Unfortunatly",
"there",
"s",
"no",
"way",
"of",
"getting",
"the",
"generic",
"type",
"at",
"runtime",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L460-L469
|
11,636
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java
|
JaxbUtils.createCollectionElement
|
protected static <T> JAXBElement createCollectionElement(String rootName, Collection<T> c) {
JAXBCollection collection = new JAXBCollection(c);
return new JAXBElement<>(new QName(rootName), JAXBCollection.class, collection);
}
|
java
|
protected static <T> JAXBElement createCollectionElement(String rootName, Collection<T> c) {
JAXBCollection collection = new JAXBCollection(c);
return new JAXBElement<>(new QName(rootName), JAXBCollection.class, collection);
}
|
[
"protected",
"static",
"<",
"T",
">",
"JAXBElement",
"createCollectionElement",
"(",
"String",
"rootName",
",",
"Collection",
"<",
"T",
">",
"c",
")",
"{",
"JAXBCollection",
"collection",
"=",
"new",
"JAXBCollection",
"(",
"c",
")",
";",
"return",
"new",
"JAXBElement",
"<>",
"(",
"new",
"QName",
"(",
"rootName",
")",
",",
"JAXBCollection",
".",
"class",
",",
"collection",
")",
";",
"}"
] |
Create a JAXBElement containing a JAXBCollection. Needed for marshalling a generic collection
without a seperate wrapper class.
@param rootName Name of the XML root element
@return JAXBElement containing the given Collection, wrapped in a JAXBCollection.
|
[
"Create",
"a",
"JAXBElement",
"containing",
"a",
"JAXBCollection",
".",
"Needed",
"for",
"marshalling",
"a",
"generic",
"collection",
"without",
"a",
"seperate",
"wrapper",
"class",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/jaxb/JaxbUtils.java#L478-L481
|
11,637
|
maxirosson/jdroid-android
|
jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java
|
StringEntityRepository.getColumn
|
protected Column getColumn(String name) {
for (Column column : getColumns()) {
if (column.getColumnName().equals(name)) {
return column;
}
}
return null;
}
|
java
|
protected Column getColumn(String name) {
for (Column column : getColumns()) {
if (column.getColumnName().equals(name)) {
return column;
}
}
return null;
}
|
[
"protected",
"Column",
"getColumn",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"Column",
"column",
":",
"getColumns",
"(",
")",
")",
"{",
"if",
"(",
"column",
".",
"getColumnName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"column",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Find for the column associated with the given name.
@param name column name.
@return return the column if exits, otherwise returns null.
|
[
"Find",
"for",
"the",
"column",
"associated",
"with",
"the",
"given",
"name",
"."
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java#L52-L59
|
11,638
|
maxirosson/jdroid-android
|
jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java
|
StringEntityRepository.replaceStringChildren
|
public void replaceStringChildren(List<String> strings, String parentId) {
ArrayList<StringEntity> entities = new ArrayList<>();
for (String string : strings) {
if (string != null) {
StringEntity entity = new StringEntity();
entity.setParentId(parentId);
entity.setValue(string);
entities.add(entity);
}
}
replaceChildren(entities, parentId);
}
|
java
|
public void replaceStringChildren(List<String> strings, String parentId) {
ArrayList<StringEntity> entities = new ArrayList<>();
for (String string : strings) {
if (string != null) {
StringEntity entity = new StringEntity();
entity.setParentId(parentId);
entity.setValue(string);
entities.add(entity);
}
}
replaceChildren(entities, parentId);
}
|
[
"public",
"void",
"replaceStringChildren",
"(",
"List",
"<",
"String",
">",
"strings",
",",
"String",
"parentId",
")",
"{",
"ArrayList",
"<",
"StringEntity",
">",
"entities",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"string",
":",
"strings",
")",
"{",
"if",
"(",
"string",
"!=",
"null",
")",
"{",
"StringEntity",
"entity",
"=",
"new",
"StringEntity",
"(",
")",
";",
"entity",
".",
"setParentId",
"(",
"parentId",
")",
";",
"entity",
".",
"setValue",
"(",
"string",
")",
";",
"entities",
".",
"add",
"(",
"entity",
")",
";",
"}",
"}",
"replaceChildren",
"(",
"entities",
",",
"parentId",
")",
";",
"}"
] |
This method allows to replace all string children of a given parent, it will remove any children which are not in
the list, add the new ones and update which are in the list.
@param strings string children list to replace.
@param parentId id of parent entity.
|
[
"This",
"method",
"allows",
"to",
"replace",
"all",
"string",
"children",
"of",
"a",
"given",
"parent",
"it",
"will",
"remove",
"any",
"children",
"which",
"are",
"not",
"in",
"the",
"list",
"add",
"the",
"new",
"ones",
"and",
"update",
"which",
"are",
"in",
"the",
"list",
"."
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java#L68-L79
|
11,639
|
maxirosson/jdroid-android
|
jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java
|
StringEntityRepository.replaceStringChildren
|
public void replaceStringChildren(List<String> strings) {
ArrayList<StringEntity> entities = new ArrayList<>();
for (String string : strings) {
StringEntity entity = new StringEntity();
entity.setValue(string);
entities.add(entity);
}
replaceAll(entities);
}
|
java
|
public void replaceStringChildren(List<String> strings) {
ArrayList<StringEntity> entities = new ArrayList<>();
for (String string : strings) {
StringEntity entity = new StringEntity();
entity.setValue(string);
entities.add(entity);
}
replaceAll(entities);
}
|
[
"public",
"void",
"replaceStringChildren",
"(",
"List",
"<",
"String",
">",
"strings",
")",
"{",
"ArrayList",
"<",
"StringEntity",
">",
"entities",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"string",
":",
"strings",
")",
"{",
"StringEntity",
"entity",
"=",
"new",
"StringEntity",
"(",
")",
";",
"entity",
".",
"setValue",
"(",
"string",
")",
";",
"entities",
".",
"add",
"(",
"entity",
")",
";",
"}",
"replaceAll",
"(",
"entities",
")",
";",
"}"
] |
This method allows to replace all string children, it will remove any children which are not in the list, add the
new ones and update which are in the list.
@param strings string children list to replace.
|
[
"This",
"method",
"allows",
"to",
"replace",
"all",
"string",
"children",
"it",
"will",
"remove",
"any",
"children",
"which",
"are",
"not",
"in",
"the",
"list",
"add",
"the",
"new",
"ones",
"and",
"update",
"which",
"are",
"in",
"the",
"list",
"."
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java#L87-L95
|
11,640
|
maxirosson/jdroid-android
|
jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java
|
StringEntityRepository.getStringChildren
|
public List<String> getStringChildren(Long parentId) {
ArrayList<String> strings = new ArrayList<>();
List<StringEntity> entities = getByField(Column.PARENT_ID, parentId);
for (StringEntity entity : entities) {
strings.add(entity.getValue());
}
return strings;
}
|
java
|
public List<String> getStringChildren(Long parentId) {
ArrayList<String> strings = new ArrayList<>();
List<StringEntity> entities = getByField(Column.PARENT_ID, parentId);
for (StringEntity entity : entities) {
strings.add(entity.getValue());
}
return strings;
}
|
[
"public",
"List",
"<",
"String",
">",
"getStringChildren",
"(",
"Long",
"parentId",
")",
"{",
"ArrayList",
"<",
"String",
">",
"strings",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"StringEntity",
">",
"entities",
"=",
"getByField",
"(",
"Column",
".",
"PARENT_ID",
",",
"parentId",
")",
";",
"for",
"(",
"StringEntity",
"entity",
":",
"entities",
")",
"{",
"strings",
".",
"add",
"(",
"entity",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"strings",
";",
"}"
] |
This method returns the list of strings associated with given parent id.
@param parentId of parent entity.
@return list of strings
|
[
"This",
"method",
"returns",
"the",
"list",
"of",
"strings",
"associated",
"with",
"given",
"parent",
"id",
"."
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java#L103-L110
|
11,641
|
maxirosson/jdroid-android
|
jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java
|
StringEntityRepository.getAllString
|
public List<String> getAllString() {
ArrayList<String> strings = new ArrayList<>();
List<StringEntity> entities = getAll();
for (StringEntity entity : entities) {
strings.add(entity.getValue());
}
return strings;
}
|
java
|
public List<String> getAllString() {
ArrayList<String> strings = new ArrayList<>();
List<StringEntity> entities = getAll();
for (StringEntity entity : entities) {
strings.add(entity.getValue());
}
return strings;
}
|
[
"public",
"List",
"<",
"String",
">",
"getAllString",
"(",
")",
"{",
"ArrayList",
"<",
"String",
">",
"strings",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"StringEntity",
">",
"entities",
"=",
"getAll",
"(",
")",
";",
"for",
"(",
"StringEntity",
"entity",
":",
"entities",
")",
"{",
"strings",
".",
"add",
"(",
"entity",
".",
"getValue",
"(",
")",
")",
";",
"}",
"return",
"strings",
";",
"}"
] |
Returns all strings.
@return list of strings
|
[
"Returns",
"all",
"strings",
"."
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/StringEntityRepository.java#L117-L124
|
11,642
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/DoubleRange.java
|
DoubleRange.overlapRelative
|
public double overlapRelative(DoubleRange other) {
double lenThis = length();
double lenOther = other.length();
if (lenThis == 0 && lenOther == 0) {
// check for single points being compared, if it's the same point overlap is 1
// if points are different, overlap is 0
return this.equals(other) ? 1 : 0;
}
double overlapAbs = overlapAbsolute(other);
return overlapAbs / Math
.max(lenThis, lenOther); // one of the lengths is guaranteed to be non-zero
}
|
java
|
public double overlapRelative(DoubleRange other) {
double lenThis = length();
double lenOther = other.length();
if (lenThis == 0 && lenOther == 0) {
// check for single points being compared, if it's the same point overlap is 1
// if points are different, overlap is 0
return this.equals(other) ? 1 : 0;
}
double overlapAbs = overlapAbsolute(other);
return overlapAbs / Math
.max(lenThis, lenOther); // one of the lengths is guaranteed to be non-zero
}
|
[
"public",
"double",
"overlapRelative",
"(",
"DoubleRange",
"other",
")",
"{",
"double",
"lenThis",
"=",
"length",
"(",
")",
";",
"double",
"lenOther",
"=",
"other",
".",
"length",
"(",
")",
";",
"if",
"(",
"lenThis",
"==",
"0",
"&&",
"lenOther",
"==",
"0",
")",
"{",
"// check for single points being compared, if it's the same point overlap is 1",
"// if points are different, overlap is 0",
"return",
"this",
".",
"equals",
"(",
"other",
")",
"?",
"1",
":",
"0",
";",
"}",
"double",
"overlapAbs",
"=",
"overlapAbsolute",
"(",
"other",
")",
";",
"return",
"overlapAbs",
"/",
"Math",
".",
"max",
"(",
"lenThis",
",",
"lenOther",
")",
";",
"// one of the lengths is guaranteed to be non-zero",
"}"
] |
Relative overlap, that is the overlap, divided by the length of the largest interval. If both
intervals are single points and they're equal - returns 1
@param other interval to compare to
@return if the intervals are single points will return 1, if the points are the same. If a
point is compared against a non-point interval, then the result is zero.
|
[
"Relative",
"overlap",
"that",
"is",
"the",
"overlap",
"divided",
"by",
"the",
"length",
"of",
"the",
"largest",
"interval",
".",
"If",
"both",
"intervals",
"are",
"single",
"points",
"and",
"they",
"re",
"equal",
"-",
"returns",
"1"
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/DoubleRange.java#L65-L77
|
11,643
|
hdbeukel/james-core
|
src/main/java/org/jamesframework/core/search/algo/BasicParallelSearch.java
|
BasicParallelSearch.searchDisposed
|
@Override
protected void searchDisposed() {
// release thread pool
pool.shutdown();
// dispose contained searches
searches.forEach(s -> s.dispose());
// dispose super
super.searchDisposed();
}
|
java
|
@Override
protected void searchDisposed() {
// release thread pool
pool.shutdown();
// dispose contained searches
searches.forEach(s -> s.dispose());
// dispose super
super.searchDisposed();
}
|
[
"@",
"Override",
"protected",
"void",
"searchDisposed",
"(",
")",
"{",
"// release thread pool",
"pool",
".",
"shutdown",
"(",
")",
";",
"// dispose contained searches",
"searches",
".",
"forEach",
"(",
"s",
"->",
"s",
".",
"dispose",
"(",
")",
")",
";",
"// dispose super",
"super",
".",
"searchDisposed",
"(",
")",
";",
"}"
] |
When disposing a basic parallel search, each of the searches that have been added to the parallel
algorithm are disposed and the thread pool used for concurrent search execution is released.
|
[
"When",
"disposing",
"a",
"basic",
"parallel",
"search",
"each",
"of",
"the",
"searches",
"that",
"have",
"been",
"added",
"to",
"the",
"parallel",
"algorithm",
"are",
"disposed",
"and",
"the",
"thread",
"pool",
"used",
"for",
"concurrent",
"search",
"execution",
"is",
"released",
"."
] |
4e85c20c142902373e5b5e8b5d12a2558650f66d
|
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/algo/BasicParallelSearch.java#L206-L214
|
11,644
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/datatypes/scancollection/ScanIndex.java
|
ScanIndex.add
|
public IScan add(IScan scan) {
int num = scan.getNum();
IScan oldScan = getNum2scan().put(num, scan);
log.trace("Adding scan #{} to ScanIndex. num2scan map already contained a scan for scanNum: {}",
num, num);
final Double rt = scan.getRt();
final TreeMap<Double, List<IScan>> rt2scan = getRt2scan();
if (scan.getRt() != null) {
List<IScan> scans = rt2scan.get(rt);
if (scans == null) {
// no entries for this RT yet
scans = new ArrayList<>(1);
scans.add(scan);
getRt2scan().put(rt, scans);
} else {
// check if this scan was in the list
boolean replaced = false;
for (int i = 0; i < scans.size(); i++) {
IScan s = scans.get(i);
if (s.getNum() == scan.getNum()) {
scans.set(i, scan);
replaced = true;
break;
}
}
if (!replaced) {
scans.add(scan);
}
}
} else {
log.debug("Adding scan # to ScanIndex. No RT.", num);
}
return oldScan;
}
|
java
|
public IScan add(IScan scan) {
int num = scan.getNum();
IScan oldScan = getNum2scan().put(num, scan);
log.trace("Adding scan #{} to ScanIndex. num2scan map already contained a scan for scanNum: {}",
num, num);
final Double rt = scan.getRt();
final TreeMap<Double, List<IScan>> rt2scan = getRt2scan();
if (scan.getRt() != null) {
List<IScan> scans = rt2scan.get(rt);
if (scans == null) {
// no entries for this RT yet
scans = new ArrayList<>(1);
scans.add(scan);
getRt2scan().put(rt, scans);
} else {
// check if this scan was in the list
boolean replaced = false;
for (int i = 0; i < scans.size(); i++) {
IScan s = scans.get(i);
if (s.getNum() == scan.getNum()) {
scans.set(i, scan);
replaced = true;
break;
}
}
if (!replaced) {
scans.add(scan);
}
}
} else {
log.debug("Adding scan # to ScanIndex. No RT.", num);
}
return oldScan;
}
|
[
"public",
"IScan",
"add",
"(",
"IScan",
"scan",
")",
"{",
"int",
"num",
"=",
"scan",
".",
"getNum",
"(",
")",
";",
"IScan",
"oldScan",
"=",
"getNum2scan",
"(",
")",
".",
"put",
"(",
"num",
",",
"scan",
")",
";",
"log",
".",
"trace",
"(",
"\"Adding scan #{} to ScanIndex. num2scan map already contained a scan for scanNum: {}\"",
",",
"num",
",",
"num",
")",
";",
"final",
"Double",
"rt",
"=",
"scan",
".",
"getRt",
"(",
")",
";",
"final",
"TreeMap",
"<",
"Double",
",",
"List",
"<",
"IScan",
">",
">",
"rt2scan",
"=",
"getRt2scan",
"(",
")",
";",
"if",
"(",
"scan",
".",
"getRt",
"(",
")",
"!=",
"null",
")",
"{",
"List",
"<",
"IScan",
">",
"scans",
"=",
"rt2scan",
".",
"get",
"(",
"rt",
")",
";",
"if",
"(",
"scans",
"==",
"null",
")",
"{",
"// no entries for this RT yet",
"scans",
"=",
"new",
"ArrayList",
"<>",
"(",
"1",
")",
";",
"scans",
".",
"add",
"(",
"scan",
")",
";",
"getRt2scan",
"(",
")",
".",
"put",
"(",
"rt",
",",
"scans",
")",
";",
"}",
"else",
"{",
"// check if this scan was in the list",
"boolean",
"replaced",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"scans",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"IScan",
"s",
"=",
"scans",
".",
"get",
"(",
"i",
")",
";",
"if",
"(",
"s",
".",
"getNum",
"(",
")",
"==",
"scan",
".",
"getNum",
"(",
")",
")",
"{",
"scans",
".",
"set",
"(",
"i",
",",
"scan",
")",
";",
"replaced",
"=",
"true",
";",
"break",
";",
"}",
"}",
"if",
"(",
"!",
"replaced",
")",
"{",
"scans",
".",
"add",
"(",
"scan",
")",
";",
"}",
"}",
"}",
"else",
"{",
"log",
".",
"debug",
"(",
"\"Adding scan # to ScanIndex. No RT.\"",
",",
"num",
")",
";",
"}",
"return",
"oldScan",
";",
"}"
] |
Adds a scan to the index. If the scan has RT set to non-null, will also add it to RT index. If
a scan with the same scan number was already in the index, then it will get replaced.
@return if a scan with the same scan number was already in the index, then it will be returned.
|
[
"Adds",
"a",
"scan",
"to",
"the",
"index",
".",
"If",
"the",
"scan",
"has",
"RT",
"set",
"to",
"non",
"-",
"null",
"will",
"also",
"add",
"it",
"to",
"RT",
"index",
".",
"If",
"a",
"scan",
"with",
"the",
"same",
"scan",
"number",
"was",
"already",
"in",
"the",
"index",
"then",
"it",
"will",
"get",
"replaced",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/datatypes/scancollection/ScanIndex.java#L56-L91
|
11,645
|
maxirosson/jdroid-android
|
jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java
|
SQLiteRepository.beginTransaction
|
protected boolean beginTransaction(SQLiteDatabase db) {
boolean endTransaction = false;
if (!db.inTransaction()) {
db.beginTransaction();
endTransaction = true;
LOGGER.trace("Begin transaction");
}
return endTransaction;
}
|
java
|
protected boolean beginTransaction(SQLiteDatabase db) {
boolean endTransaction = false;
if (!db.inTransaction()) {
db.beginTransaction();
endTransaction = true;
LOGGER.trace("Begin transaction");
}
return endTransaction;
}
|
[
"protected",
"boolean",
"beginTransaction",
"(",
"SQLiteDatabase",
"db",
")",
"{",
"boolean",
"endTransaction",
"=",
"false",
";",
"if",
"(",
"!",
"db",
".",
"inTransaction",
"(",
")",
")",
"{",
"db",
".",
"beginTransaction",
"(",
")",
";",
"endTransaction",
"=",
"true",
";",
"LOGGER",
".",
"trace",
"(",
"\"Begin transaction\"",
")",
";",
"}",
"return",
"endTransaction",
";",
"}"
] |
Begins a transaction if there is not a transaction started yet.
@param db Database.
@return true if a transaction has been started.
|
[
"Begins",
"a",
"transaction",
"if",
"there",
"is",
"not",
"a",
"transaction",
"started",
"yet",
"."
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java#L114-L122
|
11,646
|
maxirosson/jdroid-android
|
jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java
|
SQLiteRepository.getCreateTableSQL
|
public String getCreateTableSQL() {
StringBuilder builder = new StringBuilder();
// Add columns
for (Column column : getColumns()) {
addColumn(builder, column);
builder.append(", ");
}
// Add references
StringBuilder referencesBuilder = new StringBuilder();
for (Column column : getColumns()) {
if (column.getReference() != null) {
referencesBuilder.append("FOREIGN KEY(").append(column.getColumnName()).append(") REFERENCES ").append(
column.getReference().getTableName()).append("(").append(
column.getReference().getColumn().getColumnName()).append(") ON DELETE CASCADE, ");
}
}
// Add unique constraint
StringBuilder uniqueBuilder = new StringBuilder();
boolean first = true;
for (Column column : getColumns()) {
if (column.isUnique()) {
if (!first) {
uniqueBuilder.append(", ");
}
first = false;
uniqueBuilder.append(column.getColumnName());
}
}
return getCreateTableSQL(builder.toString(), referencesBuilder.toString(), uniqueBuilder.toString());
}
|
java
|
public String getCreateTableSQL() {
StringBuilder builder = new StringBuilder();
// Add columns
for (Column column : getColumns()) {
addColumn(builder, column);
builder.append(", ");
}
// Add references
StringBuilder referencesBuilder = new StringBuilder();
for (Column column : getColumns()) {
if (column.getReference() != null) {
referencesBuilder.append("FOREIGN KEY(").append(column.getColumnName()).append(") REFERENCES ").append(
column.getReference().getTableName()).append("(").append(
column.getReference().getColumn().getColumnName()).append(") ON DELETE CASCADE, ");
}
}
// Add unique constraint
StringBuilder uniqueBuilder = new StringBuilder();
boolean first = true;
for (Column column : getColumns()) {
if (column.isUnique()) {
if (!first) {
uniqueBuilder.append(", ");
}
first = false;
uniqueBuilder.append(column.getColumnName());
}
}
return getCreateTableSQL(builder.toString(), referencesBuilder.toString(), uniqueBuilder.toString());
}
|
[
"public",
"String",
"getCreateTableSQL",
"(",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// Add columns",
"for",
"(",
"Column",
"column",
":",
"getColumns",
"(",
")",
")",
"{",
"addColumn",
"(",
"builder",
",",
"column",
")",
";",
"builder",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"// Add references",
"StringBuilder",
"referencesBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Column",
"column",
":",
"getColumns",
"(",
")",
")",
"{",
"if",
"(",
"column",
".",
"getReference",
"(",
")",
"!=",
"null",
")",
"{",
"referencesBuilder",
".",
"append",
"(",
"\"FOREIGN KEY(\"",
")",
".",
"append",
"(",
"column",
".",
"getColumnName",
"(",
")",
")",
".",
"append",
"(",
"\") REFERENCES \"",
")",
".",
"append",
"(",
"column",
".",
"getReference",
"(",
")",
".",
"getTableName",
"(",
")",
")",
".",
"append",
"(",
"\"(\"",
")",
".",
"append",
"(",
"column",
".",
"getReference",
"(",
")",
".",
"getColumn",
"(",
")",
".",
"getColumnName",
"(",
")",
")",
".",
"append",
"(",
"\") ON DELETE CASCADE, \"",
")",
";",
"}",
"}",
"// Add unique constraint",
"StringBuilder",
"uniqueBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"for",
"(",
"Column",
"column",
":",
"getColumns",
"(",
")",
")",
"{",
"if",
"(",
"column",
".",
"isUnique",
"(",
")",
")",
"{",
"if",
"(",
"!",
"first",
")",
"{",
"uniqueBuilder",
".",
"append",
"(",
"\", \"",
")",
";",
"}",
"first",
"=",
"false",
";",
"uniqueBuilder",
".",
"append",
"(",
"column",
".",
"getColumnName",
"(",
")",
")",
";",
"}",
"}",
"return",
"getCreateTableSQL",
"(",
"builder",
".",
"toString",
"(",
")",
",",
"referencesBuilder",
".",
"toString",
"(",
")",
",",
"uniqueBuilder",
".",
"toString",
"(",
")",
")",
";",
"}"
] |
Creates the SQL statement to create the table according columns definitions.
@return SQL statement.
|
[
"Creates",
"the",
"SQL",
"statement",
"to",
"create",
"the",
"table",
"according",
"columns",
"definitions",
"."
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java#L453-L482
|
11,647
|
maxirosson/jdroid-android
|
jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java
|
SQLiteRepository.getCreateTableSQL
|
private String getCreateTableSQL(String columns, String references, String uniqueColumns) {
StringBuilder builder = new StringBuilder();
builder.append("CREATE TABLE ").append(getTableName()).append("(");
builder.append(columns);
builder.append(references);
builder.append("UNIQUE (").append(uniqueColumns).append(") ON CONFLICT REPLACE");
builder.append(");");
return builder.toString();
}
|
java
|
private String getCreateTableSQL(String columns, String references, String uniqueColumns) {
StringBuilder builder = new StringBuilder();
builder.append("CREATE TABLE ").append(getTableName()).append("(");
builder.append(columns);
builder.append(references);
builder.append("UNIQUE (").append(uniqueColumns).append(") ON CONFLICT REPLACE");
builder.append(");");
return builder.toString();
}
|
[
"private",
"String",
"getCreateTableSQL",
"(",
"String",
"columns",
",",
"String",
"references",
",",
"String",
"uniqueColumns",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"builder",
".",
"append",
"(",
"\"CREATE TABLE \"",
")",
".",
"append",
"(",
"getTableName",
"(",
")",
")",
".",
"append",
"(",
"\"(\"",
")",
";",
"builder",
".",
"append",
"(",
"columns",
")",
";",
"builder",
".",
"append",
"(",
"references",
")",
";",
"builder",
".",
"append",
"(",
"\"UNIQUE (\"",
")",
".",
"append",
"(",
"uniqueColumns",
")",
".",
"append",
"(",
"\") ON CONFLICT REPLACE\"",
")",
";",
"builder",
".",
"append",
"(",
"\");\"",
")",
";",
"return",
"builder",
".",
"toString",
"(",
")",
";",
"}"
] |
Creates the SQL statement to create the table using given columns definitions.
@param columns columns definitions.
@param references reference constraints.
@param uniqueColumns unique constraints.
@return SQL statement.
|
[
"Creates",
"the",
"SQL",
"statement",
"to",
"create",
"the",
"table",
"using",
"given",
"columns",
"definitions",
"."
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java#L492-L500
|
11,648
|
maxirosson/jdroid-android
|
jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java
|
SQLiteRepository.addColumn
|
private void addColumn(StringBuilder builder, Column column) {
builder.append(column.getColumnName());
builder.append(" ");
builder.append(column.getDataType().getType());
Boolean optional = column.isOptional();
if (optional != null) {
builder.append(optional ? " NULL" : " NOT NULL");
}
String extraQualifier = column.getExtraQualifier();
if (extraQualifier != null) {
builder.append(" ");
builder.append(extraQualifier);
}
}
|
java
|
private void addColumn(StringBuilder builder, Column column) {
builder.append(column.getColumnName());
builder.append(" ");
builder.append(column.getDataType().getType());
Boolean optional = column.isOptional();
if (optional != null) {
builder.append(optional ? " NULL" : " NOT NULL");
}
String extraQualifier = column.getExtraQualifier();
if (extraQualifier != null) {
builder.append(" ");
builder.append(extraQualifier);
}
}
|
[
"private",
"void",
"addColumn",
"(",
"StringBuilder",
"builder",
",",
"Column",
"column",
")",
"{",
"builder",
".",
"append",
"(",
"column",
".",
"getColumnName",
"(",
")",
")",
";",
"builder",
".",
"append",
"(",
"\" \"",
")",
";",
"builder",
".",
"append",
"(",
"column",
".",
"getDataType",
"(",
")",
".",
"getType",
"(",
")",
")",
";",
"Boolean",
"optional",
"=",
"column",
".",
"isOptional",
"(",
")",
";",
"if",
"(",
"optional",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"optional",
"?",
"\" NULL\"",
":",
"\" NOT NULL\"",
")",
";",
"}",
"String",
"extraQualifier",
"=",
"column",
".",
"getExtraQualifier",
"(",
")",
";",
"if",
"(",
"extraQualifier",
"!=",
"null",
")",
"{",
"builder",
".",
"append",
"(",
"\" \"",
")",
";",
"builder",
".",
"append",
"(",
"extraQualifier",
")",
";",
"}",
"}"
] |
Generate the SQL definition for a column.
@param builder current StringBuilder to add the SQL definition.
@param column column definition.
|
[
"Generate",
"the",
"SQL",
"definition",
"for",
"a",
"column",
"."
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-sqlite/src/main/java/com/jdroid/android/sqlite/repository/SQLiteRepository.java#L508-L521
|
11,649
|
rpau/javalang
|
src/main/java/org/walkmod/javalang/ast/Node.java
|
Node.contains
|
public boolean contains(Node node2) {
if ((getBeginLine() < node2.getBeginLine())
|| ((getBeginLine() == node2.getBeginLine()) && getBeginColumn() <= node2.getBeginColumn())) {
if (getEndLine() > node2.getEndLine()) {
return true;
} else if ((getEndLine() == node2.getEndLine()) && getEndColumn() >= node2.getEndColumn()) {
return true;
}
}
return false;
}
|
java
|
public boolean contains(Node node2) {
if ((getBeginLine() < node2.getBeginLine())
|| ((getBeginLine() == node2.getBeginLine()) && getBeginColumn() <= node2.getBeginColumn())) {
if (getEndLine() > node2.getEndLine()) {
return true;
} else if ((getEndLine() == node2.getEndLine()) && getEndColumn() >= node2.getEndColumn()) {
return true;
}
}
return false;
}
|
[
"public",
"boolean",
"contains",
"(",
"Node",
"node2",
")",
"{",
"if",
"(",
"(",
"getBeginLine",
"(",
")",
"<",
"node2",
".",
"getBeginLine",
"(",
")",
")",
"||",
"(",
"(",
"getBeginLine",
"(",
")",
"==",
"node2",
".",
"getBeginLine",
"(",
")",
")",
"&&",
"getBeginColumn",
"(",
")",
"<=",
"node2",
".",
"getBeginColumn",
"(",
")",
")",
")",
"{",
"if",
"(",
"getEndLine",
"(",
")",
">",
"node2",
".",
"getEndLine",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"(",
"getEndLine",
"(",
")",
"==",
"node2",
".",
"getEndLine",
"(",
")",
")",
"&&",
"getEndColumn",
"(",
")",
">=",
"node2",
".",
"getEndColumn",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Return if this node contains another node according their line numbers and columns
@param node2
the probably contained node
@return if this node contains the argument as a child node by its position.
|
[
"Return",
"if",
"this",
"node",
"contains",
"another",
"node",
"according",
"their",
"line",
"numbers",
"and",
"columns"
] |
17ab1d6cbe7527a2f272049c4958354328de2171
|
https://github.com/rpau/javalang/blob/17ab1d6cbe7527a2f272049c4958354328de2171/src/main/java/org/walkmod/javalang/ast/Node.java#L272-L282
|
11,650
|
rpau/javalang
|
src/main/java/org/walkmod/javalang/ast/Node.java
|
Node.isInEqualLocation
|
public boolean isInEqualLocation(Node node2) {
if (!isNewNode() && !node2.isNewNode()) {
return getBeginLine() == node2.getBeginLine() && getBeginColumn() == node2.getBeginColumn()
&& getEndLine() == node2.getEndLine() && getEndColumn() == node2.getEndColumn();
}
return false;
}
|
java
|
public boolean isInEqualLocation(Node node2) {
if (!isNewNode() && !node2.isNewNode()) {
return getBeginLine() == node2.getBeginLine() && getBeginColumn() == node2.getBeginColumn()
&& getEndLine() == node2.getEndLine() && getEndColumn() == node2.getEndColumn();
}
return false;
}
|
[
"public",
"boolean",
"isInEqualLocation",
"(",
"Node",
"node2",
")",
"{",
"if",
"(",
"!",
"isNewNode",
"(",
")",
"&&",
"!",
"node2",
".",
"isNewNode",
"(",
")",
")",
"{",
"return",
"getBeginLine",
"(",
")",
"==",
"node2",
".",
"getBeginLine",
"(",
")",
"&&",
"getBeginColumn",
"(",
")",
"==",
"node2",
".",
"getBeginColumn",
"(",
")",
"&&",
"getEndLine",
"(",
")",
"==",
"node2",
".",
"getEndLine",
"(",
")",
"&&",
"getEndColumn",
"(",
")",
"==",
"node2",
".",
"getEndColumn",
"(",
")",
";",
"}",
"return",
"false",
";",
"}"
] |
Return if this node has the same columns and lines than another one.
@param node2
the node to compare
@return if this node has the same columns and lines than another one.
|
[
"Return",
"if",
"this",
"node",
"has",
"the",
"same",
"columns",
"and",
"lines",
"than",
"another",
"one",
"."
] |
17ab1d6cbe7527a2f272049c4958354328de2171
|
https://github.com/rpau/javalang/blob/17ab1d6cbe7527a2f272049c4958354328de2171/src/main/java/org/walkmod/javalang/ast/Node.java#L291-L297
|
11,651
|
rpau/javalang
|
src/main/java/org/walkmod/javalang/ast/Node.java
|
Node.isPreviousThan
|
public boolean isPreviousThan(Node node) {
if (getEndLine() < node.getBeginLine()) {
return true;
} else if ((getEndLine() == node.getBeginLine()) && (getEndColumn() <= node.getBeginColumn())) {
return true;
}
return false;
}
|
java
|
public boolean isPreviousThan(Node node) {
if (getEndLine() < node.getBeginLine()) {
return true;
} else if ((getEndLine() == node.getBeginLine()) && (getEndColumn() <= node.getBeginColumn())) {
return true;
}
return false;
}
|
[
"public",
"boolean",
"isPreviousThan",
"(",
"Node",
"node",
")",
"{",
"if",
"(",
"getEndLine",
"(",
")",
"<",
"node",
".",
"getBeginLine",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"(",
"getEndLine",
"(",
")",
"==",
"node",
".",
"getBeginLine",
"(",
")",
")",
"&&",
"(",
"getEndColumn",
"(",
")",
"<=",
"node",
".",
"getBeginColumn",
"(",
")",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Return if this node is previous than another one according their line and column numbers
@param node
to compare
@return if this node is previous than another one according their line and
|
[
"Return",
"if",
"this",
"node",
"is",
"previous",
"than",
"another",
"one",
"according",
"their",
"line",
"and",
"column",
"numbers"
] |
17ab1d6cbe7527a2f272049c4958354328de2171
|
https://github.com/rpau/javalang/blob/17ab1d6cbe7527a2f272049c4958354328de2171/src/main/java/org/walkmod/javalang/ast/Node.java#L306-L313
|
11,652
|
jboss/jboss-el-api_spec
|
src/main/java/javax/el/CompositeELResolver.java
|
CompositeELResolver.add
|
public void add(ELResolver elResolver) {
if (elResolver == null) {
throw new NullPointerException();
}
if (size >= elResolvers.length) {
ELResolver[] newResolvers = new ELResolver[size * 2];
System.arraycopy(elResolvers, 0, newResolvers, 0, size);
elResolvers = newResolvers;
}
elResolvers[size++] = elResolver;
}
|
java
|
public void add(ELResolver elResolver) {
if (elResolver == null) {
throw new NullPointerException();
}
if (size >= elResolvers.length) {
ELResolver[] newResolvers = new ELResolver[size * 2];
System.arraycopy(elResolvers, 0, newResolvers, 0, size);
elResolvers = newResolvers;
}
elResolvers[size++] = elResolver;
}
|
[
"public",
"void",
"add",
"(",
"ELResolver",
"elResolver",
")",
"{",
"if",
"(",
"elResolver",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"if",
"(",
"size",
">=",
"elResolvers",
".",
"length",
")",
"{",
"ELResolver",
"[",
"]",
"newResolvers",
"=",
"new",
"ELResolver",
"[",
"size",
"*",
"2",
"]",
";",
"System",
".",
"arraycopy",
"(",
"elResolvers",
",",
"0",
",",
"newResolvers",
",",
"0",
",",
"size",
")",
";",
"elResolvers",
"=",
"newResolvers",
";",
"}",
"elResolvers",
"[",
"size",
"++",
"]",
"=",
"elResolver",
";",
"}"
] |
Adds the given resolver to the list of component resolvers.
<p>Resolvers are consulted in the order in which they are added.</p>
@param elResolver The component resolver to add.
@throws NullPointerException If the provided resolver is
<code>null</code>.
|
[
"Adds",
"the",
"given",
"resolver",
"to",
"the",
"list",
"of",
"component",
"resolvers",
"."
] |
4cef117cae3ccf9f76439845687a8d219ad2eb43
|
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/CompositeELResolver.java#L114-L127
|
11,653
|
jboss/jboss-el-api_spec
|
src/main/java/javax/el/CompositeELResolver.java
|
CompositeELResolver.convertToType
|
@Override
public Object convertToType(ELContext context,
Object obj,
Class<?> targetType) {
context.setPropertyResolved(false);
Object value = null;
for (int i = 0; i < size; i++) {
value = elResolvers[i].convertToType(context, obj, targetType);
if (context.isPropertyResolved()) {
return value;
}
}
return null;
}
|
java
|
@Override
public Object convertToType(ELContext context,
Object obj,
Class<?> targetType) {
context.setPropertyResolved(false);
Object value = null;
for (int i = 0; i < size; i++) {
value = elResolvers[i].convertToType(context, obj, targetType);
if (context.isPropertyResolved()) {
return value;
}
}
return null;
}
|
[
"@",
"Override",
"public",
"Object",
"convertToType",
"(",
"ELContext",
"context",
",",
"Object",
"obj",
",",
"Class",
"<",
"?",
">",
"targetType",
")",
"{",
"context",
".",
"setPropertyResolved",
"(",
"false",
")",
";",
"Object",
"value",
"=",
"null",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"size",
";",
"i",
"++",
")",
"{",
"value",
"=",
"elResolvers",
"[",
"i",
"]",
".",
"convertToType",
"(",
"context",
",",
"obj",
",",
"targetType",
")",
";",
"if",
"(",
"context",
".",
"isPropertyResolved",
"(",
")",
")",
"{",
"return",
"value",
";",
"}",
"}",
"return",
"null",
";",
"}"
] |
Converts an object to a specific type.
<p>An <code>ELException</code> is thrown if an error occurs during
the conversion.</p>
@param context The context of this evaluation.
@param obj The object to convert.
@param targetType The target type for the convertion.
@throws ELException thrown if errors occur.
@since EL 3.0
|
[
"Converts",
"an",
"object",
"to",
"a",
"specific",
"type",
"."
] |
4cef117cae3ccf9f76439845687a8d219ad2eb43
|
https://github.com/jboss/jboss-el-api_spec/blob/4cef117cae3ccf9f76439845687a8d219ad2eb43/src/main/java/javax/el/CompositeELResolver.java#L558-L573
|
11,654
|
lucasr/dspec
|
library/src/main/java/org/lucasr/dspec/DesignSpec.java
|
DesignSpec.setBaselineGridColor
|
public DesignSpec setBaselineGridColor(int color) {
if (mBaselineGridPaint.getColor() == color) {
return this;
}
mBaselineGridPaint.setColor(color);
invalidateSelf();
return this;
}
|
java
|
public DesignSpec setBaselineGridColor(int color) {
if (mBaselineGridPaint.getColor() == color) {
return this;
}
mBaselineGridPaint.setColor(color);
invalidateSelf();
return this;
}
|
[
"public",
"DesignSpec",
"setBaselineGridColor",
"(",
"int",
"color",
")",
"{",
"if",
"(",
"mBaselineGridPaint",
".",
"getColor",
"(",
")",
"==",
"color",
")",
"{",
"return",
"this",
";",
"}",
"mBaselineGridPaint",
".",
"setColor",
"(",
"color",
")",
";",
"invalidateSelf",
"(",
")",
";",
"return",
"this",
";",
"}"
] |
Sets the baseline grid color.
|
[
"Sets",
"the",
"baseline",
"grid",
"color",
"."
] |
16681449953153c649801cf8aa7d22e372586370
|
https://github.com/lucasr/dspec/blob/16681449953153c649801cf8aa7d22e372586370/library/src/main/java/org/lucasr/dspec/DesignSpec.java#L289-L298
|
11,655
|
lucasr/dspec
|
library/src/main/java/org/lucasr/dspec/DesignSpec.java
|
DesignSpec.setKeylinesColor
|
public DesignSpec setKeylinesColor(int color) {
if (mKeylinesPaint.getColor() == color) {
return this;
}
mKeylinesPaint.setColor(color);
invalidateSelf();
return this;
}
|
java
|
public DesignSpec setKeylinesColor(int color) {
if (mKeylinesPaint.getColor() == color) {
return this;
}
mKeylinesPaint.setColor(color);
invalidateSelf();
return this;
}
|
[
"public",
"DesignSpec",
"setKeylinesColor",
"(",
"int",
"color",
")",
"{",
"if",
"(",
"mKeylinesPaint",
".",
"getColor",
"(",
")",
"==",
"color",
")",
"{",
"return",
"this",
";",
"}",
"mKeylinesPaint",
".",
"setColor",
"(",
"color",
")",
";",
"invalidateSelf",
"(",
")",
";",
"return",
"this",
";",
"}"
] |
Sets the keyline color.
|
[
"Sets",
"the",
"keyline",
"color",
"."
] |
16681449953153c649801cf8aa7d22e372586370
|
https://github.com/lucasr/dspec/blob/16681449953153c649801cf8aa7d22e372586370/library/src/main/java/org/lucasr/dspec/DesignSpec.java#L324-L333
|
11,656
|
lucasr/dspec
|
library/src/main/java/org/lucasr/dspec/DesignSpec.java
|
DesignSpec.setSpacingsColor
|
public DesignSpec setSpacingsColor(int color) {
if (mSpacingsPaint.getColor() == color) {
return this;
}
mSpacingsPaint.setColor(color);
invalidateSelf();
return this;
}
|
java
|
public DesignSpec setSpacingsColor(int color) {
if (mSpacingsPaint.getColor() == color) {
return this;
}
mSpacingsPaint.setColor(color);
invalidateSelf();
return this;
}
|
[
"public",
"DesignSpec",
"setSpacingsColor",
"(",
"int",
"color",
")",
"{",
"if",
"(",
"mSpacingsPaint",
".",
"getColor",
"(",
")",
"==",
"color",
")",
"{",
"return",
"this",
";",
"}",
"mSpacingsPaint",
".",
"setColor",
"(",
"color",
")",
";",
"invalidateSelf",
"(",
")",
";",
"return",
"this",
";",
"}"
] |
Sets the spacing mark color.
|
[
"Sets",
"the",
"spacing",
"mark",
"color",
"."
] |
16681449953153c649801cf8aa7d22e372586370
|
https://github.com/lucasr/dspec/blob/16681449953153c649801cf8aa7d22e372586370/library/src/main/java/org/lucasr/dspec/DesignSpec.java#L372-L381
|
11,657
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/fileio/filetypes/mzxml/jaxb/Scan.java
|
Scan.getScanOrigin
|
public List<Scan.ScanOrigin> getScanOrigin() {
if (scanOrigin == null) {
scanOrigin = new ArrayList<Scan.ScanOrigin>();
}
return this.scanOrigin;
}
|
java
|
public List<Scan.ScanOrigin> getScanOrigin() {
if (scanOrigin == null) {
scanOrigin = new ArrayList<Scan.ScanOrigin>();
}
return this.scanOrigin;
}
|
[
"public",
"List",
"<",
"Scan",
".",
"ScanOrigin",
">",
"getScanOrigin",
"(",
")",
"{",
"if",
"(",
"scanOrigin",
"==",
"null",
")",
"{",
"scanOrigin",
"=",
"new",
"ArrayList",
"<",
"Scan",
".",
"ScanOrigin",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"scanOrigin",
";",
"}"
] |
Gets the value of the scanOrigin property.
<p>
This accessor method returns a reference to the live list, not a snapshot. Therefore any
modification you make to the returned list will be present inside the JAXB object. This is why
there is not a <CODE>set</CODE> method for the scanOrigin property.
<p>
For example, to add a new item, do as follows:
<pre>
getScanOrigin().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list {@link Scan.ScanOrigin }
|
[
"Gets",
"the",
"value",
"of",
"the",
"scanOrigin",
"property",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/fileio/filetypes/mzxml/jaxb/Scan.java#L278-L283
|
11,658
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/fileio/filetypes/mzxml/jaxb/Scan.java
|
Scan.getPrecursorMz
|
public List<Scan.PrecursorMz> getPrecursorMz() {
if (precursorMz == null) {
precursorMz = new ArrayList<Scan.PrecursorMz>();
}
return this.precursorMz;
}
|
java
|
public List<Scan.PrecursorMz> getPrecursorMz() {
if (precursorMz == null) {
precursorMz = new ArrayList<Scan.PrecursorMz>();
}
return this.precursorMz;
}
|
[
"public",
"List",
"<",
"Scan",
".",
"PrecursorMz",
">",
"getPrecursorMz",
"(",
")",
"{",
"if",
"(",
"precursorMz",
"==",
"null",
")",
"{",
"precursorMz",
"=",
"new",
"ArrayList",
"<",
"Scan",
".",
"PrecursorMz",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"precursorMz",
";",
"}"
] |
Gets the value of the precursorMz property.
<p>
This accessor method returns a reference to the live list, not a snapshot. Therefore any
modification you make to the returned list will be present inside the JAXB object. This is why
there is not a <CODE>set</CODE> method for the precursorMz property.
<p>
For example, to add a new item, do as follows:
<pre>
getPrecursorMz().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list {@link Scan.PrecursorMz }
|
[
"Gets",
"the",
"value",
"of",
"the",
"precursorMz",
"property",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/fileio/filetypes/mzxml/jaxb/Scan.java#L303-L308
|
11,659
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/fileio/filetypes/mzxml/jaxb/Scan.java
|
Scan.getPeaks
|
public List<Scan.Peaks> getPeaks() {
if (peaks == null) {
peaks = new ArrayList<Scan.Peaks>();
}
return this.peaks;
}
|
java
|
public List<Scan.Peaks> getPeaks() {
if (peaks == null) {
peaks = new ArrayList<Scan.Peaks>();
}
return this.peaks;
}
|
[
"public",
"List",
"<",
"Scan",
".",
"Peaks",
">",
"getPeaks",
"(",
")",
"{",
"if",
"(",
"peaks",
"==",
"null",
")",
"{",
"peaks",
"=",
"new",
"ArrayList",
"<",
"Scan",
".",
"Peaks",
">",
"(",
")",
";",
"}",
"return",
"this",
".",
"peaks",
";",
"}"
] |
Gets the value of the peaks property.
<p>
This accessor method returns a reference to the live list, not a snapshot. Therefore any
modification you make to the returned list will be present inside the JAXB object. This is why
there is not a <CODE>set</CODE> method for the peaks property.
<p>
For example, to add a new item, do as follows:
<pre>
getPeaks().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list {@link Scan.Peaks }
|
[
"Gets",
"the",
"value",
"of",
"the",
"peaks",
"property",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/fileio/filetypes/mzxml/jaxb/Scan.java#L346-L351
|
11,660
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/io/PagedInputBuffer.java
|
PagedInputBuffer.selectPage
|
private void selectPage(long offset) {
if (currentBuffer == null || currentBuffer.seekSuccessful(offset)) {
currentBuffer = null;
int i = 0;
// Look if the given offset is already stored in a page
while (i < pages.size() && currentBuffer == null) {
if (pages.get(i).seekSuccessful(offset))
currentBuffer = pages.get(i);
i++;
}
if (currentBuffer == null) {
// If the offset is not contained in any of the loaded pages, create a new one
// FIFO
if (pages.size() >= MaxPages)
pages.remove(0);
pages.add(new InputBuffer(input));
currentBuffer = pages.get(pages.size() - 1);
}
}
}
|
java
|
private void selectPage(long offset) {
if (currentBuffer == null || currentBuffer.seekSuccessful(offset)) {
currentBuffer = null;
int i = 0;
// Look if the given offset is already stored in a page
while (i < pages.size() && currentBuffer == null) {
if (pages.get(i).seekSuccessful(offset))
currentBuffer = pages.get(i);
i++;
}
if (currentBuffer == null) {
// If the offset is not contained in any of the loaded pages, create a new one
// FIFO
if (pages.size() >= MaxPages)
pages.remove(0);
pages.add(new InputBuffer(input));
currentBuffer = pages.get(pages.size() - 1);
}
}
}
|
[
"private",
"void",
"selectPage",
"(",
"long",
"offset",
")",
"{",
"if",
"(",
"currentBuffer",
"==",
"null",
"||",
"currentBuffer",
".",
"seekSuccessful",
"(",
"offset",
")",
")",
"{",
"currentBuffer",
"=",
"null",
";",
"int",
"i",
"=",
"0",
";",
"// Look if the given offset is already stored in a page",
"while",
"(",
"i",
"<",
"pages",
".",
"size",
"(",
")",
"&&",
"currentBuffer",
"==",
"null",
")",
"{",
"if",
"(",
"pages",
".",
"get",
"(",
"i",
")",
".",
"seekSuccessful",
"(",
"offset",
")",
")",
"currentBuffer",
"=",
"pages",
".",
"get",
"(",
"i",
")",
";",
"i",
"++",
";",
"}",
"if",
"(",
"currentBuffer",
"==",
"null",
")",
"{",
"// If the offset is not contained in any of the loaded pages, create a new one",
"// FIFO",
"if",
"(",
"pages",
".",
"size",
"(",
")",
">=",
"MaxPages",
")",
"pages",
".",
"remove",
"(",
"0",
")",
";",
"pages",
".",
"add",
"(",
"new",
"InputBuffer",
"(",
"input",
")",
")",
";",
"currentBuffer",
"=",
"pages",
".",
"get",
"(",
"pages",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"}",
"}",
"}"
] |
Select buffer.
@param offset the offset
|
[
"Select",
"buffer",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/io/PagedInputBuffer.java#L67-L90
|
11,661
|
hdbeukel/james-core
|
src/main/java/org/jamesframework/core/subset/neigh/SingleDeletionNeighbourhood.java
|
SingleDeletionNeighbourhood.getAllMoves
|
@Override
public List<SubsetMove> getAllMoves(SubsetSolution solution) {
// check minimum size
if(minSizeReached(solution)){
return Collections.emptyList();
}
// get set of candidate IDs for deletion (possibly fixed IDs are discarded)
Set<Integer> removeCandidates = getRemoveCandidates(solution);
// check if there are any candidates to be removed
if(removeCandidates.isEmpty()){
return Collections.emptyList();
}
// create deletion move for all candidates
return removeCandidates.stream()
.map(del -> new DeletionMove(del))
.collect(Collectors.toList());
}
|
java
|
@Override
public List<SubsetMove> getAllMoves(SubsetSolution solution) {
// check minimum size
if(minSizeReached(solution)){
return Collections.emptyList();
}
// get set of candidate IDs for deletion (possibly fixed IDs are discarded)
Set<Integer> removeCandidates = getRemoveCandidates(solution);
// check if there are any candidates to be removed
if(removeCandidates.isEmpty()){
return Collections.emptyList();
}
// create deletion move for all candidates
return removeCandidates.stream()
.map(del -> new DeletionMove(del))
.collect(Collectors.toList());
}
|
[
"@",
"Override",
"public",
"List",
"<",
"SubsetMove",
">",
"getAllMoves",
"(",
"SubsetSolution",
"solution",
")",
"{",
"// check minimum size",
"if",
"(",
"minSizeReached",
"(",
"solution",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"// get set of candidate IDs for deletion (possibly fixed IDs are discarded)",
"Set",
"<",
"Integer",
">",
"removeCandidates",
"=",
"getRemoveCandidates",
"(",
"solution",
")",
";",
"// check if there are any candidates to be removed",
"if",
"(",
"removeCandidates",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"// create deletion move for all candidates",
"return",
"removeCandidates",
".",
"stream",
"(",
")",
".",
"map",
"(",
"del",
"->",
"new",
"DeletionMove",
"(",
"del",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"}"
] |
Generates a list of all possible deletion moves that remove a single ID from the selection of a given
subset solution. Possible fixed IDs are not considered to be removed and the minimum subset size
is taken into account. May return an empty list if no deletion moves can be generated.
@param solution solution for which all possible deletion moves are generated
@return list of all deletion moves, may be empty
|
[
"Generates",
"a",
"list",
"of",
"all",
"possible",
"deletion",
"moves",
"that",
"remove",
"a",
"single",
"ID",
"from",
"the",
"selection",
"of",
"a",
"given",
"subset",
"solution",
".",
"Possible",
"fixed",
"IDs",
"are",
"not",
"considered",
"to",
"be",
"removed",
"and",
"the",
"minimum",
"subset",
"size",
"is",
"taken",
"into",
"account",
".",
"May",
"return",
"an",
"empty",
"list",
"if",
"no",
"deletion",
"moves",
"can",
"be",
"generated",
"."
] |
4e85c20c142902373e5b5e8b5d12a2558650f66d
|
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/subset/neigh/SingleDeletionNeighbourhood.java#L131-L147
|
11,662
|
hdbeukel/james-core
|
src/main/java/org/jamesframework/core/search/LocalSearch.java
|
LocalSearch.updateCurrentAndBestSolution
|
protected boolean updateCurrentAndBestSolution(SolutionType solution, Evaluation evaluation, Validation validation){
// update current solution
updateCurrentSolution(solution, evaluation, validation);
// update best solution (only updates if solution is valid)
return updateBestSolution(solution, evaluation, validation);
}
|
java
|
protected boolean updateCurrentAndBestSolution(SolutionType solution, Evaluation evaluation, Validation validation){
// update current solution
updateCurrentSolution(solution, evaluation, validation);
// update best solution (only updates if solution is valid)
return updateBestSolution(solution, evaluation, validation);
}
|
[
"protected",
"boolean",
"updateCurrentAndBestSolution",
"(",
"SolutionType",
"solution",
",",
"Evaluation",
"evaluation",
",",
"Validation",
"validation",
")",
"{",
"// update current solution",
"updateCurrentSolution",
"(",
"solution",
",",
"evaluation",
",",
"validation",
")",
";",
"// update best solution (only updates if solution is valid)",
"return",
"updateBestSolution",
"(",
"solution",
",",
"evaluation",
",",
"validation",
")",
";",
"}"
] |
Update the current and best solution during search, given that the respective solution has already
been evaluated and validated. The current solution is always updated, also if it is invalid. Conversely,
the best solution is only updated if the given solution is valid and improves over the best solution
found so far.
@param solution new current solution
@param evaluation evaluation of new current solution
@param validation validation of new current solution
@return <code>true</code> if the best solution has been updated
|
[
"Update",
"the",
"current",
"and",
"best",
"solution",
"during",
"search",
"given",
"that",
"the",
"respective",
"solution",
"has",
"already",
"been",
"evaluated",
"and",
"validated",
".",
"The",
"current",
"solution",
"is",
"always",
"updated",
"also",
"if",
"it",
"is",
"invalid",
".",
"Conversely",
"the",
"best",
"solution",
"is",
"only",
"updated",
"if",
"the",
"given",
"solution",
"is",
"valid",
"and",
"improves",
"over",
"the",
"best",
"solution",
"found",
"so",
"far",
"."
] |
4e85c20c142902373e5b5e8b5d12a2558650f66d
|
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/LocalSearch.java#L278-L283
|
11,663
|
maxirosson/jdroid-android
|
jdroid-android-core/src/main/java/com/jdroid/android/utils/ExternalAppsUtils.java
|
ExternalAppsUtils.launchOrDownloadApp
|
public static boolean launchOrDownloadApp(String applicationId) {
boolean isAppInstalled = isAppInstalled(applicationId);
if (isAppInstalled) {
launchExternalApp(applicationId);
} else {
GooglePlayUtils.launchAppDetails(applicationId);
}
return isAppInstalled;
}
|
java
|
public static boolean launchOrDownloadApp(String applicationId) {
boolean isAppInstalled = isAppInstalled(applicationId);
if (isAppInstalled) {
launchExternalApp(applicationId);
} else {
GooglePlayUtils.launchAppDetails(applicationId);
}
return isAppInstalled;
}
|
[
"public",
"static",
"boolean",
"launchOrDownloadApp",
"(",
"String",
"applicationId",
")",
"{",
"boolean",
"isAppInstalled",
"=",
"isAppInstalled",
"(",
"applicationId",
")",
";",
"if",
"(",
"isAppInstalled",
")",
"{",
"launchExternalApp",
"(",
"applicationId",
")",
";",
"}",
"else",
"{",
"GooglePlayUtils",
".",
"launchAppDetails",
"(",
"applicationId",
")",
";",
"}",
"return",
"isAppInstalled",
";",
"}"
] |
Launch applicationId app or open Google Play to download.
@param applicationId
@return true if app is installed, false otherwise.
|
[
"Launch",
"applicationId",
"app",
"or",
"open",
"Google",
"Play",
"to",
"download",
"."
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/utils/ExternalAppsUtils.java#L76-L84
|
11,664
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/StringUtils.java
|
StringUtils.getEnumFromString
|
public static <T extends Enum<T>> T getEnumFromString(Class<T> c, String string) {
if (c != null && string != null) {
return Enum.valueOf(c, string.trim().toUpperCase());
}
return null;
}
|
java
|
public static <T extends Enum<T>> T getEnumFromString(Class<T> c, String string) {
if (c != null && string != null) {
return Enum.valueOf(c, string.trim().toUpperCase());
}
return null;
}
|
[
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"getEnumFromString",
"(",
"Class",
"<",
"T",
">",
"c",
",",
"String",
"string",
")",
"{",
"if",
"(",
"c",
"!=",
"null",
"&&",
"string",
"!=",
"null",
")",
"{",
"return",
"Enum",
".",
"valueOf",
"(",
"c",
",",
"string",
".",
"trim",
"(",
")",
".",
"toUpperCase",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
A common method for all enums since they can't have another base class
@param <T> Enum type
@param c enum type. All enums must be all caps.
@param string case insensitive
@return corresponding enum, or null
|
[
"A",
"common",
"method",
"for",
"all",
"enums",
"since",
"they",
"can",
"t",
"have",
"another",
"base",
"class"
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/StringUtils.java#L108-L113
|
11,665
|
hdbeukel/james-core
|
src/main/java/org/jamesframework/core/search/algo/RandomDescent.java
|
RandomDescent.searchStep
|
@Override
protected void searchStep() {
// get random move
Move<? super SolutionType> move = getNeighbourhood().getRandomMove(getCurrentSolution(), getRandom());
// got move ?
if(move != null){
// accept if improvement
if(isImprovement(move)){
// accept move
accept(move);
} else {
// no improvement
reject(move);
}
} else {
// no move/neighbour reported by neighbourhood
stop();
}
}
|
java
|
@Override
protected void searchStep() {
// get random move
Move<? super SolutionType> move = getNeighbourhood().getRandomMove(getCurrentSolution(), getRandom());
// got move ?
if(move != null){
// accept if improvement
if(isImprovement(move)){
// accept move
accept(move);
} else {
// no improvement
reject(move);
}
} else {
// no move/neighbour reported by neighbourhood
stop();
}
}
|
[
"@",
"Override",
"protected",
"void",
"searchStep",
"(",
")",
"{",
"// get random move",
"Move",
"<",
"?",
"super",
"SolutionType",
">",
"move",
"=",
"getNeighbourhood",
"(",
")",
".",
"getRandomMove",
"(",
"getCurrentSolution",
"(",
")",
",",
"getRandom",
"(",
")",
")",
";",
"// got move ?",
"if",
"(",
"move",
"!=",
"null",
")",
"{",
"// accept if improvement",
"if",
"(",
"isImprovement",
"(",
"move",
")",
")",
"{",
"// accept move",
"accept",
"(",
"move",
")",
";",
"}",
"else",
"{",
"// no improvement",
"reject",
"(",
"move",
")",
";",
"}",
"}",
"else",
"{",
"// no move/neighbour reported by neighbourhood",
"stop",
"(",
")",
";",
"}",
"}"
] |
Creates a random neighbour of the current solution and accepts it if it improves over the current solution.
@throws JamesRuntimeException if depending on malfunctioning components (problem, neighbourhood, ...)
|
[
"Creates",
"a",
"random",
"neighbour",
"of",
"the",
"current",
"solution",
"and",
"accepts",
"it",
"if",
"it",
"improves",
"over",
"the",
"current",
"solution",
"."
] |
4e85c20c142902373e5b5e8b5d12a2558650f66d
|
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/algo/RandomDescent.java#L71-L89
|
11,666
|
hdbeukel/james-core
|
src/main/java/org/jamesframework/core/search/algo/tabu/FirstBestAdmissibleTabuSearch.java
|
FirstBestAdmissibleTabuSearch.searchStep
|
@Override
protected void searchStep() {
// get list of possible moves
List<? extends Move<? super SolutionType>> moves = getNeighbourhood().getAllMoves(getCurrentSolution());
// shuffle moves
Collections.shuffle(moves);
// find best admissible move, or first admissible improvement (if any)
Move<? super SolutionType> move = getBestMove(
// inspect all moves
moves,
// not necessarily an improvement
false,
// return first improvement move, if any
true,
// filter tabu moves (with aspiration criterion)
getTabuFilter()
);
// process chosen move
if (move != null) {
// accept move (automatically updates tabu memory)
accept(move);
} else {
// no valid non-tabu neighbour found: terminate search
stop();
}
}
|
java
|
@Override
protected void searchStep() {
// get list of possible moves
List<? extends Move<? super SolutionType>> moves = getNeighbourhood().getAllMoves(getCurrentSolution());
// shuffle moves
Collections.shuffle(moves);
// find best admissible move, or first admissible improvement (if any)
Move<? super SolutionType> move = getBestMove(
// inspect all moves
moves,
// not necessarily an improvement
false,
// return first improvement move, if any
true,
// filter tabu moves (with aspiration criterion)
getTabuFilter()
);
// process chosen move
if (move != null) {
// accept move (automatically updates tabu memory)
accept(move);
} else {
// no valid non-tabu neighbour found: terminate search
stop();
}
}
|
[
"@",
"Override",
"protected",
"void",
"searchStep",
"(",
")",
"{",
"// get list of possible moves",
"List",
"<",
"?",
"extends",
"Move",
"<",
"?",
"super",
"SolutionType",
">",
">",
"moves",
"=",
"getNeighbourhood",
"(",
")",
".",
"getAllMoves",
"(",
"getCurrentSolution",
"(",
")",
")",
";",
"// shuffle moves",
"Collections",
".",
"shuffle",
"(",
"moves",
")",
";",
"// find best admissible move, or first admissible improvement (if any)",
"Move",
"<",
"?",
"super",
"SolutionType",
">",
"move",
"=",
"getBestMove",
"(",
"// inspect all moves",
"moves",
",",
"// not necessarily an improvement",
"false",
",",
"// return first improvement move, if any",
"true",
",",
"// filter tabu moves (with aspiration criterion)",
"getTabuFilter",
"(",
")",
")",
";",
"// process chosen move",
"if",
"(",
"move",
"!=",
"null",
")",
"{",
"// accept move (automatically updates tabu memory)",
"accept",
"(",
"move",
")",
";",
"}",
"else",
"{",
"// no valid non-tabu neighbour found: terminate search",
"stop",
"(",
")",
";",
"}",
"}"
] |
One step of the first-best-admissible tabu search algorithm.
All possible moves are inspected in random order, and either the first admissible improvement,
if any, or, else, the best admissible move, is applied to the current solution.
@throws IncompatibleTabuMemoryException if the applied tabu memory is not compatible with the type of moves
generated by the applied neighbourhood
@throws JamesRuntimeException if depending on malfunctioning components (problem, neighbourhood, ...)
|
[
"One",
"step",
"of",
"the",
"first",
"-",
"best",
"-",
"admissible",
"tabu",
"search",
"algorithm",
".",
"All",
"possible",
"moves",
"are",
"inspected",
"in",
"random",
"order",
"and",
"either",
"the",
"first",
"admissible",
"improvement",
"if",
"any",
"or",
"else",
"the",
"best",
"admissible",
"move",
"is",
"applied",
"to",
"the",
"current",
"solution",
"."
] |
4e85c20c142902373e5b5e8b5d12a2558650f66d
|
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/search/algo/tabu/FirstBestAdmissibleTabuSearch.java#L91-L116
|
11,667
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/io/OutputBuffer.java
|
OutputBuffer.newBuffer
|
private void newBuffer(int offset) {
if (maxBufferSize >= 0) {
buffer = new int[maxBufferSize];
isByte = new boolean[maxBufferSize];
bufferOffset = offset;
currentBufferSize = 0;
}
}
|
java
|
private void newBuffer(int offset) {
if (maxBufferSize >= 0) {
buffer = new int[maxBufferSize];
isByte = new boolean[maxBufferSize];
bufferOffset = offset;
currentBufferSize = 0;
}
}
|
[
"private",
"void",
"newBuffer",
"(",
"int",
"offset",
")",
"{",
"if",
"(",
"maxBufferSize",
">=",
"0",
")",
"{",
"buffer",
"=",
"new",
"int",
"[",
"maxBufferSize",
"]",
";",
"isByte",
"=",
"new",
"boolean",
"[",
"maxBufferSize",
"]",
";",
"bufferOffset",
"=",
"offset",
";",
"currentBufferSize",
"=",
"0",
";",
"}",
"}"
] |
New buffer.
@param offset the offset
|
[
"New",
"buffer",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/io/OutputBuffer.java#L125-L132
|
11,668
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/io/OutputBuffer.java
|
OutputBuffer.writeBuffer
|
private void writeBuffer() throws IOException {
for (int pos = 0; pos < currentBufferSize; pos++) {
if (isByte[pos]) {
aFile.write((byte) buffer[pos]);
} else {
aFile.write(buffer[pos]);
}
}
}
|
java
|
private void writeBuffer() throws IOException {
for (int pos = 0; pos < currentBufferSize; pos++) {
if (isByte[pos]) {
aFile.write((byte) buffer[pos]);
} else {
aFile.write(buffer[pos]);
}
}
}
|
[
"private",
"void",
"writeBuffer",
"(",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"pos",
"=",
"0",
";",
"pos",
"<",
"currentBufferSize",
";",
"pos",
"++",
")",
"{",
"if",
"(",
"isByte",
"[",
"pos",
"]",
")",
"{",
"aFile",
".",
"write",
"(",
"(",
"byte",
")",
"buffer",
"[",
"pos",
"]",
")",
";",
"}",
"else",
"{",
"aFile",
".",
"write",
"(",
"buffer",
"[",
"pos",
"]",
")",
";",
"}",
"}",
"}"
] |
Write buffer.
@throws IOException Signals that an I/O exception has occurred.
|
[
"Write",
"buffer",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/io/OutputBuffer.java#L183-L191
|
11,669
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/fileio/filetypes/mzml/MzmlVars.java
|
MzmlVars.reset
|
public final void reset() {
isNonMassSpectrum = false;
curScan = null;
defaultArrayLength = null;
spectrumIndex = null;
spectrumId = null;
precursorSpectrumIndex = null;
activationMethodAbbreviation = null;
precursors = new ArrayList<>(1);
precursorIsoWndTarget = null;
precursorIsoWndLoOffset = null;
precursorIsoWndHiOffset = null;
precursorIntensity = null;
offsetLo = null;
offsetHi = null;
length = null;
precision = null;
compressions = null;
binDataType = null;
mzData = null;
intensityData = null;
imData = null;
}
|
java
|
public final void reset() {
isNonMassSpectrum = false;
curScan = null;
defaultArrayLength = null;
spectrumIndex = null;
spectrumId = null;
precursorSpectrumIndex = null;
activationMethodAbbreviation = null;
precursors = new ArrayList<>(1);
precursorIsoWndTarget = null;
precursorIsoWndLoOffset = null;
precursorIsoWndHiOffset = null;
precursorIntensity = null;
offsetLo = null;
offsetHi = null;
length = null;
precision = null;
compressions = null;
binDataType = null;
mzData = null;
intensityData = null;
imData = null;
}
|
[
"public",
"final",
"void",
"reset",
"(",
")",
"{",
"isNonMassSpectrum",
"=",
"false",
";",
"curScan",
"=",
"null",
";",
"defaultArrayLength",
"=",
"null",
";",
"spectrumIndex",
"=",
"null",
";",
"spectrumId",
"=",
"null",
";",
"precursorSpectrumIndex",
"=",
"null",
";",
"activationMethodAbbreviation",
"=",
"null",
";",
"precursors",
"=",
"new",
"ArrayList",
"<>",
"(",
"1",
")",
";",
"precursorIsoWndTarget",
"=",
"null",
";",
"precursorIsoWndLoOffset",
"=",
"null",
";",
"precursorIsoWndHiOffset",
"=",
"null",
";",
"precursorIntensity",
"=",
"null",
";",
"offsetLo",
"=",
"null",
";",
"offsetHi",
"=",
"null",
";",
"length",
"=",
"null",
";",
"precision",
"=",
"null",
";",
"compressions",
"=",
"null",
";",
"binDataType",
"=",
"null",
";",
"mzData",
"=",
"null",
";",
"intensityData",
"=",
"null",
";",
"imData",
"=",
"null",
";",
"}"
] |
Resets all held variables to their default values.
|
[
"Resets",
"all",
"held",
"variables",
"to",
"their",
"default",
"values",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/fileio/filetypes/mzml/MzmlVars.java#L67-L91
|
11,670
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java
|
IntervalST.prettyPrint
|
private void prettyPrint(Node<K, V> n) {
if (n.left != null) {
prettyPrint(n.left);
}
System.out.println(n);
if (n.right != null) {
prettyPrint(n.right);
}
}
|
java
|
private void prettyPrint(Node<K, V> n) {
if (n.left != null) {
prettyPrint(n.left);
}
System.out.println(n);
if (n.right != null) {
prettyPrint(n.right);
}
}
|
[
"private",
"void",
"prettyPrint",
"(",
"Node",
"<",
"K",
",",
"V",
">",
"n",
")",
"{",
"if",
"(",
"n",
".",
"left",
"!=",
"null",
")",
"{",
"prettyPrint",
"(",
"n",
".",
"left",
")",
";",
"}",
"System",
".",
"out",
".",
"println",
"(",
"n",
")",
";",
"if",
"(",
"n",
".",
"right",
"!=",
"null",
")",
"{",
"prettyPrint",
"(",
"n",
".",
"right",
")",
";",
"}",
"}"
] |
Recursively prints the tree.
@param n the node to start recursion at
|
[
"Recursively",
"prints",
"the",
"tree",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java#L209-L217
|
11,671
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java
|
IntervalST.put
|
public void put(Interval1D<K> interval, V value) {
Node<K, V> origNode = get(interval);
if (origNode != null) {
//System.err.println("Dupe is being put into the map. Interval: " + interval +
// "\n\tOld: " + origNode.getValue() + " New: " + value);
origNode.setValue(value);
} else {
root = randomizedInsert(root, interval, value);
}
}
|
java
|
public void put(Interval1D<K> interval, V value) {
Node<K, V> origNode = get(interval);
if (origNode != null) {
//System.err.println("Dupe is being put into the map. Interval: " + interval +
// "\n\tOld: " + origNode.getValue() + " New: " + value);
origNode.setValue(value);
} else {
root = randomizedInsert(root, interval, value);
}
}
|
[
"public",
"void",
"put",
"(",
"Interval1D",
"<",
"K",
">",
"interval",
",",
"V",
"value",
")",
"{",
"Node",
"<",
"K",
",",
"V",
">",
"origNode",
"=",
"get",
"(",
"interval",
")",
";",
"if",
"(",
"origNode",
"!=",
"null",
")",
"{",
"//System.err.println(\"Dupe is being put into the map. Interval: \" + interval +",
"// \"\\n\\tOld: \" + origNode.getValue() + \" New: \" + value);",
"origNode",
".",
"setValue",
"(",
"value",
")",
";",
"}",
"else",
"{",
"root",
"=",
"randomizedInsert",
"(",
"root",
",",
"interval",
",",
"value",
")",
";",
"}",
"}"
] |
Insert a new node in the tree. If the tree contained that interval already, the value is
replaced.
|
[
"Insert",
"a",
"new",
"node",
"in",
"the",
"tree",
".",
"If",
"the",
"tree",
"contained",
"that",
"interval",
"already",
"the",
"value",
"is",
"replaced",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java#L269-L278
|
11,672
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java
|
IntervalST.randomizedInsert
|
private Node<K, V> randomizedInsert(Node<K, V> x, Interval1D<K> interval, V value) {
if (x == null) {
return new Node<>(interval, value);
}
if (java.lang.Math.random() * size(x) < 1.0) {
return rootInsert(x, interval, value);
}
int cmp = interval.compareTo(x.interval);
if (cmp < 0) {
x.left = randomizedInsert(x.left, interval, value);
} else {
x.right = randomizedInsert(x.right, interval, value);
}
fix(x);
return x;
}
|
java
|
private Node<K, V> randomizedInsert(Node<K, V> x, Interval1D<K> interval, V value) {
if (x == null) {
return new Node<>(interval, value);
}
if (java.lang.Math.random() * size(x) < 1.0) {
return rootInsert(x, interval, value);
}
int cmp = interval.compareTo(x.interval);
if (cmp < 0) {
x.left = randomizedInsert(x.left, interval, value);
} else {
x.right = randomizedInsert(x.right, interval, value);
}
fix(x);
return x;
}
|
[
"private",
"Node",
"<",
"K",
",",
"V",
">",
"randomizedInsert",
"(",
"Node",
"<",
"K",
",",
"V",
">",
"x",
",",
"Interval1D",
"<",
"K",
">",
"interval",
",",
"V",
"value",
")",
"{",
"if",
"(",
"x",
"==",
"null",
")",
"{",
"return",
"new",
"Node",
"<>",
"(",
"interval",
",",
"value",
")",
";",
"}",
"if",
"(",
"java",
".",
"lang",
".",
"Math",
".",
"random",
"(",
")",
"*",
"size",
"(",
"x",
")",
"<",
"1.0",
")",
"{",
"return",
"rootInsert",
"(",
"x",
",",
"interval",
",",
"value",
")",
";",
"}",
"int",
"cmp",
"=",
"interval",
".",
"compareTo",
"(",
"x",
".",
"interval",
")",
";",
"if",
"(",
"cmp",
"<",
"0",
")",
"{",
"x",
".",
"left",
"=",
"randomizedInsert",
"(",
"x",
".",
"left",
",",
"interval",
",",
"value",
")",
";",
"}",
"else",
"{",
"x",
".",
"right",
"=",
"randomizedInsert",
"(",
"x",
".",
"right",
",",
"interval",
",",
"value",
")",
";",
"}",
"fix",
"(",
"x",
")",
";",
"return",
"x",
";",
"}"
] |
make new node the root with uniform probability
|
[
"make",
"new",
"node",
"the",
"root",
"with",
"uniform",
"probability"
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java#L285-L300
|
11,673
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java
|
IntervalST.remove
|
public Node<K, V> remove(Interval1D<K> interval) {
Node<K, V> node = get(interval);
root = remove(root, interval);
return node;
}
|
java
|
public Node<K, V> remove(Interval1D<K> interval) {
Node<K, V> node = get(interval);
root = remove(root, interval);
return node;
}
|
[
"public",
"Node",
"<",
"K",
",",
"V",
">",
"remove",
"(",
"Interval1D",
"<",
"K",
">",
"interval",
")",
"{",
"Node",
"<",
"K",
",",
"V",
">",
"node",
"=",
"get",
"(",
"interval",
")",
";",
"root",
"=",
"remove",
"(",
"root",
",",
"interval",
")",
";",
"return",
"node",
";",
"}"
] |
Remove and return value associated with given interval.
@return null, if this interval does not exist in the tree
|
[
"Remove",
"and",
"return",
"value",
"associated",
"with",
"given",
"interval",
"."
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java#L344-L348
|
11,674
|
chhh/MSFTBX
|
MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java
|
IntervalST.searchAll
|
private boolean searchAll(Node<K, V> x, Interval1D<K> interval, List<Node<K, V>> toAppend) {
boolean found1 = false;
boolean found2 = false;
boolean found3 = false;
if (x == null) {
return false;
}
if (interval.intersects(x.interval)) {
toAppend.add(x);
found1 = true;
}
if (x.left != null && x.left.max.compareTo(interval.lo) >= 0) {
found2 = searchAll(x.left, interval, toAppend);
}
if (found2 || x.left == null || x.left.max.compareTo(interval.lo) < 0) {
found3 = searchAll(x.right, interval, toAppend);
}
return found1 || found2 || found3;
}
|
java
|
private boolean searchAll(Node<K, V> x, Interval1D<K> interval, List<Node<K, V>> toAppend) {
boolean found1 = false;
boolean found2 = false;
boolean found3 = false;
if (x == null) {
return false;
}
if (interval.intersects(x.interval)) {
toAppend.add(x);
found1 = true;
}
if (x.left != null && x.left.max.compareTo(interval.lo) >= 0) {
found2 = searchAll(x.left, interval, toAppend);
}
if (found2 || x.left == null || x.left.max.compareTo(interval.lo) < 0) {
found3 = searchAll(x.right, interval, toAppend);
}
return found1 || found2 || found3;
}
|
[
"private",
"boolean",
"searchAll",
"(",
"Node",
"<",
"K",
",",
"V",
">",
"x",
",",
"Interval1D",
"<",
"K",
">",
"interval",
",",
"List",
"<",
"Node",
"<",
"K",
",",
"V",
">",
">",
"toAppend",
")",
"{",
"boolean",
"found1",
"=",
"false",
";",
"boolean",
"found2",
"=",
"false",
";",
"boolean",
"found3",
"=",
"false",
";",
"if",
"(",
"x",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"interval",
".",
"intersects",
"(",
"x",
".",
"interval",
")",
")",
"{",
"toAppend",
".",
"add",
"(",
"x",
")",
";",
"found1",
"=",
"true",
";",
"}",
"if",
"(",
"x",
".",
"left",
"!=",
"null",
"&&",
"x",
".",
"left",
".",
"max",
".",
"compareTo",
"(",
"interval",
".",
"lo",
")",
">=",
"0",
")",
"{",
"found2",
"=",
"searchAll",
"(",
"x",
".",
"left",
",",
"interval",
",",
"toAppend",
")",
";",
"}",
"if",
"(",
"found2",
"||",
"x",
".",
"left",
"==",
"null",
"||",
"x",
".",
"left",
".",
"max",
".",
"compareTo",
"(",
"interval",
".",
"lo",
")",
"<",
"0",
")",
"{",
"found3",
"=",
"searchAll",
"(",
"x",
".",
"right",
",",
"interval",
",",
"toAppend",
")",
";",
"}",
"return",
"found1",
"||",
"found2",
"||",
"found3",
";",
"}"
] |
look in subtree rooted at x
|
[
"look",
"in",
"subtree",
"rooted",
"at",
"x"
] |
e53ae6be982e2de3123292be7d5297715bec70bb
|
https://github.com/chhh/MSFTBX/blob/e53ae6be982e2de3123292be7d5297715bec70bb/MSFileToolbox/src/main/java/umich/ms/util/IntervalST.java#L415-L434
|
11,675
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/model/types/IFD.java
|
IFD.isThumbnail
|
public boolean isThumbnail() {
if (tags.containsTagId(254)) {
if (tags.get(254).getCardinality() > 0)
return BigInteger.valueOf(tags.get(254).getFirstNumericValue()).testBit(0);
}
if (tags.containsTagId(255)) {
if (tags.get(255).getCardinality() > 0)
return tags.get(255).getFirstNumericValue() == 2;
}
if (hasSubIFD() && getImageSize() < getsubIFD().getImageSize()) {
return true;
}
if (hasParent() && getImageSize() < getParent().getImageSize()) {
return true;
}
return false;
}
|
java
|
public boolean isThumbnail() {
if (tags.containsTagId(254)) {
if (tags.get(254).getCardinality() > 0)
return BigInteger.valueOf(tags.get(254).getFirstNumericValue()).testBit(0);
}
if (tags.containsTagId(255)) {
if (tags.get(255).getCardinality() > 0)
return tags.get(255).getFirstNumericValue() == 2;
}
if (hasSubIFD() && getImageSize() < getsubIFD().getImageSize()) {
return true;
}
if (hasParent() && getImageSize() < getParent().getImageSize()) {
return true;
}
return false;
}
|
[
"public",
"boolean",
"isThumbnail",
"(",
")",
"{",
"if",
"(",
"tags",
".",
"containsTagId",
"(",
"254",
")",
")",
"{",
"if",
"(",
"tags",
".",
"get",
"(",
"254",
")",
".",
"getCardinality",
"(",
")",
">",
"0",
")",
"return",
"BigInteger",
".",
"valueOf",
"(",
"tags",
".",
"get",
"(",
"254",
")",
".",
"getFirstNumericValue",
"(",
")",
")",
".",
"testBit",
"(",
"0",
")",
";",
"}",
"if",
"(",
"tags",
".",
"containsTagId",
"(",
"255",
")",
")",
"{",
"if",
"(",
"tags",
".",
"get",
"(",
"255",
")",
".",
"getCardinality",
"(",
")",
">",
"0",
")",
"return",
"tags",
".",
"get",
"(",
"255",
")",
".",
"getFirstNumericValue",
"(",
")",
"==",
"2",
";",
"}",
"if",
"(",
"hasSubIFD",
"(",
")",
"&&",
"getImageSize",
"(",
")",
"<",
"getsubIFD",
"(",
")",
".",
"getImageSize",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"hasParent",
"(",
")",
"&&",
"getImageSize",
"(",
")",
"<",
"getParent",
"(",
")",
".",
"getImageSize",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Is thumbnail boolean.
@return the boolean
|
[
"Is",
"thumbnail",
"boolean",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/model/types/IFD.java#L231-L247
|
11,676
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/model/types/IFD.java
|
IFD.getSubIFD
|
public List<IFD> getSubIFD() {
List<IFD> l = new ArrayList<IFD>();
if (hasSubIFD()) {
for (abstractTiffType o : tags.get(330).getValue()) {
l.add((IFD) o);
}
}
return l;
}
|
java
|
public List<IFD> getSubIFD() {
List<IFD> l = new ArrayList<IFD>();
if (hasSubIFD()) {
for (abstractTiffType o : tags.get(330).getValue()) {
l.add((IFD) o);
}
}
return l;
}
|
[
"public",
"List",
"<",
"IFD",
">",
"getSubIFD",
"(",
")",
"{",
"List",
"<",
"IFD",
">",
"l",
"=",
"new",
"ArrayList",
"<",
"IFD",
">",
"(",
")",
";",
"if",
"(",
"hasSubIFD",
"(",
")",
")",
"{",
"for",
"(",
"abstractTiffType",
"o",
":",
"tags",
".",
"get",
"(",
"330",
")",
".",
"getValue",
"(",
")",
")",
"{",
"l",
".",
"add",
"(",
"(",
"IFD",
")",
"o",
")",
";",
"}",
"}",
"return",
"l",
";",
"}"
] |
Gets sub ifds.
@return the subifd list.
|
[
"Gets",
"sub",
"ifds",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/model/types/IFD.java#L254-L262
|
11,677
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/model/types/IFD.java
|
IFD.createMetadata
|
public Metadata createMetadata() {
Metadata metadata = new Metadata();
for (TagValue tag : getMetadata().getTags()) {
if (tag.getCardinality() == 1) {
abstractTiffType t = tag.getValue().get(0);
if (t.isIFD()) {
Metadata metadata2 = ((IFD) t).createMetadata();
for (String key : metadata2.keySet()) {
metadata.add(key, metadata2.get(key));
}
} else if (t.containsMetadata()) {
try {
Metadata meta = t.createMetadata();
metadata.addMetadata(meta);
} catch (Exception ex) {
// TODO: What?
}
}
}
}
return metadata;
}
|
java
|
public Metadata createMetadata() {
Metadata metadata = new Metadata();
for (TagValue tag : getMetadata().getTags()) {
if (tag.getCardinality() == 1) {
abstractTiffType t = tag.getValue().get(0);
if (t.isIFD()) {
Metadata metadata2 = ((IFD) t).createMetadata();
for (String key : metadata2.keySet()) {
metadata.add(key, metadata2.get(key));
}
} else if (t.containsMetadata()) {
try {
Metadata meta = t.createMetadata();
metadata.addMetadata(meta);
} catch (Exception ex) {
// TODO: What?
}
}
}
}
return metadata;
}
|
[
"public",
"Metadata",
"createMetadata",
"(",
")",
"{",
"Metadata",
"metadata",
"=",
"new",
"Metadata",
"(",
")",
";",
"for",
"(",
"TagValue",
"tag",
":",
"getMetadata",
"(",
")",
".",
"getTags",
"(",
")",
")",
"{",
"if",
"(",
"tag",
".",
"getCardinality",
"(",
")",
"==",
"1",
")",
"{",
"abstractTiffType",
"t",
"=",
"tag",
".",
"getValue",
"(",
")",
".",
"get",
"(",
"0",
")",
";",
"if",
"(",
"t",
".",
"isIFD",
"(",
")",
")",
"{",
"Metadata",
"metadata2",
"=",
"(",
"(",
"IFD",
")",
"t",
")",
".",
"createMetadata",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"metadata2",
".",
"keySet",
"(",
")",
")",
"{",
"metadata",
".",
"add",
"(",
"key",
",",
"metadata2",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"}",
"else",
"if",
"(",
"t",
".",
"containsMetadata",
"(",
")",
")",
"{",
"try",
"{",
"Metadata",
"meta",
"=",
"t",
".",
"createMetadata",
"(",
")",
";",
"metadata",
".",
"addMetadata",
"(",
"meta",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"// TODO: What?",
"}",
"}",
"}",
"}",
"return",
"metadata",
";",
"}"
] |
Create IFD metadata.
|
[
"Create",
"IFD",
"metadata",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/model/types/IFD.java#L267-L288
|
11,678
|
EasyinnovaSL/Tiff-Library-4J
|
src/main/java/com/easyinnova/tiff/model/types/IFD.java
|
IFD.printTags
|
public void printTags() {
for (TagValue ie : tags.getTags()) {
try {
String name = "" + ie.getId();
if (TiffTags.hasTag(ie.getId()))
name = TiffTags.getTag(ie.getId()).getName();
String val = ie.toString();
String type = TiffTags.tagTypes.get(ie.getType());
System.out.println(name + "(" + ie.getType() + "->" + type + "): " + val);
} catch (Exception ex) {
System.out.println("Tag error");
}
}
}
|
java
|
public void printTags() {
for (TagValue ie : tags.getTags()) {
try {
String name = "" + ie.getId();
if (TiffTags.hasTag(ie.getId()))
name = TiffTags.getTag(ie.getId()).getName();
String val = ie.toString();
String type = TiffTags.tagTypes.get(ie.getType());
System.out.println(name + "(" + ie.getType() + "->" + type + "): " + val);
} catch (Exception ex) {
System.out.println("Tag error");
}
}
}
|
[
"public",
"void",
"printTags",
"(",
")",
"{",
"for",
"(",
"TagValue",
"ie",
":",
"tags",
".",
"getTags",
"(",
")",
")",
"{",
"try",
"{",
"String",
"name",
"=",
"\"\"",
"+",
"ie",
".",
"getId",
"(",
")",
";",
"if",
"(",
"TiffTags",
".",
"hasTag",
"(",
"ie",
".",
"getId",
"(",
")",
")",
")",
"name",
"=",
"TiffTags",
".",
"getTag",
"(",
"ie",
".",
"getId",
"(",
")",
")",
".",
"getName",
"(",
")",
";",
"String",
"val",
"=",
"ie",
".",
"toString",
"(",
")",
";",
"String",
"type",
"=",
"TiffTags",
".",
"tagTypes",
".",
"get",
"(",
"ie",
".",
"getType",
"(",
")",
")",
";",
"System",
".",
"out",
".",
"println",
"(",
"name",
"+",
"\"(\"",
"+",
"ie",
".",
"getType",
"(",
")",
"+",
"\"->\"",
"+",
"type",
"+",
"\"): \"",
"+",
"val",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Tag error\"",
")",
";",
"}",
"}",
"}"
] |
Prints the tags.
|
[
"Prints",
"the",
"tags",
"."
] |
682605d3ed207a66213278c054c98f1b909472b7
|
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/model/types/IFD.java#L353-L366
|
11,679
|
maxirosson/jdroid-android
|
jdroid-android-core/src/main/java/com/jdroid/android/refresh/RefreshActionProvider.java
|
RefreshActionProvider.showCheatsheet
|
private void showCheatsheet(Context context, View view) {
final int[] screenPos = new int[2];
final Rect displayFrame = new Rect();
view.getLocationOnScreen(screenPos);
view.getWindowVisibleDisplayFrame(displayFrame);
final int width = view.getWidth();
final int height = view.getHeight();
final int midy = screenPos[1] + (height / 2);
final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
Toast cheatSheet = Toast.makeText(context, title, Toast.LENGTH_SHORT);
if (midy < displayFrame.height()) {
// Show along the top; follow action buttons
cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT, screenWidth - screenPos[0] - (width / 2), height);
} else {
// Show along the bottom center
cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);
}
cheatSheet.show();
}
|
java
|
private void showCheatsheet(Context context, View view) {
final int[] screenPos = new int[2];
final Rect displayFrame = new Rect();
view.getLocationOnScreen(screenPos);
view.getWindowVisibleDisplayFrame(displayFrame);
final int width = view.getWidth();
final int height = view.getHeight();
final int midy = screenPos[1] + (height / 2);
final int screenWidth = context.getResources().getDisplayMetrics().widthPixels;
Toast cheatSheet = Toast.makeText(context, title, Toast.LENGTH_SHORT);
if (midy < displayFrame.height()) {
// Show along the top; follow action buttons
cheatSheet.setGravity(Gravity.TOP | Gravity.RIGHT, screenWidth - screenPos[0] - (width / 2), height);
} else {
// Show along the bottom center
cheatSheet.setGravity(Gravity.BOTTOM | Gravity.CENTER_HORIZONTAL, 0, height);
}
cheatSheet.show();
}
|
[
"private",
"void",
"showCheatsheet",
"(",
"Context",
"context",
",",
"View",
"view",
")",
"{",
"final",
"int",
"[",
"]",
"screenPos",
"=",
"new",
"int",
"[",
"2",
"]",
";",
"final",
"Rect",
"displayFrame",
"=",
"new",
"Rect",
"(",
")",
";",
"view",
".",
"getLocationOnScreen",
"(",
"screenPos",
")",
";",
"view",
".",
"getWindowVisibleDisplayFrame",
"(",
"displayFrame",
")",
";",
"final",
"int",
"width",
"=",
"view",
".",
"getWidth",
"(",
")",
";",
"final",
"int",
"height",
"=",
"view",
".",
"getHeight",
"(",
")",
";",
"final",
"int",
"midy",
"=",
"screenPos",
"[",
"1",
"]",
"+",
"(",
"height",
"/",
"2",
")",
";",
"final",
"int",
"screenWidth",
"=",
"context",
".",
"getResources",
"(",
")",
".",
"getDisplayMetrics",
"(",
")",
".",
"widthPixels",
";",
"Toast",
"cheatSheet",
"=",
"Toast",
".",
"makeText",
"(",
"context",
",",
"title",
",",
"Toast",
".",
"LENGTH_SHORT",
")",
";",
"if",
"(",
"midy",
"<",
"displayFrame",
".",
"height",
"(",
")",
")",
"{",
"// Show along the top; follow action buttons",
"cheatSheet",
".",
"setGravity",
"(",
"Gravity",
".",
"TOP",
"|",
"Gravity",
".",
"RIGHT",
",",
"screenWidth",
"-",
"screenPos",
"[",
"0",
"]",
"-",
"(",
"width",
"/",
"2",
")",
",",
"height",
")",
";",
"}",
"else",
"{",
"// Show along the bottom center",
"cheatSheet",
".",
"setGravity",
"(",
"Gravity",
".",
"BOTTOM",
"|",
"Gravity",
".",
"CENTER_HORIZONTAL",
",",
"0",
",",
"height",
")",
";",
"}",
"cheatSheet",
".",
"show",
"(",
")",
";",
"}"
] |
Slightly modified code, from Jake Wharton's ABS
|
[
"Slightly",
"modified",
"code",
"from",
"Jake",
"Wharton",
"s",
"ABS"
] |
1ba9cae56a16fa36bdb2c9c04379853f0300707f
|
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-core/src/main/java/com/jdroid/android/refresh/RefreshActionProvider.java#L79-L99
|
11,680
|
hdbeukel/james-core
|
src/main/java/org/jamesframework/core/util/FastLimitedQueue.java
|
FastLimitedQueue.add
|
public boolean add(E e){
// not yet contained?
if(set.contains(e)){
return false;
}
// add new element
queue.add(e);
set.add(e);
// maintain size limit
while(queue.size() > sizeLimit){
remove();
}
return true;
}
|
java
|
public boolean add(E e){
// not yet contained?
if(set.contains(e)){
return false;
}
// add new element
queue.add(e);
set.add(e);
// maintain size limit
while(queue.size() > sizeLimit){
remove();
}
return true;
}
|
[
"public",
"boolean",
"add",
"(",
"E",
"e",
")",
"{",
"// not yet contained?",
"if",
"(",
"set",
".",
"contains",
"(",
"e",
")",
")",
"{",
"return",
"false",
";",
"}",
"// add new element",
"queue",
".",
"add",
"(",
"e",
")",
";",
"set",
".",
"add",
"(",
"e",
")",
";",
"// maintain size limit",
"while",
"(",
"queue",
".",
"size",
"(",
")",
">",
"sizeLimit",
")",
"{",
"remove",
"(",
")",
";",
"}",
"return",
"true",
";",
"}"
] |
Add an element at the tail of the queue, replacing the least recently added item if the queue is full.
The item is only added to the queue if it is not already contained. Runs in constant time, assuming the
hash function disperses the elements properly among the buckets of the underlying hash set.
@param e element to add at the tail of the queue, if not already contained in the queue
@return <code>true</code> if the given item was not yet contained in the queue
|
[
"Add",
"an",
"element",
"at",
"the",
"tail",
"of",
"the",
"queue",
"replacing",
"the",
"least",
"recently",
"added",
"item",
"if",
"the",
"queue",
"is",
"full",
".",
"The",
"item",
"is",
"only",
"added",
"to",
"the",
"queue",
"if",
"it",
"is",
"not",
"already",
"contained",
".",
"Runs",
"in",
"constant",
"time",
"assuming",
"the",
"hash",
"function",
"disperses",
"the",
"elements",
"properly",
"among",
"the",
"buckets",
"of",
"the",
"underlying",
"hash",
"set",
"."
] |
4e85c20c142902373e5b5e8b5d12a2558650f66d
|
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/util/FastLimitedQueue.java#L67-L80
|
11,681
|
hdbeukel/james-core
|
src/main/java/org/jamesframework/core/util/FastLimitedQueue.java
|
FastLimitedQueue.addAll
|
public boolean addAll(Collection<E> items){
boolean modified = false;
for(E e : items){
modified = add(e) || modified;
}
return modified;
}
|
java
|
public boolean addAll(Collection<E> items){
boolean modified = false;
for(E e : items){
modified = add(e) || modified;
}
return modified;
}
|
[
"public",
"boolean",
"addAll",
"(",
"Collection",
"<",
"E",
">",
"items",
")",
"{",
"boolean",
"modified",
"=",
"false",
";",
"for",
"(",
"E",
"e",
":",
"items",
")",
"{",
"modified",
"=",
"add",
"(",
"e",
")",
"||",
"modified",
";",
"}",
"return",
"modified",
";",
"}"
] |
Add the given collection of items. Only those items which are not yet contained in the queue are added, in the
order of iteration through the given collection. Runs in linear time, assuming the hash function disperses the
elements properly among the buckets of the underlying hash set.
@param items items to add to the queue
@return <code>true</code> if the queue is modified, i.e. if at least one new item has been added
|
[
"Add",
"the",
"given",
"collection",
"of",
"items",
".",
"Only",
"those",
"items",
"which",
"are",
"not",
"yet",
"contained",
"in",
"the",
"queue",
"are",
"added",
"in",
"the",
"order",
"of",
"iteration",
"through",
"the",
"given",
"collection",
".",
"Runs",
"in",
"linear",
"time",
"assuming",
"the",
"hash",
"function",
"disperses",
"the",
"elements",
"properly",
"among",
"the",
"buckets",
"of",
"the",
"underlying",
"hash",
"set",
"."
] |
4e85c20c142902373e5b5e8b5d12a2558650f66d
|
https://github.com/hdbeukel/james-core/blob/4e85c20c142902373e5b5e8b5d12a2558650f66d/src/main/java/org/jamesframework/core/util/FastLimitedQueue.java#L90-L96
|
11,682
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/FormModelMediatingValueModel.java
|
FormModelMediatingValueModel.propertyChange
|
public void propertyChange(PropertyChangeEvent evt) {
originalValue = getValue();
if (deliverValueChangeEvents) {
mediatedValueHolder.setValue(originalValue);
updateDirtyState();
}
}
|
java
|
public void propertyChange(PropertyChangeEvent evt) {
originalValue = getValue();
if (deliverValueChangeEvents) {
mediatedValueHolder.setValue(originalValue);
updateDirtyState();
}
}
|
[
"public",
"void",
"propertyChange",
"(",
"PropertyChangeEvent",
"evt",
")",
"{",
"originalValue",
"=",
"getValue",
"(",
")",
";",
"if",
"(",
"deliverValueChangeEvents",
")",
"{",
"mediatedValueHolder",
".",
"setValue",
"(",
"originalValue",
")",
";",
"updateDirtyState",
"(",
")",
";",
"}",
"}"
] |
called by the wrapped value model
|
[
"called",
"by",
"the",
"wrapped",
"value",
"model"
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/FormModelMediatingValueModel.java#L129-L135
|
11,683
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/FormModelMediatingValueModel.java
|
FormModelMediatingValueModel.updateDirtyState
|
protected void updateDirtyState() {
boolean dirty = isDirty();
if (oldDirty != dirty) {
oldDirty = dirty;
firePropertyChange(DIRTY_PROPERTY, !dirty, dirty);
}
}
|
java
|
protected void updateDirtyState() {
boolean dirty = isDirty();
if (oldDirty != dirty) {
oldDirty = dirty;
firePropertyChange(DIRTY_PROPERTY, !dirty, dirty);
}
}
|
[
"protected",
"void",
"updateDirtyState",
"(",
")",
"{",
"boolean",
"dirty",
"=",
"isDirty",
"(",
")",
";",
"if",
"(",
"oldDirty",
"!=",
"dirty",
")",
"{",
"oldDirty",
"=",
"dirty",
";",
"firePropertyChange",
"(",
"DIRTY_PROPERTY",
",",
"!",
"dirty",
",",
"dirty",
")",
";",
"}",
"}"
] |
Check the dirty state and fire events if needed.
|
[
"Check",
"the",
"dirty",
"state",
"and",
"fire",
"events",
"if",
"needed",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/FormModelMediatingValueModel.java#L186-L192
|
11,684
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/FormModelMediatingValueModel.java
|
FormModelMediatingValueModel.firePropertyChange
|
protected final void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
if (DIRTY_PROPERTY.equals(propertyName)) {
PropertyChangeEvent evt = new PropertyChangeEvent(this, propertyName, Boolean.valueOf(oldValue), Boolean
.valueOf(newValue));
for (Iterator i = dirtyChangeListeners.iterator(); i.hasNext();) {
((PropertyChangeListener) i.next()).propertyChange(evt);
}
}
}
|
java
|
protected final void firePropertyChange(String propertyName, boolean oldValue, boolean newValue) {
if (DIRTY_PROPERTY.equals(propertyName)) {
PropertyChangeEvent evt = new PropertyChangeEvent(this, propertyName, Boolean.valueOf(oldValue), Boolean
.valueOf(newValue));
for (Iterator i = dirtyChangeListeners.iterator(); i.hasNext();) {
((PropertyChangeListener) i.next()).propertyChange(evt);
}
}
}
|
[
"protected",
"final",
"void",
"firePropertyChange",
"(",
"String",
"propertyName",
",",
"boolean",
"oldValue",
",",
"boolean",
"newValue",
")",
"{",
"if",
"(",
"DIRTY_PROPERTY",
".",
"equals",
"(",
"propertyName",
")",
")",
"{",
"PropertyChangeEvent",
"evt",
"=",
"new",
"PropertyChangeEvent",
"(",
"this",
",",
"propertyName",
",",
"Boolean",
".",
"valueOf",
"(",
"oldValue",
")",
",",
"Boolean",
".",
"valueOf",
"(",
"newValue",
")",
")",
";",
"for",
"(",
"Iterator",
"i",
"=",
"dirtyChangeListeners",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"(",
"(",
"PropertyChangeListener",
")",
"i",
".",
"next",
"(",
")",
")",
".",
"propertyChange",
"(",
"evt",
")",
";",
"}",
"}",
"}"
] |
Handles the dirty event firing.
@param propertyName implementation only handles DIRTY_PROPERTY.
@param oldValue
@param newValue
|
[
"Handles",
"the",
"dirty",
"event",
"firing",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/form/support/FormModelMediatingValueModel.java#L243-L251
|
11,685
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SliderLabelFactory.java
|
SliderLabelFactory.getSliderLabels
|
public Hashtable<Integer, JLabel> getSliderLabels()
{
Hashtable<Integer, JLabel> dict = new Hashtable<Integer, JLabel>();
for(Map.Entry<Integer, String> entry : labels.entrySet())
{
dict.put(entry.getKey(), new JLabel(entry.getValue()));
}
return dict;
}
|
java
|
public Hashtable<Integer, JLabel> getSliderLabels()
{
Hashtable<Integer, JLabel> dict = new Hashtable<Integer, JLabel>();
for(Map.Entry<Integer, String> entry : labels.entrySet())
{
dict.put(entry.getKey(), new JLabel(entry.getValue()));
}
return dict;
}
|
[
"public",
"Hashtable",
"<",
"Integer",
",",
"JLabel",
">",
"getSliderLabels",
"(",
")",
"{",
"Hashtable",
"<",
"Integer",
",",
"JLabel",
">",
"dict",
"=",
"new",
"Hashtable",
"<",
"Integer",
",",
"JLabel",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"String",
">",
"entry",
":",
"labels",
".",
"entrySet",
"(",
")",
")",
"{",
"dict",
".",
"put",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"new",
"JLabel",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
")",
";",
"}",
"return",
"dict",
";",
"}"
] |
Gets a map with integer values with the corresponding JLabel
for that value
|
[
"Gets",
"a",
"map",
"with",
"integer",
"values",
"with",
"the",
"corresponding",
"JLabel",
"for",
"that",
"value"
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SliderLabelFactory.java#L51-L59
|
11,686
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/support/AbstractBinderSelectionStrategy.java
|
AbstractBinderSelectionStrategy.findBinderByPropertyName
|
protected Binder findBinderByPropertyName(Class parentObjectType, String propertyName) {
PropertyNameKey key = new PropertyNameKey(parentObjectType, propertyName);
Binder binder = (Binder)propertyNameBinders.get(key);
if (binder == null) {
// if no direct match was found try to find a match in any super classes
final Map potentialMatchingBinders = new HashMap();
for (Iterator i = propertyNameBinders.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry)i.next();
if (((PropertyNameKey)entry.getKey()).getPropertyName().equals(propertyName)) {
potentialMatchingBinders.put(((PropertyNameKey)entry.getKey()).getParentObjectType(),
entry.getValue());
}
}
binder = (Binder) ClassUtils.getValueFromMapForClass(parentObjectType, potentialMatchingBinders);
if (binder != null) {
// remember the lookup so it doesn't have to be discovered again
registerBinderForPropertyName(parentObjectType, propertyName, binder);
}
}
return binder;
}
|
java
|
protected Binder findBinderByPropertyName(Class parentObjectType, String propertyName) {
PropertyNameKey key = new PropertyNameKey(parentObjectType, propertyName);
Binder binder = (Binder)propertyNameBinders.get(key);
if (binder == null) {
// if no direct match was found try to find a match in any super classes
final Map potentialMatchingBinders = new HashMap();
for (Iterator i = propertyNameBinders.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry)i.next();
if (((PropertyNameKey)entry.getKey()).getPropertyName().equals(propertyName)) {
potentialMatchingBinders.put(((PropertyNameKey)entry.getKey()).getParentObjectType(),
entry.getValue());
}
}
binder = (Binder) ClassUtils.getValueFromMapForClass(parentObjectType, potentialMatchingBinders);
if (binder != null) {
// remember the lookup so it doesn't have to be discovered again
registerBinderForPropertyName(parentObjectType, propertyName, binder);
}
}
return binder;
}
|
[
"protected",
"Binder",
"findBinderByPropertyName",
"(",
"Class",
"parentObjectType",
",",
"String",
"propertyName",
")",
"{",
"PropertyNameKey",
"key",
"=",
"new",
"PropertyNameKey",
"(",
"parentObjectType",
",",
"propertyName",
")",
";",
"Binder",
"binder",
"=",
"(",
"Binder",
")",
"propertyNameBinders",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"binder",
"==",
"null",
")",
"{",
"// if no direct match was found try to find a match in any super classes",
"final",
"Map",
"potentialMatchingBinders",
"=",
"new",
"HashMap",
"(",
")",
";",
"for",
"(",
"Iterator",
"i",
"=",
"propertyNameBinders",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"i",
".",
"next",
"(",
")",
";",
"if",
"(",
"(",
"(",
"PropertyNameKey",
")",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"getPropertyName",
"(",
")",
".",
"equals",
"(",
"propertyName",
")",
")",
"{",
"potentialMatchingBinders",
".",
"put",
"(",
"(",
"(",
"PropertyNameKey",
")",
"entry",
".",
"getKey",
"(",
")",
")",
".",
"getParentObjectType",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"binder",
"=",
"(",
"Binder",
")",
"ClassUtils",
".",
"getValueFromMapForClass",
"(",
"parentObjectType",
",",
"potentialMatchingBinders",
")",
";",
"if",
"(",
"binder",
"!=",
"null",
")",
"{",
"// remember the lookup so it doesn't have to be discovered again",
"registerBinderForPropertyName",
"(",
"parentObjectType",
",",
"propertyName",
",",
"binder",
")",
";",
"}",
"}",
"return",
"binder",
";",
"}"
] |
Try to find a binder for the provided parentObjectType and propertyName. If no
direct match found try to find binder for any superclass of the provided
objectType which also has the same propertyName.
|
[
"Try",
"to",
"find",
"a",
"binder",
"for",
"the",
"provided",
"parentObjectType",
"and",
"propertyName",
".",
"If",
"no",
"direct",
"match",
"found",
"try",
"to",
"find",
"binder",
"for",
"any",
"superclass",
"of",
"the",
"provided",
"objectType",
"which",
"also",
"has",
"the",
"same",
"propertyName",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/support/AbstractBinderSelectionStrategy.java#L93-L113
|
11,687
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/support/AbstractBinderSelectionStrategy.java
|
AbstractBinderSelectionStrategy.setBindersForPropertyTypes
|
public void setBindersForPropertyTypes(Map binders) {
for (Iterator i = binders.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry)i.next();
registerBinderForPropertyType((Class)entry.getKey(), (Binder)entry.getValue());
}
}
|
java
|
public void setBindersForPropertyTypes(Map binders) {
for (Iterator i = binders.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry)i.next();
registerBinderForPropertyType((Class)entry.getKey(), (Binder)entry.getValue());
}
}
|
[
"public",
"void",
"setBindersForPropertyTypes",
"(",
"Map",
"binders",
")",
"{",
"for",
"(",
"Iterator",
"i",
"=",
"binders",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"i",
".",
"next",
"(",
")",
";",
"registerBinderForPropertyType",
"(",
"(",
"Class",
")",
"entry",
".",
"getKey",
"(",
")",
",",
"(",
"Binder",
")",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] |
Registers property type binders by extracting the key and value from each entry
in the provided map using the key to specify the property type and the value
to specify the binder.
<p>Binders specified in the provided map will override any binders previously
registered for the same property type.
@param binders the map containing the entries to register; keys must be of type
<code>Class</code> and values of type <code>Binder</code>.
|
[
"Registers",
"property",
"type",
"binders",
"by",
"extracting",
"the",
"key",
"and",
"value",
"from",
"each",
"entry",
"in",
"the",
"provided",
"map",
"using",
"the",
"key",
"to",
"specify",
"the",
"property",
"type",
"and",
"the",
"value",
"to",
"specify",
"the",
"binder",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/support/AbstractBinderSelectionStrategy.java#L239-L244
|
11,688
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/support/AbstractBinderSelectionStrategy.java
|
AbstractBinderSelectionStrategy.setBindersForControlTypes
|
public void setBindersForControlTypes(Map binders) {
for (Iterator i = binders.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry)i.next();
registerBinderForControlType((Class)entry.getKey(), (Binder)entry.getValue());
}
}
|
java
|
public void setBindersForControlTypes(Map binders) {
for (Iterator i = binders.entrySet().iterator(); i.hasNext();) {
Map.Entry entry = (Map.Entry)i.next();
registerBinderForControlType((Class)entry.getKey(), (Binder)entry.getValue());
}
}
|
[
"public",
"void",
"setBindersForControlTypes",
"(",
"Map",
"binders",
")",
"{",
"for",
"(",
"Iterator",
"i",
"=",
"binders",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"i",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Map",
".",
"Entry",
"entry",
"=",
"(",
"Map",
".",
"Entry",
")",
"i",
".",
"next",
"(",
")",
";",
"registerBinderForControlType",
"(",
"(",
"Class",
")",
"entry",
".",
"getKey",
"(",
")",
",",
"(",
"Binder",
")",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}"
] |
Registers control type binders by extracting the key and value from each entry
in the provided map using the key to specify the property type and the value
to specify the binder.
<p>Binders specified in the provided map will override any binders previously
registered for the same control type.
@param binders the map containing the entries to register; keys must be of type
<code>Class</code> and values of type <code>Binder</code>.
|
[
"Registers",
"control",
"type",
"binders",
"by",
"extracting",
"the",
"key",
"and",
"value",
"from",
"each",
"entry",
"in",
"the",
"provided",
"map",
"using",
"the",
"key",
"to",
"specify",
"the",
"property",
"type",
"and",
"the",
"value",
"to",
"specify",
"the",
"binder",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/support/AbstractBinderSelectionStrategy.java#L261-L266
|
11,689
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-samples/valkyrie-rcp-simple-sample/src/main/java/org/valkyriercp/sample/simple/domain/SimpleValidationRulesSource.java
|
SimpleValidationRulesSource.createContactRules
|
private Rules createContactRules() {
// Construct a Rules object that contains all the constraints we need to apply
// to our domain object. The Rules class offers a lot of convenience methods
// for creating constraints on named properties.
return new Rules(Contact.class) {
protected void initRules() {
add("firstName", NAME_CONSTRAINT);
add("lastName", NAME_CONSTRAINT);
add(not(eqProperty("firstName", "lastName")));
// If a DOB is specified, it must be in the past
add("dateOfBirth", lt(new Date()));
add("emailAddress", EMAIL_CONSTRAINT);
add("homePhone", PHONE_CONSTRAINT);
add("workPhone", PHONE_CONSTRAINT);
add("contactType", required());
// Note that you can define constraints on nested properties.
// This is useful when the nested object is not displayed in
// a form of its own.
add("address.address1", required());
add("address.city", required());
add("address.state", required());
add("address.zip", ZIPCODE_CONSTRAINT);
add("memo", required());
}
};
}
|
java
|
private Rules createContactRules() {
// Construct a Rules object that contains all the constraints we need to apply
// to our domain object. The Rules class offers a lot of convenience methods
// for creating constraints on named properties.
return new Rules(Contact.class) {
protected void initRules() {
add("firstName", NAME_CONSTRAINT);
add("lastName", NAME_CONSTRAINT);
add(not(eqProperty("firstName", "lastName")));
// If a DOB is specified, it must be in the past
add("dateOfBirth", lt(new Date()));
add("emailAddress", EMAIL_CONSTRAINT);
add("homePhone", PHONE_CONSTRAINT);
add("workPhone", PHONE_CONSTRAINT);
add("contactType", required());
// Note that you can define constraints on nested properties.
// This is useful when the nested object is not displayed in
// a form of its own.
add("address.address1", required());
add("address.city", required());
add("address.state", required());
add("address.zip", ZIPCODE_CONSTRAINT);
add("memo", required());
}
};
}
|
[
"private",
"Rules",
"createContactRules",
"(",
")",
"{",
"// Construct a Rules object that contains all the constraints we need to apply",
"// to our domain object. The Rules class offers a lot of convenience methods",
"// for creating constraints on named properties.",
"return",
"new",
"Rules",
"(",
"Contact",
".",
"class",
")",
"{",
"protected",
"void",
"initRules",
"(",
")",
"{",
"add",
"(",
"\"firstName\"",
",",
"NAME_CONSTRAINT",
")",
";",
"add",
"(",
"\"lastName\"",
",",
"NAME_CONSTRAINT",
")",
";",
"add",
"(",
"not",
"(",
"eqProperty",
"(",
"\"firstName\"",
",",
"\"lastName\"",
")",
")",
")",
";",
"// If a DOB is specified, it must be in the past",
"add",
"(",
"\"dateOfBirth\"",
",",
"lt",
"(",
"new",
"Date",
"(",
")",
")",
")",
";",
"add",
"(",
"\"emailAddress\"",
",",
"EMAIL_CONSTRAINT",
")",
";",
"add",
"(",
"\"homePhone\"",
",",
"PHONE_CONSTRAINT",
")",
";",
"add",
"(",
"\"workPhone\"",
",",
"PHONE_CONSTRAINT",
")",
";",
"add",
"(",
"\"contactType\"",
",",
"required",
"(",
")",
")",
";",
"// Note that you can define constraints on nested properties.",
"// This is useful when the nested object is not displayed in",
"// a form of its own.",
"add",
"(",
"\"address.address1\"",
",",
"required",
"(",
")",
")",
";",
"add",
"(",
"\"address.city\"",
",",
"required",
"(",
")",
")",
";",
"add",
"(",
"\"address.state\"",
",",
"required",
"(",
")",
")",
";",
"add",
"(",
"\"address.zip\"",
",",
"ZIPCODE_CONSTRAINT",
")",
";",
"add",
"(",
"\"memo\"",
",",
"required",
"(",
")",
")",
";",
"}",
"}",
";",
"}"
] |
Construct the rules that are used to validate a Contact domain object.
@return validation rules
@see Rules
|
[
"Construct",
"the",
"rules",
"that",
"are",
"used",
"to",
"validate",
"a",
"Contact",
"domain",
"object",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-samples/valkyrie-rcp-simple-sample/src/main/java/org/valkyriercp/sample/simple/domain/SimpleValidationRulesSource.java#L73-L104
|
11,690
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-integrations/valkyrie-rcp-vldocking/src/main/java/org/valkyriercp/application/docking/VLDockingBeanPostProcessor.java
|
VLDockingBeanPostProcessor.getTemplate
|
private VLDockingViewDescriptor getTemplate(ViewDescriptor viewDescriptor) {
Assert.notNull(viewDescriptor, "viewDescriptor");
final VLDockingViewDescriptor vlDockingViewDescriptor;
vlDockingViewDescriptor = new VLDockingViewDescriptor();
return vlDockingViewDescriptor;
}
|
java
|
private VLDockingViewDescriptor getTemplate(ViewDescriptor viewDescriptor) {
Assert.notNull(viewDescriptor, "viewDescriptor");
final VLDockingViewDescriptor vlDockingViewDescriptor;
vlDockingViewDescriptor = new VLDockingViewDescriptor();
return vlDockingViewDescriptor;
}
|
[
"private",
"VLDockingViewDescriptor",
"getTemplate",
"(",
"ViewDescriptor",
"viewDescriptor",
")",
"{",
"Assert",
".",
"notNull",
"(",
"viewDescriptor",
",",
"\"viewDescriptor\"",
")",
";",
"final",
"VLDockingViewDescriptor",
"vlDockingViewDescriptor",
";",
"vlDockingViewDescriptor",
"=",
"new",
"VLDockingViewDescriptor",
"(",
")",
";",
"return",
"vlDockingViewDescriptor",
";",
"}"
] |
Gets the configured template for the given view descriptor.
@param viewDescriptor the view descriptor.
@return the more suitable template.
|
[
"Gets",
"the",
"configured",
"template",
"for",
"the",
"given",
"view",
"descriptor",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-integrations/valkyrie-rcp-vldocking/src/main/java/org/valkyriercp/application/docking/VLDockingBeanPostProcessor.java#L84-L93
|
11,691
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/wizard/WizardDialog.java
|
WizardDialog.createPageControls
|
private void createPageControls() {
WizardPage[] pages = wizard.getPages();
for (int i = 0; i < pages.length; i++) {
JComponent c = pages[i].getControl();
GuiStandardUtils.attachDialogBorder(c);
Dimension size = c.getPreferredSize();
if (size.width > largestPageWidth) {
largestPageWidth = size.width;
}
if (size.height > largestPageHeight) {
largestPageHeight = size.height;
}
}
}
|
java
|
private void createPageControls() {
WizardPage[] pages = wizard.getPages();
for (int i = 0; i < pages.length; i++) {
JComponent c = pages[i].getControl();
GuiStandardUtils.attachDialogBorder(c);
Dimension size = c.getPreferredSize();
if (size.width > largestPageWidth) {
largestPageWidth = size.width;
}
if (size.height > largestPageHeight) {
largestPageHeight = size.height;
}
}
}
|
[
"private",
"void",
"createPageControls",
"(",
")",
"{",
"WizardPage",
"[",
"]",
"pages",
"=",
"wizard",
".",
"getPages",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"pages",
".",
"length",
";",
"i",
"++",
")",
"{",
"JComponent",
"c",
"=",
"pages",
"[",
"i",
"]",
".",
"getControl",
"(",
")",
";",
"GuiStandardUtils",
".",
"attachDialogBorder",
"(",
"c",
")",
";",
"Dimension",
"size",
"=",
"c",
".",
"getPreferredSize",
"(",
")",
";",
"if",
"(",
"size",
".",
"width",
">",
"largestPageWidth",
")",
"{",
"largestPageWidth",
"=",
"size",
".",
"width",
";",
"}",
"if",
"(",
"size",
".",
"height",
">",
"largestPageHeight",
")",
"{",
"largestPageHeight",
"=",
"size",
".",
"height",
";",
"}",
"}",
"}"
] |
Allow the wizard's pages to pre-create their page controls. This allows
the wizard dialog to open to the correct size.
|
[
"Allow",
"the",
"wizard",
"s",
"pages",
"to",
"pre",
"-",
"create",
"their",
"page",
"controls",
".",
"This",
"allows",
"the",
"wizard",
"dialog",
"to",
"open",
"to",
"the",
"correct",
"size",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/wizard/WizardDialog.java#L121-L134
|
11,692
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandButtonIconInfo.java
|
CommandButtonIconInfo.configure
|
public AbstractButton configure(AbstractButton button) {
Assert.notNull(button, "The button to configure is required");
button.setIcon(icon);
button.setSelectedIcon(selectedIcon);
button.setDisabledIcon(disabledIcon);
button.setPressedIcon(pressedIcon);
button.setRolloverIcon(rolloverIcon);
return button;
}
|
java
|
public AbstractButton configure(AbstractButton button) {
Assert.notNull(button, "The button to configure is required");
button.setIcon(icon);
button.setSelectedIcon(selectedIcon);
button.setDisabledIcon(disabledIcon);
button.setPressedIcon(pressedIcon);
button.setRolloverIcon(rolloverIcon);
return button;
}
|
[
"public",
"AbstractButton",
"configure",
"(",
"AbstractButton",
"button",
")",
"{",
"Assert",
".",
"notNull",
"(",
"button",
",",
"\"The button to configure is required\"",
")",
";",
"button",
".",
"setIcon",
"(",
"icon",
")",
";",
"button",
".",
"setSelectedIcon",
"(",
"selectedIcon",
")",
";",
"button",
".",
"setDisabledIcon",
"(",
"disabledIcon",
")",
";",
"button",
".",
"setPressedIcon",
"(",
"pressedIcon",
")",
";",
"button",
".",
"setRolloverIcon",
"(",
"rolloverIcon",
")",
";",
"return",
"button",
";",
"}"
] |
Configures the given command button with the icon values from this
instance.
@param button The button to be configured with icons. Must not be null.
@throws IllegalArgumentException if {@code button} is null.
|
[
"Configures",
"the",
"given",
"command",
"button",
"with",
"the",
"icon",
"values",
"from",
"this",
"instance",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/config/CommandButtonIconInfo.java#L135-L145
|
11,693
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/ShuttleListBinder.java
|
ShuttleListBinder.applyContext
|
protected void applyContext( ShuttleListBinding binding, Map context ) {
if( context.containsKey(MODEL_KEY) ) {
binding.setModel((ListModel) context.get(MODEL_KEY));
}
if( context.containsKey(SELECTABLE_ITEMS_HOLDER_KEY) ) {
binding.setSelectableItemsHolder((ValueModel) context.get(SELECTABLE_ITEMS_HOLDER_KEY));
}
if( context.containsKey(SELECTED_ITEMS_HOLDER_KEY) ) {
binding.setSelectedItemsHolder((ValueModel) context.get(SELECTED_ITEMS_HOLDER_KEY));
}
if( context.containsKey(RENDERER_KEY) ) {
binding.setRenderer((ListCellRenderer) context.get(RENDERER_KEY));
}
if( context.containsKey(COMPARATOR_KEY) ) {
binding.setComparator((Comparator) context.get(COMPARATOR_KEY));
}
if( context.containsKey(SELECTED_ITEM_TYPE_KEY) ) {
binding.setSelectedItemType((Class) context.get(SELECTED_ITEM_TYPE_KEY));
}
if( context.containsKey(FORM_ID) ) {
binding.setFormId((String) context.get(FORM_ID));
}
}
|
java
|
protected void applyContext( ShuttleListBinding binding, Map context ) {
if( context.containsKey(MODEL_KEY) ) {
binding.setModel((ListModel) context.get(MODEL_KEY));
}
if( context.containsKey(SELECTABLE_ITEMS_HOLDER_KEY) ) {
binding.setSelectableItemsHolder((ValueModel) context.get(SELECTABLE_ITEMS_HOLDER_KEY));
}
if( context.containsKey(SELECTED_ITEMS_HOLDER_KEY) ) {
binding.setSelectedItemsHolder((ValueModel) context.get(SELECTED_ITEMS_HOLDER_KEY));
}
if( context.containsKey(RENDERER_KEY) ) {
binding.setRenderer((ListCellRenderer) context.get(RENDERER_KEY));
}
if( context.containsKey(COMPARATOR_KEY) ) {
binding.setComparator((Comparator) context.get(COMPARATOR_KEY));
}
if( context.containsKey(SELECTED_ITEM_TYPE_KEY) ) {
binding.setSelectedItemType((Class) context.get(SELECTED_ITEM_TYPE_KEY));
}
if( context.containsKey(FORM_ID) ) {
binding.setFormId((String) context.get(FORM_ID));
}
}
|
[
"protected",
"void",
"applyContext",
"(",
"ShuttleListBinding",
"binding",
",",
"Map",
"context",
")",
"{",
"if",
"(",
"context",
".",
"containsKey",
"(",
"MODEL_KEY",
")",
")",
"{",
"binding",
".",
"setModel",
"(",
"(",
"ListModel",
")",
"context",
".",
"get",
"(",
"MODEL_KEY",
")",
")",
";",
"}",
"if",
"(",
"context",
".",
"containsKey",
"(",
"SELECTABLE_ITEMS_HOLDER_KEY",
")",
")",
"{",
"binding",
".",
"setSelectableItemsHolder",
"(",
"(",
"ValueModel",
")",
"context",
".",
"get",
"(",
"SELECTABLE_ITEMS_HOLDER_KEY",
")",
")",
";",
"}",
"if",
"(",
"context",
".",
"containsKey",
"(",
"SELECTED_ITEMS_HOLDER_KEY",
")",
")",
"{",
"binding",
".",
"setSelectedItemsHolder",
"(",
"(",
"ValueModel",
")",
"context",
".",
"get",
"(",
"SELECTED_ITEMS_HOLDER_KEY",
")",
")",
";",
"}",
"if",
"(",
"context",
".",
"containsKey",
"(",
"RENDERER_KEY",
")",
")",
"{",
"binding",
".",
"setRenderer",
"(",
"(",
"ListCellRenderer",
")",
"context",
".",
"get",
"(",
"RENDERER_KEY",
")",
")",
";",
"}",
"if",
"(",
"context",
".",
"containsKey",
"(",
"COMPARATOR_KEY",
")",
")",
"{",
"binding",
".",
"setComparator",
"(",
"(",
"Comparator",
")",
"context",
".",
"get",
"(",
"COMPARATOR_KEY",
")",
")",
";",
"}",
"if",
"(",
"context",
".",
"containsKey",
"(",
"SELECTED_ITEM_TYPE_KEY",
")",
")",
"{",
"binding",
".",
"setSelectedItemType",
"(",
"(",
"Class",
")",
"context",
".",
"get",
"(",
"SELECTED_ITEM_TYPE_KEY",
")",
")",
";",
"}",
"if",
"(",
"context",
".",
"containsKey",
"(",
"FORM_ID",
")",
")",
"{",
"binding",
".",
"setFormId",
"(",
"(",
"String",
")",
"context",
".",
"get",
"(",
"FORM_ID",
")",
")",
";",
"}",
"}"
] |
Apply the values from the context to the specified binding.
@param binding Binding to update
@param context Map of context values to apply to the binding
|
[
"Apply",
"the",
"values",
"from",
"the",
"context",
"to",
"the",
"specified",
"binding",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/ShuttleListBinder.java#L207-L229
|
11,694
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBinderSelectionStrategy.java
|
SwingBinderSelectionStrategy.getIdBoundBinder
|
public Binder getIdBoundBinder(String id)
{
Binder binder = idBoundBinders.get(id);
if (binder == null) // try to locate the binder bean
{
Object binderBean = getApplicationContext().getBean(id);
if (binderBean instanceof Binder)
{
if (binderBean != null)
{
idBoundBinders.put(id, (Binder) binderBean);
binder = (Binder) binderBean;
}
}
else
{
throw new IllegalArgumentException("Bean '" + id + "' was found, but was not a binder");
}
}
return binder;
}
|
java
|
public Binder getIdBoundBinder(String id)
{
Binder binder = idBoundBinders.get(id);
if (binder == null) // try to locate the binder bean
{
Object binderBean = getApplicationContext().getBean(id);
if (binderBean instanceof Binder)
{
if (binderBean != null)
{
idBoundBinders.put(id, (Binder) binderBean);
binder = (Binder) binderBean;
}
}
else
{
throw new IllegalArgumentException("Bean '" + id + "' was found, but was not a binder");
}
}
return binder;
}
|
[
"public",
"Binder",
"getIdBoundBinder",
"(",
"String",
"id",
")",
"{",
"Binder",
"binder",
"=",
"idBoundBinders",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"binder",
"==",
"null",
")",
"// try to locate the binder bean",
"{",
"Object",
"binderBean",
"=",
"getApplicationContext",
"(",
")",
".",
"getBean",
"(",
"id",
")",
";",
"if",
"(",
"binderBean",
"instanceof",
"Binder",
")",
"{",
"if",
"(",
"binderBean",
"!=",
"null",
")",
"{",
"idBoundBinders",
".",
"put",
"(",
"id",
",",
"(",
"Binder",
")",
"binderBean",
")",
";",
"binder",
"=",
"(",
"Binder",
")",
"binderBean",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Bean '\"",
"+",
"id",
"+",
"\"' was found, but was not a binder\"",
")",
";",
"}",
"}",
"return",
"binder",
";",
"}"
] |
Try to find a binder with a specified id. If no binder is found, try
to locate it into the application context, check whether it's a binder and
add it to the id bound binder map.
@param id Id of the binder
@return Binder or <code>null</code> if not found.
|
[
"Try",
"to",
"find",
"a",
"binder",
"with",
"a",
"specified",
"id",
".",
"If",
"no",
"binder",
"is",
"found",
"try",
"to",
"locate",
"it",
"into",
"the",
"application",
"context",
"check",
"whether",
"it",
"s",
"a",
"binder",
"and",
"add",
"it",
"to",
"the",
"id",
"bound",
"binder",
"map",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/binding/swing/SwingBinderSelectionStrategy.java#L69-L89
|
11,695
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/validation/support/DefaultValidationResults.java
|
DefaultValidationResults.clearMessages
|
public void clearMessages(String fieldName) {
Set messagesForFieldName = getMessages(fieldName);
for (Iterator mi = messagesForFieldName.iterator(); mi.hasNext();) {
messages.remove(mi.next());
}
messagesSubSets.clear();
}
|
java
|
public void clearMessages(String fieldName) {
Set messagesForFieldName = getMessages(fieldName);
for (Iterator mi = messagesForFieldName.iterator(); mi.hasNext();) {
messages.remove(mi.next());
}
messagesSubSets.clear();
}
|
[
"public",
"void",
"clearMessages",
"(",
"String",
"fieldName",
")",
"{",
"Set",
"messagesForFieldName",
"=",
"getMessages",
"(",
"fieldName",
")",
";",
"for",
"(",
"Iterator",
"mi",
"=",
"messagesForFieldName",
".",
"iterator",
"(",
")",
";",
"mi",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"messages",
".",
"remove",
"(",
"mi",
".",
"next",
"(",
")",
")",
";",
"}",
"messagesSubSets",
".",
"clear",
"(",
")",
";",
"}"
] |
Clear all messages of the given fieldName.
|
[
"Clear",
"all",
"messages",
"of",
"the",
"given",
"fieldName",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/validation/support/DefaultValidationResults.java#L137-L143
|
11,696
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/GlazedTableModel.java
|
GlazedTableModel.isEditable
|
protected boolean isEditable(Object row, int column) {
beanWrapper.setWrappedInstance(row);
return beanWrapper.isWritableProperty(columnPropertyNames[column]);
}
|
java
|
protected boolean isEditable(Object row, int column) {
beanWrapper.setWrappedInstance(row);
return beanWrapper.isWritableProperty(columnPropertyNames[column]);
}
|
[
"protected",
"boolean",
"isEditable",
"(",
"Object",
"row",
",",
"int",
"column",
")",
"{",
"beanWrapper",
".",
"setWrappedInstance",
"(",
"row",
")",
";",
"return",
"beanWrapper",
".",
"isWritableProperty",
"(",
"columnPropertyNames",
"[",
"column",
"]",
")",
";",
"}"
] |
May be overridden to achieve control over editable columns.
@param row
the current row
@param column
the column
@return editable
|
[
"May",
"be",
"overridden",
"to",
"achieve",
"control",
"over",
"editable",
"columns",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/GlazedTableModel.java#L149-L152
|
11,697
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/GlueGroupMember.java
|
GlueGroupMember.fill
|
protected void fill(GroupContainerPopulator parentContainer,
Object factory,
CommandButtonConfigurer configurer,
List previousButtons) {
parentContainer.add(Box.createGlue());
}
|
java
|
protected void fill(GroupContainerPopulator parentContainer,
Object factory,
CommandButtonConfigurer configurer,
List previousButtons) {
parentContainer.add(Box.createGlue());
}
|
[
"protected",
"void",
"fill",
"(",
"GroupContainerPopulator",
"parentContainer",
",",
"Object",
"factory",
",",
"CommandButtonConfigurer",
"configurer",
",",
"List",
"previousButtons",
")",
"{",
"parentContainer",
".",
"add",
"(",
"Box",
".",
"createGlue",
"(",
")",
")",
";",
"}"
] |
Adds a glue component using the given container populator.
{@inheritDoc}
|
[
"Adds",
"a",
"glue",
"component",
"using",
"the",
"given",
"container",
"populator",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/command/support/GlueGroupMember.java#L50-L55
|
11,698
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java
|
AbstractObjectTable.getBaseEventList
|
public EventList getBaseEventList() {
if (baseList == null) {
// Construct on demand
Object[] data = getInitialData();
if (logger.isDebugEnabled()) {
logger.debug("Table data: got " + data.length + " entries");
}
// Construct the event list of all our data and layer on the sorting
EventList rawList = GlazedLists.eventList(Arrays.asList(data));
int initialSortColumn = getInitialSortColumn();
if (initialSortColumn >= 0) {
String sortProperty = getColumnPropertyNames()[initialSortColumn];
baseList = new SortedList(rawList, new PropertyComparator(
sortProperty, false, true));
} else {
baseList = new SortedList(rawList);
}
}
return baseList;
}
|
java
|
public EventList getBaseEventList() {
if (baseList == null) {
// Construct on demand
Object[] data = getInitialData();
if (logger.isDebugEnabled()) {
logger.debug("Table data: got " + data.length + " entries");
}
// Construct the event list of all our data and layer on the sorting
EventList rawList = GlazedLists.eventList(Arrays.asList(data));
int initialSortColumn = getInitialSortColumn();
if (initialSortColumn >= 0) {
String sortProperty = getColumnPropertyNames()[initialSortColumn];
baseList = new SortedList(rawList, new PropertyComparator(
sortProperty, false, true));
} else {
baseList = new SortedList(rawList);
}
}
return baseList;
}
|
[
"public",
"EventList",
"getBaseEventList",
"(",
")",
"{",
"if",
"(",
"baseList",
"==",
"null",
")",
"{",
"// Construct on demand",
"Object",
"[",
"]",
"data",
"=",
"getInitialData",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"Table data: got \"",
"+",
"data",
".",
"length",
"+",
"\" entries\"",
")",
";",
"}",
"// Construct the event list of all our data and layer on the sorting",
"EventList",
"rawList",
"=",
"GlazedLists",
".",
"eventList",
"(",
"Arrays",
".",
"asList",
"(",
"data",
")",
")",
";",
"int",
"initialSortColumn",
"=",
"getInitialSortColumn",
"(",
")",
";",
"if",
"(",
"initialSortColumn",
">=",
"0",
")",
"{",
"String",
"sortProperty",
"=",
"getColumnPropertyNames",
"(",
")",
"[",
"initialSortColumn",
"]",
";",
"baseList",
"=",
"new",
"SortedList",
"(",
"rawList",
",",
"new",
"PropertyComparator",
"(",
"sortProperty",
",",
"false",
",",
"true",
")",
")",
";",
"}",
"else",
"{",
"baseList",
"=",
"new",
"SortedList",
"(",
"rawList",
")",
";",
"}",
"}",
"return",
"baseList",
";",
"}"
] |
Get the base event list for the table model. This can be used to build
layered event models for filtering.
@return base event list
|
[
"Get",
"the",
"base",
"event",
"list",
"for",
"the",
"table",
"model",
".",
"This",
"can",
"be",
"used",
"to",
"build",
"layered",
"event",
"models",
"for",
"filtering",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java#L212-L231
|
11,699
|
lievendoclo/Valkyrie-RCP
|
valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java
|
AbstractObjectTable.init
|
protected void init() {
// Get all our messages
objectSingularName = getApplicationConfig().messageResolver().getMessage(
modelId + ".objectName.singular");
objectPluralName = getApplicationConfig().messageResolver().getMessage(
modelId + ".objectName.plural");
}
|
java
|
protected void init() {
// Get all our messages
objectSingularName = getApplicationConfig().messageResolver().getMessage(
modelId + ".objectName.singular");
objectPluralName = getApplicationConfig().messageResolver().getMessage(
modelId + ".objectName.plural");
}
|
[
"protected",
"void",
"init",
"(",
")",
"{",
"// Get all our messages",
"objectSingularName",
"=",
"getApplicationConfig",
"(",
")",
".",
"messageResolver",
"(",
")",
".",
"getMessage",
"(",
"modelId",
"+",
"\".objectName.singular\"",
")",
";",
"objectPluralName",
"=",
"getApplicationConfig",
"(",
")",
".",
"messageResolver",
"(",
")",
".",
"getMessage",
"(",
"modelId",
"+",
"\".objectName.plural\"",
")",
";",
"}"
] |
Initialize our internal values.
|
[
"Initialize",
"our",
"internal",
"values",
"."
] |
6aad6e640b348cda8f3b0841f6e42025233f1eb8
|
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/table/support/AbstractObjectTable.java#L356-L362
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.