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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
151,300
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseHolder.java
|
BaseHolder.getProperty
|
public String getProperty(String strKey, Map<String, Object> properties)
{
String strProperty = null;
if (properties != null)
if (properties.get(strKey) != null)
strProperty = properties.get(strKey).toString();
if (strProperty == null)
if (m_remoteObject instanceof PropertyOwner)
strProperty = ((PropertyOwner)m_remoteObject).getProperty(strKey);
if (strProperty == null)
{
if (m_parentHolder != null)
strProperty = m_parentHolder.getProperty(strKey, properties);
if (NULL.equals(strProperty))
strProperty = null;
}
return strProperty;
}
|
java
|
public String getProperty(String strKey, Map<String, Object> properties)
{
String strProperty = null;
if (properties != null)
if (properties.get(strKey) != null)
strProperty = properties.get(strKey).toString();
if (strProperty == null)
if (m_remoteObject instanceof PropertyOwner)
strProperty = ((PropertyOwner)m_remoteObject).getProperty(strKey);
if (strProperty == null)
{
if (m_parentHolder != null)
strProperty = m_parentHolder.getProperty(strKey, properties);
if (NULL.equals(strProperty))
strProperty = null;
}
return strProperty;
}
|
[
"public",
"String",
"getProperty",
"(",
"String",
"strKey",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"String",
"strProperty",
"=",
"null",
";",
"if",
"(",
"properties",
"!=",
"null",
")",
"if",
"(",
"properties",
".",
"get",
"(",
"strKey",
")",
"!=",
"null",
")",
"strProperty",
"=",
"properties",
".",
"get",
"(",
"strKey",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"strProperty",
"==",
"null",
")",
"if",
"(",
"m_remoteObject",
"instanceof",
"PropertyOwner",
")",
"strProperty",
"=",
"(",
"(",
"PropertyOwner",
")",
"m_remoteObject",
")",
".",
"getProperty",
"(",
"strKey",
")",
";",
"if",
"(",
"strProperty",
"==",
"null",
")",
"{",
"if",
"(",
"m_parentHolder",
"!=",
"null",
")",
"strProperty",
"=",
"m_parentHolder",
".",
"getProperty",
"(",
"strKey",
",",
"properties",
")",
";",
"if",
"(",
"NULL",
".",
"equals",
"(",
"strProperty",
")",
")",
"strProperty",
"=",
"null",
";",
"}",
"return",
"strProperty",
";",
"}"
] |
Get the servlet's property.
@param properties Temporary session properties.
|
[
"Get",
"the",
"servlet",
"s",
"property",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseHolder.java#L120-L137
|
151,301
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseHolder.java
|
BaseHolder.find
|
public String find(BaseHolder baseHolder)
{
if (m_mapChildHolders == null)
return null;
return m_mapChildHolders.find(baseHolder);
}
|
java
|
public String find(BaseHolder baseHolder)
{
if (m_mapChildHolders == null)
return null;
return m_mapChildHolders.find(baseHolder);
}
|
[
"public",
"String",
"find",
"(",
"BaseHolder",
"baseHolder",
")",
"{",
"if",
"(",
"m_mapChildHolders",
"==",
"null",
")",
"return",
"null",
";",
"return",
"m_mapChildHolders",
".",
"find",
"(",
"baseHolder",
")",
";",
"}"
] |
Find the key for this BaseHolder
|
[
"Find",
"the",
"key",
"for",
"this",
"BaseHolder"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseHolder.java#L219-L224
|
151,302
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseHolder.java
|
BaseHolder.add
|
public String add(BaseHolder baseHolder)
{
if (m_mapChildHolders == null)
m_mapChildHolders = new MapList();
synchronized (this)
{
return m_mapChildHolders.add(baseHolder);
}
}
|
java
|
public String add(BaseHolder baseHolder)
{
if (m_mapChildHolders == null)
m_mapChildHolders = new MapList();
synchronized (this)
{
return m_mapChildHolders.add(baseHolder);
}
}
|
[
"public",
"String",
"add",
"(",
"BaseHolder",
"baseHolder",
")",
"{",
"if",
"(",
"m_mapChildHolders",
"==",
"null",
")",
"m_mapChildHolders",
"=",
"new",
"MapList",
"(",
")",
";",
"synchronized",
"(",
"this",
")",
"{",
"return",
"m_mapChildHolders",
".",
"add",
"(",
"baseHolder",
")",
";",
"}",
"}"
] |
Add this remote object holder to this parent.
|
[
"Add",
"this",
"remote",
"object",
"holder",
"to",
"this",
"parent",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseHolder.java#L237-L245
|
151,303
|
jbundle/jbundle
|
main/db/src/main/java/org/jbundle/main/db/CheckNonNumericListener.java
|
CheckNonNumericListener.fieldChanged
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
String string = this.getOwner().toString();
if (Utility.isNumeric(string))
{
Task task = null;
if (this.getOwner() != null)
if (this.getOwner().getRecord() != null)
if (this.getOwner().getRecord().getRecordOwner() != null)
task = this.getOwner().getRecord().getRecordOwner().getTask();
if (task == null)
task = BaseApplet.getSharedInstance();
return task.setLastError("Must be non-numeric");
}
return super.fieldChanged(bDisplayOption, iMoveMode);
}
|
java
|
public int fieldChanged(boolean bDisplayOption, int iMoveMode)
{
String string = this.getOwner().toString();
if (Utility.isNumeric(string))
{
Task task = null;
if (this.getOwner() != null)
if (this.getOwner().getRecord() != null)
if (this.getOwner().getRecord().getRecordOwner() != null)
task = this.getOwner().getRecord().getRecordOwner().getTask();
if (task == null)
task = BaseApplet.getSharedInstance();
return task.setLastError("Must be non-numeric");
}
return super.fieldChanged(bDisplayOption, iMoveMode);
}
|
[
"public",
"int",
"fieldChanged",
"(",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"{",
"String",
"string",
"=",
"this",
".",
"getOwner",
"(",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"Utility",
".",
"isNumeric",
"(",
"string",
")",
")",
"{",
"Task",
"task",
"=",
"null",
";",
"if",
"(",
"this",
".",
"getOwner",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
"!=",
"null",
")",
"task",
"=",
"this",
".",
"getOwner",
"(",
")",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
".",
"getTask",
"(",
")",
";",
"if",
"(",
"task",
"==",
"null",
")",
"task",
"=",
"BaseApplet",
".",
"getSharedInstance",
"(",
")",
";",
"return",
"task",
".",
"setLastError",
"(",
"\"Must be non-numeric\"",
")",
";",
"}",
"return",
"super",
".",
"fieldChanged",
"(",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"}"
] |
Field must be non-numeric.
|
[
"Field",
"must",
"be",
"non",
"-",
"numeric",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/CheckNonNumericListener.java#L55-L70
|
151,304
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java
|
CSTransformer.transformFileList
|
protected static FileList transformFileList(final CSNodeWrapper node) {
final List<File> files = new LinkedList<File>();
// Add all the child files
if (node.getChildren() != null && node.getChildren().getItems() != null) {
final List<CSNodeWrapper> childNodes = node.getChildren().getItems();
final HashMap<CSNodeWrapper, File> fileNodes = new HashMap<CSNodeWrapper, File>();
for (final CSNodeWrapper childNode : childNodes) {
fileNodes.put(childNode, transformFile(childNode));
}
// Sort the file list nodes so that they are in the right order based on next/prev values.
final LinkedHashMap<CSNodeWrapper, File> sortedMap = CSNodeSorter.sortMap(fileNodes);
// Add the child nodes to the file list now that they are in the right order.
final Iterator<Map.Entry<CSNodeWrapper, File>> iter = sortedMap.entrySet().iterator();
while (iter.hasNext()) {
final Map.Entry<CSNodeWrapper, File> entry = iter.next();
files.add(entry.getValue());
}
}
return new FileList(CommonConstants.CS_FILE_TITLE, files);
}
|
java
|
protected static FileList transformFileList(final CSNodeWrapper node) {
final List<File> files = new LinkedList<File>();
// Add all the child files
if (node.getChildren() != null && node.getChildren().getItems() != null) {
final List<CSNodeWrapper> childNodes = node.getChildren().getItems();
final HashMap<CSNodeWrapper, File> fileNodes = new HashMap<CSNodeWrapper, File>();
for (final CSNodeWrapper childNode : childNodes) {
fileNodes.put(childNode, transformFile(childNode));
}
// Sort the file list nodes so that they are in the right order based on next/prev values.
final LinkedHashMap<CSNodeWrapper, File> sortedMap = CSNodeSorter.sortMap(fileNodes);
// Add the child nodes to the file list now that they are in the right order.
final Iterator<Map.Entry<CSNodeWrapper, File>> iter = sortedMap.entrySet().iterator();
while (iter.hasNext()) {
final Map.Entry<CSNodeWrapper, File> entry = iter.next();
files.add(entry.getValue());
}
}
return new FileList(CommonConstants.CS_FILE_TITLE, files);
}
|
[
"protected",
"static",
"FileList",
"transformFileList",
"(",
"final",
"CSNodeWrapper",
"node",
")",
"{",
"final",
"List",
"<",
"File",
">",
"files",
"=",
"new",
"LinkedList",
"<",
"File",
">",
"(",
")",
";",
"// Add all the child files",
"if",
"(",
"node",
".",
"getChildren",
"(",
")",
"!=",
"null",
"&&",
"node",
".",
"getChildren",
"(",
")",
".",
"getItems",
"(",
")",
"!=",
"null",
")",
"{",
"final",
"List",
"<",
"CSNodeWrapper",
">",
"childNodes",
"=",
"node",
".",
"getChildren",
"(",
")",
".",
"getItems",
"(",
")",
";",
"final",
"HashMap",
"<",
"CSNodeWrapper",
",",
"File",
">",
"fileNodes",
"=",
"new",
"HashMap",
"<",
"CSNodeWrapper",
",",
"File",
">",
"(",
")",
";",
"for",
"(",
"final",
"CSNodeWrapper",
"childNode",
":",
"childNodes",
")",
"{",
"fileNodes",
".",
"put",
"(",
"childNode",
",",
"transformFile",
"(",
"childNode",
")",
")",
";",
"}",
"// Sort the file list nodes so that they are in the right order based on next/prev values.",
"final",
"LinkedHashMap",
"<",
"CSNodeWrapper",
",",
"File",
">",
"sortedMap",
"=",
"CSNodeSorter",
".",
"sortMap",
"(",
"fileNodes",
")",
";",
"// Add the child nodes to the file list now that they are in the right order.",
"final",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"CSNodeWrapper",
",",
"File",
">",
">",
"iter",
"=",
"sortedMap",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"final",
"Map",
".",
"Entry",
"<",
"CSNodeWrapper",
",",
"File",
">",
"entry",
"=",
"iter",
".",
"next",
"(",
")",
";",
"files",
".",
"add",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"}",
"return",
"new",
"FileList",
"(",
"CommonConstants",
".",
"CS_FILE_TITLE",
",",
"files",
")",
";",
"}"
] |
Transforms a MetaData CSNode into a FileList that can be added to a ContentSpec object.
@param node The CSNode to be transformed.
@return The transformed FileList object.
|
[
"Transforms",
"a",
"MetaData",
"CSNode",
"into",
"a",
"FileList",
"that",
"can",
"be",
"added",
"to",
"a",
"ContentSpec",
"object",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java#L299-L322
|
151,305
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java
|
CSTransformer.transformInfoTopic
|
protected static InfoTopic transformInfoTopic(final CSNodeWrapper parentNode, final CSInfoNodeWrapper node) {
final InfoTopic infoTopic = new InfoTopic(node.getTopicId(), null);
// Basic data
infoTopic.setRevision(node.getTopicRevision());
infoTopic.setConditionStatement(node.getCondition());
infoTopic.setUniqueId(parentNode.getId() == null ? null : parentNode.getId().toString());
return infoTopic;
}
|
java
|
protected static InfoTopic transformInfoTopic(final CSNodeWrapper parentNode, final CSInfoNodeWrapper node) {
final InfoTopic infoTopic = new InfoTopic(node.getTopicId(), null);
// Basic data
infoTopic.setRevision(node.getTopicRevision());
infoTopic.setConditionStatement(node.getCondition());
infoTopic.setUniqueId(parentNode.getId() == null ? null : parentNode.getId().toString());
return infoTopic;
}
|
[
"protected",
"static",
"InfoTopic",
"transformInfoTopic",
"(",
"final",
"CSNodeWrapper",
"parentNode",
",",
"final",
"CSInfoNodeWrapper",
"node",
")",
"{",
"final",
"InfoTopic",
"infoTopic",
"=",
"new",
"InfoTopic",
"(",
"node",
".",
"getTopicId",
"(",
")",
",",
"null",
")",
";",
"// Basic data",
"infoTopic",
".",
"setRevision",
"(",
"node",
".",
"getTopicRevision",
"(",
")",
")",
";",
"infoTopic",
".",
"setConditionStatement",
"(",
"node",
".",
"getCondition",
"(",
")",
")",
";",
"infoTopic",
".",
"setUniqueId",
"(",
"parentNode",
".",
"getId",
"(",
")",
"==",
"null",
"?",
"null",
":",
"parentNode",
".",
"getId",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"return",
"infoTopic",
";",
"}"
] |
Transform a Topic CSNode entity object into an InfoTopic Object that can be added to a Content Specification.
@param node The CSNode entity object to be transformed.
@return The transformed InfoTopic entity.
|
[
"Transform",
"a",
"Topic",
"CSNode",
"entity",
"object",
"into",
"an",
"InfoTopic",
"Object",
"that",
"can",
"be",
"added",
"to",
"a",
"Content",
"Specification",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java#L518-L527
|
151,306
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java
|
CSTransformer.transformComment
|
protected static Comment transformComment(CSNodeWrapper node) {
final Comment comment;
if (node.getNodeType() == CommonConstants.CS_NODE_COMMENT) {
comment = new Comment(node.getTitle());
} else {
throw new IllegalArgumentException("The passed node is not a Comment");
}
comment.setUniqueId(node.getId() == null ? null : node.getId().toString());
return comment;
}
|
java
|
protected static Comment transformComment(CSNodeWrapper node) {
final Comment comment;
if (node.getNodeType() == CommonConstants.CS_NODE_COMMENT) {
comment = new Comment(node.getTitle());
} else {
throw new IllegalArgumentException("The passed node is not a Comment");
}
comment.setUniqueId(node.getId() == null ? null : node.getId().toString());
return comment;
}
|
[
"protected",
"static",
"Comment",
"transformComment",
"(",
"CSNodeWrapper",
"node",
")",
"{",
"final",
"Comment",
"comment",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"==",
"CommonConstants",
".",
"CS_NODE_COMMENT",
")",
"{",
"comment",
"=",
"new",
"Comment",
"(",
"node",
".",
"getTitle",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The passed node is not a Comment\"",
")",
";",
"}",
"comment",
".",
"setUniqueId",
"(",
"node",
".",
"getId",
"(",
")",
"==",
"null",
"?",
"null",
":",
"node",
".",
"getId",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"return",
"comment",
";",
"}"
] |
Transform a Comment CSNode entity into a Comment object that can be added to a Content Specification.
@param node The CSNode to be transformed.
@return The transformed Comment object.
|
[
"Transform",
"a",
"Comment",
"CSNode",
"entity",
"into",
"a",
"Comment",
"object",
"that",
"can",
"be",
"added",
"to",
"a",
"Content",
"Specification",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java#L535-L546
|
151,307
|
pressgang-ccms/PressGangCCMSContentSpec
|
src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java
|
CSTransformer.transformCommonContent
|
protected static CommonContent transformCommonContent(CSNodeWrapper node) {
final CommonContent commonContent;
if (node.getNodeType() == CommonConstants.CS_NODE_COMMON_CONTENT) {
commonContent = new CommonContent(node.getTitle());
} else {
throw new IllegalArgumentException("The passed node is not a Comment");
}
commonContent.setUniqueId(node.getId() == null ? null : node.getId().toString());
return commonContent;
}
|
java
|
protected static CommonContent transformCommonContent(CSNodeWrapper node) {
final CommonContent commonContent;
if (node.getNodeType() == CommonConstants.CS_NODE_COMMON_CONTENT) {
commonContent = new CommonContent(node.getTitle());
} else {
throw new IllegalArgumentException("The passed node is not a Comment");
}
commonContent.setUniqueId(node.getId() == null ? null : node.getId().toString());
return commonContent;
}
|
[
"protected",
"static",
"CommonContent",
"transformCommonContent",
"(",
"CSNodeWrapper",
"node",
")",
"{",
"final",
"CommonContent",
"commonContent",
";",
"if",
"(",
"node",
".",
"getNodeType",
"(",
")",
"==",
"CommonConstants",
".",
"CS_NODE_COMMON_CONTENT",
")",
"{",
"commonContent",
"=",
"new",
"CommonContent",
"(",
"node",
".",
"getTitle",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"The passed node is not a Comment\"",
")",
";",
"}",
"commonContent",
".",
"setUniqueId",
"(",
"node",
".",
"getId",
"(",
")",
"==",
"null",
"?",
"null",
":",
"node",
".",
"getId",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"return",
"commonContent",
";",
"}"
] |
Transform a Common Content CSNode entity into a Comment object that can be added to a Content Specification.
@param node The CSNode to be transformed.
@return The transformed Comment object.
|
[
"Transform",
"a",
"Common",
"Content",
"CSNode",
"entity",
"into",
"a",
"Comment",
"object",
"that",
"can",
"be",
"added",
"to",
"a",
"Content",
"Specification",
"."
] |
2bc02e2971e4522b47a130fb7ae5a0f5ad377df1
|
https://github.com/pressgang-ccms/PressGangCCMSContentSpec/blob/2bc02e2971e4522b47a130fb7ae5a0f5ad377df1/src/main/java/org/jboss/pressgang/ccms/contentspec/utils/CSTransformer.java#L554-L565
|
151,308
|
huangp/entityunit
|
src/main/java/com/github/huangp/entityunit/entity/EntityMakerBuilder.java
|
EntityMakerBuilder.reuseEntities
|
public EntityMakerBuilder reuseEntities(Collection<Object> entities) {
for (Object entity : entities) {
Class aClass = entity.getClass();
valueHolder.putIfNotNull(aClass, entity);
}
return this;
}
|
java
|
public EntityMakerBuilder reuseEntities(Collection<Object> entities) {
for (Object entity : entities) {
Class aClass = entity.getClass();
valueHolder.putIfNotNull(aClass, entity);
}
return this;
}
|
[
"public",
"EntityMakerBuilder",
"reuseEntities",
"(",
"Collection",
"<",
"Object",
">",
"entities",
")",
"{",
"for",
"(",
"Object",
"entity",
":",
"entities",
")",
"{",
"Class",
"aClass",
"=",
"entity",
".",
"getClass",
"(",
")",
";",
"valueHolder",
".",
"putIfNotNull",
"(",
"aClass",
",",
"entity",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Reuse a collection of objects when making new entities.
@param entities
reusable collection of entities
@return this
|
[
"Reuse",
"a",
"collection",
"of",
"objects",
"when",
"making",
"new",
"entities",
"."
] |
1a09b530149d707dbff7ff46f5428d9db709a4b4
|
https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/entity/EntityMakerBuilder.java#L70-L76
|
151,309
|
huangp/entityunit
|
src/main/java/com/github/huangp/entityunit/entity/EntityMakerBuilder.java
|
EntityMakerBuilder.reuseEntity
|
public EntityMakerBuilder reuseEntity(Serializable entity) {
Class aClass = entity.getClass();
valueHolder.putIfNotNull(aClass, entity);
return this;
}
|
java
|
public EntityMakerBuilder reuseEntity(Serializable entity) {
Class aClass = entity.getClass();
valueHolder.putIfNotNull(aClass, entity);
return this;
}
|
[
"public",
"EntityMakerBuilder",
"reuseEntity",
"(",
"Serializable",
"entity",
")",
"{",
"Class",
"aClass",
"=",
"entity",
".",
"getClass",
"(",
")",
";",
"valueHolder",
".",
"putIfNotNull",
"(",
"aClass",
",",
"entity",
")",
";",
"return",
"this",
";",
"}"
] |
Reuse single entity.
@param entity
entity
@return this
|
[
"Reuse",
"single",
"entity",
"."
] |
1a09b530149d707dbff7ff46f5428d9db709a4b4
|
https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/entity/EntityMakerBuilder.java#L85-L89
|
151,310
|
huangp/entityunit
|
src/main/java/com/github/huangp/entityunit/entity/EntityMakerBuilder.java
|
EntityMakerBuilder.reuseEntities
|
public EntityMakerBuilder reuseEntities(Object first, Object second, Object... rest) {
List<Object> objects = ImmutableList.builder().add(first).add(second).add(rest).build();
return reuseEntities(objects);
}
|
java
|
public EntityMakerBuilder reuseEntities(Object first, Object second, Object... rest) {
List<Object> objects = ImmutableList.builder().add(first).add(second).add(rest).build();
return reuseEntities(objects);
}
|
[
"public",
"EntityMakerBuilder",
"reuseEntities",
"(",
"Object",
"first",
",",
"Object",
"second",
",",
"Object",
"...",
"rest",
")",
"{",
"List",
"<",
"Object",
">",
"objects",
"=",
"ImmutableList",
".",
"builder",
"(",
")",
".",
"add",
"(",
"first",
")",
".",
"add",
"(",
"second",
")",
".",
"add",
"(",
"rest",
")",
".",
"build",
"(",
")",
";",
"return",
"reuseEntities",
"(",
"objects",
")",
";",
"}"
] |
Reuse entities.
@param first
first
@param second
second
@param rest
rest of reusable entities as var args
@return this
|
[
"Reuse",
"entities",
"."
] |
1a09b530149d707dbff7ff46f5428d9db709a4b4
|
https://github.com/huangp/entityunit/blob/1a09b530149d707dbff7ff46f5428d9db709a4b4/src/main/java/com/github/huangp/entityunit/entity/EntityMakerBuilder.java#L102-L105
|
151,311
|
mbenson/therian
|
build-processor/src/main/java/therian/buildweaver/StandardOperatorsProcessor.java
|
StandardOperatorsProcessor.isValidStandardOperator
|
private static boolean isValidStandardOperator(final Element e) {
if (e.getKind() == ElementKind.FIELD) {
return e.getModifiers().containsAll(EnumSet.of(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL));
}
if (e.getKind() == ElementKind.METHOD) {
return e.getModifiers().containsAll(EnumSet.of(Modifier.PUBLIC, Modifier.STATIC))
&& ((ExecutableElement) e).getParameters().isEmpty();
}
if (e.getKind() == ElementKind.CLASS) {
if (e.getModifiers().contains(Modifier.ABSTRACT) || findDefaultConstructor((TypeElement) e) == null) {
return false;
}
Element current = e;
while (current.getKind() == ElementKind.CLASS) {
final TypeElement t = (TypeElement) current;
if (t.getNestingKind() == NestingKind.TOP_LEVEL) {
return true;
}
if (t.getNestingKind() == NestingKind.MEMBER && t.getModifiers().contains(Modifier.STATIC)) {
current = t.getEnclosingElement();
continue;
}
break;
}
}
return false;
}
|
java
|
private static boolean isValidStandardOperator(final Element e) {
if (e.getKind() == ElementKind.FIELD) {
return e.getModifiers().containsAll(EnumSet.of(Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL));
}
if (e.getKind() == ElementKind.METHOD) {
return e.getModifiers().containsAll(EnumSet.of(Modifier.PUBLIC, Modifier.STATIC))
&& ((ExecutableElement) e).getParameters().isEmpty();
}
if (e.getKind() == ElementKind.CLASS) {
if (e.getModifiers().contains(Modifier.ABSTRACT) || findDefaultConstructor((TypeElement) e) == null) {
return false;
}
Element current = e;
while (current.getKind() == ElementKind.CLASS) {
final TypeElement t = (TypeElement) current;
if (t.getNestingKind() == NestingKind.TOP_LEVEL) {
return true;
}
if (t.getNestingKind() == NestingKind.MEMBER && t.getModifiers().contains(Modifier.STATIC)) {
current = t.getEnclosingElement();
continue;
}
break;
}
}
return false;
}
|
[
"private",
"static",
"boolean",
"isValidStandardOperator",
"(",
"final",
"Element",
"e",
")",
"{",
"if",
"(",
"e",
".",
"getKind",
"(",
")",
"==",
"ElementKind",
".",
"FIELD",
")",
"{",
"return",
"e",
".",
"getModifiers",
"(",
")",
".",
"containsAll",
"(",
"EnumSet",
".",
"of",
"(",
"Modifier",
".",
"PUBLIC",
",",
"Modifier",
".",
"STATIC",
",",
"Modifier",
".",
"FINAL",
")",
")",
";",
"}",
"if",
"(",
"e",
".",
"getKind",
"(",
")",
"==",
"ElementKind",
".",
"METHOD",
")",
"{",
"return",
"e",
".",
"getModifiers",
"(",
")",
".",
"containsAll",
"(",
"EnumSet",
".",
"of",
"(",
"Modifier",
".",
"PUBLIC",
",",
"Modifier",
".",
"STATIC",
")",
")",
"&&",
"(",
"(",
"ExecutableElement",
")",
"e",
")",
".",
"getParameters",
"(",
")",
".",
"isEmpty",
"(",
")",
";",
"}",
"if",
"(",
"e",
".",
"getKind",
"(",
")",
"==",
"ElementKind",
".",
"CLASS",
")",
"{",
"if",
"(",
"e",
".",
"getModifiers",
"(",
")",
".",
"contains",
"(",
"Modifier",
".",
"ABSTRACT",
")",
"||",
"findDefaultConstructor",
"(",
"(",
"TypeElement",
")",
"e",
")",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"Element",
"current",
"=",
"e",
";",
"while",
"(",
"current",
".",
"getKind",
"(",
")",
"==",
"ElementKind",
".",
"CLASS",
")",
"{",
"final",
"TypeElement",
"t",
"=",
"(",
"TypeElement",
")",
"current",
";",
"if",
"(",
"t",
".",
"getNestingKind",
"(",
")",
"==",
"NestingKind",
".",
"TOP_LEVEL",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"t",
".",
"getNestingKind",
"(",
")",
"==",
"NestingKind",
".",
"MEMBER",
"&&",
"t",
".",
"getModifiers",
"(",
")",
".",
"contains",
"(",
"Modifier",
".",
"STATIC",
")",
")",
"{",
"current",
"=",
"t",
".",
"getEnclosingElement",
"(",
")",
";",
"continue",
";",
"}",
"break",
";",
"}",
"}",
"return",
"false",
";",
"}"
] |
Must be a public static concrete class with a default constructor, public static zero-arg method, or public
static final field.
@param e
@return boolean
|
[
"Must",
"be",
"a",
"public",
"static",
"concrete",
"class",
"with",
"a",
"default",
"constructor",
"public",
"static",
"zero",
"-",
"arg",
"method",
"or",
"public",
"static",
"final",
"field",
"."
] |
0653505f73e2a6f5b0abc394ea6d83af03408254
|
https://github.com/mbenson/therian/blob/0653505f73e2a6f5b0abc394ea6d83af03408254/build-processor/src/main/java/therian/buildweaver/StandardOperatorsProcessor.java#L155-L181
|
151,312
|
jbundle/jbundle
|
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java
|
BaseHttpTask.cleanParam
|
public static String cleanParam(String[] strParams, boolean bSetDefault, String strDefault)
{
if ((strParams == null) || (strParams.length == 0))
strParams = new String[1];
if (strParams[0] == null) if (bSetDefault)
strParams[0] = strDefault;
if (strParams[0] == null)
return null;
try {
return URLDecoder.decode(strParams[0], DBConstants.URL_ENCODING);
} catch (java.io.UnsupportedEncodingException ex) {
return strParams[0];
}
}
|
java
|
public static String cleanParam(String[] strParams, boolean bSetDefault, String strDefault)
{
if ((strParams == null) || (strParams.length == 0))
strParams = new String[1];
if (strParams[0] == null) if (bSetDefault)
strParams[0] = strDefault;
if (strParams[0] == null)
return null;
try {
return URLDecoder.decode(strParams[0], DBConstants.URL_ENCODING);
} catch (java.io.UnsupportedEncodingException ex) {
return strParams[0];
}
}
|
[
"public",
"static",
"String",
"cleanParam",
"(",
"String",
"[",
"]",
"strParams",
",",
"boolean",
"bSetDefault",
",",
"String",
"strDefault",
")",
"{",
"if",
"(",
"(",
"strParams",
"==",
"null",
")",
"||",
"(",
"strParams",
".",
"length",
"==",
"0",
")",
")",
"strParams",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"if",
"(",
"strParams",
"[",
"0",
"]",
"==",
"null",
")",
"if",
"(",
"bSetDefault",
")",
"strParams",
"[",
"0",
"]",
"=",
"strDefault",
";",
"if",
"(",
"strParams",
"[",
"0",
"]",
"==",
"null",
")",
"return",
"null",
";",
"try",
"{",
"return",
"URLDecoder",
".",
"decode",
"(",
"strParams",
"[",
"0",
"]",
",",
"DBConstants",
".",
"URL_ENCODING",
")",
";",
"}",
"catch",
"(",
"java",
".",
"io",
".",
"UnsupportedEncodingException",
"ex",
")",
"{",
"return",
"strParams",
"[",
"0",
"]",
";",
"}",
"}"
] |
Clean-up the param string
|
[
"Clean",
"-",
"up",
"the",
"param",
"string"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L235-L248
|
151,313
|
jbundle/jbundle
|
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java
|
BaseHttpTask.getParam
|
public static String getParam(HttpServletRequest req, String strParam)
{
return BaseHttpTask.getParam(req, strParam, Constants.BLANK);
}
|
java
|
public static String getParam(HttpServletRequest req, String strParam)
{
return BaseHttpTask.getParam(req, strParam, Constants.BLANK);
}
|
[
"public",
"static",
"String",
"getParam",
"(",
"HttpServletRequest",
"req",
",",
"String",
"strParam",
")",
"{",
"return",
"BaseHttpTask",
".",
"getParam",
"(",
"req",
",",
"strParam",
",",
"Constants",
".",
"BLANK",
")",
";",
"}"
] |
Get the first occurence of this parameter.
|
[
"Get",
"the",
"first",
"occurence",
"of",
"this",
"parameter",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L259-L262
|
151,314
|
jbundle/jbundle
|
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java
|
BaseHttpTask.getParam
|
public static String getParam(HttpServletRequest req, String strParam, String strDefault)
{
String strParams[] = null;
if (req == null)
return null;
strParams = req.getParameterValues(strParam); // Menu page
if (DBParams.URL.equals(strParam))
{
strParams = new String[1];
strParams[0] = req.getRequestURL().toString(); // Special param (url).
}
if (DBParams.CODEBASE.equals(strParam))
{
strParams = new String[1];
strParams[0] = req.getRequestURL().toString(); // Special param (url).
if (strParams[0].endsWith(Constants.DEFAULT_SERVLET))
strParams[0] = strParams[0].substring(0, strParams[0].length() - Constants.DEFAULT_SERVLET.length());
if (!strParams[0].endsWith("/"))
strParams[0] = strParams[0] + "/"; // Codebase should always end with this
}
if (DBParams.DOMAIN.equals(strParam))
{
strParams = new String[1];
strParams[0] = req.getRequestURL().toString(); // Special param (url).
return Utility.getDomainFromURL(strParams[0], null);
}
if (strParams == null)
if (DBParams.DATATYPE.equals(strParam))
{
strParams = new String[1];
strParams[0] = req.getRequestURL().toString(); // Special param (url).
if ((strParams[0] != null)
&& (strParams[0].lastIndexOf('/') != -1))
{
strParams[0] = strParams[0].substring(strParams[0].lastIndexOf('/') + 1);
if (strParams[0].indexOf('.') != -1)
strParams[0] = strParams[0].substring(0, strParams[0].indexOf('.'));
if ((!DBParams.TABLE_PARAM.equalsIgnoreCase(strParams[0]))
&& (!DBParams.WEBSTART_PARAM.equalsIgnoreCase(strParams[0]))
&& (!DBParams.WEBSTART_APPLET_PARAM.equalsIgnoreCase(strParams[0]))
&& (!DBParams.WSDL_PARAM.equalsIgnoreCase(strParams[0]))
&& (!DBParams.IMAGE_PATH.equalsIgnoreCase(strParams[0])))
strParams = null; // Must be one of these
}
else
strParams = null;
}
if (strParams == null)
return strDefault;
if (strParams.length == 0)
return Constants.BLANK;
if (strParams[0] == null)
return Constants.BLANK;
return strParams[0];
}
|
java
|
public static String getParam(HttpServletRequest req, String strParam, String strDefault)
{
String strParams[] = null;
if (req == null)
return null;
strParams = req.getParameterValues(strParam); // Menu page
if (DBParams.URL.equals(strParam))
{
strParams = new String[1];
strParams[0] = req.getRequestURL().toString(); // Special param (url).
}
if (DBParams.CODEBASE.equals(strParam))
{
strParams = new String[1];
strParams[0] = req.getRequestURL().toString(); // Special param (url).
if (strParams[0].endsWith(Constants.DEFAULT_SERVLET))
strParams[0] = strParams[0].substring(0, strParams[0].length() - Constants.DEFAULT_SERVLET.length());
if (!strParams[0].endsWith("/"))
strParams[0] = strParams[0] + "/"; // Codebase should always end with this
}
if (DBParams.DOMAIN.equals(strParam))
{
strParams = new String[1];
strParams[0] = req.getRequestURL().toString(); // Special param (url).
return Utility.getDomainFromURL(strParams[0], null);
}
if (strParams == null)
if (DBParams.DATATYPE.equals(strParam))
{
strParams = new String[1];
strParams[0] = req.getRequestURL().toString(); // Special param (url).
if ((strParams[0] != null)
&& (strParams[0].lastIndexOf('/') != -1))
{
strParams[0] = strParams[0].substring(strParams[0].lastIndexOf('/') + 1);
if (strParams[0].indexOf('.') != -1)
strParams[0] = strParams[0].substring(0, strParams[0].indexOf('.'));
if ((!DBParams.TABLE_PARAM.equalsIgnoreCase(strParams[0]))
&& (!DBParams.WEBSTART_PARAM.equalsIgnoreCase(strParams[0]))
&& (!DBParams.WEBSTART_APPLET_PARAM.equalsIgnoreCase(strParams[0]))
&& (!DBParams.WSDL_PARAM.equalsIgnoreCase(strParams[0]))
&& (!DBParams.IMAGE_PATH.equalsIgnoreCase(strParams[0])))
strParams = null; // Must be one of these
}
else
strParams = null;
}
if (strParams == null)
return strDefault;
if (strParams.length == 0)
return Constants.BLANK;
if (strParams[0] == null)
return Constants.BLANK;
return strParams[0];
}
|
[
"public",
"static",
"String",
"getParam",
"(",
"HttpServletRequest",
"req",
",",
"String",
"strParam",
",",
"String",
"strDefault",
")",
"{",
"String",
"strParams",
"[",
"]",
"=",
"null",
";",
"if",
"(",
"req",
"==",
"null",
")",
"return",
"null",
";",
"strParams",
"=",
"req",
".",
"getParameterValues",
"(",
"strParam",
")",
";",
"// Menu page",
"if",
"(",
"DBParams",
".",
"URL",
".",
"equals",
"(",
"strParam",
")",
")",
"{",
"strParams",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"strParams",
"[",
"0",
"]",
"=",
"req",
".",
"getRequestURL",
"(",
")",
".",
"toString",
"(",
")",
";",
"// Special param (url).",
"}",
"if",
"(",
"DBParams",
".",
"CODEBASE",
".",
"equals",
"(",
"strParam",
")",
")",
"{",
"strParams",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"strParams",
"[",
"0",
"]",
"=",
"req",
".",
"getRequestURL",
"(",
")",
".",
"toString",
"(",
")",
";",
"// Special param (url).",
"if",
"(",
"strParams",
"[",
"0",
"]",
".",
"endsWith",
"(",
"Constants",
".",
"DEFAULT_SERVLET",
")",
")",
"strParams",
"[",
"0",
"]",
"=",
"strParams",
"[",
"0",
"]",
".",
"substring",
"(",
"0",
",",
"strParams",
"[",
"0",
"]",
".",
"length",
"(",
")",
"-",
"Constants",
".",
"DEFAULT_SERVLET",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"!",
"strParams",
"[",
"0",
"]",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"strParams",
"[",
"0",
"]",
"=",
"strParams",
"[",
"0",
"]",
"+",
"\"/\"",
";",
"// Codebase should always end with this",
"}",
"if",
"(",
"DBParams",
".",
"DOMAIN",
".",
"equals",
"(",
"strParam",
")",
")",
"{",
"strParams",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"strParams",
"[",
"0",
"]",
"=",
"req",
".",
"getRequestURL",
"(",
")",
".",
"toString",
"(",
")",
";",
"// Special param (url).",
"return",
"Utility",
".",
"getDomainFromURL",
"(",
"strParams",
"[",
"0",
"]",
",",
"null",
")",
";",
"}",
"if",
"(",
"strParams",
"==",
"null",
")",
"if",
"(",
"DBParams",
".",
"DATATYPE",
".",
"equals",
"(",
"strParam",
")",
")",
"{",
"strParams",
"=",
"new",
"String",
"[",
"1",
"]",
";",
"strParams",
"[",
"0",
"]",
"=",
"req",
".",
"getRequestURL",
"(",
")",
".",
"toString",
"(",
")",
";",
"// Special param (url).",
"if",
"(",
"(",
"strParams",
"[",
"0",
"]",
"!=",
"null",
")",
"&&",
"(",
"strParams",
"[",
"0",
"]",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
")",
"{",
"strParams",
"[",
"0",
"]",
"=",
"strParams",
"[",
"0",
"]",
".",
"substring",
"(",
"strParams",
"[",
"0",
"]",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"if",
"(",
"strParams",
"[",
"0",
"]",
".",
"indexOf",
"(",
"'",
"'",
")",
"!=",
"-",
"1",
")",
"strParams",
"[",
"0",
"]",
"=",
"strParams",
"[",
"0",
"]",
".",
"substring",
"(",
"0",
",",
"strParams",
"[",
"0",
"]",
".",
"indexOf",
"(",
"'",
"'",
")",
")",
";",
"if",
"(",
"(",
"!",
"DBParams",
".",
"TABLE_PARAM",
".",
"equalsIgnoreCase",
"(",
"strParams",
"[",
"0",
"]",
")",
")",
"&&",
"(",
"!",
"DBParams",
".",
"WEBSTART_PARAM",
".",
"equalsIgnoreCase",
"(",
"strParams",
"[",
"0",
"]",
")",
")",
"&&",
"(",
"!",
"DBParams",
".",
"WEBSTART_APPLET_PARAM",
".",
"equalsIgnoreCase",
"(",
"strParams",
"[",
"0",
"]",
")",
")",
"&&",
"(",
"!",
"DBParams",
".",
"WSDL_PARAM",
".",
"equalsIgnoreCase",
"(",
"strParams",
"[",
"0",
"]",
")",
")",
"&&",
"(",
"!",
"DBParams",
".",
"IMAGE_PATH",
".",
"equalsIgnoreCase",
"(",
"strParams",
"[",
"0",
"]",
")",
")",
")",
"strParams",
"=",
"null",
";",
"// Must be one of these ",
"}",
"else",
"strParams",
"=",
"null",
";",
"}",
"if",
"(",
"strParams",
"==",
"null",
")",
"return",
"strDefault",
";",
"if",
"(",
"strParams",
".",
"length",
"==",
"0",
")",
"return",
"Constants",
".",
"BLANK",
";",
"if",
"(",
"strParams",
"[",
"0",
"]",
"==",
"null",
")",
"return",
"Constants",
".",
"BLANK",
";",
"return",
"strParams",
"[",
"0",
"]",
";",
"}"
] |
Get the first occurrence of this parameter.
|
[
"Get",
"the",
"first",
"occurrence",
"of",
"this",
"parameter",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L266-L321
|
151,315
|
jbundle/jbundle
|
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java
|
BaseHttpTask.getLastError
|
public String getLastError(int iErrorCode)
{
if ((m_strLastError == null) || ((iErrorCode != 0) && (iErrorCode != m_iLastErrorCode)))
return Constants.BLANK;
String string = m_strLastError;
m_strLastError = null;
return string;
}
|
java
|
public String getLastError(int iErrorCode)
{
if ((m_strLastError == null) || ((iErrorCode != 0) && (iErrorCode != m_iLastErrorCode)))
return Constants.BLANK;
String string = m_strLastError;
m_strLastError = null;
return string;
}
|
[
"public",
"String",
"getLastError",
"(",
"int",
"iErrorCode",
")",
"{",
"if",
"(",
"(",
"m_strLastError",
"==",
"null",
")",
"||",
"(",
"(",
"iErrorCode",
"!=",
"0",
")",
"&&",
"(",
"iErrorCode",
"!=",
"m_iLastErrorCode",
")",
")",
")",
"return",
"Constants",
".",
"BLANK",
";",
"String",
"string",
"=",
"m_strLastError",
";",
"m_strLastError",
"=",
"null",
";",
"return",
"string",
";",
"}"
] |
Get the last error code.
This call clears the last error code.
@param iErrorCode Pass the error code of the last error code or 0 to get the last error.
|
[
"Get",
"the",
"last",
"error",
"code",
".",
"This",
"call",
"clears",
"the",
"last",
"error",
"code",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L487-L494
|
151,316
|
jbundle/jbundle
|
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java
|
BaseHttpTask.getStatusText
|
public String getStatusText(int iWarningLevel)
{
String strStatus = m_strCurrentStatus;
if (m_iCurrentWarningLevel < iWarningLevel)
strStatus = null;
return strStatus;
}
|
java
|
public String getStatusText(int iWarningLevel)
{
String strStatus = m_strCurrentStatus;
if (m_iCurrentWarningLevel < iWarningLevel)
strStatus = null;
return strStatus;
}
|
[
"public",
"String",
"getStatusText",
"(",
"int",
"iWarningLevel",
")",
"{",
"String",
"strStatus",
"=",
"m_strCurrentStatus",
";",
"if",
"(",
"m_iCurrentWarningLevel",
"<",
"iWarningLevel",
")",
"strStatus",
"=",
"null",
";",
"return",
"strStatus",
";",
"}"
] |
Get the last status message if it is at this level or above.
Typically you do this to see if the current message you want to display can
be displayed on top of the message that is there already.
Calling this method will clear the last status text.
@param iWarningLevel The maximum warning level to retrieve.
@return The current message if at this level or above, otherwise return null.
|
[
"Get",
"the",
"last",
"status",
"message",
"if",
"it",
"is",
"at",
"this",
"level",
"or",
"above",
".",
"Typically",
"you",
"do",
"this",
"to",
"see",
"if",
"the",
"current",
"message",
"you",
"want",
"to",
"display",
"can",
"be",
"displayed",
"on",
"top",
"of",
"the",
"message",
"that",
"is",
"there",
"already",
".",
"Calling",
"this",
"method",
"will",
"clear",
"the",
"last",
"status",
"text",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L531-L537
|
151,317
|
jbundle/jbundle
|
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java
|
BaseHttpTask.getRealPath
|
public String getRealPath(HttpServletRequest request, String path)
{
if (m_servlet != null)
return m_servlet.getRealPath(request, path);
return path;
}
|
java
|
public String getRealPath(HttpServletRequest request, String path)
{
if (m_servlet != null)
return m_servlet.getRealPath(request, path);
return path;
}
|
[
"public",
"String",
"getRealPath",
"(",
"HttpServletRequest",
"request",
",",
"String",
"path",
")",
"{",
"if",
"(",
"m_servlet",
"!=",
"null",
")",
"return",
"m_servlet",
".",
"getRealPath",
"(",
"request",
",",
"path",
")",
";",
"return",
"path",
";",
"}"
] |
Get the physical path for this internet path.
@param request The request
|
[
"Get",
"the",
"physical",
"path",
"for",
"this",
"internet",
"path",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L901-L906
|
151,318
|
jbundle/jbundle
|
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java
|
BaseHttpTask.getString
|
public String getString(String strKey)
{
if (this.getApplication() != null)
return this.getApplication().getString(strKey);
return strKey;
}
|
java
|
public String getString(String strKey)
{
if (this.getApplication() != null)
return this.getApplication().getString(strKey);
return strKey;
}
|
[
"public",
"String",
"getString",
"(",
"String",
"strKey",
")",
"{",
"if",
"(",
"this",
".",
"getApplication",
"(",
")",
"!=",
"null",
")",
"return",
"this",
".",
"getApplication",
"(",
")",
".",
"getString",
"(",
"strKey",
")",
";",
"return",
"strKey",
";",
"}"
] |
Convert this key to a localized string.
In thin, this just calls the getString method in application,
in thick, a local resource can be saved.
@param strKey The key to lookup in the resource file.
@return The localized key.
|
[
"Convert",
"this",
"key",
"to",
"a",
"localized",
"string",
".",
"In",
"thin",
"this",
"just",
"calls",
"the",
"getString",
"method",
"in",
"application",
"in",
"thick",
"a",
"local",
"resource",
"can",
"be",
"saved",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/BaseHttpTask.java#L962-L967
|
151,319
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/filter/ClassFilterBuilder.java
|
ClassFilterBuilder.add
|
private void add(ClassFilter filter) {
switch(operator) {
case NOT:
filters.add(new NegationClassFilter(filter));
operator = Operator.NONE;
break;
case OR:
filters.set(filters.size() - 1,
new OrClassFilter(filters.get(filters.size() - 1), filter));
operator = Operator.NONE;
break;
default:
filters.add(filter);
break;
}
}
|
java
|
private void add(ClassFilter filter) {
switch(operator) {
case NOT:
filters.add(new NegationClassFilter(filter));
operator = Operator.NONE;
break;
case OR:
filters.set(filters.size() - 1,
new OrClassFilter(filters.get(filters.size() - 1), filter));
operator = Operator.NONE;
break;
default:
filters.add(filter);
break;
}
}
|
[
"private",
"void",
"add",
"(",
"ClassFilter",
"filter",
")",
"{",
"switch",
"(",
"operator",
")",
"{",
"case",
"NOT",
":",
"filters",
".",
"add",
"(",
"new",
"NegationClassFilter",
"(",
"filter",
")",
")",
";",
"operator",
"=",
"Operator",
".",
"NONE",
";",
"break",
";",
"case",
"OR",
":",
"filters",
".",
"set",
"(",
"filters",
".",
"size",
"(",
")",
"-",
"1",
",",
"new",
"OrClassFilter",
"(",
"filters",
".",
"get",
"(",
"filters",
".",
"size",
"(",
")",
"-",
"1",
")",
",",
"filter",
")",
")",
";",
"operator",
"=",
"Operator",
".",
"NONE",
";",
"break",
";",
"default",
":",
"filters",
".",
"add",
"(",
"filter",
")",
";",
"break",
";",
"}",
"}"
] |
Adds a new filter and applies current operator.
@param filter filter to add.
|
[
"Adds",
"a",
"new",
"filter",
"and",
"applies",
"current",
"operator",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/filter/ClassFilterBuilder.java#L54-L69
|
151,320
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/filter/ClassFilterBuilder.java
|
ClassFilterBuilder.isDefault
|
public ClassFilterBuilder isDefault() {
add(new NegationClassFilter(new ModifierClassFilter(Modifier.PUBLIC & Modifier.PROTECTED & Modifier.PRIVATE)));
return this;
}
|
java
|
public ClassFilterBuilder isDefault() {
add(new NegationClassFilter(new ModifierClassFilter(Modifier.PUBLIC & Modifier.PROTECTED & Modifier.PRIVATE)));
return this;
}
|
[
"public",
"ClassFilterBuilder",
"isDefault",
"(",
")",
"{",
"add",
"(",
"new",
"NegationClassFilter",
"(",
"new",
"ModifierClassFilter",
"(",
"Modifier",
".",
"PUBLIC",
"&",
"Modifier",
".",
"PROTECTED",
"&",
"Modifier",
".",
"PRIVATE",
")",
")",
")",
";",
"return",
"this",
";",
"}"
] |
Adds filter for default access classes.
@return This builder for method chaining.
|
[
"Adds",
"filter",
"for",
"default",
"access",
"classes",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/filter/ClassFilterBuilder.java#L284-L287
|
151,321
|
wigforss/Ka-Commons-Reflection
|
src/main/java/org/kasource/commons/reflection/filter/ClassFilterBuilder.java
|
ClassFilterBuilder.build
|
public ClassFilter build() throws IllegalStateException {
if(filters.isEmpty()) {
throw new IllegalStateException("No filters set.");
}
if(filters.size() == 1) {
return filters.get(0);
}
ClassFilter[] classFilters = new ClassFilter[filters.size()];
filters.toArray(classFilters);
return new ClassFilterList(classFilters);
}
|
java
|
public ClassFilter build() throws IllegalStateException {
if(filters.isEmpty()) {
throw new IllegalStateException("No filters set.");
}
if(filters.size() == 1) {
return filters.get(0);
}
ClassFilter[] classFilters = new ClassFilter[filters.size()];
filters.toArray(classFilters);
return new ClassFilterList(classFilters);
}
|
[
"public",
"ClassFilter",
"build",
"(",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"filters",
".",
"isEmpty",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No filters set.\"",
")",
";",
"}",
"if",
"(",
"filters",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"return",
"filters",
".",
"get",
"(",
"0",
")",
";",
"}",
"ClassFilter",
"[",
"]",
"classFilters",
"=",
"new",
"ClassFilter",
"[",
"filters",
".",
"size",
"(",
")",
"]",
";",
"filters",
".",
"toArray",
"(",
"classFilters",
")",
";",
"return",
"new",
"ClassFilterList",
"(",
"classFilters",
")",
";",
"}"
] |
Builds the filter and returns the result.
@return the ClassFilter built.
@throws IllegalStateException if no filter has been added.
|
[
"Builds",
"the",
"filter",
"and",
"returns",
"the",
"result",
"."
] |
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
|
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/filter/ClassFilterBuilder.java#L336-L346
|
151,322
|
shibme/jbotstats
|
src/me/shib/java/lib/jbotstats/AnalyticsBot.java
|
AnalyticsBot.getChatAdministrators
|
@Override
public ChatMember[] getChatAdministrators(ChatId chat_id) throws IOException {
AnalyticsData data = new AnalyticsData("getChatAdministrators");
IOException ioException = null;
ChatMember[] admins = null;
data.setValue("chat_id", chat_id);
try {
admins = bot.getChatAdministrators(chat_id);
data.setReturned(admins);
} catch (IOException e) {
ioException = e;
data.setIoException(ioException);
}
analyticsWorker.putData(data);
if (ioException != null) {
throw ioException;
}
return admins;
}
|
java
|
@Override
public ChatMember[] getChatAdministrators(ChatId chat_id) throws IOException {
AnalyticsData data = new AnalyticsData("getChatAdministrators");
IOException ioException = null;
ChatMember[] admins = null;
data.setValue("chat_id", chat_id);
try {
admins = bot.getChatAdministrators(chat_id);
data.setReturned(admins);
} catch (IOException e) {
ioException = e;
data.setIoException(ioException);
}
analyticsWorker.putData(data);
if (ioException != null) {
throw ioException;
}
return admins;
}
|
[
"@",
"Override",
"public",
"ChatMember",
"[",
"]",
"getChatAdministrators",
"(",
"ChatId",
"chat_id",
")",
"throws",
"IOException",
"{",
"AnalyticsData",
"data",
"=",
"new",
"AnalyticsData",
"(",
"\"getChatAdministrators\"",
")",
";",
"IOException",
"ioException",
"=",
"null",
";",
"ChatMember",
"[",
"]",
"admins",
"=",
"null",
";",
"data",
".",
"setValue",
"(",
"\"chat_id\"",
",",
"chat_id",
")",
";",
"try",
"{",
"admins",
"=",
"bot",
".",
"getChatAdministrators",
"(",
"chat_id",
")",
";",
"data",
".",
"setReturned",
"(",
"admins",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"ioException",
"=",
"e",
";",
"data",
".",
"setIoException",
"(",
"ioException",
")",
";",
"}",
"analyticsWorker",
".",
"putData",
"(",
"data",
")",
";",
"if",
"(",
"ioException",
"!=",
"null",
")",
"{",
"throw",
"ioException",
";",
"}",
"return",
"admins",
";",
"}"
] |
Use this method to get a list of administrators in a chat.
@param chat_id Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
@return On success, returns an Array of ChatMember objects that contains information about all chat administrators except other bots.
If the chat is a group or a supergroup and no administrators were appointed, only the creator will be returned.
@throws IOException an exception is thrown in case of any service call failures
|
[
"Use",
"this",
"method",
"to",
"get",
"a",
"list",
"of",
"administrators",
"in",
"a",
"chat",
"."
] |
ba15c43a0722c2b7fd2a8396852bec787cca7b9d
|
https://github.com/shibme/jbotstats/blob/ba15c43a0722c2b7fd2a8396852bec787cca7b9d/src/me/shib/java/lib/jbotstats/AnalyticsBot.java#L673-L691
|
151,323
|
shibme/jbotstats
|
src/me/shib/java/lib/jbotstats/AnalyticsBot.java
|
AnalyticsBot.getChatMembersCount
|
@Override
public int getChatMembersCount(ChatId chat_id) throws IOException {
AnalyticsData data = new AnalyticsData("getChatMembersCount");
IOException ioException = null;
int membersCount = 0;
data.setValue("chat_id", chat_id);
try {
membersCount = bot.getChatMembersCount(chat_id);
data.setReturned(membersCount);
} catch (IOException e) {
ioException = e;
data.setIoException(ioException);
}
analyticsWorker.putData(data);
if (ioException != null) {
throw ioException;
}
return membersCount;
}
|
java
|
@Override
public int getChatMembersCount(ChatId chat_id) throws IOException {
AnalyticsData data = new AnalyticsData("getChatMembersCount");
IOException ioException = null;
int membersCount = 0;
data.setValue("chat_id", chat_id);
try {
membersCount = bot.getChatMembersCount(chat_id);
data.setReturned(membersCount);
} catch (IOException e) {
ioException = e;
data.setIoException(ioException);
}
analyticsWorker.putData(data);
if (ioException != null) {
throw ioException;
}
return membersCount;
}
|
[
"@",
"Override",
"public",
"int",
"getChatMembersCount",
"(",
"ChatId",
"chat_id",
")",
"throws",
"IOException",
"{",
"AnalyticsData",
"data",
"=",
"new",
"AnalyticsData",
"(",
"\"getChatMembersCount\"",
")",
";",
"IOException",
"ioException",
"=",
"null",
";",
"int",
"membersCount",
"=",
"0",
";",
"data",
".",
"setValue",
"(",
"\"chat_id\"",
",",
"chat_id",
")",
";",
"try",
"{",
"membersCount",
"=",
"bot",
".",
"getChatMembersCount",
"(",
"chat_id",
")",
";",
"data",
".",
"setReturned",
"(",
"membersCount",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"ioException",
"=",
"e",
";",
"data",
".",
"setIoException",
"(",
"ioException",
")",
";",
"}",
"analyticsWorker",
".",
"putData",
"(",
"data",
")",
";",
"if",
"(",
"ioException",
"!=",
"null",
")",
"{",
"throw",
"ioException",
";",
"}",
"return",
"membersCount",
";",
"}"
] |
Use this method to get the number of members in a chat.
@param chat_id Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
@return On success, returns the number of members in a chat as an integer
@throws IOException an exception is thrown in case of any service call failures
|
[
"Use",
"this",
"method",
"to",
"get",
"the",
"number",
"of",
"members",
"in",
"a",
"chat",
"."
] |
ba15c43a0722c2b7fd2a8396852bec787cca7b9d
|
https://github.com/shibme/jbotstats/blob/ba15c43a0722c2b7fd2a8396852bec787cca7b9d/src/me/shib/java/lib/jbotstats/AnalyticsBot.java#L700-L718
|
151,324
|
shibme/jbotstats
|
src/me/shib/java/lib/jbotstats/AnalyticsBot.java
|
AnalyticsBot.getChatMember
|
@Override
public ChatMember getChatMember(ChatId chat_id, long user_id) throws IOException {
AnalyticsData data = new AnalyticsData("getChatMember");
IOException ioException = null;
ChatMember chatMember = null;
data.setValue("chat_id", chat_id);
data.setValue("user_id", user_id);
try {
chatMember = bot.getChatMember(chat_id, user_id);
data.setReturned(chatMember);
} catch (IOException e) {
ioException = e;
data.setIoException(ioException);
}
analyticsWorker.putData(data);
if (ioException != null) {
throw ioException;
}
return chatMember;
}
|
java
|
@Override
public ChatMember getChatMember(ChatId chat_id, long user_id) throws IOException {
AnalyticsData data = new AnalyticsData("getChatMember");
IOException ioException = null;
ChatMember chatMember = null;
data.setValue("chat_id", chat_id);
data.setValue("user_id", user_id);
try {
chatMember = bot.getChatMember(chat_id, user_id);
data.setReturned(chatMember);
} catch (IOException e) {
ioException = e;
data.setIoException(ioException);
}
analyticsWorker.putData(data);
if (ioException != null) {
throw ioException;
}
return chatMember;
}
|
[
"@",
"Override",
"public",
"ChatMember",
"getChatMember",
"(",
"ChatId",
"chat_id",
",",
"long",
"user_id",
")",
"throws",
"IOException",
"{",
"AnalyticsData",
"data",
"=",
"new",
"AnalyticsData",
"(",
"\"getChatMember\"",
")",
";",
"IOException",
"ioException",
"=",
"null",
";",
"ChatMember",
"chatMember",
"=",
"null",
";",
"data",
".",
"setValue",
"(",
"\"chat_id\"",
",",
"chat_id",
")",
";",
"data",
".",
"setValue",
"(",
"\"user_id\"",
",",
"user_id",
")",
";",
"try",
"{",
"chatMember",
"=",
"bot",
".",
"getChatMember",
"(",
"chat_id",
",",
"user_id",
")",
";",
"data",
".",
"setReturned",
"(",
"chatMember",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"ioException",
"=",
"e",
";",
"data",
".",
"setIoException",
"(",
"ioException",
")",
";",
"}",
"analyticsWorker",
".",
"putData",
"(",
"data",
")",
";",
"if",
"(",
"ioException",
"!=",
"null",
")",
"{",
"throw",
"ioException",
";",
"}",
"return",
"chatMember",
";",
"}"
] |
Use this method to get information about a member of a chat.
@param chat_id Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
@param user_id Unique identifier of the target user
@return On success, returns a ChatMember object
@throws IOException an exception is thrown in case of any service call failures
|
[
"Use",
"this",
"method",
"to",
"get",
"information",
"about",
"a",
"member",
"of",
"a",
"chat",
"."
] |
ba15c43a0722c2b7fd2a8396852bec787cca7b9d
|
https://github.com/shibme/jbotstats/blob/ba15c43a0722c2b7fd2a8396852bec787cca7b9d/src/me/shib/java/lib/jbotstats/AnalyticsBot.java#L728-L747
|
151,325
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java
|
GZIPChannel.compress
|
public void compress(Stream<Path> paths) throws IOException
{
boolean first = true;
Iterator<Path> it = paths.iterator();
while (it.hasNext())
{
Path p = it.next();
if (Files.isRegularFile(path))
{
setFilename(p.getFileName().toString());
setLastModified(Files.getLastModifiedTime(p));
if (!first)
{
nextOutput();
}
first = false;
OutputStream os = Channels.newOutputStream(this);
Files.copy(p, os);
}
else
{
throw new IOException(p+" is not a regular file");
}
}
close();
}
|
java
|
public void compress(Stream<Path> paths) throws IOException
{
boolean first = true;
Iterator<Path> it = paths.iterator();
while (it.hasNext())
{
Path p = it.next();
if (Files.isRegularFile(path))
{
setFilename(p.getFileName().toString());
setLastModified(Files.getLastModifiedTime(p));
if (!first)
{
nextOutput();
}
first = false;
OutputStream os = Channels.newOutputStream(this);
Files.copy(p, os);
}
else
{
throw new IOException(p+" is not a regular file");
}
}
close();
}
|
[
"public",
"void",
"compress",
"(",
"Stream",
"<",
"Path",
">",
"paths",
")",
"throws",
"IOException",
"{",
"boolean",
"first",
"=",
"true",
";",
"Iterator",
"<",
"Path",
">",
"it",
"=",
"paths",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"it",
".",
"hasNext",
"(",
")",
")",
"{",
"Path",
"p",
"=",
"it",
".",
"next",
"(",
")",
";",
"if",
"(",
"Files",
".",
"isRegularFile",
"(",
"path",
")",
")",
"{",
"setFilename",
"(",
"p",
".",
"getFileName",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"setLastModified",
"(",
"Files",
".",
"getLastModifiedTime",
"(",
"p",
")",
")",
";",
"if",
"(",
"!",
"first",
")",
"{",
"nextOutput",
"(",
")",
";",
"}",
"first",
"=",
"false",
";",
"OutputStream",
"os",
"=",
"Channels",
".",
"newOutputStream",
"(",
"this",
")",
";",
"Files",
".",
"copy",
"(",
"p",
",",
"os",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"IOException",
"(",
"p",
"+",
"\" is not a regular file\"",
")",
";",
"}",
"}",
"close",
"(",
")",
";",
"}"
] |
Add file entries to this GZIPChannel. Channel will be closed after this
call.
@param paths
@throws IOException
|
[
"Add",
"file",
"entries",
"to",
"this",
"GZIPChannel",
".",
"Channel",
"will",
"be",
"closed",
"after",
"this",
"call",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java#L188-L213
|
151,326
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java
|
GZIPChannel.extractAll
|
public void extractAll(Path targetDir, CopyOption... options) throws IOException
{
if (!Files.isDirectory(targetDir))
{
throw new NotDirectoryException(targetDir.toString());
}
ensureReading();
do
{
Path p = targetDir.resolve(filename);
InputStream is = Channels.newInputStream(this);
Files.copy(is, p, options);
Files.setLastModifiedTime(p, lastModified);
} while (nextInput());
}
|
java
|
public void extractAll(Path targetDir, CopyOption... options) throws IOException
{
if (!Files.isDirectory(targetDir))
{
throw new NotDirectoryException(targetDir.toString());
}
ensureReading();
do
{
Path p = targetDir.resolve(filename);
InputStream is = Channels.newInputStream(this);
Files.copy(is, p, options);
Files.setLastModifiedTime(p, lastModified);
} while (nextInput());
}
|
[
"public",
"void",
"extractAll",
"(",
"Path",
"targetDir",
",",
"CopyOption",
"...",
"options",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"Files",
".",
"isDirectory",
"(",
"targetDir",
")",
")",
"{",
"throw",
"new",
"NotDirectoryException",
"(",
"targetDir",
".",
"toString",
"(",
")",
")",
";",
"}",
"ensureReading",
"(",
")",
";",
"do",
"{",
"Path",
"p",
"=",
"targetDir",
".",
"resolve",
"(",
"filename",
")",
";",
"InputStream",
"is",
"=",
"Channels",
".",
"newInputStream",
"(",
"this",
")",
";",
"Files",
".",
"copy",
"(",
"is",
",",
"p",
",",
"options",
")",
";",
"Files",
".",
"setLastModifiedTime",
"(",
"p",
",",
"lastModified",
")",
";",
"}",
"while",
"(",
"nextInput",
"(",
")",
")",
";",
"}"
] |
Extract files from this GZIPChannel to given directory.
@param targetDir
@param options
@throws IOException
|
[
"Extract",
"files",
"from",
"this",
"GZIPChannel",
"to",
"given",
"directory",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java#L220-L234
|
151,327
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java
|
GZIPChannel.position
|
@Override
public long position() throws IOException
{
if (inflater == null && deflater == null)
{
return 0;
}
if (inflater != null)
{
return inflater.getBytesWritten();
}
else
{
return deflater.getBytesRead();
}
}
|
java
|
@Override
public long position() throws IOException
{
if (inflater == null && deflater == null)
{
return 0;
}
if (inflater != null)
{
return inflater.getBytesWritten();
}
else
{
return deflater.getBytesRead();
}
}
|
[
"@",
"Override",
"public",
"long",
"position",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inflater",
"==",
"null",
"&&",
"deflater",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"inflater",
"!=",
"null",
")",
"{",
"return",
"inflater",
".",
"getBytesWritten",
"(",
")",
";",
"}",
"else",
"{",
"return",
"deflater",
".",
"getBytesRead",
"(",
")",
";",
"}",
"}"
] |
return uncompressed position
@return
@throws IOException
|
[
"return",
"uncompressed",
"position"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java#L240-L255
|
151,328
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java
|
GZIPChannel.position
|
@Override
public GZIPChannel position(long newPosition) throws IOException
{
int skip = (int) (newPosition - position());
if (skip < 0)
{
throw new UnsupportedOperationException("backwards position not supported");
}
if (skip > skipBuffer.capacity())
{
throw new UnsupportedOperationException(skip+" skip not supported maxSkipSize="+maxSkipSize);
}
if (skip > 0)
{
if (skipBuffer == null)
{
throw new UnsupportedOperationException("skip not supported maxSkipSize="+maxSkipSize);
}
skipBuffer.clear();
skipBuffer.limit(skip);
if (options.contains(READ))
{
read(skipBuffer);
}
else
{
write(skipBuffer);
}
}
return this;
}
|
java
|
@Override
public GZIPChannel position(long newPosition) throws IOException
{
int skip = (int) (newPosition - position());
if (skip < 0)
{
throw new UnsupportedOperationException("backwards position not supported");
}
if (skip > skipBuffer.capacity())
{
throw new UnsupportedOperationException(skip+" skip not supported maxSkipSize="+maxSkipSize);
}
if (skip > 0)
{
if (skipBuffer == null)
{
throw new UnsupportedOperationException("skip not supported maxSkipSize="+maxSkipSize);
}
skipBuffer.clear();
skipBuffer.limit(skip);
if (options.contains(READ))
{
read(skipBuffer);
}
else
{
write(skipBuffer);
}
}
return this;
}
|
[
"@",
"Override",
"public",
"GZIPChannel",
"position",
"(",
"long",
"newPosition",
")",
"throws",
"IOException",
"{",
"int",
"skip",
"=",
"(",
"int",
")",
"(",
"newPosition",
"-",
"position",
"(",
")",
")",
";",
"if",
"(",
"skip",
"<",
"0",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"backwards position not supported\"",
")",
";",
"}",
"if",
"(",
"skip",
">",
"skipBuffer",
".",
"capacity",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"skip",
"+",
"\" skip not supported maxSkipSize=\"",
"+",
"maxSkipSize",
")",
";",
"}",
"if",
"(",
"skip",
">",
"0",
")",
"{",
"if",
"(",
"skipBuffer",
"==",
"null",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"skip not supported maxSkipSize=\"",
"+",
"maxSkipSize",
")",
";",
"}",
"skipBuffer",
".",
"clear",
"(",
")",
";",
"skipBuffer",
".",
"limit",
"(",
"skip",
")",
";",
"if",
"(",
"options",
".",
"contains",
"(",
"READ",
")",
")",
"{",
"read",
"(",
"skipBuffer",
")",
";",
"}",
"else",
"{",
"write",
"(",
"skipBuffer",
")",
";",
"}",
"}",
"return",
"this",
";",
"}"
] |
Changes uncompressed position. Only forward direction is allowed with
small skips. This method is for alignment purposes mostly.
@param newPosition
@return
@throws IOException
|
[
"Changes",
"uncompressed",
"position",
".",
"Only",
"forward",
"direction",
"is",
"allowed",
"with",
"small",
"skips",
".",
"This",
"method",
"is",
"for",
"alignment",
"purposes",
"mostly",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java#L263-L293
|
151,329
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java
|
GZIPChannel.close
|
@Override
public void close() throws IOException
{
if (!isClosed)
{
flush();
if (closeChannel)
{
channel.close();
}
isClosed = true;
}
}
|
java
|
@Override
public void close() throws IOException
{
if (!isClosed)
{
flush();
if (closeChannel)
{
channel.close();
}
isClosed = true;
}
}
|
[
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"isClosed",
")",
"{",
"flush",
"(",
")",
";",
"if",
"(",
"closeChannel",
")",
"{",
"channel",
".",
"close",
"(",
")",
";",
"}",
"isClosed",
"=",
"true",
";",
"}",
"}"
] |
Closes channel. Underlying channel is closed only if it was opened
by one of the constructors.
@throws IOException
|
[
"Closes",
"channel",
".",
"Underlying",
"channel",
"is",
"closed",
"only",
"if",
"it",
"was",
"opened",
"by",
"one",
"of",
"the",
"constructors",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java#L417-L429
|
151,330
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java
|
GZIPChannel.nextInput
|
public boolean nextInput() throws IOException
{
if (!options.contains(READ) && !inflater.finished())
{
throw new IllegalStateException("should be called after read returns -1");
}
if (!compBuf.hasRemaining())
{
compBuf.clear();
int rc = channel.read(compBuf);
if (rc == -1)
{
return false;
}
compBuf.flip();
}
readHeader();
inflater.reset();
crc32.reset();
return true;
}
|
java
|
public boolean nextInput() throws IOException
{
if (!options.contains(READ) && !inflater.finished())
{
throw new IllegalStateException("should be called after read returns -1");
}
if (!compBuf.hasRemaining())
{
compBuf.clear();
int rc = channel.read(compBuf);
if (rc == -1)
{
return false;
}
compBuf.flip();
}
readHeader();
inflater.reset();
crc32.reset();
return true;
}
|
[
"public",
"boolean",
"nextInput",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"options",
".",
"contains",
"(",
"READ",
")",
"&&",
"!",
"inflater",
".",
"finished",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"should be called after read returns -1\"",
")",
";",
"}",
"if",
"(",
"!",
"compBuf",
".",
"hasRemaining",
"(",
")",
")",
"{",
"compBuf",
".",
"clear",
"(",
")",
";",
"int",
"rc",
"=",
"channel",
".",
"read",
"(",
"compBuf",
")",
";",
"if",
"(",
"rc",
"==",
"-",
"1",
")",
"{",
"return",
"false",
";",
"}",
"compBuf",
".",
"flip",
"(",
")",
";",
"}",
"readHeader",
"(",
")",
";",
"inflater",
".",
"reset",
"(",
")",
";",
"crc32",
".",
"reset",
"(",
")",
";",
"return",
"true",
";",
"}"
] |
After read returns -1 call nextInput to advance to nextInput file.
@return true if nextInput file available.
@throws IOException
|
[
"After",
"read",
"returns",
"-",
"1",
"call",
"nextInput",
"to",
"advance",
"to",
"nextInput",
"file",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java#L635-L655
|
151,331
|
trellis-ldp-archive/trellis-event-serialization
|
src/main/java/org/trellisldp/event/ActivityStreamMessage.java
|
ActivityStreamMessage.from
|
public static ActivityStreamMessage from(final Event event) {
final ActivityStreamMessage msg = new ActivityStreamMessage();
msg.id = event.getIdentifier().getIRIString();
msg.type = event.getTypes().stream().map(IRI::getIRIString)
.map(type -> type.startsWith(AS.URI) ? type.substring(AS.URI.length()) : type)
.collect(toList());
msg.published = event.getCreated().toString();
final List<String> actors = event.getAgents().stream().map(IRI::getIRIString).collect(toList());
msg.actor = actors.isEmpty() ? null : actors;
event.getInbox().map(IRI::getIRIString).ifPresent(inbox -> msg.inbox = inbox);
event.getTarget().map(IRI::getIRIString).ifPresent(target ->
msg.object = new EventResource(target,
event.getTargetTypes().stream().map(IRI::getIRIString).collect(toList())));
return msg;
}
|
java
|
public static ActivityStreamMessage from(final Event event) {
final ActivityStreamMessage msg = new ActivityStreamMessage();
msg.id = event.getIdentifier().getIRIString();
msg.type = event.getTypes().stream().map(IRI::getIRIString)
.map(type -> type.startsWith(AS.URI) ? type.substring(AS.URI.length()) : type)
.collect(toList());
msg.published = event.getCreated().toString();
final List<String> actors = event.getAgents().stream().map(IRI::getIRIString).collect(toList());
msg.actor = actors.isEmpty() ? null : actors;
event.getInbox().map(IRI::getIRIString).ifPresent(inbox -> msg.inbox = inbox);
event.getTarget().map(IRI::getIRIString).ifPresent(target ->
msg.object = new EventResource(target,
event.getTargetTypes().stream().map(IRI::getIRIString).collect(toList())));
return msg;
}
|
[
"public",
"static",
"ActivityStreamMessage",
"from",
"(",
"final",
"Event",
"event",
")",
"{",
"final",
"ActivityStreamMessage",
"msg",
"=",
"new",
"ActivityStreamMessage",
"(",
")",
";",
"msg",
".",
"id",
"=",
"event",
".",
"getIdentifier",
"(",
")",
".",
"getIRIString",
"(",
")",
";",
"msg",
".",
"type",
"=",
"event",
".",
"getTypes",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"IRI",
"::",
"getIRIString",
")",
".",
"map",
"(",
"type",
"->",
"type",
".",
"startsWith",
"(",
"AS",
".",
"URI",
")",
"?",
"type",
".",
"substring",
"(",
"AS",
".",
"URI",
".",
"length",
"(",
")",
")",
":",
"type",
")",
".",
"collect",
"(",
"toList",
"(",
")",
")",
";",
"msg",
".",
"published",
"=",
"event",
".",
"getCreated",
"(",
")",
".",
"toString",
"(",
")",
";",
"final",
"List",
"<",
"String",
">",
"actors",
"=",
"event",
".",
"getAgents",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"IRI",
"::",
"getIRIString",
")",
".",
"collect",
"(",
"toList",
"(",
")",
")",
";",
"msg",
".",
"actor",
"=",
"actors",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"actors",
";",
"event",
".",
"getInbox",
"(",
")",
".",
"map",
"(",
"IRI",
"::",
"getIRIString",
")",
".",
"ifPresent",
"(",
"inbox",
"->",
"msg",
".",
"inbox",
"=",
"inbox",
")",
";",
"event",
".",
"getTarget",
"(",
")",
".",
"map",
"(",
"IRI",
"::",
"getIRIString",
")",
".",
"ifPresent",
"(",
"target",
"->",
"msg",
".",
"object",
"=",
"new",
"EventResource",
"(",
"target",
",",
"event",
".",
"getTargetTypes",
"(",
")",
".",
"stream",
"(",
")",
".",
"map",
"(",
"IRI",
"::",
"getIRIString",
")",
".",
"collect",
"(",
"toList",
"(",
")",
")",
")",
")",
";",
"return",
"msg",
";",
"}"
] |
Populate a ActivityStreamMessage from an Event
@param event The event
@return an ActivityStreamMessage
|
[
"Populate",
"a",
"ActivityStreamMessage",
"from",
"an",
"Event"
] |
d41c04ea787d4e5f108bba420bef1bfb4952be34
|
https://github.com/trellis-ldp-archive/trellis-event-serialization/blob/d41c04ea787d4e5f108bba420bef1bfb4952be34/src/main/java/org/trellisldp/event/ActivityStreamMessage.java#L138-L158
|
151,332
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/util/BinarySet.java
|
BinarySet.get
|
E get(E key)
{
int idx = indexOf(key);
if (idx >= 0)
{
return list.get(idx);
}
return null;
}
|
java
|
E get(E key)
{
int idx = indexOf(key);
if (idx >= 0)
{
return list.get(idx);
}
return null;
}
|
[
"E",
"get",
"(",
"E",
"key",
")",
"{",
"int",
"idx",
"=",
"indexOf",
"(",
"key",
")",
";",
"if",
"(",
"idx",
">=",
"0",
")",
"{",
"return",
"list",
".",
"get",
"(",
"idx",
")",
";",
"}",
"return",
"null",
";",
"}"
] |
Returns item if it is found in binary-search
@param key
@param predicate
@return
|
[
"Returns",
"item",
"if",
"it",
"is",
"found",
"in",
"binary",
"-",
"search"
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/BinarySet.java#L88-L96
|
151,333
|
Tikinou/schedules-direct-core-api
|
src/main/java/com/tikinou/schedulesdirect/core/jackson/converters/HeadendResultConverter.java
|
HeadendResultConverter.convert
|
@Override
public GetHeadendsResult convert(Map<String, Headend> value) {
GetHeadendsResult r = new GetHeadendsResult();
r.setHeadends(value);
return r;
}
|
java
|
@Override
public GetHeadendsResult convert(Map<String, Headend> value) {
GetHeadendsResult r = new GetHeadendsResult();
r.setHeadends(value);
return r;
}
|
[
"@",
"Override",
"public",
"GetHeadendsResult",
"convert",
"(",
"Map",
"<",
"String",
",",
"Headend",
">",
"value",
")",
"{",
"GetHeadendsResult",
"r",
"=",
"new",
"GetHeadendsResult",
"(",
")",
";",
"r",
".",
"setHeadends",
"(",
"value",
")",
";",
"return",
"r",
";",
"}"
] |
Main conversion method.
@param value
|
[
"Main",
"conversion",
"method",
"."
] |
068d25b48f18af48ec74443fc32300b4b725ca36
|
https://github.com/Tikinou/schedules-direct-core-api/blob/068d25b48f18af48ec74443fc32300b4b725ca36/src/main/java/com/tikinou/schedulesdirect/core/jackson/converters/HeadendResultConverter.java#L37-L42
|
151,334
|
krotscheck/jersey2-toolkit
|
jersey2-configuration/src/main/java/net/krotscheck/jersey2/configuration/Jersey2ToolkitConfig.java
|
Jersey2ToolkitConfig.buildVersionConfig
|
private Configuration buildVersionConfig() {
// Inject the library version
String jersey2ToolkitVersion = Jersey2ToolkitConfig.class
.getPackage().getImplementationVersion();
HashMap<String, Object> versionConfigMap = new HashMap<>();
versionConfigMap.put("jersey2-toolkit.version", jersey2ToolkitVersion);
return new MapConfiguration(versionConfigMap);
}
|
java
|
private Configuration buildVersionConfig() {
// Inject the library version
String jersey2ToolkitVersion = Jersey2ToolkitConfig.class
.getPackage().getImplementationVersion();
HashMap<String, Object> versionConfigMap = new HashMap<>();
versionConfigMap.put("jersey2-toolkit.version", jersey2ToolkitVersion);
return new MapConfiguration(versionConfigMap);
}
|
[
"private",
"Configuration",
"buildVersionConfig",
"(",
")",
"{",
"// Inject the library version",
"String",
"jersey2ToolkitVersion",
"=",
"Jersey2ToolkitConfig",
".",
"class",
".",
"getPackage",
"(",
")",
".",
"getImplementationVersion",
"(",
")",
";",
"HashMap",
"<",
"String",
",",
"Object",
">",
"versionConfigMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"versionConfigMap",
".",
"put",
"(",
"\"jersey2-toolkit.version\"",
",",
"jersey2ToolkitVersion",
")",
";",
"return",
"new",
"MapConfiguration",
"(",
"versionConfigMap",
")",
";",
"}"
] |
Creates a configuration object that contains the current version of the
jersey2-toolkit library in use.
@return A configuration instance with jersey2-toolkit.version set.
|
[
"Creates",
"a",
"configuration",
"object",
"that",
"contains",
"the",
"current",
"version",
"of",
"the",
"jersey2",
"-",
"toolkit",
"library",
"in",
"use",
"."
] |
11d757bd222dc82ada462caf6730ba4ff85dae04
|
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-configuration/src/main/java/net/krotscheck/jersey2/configuration/Jersey2ToolkitConfig.java#L64-L74
|
151,335
|
krotscheck/jersey2-toolkit
|
jersey2-configuration/src/main/java/net/krotscheck/jersey2/configuration/Jersey2ToolkitConfig.java
|
Jersey2ToolkitConfig.buildToolkitConfig
|
private Configuration buildToolkitConfig() {
// The toolkit configuration file.
try {
File configFile = ResourceUtil
.getFileForResource("jersey2-toolkit.properties");
return new PropertiesConfiguration(configFile);
} catch (ConfigurationException ce) {
logger.error("jersey2-toolkit.properties not readable,"
+ " some features may be misconfigured.");
// Return a new, empty map configuration so we don't error out.
return new MapConfiguration(new HashMap<String, String>());
}
}
|
java
|
private Configuration buildToolkitConfig() {
// The toolkit configuration file.
try {
File configFile = ResourceUtil
.getFileForResource("jersey2-toolkit.properties");
return new PropertiesConfiguration(configFile);
} catch (ConfigurationException ce) {
logger.error("jersey2-toolkit.properties not readable,"
+ " some features may be misconfigured.");
// Return a new, empty map configuration so we don't error out.
return new MapConfiguration(new HashMap<String, String>());
}
}
|
[
"private",
"Configuration",
"buildToolkitConfig",
"(",
")",
"{",
"// The toolkit configuration file.",
"try",
"{",
"File",
"configFile",
"=",
"ResourceUtil",
".",
"getFileForResource",
"(",
"\"jersey2-toolkit.properties\"",
")",
";",
"return",
"new",
"PropertiesConfiguration",
"(",
"configFile",
")",
";",
"}",
"catch",
"(",
"ConfigurationException",
"ce",
")",
"{",
"logger",
".",
"error",
"(",
"\"jersey2-toolkit.properties not readable,\"",
"+",
"\" some features may be misconfigured.\"",
")",
";",
"// Return a new, empty map configuration so we don't error out.",
"return",
"new",
"MapConfiguration",
"(",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
")",
";",
"}",
"}"
] |
Builds the configuration object for our toolkit config.
@return A Configuration object.
|
[
"Builds",
"the",
"configuration",
"object",
"for",
"our",
"toolkit",
"config",
"."
] |
11d757bd222dc82ada462caf6730ba4ff85dae04
|
https://github.com/krotscheck/jersey2-toolkit/blob/11d757bd222dc82ada462caf6730ba4ff85dae04/jersey2-configuration/src/main/java/net/krotscheck/jersey2/configuration/Jersey2ToolkitConfig.java#L81-L95
|
151,336
|
mp911de/visualizr
|
visualizr-metrics/src/main/java/biz/paluch/visualizr/metrics/VisualizrReporter.java
|
VisualizrReporter.reportGauge
|
private void reportGauge(String name, Gauge gauge) {
String prefixedName = prefix(name);
Object value = gauge.getValue();
if (value instanceof Number) {
if (!snapshots.hasDescriptor(prefixedName)) {
snapshots.setDescriptor(prefixedName, MetricItem.Builder.create().count("gauge").build());
}
long timestamp = getTimestamp();
snapshots.addSnapshot(prefixedName, timestamp, (Map) map("gauge", value));
}
}
|
java
|
private void reportGauge(String name, Gauge gauge) {
String prefixedName = prefix(name);
Object value = gauge.getValue();
if (value instanceof Number) {
if (!snapshots.hasDescriptor(prefixedName)) {
snapshots.setDescriptor(prefixedName, MetricItem.Builder.create().count("gauge").build());
}
long timestamp = getTimestamp();
snapshots.addSnapshot(prefixedName, timestamp, (Map) map("gauge", value));
}
}
|
[
"private",
"void",
"reportGauge",
"(",
"String",
"name",
",",
"Gauge",
"gauge",
")",
"{",
"String",
"prefixedName",
"=",
"prefix",
"(",
"name",
")",
";",
"Object",
"value",
"=",
"gauge",
".",
"getValue",
"(",
")",
";",
"if",
"(",
"value",
"instanceof",
"Number",
")",
"{",
"if",
"(",
"!",
"snapshots",
".",
"hasDescriptor",
"(",
"prefixedName",
")",
")",
"{",
"snapshots",
".",
"setDescriptor",
"(",
"prefixedName",
",",
"MetricItem",
".",
"Builder",
".",
"create",
"(",
")",
".",
"count",
"(",
"\"gauge\"",
")",
".",
"build",
"(",
")",
")",
";",
"}",
"long",
"timestamp",
"=",
"getTimestamp",
"(",
")",
";",
"snapshots",
".",
"addSnapshot",
"(",
"prefixedName",
",",
"timestamp",
",",
"(",
"Map",
")",
"map",
"(",
"\"gauge\"",
",",
"value",
")",
")",
";",
"}",
"}"
] |
Report a gauge using the field gauge. Only numeric values are used.
@param name
@param gauge
|
[
"Report",
"a",
"gauge",
"using",
"the",
"field",
"gauge",
".",
"Only",
"numeric",
"values",
"are",
"used",
"."
] |
57206391692e88b2c59d52d4f18faa4cdfd32a98
|
https://github.com/mp911de/visualizr/blob/57206391692e88b2c59d52d4f18faa4cdfd32a98/visualizr-metrics/src/main/java/biz/paluch/visualizr/metrics/VisualizrReporter.java#L231-L244
|
151,337
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/convert/FirstMLastConverter.java
|
FirstMLastConverter.partsToName
|
public static String partsToName(Record record, String iNamePrefix, String iNameFirst, String iNameMiddle, String iNameSur, String iNameSuffix, String iNameTitle)
{
String string = null;
String strFinal = Constants.BLANK;
if (iNamePrefix != null)
{
string = record.getField(iNamePrefix).getString();
if (string.length() != 0)
strFinal += string + ". ";
}
string = record.getField(iNameFirst).getString();
if (string.length() != 0)
strFinal += string + " ";
if (iNameMiddle != null)
{
string = record.getField(iNameMiddle).getString();
if (string.length() != 0)
strFinal += string + " ";
}
string = record.getField(iNameSur).getString();
if (string.length() != 0)
strFinal += string;
if (iNameSuffix != null)
{
string = record.getField(iNameSuffix).getString();
if (string.length() != 0)
strFinal += " " + string;
}
if (iNameTitle != null)
{
string = record.getField(iNameTitle).getString();
if (string.length() != 0)
strFinal += " " + string;
}
return strFinal;
}
|
java
|
public static String partsToName(Record record, String iNamePrefix, String iNameFirst, String iNameMiddle, String iNameSur, String iNameSuffix, String iNameTitle)
{
String string = null;
String strFinal = Constants.BLANK;
if (iNamePrefix != null)
{
string = record.getField(iNamePrefix).getString();
if (string.length() != 0)
strFinal += string + ". ";
}
string = record.getField(iNameFirst).getString();
if (string.length() != 0)
strFinal += string + " ";
if (iNameMiddle != null)
{
string = record.getField(iNameMiddle).getString();
if (string.length() != 0)
strFinal += string + " ";
}
string = record.getField(iNameSur).getString();
if (string.length() != 0)
strFinal += string;
if (iNameSuffix != null)
{
string = record.getField(iNameSuffix).getString();
if (string.length() != 0)
strFinal += " " + string;
}
if (iNameTitle != null)
{
string = record.getField(iNameTitle).getString();
if (string.length() != 0)
strFinal += " " + string;
}
return strFinal;
}
|
[
"public",
"static",
"String",
"partsToName",
"(",
"Record",
"record",
",",
"String",
"iNamePrefix",
",",
"String",
"iNameFirst",
",",
"String",
"iNameMiddle",
",",
"String",
"iNameSur",
",",
"String",
"iNameSuffix",
",",
"String",
"iNameTitle",
")",
"{",
"String",
"string",
"=",
"null",
";",
"String",
"strFinal",
"=",
"Constants",
".",
"BLANK",
";",
"if",
"(",
"iNamePrefix",
"!=",
"null",
")",
"{",
"string",
"=",
"record",
".",
"getField",
"(",
"iNamePrefix",
")",
".",
"getString",
"(",
")",
";",
"if",
"(",
"string",
".",
"length",
"(",
")",
"!=",
"0",
")",
"strFinal",
"+=",
"string",
"+",
"\". \"",
";",
"}",
"string",
"=",
"record",
".",
"getField",
"(",
"iNameFirst",
")",
".",
"getString",
"(",
")",
";",
"if",
"(",
"string",
".",
"length",
"(",
")",
"!=",
"0",
")",
"strFinal",
"+=",
"string",
"+",
"\" \"",
";",
"if",
"(",
"iNameMiddle",
"!=",
"null",
")",
"{",
"string",
"=",
"record",
".",
"getField",
"(",
"iNameMiddle",
")",
".",
"getString",
"(",
")",
";",
"if",
"(",
"string",
".",
"length",
"(",
")",
"!=",
"0",
")",
"strFinal",
"+=",
"string",
"+",
"\" \"",
";",
"}",
"string",
"=",
"record",
".",
"getField",
"(",
"iNameSur",
")",
".",
"getString",
"(",
")",
";",
"if",
"(",
"string",
".",
"length",
"(",
")",
"!=",
"0",
")",
"strFinal",
"+=",
"string",
";",
"if",
"(",
"iNameSuffix",
"!=",
"null",
")",
"{",
"string",
"=",
"record",
".",
"getField",
"(",
"iNameSuffix",
")",
".",
"getString",
"(",
")",
";",
"if",
"(",
"string",
".",
"length",
"(",
")",
"!=",
"0",
")",
"strFinal",
"+=",
"\" \"",
"+",
"string",
";",
"}",
"if",
"(",
"iNameTitle",
"!=",
"null",
")",
"{",
"string",
"=",
"record",
".",
"getField",
"(",
"iNameTitle",
")",
".",
"getString",
"(",
")",
";",
"if",
"(",
"string",
".",
"length",
"(",
")",
"!=",
"0",
")",
"strFinal",
"+=",
"\" \"",
"+",
"string",
";",
"}",
"return",
"strFinal",
";",
"}"
] |
Convert this complete name to the component parts.
@param record Target record.
@param iNamePrefix Field sequence of the prefix field.
@param iNameFirst Field sequence of the First name field.
@param iNameMiddle Field sequence of the middle name field.
@param iNameSur Field sequence of the sur name field.
@param iNameSuffix Field sequence of the suffix field.
@param iNameTitle Field sequence of the title field.
@return Concatinate the fields and return the result.
|
[
"Convert",
"this",
"complete",
"name",
"to",
"the",
"component",
"parts",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/FirstMLastConverter.java#L225-L260
|
151,338
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/convert/FirstMLastConverter.java
|
FirstMLastConverter.setString
|
public int setString(String strSource, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
int iErrorReturn = FirstMLastConverter.nameToParts(strSource, bDisplayOption, iMoveMode, m_recThis, m_iNamePrefix, m_iNameFirst, m_iNameMiddle, m_iNameSur, m_iNameSuffix, m_iNameTitle);
if (iErrorReturn == DBConstants.NORMAL_RETURN)
if (this.getNextConverter() != null)
iErrorReturn = super.setString(strSource, bDisplayOption, iMoveMode);
return iErrorReturn;
}
|
java
|
public int setString(String strSource, boolean bDisplayOption, int iMoveMode) // init this field override for other value
{
int iErrorReturn = FirstMLastConverter.nameToParts(strSource, bDisplayOption, iMoveMode, m_recThis, m_iNamePrefix, m_iNameFirst, m_iNameMiddle, m_iNameSur, m_iNameSuffix, m_iNameTitle);
if (iErrorReturn == DBConstants.NORMAL_RETURN)
if (this.getNextConverter() != null)
iErrorReturn = super.setString(strSource, bDisplayOption, iMoveMode);
return iErrorReturn;
}
|
[
"public",
"int",
"setString",
"(",
"String",
"strSource",
",",
"boolean",
"bDisplayOption",
",",
"int",
"iMoveMode",
")",
"// init this field override for other value",
"{",
"int",
"iErrorReturn",
"=",
"FirstMLastConverter",
".",
"nameToParts",
"(",
"strSource",
",",
"bDisplayOption",
",",
"iMoveMode",
",",
"m_recThis",
",",
"m_iNamePrefix",
",",
"m_iNameFirst",
",",
"m_iNameMiddle",
",",
"m_iNameSur",
",",
"m_iNameSuffix",
",",
"m_iNameTitle",
")",
";",
"if",
"(",
"iErrorReturn",
"==",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"if",
"(",
"this",
".",
"getNextConverter",
"(",
")",
"!=",
"null",
")",
"iErrorReturn",
"=",
"super",
".",
"setString",
"(",
"strSource",
",",
"bDisplayOption",
",",
"iMoveMode",
")",
";",
"return",
"iErrorReturn",
";",
"}"
] |
Convert and move string to this field.
Split the part of this string into the target fields.
Override this method to convert the String to the actual Physical Data Type.
@param bState the state to set the data to.
@param bDisplayOption Display the data on the screen if true.
@param iMoveMode INIT, SCREEN, or READ move mode.
@return The error code (or NORMAL_RETURN).
|
[
"Convert",
"and",
"move",
"string",
"to",
"this",
"field",
".",
"Split",
"the",
"part",
"of",
"this",
"string",
"into",
"the",
"target",
"fields",
".",
"Override",
"this",
"method",
"to",
"convert",
"the",
"String",
"to",
"the",
"actual",
"Physical",
"Data",
"Type",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/FirstMLastConverter.java#L270-L277
|
151,339
|
jbundle/jbundle
|
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MKeyArea.java
|
MKeyArea.atCurrent
|
public boolean atCurrent(BaseBuffer buffer) throws DBException
{
boolean bAtCurrent = false;
try {
if ((m_iIndex >=0) && (m_iIndex < m_VectorObjects.size()))
bAtCurrent = (buffer == m_VectorObjects.elementAt(m_iIndex));
}
catch (ArrayIndexOutOfBoundsException e) {
bAtCurrent = false;
}
return bAtCurrent;
}
|
java
|
public boolean atCurrent(BaseBuffer buffer) throws DBException
{
boolean bAtCurrent = false;
try {
if ((m_iIndex >=0) && (m_iIndex < m_VectorObjects.size()))
bAtCurrent = (buffer == m_VectorObjects.elementAt(m_iIndex));
}
catch (ArrayIndexOutOfBoundsException e) {
bAtCurrent = false;
}
return bAtCurrent;
}
|
[
"public",
"boolean",
"atCurrent",
"(",
"BaseBuffer",
"buffer",
")",
"throws",
"DBException",
"{",
"boolean",
"bAtCurrent",
"=",
"false",
";",
"try",
"{",
"if",
"(",
"(",
"m_iIndex",
">=",
"0",
")",
"&&",
"(",
"m_iIndex",
"<",
"m_VectorObjects",
".",
"size",
"(",
")",
")",
")",
"bAtCurrent",
"=",
"(",
"buffer",
"==",
"m_VectorObjects",
".",
"elementAt",
"(",
"m_iIndex",
")",
")",
";",
"}",
"catch",
"(",
"ArrayIndexOutOfBoundsException",
"e",
")",
"{",
"bAtCurrent",
"=",
"false",
";",
"}",
"return",
"bAtCurrent",
";",
"}"
] |
Am I still pointing at this buffer?
If this buffer is the buffer at the current index, then the current index is correct.
@param buffer The buffer to compare.
@exception DBException File exception.
|
[
"Am",
"I",
"still",
"pointing",
"at",
"this",
"buffer?",
"If",
"this",
"buffer",
"is",
"the",
"buffer",
"at",
"the",
"current",
"index",
"then",
"the",
"current",
"index",
"is",
"correct",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MKeyArea.java#L133-L144
|
151,340
|
jbundle/jbundle
|
thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MKeyArea.java
|
MKeyArea.insertCurrent
|
public void insertCurrent(FieldTable vectorTable, KeyAreaInfo keyArea, BaseBuffer bufferNew, int iRelPosition) throws DBException
{
m_iIndex += iRelPosition;
m_VectorObjects.insertElementAt(bufferNew, m_iIndex);
m_iIndex = -1; // The index can't be used in caches anymore.
}
|
java
|
public void insertCurrent(FieldTable vectorTable, KeyAreaInfo keyArea, BaseBuffer bufferNew, int iRelPosition) throws DBException
{
m_iIndex += iRelPosition;
m_VectorObjects.insertElementAt(bufferNew, m_iIndex);
m_iIndex = -1; // The index can't be used in caches anymore.
}
|
[
"public",
"void",
"insertCurrent",
"(",
"FieldTable",
"vectorTable",
",",
"KeyAreaInfo",
"keyArea",
",",
"BaseBuffer",
"bufferNew",
",",
"int",
"iRelPosition",
")",
"throws",
"DBException",
"{",
"m_iIndex",
"+=",
"iRelPosition",
";",
"m_VectorObjects",
".",
"insertElementAt",
"(",
"bufferNew",
",",
"m_iIndex",
")",
";",
"m_iIndex",
"=",
"-",
"1",
";",
"// The index can't be used in caches anymore.",
"}"
] |
Insert this record at the current location.
@param table The basetable.
@param keyArea The key area.
@param bufferNew The buffer to add.
@param iRelPosition relative position to add the record.
@exception DBException File exception.
|
[
"Insert",
"this",
"record",
"at",
"the",
"current",
"location",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/misc/src/main/java/org/jbundle/thin/base/db/mem/memory/MKeyArea.java#L338-L343
|
151,341
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java
|
WebServiceCommunication.getUri
|
public static String getUri(String uri) throws IOException {
CloseableHttpClient c = newHttpClient(new URL(uri));
HttpGet get = new HttpGet(uri);
LOG.debug("GET {}", uri);
CloseableHttpResponse res = c.execute(get, HttpClientContext.create());
return checkResponse(res);
}
|
java
|
public static String getUri(String uri) throws IOException {
CloseableHttpClient c = newHttpClient(new URL(uri));
HttpGet get = new HttpGet(uri);
LOG.debug("GET {}", uri);
CloseableHttpResponse res = c.execute(get, HttpClientContext.create());
return checkResponse(res);
}
|
[
"public",
"static",
"String",
"getUri",
"(",
"String",
"uri",
")",
"throws",
"IOException",
"{",
"CloseableHttpClient",
"c",
"=",
"newHttpClient",
"(",
"new",
"URL",
"(",
"uri",
")",
")",
";",
"HttpGet",
"get",
"=",
"new",
"HttpGet",
"(",
"uri",
")",
";",
"LOG",
".",
"debug",
"(",
"\"GET {}\"",
",",
"uri",
")",
";",
"CloseableHttpResponse",
"res",
"=",
"c",
".",
"execute",
"(",
"get",
",",
"HttpClientContext",
".",
"create",
"(",
")",
")",
";",
"return",
"checkResponse",
"(",
"res",
")",
";",
"}"
] |
Gets the response body as string of specified uri.
@param uri http/https uri
@return response body
@throws IOException in case of any IO related issue
|
[
"Gets",
"the",
"response",
"body",
"as",
"string",
"of",
"specified",
"uri",
"."
] |
29bc084b09ad35b012eb7c6b5c9ee55337ddee28
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L194-L200
|
151,342
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java
|
WebServiceCommunication.headUri
|
public static Header[] headUri(String uri) throws IOException {
CloseableHttpClient c = newHttpClient(new URL(uri));
HttpHead head = new HttpHead(uri);
LOG.debug("HEAD {}", uri);
CloseableHttpResponse res = c.execute(head, HttpClientContext.create());
checkResponse(res);
return res.getAllHeaders();
}
|
java
|
public static Header[] headUri(String uri) throws IOException {
CloseableHttpClient c = newHttpClient(new URL(uri));
HttpHead head = new HttpHead(uri);
LOG.debug("HEAD {}", uri);
CloseableHttpResponse res = c.execute(head, HttpClientContext.create());
checkResponse(res);
return res.getAllHeaders();
}
|
[
"public",
"static",
"Header",
"[",
"]",
"headUri",
"(",
"String",
"uri",
")",
"throws",
"IOException",
"{",
"CloseableHttpClient",
"c",
"=",
"newHttpClient",
"(",
"new",
"URL",
"(",
"uri",
")",
")",
";",
"HttpHead",
"head",
"=",
"new",
"HttpHead",
"(",
"uri",
")",
";",
"LOG",
".",
"debug",
"(",
"\"HEAD {}\"",
",",
"uri",
")",
";",
"CloseableHttpResponse",
"res",
"=",
"c",
".",
"execute",
"(",
"head",
",",
"HttpClientContext",
".",
"create",
"(",
")",
")",
";",
"checkResponse",
"(",
"res",
")",
";",
"return",
"res",
".",
"getAllHeaders",
"(",
")",
";",
"}"
] |
Gets the response headers of specified uri.
@param uri http/https uri
@return response headers
@throws IOException in case of any IO related issue
|
[
"Gets",
"the",
"response",
"headers",
"of",
"specified",
"uri",
"."
] |
29bc084b09ad35b012eb7c6b5c9ee55337ddee28
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L211-L218
|
151,343
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java
|
WebServiceCommunication.headUri
|
public static String headUri(String uri, String name) throws IOException {
return Stream.of(headUri(uri)).filter(h -> h.getName().equals(name)).findFirst().get().getValue();
}
|
java
|
public static String headUri(String uri, String name) throws IOException {
return Stream.of(headUri(uri)).filter(h -> h.getName().equals(name)).findFirst().get().getValue();
}
|
[
"public",
"static",
"String",
"headUri",
"(",
"String",
"uri",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"return",
"Stream",
".",
"of",
"(",
"headUri",
"(",
"uri",
")",
")",
".",
"filter",
"(",
"h",
"->",
"h",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
".",
"findFirst",
"(",
")",
".",
"get",
"(",
")",
".",
"getValue",
"(",
")",
";",
"}"
] |
Gets the response header value of specified uri.
@param uri http/https uri
@param name header name
@return response header value
@throws IOException in case of any IO related issue
|
[
"Gets",
"the",
"response",
"header",
"value",
"of",
"specified",
"uri",
"."
] |
29bc084b09ad35b012eb7c6b5c9ee55337ddee28
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L230-L232
|
151,344
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java
|
WebServiceCommunication.setClientCertificate
|
public void setClientCertificate(String clientCertificate, String keyPassword) {
LOG.debug("use client certificate/password {}/********", clientCertificate);
this.clientCertificate = clientCertificate;
this.keyPassword = keyPassword;
}
|
java
|
public void setClientCertificate(String clientCertificate, String keyPassword) {
LOG.debug("use client certificate/password {}/********", clientCertificate);
this.clientCertificate = clientCertificate;
this.keyPassword = keyPassword;
}
|
[
"public",
"void",
"setClientCertificate",
"(",
"String",
"clientCertificate",
",",
"String",
"keyPassword",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"use client certificate/password {}/********\"",
",",
"clientCertificate",
")",
";",
"this",
".",
"clientCertificate",
"=",
"clientCertificate",
";",
"this",
".",
"keyPassword",
"=",
"keyPassword",
";",
"}"
] |
Calls this to provide client certificate.
@param clientCertificate client certificate file
@param keyPassword client certificate password
|
[
"Calls",
"this",
"to",
"provide",
"client",
"certificate",
"."
] |
29bc084b09ad35b012eb7c6b5c9ee55337ddee28
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L359-L363
|
151,345
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java
|
WebServiceCommunication.getJsonObject
|
public JSONObject getJsonObject(String endpoint) throws IOException {
String res = this.get(endpoint, null, null);
try {
return new JSONObject(res);
} catch (JSONException ex) {
LOG.warn(res);
throw ex;
}
}
|
java
|
public JSONObject getJsonObject(String endpoint) throws IOException {
String res = this.get(endpoint, null, null);
try {
return new JSONObject(res);
} catch (JSONException ex) {
LOG.warn(res);
throw ex;
}
}
|
[
"public",
"JSONObject",
"getJsonObject",
"(",
"String",
"endpoint",
")",
"throws",
"IOException",
"{",
"String",
"res",
"=",
"this",
".",
"get",
"(",
"endpoint",
",",
"null",
",",
"null",
")",
";",
"try",
"{",
"return",
"new",
"JSONObject",
"(",
"res",
")",
";",
"}",
"catch",
"(",
"JSONException",
"ex",
")",
"{",
"LOG",
".",
"warn",
"(",
"res",
")",
";",
"throw",
"ex",
";",
"}",
"}"
] |
Issues HTTP GET request, converts response body to a JSON object.
@param endpoint endpoint of request url
@return response body to a JSON object
@throws IOException in case of any IO related issue
|
[
"Issues",
"HTTP",
"GET",
"request",
"converts",
"response",
"body",
"to",
"a",
"JSON",
"object",
"."
] |
29bc084b09ad35b012eb7c6b5c9ee55337ddee28
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L548-L556
|
151,346
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java
|
WebServiceCommunication.getJsonArray
|
public JSONArray getJsonArray(String endpoint) throws IOException {
String res = this.get(endpoint, null, null);
try {
return new JSONArray(res);
} catch (JSONException ex) {
LOG.warn(res);
throw ex;
}
}
|
java
|
public JSONArray getJsonArray(String endpoint) throws IOException {
String res = this.get(endpoint, null, null);
try {
return new JSONArray(res);
} catch (JSONException ex) {
LOG.warn(res);
throw ex;
}
}
|
[
"public",
"JSONArray",
"getJsonArray",
"(",
"String",
"endpoint",
")",
"throws",
"IOException",
"{",
"String",
"res",
"=",
"this",
".",
"get",
"(",
"endpoint",
",",
"null",
",",
"null",
")",
";",
"try",
"{",
"return",
"new",
"JSONArray",
"(",
"res",
")",
";",
"}",
"catch",
"(",
"JSONException",
"ex",
")",
"{",
"LOG",
".",
"warn",
"(",
"res",
")",
";",
"throw",
"ex",
";",
"}",
"}"
] |
Issues HTTP GET request, converts response body to a JSON array object.
@param endpoint endpoint of request url
@return response body to a JSON array object
@throws IOException in case of any IO related issue
|
[
"Issues",
"HTTP",
"GET",
"request",
"converts",
"response",
"body",
"to",
"a",
"JSON",
"array",
"object",
"."
] |
29bc084b09ad35b012eb7c6b5c9ee55337ddee28
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L608-L616
|
151,347
|
wanglinsong/thx-webservice
|
src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java
|
WebServiceCommunication.delete
|
public String delete(String endpoint, String params) throws IOException {
return this.delete(endpoint, params, "");
}
|
java
|
public String delete(String endpoint, String params) throws IOException {
return this.delete(endpoint, params, "");
}
|
[
"public",
"String",
"delete",
"(",
"String",
"endpoint",
",",
"String",
"params",
")",
"throws",
"IOException",
"{",
"return",
"this",
".",
"delete",
"(",
"endpoint",
",",
"params",
",",
"\"\"",
")",
";",
"}"
] |
Issues HTTP DELETE request, returns response body as string.
@param endpoint endpoint of request url
@param params request line parameters
@return response body
@throws IOException in case of any IO related issue
|
[
"Issues",
"HTTP",
"DELETE",
"request",
"returns",
"response",
"body",
"as",
"string",
"."
] |
29bc084b09ad35b012eb7c6b5c9ee55337ddee28
|
https://github.com/wanglinsong/thx-webservice/blob/29bc084b09ad35b012eb7c6b5c9ee55337ddee28/src/main/java/com/tascape/qa/th/ws/comm/WebServiceCommunication.java#L735-L737
|
151,348
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/ByteBuffers.java
|
ByteBuffers.clearRemaining
|
public static final void clearRemaining(ByteBuffer bb)
{
if (bb.hasArray())
{
Arrays.fill(bb.array(), bb.arrayOffset()+bb.position(), bb.arrayOffset()+bb.limit(), (byte)0);
}
else
{
int limit = bb.limit();
for (int ii=bb.position();ii<limit;ii++)
{
bb.put(ii, (byte)0);
}
}
}
|
java
|
public static final void clearRemaining(ByteBuffer bb)
{
if (bb.hasArray())
{
Arrays.fill(bb.array(), bb.arrayOffset()+bb.position(), bb.arrayOffset()+bb.limit(), (byte)0);
}
else
{
int limit = bb.limit();
for (int ii=bb.position();ii<limit;ii++)
{
bb.put(ii, (byte)0);
}
}
}
|
[
"public",
"static",
"final",
"void",
"clearRemaining",
"(",
"ByteBuffer",
"bb",
")",
"{",
"if",
"(",
"bb",
".",
"hasArray",
"(",
")",
")",
"{",
"Arrays",
".",
"fill",
"(",
"bb",
".",
"array",
"(",
")",
",",
"bb",
".",
"arrayOffset",
"(",
")",
"+",
"bb",
".",
"position",
"(",
")",
",",
"bb",
".",
"arrayOffset",
"(",
")",
"+",
"bb",
".",
"limit",
"(",
")",
",",
"(",
"byte",
")",
"0",
")",
";",
"}",
"else",
"{",
"int",
"limit",
"=",
"bb",
".",
"limit",
"(",
")",
";",
"for",
"(",
"int",
"ii",
"=",
"bb",
".",
"position",
"(",
")",
";",
"ii",
"<",
"limit",
";",
"ii",
"++",
")",
"{",
"bb",
".",
"put",
"(",
"ii",
",",
"(",
"byte",
")",
"0",
")",
";",
"}",
"}",
"}"
] |
Fills data from position to limit with zeroes. Doesn't change position.
@param bb
|
[
"Fills",
"data",
"from",
"position",
"to",
"limit",
"with",
"zeroes",
".",
"Doesn",
"t",
"change",
"position",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/ByteBuffers.java#L74-L88
|
151,349
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/ByteBuffers.java
|
ByteBuffers.move
|
public static final int move(byte[] buf, int offset, int length, ByteBuffer bb)
{
int count = Math.min(length, bb.remaining());
bb.put(buf, offset, count);
return count;
}
|
java
|
public static final int move(byte[] buf, int offset, int length, ByteBuffer bb)
{
int count = Math.min(length, bb.remaining());
bb.put(buf, offset, count);
return count;
}
|
[
"public",
"static",
"final",
"int",
"move",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"offset",
",",
"int",
"length",
",",
"ByteBuffer",
"bb",
")",
"{",
"int",
"count",
"=",
"Math",
".",
"min",
"(",
"length",
",",
"bb",
".",
"remaining",
"(",
")",
")",
";",
"bb",
".",
"put",
"(",
"buf",
",",
"offset",
",",
"count",
")",
";",
"return",
"count",
";",
"}"
] |
Moves bytes from buf to bb as much as is possible. Positions are moved
according to move.
@param buf
@param offset
@param length
@param bb
@return
|
[
"Moves",
"bytes",
"from",
"buf",
"to",
"bb",
"as",
"much",
"as",
"is",
"possible",
".",
"Positions",
"are",
"moved",
"according",
"to",
"move",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/ByteBuffers.java#L98-L103
|
151,350
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/ByteBuffers.java
|
ByteBuffers.move
|
public static final long move(ByteBuffer b1, ByteBuffer b2)
{
int remaining1 = b1.remaining();
int remaining2 = b2.remaining();
if (remaining1 <= remaining2)
{
b2.put(b1);
return remaining1;
}
else
{
int safeLimit = b1.limit();
b1.limit(b1.position()+remaining2);
b2.put(b1);
b1.limit(safeLimit);
return remaining2;
}
}
|
java
|
public static final long move(ByteBuffer b1, ByteBuffer b2)
{
int remaining1 = b1.remaining();
int remaining2 = b2.remaining();
if (remaining1 <= remaining2)
{
b2.put(b1);
return remaining1;
}
else
{
int safeLimit = b1.limit();
b1.limit(b1.position()+remaining2);
b2.put(b1);
b1.limit(safeLimit);
return remaining2;
}
}
|
[
"public",
"static",
"final",
"long",
"move",
"(",
"ByteBuffer",
"b1",
",",
"ByteBuffer",
"b2",
")",
"{",
"int",
"remaining1",
"=",
"b1",
".",
"remaining",
"(",
")",
";",
"int",
"remaining2",
"=",
"b2",
".",
"remaining",
"(",
")",
";",
"if",
"(",
"remaining1",
"<=",
"remaining2",
")",
"{",
"b2",
".",
"put",
"(",
"b1",
")",
";",
"return",
"remaining1",
";",
"}",
"else",
"{",
"int",
"safeLimit",
"=",
"b1",
".",
"limit",
"(",
")",
";",
"b1",
".",
"limit",
"(",
"b1",
".",
"position",
"(",
")",
"+",
"remaining2",
")",
";",
"b2",
".",
"put",
"(",
"b1",
")",
";",
"b1",
".",
"limit",
"(",
"safeLimit",
")",
";",
"return",
"remaining2",
";",
"}",
"}"
] |
Moves bytes from b1 to b2 as much as is possible. Positions are moved
according to move.
@param b1
@param b2
@return
|
[
"Moves",
"bytes",
"from",
"b1",
"to",
"b2",
"as",
"much",
"as",
"is",
"possible",
".",
"Positions",
"are",
"moved",
"according",
"to",
"move",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/ByteBuffers.java#L126-L143
|
151,351
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/ByteBuffers.java
|
ByteBuffers.move
|
public static final long move(ByteBuffer bb, ByteBuffer[] bbArray, int offset, int length)
{
return move(new ByteBuffer[]{bb}, 0, 1, bbArray, offset, length);
}
|
java
|
public static final long move(ByteBuffer bb, ByteBuffer[] bbArray, int offset, int length)
{
return move(new ByteBuffer[]{bb}, 0, 1, bbArray, offset, length);
}
|
[
"public",
"static",
"final",
"long",
"move",
"(",
"ByteBuffer",
"bb",
",",
"ByteBuffer",
"[",
"]",
"bbArray",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"return",
"move",
"(",
"new",
"ByteBuffer",
"[",
"]",
"{",
"bb",
"}",
",",
"0",
",",
"1",
",",
"bbArray",
",",
"offset",
",",
"length",
")",
";",
"}"
] |
Moves bytes from bb to bbArray as much as is possible. Positions are moved
according to move. Returns number of bytes moved.
@param bb
@param bbArray
@param offset
@param length
@return
|
[
"Moves",
"bytes",
"from",
"bb",
"to",
"bbArray",
"as",
"much",
"as",
"is",
"possible",
".",
"Positions",
"are",
"moved",
"according",
"to",
"move",
".",
"Returns",
"number",
"of",
"bytes",
"moved",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/ByteBuffers.java#L177-L180
|
151,352
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/ByteBuffers.java
|
ByteBuffers.move
|
public static final long move(ByteBuffer[] bbArray1, ByteBuffer[] bbArray2)
{
return move(bbArray1, 0, bbArray2.length, bbArray2, 0, bbArray2.length);
}
|
java
|
public static final long move(ByteBuffer[] bbArray1, ByteBuffer[] bbArray2)
{
return move(bbArray1, 0, bbArray2.length, bbArray2, 0, bbArray2.length);
}
|
[
"public",
"static",
"final",
"long",
"move",
"(",
"ByteBuffer",
"[",
"]",
"bbArray1",
",",
"ByteBuffer",
"[",
"]",
"bbArray2",
")",
"{",
"return",
"move",
"(",
"bbArray1",
",",
"0",
",",
"bbArray2",
".",
"length",
",",
"bbArray2",
",",
"0",
",",
"bbArray2",
".",
"length",
")",
";",
"}"
] |
Moves bytes from bbArray1 to bbArray2 as much as is possible. Positions are moved
according to move. Returns number of bytes moved.
@param bbArray1
@param bbArray2
@return
|
[
"Moves",
"bytes",
"from",
"bbArray1",
"to",
"bbArray2",
"as",
"much",
"as",
"is",
"possible",
".",
"Positions",
"are",
"moved",
"according",
"to",
"move",
".",
"Returns",
"number",
"of",
"bytes",
"moved",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/ByteBuffers.java#L199-L202
|
151,353
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/nio/ByteBuffers.java
|
ByteBuffers.move
|
public static final long move(ByteBuffer[] bbArray1, int offset1, int length1, ByteBuffer[] bbArray2, int offset2, int length2)
{
if (length1 == 0 || length2 == 0)
{
return 0;
}
long res = 0;
ArrayIterator<ByteBuffer> i1 = new ArrayIterator<>(bbArray1, offset1, length1);
ArrayIterator<ByteBuffer> i2 = new ArrayIterator<>(bbArray2, offset2, length2);
ByteBuffer b1 = i1.next();
ByteBuffer b2 = i2.next();
while (true)
{
res += move(b1, b2);
if (!b1.hasRemaining())
{
if (i1.hasNext())
{
b1 = i1.next();
}
else
{
return res;
}
}
if (!b2.hasRemaining())
{
if (i2.hasNext())
{
b2 = i2.next();
}
else
{
return res;
}
}
}
}
|
java
|
public static final long move(ByteBuffer[] bbArray1, int offset1, int length1, ByteBuffer[] bbArray2, int offset2, int length2)
{
if (length1 == 0 || length2 == 0)
{
return 0;
}
long res = 0;
ArrayIterator<ByteBuffer> i1 = new ArrayIterator<>(bbArray1, offset1, length1);
ArrayIterator<ByteBuffer> i2 = new ArrayIterator<>(bbArray2, offset2, length2);
ByteBuffer b1 = i1.next();
ByteBuffer b2 = i2.next();
while (true)
{
res += move(b1, b2);
if (!b1.hasRemaining())
{
if (i1.hasNext())
{
b1 = i1.next();
}
else
{
return res;
}
}
if (!b2.hasRemaining())
{
if (i2.hasNext())
{
b2 = i2.next();
}
else
{
return res;
}
}
}
}
|
[
"public",
"static",
"final",
"long",
"move",
"(",
"ByteBuffer",
"[",
"]",
"bbArray1",
",",
"int",
"offset1",
",",
"int",
"length1",
",",
"ByteBuffer",
"[",
"]",
"bbArray2",
",",
"int",
"offset2",
",",
"int",
"length2",
")",
"{",
"if",
"(",
"length1",
"==",
"0",
"||",
"length2",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"long",
"res",
"=",
"0",
";",
"ArrayIterator",
"<",
"ByteBuffer",
">",
"i1",
"=",
"new",
"ArrayIterator",
"<>",
"(",
"bbArray1",
",",
"offset1",
",",
"length1",
")",
";",
"ArrayIterator",
"<",
"ByteBuffer",
">",
"i2",
"=",
"new",
"ArrayIterator",
"<>",
"(",
"bbArray2",
",",
"offset2",
",",
"length2",
")",
";",
"ByteBuffer",
"b1",
"=",
"i1",
".",
"next",
"(",
")",
";",
"ByteBuffer",
"b2",
"=",
"i2",
".",
"next",
"(",
")",
";",
"while",
"(",
"true",
")",
"{",
"res",
"+=",
"move",
"(",
"b1",
",",
"b2",
")",
";",
"if",
"(",
"!",
"b1",
".",
"hasRemaining",
"(",
")",
")",
"{",
"if",
"(",
"i1",
".",
"hasNext",
"(",
")",
")",
"{",
"b1",
"=",
"i1",
".",
"next",
"(",
")",
";",
"}",
"else",
"{",
"return",
"res",
";",
"}",
"}",
"if",
"(",
"!",
"b2",
".",
"hasRemaining",
"(",
")",
")",
"{",
"if",
"(",
"i2",
".",
"hasNext",
"(",
")",
")",
"{",
"b2",
"=",
"i2",
".",
"next",
"(",
")",
";",
"}",
"else",
"{",
"return",
"res",
";",
"}",
"}",
"}",
"}"
] |
Moves bytes from ba1 to ba2 as much as is possible. Positions are moved
according to move. Returns number of bytes moved.
@param bbArray1
@param offset1
@param length1
@param bbArray2
@param offset2
@param length2
@return
@see java.nio.channels.GatheringByteChannel
@see java.nio.channels.ScatteringByteChannel
|
[
"Moves",
"bytes",
"from",
"ba1",
"to",
"ba2",
"as",
"much",
"as",
"is",
"possible",
".",
"Positions",
"are",
"moved",
"according",
"to",
"move",
".",
"Returns",
"number",
"of",
"bytes",
"moved",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/ByteBuffers.java#L216-L253
|
151,354
|
lightblueseas/vintage-time
|
src/main/java/de/alpharogroup/date/Age.java
|
Age.calculateInYearsMonthsDaysHoursMinutesAndSeconds
|
public int[] calculateInYearsMonthsDaysHoursMinutesAndSeconds(final long compute)
{
long uebrig = -1;
final int[] result = new int[6];
final int years = (int)this.calculateInYears(compute);
if (0 < years)
{
result[0] = years;
uebrig = compute - years * ONE_YEAR;
}
else
{
result[0] = 0;
}
final int months = (int)this.calculateInDefaultMonth(uebrig);
if (0 < months)
{
result[1] = months;
uebrig -= months * ONE_DEFAULT_MONTH;
}
else
{
result[1] = 0;
}
final int days = (int)this.calculateInDays(uebrig);
if (0 < days)
{
result[2] = days;
uebrig -= days * ONE_DAY;
}
else
{
result[2] = 0;
}
final int hours = (int)this.calculateInHours(uebrig);
if (0 < hours)
{
result[3] = hours;
uebrig -= hours * ONE_HOUR;
}
else
{
result[3] = 0;
}
final int minutes = (int)this.calculateInMinutes(uebrig);
if (0 < minutes)
{
result[4] = minutes;
uebrig -= minutes * ONE_MINUTE;
}
else
{
result[4] = 0;
}
final int seconds = (int)this.calculateInSeconds(uebrig);
if (0 < seconds)
{
result[5] = seconds;
}
else
{
result[5] = 0;
}
return result;
}
|
java
|
public int[] calculateInYearsMonthsDaysHoursMinutesAndSeconds(final long compute)
{
long uebrig = -1;
final int[] result = new int[6];
final int years = (int)this.calculateInYears(compute);
if (0 < years)
{
result[0] = years;
uebrig = compute - years * ONE_YEAR;
}
else
{
result[0] = 0;
}
final int months = (int)this.calculateInDefaultMonth(uebrig);
if (0 < months)
{
result[1] = months;
uebrig -= months * ONE_DEFAULT_MONTH;
}
else
{
result[1] = 0;
}
final int days = (int)this.calculateInDays(uebrig);
if (0 < days)
{
result[2] = days;
uebrig -= days * ONE_DAY;
}
else
{
result[2] = 0;
}
final int hours = (int)this.calculateInHours(uebrig);
if (0 < hours)
{
result[3] = hours;
uebrig -= hours * ONE_HOUR;
}
else
{
result[3] = 0;
}
final int minutes = (int)this.calculateInMinutes(uebrig);
if (0 < minutes)
{
result[4] = minutes;
uebrig -= minutes * ONE_MINUTE;
}
else
{
result[4] = 0;
}
final int seconds = (int)this.calculateInSeconds(uebrig);
if (0 < seconds)
{
result[5] = seconds;
}
else
{
result[5] = 0;
}
return result;
}
|
[
"public",
"int",
"[",
"]",
"calculateInYearsMonthsDaysHoursMinutesAndSeconds",
"(",
"final",
"long",
"compute",
")",
"{",
"long",
"uebrig",
"=",
"-",
"1",
";",
"final",
"int",
"[",
"]",
"result",
"=",
"new",
"int",
"[",
"6",
"]",
";",
"final",
"int",
"years",
"=",
"(",
"int",
")",
"this",
".",
"calculateInYears",
"(",
"compute",
")",
";",
"if",
"(",
"0",
"<",
"years",
")",
"{",
"result",
"[",
"0",
"]",
"=",
"years",
";",
"uebrig",
"=",
"compute",
"-",
"years",
"*",
"ONE_YEAR",
";",
"}",
"else",
"{",
"result",
"[",
"0",
"]",
"=",
"0",
";",
"}",
"final",
"int",
"months",
"=",
"(",
"int",
")",
"this",
".",
"calculateInDefaultMonth",
"(",
"uebrig",
")",
";",
"if",
"(",
"0",
"<",
"months",
")",
"{",
"result",
"[",
"1",
"]",
"=",
"months",
";",
"uebrig",
"-=",
"months",
"*",
"ONE_DEFAULT_MONTH",
";",
"}",
"else",
"{",
"result",
"[",
"1",
"]",
"=",
"0",
";",
"}",
"final",
"int",
"days",
"=",
"(",
"int",
")",
"this",
".",
"calculateInDays",
"(",
"uebrig",
")",
";",
"if",
"(",
"0",
"<",
"days",
")",
"{",
"result",
"[",
"2",
"]",
"=",
"days",
";",
"uebrig",
"-=",
"days",
"*",
"ONE_DAY",
";",
"}",
"else",
"{",
"result",
"[",
"2",
"]",
"=",
"0",
";",
"}",
"final",
"int",
"hours",
"=",
"(",
"int",
")",
"this",
".",
"calculateInHours",
"(",
"uebrig",
")",
";",
"if",
"(",
"0",
"<",
"hours",
")",
"{",
"result",
"[",
"3",
"]",
"=",
"hours",
";",
"uebrig",
"-=",
"hours",
"*",
"ONE_HOUR",
";",
"}",
"else",
"{",
"result",
"[",
"3",
"]",
"=",
"0",
";",
"}",
"final",
"int",
"minutes",
"=",
"(",
"int",
")",
"this",
".",
"calculateInMinutes",
"(",
"uebrig",
")",
";",
"if",
"(",
"0",
"<",
"minutes",
")",
"{",
"result",
"[",
"4",
"]",
"=",
"minutes",
";",
"uebrig",
"-=",
"minutes",
"*",
"ONE_MINUTE",
";",
"}",
"else",
"{",
"result",
"[",
"4",
"]",
"=",
"0",
";",
"}",
"final",
"int",
"seconds",
"=",
"(",
"int",
")",
"this",
".",
"calculateInSeconds",
"(",
"uebrig",
")",
";",
"if",
"(",
"0",
"<",
"seconds",
")",
"{",
"result",
"[",
"5",
"]",
"=",
"seconds",
";",
"}",
"else",
"{",
"result",
"[",
"5",
"]",
"=",
"0",
";",
"}",
"return",
"result",
";",
"}"
] |
Calculate in years months days hours minutes and seconds.
@param compute
The long to calculate.
@return the int[] Returns an int array where the first element is the years the second
element the months the third element the days then hours, minutes and seconds.
|
[
"Calculate",
"in",
"years",
"months",
"days",
"hours",
"minutes",
"and",
"seconds",
"."
] |
fbf201e679d9f9b92e7b5771f3eea1413cc2e113
|
https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/Age.java#L333-L402
|
151,355
|
lightblueseas/vintage-time
|
src/main/java/de/alpharogroup/date/Age.java
|
Age.getHumanReadableAge
|
public String getHumanReadableAge(final int[] readableAge)
{
if (null == readableAge || readableAge.length != 6)
{
throw new IllegalArgumentException(
"Int array should not be null and the length should be equal 6.");
}
final StringBuilder result = new StringBuilder();
result.append("Your are ");
result.append(readableAge[0]).append(" years");
result.append(" ");
result.append(readableAge[1]).append(" months");
result.append(" ");
result.append(readableAge[2]).append(" days");
result.append(" ");
result.append(readableAge[3]).append(" hours");
result.append(" ");
result.append(readableAge[4]).append(" minutes");
result.append(" ");
result.append(readableAge[5]).append(" seconds");
result.append(" young!");
return result.toString();
}
|
java
|
public String getHumanReadableAge(final int[] readableAge)
{
if (null == readableAge || readableAge.length != 6)
{
throw new IllegalArgumentException(
"Int array should not be null and the length should be equal 6.");
}
final StringBuilder result = new StringBuilder();
result.append("Your are ");
result.append(readableAge[0]).append(" years");
result.append(" ");
result.append(readableAge[1]).append(" months");
result.append(" ");
result.append(readableAge[2]).append(" days");
result.append(" ");
result.append(readableAge[3]).append(" hours");
result.append(" ");
result.append(readableAge[4]).append(" minutes");
result.append(" ");
result.append(readableAge[5]).append(" seconds");
result.append(" young!");
return result.toString();
}
|
[
"public",
"String",
"getHumanReadableAge",
"(",
"final",
"int",
"[",
"]",
"readableAge",
")",
"{",
"if",
"(",
"null",
"==",
"readableAge",
"||",
"readableAge",
".",
"length",
"!=",
"6",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Int array should not be null and the length should be equal 6.\"",
")",
";",
"}",
"final",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"result",
".",
"append",
"(",
"\"Your are \"",
")",
";",
"result",
".",
"append",
"(",
"readableAge",
"[",
"0",
"]",
")",
".",
"append",
"(",
"\" years\"",
")",
";",
"result",
".",
"append",
"(",
"\" \"",
")",
";",
"result",
".",
"append",
"(",
"readableAge",
"[",
"1",
"]",
")",
".",
"append",
"(",
"\" months\"",
")",
";",
"result",
".",
"append",
"(",
"\" \"",
")",
";",
"result",
".",
"append",
"(",
"readableAge",
"[",
"2",
"]",
")",
".",
"append",
"(",
"\" days\"",
")",
";",
"result",
".",
"append",
"(",
"\" \"",
")",
";",
"result",
".",
"append",
"(",
"readableAge",
"[",
"3",
"]",
")",
".",
"append",
"(",
"\" hours\"",
")",
";",
"result",
".",
"append",
"(",
"\" \"",
")",
";",
"result",
".",
"append",
"(",
"readableAge",
"[",
"4",
"]",
")",
".",
"append",
"(",
"\" minutes\"",
")",
";",
"result",
".",
"append",
"(",
"\" \"",
")",
";",
"result",
".",
"append",
"(",
"readableAge",
"[",
"5",
"]",
")",
".",
"append",
"(",
"\" seconds\"",
")",
";",
"result",
".",
"append",
"(",
"\" young!\"",
")",
";",
"return",
"result",
".",
"toString",
"(",
")",
";",
"}"
] |
Gets a human readable string from the age.
@param readableAge
The int array with the age values.
@return Returns a human readable string from the age.
|
[
"Gets",
"a",
"human",
"readable",
"string",
"from",
"the",
"age",
"."
] |
fbf201e679d9f9b92e7b5771f3eea1413cc2e113
|
https://github.com/lightblueseas/vintage-time/blob/fbf201e679d9f9b92e7b5771f3eea1413cc2e113/src/main/java/de/alpharogroup/date/Age.java#L421-L443
|
151,356
|
FitLayout/classify
|
src/main/java/org/fit/layout/classify/TreeTagger.java
|
TreeTagger.getAllTags
|
public List<Tag> getAllTags()
{
List <Tag> ret = new Vector<Tag>(taggers.size());
for (Tagger tagger : taggers)
ret.add(tagger.getTag());
return ret;
}
|
java
|
public List<Tag> getAllTags()
{
List <Tag> ret = new Vector<Tag>(taggers.size());
for (Tagger tagger : taggers)
ret.add(tagger.getTag());
return ret;
}
|
[
"public",
"List",
"<",
"Tag",
">",
"getAllTags",
"(",
")",
"{",
"List",
"<",
"Tag",
">",
"ret",
"=",
"new",
"Vector",
"<",
"Tag",
">",
"(",
"taggers",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Tagger",
"tagger",
":",
"taggers",
")",
"ret",
".",
"(",
"tagger",
".",
"getTag",
"(",
")",
")",
";",
"return",
"ret",
";",
"}"
] |
Obtains the list of all tags used by the taggers
@return the list of tags
|
[
"Obtains",
"the",
"list",
"of",
"all",
"tags",
"used",
"by",
"the",
"taggers"
] |
0b43ceb2f0be4e6d26263491893884d811f0d605
|
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/TreeTagger.java#L56-L62
|
151,357
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/ui/ScanlineFiller.java
|
ScanlineFiller.floodFill
|
public void floodFill(int xx, int yy, int replacement)
{
floodFill(xx, yy, (c)->c!=replacement, replacement);
}
|
java
|
public void floodFill(int xx, int yy, int replacement)
{
floodFill(xx, yy, (c)->c!=replacement, replacement);
}
|
[
"public",
"void",
"floodFill",
"(",
"int",
"xx",
",",
"int",
"yy",
",",
"int",
"replacement",
")",
"{",
"floodFill",
"(",
"xx",
",",
"yy",
",",
"(",
"c",
")",
"-",
"",
">",
"c",
"!=",
"replacement",
",",
"replacement",
")",
";",
"}"
] |
Fills area starting at xx,yy. Area must be surrounded with replacement
color.
@param xx
@param yy
@param replacement
|
[
"Fills",
"area",
"starting",
"at",
"xx",
"yy",
".",
"Area",
"must",
"be",
"surrounded",
"with",
"replacement",
"color",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/ScanlineFiller.java#L63-L66
|
151,358
|
tvesalainen/util
|
util/src/main/java/org/vesalainen/ui/ScanlineFiller.java
|
ScanlineFiller.floodFill
|
public void floodFill(int xx, int yy, IntPredicate target, int replacement)
{
floodFill(xx, yy, 0, 0, width, height, target, replacement);
}
|
java
|
public void floodFill(int xx, int yy, IntPredicate target, int replacement)
{
floodFill(xx, yy, 0, 0, width, height, target, replacement);
}
|
[
"public",
"void",
"floodFill",
"(",
"int",
"xx",
",",
"int",
"yy",
",",
"IntPredicate",
"target",
",",
"int",
"replacement",
")",
"{",
"floodFill",
"(",
"xx",
",",
"yy",
",",
"0",
",",
"0",
",",
"width",
",",
"height",
",",
"target",
",",
"replacement",
")",
";",
"}"
] |
Fills area starting at xx,yy. Pixels fullfilling target are replaced with
replacement color.
@param xx
@param yy
@param target
@param replacement
|
[
"Fills",
"area",
"starting",
"at",
"xx",
"yy",
".",
"Pixels",
"fullfilling",
"target",
"are",
"replaced",
"with",
"replacement",
"color",
"."
] |
bba7a44689f638ffabc8be40a75bdc9a33676433
|
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/ui/ScanlineFiller.java#L87-L90
|
151,359
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseScreen.java
|
BaseScreen.init
|
public void init(RecordOwnerParent parent, Rec record, Map<String, Object> properties)
{
ScreenLocation itsLocation = null;
Converter fieldConverter = null;
int iDisplayFieldDesc = ScreenConstants.DEFAULT_DISPLAY;
if (properties != null)
{
if (properties.get(ScreenModel.LOCATION) instanceof ScreenLocation)
itsLocation = (ScreenLocation)properties.get(ScreenModel.LOCATION);
else
{
try {
if (properties.get(ScreenModel.LOCATION) instanceof Short)
itsLocation = new ScreenLocation(((Short)properties.get(ScreenModel.DISPLAY)).shortValue(), ScreenConstants.ANCHOR_DEFAULT);
else if (properties.get(ScreenModel.LOCATION) instanceof Integer)
itsLocation = new ScreenLocation(((Integer)properties.get(ScreenModel.DISPLAY)).shortValue(), ScreenConstants.ANCHOR_DEFAULT);
else if (properties.get(ScreenModel.LOCATION) != null)
itsLocation = new ScreenLocation(Short.parseShort(properties.get(ScreenModel.LOCATION).toString()), ScreenConstants.ANCHOR_DEFAULT);
} catch (Exception ex) {
}
}
if (properties.get(ScreenModel.DISPLAY) instanceof Short)
iDisplayFieldDesc = ((Short)properties.get(ScreenModel.DISPLAY)).intValue();
if (properties.get(ScreenModel.DISPLAY) instanceof Integer)
iDisplayFieldDesc = ((Integer)properties.get(ScreenModel.DISPLAY)).intValue();
else
{
try {
if (properties.get(ScreenModel.DISPLAY) != null)
iDisplayFieldDesc = Integer.parseInt(properties.get(ScreenModel.DISPLAY).toString());
} catch (Exception ex) {
}
}
}
properties.remove(ScreenModel.DISPLAY);
properties.remove(ScreenModel.LOCATION);
this.init((Record)record, itsLocation, (BasePanel)parent, fieldConverter, iDisplayFieldDesc, properties);
}
|
java
|
public void init(RecordOwnerParent parent, Rec record, Map<String, Object> properties)
{
ScreenLocation itsLocation = null;
Converter fieldConverter = null;
int iDisplayFieldDesc = ScreenConstants.DEFAULT_DISPLAY;
if (properties != null)
{
if (properties.get(ScreenModel.LOCATION) instanceof ScreenLocation)
itsLocation = (ScreenLocation)properties.get(ScreenModel.LOCATION);
else
{
try {
if (properties.get(ScreenModel.LOCATION) instanceof Short)
itsLocation = new ScreenLocation(((Short)properties.get(ScreenModel.DISPLAY)).shortValue(), ScreenConstants.ANCHOR_DEFAULT);
else if (properties.get(ScreenModel.LOCATION) instanceof Integer)
itsLocation = new ScreenLocation(((Integer)properties.get(ScreenModel.DISPLAY)).shortValue(), ScreenConstants.ANCHOR_DEFAULT);
else if (properties.get(ScreenModel.LOCATION) != null)
itsLocation = new ScreenLocation(Short.parseShort(properties.get(ScreenModel.LOCATION).toString()), ScreenConstants.ANCHOR_DEFAULT);
} catch (Exception ex) {
}
}
if (properties.get(ScreenModel.DISPLAY) instanceof Short)
iDisplayFieldDesc = ((Short)properties.get(ScreenModel.DISPLAY)).intValue();
if (properties.get(ScreenModel.DISPLAY) instanceof Integer)
iDisplayFieldDesc = ((Integer)properties.get(ScreenModel.DISPLAY)).intValue();
else
{
try {
if (properties.get(ScreenModel.DISPLAY) != null)
iDisplayFieldDesc = Integer.parseInt(properties.get(ScreenModel.DISPLAY).toString());
} catch (Exception ex) {
}
}
}
properties.remove(ScreenModel.DISPLAY);
properties.remove(ScreenModel.LOCATION);
this.init((Record)record, itsLocation, (BasePanel)parent, fieldConverter, iDisplayFieldDesc, properties);
}
|
[
"public",
"void",
"init",
"(",
"RecordOwnerParent",
"parent",
",",
"Rec",
"record",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"ScreenLocation",
"itsLocation",
"=",
"null",
";",
"Converter",
"fieldConverter",
"=",
"null",
";",
"int",
"iDisplayFieldDesc",
"=",
"ScreenConstants",
".",
"DEFAULT_DISPLAY",
";",
"if",
"(",
"properties",
"!=",
"null",
")",
"{",
"if",
"(",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"LOCATION",
")",
"instanceof",
"ScreenLocation",
")",
"itsLocation",
"=",
"(",
"ScreenLocation",
")",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"LOCATION",
")",
";",
"else",
"{",
"try",
"{",
"if",
"(",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"LOCATION",
")",
"instanceof",
"Short",
")",
"itsLocation",
"=",
"new",
"ScreenLocation",
"(",
"(",
"(",
"Short",
")",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"DISPLAY",
")",
")",
".",
"shortValue",
"(",
")",
",",
"ScreenConstants",
".",
"ANCHOR_DEFAULT",
")",
";",
"else",
"if",
"(",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"LOCATION",
")",
"instanceof",
"Integer",
")",
"itsLocation",
"=",
"new",
"ScreenLocation",
"(",
"(",
"(",
"Integer",
")",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"DISPLAY",
")",
")",
".",
"shortValue",
"(",
")",
",",
"ScreenConstants",
".",
"ANCHOR_DEFAULT",
")",
";",
"else",
"if",
"(",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"LOCATION",
")",
"!=",
"null",
")",
"itsLocation",
"=",
"new",
"ScreenLocation",
"(",
"Short",
".",
"parseShort",
"(",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"LOCATION",
")",
".",
"toString",
"(",
")",
")",
",",
"ScreenConstants",
".",
"ANCHOR_DEFAULT",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"}",
"}",
"if",
"(",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"DISPLAY",
")",
"instanceof",
"Short",
")",
"iDisplayFieldDesc",
"=",
"(",
"(",
"Short",
")",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"DISPLAY",
")",
")",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"DISPLAY",
")",
"instanceof",
"Integer",
")",
"iDisplayFieldDesc",
"=",
"(",
"(",
"Integer",
")",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"DISPLAY",
")",
")",
".",
"intValue",
"(",
")",
";",
"else",
"{",
"try",
"{",
"if",
"(",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"DISPLAY",
")",
"!=",
"null",
")",
"iDisplayFieldDesc",
"=",
"Integer",
".",
"parseInt",
"(",
"properties",
".",
"get",
"(",
"ScreenModel",
".",
"DISPLAY",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"}",
"}",
"}",
"properties",
".",
"remove",
"(",
"ScreenModel",
".",
"DISPLAY",
")",
";",
"properties",
".",
"remove",
"(",
"ScreenModel",
".",
"LOCATION",
")",
";",
"this",
".",
"init",
"(",
"(",
"Record",
")",
"record",
",",
"itsLocation",
",",
"(",
"BasePanel",
")",
"parent",
",",
"fieldConverter",
",",
"iDisplayFieldDesc",
",",
"properties",
")",
";",
"}"
] |
This is the new constructor list.
This initializer is required by the RecordOwner interface.
@param record The main record for this screen.
@param parent The parent screen.
@param properties The properties object.
@param location (property) The location of this component within the parent.
@param display (property) Do I display the field desc?
|
[
"This",
"is",
"the",
"new",
"constructor",
"list",
".",
"This",
"initializer",
"is",
"required",
"by",
"the",
"RecordOwner",
"interface",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseScreen.java#L126-L163
|
151,360
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseScreen.java
|
BaseScreen.addListeners
|
public void addListeners()
{ // If there is a header record and there is a bookmark associated with it, make it current!
super.addListeners();
if (this.getMainRecord() != null)
this.getMainRecord().addScreenListeners(this); // Add the basic listeners to this record that belong on screen(s).
if (this.getMainRecord() != null)
if (DBConstants.TRUE.equalsIgnoreCase(this.getMainRecord().getTable().getDatabase().getProperty(DBConstants.READ_ONLY_DB)))
this.setEditing(false); // Don't allow changes to read-only tables
}
|
java
|
public void addListeners()
{ // If there is a header record and there is a bookmark associated with it, make it current!
super.addListeners();
if (this.getMainRecord() != null)
this.getMainRecord().addScreenListeners(this); // Add the basic listeners to this record that belong on screen(s).
if (this.getMainRecord() != null)
if (DBConstants.TRUE.equalsIgnoreCase(this.getMainRecord().getTable().getDatabase().getProperty(DBConstants.READ_ONLY_DB)))
this.setEditing(false); // Don't allow changes to read-only tables
}
|
[
"public",
"void",
"addListeners",
"(",
")",
"{",
"// If there is a header record and there is a bookmark associated with it, make it current!",
"super",
".",
"addListeners",
"(",
")",
";",
"if",
"(",
"this",
".",
"getMainRecord",
"(",
")",
"!=",
"null",
")",
"this",
".",
"getMainRecord",
"(",
")",
".",
"addScreenListeners",
"(",
"this",
")",
";",
"// Add the basic listeners to this record that belong on screen(s).",
"if",
"(",
"this",
".",
"getMainRecord",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"DBConstants",
".",
"TRUE",
".",
"equalsIgnoreCase",
"(",
"this",
".",
"getMainRecord",
"(",
")",
".",
"getTable",
"(",
")",
".",
"getDatabase",
"(",
")",
".",
"getProperty",
"(",
"DBConstants",
".",
"READ_ONLY_DB",
")",
")",
")",
"this",
".",
"setEditing",
"(",
"false",
")",
";",
"// Don't allow changes to read-only tables",
"}"
] |
Override this to add behaviors.
|
[
"Override",
"this",
"to",
"add",
"behaviors",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseScreen.java#L311-L319
|
151,361
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseScreen.java
|
BaseScreen.onLogon
|
public boolean onLogon()
{
Record record = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, this);
this.removeRecord(record);
BasePanel parentScreen = this.getParentScreen();
ScreenLocation itsLocation = this.getScreenLocation();
parentScreen.popHistory(1, false);
parentScreen.pushHistory(this.getScreenURL(), false); // Update the history to my current state.
this.finalizeThisScreen(); // Validate current control, update record, get ready to close screen.
Map<String,Object> properties = null;
this.free();
int docMode = record.commandToDocType(UserInfoModel.LOGIN_SCREEN);
record.makeScreen(itsLocation, parentScreen, docMode, properties);
return true;
}
|
java
|
public boolean onLogon()
{
Record record = Record.makeRecordFromClassName(UserInfoModel.THICK_CLASS, this);
this.removeRecord(record);
BasePanel parentScreen = this.getParentScreen();
ScreenLocation itsLocation = this.getScreenLocation();
parentScreen.popHistory(1, false);
parentScreen.pushHistory(this.getScreenURL(), false); // Update the history to my current state.
this.finalizeThisScreen(); // Validate current control, update record, get ready to close screen.
Map<String,Object> properties = null;
this.free();
int docMode = record.commandToDocType(UserInfoModel.LOGIN_SCREEN);
record.makeScreen(itsLocation, parentScreen, docMode, properties);
return true;
}
|
[
"public",
"boolean",
"onLogon",
"(",
")",
"{",
"Record",
"record",
"=",
"Record",
".",
"makeRecordFromClassName",
"(",
"UserInfoModel",
".",
"THICK_CLASS",
",",
"this",
")",
";",
"this",
".",
"removeRecord",
"(",
"record",
")",
";",
"BasePanel",
"parentScreen",
"=",
"this",
".",
"getParentScreen",
"(",
")",
";",
"ScreenLocation",
"itsLocation",
"=",
"this",
".",
"getScreenLocation",
"(",
")",
";",
"parentScreen",
".",
"popHistory",
"(",
"1",
",",
"false",
")",
";",
"parentScreen",
".",
"pushHistory",
"(",
"this",
".",
"getScreenURL",
"(",
")",
",",
"false",
")",
";",
"// Update the history to my current state.",
"this",
".",
"finalizeThisScreen",
"(",
")",
";",
"// Validate current control, update record, get ready to close screen.",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
"=",
"null",
";",
"this",
".",
"free",
"(",
")",
";",
"int",
"docMode",
"=",
"record",
".",
"commandToDocType",
"(",
"UserInfoModel",
".",
"LOGIN_SCREEN",
")",
";",
"record",
".",
"makeScreen",
"(",
"itsLocation",
",",
"parentScreen",
",",
"docMode",
",",
"properties",
")",
";",
"return",
"true",
";",
"}"
] |
Display the "Logon" screen.
@return true if successful.
|
[
"Display",
"the",
"Logon",
"screen",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseScreen.java#L777-L791
|
151,362
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseScreen.java
|
BaseScreen.makeScreenFromParams
|
public static ScreenParent makeScreenFromParams(Task task, ScreenLoc itsLocation, ComponentParent screenParent, int iDocType, Map<String, Object> properties)
{
iDocType = iDocType & ~(ScreenConstants.DISPLAY_MASK | ScreenConstants.SCREEN_TYPE_MASK); // Don't need the screen types
ScreenParent screen = null;
// First, see if they want to see a screen
String strScreen = task.getProperty(DBParams.SCREEN);
if ((strScreen != null) && (strScreen.length() > 0))
screen = Record.makeNewScreen(strScreen, itsLocation, screenParent, iDocType | ScreenConstants.DEFAULT_DISPLAY, properties, null, true);
// Now, see if they want to open a file and create the default screen
if (screen == null)
{
String strRecord = task.getProperty(DBParams.RECORD);
if (strRecord != null)
{
String strScreenType = task.getProperty(DBParams.COMMAND);
iDocType = iDocType | ScreenConstants.DISPLAY_MODE | ScreenConstants.DEFAULT_DISPLAY;
if ((strScreenType != null) && (strScreenType.length() > 0))
screen = BaseScreen.makeScreenFromRecord(itsLocation, screenParent, strRecord, strScreenType, properties);
else
screen = BaseScreen.makeScreenFromRecord(itsLocation, screenParent, strRecord, iDocType, properties);
}
}
if (screen == null)
{
String strRecord = task.getProperty(ThinMenuConstants.FORM.toLowerCase());
if (strRecord != null)
screen = BaseScreen.makeScreenFromRecord(itsLocation, screenParent, strRecord, iDocType | ScreenConstants.MAINT_MODE | ScreenConstants.DEFAULT_DISPLAY, properties);
}
if (screen == null)
{
String strMenu = task.getProperty(DBParams.MENU);
if (strMenu != null)
{
screen = new MenuScreen(null, null, (BasePanel)screenParent, null, iDocType | ScreenConstants.MAINT_MODE, properties);
}
}
if (screen == null)
{ // If no params were passed in, display the default screen (menu).
screen = new MenuScreen(null, null, (BasePanel)screenParent, null, iDocType | ScreenConstants.MAINT_MODE, properties);
}
return screen;
}
|
java
|
public static ScreenParent makeScreenFromParams(Task task, ScreenLoc itsLocation, ComponentParent screenParent, int iDocType, Map<String, Object> properties)
{
iDocType = iDocType & ~(ScreenConstants.DISPLAY_MASK | ScreenConstants.SCREEN_TYPE_MASK); // Don't need the screen types
ScreenParent screen = null;
// First, see if they want to see a screen
String strScreen = task.getProperty(DBParams.SCREEN);
if ((strScreen != null) && (strScreen.length() > 0))
screen = Record.makeNewScreen(strScreen, itsLocation, screenParent, iDocType | ScreenConstants.DEFAULT_DISPLAY, properties, null, true);
// Now, see if they want to open a file and create the default screen
if (screen == null)
{
String strRecord = task.getProperty(DBParams.RECORD);
if (strRecord != null)
{
String strScreenType = task.getProperty(DBParams.COMMAND);
iDocType = iDocType | ScreenConstants.DISPLAY_MODE | ScreenConstants.DEFAULT_DISPLAY;
if ((strScreenType != null) && (strScreenType.length() > 0))
screen = BaseScreen.makeScreenFromRecord(itsLocation, screenParent, strRecord, strScreenType, properties);
else
screen = BaseScreen.makeScreenFromRecord(itsLocation, screenParent, strRecord, iDocType, properties);
}
}
if (screen == null)
{
String strRecord = task.getProperty(ThinMenuConstants.FORM.toLowerCase());
if (strRecord != null)
screen = BaseScreen.makeScreenFromRecord(itsLocation, screenParent, strRecord, iDocType | ScreenConstants.MAINT_MODE | ScreenConstants.DEFAULT_DISPLAY, properties);
}
if (screen == null)
{
String strMenu = task.getProperty(DBParams.MENU);
if (strMenu != null)
{
screen = new MenuScreen(null, null, (BasePanel)screenParent, null, iDocType | ScreenConstants.MAINT_MODE, properties);
}
}
if (screen == null)
{ // If no params were passed in, display the default screen (menu).
screen = new MenuScreen(null, null, (BasePanel)screenParent, null, iDocType | ScreenConstants.MAINT_MODE, properties);
}
return screen;
}
|
[
"public",
"static",
"ScreenParent",
"makeScreenFromParams",
"(",
"Task",
"task",
",",
"ScreenLoc",
"itsLocation",
",",
"ComponentParent",
"screenParent",
",",
"int",
"iDocType",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"properties",
")",
"{",
"iDocType",
"=",
"iDocType",
"&",
"~",
"(",
"ScreenConstants",
".",
"DISPLAY_MASK",
"|",
"ScreenConstants",
".",
"SCREEN_TYPE_MASK",
")",
";",
"// Don't need the screen types",
"ScreenParent",
"screen",
"=",
"null",
";",
"// First, see if they want to see a screen",
"String",
"strScreen",
"=",
"task",
".",
"getProperty",
"(",
"DBParams",
".",
"SCREEN",
")",
";",
"if",
"(",
"(",
"strScreen",
"!=",
"null",
")",
"&&",
"(",
"strScreen",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"screen",
"=",
"Record",
".",
"makeNewScreen",
"(",
"strScreen",
",",
"itsLocation",
",",
"screenParent",
",",
"iDocType",
"|",
"ScreenConstants",
".",
"DEFAULT_DISPLAY",
",",
"properties",
",",
"null",
",",
"true",
")",
";",
"// Now, see if they want to open a file and create the default screen",
"if",
"(",
"screen",
"==",
"null",
")",
"{",
"String",
"strRecord",
"=",
"task",
".",
"getProperty",
"(",
"DBParams",
".",
"RECORD",
")",
";",
"if",
"(",
"strRecord",
"!=",
"null",
")",
"{",
"String",
"strScreenType",
"=",
"task",
".",
"getProperty",
"(",
"DBParams",
".",
"COMMAND",
")",
";",
"iDocType",
"=",
"iDocType",
"|",
"ScreenConstants",
".",
"DISPLAY_MODE",
"|",
"ScreenConstants",
".",
"DEFAULT_DISPLAY",
";",
"if",
"(",
"(",
"strScreenType",
"!=",
"null",
")",
"&&",
"(",
"strScreenType",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"screen",
"=",
"BaseScreen",
".",
"makeScreenFromRecord",
"(",
"itsLocation",
",",
"screenParent",
",",
"strRecord",
",",
"strScreenType",
",",
"properties",
")",
";",
"else",
"screen",
"=",
"BaseScreen",
".",
"makeScreenFromRecord",
"(",
"itsLocation",
",",
"screenParent",
",",
"strRecord",
",",
"iDocType",
",",
"properties",
")",
";",
"}",
"}",
"if",
"(",
"screen",
"==",
"null",
")",
"{",
"String",
"strRecord",
"=",
"task",
".",
"getProperty",
"(",
"ThinMenuConstants",
".",
"FORM",
".",
"toLowerCase",
"(",
")",
")",
";",
"if",
"(",
"strRecord",
"!=",
"null",
")",
"screen",
"=",
"BaseScreen",
".",
"makeScreenFromRecord",
"(",
"itsLocation",
",",
"screenParent",
",",
"strRecord",
",",
"iDocType",
"|",
"ScreenConstants",
".",
"MAINT_MODE",
"|",
"ScreenConstants",
".",
"DEFAULT_DISPLAY",
",",
"properties",
")",
";",
"}",
"if",
"(",
"screen",
"==",
"null",
")",
"{",
"String",
"strMenu",
"=",
"task",
".",
"getProperty",
"(",
"DBParams",
".",
"MENU",
")",
";",
"if",
"(",
"strMenu",
"!=",
"null",
")",
"{",
"screen",
"=",
"new",
"MenuScreen",
"(",
"null",
",",
"null",
",",
"(",
"BasePanel",
")",
"screenParent",
",",
"null",
",",
"iDocType",
"|",
"ScreenConstants",
".",
"MAINT_MODE",
",",
"properties",
")",
";",
"}",
"}",
"if",
"(",
"screen",
"==",
"null",
")",
"{",
"// If no params were passed in, display the default screen (menu).",
"screen",
"=",
"new",
"MenuScreen",
"(",
"null",
",",
"null",
",",
"(",
"BasePanel",
")",
"screenParent",
",",
"null",
",",
"iDocType",
"|",
"ScreenConstants",
".",
"MAINT_MODE",
",",
"properties",
")",
";",
"}",
"return",
"screen",
";",
"}"
] |
Make a screen window from the current params.
@param task The parent to get the SCREEN, SCREENTYPE, and RECORD params from.
@param itsLocation The location of the new screen.
@param screenParent The parent of the new screen.
@param iDocType The document display params
@return The new screen.
|
[
"Make",
"a",
"screen",
"window",
"from",
"the",
"current",
"params",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/BaseScreen.java#L996-L1037
|
151,363
|
incodehq-legacy/incode-module-commchannel
|
dom/src/main/java/org/incode/module/commchannel/dom/impl/postaladdress/PostalAddress.java
|
PostalAddress.title
|
public String title() {
if(getPlaceId() != null) {
return getFormattedAddress();
} else {
final TitleBuffer buf = new TitleBuffer();
buf.append(getAddressLine1())
.append(",", getAddressLine2())
.append(",", getAddressLine3())
.append(",", getAddressLine4())
.append(",", getPostalCode())
.append(",", getCountry())
;
return StringUtils.abbreviateMiddle(buf.toString(), "...", 30);
}
}
|
java
|
public String title() {
if(getPlaceId() != null) {
return getFormattedAddress();
} else {
final TitleBuffer buf = new TitleBuffer();
buf.append(getAddressLine1())
.append(",", getAddressLine2())
.append(",", getAddressLine3())
.append(",", getAddressLine4())
.append(",", getPostalCode())
.append(",", getCountry())
;
return StringUtils.abbreviateMiddle(buf.toString(), "...", 30);
}
}
|
[
"public",
"String",
"title",
"(",
")",
"{",
"if",
"(",
"getPlaceId",
"(",
")",
"!=",
"null",
")",
"{",
"return",
"getFormattedAddress",
"(",
")",
";",
"}",
"else",
"{",
"final",
"TitleBuffer",
"buf",
"=",
"new",
"TitleBuffer",
"(",
")",
";",
"buf",
".",
"append",
"(",
"getAddressLine1",
"(",
")",
")",
".",
"append",
"(",
"\",\"",
",",
"getAddressLine2",
"(",
")",
")",
".",
"append",
"(",
"\",\"",
",",
"getAddressLine3",
"(",
")",
")",
".",
"append",
"(",
"\",\"",
",",
"getAddressLine4",
"(",
")",
")",
".",
"append",
"(",
"\",\"",
",",
"getPostalCode",
"(",
")",
")",
".",
"append",
"(",
"\",\"",
",",
"getCountry",
"(",
")",
")",
";",
"return",
"StringUtils",
".",
"abbreviateMiddle",
"(",
"buf",
".",
"toString",
"(",
")",
",",
"\"...\"",
",",
"30",
")",
";",
"}",
"}"
] |
region > title
|
[
"region",
">",
"title"
] |
a5a3673b965d795cc84fc881f5a34611cd610433
|
https://github.com/incodehq-legacy/incode-module-commchannel/blob/a5a3673b965d795cc84fc881f5a34611cd610433/dom/src/main/java/org/incode/module/commchannel/dom/impl/postaladdress/PostalAddress.java#L66-L80
|
151,364
|
incodehq-legacy/incode-module-commchannel
|
dom/src/main/java/org/incode/module/commchannel/dom/impl/postaladdress/PostalAddress.java
|
PostalAddress.getLocation
|
@Programmatic
@Override
public Location getLocation() {
final String latLng = getLatLng();
return latLng != null? Location.fromString(latLng.replace(",",";")): null;
}
|
java
|
@Programmatic
@Override
public Location getLocation() {
final String latLng = getLatLng();
return latLng != null? Location.fromString(latLng.replace(",",";")): null;
}
|
[
"@",
"Programmatic",
"@",
"Override",
"public",
"Location",
"getLocation",
"(",
")",
"{",
"final",
"String",
"latLng",
"=",
"getLatLng",
"(",
")",
";",
"return",
"latLng",
"!=",
"null",
"?",
"Location",
".",
"fromString",
"(",
"latLng",
".",
"replace",
"(",
"\",\"",
",",
"\";\"",
")",
")",
":",
"null",
";",
"}"
] |
region > Locatable API
|
[
"region",
">",
"Locatable",
"API"
] |
a5a3673b965d795cc84fc881f5a34611cd610433
|
https://github.com/incodehq-legacy/incode-module-commchannel/blob/a5a3673b965d795cc84fc881f5a34611cd610433/dom/src/main/java/org/incode/module/commchannel/dom/impl/postaladdress/PostalAddress.java#L222-L227
|
151,365
|
NessComputing/components-ness-lifecycle
|
src/main/java/com/nesscomputing/lifecycle/guice/LifecycleAnnotationFinder.java
|
LifecycleAnnotationFinder.lifecycleAvailable
|
void lifecycleAvailable(Lifecycle lifecycle) {
LOG.debug("Lifecycle now available, draining queue");
// First, make sure we will not let any more listeners be added once the lifecycle starts going.
lifecycle.addListener(LifecycleStage.CONFIGURE_STAGE, new LifecycleListener() {
@Override
public void onStage(LifecycleStage lifecycleStage) {
LOG.debug("Lifecycle started, further injections disallowed");
LifecycleAnnotationFinder.this.lifecycle = null; // Now both lifecycle and foundInvocations are null, triggering ISE on further discoveries
}
});
// Now direct further visits to the lifecycle directly
this.lifecycle = lifecycle;
// Now drain out all the previous ones into the lifecycle and remove the list itself
for (LifecycleInvocation invocation : foundInvocations) {
addListener(invocation);
}
foundInvocations = null;
}
|
java
|
void lifecycleAvailable(Lifecycle lifecycle) {
LOG.debug("Lifecycle now available, draining queue");
// First, make sure we will not let any more listeners be added once the lifecycle starts going.
lifecycle.addListener(LifecycleStage.CONFIGURE_STAGE, new LifecycleListener() {
@Override
public void onStage(LifecycleStage lifecycleStage) {
LOG.debug("Lifecycle started, further injections disallowed");
LifecycleAnnotationFinder.this.lifecycle = null; // Now both lifecycle and foundInvocations are null, triggering ISE on further discoveries
}
});
// Now direct further visits to the lifecycle directly
this.lifecycle = lifecycle;
// Now drain out all the previous ones into the lifecycle and remove the list itself
for (LifecycleInvocation invocation : foundInvocations) {
addListener(invocation);
}
foundInvocations = null;
}
|
[
"void",
"lifecycleAvailable",
"(",
"Lifecycle",
"lifecycle",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Lifecycle now available, draining queue\"",
")",
";",
"// First, make sure we will not let any more listeners be added once the lifecycle starts going.",
"lifecycle",
".",
"addListener",
"(",
"LifecycleStage",
".",
"CONFIGURE_STAGE",
",",
"new",
"LifecycleListener",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"onStage",
"(",
"LifecycleStage",
"lifecycleStage",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Lifecycle started, further injections disallowed\"",
")",
";",
"LifecycleAnnotationFinder",
".",
"this",
".",
"lifecycle",
"=",
"null",
";",
"// Now both lifecycle and foundInvocations are null, triggering ISE on further discoveries",
"}",
"}",
")",
";",
"// Now direct further visits to the lifecycle directly",
"this",
".",
"lifecycle",
"=",
"lifecycle",
";",
"// Now drain out all the previous ones into the lifecycle and remove the list itself",
"for",
"(",
"LifecycleInvocation",
"invocation",
":",
"foundInvocations",
")",
"{",
"addListener",
"(",
"invocation",
")",
";",
"}",
"foundInvocations",
"=",
"null",
";",
"}"
] |
Called once Guice has created our Lifecycle, so we can start registering callbacks
|
[
"Called",
"once",
"Guice",
"has",
"created",
"our",
"Lifecycle",
"so",
"we",
"can",
"start",
"registering",
"callbacks"
] |
6c8ae8ec8fdcd16b30383092ce9e70424a6760f1
|
https://github.com/NessComputing/components-ness-lifecycle/blob/6c8ae8ec8fdcd16b30383092ce9e70424a6760f1/src/main/java/com/nesscomputing/lifecycle/guice/LifecycleAnnotationFinder.java#L92-L115
|
151,366
|
thesmartenergy/ontop
|
ontop-maven-plugin/src/main/java/com/github/thesmartenergy/ontop/plugins/VersionedOntology.java
|
VersionedOntology.compareVersions
|
public int compareVersions(VersionedOntology o) throws OntopException {
if (!base.equals(o.base) || !ontologyPath.equals(o.ontologyPath)) {
throw new OntopException("Version comparison must be done with same ontology series.");
}
if (major > o.major) {
return 1;
} else if (major == o.major) {
if (minor > o.minor) {
return 1;
} else if (minor == o.minor) {
return 0;
}
}
return -1;
}
|
java
|
public int compareVersions(VersionedOntology o) throws OntopException {
if (!base.equals(o.base) || !ontologyPath.equals(o.ontologyPath)) {
throw new OntopException("Version comparison must be done with same ontology series.");
}
if (major > o.major) {
return 1;
} else if (major == o.major) {
if (minor > o.minor) {
return 1;
} else if (minor == o.minor) {
return 0;
}
}
return -1;
}
|
[
"public",
"int",
"compareVersions",
"(",
"VersionedOntology",
"o",
")",
"throws",
"OntopException",
"{",
"if",
"(",
"!",
"base",
".",
"equals",
"(",
"o",
".",
"base",
")",
"||",
"!",
"ontologyPath",
".",
"equals",
"(",
"o",
".",
"ontologyPath",
")",
")",
"{",
"throw",
"new",
"OntopException",
"(",
"\"Version comparison must be done with same ontology series.\"",
")",
";",
"}",
"if",
"(",
"major",
">",
"o",
".",
"major",
")",
"{",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"major",
"==",
"o",
".",
"major",
")",
"{",
"if",
"(",
"minor",
">",
"o",
".",
"minor",
")",
"{",
"return",
"1",
";",
"}",
"else",
"if",
"(",
"minor",
"==",
"o",
".",
"minor",
")",
"{",
"return",
"0",
";",
"}",
"}",
"return",
"-",
"1",
";",
"}"
] |
returns -1 if 'this' is lower than o returns 0 if 'this' is equal to o
returns 1 if 'this' is greater than o
@param o
@return
@throws OntopException
|
[
"returns",
"-",
"1",
"if",
"this",
"is",
"lower",
"than",
"o",
"returns",
"0",
"if",
"this",
"is",
"equal",
"to",
"o",
"returns",
"1",
"if",
"this",
"is",
"greater",
"than",
"o"
] |
0003b06ddfa7e075b360bcc3c77eed117aa2f6c5
|
https://github.com/thesmartenergy/ontop/blob/0003b06ddfa7e075b360bcc3c77eed117aa2f6c5/ontop-maven-plugin/src/main/java/com/github/thesmartenergy/ontop/plugins/VersionedOntology.java#L102-L116
|
151,367
|
jbundle/jbundle
|
main/screen/src/main/java/org/jbundle/main/user/screen/UserInfoBaseScreen.java
|
UserInfoBaseScreen.readCurrentUser
|
public boolean readCurrentUser()
{
String strUserName = this.getProperty(DBParams.USER_NAME);
String strUserID = this.getProperty(DBParams.USER_ID);
boolean bUserFound = false;
if ((this.getMainRecord().getEditMode() == DBConstants.EDIT_CURRENT) || (this.getMainRecord().getEditMode() == DBConstants.EDIT_IN_PROGRESS))
{
bUserFound = true;
}
else
{
if ((strUserID != null) && (strUserID.length() > 0))
{
bUserFound = ((UserInfo)this.getMainRecord()).getUserInfo(strUserID, false);
if (bUserFound)
if (this.getMainRecord().getField(UserInfo.READ_ONLY_RECORD).getState() == true)
bUserFound = false; // Can't change anonymous
}
if (!bUserFound)
if ((strUserName != null) && (strUserName.length() > 0))
{
bUserFound = ((UserInfo)this.getMainRecord()).getUserInfo(strUserName, false);
if (bUserFound)
if (this.getMainRecord().getField(UserInfo.READ_ONLY_RECORD).getState() == true)
bUserFound = false; // Can't change anonymous
}
}
if (!bUserFound)
{
try {
this.getMainRecord().addNew();
} catch (DBException e) {
e.printStackTrace();
}
this.getMainRecord().getField(UserInfo.USER_NAME).setString(strUserName);
this.getMainRecord().getField(UserInfo.USER_NAME).setModified(false); // Don't force a write
}
else
{
// TODO What do I do if this user exists?
}
return bUserFound;
}
|
java
|
public boolean readCurrentUser()
{
String strUserName = this.getProperty(DBParams.USER_NAME);
String strUserID = this.getProperty(DBParams.USER_ID);
boolean bUserFound = false;
if ((this.getMainRecord().getEditMode() == DBConstants.EDIT_CURRENT) || (this.getMainRecord().getEditMode() == DBConstants.EDIT_IN_PROGRESS))
{
bUserFound = true;
}
else
{
if ((strUserID != null) && (strUserID.length() > 0))
{
bUserFound = ((UserInfo)this.getMainRecord()).getUserInfo(strUserID, false);
if (bUserFound)
if (this.getMainRecord().getField(UserInfo.READ_ONLY_RECORD).getState() == true)
bUserFound = false; // Can't change anonymous
}
if (!bUserFound)
if ((strUserName != null) && (strUserName.length() > 0))
{
bUserFound = ((UserInfo)this.getMainRecord()).getUserInfo(strUserName, false);
if (bUserFound)
if (this.getMainRecord().getField(UserInfo.READ_ONLY_RECORD).getState() == true)
bUserFound = false; // Can't change anonymous
}
}
if (!bUserFound)
{
try {
this.getMainRecord().addNew();
} catch (DBException e) {
e.printStackTrace();
}
this.getMainRecord().getField(UserInfo.USER_NAME).setString(strUserName);
this.getMainRecord().getField(UserInfo.USER_NAME).setModified(false); // Don't force a write
}
else
{
// TODO What do I do if this user exists?
}
return bUserFound;
}
|
[
"public",
"boolean",
"readCurrentUser",
"(",
")",
"{",
"String",
"strUserName",
"=",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"USER_NAME",
")",
";",
"String",
"strUserID",
"=",
"this",
".",
"getProperty",
"(",
"DBParams",
".",
"USER_ID",
")",
";",
"boolean",
"bUserFound",
"=",
"false",
";",
"if",
"(",
"(",
"this",
".",
"getMainRecord",
"(",
")",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_CURRENT",
")",
"||",
"(",
"this",
".",
"getMainRecord",
"(",
")",
".",
"getEditMode",
"(",
")",
"==",
"DBConstants",
".",
"EDIT_IN_PROGRESS",
")",
")",
"{",
"bUserFound",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"strUserID",
"!=",
"null",
")",
"&&",
"(",
"strUserID",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"{",
"bUserFound",
"=",
"(",
"(",
"UserInfo",
")",
"this",
".",
"getMainRecord",
"(",
")",
")",
".",
"getUserInfo",
"(",
"strUserID",
",",
"false",
")",
";",
"if",
"(",
"bUserFound",
")",
"if",
"(",
"this",
".",
"getMainRecord",
"(",
")",
".",
"getField",
"(",
"UserInfo",
".",
"READ_ONLY_RECORD",
")",
".",
"getState",
"(",
")",
"==",
"true",
")",
"bUserFound",
"=",
"false",
";",
"// Can't change anonymous",
"}",
"if",
"(",
"!",
"bUserFound",
")",
"if",
"(",
"(",
"strUserName",
"!=",
"null",
")",
"&&",
"(",
"strUserName",
".",
"length",
"(",
")",
">",
"0",
")",
")",
"{",
"bUserFound",
"=",
"(",
"(",
"UserInfo",
")",
"this",
".",
"getMainRecord",
"(",
")",
")",
".",
"getUserInfo",
"(",
"strUserName",
",",
"false",
")",
";",
"if",
"(",
"bUserFound",
")",
"if",
"(",
"this",
".",
"getMainRecord",
"(",
")",
".",
"getField",
"(",
"UserInfo",
".",
"READ_ONLY_RECORD",
")",
".",
"getState",
"(",
")",
"==",
"true",
")",
"bUserFound",
"=",
"false",
";",
"// Can't change anonymous",
"}",
"}",
"if",
"(",
"!",
"bUserFound",
")",
"{",
"try",
"{",
"this",
".",
"getMainRecord",
"(",
")",
".",
"addNew",
"(",
")",
";",
"}",
"catch",
"(",
"DBException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"}",
"this",
".",
"getMainRecord",
"(",
")",
".",
"getField",
"(",
"UserInfo",
".",
"USER_NAME",
")",
".",
"setString",
"(",
"strUserName",
")",
";",
"this",
".",
"getMainRecord",
"(",
")",
".",
"getField",
"(",
"UserInfo",
".",
"USER_NAME",
")",
".",
"setModified",
"(",
"false",
")",
";",
"// Don't force a write",
"}",
"else",
"{",
"// TODO What do I do if this user exists?",
"}",
"return",
"bUserFound",
";",
"}"
] |
ReadCurrentUser Method.
|
[
"ReadCurrentUser",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/user/screen/UserInfoBaseScreen.java#L106-L149
|
151,368
|
jbundle/jbundle
|
main/screen/src/main/java/org/jbundle/main/user/screen/UserInfoBaseScreen.java
|
UserInfoBaseScreen.addAutoLoginHandler
|
public void addAutoLoginHandler()
{
this.getMainRecord().addListener(new FileListener(null)
{
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{ // Return an error to stop the change
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
if (iErrorCode == DBConstants.NORMAL_RETURN)
{
Record recUserInfo = this.getOwner();
Task task = recUserInfo.getTask();
String strUserName = recUserInfo.getField(UserInfo.ID).toString();
if ((strUserName == null) || (strUserName.length() == 0))
strUserName = recUserInfo.getLastModified(DBConstants.BOOKMARK_HANDLE).toString();
String strPassword = recUserInfo.getField(UserInfo.PASSWORD).toString();
iErrorCode = task.getApplication().login(task, strUserName, strPassword, task.getProperty(DBParams.DOMAIN)); // Always okay
}
return iErrorCode;
}
});
}
|
java
|
public void addAutoLoginHandler()
{
this.getMainRecord().addListener(new FileListener(null)
{
public int doRecordChange(FieldInfo field, int iChangeType, boolean bDisplayOption)
{ // Return an error to stop the change
int iErrorCode = super.doRecordChange(field, iChangeType, bDisplayOption);
if ((iChangeType == DBConstants.AFTER_ADD_TYPE) || (iChangeType == DBConstants.AFTER_UPDATE_TYPE))
if (iErrorCode == DBConstants.NORMAL_RETURN)
{
Record recUserInfo = this.getOwner();
Task task = recUserInfo.getTask();
String strUserName = recUserInfo.getField(UserInfo.ID).toString();
if ((strUserName == null) || (strUserName.length() == 0))
strUserName = recUserInfo.getLastModified(DBConstants.BOOKMARK_HANDLE).toString();
String strPassword = recUserInfo.getField(UserInfo.PASSWORD).toString();
iErrorCode = task.getApplication().login(task, strUserName, strPassword, task.getProperty(DBParams.DOMAIN)); // Always okay
}
return iErrorCode;
}
});
}
|
[
"public",
"void",
"addAutoLoginHandler",
"(",
")",
"{",
"this",
".",
"getMainRecord",
"(",
")",
".",
"addListener",
"(",
"new",
"FileListener",
"(",
"null",
")",
"{",
"public",
"int",
"doRecordChange",
"(",
"FieldInfo",
"field",
",",
"int",
"iChangeType",
",",
"boolean",
"bDisplayOption",
")",
"{",
"// Return an error to stop the change",
"int",
"iErrorCode",
"=",
"super",
".",
"doRecordChange",
"(",
"field",
",",
"iChangeType",
",",
"bDisplayOption",
")",
";",
"if",
"(",
"(",
"iChangeType",
"==",
"DBConstants",
".",
"AFTER_ADD_TYPE",
")",
"||",
"(",
"iChangeType",
"==",
"DBConstants",
".",
"AFTER_UPDATE_TYPE",
")",
")",
"if",
"(",
"iErrorCode",
"==",
"DBConstants",
".",
"NORMAL_RETURN",
")",
"{",
"Record",
"recUserInfo",
"=",
"this",
".",
"getOwner",
"(",
")",
";",
"Task",
"task",
"=",
"recUserInfo",
".",
"getTask",
"(",
")",
";",
"String",
"strUserName",
"=",
"recUserInfo",
".",
"getField",
"(",
"UserInfo",
".",
"ID",
")",
".",
"toString",
"(",
")",
";",
"if",
"(",
"(",
"strUserName",
"==",
"null",
")",
"||",
"(",
"strUserName",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"strUserName",
"=",
"recUserInfo",
".",
"getLastModified",
"(",
"DBConstants",
".",
"BOOKMARK_HANDLE",
")",
".",
"toString",
"(",
")",
";",
"String",
"strPassword",
"=",
"recUserInfo",
".",
"getField",
"(",
"UserInfo",
".",
"PASSWORD",
")",
".",
"toString",
"(",
")",
";",
"iErrorCode",
"=",
"task",
".",
"getApplication",
"(",
")",
".",
"login",
"(",
"task",
",",
"strUserName",
",",
"strPassword",
",",
"task",
".",
"getProperty",
"(",
"DBParams",
".",
"DOMAIN",
")",
")",
";",
"// Always okay",
"}",
"return",
"iErrorCode",
";",
"}",
"}",
")",
";",
"}"
] |
AddAutoLoginHandler Method.
|
[
"AddAutoLoginHandler",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/screen/src/main/java/org/jbundle/main/user/screen/UserInfoBaseScreen.java#L153-L174
|
151,369
|
sangupta/jerry-web
|
src/main/java/com/sangupta/jerry/web/filters/LeverageBrowserCacheFilter.java
|
LeverageBrowserCacheFilter.addStaticExtension
|
public static boolean addStaticExtension(String extension) {
if(AssertUtils.isEmpty(extension)) {
return false;
}
if(!extension.startsWith(".")) {
extension = "." + extension;
}
extension = extension.toLowerCase();
return STATIC_RESOURCE_EXTENSIONS.add(extension);
}
|
java
|
public static boolean addStaticExtension(String extension) {
if(AssertUtils.isEmpty(extension)) {
return false;
}
if(!extension.startsWith(".")) {
extension = "." + extension;
}
extension = extension.toLowerCase();
return STATIC_RESOURCE_EXTENSIONS.add(extension);
}
|
[
"public",
"static",
"boolean",
"addStaticExtension",
"(",
"String",
"extension",
")",
"{",
"if",
"(",
"AssertUtils",
".",
"isEmpty",
"(",
"extension",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"extension",
".",
"startsWith",
"(",
"\".\"",
")",
")",
"{",
"extension",
"=",
"\".\"",
"+",
"extension",
";",
"}",
"extension",
"=",
"extension",
".",
"toLowerCase",
"(",
")",
";",
"return",
"STATIC_RESOURCE_EXTENSIONS",
".",
"add",
"(",
"extension",
")",
";",
"}"
] |
Add the given extension to the list of static resources.
@param extension
the extension to add
@return <code>true</code> if extension was added, <code>false</code>
otherwise
|
[
"Add",
"the",
"given",
"extension",
"to",
"the",
"list",
"of",
"static",
"resources",
"."
] |
f0d02a5d6e7d1c15292509ce588caf52a4ddb895
|
https://github.com/sangupta/jerry-web/blob/f0d02a5d6e7d1c15292509ce588caf52a4ddb895/src/main/java/com/sangupta/jerry/web/filters/LeverageBrowserCacheFilter.java#L80-L92
|
151,370
|
sangupta/jerry-web
|
src/main/java/com/sangupta/jerry/web/filters/LeverageBrowserCacheFilter.java
|
LeverageBrowserCacheFilter.isStaticResource
|
private boolean isStaticResource(String uri) {
// find extension
int index = uri.lastIndexOf('.');
if(index == -1) {
return false; // no extension found
}
String currentExtension = uri.substring(index);
return STATIC_RESOURCE_EXTENSIONS.contains(currentExtension);
}
|
java
|
private boolean isStaticResource(String uri) {
// find extension
int index = uri.lastIndexOf('.');
if(index == -1) {
return false; // no extension found
}
String currentExtension = uri.substring(index);
return STATIC_RESOURCE_EXTENSIONS.contains(currentExtension);
}
|
[
"private",
"boolean",
"isStaticResource",
"(",
"String",
"uri",
")",
"{",
"// find extension",
"int",
"index",
"=",
"uri",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"return",
"false",
";",
"// no extension found",
"}",
"String",
"currentExtension",
"=",
"uri",
".",
"substring",
"(",
"index",
")",
";",
"return",
"STATIC_RESOURCE_EXTENSIONS",
".",
"contains",
"(",
"currentExtension",
")",
";",
"}"
] |
Method that given a URL checks if the resources is static or not - depending on
the request extension like .css, .js, .png etc.
@param uri
@return
|
[
"Method",
"that",
"given",
"a",
"URL",
"checks",
"if",
"the",
"resources",
"is",
"static",
"or",
"not",
"-",
"depending",
"on",
"the",
"request",
"extension",
"like",
".",
"css",
".",
"js",
".",
"png",
"etc",
"."
] |
f0d02a5d6e7d1c15292509ce588caf52a4ddb895
|
https://github.com/sangupta/jerry-web/blob/f0d02a5d6e7d1c15292509ce588caf52a4ddb895/src/main/java/com/sangupta/jerry/web/filters/LeverageBrowserCacheFilter.java#L157-L167
|
151,371
|
glookast/commons-timecode
|
src/main/java/com/glookast/commons/timecode/TimecodeDuration.java
|
TimecodeDuration.valueOf
|
public static TimecodeDuration valueOf(String timecode) throws IllegalArgumentException
{
TimecodeDuration td = new TimecodeDuration();
return (TimecodeDuration) td.parse(timecode);
}
|
java
|
public static TimecodeDuration valueOf(String timecode) throws IllegalArgumentException
{
TimecodeDuration td = new TimecodeDuration();
return (TimecodeDuration) td.parse(timecode);
}
|
[
"public",
"static",
"TimecodeDuration",
"valueOf",
"(",
"String",
"timecode",
")",
"throws",
"IllegalArgumentException",
"{",
"TimecodeDuration",
"td",
"=",
"new",
"TimecodeDuration",
"(",
")",
";",
"return",
"(",
"TimecodeDuration",
")",
"td",
".",
"parse",
"(",
"timecode",
")",
";",
"}"
] |
Returns a TimecodeDuration instance for given TimecodeDuration storage string. Will return null in case the storage string represents a null TimecodeDuration
@param timecode
@return the TimecodeDuration
@throws IllegalArgumentException
|
[
"Returns",
"a",
"TimecodeDuration",
"instance",
"for",
"given",
"TimecodeDuration",
"storage",
"string",
".",
"Will",
"return",
"null",
"in",
"case",
"the",
"storage",
"string",
"represents",
"a",
"null",
"TimecodeDuration"
] |
ec2f682a51d1cc435d0b42d80de48ff15adb4ee8
|
https://github.com/glookast/commons-timecode/blob/ec2f682a51d1cc435d0b42d80de48ff15adb4ee8/src/main/java/com/glookast/commons/timecode/TimecodeDuration.java#L84-L88
|
151,372
|
exKAZUu/GameAIArena
|
src/main/java/net/exkazuu/gameaiarena/gui/SceneManager.java
|
SceneManager.setWindowForTerminating
|
public SceneManager setWindowForTerminating(Window window) {
this.window = window;
window.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
terminate();
}
@Override
public void windowClosed(WindowEvent e) {
terminate();
}
});
return this;
}
|
java
|
public SceneManager setWindowForTerminating(Window window) {
this.window = window;
window.addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent e) {
terminate();
}
@Override
public void windowClosed(WindowEvent e) {
terminate();
}
});
return this;
}
|
[
"public",
"SceneManager",
"setWindowForTerminating",
"(",
"Window",
"window",
")",
"{",
"this",
".",
"window",
"=",
"window",
";",
"window",
".",
"addWindowListener",
"(",
"new",
"WindowAdapter",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"windowClosing",
"(",
"WindowEvent",
"e",
")",
"{",
"terminate",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"windowClosed",
"(",
"WindowEvent",
"e",
")",
"{",
"terminate",
"(",
")",
";",
"}",
"}",
")",
";",
"return",
"this",
";",
"}"
] |
Sets the specified window. The window will be disposed when terminating this manager. This
manager will also be terminated when closing the window.
@param window the window to be added a window listener
|
[
"Sets",
"the",
"specified",
"window",
".",
"The",
"window",
"will",
"be",
"disposed",
"when",
"terminating",
"this",
"manager",
".",
"This",
"manager",
"will",
"also",
"be",
"terminated",
"when",
"closing",
"the",
"window",
"."
] |
66894c251569fb763174654d6c262c5176dfcf48
|
https://github.com/exKAZUu/GameAIArena/blob/66894c251569fb763174654d6c262c5176dfcf48/src/main/java/net/exkazuu/gameaiarena/gui/SceneManager.java#L118-L132
|
151,373
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellCheckBox.java
|
JCellCheckBox.init
|
public void init(String text)
{
this.setOpaque(true);
this.setHorizontalTextPosition(JToggleButton.LEFT);
this.setAlignmentX(JComponent.CENTER_ALIGNMENT);
}
|
java
|
public void init(String text)
{
this.setOpaque(true);
this.setHorizontalTextPosition(JToggleButton.LEFT);
this.setAlignmentX(JComponent.CENTER_ALIGNMENT);
}
|
[
"public",
"void",
"init",
"(",
"String",
"text",
")",
"{",
"this",
".",
"setOpaque",
"(",
"true",
")",
";",
"this",
".",
"setHorizontalTextPosition",
"(",
"JToggleButton",
".",
"LEFT",
")",
";",
"this",
".",
"setAlignmentX",
"(",
"JComponent",
".",
"CENTER_ALIGNMENT",
")",
";",
"}"
] |
Creates new JCellButton
|
[
"Creates",
"new",
"JCellButton"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellCheckBox.java#L65-L70
|
151,374
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellCheckBox.java
|
JCellCheckBox.getTableCellRendererComponent
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
this.setControlValue(value);
if (isSelected && !hasFocus) {
this.setForeground(table.getSelectionForeground());
this.setBackground(table.getSelectionBackground());
}
else {
this.setForeground(table.getForeground());
this.setBackground(table.getBackground());
}
return this;
}
|
java
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
{
this.setControlValue(value);
if (isSelected && !hasFocus) {
this.setForeground(table.getSelectionForeground());
this.setBackground(table.getSelectionBackground());
}
else {
this.setForeground(table.getForeground());
this.setBackground(table.getBackground());
}
return this;
}
|
[
"public",
"Component",
"getTableCellRendererComponent",
"(",
"JTable",
"table",
",",
"Object",
"value",
",",
"boolean",
"isSelected",
",",
"boolean",
"hasFocus",
",",
"int",
"row",
",",
"int",
"column",
")",
"{",
"this",
".",
"setControlValue",
"(",
"value",
")",
";",
"if",
"(",
"isSelected",
"&&",
"!",
"hasFocus",
")",
"{",
"this",
".",
"setForeground",
"(",
"table",
".",
"getSelectionForeground",
"(",
")",
")",
";",
"this",
".",
"setBackground",
"(",
"table",
".",
"getSelectionBackground",
"(",
")",
")",
";",
"}",
"else",
"{",
"this",
".",
"setForeground",
"(",
"table",
".",
"getForeground",
"(",
")",
")",
";",
"this",
".",
"setBackground",
"(",
"table",
".",
"getBackground",
"(",
")",
")",
";",
"}",
"return",
"this",
";",
"}"
] |
Get the renderer for this location in the table.
From the TableCellRenderer interface.
Sets the value of this control and returns this.
@return this.
|
[
"Get",
"the",
"renderer",
"for",
"this",
"location",
"in",
"the",
"table",
".",
"From",
"the",
"TableCellRenderer",
"interface",
".",
"Sets",
"the",
"value",
"of",
"this",
"control",
"and",
"returns",
"this",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellCheckBox.java#L86-L98
|
151,375
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellCheckBox.java
|
JCellCheckBox.getTableCellEditorComponent
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
{
this.setControlValue(value);
return this;
}
|
java
|
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
{
this.setControlValue(value);
return this;
}
|
[
"public",
"Component",
"getTableCellEditorComponent",
"(",
"JTable",
"table",
",",
"Object",
"value",
",",
"boolean",
"isSelected",
",",
"int",
"row",
",",
"int",
"column",
")",
"{",
"this",
".",
"setControlValue",
"(",
"value",
")",
";",
"return",
"this",
";",
"}"
] |
Get the editor for this location in the table.
From the TableCellEditor interface.
Sets the value of this control and returns this.
@return this.
|
[
"Get",
"the",
"editor",
"for",
"this",
"location",
"in",
"the",
"table",
".",
"From",
"the",
"TableCellEditor",
"interface",
".",
"Sets",
"the",
"value",
"of",
"this",
"control",
"and",
"returns",
"this",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellCheckBox.java#L105-L109
|
151,376
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellCheckBox.java
|
JCellCheckBox.getCellEditorValue
|
public Object getCellEditorValue()
{
boolean bValue = this.isSelected();
if (bValue)
return Boolean.TRUE.toString();
else
return Boolean.FALSE.toString();
}
|
java
|
public Object getCellEditorValue()
{
boolean bValue = this.isSelected();
if (bValue)
return Boolean.TRUE.toString();
else
return Boolean.FALSE.toString();
}
|
[
"public",
"Object",
"getCellEditorValue",
"(",
")",
"{",
"boolean",
"bValue",
"=",
"this",
".",
"isSelected",
"(",
")",
";",
"if",
"(",
"bValue",
")",
"return",
"Boolean",
".",
"TRUE",
".",
"toString",
"(",
")",
";",
"else",
"return",
"Boolean",
".",
"FALSE",
".",
"toString",
"(",
")",
";",
"}"
] |
Get the value.
From the TableCellEditor interface.
@return A TRUE or FASLE string.
|
[
"Get",
"the",
"value",
".",
"From",
"the",
"TableCellEditor",
"interface",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellCheckBox.java#L115-L122
|
151,377
|
jbundle/jbundle
|
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellCheckBox.java
|
JCellCheckBox.setControlValue
|
public void setControlValue(Object value)
{
Boolean boolValue = null;
if (value instanceof String) // Always
if (((String)value).length() > 0)
boolValue = new Boolean((String)value);
if (boolValue == null)
boolValue = Boolean.FALSE;
this.setSelected(boolValue.booleanValue());
}
|
java
|
public void setControlValue(Object value)
{
Boolean boolValue = null;
if (value instanceof String) // Always
if (((String)value).length() > 0)
boolValue = new Boolean((String)value);
if (boolValue == null)
boolValue = Boolean.FALSE;
this.setSelected(boolValue.booleanValue());
}
|
[
"public",
"void",
"setControlValue",
"(",
"Object",
"value",
")",
"{",
"Boolean",
"boolValue",
"=",
"null",
";",
"if",
"(",
"value",
"instanceof",
"String",
")",
"// Always",
"if",
"(",
"(",
"(",
"String",
")",
"value",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"boolValue",
"=",
"new",
"Boolean",
"(",
"(",
"String",
")",
"value",
")",
";",
"if",
"(",
"boolValue",
"==",
"null",
")",
"boolValue",
"=",
"Boolean",
".",
"FALSE",
";",
"this",
".",
"setSelected",
"(",
"boolValue",
".",
"booleanValue",
"(",
")",
")",
";",
"}"
] |
Set the value of this checkbox.
@param value The value to set.
|
[
"Set",
"the",
"value",
"of",
"this",
"checkbox",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/JCellCheckBox.java#L145-L154
|
151,378
|
jbundle/jbundle
|
base/screen/model/src/main/java/org/jbundle/base/screen/model/MenuScreen.java
|
MenuScreen.openMainRecord
|
public Record openMainRecord()
{
Record record = Record.makeRecordFromClassName(MenusModel.THICK_CLASS, this);
record.setOpenMode(DBConstants.OPEN_READ_ONLY); // This will optimize the cache when client is remote.
return record;
}
|
java
|
public Record openMainRecord()
{
Record record = Record.makeRecordFromClassName(MenusModel.THICK_CLASS, this);
record.setOpenMode(DBConstants.OPEN_READ_ONLY); // This will optimize the cache when client is remote.
return record;
}
|
[
"public",
"Record",
"openMainRecord",
"(",
")",
"{",
"Record",
"record",
"=",
"Record",
".",
"makeRecordFromClassName",
"(",
"MenusModel",
".",
"THICK_CLASS",
",",
"this",
")",
";",
"record",
".",
"setOpenMode",
"(",
"DBConstants",
".",
"OPEN_READ_ONLY",
")",
";",
"// This will optimize the cache when client is remote.",
"return",
"record",
";",
"}"
] |
OpenMainFile Method.
@return The new main file.
|
[
"OpenMainFile",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/MenuScreen.java#L329-L334
|
151,379
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java
|
ImportXMLScanListener.fixDatabaseName
|
private String fixDatabaseName(String databaseName, Record record, Map<String,String> oldProperties)
{
if (databaseName.endsWith(BaseDatabase.SHARED_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.SHARED_SUFFIX.length());
else if (databaseName.endsWith(BaseDatabase.USER_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.USER_SUFFIX.length());
String recordDBName = record.getDatabaseName();
if (record instanceof DatabaseInfo)
recordDBName = DatabaseInfo.DATABASE_INFO_FILE;
if (!databaseName.startsWith(recordDBName))
{ // Typically user name
this.getTask().setProperty(DBConstants.DB_USER_PREFIX, databaseName.substring(0, databaseName.indexOf('_')));
databaseName = databaseName.substring(databaseName.indexOf('_') + 1);
}
if (!databaseName.endsWith(recordDBName))
{
String suffix = databaseName.substring(databaseName.lastIndexOf('_') + 1);
if (suffix.length() == 2)
{ // Typically language
this.getTask().setProperty(DBParams.LANGUAGE, suffix);
databaseName = databaseName.substring(0, databaseName.lastIndexOf('_'));
suffix = databaseName.substring(databaseName.lastIndexOf('_') + 1);
}
if (!databaseName.endsWith(recordDBName))
{
databaseName = databaseName.substring(0, databaseName.lastIndexOf('_'));
if ((record.getDatabaseType() & DBConstants.USER_DATA) != 0)
this.getTask().setProperty(record.getDatabaseName() + BaseDatabase.DBUSER_PARAM_SUFFIX, suffix);
else
this.getTask().setProperty(record.getDatabaseName() + BaseDatabase.DBSHARED_PARAM_SUFFIX, suffix);
suffix = databaseName.substring(databaseName.lastIndexOf('_') + 1); //?
}
if (!databaseName.endsWith(recordDBName))
{
this.getTask().setProperty(DBConstants.SYSTEM_NAME, suffix);
databaseName = databaseName.substring(0, databaseName.lastIndexOf('_'));
}
}
return databaseName;
}
|
java
|
private String fixDatabaseName(String databaseName, Record record, Map<String,String> oldProperties)
{
if (databaseName.endsWith(BaseDatabase.SHARED_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.SHARED_SUFFIX.length());
else if (databaseName.endsWith(BaseDatabase.USER_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.USER_SUFFIX.length());
String recordDBName = record.getDatabaseName();
if (record instanceof DatabaseInfo)
recordDBName = DatabaseInfo.DATABASE_INFO_FILE;
if (!databaseName.startsWith(recordDBName))
{ // Typically user name
this.getTask().setProperty(DBConstants.DB_USER_PREFIX, databaseName.substring(0, databaseName.indexOf('_')));
databaseName = databaseName.substring(databaseName.indexOf('_') + 1);
}
if (!databaseName.endsWith(recordDBName))
{
String suffix = databaseName.substring(databaseName.lastIndexOf('_') + 1);
if (suffix.length() == 2)
{ // Typically language
this.getTask().setProperty(DBParams.LANGUAGE, suffix);
databaseName = databaseName.substring(0, databaseName.lastIndexOf('_'));
suffix = databaseName.substring(databaseName.lastIndexOf('_') + 1);
}
if (!databaseName.endsWith(recordDBName))
{
databaseName = databaseName.substring(0, databaseName.lastIndexOf('_'));
if ((record.getDatabaseType() & DBConstants.USER_DATA) != 0)
this.getTask().setProperty(record.getDatabaseName() + BaseDatabase.DBUSER_PARAM_SUFFIX, suffix);
else
this.getTask().setProperty(record.getDatabaseName() + BaseDatabase.DBSHARED_PARAM_SUFFIX, suffix);
suffix = databaseName.substring(databaseName.lastIndexOf('_') + 1); //?
}
if (!databaseName.endsWith(recordDBName))
{
this.getTask().setProperty(DBConstants.SYSTEM_NAME, suffix);
databaseName = databaseName.substring(0, databaseName.lastIndexOf('_'));
}
}
return databaseName;
}
|
[
"private",
"String",
"fixDatabaseName",
"(",
"String",
"databaseName",
",",
"Record",
"record",
",",
"Map",
"<",
"String",
",",
"String",
">",
"oldProperties",
")",
"{",
"if",
"(",
"databaseName",
".",
"endsWith",
"(",
"BaseDatabase",
".",
"SHARED_SUFFIX",
")",
")",
"databaseName",
"=",
"databaseName",
".",
"substring",
"(",
"0",
",",
"databaseName",
".",
"length",
"(",
")",
"-",
"BaseDatabase",
".",
"SHARED_SUFFIX",
".",
"length",
"(",
")",
")",
";",
"else",
"if",
"(",
"databaseName",
".",
"endsWith",
"(",
"BaseDatabase",
".",
"USER_SUFFIX",
")",
")",
"databaseName",
"=",
"databaseName",
".",
"substring",
"(",
"0",
",",
"databaseName",
".",
"length",
"(",
")",
"-",
"BaseDatabase",
".",
"USER_SUFFIX",
".",
"length",
"(",
")",
")",
";",
"String",
"recordDBName",
"=",
"record",
".",
"getDatabaseName",
"(",
")",
";",
"if",
"(",
"record",
"instanceof",
"DatabaseInfo",
")",
"recordDBName",
"=",
"DatabaseInfo",
".",
"DATABASE_INFO_FILE",
";",
"if",
"(",
"!",
"databaseName",
".",
"startsWith",
"(",
"recordDBName",
")",
")",
"{",
"// Typically user name",
"this",
".",
"getTask",
"(",
")",
".",
"setProperty",
"(",
"DBConstants",
".",
"DB_USER_PREFIX",
",",
"databaseName",
".",
"substring",
"(",
"0",
",",
"databaseName",
".",
"indexOf",
"(",
"'",
"'",
")",
")",
")",
";",
"databaseName",
"=",
"databaseName",
".",
"substring",
"(",
"databaseName",
".",
"indexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"}",
"if",
"(",
"!",
"databaseName",
".",
"endsWith",
"(",
"recordDBName",
")",
")",
"{",
"String",
"suffix",
"=",
"databaseName",
".",
"substring",
"(",
"databaseName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"if",
"(",
"suffix",
".",
"length",
"(",
")",
"==",
"2",
")",
"{",
"// Typically language",
"this",
".",
"getTask",
"(",
")",
".",
"setProperty",
"(",
"DBParams",
".",
"LANGUAGE",
",",
"suffix",
")",
";",
"databaseName",
"=",
"databaseName",
".",
"substring",
"(",
"0",
",",
"databaseName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
")",
";",
"suffix",
"=",
"databaseName",
".",
"substring",
"(",
"databaseName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"}",
"if",
"(",
"!",
"databaseName",
".",
"endsWith",
"(",
"recordDBName",
")",
")",
"{",
"databaseName",
"=",
"databaseName",
".",
"substring",
"(",
"0",
",",
"databaseName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
")",
";",
"if",
"(",
"(",
"record",
".",
"getDatabaseType",
"(",
")",
"&",
"DBConstants",
".",
"USER_DATA",
")",
"!=",
"0",
")",
"this",
".",
"getTask",
"(",
")",
".",
"setProperty",
"(",
"record",
".",
"getDatabaseName",
"(",
")",
"+",
"BaseDatabase",
".",
"DBUSER_PARAM_SUFFIX",
",",
"suffix",
")",
";",
"else",
"this",
".",
"getTask",
"(",
")",
".",
"setProperty",
"(",
"record",
".",
"getDatabaseName",
"(",
")",
"+",
"BaseDatabase",
".",
"DBSHARED_PARAM_SUFFIX",
",",
"suffix",
")",
";",
"suffix",
"=",
"databaseName",
".",
"substring",
"(",
"databaseName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"//? ",
"}",
"if",
"(",
"!",
"databaseName",
".",
"endsWith",
"(",
"recordDBName",
")",
")",
"{",
"this",
".",
"getTask",
"(",
")",
".",
"setProperty",
"(",
"DBConstants",
".",
"SYSTEM_NAME",
",",
"suffix",
")",
";",
"databaseName",
"=",
"databaseName",
".",
"substring",
"(",
"0",
",",
"databaseName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
")",
";",
"}",
"}",
"return",
"databaseName",
";",
"}"
] |
Clean up the database name;
@param databaseName
@return.
|
[
"Clean",
"up",
"the",
"database",
"name",
";"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java#L154-L193
|
151,380
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java
|
ImportXMLScanListener.getDatabaseInfoDatabaseName
|
private String getDatabaseInfoDatabaseName(String className)
{
String databaseName = className.substring(0, className.length() - 1 - DatabaseInfo.DATABASE_INFO_FILE.length());
databaseName = databaseName.substring(databaseName.lastIndexOf('.') + 1);
if (databaseName.endsWith(BaseDatabase.SHARED_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.SHARED_SUFFIX.length());
if (databaseName.endsWith(BaseDatabase.USER_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.USER_SUFFIX.length());
return databaseName;
}
|
java
|
private String getDatabaseInfoDatabaseName(String className)
{
String databaseName = className.substring(0, className.length() - 1 - DatabaseInfo.DATABASE_INFO_FILE.length());
databaseName = databaseName.substring(databaseName.lastIndexOf('.') + 1);
if (databaseName.endsWith(BaseDatabase.SHARED_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.SHARED_SUFFIX.length());
if (databaseName.endsWith(BaseDatabase.USER_SUFFIX))
databaseName = databaseName.substring(0, databaseName.length() - BaseDatabase.USER_SUFFIX.length());
return databaseName;
}
|
[
"private",
"String",
"getDatabaseInfoDatabaseName",
"(",
"String",
"className",
")",
"{",
"String",
"databaseName",
"=",
"className",
".",
"substring",
"(",
"0",
",",
"className",
".",
"length",
"(",
")",
"-",
"1",
"-",
"DatabaseInfo",
".",
"DATABASE_INFO_FILE",
".",
"length",
"(",
")",
")",
";",
"databaseName",
"=",
"databaseName",
".",
"substring",
"(",
"databaseName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
"+",
"1",
")",
";",
"if",
"(",
"databaseName",
".",
"endsWith",
"(",
"BaseDatabase",
".",
"SHARED_SUFFIX",
")",
")",
"databaseName",
"=",
"databaseName",
".",
"substring",
"(",
"0",
",",
"databaseName",
".",
"length",
"(",
")",
"-",
"BaseDatabase",
".",
"SHARED_SUFFIX",
".",
"length",
"(",
")",
")",
";",
"if",
"(",
"databaseName",
".",
"endsWith",
"(",
"BaseDatabase",
".",
"USER_SUFFIX",
")",
")",
"databaseName",
"=",
"databaseName",
".",
"substring",
"(",
"0",
",",
"databaseName",
".",
"length",
"(",
")",
"-",
"BaseDatabase",
".",
"USER_SUFFIX",
".",
"length",
"(",
")",
")",
";",
"return",
"databaseName",
";",
"}"
] |
GetDatabaseInfoDatabaseName Method.
|
[
"GetDatabaseInfoDatabaseName",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java#L197-L206
|
151,381
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java
|
ImportXMLScanListener.saveOldProperties
|
public void saveOldProperties(Map<String,String> oldProperties, Record record)
{
this.saveOldProperty(oldProperties, record.getDatabaseName() + BaseDatabase.DBSHARED_PARAM_SUFFIX);
this.saveOldProperty(oldProperties, record.getDatabaseName() + BaseDatabase.DBUSER_PARAM_SUFFIX);
this.saveOldProperty(oldProperties, DBConstants.DB_USER_PREFIX);
this.saveOldProperty(oldProperties, DBConstants.SYSTEM_NAME);
this.saveOldProperty(oldProperties, DBParams.LANGUAGE);
}
|
java
|
public void saveOldProperties(Map<String,String> oldProperties, Record record)
{
this.saveOldProperty(oldProperties, record.getDatabaseName() + BaseDatabase.DBSHARED_PARAM_SUFFIX);
this.saveOldProperty(oldProperties, record.getDatabaseName() + BaseDatabase.DBUSER_PARAM_SUFFIX);
this.saveOldProperty(oldProperties, DBConstants.DB_USER_PREFIX);
this.saveOldProperty(oldProperties, DBConstants.SYSTEM_NAME);
this.saveOldProperty(oldProperties, DBParams.LANGUAGE);
}
|
[
"public",
"void",
"saveOldProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"oldProperties",
",",
"Record",
"record",
")",
"{",
"this",
".",
"saveOldProperty",
"(",
"oldProperties",
",",
"record",
".",
"getDatabaseName",
"(",
")",
"+",
"BaseDatabase",
".",
"DBSHARED_PARAM_SUFFIX",
")",
";",
"this",
".",
"saveOldProperty",
"(",
"oldProperties",
",",
"record",
".",
"getDatabaseName",
"(",
")",
"+",
"BaseDatabase",
".",
"DBUSER_PARAM_SUFFIX",
")",
";",
"this",
".",
"saveOldProperty",
"(",
"oldProperties",
",",
"DBConstants",
".",
"DB_USER_PREFIX",
")",
";",
"this",
".",
"saveOldProperty",
"(",
"oldProperties",
",",
"DBConstants",
".",
"SYSTEM_NAME",
")",
";",
"this",
".",
"saveOldProperty",
"(",
"oldProperties",
",",
"DBParams",
".",
"LANGUAGE",
")",
";",
"}"
] |
SaveOldProperties Method.
|
[
"SaveOldProperties",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java#L210-L217
|
151,382
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java
|
ImportXMLScanListener.saveOldProperty
|
public void saveOldProperty(Map<String,String> oldProperties, String param)
{
oldProperties.put(param, this.getTask().getProperty(param));
}
|
java
|
public void saveOldProperty(Map<String,String> oldProperties, String param)
{
oldProperties.put(param, this.getTask().getProperty(param));
}
|
[
"public",
"void",
"saveOldProperty",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"oldProperties",
",",
"String",
"param",
")",
"{",
"oldProperties",
".",
"put",
"(",
"param",
",",
"this",
".",
"getTask",
"(",
")",
".",
"getProperty",
"(",
"param",
")",
")",
";",
"}"
] |
SaveOldProperty Method.
|
[
"SaveOldProperty",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java#L221-L224
|
151,383
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java
|
ImportXMLScanListener.restoreOldProperties
|
public void restoreOldProperties(Map<String,String> oldProperties, Record record)
{
this.restoreOldProperty(oldProperties, record.getDatabaseName() + BaseDatabase.DBSHARED_PARAM_SUFFIX);
this.restoreOldProperty(oldProperties, record.getDatabaseName() + BaseDatabase.DBUSER_PARAM_SUFFIX);
this.restoreOldProperty(oldProperties, DBConstants.DB_USER_PREFIX);
this.restoreOldProperty(oldProperties, DBConstants.SYSTEM_NAME);
this.restoreOldProperty(oldProperties, DBParams.LANGUAGE);
}
|
java
|
public void restoreOldProperties(Map<String,String> oldProperties, Record record)
{
this.restoreOldProperty(oldProperties, record.getDatabaseName() + BaseDatabase.DBSHARED_PARAM_SUFFIX);
this.restoreOldProperty(oldProperties, record.getDatabaseName() + BaseDatabase.DBUSER_PARAM_SUFFIX);
this.restoreOldProperty(oldProperties, DBConstants.DB_USER_PREFIX);
this.restoreOldProperty(oldProperties, DBConstants.SYSTEM_NAME);
this.restoreOldProperty(oldProperties, DBParams.LANGUAGE);
}
|
[
"public",
"void",
"restoreOldProperties",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"oldProperties",
",",
"Record",
"record",
")",
"{",
"this",
".",
"restoreOldProperty",
"(",
"oldProperties",
",",
"record",
".",
"getDatabaseName",
"(",
")",
"+",
"BaseDatabase",
".",
"DBSHARED_PARAM_SUFFIX",
")",
";",
"this",
".",
"restoreOldProperty",
"(",
"oldProperties",
",",
"record",
".",
"getDatabaseName",
"(",
")",
"+",
"BaseDatabase",
".",
"DBUSER_PARAM_SUFFIX",
")",
";",
"this",
".",
"restoreOldProperty",
"(",
"oldProperties",
",",
"DBConstants",
".",
"DB_USER_PREFIX",
")",
";",
"this",
".",
"restoreOldProperty",
"(",
"oldProperties",
",",
"DBConstants",
".",
"SYSTEM_NAME",
")",
";",
"this",
".",
"restoreOldProperty",
"(",
"oldProperties",
",",
"DBParams",
".",
"LANGUAGE",
")",
";",
"}"
] |
RestoreOldProperties Method.
|
[
"RestoreOldProperties",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java#L228-L235
|
151,384
|
jbundle/jbundle
|
app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java
|
ImportXMLScanListener.restoreOldProperty
|
private void restoreOldProperty(Map<String,String> oldProperties, String param)
{
this.getTask().setProperty(param, oldProperties.get(param));
}
|
java
|
private void restoreOldProperty(Map<String,String> oldProperties, String param)
{
this.getTask().setProperty(param, oldProperties.get(param));
}
|
[
"private",
"void",
"restoreOldProperty",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"oldProperties",
",",
"String",
"param",
")",
"{",
"this",
".",
"getTask",
"(",
")",
".",
"setProperty",
"(",
"param",
",",
"oldProperties",
".",
"get",
"(",
"param",
")",
")",
";",
"}"
] |
RestoreOldProperty Method.
|
[
"RestoreOldProperty",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/script/src/main/java/org/jbundle/app/program/script/scan/ImportXMLScanListener.java#L239-L242
|
151,385
|
jbundle/jbundle
|
main/db/src/main/java/org/jbundle/main/user/db/UserField.java
|
UserField.getUserID
|
public int getUserID()
{
int iUserID = -1;
String strUserID = DBConstants.BLANK;
if (this.getRecord().getRecordOwner() != null)
if (this.getRecord().getRecordOwner().getTask() != null)
if (this.getRecord().getRecordOwner().getTask().getApplication() != null)
strUserID = ((BaseApplication)this.getRecord().getRecordOwner().getTask().getApplication()).getUserID();
try {
iUserID = Integer.parseInt(strUserID);
if (iUserID == 0)
iUserID = -1;
} catch (NumberFormatException e) {
iUserID = -1;
}
return iUserID;
}
|
java
|
public int getUserID()
{
int iUserID = -1;
String strUserID = DBConstants.BLANK;
if (this.getRecord().getRecordOwner() != null)
if (this.getRecord().getRecordOwner().getTask() != null)
if (this.getRecord().getRecordOwner().getTask().getApplication() != null)
strUserID = ((BaseApplication)this.getRecord().getRecordOwner().getTask().getApplication()).getUserID();
try {
iUserID = Integer.parseInt(strUserID);
if (iUserID == 0)
iUserID = -1;
} catch (NumberFormatException e) {
iUserID = -1;
}
return iUserID;
}
|
[
"public",
"int",
"getUserID",
"(",
")",
"{",
"int",
"iUserID",
"=",
"-",
"1",
";",
"String",
"strUserID",
"=",
"DBConstants",
".",
"BLANK",
";",
"if",
"(",
"this",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"this",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
".",
"getTask",
"(",
")",
"!=",
"null",
")",
"if",
"(",
"this",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
"!=",
"null",
")",
"strUserID",
"=",
"(",
"(",
"BaseApplication",
")",
"this",
".",
"getRecord",
"(",
")",
".",
"getRecordOwner",
"(",
")",
".",
"getTask",
"(",
")",
".",
"getApplication",
"(",
")",
")",
".",
"getUserID",
"(",
")",
";",
"try",
"{",
"iUserID",
"=",
"Integer",
".",
"parseInt",
"(",
"strUserID",
")",
";",
"if",
"(",
"iUserID",
"==",
"0",
")",
"iUserID",
"=",
"-",
"1",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"iUserID",
"=",
"-",
"1",
";",
"}",
"return",
"iUserID",
";",
"}"
] |
Get the current User's ID.
|
[
"Get",
"the",
"current",
"User",
"s",
"ID",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/user/db/UserField.java#L84-L100
|
151,386
|
jbundle/jbundle
|
thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageHeader.java
|
BaseMessageHeader.cloneMatrix
|
public final Object[][] cloneMatrix(Object[][] tempString)
{
Object[][] mxString = null;
if (tempString != null)
{
mxString = new Object[tempString.length][2];
for (int i = 0; i < tempString.length; i++)
{
mxString[i][MessageConstants.NAME] = tempString[i][MessageConstants.NAME];
mxString[i][MessageConstants.VALUE] = tempString[i][MessageConstants.VALUE];
}
}
return mxString;
}
|
java
|
public final Object[][] cloneMatrix(Object[][] tempString)
{
Object[][] mxString = null;
if (tempString != null)
{
mxString = new Object[tempString.length][2];
for (int i = 0; i < tempString.length; i++)
{
mxString[i][MessageConstants.NAME] = tempString[i][MessageConstants.NAME];
mxString[i][MessageConstants.VALUE] = tempString[i][MessageConstants.VALUE];
}
}
return mxString;
}
|
[
"public",
"final",
"Object",
"[",
"]",
"[",
"]",
"cloneMatrix",
"(",
"Object",
"[",
"]",
"[",
"]",
"tempString",
")",
"{",
"Object",
"[",
"]",
"[",
"]",
"mxString",
"=",
"null",
";",
"if",
"(",
"tempString",
"!=",
"null",
")",
"{",
"mxString",
"=",
"new",
"Object",
"[",
"tempString",
".",
"length",
"]",
"[",
"2",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"tempString",
".",
"length",
";",
"i",
"++",
")",
"{",
"mxString",
"[",
"i",
"]",
"[",
"MessageConstants",
".",
"NAME",
"]",
"=",
"tempString",
"[",
"i",
"]",
"[",
"MessageConstants",
".",
"NAME",
"]",
";",
"mxString",
"[",
"i",
"]",
"[",
"MessageConstants",
".",
"VALUE",
"]",
"=",
"tempString",
"[",
"i",
"]",
"[",
"MessageConstants",
".",
"VALUE",
"]",
";",
"}",
"}",
"return",
"mxString",
";",
"}"
] |
Create a copy of this matrix.
@param mxString Source matrix (or null if new).
@param strName Name to add
@param strValue Value to add
Skip if the value is null.
|
[
"Create",
"a",
"copy",
"of",
"this",
"matrix",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/BaseMessageHeader.java#L273-L286
|
151,387
|
jbundle/jbundle
|
thin/opt/location/src/main/java/org/jbundle/thin/opt/location/JLocationScreen.java
|
JLocationScreen.propertyChange
|
public void propertyChange(final java.beans.PropertyChangeEvent p1) {
this.firePropertyChange(p1.getPropertyName(), p1.getOldValue(), p1.getNewValue());
}
|
java
|
public void propertyChange(final java.beans.PropertyChangeEvent p1) {
this.firePropertyChange(p1.getPropertyName(), p1.getOldValue(), p1.getNewValue());
}
|
[
"public",
"void",
"propertyChange",
"(",
"final",
"java",
".",
"beans",
".",
"PropertyChangeEvent",
"p1",
")",
"{",
"this",
".",
"firePropertyChange",
"(",
"p1",
".",
"getPropertyName",
"(",
")",
",",
"p1",
".",
"getOldValue",
"(",
")",
",",
"p1",
".",
"getNewValue",
"(",
")",
")",
";",
"}"
] |
Pass the property changes on to my listeners.
|
[
"Pass",
"the",
"property",
"changes",
"on",
"to",
"my",
"listeners",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/opt/location/src/main/java/org/jbundle/thin/opt/location/JLocationScreen.java#L79-L81
|
151,388
|
jbundle/jbundle
|
app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/SetupExcludePackagesHandler.java
|
SetupExcludePackagesHandler.scanTreeForExcludes
|
public void scanTreeForExcludes(StringBuffer sb, String strParentFolderID)
{
m_recPackagesExclude.setKeyArea(Packages.PARENT_FOLDER_ID_KEY);
StringSubFileFilter listener = null;
m_recPackagesExclude.addListener(listener = new StringSubFileFilter(strParentFolderID, Packages.PARENT_FOLDER_ID, null, null, null, null));
try {
java.util.List<String> list = new ArrayList<String>();
m_recPackagesExclude.close();
while (m_recPackagesExclude.hasNext())
{
m_recPackagesExclude.next();
if (m_recPackagesExclude.getField(Packages.EXCLUDE).getState() == true)
sb.append("<exclude>" + this.getTree(m_recPackagesExclude) + "</exclude>\n");
list.add(m_recPackagesExclude.getField(Packages.ID).toString());
}
m_recPackagesExclude.removeListener(listener, true);
listener = null;
for (String strFolderID : list)
{
this.scanTreeForExcludes(sb, strFolderID);
}
} catch (DBException ex) {
ex.printStackTrace();
if (listener != null)
m_recPackagesExclude.removeListener(listener, true);
}
}
|
java
|
public void scanTreeForExcludes(StringBuffer sb, String strParentFolderID)
{
m_recPackagesExclude.setKeyArea(Packages.PARENT_FOLDER_ID_KEY);
StringSubFileFilter listener = null;
m_recPackagesExclude.addListener(listener = new StringSubFileFilter(strParentFolderID, Packages.PARENT_FOLDER_ID, null, null, null, null));
try {
java.util.List<String> list = new ArrayList<String>();
m_recPackagesExclude.close();
while (m_recPackagesExclude.hasNext())
{
m_recPackagesExclude.next();
if (m_recPackagesExclude.getField(Packages.EXCLUDE).getState() == true)
sb.append("<exclude>" + this.getTree(m_recPackagesExclude) + "</exclude>\n");
list.add(m_recPackagesExclude.getField(Packages.ID).toString());
}
m_recPackagesExclude.removeListener(listener, true);
listener = null;
for (String strFolderID : list)
{
this.scanTreeForExcludes(sb, strFolderID);
}
} catch (DBException ex) {
ex.printStackTrace();
if (listener != null)
m_recPackagesExclude.removeListener(listener, true);
}
}
|
[
"public",
"void",
"scanTreeForExcludes",
"(",
"StringBuffer",
"sb",
",",
"String",
"strParentFolderID",
")",
"{",
"m_recPackagesExclude",
".",
"setKeyArea",
"(",
"Packages",
".",
"PARENT_FOLDER_ID_KEY",
")",
";",
"StringSubFileFilter",
"listener",
"=",
"null",
";",
"m_recPackagesExclude",
".",
"addListener",
"(",
"listener",
"=",
"new",
"StringSubFileFilter",
"(",
"strParentFolderID",
",",
"Packages",
".",
"PARENT_FOLDER_ID",
",",
"null",
",",
"null",
",",
"null",
",",
"null",
")",
")",
";",
"try",
"{",
"java",
".",
"util",
".",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"m_recPackagesExclude",
".",
"close",
"(",
")",
";",
"while",
"(",
"m_recPackagesExclude",
".",
"hasNext",
"(",
")",
")",
"{",
"m_recPackagesExclude",
".",
"next",
"(",
")",
";",
"if",
"(",
"m_recPackagesExclude",
".",
"getField",
"(",
"Packages",
".",
"EXCLUDE",
")",
".",
"getState",
"(",
")",
"==",
"true",
")",
"sb",
".",
"append",
"(",
"\"<exclude>\"",
"+",
"this",
".",
"getTree",
"(",
"m_recPackagesExclude",
")",
"+",
"\"</exclude>\\n\"",
")",
";",
"list",
".",
"add",
"(",
"m_recPackagesExclude",
".",
"getField",
"(",
"Packages",
".",
"ID",
")",
".",
"toString",
"(",
")",
")",
";",
"}",
"m_recPackagesExclude",
".",
"removeListener",
"(",
"listener",
",",
"true",
")",
";",
"listener",
"=",
"null",
";",
"for",
"(",
"String",
"strFolderID",
":",
"list",
")",
"{",
"this",
".",
"scanTreeForExcludes",
"(",
"sb",
",",
"strFolderID",
")",
";",
"}",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"if",
"(",
"listener",
"!=",
"null",
")",
"m_recPackagesExclude",
".",
"removeListener",
"(",
"listener",
",",
"true",
")",
";",
"}",
"}"
] |
ScanTreeForExcludes Method.
|
[
"ScanTreeForExcludes",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/SetupExcludePackagesHandler.java#L99-L125
|
151,389
|
jbundle/jbundle
|
app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/SetupExcludePackagesHandler.java
|
SetupExcludePackagesHandler.getTree
|
public String getTree(Record recPackages)
{
try {
if (m_recPackagesTree == null)
{
RecordOwner recordOwner = this.getOwner().findRecordOwner();
m_recPackagesTree = new Packages(recordOwner);
if (recordOwner != null)
recordOwner.removeRecord(m_recPackagesTree);
}
String strPackagesTree = recPackages.getField(Packages.NAME).toString();
m_recPackagesTree.addNew();
m_recPackagesTree.getField(Packages.ID).moveFieldToThis(recPackages.getField(Packages.PARENT_FOLDER_ID));
while ((m_recPackagesTree.getField(Packages.ID).getValue() > 0) && (m_recPackagesTree.seek(null)))
{
strPackagesTree = m_recPackagesTree.getField(Packages.NAME).toString() + '.' + strPackagesTree;
m_recPackagesTree.getField(Packages.ID).moveFieldToThis(m_recPackagesTree.getField(Packages.PARENT_FOLDER_ID));
}
return strPackagesTree;
} catch (DBException ex) {
ex.printStackTrace();
return null;
}
}
|
java
|
public String getTree(Record recPackages)
{
try {
if (m_recPackagesTree == null)
{
RecordOwner recordOwner = this.getOwner().findRecordOwner();
m_recPackagesTree = new Packages(recordOwner);
if (recordOwner != null)
recordOwner.removeRecord(m_recPackagesTree);
}
String strPackagesTree = recPackages.getField(Packages.NAME).toString();
m_recPackagesTree.addNew();
m_recPackagesTree.getField(Packages.ID).moveFieldToThis(recPackages.getField(Packages.PARENT_FOLDER_ID));
while ((m_recPackagesTree.getField(Packages.ID).getValue() > 0) && (m_recPackagesTree.seek(null)))
{
strPackagesTree = m_recPackagesTree.getField(Packages.NAME).toString() + '.' + strPackagesTree;
m_recPackagesTree.getField(Packages.ID).moveFieldToThis(m_recPackagesTree.getField(Packages.PARENT_FOLDER_ID));
}
return strPackagesTree;
} catch (DBException ex) {
ex.printStackTrace();
return null;
}
}
|
[
"public",
"String",
"getTree",
"(",
"Record",
"recPackages",
")",
"{",
"try",
"{",
"if",
"(",
"m_recPackagesTree",
"==",
"null",
")",
"{",
"RecordOwner",
"recordOwner",
"=",
"this",
".",
"getOwner",
"(",
")",
".",
"findRecordOwner",
"(",
")",
";",
"m_recPackagesTree",
"=",
"new",
"Packages",
"(",
"recordOwner",
")",
";",
"if",
"(",
"recordOwner",
"!=",
"null",
")",
"recordOwner",
".",
"removeRecord",
"(",
"m_recPackagesTree",
")",
";",
"}",
"String",
"strPackagesTree",
"=",
"recPackages",
".",
"getField",
"(",
"Packages",
".",
"NAME",
")",
".",
"toString",
"(",
")",
";",
"m_recPackagesTree",
".",
"addNew",
"(",
")",
";",
"m_recPackagesTree",
".",
"getField",
"(",
"Packages",
".",
"ID",
")",
".",
"moveFieldToThis",
"(",
"recPackages",
".",
"getField",
"(",
"Packages",
".",
"PARENT_FOLDER_ID",
")",
")",
";",
"while",
"(",
"(",
"m_recPackagesTree",
".",
"getField",
"(",
"Packages",
".",
"ID",
")",
".",
"getValue",
"(",
")",
">",
"0",
")",
"&&",
"(",
"m_recPackagesTree",
".",
"seek",
"(",
"null",
")",
")",
")",
"{",
"strPackagesTree",
"=",
"m_recPackagesTree",
".",
"getField",
"(",
"Packages",
".",
"NAME",
")",
".",
"toString",
"(",
")",
"+",
"'",
"'",
"+",
"strPackagesTree",
";",
"m_recPackagesTree",
".",
"getField",
"(",
"Packages",
".",
"ID",
")",
".",
"moveFieldToThis",
"(",
"m_recPackagesTree",
".",
"getField",
"(",
"Packages",
".",
"PARENT_FOLDER_ID",
")",
")",
";",
"}",
"return",
"strPackagesTree",
";",
"}",
"catch",
"(",
"DBException",
"ex",
")",
"{",
"ex",
".",
"printStackTrace",
"(",
")",
";",
"return",
"null",
";",
"}",
"}"
] |
GetTree Method.
|
[
"GetTree",
"Method",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/app/program/packages/src/main/java/org/jbundle/app/program/packages/screen/SetupExcludePackagesHandler.java#L129-L153
|
151,390
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java
|
GridBuffer.addElement
|
public void addElement(int iTargetPosition, Object bookmark, GridList gridList)
{
int iArrayIndex = this.bufferToArrayIndex(iTargetPosition);
if (!this.inBufferArray(iTargetPosition))
iArrayIndex = this.newBufferStartsAt(iTargetPosition, gridList); // Add code to adjust the buffer to a new location
m_aCurrentRecord[iArrayIndex] = bookmark;
if (!this.inBufferList(iTargetPosition))
m_iCurrentRecordEnd = iTargetPosition + 1; // Logical size is this large
}
|
java
|
public void addElement(int iTargetPosition, Object bookmark, GridList gridList)
{
int iArrayIndex = this.bufferToArrayIndex(iTargetPosition);
if (!this.inBufferArray(iTargetPosition))
iArrayIndex = this.newBufferStartsAt(iTargetPosition, gridList); // Add code to adjust the buffer to a new location
m_aCurrentRecord[iArrayIndex] = bookmark;
if (!this.inBufferList(iTargetPosition))
m_iCurrentRecordEnd = iTargetPosition + 1; // Logical size is this large
}
|
[
"public",
"void",
"addElement",
"(",
"int",
"iTargetPosition",
",",
"Object",
"bookmark",
",",
"GridList",
"gridList",
")",
"{",
"int",
"iArrayIndex",
"=",
"this",
".",
"bufferToArrayIndex",
"(",
"iTargetPosition",
")",
";",
"if",
"(",
"!",
"this",
".",
"inBufferArray",
"(",
"iTargetPosition",
")",
")",
"iArrayIndex",
"=",
"this",
".",
"newBufferStartsAt",
"(",
"iTargetPosition",
",",
"gridList",
")",
";",
"// Add code to adjust the buffer to a new location",
"m_aCurrentRecord",
"[",
"iArrayIndex",
"]",
"=",
"bookmark",
";",
"if",
"(",
"!",
"this",
".",
"inBufferList",
"(",
"iTargetPosition",
")",
")",
"m_iCurrentRecordEnd",
"=",
"iTargetPosition",
"+",
"1",
";",
"// Logical size is this large",
"}"
] |
Add this record's unique info to current buffer.
@param iTargetPosition The position to add the bookmark at.
@param bookmark The bookmark to add.
@param gridList The gridlist to update with this bookmark.
|
[
"Add",
"this",
"record",
"s",
"unique",
"info",
"to",
"current",
"buffer",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java#L63-L71
|
151,391
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java
|
GridBuffer.findElement
|
public int findElement(Object bookmark, int iHandleType)
{
int iTargetPosition;
Object thisBookmark = null;
if (bookmark == null)
return -1;
boolean bDataRecordFormat = false;
for (iTargetPosition = m_iCurrentRecordStart; iTargetPosition < m_iCurrentRecordEnd; iTargetPosition++)
{
thisBookmark = this.elementAt(iTargetPosition);
if (iTargetPosition == m_iCurrentRecordStart)
if (thisBookmark instanceof DataRecord)
bDataRecordFormat = true;
if (bookmark.equals(thisBookmark))
return iTargetPosition;
else if (bDataRecordFormat)
if (bookmark.equals(((DataRecord)thisBookmark).getHandle(iHandleType)))
return iTargetPosition;
}
//+ Still not found, do a binary search through the recordlist for a matching key
return -1; // Not found
}
|
java
|
public int findElement(Object bookmark, int iHandleType)
{
int iTargetPosition;
Object thisBookmark = null;
if (bookmark == null)
return -1;
boolean bDataRecordFormat = false;
for (iTargetPosition = m_iCurrentRecordStart; iTargetPosition < m_iCurrentRecordEnd; iTargetPosition++)
{
thisBookmark = this.elementAt(iTargetPosition);
if (iTargetPosition == m_iCurrentRecordStart)
if (thisBookmark instanceof DataRecord)
bDataRecordFormat = true;
if (bookmark.equals(thisBookmark))
return iTargetPosition;
else if (bDataRecordFormat)
if (bookmark.equals(((DataRecord)thisBookmark).getHandle(iHandleType)))
return iTargetPosition;
}
//+ Still not found, do a binary search through the recordlist for a matching key
return -1; // Not found
}
|
[
"public",
"int",
"findElement",
"(",
"Object",
"bookmark",
",",
"int",
"iHandleType",
")",
"{",
"int",
"iTargetPosition",
";",
"Object",
"thisBookmark",
"=",
"null",
";",
"if",
"(",
"bookmark",
"==",
"null",
")",
"return",
"-",
"1",
";",
"boolean",
"bDataRecordFormat",
"=",
"false",
";",
"for",
"(",
"iTargetPosition",
"=",
"m_iCurrentRecordStart",
";",
"iTargetPosition",
"<",
"m_iCurrentRecordEnd",
";",
"iTargetPosition",
"++",
")",
"{",
"thisBookmark",
"=",
"this",
".",
"elementAt",
"(",
"iTargetPosition",
")",
";",
"if",
"(",
"iTargetPosition",
"==",
"m_iCurrentRecordStart",
")",
"if",
"(",
"thisBookmark",
"instanceof",
"DataRecord",
")",
"bDataRecordFormat",
"=",
"true",
";",
"if",
"(",
"bookmark",
".",
"equals",
"(",
"thisBookmark",
")",
")",
"return",
"iTargetPosition",
";",
"else",
"if",
"(",
"bDataRecordFormat",
")",
"if",
"(",
"bookmark",
".",
"equals",
"(",
"(",
"(",
"DataRecord",
")",
"thisBookmark",
")",
".",
"getHandle",
"(",
"iHandleType",
")",
")",
")",
"return",
"iTargetPosition",
";",
"}",
"//+ Still not found, do a binary search through the recordlist for a matching key",
"return",
"-",
"1",
";",
"// Not found",
"}"
] |
This method does a sequential seqrch through the buffer looking for the bookmark.
@return int index in table; or -1 if not found.
@param bookmark java.lang.Object The bookmark to find.
@param iHandleType The handle type of the bookmark.
|
[
"This",
"method",
"does",
"a",
"sequential",
"seqrch",
"through",
"the",
"buffer",
"looking",
"for",
"the",
"bookmark",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java#L101-L122
|
151,392
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java
|
GridBuffer.inBufferList
|
public boolean inBufferList(int iTargetPosition)
{
boolean bInBufferList = ((iTargetPosition >= m_iCurrentRecordStart) && (iTargetPosition < m_iCurrentRecordEnd));
if (bInBufferList)
if (m_aCurrentRecord[this.bufferToArrayIndex(iTargetPosition)] == gEmptyCell)
bInBufferList = false;
return bInBufferList;
}
|
java
|
public boolean inBufferList(int iTargetPosition)
{
boolean bInBufferList = ((iTargetPosition >= m_iCurrentRecordStart) && (iTargetPosition < m_iCurrentRecordEnd));
if (bInBufferList)
if (m_aCurrentRecord[this.bufferToArrayIndex(iTargetPosition)] == gEmptyCell)
bInBufferList = false;
return bInBufferList;
}
|
[
"public",
"boolean",
"inBufferList",
"(",
"int",
"iTargetPosition",
")",
"{",
"boolean",
"bInBufferList",
"=",
"(",
"(",
"iTargetPosition",
">=",
"m_iCurrentRecordStart",
")",
"&&",
"(",
"iTargetPosition",
"<",
"m_iCurrentRecordEnd",
")",
")",
";",
"if",
"(",
"bInBufferList",
")",
"if",
"(",
"m_aCurrentRecord",
"[",
"this",
".",
"bufferToArrayIndex",
"(",
"iTargetPosition",
")",
"]",
"==",
"gEmptyCell",
")",
"bInBufferList",
"=",
"false",
";",
"return",
"bInBufferList",
";",
"}"
] |
Is this actual file position in the current cache?
@param iTargetPosition The logical position to check.
@return true if this position is in the current buffer list.
|
[
"Is",
"this",
"actual",
"file",
"position",
"in",
"the",
"current",
"cache?"
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java#L146-L153
|
151,393
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java
|
GridBuffer.moveBufferToAccessList
|
public void moveBufferToAccessList(GridList gridList)
{
for (int index = m_iCurrentRecordStart; index < m_iCurrentRecordEnd; index++)
{
int iArrayIndex = this.bufferToArrayIndex(index);
Object bookmark = m_aCurrentRecord[iArrayIndex];
if (bookmark != gEmptyCell)
gridList.addElement(index, bookmark);
}
}
|
java
|
public void moveBufferToAccessList(GridList gridList)
{
for (int index = m_iCurrentRecordStart; index < m_iCurrentRecordEnd; index++)
{
int iArrayIndex = this.bufferToArrayIndex(index);
Object bookmark = m_aCurrentRecord[iArrayIndex];
if (bookmark != gEmptyCell)
gridList.addElement(index, bookmark);
}
}
|
[
"public",
"void",
"moveBufferToAccessList",
"(",
"GridList",
"gridList",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"m_iCurrentRecordStart",
";",
"index",
"<",
"m_iCurrentRecordEnd",
";",
"index",
"++",
")",
"{",
"int",
"iArrayIndex",
"=",
"this",
".",
"bufferToArrayIndex",
"(",
"index",
")",
";",
"Object",
"bookmark",
"=",
"m_aCurrentRecord",
"[",
"iArrayIndex",
"]",
";",
"if",
"(",
"bookmark",
"!=",
"gEmptyCell",
")",
"gridList",
".",
"addElement",
"(",
"index",
",",
"bookmark",
")",
";",
"}",
"}"
] |
Move these to the access list before getting rid of them.
@param gridList The list to add these buffer items to.
|
[
"Move",
"these",
"to",
"the",
"access",
"list",
"before",
"getting",
"rid",
"of",
"them",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java#L158-L167
|
151,394
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java
|
GridBuffer.newBufferStartsAt
|
public int newBufferStartsAt(int iTargetPosition, GridList gridList)
{
//**NOTE** This can be improved by moving any overlapping records in the old buffer to the new buffer
// Discard the entire current buffer
if (gridList != null)
this.moveBufferToAccessList(gridList);
for (int index = m_iCurrentRecordStart; index < m_iCurrentRecordEnd; index++)
{
int iArrayIndex = this.bufferToArrayIndex(index);
Object bookmark = m_aCurrentRecord[iArrayIndex];
m_aCurrentRecord[iArrayIndex] = gEmptyCell;
if (!gridList.inRecordList(index))
if ((bookmark != null) && (bookmark != gEmptyCell))
this.freeElement(bookmark);
}
m_iCurrentRecordStart = iTargetPosition;
m_iCurrentRecordEnd = iTargetPosition; // No records in buffer!
return this.bufferToArrayIndex(iTargetPosition);
}
|
java
|
public int newBufferStartsAt(int iTargetPosition, GridList gridList)
{
//**NOTE** This can be improved by moving any overlapping records in the old buffer to the new buffer
// Discard the entire current buffer
if (gridList != null)
this.moveBufferToAccessList(gridList);
for (int index = m_iCurrentRecordStart; index < m_iCurrentRecordEnd; index++)
{
int iArrayIndex = this.bufferToArrayIndex(index);
Object bookmark = m_aCurrentRecord[iArrayIndex];
m_aCurrentRecord[iArrayIndex] = gEmptyCell;
if (!gridList.inRecordList(index))
if ((bookmark != null) && (bookmark != gEmptyCell))
this.freeElement(bookmark);
}
m_iCurrentRecordStart = iTargetPosition;
m_iCurrentRecordEnd = iTargetPosition; // No records in buffer!
return this.bufferToArrayIndex(iTargetPosition);
}
|
[
"public",
"int",
"newBufferStartsAt",
"(",
"int",
"iTargetPosition",
",",
"GridList",
"gridList",
")",
"{",
"//**NOTE** This can be improved by moving any overlapping records in the old buffer to the new buffer",
"// Discard the entire current buffer",
"if",
"(",
"gridList",
"!=",
"null",
")",
"this",
".",
"moveBufferToAccessList",
"(",
"gridList",
")",
";",
"for",
"(",
"int",
"index",
"=",
"m_iCurrentRecordStart",
";",
"index",
"<",
"m_iCurrentRecordEnd",
";",
"index",
"++",
")",
"{",
"int",
"iArrayIndex",
"=",
"this",
".",
"bufferToArrayIndex",
"(",
"index",
")",
";",
"Object",
"bookmark",
"=",
"m_aCurrentRecord",
"[",
"iArrayIndex",
"]",
";",
"m_aCurrentRecord",
"[",
"iArrayIndex",
"]",
"=",
"gEmptyCell",
";",
"if",
"(",
"!",
"gridList",
".",
"inRecordList",
"(",
"index",
")",
")",
"if",
"(",
"(",
"bookmark",
"!=",
"null",
")",
"&&",
"(",
"bookmark",
"!=",
"gEmptyCell",
")",
")",
"this",
".",
"freeElement",
"(",
"bookmark",
")",
";",
"}",
"m_iCurrentRecordStart",
"=",
"iTargetPosition",
";",
"m_iCurrentRecordEnd",
"=",
"iTargetPosition",
";",
"// No records in buffer!",
"return",
"this",
".",
"bufferToArrayIndex",
"(",
"iTargetPosition",
")",
";",
"}"
] |
Shift the current cache to the current records and setup a new buffer.
@param iTargetPosition The new target position.
@param gridList The gridList to update with buffer items before I free them.
@return The new physical position of this target position.
|
[
"Shift",
"the",
"current",
"cache",
"to",
"the",
"current",
"records",
"and",
"setup",
"a",
"new",
"buffer",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/grid/GridBuffer.java#L174-L192
|
151,395
|
inkstand-io/scribble
|
scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServer.java
|
HttpServer.createZipResourceHandler
|
private ResourceHandler createZipResourceHandler(final URL zipFile) throws IOException {
final FileSystem fileSystem = newFileSystem(URI.create("jar:" + zipFile), Collections.<String, Object>emptyMap());
final ResourceManager resMgr = new FileSystemResourceManager(fileSystem);
return new ResourceHandler(resMgr);
}
|
java
|
private ResourceHandler createZipResourceHandler(final URL zipFile) throws IOException {
final FileSystem fileSystem = newFileSystem(URI.create("jar:" + zipFile), Collections.<String, Object>emptyMap());
final ResourceManager resMgr = new FileSystemResourceManager(fileSystem);
return new ResourceHandler(resMgr);
}
|
[
"private",
"ResourceHandler",
"createZipResourceHandler",
"(",
"final",
"URL",
"zipFile",
")",
"throws",
"IOException",
"{",
"final",
"FileSystem",
"fileSystem",
"=",
"newFileSystem",
"(",
"URI",
".",
"create",
"(",
"\"jar:\"",
"+",
"zipFile",
")",
",",
"Collections",
".",
"<",
"String",
",",
"Object",
">",
"emptyMap",
"(",
")",
")",
";",
"final",
"ResourceManager",
"resMgr",
"=",
"new",
"FileSystemResourceManager",
"(",
"fileSystem",
")",
";",
"return",
"new",
"ResourceHandler",
"(",
"resMgr",
")",
";",
"}"
] |
Creates the resource handle for a zip file, specified by the URL.
@param zipFile
url to a zip file
@return
the resource handler to handle requests to files in the zip
@throws IOException
|
[
"Creates",
"the",
"resource",
"handle",
"for",
"a",
"zip",
"file",
"specified",
"by",
"the",
"URL",
"."
] |
66e67553bad4b1ff817e1715fd1d3dd833406744
|
https://github.com/inkstand-io/scribble/blob/66e67553bad4b1ff817e1715fd1d3dd833406744/scribble-http/src/main/java/io/inkstand/scribble/http/rules/HttpServer.java#L175-L180
|
151,396
|
jbundle/jbundle
|
base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseSessionHolder.java
|
BaseSessionHolder.setReturnSessionOrObject
|
public void setReturnSessionOrObject(PrintWriter out, Object objReturn)
{
String strID = null;
String strSessionClass = null;
if (objReturn instanceof RemoteTable)
{
strSessionClass = REMOTE_TABLE;
strID = this.add(new TableHolder(this, (RemoteTable)objReturn));
}
else if (objReturn instanceof RemoteSession)
{
strSessionClass = REMOTE_SESSION;
strID = this.add(new SessionHolder(this, (RemoteSession)objReturn));
}
else if (objReturn instanceof RemoteBaseSession)
{
strSessionClass = REMOTE_BASE_SESSION;
strID = this.add(new BaseSessionHolder(this, (RemoteBaseSession)objReturn));
}
if (strID != null)
this.setReturnString(out, strSessionClass + CLASS_SEPARATOR + strID);
else
this.setReturnObject(out, objReturn);
}
|
java
|
public void setReturnSessionOrObject(PrintWriter out, Object objReturn)
{
String strID = null;
String strSessionClass = null;
if (objReturn instanceof RemoteTable)
{
strSessionClass = REMOTE_TABLE;
strID = this.add(new TableHolder(this, (RemoteTable)objReturn));
}
else if (objReturn instanceof RemoteSession)
{
strSessionClass = REMOTE_SESSION;
strID = this.add(new SessionHolder(this, (RemoteSession)objReturn));
}
else if (objReturn instanceof RemoteBaseSession)
{
strSessionClass = REMOTE_BASE_SESSION;
strID = this.add(new BaseSessionHolder(this, (RemoteBaseSession)objReturn));
}
if (strID != null)
this.setReturnString(out, strSessionClass + CLASS_SEPARATOR + strID);
else
this.setReturnObject(out, objReturn);
}
|
[
"public",
"void",
"setReturnSessionOrObject",
"(",
"PrintWriter",
"out",
",",
"Object",
"objReturn",
")",
"{",
"String",
"strID",
"=",
"null",
";",
"String",
"strSessionClass",
"=",
"null",
";",
"if",
"(",
"objReturn",
"instanceof",
"RemoteTable",
")",
"{",
"strSessionClass",
"=",
"REMOTE_TABLE",
";",
"strID",
"=",
"this",
".",
"add",
"(",
"new",
"TableHolder",
"(",
"this",
",",
"(",
"RemoteTable",
")",
"objReturn",
")",
")",
";",
"}",
"else",
"if",
"(",
"objReturn",
"instanceof",
"RemoteSession",
")",
"{",
"strSessionClass",
"=",
"REMOTE_SESSION",
";",
"strID",
"=",
"this",
".",
"add",
"(",
"new",
"SessionHolder",
"(",
"this",
",",
"(",
"RemoteSession",
")",
"objReturn",
")",
")",
";",
"}",
"else",
"if",
"(",
"objReturn",
"instanceof",
"RemoteBaseSession",
")",
"{",
"strSessionClass",
"=",
"REMOTE_BASE_SESSION",
";",
"strID",
"=",
"this",
".",
"add",
"(",
"new",
"BaseSessionHolder",
"(",
"this",
",",
"(",
"RemoteBaseSession",
")",
"objReturn",
")",
")",
";",
"}",
"if",
"(",
"strID",
"!=",
"null",
")",
"this",
".",
"setReturnString",
"(",
"out",
",",
"strSessionClass",
"+",
"CLASS_SEPARATOR",
"+",
"strID",
")",
";",
"else",
"this",
".",
"setReturnObject",
"(",
"out",
",",
"objReturn",
")",
";",
"}"
] |
If this is a session, convert to a proxy session and return, if object, convert and return.
@param out The return output stream.
@param strReturn The string to return.
|
[
"If",
"this",
"is",
"a",
"session",
"convert",
"to",
"a",
"proxy",
"session",
"and",
"return",
"if",
"object",
"convert",
"and",
"return",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseSessionHolder.java#L99-L122
|
151,397
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/BaseListener.java
|
BaseListener.free
|
public void free()
{
m_dependentStateListener = null; // This doesn't have to be managed since the dependent listener HAS to be in the same record.
this.removeListener(false); // remove it (But don't free it - duh)
if (m_nextListener != null)
{ // Never - just being careful
m_nextListener.free();
m_nextListener = null;
}
}
|
java
|
public void free()
{
m_dependentStateListener = null; // This doesn't have to be managed since the dependent listener HAS to be in the same record.
this.removeListener(false); // remove it (But don't free it - duh)
if (m_nextListener != null)
{ // Never - just being careful
m_nextListener.free();
m_nextListener = null;
}
}
|
[
"public",
"void",
"free",
"(",
")",
"{",
"m_dependentStateListener",
"=",
"null",
";",
"// This doesn't have to be managed since the dependent listener HAS to be in the same record.",
"this",
".",
"removeListener",
"(",
"false",
")",
";",
"// remove it (But don't free it - duh)",
"if",
"(",
"m_nextListener",
"!=",
"null",
")",
"{",
"// Never - just being careful",
"m_nextListener",
".",
"free",
"(",
")",
";",
"m_nextListener",
"=",
"null",
";",
"}",
"}"
] |
Free this listener.
|
[
"Free",
"this",
"listener",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseListener.java#L92-L101
|
151,398
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/BaseListener.java
|
BaseListener.doAddListener
|
public void doAddListener(BaseListener listener)
{
if (m_nextListener != null)
m_nextListener.doAddListener(listener);
else
m_nextListener = listener;
}
|
java
|
public void doAddListener(BaseListener listener)
{
if (m_nextListener != null)
m_nextListener.doAddListener(listener);
else
m_nextListener = listener;
}
|
[
"public",
"void",
"doAddListener",
"(",
"BaseListener",
"listener",
")",
"{",
"if",
"(",
"m_nextListener",
"!=",
"null",
")",
"m_nextListener",
".",
"doAddListener",
"(",
"listener",
")",
";",
"else",
"m_nextListener",
"=",
"listener",
";",
"}"
] |
Add a listener to the end of the chain.
@param listener The listener to add.
|
[
"Add",
"a",
"listener",
"to",
"the",
"end",
"of",
"the",
"chain",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseListener.java#L135-L141
|
151,399
|
jbundle/jbundle
|
base/base/src/main/java/org/jbundle/base/field/BaseListener.java
|
BaseListener.removeListener
|
public void removeListener(BaseListener listener, boolean bFreeFlag)
{
if (m_nextListener != null)
{
if (m_nextListener == listener)
{
m_nextListener = listener.getNextListener();
listener.unlink(bFreeFlag); // remove theBehavior from the linked list
}
else
m_nextListener.removeListener(listener, bFreeFlag);
} // Remember to free the listener after removing it!
}
|
java
|
public void removeListener(BaseListener listener, boolean bFreeFlag)
{
if (m_nextListener != null)
{
if (m_nextListener == listener)
{
m_nextListener = listener.getNextListener();
listener.unlink(bFreeFlag); // remove theBehavior from the linked list
}
else
m_nextListener.removeListener(listener, bFreeFlag);
} // Remember to free the listener after removing it!
}
|
[
"public",
"void",
"removeListener",
"(",
"BaseListener",
"listener",
",",
"boolean",
"bFreeFlag",
")",
"{",
"if",
"(",
"m_nextListener",
"!=",
"null",
")",
"{",
"if",
"(",
"m_nextListener",
"==",
"listener",
")",
"{",
"m_nextListener",
"=",
"listener",
".",
"getNextListener",
"(",
")",
";",
"listener",
".",
"unlink",
"(",
"bFreeFlag",
")",
";",
"// remove theBehavior from the linked list",
"}",
"else",
"m_nextListener",
".",
"removeListener",
"(",
"listener",
",",
"bFreeFlag",
")",
";",
"}",
"// Remember to free the listener after removing it!",
"}"
] |
Remove a specific listener from the chain.
@param listener The listener to remove.
@param bDeleteFlag If true, free the listener.
|
[
"Remove",
"a",
"specific",
"listener",
"from",
"the",
"chain",
"."
] |
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
|
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BaseListener.java#L166-L178
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.