id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
152,500
|
microfocus-idol/java-idol-user-service
|
src/main/java/com/hp/autonomy/user/UserServiceImpl.java
|
UserServiceImpl.createUsernameRolesMap
|
private Map<String, List<String>> createUsernameRolesMap(final Iterable<String> roleList) {
final Map<String, List<String>> usersRolesMap = new HashMap<>();
for (final String role : roleList) {
for (final String user : getUsersWithRole(role)) {
if (usersRolesMap.containsKey(user)) {
if (!usersRolesMap.get(user).contains(role)) {
usersRolesMap.get(user).add(role);
}
} else {
final List<String> list = new ArrayList<>(Collections.singletonList(role));
usersRolesMap.put(user, list);
}
}
}
return usersRolesMap;
}
|
java
|
private Map<String, List<String>> createUsernameRolesMap(final Iterable<String> roleList) {
final Map<String, List<String>> usersRolesMap = new HashMap<>();
for (final String role : roleList) {
for (final String user : getUsersWithRole(role)) {
if (usersRolesMap.containsKey(user)) {
if (!usersRolesMap.get(user).contains(role)) {
usersRolesMap.get(user).add(role);
}
} else {
final List<String> list = new ArrayList<>(Collections.singletonList(role));
usersRolesMap.put(user, list);
}
}
}
return usersRolesMap;
}
|
[
"private",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"createUsernameRolesMap",
"(",
"final",
"Iterable",
"<",
"String",
">",
"roleList",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"usersRolesMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"String",
"role",
":",
"roleList",
")",
"{",
"for",
"(",
"final",
"String",
"user",
":",
"getUsersWithRole",
"(",
"role",
")",
")",
"{",
"if",
"(",
"usersRolesMap",
".",
"containsKey",
"(",
"user",
")",
")",
"{",
"if",
"(",
"!",
"usersRolesMap",
".",
"get",
"(",
"user",
")",
".",
"contains",
"(",
"role",
")",
")",
"{",
"usersRolesMap",
".",
"get",
"(",
"user",
")",
".",
"add",
"(",
"role",
")",
";",
"}",
"}",
"else",
"{",
"final",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"Collections",
".",
"singletonList",
"(",
"role",
")",
")",
";",
"usersRolesMap",
".",
"put",
"(",
"user",
",",
"list",
")",
";",
"}",
"}",
"}",
"return",
"usersRolesMap",
";",
"}"
] |
and only the roles contained in the roleList are included in the role lists.
|
[
"and",
"only",
"the",
"roles",
"contained",
"in",
"the",
"roleList",
"are",
"included",
"in",
"the",
"role",
"lists",
"."
] |
8eb5d00b3359b69891893c54f8201c16e7910322
|
https://github.com/microfocus-idol/java-idol-user-service/blob/8eb5d00b3359b69891893c54f8201c16e7910322/src/main/java/com/hp/autonomy/user/UserServiceImpl.java#L341-L358
|
152,501
|
microfocus-idol/java-idol-user-service
|
src/main/java/com/hp/autonomy/user/UserServiceImpl.java
|
UserServiceImpl.retainExistingRoles
|
private Iterable<String> retainExistingRoles(final Collection<String> roles) {
final List<String> existingRoles = getRoles();
existingRoles.retainAll(roles);
return existingRoles;
}
|
java
|
private Iterable<String> retainExistingRoles(final Collection<String> roles) {
final List<String> existingRoles = getRoles();
existingRoles.retainAll(roles);
return existingRoles;
}
|
[
"private",
"Iterable",
"<",
"String",
">",
"retainExistingRoles",
"(",
"final",
"Collection",
"<",
"String",
">",
"roles",
")",
"{",
"final",
"List",
"<",
"String",
">",
"existingRoles",
"=",
"getRoles",
"(",
")",
";",
"existingRoles",
".",
"retainAll",
"(",
"roles",
")",
";",
"return",
"existingRoles",
";",
"}"
] |
Returns a list of roles present in both the roles parameter and in community
|
[
"Returns",
"a",
"list",
"of",
"roles",
"present",
"in",
"both",
"the",
"roles",
"parameter",
"and",
"in",
"community"
] |
8eb5d00b3359b69891893c54f8201c16e7910322
|
https://github.com/microfocus-idol/java-idol-user-service/blob/8eb5d00b3359b69891893c54f8201c16e7910322/src/main/java/com/hp/autonomy/user/UserServiceImpl.java#L361-L365
|
152,502
|
inkstand-io/scribble
|
scribble-file/src/main/java/io/inkstand/scribble/rules/builder/ZipFileBuilder.java
|
ZipFileBuilder.addClasspathResource
|
public ZipFileBuilder addClasspathResource(final String zipEntryPath, final String pathToResource) {
final Class<?> callerClass = getCallerClass();
final URL resource = resolver.resolve(pathToResource, callerClass);
addResource(zipEntryPath, resource);
return this;
}
|
java
|
public ZipFileBuilder addClasspathResource(final String zipEntryPath, final String pathToResource) {
final Class<?> callerClass = getCallerClass();
final URL resource = resolver.resolve(pathToResource, callerClass);
addResource(zipEntryPath, resource);
return this;
}
|
[
"public",
"ZipFileBuilder",
"addClasspathResource",
"(",
"final",
"String",
"zipEntryPath",
",",
"final",
"String",
"pathToResource",
")",
"{",
"final",
"Class",
"<",
"?",
">",
"callerClass",
"=",
"getCallerClass",
"(",
")",
";",
"final",
"URL",
"resource",
"=",
"resolver",
".",
"resolve",
"(",
"pathToResource",
",",
"callerClass",
")",
";",
"addResource",
"(",
"zipEntryPath",
",",
"resource",
")",
";",
"return",
"this",
";",
"}"
] |
Adds an entry to the zip file from a classpath resource.
@param zipEntryPath
the path of the entry in the zip file. If the path denotes a path (ends with '/') the resource is put
under its own name on that location. If it denotes a file, it will be put as this file into the zip. Note
that even if the path ist defined absolute, starting with a '/', the created entry in the zip file won't
start with a '/'
@param pathToResource
the path to the resource in the classpath
@return this builder
|
[
"Adds",
"an",
"entry",
"to",
"the",
"zip",
"file",
"from",
"a",
"classpath",
"resource",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-file/src/main/java/io/inkstand/scribble/rules/builder/ZipFileBuilder.java#L68-L74
|
152,503
|
inkstand-io/scribble
|
scribble-file/src/main/java/io/inkstand/scribble/rules/builder/ZipFileBuilder.java
|
ZipFileBuilder.addResource
|
public ZipFileBuilder addResource(String zipEntryPath, URL resource) {
this.entryMap.put(zipEntryPath, resource);
return this;
}
|
java
|
public ZipFileBuilder addResource(String zipEntryPath, URL resource) {
this.entryMap.put(zipEntryPath, resource);
return this;
}
|
[
"public",
"ZipFileBuilder",
"addResource",
"(",
"String",
"zipEntryPath",
",",
"URL",
"resource",
")",
"{",
"this",
".",
"entryMap",
".",
"put",
"(",
"zipEntryPath",
",",
"resource",
")",
";",
"return",
"this",
";",
"}"
] |
Adds a resource to the Zip File under the path specified.
@param zipEntryPath
the path to the entry in the zip file
@param resource
the resource providing the content for the path. If an empty directory should be added, this value must
@return this builder
|
[
"Adds",
"a",
"resource",
"to",
"the",
"Zip",
"File",
"under",
"the",
"path",
"specified",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-file/src/main/java/io/inkstand/scribble/rules/builder/ZipFileBuilder.java#L86-L90
|
152,504
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/WaitForFieldChangeHandler.java
|
WaitForFieldChangeHandler.fieldChanged
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
if (m_bWaiting)
{
synchronized (this)
{
m_bWaiting = false;
this.notify();
}
}
return super.fieldChanged(bDisplayOption, iMoveMode);
}
|
java
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
if (m_bWaiting)
{
synchronized (this)
{
m_bWaiting = false;
this.notify();
}
}
return super.fieldChanged(bDisplayOption, iMoveMode);
}
|
[
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"m_bWaiting",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"m_bWaiting",
"=",
"false",
";",
"this",
".",
"notify",
"(",
")",
";",
"}",
"}",
"return",
"super",
".",
"fieldChanged",
"(",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] |
The Field has Changed.
Don't need to call inherited.
@param bDisplayOption If true, display the change.
@param iMoveMode The type of move being done (init/read/screen).
@return The error code (or NORMAL_RETURN if okay).
|
[
"The",
"Field",
"has",
"Changed",
".",
"Don",
"t",
"need",
"to",
"call",
"inherited",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/WaitForFieldChangeHandler.java#L108-L119
|
152,505
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/WaitForFieldChangeHandler.java
|
WaitForFieldChangeHandler.waitForChange
|
public int waitForChange()
{
if (m_lTimeOut <= 0)
return TIMEOUT_ERROR; // Timed out
m_bWaiting = false;
synchronized(this)
{
long lStartTime = System.currentTimeMillis();
try {
m_bWaiting = true;
this.wait(m_lTimeOut);
} catch (InterruptedException e) {
e.printStackTrace();
}
m_lTimeOut = m_lTimeOut - (System.currentTimeMillis() - lStartTime);
}
if (m_bWaiting == false)
return DBConstants.NORMAL_RETURN; // Was interrupted by a field change
m_bWaiting = false;
return TIMEOUT_ERROR; // Timed out
}
|
java
|
public int waitForChange()
{
if (m_lTimeOut <= 0)
return TIMEOUT_ERROR; // Timed out
m_bWaiting = false;
synchronized(this)
{
long lStartTime = System.currentTimeMillis();
try {
m_bWaiting = true;
this.wait(m_lTimeOut);
} catch (InterruptedException e) {
e.printStackTrace();
}
m_lTimeOut = m_lTimeOut - (System.currentTimeMillis() - lStartTime);
}
if (m_bWaiting == false)
return DBConstants.NORMAL_RETURN; // Was interrupted by a field change
m_bWaiting = false;
return TIMEOUT_ERROR; // Timed out
}
|
[
"public",
"int",
"waitForChange",
"(",
")",
"{",
"if",
"(",
"m_lTimeOut",
"<=",
"0",
")",
"return",
"TIMEOUT_ERROR",
";",
"// Timed out ",
"m_bWaiting",
"=",
"false",
";",
"synchronized",
"(",
"this",
")",
"{",
"long",
"lStartTime",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"try",
"{",
"m_bWaiting",
"=",
"true",
";",
"this",
".",
"wait",
"(",
"m_lTimeOut",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"m_lTimeOut",
"=",
"m_lTimeOut",
"-",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"lStartTime",
")",
";",
"}",
"if",
"(",
"m_bWaiting",
"==",
"false",
")",
"return",
"DBConstants",
".",
"NORMAL_RETURN",
";",
"// Was interrupted by a field change",
"m_bWaiting",
"=",
"false",
";",
"return",
"TIMEOUT_ERROR",
";",
"// Timed out",
"}"
] |
Wait for this field to change.
@return Normal return if changed, TIMEOUT if timeout.
|
[
"Wait",
"for",
"this",
"field",
"to",
"change",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/WaitForFieldChangeHandler.java#L132-L152
|
152,506
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/IntMap.java
|
IntMap.put
|
public IntReference put(K key, int value)
{
IntReference w = map.get(key);
if (w == null)
{
w = new IntReference(value);
return map.put(key, w);
}
else
{
w.value = value;
return null;
}
}
|
java
|
public IntReference put(K key, int value)
{
IntReference w = map.get(key);
if (w == null)
{
w = new IntReference(value);
return map.put(key, w);
}
else
{
w.value = value;
return null;
}
}
|
[
"public",
"IntReference",
"put",
"(",
"K",
"key",
",",
"int",
"value",
")",
"{",
"IntReference",
"w",
"=",
"map",
".",
"get",
"(",
"key",
")",
";",
"if",
"(",
"w",
"==",
"null",
")",
"{",
"w",
"=",
"new",
"IntReference",
"(",
"value",
")",
";",
"return",
"map",
".",
"put",
"(",
"key",
",",
"w",
")",
";",
"}",
"else",
"{",
"w",
".",
"value",
"=",
"value",
";",
"return",
"null",
";",
"}",
"}"
] |
Associates value to key
@param key
@param value
|
[
"Associates",
"value",
"to",
"key"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/IntMap.java#L54-L67
|
152,507
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/Seb.java
|
Seb.withConfiguration
|
public <T extends SebConfiguration> Seb withConfiguration(Class<T> configCls) {
try {
return withConfiguration(configCls.getConstructor().newInstance());
} catch (Exception e) {
throw new SebConfigurationConstructException("Unable to construct Seb configuration " + configCls.getName(),
e);
}
}
|
java
|
public <T extends SebConfiguration> Seb withConfiguration(Class<T> configCls) {
try {
return withConfiguration(configCls.getConstructor().newInstance());
} catch (Exception e) {
throw new SebConfigurationConstructException("Unable to construct Seb configuration " + configCls.getName(),
e);
}
}
|
[
"public",
"<",
"T",
"extends",
"SebConfiguration",
">",
"Seb",
"withConfiguration",
"(",
"Class",
"<",
"T",
">",
"configCls",
")",
"{",
"try",
"{",
"return",
"withConfiguration",
"(",
"configCls",
".",
"getConstructor",
"(",
")",
".",
"newInstance",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"SebConfigurationConstructException",
"(",
"\"Unable to construct Seb configuration \"",
"+",
"configCls",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"}",
"}"
] |
Set configuration to configuration constructed from given class.
Configuration class needs to have constructor with no parameters.
@param configCls
The configuration class
@return Seb instance
|
[
"Set",
"configuration",
"to",
"configuration",
"constructed",
"from",
"given",
"class",
".",
"Configuration",
"class",
"needs",
"to",
"have",
"constructor",
"with",
"no",
"parameters",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/Seb.java#L212-L219
|
152,508
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/Seb.java
|
Seb.withLabel
|
public Seb withLabel(String... labels) {
this.label = utils.join(LABEL_DELIMITER, (Object[]) labels);
return this;
}
|
java
|
public Seb withLabel(String... labels) {
this.label = utils.join(LABEL_DELIMITER, (Object[]) labels);
return this;
}
|
[
"public",
"Seb",
"withLabel",
"(",
"String",
"...",
"labels",
")",
"{",
"this",
".",
"label",
"=",
"utils",
".",
"join",
"(",
"LABEL_DELIMITER",
",",
"(",
"Object",
"[",
"]",
")",
"labels",
")",
";",
"return",
"this",
";",
"}"
] |
Set label joining given labels.
@param labels
Seb labels
@return Seb instance
|
[
"Set",
"label",
"joining",
"given",
"labels",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/Seb.java#L252-L255
|
152,509
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/Seb.java
|
Seb.setLabel
|
@Deprecated
public void setLabel(String... labels) {
this.label = utils.join(LABEL_DELIMITER, (Object[]) labels);
}
|
java
|
@Deprecated
public void setLabel(String... labels) {
this.label = utils.join(LABEL_DELIMITER, (Object[]) labels);
}
|
[
"@",
"Deprecated",
"public",
"void",
"setLabel",
"(",
"String",
"...",
"labels",
")",
"{",
"this",
".",
"label",
"=",
"utils",
".",
"join",
"(",
"LABEL_DELIMITER",
",",
"(",
"Object",
"[",
"]",
")",
"labels",
")",
";",
"}"
] |
Modify Seb label joining given labels.
@param labels
Seb labels
@deprecated As of Seb version 0.3.22, replaced by
<code>Seb.withLabel(String... labels)</code>.
|
[
"Modify",
"Seb",
"label",
"joining",
"given",
"labels",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/Seb.java#L391-L394
|
152,510
|
etnetera/seb
|
src/main/java/cz/etnetera/seb/Seb.java
|
Seb.useEnclosingMethodLabel
|
public Seb useEnclosingMethodLabel() {
final StackTraceElement e = Thread.currentThread().getStackTrace()[2];
final String s = e.getClassName();
setLabel(s.substring(s.lastIndexOf('.') + 1, s.length()), e.getMethodName());
return this;
}
|
java
|
public Seb useEnclosingMethodLabel() {
final StackTraceElement e = Thread.currentThread().getStackTrace()[2];
final String s = e.getClassName();
setLabel(s.substring(s.lastIndexOf('.') + 1, s.length()), e.getMethodName());
return this;
}
|
[
"public",
"Seb",
"useEnclosingMethodLabel",
"(",
")",
"{",
"final",
"StackTraceElement",
"e",
"=",
"Thread",
".",
"currentThread",
"(",
")",
".",
"getStackTrace",
"(",
")",
"[",
"2",
"]",
";",
"final",
"String",
"s",
"=",
"e",
".",
"getClassName",
"(",
")",
";",
"setLabel",
"(",
"s",
".",
"substring",
"(",
"s",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
",",
"s",
".",
"length",
"(",
")",
")",
",",
"e",
".",
"getMethodName",
"(",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Sets label using enclosing method class name and method name.
|
[
"Sets",
"label",
"using",
"enclosing",
"method",
"class",
"name",
"and",
"method",
"name",
"."
] |
6aed29c7726db12f440c60cfd253de229064ed04
|
https://github.com/etnetera/seb/blob/6aed29c7726db12f440c60cfd253de229064ed04/src/main/java/cz/etnetera/seb/Seb.java#L603-L608
|
152,511
|
jbundle/jbundle
|
app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClasses.java
|
WriteClasses.writeThisClass
|
public void writeThisClass(String strClassName, String strRecordType)
{
Record recFileHdr = this.getRecord(FileHdr.FILE_HDR_FILE);
try {
recFileHdr.addNew();
recFileHdr.getField(FileHdr.FILE_NAME).setString(strClassName);
recFileHdr.setKeyArea(FileHdr.FILE_NAME_KEY);
if (recFileHdr.seek(DBConstants.EQUALS)) // Is there a file with this name?
strRecordType = "Record"; // Just to be sure
} catch (DBException ex) {
ex.printStackTrace();
}
if (strRecordType.length() == 0)
strRecordType = " ";
if (m_ClassNameList.addName(strClassName) == false)
return;
WriteClass writeClass = null;
if (strRecordType.equalsIgnoreCase("Record"))
writeClass = new WriteRecordClass(this.getTask(), null, null);
else if (strRecordType.equalsIgnoreCase("Resource"))
writeClass = new WriteResourceClass(this.getTask(), null, null);
else
writeClass = new WriteClass(this.getTask(), null, null);
if (writeClass != null)
{
writeClass.writeClass(strClassName, CodeType.THICK);
writeClass.free();
}
}
|
java
|
public void writeThisClass(String strClassName, String strRecordType)
{
Record recFileHdr = this.getRecord(FileHdr.FILE_HDR_FILE);
try {
recFileHdr.addNew();
recFileHdr.getField(FileHdr.FILE_NAME).setString(strClassName);
recFileHdr.setKeyArea(FileHdr.FILE_NAME_KEY);
if (recFileHdr.seek(DBConstants.EQUALS)) // Is there a file with this name?
strRecordType = "Record"; // Just to be sure
} catch (DBException ex) {
ex.printStackTrace();
}
if (strRecordType.length() == 0)
strRecordType = " ";
if (m_ClassNameList.addName(strClassName) == false)
return;
WriteClass writeClass = null;
if (strRecordType.equalsIgnoreCase("Record"))
writeClass = new WriteRecordClass(this.getTask(), null, null);
else if (strRecordType.equalsIgnoreCase("Resource"))
writeClass = new WriteResourceClass(this.getTask(), null, null);
else
writeClass = new WriteClass(this.getTask(), null, null);
if (writeClass != null)
{
writeClass.writeClass(strClassName, CodeType.THICK);
writeClass.free();
}
}
|
[
"public",
"void",
"writeThisClass",
"(",
"String",
"strClassName",
",",
"String",
"strRecordType",
")",
"{",
"Record",
"recFileHdr",
"=",
"this",
".",
"getRecord",
"(",
"FileHdr",
".",
"FILE_HDR_FILE",
")",
";",
"try",
"{",
"recFileHdr",
".",
"addNew",
"(",
")",
";",
"recFileHdr",
".",
"getField",
"(",
"FileHdr",
".",
"FILE_NAME",
")",
".",
"setString",
"(",
"strClassName",
")",
";",
"recFileHdr",
".",
"setKeyArea",
"(",
"FileHdr",
".",
"FILE_NAME_KEY",
")",
";",
"if",
"(",
"recFileHdr",
".",
"seek",
"(",
"DBConstants",
".",
"EQUALS",
")",
")",
"// Is there a file with this name?",
"strRecordType",
"=",
"\"Record\"",
";",
"// Just to be sure",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"}",
"if",
"(",
"strRecordType",
".",
"length",
"(",
")",
"==",
"0",
")",
"strRecordType",
"=",
"\" \"",
";",
"if",
"(",
"m_ClassNameList",
".",
"addName",
"(",
"strClassName",
")",
"==",
"false",
")",
"return",
";",
"WriteClass",
"writeClass",
"=",
"null",
";",
"if",
"(",
"strRecordType",
".",
"equalsIgnoreCase",
"(",
"\"Record\"",
")",
")",
"writeClass",
"=",
"new",
"WriteRecordClass",
"(",
"this",
".",
"getTask",
"(",
")",
",",
"null",
",",
"null",
")",
";",
"else",
"if",
"(",
"strRecordType",
".",
"equalsIgnoreCase",
"(",
"\"Resource\"",
")",
")",
"writeClass",
"=",
"new",
"WriteResourceClass",
"(",
"this",
".",
"getTask",
"(",
")",
",",
"null",
",",
"null",
")",
";",
"else",
"writeClass",
"=",
"new",
"WriteClass",
"(",
"this",
".",
"getTask",
"(",
")",
",",
"null",
",",
"null",
")",
";",
"if",
"(",
"writeClass",
"!=",
"null",
")",
"{",
"writeClass",
".",
"writeClass",
"(",
"strClassName",
",",
"CodeType",
".",
"THICK",
")",
";",
"writeClass",
".",
"free",
"(",
")",
";",
"}",
"}"
] |
Write this class using the correct method for the type.
|
[
"Write",
"this",
"class",
"using",
"the",
"correct",
"method",
"for",
"the",
"type",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/manual/util/src/main/java/org/jbundle/app/program/manual/util/WriteClasses.java#L183-L214
|
152,512
|
jbundle/jbundle
|
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MTable.java
|
MTable.getRecordCount
|
public int getRecordCount(FieldTable table)
{
int iKeyOrder = table.getRecord().getDefaultOrder();
if (iKeyOrder == -1)
iKeyOrder = Constants.MAIN_KEY_AREA;
return this.getPKeyArea(iKeyOrder).getRecordCount();
}
|
java
|
public int getRecordCount(FieldTable table)
{
int iKeyOrder = table.getRecord().getDefaultOrder();
if (iKeyOrder == -1)
iKeyOrder = Constants.MAIN_KEY_AREA;
return this.getPKeyArea(iKeyOrder).getRecordCount();
}
|
[
"public",
"int",
"getRecordCount",
"(",
"FieldTable",
"table",
")",
"{",
"int",
"iKeyOrder",
"=",
"table",
".",
"getRecord",
"(",
")",
".",
"getDefaultOrder",
"(",
")",
";",
"if",
"(",
"iKeyOrder",
"==",
"-",
"1",
")",
"iKeyOrder",
"=",
"Constants",
".",
"MAIN_KEY_AREA",
";",
"return",
"this",
".",
"getPKeyArea",
"(",
"iKeyOrder",
")",
".",
"getRecordCount",
"(",
")",
";",
"}"
] |
Get the record count.
Just returns the count of the default key area.
@return The record count (or -1 if unknown).
|
[
"Get",
"the",
"record",
"count",
".",
"Just",
"returns",
"the",
"count",
"of",
"the",
"default",
"key",
"area",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MTable.java#L79-L85
|
152,513
|
jbundle/jbundle
|
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MTable.java
|
MTable.open
|
public void open(FieldTable table) throws DBException
{
super.open(table);
if (!m_bDataIn)
{ // Import all data on first open
m_bDataIn = true;
this.readData(table);
}
}
|
java
|
public void open(FieldTable table) throws DBException
{
super.open(table);
if (!m_bDataIn)
{ // Import all data on first open
m_bDataIn = true;
this.readData(table);
}
}
|
[
"public",
"void",
"open",
"(",
"FieldTable",
"table",
")",
"throws",
"DBException",
"{",
"super",
".",
"open",
"(",
"table",
")",
";",
"if",
"(",
"!",
"m_bDataIn",
")",
"{",
"// Import all data on first open",
"m_bDataIn",
"=",
"true",
";",
"this",
".",
"readData",
"(",
"table",
")",
";",
"}",
"}"
] |
Init this object
|
[
"Init",
"this",
"object"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MTable.java#L98-L106
|
152,514
|
inkstand-io/scribble
|
scribble-net/src/main/java/io/inkstand/scribble/net/NetworkMatchers.java
|
NetworkMatchers.remotePort
|
public static NetworkPort remotePort(String hostname, int port){
return new RemoteNetworkPort(hostname, port, NetworkPort.Type.TCP);
}
|
java
|
public static NetworkPort remotePort(String hostname, int port){
return new RemoteNetworkPort(hostname, port, NetworkPort.Type.TCP);
}
|
[
"public",
"static",
"NetworkPort",
"remotePort",
"(",
"String",
"hostname",
",",
"int",
"port",
")",
"{",
"return",
"new",
"RemoteNetworkPort",
"(",
"hostname",
",",
"port",
",",
"NetworkPort",
".",
"Type",
".",
"TCP",
")",
";",
"}"
] |
Creates a type-safe tcp port pointing ot a remote host and port.
@param hostname
the hostname of the remote host
@param port
the port of the remote host
@return a {@link NetworkPort} instance describing the tcp port
|
[
"Creates",
"a",
"type",
"-",
"safe",
"tcp",
"port",
"pointing",
"ot",
"a",
"remote",
"host",
"and",
"port",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-net/src/main/java/io/inkstand/scribble/net/NetworkMatchers.java#L88-L90
|
152,515
|
inkstand-io/scribble
|
scribble-net/src/main/java/io/inkstand/scribble/net/NetworkMatchers.java
|
NetworkMatchers.remoteDatagramPort
|
public static NetworkPort remoteDatagramPort(String hostname, int port){
return new RemoteNetworkPort(hostname, port, NetworkPort.Type.UDP);
}
|
java
|
public static NetworkPort remoteDatagramPort(String hostname, int port){
return new RemoteNetworkPort(hostname, port, NetworkPort.Type.UDP);
}
|
[
"public",
"static",
"NetworkPort",
"remoteDatagramPort",
"(",
"String",
"hostname",
",",
"int",
"port",
")",
"{",
"return",
"new",
"RemoteNetworkPort",
"(",
"hostname",
",",
"port",
",",
"NetworkPort",
".",
"Type",
".",
"UDP",
")",
";",
"}"
] |
Creates a type-safe udp port pointing ot a remote host and port.
@param hostname
the hostname of the remote host
@param port
the port of the remote host
@return a {@link NetworkPort} instance describing the udp port
|
[
"Creates",
"a",
"type",
"-",
"safe",
"udp",
"port",
"pointing",
"ot",
"a",
"remote",
"host",
"and",
"port",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-net/src/main/java/io/inkstand/scribble/net/NetworkMatchers.java#L102-L104
|
152,516
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/HttpRequester.java
|
HttpRequester.buildUri
|
public static URI buildUri(String httpOrHttps, String host, String path,
Map<String, String> paramMap) {
try {
return new URIBuilder().setScheme(httpOrHttps).setHost(host)
.setPath(path)
.setParameters(buildNameValuePareList(paramMap)).build();
} catch (URISyntaxException e) {
throw JMExceptionManager.handleExceptionAndReturnRuntimeEx(log, e,
"getResponseAsString", httpOrHttps, host, path, paramMap);
}
}
|
java
|
public static URI buildUri(String httpOrHttps, String host, String path,
Map<String, String> paramMap) {
try {
return new URIBuilder().setScheme(httpOrHttps).setHost(host)
.setPath(path)
.setParameters(buildNameValuePareList(paramMap)).build();
} catch (URISyntaxException e) {
throw JMExceptionManager.handleExceptionAndReturnRuntimeEx(log, e,
"getResponseAsString", httpOrHttps, host, path, paramMap);
}
}
|
[
"public",
"static",
"URI",
"buildUri",
"(",
"String",
"httpOrHttps",
",",
"String",
"host",
",",
"String",
"path",
",",
"Map",
"<",
"String",
",",
"String",
">",
"paramMap",
")",
"{",
"try",
"{",
"return",
"new",
"URIBuilder",
"(",
")",
".",
"setScheme",
"(",
"httpOrHttps",
")",
".",
"setHost",
"(",
"host",
")",
".",
"setPath",
"(",
"path",
")",
".",
"setParameters",
"(",
"buildNameValuePareList",
"(",
"paramMap",
")",
")",
".",
"build",
"(",
")",
";",
"}",
"catch",
"(",
"URISyntaxException",
"e",
")",
"{",
"throw",
"JMExceptionManager",
".",
"handleExceptionAndReturnRuntimeEx",
"(",
"log",
",",
"e",
",",
"\"getResponseAsString\"",
",",
"httpOrHttps",
",",
"host",
",",
"path",
",",
"paramMap",
")",
";",
"}",
"}"
] |
Build uri uri.
@param httpOrHttps the http or https
@param host the host
@param path the path
@param paramMap the param map
@return the uri
|
[
"Build",
"uri",
"uri",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/HttpRequester.java#L115-L125
|
152,517
|
JM-Lab/utils-java9
|
src/main/java/kr/jm/utils/HttpRequester.java
|
HttpRequester.buildNameValuePareList
|
public static List<NameValuePair>
buildNameValuePareList(Map<String, String> keyValueMap) {
return keyValueMap.entrySet().stream()
.map(entry -> new BasicNameValuePair(entry.getKey(),
entry.getValue()))
.collect(toList());
}
|
java
|
public static List<NameValuePair>
buildNameValuePareList(Map<String, String> keyValueMap) {
return keyValueMap.entrySet().stream()
.map(entry -> new BasicNameValuePair(entry.getKey(),
entry.getValue()))
.collect(toList());
}
|
[
"public",
"static",
"List",
"<",
"NameValuePair",
">",
"buildNameValuePareList",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"keyValueMap",
")",
"{",
"return",
"keyValueMap",
".",
"entrySet",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"entry",
"->",
"new",
"BasicNameValuePair",
"(",
"entry",
".",
"getKey",
"(",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
")",
".",
"collect",
"(",
"toList",
"(",
")",
")",
";",
"}"
] |
Build name value pare list list.
@param keyValueMap the key value map
@return the list
|
[
"Build",
"name",
"value",
"pare",
"list",
"list",
"."
] |
ee80235b2760396a616cf7563cbdc98d4affe8e1
|
https://github.com/JM-Lab/utils-java9/blob/ee80235b2760396a616cf7563cbdc98d4affe8e1/src/main/java/kr/jm/utils/HttpRequester.java#L133-L139
|
152,518
|
DDTH/ddth-tsc
|
ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/CassandraCounter.java
|
CassandraCounter._getRowWithCache
|
@SuppressWarnings("unchecked")
private Map<Long, DataPoint> _getRowWithCache(long timestampMs) {
int[] yyyymm_dd = toYYYYMM_DD(timestampMs);
int yyyymmdd = yyyymm_dd[0] * 100 + yyyymm_dd[1];
ICache cache = getCache();
String cacheKey = String.valueOf(yyyymmdd);
Object temp = cache != null ? cache.get(cacheKey) : null;
Map<Long, DataPoint> result = (Map<Long, DataPoint>) (temp instanceof Map ? temp : null);
if (result == null) {
result = _getRow(getName(), yyyymm_dd[0], yyyymm_dd[1]);
if (cache != null) {
cache.set(cacheKey, result);
}
}
return result;
}
|
java
|
@SuppressWarnings("unchecked")
private Map<Long, DataPoint> _getRowWithCache(long timestampMs) {
int[] yyyymm_dd = toYYYYMM_DD(timestampMs);
int yyyymmdd = yyyymm_dd[0] * 100 + yyyymm_dd[1];
ICache cache = getCache();
String cacheKey = String.valueOf(yyyymmdd);
Object temp = cache != null ? cache.get(cacheKey) : null;
Map<Long, DataPoint> result = (Map<Long, DataPoint>) (temp instanceof Map ? temp : null);
if (result == null) {
result = _getRow(getName(), yyyymm_dd[0], yyyymm_dd[1]);
if (cache != null) {
cache.set(cacheKey, result);
}
}
return result;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"Map",
"<",
"Long",
",",
"DataPoint",
">",
"_getRowWithCache",
"(",
"long",
"timestampMs",
")",
"{",
"int",
"[",
"]",
"yyyymm_dd",
"=",
"toYYYYMM_DD",
"(",
"timestampMs",
")",
";",
"int",
"yyyymmdd",
"=",
"yyyymm_dd",
"[",
"0",
"]",
"*",
"100",
"+",
"yyyymm_dd",
"[",
"1",
"]",
";",
"ICache",
"cache",
"=",
"getCache",
"(",
")",
";",
"String",
"cacheKey",
"=",
"String",
".",
"valueOf",
"(",
"yyyymmdd",
")",
";",
"Object",
"temp",
"=",
"cache",
"!=",
"null",
"?",
"cache",
".",
"get",
"(",
"cacheKey",
")",
":",
"null",
";",
"Map",
"<",
"Long",
",",
"DataPoint",
">",
"result",
"=",
"(",
"Map",
"<",
"Long",
",",
"DataPoint",
">",
")",
"(",
"temp",
"instanceof",
"Map",
"?",
"temp",
":",
"null",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"_getRow",
"(",
"getName",
"(",
")",
",",
"yyyymm_dd",
"[",
"0",
"]",
",",
"yyyymm_dd",
"[",
"1",
"]",
")",
";",
"if",
"(",
"cache",
"!=",
"null",
")",
"{",
"cache",
".",
"set",
"(",
"cacheKey",
",",
"result",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Gets all data points of a day specified by the timestamp, cache
supported.
@param timestampMs
@return
|
[
"Gets",
"all",
"data",
"points",
"of",
"a",
"day",
"specified",
"by",
"the",
"timestamp",
"cache",
"supported",
"."
] |
d233c304c8fed2f3c069de42a36b7bbd5c8be01b
|
https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/CassandraCounter.java#L252-L267
|
152,519
|
DDTH/ddth-tsc
|
ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/CassandraCounter.java
|
CassandraCounter._getRow
|
private Map<Long, DataPoint> _getRow(String counterName, int yyyymm, int dd) {
Map<Long, DataPoint> result = new HashMap<Long, DataPoint>();
ResultSet rs = CqlUtils.execute(sessionHelper.getSession(), cqlGetRow,
getConsistencyLevelForRead(), counterName, yyyymm, dd);
for (Iterator<Row> it = rs.iterator(); it.hasNext();) {
Row row = it.next();
long key = row.getLong(CqlTemplate.COL_COUNTER_TIMESTAMP);
long value = row.getLong(CqlTemplate.COL_COUNTER_VALUE);
DataPoint dp = new DataPoint(Type.SUM, key, value, RESOLUTION_MS);
result.put(key, dp);
}
return result;
}
|
java
|
private Map<Long, DataPoint> _getRow(String counterName, int yyyymm, int dd) {
Map<Long, DataPoint> result = new HashMap<Long, DataPoint>();
ResultSet rs = CqlUtils.execute(sessionHelper.getSession(), cqlGetRow,
getConsistencyLevelForRead(), counterName, yyyymm, dd);
for (Iterator<Row> it = rs.iterator(); it.hasNext();) {
Row row = it.next();
long key = row.getLong(CqlTemplate.COL_COUNTER_TIMESTAMP);
long value = row.getLong(CqlTemplate.COL_COUNTER_VALUE);
DataPoint dp = new DataPoint(Type.SUM, key, value, RESOLUTION_MS);
result.put(key, dp);
}
return result;
}
|
[
"private",
"Map",
"<",
"Long",
",",
"DataPoint",
">",
"_getRow",
"(",
"String",
"counterName",
",",
"int",
"yyyymm",
",",
"int",
"dd",
")",
"{",
"Map",
"<",
"Long",
",",
"DataPoint",
">",
"result",
"=",
"new",
"HashMap",
"<",
"Long",
",",
"DataPoint",
">",
"(",
")",
";",
"ResultSet",
"rs",
"=",
"CqlUtils",
".",
"execute",
"(",
"sessionHelper",
".",
"getSession",
"(",
")",
",",
"cqlGetRow",
",",
"getConsistencyLevelForRead",
"(",
")",
",",
"counterName",
",",
"yyyymm",
",",
"dd",
")",
";",
"for",
"(",
"Iterator",
"<",
"Row",
">",
"it",
"=",
"rs",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"Row",
"row",
"=",
"it",
".",
"next",
"(",
")",
";",
"long",
"key",
"=",
"row",
".",
"getLong",
"(",
"CqlTemplate",
".",
"COL_COUNTER_TIMESTAMP",
")",
";",
"long",
"value",
"=",
"row",
".",
"getLong",
"(",
"CqlTemplate",
".",
"COL_COUNTER_VALUE",
")",
";",
"DataPoint",
"dp",
"=",
"new",
"DataPoint",
"(",
"Type",
".",
"SUM",
",",
"key",
",",
"value",
",",
"RESOLUTION_MS",
")",
";",
"result",
".",
"put",
"(",
"key",
",",
"dp",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Gets all data points of a day.
@param counterName
@param yyyymm
@param dd
@return
@since 0.3.1.1
|
[
"Gets",
"all",
"data",
"points",
"of",
"a",
"day",
"."
] |
d233c304c8fed2f3c069de42a36b7bbd5c8be01b
|
https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/cassandra/CassandraCounter.java#L278-L292
|
152,520
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/HexDump.java
|
HexDump.fromHex
|
public static final byte[] fromHex(String hexDump)
{
List<Integer> list = new ArrayList<>();
String[] lines = hexDump.split("\n");
if (lines.length < 2)
{
throw new IllegalArgumentException("not a hex dump");
}
if (!lines[0].contains(Title))
{
throw new IllegalArgumentException("not a hex dump");
}
for (int ll=1;ll<lines.length;ll++)
{
String line = lines[ll];
int i1 = line.indexOf(':');
if (i1 == -1)
{
throw new IllegalArgumentException("not a hex dump");
}
int i2 = line.indexOf(" ", i1+2);
if (i2 == -1)
{
throw new IllegalArgumentException("not a hex dump");
}
String[] fields = line.substring(i1+2, i2).split(" ");
for (int ii=0;ii<fields.length;ii++)
{
list.add(Integer.parseInt(fields[ii], 16));
}
}
byte[] bytes = new byte[list.size()];
for (int ii=0;ii<bytes.length;ii++)
{
bytes[ii] = list.get(ii).byteValue();
}
return bytes;
}
|
java
|
public static final byte[] fromHex(String hexDump)
{
List<Integer> list = new ArrayList<>();
String[] lines = hexDump.split("\n");
if (lines.length < 2)
{
throw new IllegalArgumentException("not a hex dump");
}
if (!lines[0].contains(Title))
{
throw new IllegalArgumentException("not a hex dump");
}
for (int ll=1;ll<lines.length;ll++)
{
String line = lines[ll];
int i1 = line.indexOf(':');
if (i1 == -1)
{
throw new IllegalArgumentException("not a hex dump");
}
int i2 = line.indexOf(" ", i1+2);
if (i2 == -1)
{
throw new IllegalArgumentException("not a hex dump");
}
String[] fields = line.substring(i1+2, i2).split(" ");
for (int ii=0;ii<fields.length;ii++)
{
list.add(Integer.parseInt(fields[ii], 16));
}
}
byte[] bytes = new byte[list.size()];
for (int ii=0;ii<bytes.length;ii++)
{
bytes[ii] = list.get(ii).byteValue();
}
return bytes;
}
|
[
"public",
"static",
"final",
"byte",
"[",
"]",
"fromHex",
"(",
"String",
"hexDump",
")",
"{",
"List",
"<",
"Integer",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"String",
"[",
"]",
"lines",
"=",
"hexDump",
".",
"split",
"(",
"\"\\n\"",
")",
";",
"if",
"(",
"lines",
".",
"length",
"<",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"not a hex dump\"",
")",
";",
"}",
"if",
"(",
"!",
"lines",
"[",
"0",
"]",
".",
"contains",
"(",
"Title",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"not a hex dump\"",
")",
";",
"}",
"for",
"(",
"int",
"ll",
"=",
"1",
";",
"ll",
"<",
"lines",
".",
"length",
";",
"ll",
"++",
")",
"{",
"String",
"line",
"=",
"lines",
"[",
"ll",
"]",
";",
"int",
"i1",
"=",
"line",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"i1",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"not a hex dump\"",
")",
";",
"}",
"int",
"i2",
"=",
"line",
".",
"indexOf",
"(",
"\" \"",
",",
"i1",
"+",
"2",
")",
";",
"if",
"(",
"i2",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"not a hex dump\"",
")",
";",
"}",
"String",
"[",
"]",
"fields",
"=",
"line",
".",
"substring",
"(",
"i1",
"+",
"2",
",",
"i2",
")",
".",
"split",
"(",
"\" \"",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"fields",
".",
"length",
";",
"ii",
"++",
")",
"{",
"list",
".",
"add",
"(",
"Integer",
".",
"parseInt",
"(",
"fields",
"[",
"ii",
"]",
",",
"16",
")",
")",
";",
"}",
"}",
"byte",
"[",
"]",
"bytes",
"=",
"new",
"byte",
"[",
"list",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"bytes",
".",
"length",
";",
"ii",
"++",
")",
"{",
"bytes",
"[",
"ii",
"]",
"=",
"list",
".",
"get",
"(",
"ii",
")",
".",
"byteValue",
"(",
")",
";",
"}",
"return",
"bytes",
";",
"}"
] |
Recreates byte array from hex dump.
@param hexDump
@return
|
[
"Recreates",
"byte",
"array",
"from",
"hex",
"dump",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/HexDump.java#L37-L74
|
152,521
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/HexDump.java
|
HexDump.remainingToHex
|
public static final String remainingToHex(ByteBuffer bb)
{
byte[] buf = new byte[bb.remaining()];
int safe = bb.position();
bb.get(buf);
bb.position(safe);
return toHex(buf);
}
|
java
|
public static final String remainingToHex(ByteBuffer bb)
{
byte[] buf = new byte[bb.remaining()];
int safe = bb.position();
bb.get(buf);
bb.position(safe);
return toHex(buf);
}
|
[
"public",
"static",
"final",
"String",
"remainingToHex",
"(",
"ByteBuffer",
"bb",
")",
"{",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"bb",
".",
"remaining",
"(",
")",
"]",
";",
"int",
"safe",
"=",
"bb",
".",
"position",
"(",
")",
";",
"bb",
".",
"get",
"(",
"buf",
")",
";",
"bb",
".",
"position",
"(",
"safe",
")",
";",
"return",
"toHex",
"(",
"buf",
")",
";",
"}"
] |
Creates readable view to byte buffer remaining. Doesn't change byte buffer.
@param bb
@return
|
[
"Creates",
"readable",
"view",
"to",
"byte",
"buffer",
"remaining",
".",
"Doesn",
"t",
"change",
"byte",
"buffer",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/HexDump.java#L80-L87
|
152,522
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/HexDump.java
|
HexDump.startToHex
|
public static final String startToHex(ByteBuffer bb)
{
byte[] buf = new byte[bb.position()];
int safePos = bb.position();
int safeLim = bb.limit();
bb.position(0);
bb.get(buf);
bb.position(safePos);
bb.limit(safeLim);
return toHex(buf);
}
|
java
|
public static final String startToHex(ByteBuffer bb)
{
byte[] buf = new byte[bb.position()];
int safePos = bb.position();
int safeLim = bb.limit();
bb.position(0);
bb.get(buf);
bb.position(safePos);
bb.limit(safeLim);
return toHex(buf);
}
|
[
"public",
"static",
"final",
"String",
"startToHex",
"(",
"ByteBuffer",
"bb",
")",
"{",
"byte",
"[",
"]",
"buf",
"=",
"new",
"byte",
"[",
"bb",
".",
"position",
"(",
")",
"]",
";",
"int",
"safePos",
"=",
"bb",
".",
"position",
"(",
")",
";",
"int",
"safeLim",
"=",
"bb",
".",
"limit",
"(",
")",
";",
"bb",
".",
"position",
"(",
"0",
")",
";",
"bb",
".",
"get",
"(",
"buf",
")",
";",
"bb",
".",
"position",
"(",
"safePos",
")",
";",
"bb",
".",
"limit",
"(",
"safeLim",
")",
";",
"return",
"toHex",
"(",
"buf",
")",
";",
"}"
] |
Creates readable view to byte buffer remaining. Mark will be discarded.
@param bb
@return
|
[
"Creates",
"readable",
"view",
"to",
"byte",
"buffer",
"remaining",
".",
"Mark",
"will",
"be",
"discarded",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/HexDump.java#L93-L103
|
152,523
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/FieldListener.java
|
FieldListener.getSyncedListenersField
|
public BaseField getSyncedListenersField(BaseField field, FieldListener listener)
{
if (field != null)
if (field.getRecord() == this.getOwner().getRecord())
field = listener.getOwner().getRecord().getField(field.getFieldName());
return field;
}
|
java
|
public BaseField getSyncedListenersField(BaseField field, FieldListener listener)
{
if (field != null)
if (field.getRecord() == this.getOwner().getRecord())
field = listener.getOwner().getRecord().getField(field.getFieldName());
return field;
}
|
[
"public",
"BaseField",
"getSyncedListenersField",
"(",
"BaseField",
"field",
",",
"FieldListener",
"listener",
")",
"{",
"if",
"(",
"field",
"!=",
"null",
")",
"if",
"(",
"field",
".",
"getRecord",
"(",
")",
"==",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
")",
"field",
"=",
"listener",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getField",
"(",
"field",
".",
"getFieldName",
"(",
")",
")",
";",
"return",
"field",
";",
"}"
] |
When cloning a listener, if the field is contained in the source record, get the same field is the new record.
@param field
@param listener
@return
|
[
"When",
"cloning",
"a",
"listener",
"if",
"the",
"field",
"is",
"contained",
"in",
"the",
"source",
"record",
"get",
"the",
"same",
"field",
"is",
"the",
"new",
"record",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/FieldListener.java#L132-L138
|
152,524
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/event/FieldListener.java
|
FieldListener.respondsToMode
|
public boolean respondsToMode(int iMoveMode)
{
if (iMoveMode == DBConstants.SCREEN_MOVE)
return m_bScreenMove;
if (iMoveMode == DBConstants.INIT_MOVE)
return m_bInitMove;
if (iMoveMode == DBConstants.READ_MOVE)
return m_bReadMove;
return false;
}
|
java
|
public boolean respondsToMode(int iMoveMode)
{
if (iMoveMode == DBConstants.SCREEN_MOVE)
return m_bScreenMove;
if (iMoveMode == DBConstants.INIT_MOVE)
return m_bInitMove;
if (iMoveMode == DBConstants.READ_MOVE)
return m_bReadMove;
return false;
}
|
[
"public",
"boolean",
"respondsToMode",
"(",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"iMoveMode",
"==",
"DBConstants",
".",
"SCREEN_MOVE",
")",
"return",
"m_bScreenMove",
";",
"if",
"(",
"iMoveMode",
"==",
"DBConstants",
".",
"INIT_MOVE",
")",
"return",
"m_bInitMove",
";",
"if",
"(",
"iMoveMode",
"==",
"DBConstants",
".",
"READ_MOVE",
")",
"return",
"m_bReadMove",
";",
"return",
"false",
";",
"}"
] |
Does this listener respond to this mode?
@return true if this listener responds to this kind of move.
|
[
"Does",
"this",
"listener",
"respond",
"to",
"this",
"mode?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/FieldListener.java#L284-L293
|
152,525
|
ggrandes/stringproperties
|
src/main/java/org/javastack/stringproperties/StringProperties.java
|
StringProperties.eval
|
private final String eval(final String str) throws InvalidExpression {
if (str == null)
return null;
return new MapExpression(str, null, mapper, false).eval().get();
}
|
java
|
private final String eval(final String str) throws InvalidExpression {
if (str == null)
return null;
return new MapExpression(str, null, mapper, false).eval().get();
}
|
[
"private",
"final",
"String",
"eval",
"(",
"final",
"String",
"str",
")",
"throws",
"InvalidExpression",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"return",
"null",
";",
"return",
"new",
"MapExpression",
"(",
"str",
",",
"null",
",",
"mapper",
",",
"false",
")",
".",
"eval",
"(",
")",
".",
"get",
"(",
")",
";",
"}"
] |
GET with MapExpression
|
[
"GET",
"with",
"MapExpression"
] |
9bbfb351d1d39dc65a906c9cde929633f647ad2c
|
https://github.com/ggrandes/stringproperties/blob/9bbfb351d1d39dc65a906c9cde929633f647ad2c/src/main/java/org/javastack/stringproperties/StringProperties.java#L193-L197
|
152,526
|
aoindustries/ao-dao-base
|
src/main/java/com/aoindustries/dao/impl/RowCacheTable.java
|
RowCacheTable.addToCache
|
protected void addToCache(K canonicalKey, R row) {
assert ObjectUtils.equals(canonicalize(row.getKey()), canonicalKey);
rowCache.get().put(canonicalKey, row);
}
|
java
|
protected void addToCache(K canonicalKey, R row) {
assert ObjectUtils.equals(canonicalize(row.getKey()), canonicalKey);
rowCache.get().put(canonicalKey, row);
}
|
[
"protected",
"void",
"addToCache",
"(",
"K",
"canonicalKey",
",",
"R",
"row",
")",
"{",
"assert",
"ObjectUtils",
".",
"equals",
"(",
"canonicalize",
"(",
"row",
".",
"getKey",
"(",
")",
")",
",",
"canonicalKey",
")",
";",
"rowCache",
".",
"get",
"(",
")",
".",
"put",
"(",
"canonicalKey",
",",
"row",
")",
";",
"}"
] |
Adds a single object to the cache.
|
[
"Adds",
"a",
"single",
"object",
"to",
"the",
"cache",
"."
] |
b1cde7f8d976f2d1ab57d110a77e2399ffa595ac
|
https://github.com/aoindustries/ao-dao-base/blob/b1cde7f8d976f2d1ab57d110a77e2399ffa595ac/src/main/java/com/aoindustries/dao/impl/RowCacheTable.java#L150-L153
|
152,527
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/db/MessageLog.java
|
MessageLog.createMessageHeader
|
public BaseMessageHeader createMessageHeader()
{
Map<String,Object> properties = ((PropertiesField)this.getField(MessageLog.MESSAGE_HEADER_PROPERTIES)).getProperties();
BaseMessageHeader messageHeader = null;
String strMessageHeaderClassName = this.getField(MessageLog.MESSAGE_HEADER_CLASS_NAME).toString();
String strQueueName = this.getField(MessageLog.MESSAGE_QUEUE_NAME).toString();
String strQueueType = this.getField(MessageLog.MESSAGE_QUEUE_TYPE).toString();
Object source = null;
messageHeader = BaseMessageHeader.createMessageHeader(strMessageHeaderClassName, strQueueName, strQueueType, source, properties);
if (messageHeader == null)
messageHeader = new TrxMessageHeader(null, properties);
if (messageHeader instanceof TrxMessageHeader)
{
properties = ((PropertiesField)this.getField(MessageLog.MESSAGE_INFO_PROPERTIES)).getProperties();
((TrxMessageHeader)messageHeader).setMessageInfoMap(properties);
properties = ((PropertiesField)this.getField(MessageLog.MESSAGE_TRANSPORT_PROPERTIES)).getProperties();
((TrxMessageHeader)messageHeader).setMessageTransportMap(properties);
((TrxMessageHeader)messageHeader).put(TrxMessageHeader.LOG_TRX_ID, this.getCounterField().toString()); // Should be there
}
return messageHeader;
}
|
java
|
public BaseMessageHeader createMessageHeader()
{
Map<String,Object> properties = ((PropertiesField)this.getField(MessageLog.MESSAGE_HEADER_PROPERTIES)).getProperties();
BaseMessageHeader messageHeader = null;
String strMessageHeaderClassName = this.getField(MessageLog.MESSAGE_HEADER_CLASS_NAME).toString();
String strQueueName = this.getField(MessageLog.MESSAGE_QUEUE_NAME).toString();
String strQueueType = this.getField(MessageLog.MESSAGE_QUEUE_TYPE).toString();
Object source = null;
messageHeader = BaseMessageHeader.createMessageHeader(strMessageHeaderClassName, strQueueName, strQueueType, source, properties);
if (messageHeader == null)
messageHeader = new TrxMessageHeader(null, properties);
if (messageHeader instanceof TrxMessageHeader)
{
properties = ((PropertiesField)this.getField(MessageLog.MESSAGE_INFO_PROPERTIES)).getProperties();
((TrxMessageHeader)messageHeader).setMessageInfoMap(properties);
properties = ((PropertiesField)this.getField(MessageLog.MESSAGE_TRANSPORT_PROPERTIES)).getProperties();
((TrxMessageHeader)messageHeader).setMessageTransportMap(properties);
((TrxMessageHeader)messageHeader).put(TrxMessageHeader.LOG_TRX_ID, this.getCounterField().toString()); // Should be there
}
return messageHeader;
}
|
[
"public",
"BaseMessageHeader",
"createMessageHeader",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"(",
"(",
"PropertiesField",
")",
"this",
".",
"getField",
"(",
"MessageLog",
".",
"MESSAGE_HEADER_PROPERTIES",
")",
")",
".",
"getProperties",
"(",
")",
";",
"BaseMessageHeader",
"messageHeader",
"=",
"null",
";",
"String",
"strMessageHeaderClassName",
"=",
"this",
".",
"getField",
"(",
"MessageLog",
".",
"MESSAGE_HEADER_CLASS_NAME",
")",
".",
"toString",
"(",
")",
";",
"String",
"strQueueName",
"=",
"this",
".",
"getField",
"(",
"MessageLog",
".",
"MESSAGE_QUEUE_NAME",
")",
".",
"toString",
"(",
")",
";",
"String",
"strQueueType",
"=",
"this",
".",
"getField",
"(",
"MessageLog",
".",
"MESSAGE_QUEUE_TYPE",
")",
".",
"toString",
"(",
")",
";",
"Object",
"source",
"=",
"null",
";",
"messageHeader",
"=",
"BaseMessageHeader",
".",
"createMessageHeader",
"(",
"strMessageHeaderClassName",
",",
"strQueueName",
",",
"strQueueType",
",",
"source",
",",
"properties",
")",
";",
"if",
"(",
"messageHeader",
"==",
"null",
")",
"messageHeader",
"=",
"new",
"TrxMessageHeader",
"(",
"null",
",",
"properties",
")",
";",
"if",
"(",
"messageHeader",
"instanceof",
"TrxMessageHeader",
")",
"{",
"properties",
"=",
"(",
"(",
"PropertiesField",
")",
"this",
".",
"getField",
"(",
"MessageLog",
".",
"MESSAGE_INFO_PROPERTIES",
")",
")",
".",
"getProperties",
"(",
")",
";",
"(",
"(",
"TrxMessageHeader",
")",
"messageHeader",
")",
".",
"setMessageInfoMap",
"(",
"properties",
")",
";",
"properties",
"=",
"(",
"(",
"PropertiesField",
")",
"this",
".",
"getField",
"(",
"MessageLog",
".",
"MESSAGE_TRANSPORT_PROPERTIES",
")",
")",
".",
"getProperties",
"(",
")",
";",
"(",
"(",
"TrxMessageHeader",
")",
"messageHeader",
")",
".",
"setMessageTransportMap",
"(",
"properties",
")",
";",
"(",
"(",
"TrxMessageHeader",
")",
"messageHeader",
")",
".",
"put",
"(",
"TrxMessageHeader",
".",
"LOG_TRX_ID",
",",
"this",
".",
"getCounterField",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"// Should be there",
"}",
"return",
"messageHeader",
";",
"}"
] |
CreateMessageHeader Method.
|
[
"CreateMessageHeader",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageLog.java#L313-L333
|
152,528
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/db/MessageLog.java
|
MessageLog.createMessageData
|
public BaseMessageRecordDesc createMessageData()
{
MessageRecordDesc messageData = null;
String strMessageDataClassName = this.getField(MessageLog.MESSAGE_DATA_CLASS_NAME).toString();
return MessageRecordDesc.createMessageRecordDesc(strMessageDataClassName, null, null);
}
|
java
|
public BaseMessageRecordDesc createMessageData()
{
MessageRecordDesc messageData = null;
String strMessageDataClassName = this.getField(MessageLog.MESSAGE_DATA_CLASS_NAME).toString();
return MessageRecordDesc.createMessageRecordDesc(strMessageDataClassName, null, null);
}
|
[
"public",
"BaseMessageRecordDesc",
"createMessageData",
"(",
")",
"{",
"MessageRecordDesc",
"messageData",
"=",
"null",
";",
"String",
"strMessageDataClassName",
"=",
"this",
".",
"getField",
"(",
"MessageLog",
".",
"MESSAGE_DATA_CLASS_NAME",
")",
".",
"toString",
"(",
")",
";",
"return",
"MessageRecordDesc",
".",
"createMessageRecordDesc",
"(",
"strMessageDataClassName",
",",
"null",
",",
"null",
")",
";",
"}"
] |
CreateMessageData Method.
|
[
"CreateMessageData",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageLog.java#L337-L342
|
152,529
|
jbundle/jbundle
|
main/msg/src/main/java/org/jbundle/main/msg/db/MessageLog.java
|
MessageLog.getProperty
|
public String getProperty(String strKey)
{
String strProperty = this.getMessageProperty(strKey);
if (strProperty == null)
strProperty = ((PropertiesField)this.getField(MessageLog.MESSAGE_HEADER_PROPERTIES)).getProperty(strKey);
if (strProperty == null)
strProperty = ((PropertiesField)this.getField(MessageLog.MESSAGE_INFO_PROPERTIES)).getProperty(strKey);
if (strProperty == null)
strProperty = ((PropertiesField)this.getField(MessageLog.MESSAGE_TRANSPORT_PROPERTIES)).getProperty(strKey);
return strProperty;
}
|
java
|
public String getProperty(String strKey)
{
String strProperty = this.getMessageProperty(strKey);
if (strProperty == null)
strProperty = ((PropertiesField)this.getField(MessageLog.MESSAGE_HEADER_PROPERTIES)).getProperty(strKey);
if (strProperty == null)
strProperty = ((PropertiesField)this.getField(MessageLog.MESSAGE_INFO_PROPERTIES)).getProperty(strKey);
if (strProperty == null)
strProperty = ((PropertiesField)this.getField(MessageLog.MESSAGE_TRANSPORT_PROPERTIES)).getProperty(strKey);
return strProperty;
}
|
[
"public",
"String",
"getProperty",
"(",
"String",
"strKey",
")",
"{",
"String",
"strProperty",
"=",
"this",
".",
"getMessageProperty",
"(",
"strKey",
")",
";",
"if",
"(",
"strProperty",
"==",
"null",
")",
"strProperty",
"=",
"(",
"(",
"PropertiesField",
")",
"this",
".",
"getField",
"(",
"MessageLog",
".",
"MESSAGE_HEADER_PROPERTIES",
")",
")",
".",
"getProperty",
"(",
"strKey",
")",
";",
"if",
"(",
"strProperty",
"==",
"null",
")",
"strProperty",
"=",
"(",
"(",
"PropertiesField",
")",
"this",
".",
"getField",
"(",
"MessageLog",
".",
"MESSAGE_INFO_PROPERTIES",
")",
")",
".",
"getProperty",
"(",
"strKey",
")",
";",
"if",
"(",
"strProperty",
"==",
"null",
")",
"strProperty",
"=",
"(",
"(",
"PropertiesField",
")",
"this",
".",
"getField",
"(",
"MessageLog",
".",
"MESSAGE_TRANSPORT_PROPERTIES",
")",
")",
".",
"getProperty",
"(",
"strKey",
")",
";",
"return",
"strProperty",
";",
"}"
] |
Get this property from this record.
|
[
"Get",
"this",
"property",
"from",
"this",
"record",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageLog.java#L380-L390
|
152,530
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/lang/Primitives.java
|
Primitives.toDigits
|
public static final IntStream toDigits(long v, int length, int radix)
{
Spliterator.OfInt spliterator = Spliterators.spliterator(new PRimIt(v, length, radix), Long.MAX_VALUE, 0);
return StreamSupport.intStream(spliterator, false);
}
|
java
|
public static final IntStream toDigits(long v, int length, int radix)
{
Spliterator.OfInt spliterator = Spliterators.spliterator(new PRimIt(v, length, radix), Long.MAX_VALUE, 0);
return StreamSupport.intStream(spliterator, false);
}
|
[
"public",
"static",
"final",
"IntStream",
"toDigits",
"(",
"long",
"v",
",",
"int",
"length",
",",
"int",
"radix",
")",
"{",
"Spliterator",
".",
"OfInt",
"spliterator",
"=",
"Spliterators",
".",
"spliterator",
"(",
"new",
"PRimIt",
"(",
"v",
",",
"length",
",",
"radix",
")",
",",
"Long",
".",
"MAX_VALUE",
",",
"0",
")",
";",
"return",
"StreamSupport",
".",
"intStream",
"(",
"spliterator",
",",
"false",
")",
";",
"}"
] |
Returns IntStream where each item is a digit. I.e zero leading digits.
@param v
@param length
@param radix
@return
|
[
"Returns",
"IntStream",
"where",
"each",
"item",
"is",
"a",
"digit",
".",
"I",
".",
"e",
"zero",
"leading",
"digits",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L79-L83
|
152,531
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/lang/Primitives.java
|
Primitives.parseChar
|
public static final char parseChar(CharSequence cs, int beginIndex, int endIndex)
{
if (endIndex - beginIndex != 1)
{
throw new IllegalArgumentException("input length must be 1");
}
return cs.charAt(beginIndex);
}
|
java
|
public static final char parseChar(CharSequence cs, int beginIndex, int endIndex)
{
if (endIndex - beginIndex != 1)
{
throw new IllegalArgumentException("input length must be 1");
}
return cs.charAt(beginIndex);
}
|
[
"public",
"static",
"final",
"char",
"parseChar",
"(",
"CharSequence",
"cs",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"if",
"(",
"endIndex",
"-",
"beginIndex",
"!=",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"input length must be 1\"",
")",
";",
"}",
"return",
"cs",
".",
"charAt",
"(",
"beginIndex",
")",
";",
"}"
] |
Returns char from input.
@param cs
@param beginIndex the index to the first char of the text range.
@param endIndex the index after the last char of the text range.
@return
@throws IllegalArgumentException if input length is not 1.
|
[
"Returns",
"char",
"from",
"input",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L471-L478
|
152,532
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/lang/Primitives.java
|
Primitives.parseBoolean
|
public static final boolean parseBoolean(CharSequence cs, int beginIndex, int endIndex)
{
return
endIndex - beginIndex == 4 &&
Character.codePointCount(cs, beginIndex, endIndex) == 4 &&
Character.toUpperCase(Character.codePointAt(cs, beginIndex)) == 'T' &&
Character.toUpperCase(Character.codePointAt(cs, beginIndex+1)) == 'R' &&
Character.toUpperCase(Character.codePointAt(cs, beginIndex+2)) == 'U' &&
Character.toUpperCase(Character.codePointAt(cs, beginIndex+3)) == 'E';
}
|
java
|
public static final boolean parseBoolean(CharSequence cs, int beginIndex, int endIndex)
{
return
endIndex - beginIndex == 4 &&
Character.codePointCount(cs, beginIndex, endIndex) == 4 &&
Character.toUpperCase(Character.codePointAt(cs, beginIndex)) == 'T' &&
Character.toUpperCase(Character.codePointAt(cs, beginIndex+1)) == 'R' &&
Character.toUpperCase(Character.codePointAt(cs, beginIndex+2)) == 'U' &&
Character.toUpperCase(Character.codePointAt(cs, beginIndex+3)) == 'E';
}
|
[
"public",
"static",
"final",
"boolean",
"parseBoolean",
"(",
"CharSequence",
"cs",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"return",
"endIndex",
"-",
"beginIndex",
"==",
"4",
"&&",
"Character",
".",
"codePointCount",
"(",
"cs",
",",
"beginIndex",
",",
"endIndex",
")",
"==",
"4",
"&&",
"Character",
".",
"toUpperCase",
"(",
"Character",
".",
"codePointAt",
"(",
"cs",
",",
"beginIndex",
")",
")",
"==",
"'",
"'",
"&&",
"Character",
".",
"toUpperCase",
"(",
"Character",
".",
"codePointAt",
"(",
"cs",
",",
"beginIndex",
"+",
"1",
")",
")",
"==",
"'",
"'",
"&&",
"Character",
".",
"toUpperCase",
"(",
"Character",
".",
"codePointAt",
"(",
"cs",
",",
"beginIndex",
"+",
"2",
")",
")",
"==",
"'",
"'",
"&&",
"Character",
".",
"toUpperCase",
"(",
"Character",
".",
"codePointAt",
"(",
"cs",
",",
"beginIndex",
"+",
"3",
")",
")",
"==",
"'",
"'",
";",
"}"
] |
Parses the char sequence argument as a boolean. The boolean returned represents
the value true if the char sequence argument is not null and is equal, ignoring
case, to the string "true".
@param cs
@param beginIndex the index to the first char of the text range.
@param endIndex the index after the last char of the text range.
@return
@throws IllegalArgumentException if input length is not 4.
@see java.lang.Boolean#parseBoolean(java.lang.String)
|
[
"Parses",
"the",
"char",
"sequence",
"argument",
"as",
"a",
"boolean",
".",
"The",
"boolean",
"returned",
"represents",
"the",
"value",
"true",
"if",
"the",
"char",
"sequence",
"argument",
"is",
"not",
"null",
"and",
"is",
"equal",
"ignoring",
"case",
"to",
"the",
"string",
"true",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L503-L512
|
152,533
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/lang/Primitives.java
|
Primitives.parseBoolean
|
public static final boolean parseBoolean(CharSequence cs, int radix, int beginIndex, int endIndex)
{
if (radix != 2)
{
throw new IllegalArgumentException("radix must be 2");
}
if (Character.codePointCount(cs, beginIndex, endIndex) != 1)
{
throw new IllegalArgumentException("input length must be 1");
}
int digit = Character.digit(Character.codePointAt(cs, beginIndex), 2);
switch (digit)
{
case 1:
return true;
case 0:
return false;
default:
throw new IllegalArgumentException("input must be 0/1");
}
}
|
java
|
public static final boolean parseBoolean(CharSequence cs, int radix, int beginIndex, int endIndex)
{
if (radix != 2)
{
throw new IllegalArgumentException("radix must be 2");
}
if (Character.codePointCount(cs, beginIndex, endIndex) != 1)
{
throw new IllegalArgumentException("input length must be 1");
}
int digit = Character.digit(Character.codePointAt(cs, beginIndex), 2);
switch (digit)
{
case 1:
return true;
case 0:
return false;
default:
throw new IllegalArgumentException("input must be 0/1");
}
}
|
[
"public",
"static",
"final",
"boolean",
"parseBoolean",
"(",
"CharSequence",
"cs",
",",
"int",
"radix",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"if",
"(",
"radix",
"!=",
"2",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"radix must be 2\"",
")",
";",
"}",
"if",
"(",
"Character",
".",
"codePointCount",
"(",
"cs",
",",
"beginIndex",
",",
"endIndex",
")",
"!=",
"1",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"input length must be 1\"",
")",
";",
"}",
"int",
"digit",
"=",
"Character",
".",
"digit",
"(",
"Character",
".",
"codePointAt",
"(",
"cs",
",",
"beginIndex",
")",
",",
"2",
")",
";",
"switch",
"(",
"digit",
")",
"{",
"case",
"1",
":",
"return",
"true",
";",
"case",
"0",
":",
"return",
"false",
";",
"default",
":",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"input must be 0/1\"",
")",
";",
"}",
"}"
] |
Parses the char sequence argument as a boolean. The boolean returned represents
the value true if the char sequence argument is not null and it's digit value
is 1.
@param cs
@param radix Must be 2.
@param beginIndex the index to the first char of the text range.
@param endIndex the index after the last char of the text range.
@return
@throws IllegalArgumentException radix != 2 or if code point count != 1
or if input digit is not 0/1.
@see java.lang.Character#digit(int, int)
@see java.lang.Character#codePointCount(java.lang.CharSequence, int, int)
|
[
"Parses",
"the",
"char",
"sequence",
"argument",
"as",
"a",
"boolean",
".",
"The",
"boolean",
"returned",
"represents",
"the",
"value",
"true",
"if",
"the",
"char",
"sequence",
"argument",
"is",
"not",
"null",
"and",
"it",
"s",
"digit",
"value",
"is",
"1",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L543-L563
|
152,534
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/lang/Primitives.java
|
Primitives.parseFloat
|
public static final float parseFloat(CharSequence cs, int beginIndex, int endIndex)
{
FloatState fs = FloatState.Significand;
int end = endIndex;
int significand = 0;
int sign = 1;
int index = beginIndex;
int decimal = 0;
int exponent = 0;
int exponentSign = 1;
boolean overFlow = false;
int cp = Character.codePointAt(cs, index);
if (cp == '+')
{
index++;
}
if (cp == '-')
{
sign = -1;
index++;
}
if (index >= end)
{
throw new NumberFormatException("unparsable number "+cs.subSequence(beginIndex, endIndex));
}
while (index < end)
{
cp = Character.codePointAt(cs, index);
if (Character.isBmpCodePoint(cp))
{
index++;
}
else
{
index += 2;
}
switch (cp)
{
default:
int digit = Character.digit(cp, 10);
if (digit != -1)
{
if (!overFlow && significand > INT_LIMIT)
{
overFlow = true;
}
switch (fs)
{
case Significand:
if (!overFlow)
{
significand *= 10;
significand += digit;
}
else
{
decimal++;
}
break;
case Decimal:
if (!overFlow)
{
significand *= 10;
significand += digit;
decimal--;
}
break;
case Exponent:
exponent = 10*exponent + digit;
break;
}
}
else
{
throw new NumberFormatException("no float "+cs.subSequence(beginIndex, endIndex));
}
break;
case '.':
if (fs != FloatState.Significand)
{
throw new NumberFormatException("cannot convert "+cs.subSequence(beginIndex, endIndex)+" to float");
}
fs = FloatState.Decimal;
break;
case 'e':
case 'E':
if (fs == FloatState.Exponent)
{
throw new NumberFormatException("cannot convert "+cs.subSequence(beginIndex, endIndex)+" to float");
}
fs = FloatState.Exponent;
break;
case '-':
if (fs != FloatState.Exponent)
{
throw new NumberFormatException("cannot convert "+cs.subSequence(beginIndex, endIndex)+" to float");
}
exponentSign = -1;
break;
case '+':
if (fs != FloatState.Exponent)
{
throw new NumberFormatException("cannot convert "+cs.subSequence(beginIndex, endIndex)+" to float");
}
break;
}
}
return (float) (sign * significand * Math.pow(10, exponentSign*exponent+decimal));
}
|
java
|
public static final float parseFloat(CharSequence cs, int beginIndex, int endIndex)
{
FloatState fs = FloatState.Significand;
int end = endIndex;
int significand = 0;
int sign = 1;
int index = beginIndex;
int decimal = 0;
int exponent = 0;
int exponentSign = 1;
boolean overFlow = false;
int cp = Character.codePointAt(cs, index);
if (cp == '+')
{
index++;
}
if (cp == '-')
{
sign = -1;
index++;
}
if (index >= end)
{
throw new NumberFormatException("unparsable number "+cs.subSequence(beginIndex, endIndex));
}
while (index < end)
{
cp = Character.codePointAt(cs, index);
if (Character.isBmpCodePoint(cp))
{
index++;
}
else
{
index += 2;
}
switch (cp)
{
default:
int digit = Character.digit(cp, 10);
if (digit != -1)
{
if (!overFlow && significand > INT_LIMIT)
{
overFlow = true;
}
switch (fs)
{
case Significand:
if (!overFlow)
{
significand *= 10;
significand += digit;
}
else
{
decimal++;
}
break;
case Decimal:
if (!overFlow)
{
significand *= 10;
significand += digit;
decimal--;
}
break;
case Exponent:
exponent = 10*exponent + digit;
break;
}
}
else
{
throw new NumberFormatException("no float "+cs.subSequence(beginIndex, endIndex));
}
break;
case '.':
if (fs != FloatState.Significand)
{
throw new NumberFormatException("cannot convert "+cs.subSequence(beginIndex, endIndex)+" to float");
}
fs = FloatState.Decimal;
break;
case 'e':
case 'E':
if (fs == FloatState.Exponent)
{
throw new NumberFormatException("cannot convert "+cs.subSequence(beginIndex, endIndex)+" to float");
}
fs = FloatState.Exponent;
break;
case '-':
if (fs != FloatState.Exponent)
{
throw new NumberFormatException("cannot convert "+cs.subSequence(beginIndex, endIndex)+" to float");
}
exponentSign = -1;
break;
case '+':
if (fs != FloatState.Exponent)
{
throw new NumberFormatException("cannot convert "+cs.subSequence(beginIndex, endIndex)+" to float");
}
break;
}
}
return (float) (sign * significand * Math.pow(10, exponentSign*exponent+decimal));
}
|
[
"public",
"static",
"final",
"float",
"parseFloat",
"(",
"CharSequence",
"cs",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"FloatState",
"fs",
"=",
"FloatState",
".",
"Significand",
";",
"int",
"end",
"=",
"endIndex",
";",
"int",
"significand",
"=",
"0",
";",
"int",
"sign",
"=",
"1",
";",
"int",
"index",
"=",
"beginIndex",
";",
"int",
"decimal",
"=",
"0",
";",
"int",
"exponent",
"=",
"0",
";",
"int",
"exponentSign",
"=",
"1",
";",
"boolean",
"overFlow",
"=",
"false",
";",
"int",
"cp",
"=",
"Character",
".",
"codePointAt",
"(",
"cs",
",",
"index",
")",
";",
"if",
"(",
"cp",
"==",
"'",
"'",
")",
"{",
"index",
"++",
";",
"}",
"if",
"(",
"cp",
"==",
"'",
"'",
")",
"{",
"sign",
"=",
"-",
"1",
";",
"index",
"++",
";",
"}",
"if",
"(",
"index",
">=",
"end",
")",
"{",
"throw",
"new",
"NumberFormatException",
"(",
"\"unparsable number \"",
"+",
"cs",
".",
"subSequence",
"(",
"beginIndex",
",",
"endIndex",
")",
")",
";",
"}",
"while",
"(",
"index",
"<",
"end",
")",
"{",
"cp",
"=",
"Character",
".",
"codePointAt",
"(",
"cs",
",",
"index",
")",
";",
"if",
"(",
"Character",
".",
"isBmpCodePoint",
"(",
"cp",
")",
")",
"{",
"index",
"++",
";",
"}",
"else",
"{",
"index",
"+=",
"2",
";",
"}",
"switch",
"(",
"cp",
")",
"{",
"default",
":",
"int",
"digit",
"=",
"Character",
".",
"digit",
"(",
"cp",
",",
"10",
")",
";",
"if",
"(",
"digit",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"!",
"overFlow",
"&&",
"significand",
">",
"INT_LIMIT",
")",
"{",
"overFlow",
"=",
"true",
";",
"}",
"switch",
"(",
"fs",
")",
"{",
"case",
"Significand",
":",
"if",
"(",
"!",
"overFlow",
")",
"{",
"significand",
"*=",
"10",
";",
"significand",
"+=",
"digit",
";",
"}",
"else",
"{",
"decimal",
"++",
";",
"}",
"break",
";",
"case",
"Decimal",
":",
"if",
"(",
"!",
"overFlow",
")",
"{",
"significand",
"*=",
"10",
";",
"significand",
"+=",
"digit",
";",
"decimal",
"--",
";",
"}",
"break",
";",
"case",
"Exponent",
":",
"exponent",
"=",
"10",
"*",
"exponent",
"+",
"digit",
";",
"break",
";",
"}",
"}",
"else",
"{",
"throw",
"new",
"NumberFormatException",
"(",
"\"no float \"",
"+",
"cs",
".",
"subSequence",
"(",
"beginIndex",
",",
"endIndex",
")",
")",
";",
"}",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"fs",
"!=",
"FloatState",
".",
"Significand",
")",
"{",
"throw",
"new",
"NumberFormatException",
"(",
"\"cannot convert \"",
"+",
"cs",
".",
"subSequence",
"(",
"beginIndex",
",",
"endIndex",
")",
"+",
"\" to float\"",
")",
";",
"}",
"fs",
"=",
"FloatState",
".",
"Decimal",
";",
"break",
";",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"if",
"(",
"fs",
"==",
"FloatState",
".",
"Exponent",
")",
"{",
"throw",
"new",
"NumberFormatException",
"(",
"\"cannot convert \"",
"+",
"cs",
".",
"subSequence",
"(",
"beginIndex",
",",
"endIndex",
")",
"+",
"\" to float\"",
")",
";",
"}",
"fs",
"=",
"FloatState",
".",
"Exponent",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"fs",
"!=",
"FloatState",
".",
"Exponent",
")",
"{",
"throw",
"new",
"NumberFormatException",
"(",
"\"cannot convert \"",
"+",
"cs",
".",
"subSequence",
"(",
"beginIndex",
",",
"endIndex",
")",
"+",
"\" to float\"",
")",
";",
"}",
"exponentSign",
"=",
"-",
"1",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"fs",
"!=",
"FloatState",
".",
"Exponent",
")",
"{",
"throw",
"new",
"NumberFormatException",
"(",
"\"cannot convert \"",
"+",
"cs",
".",
"subSequence",
"(",
"beginIndex",
",",
"endIndex",
")",
"+",
"\" to float\"",
")",
";",
"}",
"break",
";",
"}",
"}",
"return",
"(",
"float",
")",
"(",
"sign",
"*",
"significand",
"*",
"Math",
".",
"pow",
"(",
"10",
",",
"exponentSign",
"*",
"exponent",
"+",
"decimal",
")",
")",
";",
"}"
] |
Parses float from decimal floating point representation.
<p>Input can start with '-' or '+'.
<p>All numbers are decimals.
<p>Decimal separator is '.'
<p>Exponent separator is 'e' or 'E'
<p>Examples
<p>-1234.56
<p>+1234.56e12
<p>-1234.56E-12
@param cs
@param beginIndex the index to the first char of the text range.
@param endIndex the index after the last char of the text range.
@return
@see java.lang.Float#parseFloat(java.lang.String)
@see java.lang.Character#digit(int, int)
@throws java.lang.NumberFormatException if input cannot be parsed to proper
float.
|
[
"Parses",
"float",
"from",
"decimal",
"floating",
"point",
"representation",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L606-L714
|
152,535
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/lang/Primitives.java
|
Primitives.findInt
|
public static final int findInt(CharSequence cs, int radix, int beginIndex, int endIndex)
{
IntPredicate predicate = null;
switch (radix)
{
case 8:
predicate = Primitives::isOctalDigit;
break;
case 10:
predicate = Primitives::isDecimalDigit;
break;
case 16:
predicate = Primitives::isHexDigit;
break;
default:
throw new UnsupportedOperationException("radix "+radix+" not supported");
}
int begin = CharSequences.indexOf(cs, predicate, beginIndex);
int end = CharSequences.indexOf(cs, predicate.negate(), begin);
return parseInt(cs, radix, begin, endIndex(end, endIndex));
}
|
java
|
public static final int findInt(CharSequence cs, int radix, int beginIndex, int endIndex)
{
IntPredicate predicate = null;
switch (radix)
{
case 8:
predicate = Primitives::isOctalDigit;
break;
case 10:
predicate = Primitives::isDecimalDigit;
break;
case 16:
predicate = Primitives::isHexDigit;
break;
default:
throw new UnsupportedOperationException("radix "+radix+" not supported");
}
int begin = CharSequences.indexOf(cs, predicate, beginIndex);
int end = CharSequences.indexOf(cs, predicate.negate(), begin);
return parseInt(cs, radix, begin, endIndex(end, endIndex));
}
|
[
"public",
"static",
"final",
"int",
"findInt",
"(",
"CharSequence",
"cs",
",",
"int",
"radix",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"IntPredicate",
"predicate",
"=",
"null",
";",
"switch",
"(",
"radix",
")",
"{",
"case",
"8",
":",
"predicate",
"=",
"Primitives",
"::",
"isOctalDigit",
";",
"break",
";",
"case",
"10",
":",
"predicate",
"=",
"Primitives",
"::",
"isDecimalDigit",
";",
"break",
";",
"case",
"16",
":",
"predicate",
"=",
"Primitives",
"::",
"isHexDigit",
";",
"break",
";",
"default",
":",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"radix \"",
"+",
"radix",
"+",
"\" not supported\"",
")",
";",
"}",
"int",
"begin",
"=",
"CharSequences",
".",
"indexOf",
"(",
"cs",
",",
"predicate",
",",
"beginIndex",
")",
";",
"int",
"end",
"=",
"CharSequences",
".",
"indexOf",
"(",
"cs",
",",
"predicate",
".",
"negate",
"(",
")",
",",
"begin",
")",
";",
"return",
"parseInt",
"(",
"cs",
",",
"radix",
",",
"begin",
",",
"endIndex",
"(",
"end",
",",
"endIndex",
")",
")",
";",
"}"
] |
Parses next int
@param cs
@param radix
@param beginIndex
@param endIndex
@return
|
[
"Parses",
"next",
"int"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L1563-L1583
|
152,536
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/lang/Primitives.java
|
Primitives.findFloat
|
public static final float findFloat(CharSequence cs, int beginIndex, int endIndex)
{
int begin = CharSequences.indexOf(cs, Primitives::isFloatDigit, beginIndex);
int end = CharSequences.indexOf(cs, (c)->!Primitives.isFloatDigit(c), begin);
return parseFloat(cs, begin, endIndex(end, endIndex));
}
|
java
|
public static final float findFloat(CharSequence cs, int beginIndex, int endIndex)
{
int begin = CharSequences.indexOf(cs, Primitives::isFloatDigit, beginIndex);
int end = CharSequences.indexOf(cs, (c)->!Primitives.isFloatDigit(c), begin);
return parseFloat(cs, begin, endIndex(end, endIndex));
}
|
[
"public",
"static",
"final",
"float",
"findFloat",
"(",
"CharSequence",
"cs",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"int",
"begin",
"=",
"CharSequences",
".",
"indexOf",
"(",
"cs",
",",
"Primitives",
"::",
"isFloatDigit",
",",
"beginIndex",
")",
";",
"int",
"end",
"=",
"CharSequences",
".",
"indexOf",
"(",
"cs",
",",
"(",
"c",
")",
"-",
">",
"!",
"Primitives",
".",
"isFloatDigit",
"(",
"c",
")",
",",
"begin",
")",
";",
"return",
"parseFloat",
"(",
"cs",
",",
"begin",
",",
"endIndex",
"(",
"end",
",",
"endIndex",
")",
")",
";",
"}"
] |
Parses next float
@param cs
@param beginIndex
@param endIndex
@return
|
[
"Parses",
"next",
"float"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L1659-L1664
|
152,537
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/lang/Primitives.java
|
Primitives.findDouble
|
public static final double findDouble(CharSequence cs, int beginIndex, int endIndex)
{
int begin = CharSequences.indexOf(cs, Primitives::isFloatDigit, beginIndex);
int end = CharSequences.indexOf(cs, (c)->!Primitives.isFloatDigit(c), begin);
return parseDouble(cs, begin, endIndex(end, endIndex));
}
|
java
|
public static final double findDouble(CharSequence cs, int beginIndex, int endIndex)
{
int begin = CharSequences.indexOf(cs, Primitives::isFloatDigit, beginIndex);
int end = CharSequences.indexOf(cs, (c)->!Primitives.isFloatDigit(c), begin);
return parseDouble(cs, begin, endIndex(end, endIndex));
}
|
[
"public",
"static",
"final",
"double",
"findDouble",
"(",
"CharSequence",
"cs",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"int",
"begin",
"=",
"CharSequences",
".",
"indexOf",
"(",
"cs",
",",
"Primitives",
"::",
"isFloatDigit",
",",
"beginIndex",
")",
";",
"int",
"end",
"=",
"CharSequences",
".",
"indexOf",
"(",
"cs",
",",
"(",
"c",
")",
"-",
">",
"!",
"Primitives",
".",
"isFloatDigit",
"(",
"c",
")",
",",
"begin",
")",
";",
"return",
"parseDouble",
"(",
"cs",
",",
"begin",
",",
"endIndex",
"(",
"end",
",",
"endIndex",
")",
")",
";",
"}"
] |
Parses next double in decimal form
@param cs
@param beginIndex
@param endIndex
@return
|
[
"Parses",
"next",
"double",
"in",
"decimal",
"form"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L1681-L1686
|
152,538
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/lang/Primitives.java
|
Primitives.findScientific
|
public static final double findScientific(CharSequence cs, int beginIndex, int endIndex)
{
int begin = CharSequences.indexOf(cs, Primitives::isScientificDigit, beginIndex);
int end = CharSequences.indexOf(cs, (c)->!Primitives.isScientificDigit(c), begin);
return parseDouble(cs, begin, endIndex(end, endIndex));
}
|
java
|
public static final double findScientific(CharSequence cs, int beginIndex, int endIndex)
{
int begin = CharSequences.indexOf(cs, Primitives::isScientificDigit, beginIndex);
int end = CharSequences.indexOf(cs, (c)->!Primitives.isScientificDigit(c), begin);
return parseDouble(cs, begin, endIndex(end, endIndex));
}
|
[
"public",
"static",
"final",
"double",
"findScientific",
"(",
"CharSequence",
"cs",
",",
"int",
"beginIndex",
",",
"int",
"endIndex",
")",
"{",
"int",
"begin",
"=",
"CharSequences",
".",
"indexOf",
"(",
"cs",
",",
"Primitives",
"::",
"isScientificDigit",
",",
"beginIndex",
")",
";",
"int",
"end",
"=",
"CharSequences",
".",
"indexOf",
"(",
"cs",
",",
"(",
"c",
")",
"-",
">",
"!",
"Primitives",
".",
"isScientificDigit",
"(",
"c",
")",
",",
"begin",
")",
";",
"return",
"parseDouble",
"(",
"cs",
",",
"begin",
",",
"endIndex",
"(",
"end",
",",
"endIndex",
")",
")",
";",
"}"
] |
Parses next double in scientific form
@param cs
@param beginIndex
@param endIndex
@return
|
[
"Parses",
"next",
"double",
"in",
"scientific",
"form"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/lang/Primitives.java#L1703-L1708
|
152,539
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/math/BernsteinPolynomial.java
|
BernsteinPolynomial.b
|
public static DoubleUnaryOperator b(int n, int m)
{
return (t)->c(n,m)*Math.pow(t, m)*Math.pow(1-t, n-m);
}
|
java
|
public static DoubleUnaryOperator b(int n, int m)
{
return (t)->c(n,m)*Math.pow(t, m)*Math.pow(1-t, n-m);
}
|
[
"public",
"static",
"DoubleUnaryOperator",
"b",
"(",
"int",
"n",
",",
"int",
"m",
")",
"{",
"return",
"(",
"t",
")",
"-",
"",
">",
"c",
"(",
"n",
",",
"m",
")",
"*",
"Math",
".",
"pow",
"(",
"t",
",",
"m",
")",
"*",
"Math",
".",
"pow",
"(",
"1",
"-",
"t",
",",
"n",
"-",
"m",
")",
";",
"}"
] |
Returns Bernstein polynomial
@param n
@param m
@return
|
[
"Returns",
"Bernstein",
"polynomial"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/BernsteinPolynomial.java#L34-L37
|
152,540
|
openCage/kleinod-mixed
|
src/main/java/de/pfabulist/kleinod/text/Strings.java
|
Strings.toFirstLower
|
public static String toFirstLower( String name ) {
if ( isEmpty( name )) {
return name;
}
return "" + name.toLowerCase( Locale.ROOT ).charAt(0) + name.substring(1);
}
|
java
|
public static String toFirstLower( String name ) {
if ( isEmpty( name )) {
return name;
}
return "" + name.toLowerCase( Locale.ROOT ).charAt(0) + name.substring(1);
}
|
[
"public",
"static",
"String",
"toFirstLower",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"name",
")",
")",
"{",
"return",
"name",
";",
"}",
"return",
"\"\"",
"+",
"name",
".",
"toLowerCase",
"(",
"Locale",
".",
"ROOT",
")",
".",
"charAt",
"(",
"0",
")",
"+",
"name",
".",
"substring",
"(",
"1",
")",
";",
"}"
] |
Make the first character lower case
@param name Any String
@return A String
|
[
"Make",
"the",
"first",
"character",
"lower",
"case"
] |
a589fe205150bfeeaed03620f8db9de546c64d84
|
https://github.com/openCage/kleinod-mixed/blob/a589fe205150bfeeaed03620f8db9de546c64d84/src/main/java/de/pfabulist/kleinod/text/Strings.java#L31-L36
|
152,541
|
openCage/kleinod-mixed
|
src/main/java/de/pfabulist/kleinod/text/Strings.java
|
Strings.toFirstUpper
|
public static String toFirstUpper(String name) {
if ( isEmpty( name )) {
return name;
}
return "" + name.toUpperCase( Locale.ROOT ).charAt(0) + name.substring(1);
}
|
java
|
public static String toFirstUpper(String name) {
if ( isEmpty( name )) {
return name;
}
return "" + name.toUpperCase( Locale.ROOT ).charAt(0) + name.substring(1);
}
|
[
"public",
"static",
"String",
"toFirstUpper",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"isEmpty",
"(",
"name",
")",
")",
"{",
"return",
"name",
";",
"}",
"return",
"\"\"",
"+",
"name",
".",
"toUpperCase",
"(",
"Locale",
".",
"ROOT",
")",
".",
"charAt",
"(",
"0",
")",
"+",
"name",
".",
"substring",
"(",
"1",
")",
";",
"}"
] |
Make the first character upper case
@param name Any String
@return A String
|
[
"Make",
"the",
"first",
"character",
"upper",
"case"
] |
a589fe205150bfeeaed03620f8db9de546c64d84
|
https://github.com/openCage/kleinod-mixed/blob/a589fe205150bfeeaed03620f8db9de546c64d84/src/main/java/de/pfabulist/kleinod/text/Strings.java#L52-L57
|
152,542
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
|
DateTimeField.getInputType
|
public String getInputType(String strViewType)
{
if (ScreenModel.HTML_TYPE.equalsIgnoreCase(strViewType))
return "date";
else //if (TopScreen.XML_TYPE.equalsIgnoreCase(strViewType))
return super.getInputType(strViewType);
}
|
java
|
public String getInputType(String strViewType)
{
if (ScreenModel.HTML_TYPE.equalsIgnoreCase(strViewType))
return "date";
else //if (TopScreen.XML_TYPE.equalsIgnoreCase(strViewType))
return super.getInputType(strViewType);
}
|
[
"public",
"String",
"getInputType",
"(",
"String",
"strViewType",
")",
"{",
"if",
"(",
"ScreenModel",
".",
"HTML_TYPE",
".",
"equalsIgnoreCase",
"(",
"strViewType",
")",
")",
"return",
"\"date\"",
";",
"else",
"//if (TopScreen.XML_TYPE.equalsIgnoreCase(strViewType))",
"return",
"super",
".",
"getInputType",
"(",
"strViewType",
")",
";",
"}"
] |
Get the HTML Input Type.
@return The html type (date).
|
[
"Get",
"the",
"HTML",
"Input",
"Type",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L151-L157
|
152,543
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
|
DateTimeField.getSQLFromField
|
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
{
if (this.isNull())
{
if ((!this.isNullable())
|| (iType == DBConstants.SQL_SELECT_TYPE)
|| (DBConstants.FALSE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.NULL_TIMESTAMP_SUPPORTED)))) // HACK for Access
{ // Access does not allow you to pass a null for a timestamp (must pass a 0)
java.sql.Timestamp sqlDate = new java.sql.Timestamp(0);
statement.setTimestamp(iParamColumn, sqlDate);
}
else
statement.setNull(iParamColumn, Types.TIMESTAMP);
}
else
{
java.util.Date time = (java.util.Date)this.getData();
Converter.initGlobals();
Converter.gCalendar.setTime(time);
//x if (Converter.gCalendar.getTimeZone().inDaylightTime(time)) // Hack (DST Problem?)
//x Converter.gCalendar.add(Calendar.MILLISECOND, Converter.gCalendar.getTimeZone().getDSTSavings());
java.sql.Timestamp sqlDate = new java.sql.Timestamp(Converter.gCalendar.getTimeInMillis());
statement.setTimestamp(iParamColumn, sqlDate);
}
}
|
java
|
public void getSQLFromField(PreparedStatement statement, int iType, int iParamColumn) throws SQLException
{
if (this.isNull())
{
if ((!this.isNullable())
|| (iType == DBConstants.SQL_SELECT_TYPE)
|| (DBConstants.FALSE.equals(this.getRecord().getTable().getDatabase().getProperties().get(SQLParams.NULL_TIMESTAMP_SUPPORTED)))) // HACK for Access
{ // Access does not allow you to pass a null for a timestamp (must pass a 0)
java.sql.Timestamp sqlDate = new java.sql.Timestamp(0);
statement.setTimestamp(iParamColumn, sqlDate);
}
else
statement.setNull(iParamColumn, Types.TIMESTAMP);
}
else
{
java.util.Date time = (java.util.Date)this.getData();
Converter.initGlobals();
Converter.gCalendar.setTime(time);
//x if (Converter.gCalendar.getTimeZone().inDaylightTime(time)) // Hack (DST Problem?)
//x Converter.gCalendar.add(Calendar.MILLISECOND, Converter.gCalendar.getTimeZone().getDSTSavings());
java.sql.Timestamp sqlDate = new java.sql.Timestamp(Converter.gCalendar.getTimeInMillis());
statement.setTimestamp(iParamColumn, sqlDate);
}
}
|
[
"public",
"void",
"getSQLFromField",
"(",
"PreparedStatement",
"statement",
",",
"int",
"iType",
",",
"int",
"iParamColumn",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"this",
".",
"isNull",
"(",
")",
")",
"{",
"if",
"(",
"(",
"!",
"this",
".",
"isNullable",
"(",
")",
")",
"||",
"(",
"iType",
"==",
"DBConstants",
".",
"SQL_SELECT_TYPE",
")",
"||",
"(",
"DBConstants",
".",
"FALSE",
".",
"equals",
"(",
"this",
".",
"getRecord",
"(",
")",
".",
"getTable",
"(",
")",
".",
"getDatabase",
"(",
")",
".",
"getProperties",
"(",
")",
".",
"get",
"(",
"SQLParams",
".",
"NULL_TIMESTAMP_SUPPORTED",
")",
")",
")",
")",
"// HACK for Access",
"{",
"// Access does not allow you to pass a null for a timestamp (must pass a 0)",
"java",
".",
"sql",
".",
"Timestamp",
"sqlDate",
"=",
"new",
"java",
".",
"sql",
".",
"Timestamp",
"(",
"0",
")",
";",
"statement",
".",
"setTimestamp",
"(",
"iParamColumn",
",",
"sqlDate",
")",
";",
"}",
"else",
"statement",
".",
"setNull",
"(",
"iParamColumn",
",",
"Types",
".",
"TIMESTAMP",
")",
";",
"}",
"else",
"{",
"java",
".",
"util",
".",
"Date",
"time",
"=",
"(",
"java",
".",
"util",
".",
"Date",
")",
"this",
".",
"getData",
"(",
")",
";",
"Converter",
".",
"initGlobals",
"(",
")",
";",
"Converter",
".",
"gCalendar",
".",
"setTime",
"(",
"time",
")",
";",
"//x if (Converter.gCalendar.getTimeZone().inDaylightTime(time)) // Hack (DST Problem?)",
"//x Converter.gCalendar.add(Calendar.MILLISECOND, Converter.gCalendar.getTimeZone().getDSTSavings());",
"java",
".",
"sql",
".",
"Timestamp",
"sqlDate",
"=",
"new",
"java",
".",
"sql",
".",
"Timestamp",
"(",
"Converter",
".",
"gCalendar",
".",
"getTimeInMillis",
"(",
")",
")",
";",
"statement",
".",
"setTimestamp",
"(",
"iParamColumn",
",",
"sqlDate",
")",
";",
"}",
"}"
] |
Move the physical binary data to this SQL parameter row.
This method used the setTimestamp statement method.
@param statement The SQL prepare statement.
@param iType the type of SQL statement.
@param iParamColumn The column in the prepared statement to set the data.
@exception SQLException From SQL calls.
|
[
"Move",
"the",
"physical",
"binary",
"data",
"to",
"this",
"SQL",
"parameter",
"row",
".",
"This",
"method",
"used",
"the",
"setTimestamp",
"statement",
"method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L166-L190
|
152,544
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
|
DateTimeField.setValue
|
public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
java.util.Date dateTemp = new java.util.Date((long)value);
int iErrorCode = this.setData(dateTemp, bDisplayOption, iMoveMode);
return iErrorCode;
}
|
java
|
public int setValue(double value, boolean bDisplayOption, int iMoveMode)
{ // Set this field's value
java.util.Date dateTemp = new java.util.Date((long)value);
int iErrorCode = this.setData(dateTemp, bDisplayOption, iMoveMode);
return iErrorCode;
}
|
[
"public",
"int",
"setValue",
"(",
"double",
"value",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"// Set this field's value",
"java",
".",
"util",
".",
"Date",
"dateTemp",
"=",
"new",
"java",
".",
"util",
".",
"Date",
"(",
"(",
"long",
")",
"value",
")",
";",
"int",
"iErrorCode",
"=",
"this",
".",
"setData",
"(",
"dateTemp",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"return",
"iErrorCode",
";",
"}"
] |
Set the Value of this field as a double.
@param value The value of this field.
@param iDisplayOption If true, display the new field.
@param iMoveMove The move mode.
@return An error code (NORMAL_RETURN for success).
|
[
"Set",
"the",
"Value",
"of",
"this",
"field",
"as",
"a",
"double",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L251-L256
|
152,545
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
|
DateTimeField.getCalendar
|
public Calendar getCalendar()
{ // Get this field's value
java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data
if (dateValue == null)
return null;
Calendar calendar = Calendar.getInstance();
calendar.setTime(dateValue);
return calendar;
}
|
java
|
public Calendar getCalendar()
{ // Get this field's value
java.util.Date dateValue = (java.util.Date)this.getData(); // Get the physical data
if (dateValue == null)
return null;
Calendar calendar = Calendar.getInstance();
calendar.setTime(dateValue);
return calendar;
}
|
[
"public",
"Calendar",
"getCalendar",
"(",
")",
"{",
"// Get this field's value",
"java",
".",
"util",
".",
"Date",
"dateValue",
"=",
"(",
"java",
".",
"util",
".",
"Date",
")",
"this",
".",
"getData",
"(",
")",
";",
"// Get the physical data",
"if",
"(",
"dateValue",
"==",
"null",
")",
"return",
"null",
";",
"Calendar",
"calendar",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"calendar",
".",
"setTime",
"(",
"dateValue",
")",
";",
"return",
"calendar",
";",
"}"
] |
Get this field as a java calendar value.
@return This field as a calendar value.
|
[
"Get",
"this",
"field",
"as",
"a",
"java",
"calendar",
"value",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L269-L277
|
152,546
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
|
DateTimeField.setTime
|
public int setTime(java.util.Date time, boolean bDisplayOption, int iMoveMode)
{
java.util.Date m_DateTime = (java.util.Date)m_data;
int iYear = DBConstants.FIRST_YEAR;
int iMonth = DBConstants.FIRST_DAY;
int iDate = DBConstants.FIRST_MONTH;
if (m_DateTime != null) //|| (m_CurrentLength == 0))
{
m_calendar.setTime(m_DateTime);
iYear = m_calendar.get(Calendar.YEAR);
iMonth = m_calendar.get(Calendar.MONTH);
iDate = m_calendar.get(Calendar.DATE);
}
m_calendar.setTime(time);
int iHour = m_calendar.get(Calendar.HOUR_OF_DAY);
int iMinute = m_calendar.get(Calendar.MINUTE);
int iSecond = m_calendar.get(Calendar.SECOND);
m_calendar.set(iYear, iMonth, iDate, iHour, iMinute, iSecond);
java.util.Date dateNew = m_calendar.getTime();
return this.setDateTime(dateNew, bDisplayOption, iMoveMode);
}
|
java
|
public int setTime(java.util.Date time, boolean bDisplayOption, int iMoveMode)
{
java.util.Date m_DateTime = (java.util.Date)m_data;
int iYear = DBConstants.FIRST_YEAR;
int iMonth = DBConstants.FIRST_DAY;
int iDate = DBConstants.FIRST_MONTH;
if (m_DateTime != null) //|| (m_CurrentLength == 0))
{
m_calendar.setTime(m_DateTime);
iYear = m_calendar.get(Calendar.YEAR);
iMonth = m_calendar.get(Calendar.MONTH);
iDate = m_calendar.get(Calendar.DATE);
}
m_calendar.setTime(time);
int iHour = m_calendar.get(Calendar.HOUR_OF_DAY);
int iMinute = m_calendar.get(Calendar.MINUTE);
int iSecond = m_calendar.get(Calendar.SECOND);
m_calendar.set(iYear, iMonth, iDate, iHour, iMinute, iSecond);
java.util.Date dateNew = m_calendar.getTime();
return this.setDateTime(dateNew, bDisplayOption, iMoveMode);
}
|
[
"public",
"int",
"setTime",
"(",
"java",
".",
"util",
".",
"Date",
"time",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"java",
".",
"util",
".",
"Date",
"m_DateTime",
"=",
"(",
"java",
".",
"util",
".",
"Date",
")",
"m_data",
";",
"int",
"iYear",
"=",
"DBConstants",
".",
"FIRST_YEAR",
";",
"int",
"iMonth",
"=",
"DBConstants",
".",
"FIRST_DAY",
";",
"int",
"iDate",
"=",
"DBConstants",
".",
"FIRST_MONTH",
";",
"if",
"(",
"m_DateTime",
"!=",
"null",
")",
"//|| (m_CurrentLength == 0))",
"{",
"m_calendar",
".",
"setTime",
"(",
"m_DateTime",
")",
";",
"iYear",
"=",
"m_calendar",
".",
"get",
"(",
"Calendar",
".",
"YEAR",
")",
";",
"iMonth",
"=",
"m_calendar",
".",
"get",
"(",
"Calendar",
".",
"MONTH",
")",
";",
"iDate",
"=",
"m_calendar",
".",
"get",
"(",
"Calendar",
".",
"DATE",
")",
";",
"}",
"m_calendar",
".",
"setTime",
"(",
"time",
")",
";",
"int",
"iHour",
"=",
"m_calendar",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",
";",
"int",
"iMinute",
"=",
"m_calendar",
".",
"get",
"(",
"Calendar",
".",
"MINUTE",
")",
";",
"int",
"iSecond",
"=",
"m_calendar",
".",
"get",
"(",
"Calendar",
".",
"SECOND",
")",
";",
"m_calendar",
".",
"set",
"(",
"iYear",
",",
"iMonth",
",",
"iDate",
",",
"iHour",
",",
"iMinute",
",",
"iSecond",
")",
";",
"java",
".",
"util",
".",
"Date",
"dateNew",
"=",
"m_calendar",
".",
"getTime",
"(",
")",
";",
"return",
"this",
".",
"setDateTime",
"(",
"dateNew",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] |
Change the time without changing the date.
@param time The date to set (only time portion is used).
@param bDisplayOption Display changed fields if true.
@param iMoveMode The move mode.
@return The error code (or NORMAL_RETURN).
|
[
"Change",
"the",
"time",
"without",
"changing",
"the",
"date",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L331-L351
|
152,547
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
|
DateTimeField.setToLimit
|
public void setToLimit(int iAreaDesc) // Set this field to the largest or smallest value
{ // By default compare as ASCII strings
m_calendar.set(DBConstants.FIRST_YEAR, Calendar.JANUARY, 1, 0, 0, 0);
if (iAreaDesc == DBConstants.END_SELECT_KEY)
m_calendar.set(DBConstants.LAST_YEAR, Calendar.DECEMBER, 31, 23, 59, 59); // Highest value
java.util.Date time = m_calendar.getTime(); // Lowest value
this.doSetData(time, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE);
}
|
java
|
public void setToLimit(int iAreaDesc) // Set this field to the largest or smallest value
{ // By default compare as ASCII strings
m_calendar.set(DBConstants.FIRST_YEAR, Calendar.JANUARY, 1, 0, 0, 0);
if (iAreaDesc == DBConstants.END_SELECT_KEY)
m_calendar.set(DBConstants.LAST_YEAR, Calendar.DECEMBER, 31, 23, 59, 59); // Highest value
java.util.Date time = m_calendar.getTime(); // Lowest value
this.doSetData(time, DBConstants.DONT_DISPLAY, DBConstants.SCREEN_MOVE);
}
|
[
"public",
"void",
"setToLimit",
"(",
"int",
"iAreaDesc",
")",
"// Set this field to the largest or smallest value",
"{",
"// By default compare as ASCII strings",
"m_calendar",
".",
"set",
"(",
"DBConstants",
".",
"FIRST_YEAR",
",",
"Calendar",
".",
"JANUARY",
",",
"1",
",",
"0",
",",
"0",
",",
"0",
")",
";",
"if",
"(",
"iAreaDesc",
"==",
"DBConstants",
".",
"END_SELECT_KEY",
")",
"m_calendar",
".",
"set",
"(",
"DBConstants",
".",
"LAST_YEAR",
",",
"Calendar",
".",
"DECEMBER",
",",
"31",
",",
"23",
",",
"59",
",",
"59",
")",
";",
"// Highest value",
"java",
".",
"util",
".",
"Date",
"time",
"=",
"m_calendar",
".",
"getTime",
"(",
")",
";",
"// Lowest value",
"this",
".",
"doSetData",
"(",
"time",
",",
"DBConstants",
".",
"DONT_DISPLAY",
",",
"DBConstants",
".",
"SCREEN_MOVE",
")",
";",
"}"
] |
Set to the min or max value.
@param iAreaDesc END_SELECT_KEY means set to largest value, others mean smallest.
|
[
"Set",
"to",
"the",
"min",
"or",
"max",
"value",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L356-L363
|
152,548
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
|
DateTimeField.todaysDate
|
public static double todaysDate()
{
java.util.Date date = new java.util.Date();
m_calendar.setTime(date);
m_calendar.set(Calendar.HOUR_OF_DAY, 0);
m_calendar.set(Calendar.MINUTE, 0);
m_calendar.set(Calendar.SECOND, 0);
m_calendar.set(Calendar.MILLISECOND, 0);
date = m_calendar.getTime();
return date.getTime(); // Convert to double
}
|
java
|
public static double todaysDate()
{
java.util.Date date = new java.util.Date();
m_calendar.setTime(date);
m_calendar.set(Calendar.HOUR_OF_DAY, 0);
m_calendar.set(Calendar.MINUTE, 0);
m_calendar.set(Calendar.SECOND, 0);
m_calendar.set(Calendar.MILLISECOND, 0);
date = m_calendar.getTime();
return date.getTime(); // Convert to double
}
|
[
"public",
"static",
"double",
"todaysDate",
"(",
")",
"{",
"java",
".",
"util",
".",
"Date",
"date",
"=",
"new",
"java",
".",
"util",
".",
"Date",
"(",
")",
";",
"m_calendar",
".",
"setTime",
"(",
"date",
")",
";",
"m_calendar",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"0",
")",
";",
"m_calendar",
".",
"set",
"(",
"Calendar",
".",
"MINUTE",
",",
"0",
")",
";",
"m_calendar",
".",
"set",
"(",
"Calendar",
".",
"SECOND",
",",
"0",
")",
";",
"m_calendar",
".",
"set",
"(",
"Calendar",
".",
"MILLISECOND",
",",
"0",
")",
";",
"date",
"=",
"m_calendar",
".",
"getTime",
"(",
")",
";",
"return",
"date",
".",
"getTime",
"(",
")",
";",
"// Convert to double",
"}"
] |
Return the current date with a 0 time.
@return The date.
|
[
"Return",
"the",
"current",
"date",
"with",
"a",
"0",
"time",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L443-L453
|
152,549
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
|
DateTimeField.currentTime
|
public static double currentTime()
{
java.util.Date time = new java.util.Date();
m_calendar.setTime(time);
//x m_calendar.set(Calendar.SECOND, 0);
m_calendar.set(Calendar.MILLISECOND, 0);
time = m_calendar.getTime();
return time.getTime(); // Convert to double
}
|
java
|
public static double currentTime()
{
java.util.Date time = new java.util.Date();
m_calendar.setTime(time);
//x m_calendar.set(Calendar.SECOND, 0);
m_calendar.set(Calendar.MILLISECOND, 0);
time = m_calendar.getTime();
return time.getTime(); // Convert to double
}
|
[
"public",
"static",
"double",
"currentTime",
"(",
")",
"{",
"java",
".",
"util",
".",
"Date",
"time",
"=",
"new",
"java",
".",
"util",
".",
"Date",
"(",
")",
";",
"m_calendar",
".",
"setTime",
"(",
"time",
")",
";",
"//x m_calendar.set(Calendar.SECOND, 0);",
"m_calendar",
".",
"set",
"(",
"Calendar",
".",
"MILLISECOND",
",",
"0",
")",
";",
"time",
"=",
"m_calendar",
".",
"getTime",
"(",
")",
";",
"return",
"time",
".",
"getTime",
"(",
")",
";",
"// Convert to double",
"}"
] |
Return the current date and time as a double.
@return The current date and time.
|
[
"Return",
"the",
"current",
"date",
"and",
"time",
"as",
"a",
"double",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L458-L466
|
152,550
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
|
DateTimeField.doSetData
|
public int doSetData(Object vpData, boolean bDisplayOption, int iMoveMode)
{
if ((vpData != null) && (!(vpData instanceof java.util.Date)))
return DBConstants.ERROR_RETURN;
return super.doSetData(vpData, bDisplayOption, iMoveMode);
}
|
java
|
public int doSetData(Object vpData, boolean bDisplayOption, int iMoveMode)
{
if ((vpData != null) && (!(vpData instanceof java.util.Date)))
return DBConstants.ERROR_RETURN;
return super.doSetData(vpData, bDisplayOption, iMoveMode);
}
|
[
"public",
"int",
"doSetData",
"(",
"Object",
"vpData",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"if",
"(",
"(",
"vpData",
"!=",
"null",
")",
"&&",
"(",
"!",
"(",
"vpData",
"instanceof",
"java",
".",
"util",
".",
"Date",
")",
")",
")",
"return",
"DBConstants",
".",
"ERROR_RETURN",
";",
"return",
"super",
".",
"doSetData",
"(",
"vpData",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] |
Move this physical binary data to this field.
Must be java Date type.
@param data The physical data to move to this field (must be the correct raw data class).
@param bDisplayOption If true, display after setting the data.
@param iMoveMode The type of move.
@return an error code (0 if success).
|
[
"Move",
"this",
"physical",
"binary",
"data",
"to",
"this",
"field",
".",
"Must",
"be",
"java",
"Date",
"type",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L475-L480
|
152,551
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/DateTimeField.java
|
DateTimeField.propertyChange
|
public void propertyChange(PropertyChangeEvent evt)
{
if (MenuConstants.DATE.equalsIgnoreCase(evt.getPropertyName()))
if (evt.getNewValue() instanceof java.util.Date)
this.setDateTime((java.util.Date)evt.getNewValue(), true, DBConstants.SCREEN_MOVE);
}
|
java
|
public void propertyChange(PropertyChangeEvent evt)
{
if (MenuConstants.DATE.equalsIgnoreCase(evt.getPropertyName()))
if (evt.getNewValue() instanceof java.util.Date)
this.setDateTime((java.util.Date)evt.getNewValue(), true, DBConstants.SCREEN_MOVE);
}
|
[
"public",
"void",
"propertyChange",
"(",
"PropertyChangeEvent",
"evt",
")",
"{",
"if",
"(",
"MenuConstants",
".",
"DATE",
".",
"equalsIgnoreCase",
"(",
"evt",
".",
"getPropertyName",
"(",
")",
")",
")",
"if",
"(",
"evt",
".",
"getNewValue",
"(",
")",
"instanceof",
"java",
".",
"util",
".",
"Date",
")",
"this",
".",
"setDateTime",
"(",
"(",
"java",
".",
"util",
".",
"Date",
")",
"evt",
".",
"getNewValue",
"(",
")",
",",
"true",
",",
"DBConstants",
".",
"SCREEN_MOVE",
")",
";",
"}"
] |
This method gets called when a bound property is changed.
This is required to listen to changes by the date popup control.
@param evt A PropertyChangeEvent object describing the event source and the property that has changed.
|
[
"This",
"method",
"gets",
"called",
"when",
"a",
"bound",
"property",
"is",
"changed",
".",
"This",
"is",
"required",
"to",
"listen",
"to",
"changes",
"by",
"the",
"date",
"popup",
"control",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/DateTimeField.java#L541-L546
|
152,552
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/PropertiesField.java
|
PropertiesField.getProperty
|
public String getProperty(String strProperty)
{
if ((strProperty == null) || (strProperty.length() == 0))
return null;
if (m_propertiesCache == null)
m_propertiesCache = this.loadProperties();
return (String)m_propertiesCache.get(strProperty); // Add code here
}
|
java
|
public String getProperty(String strProperty)
{
if ((strProperty == null) || (strProperty.length() == 0))
return null;
if (m_propertiesCache == null)
m_propertiesCache = this.loadProperties();
return (String)m_propertiesCache.get(strProperty); // Add code here
}
|
[
"public",
"String",
"getProperty",
"(",
"String",
"strProperty",
")",
"{",
"if",
"(",
"(",
"strProperty",
"==",
"null",
")",
"||",
"(",
"strProperty",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"return",
"null",
";",
"if",
"(",
"m_propertiesCache",
"==",
"null",
")",
"m_propertiesCache",
"=",
"this",
".",
"loadProperties",
"(",
")",
";",
"return",
"(",
"String",
")",
"m_propertiesCache",
".",
"get",
"(",
"strProperty",
")",
";",
"// Add code here ",
"}"
] |
Get this property in the user's property area.
@param strProperty The property key to retrieve.
@return The property.
|
[
"Get",
"this",
"property",
"in",
"the",
"user",
"s",
"property",
"area",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L115-L122
|
152,553
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/PropertiesField.java
|
PropertiesField.getNewValue
|
public String getNewValue(String strKey, String strReadValue, String strOrigValue, String strCurrentValue)
{
String strNewValue = null;
if (((strCurrentValue != null) && (strCurrentValue.equals(strOrigValue)))
|| ((strCurrentValue == null) && (strOrigValue == null)))
{ // I have't changed it, so use the read value
strNewValue = strReadValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strOrigValue)))
|| ((strReadValue == null) && (strOrigValue == null)))
{ // Someone else didn't change it, use current value
strNewValue = strCurrentValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strCurrentValue)))
|| ((strReadValue == null) && (strCurrentValue == null)))
{ // The read value and my value are the same... good, use it
strNewValue = strCurrentValue;
}
else
{ // All three values are different... figure out which to use
strNewValue = this.mergeKey(strKey, strReadValue, strCurrentValue); // I HAVE changed it, so I need to figure out which one is better
}
return strNewValue;
}
|
java
|
public String getNewValue(String strKey, String strReadValue, String strOrigValue, String strCurrentValue)
{
String strNewValue = null;
if (((strCurrentValue != null) && (strCurrentValue.equals(strOrigValue)))
|| ((strCurrentValue == null) && (strOrigValue == null)))
{ // I have't changed it, so use the read value
strNewValue = strReadValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strOrigValue)))
|| ((strReadValue == null) && (strOrigValue == null)))
{ // Someone else didn't change it, use current value
strNewValue = strCurrentValue;
}
else if (((strReadValue != null) && (strReadValue.equals(strCurrentValue)))
|| ((strReadValue == null) && (strCurrentValue == null)))
{ // The read value and my value are the same... good, use it
strNewValue = strCurrentValue;
}
else
{ // All three values are different... figure out which to use
strNewValue = this.mergeKey(strKey, strReadValue, strCurrentValue); // I HAVE changed it, so I need to figure out which one is better
}
return strNewValue;
}
|
[
"public",
"String",
"getNewValue",
"(",
"String",
"strKey",
",",
"String",
"strReadValue",
",",
"String",
"strOrigValue",
",",
"String",
"strCurrentValue",
")",
"{",
"String",
"strNewValue",
"=",
"null",
";",
"if",
"(",
"(",
"(",
"strCurrentValue",
"!=",
"null",
")",
"&&",
"(",
"strCurrentValue",
".",
"equals",
"(",
"strOrigValue",
")",
")",
")",
"||",
"(",
"(",
"strCurrentValue",
"==",
"null",
")",
"&&",
"(",
"strOrigValue",
"==",
"null",
")",
")",
")",
"{",
"// I have't changed it, so use the read value",
"strNewValue",
"=",
"strReadValue",
";",
"}",
"else",
"if",
"(",
"(",
"(",
"strReadValue",
"!=",
"null",
")",
"&&",
"(",
"strReadValue",
".",
"equals",
"(",
"strOrigValue",
")",
")",
")",
"||",
"(",
"(",
"strReadValue",
"==",
"null",
")",
"&&",
"(",
"strOrigValue",
"==",
"null",
")",
")",
")",
"{",
"// Someone else didn't change it, use current value",
"strNewValue",
"=",
"strCurrentValue",
";",
"}",
"else",
"if",
"(",
"(",
"(",
"strReadValue",
"!=",
"null",
")",
"&&",
"(",
"strReadValue",
".",
"equals",
"(",
"strCurrentValue",
")",
")",
")",
"||",
"(",
"(",
"strReadValue",
"==",
"null",
")",
"&&",
"(",
"strCurrentValue",
"==",
"null",
")",
")",
")",
"{",
"// The read value and my value are the same... good, use it",
"strNewValue",
"=",
"strCurrentValue",
";",
"}",
"else",
"{",
"// All three values are different... figure out which to use",
"strNewValue",
"=",
"this",
".",
"mergeKey",
"(",
"strKey",
",",
"strReadValue",
",",
"strCurrentValue",
")",
";",
"// I HAVE changed it, so I need to figure out which one is better",
"}",
"return",
"strNewValue",
";",
"}"
] |
Given the read, original, and current values for this key, decide which to use.
@param strKey
@param strReadValue
@param strOrigValue
@param strCurrentValue
@return
|
[
"Given",
"the",
"read",
"original",
"and",
"current",
"values",
"for",
"this",
"key",
"decide",
"which",
"to",
"use",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L557-L580
|
152,554
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/PropertiesField.java
|
PropertiesField.updateOrigKey
|
public boolean updateOrigKey(Map<String,Object> propOrig, String strKey, String strOrigValue, String strNewValue, boolean bOrigChange)
{
if (((strNewValue != null) && (!strNewValue.equals(strOrigValue)))
|| ((strNewValue == null) && (strOrigValue != null)))
{ // If I am using the read value now (and it has changed from the orig value) change the orig value to the read value.
bOrigChange = true;
if (strNewValue != null)
propOrig.put(strKey, strNewValue); // Original must reflect the read value in case it changes again.
else
propOrig.remove(strKey); // Original must reflect the read value in case it changes again.
}
return bOrigChange;
}
|
java
|
public boolean updateOrigKey(Map<String,Object> propOrig, String strKey, String strOrigValue, String strNewValue, boolean bOrigChange)
{
if (((strNewValue != null) && (!strNewValue.equals(strOrigValue)))
|| ((strNewValue == null) && (strOrigValue != null)))
{ // If I am using the read value now (and it has changed from the orig value) change the orig value to the read value.
bOrigChange = true;
if (strNewValue != null)
propOrig.put(strKey, strNewValue); // Original must reflect the read value in case it changes again.
else
propOrig.remove(strKey); // Original must reflect the read value in case it changes again.
}
return bOrigChange;
}
|
[
"public",
"boolean",
"updateOrigKey",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"propOrig",
",",
"String",
"strKey",
",",
"String",
"strOrigValue",
",",
"String",
"strNewValue",
",",
"boolean",
"bOrigChange",
")",
"{",
"if",
"(",
"(",
"(",
"strNewValue",
"!=",
"null",
")",
"&&",
"(",
"!",
"strNewValue",
".",
"equals",
"(",
"strOrigValue",
")",
")",
")",
"||",
"(",
"(",
"strNewValue",
"==",
"null",
")",
"&&",
"(",
"strOrigValue",
"!=",
"null",
")",
")",
")",
"{",
"// If I am using the read value now (and it has changed from the orig value) change the orig value to the read value.",
"bOrigChange",
"=",
"true",
";",
"if",
"(",
"strNewValue",
"!=",
"null",
")",
"propOrig",
".",
"put",
"(",
"strKey",
",",
"strNewValue",
")",
";",
"// Original must reflect the read value in case it changes again.",
"else",
"propOrig",
".",
"remove",
"(",
"strKey",
")",
";",
"// Original must reflect the read value in case it changes again.",
"}",
"return",
"bOrigChange",
";",
"}"
] |
Given the read, original, and current values for this key, update the original key value.
@param propOrig
@param strKey
@param strReadValue
@param strOrigValue
@param strNewValue
@param bOrigChange
@return
|
[
"Given",
"the",
"read",
"original",
"and",
"current",
"values",
"for",
"this",
"key",
"update",
"the",
"original",
"key",
"value",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/PropertiesField.java#L591-L603
|
152,555
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java
|
FMDate.fromString
|
public static FMDate fromString(String value) {
return StringUtils.isEmpty(value) ? null : new FMDate(value);
}
|
java
|
public static FMDate fromString(String value) {
return StringUtils.isEmpty(value) ? null : new FMDate(value);
}
|
[
"public",
"static",
"FMDate",
"fromString",
"(",
"String",
"value",
")",
"{",
"return",
"StringUtils",
".",
"isEmpty",
"(",
"value",
")",
"?",
"null",
":",
"new",
"FMDate",
"(",
"value",
")",
";",
"}"
] |
Converts a string value to a FM date.
@param value The string value to convert.
@return A FM date.
|
[
"Converts",
"a",
"string",
"value",
"to",
"a",
"FM",
"date",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java#L87-L89
|
152,556
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java
|
FMDate.setCalendar
|
private long setCalendar(Calendar cal, int part, long value, long div) {
cal.set(part, (int) (value % div));
return value / div;
}
|
java
|
private long setCalendar(Calendar cal, int part, long value, long div) {
cal.set(part, (int) (value % div));
return value / div;
}
|
[
"private",
"long",
"setCalendar",
"(",
"Calendar",
"cal",
",",
"int",
"part",
",",
"long",
"value",
",",
"long",
"div",
")",
"{",
"cal",
".",
"set",
"(",
"part",
",",
"(",
"int",
")",
"(",
"value",
"%",
"div",
")",
")",
";",
"return",
"value",
"/",
"div",
";",
"}"
] |
Sets a calendar component based on the input value. Meant to be called successively, with the
return value used as the input value for the next call, to extract lower digits from the
input value to be set into the calendar component.
@param cal Calendar component.
@param part Calendar component to be set.
@param value Current value.
@param div Modulus for value to be extracted.
@return Original value divided by modulus.
|
[
"Sets",
"a",
"calendar",
"component",
"based",
"on",
"the",
"input",
"value",
".",
"Meant",
"to",
"be",
"called",
"successively",
"with",
"the",
"return",
"value",
"used",
"as",
"the",
"input",
"value",
"for",
"the",
"next",
"call",
"to",
"extract",
"lower",
"digits",
"from",
"the",
"input",
"value",
"to",
"be",
"set",
"into",
"the",
"calendar",
"component",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java#L149-L152
|
152,557
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java
|
FMDate.setFMDate
|
public void setFMDate(String value) {
final long multiplier = 100000000;
Calendar cal = Calendar.getInstance();
double val = Double.parseDouble(value);
if (val < 1000000D || val > 9999999D) {
throw new IllegalArgumentException();
}
long date = (long) Math.floor(val * multiplier);
hasTime = date % multiplier != 0;
date = setCalendar(cal, Calendar.MILLISECOND, date, 100);
date = setCalendar(cal, Calendar.SECOND, date, 100);
date = setCalendar(cal, Calendar.MINUTE, date, 100);
date = setCalendar(cal, Calendar.HOUR_OF_DAY, date, 100);
date = setCalendar(cal, Calendar.DAY_OF_MONTH, date, 100);
date = setCalendar(cal, Calendar.MONTH, date - 1, 100);
date = setCalendar(cal, Calendar.YEAR, date + 1700, 10000);
setTime(cal.getTimeInMillis());
}
|
java
|
public void setFMDate(String value) {
final long multiplier = 100000000;
Calendar cal = Calendar.getInstance();
double val = Double.parseDouble(value);
if (val < 1000000D || val > 9999999D) {
throw new IllegalArgumentException();
}
long date = (long) Math.floor(val * multiplier);
hasTime = date % multiplier != 0;
date = setCalendar(cal, Calendar.MILLISECOND, date, 100);
date = setCalendar(cal, Calendar.SECOND, date, 100);
date = setCalendar(cal, Calendar.MINUTE, date, 100);
date = setCalendar(cal, Calendar.HOUR_OF_DAY, date, 100);
date = setCalendar(cal, Calendar.DAY_OF_MONTH, date, 100);
date = setCalendar(cal, Calendar.MONTH, date - 1, 100);
date = setCalendar(cal, Calendar.YEAR, date + 1700, 10000);
setTime(cal.getTimeInMillis());
}
|
[
"public",
"void",
"setFMDate",
"(",
"String",
"value",
")",
"{",
"final",
"long",
"multiplier",
"=",
"100000000",
";",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"double",
"val",
"=",
"Double",
".",
"parseDouble",
"(",
"value",
")",
";",
"if",
"(",
"val",
"<",
"1000000D",
"||",
"val",
">",
"9999999D",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"long",
"date",
"=",
"(",
"long",
")",
"Math",
".",
"floor",
"(",
"val",
"*",
"multiplier",
")",
";",
"hasTime",
"=",
"date",
"%",
"multiplier",
"!=",
"0",
";",
"date",
"=",
"setCalendar",
"(",
"cal",
",",
"Calendar",
".",
"MILLISECOND",
",",
"date",
",",
"100",
")",
";",
"date",
"=",
"setCalendar",
"(",
"cal",
",",
"Calendar",
".",
"SECOND",
",",
"date",
",",
"100",
")",
";",
"date",
"=",
"setCalendar",
"(",
"cal",
",",
"Calendar",
".",
"MINUTE",
",",
"date",
",",
"100",
")",
";",
"date",
"=",
"setCalendar",
"(",
"cal",
",",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"date",
",",
"100",
")",
";",
"date",
"=",
"setCalendar",
"(",
"cal",
",",
"Calendar",
".",
"DAY_OF_MONTH",
",",
"date",
",",
"100",
")",
";",
"date",
"=",
"setCalendar",
"(",
"cal",
",",
"Calendar",
".",
"MONTH",
",",
"date",
"-",
"1",
",",
"100",
")",
";",
"date",
"=",
"setCalendar",
"(",
"cal",
",",
"Calendar",
".",
"YEAR",
",",
"date",
"+",
"1700",
",",
"10000",
")",
";",
"setTime",
"(",
"cal",
".",
"getTimeInMillis",
"(",
")",
")",
";",
"}"
] |
Sets the date value based on the specified FM string representation.
@param value FM string representation.
|
[
"Sets",
"the",
"date",
"value",
"based",
"on",
"the",
"specified",
"FM",
"string",
"representation",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java#L159-L178
|
152,558
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java
|
FMDate.getFMDate
|
public String getFMDate() {
Calendar cal = Calendar.getInstance();
cal.setTime(this);
StringBuilder sb = new StringBuilder(15);
int hour = cal.get(Calendar.HOUR_OF_DAY);
if (hour == 0 && hasTime) {
hour = 24;
cal.add(Calendar.DAY_OF_MONTH, -1);
}
addFMPiece(sb, cal.get(Calendar.YEAR) - 1700, 0);
addFMPiece(sb, cal.get(Calendar.MONTH) + 1, 2);
addFMPiece(sb, cal.get(Calendar.DAY_OF_MONTH), 2);
if (hasTime) {
sb.append('.');
addFMPiece(sb, hour, 2);
addFMPiece(sb, cal.get(Calendar.MINUTE), 2);
addFMPiece(sb, cal.get(Calendar.SECOND), 2);
addFMPiece(sb, cal.get(Calendar.MILLISECOND), 2);
for (int i = sb.length() - 1; i >= 0; i--) {
char c = sb.charAt(i);
if (c == '0') {
sb.deleteCharAt(i);
} else if (c == '.') {
sb.deleteCharAt(i);
break;
} else {
break;
}
}
}
return sb.toString();
}
|
java
|
public String getFMDate() {
Calendar cal = Calendar.getInstance();
cal.setTime(this);
StringBuilder sb = new StringBuilder(15);
int hour = cal.get(Calendar.HOUR_OF_DAY);
if (hour == 0 && hasTime) {
hour = 24;
cal.add(Calendar.DAY_OF_MONTH, -1);
}
addFMPiece(sb, cal.get(Calendar.YEAR) - 1700, 0);
addFMPiece(sb, cal.get(Calendar.MONTH) + 1, 2);
addFMPiece(sb, cal.get(Calendar.DAY_OF_MONTH), 2);
if (hasTime) {
sb.append('.');
addFMPiece(sb, hour, 2);
addFMPiece(sb, cal.get(Calendar.MINUTE), 2);
addFMPiece(sb, cal.get(Calendar.SECOND), 2);
addFMPiece(sb, cal.get(Calendar.MILLISECOND), 2);
for (int i = sb.length() - 1; i >= 0; i--) {
char c = sb.charAt(i);
if (c == '0') {
sb.deleteCharAt(i);
} else if (c == '.') {
sb.deleteCharAt(i);
break;
} else {
break;
}
}
}
return sb.toString();
}
|
[
"public",
"String",
"getFMDate",
"(",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"this",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"15",
")",
";",
"int",
"hour",
"=",
"cal",
".",
"get",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
")",
";",
"if",
"(",
"hour",
"==",
"0",
"&&",
"hasTime",
")",
"{",
"hour",
"=",
"24",
";",
"cal",
".",
"add",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
",",
"-",
"1",
")",
";",
"}",
"addFMPiece",
"(",
"sb",
",",
"cal",
".",
"get",
"(",
"Calendar",
".",
"YEAR",
")",
"-",
"1700",
",",
"0",
")",
";",
"addFMPiece",
"(",
"sb",
",",
"cal",
".",
"get",
"(",
"Calendar",
".",
"MONTH",
")",
"+",
"1",
",",
"2",
")",
";",
"addFMPiece",
"(",
"sb",
",",
"cal",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
")",
",",
"2",
")",
";",
"if",
"(",
"hasTime",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"addFMPiece",
"(",
"sb",
",",
"hour",
",",
"2",
")",
";",
"addFMPiece",
"(",
"sb",
",",
"cal",
".",
"get",
"(",
"Calendar",
".",
"MINUTE",
")",
",",
"2",
")",
";",
"addFMPiece",
"(",
"sb",
",",
"cal",
".",
"get",
"(",
"Calendar",
".",
"SECOND",
")",
",",
"2",
")",
";",
"addFMPiece",
"(",
"sb",
",",
"cal",
".",
"get",
"(",
"Calendar",
".",
"MILLISECOND",
")",
",",
"2",
")",
";",
"for",
"(",
"int",
"i",
"=",
"sb",
".",
"length",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",
"{",
"char",
"c",
"=",
"sb",
".",
"charAt",
"(",
"i",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"sb",
".",
"deleteCharAt",
"(",
"i",
")",
";",
"}",
"else",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"sb",
".",
"deleteCharAt",
"(",
"i",
")",
";",
"break",
";",
"}",
"else",
"{",
"break",
";",
"}",
"}",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns the FM string representation of the date.
@return FM string representation.
|
[
"Returns",
"the",
"FM",
"string",
"representation",
"of",
"the",
"date",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java#L185-L222
|
152,559
|
carewebframework/carewebframework-vista
|
org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java
|
FMDate.addFMPiece
|
private void addFMPiece(StringBuilder sb, int value, int pad) {
String val = Integer.toString(value);
pad -= val.length();
while (pad-- > 0) {
sb.append('0');
}
sb.append(val);
}
|
java
|
private void addFMPiece(StringBuilder sb, int value, int pad) {
String val = Integer.toString(value);
pad -= val.length();
while (pad-- > 0) {
sb.append('0');
}
sb.append(val);
}
|
[
"private",
"void",
"addFMPiece",
"(",
"StringBuilder",
"sb",
",",
"int",
"value",
",",
"int",
"pad",
")",
"{",
"String",
"val",
"=",
"Integer",
".",
"toString",
"(",
"value",
")",
";",
"pad",
"-=",
"val",
".",
"length",
"(",
")",
";",
"while",
"(",
"pad",
"--",
">",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"sb",
".",
"append",
"(",
"val",
")",
";",
"}"
] |
Used to build a FM string representation of a date.
@param sb String builder.
@param value Value to append.
@param pad Left pad with zeros to this number of digits.
|
[
"Used",
"to",
"build",
"a",
"FM",
"string",
"representation",
"of",
"a",
"date",
"."
] |
883b2cbe395d9e8a21cd19db820f0876bda6b1c6
|
https://github.com/carewebframework/carewebframework-vista/blob/883b2cbe395d9e8a21cd19db820f0876bda6b1c6/org.carewebframework.vista.mbroker/src/main/java/org/carewebframework/vista/mbroker/FMDate.java#L231-L240
|
152,560
|
pressgang-ccms/PressGangCCMSRESTv1Common
|
src/main/java/org/jboss/pressgang/ccms/rest/v1/collections/join/RESTCategoryInTagCollectionV1.java
|
RESTCategoryInTagCollectionV1.ignoreDuplicatedChangeItemRequests
|
@Override
protected void ignoreDuplicatedChangeItemRequests() {
if (getItems() != null) {
final List<RESTCategoryInTagCollectionItemV1> items = new ArrayList<RESTCategoryInTagCollectionItemV1>(getItems());
/* on the second loop, remove any items that are marked for both add and remove is separate items */
for (int i = 0; i < items.size(); ++i) {
final RESTCategoryInTagCollectionItemV1 child1 = items.get(i);
final RESTCategoryInTagV1 childItem1 = child1.getItem();
// New Entity so ignore it
if (childItem1.getId() == null) continue;
/* at this point we know that either add1 or remove1 will be true, but not both */
final boolean add1 = child1.getState().equals(ADD_STATE);
final boolean remove1 = child1.getState().equals(REMOVE_STATE);
final boolean update1 = child1.getState().equals(UPDATE_STATE);
/* Loop a second time, looking for duplicates */
for (int j = i + 1; j < items.size(); ++j) {
final RESTCategoryInTagCollectionItemV1 child2 = items.get(j);
final RESTCategoryInTagV1 childItem2 = child2.getItem();
// New Entity so ignore it
if (childItem2.getId() == null) continue;
/* Do some checks on values that could be null */
final boolean relationshipIdEqual = childItem1.getRelationshipId() == null && childItem2.getRelationshipId() == null
|| childItem1.getRelationshipId() != null && childItem1.getRelationshipId().equals(
childItem2.getRelationshipId());
/* Check the PropertyTags for uniqueness and their value as well as their IDs */
if (childItem1.getId().equals(childItem2.getId()) && relationshipIdEqual) {
final boolean add2 = child2.getState().equals(ADD_STATE);
final boolean remove2 = child2.getState().equals(REMOVE_STATE);
final boolean update2 = child2.getState().equals(UPDATE_STATE);
final boolean relationshipSortEqual = childItem1.getRelationshipSort() == null && childItem2.getRelationshipSort
() == null || childItem1.getRelationshipSort() != null && childItem1.getRelationshipSort().equals(
childItem2.getRelationshipSort());
/* check for double add, double remove, double update, and remove one instance */
if ((add1 && add2) || (remove1 && remove2) || (update1 && update2)) {
/*
* If the relationship sort values are equal then we only need to remove one item. If
* the are different then both should be removed.
*/
if (relationshipSortEqual) {
getItems().remove(child1);
} else {
getItems().remove(child1);
getItems().remove(child2);
}
}
/* check for double add, double remove, add and remove, remove and add */
if ((add1 && remove2) || (remove1 && add2) || (update1 && remove2) || (update2 && remove1) || (update1 && add2)
|| (update2 && add1)) {
getItems().remove(child1);
getItems().remove(child2);
}
}
}
}
}
}
|
java
|
@Override
protected void ignoreDuplicatedChangeItemRequests() {
if (getItems() != null) {
final List<RESTCategoryInTagCollectionItemV1> items = new ArrayList<RESTCategoryInTagCollectionItemV1>(getItems());
/* on the second loop, remove any items that are marked for both add and remove is separate items */
for (int i = 0; i < items.size(); ++i) {
final RESTCategoryInTagCollectionItemV1 child1 = items.get(i);
final RESTCategoryInTagV1 childItem1 = child1.getItem();
// New Entity so ignore it
if (childItem1.getId() == null) continue;
/* at this point we know that either add1 or remove1 will be true, but not both */
final boolean add1 = child1.getState().equals(ADD_STATE);
final boolean remove1 = child1.getState().equals(REMOVE_STATE);
final boolean update1 = child1.getState().equals(UPDATE_STATE);
/* Loop a second time, looking for duplicates */
for (int j = i + 1; j < items.size(); ++j) {
final RESTCategoryInTagCollectionItemV1 child2 = items.get(j);
final RESTCategoryInTagV1 childItem2 = child2.getItem();
// New Entity so ignore it
if (childItem2.getId() == null) continue;
/* Do some checks on values that could be null */
final boolean relationshipIdEqual = childItem1.getRelationshipId() == null && childItem2.getRelationshipId() == null
|| childItem1.getRelationshipId() != null && childItem1.getRelationshipId().equals(
childItem2.getRelationshipId());
/* Check the PropertyTags for uniqueness and their value as well as their IDs */
if (childItem1.getId().equals(childItem2.getId()) && relationshipIdEqual) {
final boolean add2 = child2.getState().equals(ADD_STATE);
final boolean remove2 = child2.getState().equals(REMOVE_STATE);
final boolean update2 = child2.getState().equals(UPDATE_STATE);
final boolean relationshipSortEqual = childItem1.getRelationshipSort() == null && childItem2.getRelationshipSort
() == null || childItem1.getRelationshipSort() != null && childItem1.getRelationshipSort().equals(
childItem2.getRelationshipSort());
/* check for double add, double remove, double update, and remove one instance */
if ((add1 && add2) || (remove1 && remove2) || (update1 && update2)) {
/*
* If the relationship sort values are equal then we only need to remove one item. If
* the are different then both should be removed.
*/
if (relationshipSortEqual) {
getItems().remove(child1);
} else {
getItems().remove(child1);
getItems().remove(child2);
}
}
/* check for double add, double remove, add and remove, remove and add */
if ((add1 && remove2) || (remove1 && add2) || (update1 && remove2) || (update2 && remove1) || (update1 && add2)
|| (update2 && add1)) {
getItems().remove(child1);
getItems().remove(child2);
}
}
}
}
}
}
|
[
"@",
"Override",
"protected",
"void",
"ignoreDuplicatedChangeItemRequests",
"(",
")",
"{",
"if",
"(",
"getItems",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"List",
"<",
"RESTCategoryInTagCollectionItemV1",
">",
"items",
"=",
"new",
"ArrayList",
"<",
"RESTCategoryInTagCollectionItemV1",
">",
"(",
"getItems",
"(",
")",
")",
";",
"/* on the second loop, remove any items that are marked for both add and remove is separate items */",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"items",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{",
"final",
"RESTCategoryInTagCollectionItemV1",
"child1",
"=",
"items",
".",
"get",
"(",
"i",
")",
";",
"final",
"RESTCategoryInTagV1",
"childItem1",
"=",
"child1",
".",
"getItem",
"(",
")",
";",
"// New Entity so ignore it",
"if",
"(",
"childItem1",
".",
"getId",
"(",
")",
"==",
"null",
")",
"continue",
";",
"/* at this point we know that either add1 or remove1 will be true, but not both */",
"final",
"boolean",
"add1",
"=",
"child1",
".",
"getState",
"(",
")",
".",
"equals",
"(",
"ADD_STATE",
")",
";",
"final",
"boolean",
"remove1",
"=",
"child1",
".",
"getState",
"(",
")",
".",
"equals",
"(",
"REMOVE_STATE",
")",
";",
"final",
"boolean",
"update1",
"=",
"child1",
".",
"getState",
"(",
")",
".",
"equals",
"(",
"UPDATE_STATE",
")",
";",
"/* Loop a second time, looking for duplicates */",
"for",
"(",
"int",
"j",
"=",
"i",
"+",
"1",
";",
"j",
"<",
"items",
".",
"size",
"(",
")",
";",
"++",
"j",
")",
"{",
"final",
"RESTCategoryInTagCollectionItemV1",
"child2",
"=",
"items",
".",
"get",
"(",
"j",
")",
";",
"final",
"RESTCategoryInTagV1",
"childItem2",
"=",
"child2",
".",
"getItem",
"(",
")",
";",
"// New Entity so ignore it",
"if",
"(",
"childItem2",
".",
"getId",
"(",
")",
"==",
"null",
")",
"continue",
";",
"/* Do some checks on values that could be null */",
"final",
"boolean",
"relationshipIdEqual",
"=",
"childItem1",
".",
"getRelationshipId",
"(",
")",
"==",
"null",
"&&",
"childItem2",
".",
"getRelationshipId",
"(",
")",
"==",
"null",
"||",
"childItem1",
".",
"getRelationshipId",
"(",
")",
"!=",
"null",
"&&",
"childItem1",
".",
"getRelationshipId",
"(",
")",
".",
"equals",
"(",
"childItem2",
".",
"getRelationshipId",
"(",
")",
")",
";",
"/* Check the PropertyTags for uniqueness and their value as well as their IDs */",
"if",
"(",
"childItem1",
".",
"getId",
"(",
")",
".",
"equals",
"(",
"childItem2",
".",
"getId",
"(",
")",
")",
"&&",
"relationshipIdEqual",
")",
"{",
"final",
"boolean",
"add2",
"=",
"child2",
".",
"getState",
"(",
")",
".",
"equals",
"(",
"ADD_STATE",
")",
";",
"final",
"boolean",
"remove2",
"=",
"child2",
".",
"getState",
"(",
")",
".",
"equals",
"(",
"REMOVE_STATE",
")",
";",
"final",
"boolean",
"update2",
"=",
"child2",
".",
"getState",
"(",
")",
".",
"equals",
"(",
"UPDATE_STATE",
")",
";",
"final",
"boolean",
"relationshipSortEqual",
"=",
"childItem1",
".",
"getRelationshipSort",
"(",
")",
"==",
"null",
"&&",
"childItem2",
".",
"getRelationshipSort",
"(",
")",
"==",
"null",
"||",
"childItem1",
".",
"getRelationshipSort",
"(",
")",
"!=",
"null",
"&&",
"childItem1",
".",
"getRelationshipSort",
"(",
")",
".",
"equals",
"(",
"childItem2",
".",
"getRelationshipSort",
"(",
")",
")",
";",
"/* check for double add, double remove, double update, and remove one instance */",
"if",
"(",
"(",
"add1",
"&&",
"add2",
")",
"||",
"(",
"remove1",
"&&",
"remove2",
")",
"||",
"(",
"update1",
"&&",
"update2",
")",
")",
"{",
"/* \n * If the relationship sort values are equal then we only need to remove one item. If\n * the are different then both should be removed. \n */",
"if",
"(",
"relationshipSortEqual",
")",
"{",
"getItems",
"(",
")",
".",
"remove",
"(",
"child1",
")",
";",
"}",
"else",
"{",
"getItems",
"(",
")",
".",
"remove",
"(",
"child1",
")",
";",
"getItems",
"(",
")",
".",
"remove",
"(",
"child2",
")",
";",
"}",
"}",
"/* check for double add, double remove, add and remove, remove and add */",
"if",
"(",
"(",
"add1",
"&&",
"remove2",
")",
"||",
"(",
"remove1",
"&&",
"add2",
")",
"||",
"(",
"update1",
"&&",
"remove2",
")",
"||",
"(",
"update2",
"&&",
"remove1",
")",
"||",
"(",
"update1",
"&&",
"add2",
")",
"||",
"(",
"update2",
"&&",
"add1",
")",
")",
"{",
"getItems",
"(",
")",
".",
"remove",
"(",
"child1",
")",
";",
"getItems",
"(",
")",
".",
"remove",
"(",
"child2",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}"
] |
CategoryTags are only duplicated when they have the same ID and the same value.
|
[
"CategoryTags",
"are",
"only",
"duplicated",
"when",
"they",
"have",
"the",
"same",
"ID",
"and",
"the",
"same",
"value",
"."
] |
0641d21b127297b47035f3b8e55fba81251b419c
|
https://github.com/pressgang-ccms/PressGangCCMSRESTv1Common/blob/0641d21b127297b47035f3b8e55fba81251b419c/src/main/java/org/jboss/pressgang/ccms/rest/v1/collections/join/RESTCategoryInTagCollectionV1.java#L64-L129
|
152,561
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/SCheckBox.java
|
SCheckBox.getSFieldProperty
|
public String getSFieldProperty(String strFieldName)
{
String strValue = super.getSFieldProperty(strFieldName);
if (strValue == null)
if (this.getParentScreen() != null)
if (DBConstants.SUBMIT.equalsIgnoreCase(this.getParentScreen().getProperty(DBParams.COMMAND)))
strValue = DBConstants.NO; // If you submit a checkbox that is off, the param is not passed (null) so I need a No.
return strValue;
}
|
java
|
public String getSFieldProperty(String strFieldName)
{
String strValue = super.getSFieldProperty(strFieldName);
if (strValue == null)
if (this.getParentScreen() != null)
if (DBConstants.SUBMIT.equalsIgnoreCase(this.getParentScreen().getProperty(DBParams.COMMAND)))
strValue = DBConstants.NO; // If you submit a checkbox that is off, the param is not passed (null) so I need a No.
return strValue;
}
|
[
"public",
"String",
"getSFieldProperty",
"(",
"String",
"strFieldName",
")",
"{",
"String",
"strValue",
"=",
"super",
".",
"getSFieldProperty",
"(",
"strFieldName",
")",
";",
"if",
"(",
"strValue",
"==",
"null",
")",
"if",
"(",
"this",
".",
"getParentScreen",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"DBConstants",
".",
"SUBMIT",
".",
"equalsIgnoreCase",
"(",
"this",
".",
"getParentScreen",
"(",
")",
".",
"getProperty",
"(",
"DBParams",
".",
"COMMAND",
")",
")",
")",
"strValue",
"=",
"DBConstants",
".",
"NO",
";",
"// If you submit a checkbox that is off, the param is not passed (null) so I need a No.",
"return",
"strValue",
";",
"}"
] |
Set this control's value as it was submitted by the HTML post operation.
@return The value the field was set to.
|
[
"Set",
"this",
"control",
"s",
"value",
"as",
"it",
"was",
"submitted",
"by",
"the",
"HTML",
"post",
"operation",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/SCheckBox.java#L64-L72
|
152,562
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/create/CreateFileExtensions.java
|
CreateFileExtensions.newDirectories
|
public static FileCreationState newDirectories(final Collection<File> directories)
throws DirectoryAlreadyExistsException
{
FileCreationState created = FileCreationState.PENDING;
for (final File dir : directories)
{
created = CreateFileExtensions.newDirectory(dir);
}
return created;
}
|
java
|
public static FileCreationState newDirectories(final Collection<File> directories)
throws DirectoryAlreadyExistsException
{
FileCreationState created = FileCreationState.PENDING;
for (final File dir : directories)
{
created = CreateFileExtensions.newDirectory(dir);
}
return created;
}
|
[
"public",
"static",
"FileCreationState",
"newDirectories",
"(",
"final",
"Collection",
"<",
"File",
">",
"directories",
")",
"throws",
"DirectoryAlreadyExistsException",
"{",
"FileCreationState",
"created",
"=",
"FileCreationState",
".",
"PENDING",
";",
"for",
"(",
"final",
"File",
"dir",
":",
"directories",
")",
"{",
"created",
"=",
"CreateFileExtensions",
".",
"newDirectory",
"(",
"dir",
")",
";",
"}",
"return",
"created",
";",
"}"
] |
Creates the directories.
@param directories
the directories
@return true, if successful
@throws DirectoryAlreadyExistsException
the directory allready exists exception
|
[
"Creates",
"the",
"directories",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/create/CreateFileExtensions.java#L58-L68
|
152,563
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/create/CreateFileExtensions.java
|
CreateFileExtensions.newFile
|
public static FileCreationState newFile(final File file) throws IOException
{
FileCreationState fileCreationState = FileCreationState.ALREADY_EXISTS;
if (!file.exists())
{
fileCreationState = FileCreationState.FAILED;
newParentDirectories(file);
if (file.createNewFile())
{
fileCreationState = FileCreationState.CREATED;
}
}
return fileCreationState;
}
|
java
|
public static FileCreationState newFile(final File file) throws IOException
{
FileCreationState fileCreationState = FileCreationState.ALREADY_EXISTS;
if (!file.exists())
{
fileCreationState = FileCreationState.FAILED;
newParentDirectories(file);
if (file.createNewFile())
{
fileCreationState = FileCreationState.CREATED;
}
}
return fileCreationState;
}
|
[
"public",
"static",
"FileCreationState",
"newFile",
"(",
"final",
"File",
"file",
")",
"throws",
"IOException",
"{",
"FileCreationState",
"fileCreationState",
"=",
"FileCreationState",
".",
"ALREADY_EXISTS",
";",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"fileCreationState",
"=",
"FileCreationState",
".",
"FAILED",
";",
"newParentDirectories",
"(",
"file",
")",
";",
"if",
"(",
"file",
".",
"createNewFile",
"(",
")",
")",
"{",
"fileCreationState",
"=",
"FileCreationState",
".",
"CREATED",
";",
"}",
"}",
"return",
"fileCreationState",
";",
"}"
] |
Creates an empty file if the File does not exists otherwise it lets the file as it is.
@param file
the file.
@return true, if the file is successful created otherwise false.
@throws IOException
Signals that an I/O exception has occurred.
|
[
"Creates",
"an",
"empty",
"file",
"if",
"the",
"File",
"does",
"not",
"exists",
"otherwise",
"it",
"lets",
"the",
"file",
"as",
"it",
"is",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/create/CreateFileExtensions.java#L149-L162
|
152,564
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/create/CreateFileExtensions.java
|
CreateFileExtensions.newFiles
|
public static FileCreationState newFiles(final Collection<File> files) throws IOException
{
FileCreationState created = FileCreationState.PENDING;
for (final File file : files)
{
created = CreateFileExtensions.newFile(file);
}
return created;
}
|
java
|
public static FileCreationState newFiles(final Collection<File> files) throws IOException
{
FileCreationState created = FileCreationState.PENDING;
for (final File file : files)
{
created = CreateFileExtensions.newFile(file);
}
return created;
}
|
[
"public",
"static",
"FileCreationState",
"newFiles",
"(",
"final",
"Collection",
"<",
"File",
">",
"files",
")",
"throws",
"IOException",
"{",
"FileCreationState",
"created",
"=",
"FileCreationState",
".",
"PENDING",
";",
"for",
"(",
"final",
"File",
"file",
":",
"files",
")",
"{",
"created",
"=",
"CreateFileExtensions",
".",
"newFile",
"(",
"file",
")",
";",
"}",
"return",
"created",
";",
"}"
] |
Creates all files contained in the collection as empty files if the files does not exists
otherwise it lets the files as they are.
@param files
the Collection with the File objects.
@return true, if successful
@throws IOException
Signals that an I/O exception has occurred.
|
[
"Creates",
"all",
"files",
"contained",
"in",
"the",
"collection",
"as",
"empty",
"files",
"if",
"the",
"files",
"does",
"not",
"exists",
"otherwise",
"it",
"lets",
"the",
"files",
"as",
"they",
"are",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/create/CreateFileExtensions.java#L176-L184
|
152,565
|
lightblueseas/file-worker
|
src/main/java/de/alpharogroup/file/create/CreateFileExtensions.java
|
CreateFileExtensions.newParentDirectories
|
@Deprecated
public static void newParentDirectories(final File file)
{
if (!file.exists())
{
final File parent = file.getParentFile();
if (parent != null && !parent.exists())
{
parent.mkdirs();
}
}
}
|
java
|
@Deprecated
public static void newParentDirectories(final File file)
{
if (!file.exists())
{
final File parent = file.getParentFile();
if (parent != null && !parent.exists())
{
parent.mkdirs();
}
}
}
|
[
"@",
"Deprecated",
"public",
"static",
"void",
"newParentDirectories",
"(",
"final",
"File",
"file",
")",
"{",
"if",
"(",
"!",
"file",
".",
"exists",
"(",
")",
")",
"{",
"final",
"File",
"parent",
"=",
"file",
".",
"getParentFile",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
"&&",
"!",
"parent",
".",
"exists",
"(",
")",
")",
"{",
"parent",
".",
"mkdirs",
"(",
")",
";",
"}",
"}",
"}"
] |
Creates the parent directories from the given file.
@param file
the file
@deprecated use instead the method
{@linkplain CreateFileExtensions#newDirectories(Path, FileAttribute...)} <br>
<br>
Note: will be removed in the next minor release
|
[
"Creates",
"the",
"parent",
"directories",
"from",
"the",
"given",
"file",
"."
] |
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
|
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/create/CreateFileExtensions.java#L196-L207
|
152,566
|
wigforss/Ka-Commons-Collection
|
src/main/java/org/kasource/commons/collection/builder/MapBuilder.java
|
MapBuilder.putAll
|
public MapBuilder<K, V> putAll(Map<K, V> otherMap) {
map.putAll(otherMap);
return this;
}
|
java
|
public MapBuilder<K, V> putAll(Map<K, V> otherMap) {
map.putAll(otherMap);
return this;
}
|
[
"public",
"MapBuilder",
"<",
"K",
",",
"V",
">",
"putAll",
"(",
"Map",
"<",
"K",
",",
"V",
">",
"otherMap",
")",
"{",
"map",
".",
"putAll",
"(",
"otherMap",
")",
";",
"return",
"this",
";",
"}"
] |
Puts all entries from otherMap into the map.
@param otherMap Map to populate entries from.
@return This builder.
|
[
"Puts",
"all",
"entries",
"from",
"otherMap",
"into",
"the",
"map",
"."
] |
bee25f16ec4a65af0005bf0a9151a891cfe23e8e
|
https://github.com/wigforss/Ka-Commons-Collection/blob/bee25f16ec4a65af0005bf0a9151a891cfe23e8e/src/main/java/org/kasource/commons/collection/builder/MapBuilder.java#L57-L60
|
152,567
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/PassThruTable.java
|
PassThruTable.init
|
public void init(BaseDatabase database, Record record)
{
m_tableNext = null;
database = null; // Use the database of the last table on the chain!
super.init(database, record);
if (record.getTable() != this)
m_tableNext = record.getTable();
record.setTable(this); // Make sure the record sees me first
}
|
java
|
public void init(BaseDatabase database, Record record)
{
m_tableNext = null;
database = null; // Use the database of the last table on the chain!
super.init(database, record);
if (record.getTable() != this)
m_tableNext = record.getTable();
record.setTable(this); // Make sure the record sees me first
}
|
[
"public",
"void",
"init",
"(",
"BaseDatabase",
"database",
",",
"Record",
"record",
")",
"{",
"m_tableNext",
"=",
"null",
";",
"database",
"=",
"null",
";",
"// Use the database of the last table on the chain!",
"super",
".",
"init",
"(",
"database",
",",
"record",
")",
";",
"if",
"(",
"record",
".",
"getTable",
"(",
")",
"!=",
"this",
")",
"m_tableNext",
"=",
"record",
".",
"getTable",
"(",
")",
";",
"record",
".",
"setTable",
"(",
"this",
")",
";",
"// Make sure the record sees me first",
"}"
] |
Initialize the table.
Adds the record's current table to my chain, and sets the record's table to this new table.
@param database Should be null, as the last table on the chain contains the database.
@param record The record's current table will be changed to this table and moved down my list.
|
[
"Initialize",
"the",
"table",
".",
"Adds",
"the",
"record",
"s",
"current",
"table",
"to",
"my",
"chain",
"and",
"sets",
"the",
"record",
"s",
"table",
"to",
"this",
"new",
"table",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L73-L81
|
152,568
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/PassThruTable.java
|
PassThruTable.free
|
public void free()
{
if (m_mapTable != null)
{
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
{
Record record = table.getRecord();
if (record != null)
record.free();
}
}
m_mapTable.clear();
m_mapTable = null;
}
if (m_tableNext != null)
{
BaseTable baseTable = m_tableNext;
m_tableNext = null; // This will prevent the record from being freed (freed in prev. line)
baseTable.free(); // This will also free the record
m_record = null; // Being paranoid
}
super.free();
}
|
java
|
public void free()
{
if (m_mapTable != null)
{
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
{
Record record = table.getRecord();
if (record != null)
record.free();
}
}
m_mapTable.clear();
m_mapTable = null;
}
if (m_tableNext != null)
{
BaseTable baseTable = m_tableNext;
m_tableNext = null; // This will prevent the record from being freed (freed in prev. line)
baseTable.free(); // This will also free the record
m_record = null; // Being paranoid
}
super.free();
}
|
[
"public",
"void",
"free",
"(",
")",
"{",
"if",
"(",
"m_mapTable",
"!=",
"null",
")",
"{",
"Iterator",
"<",
"BaseTable",
">",
"iterator",
"=",
"this",
".",
"getTables",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"BaseTable",
"table",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"(",
"table",
"!=",
"null",
")",
"&&",
"(",
"table",
"!=",
"this",
".",
"getNextTable",
"(",
")",
")",
")",
"{",
"Record",
"record",
"=",
"table",
".",
"getRecord",
"(",
")",
";",
"if",
"(",
"record",
"!=",
"null",
")",
"record",
".",
"free",
"(",
")",
";",
"}",
"}",
"m_mapTable",
".",
"clear",
"(",
")",
";",
"m_mapTable",
"=",
"null",
";",
"}",
"if",
"(",
"m_tableNext",
"!=",
"null",
")",
"{",
"BaseTable",
"baseTable",
"=",
"m_tableNext",
";",
"m_tableNext",
"=",
"null",
";",
"// This will prevent the record from being freed (freed in prev. line)",
"baseTable",
".",
"free",
"(",
")",
";",
"// This will also free the record",
"m_record",
"=",
"null",
";",
"// Being paranoid",
"}",
"super",
".",
"free",
"(",
")",
";",
"}"
] |
Free this passthrutable and all linked tables in this chain.
|
[
"Free",
"this",
"passthrutable",
"and",
"all",
"linked",
"tables",
"in",
"this",
"chain",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L85-L111
|
152,569
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/PassThruTable.java
|
PassThruTable.close
|
public void close()
{
if (m_mapTable != null)
{
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
{
Record record = table.getRecord();
if (record != null)
record.close();
}
}
}
if (m_tableNext != null)
m_tableNext.close();
super.close();
}
|
java
|
public void close()
{
if (m_mapTable != null)
{
Iterator<BaseTable> iterator = this.getTables();
while (iterator.hasNext())
{
BaseTable table = iterator.next();
if ((table != null) && (table != this.getNextTable()))
{
Record record = table.getRecord();
if (record != null)
record.close();
}
}
}
if (m_tableNext != null)
m_tableNext.close();
super.close();
}
|
[
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"m_mapTable",
"!=",
"null",
")",
"{",
"Iterator",
"<",
"BaseTable",
">",
"iterator",
"=",
"this",
".",
"getTables",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"BaseTable",
"table",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"(",
"table",
"!=",
"null",
")",
"&&",
"(",
"table",
"!=",
"this",
".",
"getNextTable",
"(",
")",
")",
")",
"{",
"Record",
"record",
"=",
"table",
".",
"getRecord",
"(",
")",
";",
"if",
"(",
"record",
"!=",
"null",
")",
"record",
".",
"close",
"(",
")",
";",
"}",
"}",
"}",
"if",
"(",
"m_tableNext",
"!=",
"null",
")",
"m_tableNext",
".",
"close",
"(",
")",
";",
"super",
".",
"close",
"(",
")",
";",
"}"
] |
Close the all the recordsets in the list.
|
[
"Close",
"the",
"all",
"the",
"recordsets",
"in",
"the",
"list",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L164-L183
|
152,570
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/PassThruTable.java
|
PassThruTable.getTableAt
|
public BaseTable getTableAt(Object objKey)
{
if (m_mapTable != null)
if (objKey != null)
return (BaseTable)m_mapTable.get(objKey);
return null;
}
|
java
|
public BaseTable getTableAt(Object objKey)
{
if (m_mapTable != null)
if (objKey != null)
return (BaseTable)m_mapTable.get(objKey);
return null;
}
|
[
"public",
"BaseTable",
"getTableAt",
"(",
"Object",
"objKey",
")",
"{",
"if",
"(",
"m_mapTable",
"!=",
"null",
")",
"if",
"(",
"objKey",
"!=",
"null",
")",
"return",
"(",
"BaseTable",
")",
"m_mapTable",
".",
"get",
"(",
"objKey",
")",
";",
"return",
"null",
";",
"}"
] |
Get the table at this position in the table list.
@param iIndex The index to retrieve the table from.
@return The table at this location.
|
[
"Get",
"the",
"table",
"at",
"this",
"position",
"in",
"the",
"table",
"list",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L451-L457
|
152,571
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/PassThruTable.java
|
PassThruTable.addTable
|
public void addTable(Object objKey, BaseTable table)
{
if (m_mapTable == null)
m_mapTable = new Hashtable<Object,BaseTable>();
if (objKey == null)
objKey = new Integer(m_mapTable.size());
m_mapTable.put(objKey, table);
}
|
java
|
public void addTable(Object objKey, BaseTable table)
{
if (m_mapTable == null)
m_mapTable = new Hashtable<Object,BaseTable>();
if (objKey == null)
objKey = new Integer(m_mapTable.size());
m_mapTable.put(objKey, table);
}
|
[
"public",
"void",
"addTable",
"(",
"Object",
"objKey",
",",
"BaseTable",
"table",
")",
"{",
"if",
"(",
"m_mapTable",
"==",
"null",
")",
"m_mapTable",
"=",
"new",
"Hashtable",
"<",
"Object",
",",
"BaseTable",
">",
"(",
")",
";",
"if",
"(",
"objKey",
"==",
"null",
")",
"objKey",
"=",
"new",
"Integer",
"(",
"m_mapTable",
".",
"size",
"(",
")",
")",
";",
"m_mapTable",
".",
"put",
"(",
"objKey",
",",
"table",
")",
";",
"}"
] |
Add this record's table to the list of tables to pass commands to.
@param table The table to add.
|
[
"Add",
"this",
"record",
"s",
"table",
"to",
"the",
"list",
"of",
"tables",
"to",
"pass",
"commands",
"to",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L506-L513
|
152,572
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/PassThruTable.java
|
PassThruTable.removeTable
|
public boolean removeTable(BaseTable table)
{
if (m_mapTable != null)
{
for (Object objKey : m_mapTable.keySet())
{
if (table == m_mapTable.get(objKey))
{
return (m_mapTable.remove(objKey) != null);
}
}
}
else
{
if (this.getNextTable() != null)
return this.getNextTable().removeTable(table);
}
return super.removeTable(table);
}
|
java
|
public boolean removeTable(BaseTable table)
{
if (m_mapTable != null)
{
for (Object objKey : m_mapTable.keySet())
{
if (table == m_mapTable.get(objKey))
{
return (m_mapTable.remove(objKey) != null);
}
}
}
else
{
if (this.getNextTable() != null)
return this.getNextTable().removeTable(table);
}
return super.removeTable(table);
}
|
[
"public",
"boolean",
"removeTable",
"(",
"BaseTable",
"table",
")",
"{",
"if",
"(",
"m_mapTable",
"!=",
"null",
")",
"{",
"for",
"(",
"Object",
"objKey",
":",
"m_mapTable",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"table",
"==",
"m_mapTable",
".",
"get",
"(",
"objKey",
")",
")",
"{",
"return",
"(",
"m_mapTable",
".",
"remove",
"(",
"objKey",
")",
"!=",
"null",
")",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"this",
".",
"getNextTable",
"(",
")",
"!=",
"null",
")",
"return",
"this",
".",
"getNextTable",
"(",
")",
".",
"removeTable",
"(",
"table",
")",
";",
"}",
"return",
"super",
".",
"removeTable",
"(",
"table",
")",
";",
"}"
] |
Remove this table from this table list.
@param table The table to remove.
|
[
"Remove",
"this",
"table",
"from",
"this",
"table",
"list",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L518-L536
|
152,573
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/PassThruTable.java
|
PassThruTable.getDatabase
|
public BaseDatabase getDatabase()
{
BaseDatabase database = super.getDatabase();
if (database == null)
if (this.getNextTable() != null)
database = this.getNextTable().getDatabase();
return database;
}
|
java
|
public BaseDatabase getDatabase()
{
BaseDatabase database = super.getDatabase();
if (database == null)
if (this.getNextTable() != null)
database = this.getNextTable().getDatabase();
return database;
}
|
[
"public",
"BaseDatabase",
"getDatabase",
"(",
")",
"{",
"BaseDatabase",
"database",
"=",
"super",
".",
"getDatabase",
"(",
")",
";",
"if",
"(",
"database",
"==",
"null",
")",
"if",
"(",
"this",
".",
"getNextTable",
"(",
")",
"!=",
"null",
")",
"database",
"=",
"this",
".",
"getNextTable",
"(",
")",
".",
"getDatabase",
"(",
")",
";",
"return",
"database",
";",
"}"
] |
Get the table's database.
@return The database for this table.
|
[
"Get",
"the",
"table",
"s",
"database",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/PassThruTable.java#L541-L548
|
152,574
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/TopicPool.java
|
TopicPool.savePool
|
public boolean savePool() {
if (newTopicPool.isEmpty() && updatedTopicPool.isEmpty()) return true;
try {
// Save the new topics
if (!newTopicPool.isEmpty()) {
final CollectionWrapper<TopicWrapper> response = topicProvider.createTopics(newTopicPool);
// Check that the response isn't empty (ie failed)
if (response == null) return false;
if (response.getItems() == null) return false;
// The response is valid so set it as the pool
newTopicPool = response;
}
// Update the existing topics
if (!updatedTopicPool.isEmpty()) {
final CollectionWrapper<TopicWrapper> response = topicProvider.updateTopics(updatedTopicPool);
// Check that the response isn't empty (ie failed)
if (response == null) return false;
if (response.getItems() == null) return false;
// The response is valid so set it as the pool
updatedTopicPool = response;
}
initialised = true;
return true;
} catch (Exception e) {
log.error("", e);
return false;
}
}
|
java
|
public boolean savePool() {
if (newTopicPool.isEmpty() && updatedTopicPool.isEmpty()) return true;
try {
// Save the new topics
if (!newTopicPool.isEmpty()) {
final CollectionWrapper<TopicWrapper> response = topicProvider.createTopics(newTopicPool);
// Check that the response isn't empty (ie failed)
if (response == null) return false;
if (response.getItems() == null) return false;
// The response is valid so set it as the pool
newTopicPool = response;
}
// Update the existing topics
if (!updatedTopicPool.isEmpty()) {
final CollectionWrapper<TopicWrapper> response = topicProvider.updateTopics(updatedTopicPool);
// Check that the response isn't empty (ie failed)
if (response == null) return false;
if (response.getItems() == null) return false;
// The response is valid so set it as the pool
updatedTopicPool = response;
}
initialised = true;
return true;
} catch (Exception e) {
log.error("", e);
return false;
}
}
|
[
"public",
"boolean",
"savePool",
"(",
")",
"{",
"if",
"(",
"newTopicPool",
".",
"isEmpty",
"(",
")",
"&&",
"updatedTopicPool",
".",
"isEmpty",
"(",
")",
")",
"return",
"true",
";",
"try",
"{",
"// Save the new topics",
"if",
"(",
"!",
"newTopicPool",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"CollectionWrapper",
"<",
"TopicWrapper",
">",
"response",
"=",
"topicProvider",
".",
"createTopics",
"(",
"newTopicPool",
")",
";",
"// Check that the response isn't empty (ie failed)",
"if",
"(",
"response",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"response",
".",
"getItems",
"(",
")",
"==",
"null",
")",
"return",
"false",
";",
"// The response is valid so set it as the pool",
"newTopicPool",
"=",
"response",
";",
"}",
"// Update the existing topics",
"if",
"(",
"!",
"updatedTopicPool",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"CollectionWrapper",
"<",
"TopicWrapper",
">",
"response",
"=",
"topicProvider",
".",
"updateTopics",
"(",
"updatedTopicPool",
")",
";",
"// Check that the response isn't empty (ie failed)",
"if",
"(",
"response",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"response",
".",
"getItems",
"(",
")",
"==",
"null",
")",
"return",
"false",
";",
"// The response is valid so set it as the pool",
"updatedTopicPool",
"=",
"response",
";",
"}",
"initialised",
"=",
"true",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"\"",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"}"
] |
Saves all the topics in the pool to the database using the REST API.
@return True if all the topics in the pool were saved successfully,
otherwise false.
|
[
"Saves",
"all",
"the",
"topics",
"in",
"the",
"pool",
"to",
"the",
"database",
"using",
"the",
"REST",
"API",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/TopicPool.java#L80-L108
|
152,575
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/TopicPool.java
|
TopicPool.initialiseFromPool
|
public ITopicNode initialiseFromPool(final ITopicNode topicNode) {
if (initialised) {
if (newTopicPool != null && !newTopicPool.isEmpty()) {
for (final TopicWrapper topic : newTopicPool.getItems()) {
if (topic.getProperty(cspIdPropertyTagId) != null) {
if (topic.getProperty(cspIdPropertyTagId).getValue().equals(topicNode.getUniqueId())) {
topicNode.setId(Integer.toString(topic.getId()));
return topicNode;
}
}
}
}
if (updatedTopicPool != null && !updatedTopicPool.isEmpty()) {
for (final TopicWrapper topic : updatedTopicPool.getItems()) {
if (topic.getProperty(cspIdPropertyTagId) != null) {
if (topic.getProperty(cspIdPropertyTagId).getValue().equals(topicNode.getUniqueId())) {
topicNode.setId(Integer.toString(topic.getId()));
return topicNode;
}
}
}
}
}
return topicNode;
}
|
java
|
public ITopicNode initialiseFromPool(final ITopicNode topicNode) {
if (initialised) {
if (newTopicPool != null && !newTopicPool.isEmpty()) {
for (final TopicWrapper topic : newTopicPool.getItems()) {
if (topic.getProperty(cspIdPropertyTagId) != null) {
if (topic.getProperty(cspIdPropertyTagId).getValue().equals(topicNode.getUniqueId())) {
topicNode.setId(Integer.toString(topic.getId()));
return topicNode;
}
}
}
}
if (updatedTopicPool != null && !updatedTopicPool.isEmpty()) {
for (final TopicWrapper topic : updatedTopicPool.getItems()) {
if (topic.getProperty(cspIdPropertyTagId) != null) {
if (topic.getProperty(cspIdPropertyTagId).getValue().equals(topicNode.getUniqueId())) {
topicNode.setId(Integer.toString(topic.getId()));
return topicNode;
}
}
}
}
}
return topicNode;
}
|
[
"public",
"ITopicNode",
"initialiseFromPool",
"(",
"final",
"ITopicNode",
"topicNode",
")",
"{",
"if",
"(",
"initialised",
")",
"{",
"if",
"(",
"newTopicPool",
"!=",
"null",
"&&",
"!",
"newTopicPool",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"final",
"TopicWrapper",
"topic",
":",
"newTopicPool",
".",
"getItems",
"(",
")",
")",
"{",
"if",
"(",
"topic",
".",
"getProperty",
"(",
"cspIdPropertyTagId",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"topic",
".",
"getProperty",
"(",
"cspIdPropertyTagId",
")",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"topicNode",
".",
"getUniqueId",
"(",
")",
")",
")",
"{",
"topicNode",
".",
"setId",
"(",
"Integer",
".",
"toString",
"(",
"topic",
".",
"getId",
"(",
")",
")",
")",
";",
"return",
"topicNode",
";",
"}",
"}",
"}",
"}",
"if",
"(",
"updatedTopicPool",
"!=",
"null",
"&&",
"!",
"updatedTopicPool",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"final",
"TopicWrapper",
"topic",
":",
"updatedTopicPool",
".",
"getItems",
"(",
")",
")",
"{",
"if",
"(",
"topic",
".",
"getProperty",
"(",
"cspIdPropertyTagId",
")",
"!=",
"null",
")",
"{",
"if",
"(",
"topic",
".",
"getProperty",
"(",
"cspIdPropertyTagId",
")",
".",
"getValue",
"(",
")",
".",
"equals",
"(",
"topicNode",
".",
"getUniqueId",
"(",
")",
")",
")",
"{",
"topicNode",
".",
"setId",
"(",
"Integer",
".",
"toString",
"(",
"topic",
".",
"getId",
"(",
")",
")",
")",
";",
"return",
"topicNode",
";",
"}",
"}",
"}",
"}",
"}",
"return",
"topicNode",
";",
"}"
] |
Initialises a content spec topic using the REST topics that exist
within this pool. The topic pool must be saved and initialised before
this call will work.
@param topicNode
@return
|
[
"Initialises",
"a",
"content",
"spec",
"topic",
"using",
"the",
"REST",
"topics",
"that",
"exist",
"within",
"this",
"pool",
".",
"The",
"topic",
"pool",
"must",
"be",
"saved",
"and",
"initialised",
"before",
"this",
"call",
"will",
"work",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/TopicPool.java#L118-L142
|
152,576
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/TopicPool.java
|
TopicPool.isEmpty
|
public boolean isEmpty() {
return (newTopicPool == null ? true : newTopicPool.isEmpty()) && (updatedTopicPool == null ? true : updatedTopicPool.isEmpty());
}
|
java
|
public boolean isEmpty() {
return (newTopicPool == null ? true : newTopicPool.isEmpty()) && (updatedTopicPool == null ? true : updatedTopicPool.isEmpty());
}
|
[
"public",
"boolean",
"isEmpty",
"(",
")",
"{",
"return",
"(",
"newTopicPool",
"==",
"null",
"?",
"true",
":",
"newTopicPool",
".",
"isEmpty",
"(",
")",
")",
"&&",
"(",
"updatedTopicPool",
"==",
"null",
"?",
"true",
":",
"updatedTopicPool",
".",
"isEmpty",
"(",
")",
")",
";",
"}"
] |
Checks to see if the topic pool is empty.
@return True if the pool is empty otherwise false.
|
[
"Checks",
"to",
"see",
"if",
"the",
"topic",
"pool",
"is",
"empty",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/TopicPool.java#L159-L161
|
152,577
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/TopicPool.java
|
TopicPool.rollbackPool
|
public void rollbackPool() {
if (newTopicPool == null || newTopicPool.isEmpty()) return;
final List<Integer> topicIds = new ArrayList<Integer>();
for (final TopicWrapper topic : newTopicPool.getItems()) {
topicIds.add(topic.getTopicId());
}
try {
topicProvider.deleteTopics(topicIds);
initialised = false;
} catch (Exception e) {
log.error("An error occurred while trying to rollback the Topic Pool", e);
}
}
|
java
|
public void rollbackPool() {
if (newTopicPool == null || newTopicPool.isEmpty()) return;
final List<Integer> topicIds = new ArrayList<Integer>();
for (final TopicWrapper topic : newTopicPool.getItems()) {
topicIds.add(topic.getTopicId());
}
try {
topicProvider.deleteTopics(topicIds);
initialised = false;
} catch (Exception e) {
log.error("An error occurred while trying to rollback the Topic Pool", e);
}
}
|
[
"public",
"void",
"rollbackPool",
"(",
")",
"{",
"if",
"(",
"newTopicPool",
"==",
"null",
"||",
"newTopicPool",
".",
"isEmpty",
"(",
")",
")",
"return",
";",
"final",
"List",
"<",
"Integer",
">",
"topicIds",
"=",
"new",
"ArrayList",
"<",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"final",
"TopicWrapper",
"topic",
":",
"newTopicPool",
".",
"getItems",
"(",
")",
")",
"{",
"topicIds",
".",
"add",
"(",
"topic",
".",
"getTopicId",
"(",
")",
")",
";",
"}",
"try",
"{",
"topicProvider",
".",
"deleteTopics",
"(",
"topicIds",
")",
";",
"initialised",
"=",
"false",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"log",
".",
"error",
"(",
"\"An error occurred while trying to rollback the Topic Pool\"",
",",
"e",
")",
";",
"}",
"}"
] |
Rolls back any new topics that were created. Since existing topics are stored
in revision data when edited we can't roll back that data properly.
|
[
"Rolls",
"back",
"any",
"new",
"topics",
"that",
"were",
"created",
".",
"Since",
"existing",
"topics",
"are",
"stored",
"in",
"revision",
"data",
"when",
"edited",
"we",
"can",
"t",
"roll",
"back",
"that",
"data",
"properly",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/TopicPool.java#L167-L180
|
152,578
|
jbundle/jbundle
|
base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseMenuScreen.java
|
XBaseMenuScreen.getStylesheetName
|
public String getStylesheetName()
{
if (this.getProperty(DBParams.HELP) != null)
return "menuhelp";
else if (this.getProperty(DBParams.STYLESHEET) != null)
return this.getProperty(DBParams.STYLESHEET);
else
return "menus";
}
|
java
|
public String getStylesheetName()
{
if (this.getProperty(DBParams.HELP) != null)
return "menuhelp";
else if (this.getProperty(DBParams.STYLESHEET) != null)
return this.getProperty(DBParams.STYLESHEET);
else
return "menus";
}
|
[
"public",
"String",
"getStylesheetName",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"HELP",
")",
"!=",
"null",
")",
"return",
"\"menuhelp\"",
";",
"else",
"if",
"(",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"STYLESHEET",
")",
"!=",
"null",
")",
"return",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"STYLESHEET",
")",
";",
"else",
"return",
"\"menus\"",
";",
"}"
] |
Get the name of the stylesheet.
|
[
"Get",
"the",
"name",
"of",
"the",
"stylesheet",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/xml/src/main/java/org/jbundle/base/screen/view/xml/XBaseMenuScreen.java#L69-L77
|
152,579
|
mlhartme/jasmin
|
src/main/java/net/oneandone/jasmin/cache/Cache.java
|
Cache.probe
|
public synchronized V probe(K key) {
Item<V> item;
item = items.get(key);
return item == null ? null : item.value;
}
|
java
|
public synchronized V probe(K key) {
Item<V> item;
item = items.get(key);
return item == null ? null : item.value;
}
|
[
"public",
"synchronized",
"V",
"probe",
"(",
"K",
"key",
")",
"{",
"Item",
"<",
"V",
">",
"item",
";",
"item",
"=",
"items",
".",
"get",
"(",
"key",
")",
";",
"return",
"item",
"==",
"null",
"?",
"null",
":",
"item",
".",
"value",
";",
"}"
] |
lookup without stats
|
[
"lookup",
"without",
"stats"
] |
1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d
|
https://github.com/mlhartme/jasmin/blob/1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d/src/main/java/net/oneandone/jasmin/cache/Cache.java#L85-L90
|
152,580
|
js-lib-com/commons
|
src/main/java/js/lang/LooperThread.java
|
LooperThread.wait
|
private static void wait(Object lock, int timeout)
{
try {
lock.wait(timeout);
}
catch(InterruptedException unused) {
Thread.currentThread().interrupt();
}
}
|
java
|
private static void wait(Object lock, int timeout)
{
try {
lock.wait(timeout);
}
catch(InterruptedException unused) {
Thread.currentThread().interrupt();
}
}
|
[
"private",
"static",
"void",
"wait",
"(",
"Object",
"lock",
",",
"int",
"timeout",
")",
"{",
"try",
"{",
"lock",
".",
"wait",
"(",
"timeout",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"unused",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
".",
"interrupt",
"(",
")",
";",
"}",
"}"
] |
Wait notification on synchronized object for specified period of time. If timeout is zero this method blocks till
notification arrive.
@param lock synchronized object to wait on, possible zero,
@param timeout timeout in milliseconds.
|
[
"Wait",
"notification",
"on",
"synchronized",
"object",
"for",
"specified",
"period",
"of",
"time",
".",
"If",
"timeout",
"is",
"zero",
"this",
"method",
"blocks",
"till",
"notification",
"arrive",
"."
] |
f8c64482142b163487745da74feb106f0765c16b
|
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/lang/LooperThread.java#L299-L307
|
152,581
|
GII/broccoli
|
broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/profile/functionality/OWLSAtomicService.java
|
OWLSAtomicService.executeWithInputs
|
@Override
public synchronized Collection<IResult> executeWithInputs(Collection<IInputValue> inputs) throws ModelException
{
if (!hasGrounding())
{
return null;
}
ValueMap<Output, OWLValue> returnedOutputs;
try
{
returnedOutputs = executionEngine().execute(
service.getProcess(),
fromParameterInputs(service.getProcess(), inputs),
service.getKB());
} catch (ExecutionException ex)
{
throw new ServiceExecutionException("Problem executing service with inputs: " + inputs.toString(), ex);
}
return valuesToParameters(service.getProcess(), returnedOutputs);
}
|
java
|
@Override
public synchronized Collection<IResult> executeWithInputs(Collection<IInputValue> inputs) throws ModelException
{
if (!hasGrounding())
{
return null;
}
ValueMap<Output, OWLValue> returnedOutputs;
try
{
returnedOutputs = executionEngine().execute(
service.getProcess(),
fromParameterInputs(service.getProcess(), inputs),
service.getKB());
} catch (ExecutionException ex)
{
throw new ServiceExecutionException("Problem executing service with inputs: " + inputs.toString(), ex);
}
return valuesToParameters(service.getProcess(), returnedOutputs);
}
|
[
"@",
"Override",
"public",
"synchronized",
"Collection",
"<",
"IResult",
">",
"executeWithInputs",
"(",
"Collection",
"<",
"IInputValue",
">",
"inputs",
")",
"throws",
"ModelException",
"{",
"if",
"(",
"!",
"hasGrounding",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"ValueMap",
"<",
"Output",
",",
"OWLValue",
">",
"returnedOutputs",
";",
"try",
"{",
"returnedOutputs",
"=",
"executionEngine",
"(",
")",
".",
"execute",
"(",
"service",
".",
"getProcess",
"(",
")",
",",
"fromParameterInputs",
"(",
"service",
".",
"getProcess",
"(",
")",
",",
"inputs",
")",
",",
"service",
".",
"getKB",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ExecutionException",
"ex",
")",
"{",
"throw",
"new",
"ServiceExecutionException",
"(",
"\"Problem executing service with inputs: \"",
"+",
"inputs",
".",
"toString",
"(",
")",
",",
"ex",
")",
";",
"}",
"return",
"valuesToParameters",
"(",
"service",
".",
"getProcess",
"(",
")",
",",
"returnedOutputs",
")",
";",
"}"
] |
Executes the handled OWL-S service, given a list of inputs as IParameter
@param inputs
@return
@throws ModelException
|
[
"Executes",
"the",
"handled",
"OWL",
"-",
"S",
"service",
"given",
"a",
"list",
"of",
"inputs",
"as",
"IParameter"
] |
a3033a90322cbcee4dc0f1719143b84b822bc4ba
|
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/profile/functionality/OWLSAtomicService.java#L164-L184
|
152,582
|
GII/broccoli
|
broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/profile/functionality/OWLSAtomicService.java
|
OWLSAtomicService.fromParameterInputs
|
private static ValueMap<Input, OWLValue> fromParameterInputs(Process process, Collection<IInputValue> parameters) throws ModelException
{
if (parameters.isEmpty())
{
return null;
}
ValueMap<Input, OWLValue> valueMap = new ValueMap<Input, OWLValue>();
for (IInputValue parameter : parameters)
{
valueMap.setValue(
process.getInput(parameter.getInput().name()),
process.getKB().createDataValue(parameter.object()));
}
return valueMap;
}
|
java
|
private static ValueMap<Input, OWLValue> fromParameterInputs(Process process, Collection<IInputValue> parameters) throws ModelException
{
if (parameters.isEmpty())
{
return null;
}
ValueMap<Input, OWLValue> valueMap = new ValueMap<Input, OWLValue>();
for (IInputValue parameter : parameters)
{
valueMap.setValue(
process.getInput(parameter.getInput().name()),
process.getKB().createDataValue(parameter.object()));
}
return valueMap;
}
|
[
"private",
"static",
"ValueMap",
"<",
"Input",
",",
"OWLValue",
">",
"fromParameterInputs",
"(",
"Process",
"process",
",",
"Collection",
"<",
"IInputValue",
">",
"parameters",
")",
"throws",
"ModelException",
"{",
"if",
"(",
"parameters",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"ValueMap",
"<",
"Input",
",",
"OWLValue",
">",
"valueMap",
"=",
"new",
"ValueMap",
"<",
"Input",
",",
"OWLValue",
">",
"(",
")",
";",
"for",
"(",
"IInputValue",
"parameter",
":",
"parameters",
")",
"{",
"valueMap",
".",
"setValue",
"(",
"process",
".",
"getInput",
"(",
"parameter",
".",
"getInput",
"(",
")",
".",
"name",
"(",
")",
")",
",",
"process",
".",
"getKB",
"(",
")",
".",
"createDataValue",
"(",
"parameter",
".",
"object",
"(",
")",
")",
")",
";",
"}",
"return",
"valueMap",
";",
"}"
] |
Translates a list of IParameter to a collection of Input,OWLValue
@param process
@param parameters
@return
|
[
"Translates",
"a",
"list",
"of",
"IParameter",
"to",
"a",
"collection",
"of",
"Input",
"OWLValue"
] |
a3033a90322cbcee4dc0f1719143b84b822bc4ba
|
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/profile/functionality/OWLSAtomicService.java#L258-L272
|
152,583
|
GII/broccoli
|
broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/profile/functionality/OWLSAtomicService.java
|
OWLSAtomicService.valuesToParameters
|
private synchronized Collection<IResult> valuesToParameters(Process process, ValueMap<Output, OWLValue> values) throws NotYetImplementedException, OWLTranslationException
{
if (values.isEmpty())
{
return null;
}
Collection<IResult> parameters = new ArrayList<IResult>();
Iterator<Entry<Output, OWLValue>> valuesIterator = values.iterator();
while (valuesIterator.hasNext())
{
Entry<Output, OWLValue> valuesEntry = valuesIterator.next();
final OWLSParameter parameter
= new OWLSParameter(
process.getOntology(),
valuesEntry.getKey().getName(),
valuesEntry.getValue());
parameters.add(new IOutputValue()
{
@Override
public IOutput getOutput()
{
try
{
return output(parameter.name());
} catch (ModelException ex)
{
return null;
}
}
@Override
public Object object() throws ModelException
{
return parameter.object();
}
@Override
public ISemanticIdentifier getSemanticAnnotation()
{
return parameter.getSemanticAnnotation();
}
@Override
public ISubject value() throws ModelException
{
if (null != functionalityGrounding)
{
return functionalityGrounding.createOutput(parameter.object(), OWLSAtomicService.this).value();
}
throw new UnsupportedOperationException("Not supported yet.");
}
});
}
return parameters;
}
|
java
|
private synchronized Collection<IResult> valuesToParameters(Process process, ValueMap<Output, OWLValue> values) throws NotYetImplementedException, OWLTranslationException
{
if (values.isEmpty())
{
return null;
}
Collection<IResult> parameters = new ArrayList<IResult>();
Iterator<Entry<Output, OWLValue>> valuesIterator = values.iterator();
while (valuesIterator.hasNext())
{
Entry<Output, OWLValue> valuesEntry = valuesIterator.next();
final OWLSParameter parameter
= new OWLSParameter(
process.getOntology(),
valuesEntry.getKey().getName(),
valuesEntry.getValue());
parameters.add(new IOutputValue()
{
@Override
public IOutput getOutput()
{
try
{
return output(parameter.name());
} catch (ModelException ex)
{
return null;
}
}
@Override
public Object object() throws ModelException
{
return parameter.object();
}
@Override
public ISemanticIdentifier getSemanticAnnotation()
{
return parameter.getSemanticAnnotation();
}
@Override
public ISubject value() throws ModelException
{
if (null != functionalityGrounding)
{
return functionalityGrounding.createOutput(parameter.object(), OWLSAtomicService.this).value();
}
throw new UnsupportedOperationException("Not supported yet.");
}
});
}
return parameters;
}
|
[
"private",
"synchronized",
"Collection",
"<",
"IResult",
">",
"valuesToParameters",
"(",
"Process",
"process",
",",
"ValueMap",
"<",
"Output",
",",
"OWLValue",
">",
"values",
")",
"throws",
"NotYetImplementedException",
",",
"OWLTranslationException",
"{",
"if",
"(",
"values",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"Collection",
"<",
"IResult",
">",
"parameters",
"=",
"new",
"ArrayList",
"<",
"IResult",
">",
"(",
")",
";",
"Iterator",
"<",
"Entry",
"<",
"Output",
",",
"OWLValue",
">",
">",
"valuesIterator",
"=",
"values",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"valuesIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"Entry",
"<",
"Output",
",",
"OWLValue",
">",
"valuesEntry",
"=",
"valuesIterator",
".",
"next",
"(",
")",
";",
"final",
"OWLSParameter",
"parameter",
"=",
"new",
"OWLSParameter",
"(",
"process",
".",
"getOntology",
"(",
")",
",",
"valuesEntry",
".",
"getKey",
"(",
")",
".",
"getName",
"(",
")",
",",
"valuesEntry",
".",
"getValue",
"(",
")",
")",
";",
"parameters",
".",
"add",
"(",
"new",
"IOutputValue",
"(",
")",
"{",
"@",
"Override",
"public",
"IOutput",
"getOutput",
"(",
")",
"{",
"try",
"{",
"return",
"output",
"(",
"parameter",
".",
"name",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ModelException",
"ex",
")",
"{",
"return",
"null",
";",
"}",
"}",
"@",
"Override",
"public",
"Object",
"object",
"(",
")",
"throws",
"ModelException",
"{",
"return",
"parameter",
".",
"object",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"ISemanticIdentifier",
"getSemanticAnnotation",
"(",
")",
"{",
"return",
"parameter",
".",
"getSemanticAnnotation",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"ISubject",
"value",
"(",
")",
"throws",
"ModelException",
"{",
"if",
"(",
"null",
"!=",
"functionalityGrounding",
")",
"{",
"return",
"functionalityGrounding",
".",
"createOutput",
"(",
"parameter",
".",
"object",
"(",
")",
",",
"OWLSAtomicService",
".",
"this",
")",
".",
"value",
"(",
")",
";",
"}",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Not supported yet.\"",
")",
";",
"}",
"}",
")",
";",
"}",
"return",
"parameters",
";",
"}"
] |
Translates a collection of Output,OWLvalue to a list of IParameter
@param process
@param values
@return
@throws NotYetImplementedException
@throws OWLTranslationException
|
[
"Translates",
"a",
"collection",
"of",
"Output",
"OWLvalue",
"to",
"a",
"list",
"of",
"IParameter"
] |
a3033a90322cbcee4dc0f1719143b84b822bc4ba
|
https://github.com/GII/broccoli/blob/a3033a90322cbcee4dc0f1719143b84b822bc4ba/broccoli-owls/src/main/java/com/hi3project/broccoli/bsdf/impl/owls/profile/functionality/OWLSAtomicService.java#L283-L337
|
152,584
|
jbundle/jbundle
|
app/program/screen/src/main/java/org/jbundle/app/program/resource/screen/WriteResources.java
|
WriteResources.writeDetailLine
|
public void writeDetailLine(Record registration, StreamOut out, boolean bResourceListBundle)
{
String strKey = registration.getField(Registration.KEY_VALUE).toString();
String strValue = registration.getField(Registration.OBJECT_VALUE).toString();
strValue = ResourcesUtilities.fixPropertyValue(strValue, bResourceListBundle);
if (bResourceListBundle)
out.writeit("\t{\"" + strKey + "\", " + strValue + "}");
else
out.writeit(ResourcesUtilities.fixPropertyKey(strKey) + "=" + strValue);
}
|
java
|
public void writeDetailLine(Record registration, StreamOut out, boolean bResourceListBundle)
{
String strKey = registration.getField(Registration.KEY_VALUE).toString();
String strValue = registration.getField(Registration.OBJECT_VALUE).toString();
strValue = ResourcesUtilities.fixPropertyValue(strValue, bResourceListBundle);
if (bResourceListBundle)
out.writeit("\t{\"" + strKey + "\", " + strValue + "}");
else
out.writeit(ResourcesUtilities.fixPropertyKey(strKey) + "=" + strValue);
}
|
[
"public",
"void",
"writeDetailLine",
"(",
"Record",
"registration",
",",
"StreamOut",
"out",
",",
"boolean",
"bResourceListBundle",
")",
"{",
"String",
"strKey",
"=",
"registration",
".",
"getField",
"(",
"Registration",
".",
"KEY_VALUE",
")",
".",
"toString",
"(",
")",
";",
"String",
"strValue",
"=",
"registration",
".",
"getField",
"(",
"Registration",
".",
"OBJECT_VALUE",
")",
".",
"toString",
"(",
")",
";",
"strValue",
"=",
"ResourcesUtilities",
".",
"fixPropertyValue",
"(",
"strValue",
",",
"bResourceListBundle",
")",
";",
"if",
"(",
"bResourceListBundle",
")",
"out",
".",
"writeit",
"(",
"\"\\t{\\\"\"",
"+",
"strKey",
"+",
"\"\\\", \"",
"+",
"strValue",
"+",
"\"}\"",
")",
";",
"else",
"out",
".",
"writeit",
"(",
"ResourcesUtilities",
".",
"fixPropertyKey",
"(",
"strKey",
")",
"+",
"\"=\"",
"+",
"strValue",
")",
";",
"}"
] |
WriteDetailLine Method.
|
[
"WriteDetailLine",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/resource/screen/WriteResources.java#L165-L174
|
152,585
|
jbundle/jbundle
|
app/program/screen/src/main/java/org/jbundle/app/program/resource/screen/WriteResources.java
|
WriteResources.createFile
|
public StreamOut createFile(String strFullFileName)
{
StreamOut streamOut = null;
try {
File file = new File(strFullFileName);
String pathName = file.getParent();
File fileDir = new File(pathName);
fileDir.mkdirs();
streamOut = new StreamOut(strFullFileName);
} catch (IOException ex) {
ex.printStackTrace();
streamOut = null;
}
return streamOut;
}
|
java
|
public StreamOut createFile(String strFullFileName)
{
StreamOut streamOut = null;
try {
File file = new File(strFullFileName);
String pathName = file.getParent();
File fileDir = new File(pathName);
fileDir.mkdirs();
streamOut = new StreamOut(strFullFileName);
} catch (IOException ex) {
ex.printStackTrace();
streamOut = null;
}
return streamOut;
}
|
[
"public",
"StreamOut",
"createFile",
"(",
"String",
"strFullFileName",
")",
"{",
"StreamOut",
"streamOut",
"=",
"null",
";",
"try",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"strFullFileName",
")",
";",
"String",
"pathName",
"=",
"file",
".",
"getParent",
"(",
")",
";",
"File",
"fileDir",
"=",
"new",
"File",
"(",
"pathName",
")",
";",
"fileDir",
".",
"mkdirs",
"(",
")",
";",
"streamOut",
"=",
"new",
"StreamOut",
"(",
"strFullFileName",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"streamOut",
"=",
"null",
";",
"}",
"return",
"streamOut",
";",
"}"
] |
CreateFile Method.
|
[
"CreateFile",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/resource/screen/WriteResources.java#L237-L251
|
152,586
|
jbundle/jbundle
|
app/program/screen/src/main/java/org/jbundle/app/program/resource/screen/WriteResources.java
|
WriteResources.getStartSourceCode
|
public String getStartSourceCode(String packagePath, String strFileName, String strDescription, boolean bResourceListBundle)
{
String string;
if (bResourceListBundle)
{
string =
"package " + packagePath + ";\n"
+ "/**\n"
+ " * @(#)" + strFileName + ".java 0.00 1-Jan-10 Don Corley\n"
+ " *\n"
+ " * Copyright © 2010 tourgeek.com. All Rights Reserved.\n"
+ " * don@donandann.com\n"
+ " */\n"
+ "import java.util.*;\n"
+ "\n"
+ "/**\n"
+ " * " + strFileName + " - Resources.\n"
+ strDescription + "\n"
+ " */\n"
+ "public class " + strFileName + " extends ListResourceBundle\n"
+ "{\n"
+ "\tpublic Object[][] getContents() {\n"
+ "\t\treturn contents;\n"
+ "\t}\n";
}
else
string = "# " + strFileName + " property file" + "\n" + "# " + strDescription + "\n";
return string;
}
|
java
|
public String getStartSourceCode(String packagePath, String strFileName, String strDescription, boolean bResourceListBundle)
{
String string;
if (bResourceListBundle)
{
string =
"package " + packagePath + ";\n"
+ "/**\n"
+ " * @(#)" + strFileName + ".java 0.00 1-Jan-10 Don Corley\n"
+ " *\n"
+ " * Copyright © 2010 tourgeek.com. All Rights Reserved.\n"
+ " * don@donandann.com\n"
+ " */\n"
+ "import java.util.*;\n"
+ "\n"
+ "/**\n"
+ " * " + strFileName + " - Resources.\n"
+ strDescription + "\n"
+ " */\n"
+ "public class " + strFileName + " extends ListResourceBundle\n"
+ "{\n"
+ "\tpublic Object[][] getContents() {\n"
+ "\t\treturn contents;\n"
+ "\t}\n";
}
else
string = "# " + strFileName + " property file" + "\n" + "# " + strDescription + "\n";
return string;
}
|
[
"public",
"String",
"getStartSourceCode",
"(",
"String",
"packagePath",
",",
"String",
"strFileName",
",",
"String",
"strDescription",
",",
"boolean",
"bResourceListBundle",
")",
"{",
"String",
"string",
";",
"if",
"(",
"bResourceListBundle",
")",
"{",
"string",
"=",
"\"package \"",
"+",
"packagePath",
"+",
"\";\\n\"",
"+",
"\"/**\\n\"",
"+",
"\" * @(#)\"",
"+",
"strFileName",
"+",
"\".java 0.00 1-Jan-10 Don Corley\\n\"",
"+",
"\" *\\n\"",
"+",
"\" * Copyright © 2010 tourgeek.com. All Rights Reserved.\\n\"",
"+",
"\" * don@donandann.com\\n\"",
"+",
"\" */\\n\"",
"+",
"\"import java.util.*;\\n\"",
"+",
"\"\\n\"",
"+",
"\"/**\\n\"",
"+",
"\" * \"",
"+",
"strFileName",
"+",
"\" - Resources.\\n\"",
"+",
"strDescription",
"+",
"\"\\n\"",
"+",
"\" */\\n\"",
"+",
"\"public class \"",
"+",
"strFileName",
"+",
"\" extends ListResourceBundle\\n\"",
"+",
"\"{\\n\"",
"+",
"\"\\tpublic Object[][] getContents() {\\n\"",
"+",
"\"\\t\\treturn contents;\\n\"",
"+",
"\"\\t}\\n\"",
";",
"}",
"else",
"string",
"=",
"\"# \"",
"+",
"strFileName",
"+",
"\" property file\"",
"+",
"\"\\n\"",
"+",
"\"# \"",
"+",
"strDescription",
"+",
"\"\\n\"",
";",
"return",
"string",
";",
"}"
] |
GetStartSourceCode Method.
|
[
"GetStartSourceCode",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/screen/src/main/java/org/jbundle/app/program/resource/screen/WriteResources.java#L255-L283
|
152,587
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java
|
BaseDatabase.free
|
public void free()
{
this.close();
while (m_vTableList.size() > 0)
{
BaseTable table = m_vTableList.elementAt(0);
table.free();
}
m_vTableList.removeAllElements();
m_vTableList = null;
if (m_databaseOwner != null)
m_databaseOwner.removeDatabase(this);
m_databaseOwner = null;
m_strDbName = null;
}
|
java
|
public void free()
{
this.close();
while (m_vTableList.size() > 0)
{
BaseTable table = m_vTableList.elementAt(0);
table.free();
}
m_vTableList.removeAllElements();
m_vTableList = null;
if (m_databaseOwner != null)
m_databaseOwner.removeDatabase(this);
m_databaseOwner = null;
m_strDbName = null;
}
|
[
"public",
"void",
"free",
"(",
")",
"{",
"this",
".",
"close",
"(",
")",
";",
"while",
"(",
"m_vTableList",
".",
"size",
"(",
")",
">",
"0",
")",
"{",
"BaseTable",
"table",
"=",
"m_vTableList",
".",
"elementAt",
"(",
"0",
")",
";",
"table",
".",
"free",
"(",
")",
";",
"}",
"m_vTableList",
".",
"removeAllElements",
"(",
")",
";",
"m_vTableList",
"=",
"null",
";",
"if",
"(",
"m_databaseOwner",
"!=",
"null",
")",
"m_databaseOwner",
".",
"removeDatabase",
"(",
"this",
")",
";",
"m_databaseOwner",
"=",
"null",
";",
"m_strDbName",
"=",
"null",
";",
"}"
] |
Free this database object.
|
[
"Free",
"this",
"database",
"object",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java#L129-L144
|
152,588
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java
|
BaseDatabase.doMakeTable
|
public BaseTable doMakeTable(Record record)
{
if (((record.getDatabaseType() & DBConstants.TABLE_TYPE_MASK) == DBConstants.MEMORY)
|| ((record.getDatabaseType() & DBConstants.TABLE_TYPE_MASK) == DBConstants.UNSHAREABLE_MEMORY))
{
BaseDatabase database = (BaseDatabase)this.getDatabaseOwner().getDatabase(DBParams.MEMORY, record.getDatabaseType(), null);
return database.doMakeTable(record);
}
else
return null;
}
|
java
|
public BaseTable doMakeTable(Record record)
{
if (((record.getDatabaseType() & DBConstants.TABLE_TYPE_MASK) == DBConstants.MEMORY)
|| ((record.getDatabaseType() & DBConstants.TABLE_TYPE_MASK) == DBConstants.UNSHAREABLE_MEMORY))
{
BaseDatabase database = (BaseDatabase)this.getDatabaseOwner().getDatabase(DBParams.MEMORY, record.getDatabaseType(), null);
return database.doMakeTable(record);
}
else
return null;
}
|
[
"public",
"BaseTable",
"doMakeTable",
"(",
"Record",
"record",
")",
"{",
"if",
"(",
"(",
"(",
"record",
".",
"getDatabaseType",
"(",
")",
"&",
"DBConstants",
".",
"TABLE_TYPE_MASK",
")",
"==",
"DBConstants",
".",
"MEMORY",
")",
"||",
"(",
"(",
"record",
".",
"getDatabaseType",
"(",
")",
"&",
"DBConstants",
".",
"TABLE_TYPE_MASK",
")",
"==",
"DBConstants",
".",
"UNSHAREABLE_MEMORY",
")",
")",
"{",
"BaseDatabase",
"database",
"=",
"(",
"BaseDatabase",
")",
"this",
".",
"getDatabaseOwner",
"(",
")",
".",
"getDatabase",
"(",
"DBParams",
".",
"MEMORY",
",",
"record",
".",
"getDatabaseType",
"(",
")",
",",
"null",
")",
";",
"return",
"database",
".",
"doMakeTable",
"(",
"record",
")",
";",
"}",
"else",
"return",
"null",
";",
"}"
] |
You must override this to make a table for this database.
Always override this method.
@param record The record to make a table for.
@return BaseTable The new table.
|
[
"You",
"must",
"override",
"this",
"to",
"make",
"a",
"table",
"for",
"this",
"database",
".",
"Always",
"override",
"this",
"method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java#L338-L348
|
152,589
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java
|
BaseDatabase.retrieveUserProperties
|
public PropertyOwner retrieveUserProperties(String strRegistrationKey)
{
if (m_properties != null)
if (m_properties.get(strRegistrationKey) != null)
return this;
return m_databaseOwner.retrieveUserProperties(strRegistrationKey);
}
|
java
|
public PropertyOwner retrieveUserProperties(String strRegistrationKey)
{
if (m_properties != null)
if (m_properties.get(strRegistrationKey) != null)
return this;
return m_databaseOwner.retrieveUserProperties(strRegistrationKey);
}
|
[
"public",
"PropertyOwner",
"retrieveUserProperties",
"(",
"String",
"strRegistrationKey",
")",
"{",
"if",
"(",
"m_properties",
"!=",
"null",
")",
"if",
"(",
"m_properties",
".",
"get",
"(",
"strRegistrationKey",
")",
"!=",
"null",
")",
"return",
"this",
";",
"return",
"m_databaseOwner",
".",
"retrieveUserProperties",
"(",
"strRegistrationKey",
")",
";",
"}"
] |
Get the owner of this property key.
@param strPropertyCode The key I'm looking for the owner to.
@return The owner of this property key.
|
[
"Get",
"the",
"owner",
"of",
"this",
"property",
"key",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java#L510-L516
|
152,590
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java
|
BaseDatabase.addDBProperties
|
public static Map<String,Object> addDBProperties(Map<String,Object> properties, PropertyOwner propertyOwner, Map<String,Object> otherProperties)
{
if (properties == null)
properties = new Hashtable<String,Object>();
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.CREATE_DB_IF_NOT_FOUND);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.DB_USER_PREFIX);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.SYSTEM_NAME);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.MODE);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.LOAD_INITIAL_DATA);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.ARCHIVE_FOLDER);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.USER_ARCHIVE_FOLDER);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.SHARED_ARCHIVE_FOLDER);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.BASE_TABLE_ONLY);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, SQLParams.AUTO_COMMIT_PARAM);
if (propertyOwner != null)
{
BaseDatabase.addOtherDBProperties(properties, propertyOwner.getProperties());
if (propertyOwner instanceof RecordOwnerParent)
{
Task task = ((RecordOwnerParent)propertyOwner).getTask();
if (task != null)
{
BaseDatabase.addOtherDBProperties(properties, task.getProperties());
App app = task.getApplication();
if (app != null)
{
BaseDatabase.addOtherDBProperties(properties, app.getProperties());
// Note: db properties should not be in the environment.. so don't go farther
}
}
}
}
if (otherProperties != null)
BaseDatabase.addOtherDBProperties(properties, otherProperties);
return properties;
}
|
java
|
public static Map<String,Object> addDBProperties(Map<String,Object> properties, PropertyOwner propertyOwner, Map<String,Object> otherProperties)
{
if (properties == null)
properties = new Hashtable<String,Object>();
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.CREATE_DB_IF_NOT_FOUND);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.DB_USER_PREFIX);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.SYSTEM_NAME);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.MODE);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.LOAD_INITIAL_DATA);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.ARCHIVE_FOLDER);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.USER_ARCHIVE_FOLDER);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.SHARED_ARCHIVE_FOLDER);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, DBConstants.BASE_TABLE_ONLY);
BaseDatabase.addDBProperty(properties, propertyOwner, otherProperties, SQLParams.AUTO_COMMIT_PARAM);
if (propertyOwner != null)
{
BaseDatabase.addOtherDBProperties(properties, propertyOwner.getProperties());
if (propertyOwner instanceof RecordOwnerParent)
{
Task task = ((RecordOwnerParent)propertyOwner).getTask();
if (task != null)
{
BaseDatabase.addOtherDBProperties(properties, task.getProperties());
App app = task.getApplication();
if (app != null)
{
BaseDatabase.addOtherDBProperties(properties, app.getProperties());
// Note: db properties should not be in the environment.. so don't go farther
}
}
}
}
if (otherProperties != null)
BaseDatabase.addOtherDBProperties(properties, otherProperties);
return properties;
}
|
[
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"addDBProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
",",
"PropertyOwner",
"propertyOwner",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"otherProperties",
")",
"{",
"if",
"(",
"properties",
"==",
"null",
")",
"properties",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"BaseDatabase",
".",
"addDBProperty",
"(",
"properties",
",",
"propertyOwner",
",",
"otherProperties",
",",
"DBConstants",
".",
"CREATE_DB_IF_NOT_FOUND",
")",
";",
"BaseDatabase",
".",
"addDBProperty",
"(",
"properties",
",",
"propertyOwner",
",",
"otherProperties",
",",
"DBConstants",
".",
"DB_USER_PREFIX",
")",
";",
"BaseDatabase",
".",
"addDBProperty",
"(",
"properties",
",",
"propertyOwner",
",",
"otherProperties",
",",
"DBConstants",
".",
"SYSTEM_NAME",
")",
";",
"BaseDatabase",
".",
"addDBProperty",
"(",
"properties",
",",
"propertyOwner",
",",
"otherProperties",
",",
"DBConstants",
".",
"MODE",
")",
";",
"BaseDatabase",
".",
"addDBProperty",
"(",
"properties",
",",
"propertyOwner",
",",
"otherProperties",
",",
"DBConstants",
".",
"LOAD_INITIAL_DATA",
")",
";",
"BaseDatabase",
".",
"addDBProperty",
"(",
"properties",
",",
"propertyOwner",
",",
"otherProperties",
",",
"DBConstants",
".",
"ARCHIVE_FOLDER",
")",
";",
"BaseDatabase",
".",
"addDBProperty",
"(",
"properties",
",",
"propertyOwner",
",",
"otherProperties",
",",
"DBConstants",
".",
"USER_ARCHIVE_FOLDER",
")",
";",
"BaseDatabase",
".",
"addDBProperty",
"(",
"properties",
",",
"propertyOwner",
",",
"otherProperties",
",",
"DBConstants",
".",
"SHARED_ARCHIVE_FOLDER",
")",
";",
"BaseDatabase",
".",
"addDBProperty",
"(",
"properties",
",",
"propertyOwner",
",",
"otherProperties",
",",
"DBConstants",
".",
"BASE_TABLE_ONLY",
")",
";",
"BaseDatabase",
".",
"addDBProperty",
"(",
"properties",
",",
"propertyOwner",
",",
"otherProperties",
",",
"SQLParams",
".",
"AUTO_COMMIT_PARAM",
")",
";",
"if",
"(",
"propertyOwner",
"!=",
"null",
")",
"{",
"BaseDatabase",
".",
"addOtherDBProperties",
"(",
"properties",
",",
"propertyOwner",
".",
"getProperties",
"(",
")",
")",
";",
"if",
"(",
"propertyOwner",
"instanceof",
"RecordOwnerParent",
")",
"{",
"Task",
"task",
"=",
"(",
"(",
"RecordOwnerParent",
")",
"propertyOwner",
")",
".",
"getTask",
"(",
")",
";",
"if",
"(",
"task",
"!=",
"null",
")",
"{",
"BaseDatabase",
".",
"addOtherDBProperties",
"(",
"properties",
",",
"task",
".",
"getProperties",
"(",
")",
")",
";",
"App",
"app",
"=",
"task",
".",
"getApplication",
"(",
")",
";",
"if",
"(",
"app",
"!=",
"null",
")",
"{",
"BaseDatabase",
".",
"addOtherDBProperties",
"(",
"properties",
",",
"app",
".",
"getProperties",
"(",
")",
")",
";",
"// Note: db properties should not be in the environment.. so don't go farther",
"}",
"}",
"}",
"}",
"if",
"(",
"otherProperties",
"!=",
"null",
")",
"BaseDatabase",
".",
"addOtherDBProperties",
"(",
"properties",
",",
"otherProperties",
")",
";",
"return",
"properties",
";",
"}"
] |
Since only the DB properties are passed down to the server,
make sure any global properties that pertain to databases are passed down also.
@param properties The properties object to add these properties to.
@param propertyOwner Look here for db properties
@param otherProperties to look for db properties in
|
[
"Since",
"only",
"the",
"DB",
"properties",
"are",
"passed",
"down",
"to",
"the",
"server",
"make",
"sure",
"any",
"global",
"properties",
"that",
"pertain",
"to",
"databases",
"are",
"passed",
"down",
"also",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java#L571-L606
|
152,591
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java
|
BaseDatabase.setupDatabaseProperties
|
public boolean setupDatabaseProperties()
{
if (this.getProperty(DB_PROPERTIES_LOADED) != null)
return true; // Already setup
String strDatabaseName = this.getDatabaseName(true);
Environment env = (Environment)this.getDatabaseOwner().getEnvironment();
Map<String,String> map = env.getCachedDatabaseProperties(strDatabaseName);
if ((map == null) || (map == Environment.DATABASE_DOESNT_EXIST))
{
map = this.getDatabaseProperties();
if (map == null)
return false; // Was not set up
env.cacheDatabaseProperties(strDatabaseName, map); // Update the cache
}
for (String key : map.keySet())
{
this.setProperty(key, map.get(key));
}
if (m_databaseBase == null) // Always
if (this.getProperty(BASE_DATABASE) != null)
{
Map<String,Object> properties = new HashMap<String,Object>();
properties.putAll(this.getProperties());
properties.remove(BASE_DATABASE);
properties.remove(SQLParams.JDBC_DRIVER_PARAM);
properties.put(DBConstants.DB_USER_PREFIX, DBConstants.BLANK);
properties.remove(DBConstants.SYSTEM_NAME);
properties.put(DBConstants.MODE, DBConstants.BLANK);
m_databaseBase = (BaseDatabase)m_databaseOwner.getDatabase(this.getProperty(BASE_DATABASE), this.getDatabaseType() & DBConstants.TABLE_MASK, properties);
}
this.setProperty(DB_PROPERTIES_LOADED, DBConstants.TRUE); // Flag properties as read
return true; // Success
}
|
java
|
public boolean setupDatabaseProperties()
{
if (this.getProperty(DB_PROPERTIES_LOADED) != null)
return true; // Already setup
String strDatabaseName = this.getDatabaseName(true);
Environment env = (Environment)this.getDatabaseOwner().getEnvironment();
Map<String,String> map = env.getCachedDatabaseProperties(strDatabaseName);
if ((map == null) || (map == Environment.DATABASE_DOESNT_EXIST))
{
map = this.getDatabaseProperties();
if (map == null)
return false; // Was not set up
env.cacheDatabaseProperties(strDatabaseName, map); // Update the cache
}
for (String key : map.keySet())
{
this.setProperty(key, map.get(key));
}
if (m_databaseBase == null) // Always
if (this.getProperty(BASE_DATABASE) != null)
{
Map<String,Object> properties = new HashMap<String,Object>();
properties.putAll(this.getProperties());
properties.remove(BASE_DATABASE);
properties.remove(SQLParams.JDBC_DRIVER_PARAM);
properties.put(DBConstants.DB_USER_PREFIX, DBConstants.BLANK);
properties.remove(DBConstants.SYSTEM_NAME);
properties.put(DBConstants.MODE, DBConstants.BLANK);
m_databaseBase = (BaseDatabase)m_databaseOwner.getDatabase(this.getProperty(BASE_DATABASE), this.getDatabaseType() & DBConstants.TABLE_MASK, properties);
}
this.setProperty(DB_PROPERTIES_LOADED, DBConstants.TRUE); // Flag properties as read
return true; // Success
}
|
[
"public",
"boolean",
"setupDatabaseProperties",
"(",
")",
"{",
"if",
"(",
"this",
".",
"getProperty",
"(",
"DB_PROPERTIES_LOADED",
")",
"!=",
"null",
")",
"return",
"true",
";",
"// Already setup",
"String",
"strDatabaseName",
"=",
"this",
".",
"getDatabaseName",
"(",
"true",
")",
";",
"Environment",
"env",
"=",
"(",
"Environment",
")",
"this",
".",
"getDatabaseOwner",
"(",
")",
".",
"getEnvironment",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"map",
"=",
"env",
".",
"getCachedDatabaseProperties",
"(",
"strDatabaseName",
")",
";",
"if",
"(",
"(",
"map",
"==",
"null",
")",
"||",
"(",
"map",
"==",
"Environment",
".",
"DATABASE_DOESNT_EXIST",
")",
")",
"{",
"map",
"=",
"this",
".",
"getDatabaseProperties",
"(",
")",
";",
"if",
"(",
"map",
"==",
"null",
")",
"return",
"false",
";",
"// Was not set up",
"env",
".",
"cacheDatabaseProperties",
"(",
"strDatabaseName",
",",
"map",
")",
";",
"// Update the cache",
"}",
"for",
"(",
"String",
"key",
":",
"map",
".",
"keySet",
"(",
")",
")",
"{",
"this",
".",
"setProperty",
"(",
"key",
",",
"map",
".",
"get",
"(",
"key",
")",
")",
";",
"}",
"if",
"(",
"m_databaseBase",
"==",
"null",
")",
"// Always",
"if",
"(",
"this",
".",
"getProperty",
"(",
"BASE_DATABASE",
")",
"!=",
"null",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"properties",
".",
"putAll",
"(",
"this",
".",
"getProperties",
"(",
")",
")",
";",
"properties",
".",
"remove",
"(",
"BASE_DATABASE",
")",
";",
"properties",
".",
"remove",
"(",
"SQLParams",
".",
"JDBC_DRIVER_PARAM",
")",
";",
"properties",
".",
"put",
"(",
"DBConstants",
".",
"DB_USER_PREFIX",
",",
"DBConstants",
".",
"BLANK",
")",
";",
"properties",
".",
"remove",
"(",
"DBConstants",
".",
"SYSTEM_NAME",
")",
";",
"properties",
".",
"put",
"(",
"DBConstants",
".",
"MODE",
",",
"DBConstants",
".",
"BLANK",
")",
";",
"m_databaseBase",
"=",
"(",
"BaseDatabase",
")",
"m_databaseOwner",
".",
"getDatabase",
"(",
"this",
".",
"getProperty",
"(",
"BASE_DATABASE",
")",
",",
"this",
".",
"getDatabaseType",
"(",
")",
"&",
"DBConstants",
".",
"TABLE_MASK",
",",
"properties",
")",
";",
"}",
"this",
".",
"setProperty",
"(",
"DB_PROPERTIES_LOADED",
",",
"DBConstants",
".",
"TRUE",
")",
";",
"// Flag properties as read",
"return",
"true",
";",
"// Success",
"}"
] |
Given the name of the database, get the properties file and optionally merge them with my current properties.
@param strDatabaseName The name of the database engine (as returned in the meta call).
@return The ResourceBundle with all the database properties.
|
[
"Given",
"the",
"name",
"of",
"the",
"database",
"get",
"the",
"properties",
"file",
"and",
"optionally",
"merge",
"them",
"with",
"my",
"current",
"properties",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java#L672-L708
|
152,592
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java
|
BaseDatabase.returnBaseTable
|
public BaseTable returnBaseTable(BaseTable table)
{
Record record = table.getRecord();
int iRawDBType = (record.getDatabaseType() & DBConstants.TABLE_TYPE_MASK);
if ((iRawDBType == DBConstants.LOCAL)
|| (iRawDBType == DBConstants.REMOTE) || (iRawDBType == DBConstants.TABLE))
if ((this.getMasterSlave() & RecordOwner.SLAVE) == RecordOwner.SLAVE) // Do this at the server only
{
if ((record.getDatabaseType() & DBConstants.LOCALIZABLE) == DBConstants.LOCALIZABLE)
{
m_databaseLocale = this.makeDBLocale(record, m_databaseLocale); // Check the local database to make sure it is correct
if (m_databaseLocale != this)
{
table.setRecord(null);
table.free(); // Don't need this for base access
table = m_databaseLocale.makeTable(record);
}
}
}
return table; // Base table (special) access
}
|
java
|
public BaseTable returnBaseTable(BaseTable table)
{
Record record = table.getRecord();
int iRawDBType = (record.getDatabaseType() & DBConstants.TABLE_TYPE_MASK);
if ((iRawDBType == DBConstants.LOCAL)
|| (iRawDBType == DBConstants.REMOTE) || (iRawDBType == DBConstants.TABLE))
if ((this.getMasterSlave() & RecordOwner.SLAVE) == RecordOwner.SLAVE) // Do this at the server only
{
if ((record.getDatabaseType() & DBConstants.LOCALIZABLE) == DBConstants.LOCALIZABLE)
{
m_databaseLocale = this.makeDBLocale(record, m_databaseLocale); // Check the local database to make sure it is correct
if (m_databaseLocale != this)
{
table.setRecord(null);
table.free(); // Don't need this for base access
table = m_databaseLocale.makeTable(record);
}
}
}
return table; // Base table (special) access
}
|
[
"public",
"BaseTable",
"returnBaseTable",
"(",
"BaseTable",
"table",
")",
"{",
"Record",
"record",
"=",
"table",
".",
"getRecord",
"(",
")",
";",
"int",
"iRawDBType",
"=",
"(",
"record",
".",
"getDatabaseType",
"(",
")",
"&",
"DBConstants",
".",
"TABLE_TYPE_MASK",
")",
";",
"if",
"(",
"(",
"iRawDBType",
"==",
"DBConstants",
".",
"LOCAL",
")",
"||",
"(",
"iRawDBType",
"==",
"DBConstants",
".",
"REMOTE",
")",
"||",
"(",
"iRawDBType",
"==",
"DBConstants",
".",
"TABLE",
")",
")",
"if",
"(",
"(",
"this",
".",
"getMasterSlave",
"(",
")",
"&",
"RecordOwner",
".",
"SLAVE",
")",
"==",
"RecordOwner",
".",
"SLAVE",
")",
"// Do this at the server only",
"{",
"if",
"(",
"(",
"record",
".",
"getDatabaseType",
"(",
")",
"&",
"DBConstants",
".",
"LOCALIZABLE",
")",
"==",
"DBConstants",
".",
"LOCALIZABLE",
")",
"{",
"m_databaseLocale",
"=",
"this",
".",
"makeDBLocale",
"(",
"record",
",",
"m_databaseLocale",
")",
";",
"// Check the local database to make sure it is correct",
"if",
"(",
"m_databaseLocale",
"!=",
"this",
")",
"{",
"table",
".",
"setRecord",
"(",
"null",
")",
";",
"table",
".",
"free",
"(",
")",
";",
"// Don't need this for base access",
"table",
"=",
"m_databaseLocale",
".",
"makeTable",
"(",
"record",
")",
";",
"}",
"}",
"}",
"return",
"table",
";",
"// Base table (special) access",
"}"
] |
Return the base table for this record.
This is very specialized logic for exporting and importing only the base file.
Further, this logic will return the localized version of the file if language=xxx is set for the client.
@param table The record's initial table
@return The base table.
|
[
"Return",
"the",
"base",
"table",
"for",
"this",
"record",
".",
"This",
"is",
"very",
"specialized",
"logic",
"for",
"exporting",
"and",
"importing",
"only",
"the",
"base",
"file",
".",
"Further",
"this",
"logic",
"will",
"return",
"the",
"localized",
"version",
"of",
"the",
"file",
"if",
"language",
"=",
"xxx",
"is",
"set",
"for",
"the",
"client",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseDatabase.java#L726-L746
|
152,593
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/RingBuffer.java
|
RingBuffer.updated
|
protected void updated()
{
if (remaining < 0 && remaining > capacity)
{
throw new IllegalArgumentException(remaining+" illegal remaining at %s"+toString());
}
if (marked < 0 && marked > capacity)
{
throw new IllegalArgumentException(marked+" illegal marked at %s"+toString());
}
}
|
java
|
protected void updated()
{
if (remaining < 0 && remaining > capacity)
{
throw new IllegalArgumentException(remaining+" illegal remaining at %s"+toString());
}
if (marked < 0 && marked > capacity)
{
throw new IllegalArgumentException(marked+" illegal marked at %s"+toString());
}
}
|
[
"protected",
"void",
"updated",
"(",
")",
"{",
"if",
"(",
"remaining",
"<",
"0",
"&&",
"remaining",
">",
"capacity",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"remaining",
"+",
"\" illegal remaining at %s\"",
"+",
"toString",
"(",
")",
")",
";",
"}",
"if",
"(",
"marked",
"<",
"0",
"&&",
"marked",
">",
"capacity",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"marked",
"+",
"\" illegal marked at %s\"",
"+",
"toString",
"(",
")",
")",
";",
"}",
"}"
] |
This method is called after some parameters like marked are updated.
|
[
"This",
"method",
"is",
"called",
"after",
"some",
"parameters",
"like",
"marked",
"are",
"updated",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/RingBuffer.java#L193-L203
|
152,594
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/RingBuffer.java
|
RingBuffer.writeTo
|
protected int writeTo(SparseBufferOperator<B> op, Splitter<SparseBufferOperator<B>> splitter, int start, int length) throws IOException
{
return splitter.split(op, start, length);
}
|
java
|
protected int writeTo(SparseBufferOperator<B> op, Splitter<SparseBufferOperator<B>> splitter, int start, int length) throws IOException
{
return splitter.split(op, start, length);
}
|
[
"protected",
"int",
"writeTo",
"(",
"SparseBufferOperator",
"<",
"B",
">",
"op",
",",
"Splitter",
"<",
"SparseBufferOperator",
"<",
"B",
">",
">",
"splitter",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"return",
"splitter",
".",
"split",
"(",
"op",
",",
"start",
",",
"length",
")",
";",
"}"
] |
Write buffers content from start
@param op
@param splitter
@param start
@param length
@return
@throws IOException
|
[
"Write",
"buffers",
"content",
"from",
"start"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/RingBuffer.java#L283-L286
|
152,595
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/RingBuffer.java
|
RingBuffer.getString
|
public String getString()
{
StringBuilder sb = new StringBuilder();
for (int ii=0;ii<marked;ii++)
{
sb.append(charAt(ii));
}
return sb.toString();
}
|
java
|
public String getString()
{
StringBuilder sb = new StringBuilder();
for (int ii=0;ii<marked;ii++)
{
sb.append(charAt(ii));
}
return sb.toString();
}
|
[
"public",
"String",
"getString",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"0",
";",
"ii",
"<",
"marked",
";",
"ii",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"charAt",
"(",
"ii",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Returns input between discard and position as a string
@return
|
[
"Returns",
"input",
"between",
"discard",
"and",
"position",
"as",
"a",
"string"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/RingBuffer.java#L311-L319
|
152,596
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/RingBuffer.java
|
RingBuffer.subSequence
|
@Override
public CharSequence subSequence(int start, int end)
{
StringBuilder sb = new StringBuilder();
for (int ii=start;ii<end;ii++)
{
sb.append((char)getAt(ii));
}
return sb.toString();
}
|
java
|
@Override
public CharSequence subSequence(int start, int end)
{
StringBuilder sb = new StringBuilder();
for (int ii=start;ii<end;ii++)
{
sb.append((char)getAt(ii));
}
return sb.toString();
}
|
[
"@",
"Override",
"public",
"CharSequence",
"subSequence",
"(",
"int",
"start",
",",
"int",
"end",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"start",
";",
"ii",
"<",
"end",
";",
"ii",
"++",
")",
"{",
"sb",
".",
"append",
"(",
"(",
"char",
")",
"getAt",
"(",
"ii",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Note that implementation uses StringBuilder to create String as CharSequence.
@param start
@param end
@return
|
[
"Note",
"that",
"implementation",
"uses",
"StringBuilder",
"to",
"create",
"String",
"as",
"CharSequence",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/RingBuffer.java#L344-L353
|
152,597
|
jbundle/jbundle
|
base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/report/HDualReportScreen.java
|
HDualReportScreen.printHtmlNavMenu
|
public void printHtmlNavMenu(PrintWriter out)
throws DBException
{
String strForms = this.getProperty(HtmlConstants.FORMS); // Html page
if (strForms != null) if (strForms.equalsIgnoreCase(HtmlConstants.DISPLAY))
((BasePanel)this.getScreenField()).setProperty(DBParams.NAVMENUS, UserInfoModel.NO_ICONS); // Don't display NAV menus
//x return; // Don't display NAV menus
super.printHtmlNavMenu(out);
}
|
java
|
public void printHtmlNavMenu(PrintWriter out)
throws DBException
{
String strForms = this.getProperty(HtmlConstants.FORMS); // Html page
if (strForms != null) if (strForms.equalsIgnoreCase(HtmlConstants.DISPLAY))
((BasePanel)this.getScreenField()).setProperty(DBParams.NAVMENUS, UserInfoModel.NO_ICONS); // Don't display NAV menus
//x return; // Don't display NAV menus
super.printHtmlNavMenu(out);
}
|
[
"public",
"void",
"printHtmlNavMenu",
"(",
"PrintWriter",
"out",
")",
"throws",
"DBException",
"{",
"String",
"strForms",
"=",
"this",
".",
"getProperty",
"(",
"HtmlConstants",
".",
"FORMS",
")",
";",
"// Html page",
"if",
"(",
"strForms",
"!=",
"null",
")",
"if",
"(",
"strForms",
".",
"equalsIgnoreCase",
"(",
"HtmlConstants",
".",
"DISPLAY",
")",
")",
"(",
"(",
"BasePanel",
")",
"this",
".",
"getScreenField",
"(",
")",
")",
".",
"setProperty",
"(",
"DBParams",
".",
"NAVMENUS",
",",
"UserInfoModel",
".",
"NO_ICONS",
")",
";",
"// Don't display NAV menus",
"//x return; // Don't display NAV menus",
"super",
".",
"printHtmlNavMenu",
"(",
"out",
")",
";",
"}"
] |
Code to display a Menu.
Skip Nav menu for reports.
@exception DBException File exception.
|
[
"Code",
"to",
"display",
"a",
"Menu",
".",
"Skip",
"Nav",
"menu",
"for",
"reports",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/view/html/src/main/java/org/jbundle/base/screen/view/html/report/HDualReportScreen.java#L74-L82
|
152,598
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/menu/SBaseMenuBar.java
|
SBaseMenuBar.getString
|
public String getString(String strKey)
{
if (m_resources == null)
{
BaseApplication application = (BaseApplication)this.getTask().getApplication();
m_resources = application.getResources(ResourceConstants.MENU_RESOURCE, true);
}
return m_resources.getString(strKey);
}
|
java
|
public String getString(String strKey)
{
if (m_resources == null)
{
BaseApplication application = (BaseApplication)this.getTask().getApplication();
m_resources = application.getResources(ResourceConstants.MENU_RESOURCE, true);
}
return m_resources.getString(strKey);
}
|
[
"public",
"String",
"getString",
"(",
"String",
"strKey",
")",
"{",
"if",
"(",
"m_resources",
"==",
"null",
")",
"{",
"BaseApplication",
"application",
"=",
"(",
"BaseApplication",
")",
"this",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
";",
"m_resources",
"=",
"application",
".",
"getResources",
"(",
"ResourceConstants",
".",
"MENU_RESOURCE",
",",
"true",
")",
";",
"}",
"return",
"m_resources",
".",
"getString",
"(",
"strKey",
")",
";",
"}"
] |
Get the Menu resource object.
@param strKey The key to lookup.
@return The local string.
|
[
"Get",
"the",
"Menu",
"resource",
"object",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/menu/SBaseMenuBar.java#L132-L140
|
152,599
|
inkstand-io/scribble
|
scribble-inject/src/main/java/io/inkstand/scribble/inject/ResourceInjection.java
|
ResourceInjection.matchesResourceAnnotation
|
private boolean matchesResourceAnnotation(final Resource resourceAnnotation) {
for (final Resource expectedResources : this.matchingResources) {
if (expectedResources.equals(resourceAnnotation)) {
return true;
}
}
return false;
}
|
java
|
private boolean matchesResourceAnnotation(final Resource resourceAnnotation) {
for (final Resource expectedResources : this.matchingResources) {
if (expectedResources.equals(resourceAnnotation)) {
return true;
}
}
return false;
}
|
[
"private",
"boolean",
"matchesResourceAnnotation",
"(",
"final",
"Resource",
"resourceAnnotation",
")",
"{",
"for",
"(",
"final",
"Resource",
"expectedResources",
":",
"this",
".",
"matchingResources",
")",
"{",
"if",
"(",
"expectedResources",
".",
"equals",
"(",
"resourceAnnotation",
")",
")",
"{",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Verifies, if the specified resource annotation matches any of the resource specification for this injection.
@param resourceAnnotation
the resource annotation of a potential injection target field
@return
<code>true</code> if any of the resource specifications of this injection matches the field
|
[
"Verifies",
"if",
"the",
"specified",
"resource",
"annotation",
"matches",
"any",
"of",
"the",
"resource",
"specification",
"for",
"this",
"injection",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-inject/src/main/java/io/inkstand/scribble/inject/ResourceInjection.java#L118-L126
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.