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
30,700
lucee/Lucee
core/src/main/java/lucee/transformer/library/tag/TagLib.java
TagLib.duplicate
public TagLib duplicate(boolean deepCopy) { TagLib tl = new TagLib(isCore); tl.appendixTags = duplicate(this.appendixTags, deepCopy); tl.displayName = this.displayName; tl.ELClass = this.ELClass; tl.exprTransformer = this.exprTransformer; tl.isCore = this.isCore; tl.nameSpace = this.nameSpace; tl.nameSpaceAndNameSpaceSeperator = this.nameSpaceAndNameSpaceSeperator; tl.nameSpaceSeperator = this.nameSpaceSeperator; tl.shortName = this.shortName; tl.tags = duplicate(this.tags, deepCopy); tl.type = this.type; tl.source = this.source; tl.ignoreUnknowTags = this.ignoreUnknowTags; return tl; }
java
public TagLib duplicate(boolean deepCopy) { TagLib tl = new TagLib(isCore); tl.appendixTags = duplicate(this.appendixTags, deepCopy); tl.displayName = this.displayName; tl.ELClass = this.ELClass; tl.exprTransformer = this.exprTransformer; tl.isCore = this.isCore; tl.nameSpace = this.nameSpace; tl.nameSpaceAndNameSpaceSeperator = this.nameSpaceAndNameSpaceSeperator; tl.nameSpaceSeperator = this.nameSpaceSeperator; tl.shortName = this.shortName; tl.tags = duplicate(this.tags, deepCopy); tl.type = this.type; tl.source = this.source; tl.ignoreUnknowTags = this.ignoreUnknowTags; return tl; }
[ "public", "TagLib", "duplicate", "(", "boolean", "deepCopy", ")", "{", "TagLib", "tl", "=", "new", "TagLib", "(", "isCore", ")", ";", "tl", ".", "appendixTags", "=", "duplicate", "(", "this", ".", "appendixTags", ",", "deepCopy", ")", ";", "tl", ".", "...
duplicate the taglib, does not @param deepCopy duplicate also the children (TagLibTag) of this TagLib @return clone of this taglib
[ "duplicate", "the", "taglib", "does", "not" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLib.java#L370-L387
30,701
lucee/Lucee
core/src/main/java/lucee/transformer/library/tag/TagLib.java
TagLib.duplicate
private HashMap<String, TagLibTag> duplicate(HashMap<String, TagLibTag> tags, boolean deepCopy) { if (deepCopy) throw new PageRuntimeException(new ExpressionException("deep copy not supported")); Iterator<Entry<String, TagLibTag>> it = tags.entrySet().iterator(); HashMap<String, TagLibTag> cm = new HashMap<String, TagLibTag>(); Entry<String, TagLibTag> entry; while (it.hasNext()) { entry = it.next(); cm.put(entry.getKey(), deepCopy ? entry.getValue() : // TODO add support for deepcopy ((TagLibTag)entry.getValue()).duplicate(deepCopy): entry.getValue()); } return cm; }
java
private HashMap<String, TagLibTag> duplicate(HashMap<String, TagLibTag> tags, boolean deepCopy) { if (deepCopy) throw new PageRuntimeException(new ExpressionException("deep copy not supported")); Iterator<Entry<String, TagLibTag>> it = tags.entrySet().iterator(); HashMap<String, TagLibTag> cm = new HashMap<String, TagLibTag>(); Entry<String, TagLibTag> entry; while (it.hasNext()) { entry = it.next(); cm.put(entry.getKey(), deepCopy ? entry.getValue() : // TODO add support for deepcopy ((TagLibTag)entry.getValue()).duplicate(deepCopy): entry.getValue()); } return cm; }
[ "private", "HashMap", "<", "String", ",", "TagLibTag", ">", "duplicate", "(", "HashMap", "<", "String", ",", "TagLibTag", ">", "tags", ",", "boolean", "deepCopy", ")", "{", "if", "(", "deepCopy", ")", "throw", "new", "PageRuntimeException", "(", "new", "Ex...
duplcate a hashmap with TagLibTag's @param tags @param deepCopy @return cloned map
[ "duplcate", "a", "hashmap", "with", "TagLibTag", "s" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/library/tag/TagLib.java#L396-L408
30,702
lucee/Lucee
core/src/main/java/lucee/commons/lang/ExceptionUtil.java
ExceptionUtil.similarKeyMessage
public static String similarKeyMessage(Collection.Key[] _keys, String keySearched, String keyLabel, String keyLabels, String in, boolean listAll) { String inThe = StringUtil.isEmpty(in, true) ? "" : " in the " + in; boolean empty = _keys.length == 0; if (listAll && (_keys.length > 50 || empty)) { listAll = false; } String list = null; if (listAll) { Arrays.sort(_keys); list = ListUtil.arrayToList(_keys, ","); } String keySearchedSoundex = StringUtil.soundex(keySearched); for (int i = 0; i < _keys.length; i++) { String k = _keys[i].getString(); if (StringUtil.soundex(k).equals(keySearchedSoundex)) { if (keySearched.equalsIgnoreCase(k)) continue; // must be a null value in a partial null-support environment String appendix; if (listAll) appendix = ". Here is a complete list of all available " + keyLabels + ": [" + list + "]."; else if (empty) appendix = ". The structure is empty"; else appendix = "."; return "The " + keyLabel + " [" + keySearched + "] does not exist" + inThe + ", but there is a similar " + keyLabel + " with name [" + _keys[i].getString() + "] available" + appendix; } } String appendix; if (listAll) appendix = ", only the following " + keyLabels + " are available: [" + list + "]."; else if (empty) appendix = ", the structure is empty"; else appendix = "."; return "The " + keyLabel + " [" + keySearched + "] does not exist" + inThe + appendix; }
java
public static String similarKeyMessage(Collection.Key[] _keys, String keySearched, String keyLabel, String keyLabels, String in, boolean listAll) { String inThe = StringUtil.isEmpty(in, true) ? "" : " in the " + in; boolean empty = _keys.length == 0; if (listAll && (_keys.length > 50 || empty)) { listAll = false; } String list = null; if (listAll) { Arrays.sort(_keys); list = ListUtil.arrayToList(_keys, ","); } String keySearchedSoundex = StringUtil.soundex(keySearched); for (int i = 0; i < _keys.length; i++) { String k = _keys[i].getString(); if (StringUtil.soundex(k).equals(keySearchedSoundex)) { if (keySearched.equalsIgnoreCase(k)) continue; // must be a null value in a partial null-support environment String appendix; if (listAll) appendix = ". Here is a complete list of all available " + keyLabels + ": [" + list + "]."; else if (empty) appendix = ". The structure is empty"; else appendix = "."; return "The " + keyLabel + " [" + keySearched + "] does not exist" + inThe + ", but there is a similar " + keyLabel + " with name [" + _keys[i].getString() + "] available" + appendix; } } String appendix; if (listAll) appendix = ", only the following " + keyLabels + " are available: [" + list + "]."; else if (empty) appendix = ", the structure is empty"; else appendix = "."; return "The " + keyLabel + " [" + keySearched + "] does not exist" + inThe + appendix; }
[ "public", "static", "String", "similarKeyMessage", "(", "Collection", ".", "Key", "[", "]", "_keys", ",", "String", "keySearched", ",", "String", "keyLabel", ",", "String", "keyLabels", ",", "String", "in", ",", "boolean", "listAll", ")", "{", "String", "inT...
creates a message for key not found with soundex check for similar key @param _keys @param keyLabel @return
[ "creates", "a", "message", "for", "key", "not", "found", "with", "soundex", "check", "for", "similar", "key" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ExceptionUtil.java#L90-L129
30,703
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/storage/WeakConstructorStorage.java
WeakConstructorStorage.getConstructors
public Constructor[] getConstructors(Class clazz, int count) { Array con; Object o; synchronized (map) { o = map.get(clazz); if (o == null) { con = store(clazz); } else con = (Array) o; } o = con.get(count + 1, null); if (o == null) return null; return (Constructor[]) o; }
java
public Constructor[] getConstructors(Class clazz, int count) { Array con; Object o; synchronized (map) { o = map.get(clazz); if (o == null) { con = store(clazz); } else con = (Array) o; } o = con.get(count + 1, null); if (o == null) return null; return (Constructor[]) o; }
[ "public", "Constructor", "[", "]", "getConstructors", "(", "Class", "clazz", ",", "int", "count", ")", "{", "Array", "con", ";", "Object", "o", ";", "synchronized", "(", "map", ")", "{", "o", "=", "map", ".", "get", "(", "clazz", ")", ";", "if", "(...
returns a constructor matching given criteria or null if Constructor doesn't exist @param clazz Class to get Constructor for @param count count of arguments for the constructor @return returns the constructors
[ "returns", "a", "constructor", "matching", "given", "criteria", "or", "null", "if", "Constructor", "doesn", "t", "exist" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/storage/WeakConstructorStorage.java#L40-L53
30,704
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/storage/WeakConstructorStorage.java
WeakConstructorStorage.store
private Array store(Class clazz) { Constructor[] conArr = clazz.getConstructors(); Array args = new ArrayImpl(); for (int i = 0; i < conArr.length; i++) { storeArgs(conArr[i], args); } map.put(clazz, args); return args; }
java
private Array store(Class clazz) { Constructor[] conArr = clazz.getConstructors(); Array args = new ArrayImpl(); for (int i = 0; i < conArr.length; i++) { storeArgs(conArr[i], args); } map.put(clazz, args); return args; }
[ "private", "Array", "store", "(", "Class", "clazz", ")", "{", "Constructor", "[", "]", "conArr", "=", "clazz", ".", "getConstructors", "(", ")", ";", "Array", "args", "=", "new", "ArrayImpl", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i...
stores the constructors for a Class @param clazz @return stored structure
[ "stores", "the", "constructors", "for", "a", "Class" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/storage/WeakConstructorStorage.java#L61-L70
30,705
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/storage/WeakConstructorStorage.java
WeakConstructorStorage.storeArgs
private void storeArgs(Constructor constructor, Array conArgs) { Class[] pmt = constructor.getParameterTypes(); Object o = conArgs.get(pmt.length + 1, null); Constructor[] args; if (o == null) { args = new Constructor[1]; conArgs.setEL(pmt.length + 1, args); } else { Constructor[] cs = (Constructor[]) o; args = new Constructor[cs.length + 1]; for (int i = 0; i < cs.length; i++) { args[i] = cs[i]; } conArgs.setEL(pmt.length + 1, args); } args[args.length - 1] = constructor; }
java
private void storeArgs(Constructor constructor, Array conArgs) { Class[] pmt = constructor.getParameterTypes(); Object o = conArgs.get(pmt.length + 1, null); Constructor[] args; if (o == null) { args = new Constructor[1]; conArgs.setEL(pmt.length + 1, args); } else { Constructor[] cs = (Constructor[]) o; args = new Constructor[cs.length + 1]; for (int i = 0; i < cs.length; i++) { args[i] = cs[i]; } conArgs.setEL(pmt.length + 1, args); } args[args.length - 1] = constructor; }
[ "private", "void", "storeArgs", "(", "Constructor", "constructor", ",", "Array", "conArgs", ")", "{", "Class", "[", "]", "pmt", "=", "constructor", ".", "getParameterTypes", "(", ")", ";", "Object", "o", "=", "conArgs", ".", "get", "(", "pmt", ".", "leng...
seperate and store the different arguments of one constructor @param constructor @param conArgs
[ "seperate", "and", "store", "the", "different", "arguments", "of", "one", "constructor" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/storage/WeakConstructorStorage.java#L78-L96
30,706
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Search.java
Search.release
@Override public void release() { super.release(); type = SearchCollection.SEARCH_TYPE_SIMPLE; maxrows = -1; criteria = ""; startrow = 1; collections = null; category = EMPTY; categoryTree = ""; status = null; suggestions = SUGGESTIONS_NEVER; contextPassages = 0; contextBytes = 300; contextHighlightBegin = "<b>"; contextHighlightEnd = "</b>"; previousCriteria = null; // spellCheckMaxLevel=10; // result=null; }
java
@Override public void release() { super.release(); type = SearchCollection.SEARCH_TYPE_SIMPLE; maxrows = -1; criteria = ""; startrow = 1; collections = null; category = EMPTY; categoryTree = ""; status = null; suggestions = SUGGESTIONS_NEVER; contextPassages = 0; contextBytes = 300; contextHighlightBegin = "<b>"; contextHighlightEnd = "</b>"; previousCriteria = null; // spellCheckMaxLevel=10; // result=null; }
[ "@", "Override", "public", "void", "release", "(", ")", "{", "super", ".", "release", "(", ")", ";", "type", "=", "SearchCollection", ".", "SEARCH_TYPE_SIMPLE", ";", "maxrows", "=", "-", "1", ";", "criteria", "=", "\"\"", ";", "startrow", "=", "1", ";"...
private String result=null;
[ "private", "String", "result", "=", "null", ";" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Search.java#L89-L111
30,707
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Search.java
Search.setType
public void setType(String type) throws ApplicationException { if (type == null) return; type = type.toLowerCase().trim(); if (type.equals("simple")) this.type = SearchCollection.SEARCH_TYPE_SIMPLE; else if (type.equals("explicit")) this.type = SearchCollection.SEARCH_TYPE_EXPLICIT; else throw new ApplicationException("attribute type of tag search has an invalid value, valid values are [simple,explicit] now is [" + type + "]"); }
java
public void setType(String type) throws ApplicationException { if (type == null) return; type = type.toLowerCase().trim(); if (type.equals("simple")) this.type = SearchCollection.SEARCH_TYPE_SIMPLE; else if (type.equals("explicit")) this.type = SearchCollection.SEARCH_TYPE_EXPLICIT; else throw new ApplicationException("attribute type of tag search has an invalid value, valid values are [simple,explicit] now is [" + type + "]"); }
[ "public", "void", "setType", "(", "String", "type", ")", "throws", "ApplicationException", "{", "if", "(", "type", "==", "null", ")", "return", ";", "type", "=", "type", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "type", "."...
set the value type Specifies the criteria type for the search. @param type value to set @throws ApplicationException
[ "set", "the", "value", "type", "Specifies", "the", "criteria", "type", "for", "the", "search", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Search.java#L119-L126
30,708
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Search.java
Search.setCollection
public void setCollection(String collection) throws PageException { String[] collNames = ListUtil.toStringArrayTrim(ListUtil.listToArrayRemoveEmpty(collection, ',')); collections = new SearchCollection[collNames.length]; SearchEngine se = pageContext.getConfig().getSearchEngine(pageContext); try { for (int i = 0; i < collections.length; i++) { collections[i] = se.getCollectionByName(collNames[i]); } } catch (SearchException e) { collections = null; throw Caster.toPageException(e); } }
java
public void setCollection(String collection) throws PageException { String[] collNames = ListUtil.toStringArrayTrim(ListUtil.listToArrayRemoveEmpty(collection, ',')); collections = new SearchCollection[collNames.length]; SearchEngine se = pageContext.getConfig().getSearchEngine(pageContext); try { for (int i = 0; i < collections.length; i++) { collections[i] = se.getCollectionByName(collNames[i]); } } catch (SearchException e) { collections = null; throw Caster.toPageException(e); } }
[ "public", "void", "setCollection", "(", "String", "collection", ")", "throws", "PageException", "{", "String", "[", "]", "collNames", "=", "ListUtil", ".", "toStringArrayTrim", "(", "ListUtil", ".", "listToArrayRemoveEmpty", "(", "collection", ",", "'", "'", ")"...
set the value collection The logical collection name that is the target of the search operation or an external collection with fully qualified path. @param collection value to set @throws PageException
[ "set", "the", "value", "collection", "The", "logical", "collection", "name", "that", "is", "the", "target", "of", "the", "search", "operation", "or", "an", "external", "collection", "with", "fully", "qualified", "path", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Search.java#L164-L177
30,709
lucee/Lucee
core/src/main/java/lucee/runtime/type/QueryColumnUtil.java
QueryColumnUtil.reDefineType
protected static Object reDefineType(QueryColumnImpl column, Object value) { column.typeChecked = false; if (value == null || column.type == Types.OTHER) return value; if (value instanceof String && ((String) value).isEmpty()) return value; switch (column.type) { // Numeric Values case Types.DOUBLE: return reDefineDouble(column, value); case Types.BIGINT: return reDefineDecimal(column, value); case Types.NUMERIC: return reDefineDouble(column, value); case Types.INTEGER: return reDefineInteger(column, value); case Types.TINYINT: return reDefineTinyInt(column, value); case Types.FLOAT: return reDefineFloat(column, value); case Types.DECIMAL: return reDefineDecimal(column, value); case Types.REAL: return reDefineFloat(column, value); case Types.SMALLINT: return reDefineShort(column, value); // DateTime Values case Types.TIMESTAMP: return reDefineDateTime(column, value); case Types.DATE: return reDefineDateTime(column, value); case Types.TIME: return reDefineDateTime(column, value); // Char case Types.CHAR: return reDefineString(column, value); case Types.VARCHAR: return reDefineString(column, value); case Types.LONGVARCHAR: return reDefineString(column, value); case Types.CLOB: return reDefineClob(column, value); // Boolean case Types.BOOLEAN: return reDefineBoolean(column, value); case Types.BIT: return reDefineBoolean(column, value); // Binary case Types.BINARY: return reDefineBinary(column, value); case Types.VARBINARY: return reDefineBinary(column, value); case Types.LONGVARBINARY: return reDefineBinary(column, value); case Types.BLOB: return reDefineBlob(column, value); // Others case Types.ARRAY: return reDefineOther(column, value); case Types.DATALINK: return reDefineOther(column, value); case Types.DISTINCT: return reDefineOther(column, value); case Types.JAVA_OBJECT: return reDefineOther(column, value); case Types.NULL: return reDefineOther(column, value); case Types.STRUCT: return reDefineOther(column, value); case Types.REF: return reDefineOther(column, value); default: return value; } }
java
protected static Object reDefineType(QueryColumnImpl column, Object value) { column.typeChecked = false; if (value == null || column.type == Types.OTHER) return value; if (value instanceof String && ((String) value).isEmpty()) return value; switch (column.type) { // Numeric Values case Types.DOUBLE: return reDefineDouble(column, value); case Types.BIGINT: return reDefineDecimal(column, value); case Types.NUMERIC: return reDefineDouble(column, value); case Types.INTEGER: return reDefineInteger(column, value); case Types.TINYINT: return reDefineTinyInt(column, value); case Types.FLOAT: return reDefineFloat(column, value); case Types.DECIMAL: return reDefineDecimal(column, value); case Types.REAL: return reDefineFloat(column, value); case Types.SMALLINT: return reDefineShort(column, value); // DateTime Values case Types.TIMESTAMP: return reDefineDateTime(column, value); case Types.DATE: return reDefineDateTime(column, value); case Types.TIME: return reDefineDateTime(column, value); // Char case Types.CHAR: return reDefineString(column, value); case Types.VARCHAR: return reDefineString(column, value); case Types.LONGVARCHAR: return reDefineString(column, value); case Types.CLOB: return reDefineClob(column, value); // Boolean case Types.BOOLEAN: return reDefineBoolean(column, value); case Types.BIT: return reDefineBoolean(column, value); // Binary case Types.BINARY: return reDefineBinary(column, value); case Types.VARBINARY: return reDefineBinary(column, value); case Types.LONGVARBINARY: return reDefineBinary(column, value); case Types.BLOB: return reDefineBlob(column, value); // Others case Types.ARRAY: return reDefineOther(column, value); case Types.DATALINK: return reDefineOther(column, value); case Types.DISTINCT: return reDefineOther(column, value); case Types.JAVA_OBJECT: return reDefineOther(column, value); case Types.NULL: return reDefineOther(column, value); case Types.STRUCT: return reDefineOther(column, value); case Types.REF: return reDefineOther(column, value); default: return value; } }
[ "protected", "static", "Object", "reDefineType", "(", "QueryColumnImpl", "column", ",", "Object", "value", ")", "{", "column", ".", "typeChecked", "=", "false", ";", "if", "(", "value", "==", "null", "||", "column", ".", "type", "==", "Types", ".", "OTHER"...
redefine type of value @param value @return redefined type of the value
[ "redefine", "type", "of", "value" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/QueryColumnUtil.java#L48-L128
30,710
lucee/Lucee
core/src/main/java/lucee/runtime/type/QueryColumnUtil.java
QueryColumnUtil.reOrganizeType
protected static void reOrganizeType(QueryColumnImpl column) { if ((column.type == Types.OTHER) && !column.typeChecked) { column.typeChecked = true; if (column.size() > 0) { checkOther(column, column.data[0]); // get Type for (int i = 1; i < column.size(); i++) { switch (column.type) { case Types.NULL: checkOther(column, column.data[i]); break; case Types.TIMESTAMP: checkDate(column, column.data[i]); break; // case Types.DATE:checkDate(column.data[i]);break; case Types.BOOLEAN: checkBoolean(column, column.data[i]); break; case Types.DOUBLE: checkDouble(column, column.data[i]); break; case Types.VARCHAR: checkBasic(column, column.data[i]); break; default: break; } } } } }
java
protected static void reOrganizeType(QueryColumnImpl column) { if ((column.type == Types.OTHER) && !column.typeChecked) { column.typeChecked = true; if (column.size() > 0) { checkOther(column, column.data[0]); // get Type for (int i = 1; i < column.size(); i++) { switch (column.type) { case Types.NULL: checkOther(column, column.data[i]); break; case Types.TIMESTAMP: checkDate(column, column.data[i]); break; // case Types.DATE:checkDate(column.data[i]);break; case Types.BOOLEAN: checkBoolean(column, column.data[i]); break; case Types.DOUBLE: checkDouble(column, column.data[i]); break; case Types.VARCHAR: checkBasic(column, column.data[i]); break; default: break; } } } } }
[ "protected", "static", "void", "reOrganizeType", "(", "QueryColumnImpl", "column", ")", "{", "if", "(", "(", "column", ".", "type", "==", "Types", ".", "OTHER", ")", "&&", "!", "column", ".", "typeChecked", ")", "{", "column", ".", "typeChecked", "=", "t...
reorganize type of a column @param reorganize
[ "reorganize", "type", "of", "a", "column" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/QueryColumnUtil.java#L225-L256
30,711
lucee/Lucee
core/src/main/java/lucee/runtime/functions/string/Wrap.java
Wrap.wrap
public static String wrap(String str, int wrapTextLength) { if (wrapTextLength <= 0) return str; StringBuilder rtn = new StringBuilder(); String ls = SystemUtil.getOSSpecificLineSeparator(); Array arr = ListUtil.listToArray(str, ls); int len = arr.size(); for (int i = 1; i <= len; i++) { rtn.append(wrapLine(Caster.toString(arr.get(i, ""), ""), wrapTextLength)); if (i + 1 < len) rtn.append(ls); } return rtn.toString(); }
java
public static String wrap(String str, int wrapTextLength) { if (wrapTextLength <= 0) return str; StringBuilder rtn = new StringBuilder(); String ls = SystemUtil.getOSSpecificLineSeparator(); Array arr = ListUtil.listToArray(str, ls); int len = arr.size(); for (int i = 1; i <= len; i++) { rtn.append(wrapLine(Caster.toString(arr.get(i, ""), ""), wrapTextLength)); if (i + 1 < len) rtn.append(ls); } return rtn.toString(); }
[ "public", "static", "String", "wrap", "(", "String", "str", ",", "int", "wrapTextLength", ")", "{", "if", "(", "wrapTextLength", "<=", "0", ")", "return", "str", ";", "StringBuilder", "rtn", "=", "new", "StringBuilder", "(", ")", ";", "String", "ls", "="...
wraps a String to specified length @param str string to erap @param wrapTextLength @return wraped String
[ "wraps", "a", "String", "to", "specified", "length" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/functions/string/Wrap.java#L56-L69
30,712
lucee/Lucee
core/src/main/java/lucee/transformer/cfml/evaluator/EvaluatorSupport.java
EvaluatorSupport.execute
@Override public TagLib execute(Config config, Tag tag, TagLibTag libTag, FunctionLib[] flibs, Data data) throws TemplateException { return null; }
java
@Override public TagLib execute(Config config, Tag tag, TagLibTag libTag, FunctionLib[] flibs, Data data) throws TemplateException { return null; }
[ "@", "Override", "public", "TagLib", "execute", "(", "Config", "config", ",", "Tag", "tag", ",", "TagLibTag", "libTag", ",", "FunctionLib", "[", "]", "flibs", ",", "Data", "data", ")", "throws", "TemplateException", "{", "return", "null", ";", "}" ]
Die Methode execute wird aufgerufen, wenn der Context eines Tags geprueft werden soll. Diese Methode ueberschreibt, jene des Interface Evaluator. Falls diese Methode durch eine Implementation nicht ueberschrieben wird, ruft sie wiederere, allenfalls implementierte evaluate Methoden auf. Mit Hilfe dieses Konstrukt ist es moeglich drei evaluate methoden anzubieten. @param cfxdTag Das konkrete Tag innerhalb der kompletten CFXD. @param libTag Die Definition des Tag aus der TLD. @param flibs Saemtliche Function Library Deskriptoren des aktuellen Tag Libray Deskriptors. @param srcCode @return TagLib @throws TemplateException
[ "Die", "Methode", "execute", "wird", "aufgerufen", "wenn", "der", "Context", "eines", "Tags", "geprueft", "werden", "soll", ".", "Diese", "Methode", "ueberschreibt", "jene", "des", "Interface", "Evaluator", ".", "Falls", "diese", "Methode", "durch", "eine", "Imp...
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/evaluator/EvaluatorSupport.java#L52-L56
30,713
lucee/Lucee
core/src/main/java/lucee/transformer/cfml/evaluator/EvaluatorSupport.java
EvaluatorSupport.evaluate
@Override public void evaluate(Tag tag, TagLibTag libTag, FunctionLib[] flibs) throws EvaluatorException { evaluate(tag); evaluate(tag, libTag); }
java
@Override public void evaluate(Tag tag, TagLibTag libTag, FunctionLib[] flibs) throws EvaluatorException { evaluate(tag); evaluate(tag, libTag); }
[ "@", "Override", "public", "void", "evaluate", "(", "Tag", "tag", ",", "TagLibTag", "libTag", ",", "FunctionLib", "[", "]", "flibs", ")", "throws", "EvaluatorException", "{", "evaluate", "(", "tag", ")", ";", "evaluate", "(", "tag", ",", "libTag", ")", "...
Die Methode evaluate wird aufgerufen, wenn der Context eines Tags geprueft werden soll. Diese Methode ueberschreibt, jene des Interface Evaluator. Falls diese Methode durch eine Implementation nicht ueberschrieben wird, ruft sie wiederere, allenfalls implementierte evaluate Methoden auf. Mit Hilfe dieses Konstrukt ist es moeglich drei evaluate methoden anzubieten. @param cfxdTag Das konkrete Tag innerhalb der kompletten CFXD. @param libTag Die Definition des Tag aus der TLD. @param flibs Saemtliche Function Library Deskriptoren des aktuellen Tag Libray Deskriptors. @throws EvaluatorException
[ "Die", "Methode", "evaluate", "wird", "aufgerufen", "wenn", "der", "Context", "eines", "Tags", "geprueft", "werden", "soll", ".", "Diese", "Methode", "ueberschreibt", "jene", "des", "Interface", "Evaluator", ".", "Falls", "diese", "Methode", "durch", "eine", "Im...
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/cfml/evaluator/EvaluatorSupport.java#L69-L73
30,714
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.getElement
public Element getElement(NodeList list, String key, String value) { int len = list.getLength(); for (int i = 0; i < len; i++) { Node n = list.item(i); if (n instanceof Element) { Element el = (Element) n; if (el.getAttribute(key).equalsIgnoreCase(value)) return el; } } return null; }
java
public Element getElement(NodeList list, String key, String value) { int len = list.getLength(); for (int i = 0; i < len; i++) { Node n = list.item(i); if (n instanceof Element) { Element el = (Element) n; if (el.getAttribute(key).equalsIgnoreCase(value)) return el; } } return null; }
[ "public", "Element", "getElement", "(", "NodeList", "list", ",", "String", "key", ",", "String", "value", ")", "{", "int", "len", "=", "list", ".", "getLength", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++"...
return XML Element matching name @param list source node list @param key key to compare @param value value to compare @return matching XML Element
[ "return", "XML", "Element", "matching", "name" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L88-L98
30,715
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.toDateTime
public DateTime toDateTime(Config config, Element el, String attributeName) { String str = el.getAttribute(attributeName); if (str == null) return null; return DateCaster.toDateAdvanced(str, ThreadLocalPageContext.getTimeZone(config), null); }
java
public DateTime toDateTime(Config config, Element el, String attributeName) { String str = el.getAttribute(attributeName); if (str == null) return null; return DateCaster.toDateAdvanced(str, ThreadLocalPageContext.getTimeZone(config), null); }
[ "public", "DateTime", "toDateTime", "(", "Config", "config", ",", "Element", "el", ",", "String", "attributeName", ")", "{", "String", "str", "=", "el", ".", "getAttribute", "(", "attributeName", ")", ";", "if", "(", "str", "==", "null", ")", "return", "...
reads a XML Element Attribute ans cast it to a DateTime Object @param config @param el XML Element to read Attribute from it @param attributeName Name of the Attribute to read @return Attribute Value
[ "reads", "a", "XML", "Element", "Attribute", "ans", "cast", "it", "to", "a", "DateTime", "Object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L243-L247
30,716
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.toDateTime
public DateTime toDateTime(Element el, String attributeName, DateTime defaultValue) { String value = el.getAttribute(attributeName); if (value == null) return defaultValue; DateTime dtValue = Caster.toDate(value, false, null, null); if (dtValue == null) return defaultValue; return dtValue; }
java
public DateTime toDateTime(Element el, String attributeName, DateTime defaultValue) { String value = el.getAttribute(attributeName); if (value == null) return defaultValue; DateTime dtValue = Caster.toDate(value, false, null, null); if (dtValue == null) return defaultValue; return dtValue; }
[ "public", "DateTime", "toDateTime", "(", "Element", "el", ",", "String", "attributeName", ",", "DateTime", "defaultValue", ")", "{", "String", "value", "=", "el", ".", "getAttribute", "(", "attributeName", ")", ";", "if", "(", "value", "==", "null", ")", "...
reads a XML Element Attribute ans cast it to a DateTime @param el XML Element to read Attribute from it @param attributeName Name of the Attribute to read @param defaultValue if attribute doesn't exist return default value @return Attribute Value
[ "reads", "a", "XML", "Element", "Attribute", "ans", "cast", "it", "to", "a", "DateTime" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L257-L264
30,717
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.toDate
public Date toDate(Config config, Element el, String attributeName) { DateTime dt = toDateTime(config, el, attributeName); if (dt == null) return null; return new DateImpl(dt); }
java
public Date toDate(Config config, Element el, String attributeName) { DateTime dt = toDateTime(config, el, attributeName); if (dt == null) return null; return new DateImpl(dt); }
[ "public", "Date", "toDate", "(", "Config", "config", ",", "Element", "el", ",", "String", "attributeName", ")", "{", "DateTime", "dt", "=", "toDateTime", "(", "config", ",", "el", ",", "attributeName", ")", ";", "if", "(", "dt", "==", "null", ")", "ret...
reads a XML Element Attribute ans cast it to a Date Object @param el XML Element to read Attribute from it @param attributeName Name of the Attribute to read @return Attribute Value
[ "reads", "a", "XML", "Element", "Attribute", "ans", "cast", "it", "to", "a", "Date", "Object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L273-L277
30,718
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.toTime
public Time toTime(Config config, Element el, String attributeName) { DateTime dt = toDateTime(config, el, attributeName); if (dt == null) return null; return new TimeImpl(dt); }
java
public Time toTime(Config config, Element el, String attributeName) { DateTime dt = toDateTime(config, el, attributeName); if (dt == null) return null; return new TimeImpl(dt); }
[ "public", "Time", "toTime", "(", "Config", "config", ",", "Element", "el", ",", "String", "attributeName", ")", "{", "DateTime", "dt", "=", "toDateTime", "(", "config", ",", "el", ",", "attributeName", ")", ";", "if", "(", "dt", "==", "null", ")", "ret...
reads a XML Element Attribute ans cast it to a Time Object @param config @param el XML Element to read Attribute from it @param attributeName Name of the Attribute to read @return Attribute Value
[ "reads", "a", "XML", "Element", "Attribute", "ans", "cast", "it", "to", "a", "Time", "Object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L299-L303
30,719
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.toCredentials
public Credentials toCredentials(Element el, String attributeUser, String attributePassword, Credentials defaultCredentials) { String user = el.getAttribute(attributeUser); String pass = el.getAttribute(attributePassword); if (user == null) return defaultCredentials; if (pass == null) pass = ""; return CredentialsImpl.toCredentials(user, pass); }
java
public Credentials toCredentials(Element el, String attributeUser, String attributePassword, Credentials defaultCredentials) { String user = el.getAttribute(attributeUser); String pass = el.getAttribute(attributePassword); if (user == null) return defaultCredentials; if (pass == null) pass = ""; return CredentialsImpl.toCredentials(user, pass); }
[ "public", "Credentials", "toCredentials", "(", "Element", "el", ",", "String", "attributeUser", ",", "String", "attributePassword", ",", "Credentials", "defaultCredentials", ")", "{", "String", "user", "=", "el", ".", "getAttribute", "(", "attributeUser", ")", ";"...
reads 2 XML Element Attribute ans cast it to a Credential @param el XML Element to read Attribute from it @param attributeUser Name of the user Attribute to read @param attributePassword Name of the password Attribute to read @param defaultCredentials @return Attribute Value
[ "reads", "2", "XML", "Element", "Attribute", "ans", "cast", "it", "to", "a", "Credential" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L342-L348
30,720
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.setString
public void setString(Element el, String key, String value) { if (value != null) el.setAttribute(key, value); }
java
public void setString(Element el, String key, String value) { if (value != null) el.setAttribute(key, value); }
[ "public", "void", "setString", "(", "Element", "el", ",", "String", "key", ",", "String", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "el", ".", "setAttribute", "(", "key", ",", "value", ")", ";", "}" ]
sets a string value to a XML Element @param el Element to set value on it @param key key to set @param value value to set
[ "sets", "a", "string", "value", "to", "a", "XML", "Element" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L357-L359
30,721
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.setBoolean
public void setBoolean(Element el, String key, boolean value) { el.setAttribute(key, String.valueOf(value)); }
java
public void setBoolean(Element el, String key, boolean value) { el.setAttribute(key, String.valueOf(value)); }
[ "public", "void", "setBoolean", "(", "Element", "el", ",", "String", "key", ",", "boolean", "value", ")", "{", "el", ".", "setAttribute", "(", "key", ",", "String", ".", "valueOf", "(", "value", ")", ")", ";", "}" ]
sets a boolean value to a XML Element @param el Element to set value on it @param key key to set @param value value to set
[ "sets", "a", "boolean", "value", "to", "a", "XML", "Element" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L390-L392
30,722
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.setInt
public void setInt(Element el, String key, int value) { el.setAttribute(key, String.valueOf(value)); }
java
public void setInt(Element el, String key, int value) { el.setAttribute(key, String.valueOf(value)); }
[ "public", "void", "setInt", "(", "Element", "el", ",", "String", "key", ",", "int", "value", ")", "{", "el", ".", "setAttribute", "(", "key", ",", "String", ".", "valueOf", "(", "value", ")", ")", ";", "}" ]
sets a int value to a XML Element @param el Element to set value on it @param key key to set @param value value to set
[ "sets", "a", "int", "value", "to", "a", "XML", "Element" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L401-L403
30,723
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.setDateTime
public void setDateTime(Element el, String key, DateTime value) { if (value != null) { String str = value.castToString(null); if (str != null) el.setAttribute(key, str); } }
java
public void setDateTime(Element el, String key, DateTime value) { if (value != null) { String str = value.castToString(null); if (str != null) el.setAttribute(key, str); } }
[ "public", "void", "setDateTime", "(", "Element", "el", ",", "String", "key", ",", "DateTime", "value", ")", "{", "if", "(", "value", "!=", "null", ")", "{", "String", "str", "=", "value", ".", "castToString", "(", "null", ")", ";", "if", "(", "str", ...
sets a datetime value to a XML Element @param el Element to set value on it @param key key to set @param value value to set
[ "sets", "a", "datetime", "value", "to", "a", "XML", "Element" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L412-L417
30,724
lucee/Lucee
core/src/main/java/lucee/runtime/schedule/StorageUtil.java
StorageUtil.setCredentials
public void setCredentials(Element el, String username, String password, Credentials c) { if (c == null) return; if (c.getUsername() != null) el.setAttribute(username, c.getUsername()); if (c.getPassword() != null) el.setAttribute(password, c.getPassword()); }
java
public void setCredentials(Element el, String username, String password, Credentials c) { if (c == null) return; if (c.getUsername() != null) el.setAttribute(username, c.getUsername()); if (c.getPassword() != null) el.setAttribute(password, c.getPassword()); }
[ "public", "void", "setCredentials", "(", "Element", "el", ",", "String", "username", ",", "String", "password", ",", "Credentials", "c", ")", "{", "if", "(", "c", "==", "null", ")", "return", ";", "if", "(", "c", ".", "getUsername", "(", ")", "!=", "...
sets a Credentials to a XML Element @param el @param username @param password @param credentials
[ "sets", "a", "Credentials", "to", "a", "XML", "Element" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/schedule/StorageUtil.java#L427-L431
30,725
lucee/Lucee
core/src/main/java/lucee/commons/lang/ParserString.java
ParserString.removeSpace
public boolean removeSpace() { int start = pos; while (pos < text.length && lcText[pos] == ' ') { pos++; } return (start < pos); }
java
public boolean removeSpace() { int start = pos; while (pos < text.length && lcText[pos] == ' ') { pos++; } return (start < pos); }
[ "public", "boolean", "removeSpace", "(", ")", "{", "int", "start", "=", "pos", ";", "while", "(", "pos", "<", "text", ".", "length", "&&", "lcText", "[", "pos", "]", "==", "'", "'", ")", "{", "pos", "++", ";", "}", "return", "(", "start", "<", ...
Stellt den Zeiger nach vorne, wenn er sich innerhalb von Leerzeichen befindet, bis die Leerzeichen fertig sind. @return Gibt zurueck ob der Zeiger innerhalb von Leerzeichen war oder nicht.
[ "Stellt", "den", "Zeiger", "nach", "vorne", "wenn", "er", "sich", "innerhalb", "von", "Leerzeichen", "befindet", "bis", "die", "Leerzeichen", "fertig", "sind", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ParserString.java#L669-L675
30,726
lucee/Lucee
core/src/main/java/lucee/commons/lang/ParserString.java
ParserString.subCFMLString
public ParserString subCFMLString(int start, int count) { return new ParserString(String.valueOf(text, start, count)); /* * NICE die untermenge direkter ermiiteln, das problem hierbei sind die lines * * int endPos=start+count; int LineFrom=-1; int LineTo=-1; for(int i=0;i<lines.length;i++) { if() } * * return new CFMLString( 0, String.valueOf(text,start,count).toCharArray(), * String.valueOf(lcText,start,count).toCharArray(), lines); */ }
java
public ParserString subCFMLString(int start, int count) { return new ParserString(String.valueOf(text, start, count)); /* * NICE die untermenge direkter ermiiteln, das problem hierbei sind die lines * * int endPos=start+count; int LineFrom=-1; int LineTo=-1; for(int i=0;i<lines.length;i++) { if() } * * return new CFMLString( 0, String.valueOf(text,start,count).toCharArray(), * String.valueOf(lcText,start,count).toCharArray(), lines); */ }
[ "public", "ParserString", "subCFMLString", "(", "int", "start", ",", "int", "count", ")", "{", "return", "new", "ParserString", "(", "String", ".", "valueOf", "(", "text", ",", "start", ",", "count", ")", ")", ";", "/*\n\t * NICE die untermenge direkter ermiitel...
Gibt eine Untermenge des CFMLString als CFMLString zurueck, ausgehend von start mit einer maximalen Laenge count. @param start Von wo aus die Untermenge ausgegeben werden soll. @param count Wie lange die zurueckgegebene Zeichenkette maximal sein darf. @return Untermenge als CFMLString
[ "Gibt", "eine", "Untermenge", "des", "CFMLString", "als", "CFMLString", "zurueck", "ausgehend", "von", "start", "mit", "einer", "maximalen", "Laenge", "count", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/ParserString.java#L765-L775
30,727
lucee/Lucee
core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java
CFMLEngineImpl.getInstance
public static synchronized CFMLEngine getInstance(CFMLEngineFactory factory, BundleCollection bc) { if (engine == null) { if (SystemUtil.getLoaderVersion() < 6.0D) { // windows needs 6.0 because restart is not working with older versions if (SystemUtil.isWindows()) throw new RuntimeException("You need to update a newer lucee.jar to run this version, you can download the latest jar from http://download.lucee.org."); else if (SystemUtil.getLoaderVersion() < 5.8D) throw new RuntimeException("You need to update your lucee.jar to run this version, you can download the latest jar from http://download.lucee.org."); else if (SystemUtil.getLoaderVersion() < 5.9D) SystemOut.printDate("To use all features Lucee provides, you need to update your lucee.jar, you can download the latest jar from http://download.lucee.org."); } engine = new CFMLEngineImpl(factory, bc); } return engine; }
java
public static synchronized CFMLEngine getInstance(CFMLEngineFactory factory, BundleCollection bc) { if (engine == null) { if (SystemUtil.getLoaderVersion() < 6.0D) { // windows needs 6.0 because restart is not working with older versions if (SystemUtil.isWindows()) throw new RuntimeException("You need to update a newer lucee.jar to run this version, you can download the latest jar from http://download.lucee.org."); else if (SystemUtil.getLoaderVersion() < 5.8D) throw new RuntimeException("You need to update your lucee.jar to run this version, you can download the latest jar from http://download.lucee.org."); else if (SystemUtil.getLoaderVersion() < 5.9D) SystemOut.printDate("To use all features Lucee provides, you need to update your lucee.jar, you can download the latest jar from http://download.lucee.org."); } engine = new CFMLEngineImpl(factory, bc); } return engine; }
[ "public", "static", "synchronized", "CFMLEngine", "getInstance", "(", "CFMLEngineFactory", "factory", ",", "BundleCollection", "bc", ")", "{", "if", "(", "engine", "==", "null", ")", "{", "if", "(", "SystemUtil", ".", "getLoaderVersion", "(", ")", "<", "6.0D",...
get singelton instance of the CFML Engine @param factory @return CFMLEngine
[ "get", "singelton", "instance", "of", "the", "CFML", "Engine" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java#L592-L607
30,728
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Ldap.java
Ldap.setScope
public void setScope(String strScope) throws ApplicationException { strScope = strScope.trim().toLowerCase(); if (strScope.equals("onelevel")) scope = SearchControls.ONELEVEL_SCOPE; else if (strScope.equals("base")) scope = SearchControls.OBJECT_SCOPE; else if (strScope.equals("subtree")) scope = SearchControls.SUBTREE_SCOPE; else throw new ApplicationException("invalid value for attribute scope [" + strScope + "], valid values are [oneLevel,base,subtree]"); }
java
public void setScope(String strScope) throws ApplicationException { strScope = strScope.trim().toLowerCase(); if (strScope.equals("onelevel")) scope = SearchControls.ONELEVEL_SCOPE; else if (strScope.equals("base")) scope = SearchControls.OBJECT_SCOPE; else if (strScope.equals("subtree")) scope = SearchControls.SUBTREE_SCOPE; else throw new ApplicationException("invalid value for attribute scope [" + strScope + "], valid values are [oneLevel,base,subtree]"); }
[ "public", "void", "setScope", "(", "String", "strScope", ")", "throws", "ApplicationException", "{", "strScope", "=", "strScope", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "strScope", ".", "equals", "(", "\"onelevel\"", ")", ")",...
Specifies the scope of the search from the entry specified in the Start attribute for action = "Query". @param strScope The scope to set. @throws ApplicationException
[ "Specifies", "the", "scope", "of", "the", "search", "from", "the", "entry", "specified", "in", "the", "Start", "attribute", "for", "action", "=", "Query", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ldap.java#L218-L224
30,729
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Ldap.java
Ldap.setModifytype
public void setModifytype(String modifyType) throws ApplicationException { modifyType = modifyType.trim().toLowerCase(); if (modifyType.equals("add")) this.modifyType = DirContext.ADD_ATTRIBUTE; else if (modifyType.equals("delete")) this.modifyType = DirContext.REMOVE_ATTRIBUTE; else if (modifyType.equals("replace")) this.modifyType = DirContext.REPLACE_ATTRIBUTE; else throw new ApplicationException("invalid value for attribute modifyType [" + modifyType + "], valid values are [add,replace,delete]"); }
java
public void setModifytype(String modifyType) throws ApplicationException { modifyType = modifyType.trim().toLowerCase(); if (modifyType.equals("add")) this.modifyType = DirContext.ADD_ATTRIBUTE; else if (modifyType.equals("delete")) this.modifyType = DirContext.REMOVE_ATTRIBUTE; else if (modifyType.equals("replace")) this.modifyType = DirContext.REPLACE_ATTRIBUTE; else throw new ApplicationException("invalid value for attribute modifyType [" + modifyType + "], valid values are [add,replace,delete]"); }
[ "public", "void", "setModifytype", "(", "String", "modifyType", ")", "throws", "ApplicationException", "{", "modifyType", "=", "modifyType", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ";", "if", "(", "modifyType", ".", "equals", "(", "\"add\"", ")"...
Indicates whether to add, delete, or replace an attribute in a multi-value list of attributes. @param modifyType The modifyType to set. @throws ApplicationException
[ "Indicates", "whether", "to", "add", "delete", "or", "replace", "an", "attribute", "in", "a", "multi", "-", "value", "list", "of", "attributes", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ldap.java#L232-L238
30,730
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Ldap.java
Ldap.setSortcontrol
public void setSortcontrol(String sortControl) throws PageException { String[] sortControlArr = ArrayUtil.trim(ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(sortControl, ','))); for (int i = 0; i < sortControlArr.length; i++) { String scs = sortControlArr[i].trim().toLowerCase(); if (scs.equals("asc")) sortDirection = LDAPClient.SORT_DIRECTION_ASC; else if (scs.equals("desc")) sortDirection = LDAPClient.SORT_DIRECTION_DESC; else if (scs.equals("case")) sortType = LDAPClient.SORT_TYPE_CASE; else if (scs.equals("nocase")) sortType = LDAPClient.SORT_TYPE_NOCASE; else throw new ApplicationException("invalid value for attribute sortControl [" + sortControl + "], " + "valid values are [asc,desc,case,nocase]"); } }
java
public void setSortcontrol(String sortControl) throws PageException { String[] sortControlArr = ArrayUtil.trim(ListUtil.toStringArray(ListUtil.listToArrayRemoveEmpty(sortControl, ','))); for (int i = 0; i < sortControlArr.length; i++) { String scs = sortControlArr[i].trim().toLowerCase(); if (scs.equals("asc")) sortDirection = LDAPClient.SORT_DIRECTION_ASC; else if (scs.equals("desc")) sortDirection = LDAPClient.SORT_DIRECTION_DESC; else if (scs.equals("case")) sortType = LDAPClient.SORT_TYPE_CASE; else if (scs.equals("nocase")) sortType = LDAPClient.SORT_TYPE_NOCASE; else throw new ApplicationException("invalid value for attribute sortControl [" + sortControl + "], " + "valid values are [asc,desc,case,nocase]"); } }
[ "public", "void", "setSortcontrol", "(", "String", "sortControl", ")", "throws", "PageException", "{", "String", "[", "]", "sortControlArr", "=", "ArrayUtil", ".", "trim", "(", "ListUtil", ".", "toStringArray", "(", "ListUtil", ".", "listToArrayRemoveEmpty", "(", ...
Specifies how to sort query results. @param sortControl sortControl to set @throws PageException
[ "Specifies", "how", "to", "sort", "query", "results", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Ldap.java#L265-L276
30,731
lucee/Lucee
core/src/main/java/lucee/commons/io/res/type/ram/RamResourceCore.java
RamResourceCore.getChildNames
public String[] getChildNames() { if (children == null || children.size() == 0) return EMPTY_NAMES; String[] arr = new String[children.size()]; for (int i = 0; i < arr.length; i++) { arr[i] = ((RamResourceCore) children.get(i)).getName(); } return arr; }
java
public String[] getChildNames() { if (children == null || children.size() == 0) return EMPTY_NAMES; String[] arr = new String[children.size()]; for (int i = 0; i < arr.length; i++) { arr[i] = ((RamResourceCore) children.get(i)).getName(); } return arr; }
[ "public", "String", "[", "]", "getChildNames", "(", ")", "{", "if", "(", "children", "==", "null", "||", "children", ".", "size", "(", ")", "==", "0", ")", "return", "EMPTY_NAMES", ";", "String", "[", "]", "arr", "=", "new", "String", "[", "children"...
Gibt den Feldnamen children zurueck. @return children
[ "Gibt", "den", "Feldnamen", "children", "zurueck", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/ram/RamResourceCore.java#L93-L100
30,732
lucee/Lucee
core/src/main/java/lucee/commons/io/res/type/ram/RamResourceCore.java
RamResourceCore.getChild
public RamResourceCore getChild(String name, boolean caseSensitive) { if (children == null) return null; RamResourceCore child; for (int i = children.size() - 1; i >= 0; i--) { child = (RamResourceCore) children.get(i); if (child != null && (caseSensitive ? child.getName().equals(name) : child.getName().equalsIgnoreCase(name))) return child; } return null; }
java
public RamResourceCore getChild(String name, boolean caseSensitive) { if (children == null) return null; RamResourceCore child; for (int i = children.size() - 1; i >= 0; i--) { child = (RamResourceCore) children.get(i); if (child != null && (caseSensitive ? child.getName().equals(name) : child.getName().equalsIgnoreCase(name))) return child; } return null; }
[ "public", "RamResourceCore", "getChild", "(", "String", "name", ",", "boolean", "caseSensitive", ")", "{", "if", "(", "children", "==", "null", ")", "return", "null", ";", "RamResourceCore", "child", ";", "for", "(", "int", "i", "=", "children", ".", "size...
returns a child that match given name @param name @return matching child
[ "returns", "a", "child", "that", "match", "given", "name" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/ram/RamResourceCore.java#L204-L213
30,733
lucee/Lucee
core/src/main/java/lucee/commons/io/res/type/ram/RamResourceCore.java
RamResourceCore.removeChild
public void removeChild(RamResourceCore core) { if (children == null) return; RamResourceCore child; for (int i = children.size() - 1; i >= 0; i--) { child = (RamResourceCore) children.get(i); if (child == core) { children.remove(i); break; } } }
java
public void removeChild(RamResourceCore core) { if (children == null) return; RamResourceCore child; for (int i = children.size() - 1; i >= 0; i--) { child = (RamResourceCore) children.get(i); if (child == core) { children.remove(i); break; } } }
[ "public", "void", "removeChild", "(", "RamResourceCore", "core", ")", "{", "if", "(", "children", "==", "null", ")", "return", ";", "RamResourceCore", "child", ";", "for", "(", "int", "i", "=", "children", ".", "size", "(", ")", "-", "1", ";", "i", "...
remove given child from this core @param core
[ "remove", "given", "child", "from", "this", "core" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/ram/RamResourceCore.java#L229-L241
30,734
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java
VariableInterpreter.getVariable
public static Object getVariable(PageContext pc, Collection collection, String var) throws PageException { StringList list = parse(pc, new ParserString(var), false); if (list == null) throw new InterpreterException("invalid variable declaration [" + var + "]"); while (list.hasNextNext()) { collection = Caster.toCollection(collection.get(KeyImpl.init(list.next()))); } return collection.get(KeyImpl.init(list.next())); }
java
public static Object getVariable(PageContext pc, Collection collection, String var) throws PageException { StringList list = parse(pc, new ParserString(var), false); if (list == null) throw new InterpreterException("invalid variable declaration [" + var + "]"); while (list.hasNextNext()) { collection = Caster.toCollection(collection.get(KeyImpl.init(list.next()))); } return collection.get(KeyImpl.init(list.next())); }
[ "public", "static", "Object", "getVariable", "(", "PageContext", "pc", ",", "Collection", "collection", ",", "String", "var", ")", "throws", "PageException", "{", "StringList", "list", "=", "parse", "(", "pc", ",", "new", "ParserString", "(", "var", ")", ","...
reads a subelement from a struct @param pc @param collection @param var @return matching Object @throws PageException
[ "reads", "a", "subelement", "from", "a", "struct" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java#L58-L66
30,735
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java
VariableInterpreter.getVariableEL
public static Object getVariableEL(PageContext pc, String var, Object defaultValue) { StringList list = parse(pc, new ParserString(var), false); if (list == null) return defaultValue; int scope = scopeString2Int(pc.ignoreScopes(), list.next()); Object coll = null; if (scope == Scope.SCOPE_UNDEFINED) { coll = pc.undefinedScope().get(KeyImpl.init(list.current()), NullSupportHelper.NULL()); if (coll == NullSupportHelper.NULL()) return defaultValue; } else { try { coll = VariableInterpreter.scope(pc, scope, list.hasNext()); // coll=pc.scope(scope); } catch (PageException e) { return defaultValue; } } while (list.hasNext()) { coll = pc.getVariableUtil().get(pc, coll, KeyImpl.init(list.next()), NullSupportHelper.NULL()); if (coll == NullSupportHelper.NULL()) return defaultValue; } return coll; }
java
public static Object getVariableEL(PageContext pc, String var, Object defaultValue) { StringList list = parse(pc, new ParserString(var), false); if (list == null) return defaultValue; int scope = scopeString2Int(pc.ignoreScopes(), list.next()); Object coll = null; if (scope == Scope.SCOPE_UNDEFINED) { coll = pc.undefinedScope().get(KeyImpl.init(list.current()), NullSupportHelper.NULL()); if (coll == NullSupportHelper.NULL()) return defaultValue; } else { try { coll = VariableInterpreter.scope(pc, scope, list.hasNext()); // coll=pc.scope(scope); } catch (PageException e) { return defaultValue; } } while (list.hasNext()) { coll = pc.getVariableUtil().get(pc, coll, KeyImpl.init(list.next()), NullSupportHelper.NULL()); if (coll == NullSupportHelper.NULL()) return defaultValue; } return coll; }
[ "public", "static", "Object", "getVariableEL", "(", "PageContext", "pc", ",", "String", "var", ",", "Object", "defaultValue", ")", "{", "StringList", "list", "=", "parse", "(", "pc", ",", "new", "ParserString", "(", "var", ")", ",", "false", ")", ";", "i...
get a variable from page context @param pc Page Context @param var variable string to get value to @param defaultValue value returnded if variable was not found @return the value or default value if not found
[ "get", "a", "variable", "from", "page", "context" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java#L223-L248
30,736
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java
VariableInterpreter.setVariable
public static Object setVariable(PageContext pc, String var, Object value) throws PageException { StringList list = parse(pc, new ParserString(var), false); if (list == null) throw new InterpreterException("invalid variable name declaration [" + var + "]"); if (list.size() == 1) { return pc.undefinedScope().set(list.next(), value); } // min 2 elements int scope = scopeString2Int(pc.ignoreScopes(), list.next()); Object coll; if (scope == Scope.SCOPE_UNDEFINED) { coll = pc.touch(pc.undefinedScope(), KeyImpl.init(list.current())); } else { coll = VariableInterpreter.scope(pc, scope, true); // coll=pc.scope(scope); } while (list.hasNextNext()) { coll = pc.touch(coll, KeyImpl.init(list.next())); } return pc.set(coll, KeyImpl.init(list.next()), value); }
java
public static Object setVariable(PageContext pc, String var, Object value) throws PageException { StringList list = parse(pc, new ParserString(var), false); if (list == null) throw new InterpreterException("invalid variable name declaration [" + var + "]"); if (list.size() == 1) { return pc.undefinedScope().set(list.next(), value); } // min 2 elements int scope = scopeString2Int(pc.ignoreScopes(), list.next()); Object coll; if (scope == Scope.SCOPE_UNDEFINED) { coll = pc.touch(pc.undefinedScope(), KeyImpl.init(list.current())); } else { coll = VariableInterpreter.scope(pc, scope, true); // coll=pc.scope(scope); } while (list.hasNextNext()) { coll = pc.touch(coll, KeyImpl.init(list.next())); } return pc.set(coll, KeyImpl.init(list.next()), value); }
[ "public", "static", "Object", "setVariable", "(", "PageContext", "pc", ",", "String", "var", ",", "Object", "value", ")", "throws", "PageException", "{", "StringList", "list", "=", "parse", "(", "pc", ",", "new", "ParserString", "(", "var", ")", ",", "fals...
sets a variable to page Context @param pc pagecontext of the new variable @param var String of variable definition @param value value to set to variable @return value setted @throws PageException
[ "sets", "a", "variable", "to", "page", "Context" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java#L361-L384
30,737
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java
VariableInterpreter.removeVariable
public static Object removeVariable(PageContext pc, String var) throws PageException { // print.ln("var:"+var); StringList list = parse(pc, new ParserString(var), false); if (list == null) throw new InterpreterException("invalid variable declaration [" + var + "]"); if (list.size() == 1) { return pc.undefinedScope().remove(KeyImpl.init(list.next())); } int scope = scopeString2Int(pc.ignoreScopes(), list.next()); Object coll; if (scope == Scope.SCOPE_UNDEFINED) { coll = pc.undefinedScope().get(list.current()); } else { coll = VariableInterpreter.scope(pc, scope, true); // coll=pc.scope(scope); } while (list.hasNextNext()) { coll = pc.get(coll, list.next()); } return Caster.toCollection(coll).remove(KeyImpl.init(list.next())); }
java
public static Object removeVariable(PageContext pc, String var) throws PageException { // print.ln("var:"+var); StringList list = parse(pc, new ParserString(var), false); if (list == null) throw new InterpreterException("invalid variable declaration [" + var + "]"); if (list.size() == 1) { return pc.undefinedScope().remove(KeyImpl.init(list.next())); } int scope = scopeString2Int(pc.ignoreScopes(), list.next()); Object coll; if (scope == Scope.SCOPE_UNDEFINED) { coll = pc.undefinedScope().get(list.current()); } else { coll = VariableInterpreter.scope(pc, scope, true); // coll=pc.scope(scope); } while (list.hasNextNext()) { coll = pc.get(coll, list.next()); } return Caster.toCollection(coll).remove(KeyImpl.init(list.next())); }
[ "public", "static", "Object", "removeVariable", "(", "PageContext", "pc", ",", "String", "var", ")", "throws", "PageException", "{", "// print.ln(\"var:\"+var);", "StringList", "list", "=", "parse", "(", "pc", ",", "new", "ParserString", "(", "var", ")", ",", ...
removes a variable eith matching name from page context @param pc @param var @return has removed or not @throws PageException
[ "removes", "a", "variable", "eith", "matching", "name", "from", "page", "context" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java#L394-L418
30,738
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java
VariableInterpreter.parse
private static StringList parse(PageContext pc, ParserString ps, boolean doLowerCase) { String id = readIdentifier(ps, doLowerCase); if (id == null) return null; StringList list = new StringList(id); CFMLExpressionInterpreter interpreter = null; while (true) { if (ps.forwardIfCurrent('.')) { id = readIdentifier(ps, doLowerCase); if (id == null) return null; list.add(id); } else if (ps.forwardIfCurrent('[')) { if (interpreter == null) interpreter = new CFMLExpressionInterpreter(false); try { list.add(Caster.toString(interpreter.interpretPart(pc, ps))); } catch (PageException e) { return null; } if (!ps.forwardIfCurrent(']')) return null; ps.removeSpace(); } else break; } if (ps.isValidIndex()) return null; list.reset(); return list; }
java
private static StringList parse(PageContext pc, ParserString ps, boolean doLowerCase) { String id = readIdentifier(ps, doLowerCase); if (id == null) return null; StringList list = new StringList(id); CFMLExpressionInterpreter interpreter = null; while (true) { if (ps.forwardIfCurrent('.')) { id = readIdentifier(ps, doLowerCase); if (id == null) return null; list.add(id); } else if (ps.forwardIfCurrent('[')) { if (interpreter == null) interpreter = new CFMLExpressionInterpreter(false); try { list.add(Caster.toString(interpreter.interpretPart(pc, ps))); } catch (PageException e) { return null; } if (!ps.forwardIfCurrent(']')) return null; ps.removeSpace(); } else break; } if (ps.isValidIndex()) return null; list.reset(); return list; }
[ "private", "static", "StringList", "parse", "(", "PageContext", "pc", ",", "ParserString", "ps", ",", "boolean", "doLowerCase", ")", "{", "String", "id", "=", "readIdentifier", "(", "ps", ",", "doLowerCase", ")", ";", "if", "(", "id", "==", "null", ")", ...
parse a Literal variable String and return result as String List @param pc Page Context @param ps ParserString to read @return Variable Definition in a String List
[ "parse", "a", "Literal", "variable", "String", "and", "return", "result", "as", "String", "List" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java#L474-L502
30,739
lucee/Lucee
core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java
VariableInterpreter.scopeString2Int
public static int scopeString2Int(boolean ignoreScope, String type) { type = StringUtil.toLowerCase(type); char c = type.charAt(0); // ignore scope only handles only reconize local,arguments as scope, the rest is ignored if (ignoreScope) { if ('a' == c) { if ("arguments".equals(type)) return Scope.SCOPE_ARGUMENTS; } else if ('l' == c) { if ("local".equals(type)) return Scope.SCOPE_LOCAL;// LLL } else if ('r' == c) { if ("request".equals(type)) return Scope.SCOPE_REQUEST; } else if ('v' == c) { if ("variables".equals(type)) return Scope.SCOPE_VARIABLES; } else if ('s' == c) { if ("server".equals(type)) return Scope.SCOPE_SERVER; } return Scope.SCOPE_UNDEFINED; } if ('a' == c) { if ("application".equals(type)) return Scope.SCOPE_APPLICATION; else if ("arguments".equals(type)) return Scope.SCOPE_ARGUMENTS; } else if ('c' == c) { if ("cgi".equals(type)) return Scope.SCOPE_CGI; if ("cookie".equals(type)) return Scope.SCOPE_COOKIE; if ("client".equals(type)) return Scope.SCOPE_CLIENT; if ("cluster".equals(type)) return Scope.SCOPE_CLUSTER; } else if ('f' == c) { if ("form".equals(type)) return Scope.SCOPE_FORM; } else if ('l' == c) { if ("local".equals(type)) return Scope.SCOPE_LOCAL;// LLL } else if ('r' == c) { if ("request".equals(type)) return Scope.SCOPE_REQUEST; } else if ('s' == c) { if ("session".equals(type)) return Scope.SCOPE_SESSION; if ("server".equals(type)) return Scope.SCOPE_SERVER; } else if ('u' == c) { if ("url".equals(type)) return Scope.SCOPE_URL; } else if ('v' == c) { if ("variables".equals(type)) return Scope.SCOPE_VARIABLES; } return Scope.SCOPE_UNDEFINED; }
java
public static int scopeString2Int(boolean ignoreScope, String type) { type = StringUtil.toLowerCase(type); char c = type.charAt(0); // ignore scope only handles only reconize local,arguments as scope, the rest is ignored if (ignoreScope) { if ('a' == c) { if ("arguments".equals(type)) return Scope.SCOPE_ARGUMENTS; } else if ('l' == c) { if ("local".equals(type)) return Scope.SCOPE_LOCAL;// LLL } else if ('r' == c) { if ("request".equals(type)) return Scope.SCOPE_REQUEST; } else if ('v' == c) { if ("variables".equals(type)) return Scope.SCOPE_VARIABLES; } else if ('s' == c) { if ("server".equals(type)) return Scope.SCOPE_SERVER; } return Scope.SCOPE_UNDEFINED; } if ('a' == c) { if ("application".equals(type)) return Scope.SCOPE_APPLICATION; else if ("arguments".equals(type)) return Scope.SCOPE_ARGUMENTS; } else if ('c' == c) { if ("cgi".equals(type)) return Scope.SCOPE_CGI; if ("cookie".equals(type)) return Scope.SCOPE_COOKIE; if ("client".equals(type)) return Scope.SCOPE_CLIENT; if ("cluster".equals(type)) return Scope.SCOPE_CLUSTER; } else if ('f' == c) { if ("form".equals(type)) return Scope.SCOPE_FORM; } else if ('l' == c) { if ("local".equals(type)) return Scope.SCOPE_LOCAL;// LLL } else if ('r' == c) { if ("request".equals(type)) return Scope.SCOPE_REQUEST; } else if ('s' == c) { if ("session".equals(type)) return Scope.SCOPE_SESSION; if ("server".equals(type)) return Scope.SCOPE_SERVER; } else if ('u' == c) { if ("url".equals(type)) return Scope.SCOPE_URL; } else if ('v' == c) { if ("variables".equals(type)) return Scope.SCOPE_VARIABLES; } return Scope.SCOPE_UNDEFINED; }
[ "public", "static", "int", "scopeString2Int", "(", "boolean", "ignoreScope", ",", "String", "type", ")", "{", "type", "=", "StringUtil", ".", "toLowerCase", "(", "type", ")", ";", "char", "c", "=", "type", ".", "charAt", "(", "0", ")", ";", "// ignore sc...
translate a string type definition to its int representation @param type type to translate @return int representation matching to given string
[ "translate", "a", "string", "type", "definition", "to", "its", "int", "representation" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/interpreter/VariableInterpreter.java#L529-L584
30,740
lucee/Lucee
core/src/main/java/lucee/runtime/PageSourcePool.java
PageSourcePool.getPageSource
public PageSource getPageSource(String key, boolean updateAccesTime) { // DO NOT CHANGE INTERFACE (used by Argus Monitor) PageSource ps = pageSources.get(key.toLowerCase()); if (ps == null) return null; if (updateAccesTime) ps.setLastAccessTime(); return ps; }
java
public PageSource getPageSource(String key, boolean updateAccesTime) { // DO NOT CHANGE INTERFACE (used by Argus Monitor) PageSource ps = pageSources.get(key.toLowerCase()); if (ps == null) return null; if (updateAccesTime) ps.setLastAccessTime(); return ps; }
[ "public", "PageSource", "getPageSource", "(", "String", "key", ",", "boolean", "updateAccesTime", ")", "{", "// DO NOT CHANGE INTERFACE (used by Argus Monitor)", "PageSource", "ps", "=", "pageSources", ".", "get", "(", "key", ".", "toLowerCase", "(", ")", ")", ";", ...
return pages matching to key @param key key for the page @param updateAccesTime define if do update access time @return page
[ "return", "pages", "matching", "to", "key" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/PageSourcePool.java#L67-L72
30,741
lucee/Lucee
core/src/main/java/lucee/runtime/PageSourcePool.java
PageSourcePool.setPage
public void setPage(String key, PageSource ps) { ps.setLastAccessTime(); pageSources.put(key.toLowerCase(), ps); }
java
public void setPage(String key, PageSource ps) { ps.setLastAccessTime(); pageSources.put(key.toLowerCase(), ps); }
[ "public", "void", "setPage", "(", "String", "key", ",", "PageSource", "ps", ")", "{", "ps", ".", "setLastAccessTime", "(", ")", ";", "pageSources", ".", "put", "(", "key", ".", "toLowerCase", "(", ")", ",", "ps", ")", ";", "}" ]
sts a page object to the page pool @param key key reference to store page object @param ps pagesource to store
[ "sts", "a", "page", "object", "to", "the", "page", "pool" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/PageSourcePool.java#L80-L84
30,742
lucee/Lucee
core/src/main/java/lucee/runtime/PageSourcePool.java
PageSourcePool.remove
public boolean remove(String key) { if (pageSources.remove(key.toLowerCase()) != null) return true; Set<String> set = pageSources.keySet(); String[] keys = set.toArray(new String[set.size()]); // done this way to avoid ConcurrentModificationException PageSource ps; for (String k: keys) { ps = pageSources.get(k); if (key.equalsIgnoreCase(ps.getClassName())) { pageSources.remove(k); return true; } } return false; }
java
public boolean remove(String key) { if (pageSources.remove(key.toLowerCase()) != null) return true; Set<String> set = pageSources.keySet(); String[] keys = set.toArray(new String[set.size()]); // done this way to avoid ConcurrentModificationException PageSource ps; for (String k: keys) { ps = pageSources.get(k); if (key.equalsIgnoreCase(ps.getClassName())) { pageSources.remove(k); return true; } } return false; }
[ "public", "boolean", "remove", "(", "String", "key", ")", "{", "if", "(", "pageSources", ".", "remove", "(", "key", ".", "toLowerCase", "(", ")", ")", "!=", "null", ")", "return", "true", ";", "Set", "<", "String", ">", "set", "=", "pageSources", "."...
removes a page from the page pool @param key key reference to page object @return page object matching to key reference
[ "removes", "a", "page", "from", "the", "page", "pool" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/PageSourcePool.java#L111-L126
30,743
lucee/Lucee
core/src/main/java/lucee/runtime/PageSourcePool.java
PageSourcePool.clearUnused
public void clearUnused(ConfigImpl config) { SystemOut.printDate(config.getOutWriter(), "PagePool: " + size() + ">(" + maxSize + ")"); if (size() > maxSize) { String[] keys = keys(); LongKeyList list = new LongKeyList(); for (int i = 0; i < keys.length; i++) { PageSource ps = getPageSource(keys[i], false); long updateTime = ps.getLastAccessTime(); if (updateTime + timeout < System.currentTimeMillis()) { long add = ((ps.getAccessCount() - 1) * 10000); if (add > timeout) add = timeout; list.add(updateTime + add, keys[i]); } } while (size() > maxSize) { Object key = list.shift(); if (key == null) break; remove(key.toString()); } } }
java
public void clearUnused(ConfigImpl config) { SystemOut.printDate(config.getOutWriter(), "PagePool: " + size() + ">(" + maxSize + ")"); if (size() > maxSize) { String[] keys = keys(); LongKeyList list = new LongKeyList(); for (int i = 0; i < keys.length; i++) { PageSource ps = getPageSource(keys[i], false); long updateTime = ps.getLastAccessTime(); if (updateTime + timeout < System.currentTimeMillis()) { long add = ((ps.getAccessCount() - 1) * 10000); if (add > timeout) add = timeout; list.add(updateTime + add, keys[i]); } } while (size() > maxSize) { Object key = list.shift(); if (key == null) break; remove(key.toString()); } } }
[ "public", "void", "clearUnused", "(", "ConfigImpl", "config", ")", "{", "SystemOut", ".", "printDate", "(", "config", ".", "getOutWriter", "(", ")", ",", "\"PagePool: \"", "+", "size", "(", ")", "+", "\">(\"", "+", "maxSize", "+", "\")\"", ")", ";", "if"...
clear unused pages from page pool
[ "clear", "unused", "pages", "from", "page", "pool" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/PageSourcePool.java#L163-L184
30,744
lucee/Lucee
core/src/main/java/lucee/runtime/PageSourcePool.java
PageSourcePool.clearPages
public void clearPages(ClassLoader cl) { Iterator<PageSource> it = this.pageSources.values().iterator(); PageSourceImpl entry; while (it.hasNext()) { entry = (PageSourceImpl) it.next(); if (cl != null) entry.clear(cl); else entry.clear(); } }
java
public void clearPages(ClassLoader cl) { Iterator<PageSource> it = this.pageSources.values().iterator(); PageSourceImpl entry; while (it.hasNext()) { entry = (PageSourceImpl) it.next(); if (cl != null) entry.clear(cl); else entry.clear(); } }
[ "public", "void", "clearPages", "(", "ClassLoader", "cl", ")", "{", "Iterator", "<", "PageSource", ">", "it", "=", "this", ".", "pageSources", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "PageSourceImpl", "entry", ";", "while", "(", "it", ...
remove all Page from Pool using this classloader @param cl
[ "remove", "all", "Page", "from", "Pool", "using", "this", "classloader" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/PageSourcePool.java#L211-L219
30,745
lucee/Lucee
core/src/main/java/lucee/commons/img/Captcha.java
Captcha.writeOut
public static void writeOut(BufferedImage image, OutputStream os, String format) throws IOException { ImageIO.write(image, format, os); }
java
public static void writeOut(BufferedImage image, OutputStream os, String format) throws IOException { ImageIO.write(image, format, os); }
[ "public", "static", "void", "writeOut", "(", "BufferedImage", "image", ",", "OutputStream", "os", ",", "String", "format", ")", "throws", "IOException", "{", "ImageIO", ".", "write", "(", "image", ",", "format", ",", "os", ")", ";", "}" ]
write out image object to a output stream @param image @param os @param format @throws IOException
[ "write", "out", "image", "object", "to", "a", "output", "stream" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/img/Captcha.java#L51-L54
30,746
lucee/Lucee
core/src/main/java/lucee/commons/img/Captcha.java
Captcha.randomString
public static String randomString(int length) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < length; i++) { sb.append(chars[AbstractCaptcha.rnd(0, chars.length - 1)]); } return sb.toString(); }
java
public static String randomString(int length) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < length; i++) { sb.append(chars[AbstractCaptcha.rnd(0, chars.length - 1)]); } return sb.toString(); }
[ "public", "static", "String", "randomString", "(", "int", "length", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", "{", "sb", ".", "append...
creates a random String in given length @param length length of the string to create @return
[ "creates", "a", "random", "String", "in", "given", "length" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/img/Captcha.java#L62-L68
30,747
lucee/Lucee
core/src/main/java/lucee/runtime/net/http/HttpServletRequestDummy.java
HttpServletRequestDummy.translateQS
private Pair[] translateQS(String qs) { if (qs == null) return new Pair[0]; Array arr = lucee.runtime.type.util.ListUtil.listToArrayRemoveEmpty(qs, "&"); Pair[] parameters = new Pair[arr.size()]; // Array item; int index; String name; for (int i = 1; i <= parameters.length; i++) { name = Caster.toString(arr.get(i, ""), ""); index = name.indexOf('='); if (index != -1) parameters[i - 1] = new Pair(name.substring(0, index), name.substring(index + 1)); else parameters[i - 1] = new Pair(name, ""); } return parameters; }
java
private Pair[] translateQS(String qs) { if (qs == null) return new Pair[0]; Array arr = lucee.runtime.type.util.ListUtil.listToArrayRemoveEmpty(qs, "&"); Pair[] parameters = new Pair[arr.size()]; // Array item; int index; String name; for (int i = 1; i <= parameters.length; i++) { name = Caster.toString(arr.get(i, ""), ""); index = name.indexOf('='); if (index != -1) parameters[i - 1] = new Pair(name.substring(0, index), name.substring(index + 1)); else parameters[i - 1] = new Pair(name, ""); } return parameters; }
[ "private", "Pair", "[", "]", "translateQS", "(", "String", "qs", ")", "{", "if", "(", "qs", "==", "null", ")", "return", "new", "Pair", "[", "0", "]", ";", "Array", "arr", "=", "lucee", ".", "runtime", ".", "type", ".", "util", ".", "ListUtil", "...
constructor of the class @throws PageException / public HttpServletRequestDummy(String serverName, String scriptName,Struct queryString) throws PageException { this.serverName=serverName; requestURI=scriptName; StringBuffer qs=new StringBuffer(); String[] keys=queryString.keys(); parameters=new Item[keys.length]; String key; Object value; for(int i=0;i<keys.length;i++) { if(i>0) qs.append('&'); key=keys[i]; value=queryString.get(key); parameters[i]=new Item(key,value); qs.append(key); qs.append('='); qs.append(Caster.toString(value)); } this.queryString=qs.toString(); }
[ "constructor", "of", "the", "class" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/HttpServletRequestDummy.java#L161-L177
30,748
lucee/Lucee
core/src/main/java/lucee/runtime/net/http/HttpServletRequestDummy.java
HttpServletRequestDummy.setHeader
public void setHeader(String name, String value) { headers = ReqRspUtil.set(headers, name, value); }
java
public void setHeader(String name, String value) { headers = ReqRspUtil.set(headers, name, value); }
[ "public", "void", "setHeader", "(", "String", "name", ",", "String", "value", ")", "{", "headers", "=", "ReqRspUtil", ".", "set", "(", "headers", ",", "name", ",", "value", ")", ";", "}" ]
sets a new header value @param name name of the new value @param value header value
[ "sets", "a", "new", "header", "value" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/HttpServletRequestDummy.java#L237-L239
30,749
lucee/Lucee
core/src/main/java/lucee/runtime/net/http/HttpServletRequestDummy.java
HttpServletRequestDummy.addHeader
public void addHeader(String name, String value) { headers = ReqRspUtil.add(headers, name, value); }
java
public void addHeader(String name, String value) { headers = ReqRspUtil.add(headers, name, value); }
[ "public", "void", "addHeader", "(", "String", "name", ",", "String", "value", ")", "{", "headers", "=", "ReqRspUtil", ".", "add", "(", "headers", ",", "name", ",", "value", ")", ";", "}" ]
add a new header value @param name name of the new value @param value header value
[ "add", "a", "new", "header", "value" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/http/HttpServletRequestDummy.java#L247-L249
30,750
lucee/Lucee
core/src/main/java/lucee/runtime/functions/thread/RunAsync.java
RunAsync.call
public static Object call(PageContext pc, Object udf, double timeout) throws PageException { return Future._then(pc, Caster.toFunction(udf), (long) timeout); }
java
public static Object call(PageContext pc, Object udf, double timeout) throws PageException { return Future._then(pc, Caster.toFunction(udf), (long) timeout); }
[ "public", "static", "Object", "call", "(", "PageContext", "pc", ",", "Object", "udf", ",", "double", "timeout", ")", "throws", "PageException", "{", "return", "Future", ".", "_then", "(", "pc", ",", "Caster", ".", "toFunction", "(", "udf", ")", ",", "(",...
Verify if in thread or not @param pc @return @throws PageException
[ "Verify", "if", "in", "thread", "or", "not" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/functions/thread/RunAsync.java#L26-L28
30,751
lucee/Lucee
core/src/main/java/lucee/runtime/instrumentation/InstrumentationFactory.java
InstrumentationFactory.loadAgent
private static void loadAgent(Config config, Log log, String agentJar, Class<?> vmClass) { try { // addAttach(config,log); // first obtain the PID of the currently-running process // ### this relies on the undocumented convention of the // RuntimeMXBean's // ### name starting with the PID, but there appears to be no other // ### way to obtain the current process' id, which we need for // ### the attach process RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String pid = runtime.getName(); if (pid.indexOf("@") != -1) pid = pid.substring(0, pid.indexOf("@")); log.info("Instrumentation", "pid:" + pid); // JDK1.6: now attach to the current VM so we can deploy a new agent // ### this is a Sun JVM specific feature; other JVMs may offer // ### this feature, but in an implementation-dependent way Object vm = vmClass.getMethod("attach", new Class<?>[] { String.class }).invoke(null, new Object[] { pid }); // now deploy the actual agent, which will wind up calling // agentmain() vmClass.getMethod("loadAgent", new Class[] { String.class }).invoke(vm, new Object[] { agentJar }); vmClass.getMethod("detach", new Class[] {}).invoke(vm, new Object[] {}); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); // Log the message from the exception. Don't log the entire // stack as this is expected when running on a JDK that doesn't // support the Attach API. log.log(Log.LEVEL_INFO, "Instrumentation", t); } }
java
private static void loadAgent(Config config, Log log, String agentJar, Class<?> vmClass) { try { // addAttach(config,log); // first obtain the PID of the currently-running process // ### this relies on the undocumented convention of the // RuntimeMXBean's // ### name starting with the PID, but there appears to be no other // ### way to obtain the current process' id, which we need for // ### the attach process RuntimeMXBean runtime = ManagementFactory.getRuntimeMXBean(); String pid = runtime.getName(); if (pid.indexOf("@") != -1) pid = pid.substring(0, pid.indexOf("@")); log.info("Instrumentation", "pid:" + pid); // JDK1.6: now attach to the current VM so we can deploy a new agent // ### this is a Sun JVM specific feature; other JVMs may offer // ### this feature, but in an implementation-dependent way Object vm = vmClass.getMethod("attach", new Class<?>[] { String.class }).invoke(null, new Object[] { pid }); // now deploy the actual agent, which will wind up calling // agentmain() vmClass.getMethod("loadAgent", new Class[] { String.class }).invoke(vm, new Object[] { agentJar }); vmClass.getMethod("detach", new Class[] {}).invoke(vm, new Object[] {}); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); // Log the message from the exception. Don't log the entire // stack as this is expected when running on a JDK that doesn't // support the Attach API. log.log(Log.LEVEL_INFO, "Instrumentation", t); } }
[ "private", "static", "void", "loadAgent", "(", "Config", "config", ",", "Log", "log", ",", "String", "agentJar", ",", "Class", "<", "?", ">", "vmClass", ")", "{", "try", "{", "// addAttach(config,log);", "// first obtain the PID of the currently-running process", "/...
Attach and load an agent class. @param log Log used if the agent cannot be loaded. @param agentJar absolute path to the agent jar. @param vmClass VirtualMachine.class from tools.jar.
[ "Attach", "and", "load", "an", "agent", "class", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/instrumentation/InstrumentationFactory.java#L309-L341
30,752
lucee/Lucee
core/src/main/java/lucee/runtime/debug/DebuggerImpl.java
DebuggerImpl.getDebugEntry
public static lucee.runtime.config.DebugEntry getDebugEntry(PageContext pc) { String addr = pc.getHttpServletRequest().getRemoteAddr(); lucee.runtime.config.DebugEntry debugEntry = ((ConfigImpl) pc.getConfig()).getDebugEntry(addr, null); return debugEntry; }
java
public static lucee.runtime.config.DebugEntry getDebugEntry(PageContext pc) { String addr = pc.getHttpServletRequest().getRemoteAddr(); lucee.runtime.config.DebugEntry debugEntry = ((ConfigImpl) pc.getConfig()).getDebugEntry(addr, null); return debugEntry; }
[ "public", "static", "lucee", ".", "runtime", ".", "config", ".", "DebugEntry", "getDebugEntry", "(", "PageContext", "pc", ")", "{", "String", "addr", "=", "pc", ".", "getHttpServletRequest", "(", ")", ".", "getRemoteAddr", "(", ")", ";", "lucee", ".", "run...
returns the DebugEntry for the current request's IP address, or null if no template matches the address @param pc @return
[ "returns", "the", "DebugEntry", "for", "the", "current", "request", "s", "IP", "address", "or", "null", "if", "no", "template", "matches", "the", "address" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/debug/DebuggerImpl.java#L271-L276
30,753
lucee/Lucee
core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java
ValidateCreditCard.buildRanges
private static void buildRanges() { // careful, no lead zeros allowed // low high len vendor mod-10? ranges = new LCR[] { new LCR(4000000000000L, 4999999999999L, 13, VISA, true), new LCR(30000000000000L, 30599999999999L, 14, DINERS, true), new LCR(36000000000000L, 36999999999999L, 14, DINERS, true), new LCR(38000000000000L, 38999999999999L, 14, DINERS, true), new LCR(180000000000000L, 180099999999999L, 15, JCB, true), new LCR(201400000000000L, 201499999999999L, 15, ENROUTE, false), new LCR(213100000000000L, 213199999999999L, 15, JCB, true), new LCR(214900000000000L, 214999999999999L, 15, ENROUTE, false), new LCR(340000000000000L, 349999999999999L, 15, AMEX, true), new LCR(370000000000000L, 379999999999999L, 15, AMEX, true), new LCR(3000000000000000L, 3999999999999999L, 16, JCB, true), new LCR(4000000000000000L, 4999999999999999L, 16, VISA, true), new LCR(5100000000000000L, 5599999999999999L, 16, MASTERCARD, true), new LCR(6011000000000000L, 6011999999999999L, 16, DISCOVER, true) }; // end table // initialisation }
java
private static void buildRanges() { // careful, no lead zeros allowed // low high len vendor mod-10? ranges = new LCR[] { new LCR(4000000000000L, 4999999999999L, 13, VISA, true), new LCR(30000000000000L, 30599999999999L, 14, DINERS, true), new LCR(36000000000000L, 36999999999999L, 14, DINERS, true), new LCR(38000000000000L, 38999999999999L, 14, DINERS, true), new LCR(180000000000000L, 180099999999999L, 15, JCB, true), new LCR(201400000000000L, 201499999999999L, 15, ENROUTE, false), new LCR(213100000000000L, 213199999999999L, 15, JCB, true), new LCR(214900000000000L, 214999999999999L, 15, ENROUTE, false), new LCR(340000000000000L, 349999999999999L, 15, AMEX, true), new LCR(370000000000000L, 379999999999999L, 15, AMEX, true), new LCR(3000000000000000L, 3999999999999999L, 16, JCB, true), new LCR(4000000000000000L, 4999999999999999L, 16, VISA, true), new LCR(5100000000000000L, 5599999999999999L, 16, MASTERCARD, true), new LCR(6011000000000000L, 6011999999999999L, 16, DISCOVER, true) }; // end table // initialisation }
[ "private", "static", "void", "buildRanges", "(", ")", "{", "// careful, no lead zeros allowed", "// low high len vendor mod-10?", "ranges", "=", "new", "LCR", "[", "]", "{", "new", "LCR", "(", "4000000000000L", ",", "4999999999999L", ",", "13", ",", "VISA", ",", ...
build table of which ranges of credit card number belong to which vendor
[ "build", "table", "of", "which", "ranges", "of", "credit", "card", "number", "belong", "to", "which", "vendor" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java#L112-L123
30,754
lucee/Lucee
core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java
ValidateCreditCard.findMatchingRange
protected static int findMatchingRange(long creditCardNumber) { if (creditCardNumber < 1000000000000L) { return NOT_ENOUGH_DIGITS; } if (creditCardNumber > 9999999999999999L) { return TOO_MANY_DIGITS; } // check the cached index first, where we last found a number. if (ranges[cachedLastFind].low <= creditCardNumber && creditCardNumber <= ranges[cachedLastFind].high) { return cachedLastFind; } for (int i = 0; i < ranges.length; i++) { if (ranges[i].low <= creditCardNumber && creditCardNumber <= ranges[i].high) { // we have a match cachedLastFind = i; return i; } } // end for return UNKNOWN_VENDOR; }
java
protected static int findMatchingRange(long creditCardNumber) { if (creditCardNumber < 1000000000000L) { return NOT_ENOUGH_DIGITS; } if (creditCardNumber > 9999999999999999L) { return TOO_MANY_DIGITS; } // check the cached index first, where we last found a number. if (ranges[cachedLastFind].low <= creditCardNumber && creditCardNumber <= ranges[cachedLastFind].high) { return cachedLastFind; } for (int i = 0; i < ranges.length; i++) { if (ranges[i].low <= creditCardNumber && creditCardNumber <= ranges[i].high) { // we have a match cachedLastFind = i; return i; } } // end for return UNKNOWN_VENDOR; }
[ "protected", "static", "int", "findMatchingRange", "(", "long", "creditCardNumber", ")", "{", "if", "(", "creditCardNumber", "<", "1000000000000L", ")", "{", "return", "NOT_ENOUGH_DIGITS", ";", "}", "if", "(", "creditCardNumber", ">", "9999999999999999L", ")", "{"...
Finds a matching range in the ranges array for a given creditCardNumber. @param creditCardNumber number on card. @return index of matching range, or NOT_ENOUGH_DIGITS or UNKNOWN_VENDOR on failure.
[ "Finds", "a", "matching", "range", "in", "the", "ranges", "array", "for", "a", "given", "creditCardNumber", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java#L132-L151
30,755
lucee/Lucee
core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java
ValidateCreditCard.isValid
public static boolean isValid(long creditCardNumber) { int i = findMatchingRange(creditCardNumber); if (i < 0) { return false; } // else { // we have a match if (ranges[i].hasCheckDigit) { // there is a checkdigit to be validated /* * Manual method MOD 10 checkdigit 706-511-227 7 0 6 5 1 1 2 2 7 2 * 2 * 2 * 2 * --------------------------------- 7 + 0 + 6 +1+0+ 1 + 2 + 2 + 4 = 23 23 MOD 10 = 3 10 - 3 = 7 -- * the check digit Note digits of multiplication results must be added before sum. Computer Method * MOD 10 checkdigit 706-511-227 7 0 6 5 1 1 2 2 7 Z Z Z Z --------------------------------- 7 + 0 + * 6 + 1 + 1 + 2 + 2 + 4 + 7 = 30 30 MOD 10 had better = 0 */ long number = creditCardNumber; int checksum = 0; // work right to left for (int place = 0; place < 16; place++) { int digit = (int) (number % 10); number /= 10; if ((place & 1) == 0) { // even position (0-based from right), just add digit checksum += digit; } else { // odd position (0-based from right), must double // and add checksum += z(digit); } if (number == 0) { break; } } // end for // good checksum should be 0 mod 10 return (checksum % 10) == 0; } return true; // no checksum needed // } // end if have match }
java
public static boolean isValid(long creditCardNumber) { int i = findMatchingRange(creditCardNumber); if (i < 0) { return false; } // else { // we have a match if (ranges[i].hasCheckDigit) { // there is a checkdigit to be validated /* * Manual method MOD 10 checkdigit 706-511-227 7 0 6 5 1 1 2 2 7 2 * 2 * 2 * 2 * --------------------------------- 7 + 0 + 6 +1+0+ 1 + 2 + 2 + 4 = 23 23 MOD 10 = 3 10 - 3 = 7 -- * the check digit Note digits of multiplication results must be added before sum. Computer Method * MOD 10 checkdigit 706-511-227 7 0 6 5 1 1 2 2 7 Z Z Z Z --------------------------------- 7 + 0 + * 6 + 1 + 1 + 2 + 2 + 4 + 7 = 30 30 MOD 10 had better = 0 */ long number = creditCardNumber; int checksum = 0; // work right to left for (int place = 0; place < 16; place++) { int digit = (int) (number % 10); number /= 10; if ((place & 1) == 0) { // even position (0-based from right), just add digit checksum += digit; } else { // odd position (0-based from right), must double // and add checksum += z(digit); } if (number == 0) { break; } } // end for // good checksum should be 0 mod 10 return (checksum % 10) == 0; } return true; // no checksum needed // } // end if have match }
[ "public", "static", "boolean", "isValid", "(", "long", "creditCardNumber", ")", "{", "int", "i", "=", "findMatchingRange", "(", "creditCardNumber", ")", ";", "if", "(", "i", "<", "0", ")", "{", "return", "false", ";", "}", "// else {", "// we have a match", ...
Determine if the credit card number is valid, i.e. has good prefix and checkdigit. Does _not_ ask the credit card company if this card has been issued or is in good standing. @param creditCardNumber number on card. @return true if card number is good.
[ "Determine", "if", "the", "credit", "card", "number", "is", "valid", "i", ".", "e", ".", "has", "good", "prefix", "and", "checkdigit", ".", "Does", "_not_", "ask", "the", "credit", "card", "company", "if", "this", "card", "has", "been", "issued", "or", ...
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java#L181-L221
30,756
lucee/Lucee
core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java
ValidateCreditCard.recognizeVendor
public static int recognizeVendor(long creditCardNumber) { int i = findMatchingRange(creditCardNumber); if (i < 0) { return i; } return ranges[i].vendor; }
java
public static int recognizeVendor(long creditCardNumber) { int i = findMatchingRange(creditCardNumber); if (i < 0) { return i; } return ranges[i].vendor; }
[ "public", "static", "int", "recognizeVendor", "(", "long", "creditCardNumber", ")", "{", "int", "i", "=", "findMatchingRange", "(", "creditCardNumber", ")", ";", "if", "(", "i", "<", "0", ")", "{", "return", "i", ";", "}", "return", "ranges", "[", "i", ...
Determine the credit card company. Does NOT validate checkdigit. @param creditCardNumber number on card. @return credit card vendor enumeration constant.
[ "Determine", "the", "credit", "card", "company", ".", "Does", "NOT", "validate", "checkdigit", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java#L230-L237
30,757
lucee/Lucee
core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java
ValidateCreditCard.toCreditcard
public static String toCreditcard(String strCreditCardNumber) throws ExpressionException { long number = toLong(strCreditCardNumber, -1); if (number == -1) throw new ExpressionException("invalid creditcard number [" + strCreditCardNumber + "]"); return toPrettyString(number); }
java
public static String toCreditcard(String strCreditCardNumber) throws ExpressionException { long number = toLong(strCreditCardNumber, -1); if (number == -1) throw new ExpressionException("invalid creditcard number [" + strCreditCardNumber + "]"); return toPrettyString(number); }
[ "public", "static", "String", "toCreditcard", "(", "String", "strCreditCardNumber", ")", "throws", "ExpressionException", "{", "long", "number", "=", "toLong", "(", "strCreditCardNumber", ",", "-", "1", ")", ";", "if", "(", "number", "==", "-", "1", ")", "th...
1800 15 mod 10
[ "1800", "15", "mod", "10" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java#L256-L260
30,758
lucee/Lucee
core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java
ValidateCreditCard.toPrettyString
private static String toPrettyString(long creditCardNumber) { String plain = Long.toString(creditCardNumber); // int i = findMatchingRange(creditCardNumber); int length = plain.length(); switch (length) { case 12: // 12 pattern 3-3-3-3 return plain.substring(0, 3) + ' ' + plain.substring(3, 6) + ' ' + plain.substring(6, 9) + ' ' + plain.substring(9, 12); case 13: // 13 pattern 4-3-3-3 return plain.substring(0, 4) + ' ' + plain.substring(4, 7) + ' ' + plain.substring(7, 10) + ' ' + plain.substring(10, 13); case 14: // 14 pattern 2-4-4-4 return plain.substring(0, 2) + ' ' + plain.substring(2, 6) + ' ' + plain.substring(6, 10) + ' ' + plain.substring(10, 14); case 15: // 15 pattern 3-4-4-4 return plain.substring(0, 3) + ' ' + plain.substring(3, 7) + ' ' + plain.substring(7, 11) + ' ' + plain.substring(11, 15); case 16: // 16 pattern 4-4-4-4 return plain.substring(0, 4) + ' ' + plain.substring(4, 8) + ' ' + plain.substring(8, 12) + ' ' + plain.substring(12, 16); case 17: // 17 pattern 1-4-4-4-4 return plain.substring(0, 1) + ' ' + plain.substring(1, 5) + ' ' + plain.substring(5, 9) + ' ' + plain.substring(9, 13) + ' ' + plain.substring(13, 17); default: // 0..11, 18+ digits long // plain return plain; } // end switch }
java
private static String toPrettyString(long creditCardNumber) { String plain = Long.toString(creditCardNumber); // int i = findMatchingRange(creditCardNumber); int length = plain.length(); switch (length) { case 12: // 12 pattern 3-3-3-3 return plain.substring(0, 3) + ' ' + plain.substring(3, 6) + ' ' + plain.substring(6, 9) + ' ' + plain.substring(9, 12); case 13: // 13 pattern 4-3-3-3 return plain.substring(0, 4) + ' ' + plain.substring(4, 7) + ' ' + plain.substring(7, 10) + ' ' + plain.substring(10, 13); case 14: // 14 pattern 2-4-4-4 return plain.substring(0, 2) + ' ' + plain.substring(2, 6) + ' ' + plain.substring(6, 10) + ' ' + plain.substring(10, 14); case 15: // 15 pattern 3-4-4-4 return plain.substring(0, 3) + ' ' + plain.substring(3, 7) + ' ' + plain.substring(7, 11) + ' ' + plain.substring(11, 15); case 16: // 16 pattern 4-4-4-4 return plain.substring(0, 4) + ' ' + plain.substring(4, 8) + ' ' + plain.substring(8, 12) + ' ' + plain.substring(12, 16); case 17: // 17 pattern 1-4-4-4-4 return plain.substring(0, 1) + ' ' + plain.substring(1, 5) + ' ' + plain.substring(5, 9) + ' ' + plain.substring(9, 13) + ' ' + plain.substring(13, 17); default: // 0..11, 18+ digits long // plain return plain; } // end switch }
[ "private", "static", "String", "toPrettyString", "(", "long", "creditCardNumber", ")", "{", "String", "plain", "=", "Long", ".", "toString", "(", "creditCardNumber", ")", ";", "// int i = findMatchingRange(creditCardNumber);", "int", "length", "=", "plain", ".", "le...
Convert a creditCardNumber as long to a formatted String. Currently it breaks 16-digit numbers into groups of 4. @param creditCardNumber number on card. @return String representation of the credit card number.
[ "Convert", "a", "creditCardNumber", "as", "long", "to", "a", "formatted", "String", ".", "Currently", "it", "breaks", "16", "-", "digit", "numbers", "into", "groups", "of", "4", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/op/validators/ValidateCreditCard.java#L276-L311
30,759
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.swap
public static void swap(Array array, int left, int right) throws ExpressionException { int len = array.size(); if (len == 0) throw new ExpressionException("array is empty"); if (left < 1 || left > len) throw new ExpressionException("invalid index [" + left + "]", "valid indexes are from 1 to " + len); if (right < 1 || right > len) throw new ExpressionException("invalid index [" + right + "]", "valid indexes are from 1 to " + len); try { Object leftValue = array.get(left, null); Object rightValue = array.get(right, null); array.setE(left, rightValue); array.setE(right, leftValue); } catch (PageException e) { throw new ExpressionException("can't swap values of array", e.getMessage()); } }
java
public static void swap(Array array, int left, int right) throws ExpressionException { int len = array.size(); if (len == 0) throw new ExpressionException("array is empty"); if (left < 1 || left > len) throw new ExpressionException("invalid index [" + left + "]", "valid indexes are from 1 to " + len); if (right < 1 || right > len) throw new ExpressionException("invalid index [" + right + "]", "valid indexes are from 1 to " + len); try { Object leftValue = array.get(left, null); Object rightValue = array.get(right, null); array.setE(left, rightValue); array.setE(right, leftValue); } catch (PageException e) { throw new ExpressionException("can't swap values of array", e.getMessage()); } }
[ "public", "static", "void", "swap", "(", "Array", "array", ",", "int", "left", ",", "int", "right", ")", "throws", "ExpressionException", "{", "int", "len", "=", "array", ".", "size", "(", ")", ";", "if", "(", "len", "==", "0", ")", "throw", "new", ...
swap to values of the array @param array @param left left value to swap @param right right value to swap @throws ExpressionException
[ "swap", "to", "values", "of", "the", "array" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L133-L151
30,760
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.find
public static int find(Array array, Object object) { int len = array.size(); for (int i = 1; i <= len; i++) { Object tmp = array.get(i, null); try { if (tmp != null && Operator.compare(object, tmp) == 0) return i; } catch (PageException e) {} } return 0; }
java
public static int find(Array array, Object object) { int len = array.size(); for (int i = 1; i <= len; i++) { Object tmp = array.get(i, null); try { if (tmp != null && Operator.compare(object, tmp) == 0) return i; } catch (PageException e) {} } return 0; }
[ "public", "static", "int", "find", "(", "Array", "array", ",", "Object", "object", ")", "{", "int", "len", "=", "array", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<=", "len", ";", "i", "++", ")", "{", "Object", ...
find a object in array @param array @param object object to find @return position in array or 0
[ "find", "a", "object", "in", "array" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L160-L170
30,761
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.avg
public static double avg(Array array) throws ExpressionException { if (array.size() == 0) return 0; return sum(array) / array.size(); }
java
public static double avg(Array array) throws ExpressionException { if (array.size() == 0) return 0; return sum(array) / array.size(); }
[ "public", "static", "double", "avg", "(", "Array", "array", ")", "throws", "ExpressionException", "{", "if", "(", "array", ".", "size", "(", ")", "==", "0", ")", "return", "0", ";", "return", "sum", "(", "array", ")", "/", "array", ".", "size", "(", ...
average of all values of the array, only work when all values are numeric @param array @return average of all values @throws ExpressionException
[ "average", "of", "all", "values", "of", "the", "array", "only", "work", "when", "all", "values", "are", "numeric" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L179-L182
30,762
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.sum
public static double sum(Array array) throws ExpressionException { if (array.getDimension() > 1) throw new ExpressionException("can only get sum/avg from 1 dimensional arrays"); double rtn = 0; int len = array.size(); // try { for (int i = 1; i <= len; i++) { rtn += _toDoubleValue(array, i); } /* * } catch (PageException e) { throw new * ExpressionException("exception while execute array operation: "+e.getMessage()); } */ return rtn; }
java
public static double sum(Array array) throws ExpressionException { if (array.getDimension() > 1) throw new ExpressionException("can only get sum/avg from 1 dimensional arrays"); double rtn = 0; int len = array.size(); // try { for (int i = 1; i <= len; i++) { rtn += _toDoubleValue(array, i); } /* * } catch (PageException e) { throw new * ExpressionException("exception while execute array operation: "+e.getMessage()); } */ return rtn; }
[ "public", "static", "double", "sum", "(", "Array", "array", ")", "throws", "ExpressionException", "{", "if", "(", "array", ".", "getDimension", "(", ")", ">", "1", ")", "throw", "new", "ExpressionException", "(", "\"can only get sum/avg from 1 dimensional arrays\"",...
sum of all values of a array, only work when all values are numeric @param array Array @return sum of all values @throws ExpressionException
[ "sum", "of", "all", "values", "of", "a", "array", "only", "work", "when", "all", "values", "are", "numeric" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L191-L205
30,763
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.median
public static double median(Array array) throws ExpressionException { int len = array.size(); if (len == 0) return 0; if (array.getDimension() > 1) throw new ExpressionException("Median() can only be calculated for one dimensional arrays"); double[] arr = new double[len]; for (int i = 0; i < len; i++) arr[i] = _toDoubleValue(array, i + 1); Arrays.sort(arr); double result = arr[len / 2]; if (len % 2 == 0) { return (result + arr[(len - 2) / 2]) / 2; } return result; }
java
public static double median(Array array) throws ExpressionException { int len = array.size(); if (len == 0) return 0; if (array.getDimension() > 1) throw new ExpressionException("Median() can only be calculated for one dimensional arrays"); double[] arr = new double[len]; for (int i = 0; i < len; i++) arr[i] = _toDoubleValue(array, i + 1); Arrays.sort(arr); double result = arr[len / 2]; if (len % 2 == 0) { return (result + arr[(len - 2) / 2]) / 2; } return result; }
[ "public", "static", "double", "median", "(", "Array", "array", ")", "throws", "ExpressionException", "{", "int", "len", "=", "array", ".", "size", "(", ")", ";", "if", "(", "len", "==", "0", ")", "return", "0", ";", "if", "(", "array", ".", "getDimen...
median value of all items in the arrays, only works when all values are numeric @param array @return @throws ExpressionException
[ "median", "value", "of", "all", "items", "in", "the", "arrays", "only", "works", "when", "all", "values", "are", "numeric" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L214-L237
30,764
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.min
public static double min(Array array) throws PageException { if (array.getDimension() > 1) throw new ExpressionException("can only get max value from 1 dimensional arrays"); if (array.size() == 0) return 0; double rtn = _toDoubleValue(array, 1); int len = array.size(); try { for (int i = 2; i <= len; i++) { double v = _toDoubleValue(array, i); if (rtn > v) rtn = v; } } catch (PageException e) { throw new ExpressionException("exception while execute array operation: " + e.getMessage()); } return rtn; }
java
public static double min(Array array) throws PageException { if (array.getDimension() > 1) throw new ExpressionException("can only get max value from 1 dimensional arrays"); if (array.size() == 0) return 0; double rtn = _toDoubleValue(array, 1); int len = array.size(); try { for (int i = 2; i <= len; i++) { double v = _toDoubleValue(array, i); if (rtn > v) rtn = v; } } catch (PageException e) { throw new ExpressionException("exception while execute array operation: " + e.getMessage()); } return rtn; }
[ "public", "static", "double", "min", "(", "Array", "array", ")", "throws", "PageException", "{", "if", "(", "array", ".", "getDimension", "(", ")", ">", "1", ")", "throw", "new", "ExpressionException", "(", "\"can only get max value from 1 dimensional arrays\"", "...
the smallest value, of all values inside the array, only work when all values are numeric @param array @return the smallest value @throws PageException
[ "the", "smallest", "value", "of", "all", "values", "inside", "the", "array", "only", "work", "when", "all", "values", "are", "numeric" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L254-L271
30,765
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.setEL
public static Object setEL(Object o, int index, Object value) { try { return set(o, index, value); } catch (ArrayUtilException e) { return null; } }
java
public static Object setEL(Object o, int index, Object value) { try { return set(o, index, value); } catch (ArrayUtilException e) { return null; } }
[ "public", "static", "Object", "setEL", "(", "Object", "o", ",", "int", "index", ",", "Object", "value", ")", "{", "try", "{", "return", "set", "(", "o", ",", "index", ",", "value", ")", ";", "}", "catch", "(", "ArrayUtilException", "e", ")", "{", "...
sets a value to a array at defined index @param o @param index @param value @return value setted
[ "sets", "a", "value", "to", "a", "array", "at", "defined", "index" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L604-L611
30,766
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.toArray
public static Object[] toArray(List<?> list) { Iterator<?> it = list.iterator(); Class clazz = null; while (it.hasNext()) { Object v = it.next(); if (v == null) continue; if (clazz == null) clazz = v.getClass(); else if (clazz != v.getClass()) return list.toArray(); } if (clazz == Object.class || clazz == null) return list.toArray(); Object arr = java.lang.reflect.Array.newInstance(clazz, list.size()); return list.toArray((Object[]) arr); }
java
public static Object[] toArray(List<?> list) { Iterator<?> it = list.iterator(); Class clazz = null; while (it.hasNext()) { Object v = it.next(); if (v == null) continue; if (clazz == null) clazz = v.getClass(); else if (clazz != v.getClass()) return list.toArray(); } if (clazz == Object.class || clazz == null) return list.toArray(); Object arr = java.lang.reflect.Array.newInstance(clazz, list.size()); return list.toArray((Object[]) arr); }
[ "public", "static", "Object", "[", "]", "toArray", "(", "List", "<", "?", ">", "list", ")", "{", "Iterator", "<", "?", ">", "it", "=", "list", ".", "iterator", "(", ")", ";", "Class", "clazz", "=", "null", ";", "while", "(", "it", ".", "hasNext",...
creates a native array out of the input list, if all values are from the same type, this type is used for the array, otherwise object @param list
[ "creates", "a", "native", "array", "out", "of", "the", "input", "list", "if", "all", "values", "are", "from", "the", "same", "type", "this", "type", "is", "used", "for", "the", "array", "otherwise", "object" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L868-L881
30,767
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/ArrayUtil.java
ArrayUtil.resizeIfNeeded
public static Object[] resizeIfNeeded(Object[] arr, int minSize, boolean doPowerOf2) { if (arr.length >= minSize) return arr; if (doPowerOf2) minSize = MathUtil.nextPowerOf2(minSize); Object[] result = new Object[minSize]; System.arraycopy(arr, 0, result, 0, arr.length); return result; }
java
public static Object[] resizeIfNeeded(Object[] arr, int minSize, boolean doPowerOf2) { if (arr.length >= minSize) return arr; if (doPowerOf2) minSize = MathUtil.nextPowerOf2(minSize); Object[] result = new Object[minSize]; System.arraycopy(arr, 0, result, 0, arr.length); return result; }
[ "public", "static", "Object", "[", "]", "resizeIfNeeded", "(", "Object", "[", "]", "arr", ",", "int", "minSize", ",", "boolean", "doPowerOf2", ")", "{", "if", "(", "arr", ".", "length", ">=", "minSize", ")", "return", "arr", ";", "if", "(", "doPowerOf2...
this method returns the original array if its length is equal or greater than the minSize, or create a new array and copies the data from the original array into the new one. @param arr - the array to check @param minSize - the required minimum size @param doPowerOf2 - if true, and a resize is required, the new size will be a power of 2 @return - either the original arr array if it had enough capacity, or a new array.
[ "this", "method", "returns", "the", "original", "array", "if", "its", "length", "is", "equal", "or", "greater", "than", "the", "minSize", "or", "create", "a", "new", "array", "and", "copies", "the", "data", "from", "the", "original", "array", "into", "the"...
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/ArrayUtil.java#L945-L955
30,768
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Log.java
Log.setLog
public void setLog(String log) throws ApplicationException { if (StringUtil.isEmpty(log, true)) return; this.log = log.trim(); // throw new ApplicationException("invalid value for attribute log ["+log+"]","valid values are // [application, scheduler,console]"); }
java
public void setLog(String log) throws ApplicationException { if (StringUtil.isEmpty(log, true)) return; this.log = log.trim(); // throw new ApplicationException("invalid value for attribute log ["+log+"]","valid values are // [application, scheduler,console]"); }
[ "public", "void", "setLog", "(", "String", "log", ")", "throws", "ApplicationException", "{", "if", "(", "StringUtil", ".", "isEmpty", "(", "log", ",", "true", ")", ")", "return", ";", "this", ".", "log", "=", "log", ".", "trim", "(", ")", ";", "// t...
set the value log If you omit the file attribute, specifies the standard log file in which to write the message. Ignored if you specify a file attribute @param log value to set @throws ApplicationException
[ "set", "the", "value", "log", "If", "you", "omit", "the", "file", "attribute", "specifies", "the", "standard", "log", "file", "in", "which", "to", "write", "the", "message", ".", "Ignored", "if", "you", "specify", "a", "file", "attribute" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Log.java#L97-L102
30,769
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Log.java
Log.setType
public void setType(String type) throws ApplicationException { type = type.toLowerCase().trim(); if (type.equals("information")) this.type = lucee.commons.io.log.Log.LEVEL_INFO; else if (type.equals("info")) this.type = lucee.commons.io.log.Log.LEVEL_INFO; else if (type.equals("warning")) this.type = lucee.commons.io.log.Log.LEVEL_WARN; else if (type.equals("warn")) this.type = lucee.commons.io.log.Log.LEVEL_WARN; else if (type.equals("error")) this.type = lucee.commons.io.log.Log.LEVEL_ERROR; else if (type.startsWith("fatal")) this.type = lucee.commons.io.log.Log.LEVEL_FATAL; else if (type.startsWith("debug")) this.type = lucee.commons.io.log.Log.LEVEL_DEBUG; else if (type.startsWith("trace")) this.type = lucee.commons.io.log.Log.LEVEL_TRACE; else throw new ApplicationException("invalid value for attribute type [" + type + "]", "valid values are [information,warning,error,fatal,debug]"); }
java
public void setType(String type) throws ApplicationException { type = type.toLowerCase().trim(); if (type.equals("information")) this.type = lucee.commons.io.log.Log.LEVEL_INFO; else if (type.equals("info")) this.type = lucee.commons.io.log.Log.LEVEL_INFO; else if (type.equals("warning")) this.type = lucee.commons.io.log.Log.LEVEL_WARN; else if (type.equals("warn")) this.type = lucee.commons.io.log.Log.LEVEL_WARN; else if (type.equals("error")) this.type = lucee.commons.io.log.Log.LEVEL_ERROR; else if (type.startsWith("fatal")) this.type = lucee.commons.io.log.Log.LEVEL_FATAL; else if (type.startsWith("debug")) this.type = lucee.commons.io.log.Log.LEVEL_DEBUG; else if (type.startsWith("trace")) this.type = lucee.commons.io.log.Log.LEVEL_TRACE; else throw new ApplicationException("invalid value for attribute type [" + type + "]", "valid values are [information,warning,error,fatal,debug]"); }
[ "public", "void", "setType", "(", "String", "type", ")", "throws", "ApplicationException", "{", "type", "=", "type", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "type", ".", "equals", "(", "\"information\"", ")", ")", "this", "...
set the value type The type or severity of the message. @param type value to set @throws ApplicationException
[ "set", "the", "value", "type", "The", "type", "or", "severity", "of", "the", "message", "." ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Log.java#L124-L136
30,770
lucee/Lucee
core/src/main/java/lucee/runtime/tag/Log.java
Log.setFile
public void setFile(String file) throws ApplicationException { if (StringUtil.isEmpty(file)) return; if (file.indexOf('/') != -1 || file.indexOf('\\') != -1) throw new ApplicationException("value [" + file + "] from attribute [file] at tag [log] can only contain a filename, file separators like [\\/] are not allowed"); if (!file.endsWith(".log")) file += ".log"; this.file = file; }
java
public void setFile(String file) throws ApplicationException { if (StringUtil.isEmpty(file)) return; if (file.indexOf('/') != -1 || file.indexOf('\\') != -1) throw new ApplicationException("value [" + file + "] from attribute [file] at tag [log] can only contain a filename, file separators like [\\/] are not allowed"); if (!file.endsWith(".log")) file += ".log"; this.file = file; }
[ "public", "void", "setFile", "(", "String", "file", ")", "throws", "ApplicationException", "{", "if", "(", "StringUtil", ".", "isEmpty", "(", "file", ")", ")", "return", ";", "if", "(", "file", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", "||"...
set the value file @param file value to set @throws ApplicationException
[ "set", "the", "value", "file" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/tag/Log.java#L156-L163
30,771
lucee/Lucee
core/src/main/java/lucee/intergral/fusiondebug/server/FDStackFrameImpl.java
FDStackFrameImpl.copyValues
private static List copyValues(FDStackFrameImpl frame, List to, Struct from) { Iterator it = from.entrySet().iterator(); Entry entry; while (it.hasNext()) { entry = (Entry) it.next(); to.add(new FDVariable(frame, (String) entry.getKey(), FDCaster.toFDValue(frame, entry.getValue()))); } return to; }
java
private static List copyValues(FDStackFrameImpl frame, List to, Struct from) { Iterator it = from.entrySet().iterator(); Entry entry; while (it.hasNext()) { entry = (Entry) it.next(); to.add(new FDVariable(frame, (String) entry.getKey(), FDCaster.toFDValue(frame, entry.getValue()))); } return to; }
[ "private", "static", "List", "copyValues", "(", "FDStackFrameImpl", "frame", ",", "List", "to", ",", "Struct", "from", ")", "{", "Iterator", "it", "=", "from", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "Entry", "entry", ";", "while", "...
copy all data from given struct to given list and translate it to a FDValue @param to list to fill with values @param from struct to read values from @return the given list
[ "copy", "all", "data", "from", "given", "struct", "to", "given", "list", "and", "translate", "it", "to", "a", "FDValue" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/intergral/fusiondebug/server/FDStackFrameImpl.java#L208-L216
30,772
lucee/Lucee
loader/src/main/java/lucee/loader/util/Util.java
Util.isNewerThan
public static boolean isNewerThan(final Version left, final Version right) { // major if (left.getMajor() > right.getMajor()) return true; if (left.getMajor() < right.getMajor()) return false; // minor if (left.getMinor() > right.getMinor()) return true; if (left.getMinor() < right.getMinor()) return false; // micro if (left.getMicro() > right.getMicro()) return true; if (left.getMicro() < right.getMicro()) return false; // qualifier // left String q = left.getQualifier(); int index = q.indexOf('-'); String qla = index == -1 ? "" : q.substring(index + 1).trim(); String qln = index == -1 ? q : q.substring(0, index); int ql = isEmpty(qln) ? Integer.MIN_VALUE : Integer.parseInt(qln); // right q = right.getQualifier(); index = q.indexOf('-'); String qra = index == -1 ? "" : q.substring(index + 1).trim(); String qrn = index == -1 ? q : q.substring(0, index); int qr = isEmpty(qln) ? Integer.MIN_VALUE : Integer.parseInt(qrn); if (ql > qr) return true; if (ql < qr) return false; int qlan = qualifierAppendix2Number(qla); int qran = qualifierAppendix2Number(qra); if (qlan > qran) return true; if (qlan < qran) return false; if (qlan == QUALIFIER_APPENDIX_OTHER && qran == QUALIFIER_APPENDIX_OTHER) return left.compareTo(right) > 0; return false; }
java
public static boolean isNewerThan(final Version left, final Version right) { // major if (left.getMajor() > right.getMajor()) return true; if (left.getMajor() < right.getMajor()) return false; // minor if (left.getMinor() > right.getMinor()) return true; if (left.getMinor() < right.getMinor()) return false; // micro if (left.getMicro() > right.getMicro()) return true; if (left.getMicro() < right.getMicro()) return false; // qualifier // left String q = left.getQualifier(); int index = q.indexOf('-'); String qla = index == -1 ? "" : q.substring(index + 1).trim(); String qln = index == -1 ? q : q.substring(0, index); int ql = isEmpty(qln) ? Integer.MIN_VALUE : Integer.parseInt(qln); // right q = right.getQualifier(); index = q.indexOf('-'); String qra = index == -1 ? "" : q.substring(index + 1).trim(); String qrn = index == -1 ? q : q.substring(0, index); int qr = isEmpty(qln) ? Integer.MIN_VALUE : Integer.parseInt(qrn); if (ql > qr) return true; if (ql < qr) return false; int qlan = qualifierAppendix2Number(qla); int qran = qualifierAppendix2Number(qra); if (qlan > qran) return true; if (qlan < qran) return false; if (qlan == QUALIFIER_APPENDIX_OTHER && qran == QUALIFIER_APPENDIX_OTHER) return left.compareTo(right) > 0; return false; }
[ "public", "static", "boolean", "isNewerThan", "(", "final", "Version", "left", ",", "final", "Version", "right", ")", "{", "// major", "if", "(", "left", ".", "getMajor", "(", ")", ">", "right", ".", "getMajor", "(", ")", ")", "return", "true", ";", "i...
check left value against right value @param left @param right @return returns if right is newer than left
[ "check", "left", "value", "against", "right", "value" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/loader/src/main/java/lucee/loader/util/Util.java#L463-L504
30,773
lucee/Lucee
core/src/main/java/lucee/runtime/crypt/Cryptor.java
Cryptor.encrypt
public static byte[] encrypt(byte[] input, String key, String algorithm, byte[] ivOrSalt, int iterations) throws PageException { return crypt(input, key, algorithm, ivOrSalt, iterations, false); }
java
public static byte[] encrypt(byte[] input, String key, String algorithm, byte[] ivOrSalt, int iterations) throws PageException { return crypt(input, key, algorithm, ivOrSalt, iterations, false); }
[ "public", "static", "byte", "[", "]", "encrypt", "(", "byte", "[", "]", "input", ",", "String", "key", ",", "String", "algorithm", ",", "byte", "[", "]", "ivOrSalt", ",", "int", "iterations", ")", "throws", "PageException", "{", "return", "crypt", "(", ...
an encrypt method that takes a byte-array for input and returns an encrypted byte-array
[ "an", "encrypt", "method", "that", "takes", "a", "byte", "-", "array", "for", "input", "and", "returns", "an", "encrypted", "byte", "-", "array" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/Cryptor.java#L149-L151
30,774
lucee/Lucee
core/src/main/java/lucee/runtime/crypt/Cryptor.java
Cryptor.encrypt
public static String encrypt(String input, String key, String algorithm, byte[] ivOrSalt, int iterations, String encoding, String charset) throws PageException { try { if (charset == null) charset = DEFAULT_CHARSET; if (encoding == null) encoding = DEFAULT_ENCODING; byte[] baInput = input.getBytes(charset); byte[] encrypted = encrypt(baInput, key, algorithm, ivOrSalt, iterations); return Coder.encode(encoding, encrypted); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); throw Caster.toPageException(t); } }
java
public static String encrypt(String input, String key, String algorithm, byte[] ivOrSalt, int iterations, String encoding, String charset) throws PageException { try { if (charset == null) charset = DEFAULT_CHARSET; if (encoding == null) encoding = DEFAULT_ENCODING; byte[] baInput = input.getBytes(charset); byte[] encrypted = encrypt(baInput, key, algorithm, ivOrSalt, iterations); return Coder.encode(encoding, encrypted); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); throw Caster.toPageException(t); } }
[ "public", "static", "String", "encrypt", "(", "String", "input", ",", "String", "key", ",", "String", "algorithm", ",", "byte", "[", "]", "ivOrSalt", ",", "int", "iterations", ",", "String", "encoding", ",", "String", "charset", ")", "throws", "PageException...
an encrypt method that takes a clear-text String for input and returns an encrypted, encoded, String
[ "an", "encrypt", "method", "that", "takes", "a", "clear", "-", "text", "String", "for", "input", "and", "returns", "an", "encrypted", "encoded", "String" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/Cryptor.java#L157-L173
30,775
lucee/Lucee
core/src/main/java/lucee/runtime/crypt/Cryptor.java
Cryptor.decrypt
public static byte[] decrypt(byte[] input, String key, String algorithm, byte[] ivOrSalt, int iterations) throws PageException { return crypt(input, key, algorithm, ivOrSalt, iterations, true); }
java
public static byte[] decrypt(byte[] input, String key, String algorithm, byte[] ivOrSalt, int iterations) throws PageException { return crypt(input, key, algorithm, ivOrSalt, iterations, true); }
[ "public", "static", "byte", "[", "]", "decrypt", "(", "byte", "[", "]", "input", ",", "String", "key", ",", "String", "algorithm", ",", "byte", "[", "]", "ivOrSalt", ",", "int", "iterations", ")", "throws", "PageException", "{", "return", "crypt", "(", ...
a decrypt method that takes an encrypted byte-array for input and returns an unencrypted byte-array
[ "a", "decrypt", "method", "that", "takes", "an", "encrypted", "byte", "-", "array", "for", "input", "and", "returns", "an", "unencrypted", "byte", "-", "array" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/Cryptor.java#L179-L181
30,776
lucee/Lucee
core/src/main/java/lucee/runtime/crypt/Cryptor.java
Cryptor.decrypt
public static String decrypt(String input, String key, String algorithm, byte[] ivOrSalt, int iterations, String encoding, String charset) throws PageException { try { if (charset == null) charset = DEFAULT_CHARSET; if (encoding == null) encoding = DEFAULT_ENCODING; byte[] baInput = Coder.decode(encoding, input); byte[] decrypted = decrypt(baInput, key, algorithm, ivOrSalt, iterations); return new String(decrypted, charset); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); throw Caster.toPageException(t); } }
java
public static String decrypt(String input, String key, String algorithm, byte[] ivOrSalt, int iterations, String encoding, String charset) throws PageException { try { if (charset == null) charset = DEFAULT_CHARSET; if (encoding == null) encoding = DEFAULT_ENCODING; byte[] baInput = Coder.decode(encoding, input); byte[] decrypted = decrypt(baInput, key, algorithm, ivOrSalt, iterations); return new String(decrypted, charset); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); throw Caster.toPageException(t); } }
[ "public", "static", "String", "decrypt", "(", "String", "input", ",", "String", "key", ",", "String", "algorithm", ",", "byte", "[", "]", "ivOrSalt", ",", "int", "iterations", ",", "String", "encoding", ",", "String", "charset", ")", "throws", "PageException...
a decrypt method that takes an encrypted, encoded, String for input and returns a clear-text String
[ "a", "decrypt", "method", "that", "takes", "an", "encrypted", "encoded", "String", "for", "input", "and", "returns", "a", "clear", "-", "text", "String" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/crypt/Cryptor.java#L187-L203
30,777
lucee/Lucee
core/src/main/java/lucee/commons/io/res/type/datasource/DatasourceResourceProvider.java
DatasourceResourceProvider.release
void release(DatasourceConnection dc) { if (dc != null) { try { dc.getConnection().commit(); dc.getConnection().setAutoCommit(true); dc.getConnection().setTransactionIsolation(Connection.TRANSACTION_NONE); } catch (SQLException e) {} getManager().releaseConnection(ThreadLocalPageContext.get(), dc); } }
java
void release(DatasourceConnection dc) { if (dc != null) { try { dc.getConnection().commit(); dc.getConnection().setAutoCommit(true); dc.getConnection().setTransactionIsolation(Connection.TRANSACTION_NONE); } catch (SQLException e) {} getManager().releaseConnection(ThreadLocalPageContext.get(), dc); } }
[ "void", "release", "(", "DatasourceConnection", "dc", ")", "{", "if", "(", "dc", "!=", "null", ")", "{", "try", "{", "dc", ".", "getConnection", "(", ")", ".", "commit", "(", ")", ";", "dc", ".", "getConnection", "(", ")", ".", "setAutoCommit", "(", ...
release datasource connection @param dc @param autoCommit
[ "release", "datasource", "connection" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/res/type/datasource/DatasourceResourceProvider.java#L582-L594
30,778
lucee/Lucee
core/src/main/java/lucee/runtime/rest/RestUtil.java
RestUtil.matchPath
public static int matchPath(Struct variables, Path[] restPath, String[] callerPath) { if (restPath.length > callerPath.length) return -1; int index = 0; for (; index < restPath.length; index++) { if (!restPath[index].match(variables, callerPath[index])) return -1; } return index - 1; }
java
public static int matchPath(Struct variables, Path[] restPath, String[] callerPath) { if (restPath.length > callerPath.length) return -1; int index = 0; for (; index < restPath.length; index++) { if (!restPath[index].match(variables, callerPath[index])) return -1; } return index - 1; }
[ "public", "static", "int", "matchPath", "(", "Struct", "variables", ",", "Path", "[", "]", "restPath", ",", "String", "[", "]", "callerPath", ")", "{", "if", "(", "restPath", ".", "length", ">", "callerPath", ".", "length", ")", "return", "-", "1", ";"...
check if caller path match the cfc path @param variables @param restPath @param callerPath @return match until which index of the given cfc path, returns -1 if there is no match
[ "check", "if", "caller", "path", "match", "the", "cfc", "path" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/rest/RestUtil.java#L46-L54
30,779
lucee/Lucee
core/src/main/java/lucee/runtime/gateway/GatewayEngineImpl.java
GatewayEngineImpl.sendMessage
public String sendMessage(String gatewayId, Struct data) throws PageException, IOException { Gateway g = getGateway(gatewayId); if (g.getState() != Gateway.RUNNING) throw new GatewayException("Gateway [" + gatewayId + "] is not running"); return g.sendMessage(data); }
java
public String sendMessage(String gatewayId, Struct data) throws PageException, IOException { Gateway g = getGateway(gatewayId); if (g.getState() != Gateway.RUNNING) throw new GatewayException("Gateway [" + gatewayId + "] is not running"); return g.sendMessage(data); }
[ "public", "String", "sendMessage", "(", "String", "gatewayId", ",", "Struct", "data", ")", "throws", "PageException", ",", "IOException", "{", "Gateway", "g", "=", "getGateway", "(", "gatewayId", ")", ";", "if", "(", "g", ".", "getState", "(", ")", "!=", ...
send the message to the gateway @param gatewayId @param data @return @throws PageException
[ "send", "the", "message", "to", "the", "gateway" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/gateway/GatewayEngineImpl.java#L162-L166
30,780
lucee/Lucee
core/src/main/java/lucee/runtime/gateway/GatewayEngineImpl.java
GatewayEngineImpl.stopAll
public void stopAll() { Iterator<GatewayEntry> it = getEntries().values().iterator(); Gateway g; while (it.hasNext()) { g = it.next().getGateway(); if (g != null) stop(g); } }
java
public void stopAll() { Iterator<GatewayEntry> it = getEntries().values().iterator(); Gateway g; while (it.hasNext()) { g = it.next().getGateway(); if (g != null) stop(g); } }
[ "public", "void", "stopAll", "(", ")", "{", "Iterator", "<", "GatewayEntry", ">", "it", "=", "getEntries", "(", ")", ".", "values", "(", ")", ".", "iterator", "(", ")", ";", "Gateway", "g", ";", "while", "(", "it", ".", "hasNext", "(", ")", ")", ...
stop all entries
[ "stop", "all", "entries" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/gateway/GatewayEngineImpl.java#L199-L206
30,781
lucee/Lucee
core/src/main/java/lucee/commons/io/compress/CompressUtil.java
CompressUtil.compressGZip
private static void compressGZip(Resource source, Resource target) throws IOException { if (source.isDirectory()) { throw new IOException("you can only create a GZIP File from a single source file, use TGZ (TAR-GZIP) to first TAR multiple files"); } InputStream is = null; OutputStream os = null; try { is = source.getInputStream(); os = target.getOutputStream(); } catch (IOException ioe) { IOUtil.closeEL(is, os); throw ioe; } compressGZip(is, os); }
java
private static void compressGZip(Resource source, Resource target) throws IOException { if (source.isDirectory()) { throw new IOException("you can only create a GZIP File from a single source file, use TGZ (TAR-GZIP) to first TAR multiple files"); } InputStream is = null; OutputStream os = null; try { is = source.getInputStream(); os = target.getOutputStream(); } catch (IOException ioe) { IOUtil.closeEL(is, os); throw ioe; } compressGZip(is, os); }
[ "private", "static", "void", "compressGZip", "(", "Resource", "source", ",", "Resource", "target", ")", "throws", "IOException", "{", "if", "(", "source", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IOException", "(", "\"you can only create a GZIP F...
compress a source file to a gzip file @param source @param target @throws IOException @throws IOException
[ "compress", "a", "source", "file", "to", "a", "gzip", "file" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/compress/CompressUtil.java#L412-L428
30,782
lucee/Lucee
core/src/main/java/lucee/commons/io/compress/CompressUtil.java
CompressUtil._compressBZip2
private static void _compressBZip2(InputStream source, OutputStream target) throws IOException { InputStream is = IOUtil.toBufferedInputStream(source); OutputStream os = new BZip2CompressorOutputStream(IOUtil.toBufferedOutputStream(target)); IOUtil.copy(is, os, true, true); }
java
private static void _compressBZip2(InputStream source, OutputStream target) throws IOException { InputStream is = IOUtil.toBufferedInputStream(source); OutputStream os = new BZip2CompressorOutputStream(IOUtil.toBufferedOutputStream(target)); IOUtil.copy(is, os, true, true); }
[ "private", "static", "void", "_compressBZip2", "(", "InputStream", "source", ",", "OutputStream", "target", ")", "throws", "IOException", "{", "InputStream", "is", "=", "IOUtil", ".", "toBufferedInputStream", "(", "source", ")", ";", "OutputStream", "os", "=", "...
compress a source file to a bzip2 file @param source @param target @throws IOException
[ "compress", "a", "source", "file", "to", "a", "bzip2", "file" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/compress/CompressUtil.java#L468-L473
30,783
lucee/Lucee
core/src/main/java/lucee/runtime/reflection/storage/WeakFieldStorage.java
WeakFieldStorage.getFields
public Field[] getFields(Class clazz, String fieldname) { Struct fieldMap; Object o; synchronized (map) { o = map.get(clazz); if (o == null) { fieldMap = store(clazz); } else fieldMap = (Struct) o; } o = fieldMap.get(fieldname, null); if (o == null) return null; return (Field[]) o; }
java
public Field[] getFields(Class clazz, String fieldname) { Struct fieldMap; Object o; synchronized (map) { o = map.get(clazz); if (o == null) { fieldMap = store(clazz); } else fieldMap = (Struct) o; } o = fieldMap.get(fieldname, null); if (o == null) return null; return (Field[]) o; }
[ "public", "Field", "[", "]", "getFields", "(", "Class", "clazz", ",", "String", "fieldname", ")", "{", "Struct", "fieldMap", ";", "Object", "o", ";", "synchronized", "(", "map", ")", "{", "o", "=", "map", ".", "get", "(", "clazz", ")", ";", "if", "...
returns all fields matching given criteria or null if field does exist @param clazz clazz to get field from @param fieldname Name of the Field to get @return matching Fields as Array
[ "returns", "all", "fields", "matching", "given", "criteria", "or", "null", "if", "field", "does", "exist" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/reflection/storage/WeakFieldStorage.java#L40-L54
30,784
lucee/Lucee
core/src/main/java/lucee/runtime/MappingImpl.java
MappingImpl.cloneReadOnly
public MappingImpl cloneReadOnly(ConfigImpl config) { return new MappingImpl(config, virtual, strPhysical, strArchive, inspect, physicalFirst, hidden, true, topLevel, appMapping, ignoreVirtual, appListener, listenerMode, listenerType); }
java
public MappingImpl cloneReadOnly(ConfigImpl config) { return new MappingImpl(config, virtual, strPhysical, strArchive, inspect, physicalFirst, hidden, true, topLevel, appMapping, ignoreVirtual, appListener, listenerMode, listenerType); }
[ "public", "MappingImpl", "cloneReadOnly", "(", "ConfigImpl", "config", ")", "{", "return", "new", "MappingImpl", "(", "config", ",", "virtual", ",", "strPhysical", ",", "strArchive", ",", "inspect", ",", "physicalFirst", ",", "hidden", ",", "true", ",", "topLe...
clones a mapping and make it readOnly @param config @return cloned mapping @throws IOException
[ "clones", "a", "mapping", "and", "make", "it", "readOnly" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/MappingImpl.java#L318-L321
30,785
lucee/Lucee
core/src/main/java/lucee/intergral/fusiondebug/server/util/FDCaster.java
FDCaster.serialize
public static String serialize(Object object) { if (object == null) return "[null]"; try { return new ScriptConverter().serialize(object); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); return object.toString(); } }
java
public static String serialize(Object object) { if (object == null) return "[null]"; try { return new ScriptConverter().serialize(object); } catch (Throwable t) { ExceptionUtil.rethrowIfNecessary(t); return object.toString(); } }
[ "public", "static", "String", "serialize", "(", "Object", "object", ")", "{", "if", "(", "object", "==", "null", ")", "return", "\"[null]\"", ";", "try", "{", "return", "new", "ScriptConverter", "(", ")", ".", "serialize", "(", "object", ")", ";", "}", ...
translate a object to its string representation @param object @return
[ "translate", "a", "object", "to", "its", "string", "representation" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/intergral/fusiondebug/server/util/FDCaster.java#L59-L68
30,786
lucee/Lucee
core/src/main/java/lucee/runtime/type/util/MemberUtil.java
MemberUtil.callWithNamedValues
public static Object callWithNamedValues(PageContext pc, Object coll, Collection.Key methodName, Struct args, short type, String strType) throws PageException { Map<Key, FunctionLibFunction> members = getMembers(pc, type); FunctionLibFunction member = members.get(methodName); if (member != null) { List<FunctionLibFunctionArg> _args = member.getArg(); FunctionLibFunctionArg arg; if (args.size() < _args.size()) { Object val; ArrayList<Ref> refs = new ArrayList<Ref>(); arg = _args.get(0); refs.add(new Casting(arg.getTypeAsString(), arg.getType(), new LFunctionValue(new LString(arg.getName()), coll))); for (int y = 1; y < _args.size(); y++) { arg = _args.get(y); // match by name val = args.get(arg.getName(), null); // match by alias if (val == null) { String alias = arg.getAlias(); if (!StringUtil.isEmpty(alias, true)) { String[] aliases = lucee.runtime.type.util.ListUtil.trimItems(lucee.runtime.type.util.ListUtil.listToStringArray(alias, ',')); for (int x = 0; x < aliases.length; x++) { val = args.get(aliases[x], null); if (val != null) break; } } } if (val == null) { if (arg.getRequired()) { String[] names = member.getMemberNames(); String n = ArrayUtil.isEmpty(names) ? "" : names[0]; throw new ExpressionException("missing required argument [" + arg.getName() + "] for member function call [" + n + "]"); } } else { refs.add(new Casting(arg.getTypeAsString(), arg.getType(), new LFunctionValue(new LString(arg.getName()), val))); // refs.add(new LFunctionValue(new LString(arg.getName()),new // Casting(pc,arg.getTypeAsString(),arg.getType(),val))); } } return new BIFCall(coll, member, refs.toArray(new Ref[refs.size()])).getValue(pc); } } throw new ExpressionException("No matching function member [" + methodName + "] for call with named arguments found, available function members are [" + lucee.runtime.type.util.ListUtil.sort(CollectionUtil.getKeyList(members.keySet().iterator(), ","), "textnocase", "asc", ",") + "]"); }
java
public static Object callWithNamedValues(PageContext pc, Object coll, Collection.Key methodName, Struct args, short type, String strType) throws PageException { Map<Key, FunctionLibFunction> members = getMembers(pc, type); FunctionLibFunction member = members.get(methodName); if (member != null) { List<FunctionLibFunctionArg> _args = member.getArg(); FunctionLibFunctionArg arg; if (args.size() < _args.size()) { Object val; ArrayList<Ref> refs = new ArrayList<Ref>(); arg = _args.get(0); refs.add(new Casting(arg.getTypeAsString(), arg.getType(), new LFunctionValue(new LString(arg.getName()), coll))); for (int y = 1; y < _args.size(); y++) { arg = _args.get(y); // match by name val = args.get(arg.getName(), null); // match by alias if (val == null) { String alias = arg.getAlias(); if (!StringUtil.isEmpty(alias, true)) { String[] aliases = lucee.runtime.type.util.ListUtil.trimItems(lucee.runtime.type.util.ListUtil.listToStringArray(alias, ',')); for (int x = 0; x < aliases.length; x++) { val = args.get(aliases[x], null); if (val != null) break; } } } if (val == null) { if (arg.getRequired()) { String[] names = member.getMemberNames(); String n = ArrayUtil.isEmpty(names) ? "" : names[0]; throw new ExpressionException("missing required argument [" + arg.getName() + "] for member function call [" + n + "]"); } } else { refs.add(new Casting(arg.getTypeAsString(), arg.getType(), new LFunctionValue(new LString(arg.getName()), val))); // refs.add(new LFunctionValue(new LString(arg.getName()),new // Casting(pc,arg.getTypeAsString(),arg.getType(),val))); } } return new BIFCall(coll, member, refs.toArray(new Ref[refs.size()])).getValue(pc); } } throw new ExpressionException("No matching function member [" + methodName + "] for call with named arguments found, available function members are [" + lucee.runtime.type.util.ListUtil.sort(CollectionUtil.getKeyList(members.keySet().iterator(), ","), "textnocase", "asc", ",") + "]"); }
[ "public", "static", "Object", "callWithNamedValues", "(", "PageContext", "pc", ",", "Object", "coll", ",", "Collection", ".", "Key", "methodName", ",", "Struct", "args", ",", "short", "type", ",", "String", "strType", ")", "throws", "PageException", "{", "Map"...
used in extension image
[ "used", "in", "extension", "image" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/type/util/MemberUtil.java#L169-L219
30,787
lucee/Lucee
core/src/main/java/lucee/commons/date/TimeZoneUtil.java
TimeZoneUtil.toTimeZone
public static TimeZone toTimeZone(String strTimezone, TimeZone defaultValue) { if (strTimezone == null) return defaultValue; String strTimezoneTrimmed = StringUtil.replace(strTimezone.trim().toLowerCase(), " ", "", false); TimeZone tz = getTimeZoneFromIDS(strTimezoneTrimmed); if (tz != null) return tz; // parse GMT followd by a number float gmtOffset = Float.NaN; if (strTimezoneTrimmed.startsWith("gmt")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(3).trim(), Float.NaN); else if (strTimezoneTrimmed.startsWith("etc/gmt")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(7).trim(), Float.NaN); else if (strTimezoneTrimmed.startsWith("utc")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(3).trim(), Float.NaN); else if (strTimezoneTrimmed.startsWith("etc/utc")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(7).trim(), Float.NaN); if (!Float.isNaN(gmtOffset)) { strTimezoneTrimmed = "etc/gmt" + (gmtOffset >= 0 ? "+" : "") + Caster.toString(gmtOffset); tz = getTimeZoneFromIDS(strTimezoneTrimmed); if (tz != null) return tz; } // display name in all variations if (!StringUtil.isEmpty(strTimezoneTrimmed)) { tz = dn.get(strTimezoneTrimmed); if (tz != null) return tz; Iterator<Object> it = IDS.values().iterator(); Object o; while (it.hasNext()) { o = it.next(); if (o instanceof TimeZone) { tz = (TimeZone) o; if (strTimezone.equalsIgnoreCase(tz.getDisplayName(true, TimeZone.SHORT, Locale.US)) || strTimezone.equalsIgnoreCase(tz.getDisplayName(false, TimeZone.SHORT, Locale.US)) || strTimezone.equalsIgnoreCase(tz.getDisplayName(true, TimeZone.LONG, Locale.US)) || strTimezone.equalsIgnoreCase(tz.getDisplayName(false, TimeZone.LONG, Locale.US))) { dn.put(strTimezoneTrimmed, tz); return tz; } } } } return defaultValue; }
java
public static TimeZone toTimeZone(String strTimezone, TimeZone defaultValue) { if (strTimezone == null) return defaultValue; String strTimezoneTrimmed = StringUtil.replace(strTimezone.trim().toLowerCase(), " ", "", false); TimeZone tz = getTimeZoneFromIDS(strTimezoneTrimmed); if (tz != null) return tz; // parse GMT followd by a number float gmtOffset = Float.NaN; if (strTimezoneTrimmed.startsWith("gmt")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(3).trim(), Float.NaN); else if (strTimezoneTrimmed.startsWith("etc/gmt")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(7).trim(), Float.NaN); else if (strTimezoneTrimmed.startsWith("utc")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(3).trim(), Float.NaN); else if (strTimezoneTrimmed.startsWith("etc/utc")) gmtOffset = getGMTOffset(strTimezoneTrimmed.substring(7).trim(), Float.NaN); if (!Float.isNaN(gmtOffset)) { strTimezoneTrimmed = "etc/gmt" + (gmtOffset >= 0 ? "+" : "") + Caster.toString(gmtOffset); tz = getTimeZoneFromIDS(strTimezoneTrimmed); if (tz != null) return tz; } // display name in all variations if (!StringUtil.isEmpty(strTimezoneTrimmed)) { tz = dn.get(strTimezoneTrimmed); if (tz != null) return tz; Iterator<Object> it = IDS.values().iterator(); Object o; while (it.hasNext()) { o = it.next(); if (o instanceof TimeZone) { tz = (TimeZone) o; if (strTimezone.equalsIgnoreCase(tz.getDisplayName(true, TimeZone.SHORT, Locale.US)) || strTimezone.equalsIgnoreCase(tz.getDisplayName(false, TimeZone.SHORT, Locale.US)) || strTimezone.equalsIgnoreCase(tz.getDisplayName(true, TimeZone.LONG, Locale.US)) || strTimezone.equalsIgnoreCase(tz.getDisplayName(false, TimeZone.LONG, Locale.US))) { dn.put(strTimezoneTrimmed, tz); return tz; } } } } return defaultValue; }
[ "public", "static", "TimeZone", "toTimeZone", "(", "String", "strTimezone", ",", "TimeZone", "defaultValue", ")", "{", "if", "(", "strTimezone", "==", "null", ")", "return", "defaultValue", ";", "String", "strTimezoneTrimmed", "=", "StringUtil", ".", "replace", ...
translate timezone string format to a timezone @param strTimezoneTrimmed @return
[ "translate", "timezone", "string", "format", "to", "a", "timezone" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/date/TimeZoneUtil.java#L179-L221
30,788
lucee/Lucee
core/src/main/java/lucee/transformer/interpreter/InterpreterContext.java
InterpreterContext.getValueAsString
public String getValueAsString(Expression expr) throws PageException { expr.writeOut(this, Expression.MODE_REF); return Caster.toString(stack.pop()); }
java
public String getValueAsString(Expression expr) throws PageException { expr.writeOut(this, Expression.MODE_REF); return Caster.toString(stack.pop()); }
[ "public", "String", "getValueAsString", "(", "Expression", "expr", ")", "throws", "PageException", "{", "expr", ".", "writeOut", "(", "this", ",", "Expression", ".", "MODE_REF", ")", ";", "return", "Caster", ".", "toString", "(", "stack", ".", "pop", "(", ...
removes the element from top of the stack @return public String stackPopBottomAsString() { // TODO Auto-generated method stub return null; } public boolean stackPopBottomAsBoolean() { // TODO Auto-generated method stub return false; }
[ "removes", "the", "element", "from", "top", "of", "the", "stack" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/transformer/interpreter/InterpreterContext.java#L95-L98
30,789
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.repeatString
public static String repeatString(String str, int count) { if (count <= 0) return ""; char[] chars = str.toCharArray(); char[] rtn = new char[chars.length * count]; int pos = 0; for (int i = 0; i < count; i++) { for (int y = 0; y < chars.length; y++) rtn[pos++] = chars[y]; // rtn.append(str); } return new String(rtn); }
java
public static String repeatString(String str, int count) { if (count <= 0) return ""; char[] chars = str.toCharArray(); char[] rtn = new char[chars.length * count]; int pos = 0; for (int i = 0; i < count; i++) { for (int y = 0; y < chars.length; y++) rtn[pos++] = chars[y]; // rtn.append(str); } return new String(rtn); }
[ "public", "static", "String", "repeatString", "(", "String", "str", ",", "int", "count", ")", "{", "if", "(", "count", "<=", "0", ")", "return", "\"\"", ";", "char", "[", "]", "chars", "=", "str", ".", "toCharArray", "(", ")", ";", "char", "[", "]"...
reapeats a string @param str string to repeat @param count how many time string will be repeated @return reapted string
[ "reapeats", "a", "string" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L237-L248
30,790
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.reqExpEscape
public static String reqExpEscape(String str) { char[] arr = str.toCharArray(); StringBuilder sb = new StringBuilder(str.length() * 2); for (int i = 0; i < arr.length; i++) { sb.append('\\'); sb.append(arr[i]); } return sb.toString(); }
java
public static String reqExpEscape(String str) { char[] arr = str.toCharArray(); StringBuilder sb = new StringBuilder(str.length() * 2); for (int i = 0; i < arr.length; i++) { sb.append('\\'); sb.append(arr[i]); } return sb.toString(); }
[ "public", "static", "String", "reqExpEscape", "(", "String", "str", ")", "{", "char", "[", "]", "arr", "=", "str", ".", "toCharArray", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "str", ".", "length", "(", ")", "*", "2", "...
escape all special characters of the regular expresson language @param str String to escape @return escaped String
[ "escape", "all", "special", "characters", "of", "the", "regular", "expresson", "language" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L278-L288
30,791
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.toIdentityVariableName
public static String toIdentityVariableName(String varName) { char[] chars = varName.toCharArray(); long changes = 0; StringBuilder rtn = new StringBuilder(chars.length + 2); rtn.append("CF"); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) rtn.append(c); else { rtn.append('_'); changes += (c * (i + 1)); } } return rtn.append(changes).toString(); }
java
public static String toIdentityVariableName(String varName) { char[] chars = varName.toCharArray(); long changes = 0; StringBuilder rtn = new StringBuilder(chars.length + 2); rtn.append("CF"); for (int i = 0; i < chars.length; i++) { char c = chars[i]; if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) rtn.append(c); else { rtn.append('_'); changes += (c * (i + 1)); } } return rtn.append(changes).toString(); }
[ "public", "static", "String", "toIdentityVariableName", "(", "String", "varName", ")", "{", "char", "[", "]", "chars", "=", "varName", ".", "toCharArray", "(", ")", ";", "long", "changes", "=", "0", ";", "StringBuilder", "rtn", "=", "new", "StringBuilder", ...
translate a string to a valid identity variable name @param varName variable name template to translate @return translated variable name
[ "translate", "a", "string", "to", "a", "valid", "identity", "variable", "name" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L296-L313
30,792
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.toClassName
public static String toClassName(String str) { StringBuilder rtn = new StringBuilder(); String[] arr = str.split("[\\\\|//]"); for (int i = 0; i < arr.length; i++) { if (arr[i].length() == 0) continue; if (rtn.length() != 0) rtn.append('.'); char[] chars = arr[i].toCharArray(); long changes = 0; for (int y = 0; y < chars.length; y++) { char c = chars[y]; if (y == 0 && (c >= '0' && c <= '9')) rtn.append("_" + c); else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) rtn.append(c); else { rtn.append('_'); changes += (c * (i + 1)); } } if (changes > 0) rtn.append(changes); } return rtn.toString(); }
java
public static String toClassName(String str) { StringBuilder rtn = new StringBuilder(); String[] arr = str.split("[\\\\|//]"); for (int i = 0; i < arr.length; i++) { if (arr[i].length() == 0) continue; if (rtn.length() != 0) rtn.append('.'); char[] chars = arr[i].toCharArray(); long changes = 0; for (int y = 0; y < chars.length; y++) { char c = chars[y]; if (y == 0 && (c >= '0' && c <= '9')) rtn.append("_" + c); else if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9')) rtn.append(c); else { rtn.append('_'); changes += (c * (i + 1)); } } if (changes > 0) rtn.append(changes); } return rtn.toString(); }
[ "public", "static", "String", "toClassName", "(", "String", "str", ")", "{", "StringBuilder", "rtn", "=", "new", "StringBuilder", "(", ")", ";", "String", "[", "]", "arr", "=", "str", ".", "split", "(", "\"[\\\\\\\\|//]\"", ")", ";", "for", "(", "int", ...
translate a string to a valid classname string @param str string to translate @return translated String
[ "translate", "a", "string", "to", "a", "valid", "classname", "string" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L321-L341
30,793
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.ltrim
public static String ltrim(String str, String defaultValue) { if (str == null) return defaultValue; int len = str.length(); int st = 0; while ((st < len) && (str.charAt(st) <= ' ')) { st++; } return ((st > 0)) ? str.substring(st) : str; }
java
public static String ltrim(String str, String defaultValue) { if (str == null) return defaultValue; int len = str.length(); int st = 0; while ((st < len) && (str.charAt(st) <= ' ')) { st++; } return ((st > 0)) ? str.substring(st) : str; }
[ "public", "static", "String", "ltrim", "(", "String", "str", ",", "String", "defaultValue", ")", "{", "if", "(", "str", "==", "null", ")", "return", "defaultValue", ";", "int", "len", "=", "str", ".", "length", "(", ")", ";", "int", "st", "=", "0", ...
This function returns a string with whitespace stripped from the beginning of str @param str String to clean @return cleaned String
[ "This", "function", "returns", "a", "string", "with", "whitespace", "stripped", "from", "the", "beginning", "of", "str" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L483-L492
30,794
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.rtrim
public static String rtrim(String str, String defaultValue) { if (str == null) return defaultValue; int len = str.length(); while ((0 < len) && (str.charAt(len - 1) <= ' ')) { len--; } return (len < str.length()) ? str.substring(0, len) : str; }
java
public static String rtrim(String str, String defaultValue) { if (str == null) return defaultValue; int len = str.length(); while ((0 < len) && (str.charAt(len - 1) <= ' ')) { len--; } return (len < str.length()) ? str.substring(0, len) : str; }
[ "public", "static", "String", "rtrim", "(", "String", "str", ",", "String", "defaultValue", ")", "{", "if", "(", "str", "==", "null", ")", "return", "defaultValue", ";", "int", "len", "=", "str", ".", "length", "(", ")", ";", "while", "(", "(", "0", ...
This function returns a string with whitespace stripped from the end of str @param str String to clean @return cleaned String
[ "This", "function", "returns", "a", "string", "with", "whitespace", "stripped", "from", "the", "end", "of", "str" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L500-L508
30,795
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.trim
public static String trim(String str, String defaultValue) { if (str == null) return defaultValue; return str.trim(); }
java
public static String trim(String str, String defaultValue) { if (str == null) return defaultValue; return str.trim(); }
[ "public", "static", "String", "trim", "(", "String", "str", ",", "String", "defaultValue", ")", "{", "if", "(", "str", "==", "null", ")", "return", "defaultValue", ";", "return", "str", ".", "trim", "(", ")", ";", "}" ]
trim given value, return defaultvalue when input is null @param str @param defaultValue @return trimmed string or defaultValue
[ "trim", "given", "value", "return", "defaultvalue", "when", "input", "is", "null" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L517-L520
30,796
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.trim
public static String trim(String str, boolean removeBOM, boolean removeSpecialWhiteSpace, String defaultValue) { if (str == null) return defaultValue; if (str.isEmpty()) return str; // remove leading BOM Marks if (removeBOM) { // UTF-16, big-endian if (str.charAt(0) == '\uFEFF') str = str.substring(1); else if (str.charAt(0) == '\uFFFD') str = str.substring(1); // UTF-16, little-endian else if (str.charAt(0) == '\uFFFE') str = str.substring(1); // UTF-8 else if (str.length() >= 2) { // TODO i get this from UTF-8 files generated by suplime text, i was expecting something else if (str.charAt(0) == '\uBBEF' && str.charAt(1) == '\uFFFD') str = str.substring(2); } } if (removeSpecialWhiteSpace) { int len = str.length(); int startIndex = 0, endIndex = len - 1; // left while ((startIndex < len) && isWhiteSpace(str.charAt(startIndex), true)) { startIndex++; } // right while ((startIndex < endIndex) && isWhiteSpace(str.charAt(endIndex), true)) { endIndex--; } return ((startIndex > 0) || (endIndex + 1 < len)) ? str.substring(startIndex, endIndex + 1) : str; } return str.trim(); }
java
public static String trim(String str, boolean removeBOM, boolean removeSpecialWhiteSpace, String defaultValue) { if (str == null) return defaultValue; if (str.isEmpty()) return str; // remove leading BOM Marks if (removeBOM) { // UTF-16, big-endian if (str.charAt(0) == '\uFEFF') str = str.substring(1); else if (str.charAt(0) == '\uFFFD') str = str.substring(1); // UTF-16, little-endian else if (str.charAt(0) == '\uFFFE') str = str.substring(1); // UTF-8 else if (str.length() >= 2) { // TODO i get this from UTF-8 files generated by suplime text, i was expecting something else if (str.charAt(0) == '\uBBEF' && str.charAt(1) == '\uFFFD') str = str.substring(2); } } if (removeSpecialWhiteSpace) { int len = str.length(); int startIndex = 0, endIndex = len - 1; // left while ((startIndex < len) && isWhiteSpace(str.charAt(startIndex), true)) { startIndex++; } // right while ((startIndex < endIndex) && isWhiteSpace(str.charAt(endIndex), true)) { endIndex--; } return ((startIndex > 0) || (endIndex + 1 < len)) ? str.substring(startIndex, endIndex + 1) : str; } return str.trim(); }
[ "public", "static", "String", "trim", "(", "String", "str", ",", "boolean", "removeBOM", ",", "boolean", "removeSpecialWhiteSpace", ",", "String", "defaultValue", ")", "{", "if", "(", "str", "==", "null", ")", "return", "defaultValue", ";", "if", "(", "str",...
trim given value, return defaultvalue when input is null this function no only removes the "classic" whitespaces, it also removes Byte order masks forgotten to remove when reading a UTF file. @param str @param removeBOM if set to true, Byte Order Mask that got forgotten get removed as well @param removeSpecialWhiteSpace if set to true, lucee removes also uncommon white spaces. @param defaultValue @return trimmed string or defaultValue
[ "trim", "given", "value", "return", "defaultvalue", "when", "input", "is", "null", "this", "function", "no", "only", "removes", "the", "classic", "whitespaces", "it", "also", "removes", "Byte", "order", "masks", "forgotten", "to", "remove", "when", "reading", ...
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L553-L587
30,797
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.hasLineFeed
public static boolean hasLineFeed(String str) { int len = str.length(); char c; for (int i = 0; i < len; i++) { c = str.charAt(i); if (c == '\n' || c == '\r') return true; } return false; }
java
public static boolean hasLineFeed(String str) { int len = str.length(); char c; for (int i = 0; i < len; i++) { c = str.charAt(i); if (c == '\n' || c == '\r') return true; } return false; }
[ "public", "static", "boolean", "hasLineFeed", "(", "String", "str", ")", "{", "int", "len", "=", "str", ".", "length", "(", ")", ";", "char", "c", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "len", ";", "i", "++", ")", "{", "c", "="...
return if in a string are line feeds or not @param str string to check @return translated string
[ "return", "if", "in", "a", "string", "are", "line", "feeds", "or", "not" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L595-L603
30,798
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.suppressWhiteSpace
public static String suppressWhiteSpace(String str) { int len = str.length(); StringBuilder sb = new StringBuilder(len); // boolean wasWS=false; char c; char buffer = 0; for (int i = 0; i < len; i++) { c = str.charAt(i); if (c == '\n' || c == '\r') buffer = '\n'; else if (isWhiteSpace(c)) { if (buffer == 0) buffer = c; } else { if (buffer != 0) { sb.append(buffer); buffer = 0; } sb.append(c); } // sb.append(c); } if (buffer != 0) sb.append(buffer); return sb.toString(); }
java
public static String suppressWhiteSpace(String str) { int len = str.length(); StringBuilder sb = new StringBuilder(len); // boolean wasWS=false; char c; char buffer = 0; for (int i = 0; i < len; i++) { c = str.charAt(i); if (c == '\n' || c == '\r') buffer = '\n'; else if (isWhiteSpace(c)) { if (buffer == 0) buffer = c; } else { if (buffer != 0) { sb.append(buffer); buffer = 0; } sb.append(c); } // sb.append(c); } if (buffer != 0) sb.append(buffer); return sb.toString(); }
[ "public", "static", "String", "suppressWhiteSpace", "(", "String", "str", ")", "{", "int", "len", "=", "str", ".", "length", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "len", ")", ";", "// boolean wasWS=false;", "char", "c", ";...
remove all white spaces followed by whitespaces @param str string to translate @return translated string
[ "remove", "all", "white", "spaces", "followed", "by", "whitespaces" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L611-L636
30,799
lucee/Lucee
core/src/main/java/lucee/commons/lang/StringUtil.java
StringUtil.replace
public static String replace(String input, String find, String repl, boolean firstOnly, boolean ignoreCase) { int findLen = find.length(); if (findLen == 0) return input; // String scan = input; /* * if ( ignoreCase ) { scan = scan.toLowerCase(); find = find.toLowerCase(); } else */ if (!ignoreCase && findLen == repl.length()) { if (find.equals(repl)) return input; if (!firstOnly && findLen == 1) return input.replace(find.charAt(0), repl.charAt(0)); } /* * print.e(input); print.e(input.length()); * * print.e(scan); print.e(scan.length()); */ /* * for(int i=0;i<scan.length();i++) { print.e(scan.charAt(i)); } */ int pos = ignoreCase ? indexOfIgnoreCase(input, find) : input.indexOf(find); if (pos == -1) return input; int start = 0; StringBuilder sb = new StringBuilder(repl.length() > find.length() ? (int) Math.ceil(input.length() * 1.2) : input.length()); while (pos != -1) { sb.append(input.substring(start, pos)); sb.append(repl); start = pos + findLen; if (firstOnly) break; pos = ignoreCase ? indexOfIgnoreCase(input, find, start) : input.indexOf(find, start); } if (input.length() > start) sb.append(input.substring(start)); return sb.toString(); }
java
public static String replace(String input, String find, String repl, boolean firstOnly, boolean ignoreCase) { int findLen = find.length(); if (findLen == 0) return input; // String scan = input; /* * if ( ignoreCase ) { scan = scan.toLowerCase(); find = find.toLowerCase(); } else */ if (!ignoreCase && findLen == repl.length()) { if (find.equals(repl)) return input; if (!firstOnly && findLen == 1) return input.replace(find.charAt(0), repl.charAt(0)); } /* * print.e(input); print.e(input.length()); * * print.e(scan); print.e(scan.length()); */ /* * for(int i=0;i<scan.length();i++) { print.e(scan.charAt(i)); } */ int pos = ignoreCase ? indexOfIgnoreCase(input, find) : input.indexOf(find); if (pos == -1) return input; int start = 0; StringBuilder sb = new StringBuilder(repl.length() > find.length() ? (int) Math.ceil(input.length() * 1.2) : input.length()); while (pos != -1) { sb.append(input.substring(start, pos)); sb.append(repl); start = pos + findLen; if (firstOnly) break; pos = ignoreCase ? indexOfIgnoreCase(input, find, start) : input.indexOf(find, start); } if (input.length() > start) sb.append(input.substring(start)); return sb.toString(); }
[ "public", "static", "String", "replace", "(", "String", "input", ",", "String", "find", ",", "String", "repl", ",", "boolean", "firstOnly", ",", "boolean", "ignoreCase", ")", "{", "int", "findLen", "=", "find", ".", "length", "(", ")", ";", "if", "(", ...
performs a replace operation on a string @param input - the string input to work on @param find - the substring to find @param repl - the substring to replace the matches with @param firstOnly - if true then only the first occurrence of {@code find} will be replaced @param ignoreCase - if true then matches will not be case sensitive @return
[ "performs", "a", "replace", "operation", "on", "a", "string" ]
29b153fc4e126e5edb97da937f2ee2e231b87593
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/lang/StringUtil.java#L690-L738