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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
larsga/Duke | duke-lucene/src/main/java/no/priv/garshol/duke/databases/LuceneDatabase.java | LuceneDatabase.commit | public void commit() {
if (directory == null)
return;
try {
if (reader != null)
reader.close();
// it turns out that IndexWriter.optimize actually slows
// searches down, because it invalidates the cache. therefore
// not calling it any more.
// http://www.searchworkings.org/blog/-/blogs/uwe-says%3A-is-your-reader-atomic
// iwriter.optimize();
iwriter.commit();
openSearchers();
} catch (IOException e) {
throw new DukeException(e);
}
} | java | public void commit() {
if (directory == null)
return;
try {
if (reader != null)
reader.close();
// it turns out that IndexWriter.optimize actually slows
// searches down, because it invalidates the cache. therefore
// not calling it any more.
// http://www.searchworkings.org/blog/-/blogs/uwe-says%3A-is-your-reader-atomic
// iwriter.optimize();
iwriter.commit();
openSearchers();
} catch (IOException e) {
throw new DukeException(e);
}
} | [
"public",
"void",
"commit",
"(",
")",
"{",
"if",
"(",
"directory",
"==",
"null",
")",
"return",
";",
"try",
"{",
"if",
"(",
"reader",
"!=",
"null",
")",
"reader",
".",
"close",
"(",
")",
";",
"// it turns out that IndexWriter.optimize actually slows",
"// se... | Flushes all changes to disk. | [
"Flushes",
"all",
"changes",
"to",
"disk",
"."
] | 6263f9c6e984c26362a76241c7c7ea3bb4469bac | https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-lucene/src/main/java/no/priv/garshol/duke/databases/LuceneDatabase.java#L218-L237 | train |
larsga/Duke | duke-lucene/src/main/java/no/priv/garshol/duke/databases/LuceneDatabase.java | LuceneDatabase.findRecordById | public Record findRecordById(String id) {
if (directory == null)
init();
Property idprop = config.getIdentityProperties().iterator().next();
for (Record r : lookup(idprop, id))
if (r.getValue(idprop.getName()).equals(id))
return r;
return null; // not found
} | java | public Record findRecordById(String id) {
if (directory == null)
init();
Property idprop = config.getIdentityProperties().iterator().next();
for (Record r : lookup(idprop, id))
if (r.getValue(idprop.getName()).equals(id))
return r;
return null; // not found
} | [
"public",
"Record",
"findRecordById",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"directory",
"==",
"null",
")",
"init",
"(",
")",
";",
"Property",
"idprop",
"=",
"config",
".",
"getIdentityProperties",
"(",
")",
".",
"iterator",
"(",
")",
".",
"next",
... | Look up record by identity. | [
"Look",
"up",
"record",
"by",
"identity",
"."
] | 6263f9c6e984c26362a76241c7c7ea3bb4469bac | https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-lucene/src/main/java/no/priv/garshol/duke/databases/LuceneDatabase.java#L242-L252 | train |
larsga/Duke | duke-core/src/main/java/no/priv/garshol/duke/cleaners/PhoneNumberCleaner.java | PhoneNumberCleaner.clean | public String clean(String value) {
String orig = value;
// check if there's a + before the first digit
boolean initialplus = findPlus(value);
// remove everything but digits
value = sub.clean(value);
if (value == null)
return null;
// check for initial '00'
boolean zerozero = !initialplus && value.startsWith("00");
if (zerozero)
value = value.substring(2); // strip off the zeros
// look for country code
CountryCode ccode = findCountryCode(value);
if (ccode == null) {
// no country code, let's do what little we can
if (initialplus || zerozero)
return orig; // this number is messed up. dare not touch
return value;
} else {
value = value.substring(ccode.getPrefix().length()); // strip off ccode
if (ccode.getStripZero() && value.startsWith("0"))
value = value.substring(1); // strip the zero
if (ccode.isRightFormat(value))
return "+" + ccode.getPrefix() + " " + value;
else
return orig; // don't dare touch this
}
} | java | public String clean(String value) {
String orig = value;
// check if there's a + before the first digit
boolean initialplus = findPlus(value);
// remove everything but digits
value = sub.clean(value);
if (value == null)
return null;
// check for initial '00'
boolean zerozero = !initialplus && value.startsWith("00");
if (zerozero)
value = value.substring(2); // strip off the zeros
// look for country code
CountryCode ccode = findCountryCode(value);
if (ccode == null) {
// no country code, let's do what little we can
if (initialplus || zerozero)
return orig; // this number is messed up. dare not touch
return value;
} else {
value = value.substring(ccode.getPrefix().length()); // strip off ccode
if (ccode.getStripZero() && value.startsWith("0"))
value = value.substring(1); // strip the zero
if (ccode.isRightFormat(value))
return "+" + ccode.getPrefix() + " " + value;
else
return orig; // don't dare touch this
}
} | [
"public",
"String",
"clean",
"(",
"String",
"value",
")",
"{",
"String",
"orig",
"=",
"value",
";",
"// check if there's a + before the first digit",
"boolean",
"initialplus",
"=",
"findPlus",
"(",
"value",
")",
";",
"// remove everything but digits",
"value",
"=",
... | look for zero after country code, and remove if present | [
"look",
"for",
"zero",
"after",
"country",
"code",
"and",
"remove",
"if",
"present"
] | 6263f9c6e984c26362a76241c7c7ea3bb4469bac | https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-core/src/main/java/no/priv/garshol/duke/cleaners/PhoneNumberCleaner.java#L32-L66 | train |
larsga/Duke | duke-core/src/main/java/no/priv/garshol/duke/Link.java | Link.overrides | public boolean overrides(Link other) {
if (other.getStatus() == LinkStatus.ASSERTED &&
status != LinkStatus.ASSERTED)
return false;
else if (status == LinkStatus.ASSERTED &&
other.getStatus() != LinkStatus.ASSERTED)
return true;
// the two links are from equivalent sources of information, so we
// believe the most recent
return timestamp > other.getTimestamp();
} | java | public boolean overrides(Link other) {
if (other.getStatus() == LinkStatus.ASSERTED &&
status != LinkStatus.ASSERTED)
return false;
else if (status == LinkStatus.ASSERTED &&
other.getStatus() != LinkStatus.ASSERTED)
return true;
// the two links are from equivalent sources of information, so we
// believe the most recent
return timestamp > other.getTimestamp();
} | [
"public",
"boolean",
"overrides",
"(",
"Link",
"other",
")",
"{",
"if",
"(",
"other",
".",
"getStatus",
"(",
")",
"==",
"LinkStatus",
".",
"ASSERTED",
"&&",
"status",
"!=",
"LinkStatus",
".",
"ASSERTED",
")",
"return",
"false",
";",
"else",
"if",
"(",
... | Returns true if the information in this link should take
precedence over the information in the other link. | [
"Returns",
"true",
"if",
"the",
"information",
"in",
"this",
"link",
"should",
"take",
"precedence",
"over",
"the",
"information",
"in",
"the",
"other",
"link",
"."
] | 6263f9c6e984c26362a76241c7c7ea3bb4469bac | https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-core/src/main/java/no/priv/garshol/duke/Link.java#L92-L104 | train |
larsga/Duke | duke-server/src/main/java/no/priv/garshol/duke/server/DukeController.java | DukeController.process | public void process() {
// are we ready to process yet, or have we had an error, and are
// waiting a bit longer in the hope that it will resolve itself?
if (error_skips > 0) {
error_skips--;
return;
}
try {
if (logger != null)
logger.debug("Starting processing");
status = "Processing";
lastCheck = System.currentTimeMillis();
// FIXME: how to break off processing if we don't want to keep going?
processor.deduplicate(batch_size);
status = "Sleeping";
if (logger != null)
logger.debug("Finished processing");
} catch (Throwable e) {
status = "Thread blocked on error: " + e;
if (logger != null)
logger.error("Error in processing; waiting", e);
error_skips = error_factor;
}
} | java | public void process() {
// are we ready to process yet, or have we had an error, and are
// waiting a bit longer in the hope that it will resolve itself?
if (error_skips > 0) {
error_skips--;
return;
}
try {
if (logger != null)
logger.debug("Starting processing");
status = "Processing";
lastCheck = System.currentTimeMillis();
// FIXME: how to break off processing if we don't want to keep going?
processor.deduplicate(batch_size);
status = "Sleeping";
if (logger != null)
logger.debug("Finished processing");
} catch (Throwable e) {
status = "Thread blocked on error: " + e;
if (logger != null)
logger.error("Error in processing; waiting", e);
error_skips = error_factor;
}
} | [
"public",
"void",
"process",
"(",
")",
"{",
"// are we ready to process yet, or have we had an error, and are",
"// waiting a bit longer in the hope that it will resolve itself?",
"if",
"(",
"error_skips",
">",
"0",
")",
"{",
"error_skips",
"--",
";",
"return",
";",
"}",
"t... | Runs the record linkage process. | [
"Runs",
"the",
"record",
"linkage",
"process",
"."
] | 6263f9c6e984c26362a76241c7c7ea3bb4469bac | https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-server/src/main/java/no/priv/garshol/duke/server/DukeController.java#L98-L124 | train |
larsga/Duke | duke-server/src/main/java/no/priv/garshol/duke/server/DukeController.java | DukeController.reportError | void reportError(Throwable throwable) {
if (logger != null)
logger.error("Timer reported error", throwable);
status = "Thread blocked on error: " + throwable;
error_skips = error_factor;
} | java | void reportError(Throwable throwable) {
if (logger != null)
logger.error("Timer reported error", throwable);
status = "Thread blocked on error: " + throwable;
error_skips = error_factor;
} | [
"void",
"reportError",
"(",
"Throwable",
"throwable",
")",
"{",
"if",
"(",
"logger",
"!=",
"null",
")",
"logger",
".",
"error",
"(",
"\"Timer reported error\"",
",",
"throwable",
")",
";",
"status",
"=",
"\"Thread blocked on error: \"",
"+",
"throwable",
";",
... | called by timer thread | [
"called",
"by",
"timer",
"thread"
] | 6263f9c6e984c26362a76241c7c7ea3bb4469bac | https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-server/src/main/java/no/priv/garshol/duke/server/DukeController.java#L155-L160 | train |
larsga/Duke | duke-core/src/main/java/no/priv/garshol/duke/utils/ObjectUtils.java | ObjectUtils.makePropertyName | public static String makePropertyName(String name) {
char[] buf = new char[name.length() + 3];
int pos = 0;
buf[pos++] = 's';
buf[pos++] = 'e';
buf[pos++] = 't';
for (int ix = 0; ix < name.length(); ix++) {
char ch = name.charAt(ix);
if (ix == 0)
ch = Character.toUpperCase(ch);
else if (ch == '-') {
ix++;
if (ix == name.length())
break;
ch = Character.toUpperCase(name.charAt(ix));
}
buf[pos++] = ch;
}
return new String(buf, 0, pos);
} | java | public static String makePropertyName(String name) {
char[] buf = new char[name.length() + 3];
int pos = 0;
buf[pos++] = 's';
buf[pos++] = 'e';
buf[pos++] = 't';
for (int ix = 0; ix < name.length(); ix++) {
char ch = name.charAt(ix);
if (ix == 0)
ch = Character.toUpperCase(ch);
else if (ch == '-') {
ix++;
if (ix == name.length())
break;
ch = Character.toUpperCase(name.charAt(ix));
}
buf[pos++] = ch;
}
return new String(buf, 0, pos);
} | [
"public",
"static",
"String",
"makePropertyName",
"(",
"String",
"name",
")",
"{",
"char",
"[",
"]",
"buf",
"=",
"new",
"char",
"[",
"name",
".",
"length",
"(",
")",
"+",
"3",
"]",
";",
"int",
"pos",
"=",
"0",
";",
"buf",
"[",
"pos",
"++",
"]",
... | public because it's used by other packages that use Duke | [
"public",
"because",
"it",
"s",
"used",
"by",
"other",
"packages",
"that",
"use",
"Duke"
] | 6263f9c6e984c26362a76241c7c7ea3bb4469bac | https://github.com/larsga/Duke/blob/6263f9c6e984c26362a76241c7c7ea3bb4469bac/duke-core/src/main/java/no/priv/garshol/duke/utils/ObjectUtils.java#L77-L99 | train |
andremion/Louvre | louvre/src/main/java/com/andremion/louvre/util/transition/MediaSharedElementCallback.java | MediaSharedElementCallback.mapObsoleteElements | @NonNull
private List<String> mapObsoleteElements(List<String> names) {
List<String> elementsToRemove = new ArrayList<>(names.size());
for (String name : names) {
if (name.startsWith("android")) continue;
elementsToRemove.add(name);
}
return elementsToRemove;
} | java | @NonNull
private List<String> mapObsoleteElements(List<String> names) {
List<String> elementsToRemove = new ArrayList<>(names.size());
for (String name : names) {
if (name.startsWith("android")) continue;
elementsToRemove.add(name);
}
return elementsToRemove;
} | [
"@",
"NonNull",
"private",
"List",
"<",
"String",
">",
"mapObsoleteElements",
"(",
"List",
"<",
"String",
">",
"names",
")",
"{",
"List",
"<",
"String",
">",
"elementsToRemove",
"=",
"new",
"ArrayList",
"<>",
"(",
"names",
".",
"size",
"(",
")",
")",
"... | Maps all views that don't start with "android" namespace.
@param names All shared element names.
@return The obsolete shared element names. | [
"Maps",
"all",
"views",
"that",
"don",
"t",
"start",
"with",
"android",
"namespace",
"."
] | 9aeddc88f2e51b8f0f757c290ff26904ae8d6af2 | https://github.com/andremion/Louvre/blob/9aeddc88f2e51b8f0f757c290ff26904ae8d6af2/louvre/src/main/java/com/andremion/louvre/util/transition/MediaSharedElementCallback.java#L72-L80 | train |
andremion/Louvre | louvre/src/main/java/com/andremion/louvre/util/transition/MediaSharedElementCallback.java | MediaSharedElementCallback.removeObsoleteElements | private void removeObsoleteElements(List<String> names,
Map<String, View> sharedElements,
List<String> elementsToRemove) {
if (elementsToRemove.size() > 0) {
names.removeAll(elementsToRemove);
for (String elementToRemove : elementsToRemove) {
sharedElements.remove(elementToRemove);
}
}
} | java | private void removeObsoleteElements(List<String> names,
Map<String, View> sharedElements,
List<String> elementsToRemove) {
if (elementsToRemove.size() > 0) {
names.removeAll(elementsToRemove);
for (String elementToRemove : elementsToRemove) {
sharedElements.remove(elementToRemove);
}
}
} | [
"private",
"void",
"removeObsoleteElements",
"(",
"List",
"<",
"String",
">",
"names",
",",
"Map",
"<",
"String",
",",
"View",
">",
"sharedElements",
",",
"List",
"<",
"String",
">",
"elementsToRemove",
")",
"{",
"if",
"(",
"elementsToRemove",
".",
"size",
... | Removes obsolete elements from names and shared elements.
@param names Shared element names.
@param sharedElements Shared elements.
@param elementsToRemove The elements that should be removed. | [
"Removes",
"obsolete",
"elements",
"from",
"names",
"and",
"shared",
"elements",
"."
] | 9aeddc88f2e51b8f0f757c290ff26904ae8d6af2 | https://github.com/andremion/Louvre/blob/9aeddc88f2e51b8f0f757c290ff26904ae8d6af2/louvre/src/main/java/com/andremion/louvre/util/transition/MediaSharedElementCallback.java#L89-L98 | train |
andremion/Louvre | louvre/src/main/java/com/andremion/louvre/home/GalleryAdapter.java | GalleryAdapter.onBindViewHolder | @Override
public void onBindViewHolder(GalleryAdapter.ViewHolder holder, int position, List<Object> payloads) {
if (payloads.isEmpty()) { // If doesn't have any payload then bind the fully item
super.onBindViewHolder(holder, position, payloads);
} else {
for (Object payload : payloads) {
boolean selected = isSelected(position);
if (SELECTION_PAYLOAD.equals(payload)) {
if (VIEW_TYPE_MEDIA == getItemViewType(position)) {
MediaViewHolder viewHolder = (MediaViewHolder) holder;
viewHolder.mCheckView.setChecked(selected);
if (selected) {
AnimationHelper.scaleView(holder.mImageView, SELECTED_SCALE);
} else {
AnimationHelper.scaleView(holder.mImageView, UNSELECTED_SCALE);
}
}
}
}
}
} | java | @Override
public void onBindViewHolder(GalleryAdapter.ViewHolder holder, int position, List<Object> payloads) {
if (payloads.isEmpty()) { // If doesn't have any payload then bind the fully item
super.onBindViewHolder(holder, position, payloads);
} else {
for (Object payload : payloads) {
boolean selected = isSelected(position);
if (SELECTION_PAYLOAD.equals(payload)) {
if (VIEW_TYPE_MEDIA == getItemViewType(position)) {
MediaViewHolder viewHolder = (MediaViewHolder) holder;
viewHolder.mCheckView.setChecked(selected);
if (selected) {
AnimationHelper.scaleView(holder.mImageView, SELECTED_SCALE);
} else {
AnimationHelper.scaleView(holder.mImageView, UNSELECTED_SCALE);
}
}
}
}
}
} | [
"@",
"Override",
"public",
"void",
"onBindViewHolder",
"(",
"GalleryAdapter",
".",
"ViewHolder",
"holder",
",",
"int",
"position",
",",
"List",
"<",
"Object",
">",
"payloads",
")",
"{",
"if",
"(",
"payloads",
".",
"isEmpty",
"(",
")",
")",
"{",
"// If does... | Binding view holder with payloads is used to handle partial changes in item. | [
"Binding",
"view",
"holder",
"with",
"payloads",
"is",
"used",
"to",
"handle",
"partial",
"changes",
"in",
"item",
"."
] | 9aeddc88f2e51b8f0f757c290ff26904ae8d6af2 | https://github.com/andremion/Louvre/blob/9aeddc88f2e51b8f0f757c290ff26904ae8d6af2/louvre/src/main/java/com/andremion/louvre/home/GalleryAdapter.java#L190-L210 | train |
airlift/slice | src/main/java/io/airlift/slice/UnsafeSliceFactory.java | UnsafeSliceFactory.newSlice | public Slice newSlice(long address, int size)
{
if (address <= 0) {
throw new IllegalArgumentException("Invalid address: " + address);
}
if (size == 0) {
return Slices.EMPTY_SLICE;
}
return new Slice(null, address, size, 0, null);
} | java | public Slice newSlice(long address, int size)
{
if (address <= 0) {
throw new IllegalArgumentException("Invalid address: " + address);
}
if (size == 0) {
return Slices.EMPTY_SLICE;
}
return new Slice(null, address, size, 0, null);
} | [
"public",
"Slice",
"newSlice",
"(",
"long",
"address",
",",
"int",
"size",
")",
"{",
"if",
"(",
"address",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid address: \"",
"+",
"address",
")",
";",
"}",
"if",
"(",
"size",
"=... | Creates a slice for directly a raw memory address. This is
inherently unsafe as it may be used to access arbitrary memory.
@param address the raw memory address base
@param size the size of the slice
@return the unsafe slice | [
"Creates",
"a",
"slice",
"for",
"directly",
"a",
"raw",
"memory",
"address",
".",
"This",
"is",
"inherently",
"unsafe",
"as",
"it",
"may",
"be",
"used",
"to",
"access",
"arbitrary",
"memory",
"."
] | 7166cb0319e3655f8ba15f5a7ccf3d2f721c1242 | https://github.com/airlift/slice/blob/7166cb0319e3655f8ba15f5a7ccf3d2f721c1242/src/main/java/io/airlift/slice/UnsafeSliceFactory.java#L64-L73 | train |
airlift/slice | src/main/java/io/airlift/slice/UnsafeSliceFactory.java | UnsafeSliceFactory.newSlice | public Slice newSlice(long address, int size, Object reference)
{
if (address <= 0) {
throw new IllegalArgumentException("Invalid address: " + address);
}
if (reference == null) {
throw new NullPointerException("Object reference is null");
}
if (size == 0) {
return Slices.EMPTY_SLICE;
}
return new Slice(null, address, size, size, reference);
} | java | public Slice newSlice(long address, int size, Object reference)
{
if (address <= 0) {
throw new IllegalArgumentException("Invalid address: " + address);
}
if (reference == null) {
throw new NullPointerException("Object reference is null");
}
if (size == 0) {
return Slices.EMPTY_SLICE;
}
return new Slice(null, address, size, size, reference);
} | [
"public",
"Slice",
"newSlice",
"(",
"long",
"address",
",",
"int",
"size",
",",
"Object",
"reference",
")",
"{",
"if",
"(",
"address",
"<=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid address: \"",
"+",
"address",
")",
";",
... | Creates a slice for directly a raw memory address. This is
inherently unsafe as it may be used to access arbitrary memory.
The slice will hold the specified object reference to prevent the
garbage collector from freeing it while it is in use by the slice.
@param address the raw memory address base
@param size the size of the slice
@param reference the object reference
@return the unsafe slice | [
"Creates",
"a",
"slice",
"for",
"directly",
"a",
"raw",
"memory",
"address",
".",
"This",
"is",
"inherently",
"unsafe",
"as",
"it",
"may",
"be",
"used",
"to",
"access",
"arbitrary",
"memory",
".",
"The",
"slice",
"will",
"hold",
"the",
"specified",
"object... | 7166cb0319e3655f8ba15f5a7ccf3d2f721c1242 | https://github.com/airlift/slice/blob/7166cb0319e3655f8ba15f5a7ccf3d2f721c1242/src/main/java/io/airlift/slice/UnsafeSliceFactory.java#L86-L98 | train |
airlift/slice | src/main/java/io/airlift/slice/Murmur3Hash32.java | Murmur3Hash32.hash | public static int hash(int input)
{
int k1 = mixK1(input);
int h1 = mixH1(DEFAULT_SEED, k1);
return fmix(h1, SizeOf.SIZE_OF_INT);
} | java | public static int hash(int input)
{
int k1 = mixK1(input);
int h1 = mixH1(DEFAULT_SEED, k1);
return fmix(h1, SizeOf.SIZE_OF_INT);
} | [
"public",
"static",
"int",
"hash",
"(",
"int",
"input",
")",
"{",
"int",
"k1",
"=",
"mixK1",
"(",
"input",
")",
";",
"int",
"h1",
"=",
"mixH1",
"(",
"DEFAULT_SEED",
",",
"k1",
")",
";",
"return",
"fmix",
"(",
"h1",
",",
"SizeOf",
".",
"SIZE_OF_INT"... | Special-purpose version for hashing a single int value. Value is treated as little-endian | [
"Special",
"-",
"purpose",
"version",
"for",
"hashing",
"a",
"single",
"int",
"value",
".",
"Value",
"is",
"treated",
"as",
"little",
"-",
"endian"
] | 7166cb0319e3655f8ba15f5a7ccf3d2f721c1242 | https://github.com/airlift/slice/blob/7166cb0319e3655f8ba15f5a7ccf3d2f721c1242/src/main/java/io/airlift/slice/Murmur3Hash32.java#L70-L76 | train |
airlift/slice | src/main/java/io/airlift/slice/SliceUtf8.java | SliceUtf8.isAscii | public static boolean isAscii(Slice utf8)
{
int length = utf8.length();
int offset = 0;
// Length rounded to 8 bytes
int length8 = length & 0x7FFF_FFF8;
for (; offset < length8; offset += 8) {
if ((utf8.getLongUnchecked(offset) & TOP_MASK64) != 0) {
return false;
}
}
// Enough bytes left for 32 bits?
if (offset + 4 < length) {
if ((utf8.getIntUnchecked(offset) & TOP_MASK32) != 0) {
return false;
}
offset += 4;
}
// Do the rest one by one
for (; offset < length; offset++) {
if ((utf8.getByteUnchecked(offset) & 0x80) != 0) {
return false;
}
}
return true;
} | java | public static boolean isAscii(Slice utf8)
{
int length = utf8.length();
int offset = 0;
// Length rounded to 8 bytes
int length8 = length & 0x7FFF_FFF8;
for (; offset < length8; offset += 8) {
if ((utf8.getLongUnchecked(offset) & TOP_MASK64) != 0) {
return false;
}
}
// Enough bytes left for 32 bits?
if (offset + 4 < length) {
if ((utf8.getIntUnchecked(offset) & TOP_MASK32) != 0) {
return false;
}
offset += 4;
}
// Do the rest one by one
for (; offset < length; offset++) {
if ((utf8.getByteUnchecked(offset) & 0x80) != 0) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isAscii",
"(",
"Slice",
"utf8",
")",
"{",
"int",
"length",
"=",
"utf8",
".",
"length",
"(",
")",
";",
"int",
"offset",
"=",
"0",
";",
"// Length rounded to 8 bytes",
"int",
"length8",
"=",
"length",
"&",
"0x7FFF_FFF8",
";",
... | Does the slice contain only 7-bit ASCII characters. | [
"Does",
"the",
"slice",
"contain",
"only",
"7",
"-",
"bit",
"ASCII",
"characters",
"."
] | 7166cb0319e3655f8ba15f5a7ccf3d2f721c1242 | https://github.com/airlift/slice/blob/7166cb0319e3655f8ba15f5a7ccf3d2f721c1242/src/main/java/io/airlift/slice/SliceUtf8.java#L67-L95 | train |
airlift/slice | src/main/java/io/airlift/slice/SliceUtf8.java | SliceUtf8.lengthOfCodePoint | public static int lengthOfCodePoint(int codePoint)
{
if (codePoint < 0) {
throw new InvalidCodePointException(codePoint);
}
if (codePoint < 0x80) {
// normal ASCII
// 0xxx_xxxx
return 1;
}
if (codePoint < 0x800) {
return 2;
}
if (codePoint < 0x1_0000) {
return 3;
}
if (codePoint < 0x11_0000) {
return 4;
}
// Per RFC3629, UTF-8 is limited to 4 bytes, so more bytes are illegal
throw new InvalidCodePointException(codePoint);
} | java | public static int lengthOfCodePoint(int codePoint)
{
if (codePoint < 0) {
throw new InvalidCodePointException(codePoint);
}
if (codePoint < 0x80) {
// normal ASCII
// 0xxx_xxxx
return 1;
}
if (codePoint < 0x800) {
return 2;
}
if (codePoint < 0x1_0000) {
return 3;
}
if (codePoint < 0x11_0000) {
return 4;
}
// Per RFC3629, UTF-8 is limited to 4 bytes, so more bytes are illegal
throw new InvalidCodePointException(codePoint);
} | [
"public",
"static",
"int",
"lengthOfCodePoint",
"(",
"int",
"codePoint",
")",
"{",
"if",
"(",
"codePoint",
"<",
"0",
")",
"{",
"throw",
"new",
"InvalidCodePointException",
"(",
"codePoint",
")",
";",
"}",
"if",
"(",
"codePoint",
"<",
"0x80",
")",
"{",
"/... | Gets the UTF-8 sequence length of the code point.
@throws InvalidCodePointException if code point is not within a valid range | [
"Gets",
"the",
"UTF",
"-",
"8",
"sequence",
"length",
"of",
"the",
"code",
"point",
"."
] | 7166cb0319e3655f8ba15f5a7ccf3d2f721c1242 | https://github.com/airlift/slice/blob/7166cb0319e3655f8ba15f5a7ccf3d2f721c1242/src/main/java/io/airlift/slice/SliceUtf8.java#L906-L927 | train |
jblas-project/jblas | src/main/java/org/jblas/ComplexDouble.java | ComplexDouble.divi | public ComplexDouble divi(ComplexDouble c, ComplexDouble result) {
double d = c.r * c.r + c.i * c.i;
double newR = (r * c.r + i * c.i) / d;
double newI = (i * c.r - r * c.i) / d;
result.r = newR;
result.i = newI;
return result;
} | java | public ComplexDouble divi(ComplexDouble c, ComplexDouble result) {
double d = c.r * c.r + c.i * c.i;
double newR = (r * c.r + i * c.i) / d;
double newI = (i * c.r - r * c.i) / d;
result.r = newR;
result.i = newI;
return result;
} | [
"public",
"ComplexDouble",
"divi",
"(",
"ComplexDouble",
"c",
",",
"ComplexDouble",
"result",
")",
"{",
"double",
"d",
"=",
"c",
".",
"r",
"*",
"c",
".",
"r",
"+",
"c",
".",
"i",
"*",
"c",
".",
"i",
";",
"double",
"newR",
"=",
"(",
"r",
"*",
"c... | Divide two complex numbers, in-place
@param c complex number to divide this by
@param result complex number to hold result
@return same as result | [
"Divide",
"two",
"complex",
"numbers",
"in",
"-",
"place"
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/ComplexDouble.java#L284-L291 | train |
jblas-project/jblas | src/main/java/org/jblas/util/Permutations.java | Permutations.randomPermutation | public static int[] randomPermutation(int size) {
Random r = new Random();
int[] result = new int[size];
for (int j = 0; j < size; j++) {
result[j] = j;
}
for (int j = size - 1; j > 0; j--) {
int k = r.nextInt(j);
int temp = result[j];
result[j] = result[k];
result[k] = temp;
}
return result;
} | java | public static int[] randomPermutation(int size) {
Random r = new Random();
int[] result = new int[size];
for (int j = 0; j < size; j++) {
result[j] = j;
}
for (int j = size - 1; j > 0; j--) {
int k = r.nextInt(j);
int temp = result[j];
result[j] = result[k];
result[k] = temp;
}
return result;
} | [
"public",
"static",
"int",
"[",
"]",
"randomPermutation",
"(",
"int",
"size",
")",
"{",
"Random",
"r",
"=",
"new",
"Random",
"(",
")",
";",
"int",
"[",
"]",
"result",
"=",
"new",
"int",
"[",
"size",
"]",
";",
"for",
"(",
"int",
"j",
"=",
"0",
"... | Create a random permutation of the numbers 0, ..., size - 1.
see Algorithm P, D.E. Knuth: The Art of Computer Programming, Vol. 2, p. 145 | [
"Create",
"a",
"random",
"permutation",
"of",
"the",
"numbers",
"0",
"...",
"size",
"-",
"1",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/Permutations.java#L54-L70 | train |
jblas-project/jblas | src/main/java/org/jblas/util/Permutations.java | Permutations.randomSubset | public static int[] randomSubset(int k, int n) {
assert(0 < k && k <= n);
Random r = new Random();
int t = 0, m = 0;
int[] result = new int[k];
while (m < k) {
double u = r.nextDouble();
if ( (n - t) * u < k - m ) {
result[m] = t;
m++;
}
t++;
}
return result;
} | java | public static int[] randomSubset(int k, int n) {
assert(0 < k && k <= n);
Random r = new Random();
int t = 0, m = 0;
int[] result = new int[k];
while (m < k) {
double u = r.nextDouble();
if ( (n - t) * u < k - m ) {
result[m] = t;
m++;
}
t++;
}
return result;
} | [
"public",
"static",
"int",
"[",
"]",
"randomSubset",
"(",
"int",
"k",
",",
"int",
"n",
")",
"{",
"assert",
"(",
"0",
"<",
"k",
"&&",
"k",
"<=",
"n",
")",
";",
"Random",
"r",
"=",
"new",
"Random",
"(",
")",
";",
"int",
"t",
"=",
"0",
",",
"m... | Get a random sample of k out of n elements.
See Algorithm S, D. E. Knuth, The Art of Computer Programming, Vol. 2, p.142. | [
"Get",
"a",
"random",
"sample",
"of",
"k",
"out",
"of",
"n",
"elements",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/Permutations.java#L77-L92 | train |
jblas-project/jblas | src/main/java/org/jblas/Singular.java | Singular.fullSVD | public static DoubleMatrix[] fullSVD(DoubleMatrix A) {
int m = A.rows;
int n = A.columns;
DoubleMatrix U = new DoubleMatrix(m, m);
DoubleMatrix S = new DoubleMatrix(min(m, n));
DoubleMatrix V = new DoubleMatrix(n, n);
int info = NativeBlas.dgesvd('A', 'A', m, n, A.dup().data, 0, m, S.data, 0, U.data, 0, m, V.data, 0, n);
if (info > 0) {
throw new LapackConvergenceException("GESVD", info + " superdiagonals of an intermediate bidiagonal form failed to converge.");
}
return new DoubleMatrix[]{U, S, V.transpose()};
} | java | public static DoubleMatrix[] fullSVD(DoubleMatrix A) {
int m = A.rows;
int n = A.columns;
DoubleMatrix U = new DoubleMatrix(m, m);
DoubleMatrix S = new DoubleMatrix(min(m, n));
DoubleMatrix V = new DoubleMatrix(n, n);
int info = NativeBlas.dgesvd('A', 'A', m, n, A.dup().data, 0, m, S.data, 0, U.data, 0, m, V.data, 0, n);
if (info > 0) {
throw new LapackConvergenceException("GESVD", info + " superdiagonals of an intermediate bidiagonal form failed to converge.");
}
return new DoubleMatrix[]{U, S, V.transpose()};
} | [
"public",
"static",
"DoubleMatrix",
"[",
"]",
"fullSVD",
"(",
"DoubleMatrix",
"A",
")",
"{",
"int",
"m",
"=",
"A",
".",
"rows",
";",
"int",
"n",
"=",
"A",
".",
"columns",
";",
"DoubleMatrix",
"U",
"=",
"new",
"DoubleMatrix",
"(",
"m",
",",
"m",
")"... | Compute a singular-value decomposition of A.
@return A DoubleMatrix[3] array of U, S, V such that A = U * diag(S) * V' | [
"Compute",
"a",
"singular",
"-",
"value",
"decomposition",
"of",
"A",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Singular.java#L21-L36 | train |
jblas-project/jblas | src/main/java/org/jblas/util/LibraryLoader.java | LibraryLoader.tryPath | private InputStream tryPath(String path) {
Logger.getLogger().debug("Trying path \"" + path + "\".");
return getClass().getResourceAsStream(path);
} | java | private InputStream tryPath(String path) {
Logger.getLogger().debug("Trying path \"" + path + "\".");
return getClass().getResourceAsStream(path);
} | [
"private",
"InputStream",
"tryPath",
"(",
"String",
"path",
")",
"{",
"Logger",
".",
"getLogger",
"(",
")",
".",
"debug",
"(",
"\"Trying path \\\"\"",
"+",
"path",
"+",
"\"\\\".\"",
")",
";",
"return",
"getClass",
"(",
")",
".",
"getResourceAsStream",
"(",
... | Try to open a file at the given position. | [
"Try",
"to",
"open",
"a",
"file",
"at",
"the",
"given",
"position",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/LibraryLoader.java#L233-L236 | train |
jblas-project/jblas | src/main/java/org/jblas/util/LibraryLoader.java | LibraryLoader.loadLibraryFromStream | private void loadLibraryFromStream(String libname, InputStream is) {
try {
File tempfile = createTempFile(libname);
OutputStream os = new FileOutputStream(tempfile);
logger.debug("tempfile.getPath() = " + tempfile.getPath());
long savedTime = System.currentTimeMillis();
// Leo says 8k block size is STANDARD ;)
byte buf[] = new byte[8192];
int len;
while ((len = is.read(buf)) > 0) {
os.write(buf, 0, len);
}
os.flush();
InputStream lock = new FileInputStream(tempfile);
os.close();
double seconds = (double) (System.currentTimeMillis() - savedTime) / 1e3;
logger.debug("Copying took " + seconds + " seconds.");
logger.debug("Loading library from " + tempfile.getPath() + ".");
System.load(tempfile.getPath());
lock.close();
} catch (IOException io) {
logger.error("Could not create the temp file: " + io.toString() + ".\n");
} catch (UnsatisfiedLinkError ule) {
logger.error("Couldn't load copied link file: " + ule.toString() + ".\n");
throw ule;
}
} | java | private void loadLibraryFromStream(String libname, InputStream is) {
try {
File tempfile = createTempFile(libname);
OutputStream os = new FileOutputStream(tempfile);
logger.debug("tempfile.getPath() = " + tempfile.getPath());
long savedTime = System.currentTimeMillis();
// Leo says 8k block size is STANDARD ;)
byte buf[] = new byte[8192];
int len;
while ((len = is.read(buf)) > 0) {
os.write(buf, 0, len);
}
os.flush();
InputStream lock = new FileInputStream(tempfile);
os.close();
double seconds = (double) (System.currentTimeMillis() - savedTime) / 1e3;
logger.debug("Copying took " + seconds + " seconds.");
logger.debug("Loading library from " + tempfile.getPath() + ".");
System.load(tempfile.getPath());
lock.close();
} catch (IOException io) {
logger.error("Could not create the temp file: " + io.toString() + ".\n");
} catch (UnsatisfiedLinkError ule) {
logger.error("Couldn't load copied link file: " + ule.toString() + ".\n");
throw ule;
}
} | [
"private",
"void",
"loadLibraryFromStream",
"(",
"String",
"libname",
",",
"InputStream",
"is",
")",
"{",
"try",
"{",
"File",
"tempfile",
"=",
"createTempFile",
"(",
"libname",
")",
";",
"OutputStream",
"os",
"=",
"new",
"FileOutputStream",
"(",
"tempfile",
")... | Load a system library from a stream. Copies the library to a temp file
and loads from there.
@param libname name of the library (just used in constructing the library name)
@param is InputStream pointing to the library | [
"Load",
"a",
"system",
"library",
"from",
"a",
"stream",
".",
"Copies",
"the",
"library",
"to",
"a",
"temp",
"file",
"and",
"loads",
"from",
"there",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/LibraryLoader.java#L249-L282 | train |
jblas-project/jblas | src/main/java/org/jblas/util/SanityChecks.java | SanityChecks.checkVectorAddition | public static void checkVectorAddition() {
DoubleMatrix x = new DoubleMatrix(3, 1, 1.0, 2.0, 3.0);
DoubleMatrix y = new DoubleMatrix(3, 1, 4.0, 5.0, 6.0);
DoubleMatrix z = new DoubleMatrix(3, 1, 5.0, 7.0, 9.0);
check("checking vector addition", x.add(y).equals(z));
} | java | public static void checkVectorAddition() {
DoubleMatrix x = new DoubleMatrix(3, 1, 1.0, 2.0, 3.0);
DoubleMatrix y = new DoubleMatrix(3, 1, 4.0, 5.0, 6.0);
DoubleMatrix z = new DoubleMatrix(3, 1, 5.0, 7.0, 9.0);
check("checking vector addition", x.add(y).equals(z));
} | [
"public",
"static",
"void",
"checkVectorAddition",
"(",
")",
"{",
"DoubleMatrix",
"x",
"=",
"new",
"DoubleMatrix",
"(",
"3",
",",
"1",
",",
"1.0",
",",
"2.0",
",",
"3.0",
")",
";",
"DoubleMatrix",
"y",
"=",
"new",
"DoubleMatrix",
"(",
"3",
",",
"1",
... | Check whether vector addition works. This is pure Java code and should work. | [
"Check",
"whether",
"vector",
"addition",
"works",
".",
"This",
"is",
"pure",
"Java",
"code",
"and",
"should",
"work",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/SanityChecks.java#L64-L70 | train |
jblas-project/jblas | src/main/java/org/jblas/util/SanityChecks.java | SanityChecks.checkXerbla | public static void checkXerbla() {
double[] x = new double[9];
System.out.println("Check whether we're catching XERBLA errors. If you see something like \"** On entry to DGEMM parameter number 4 had an illegal value\", it didn't work!");
try {
NativeBlas.dgemm('N', 'N', 3, -1, 3, 1.0, x, 0, 3, x, 0, 3, 0.0, x, 0, 3);
} catch (IllegalArgumentException e) {
check("checking XERBLA", e.getMessage().contains("XERBLA"));
return;
}
assert (false); // shouldn't happen
} | java | public static void checkXerbla() {
double[] x = new double[9];
System.out.println("Check whether we're catching XERBLA errors. If you see something like \"** On entry to DGEMM parameter number 4 had an illegal value\", it didn't work!");
try {
NativeBlas.dgemm('N', 'N', 3, -1, 3, 1.0, x, 0, 3, x, 0, 3, 0.0, x, 0, 3);
} catch (IllegalArgumentException e) {
check("checking XERBLA", e.getMessage().contains("XERBLA"));
return;
}
assert (false); // shouldn't happen
} | [
"public",
"static",
"void",
"checkXerbla",
"(",
")",
"{",
"double",
"[",
"]",
"x",
"=",
"new",
"double",
"[",
"9",
"]",
";",
"System",
".",
"out",
".",
"println",
"(",
"\"Check whether we're catching XERBLA errors. If you see something like \\\"** On entry to DGEMM p... | Check whether error handling works. If it works, you should see an
ok, otherwise, you might see the actual error message and then
the program exits. | [
"Check",
"whether",
"error",
"handling",
"works",
".",
"If",
"it",
"works",
"you",
"should",
"see",
"an",
"ok",
"otherwise",
"you",
"might",
"see",
"the",
"actual",
"error",
"message",
"and",
"then",
"the",
"program",
"exits",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/SanityChecks.java#L99-L109 | train |
jblas-project/jblas | src/main/java/org/jblas/util/SanityChecks.java | SanityChecks.checkEigenvalues | public static void checkEigenvalues() {
DoubleMatrix A = new DoubleMatrix(new double[][]{
{3.0, 2.0, 0.0},
{2.0, 3.0, 2.0},
{0.0, 2.0, 3.0}
});
DoubleMatrix E = new DoubleMatrix(3, 1);
NativeBlas.dsyev('N', 'U', 3, A.data, 0, 3, E.data, 0);
check("checking existence of dsyev...", true);
} | java | public static void checkEigenvalues() {
DoubleMatrix A = new DoubleMatrix(new double[][]{
{3.0, 2.0, 0.0},
{2.0, 3.0, 2.0},
{0.0, 2.0, 3.0}
});
DoubleMatrix E = new DoubleMatrix(3, 1);
NativeBlas.dsyev('N', 'U', 3, A.data, 0, 3, E.data, 0);
check("checking existence of dsyev...", true);
} | [
"public",
"static",
"void",
"checkEigenvalues",
"(",
")",
"{",
"DoubleMatrix",
"A",
"=",
"new",
"DoubleMatrix",
"(",
"new",
"double",
"[",
"]",
"[",
"]",
"{",
"{",
"3.0",
",",
"2.0",
",",
"0.0",
"}",
",",
"{",
"2.0",
",",
"3.0",
",",
"2.0",
"}",
... | Compute eigenvalues. This is a routine not in ATLAS, but in the original
LAPACK. | [
"Compute",
"eigenvalues",
".",
"This",
"is",
"a",
"routine",
"not",
"in",
"ATLAS",
"but",
"in",
"the",
"original",
"LAPACK",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/util/SanityChecks.java#L115-L126 | train |
jblas-project/jblas | src/main/java/org/jblas/Decompose.java | Decompose.cholesky | public static DoubleMatrix cholesky(DoubleMatrix A) {
DoubleMatrix result = A.dup();
int info = NativeBlas.dpotrf('U', A.rows, result.data, 0, A.rows);
if (info < 0) {
throw new LapackArgumentException("DPOTRF", -info);
} else if (info > 0) {
throw new LapackPositivityException("DPOTRF", "Minor " + info + " was negative. Matrix must be positive definite.");
}
clearLower(result);
return result;
} | java | public static DoubleMatrix cholesky(DoubleMatrix A) {
DoubleMatrix result = A.dup();
int info = NativeBlas.dpotrf('U', A.rows, result.data, 0, A.rows);
if (info < 0) {
throw new LapackArgumentException("DPOTRF", -info);
} else if (info > 0) {
throw new LapackPositivityException("DPOTRF", "Minor " + info + " was negative. Matrix must be positive definite.");
}
clearLower(result);
return result;
} | [
"public",
"static",
"DoubleMatrix",
"cholesky",
"(",
"DoubleMatrix",
"A",
")",
"{",
"DoubleMatrix",
"result",
"=",
"A",
".",
"dup",
"(",
")",
";",
"int",
"info",
"=",
"NativeBlas",
".",
"dpotrf",
"(",
"'",
"'",
",",
"A",
".",
"rows",
",",
"result",
"... | Compute Cholesky decomposition of A
@param A symmetric, positive definite matrix (only upper half is used)
@return upper triangular matrix U such that A = U' * U | [
"Compute",
"Cholesky",
"decomposition",
"of",
"A"
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Decompose.java#L149-L159 | train |
jblas-project/jblas | src/main/java/org/jblas/Decompose.java | Decompose.qr | public static QRDecomposition<DoubleMatrix> qr(DoubleMatrix A) {
int minmn = min(A.rows, A.columns);
DoubleMatrix result = A.dup();
DoubleMatrix tau = new DoubleMatrix(minmn);
SimpleBlas.geqrf(result, tau);
DoubleMatrix R = new DoubleMatrix(A.rows, A.columns);
for (int i = 0; i < A.rows; i++) {
for (int j = i; j < A.columns; j++) {
R.put(i, j, result.get(i, j));
}
}
DoubleMatrix Q = DoubleMatrix.eye(A.rows);
SimpleBlas.ormqr('L', 'N', result, tau, Q);
return new QRDecomposition<DoubleMatrix>(Q, R);
} | java | public static QRDecomposition<DoubleMatrix> qr(DoubleMatrix A) {
int minmn = min(A.rows, A.columns);
DoubleMatrix result = A.dup();
DoubleMatrix tau = new DoubleMatrix(minmn);
SimpleBlas.geqrf(result, tau);
DoubleMatrix R = new DoubleMatrix(A.rows, A.columns);
for (int i = 0; i < A.rows; i++) {
for (int j = i; j < A.columns; j++) {
R.put(i, j, result.get(i, j));
}
}
DoubleMatrix Q = DoubleMatrix.eye(A.rows);
SimpleBlas.ormqr('L', 'N', result, tau, Q);
return new QRDecomposition<DoubleMatrix>(Q, R);
} | [
"public",
"static",
"QRDecomposition",
"<",
"DoubleMatrix",
">",
"qr",
"(",
"DoubleMatrix",
"A",
")",
"{",
"int",
"minmn",
"=",
"min",
"(",
"A",
".",
"rows",
",",
"A",
".",
"columns",
")",
";",
"DoubleMatrix",
"result",
"=",
"A",
".",
"dup",
"(",
")"... | QR decomposition.
Decomposes (m,n) matrix A into a (m,m) matrix Q and an (m,n) matrix R such that
Q is orthogonal, R is upper triangular and Q * R = A
Note that if A has more rows than columns, then the lower rows of R will contain
only zeros, such that the corresponding later columns of Q do not enter the computation
at all. For some reason, LAPACK does not properly normalize those columns.
@param A matrix
@return QR decomposition | [
"QR",
"decomposition",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/Decompose.java#L200-L214 | train |
jblas-project/jblas | src/main/java/org/jblas/MatrixFunctions.java | MatrixFunctions.absi | public static DoubleMatrix absi(DoubleMatrix x) {
/*# mapfct('Math.abs') #*/
//RJPP-BEGIN------------------------------------------------------------
for (int i = 0; i < x.length; i++)
x.put(i, (double) Math.abs(x.get(i)));
return x;
//RJPP-END--------------------------------------------------------------
} | java | public static DoubleMatrix absi(DoubleMatrix x) {
/*# mapfct('Math.abs') #*/
//RJPP-BEGIN------------------------------------------------------------
for (int i = 0; i < x.length; i++)
x.put(i, (double) Math.abs(x.get(i)));
return x;
//RJPP-END--------------------------------------------------------------
} | [
"public",
"static",
"DoubleMatrix",
"absi",
"(",
"DoubleMatrix",
"x",
")",
"{",
"/*# mapfct('Math.abs') #*/",
"//RJPP-BEGIN------------------------------------------------------------",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"x",
".",
"length",
";",
"i",
"... | Sets all elements in this matrix to their absolute values. Note
that this operation is in-place.
@see MatrixFunctions#abs(DoubleMatrix)
@return this matrix | [
"Sets",
"all",
"elements",
"in",
"this",
"matrix",
"to",
"their",
"absolute",
"values",
".",
"Note",
"that",
"this",
"operation",
"is",
"in",
"-",
"place",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/MatrixFunctions.java#L69-L76 | train |
jblas-project/jblas | src/main/java/org/jblas/MatrixFunctions.java | MatrixFunctions.expm | public static DoubleMatrix expm(DoubleMatrix A) {
// constants for pade approximation
final double c0 = 1.0;
final double c1 = 0.5;
final double c2 = 0.12;
final double c3 = 0.01833333333333333;
final double c4 = 0.0019927536231884053;
final double c5 = 1.630434782608695E-4;
final double c6 = 1.0351966873706E-5;
final double c7 = 5.175983436853E-7;
final double c8 = 2.0431513566525E-8;
final double c9 = 6.306022705717593E-10;
final double c10 = 1.4837700484041396E-11;
final double c11 = 2.5291534915979653E-13;
final double c12 = 2.8101705462199615E-15;
final double c13 = 1.5440497506703084E-17;
int j = Math.max(0, 1 + (int) Math.floor(Math.log(A.normmax()) / Math.log(2)));
DoubleMatrix As = A.div((double) Math.pow(2, j)); // scaled version of A
int n = A.getRows();
// calculate D and N using special Horner techniques
DoubleMatrix As_2 = As.mmul(As);
DoubleMatrix As_4 = As_2.mmul(As_2);
DoubleMatrix As_6 = As_4.mmul(As_2);
// U = c0*I + c2*A^2 + c4*A^4 + (c6*I + c8*A^2 + c10*A^4 + c12*A^6)*A^6
DoubleMatrix U = DoubleMatrix.eye(n).muli(c0).addi(As_2.mul(c2)).addi(As_4.mul(c4)).addi(
DoubleMatrix.eye(n).muli(c6).addi(As_2.mul(c8)).addi(As_4.mul(c10)).addi(As_6.mul(c12)).mmuli(As_6));
// V = c1*I + c3*A^2 + c5*A^4 + (c7*I + c9*A^2 + c11*A^4 + c13*A^6)*A^6
DoubleMatrix V = DoubleMatrix.eye(n).muli(c1).addi(As_2.mul(c3)).addi(As_4.mul(c5)).addi(
DoubleMatrix.eye(n).muli(c7).addi(As_2.mul(c9)).addi(As_4.mul(c11)).addi(As_6.mul(c13)).mmuli(As_6));
DoubleMatrix AV = As.mmuli(V);
DoubleMatrix N = U.add(AV);
DoubleMatrix D = U.subi(AV);
// solve DF = N for F
DoubleMatrix F = Solve.solve(D, N);
// now square j times
for (int k = 0; k < j; k++) {
F.mmuli(F);
}
return F;
} | java | public static DoubleMatrix expm(DoubleMatrix A) {
// constants for pade approximation
final double c0 = 1.0;
final double c1 = 0.5;
final double c2 = 0.12;
final double c3 = 0.01833333333333333;
final double c4 = 0.0019927536231884053;
final double c5 = 1.630434782608695E-4;
final double c6 = 1.0351966873706E-5;
final double c7 = 5.175983436853E-7;
final double c8 = 2.0431513566525E-8;
final double c9 = 6.306022705717593E-10;
final double c10 = 1.4837700484041396E-11;
final double c11 = 2.5291534915979653E-13;
final double c12 = 2.8101705462199615E-15;
final double c13 = 1.5440497506703084E-17;
int j = Math.max(0, 1 + (int) Math.floor(Math.log(A.normmax()) / Math.log(2)));
DoubleMatrix As = A.div((double) Math.pow(2, j)); // scaled version of A
int n = A.getRows();
// calculate D and N using special Horner techniques
DoubleMatrix As_2 = As.mmul(As);
DoubleMatrix As_4 = As_2.mmul(As_2);
DoubleMatrix As_6 = As_4.mmul(As_2);
// U = c0*I + c2*A^2 + c4*A^4 + (c6*I + c8*A^2 + c10*A^4 + c12*A^6)*A^6
DoubleMatrix U = DoubleMatrix.eye(n).muli(c0).addi(As_2.mul(c2)).addi(As_4.mul(c4)).addi(
DoubleMatrix.eye(n).muli(c6).addi(As_2.mul(c8)).addi(As_4.mul(c10)).addi(As_6.mul(c12)).mmuli(As_6));
// V = c1*I + c3*A^2 + c5*A^4 + (c7*I + c9*A^2 + c11*A^4 + c13*A^6)*A^6
DoubleMatrix V = DoubleMatrix.eye(n).muli(c1).addi(As_2.mul(c3)).addi(As_4.mul(c5)).addi(
DoubleMatrix.eye(n).muli(c7).addi(As_2.mul(c9)).addi(As_4.mul(c11)).addi(As_6.mul(c13)).mmuli(As_6));
DoubleMatrix AV = As.mmuli(V);
DoubleMatrix N = U.add(AV);
DoubleMatrix D = U.subi(AV);
// solve DF = N for F
DoubleMatrix F = Solve.solve(D, N);
// now square j times
for (int k = 0; k < j; k++) {
F.mmuli(F);
}
return F;
} | [
"public",
"static",
"DoubleMatrix",
"expm",
"(",
"DoubleMatrix",
"A",
")",
"{",
"// constants for pade approximation",
"final",
"double",
"c0",
"=",
"1.0",
";",
"final",
"double",
"c1",
"=",
"0.5",
";",
"final",
"double",
"c2",
"=",
"0.12",
";",
"final",
"do... | Calculate matrix exponential of a square matrix.
A scaled Pade approximation algorithm is used.
The algorithm has been directly translated from Golub & Van Loan "Matrix Computations",
algorithm 11.3.1. Special Horner techniques from 11.2 are also used to minimize the number
of matrix multiplications.
@param A square matrix
@return matrix exponential of A | [
"Calculate",
"matrix",
"exponential",
"of",
"a",
"square",
"matrix",
"."
] | 2818f231228e655cda80dfd8e0b87709fdfd8a70 | https://github.com/jblas-project/jblas/blob/2818f231228e655cda80dfd8e0b87709fdfd8a70/src/main/java/org/jblas/MatrixFunctions.java#L406-L451 | train |
wdtinc/mapbox-vector-tile-java | src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java | JtsAdapter.toGeomType | public static VectorTile.Tile.GeomType toGeomType(Geometry geometry) {
VectorTile.Tile.GeomType result = VectorTile.Tile.GeomType.UNKNOWN;
if(geometry instanceof Point
|| geometry instanceof MultiPoint) {
result = VectorTile.Tile.GeomType.POINT;
} else if(geometry instanceof LineString
|| geometry instanceof MultiLineString) {
result = VectorTile.Tile.GeomType.LINESTRING;
} else if(geometry instanceof Polygon
|| geometry instanceof MultiPolygon) {
result = VectorTile.Tile.GeomType.POLYGON;
}
return result;
} | java | public static VectorTile.Tile.GeomType toGeomType(Geometry geometry) {
VectorTile.Tile.GeomType result = VectorTile.Tile.GeomType.UNKNOWN;
if(geometry instanceof Point
|| geometry instanceof MultiPoint) {
result = VectorTile.Tile.GeomType.POINT;
} else if(geometry instanceof LineString
|| geometry instanceof MultiLineString) {
result = VectorTile.Tile.GeomType.LINESTRING;
} else if(geometry instanceof Polygon
|| geometry instanceof MultiPolygon) {
result = VectorTile.Tile.GeomType.POLYGON;
}
return result;
} | [
"public",
"static",
"VectorTile",
".",
"Tile",
".",
"GeomType",
"toGeomType",
"(",
"Geometry",
"geometry",
")",
"{",
"VectorTile",
".",
"Tile",
".",
"GeomType",
"result",
"=",
"VectorTile",
".",
"Tile",
".",
"GeomType",
".",
"UNKNOWN",
";",
"if",
"(",
"geo... | Get the MVT type mapping for the provided JTS Geometry.
@param geometry JTS Geometry to get MVT type for
@return MVT type for the given JTS Geometry, may return
{@link com.wdtinc.mapbox_vector_tile.VectorTile.Tile.GeomType#UNKNOWN} | [
"Get",
"the",
"MVT",
"type",
"mapping",
"for",
"the",
"provided",
"JTS",
"Geometry",
"."
] | e5e3df3fc2260709e289f972a1348c0a1ea30339 | https://github.com/wdtinc/mapbox-vector-tile-java/blob/e5e3df3fc2260709e289f972a1348c0a1ea30339/src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java#L184-L201 | train |
wdtinc/mapbox-vector-tile-java | src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java | JtsAdapter.equalAsInts | private static boolean equalAsInts(Vec2d a, Vec2d b) {
return ((int) a.x) == ((int) b.x) && ((int) a.y) == ((int) b.y);
} | java | private static boolean equalAsInts(Vec2d a, Vec2d b) {
return ((int) a.x) == ((int) b.x) && ((int) a.y) == ((int) b.y);
} | [
"private",
"static",
"boolean",
"equalAsInts",
"(",
"Vec2d",
"a",
",",
"Vec2d",
"b",
")",
"{",
"return",
"(",
"(",
"int",
")",
"a",
".",
"x",
")",
"==",
"(",
"(",
"int",
")",
"b",
".",
"x",
")",
"&&",
"(",
"(",
"int",
")",
"a",
".",
"y",
")... | Return true if the values of the two vectors are equal when cast as ints.
@param a first vector to compare
@param b second vector to compare
@return true if the values of the two vectors are equal when cast as ints | [
"Return",
"true",
"if",
"the",
"values",
"of",
"the",
"two",
"vectors",
"are",
"equal",
"when",
"cast",
"as",
"ints",
"."
] | e5e3df3fc2260709e289f972a1348c0a1ea30339 | https://github.com/wdtinc/mapbox-vector-tile-java/blob/e5e3df3fc2260709e289f972a1348c0a1ea30339/src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/JtsAdapter.java#L630-L632 | train |
wdtinc/mapbox-vector-tile-java | src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/model/JtsLayer.java | JtsLayer.validate | private static void validate(String name, Collection<Geometry> geometries, int extent) {
if (name == null) {
throw new IllegalArgumentException("layer name is null");
}
if (geometries == null) {
throw new IllegalArgumentException("geometry collection is null");
}
if (extent <= 0) {
throw new IllegalArgumentException("extent is less than or equal to 0");
}
} | java | private static void validate(String name, Collection<Geometry> geometries, int extent) {
if (name == null) {
throw new IllegalArgumentException("layer name is null");
}
if (geometries == null) {
throw new IllegalArgumentException("geometry collection is null");
}
if (extent <= 0) {
throw new IllegalArgumentException("extent is less than or equal to 0");
}
} | [
"private",
"static",
"void",
"validate",
"(",
"String",
"name",
",",
"Collection",
"<",
"Geometry",
">",
"geometries",
",",
"int",
"extent",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"layer name i... | Validate the JtsLayer.
@param name mvt layer name
@param geometries geometries in the tile
@throws IllegalArgumentException when {@code name} or {@code geometries} are null | [
"Validate",
"the",
"JtsLayer",
"."
] | e5e3df3fc2260709e289f972a1348c0a1ea30339 | https://github.com/wdtinc/mapbox-vector-tile-java/blob/e5e3df3fc2260709e289f972a1348c0a1ea30339/src/main/java/com/wdtinc/mapbox_vector_tile/adapt/jts/model/JtsLayer.java#L121-L131 | train |
wdtinc/mapbox-vector-tile-java | src/main/java/com/wdtinc/mapbox_vector_tile/build/MvtLayerProps.java | MvtLayerProps.addKey | public int addKey(String key) {
JdkUtils.requireNonNull(key);
int nextIndex = keys.size();
final Integer mapIndex = JdkUtils.putIfAbsent(keys, key, nextIndex);
return mapIndex == null ? nextIndex : mapIndex;
} | java | public int addKey(String key) {
JdkUtils.requireNonNull(key);
int nextIndex = keys.size();
final Integer mapIndex = JdkUtils.putIfAbsent(keys, key, nextIndex);
return mapIndex == null ? nextIndex : mapIndex;
} | [
"public",
"int",
"addKey",
"(",
"String",
"key",
")",
"{",
"JdkUtils",
".",
"requireNonNull",
"(",
"key",
")",
";",
"int",
"nextIndex",
"=",
"keys",
".",
"size",
"(",
")",
";",
"final",
"Integer",
"mapIndex",
"=",
"JdkUtils",
".",
"putIfAbsent",
"(",
"... | Add the key and return it's index code. If the key already is present, the previous
index code is returned and no insertion is done.
@param key key to add
@return index of the key | [
"Add",
"the",
"key",
"and",
"return",
"it",
"s",
"index",
"code",
".",
"If",
"the",
"key",
"already",
"is",
"present",
"the",
"previous",
"index",
"code",
"is",
"returned",
"and",
"no",
"insertion",
"is",
"done",
"."
] | e5e3df3fc2260709e289f972a1348c0a1ea30339 | https://github.com/wdtinc/mapbox-vector-tile-java/blob/e5e3df3fc2260709e289f972a1348c0a1ea30339/src/main/java/com/wdtinc/mapbox_vector_tile/build/MvtLayerProps.java#L35-L40 | train |
liuguangqiang/SwipeBack | library/src/main/java/com/liuguangqiang/swipeback/SwipeBackLayout.java | SwipeBackLayout.findScrollView | private void findScrollView(ViewGroup viewGroup) {
scrollChild = viewGroup;
if (viewGroup.getChildCount() > 0) {
int count = viewGroup.getChildCount();
View child;
for (int i = 0; i < count; i++) {
child = viewGroup.getChildAt(i);
if (child instanceof AbsListView || child instanceof ScrollView || child instanceof ViewPager || child instanceof WebView) {
scrollChild = child;
return;
}
}
}
} | java | private void findScrollView(ViewGroup viewGroup) {
scrollChild = viewGroup;
if (viewGroup.getChildCount() > 0) {
int count = viewGroup.getChildCount();
View child;
for (int i = 0; i < count; i++) {
child = viewGroup.getChildAt(i);
if (child instanceof AbsListView || child instanceof ScrollView || child instanceof ViewPager || child instanceof WebView) {
scrollChild = child;
return;
}
}
}
} | [
"private",
"void",
"findScrollView",
"(",
"ViewGroup",
"viewGroup",
")",
"{",
"scrollChild",
"=",
"viewGroup",
";",
"if",
"(",
"viewGroup",
".",
"getChildCount",
"(",
")",
">",
"0",
")",
"{",
"int",
"count",
"=",
"viewGroup",
".",
"getChildCount",
"(",
")"... | Find out the scrollable child view from a ViewGroup.
@param viewGroup | [
"Find",
"out",
"the",
"scrollable",
"child",
"view",
"from",
"a",
"ViewGroup",
"."
] | 0dd68189c58a5b2ead6bd5fe97c2a29cb43639f6 | https://github.com/liuguangqiang/SwipeBack/blob/0dd68189c58a5b2ead6bd5fe97c2a29cb43639f6/library/src/main/java/com/liuguangqiang/swipeback/SwipeBackLayout.java#L227-L240 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/sessions/CmsSendBroadcastDialog.java | CmsSendBroadcastDialog.removeAllBroadcasts | private void removeAllBroadcasts(Set<String> sessionIds) {
if (sessionIds == null) {
for (CmsSessionInfo info : OpenCms.getSessionManager().getSessionInfos()) {
OpenCms.getSessionManager().getBroadcastQueue(info.getSessionId().getStringValue()).clear();
}
return;
}
for (String sessionId : sessionIds) {
OpenCms.getSessionManager().getBroadcastQueue(sessionId).clear();
}
} | java | private void removeAllBroadcasts(Set<String> sessionIds) {
if (sessionIds == null) {
for (CmsSessionInfo info : OpenCms.getSessionManager().getSessionInfos()) {
OpenCms.getSessionManager().getBroadcastQueue(info.getSessionId().getStringValue()).clear();
}
return;
}
for (String sessionId : sessionIds) {
OpenCms.getSessionManager().getBroadcastQueue(sessionId).clear();
}
} | [
"private",
"void",
"removeAllBroadcasts",
"(",
"Set",
"<",
"String",
">",
"sessionIds",
")",
"{",
"if",
"(",
"sessionIds",
"==",
"null",
")",
"{",
"for",
"(",
"CmsSessionInfo",
"info",
":",
"OpenCms",
".",
"getSessionManager",
"(",
")",
".",
"getSessionInfos... | Removes all pending broadcasts
@param sessionIds to remove broadcast for (or null for all sessions) | [
"Removes",
"all",
"pending",
"broadcasts"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/sessions/CmsSendBroadcastDialog.java#L169-L180 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyView.java | CmsPatternPanelMonthlyView.onWeekDayChange | @UiHandler("m_atDay")
void onWeekDayChange(ValueChangeEvent<String> event) {
if (handleChange()) {
m_controller.setWeekDay(event.getValue());
}
} | java | @UiHandler("m_atDay")
void onWeekDayChange(ValueChangeEvent<String> event) {
if (handleChange()) {
m_controller.setWeekDay(event.getValue());
}
} | [
"@",
"UiHandler",
"(",
"\"m_atDay\"",
")",
"void",
"onWeekDayChange",
"(",
"ValueChangeEvent",
"<",
"String",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setWeekDay",
"(",
"event",
".",
"getValue",
"(",
")",... | Handles week day changes.
@param event the change event. | [
"Handles",
"week",
"day",
"changes",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyView.java#L282-L288 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyView.java | CmsPatternPanelMonthlyView.addCheckBox | private void addCheckBox(final String internalValue, String labelMessageKey) {
CmsCheckBox box = new CmsCheckBox(Messages.get().key(labelMessageKey));
box.setInternalValue(internalValue);
box.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
public void onValueChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.weeksChange(internalValue, event.getValue());
}
}
});
m_weekPanel.add(box);
m_checkboxes.add(box);
} | java | private void addCheckBox(final String internalValue, String labelMessageKey) {
CmsCheckBox box = new CmsCheckBox(Messages.get().key(labelMessageKey));
box.setInternalValue(internalValue);
box.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
public void onValueChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.weeksChange(internalValue, event.getValue());
}
}
});
m_weekPanel.add(box);
m_checkboxes.add(box);
} | [
"private",
"void",
"addCheckBox",
"(",
"final",
"String",
"internalValue",
",",
"String",
"labelMessageKey",
")",
"{",
"CmsCheckBox",
"box",
"=",
"new",
"CmsCheckBox",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"labelMessageKey",
")",
")",
";",
... | Creates a check box and adds it to the week panel and the checkboxes.
@param internalValue the internal value of the checkbox
@param labelMessageKey key for the label of the checkbox | [
"Creates",
"a",
"check",
"box",
"and",
"adds",
"it",
"to",
"the",
"week",
"panel",
"and",
"the",
"checkboxes",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyView.java#L295-L311 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyView.java | CmsPatternPanelMonthlyView.checkExactlyTheWeeksCheckBoxes | private void checkExactlyTheWeeksCheckBoxes(Collection<WeekOfMonth> weeksToCheck) {
for (CmsCheckBox cb : m_checkboxes) {
cb.setChecked(weeksToCheck.contains(WeekOfMonth.valueOf(cb.getInternalValue())));
}
} | java | private void checkExactlyTheWeeksCheckBoxes(Collection<WeekOfMonth> weeksToCheck) {
for (CmsCheckBox cb : m_checkboxes) {
cb.setChecked(weeksToCheck.contains(WeekOfMonth.valueOf(cb.getInternalValue())));
}
} | [
"private",
"void",
"checkExactlyTheWeeksCheckBoxes",
"(",
"Collection",
"<",
"WeekOfMonth",
">",
"weeksToCheck",
")",
"{",
"for",
"(",
"CmsCheckBox",
"cb",
":",
"m_checkboxes",
")",
"{",
"cb",
".",
"setChecked",
"(",
"weeksToCheck",
".",
"contains",
"(",
"WeekOf... | Check exactly the week check-boxes representing the given weeks.
@param weeksToCheck the weeks selected. | [
"Check",
"exactly",
"the",
"week",
"check",
"-",
"boxes",
"representing",
"the",
"given",
"weeks",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyView.java#L317-L322 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyView.java | CmsPatternPanelMonthlyView.fillWeekPanel | private void fillWeekPanel() {
addCheckBox(WeekOfMonth.FIRST.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_1_0);
addCheckBox(WeekOfMonth.SECOND.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_2_0);
addCheckBox(WeekOfMonth.THIRD.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_3_0);
addCheckBox(WeekOfMonth.FOURTH.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_4_0);
addCheckBox(WeekOfMonth.LAST.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_5_0);
} | java | private void fillWeekPanel() {
addCheckBox(WeekOfMonth.FIRST.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_1_0);
addCheckBox(WeekOfMonth.SECOND.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_2_0);
addCheckBox(WeekOfMonth.THIRD.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_3_0);
addCheckBox(WeekOfMonth.FOURTH.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_4_0);
addCheckBox(WeekOfMonth.LAST.toString(), Messages.GUI_SERIALDATE_WEEKDAYNUMBER_5_0);
} | [
"private",
"void",
"fillWeekPanel",
"(",
")",
"{",
"addCheckBox",
"(",
"WeekOfMonth",
".",
"FIRST",
".",
"toString",
"(",
")",
",",
"Messages",
".",
"GUI_SERIALDATE_WEEKDAYNUMBER_1_0",
")",
";",
"addCheckBox",
"(",
"WeekOfMonth",
".",
"SECOND",
".",
"toString",
... | Fills the week panel with checkboxes. | [
"Fills",
"the",
"week",
"panel",
"with",
"checkboxes",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsPatternPanelMonthlyView.java#L327-L334 | train |
alkacon/opencms-core | src-setup/org/opencms/setup/ui/A_CmsSetupStep.java | A_CmsSetupStep.htmlLabel | public Label htmlLabel(String html) {
Label label = new Label();
label.setContentMode(ContentMode.HTML);
label.setValue(html);
return label;
} | java | public Label htmlLabel(String html) {
Label label = new Label();
label.setContentMode(ContentMode.HTML);
label.setValue(html);
return label;
} | [
"public",
"Label",
"htmlLabel",
"(",
"String",
"html",
")",
"{",
"Label",
"label",
"=",
"new",
"Label",
"(",
")",
";",
"label",
".",
"setContentMode",
"(",
"ContentMode",
".",
"HTML",
")",
";",
"label",
".",
"setValue",
"(",
"html",
")",
";",
"return",... | Creates a new HTML-formatted label with the given content.
@param html the label content | [
"Creates",
"a",
"new",
"HTML",
"-",
"formatted",
"label",
"with",
"the",
"given",
"content",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/A_CmsSetupStep.java#L80-L87 | train |
alkacon/opencms-core | src-setup/org/opencms/setup/ui/A_CmsSetupStep.java | A_CmsSetupStep.readSnippet | public String readSnippet(String name) {
String path = CmsStringUtil.joinPaths(
m_context.getSetupBean().getWebAppRfsPath(),
CmsSetupBean.FOLDER_SETUP,
"html",
name);
try (InputStream stream = new FileInputStream(path)) {
byte[] data = CmsFileUtil.readFully(stream, false);
String result = new String(data, "UTF-8");
return result;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | java | public String readSnippet(String name) {
String path = CmsStringUtil.joinPaths(
m_context.getSetupBean().getWebAppRfsPath(),
CmsSetupBean.FOLDER_SETUP,
"html",
name);
try (InputStream stream = new FileInputStream(path)) {
byte[] data = CmsFileUtil.readFully(stream, false);
String result = new String(data, "UTF-8");
return result;
} catch (Exception e) {
throw new RuntimeException(e);
}
} | [
"public",
"String",
"readSnippet",
"(",
"String",
"name",
")",
"{",
"String",
"path",
"=",
"CmsStringUtil",
".",
"joinPaths",
"(",
"m_context",
".",
"getSetupBean",
"(",
")",
".",
"getWebAppRfsPath",
"(",
")",
",",
"CmsSetupBean",
".",
"FOLDER_SETUP",
",",
"... | Reads an HTML snippet with the given name.
@return the HTML data | [
"Reads",
"an",
"HTML",
"snippet",
"with",
"the",
"given",
"name",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/ui/A_CmsSetupStep.java#L94-L108 | train |
alkacon/opencms-core | src/org/opencms/widgets/CmsAddFormatterWidget.java | CmsAddFormatterWidget.getSelectOptionValues | public static List<String> getSelectOptionValues(CmsObject cms, String rootPath, boolean allRemoved) {
try {
cms = OpenCms.initCmsObject(cms);
cms.getRequestContext().setSiteRoot("");
CmsADEConfigData adeConfig = OpenCms.getADEManager().lookupConfiguration(cms, rootPath);
if (adeConfig.parent() != null) {
adeConfig = adeConfig.parent();
}
List<CmsSelectWidgetOption> options = getFormatterOptionsStatic(cms, adeConfig, rootPath, allRemoved);
List<CmsSelectWidgetOption> typeOptions = getTypeOptionsStatic(cms, adeConfig, allRemoved);
options.addAll(typeOptions);
List<String> result = new ArrayList<String>(options.size());
for (CmsSelectWidgetOption o : options) {
result.add(o.getValue());
}
return result;
} catch (CmsException e) {
// should never happen
LOG.error(e.getLocalizedMessage(), e);
return null;
}
} | java | public static List<String> getSelectOptionValues(CmsObject cms, String rootPath, boolean allRemoved) {
try {
cms = OpenCms.initCmsObject(cms);
cms.getRequestContext().setSiteRoot("");
CmsADEConfigData adeConfig = OpenCms.getADEManager().lookupConfiguration(cms, rootPath);
if (adeConfig.parent() != null) {
adeConfig = adeConfig.parent();
}
List<CmsSelectWidgetOption> options = getFormatterOptionsStatic(cms, adeConfig, rootPath, allRemoved);
List<CmsSelectWidgetOption> typeOptions = getTypeOptionsStatic(cms, adeConfig, allRemoved);
options.addAll(typeOptions);
List<String> result = new ArrayList<String>(options.size());
for (CmsSelectWidgetOption o : options) {
result.add(o.getValue());
}
return result;
} catch (CmsException e) {
// should never happen
LOG.error(e.getLocalizedMessage(), e);
return null;
}
} | [
"public",
"static",
"List",
"<",
"String",
">",
"getSelectOptionValues",
"(",
"CmsObject",
"cms",
",",
"String",
"rootPath",
",",
"boolean",
"allRemoved",
")",
"{",
"try",
"{",
"cms",
"=",
"OpenCms",
".",
"initCmsObject",
"(",
"cms",
")",
";",
"cms",
".",
... | Returns all values that can be selected in the widget.
@param cms the current CMS object
@param rootPath the root path to the currently edited xml file (sitemap config)
@param allRemoved flag, indicating if all inheritedly available formatters should be disabled
@return all values that can be selected in the widget. | [
"Returns",
"all",
"values",
"that",
"can",
"be",
"selected",
"in",
"the",
"widget",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/CmsAddFormatterWidget.java#L85-L109 | train |
alkacon/opencms-core | src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java | CmsEditableGroup.addRow | public void addRow(Component component) {
Component actualComponent = component == null ? m_newComponentFactory.get() : component;
I_CmsEditableGroupRow row = m_rowBuilder.buildRow(this, actualComponent);
m_container.addComponent(row);
updatePlaceholder();
updateButtonBars();
updateGroupValidation();
} | java | public void addRow(Component component) {
Component actualComponent = component == null ? m_newComponentFactory.get() : component;
I_CmsEditableGroupRow row = m_rowBuilder.buildRow(this, actualComponent);
m_container.addComponent(row);
updatePlaceholder();
updateButtonBars();
updateGroupValidation();
} | [
"public",
"void",
"addRow",
"(",
"Component",
"component",
")",
"{",
"Component",
"actualComponent",
"=",
"component",
"==",
"null",
"?",
"m_newComponentFactory",
".",
"get",
"(",
")",
":",
"component",
";",
"I_CmsEditableGroupRow",
"row",
"=",
"m_rowBuilder",
"... | Adds a row for the given component at the end of the group.
@param component the component to wrap in the row to be added | [
"Adds",
"a",
"row",
"for",
"the",
"given",
"component",
"at",
"the",
"end",
"of",
"the",
"group",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java#L251-L259 | train |
alkacon/opencms-core | src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java | CmsEditableGroup.addRowAfter | public void addRowAfter(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if (index >= 0) {
Component component = m_newComponentFactory.get();
I_CmsEditableGroupRow newRow = m_rowBuilder.buildRow(this, component);
m_container.addComponent(newRow, index + 1);
}
updatePlaceholder();
updateButtonBars();
updateGroupValidation();
} | java | public void addRowAfter(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if (index >= 0) {
Component component = m_newComponentFactory.get();
I_CmsEditableGroupRow newRow = m_rowBuilder.buildRow(this, component);
m_container.addComponent(newRow, index + 1);
}
updatePlaceholder();
updateButtonBars();
updateGroupValidation();
} | [
"public",
"void",
"addRowAfter",
"(",
"I_CmsEditableGroupRow",
"row",
")",
"{",
"int",
"index",
"=",
"m_container",
".",
"getComponentIndex",
"(",
"row",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"Component",
"component",
"=",
"m_newComponentFactory",... | Adds a new row after the given one.
@param row the row after which a new one should be added | [
"Adds",
"a",
"new",
"row",
"after",
"the",
"given",
"one",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java#L266-L277 | train |
alkacon/opencms-core | src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java | CmsEditableGroup.getRows | public List<I_CmsEditableGroupRow> getRows() {
List<I_CmsEditableGroupRow> result = Lists.newArrayList();
for (Component component : m_container) {
if (component instanceof I_CmsEditableGroupRow) {
result.add((I_CmsEditableGroupRow)component);
}
}
return result;
} | java | public List<I_CmsEditableGroupRow> getRows() {
List<I_CmsEditableGroupRow> result = Lists.newArrayList();
for (Component component : m_container) {
if (component instanceof I_CmsEditableGroupRow) {
result.add((I_CmsEditableGroupRow)component);
}
}
return result;
} | [
"public",
"List",
"<",
"I_CmsEditableGroupRow",
">",
"getRows",
"(",
")",
"{",
"List",
"<",
"I_CmsEditableGroupRow",
">",
"result",
"=",
"Lists",
".",
"newArrayList",
"(",
")",
";",
"for",
"(",
"Component",
"component",
":",
"m_container",
")",
"{",
"if",
... | Gets all rows.
@return the list of all rows | [
"Gets",
"all",
"rows",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java#L324-L333 | train |
alkacon/opencms-core | src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java | CmsEditableGroup.moveDown | public void moveDown(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if ((index >= 0) && (index < (m_container.getComponentCount() - 1))) {
m_container.removeComponent(row);
m_container.addComponent(row, index + 1);
}
updateButtonBars();
} | java | public void moveDown(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if ((index >= 0) && (index < (m_container.getComponentCount() - 1))) {
m_container.removeComponent(row);
m_container.addComponent(row, index + 1);
}
updateButtonBars();
} | [
"public",
"void",
"moveDown",
"(",
"I_CmsEditableGroupRow",
"row",
")",
"{",
"int",
"index",
"=",
"m_container",
".",
"getComponentIndex",
"(",
"row",
")",
";",
"if",
"(",
"(",
"index",
">=",
"0",
")",
"&&",
"(",
"index",
"<",
"(",
"m_container",
".",
... | Moves the given row down.
@param row the row to move | [
"Moves",
"the",
"given",
"row",
"down",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java#L350-L358 | train |
alkacon/opencms-core | src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java | CmsEditableGroup.moveUp | public void moveUp(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if (index > 0) {
m_container.removeComponent(row);
m_container.addComponent(row, index - 1);
}
updateButtonBars();
} | java | public void moveUp(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if (index > 0) {
m_container.removeComponent(row);
m_container.addComponent(row, index - 1);
}
updateButtonBars();
} | [
"public",
"void",
"moveUp",
"(",
"I_CmsEditableGroupRow",
"row",
")",
"{",
"int",
"index",
"=",
"m_container",
".",
"getComponentIndex",
"(",
"row",
")",
";",
"if",
"(",
"index",
">",
"0",
")",
"{",
"m_container",
".",
"removeComponent",
"(",
"row",
")",
... | Moves the given row up.
@param row the row to move | [
"Moves",
"the",
"given",
"row",
"up",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java#L365-L373 | train |
alkacon/opencms-core | src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java | CmsEditableGroup.remove | public void remove(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if (index >= 0) {
m_container.removeComponent(row);
}
updatePlaceholder();
updateButtonBars();
updateGroupValidation();
} | java | public void remove(I_CmsEditableGroupRow row) {
int index = m_container.getComponentIndex(row);
if (index >= 0) {
m_container.removeComponent(row);
}
updatePlaceholder();
updateButtonBars();
updateGroupValidation();
} | [
"public",
"void",
"remove",
"(",
"I_CmsEditableGroupRow",
"row",
")",
"{",
"int",
"index",
"=",
"m_container",
".",
"getComponentIndex",
"(",
"row",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"m_container",
".",
"removeComponent",
"(",
"row",
")",
... | Removes the given row.
@param row the row to remove | [
"Removes",
"the",
"given",
"row",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/components/editablegroup/CmsEditableGroup.java#L380-L389 | train |
alkacon/opencms-core | src/org/opencms/file/CmsObject.java | CmsObject.adjustLinks | public void adjustLinks(String sourceFolder, String targetFolder) throws CmsException {
String rootSourceFolder = addSiteRoot(sourceFolder);
String rootTargetFolder = addSiteRoot(targetFolder);
String siteRoot = getRequestContext().getSiteRoot();
getRequestContext().setSiteRoot("");
try {
CmsLinkRewriter linkRewriter = new CmsLinkRewriter(this, rootSourceFolder, rootTargetFolder);
linkRewriter.rewriteLinks();
} finally {
getRequestContext().setSiteRoot(siteRoot);
}
} | java | public void adjustLinks(String sourceFolder, String targetFolder) throws CmsException {
String rootSourceFolder = addSiteRoot(sourceFolder);
String rootTargetFolder = addSiteRoot(targetFolder);
String siteRoot = getRequestContext().getSiteRoot();
getRequestContext().setSiteRoot("");
try {
CmsLinkRewriter linkRewriter = new CmsLinkRewriter(this, rootSourceFolder, rootTargetFolder);
linkRewriter.rewriteLinks();
} finally {
getRequestContext().setSiteRoot(siteRoot);
}
} | [
"public",
"void",
"adjustLinks",
"(",
"String",
"sourceFolder",
",",
"String",
"targetFolder",
")",
"throws",
"CmsException",
"{",
"String",
"rootSourceFolder",
"=",
"addSiteRoot",
"(",
"sourceFolder",
")",
";",
"String",
"rootTargetFolder",
"=",
"addSiteRoot",
"(",... | Adjusts all links in the target folder that point to the source folder
so that they are kept "relative" in the target folder where possible.
If a link is found from the target folder to the source folder,
then the target folder is checked if a target of the same name
is found also "relative" inside the target Folder, and if so,
the link is changed to that "relative" target. This is mainly used to keep
relative links inside a copied folder structure intact.
Example: Image we have folder /folderA/ that contains files
/folderA/x1 and /folderA/y1. x1 has a link to y1 and y1 to x1.
Now someone copies /folderA/ to /folderB/. So we end up with
/folderB/x2 and /folderB/y2. Because of the link mechanism in OpenCms,
x2 will have a link to y1 and y2 to x1. By using this method,
the links from x2 to y1 will be replaced by a link x2 to y2,
and y2 to x1 with y2 to x2.
Link replacement works for links in XML files as well as relation only
type links.
@param sourceFolder the source folder
@param targetFolder the target folder
@throws CmsException if something goes wrong | [
"Adjusts",
"all",
"links",
"in",
"the",
"target",
"folder",
"that",
"point",
"to",
"the",
"source",
"folder",
"so",
"that",
"they",
"are",
"kept",
"relative",
"in",
"the",
"target",
"folder",
"where",
"possible",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L253-L265 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColorSelector.java | CmsColorSelector.setRGB | public void setRGB(int red, int green, int blue) throws Exception {
CmsColor color = new CmsColor();
color.setRGB(red, green, blue);
m_red = red;
m_green = green;
m_blue = blue;
m_hue = color.getHue();
m_saturation = color.getSaturation();
m_brightness = color.getValue();
m_tbRed.setText(Integer.toString(m_red));
m_tbGreen.setText(Integer.toString(m_green));
m_tbBlue.setText(Integer.toString(m_blue));
m_tbHue.setText(Integer.toString(m_hue));
m_tbSaturation.setText(Integer.toString(m_saturation));
m_tbBrightness.setText(Integer.toString(m_brightness));
m_tbHexColor.setText(color.getHex());
setPreview(color.getHex());
updateSliders();
} | java | public void setRGB(int red, int green, int blue) throws Exception {
CmsColor color = new CmsColor();
color.setRGB(red, green, blue);
m_red = red;
m_green = green;
m_blue = blue;
m_hue = color.getHue();
m_saturation = color.getSaturation();
m_brightness = color.getValue();
m_tbRed.setText(Integer.toString(m_red));
m_tbGreen.setText(Integer.toString(m_green));
m_tbBlue.setText(Integer.toString(m_blue));
m_tbHue.setText(Integer.toString(m_hue));
m_tbSaturation.setText(Integer.toString(m_saturation));
m_tbBrightness.setText(Integer.toString(m_brightness));
m_tbHexColor.setText(color.getHex());
setPreview(color.getHex());
updateSliders();
} | [
"public",
"void",
"setRGB",
"(",
"int",
"red",
",",
"int",
"green",
",",
"int",
"blue",
")",
"throws",
"Exception",
"{",
"CmsColor",
"color",
"=",
"new",
"CmsColor",
"(",
")",
";",
"color",
".",
"setRGB",
"(",
"red",
",",
"green",
",",
"blue",
")",
... | Sets the Red, Green, and Blue color variables. This will automatically populate the Hue, Saturation and Brightness and Hexadecimal fields, too.
The RGB color model is an additive color model in which red, green, and blue light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three additive primary colors, red, green, and blue.
@param red strength - valid range is 0-255
@param green strength - valid range is 0-255
@param blue strength - valid range is 0-255
@throws java.lang.Exception Exception if the Red, Green or Blue variables are out of range. | [
"Sets",
"the",
"Red",
"Green",
"and",
"Blue",
"color",
"variables",
".",
"This",
"will",
"automatically",
"populate",
"the",
"Hue",
"Saturation",
"and",
"Brightness",
"and",
"Hexadecimal",
"fields",
"too",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/input/colorpicker/CmsColorSelector.java#L787-L809 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteDialog.java | CmsFavoriteDialog.doSave | protected void doSave() {
List<CmsFavoriteEntry> entries = getEntries();
try {
m_favDao.saveFavorites(entries);
} catch (Exception e) {
CmsErrorDialog.showErrorDialog(e);
}
} | java | protected void doSave() {
List<CmsFavoriteEntry> entries = getEntries();
try {
m_favDao.saveFavorites(entries);
} catch (Exception e) {
CmsErrorDialog.showErrorDialog(e);
}
} | [
"protected",
"void",
"doSave",
"(",
")",
"{",
"List",
"<",
"CmsFavoriteEntry",
">",
"entries",
"=",
"getEntries",
"(",
")",
";",
"try",
"{",
"m_favDao",
".",
"saveFavorites",
"(",
"entries",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"Cms... | Saves the list of currently displayed favorites. | [
"Saves",
"the",
"list",
"of",
"currently",
"displayed",
"favorites",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L273-L281 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteDialog.java | CmsFavoriteDialog.getEntries | List<CmsFavoriteEntry> getEntries() {
List<CmsFavoriteEntry> result = new ArrayList<>();
for (I_CmsEditableGroupRow row : m_group.getRows()) {
CmsFavoriteEntry entry = ((CmsFavInfo)row).getEntry();
result.add(entry);
}
return result;
} | java | List<CmsFavoriteEntry> getEntries() {
List<CmsFavoriteEntry> result = new ArrayList<>();
for (I_CmsEditableGroupRow row : m_group.getRows()) {
CmsFavoriteEntry entry = ((CmsFavInfo)row).getEntry();
result.add(entry);
}
return result;
} | [
"List",
"<",
"CmsFavoriteEntry",
">",
"getEntries",
"(",
")",
"{",
"List",
"<",
"CmsFavoriteEntry",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"I_CmsEditableGroupRow",
"row",
":",
"m_group",
".",
"getRows",
"(",
")",
")",
"{... | Gets the favorite entries corresponding to the currently displayed favorite widgets.
@return the list of favorite entries | [
"Gets",
"the",
"favorite",
"entries",
"corresponding",
"to",
"the",
"currently",
"displayed",
"favorite",
"widgets",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L296-L304 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteDialog.java | CmsFavoriteDialog.createFavInfo | private CmsFavInfo createFavInfo(CmsFavoriteEntry entry) throws CmsException {
String title = "";
String subtitle = "";
CmsFavInfo result = new CmsFavInfo(entry);
CmsObject cms = A_CmsUI.getCmsObject();
String project = getProject(cms, entry);
String site = getSite(cms, entry);
try {
CmsUUID idToLoad = entry.getDetailId() != null ? entry.getDetailId() : entry.getStructureId();
CmsResource resource = cms.readResource(idToLoad, CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible());
CmsResourceUtil resutil = new CmsResourceUtil(cms, resource);
switch (entry.getType()) {
case explorerFolder:
title = CmsStringUtil.isEmpty(resutil.getTitle())
? CmsResource.getName(resource.getRootPath())
: resutil.getTitle();
break;
case page:
title = resutil.getTitle();
break;
}
subtitle = resource.getRootPath();
CmsResourceIcon icon = result.getResourceIcon();
icon.initContent(resutil, CmsResource.STATE_UNCHANGED, false, false);
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
result.getTopLine().setValue(title);
result.getBottomLine().setValue(subtitle);
result.getProjectLabel().setValue(project);
result.getSiteLabel().setValue(site);
return result;
} | java | private CmsFavInfo createFavInfo(CmsFavoriteEntry entry) throws CmsException {
String title = "";
String subtitle = "";
CmsFavInfo result = new CmsFavInfo(entry);
CmsObject cms = A_CmsUI.getCmsObject();
String project = getProject(cms, entry);
String site = getSite(cms, entry);
try {
CmsUUID idToLoad = entry.getDetailId() != null ? entry.getDetailId() : entry.getStructureId();
CmsResource resource = cms.readResource(idToLoad, CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible());
CmsResourceUtil resutil = new CmsResourceUtil(cms, resource);
switch (entry.getType()) {
case explorerFolder:
title = CmsStringUtil.isEmpty(resutil.getTitle())
? CmsResource.getName(resource.getRootPath())
: resutil.getTitle();
break;
case page:
title = resutil.getTitle();
break;
}
subtitle = resource.getRootPath();
CmsResourceIcon icon = result.getResourceIcon();
icon.initContent(resutil, CmsResource.STATE_UNCHANGED, false, false);
} catch (CmsException e) {
LOG.warn(e.getLocalizedMessage(), e);
}
result.getTopLine().setValue(title);
result.getBottomLine().setValue(subtitle);
result.getProjectLabel().setValue(project);
result.getSiteLabel().setValue(site);
return result;
} | [
"private",
"CmsFavInfo",
"createFavInfo",
"(",
"CmsFavoriteEntry",
"entry",
")",
"throws",
"CmsException",
"{",
"String",
"title",
"=",
"\"\"",
";",
"String",
"subtitle",
"=",
"\"\"",
";",
"CmsFavInfo",
"result",
"=",
"new",
"CmsFavInfo",
"(",
"entry",
")",
";... | Creates a favorite widget for a favorite entry.
@param entry the favorite entry
@return the favorite widget
@throws CmsException if something goes wrong | [
"Creates",
"a",
"favorite",
"widget",
"for",
"a",
"favorite",
"entry",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L314-L349 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteDialog.java | CmsFavoriteDialog.getEntry | private CmsFavoriteEntry getEntry(Component row) {
if (row instanceof CmsFavInfo) {
return ((CmsFavInfo)row).getEntry();
}
return null;
} | java | private CmsFavoriteEntry getEntry(Component row) {
if (row instanceof CmsFavInfo) {
return ((CmsFavInfo)row).getEntry();
}
return null;
} | [
"private",
"CmsFavoriteEntry",
"getEntry",
"(",
"Component",
"row",
")",
"{",
"if",
"(",
"row",
"instanceof",
"CmsFavInfo",
")",
"{",
"return",
"(",
"(",
"CmsFavInfo",
")",
"row",
")",
".",
"getEntry",
"(",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Gets the favorite entry for a given row.
@param row the widget used to display the favorite
@return the favorite entry for the widget | [
"Gets",
"the",
"favorite",
"entry",
"for",
"a",
"given",
"row",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L357-L366 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteDialog.java | CmsFavoriteDialog.getProject | private String getProject(CmsObject cms, CmsFavoriteEntry entry) throws CmsException {
String result = m_projectLabels.get(entry.getProjectId());
if (result == null) {
result = cms.readProject(entry.getProjectId()).getName();
m_projectLabels.put(entry.getProjectId(), result);
}
return result;
} | java | private String getProject(CmsObject cms, CmsFavoriteEntry entry) throws CmsException {
String result = m_projectLabels.get(entry.getProjectId());
if (result == null) {
result = cms.readProject(entry.getProjectId()).getName();
m_projectLabels.put(entry.getProjectId(), result);
}
return result;
} | [
"private",
"String",
"getProject",
"(",
"CmsObject",
"cms",
",",
"CmsFavoriteEntry",
"entry",
")",
"throws",
"CmsException",
"{",
"String",
"result",
"=",
"m_projectLabels",
".",
"get",
"(",
"entry",
".",
"getProjectId",
"(",
")",
")",
";",
"if",
"(",
"resul... | Gets the project name for a favorite entry.
@param cms the CMS context
@param entry the favorite entry
@return the project name for the favorite entry
@throws CmsException if something goes wrong | [
"Gets",
"the",
"project",
"name",
"for",
"a",
"favorite",
"entry",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L376-L384 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteDialog.java | CmsFavoriteDialog.getSite | private String getSite(CmsObject cms, CmsFavoriteEntry entry) {
CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(entry.getSiteRoot());
Item item = m_sitesContainer.getItem(entry.getSiteRoot());
if (item != null) {
return (String)(item.getItemProperty("caption").getValue());
}
String result = entry.getSiteRoot();
if (site != null) {
if (!CmsStringUtil.isEmpty(site.getTitle())) {
result = site.getTitle();
}
}
return result;
} | java | private String getSite(CmsObject cms, CmsFavoriteEntry entry) {
CmsSite site = OpenCms.getSiteManager().getSiteForRootPath(entry.getSiteRoot());
Item item = m_sitesContainer.getItem(entry.getSiteRoot());
if (item != null) {
return (String)(item.getItemProperty("caption").getValue());
}
String result = entry.getSiteRoot();
if (site != null) {
if (!CmsStringUtil.isEmpty(site.getTitle())) {
result = site.getTitle();
}
}
return result;
} | [
"private",
"String",
"getSite",
"(",
"CmsObject",
"cms",
",",
"CmsFavoriteEntry",
"entry",
")",
"{",
"CmsSite",
"site",
"=",
"OpenCms",
".",
"getSiteManager",
"(",
")",
".",
"getSiteForRootPath",
"(",
"entry",
".",
"getSiteRoot",
"(",
")",
")",
";",
"Item",
... | Gets the site label for the entry.
@param cms the current CMS context
@param entry the entry
@return the site label for the entry | [
"Gets",
"the",
"site",
"label",
"for",
"the",
"entry",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L393-L407 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteDialog.java | CmsFavoriteDialog.onClickAdd | private void onClickAdd() {
if (m_currentLocation.isPresent()) {
CmsFavoriteEntry entry = m_currentLocation.get();
List<CmsFavoriteEntry> entries = getEntries();
entries.add(entry);
try {
m_favDao.saveFavorites(entries);
} catch (Exception e) {
CmsErrorDialog.showErrorDialog(e);
}
m_context.close();
}
} | java | private void onClickAdd() {
if (m_currentLocation.isPresent()) {
CmsFavoriteEntry entry = m_currentLocation.get();
List<CmsFavoriteEntry> entries = getEntries();
entries.add(entry);
try {
m_favDao.saveFavorites(entries);
} catch (Exception e) {
CmsErrorDialog.showErrorDialog(e);
}
m_context.close();
}
} | [
"private",
"void",
"onClickAdd",
"(",
")",
"{",
"if",
"(",
"m_currentLocation",
".",
"isPresent",
"(",
")",
")",
"{",
"CmsFavoriteEntry",
"entry",
"=",
"m_currentLocation",
".",
"get",
"(",
")",
";",
"List",
"<",
"CmsFavoriteEntry",
">",
"entries",
"=",
"g... | The click handler for the add button. | [
"The",
"click",
"handler",
"for",
"the",
"add",
"button",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDialog.java#L412-L425 | train |
alkacon/opencms-core | src/org/opencms/jsp/CmsJspTagNavigation.java | CmsJspTagNavigation.setLocale | public void setLocale(String locale) {
try {
m_locale = LocaleUtils.toLocale(locale);
} catch (IllegalArgumentException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_TAG_INVALID_LOCALE_1, "cms:navigation"), e);
m_locale = null;
}
} | java | public void setLocale(String locale) {
try {
m_locale = LocaleUtils.toLocale(locale);
} catch (IllegalArgumentException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_TAG_INVALID_LOCALE_1, "cms:navigation"), e);
m_locale = null;
}
} | [
"public",
"void",
"setLocale",
"(",
"String",
"locale",
")",
"{",
"try",
"{",
"m_locale",
"=",
"LocaleUtils",
".",
"toLocale",
"(",
"locale",
")",
";",
"}",
"catch",
"(",
"IllegalArgumentException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"Messages",
".... | Sets the locale for which the property should be read.
@param locale the locale for which the property should be read. | [
"Sets",
"the",
"locale",
"for",
"which",
"the",
"property",
"should",
"be",
"read",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagNavigation.java#L220-L228 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteDAO.java | CmsFavoriteDAO.loadFavorites | public List<CmsFavoriteEntry> loadFavorites() throws CmsException {
List<CmsFavoriteEntry> result = new ArrayList<>();
try {
CmsUser user = readUser();
String data = (String)user.getAdditionalInfo(ADDINFO_KEY);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(data)) {
return new ArrayList<>();
}
JSONObject json = new JSONObject(data);
JSONArray array = json.getJSONArray(BASE_KEY);
for (int i = 0; i < array.length(); i++) {
JSONObject fav = array.getJSONObject(i);
try {
CmsFavoriteEntry entry = new CmsFavoriteEntry(fav);
if (validate(entry)) {
result.add(entry);
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
} catch (JSONException e) {
LOG.error(e.getLocalizedMessage(), e);
}
return result;
} | java | public List<CmsFavoriteEntry> loadFavorites() throws CmsException {
List<CmsFavoriteEntry> result = new ArrayList<>();
try {
CmsUser user = readUser();
String data = (String)user.getAdditionalInfo(ADDINFO_KEY);
if (CmsStringUtil.isEmptyOrWhitespaceOnly(data)) {
return new ArrayList<>();
}
JSONObject json = new JSONObject(data);
JSONArray array = json.getJSONArray(BASE_KEY);
for (int i = 0; i < array.length(); i++) {
JSONObject fav = array.getJSONObject(i);
try {
CmsFavoriteEntry entry = new CmsFavoriteEntry(fav);
if (validate(entry)) {
result.add(entry);
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
}
}
} catch (JSONException e) {
LOG.error(e.getLocalizedMessage(), e);
}
return result;
} | [
"public",
"List",
"<",
"CmsFavoriteEntry",
">",
"loadFavorites",
"(",
")",
"throws",
"CmsException",
"{",
"List",
"<",
"CmsFavoriteEntry",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"CmsUser",
"user",
"=",
"readUser",
"(",
")"... | Loads the favorite list.
@return the list of favorites
@throws CmsException if something goes wrong | [
"Loads",
"the",
"favorite",
"list",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDAO.java#L120-L147 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteDAO.java | CmsFavoriteDAO.saveFavorites | public void saveFavorites(List<CmsFavoriteEntry> favorites) throws CmsException {
try {
JSONObject json = new JSONObject();
JSONArray array = new JSONArray();
for (CmsFavoriteEntry entry : favorites) {
array.put(entry.toJson());
}
json.put(BASE_KEY, array);
String data = json.toString();
CmsUser user = readUser();
user.setAdditionalInfo(ADDINFO_KEY, data);
m_cms.writeUser(user);
} catch (JSONException e) {
LOG.error(e.getLocalizedMessage(), e);
}
} | java | public void saveFavorites(List<CmsFavoriteEntry> favorites) throws CmsException {
try {
JSONObject json = new JSONObject();
JSONArray array = new JSONArray();
for (CmsFavoriteEntry entry : favorites) {
array.put(entry.toJson());
}
json.put(BASE_KEY, array);
String data = json.toString();
CmsUser user = readUser();
user.setAdditionalInfo(ADDINFO_KEY, data);
m_cms.writeUser(user);
} catch (JSONException e) {
LOG.error(e.getLocalizedMessage(), e);
}
} | [
"public",
"void",
"saveFavorites",
"(",
"List",
"<",
"CmsFavoriteEntry",
">",
"favorites",
")",
"throws",
"CmsException",
"{",
"try",
"{",
"JSONObject",
"json",
"=",
"new",
"JSONObject",
"(",
")",
";",
"JSONArray",
"array",
"=",
"new",
"JSONArray",
"(",
")",... | Saves the favorites.
@param favorites the list of favorites to save
@throws CmsException if something goes wrong | [
"Saves",
"the",
"favorites",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDAO.java#L155-L172 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsFavoriteDAO.java | CmsFavoriteDAO.validate | private boolean validate(CmsFavoriteEntry entry) {
try {
String siteRoot = entry.getSiteRoot();
if (!m_okSiteRoots.contains(siteRoot)) {
m_rootCms.readResource(siteRoot);
m_okSiteRoots.add(siteRoot);
}
CmsUUID project = entry.getProjectId();
if (!m_okProjects.contains(project)) {
m_cms.readProject(project);
m_okProjects.add(project);
}
for (CmsUUID id : Arrays.asList(entry.getDetailId(), entry.getStructureId())) {
if ((id != null) && !m_okStructureIds.contains(id)) {
m_cms.readResource(id, CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible());
m_okStructureIds.add(id);
}
}
return true;
} catch (Exception e) {
LOG.info("Favorite entry validation failed: " + e.getLocalizedMessage(), e);
return false;
}
} | java | private boolean validate(CmsFavoriteEntry entry) {
try {
String siteRoot = entry.getSiteRoot();
if (!m_okSiteRoots.contains(siteRoot)) {
m_rootCms.readResource(siteRoot);
m_okSiteRoots.add(siteRoot);
}
CmsUUID project = entry.getProjectId();
if (!m_okProjects.contains(project)) {
m_cms.readProject(project);
m_okProjects.add(project);
}
for (CmsUUID id : Arrays.asList(entry.getDetailId(), entry.getStructureId())) {
if ((id != null) && !m_okStructureIds.contains(id)) {
m_cms.readResource(id, CmsResourceFilter.IGNORE_EXPIRATION.addRequireVisible());
m_okStructureIds.add(id);
}
}
return true;
} catch (Exception e) {
LOG.info("Favorite entry validation failed: " + e.getLocalizedMessage(), e);
return false;
}
} | [
"private",
"boolean",
"validate",
"(",
"CmsFavoriteEntry",
"entry",
")",
"{",
"try",
"{",
"String",
"siteRoot",
"=",
"entry",
".",
"getSiteRoot",
"(",
")",
";",
"if",
"(",
"!",
"m_okSiteRoots",
".",
"contains",
"(",
"siteRoot",
")",
")",
"{",
"m_rootCms",
... | Validates a favorite entry.
<p>If the favorite entry references a resource or project that can't be read, this will return false.
@param entry the favorite entry
@return the | [
"Validates",
"a",
"favorite",
"entry",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsFavoriteDAO.java#L188-L214 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.showCurrentDates | public void showCurrentDates(Collection<CmsPair<Date, Boolean>> dates) {
m_overviewList.setDatesWithCheckState(dates);
m_overviewPopup.center();
} | java | public void showCurrentDates(Collection<CmsPair<Date, Boolean>> dates) {
m_overviewList.setDatesWithCheckState(dates);
m_overviewPopup.center();
} | [
"public",
"void",
"showCurrentDates",
"(",
"Collection",
"<",
"CmsPair",
"<",
"Date",
",",
"Boolean",
">",
">",
"dates",
")",
"{",
"m_overviewList",
".",
"setDatesWithCheckState",
"(",
"dates",
")",
";",
"m_overviewPopup",
".",
"center",
"(",
")",
";",
"}"
] | Shows the provided list of dates as current dates.
@param dates the current dates to show, accompanied with the information if they are exceptions or not. | [
"Shows",
"the",
"provided",
"list",
"of",
"dates",
"as",
"current",
"dates",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L339-L344 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.updateExceptions | public void updateExceptions() {
m_exceptionsList.setDates(m_model.getExceptions());
if (m_model.getExceptions().size() > 0) {
m_exceptionsPanel.setVisible(true);
} else {
m_exceptionsPanel.setVisible(false);
}
} | java | public void updateExceptions() {
m_exceptionsList.setDates(m_model.getExceptions());
if (m_model.getExceptions().size() > 0) {
m_exceptionsPanel.setVisible(true);
} else {
m_exceptionsPanel.setVisible(false);
}
} | [
"public",
"void",
"updateExceptions",
"(",
")",
"{",
"m_exceptionsList",
".",
"setDates",
"(",
"m_model",
".",
"getExceptions",
"(",
")",
")",
";",
"if",
"(",
"m_model",
".",
"getExceptions",
"(",
")",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"m_exce... | Updates the exceptions panel. | [
"Updates",
"the",
"exceptions",
"panel",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L349-L357 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.onCurrentTillEndChange | @UiHandler("m_currentTillEndCheckBox")
void onCurrentTillEndChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.setCurrentTillEnd(event.getValue());
}
} | java | @UiHandler("m_currentTillEndCheckBox")
void onCurrentTillEndChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.setCurrentTillEnd(event.getValue());
}
} | [
"@",
"UiHandler",
"(",
"\"m_currentTillEndCheckBox\"",
")",
"void",
"onCurrentTillEndChange",
"(",
"ValueChangeEvent",
"<",
"Boolean",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setCurrentTillEnd",
"(",
"event",
... | Handle a "current till end" change event.
@param event the change event. | [
"Handle",
"a",
"current",
"till",
"end",
"change",
"event",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L372-L378 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.onEndTimeChange | @UiHandler("m_endTime")
void onEndTimeChange(CmsDateBoxEvent event) {
if (handleChange() && !event.isUserTyping()) {
m_controller.setEndTime(event.getDate());
}
} | java | @UiHandler("m_endTime")
void onEndTimeChange(CmsDateBoxEvent event) {
if (handleChange() && !event.isUserTyping()) {
m_controller.setEndTime(event.getDate());
}
} | [
"@",
"UiHandler",
"(",
"\"m_endTime\"",
")",
"void",
"onEndTimeChange",
"(",
"CmsDateBoxEvent",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
"&&",
"!",
"event",
".",
"isUserTyping",
"(",
")",
")",
"{",
"m_controller",
".",
"setEndTime",
"(",
"ev... | Handle an end time change.
@param event the change event. | [
"Handle",
"an",
"end",
"time",
"change",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L384-L390 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.onEndTypeChange | void onEndTypeChange() {
EndType endType = m_model.getEndType();
m_groupDuration.selectButton(getDurationButtonForType(endType));
switch (endType) {
case DATE:
case TIMES:
m_durationPanel.setVisible(true);
m_seriesEndDate.setValue(m_model.getSeriesEndDate());
int occurrences = m_model.getOccurrences();
if (!m_occurrences.isFocused()) {
m_occurrences.setFormValueAsString(occurrences > 0 ? "" + occurrences : "");
}
break;
default:
m_durationPanel.setVisible(false);
break;
}
updateExceptions();
} | java | void onEndTypeChange() {
EndType endType = m_model.getEndType();
m_groupDuration.selectButton(getDurationButtonForType(endType));
switch (endType) {
case DATE:
case TIMES:
m_durationPanel.setVisible(true);
m_seriesEndDate.setValue(m_model.getSeriesEndDate());
int occurrences = m_model.getOccurrences();
if (!m_occurrences.isFocused()) {
m_occurrences.setFormValueAsString(occurrences > 0 ? "" + occurrences : "");
}
break;
default:
m_durationPanel.setVisible(false);
break;
}
updateExceptions();
} | [
"void",
"onEndTypeChange",
"(",
")",
"{",
"EndType",
"endType",
"=",
"m_model",
".",
"getEndType",
"(",
")",
";",
"m_groupDuration",
".",
"selectButton",
"(",
"getDurationButtonForType",
"(",
"endType",
")",
")",
";",
"switch",
"(",
"endType",
")",
"{",
"cas... | Called when the end type is changed. | [
"Called",
"when",
"the",
"end",
"type",
"is",
"changed",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L395-L414 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.onPatternChange | void onPatternChange() {
PatternType patternType = m_model.getPatternType();
boolean isSeries = !patternType.equals(PatternType.NONE);
setSerialOptionsVisible(isSeries);
m_seriesCheckBox.setChecked(isSeries);
if (isSeries) {
m_groupPattern.selectButton(m_patternButtons.get(patternType));
m_controller.getPatternView().onValueChange();
m_patternOptions.setWidget(m_controller.getPatternView());
onEndTypeChange();
}
m_controller.sizeChanged();
} | java | void onPatternChange() {
PatternType patternType = m_model.getPatternType();
boolean isSeries = !patternType.equals(PatternType.NONE);
setSerialOptionsVisible(isSeries);
m_seriesCheckBox.setChecked(isSeries);
if (isSeries) {
m_groupPattern.selectButton(m_patternButtons.get(patternType));
m_controller.getPatternView().onValueChange();
m_patternOptions.setWidget(m_controller.getPatternView());
onEndTypeChange();
}
m_controller.sizeChanged();
} | [
"void",
"onPatternChange",
"(",
")",
"{",
"PatternType",
"patternType",
"=",
"m_model",
".",
"getPatternType",
"(",
")",
";",
"boolean",
"isSeries",
"=",
"!",
"patternType",
".",
"equals",
"(",
"PatternType",
".",
"NONE",
")",
";",
"setSerialOptionsVisible",
"... | Called when the pattern has changed. | [
"Called",
"when",
"the",
"pattern",
"has",
"changed",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L457-L470 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.onSeriesChange | @UiHandler("m_seriesCheckBox")
void onSeriesChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.setIsSeries(event.getValue());
}
} | java | @UiHandler("m_seriesCheckBox")
void onSeriesChange(ValueChangeEvent<Boolean> event) {
if (handleChange()) {
m_controller.setIsSeries(event.getValue());
}
} | [
"@",
"UiHandler",
"(",
"\"m_seriesCheckBox\"",
")",
"void",
"onSeriesChange",
"(",
"ValueChangeEvent",
"<",
"Boolean",
">",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setIsSeries",
"(",
"event",
".",
"getValue",
"... | Handle changes of the series check box.
@param event the change event. | [
"Handle",
"changes",
"of",
"the",
"series",
"check",
"box",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L476-L482 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.onStartTimeChange | @UiHandler("m_startTime")
void onStartTimeChange(CmsDateBoxEvent event) {
if (handleChange() && !event.isUserTyping()) {
m_controller.setStartTime(event.getDate());
}
} | java | @UiHandler("m_startTime")
void onStartTimeChange(CmsDateBoxEvent event) {
if (handleChange() && !event.isUserTyping()) {
m_controller.setStartTime(event.getDate());
}
} | [
"@",
"UiHandler",
"(",
"\"m_startTime\"",
")",
"void",
"onStartTimeChange",
"(",
"CmsDateBoxEvent",
"event",
")",
"{",
"if",
"(",
"handleChange",
"(",
")",
"&&",
"!",
"event",
".",
"isUserTyping",
"(",
")",
")",
"{",
"m_controller",
".",
"setStartTime",
"(",... | Handle a start time change.
@param event the change event | [
"Handle",
"a",
"start",
"time",
"change",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L512-L518 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.onWholeDayChange | @UiHandler("m_wholeDayCheckBox")
void onWholeDayChange(ValueChangeEvent<Boolean> event) {
//TODO: Improve - adjust time selections?
if (handleChange()) {
m_controller.setWholeDay(event.getValue());
}
} | java | @UiHandler("m_wholeDayCheckBox")
void onWholeDayChange(ValueChangeEvent<Boolean> event) {
//TODO: Improve - adjust time selections?
if (handleChange()) {
m_controller.setWholeDay(event.getValue());
}
} | [
"@",
"UiHandler",
"(",
"\"m_wholeDayCheckBox\"",
")",
"void",
"onWholeDayChange",
"(",
"ValueChangeEvent",
"<",
"Boolean",
">",
"event",
")",
"{",
"//TODO: Improve - adjust time selections?",
"if",
"(",
"handleChange",
"(",
")",
")",
"{",
"m_controller",
".",
"setWh... | Handle a whole day change event.
@param event the change event. | [
"Handle",
"a",
"whole",
"day",
"change",
"event",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L524-L531 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.createAndAddButton | private void createAndAddButton(PatternType pattern, String messageKey) {
CmsRadioButton btn = new CmsRadioButton(pattern.toString(), Messages.get().key(messageKey));
btn.addStyleName(I_CmsWidgetsLayoutBundle.INSTANCE.widgetCss().radioButtonlabel());
btn.setGroup(m_groupPattern);
m_patternButtons.put(pattern, btn);
m_patternRadioButtonsPanel.add(btn);
} | java | private void createAndAddButton(PatternType pattern, String messageKey) {
CmsRadioButton btn = new CmsRadioButton(pattern.toString(), Messages.get().key(messageKey));
btn.addStyleName(I_CmsWidgetsLayoutBundle.INSTANCE.widgetCss().radioButtonlabel());
btn.setGroup(m_groupPattern);
m_patternButtons.put(pattern, btn);
m_patternRadioButtonsPanel.add(btn);
} | [
"private",
"void",
"createAndAddButton",
"(",
"PatternType",
"pattern",
",",
"String",
"messageKey",
")",
"{",
"CmsRadioButton",
"btn",
"=",
"new",
"CmsRadioButton",
"(",
"pattern",
".",
"toString",
"(",
")",
",",
"Messages",
".",
"get",
"(",
")",
".",
"key"... | Creates a pattern choice radio button and adds it where necessary.
@param pattern the pattern that should be chosen by the button.
@param messageKey the message key for the button's label. | [
"Creates",
"a",
"pattern",
"choice",
"radio",
"button",
"and",
"adds",
"it",
"where",
"necessary",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L552-L560 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.initDatesPanel | private void initDatesPanel() {
m_startLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_STARTTIME_0));
m_startTime.setAllowInvalidValue(true);
m_startTime.setValue(m_model.getStart());
m_endLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_ENDTIME_0));
m_endTime.setAllowInvalidValue(true);
m_endTime.setValue(m_model.getEnd());
m_seriesCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_SERIES_CHECKBOX_0));
m_wholeDayCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_WHOLE_DAY_CHECKBOX_0));
m_currentTillEndCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_0));
m_currentTillEndCheckBox.getButton().setTitle(
Messages.get().key(Messages.GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_HELP_0));
} | java | private void initDatesPanel() {
m_startLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_STARTTIME_0));
m_startTime.setAllowInvalidValue(true);
m_startTime.setValue(m_model.getStart());
m_endLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_TIME_ENDTIME_0));
m_endTime.setAllowInvalidValue(true);
m_endTime.setValue(m_model.getEnd());
m_seriesCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_SERIES_CHECKBOX_0));
m_wholeDayCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_WHOLE_DAY_CHECKBOX_0));
m_currentTillEndCheckBox.setText(Messages.get().key(Messages.GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_0));
m_currentTillEndCheckBox.getButton().setTitle(
Messages.get().key(Messages.GUI_SERIALDATE_CURRENT_TILL_END_CHECKBOX_HELP_0));
} | [
"private",
"void",
"initDatesPanel",
"(",
")",
"{",
"m_startLabel",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_TIME_STARTTIME_0",
")",
")",
";",
"m_startTime",
".",
"setAllowInvalidValue",
"(",
"tru... | Initialize dates panel elements. | [
"Initialize",
"dates",
"panel",
"elements",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L580-L593 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.initDeactivationPanel | private void initDeactivationPanel() {
m_deactivationPanel.setVisible(false);
m_deactivationText.setText(Messages.get().key(Messages.GUI_SERIALDATE_DEACTIVE_TEXT_0));
} | java | private void initDeactivationPanel() {
m_deactivationPanel.setVisible(false);
m_deactivationText.setText(Messages.get().key(Messages.GUI_SERIALDATE_DEACTIVE_TEXT_0));
} | [
"private",
"void",
"initDeactivationPanel",
"(",
")",
"{",
"m_deactivationPanel",
".",
"setVisible",
"(",
"false",
")",
";",
"m_deactivationText",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_DEACTIVE_T... | Initialize elements of the panel displayed for the deactivated widget. | [
"Initialize",
"elements",
"of",
"the",
"panel",
"displayed",
"for",
"the",
"deactivated",
"widget",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L598-L603 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.initDurationButtonGroup | private void initDurationButtonGroup() {
m_groupDuration = new CmsRadioButtonGroup();
m_endsAfterRadioButton = new CmsRadioButton(
EndType.TIMES.toString(),
Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_0));
m_endsAfterRadioButton.setGroup(m_groupDuration);
m_endsAtRadioButton = new CmsRadioButton(
EndType.DATE.toString(),
Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_DATE_0));
m_endsAtRadioButton.setGroup(m_groupDuration);
m_groupDuration.addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String> event) {
if (handleChange()) {
String value = event.getValue();
if (null != value) {
m_controller.setEndType(value);
}
}
}
});
} | java | private void initDurationButtonGroup() {
m_groupDuration = new CmsRadioButtonGroup();
m_endsAfterRadioButton = new CmsRadioButton(
EndType.TIMES.toString(),
Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_0));
m_endsAfterRadioButton.setGroup(m_groupDuration);
m_endsAtRadioButton = new CmsRadioButton(
EndType.DATE.toString(),
Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_DATE_0));
m_endsAtRadioButton.setGroup(m_groupDuration);
m_groupDuration.addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String> event) {
if (handleChange()) {
String value = event.getValue();
if (null != value) {
m_controller.setEndType(value);
}
}
}
});
} | [
"private",
"void",
"initDurationButtonGroup",
"(",
")",
"{",
"m_groupDuration",
"=",
"new",
"CmsRadioButtonGroup",
"(",
")",
";",
"m_endsAfterRadioButton",
"=",
"new",
"CmsRadioButton",
"(",
"EndType",
".",
"TIMES",
".",
"toString",
"(",
")",
",",
"Messages",
".... | Configure all UI elements in the "ending"-options panel. | [
"Configure",
"all",
"UI",
"elements",
"in",
"the",
"ending",
"-",
"options",
"panel",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L608-L633 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.initDurationPanel | private void initDurationPanel() {
m_durationPrefixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_PREFIX_0));
m_durationAfterPostfixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_POSTFIX_0));
m_seriesEndDate.setDateOnly(true);
m_seriesEndDate.setAllowInvalidValue(true);
m_seriesEndDate.setValue(m_model.getSeriesEndDate());
m_seriesEndDate.getTextField().addFocusHandler(new FocusHandler() {
public void onFocus(FocusEvent event) {
if (handleChange()) {
onSeriesEndDateFocus(event);
}
}
});
} | java | private void initDurationPanel() {
m_durationPrefixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_PREFIX_0));
m_durationAfterPostfixLabel.setText(Messages.get().key(Messages.GUI_SERIALDATE_DURATION_ENDTYPE_OCC_POSTFIX_0));
m_seriesEndDate.setDateOnly(true);
m_seriesEndDate.setAllowInvalidValue(true);
m_seriesEndDate.setValue(m_model.getSeriesEndDate());
m_seriesEndDate.getTextField().addFocusHandler(new FocusHandler() {
public void onFocus(FocusEvent event) {
if (handleChange()) {
onSeriesEndDateFocus(event);
}
}
});
} | [
"private",
"void",
"initDurationPanel",
"(",
")",
"{",
"m_durationPrefixLabel",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_DURATION_PREFIX_0",
")",
")",
";",
"m_durationAfterPostfixLabel",
".",
"setText... | Initialize elements from the duration panel. | [
"Initialize",
"elements",
"from",
"the",
"duration",
"panel",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L636-L653 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.initExceptionsPanel | private void initExceptionsPanel() {
m_exceptionsPanel.setLegend(Messages.get().key(Messages.GUI_SERIALDATE_PANEL_EXCEPTIONS_0));
m_exceptionsPanel.addCloseHandler(this);
m_exceptionsPanel.setVisible(false);
} | java | private void initExceptionsPanel() {
m_exceptionsPanel.setLegend(Messages.get().key(Messages.GUI_SERIALDATE_PANEL_EXCEPTIONS_0));
m_exceptionsPanel.addCloseHandler(this);
m_exceptionsPanel.setVisible(false);
} | [
"private",
"void",
"initExceptionsPanel",
"(",
")",
"{",
"m_exceptionsPanel",
".",
"setLegend",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_PANEL_EXCEPTIONS_0",
")",
")",
";",
"m_exceptionsPanel",
".",
"addCloseHandler"... | Configure all UI elements in the exceptions panel. | [
"Configure",
"all",
"UI",
"elements",
"in",
"the",
"exceptions",
"panel",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L658-L663 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.initManagementPart | private void initManagementPart() {
m_manageExceptionsButton.setText(Messages.get().key(Messages.GUI_SERIALDATE_BUTTON_MANAGE_EXCEPTIONS_0));
m_manageExceptionsButton.getElement().getStyle().setFloat(Style.Float.RIGHT);
} | java | private void initManagementPart() {
m_manageExceptionsButton.setText(Messages.get().key(Messages.GUI_SERIALDATE_BUTTON_MANAGE_EXCEPTIONS_0));
m_manageExceptionsButton.getElement().getStyle().setFloat(Style.Float.RIGHT);
} | [
"private",
"void",
"initManagementPart",
"(",
")",
"{",
"m_manageExceptionsButton",
".",
"setText",
"(",
"Messages",
".",
"get",
"(",
")",
".",
"key",
"(",
"Messages",
".",
"GUI_SERIALDATE_BUTTON_MANAGE_EXCEPTIONS_0",
")",
")",
";",
"m_manageExceptionsButton",
".",
... | Initialize the ui elements for the management part. | [
"Initialize",
"the",
"ui",
"elements",
"for",
"the",
"management",
"part",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L668-L672 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java | CmsSerialDateView.initPatternButtonGroup | private void initPatternButtonGroup() {
m_groupPattern = new CmsRadioButtonGroup();
m_patternButtons = new HashMap<>();
createAndAddButton(PatternType.DAILY, Messages.GUI_SERIALDATE_TYPE_DAILY_0);
m_patternButtons.put(PatternType.NONE, m_patternButtons.get(PatternType.DAILY));
createAndAddButton(PatternType.WEEKLY, Messages.GUI_SERIALDATE_TYPE_WEEKLY_0);
createAndAddButton(PatternType.MONTHLY, Messages.GUI_SERIALDATE_TYPE_MONTHLY_0);
createAndAddButton(PatternType.YEARLY, Messages.GUI_SERIALDATE_TYPE_YEARLY_0);
// createAndAddButton(PatternType.INDIVIDUAL, Messages.GUI_SERIALDATE_TYPE_INDIVIDUAL_0);
m_groupPattern.addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String> event) {
if (handleChange()) {
String value = event.getValue();
if (value != null) {
m_controller.setPattern(value);
}
}
}
});
} | java | private void initPatternButtonGroup() {
m_groupPattern = new CmsRadioButtonGroup();
m_patternButtons = new HashMap<>();
createAndAddButton(PatternType.DAILY, Messages.GUI_SERIALDATE_TYPE_DAILY_0);
m_patternButtons.put(PatternType.NONE, m_patternButtons.get(PatternType.DAILY));
createAndAddButton(PatternType.WEEKLY, Messages.GUI_SERIALDATE_TYPE_WEEKLY_0);
createAndAddButton(PatternType.MONTHLY, Messages.GUI_SERIALDATE_TYPE_MONTHLY_0);
createAndAddButton(PatternType.YEARLY, Messages.GUI_SERIALDATE_TYPE_YEARLY_0);
// createAndAddButton(PatternType.INDIVIDUAL, Messages.GUI_SERIALDATE_TYPE_INDIVIDUAL_0);
m_groupPattern.addValueChangeHandler(new ValueChangeHandler<String>() {
public void onValueChange(ValueChangeEvent<String> event) {
if (handleChange()) {
String value = event.getValue();
if (value != null) {
m_controller.setPattern(value);
}
}
}
});
} | [
"private",
"void",
"initPatternButtonGroup",
"(",
")",
"{",
"m_groupPattern",
"=",
"new",
"CmsRadioButtonGroup",
"(",
")",
";",
"m_patternButtons",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"createAndAddButton",
"(",
"PatternType",
".",
"DAILY",
",",
"Messages... | Initialize the pattern choice button group. | [
"Initialize",
"the",
"pattern",
"choice",
"button",
"group",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateView.java#L711-L736 | train |
alkacon/opencms-core | src/org/opencms/ui/apps/CmsAppView.java | CmsAppView.injectAdditionalStyles | private void injectAdditionalStyles() {
try {
Collection<String> stylesheets = OpenCms.getWorkplaceAppManager().getAdditionalStyleSheets();
for (String stylesheet : stylesheets) {
A_CmsUI.get().getPage().addDependency(new Dependency(Type.STYLESHEET, stylesheet));
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
}
} | java | private void injectAdditionalStyles() {
try {
Collection<String> stylesheets = OpenCms.getWorkplaceAppManager().getAdditionalStyleSheets();
for (String stylesheet : stylesheets) {
A_CmsUI.get().getPage().addDependency(new Dependency(Type.STYLESHEET, stylesheet));
}
} catch (Exception e) {
LOG.warn(e.getLocalizedMessage(), e);
}
} | [
"private",
"void",
"injectAdditionalStyles",
"(",
")",
"{",
"try",
"{",
"Collection",
"<",
"String",
">",
"stylesheets",
"=",
"OpenCms",
".",
"getWorkplaceAppManager",
"(",
")",
".",
"getAdditionalStyleSheets",
"(",
")",
";",
"for",
"(",
"String",
"stylesheet",
... | Inject external stylesheets. | [
"Inject",
"external",
"stylesheets",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/CmsAppView.java#L396-L406 | train |
alkacon/opencms-core | src/org/opencms/ugc/CmsUgcActionElement.java | CmsUgcActionElement.createSessionForResource | public String createSessionForResource(String configPath, String fileName) throws CmsUgcException {
CmsUgcSession formSession = CmsUgcSessionFactory.getInstance().createSessionForFile(
getCmsObject(),
getRequest(),
configPath,
fileName);
return "" + formSession.getId();
} | java | public String createSessionForResource(String configPath, String fileName) throws CmsUgcException {
CmsUgcSession formSession = CmsUgcSessionFactory.getInstance().createSessionForFile(
getCmsObject(),
getRequest(),
configPath,
fileName);
return "" + formSession.getId();
} | [
"public",
"String",
"createSessionForResource",
"(",
"String",
"configPath",
",",
"String",
"fileName",
")",
"throws",
"CmsUgcException",
"{",
"CmsUgcSession",
"formSession",
"=",
"CmsUgcSessionFactory",
".",
"getInstance",
"(",
")",
".",
"createSessionForFile",
"(",
... | Creates a new form session to edit the file with the given name using the given form configuration.
@param configPath the site path of the form configuration
@param fileName the name (not path) of the XML content to edit
@return the id of the newly created form session
@throws CmsUgcException if something goes wrong | [
"Creates",
"a",
"new",
"form",
"session",
"to",
"edit",
"the",
"file",
"with",
"the",
"given",
"name",
"using",
"the",
"given",
"form",
"configuration",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcActionElement.java#L63-L71 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.setValue | public final void setValue(String value) {
if ((null == value) || value.isEmpty()) {
setDefaultValue();
} else {
try {
tryToSetParsedValue(value);
} catch (@SuppressWarnings("unused") Exception e) {
CmsDebugLog.consoleLog("Could not set invalid serial date value: " + value);
setDefaultValue();
}
}
notifyOnValueChange();
} | java | public final void setValue(String value) {
if ((null == value) || value.isEmpty()) {
setDefaultValue();
} else {
try {
tryToSetParsedValue(value);
} catch (@SuppressWarnings("unused") Exception e) {
CmsDebugLog.consoleLog("Could not set invalid serial date value: " + value);
setDefaultValue();
}
}
notifyOnValueChange();
} | [
"public",
"final",
"void",
"setValue",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"(",
"null",
"==",
"value",
")",
"||",
"value",
".",
"isEmpty",
"(",
")",
")",
"{",
"setDefaultValue",
"(",
")",
";",
"}",
"else",
"{",
"try",
"{",
"tryToSetParsedVal... | Set the value as provided.
@param value the serial date value as JSON string. | [
"Set",
"the",
"value",
"as",
"provided",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L75-L88 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.datesToJsonArray | private JSONValue datesToJsonArray(Collection<Date> dates) {
if (null != dates) {
JSONArray result = new JSONArray();
for (Date d : dates) {
result.set(result.size(), dateToJson(d));
}
return result;
}
return null;
} | java | private JSONValue datesToJsonArray(Collection<Date> dates) {
if (null != dates) {
JSONArray result = new JSONArray();
for (Date d : dates) {
result.set(result.size(), dateToJson(d));
}
return result;
}
return null;
} | [
"private",
"JSONValue",
"datesToJsonArray",
"(",
"Collection",
"<",
"Date",
">",
"dates",
")",
"{",
"if",
"(",
"null",
"!=",
"dates",
")",
"{",
"JSONArray",
"result",
"=",
"new",
"JSONArray",
"(",
")",
";",
"for",
"(",
"Date",
"d",
":",
"dates",
")",
... | Converts a collection of dates to a JSON array with the long representation of the dates as strings.
@param dates the list to convert.
@return JSON array with long values of dates as string | [
"Converts",
"a",
"collection",
"of",
"dates",
"to",
"a",
"JSON",
"array",
"with",
"the",
"long",
"representation",
"of",
"the",
"dates",
"as",
"strings",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L156-L166 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.dateToJson | private JSONValue dateToJson(Date d) {
return null != d ? new JSONString(Long.toString(d.getTime())) : null;
} | java | private JSONValue dateToJson(Date d) {
return null != d ? new JSONString(Long.toString(d.getTime())) : null;
} | [
"private",
"JSONValue",
"dateToJson",
"(",
"Date",
"d",
")",
"{",
"return",
"null",
"!=",
"d",
"?",
"new",
"JSONString",
"(",
"Long",
".",
"toString",
"(",
"d",
".",
"getTime",
"(",
")",
")",
")",
":",
"null",
";",
"}"
] | Convert a date to the String representation we use in the JSON.
@param d the date to convert
@return the String representation we use in the JSON. | [
"Convert",
"a",
"date",
"to",
"the",
"String",
"representation",
"we",
"use",
"in",
"the",
"JSON",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L173-L176 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.readOptionalBoolean | private Boolean readOptionalBoolean(JSONValue val) {
JSONBoolean b = null == val ? null : val.isBoolean();
if (b != null) {
return Boolean.valueOf(b.booleanValue());
}
return null;
} | java | private Boolean readOptionalBoolean(JSONValue val) {
JSONBoolean b = null == val ? null : val.isBoolean();
if (b != null) {
return Boolean.valueOf(b.booleanValue());
}
return null;
} | [
"private",
"Boolean",
"readOptionalBoolean",
"(",
"JSONValue",
"val",
")",
"{",
"JSONBoolean",
"b",
"=",
"null",
"==",
"val",
"?",
"null",
":",
"val",
".",
"isBoolean",
"(",
")",
";",
"if",
"(",
"b",
"!=",
"null",
")",
"{",
"return",
"Boolean",
".",
... | Read an optional boolean value form a JSON value.
@param val the JSON value that should represent the boolean.
@return the boolean from the JSON or null if reading the boolean fails. | [
"Read",
"an",
"optional",
"boolean",
"value",
"form",
"a",
"JSON",
"value",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L265-L272 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.readOptionalDate | private Date readOptionalDate(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
try {
return new Date(Long.parseLong(str.stringValue()));
} catch (@SuppressWarnings("unused") NumberFormatException e) {
// do nothing - return the default value
}
}
return null;
} | java | private Date readOptionalDate(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
try {
return new Date(Long.parseLong(str.stringValue()));
} catch (@SuppressWarnings("unused") NumberFormatException e) {
// do nothing - return the default value
}
}
return null;
} | [
"private",
"Date",
"readOptionalDate",
"(",
"JSONValue",
"val",
")",
"{",
"JSONString",
"str",
"=",
"null",
"==",
"val",
"?",
"null",
":",
"val",
".",
"isString",
"(",
")",
";",
"if",
"(",
"str",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"new",
... | Read an optional Date value form a JSON value.
@param val the JSON value that should represent the Date as long value in a string.
@return the Date from the JSON or null if reading the date fails. | [
"Read",
"an",
"optional",
"Date",
"value",
"form",
"a",
"JSON",
"value",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L279-L290 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.readOptionalInt | private int readOptionalInt(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
try {
return Integer.valueOf(str.stringValue()).intValue();
} catch (@SuppressWarnings("unused") NumberFormatException e) {
// Do nothing, return default value
}
}
return 0;
} | java | private int readOptionalInt(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
try {
return Integer.valueOf(str.stringValue()).intValue();
} catch (@SuppressWarnings("unused") NumberFormatException e) {
// Do nothing, return default value
}
}
return 0;
} | [
"private",
"int",
"readOptionalInt",
"(",
"JSONValue",
"val",
")",
"{",
"JSONString",
"str",
"=",
"null",
"==",
"val",
"?",
"null",
":",
"val",
".",
"isString",
"(",
")",
";",
"if",
"(",
"str",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"Integer",... | Read an optional int value form a JSON value.
@param val the JSON value that should represent the int.
@return the int from the JSON or 0 reading the int fails. | [
"Read",
"an",
"optional",
"int",
"value",
"form",
"a",
"JSON",
"value",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L297-L308 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.readOptionalMonth | private Month readOptionalMonth(JSONValue val) {
String str = readOptionalString(val);
if (null != str) {
try {
return Month.valueOf(str);
} catch (@SuppressWarnings("unused") IllegalArgumentException e) {
// Do nothing -return the default value
}
}
return null;
} | java | private Month readOptionalMonth(JSONValue val) {
String str = readOptionalString(val);
if (null != str) {
try {
return Month.valueOf(str);
} catch (@SuppressWarnings("unused") IllegalArgumentException e) {
// Do nothing -return the default value
}
}
return null;
} | [
"private",
"Month",
"readOptionalMonth",
"(",
"JSONValue",
"val",
")",
"{",
"String",
"str",
"=",
"readOptionalString",
"(",
"val",
")",
";",
"if",
"(",
"null",
"!=",
"str",
")",
"{",
"try",
"{",
"return",
"Month",
".",
"valueOf",
"(",
"str",
")",
";",... | Read an optional month value form a JSON value.
@param val the JSON value that should represent the month.
@return the month from the JSON or null if reading the month fails. | [
"Read",
"an",
"optional",
"month",
"value",
"form",
"a",
"JSON",
"value",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L315-L326 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.readOptionalString | private String readOptionalString(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
return str.stringValue();
}
return null;
} | java | private String readOptionalString(JSONValue val) {
JSONString str = null == val ? null : val.isString();
if (str != null) {
return str.stringValue();
}
return null;
} | [
"private",
"String",
"readOptionalString",
"(",
"JSONValue",
"val",
")",
"{",
"JSONString",
"str",
"=",
"null",
"==",
"val",
"?",
"null",
":",
"val",
".",
"isString",
"(",
")",
";",
"if",
"(",
"str",
"!=",
"null",
")",
"{",
"return",
"str",
".",
"str... | Read an optional string value form a JSON value.
@param val the JSON value that should represent the string.
@return the string from the JSON or null if reading the string fails. | [
"Read",
"an",
"optional",
"string",
"value",
"form",
"a",
"JSON",
"value",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L333-L340 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.readWeekDay | private WeekDay readWeekDay(JSONValue val) throws IllegalArgumentException {
String str = readOptionalString(val);
if (null != str) {
return WeekDay.valueOf(str);
}
throw new IllegalArgumentException();
} | java | private WeekDay readWeekDay(JSONValue val) throws IllegalArgumentException {
String str = readOptionalString(val);
if (null != str) {
return WeekDay.valueOf(str);
}
throw new IllegalArgumentException();
} | [
"private",
"WeekDay",
"readWeekDay",
"(",
"JSONValue",
"val",
")",
"throws",
"IllegalArgumentException",
"{",
"String",
"str",
"=",
"readOptionalString",
"(",
"val",
")",
";",
"if",
"(",
"null",
"!=",
"str",
")",
"{",
"return",
"WeekDay",
".",
"valueOf",
"("... | Read a single weekday from the provided JSON value.
@param val the value to read the week day from.
@return the week day read
@throws IllegalArgumentException thrown if the provided JSON value is not the representation of a week day. | [
"Read",
"a",
"single",
"weekday",
"from",
"the",
"provided",
"JSON",
"value",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L401-L408 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.toJsonStringList | private JSONValue toJsonStringList(Collection<? extends Object> list) {
if (null != list) {
JSONArray array = new JSONArray();
for (Object o : list) {
array.set(array.size(), new JSONString(o.toString()));
}
return array;
} else {
return null;
}
} | java | private JSONValue toJsonStringList(Collection<? extends Object> list) {
if (null != list) {
JSONArray array = new JSONArray();
for (Object o : list) {
array.set(array.size(), new JSONString(o.toString()));
}
return array;
} else {
return null;
}
} | [
"private",
"JSONValue",
"toJsonStringList",
"(",
"Collection",
"<",
"?",
"extends",
"Object",
">",
"list",
")",
"{",
"if",
"(",
"null",
"!=",
"list",
")",
"{",
"JSONArray",
"array",
"=",
"new",
"JSONArray",
"(",
")",
";",
"for",
"(",
"Object",
"o",
":"... | Convert a list of objects to a JSON array with the string representations of that objects.
@param list the list of objects.
@return the JSON array with the string representations. | [
"Convert",
"a",
"list",
"of",
"objects",
"to",
"a",
"JSON",
"array",
"with",
"the",
"string",
"representations",
"of",
"that",
"objects",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L461-L472 | train |
alkacon/opencms-core | src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java | CmsSerialDateValue.tryToSetParsedValue | private void tryToSetParsedValue(String value) throws Exception {
JSONObject json = JSONParser.parseStrict(value).isObject();
JSONValue val = json.get(JsonKey.START);
setStart(readOptionalDate(val));
val = json.get(JsonKey.END);
setEnd(readOptionalDate(val));
setWholeDay(readOptionalBoolean(json.get(JsonKey.WHOLE_DAY)));
JSONObject patternJson = json.get(JsonKey.PATTERN).isObject();
readPattern(patternJson);
setExceptions(readDates(json.get(JsonKey.EXCEPTIONS)));
setSeriesEndDate(readOptionalDate(json.get(JsonKey.SERIES_ENDDATE)));
setOccurrences(readOptionalInt(json.get(JsonKey.SERIES_OCCURRENCES)));
setDerivedEndType();
setCurrentTillEnd(readOptionalBoolean(json.get(JsonKey.CURRENT_TILL_END)));
setParentSeriesId(readOptionalUUID(json.get(JsonKey.PARENT_SERIES)));
} | java | private void tryToSetParsedValue(String value) throws Exception {
JSONObject json = JSONParser.parseStrict(value).isObject();
JSONValue val = json.get(JsonKey.START);
setStart(readOptionalDate(val));
val = json.get(JsonKey.END);
setEnd(readOptionalDate(val));
setWholeDay(readOptionalBoolean(json.get(JsonKey.WHOLE_DAY)));
JSONObject patternJson = json.get(JsonKey.PATTERN).isObject();
readPattern(patternJson);
setExceptions(readDates(json.get(JsonKey.EXCEPTIONS)));
setSeriesEndDate(readOptionalDate(json.get(JsonKey.SERIES_ENDDATE)));
setOccurrences(readOptionalInt(json.get(JsonKey.SERIES_OCCURRENCES)));
setDerivedEndType();
setCurrentTillEnd(readOptionalBoolean(json.get(JsonKey.CURRENT_TILL_END)));
setParentSeriesId(readOptionalUUID(json.get(JsonKey.PARENT_SERIES)));
} | [
"private",
"void",
"tryToSetParsedValue",
"(",
"String",
"value",
")",
"throws",
"Exception",
"{",
"JSONObject",
"json",
"=",
"JSONParser",
".",
"parseStrict",
"(",
"value",
")",
".",
"isObject",
"(",
")",
";",
"JSONValue",
"val",
"=",
"json",
".",
"get",
... | Try to set the value from the provided Json string.
@param value the value to set.
@throws Exception thrown if parsing fails. | [
"Try",
"to",
"set",
"the",
"value",
"from",
"the",
"provided",
"Json",
"string",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsSerialDateValue.java#L479-L496 | train |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java | CmsJspCategoryAccessBean.getCategories | private static List<CmsCategory> getCategories(CmsObject cms, CmsResource resource) {
if ((null != resource) && (null != cms)) {
try {
return CmsCategoryService.getInstance().readResourceCategories(cms, resource);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
return new ArrayList<CmsCategory>(0);
} | java | private static List<CmsCategory> getCategories(CmsObject cms, CmsResource resource) {
if ((null != resource) && (null != cms)) {
try {
return CmsCategoryService.getInstance().readResourceCategories(cms, resource);
} catch (CmsException e) {
LOG.error(e.getLocalizedMessage(), e);
}
}
return new ArrayList<CmsCategory>(0);
} | [
"private",
"static",
"List",
"<",
"CmsCategory",
">",
"getCategories",
"(",
"CmsObject",
"cms",
",",
"CmsResource",
"resource",
")",
"{",
"if",
"(",
"(",
"null",
"!=",
"resource",
")",
"&&",
"(",
"null",
"!=",
"cms",
")",
")",
"{",
"try",
"{",
"return"... | Reads the categories for the given resource.
@param cms the {@link CmsObject} used for reading the categories.
@param resource the resource for which the categories should be read.
@return the categories assigned to the given resource. | [
"Reads",
"the",
"categories",
"for",
"the",
"given",
"resource",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java#L113-L123 | train |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java | CmsJspCategoryAccessBean.getLeafItems | public List<CmsCategory> getLeafItems() {
List<CmsCategory> result = new ArrayList<CmsCategory>();
if (m_categories.isEmpty()) {
return result;
}
Iterator<CmsCategory> it = m_categories.iterator();
CmsCategory current = it.next();
while (it.hasNext()) {
CmsCategory next = it.next();
if (!next.getPath().startsWith(current.getPath())) {
result.add(current);
}
current = next;
}
result.add(current);
return result;
} | java | public List<CmsCategory> getLeafItems() {
List<CmsCategory> result = new ArrayList<CmsCategory>();
if (m_categories.isEmpty()) {
return result;
}
Iterator<CmsCategory> it = m_categories.iterator();
CmsCategory current = it.next();
while (it.hasNext()) {
CmsCategory next = it.next();
if (!next.getPath().startsWith(current.getPath())) {
result.add(current);
}
current = next;
}
result.add(current);
return result;
} | [
"public",
"List",
"<",
"CmsCategory",
">",
"getLeafItems",
"(",
")",
"{",
"List",
"<",
"CmsCategory",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"CmsCategory",
">",
"(",
")",
";",
"if",
"(",
"m_categories",
".",
"isEmpty",
"(",
")",
")",
"{",
"return... | Returns only the leaf categories of the wrapped categories.
The method assumes that categories are ordered in the list, i.e., parents are directly followed by their children.
NOTE: In the complete category tree a leaf of the wrapped tree part may not be a leaf.
@return only the leaf categories of the wrapped categories. | [
"Returns",
"only",
"the",
"leaf",
"categories",
"of",
"the",
"wrapped",
"categories",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java#L154-L171 | train |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java | CmsJspCategoryAccessBean.getSubCategories | public Map<String, CmsJspCategoryAccessBean> getSubCategories() {
if (m_subCategories == null) {
m_subCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {
@SuppressWarnings("synthetic-access")
public Object transform(Object pathPrefix) {
return new CmsJspCategoryAccessBean(m_cms, m_categories, (String)pathPrefix);
}
});
}
return m_subCategories;
} | java | public Map<String, CmsJspCategoryAccessBean> getSubCategories() {
if (m_subCategories == null) {
m_subCategories = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() {
@SuppressWarnings("synthetic-access")
public Object transform(Object pathPrefix) {
return new CmsJspCategoryAccessBean(m_cms, m_categories, (String)pathPrefix);
}
});
}
return m_subCategories;
} | [
"public",
"Map",
"<",
"String",
",",
"CmsJspCategoryAccessBean",
">",
"getSubCategories",
"(",
")",
"{",
"if",
"(",
"m_subCategories",
"==",
"null",
")",
"{",
"m_subCategories",
"=",
"CmsCollectionsGenericWrapper",
".",
"createLazyMap",
"(",
"new",
"Transformer",
... | Returns a map from a category path to the wrapper of all the sub-categories of the category with the path given as key.
@return a map from a category path to all sub-categories of the path's category. | [
"Returns",
"a",
"map",
"from",
"a",
"category",
"path",
"to",
"the",
"wrapper",
"of",
"all",
"the",
"sub",
"-",
"categories",
"of",
"the",
"category",
"with",
"the",
"path",
"given",
"as",
"key",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java#L178-L192 | train |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java | CmsJspCategoryAccessBean.getTopItems | public List<CmsCategory> getTopItems() {
List<CmsCategory> categories = new ArrayList<CmsCategory>();
String matcher = Pattern.quote(m_mainCategoryPath) + "[^/]*/";
for (CmsCategory category : m_categories) {
if (category.getPath().matches(matcher)) {
categories.add(category);
}
}
return categories;
} | java | public List<CmsCategory> getTopItems() {
List<CmsCategory> categories = new ArrayList<CmsCategory>();
String matcher = Pattern.quote(m_mainCategoryPath) + "[^/]*/";
for (CmsCategory category : m_categories) {
if (category.getPath().matches(matcher)) {
categories.add(category);
}
}
return categories;
} | [
"public",
"List",
"<",
"CmsCategory",
">",
"getTopItems",
"(",
")",
"{",
"List",
"<",
"CmsCategory",
">",
"categories",
"=",
"new",
"ArrayList",
"<",
"CmsCategory",
">",
"(",
")",
";",
"String",
"matcher",
"=",
"Pattern",
".",
"quote",
"(",
"m_mainCategory... | Returns all categories that are direct children of the current main category.
@return all categories that are direct children of the current main category. | [
"Returns",
"all",
"categories",
"that",
"are",
"direct",
"children",
"of",
"the",
"current",
"main",
"category",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspCategoryAccessBean.java#L199-L209 | train |
alkacon/opencms-core | src/org/opencms/jsp/util/CmsJspImageBean.java | CmsJspImageBean.addHiDpiImage | public void addHiDpiImage(String factor, CmsJspImageBean image) {
if (m_hiDpiImages == null) {
m_hiDpiImages = CmsCollectionsGenericWrapper.createLazyMap(new CmsScaleHiDpiTransformer());
}
m_hiDpiImages.put(factor, image);
} | java | public void addHiDpiImage(String factor, CmsJspImageBean image) {
if (m_hiDpiImages == null) {
m_hiDpiImages = CmsCollectionsGenericWrapper.createLazyMap(new CmsScaleHiDpiTransformer());
}
m_hiDpiImages.put(factor, image);
} | [
"public",
"void",
"addHiDpiImage",
"(",
"String",
"factor",
",",
"CmsJspImageBean",
"image",
")",
"{",
"if",
"(",
"m_hiDpiImages",
"==",
"null",
")",
"{",
"m_hiDpiImages",
"=",
"CmsCollectionsGenericWrapper",
".",
"createLazyMap",
"(",
"new",
"CmsScaleHiDpiTransform... | adds a CmsJspImageBean as hi-DPI variant to this image
@param factor the variant multiplier, e.g. "2x" (the common retina multiplier)
@param image the image to be used for this variant | [
"adds",
"a",
"CmsJspImageBean",
"as",
"hi",
"-",
"DPI",
"variant",
"to",
"this",
"image"
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/util/CmsJspImageBean.java#L362-L368 | train |
alkacon/opencms-core | src/org/opencms/search/galleries/CmsGallerySearchResult.java | CmsGallerySearchResult.getRequiredSolrFields | public static final String[] getRequiredSolrFields() {
if (null == m_requiredSolrFields) {
List<Locale> locales = OpenCms.getLocaleManager().getAvailableLocales();
m_requiredSolrFields = new String[14 + (locales.size() * 6)];
int count = 0;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_PATH;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_TYPE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_CREATED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_LASTMODIFIED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_EXPIRED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_RELEASED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_SIZE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_STATE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_USER_CREATED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_ID;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_USER_LAST_MODIFIED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_ADDITIONAL_INFO;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_CONTAINER_TYPES;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_RESOURCE_LOCALES;
for (Locale locale : locales) {
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsSearchField.FIELD_TITLE_UNSTORED,
locale.toString()) + "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsPropertyDefinition.PROPERTY_TITLE,
locale.toString()) + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT + "_s";
m_requiredSolrFields[count++] = CmsPropertyDefinition.PROPERTY_TITLE
+ CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT
+ "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsSearchField.FIELD_DESCRIPTION,
locale.toString()) + "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsPropertyDefinition.PROPERTY_DESCRIPTION,
locale.toString()) + CmsSearchField.FIELD_DYNAMIC_PROPERTIES + "_s";
m_requiredSolrFields[count++] = CmsPropertyDefinition.PROPERTY_DESCRIPTION
+ CmsSearchField.FIELD_DYNAMIC_PROPERTIES
+ "_s";
}
}
return m_requiredSolrFields;
} | java | public static final String[] getRequiredSolrFields() {
if (null == m_requiredSolrFields) {
List<Locale> locales = OpenCms.getLocaleManager().getAvailableLocales();
m_requiredSolrFields = new String[14 + (locales.size() * 6)];
int count = 0;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_PATH;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_TYPE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_CREATED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_LASTMODIFIED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_EXPIRED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_DATE_RELEASED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_SIZE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_STATE;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_USER_CREATED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_ID;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_USER_LAST_MODIFIED;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_ADDITIONAL_INFO;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_CONTAINER_TYPES;
m_requiredSolrFields[count++] = CmsSearchField.FIELD_RESOURCE_LOCALES;
for (Locale locale : locales) {
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsSearchField.FIELD_TITLE_UNSTORED,
locale.toString()) + "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsPropertyDefinition.PROPERTY_TITLE,
locale.toString()) + CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT + "_s";
m_requiredSolrFields[count++] = CmsPropertyDefinition.PROPERTY_TITLE
+ CmsSearchField.FIELD_DYNAMIC_PROPERTIES_DIRECT
+ "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsSearchField.FIELD_DESCRIPTION,
locale.toString()) + "_s";
m_requiredSolrFields[count++] = CmsSearchFieldConfiguration.getLocaleExtendedName(
CmsPropertyDefinition.PROPERTY_DESCRIPTION,
locale.toString()) + CmsSearchField.FIELD_DYNAMIC_PROPERTIES + "_s";
m_requiredSolrFields[count++] = CmsPropertyDefinition.PROPERTY_DESCRIPTION
+ CmsSearchField.FIELD_DYNAMIC_PROPERTIES
+ "_s";
}
}
return m_requiredSolrFields;
} | [
"public",
"static",
"final",
"String",
"[",
"]",
"getRequiredSolrFields",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"m_requiredSolrFields",
")",
"{",
"List",
"<",
"Locale",
">",
"locales",
"=",
"OpenCms",
".",
"getLocaleManager",
"(",
")",
".",
"getAvailableLo... | Returns the list of Solr fields a search result must have to initialize the gallery search result correctly.
@return the list of Solr fields. | [
"Returns",
"the",
"list",
"of",
"Solr",
"fields",
"a",
"search",
"result",
"must",
"have",
"to",
"initialize",
"the",
"gallery",
"search",
"result",
"correctly",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/galleries/CmsGallerySearchResult.java#L297-L339 | train |
alkacon/opencms-core | src/org/opencms/ui/favorites/CmsPageEditorFavoriteContext.java | CmsPageEditorFavoriteContext.toUuid | private static CmsUUID toUuid(String uuid) {
if ("null".equals(uuid) || CmsStringUtil.isEmpty(uuid)) {
return null;
}
return new CmsUUID(uuid);
} | java | private static CmsUUID toUuid(String uuid) {
if ("null".equals(uuid) || CmsStringUtil.isEmpty(uuid)) {
return null;
}
return new CmsUUID(uuid);
} | [
"private",
"static",
"CmsUUID",
"toUuid",
"(",
"String",
"uuid",
")",
"{",
"if",
"(",
"\"null\"",
".",
"equals",
"(",
"uuid",
")",
"||",
"CmsStringUtil",
".",
"isEmpty",
"(",
"uuid",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"CmsUUID"... | Converts string to UUID and returns it, or null if the conversion is not possible.
@param uuid the potential UUID string
@return the UUID, or null if conversion is not possible | [
"Converts",
"string",
"to",
"UUID",
"and",
"returns",
"it",
"or",
"null",
"if",
"the",
"conversion",
"is",
"not",
"possible",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/favorites/CmsPageEditorFavoriteContext.java#L85-L92 | train |
alkacon/opencms-core | src/org/opencms/search/CmsSearchManager.java | CmsSearchManager.ensureIndexIsUnlocked | private void ensureIndexIsUnlocked(String dataDir) {
Collection<File> lockFiles = new ArrayList<File>(2);
lockFiles.add(
new File(
CmsFileUtil.addTrailingSeparator(CmsFileUtil.addTrailingSeparator(dataDir) + "index") + "write.lock"));
lockFiles.add(
new File(
CmsFileUtil.addTrailingSeparator(CmsFileUtil.addTrailingSeparator(dataDir) + "spellcheck")
+ "write.lock"));
for (File lockFile : lockFiles) {
if (lockFile.exists()) {
lockFile.delete();
LOG.warn(
"Forcely unlocking index with data dir \""
+ dataDir
+ "\" by removing file \""
+ lockFile.getAbsolutePath()
+ "\".");
}
}
} | java | private void ensureIndexIsUnlocked(String dataDir) {
Collection<File> lockFiles = new ArrayList<File>(2);
lockFiles.add(
new File(
CmsFileUtil.addTrailingSeparator(CmsFileUtil.addTrailingSeparator(dataDir) + "index") + "write.lock"));
lockFiles.add(
new File(
CmsFileUtil.addTrailingSeparator(CmsFileUtil.addTrailingSeparator(dataDir) + "spellcheck")
+ "write.lock"));
for (File lockFile : lockFiles) {
if (lockFile.exists()) {
lockFile.delete();
LOG.warn(
"Forcely unlocking index with data dir \""
+ dataDir
+ "\" by removing file \""
+ lockFile.getAbsolutePath()
+ "\".");
}
}
} | [
"private",
"void",
"ensureIndexIsUnlocked",
"(",
"String",
"dataDir",
")",
"{",
"Collection",
"<",
"File",
">",
"lockFiles",
"=",
"new",
"ArrayList",
"<",
"File",
">",
"(",
"2",
")",
";",
"lockFiles",
".",
"add",
"(",
"new",
"File",
"(",
"CmsFileUtil",
"... | Remove write.lock file in the data directory to ensure the index is unlocked.
@param dataDir the data directory of the Solr index that should be unlocked. | [
"Remove",
"write",
".",
"lock",
"file",
"in",
"the",
"data",
"directory",
"to",
"ensure",
"the",
"index",
"is",
"unlocked",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/search/CmsSearchManager.java#L3157-L3178 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsScrollPanelImpl.java | CmsScrollPanelImpl.maybeUpdateScrollbarPositions | private void maybeUpdateScrollbarPositions() {
if (!isAttached()) {
return;
}
if (m_scrollbar != null) {
int vPos = getVerticalScrollPosition();
if (m_scrollbar.getVerticalScrollPosition() != vPos) {
m_scrollbar.setVerticalScrollPosition(vPos);
}
}
} | java | private void maybeUpdateScrollbarPositions() {
if (!isAttached()) {
return;
}
if (m_scrollbar != null) {
int vPos = getVerticalScrollPosition();
if (m_scrollbar.getVerticalScrollPosition() != vPos) {
m_scrollbar.setVerticalScrollPosition(vPos);
}
}
} | [
"private",
"void",
"maybeUpdateScrollbarPositions",
"(",
")",
"{",
"if",
"(",
"!",
"isAttached",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"m_scrollbar",
"!=",
"null",
")",
"{",
"int",
"vPos",
"=",
"getVerticalScrollPosition",
"(",
")",
";",
"if... | Synchronize the scroll positions of the scrollbars with the actual scroll
position of the content. | [
"Synchronize",
"the",
"scroll",
"positions",
"of",
"the",
"scrollbars",
"with",
"the",
"actual",
"scroll",
"position",
"of",
"the",
"content",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsScrollPanelImpl.java#L351-L363 | train |
alkacon/opencms-core | src-gwt/org/opencms/gwt/client/ui/CmsScrollPanelImpl.java | CmsScrollPanelImpl.setVerticalScrollbar | private void setVerticalScrollbar(final CmsScrollBar scrollbar, int width) {
// Validate.
if ((scrollbar == m_scrollbar) || (scrollbar == null)) {
return;
}
// Detach new child.
scrollbar.asWidget().removeFromParent();
// Remove old child.
if (m_scrollbar != null) {
if (m_verticalScrollbarHandlerRegistration != null) {
m_verticalScrollbarHandlerRegistration.removeHandler();
m_verticalScrollbarHandlerRegistration = null;
}
remove(m_scrollbar);
}
m_scrollLayer.appendChild(scrollbar.asWidget().getElement());
adopt(scrollbar.asWidget());
// Logical attach.
m_scrollbar = scrollbar;
m_verticalScrollbarWidth = width;
// Initialize the new scrollbar.
m_verticalScrollbarHandlerRegistration = scrollbar.addValueChangeHandler(new ValueChangeHandler<Integer>() {
public void onValueChange(ValueChangeEvent<Integer> event) {
int vPos = scrollbar.getVerticalScrollPosition();
int v = getVerticalScrollPosition();
if (v != vPos) {
setVerticalScrollPosition(vPos);
}
}
});
maybeUpdateScrollbars();
} | java | private void setVerticalScrollbar(final CmsScrollBar scrollbar, int width) {
// Validate.
if ((scrollbar == m_scrollbar) || (scrollbar == null)) {
return;
}
// Detach new child.
scrollbar.asWidget().removeFromParent();
// Remove old child.
if (m_scrollbar != null) {
if (m_verticalScrollbarHandlerRegistration != null) {
m_verticalScrollbarHandlerRegistration.removeHandler();
m_verticalScrollbarHandlerRegistration = null;
}
remove(m_scrollbar);
}
m_scrollLayer.appendChild(scrollbar.asWidget().getElement());
adopt(scrollbar.asWidget());
// Logical attach.
m_scrollbar = scrollbar;
m_verticalScrollbarWidth = width;
// Initialize the new scrollbar.
m_verticalScrollbarHandlerRegistration = scrollbar.addValueChangeHandler(new ValueChangeHandler<Integer>() {
public void onValueChange(ValueChangeEvent<Integer> event) {
int vPos = scrollbar.getVerticalScrollPosition();
int v = getVerticalScrollPosition();
if (v != vPos) {
setVerticalScrollPosition(vPos);
}
}
});
maybeUpdateScrollbars();
} | [
"private",
"void",
"setVerticalScrollbar",
"(",
"final",
"CmsScrollBar",
"scrollbar",
",",
"int",
"width",
")",
"{",
"// Validate.\r",
"if",
"(",
"(",
"scrollbar",
"==",
"m_scrollbar",
")",
"||",
"(",
"scrollbar",
"==",
"null",
")",
")",
"{",
"return",
";",
... | Set the scrollbar used for vertical scrolling.
@param scrollbar the scrollbar, or null to clear it
@param width the width of the scrollbar in pixels | [
"Set",
"the",
"scrollbar",
"used",
"for",
"vertical",
"scrolling",
"."
] | bc104acc75d2277df5864da939a1f2de5fdee504 | https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsScrollPanelImpl.java#L416-L454 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.