id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
152,600
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/filter/StartSearchFilter.java
StartSearchFilter.fakeTheDate
public void fakeTheDate() { int ecErrorCode; BaseField fldToCompare = m_fldToCompare; // Cache this in case it is changed if (m_fldToCompare.isNull()) return; // Don't convert the date if this is NULL! if (m_fldFakeDate == null) m_fldFakeDate = new DateField(null, FAKE_DATE, DBConstants.DEFAULT_FIELD_LENGTH, FAKE_DATE, null); //m_FieldToCompare->GetFile()->GetField(kBkFakeDate); m_fldToCompare = m_fldFakeDate; ecErrorCode = m_fldToCompare.moveFieldToThis(fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Convert the date boolean bOldState = fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(false); // Disable the reselect listener for a second if ((ecErrorCode == DBConstants.NORMAL_RETURN) && (((NumberField)m_fldToCompare).getValue() != 0)) fldToCompare.moveFieldToThis(m_fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Reformat and display the date else { fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field m_fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field } fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(bOldState); // Reenable the reselect listener for a second }
java
public void fakeTheDate() { int ecErrorCode; BaseField fldToCompare = m_fldToCompare; // Cache this in case it is changed if (m_fldToCompare.isNull()) return; // Don't convert the date if this is NULL! if (m_fldFakeDate == null) m_fldFakeDate = new DateField(null, FAKE_DATE, DBConstants.DEFAULT_FIELD_LENGTH, FAKE_DATE, null); //m_FieldToCompare->GetFile()->GetField(kBkFakeDate); m_fldToCompare = m_fldFakeDate; ecErrorCode = m_fldToCompare.moveFieldToThis(fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Convert the date boolean bOldState = fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(false); // Disable the reselect listener for a second if ((ecErrorCode == DBConstants.NORMAL_RETURN) && (((NumberField)m_fldToCompare).getValue() != 0)) fldToCompare.moveFieldToThis(m_fldToCompare, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Reformat and display the date else { fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field m_fldToCompare.initField(DBConstants.DISPLAY); // Clear this wierd field } fldToCompare.getListener(FieldReSelectHandler.class.getName()).setEnabledListener(bOldState); // Reenable the reselect listener for a second }
[ "public", "void", "fakeTheDate", "(", ")", "{", "int", "ecErrorCode", ";", "BaseField", "fldToCompare", "=", "m_fldToCompare", ";", "// Cache this in case it is changed", "if", "(", "m_fldToCompare", ".", "isNull", "(", ")", ")", "return", ";", "// Don't convert the date if this is NULL!", "if", "(", "m_fldFakeDate", "==", "null", ")", "m_fldFakeDate", "=", "new", "DateField", "(", "null", ",", "FAKE_DATE", ",", "DBConstants", ".", "DEFAULT_FIELD_LENGTH", ",", "FAKE_DATE", ",", "null", ")", ";", "//m_FieldToCompare->GetFile()->GetField(kBkFakeDate);", "m_fldToCompare", "=", "m_fldFakeDate", ";", "ecErrorCode", "=", "m_fldToCompare", ".", "moveFieldToThis", "(", "fldToCompare", ",", "DBConstants", ".", "DISPLAY", ",", "DBConstants", ".", "SCREEN_MOVE", ")", ";", "// Convert the date", "boolean", "bOldState", "=", "fldToCompare", ".", "getListener", "(", "FieldReSelectHandler", ".", "class", ".", "getName", "(", ")", ")", ".", "setEnabledListener", "(", "false", ")", ";", "// Disable the reselect listener for a second", "if", "(", "(", "ecErrorCode", "==", "DBConstants", ".", "NORMAL_RETURN", ")", "&&", "(", "(", "(", "NumberField", ")", "m_fldToCompare", ")", ".", "getValue", "(", ")", "!=", "0", ")", ")", "fldToCompare", ".", "moveFieldToThis", "(", "m_fldToCompare", ",", "DBConstants", ".", "DISPLAY", ",", "DBConstants", ".", "SCREEN_MOVE", ")", ";", "// Reformat and display the date", "else", "{", "fldToCompare", ".", "initField", "(", "DBConstants", ".", "DISPLAY", ")", ";", "// Clear this wierd field", "m_fldToCompare", ".", "initField", "(", "DBConstants", ".", "DISPLAY", ")", ";", "// Clear this wierd field", "}", "fldToCompare", ".", "getListener", "(", "FieldReSelectHandler", ".", "class", ".", "getName", "(", ")", ")", ".", "setEnabledListener", "(", "bOldState", ")", ";", "// Reenable the reselect listener for a second", "}" ]
If the current key starts with a date, convert the search field to a date and compare.
[ "If", "the", "current", "key", "starts", "with", "a", "date", "convert", "the", "search", "field", "to", "a", "date", "and", "compare", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/filter/StartSearchFilter.java#L126-L145
152,601
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/report/ReportBreakScreen.java
ReportBreakScreen.isBreak
public boolean isBreak() { if (this.getMainRecord() != null) if ((this.getMainRecord().getEditMode() != DBConstants.EDIT_CURRENT) && (this.getMainRecord().getEditMode() != DBConstants.EDIT_IN_PROGRESS)) { // End of file if ((m_iDisplayFieldDesc & HtmlConstants.FOOTING_SCREEN) == HtmlConstants.FOOTING_SCREEN) return true; // EOF = always break on footing if ((m_iDisplayFieldDesc & HtmlConstants.HEADING_SCREEN) == HtmlConstants.HEADING_SCREEN) return false; // EOF = always break on heading } Object objValue = this.getBreakValue(); if (m_objLastValue != INITIAL_VALUE) if ((objValue == m_objLastValue) || ((objValue != null) && (objValue.equals(m_objLastValue)))) return false; // Not a break boolean bChange = true; if (m_objLastValue == INITIAL_VALUE) { // End of file if ((m_iDisplayFieldDesc & HtmlConstants.FOOTING_SCREEN) == HtmlConstants.FOOTING_SCREEN) bChange = false; // Never on first time } m_objLastValue = objValue; return bChange; // Is a break }
java
public boolean isBreak() { if (this.getMainRecord() != null) if ((this.getMainRecord().getEditMode() != DBConstants.EDIT_CURRENT) && (this.getMainRecord().getEditMode() != DBConstants.EDIT_IN_PROGRESS)) { // End of file if ((m_iDisplayFieldDesc & HtmlConstants.FOOTING_SCREEN) == HtmlConstants.FOOTING_SCREEN) return true; // EOF = always break on footing if ((m_iDisplayFieldDesc & HtmlConstants.HEADING_SCREEN) == HtmlConstants.HEADING_SCREEN) return false; // EOF = always break on heading } Object objValue = this.getBreakValue(); if (m_objLastValue != INITIAL_VALUE) if ((objValue == m_objLastValue) || ((objValue != null) && (objValue.equals(m_objLastValue)))) return false; // Not a break boolean bChange = true; if (m_objLastValue == INITIAL_VALUE) { // End of file if ((m_iDisplayFieldDesc & HtmlConstants.FOOTING_SCREEN) == HtmlConstants.FOOTING_SCREEN) bChange = false; // Never on first time } m_objLastValue = objValue; return bChange; // Is a break }
[ "public", "boolean", "isBreak", "(", ")", "{", "if", "(", "this", ".", "getMainRecord", "(", ")", "!=", "null", ")", "if", "(", "(", "this", ".", "getMainRecord", "(", ")", ".", "getEditMode", "(", ")", "!=", "DBConstants", ".", "EDIT_CURRENT", ")", "&&", "(", "this", ".", "getMainRecord", "(", ")", ".", "getEditMode", "(", ")", "!=", "DBConstants", ".", "EDIT_IN_PROGRESS", ")", ")", "{", "// End of file", "if", "(", "(", "m_iDisplayFieldDesc", "&", "HtmlConstants", ".", "FOOTING_SCREEN", ")", "==", "HtmlConstants", ".", "FOOTING_SCREEN", ")", "return", "true", ";", "// EOF = always break on footing", "if", "(", "(", "m_iDisplayFieldDesc", "&", "HtmlConstants", ".", "HEADING_SCREEN", ")", "==", "HtmlConstants", ".", "HEADING_SCREEN", ")", "return", "false", ";", "// EOF = always break on heading", "}", "Object", "objValue", "=", "this", ".", "getBreakValue", "(", ")", ";", "if", "(", "m_objLastValue", "!=", "INITIAL_VALUE", ")", "if", "(", "(", "objValue", "==", "m_objLastValue", ")", "||", "(", "(", "objValue", "!=", "null", ")", "&&", "(", "objValue", ".", "equals", "(", "m_objLastValue", ")", ")", ")", ")", "return", "false", ";", "// Not a break", "boolean", "bChange", "=", "true", ";", "if", "(", "m_objLastValue", "==", "INITIAL_VALUE", ")", "{", "// End of file", "if", "(", "(", "m_iDisplayFieldDesc", "&", "HtmlConstants", ".", "FOOTING_SCREEN", ")", "==", "HtmlConstants", ".", "FOOTING_SCREEN", ")", "bChange", "=", "false", ";", "// Never on first time", "}", "m_objLastValue", "=", "objValue", ";", "return", "bChange", ";", "// Is a break", "}" ]
Is this a control break? @return True if it is a break.
[ "Is", "this", "a", "control", "break?" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/report/ReportBreakScreen.java#L136-L160
152,602
FitLayout/classify
src/main/java/org/fit/layout/classify/StyleCounter.java
StyleCounter.add
public void add(T style) { Integer cnt = styles.get(style); if (cnt == null) styles.put(style, 1); else styles.put(style, cnt+1); }
java
public void add(T style) { Integer cnt = styles.get(style); if (cnt == null) styles.put(style, 1); else styles.put(style, cnt+1); }
[ "public", "void", "add", "(", "T", "style", ")", "{", "Integer", "cnt", "=", "styles", ".", "get", "(", "style", ")", ";", "if", "(", "cnt", "==", "null", ")", "styles", ".", "put", "(", "style", ",", "1", ")", ";", "else", "styles", ".", "put", "(", "style", ",", "cnt", "+", "1", ")", ";", "}" ]
Adds a new occurence to the counter. @param style The style to be added.
[ "Adds", "a", "new", "occurence", "to", "the", "counter", "." ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/StyleCounter.java#L40-L47
152,603
FitLayout/classify
src/main/java/org/fit/layout/classify/StyleCounter.java
StyleCounter.getCount
public int getCount(T style) { Integer cnt = styles.get(style); return cnt == null ? 0 : cnt; }
java
public int getCount(T style) { Integer cnt = styles.get(style); return cnt == null ? 0 : cnt; }
[ "public", "int", "getCount", "(", "T", "style", ")", "{", "Integer", "cnt", "=", "styles", ".", "get", "(", "style", ")", ";", "return", "cnt", "==", "null", "?", "0", ":", "cnt", ";", "}" ]
Obtains total registered number of occurences of the given style. @param style the style whose number of occurences should be returned @return
[ "Obtains", "total", "registered", "number", "of", "occurences", "of", "the", "given", "style", "." ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/StyleCounter.java#L54-L58
152,604
FitLayout/classify
src/main/java/org/fit/layout/classify/StyleCounter.java
StyleCounter.getMaximalFrequency
public int getMaximalFrequency() { int maxfreq = 0; for (Map.Entry<T, Integer> entry : styles.entrySet()) { if (entry.getValue() > maxfreq) maxfreq = entry.getValue(); } return maxfreq; }
java
public int getMaximalFrequency() { int maxfreq = 0; for (Map.Entry<T, Integer> entry : styles.entrySet()) { if (entry.getValue() > maxfreq) maxfreq = entry.getValue(); } return maxfreq; }
[ "public", "int", "getMaximalFrequency", "(", ")", "{", "int", "maxfreq", "=", "0", ";", "for", "(", "Map", ".", "Entry", "<", "T", ",", "Integer", ">", "entry", ":", "styles", ".", "entrySet", "(", ")", ")", "{", "if", "(", "entry", ".", "getValue", "(", ")", ">", "maxfreq", ")", "maxfreq", "=", "entry", ".", "getValue", "(", ")", ";", "}", "return", "maxfreq", ";", "}" ]
Gets the number of the most frequent entry. @return the number of occurences of the most frequent entry
[ "Gets", "the", "number", "of", "the", "most", "frequent", "entry", "." ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/StyleCounter.java#L64-L73
152,605
FitLayout/classify
src/main/java/org/fit/layout/classify/StyleCounter.java
StyleCounter.getMostFrequent
public T getMostFrequent() { T ret = null; int freq = 0; for (Map.Entry<T, Integer> entry : styles.entrySet()) { if (entry.getValue() > freq) { ret = entry.getKey(); freq = entry.getValue(); } } return ret; }
java
public T getMostFrequent() { T ret = null; int freq = 0; for (Map.Entry<T, Integer> entry : styles.entrySet()) { if (entry.getValue() > freq) { ret = entry.getKey(); freq = entry.getValue(); } } return ret; }
[ "public", "T", "getMostFrequent", "(", ")", "{", "T", "ret", "=", "null", ";", "int", "freq", "=", "0", ";", "for", "(", "Map", ".", "Entry", "<", "T", ",", "Integer", ">", "entry", ":", "styles", ".", "entrySet", "(", ")", ")", "{", "if", "(", "entry", ".", "getValue", "(", ")", ">", "freq", ")", "{", "ret", "=", "entry", ".", "getKey", "(", ")", ";", "freq", "=", "entry", ".", "getValue", "(", ")", ";", "}", "}", "return", "ret", ";", "}" ]
Obtains the most frequent style. If there are multiple styles with the same frequency then only one of them is returned. @return The most frequent style or {@code null} when the counter is empty.
[ "Obtains", "the", "most", "frequent", "style", ".", "If", "there", "are", "multiple", "styles", "with", "the", "same", "frequency", "then", "only", "one", "of", "them", "is", "returned", "." ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/StyleCounter.java#L80-L93
152,606
FitLayout/classify
src/main/java/org/fit/layout/classify/StyleCounter.java
StyleCounter.getMostFrequentAll
public List<T> getMostFrequentAll() { List<T> ret = new ArrayList<T>(); int maxfreq = getMaximalFrequency(); for (Map.Entry<T, Integer> entry : styles.entrySet()) { if (entry.getValue() == maxfreq) ret.add(entry.getKey()); } return ret; }
java
public List<T> getMostFrequentAll() { List<T> ret = new ArrayList<T>(); int maxfreq = getMaximalFrequency(); for (Map.Entry<T, Integer> entry : styles.entrySet()) { if (entry.getValue() == maxfreq) ret.add(entry.getKey()); } return ret; }
[ "public", "List", "<", "T", ">", "getMostFrequentAll", "(", ")", "{", "List", "<", "T", ">", "ret", "=", "new", "ArrayList", "<", "T", ">", "(", ")", ";", "int", "maxfreq", "=", "getMaximalFrequency", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "T", ",", "Integer", ">", "entry", ":", "styles", ".", "entrySet", "(", ")", ")", "{", "if", "(", "entry", ".", "getValue", "(", ")", "==", "maxfreq", ")", "ret", ".", "add", "(", "entry", ".", "getKey", "(", ")", ")", ";", "}", "return", "ret", ";", "}" ]
Obtains the most frequent style or styles when multiple of them have the maximal frequency. @return The list of styles with the maximal frequency.
[ "Obtains", "the", "most", "frequent", "style", "or", "styles", "when", "multiple", "of", "them", "have", "the", "maximal", "frequency", "." ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/StyleCounter.java#L99-L109
152,607
FitLayout/classify
src/main/java/org/fit/layout/classify/StyleCounter.java
StyleCounter.getAllSorted
public Map<T, Integer> getAllSorted() { Map<T, Integer> map = styles; TreeMap<T, Integer> smap = new TreeMap<T, Integer>(new StyleCountComparator(map)); smap.putAll(map); return smap; }
java
public Map<T, Integer> getAllSorted() { Map<T, Integer> map = styles; TreeMap<T, Integer> smap = new TreeMap<T, Integer>(new StyleCountComparator(map)); smap.putAll(map); return smap; }
[ "public", "Map", "<", "T", ",", "Integer", ">", "getAllSorted", "(", ")", "{", "Map", "<", "T", ",", "Integer", ">", "map", "=", "styles", ";", "TreeMap", "<", "T", ",", "Integer", ">", "smap", "=", "new", "TreeMap", "<", "T", ",", "Integer", ">", "(", "new", "StyleCountComparator", "(", "map", ")", ")", ";", "smap", ".", "putAll", "(", "map", ")", ";", "return", "smap", ";", "}" ]
Obtains all the registered styles and their frequencies, sorted by frequency. @return A map that assigns a frequency to each unique style.
[ "Obtains", "all", "the", "registered", "styles", "and", "their", "frequencies", "sorted", "by", "frequency", "." ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/StyleCounter.java#L162-L168
152,608
FitLayout/classify
src/main/java/org/fit/layout/classify/StyleCounter.java
StyleCounter.getPercentage
public double getPercentage(T style) { int scnt = 0; int allcnt = 0; for (Map.Entry<T, Integer> entry : getAll().entrySet()) { if (entry.getKey().equals(style)) scnt = entry.getValue(); allcnt += entry.getValue(); } return scnt / (double) allcnt; }
java
public double getPercentage(T style) { int scnt = 0; int allcnt = 0; for (Map.Entry<T, Integer> entry : getAll().entrySet()) { if (entry.getKey().equals(style)) scnt = entry.getValue(); allcnt += entry.getValue(); } return scnt / (double) allcnt; }
[ "public", "double", "getPercentage", "(", "T", "style", ")", "{", "int", "scnt", "=", "0", ";", "int", "allcnt", "=", "0", ";", "for", "(", "Map", ".", "Entry", "<", "T", ",", "Integer", ">", "entry", ":", "getAll", "(", ")", ".", "entrySet", "(", ")", ")", "{", "if", "(", "entry", ".", "getKey", "(", ")", ".", "equals", "(", "style", ")", ")", "scnt", "=", "entry", ".", "getValue", "(", ")", ";", "allcnt", "+=", "entry", ".", "getValue", "(", ")", ";", "}", "return", "scnt", "/", "(", "double", ")", "allcnt", ";", "}" ]
Computes the percentage of the given style among all the style occurences. @param style the style @return the style percentage
[ "Computes", "the", "percentage", "of", "the", "given", "style", "among", "all", "the", "style", "occurences", "." ]
0b43ceb2f0be4e6d26263491893884d811f0d605
https://github.com/FitLayout/classify/blob/0b43ceb2f0be4e6d26263491893884d811f0d605/src/main/java/org/fit/layout/classify/StyleCounter.java#L175-L186
152,609
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PDatabase.java
PDatabase.getPDBTypeFromDBType
public static char getPDBTypeFromDBType(int iDatabaseType) { char strPDBType = ThinPhysicalDatabase.MEMORY_TYPE; if ((iDatabaseType & Constants.MAPPED) != 0) ; iDatabaseType = iDatabaseType & Constants.TABLE_TYPE_MASK; if (iDatabaseType == Constants.LOCAL) strPDBType = ThinPhysicalDatabase.NET_TYPE; // Never asked if (iDatabaseType == Constants.REMOTE) strPDBType = ThinPhysicalDatabase.NET_TYPE; // Never asked if (iDatabaseType == Constants.TABLE) strPDBType = ThinPhysicalDatabase.NET_TYPE; return strPDBType; }
java
public static char getPDBTypeFromDBType(int iDatabaseType) { char strPDBType = ThinPhysicalDatabase.MEMORY_TYPE; if ((iDatabaseType & Constants.MAPPED) != 0) ; iDatabaseType = iDatabaseType & Constants.TABLE_TYPE_MASK; if (iDatabaseType == Constants.LOCAL) strPDBType = ThinPhysicalDatabase.NET_TYPE; // Never asked if (iDatabaseType == Constants.REMOTE) strPDBType = ThinPhysicalDatabase.NET_TYPE; // Never asked if (iDatabaseType == Constants.TABLE) strPDBType = ThinPhysicalDatabase.NET_TYPE; return strPDBType; }
[ "public", "static", "char", "getPDBTypeFromDBType", "(", "int", "iDatabaseType", ")", "{", "char", "strPDBType", "=", "ThinPhysicalDatabase", ".", "MEMORY_TYPE", ";", "if", "(", "(", "iDatabaseType", "&", "Constants", ".", "MAPPED", ")", "!=", "0", ")", ";", "iDatabaseType", "=", "iDatabaseType", "&", "Constants", ".", "TABLE_TYPE_MASK", ";", "if", "(", "iDatabaseType", "==", "Constants", ".", "LOCAL", ")", "strPDBType", "=", "ThinPhysicalDatabase", ".", "NET_TYPE", ";", "// Never asked", "if", "(", "iDatabaseType", "==", "Constants", ".", "REMOTE", ")", "strPDBType", "=", "ThinPhysicalDatabase", ".", "NET_TYPE", ";", "// Never asked", "if", "(", "iDatabaseType", "==", "Constants", ".", "TABLE", ")", "strPDBType", "=", "ThinPhysicalDatabase", ".", "NET_TYPE", ";", "return", "strPDBType", ";", "}" ]
Get the physical db type from the record db type. @param iDatabaseType @return
[ "Get", "the", "physical", "db", "type", "from", "the", "record", "db", "type", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PDatabase.java#L169-L182
152,610
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PDatabase.java
PDatabase.addPTable
public void addPTable(PTable physicalTable) { Object strKey = physicalTable.getLookupKey(); m_htTableList.put(strKey, physicalTable); this.getPDatabaseParent().addTableToCache(physicalTable); // If cache is on }
java
public void addPTable(PTable physicalTable) { Object strKey = physicalTable.getLookupKey(); m_htTableList.put(strKey, physicalTable); this.getPDatabaseParent().addTableToCache(physicalTable); // If cache is on }
[ "public", "void", "addPTable", "(", "PTable", "physicalTable", ")", "{", "Object", "strKey", "=", "physicalTable", ".", "getLookupKey", "(", ")", ";", "m_htTableList", ".", "put", "(", "strKey", ",", "physicalTable", ")", ";", "this", ".", "getPDatabaseParent", "(", ")", ".", "addTableToCache", "(", "physicalTable", ")", ";", "// If cache is on", "}" ]
Add this raw data table to my table list. @param physicalTable The raw data table to add.
[ "Add", "this", "raw", "data", "table", "to", "my", "table", "list", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PDatabase.java#L216-L221
152,611
jbundle/jbundle
thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PDatabase.java
PDatabase.removePDatabaseOwner
public int removePDatabaseOwner(ThinPhysicalDatabaseOwner pDatabaseOwner, boolean bFreeIfEmpty) { m_setPDatabaseOwners.remove(pDatabaseOwner); if (bFreeIfEmpty) if (m_setPDatabaseOwners.size() == 0) if (m_htTableList.size() == 0) { this.free(); return 0; } return m_setPDatabaseOwners.size(); }
java
public int removePDatabaseOwner(ThinPhysicalDatabaseOwner pDatabaseOwner, boolean bFreeIfEmpty) { m_setPDatabaseOwners.remove(pDatabaseOwner); if (bFreeIfEmpty) if (m_setPDatabaseOwners.size() == 0) if (m_htTableList.size() == 0) { this.free(); return 0; } return m_setPDatabaseOwners.size(); }
[ "public", "int", "removePDatabaseOwner", "(", "ThinPhysicalDatabaseOwner", "pDatabaseOwner", ",", "boolean", "bFreeIfEmpty", ")", "{", "m_setPDatabaseOwners", ".", "remove", "(", "pDatabaseOwner", ")", ";", "if", "(", "bFreeIfEmpty", ")", "if", "(", "m_setPDatabaseOwners", ".", "size", "(", ")", "==", "0", ")", "if", "(", "m_htTableList", ".", "size", "(", ")", "==", "0", ")", "{", "this", ".", "free", "(", ")", ";", "return", "0", ";", "}", "return", "m_setPDatabaseOwners", ".", "size", "(", ")", ";", "}" ]
Remove this physical database owner. @param pDatabaseOwner @return
[ "Remove", "this", "physical", "database", "owner", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/db/base/src/main/java/org/jbundle/thin/base/db/mem/base/PDatabase.java#L237-L248
152,612
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/FieldScratchHandler.java
FieldScratchHandler.getFieldCopy
public BaseField getFieldCopy() { try { if (m_fldCopy == null) m_fldCopy = (BaseField)this.getOwner().clone(); // Make a copy } catch (CloneNotSupportedException ex) { m_fldCopy = null; } return m_fldCopy; }
java
public BaseField getFieldCopy() { try { if (m_fldCopy == null) m_fldCopy = (BaseField)this.getOwner().clone(); // Make a copy } catch (CloneNotSupportedException ex) { m_fldCopy = null; } return m_fldCopy; }
[ "public", "BaseField", "getFieldCopy", "(", ")", "{", "try", "{", "if", "(", "m_fldCopy", "==", "null", ")", "m_fldCopy", "=", "(", "BaseField", ")", "this", ".", "getOwner", "(", ")", ".", "clone", "(", ")", ";", "// Make a copy", "}", "catch", "(", "CloneNotSupportedException", "ex", ")", "{", "m_fldCopy", "=", "null", ";", "}", "return", "m_fldCopy", ";", "}" ]
Get the field copy. Clone a copy if the copy doesn't exist. @return The field copy.
[ "Get", "the", "field", "copy", ".", "Clone", "a", "copy", "if", "the", "copy", "doesn", "t", "exist", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/FieldScratchHandler.java#L73-L82
152,613
tvesalainen/util
util/src/main/java/org/vesalainen/util/AbstractProvisioner.java
AbstractProvisioner.detach
public void detach(Object ob) { Iterator<Map.Entry<String, List<InstanceMethod>>> ki = map.entrySet().iterator(); while (ki.hasNext()) { Map.Entry<String, List<InstanceMethod>> entry = ki.next(); Iterator<InstanceMethod> li = entry.getValue().iterator(); while (li.hasNext()) { InstanceMethod im = li.next(); if (im.instance.equals(ob)) { li.remove(); } } if (entry.getValue().isEmpty()) { ki.remove(); } } }
java
public void detach(Object ob) { Iterator<Map.Entry<String, List<InstanceMethod>>> ki = map.entrySet().iterator(); while (ki.hasNext()) { Map.Entry<String, List<InstanceMethod>> entry = ki.next(); Iterator<InstanceMethod> li = entry.getValue().iterator(); while (li.hasNext()) { InstanceMethod im = li.next(); if (im.instance.equals(ob)) { li.remove(); } } if (entry.getValue().isEmpty()) { ki.remove(); } } }
[ "public", "void", "detach", "(", "Object", "ob", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "String", ",", "List", "<", "InstanceMethod", ">", ">", ">", "ki", "=", "map", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "ki", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "<", "String", ",", "List", "<", "InstanceMethod", ">", ">", "entry", "=", "ki", ".", "next", "(", ")", ";", "Iterator", "<", "InstanceMethod", ">", "li", "=", "entry", ".", "getValue", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "li", ".", "hasNext", "(", ")", ")", "{", "InstanceMethod", "im", "=", "li", ".", "next", "(", ")", ";", "if", "(", "im", ".", "instance", ".", "equals", "(", "ob", ")", ")", "{", "li", ".", "remove", "(", ")", ";", "}", "}", "if", "(", "entry", ".", "getValue", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "ki", ".", "remove", "(", ")", ";", "}", "}", "}" ]
Removes all previously made attachments to given object. @param ob
[ "Removes", "all", "previously", "made", "attachments", "to", "given", "object", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/AbstractProvisioner.java#L96-L116
152,614
tvesalainen/util
util/src/main/java/org/vesalainen/util/AbstractProvisioner.java
AbstractProvisioner.detach
public void detach(Class<?> cls) { Iterator<Map.Entry<String, List<InstanceMethod>>> ki = map.entrySet().iterator(); while (ki.hasNext()) { Map.Entry<String, List<InstanceMethod>> entry = ki.next(); Iterator<InstanceMethod> li = entry.getValue().iterator(); while (li.hasNext()) { InstanceMethod im = li.next(); if (im.type.equals(cls)) { li.remove(); } } if (entry.getValue().isEmpty()) { ki.remove(); } } }
java
public void detach(Class<?> cls) { Iterator<Map.Entry<String, List<InstanceMethod>>> ki = map.entrySet().iterator(); while (ki.hasNext()) { Map.Entry<String, List<InstanceMethod>> entry = ki.next(); Iterator<InstanceMethod> li = entry.getValue().iterator(); while (li.hasNext()) { InstanceMethod im = li.next(); if (im.type.equals(cls)) { li.remove(); } } if (entry.getValue().isEmpty()) { ki.remove(); } } }
[ "public", "void", "detach", "(", "Class", "<", "?", ">", "cls", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "String", ",", "List", "<", "InstanceMethod", ">", ">", ">", "ki", "=", "map", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "ki", ".", "hasNext", "(", ")", ")", "{", "Map", ".", "Entry", "<", "String", ",", "List", "<", "InstanceMethod", ">", ">", "entry", "=", "ki", ".", "next", "(", ")", ";", "Iterator", "<", "InstanceMethod", ">", "li", "=", "entry", ".", "getValue", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "li", ".", "hasNext", "(", ")", ")", "{", "InstanceMethod", "im", "=", "li", ".", "next", "(", ")", ";", "if", "(", "im", ".", "type", ".", "equals", "(", "cls", ")", ")", "{", "li", ".", "remove", "(", ")", ";", "}", "}", "if", "(", "entry", ".", "getValue", "(", ")", ".", "isEmpty", "(", ")", ")", "{", "ki", ".", "remove", "(", ")", ";", "}", "}", "}" ]
Removes all previously made attachments to static class. @param cls
[ "Removes", "all", "previously", "made", "attachments", "to", "static", "class", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/AbstractProvisioner.java#L121-L141
152,615
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlUtilities.java
XmlUtilities.encodeDateTime
public static String encodeDateTime(DateTimeField field) { Date date = ((DateTimeField)field).getDateTime(); if (date == null) return null; if (field instanceof TimeField) return timeFormat.format(date); else if (field instanceof DateField) return dateFormat.format(date); else // if (field instanceof DateTimeField) return dateTimeFormat.format(date); }
java
public static String encodeDateTime(DateTimeField field) { Date date = ((DateTimeField)field).getDateTime(); if (date == null) return null; if (field instanceof TimeField) return timeFormat.format(date); else if (field instanceof DateField) return dateFormat.format(date); else // if (field instanceof DateTimeField) return dateTimeFormat.format(date); }
[ "public", "static", "String", "encodeDateTime", "(", "DateTimeField", "field", ")", "{", "Date", "date", "=", "(", "(", "DateTimeField", ")", "field", ")", ".", "getDateTime", "(", ")", ";", "if", "(", "date", "==", "null", ")", "return", "null", ";", "if", "(", "field", "instanceof", "TimeField", ")", "return", "timeFormat", ".", "format", "(", "date", ")", ";", "else", "if", "(", "field", "instanceof", "DateField", ")", "return", "dateFormat", ".", "format", "(", "date", ")", ";", "else", "// if (field instanceof DateTimeField)", "return", "dateTimeFormat", ".", "format", "(", "date", ")", ";", "}" ]
Encode date time field. @param field @return
[ "Encode", "date", "time", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlUtilities.java#L274-L285
152,616
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlUtilities.java
XmlUtilities.encodeFieldData
public static String encodeFieldData(BaseField field) { if (field.getData() == null) return DBConstants.BLANK; ByteArrayOutputStream baOut = new ByteArrayOutputStream(); DataOutputStream daOut = new DataOutputStream(baOut); try { field.write(daOut, false); daOut.flush(); } catch (IOException e) { e.printStackTrace(); } char[] chOut = Base64.encode(baOut.toByteArray()); if (chOut == null) return DBConstants.BLANK; // Never return new String(chOut); }
java
public static String encodeFieldData(BaseField field) { if (field.getData() == null) return DBConstants.BLANK; ByteArrayOutputStream baOut = new ByteArrayOutputStream(); DataOutputStream daOut = new DataOutputStream(baOut); try { field.write(daOut, false); daOut.flush(); } catch (IOException e) { e.printStackTrace(); } char[] chOut = Base64.encode(baOut.toByteArray()); if (chOut == null) return DBConstants.BLANK; // Never return new String(chOut); }
[ "public", "static", "String", "encodeFieldData", "(", "BaseField", "field", ")", "{", "if", "(", "field", ".", "getData", "(", ")", "==", "null", ")", "return", "DBConstants", ".", "BLANK", ";", "ByteArrayOutputStream", "baOut", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "DataOutputStream", "daOut", "=", "new", "DataOutputStream", "(", "baOut", ")", ";", "try", "{", "field", ".", "write", "(", "daOut", ",", "false", ")", ";", "daOut", ".", "flush", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "char", "[", "]", "chOut", "=", "Base64", ".", "encode", "(", "baOut", ".", "toByteArray", "(", ")", ")", ";", "if", "(", "chOut", "==", "null", ")", "return", "DBConstants", ".", "BLANK", ";", "// Never", "return", "new", "String", "(", "chOut", ")", ";", "}" ]
Change the data in this field to base64. WARNING - This requires 64bit encoding found in javax.mail! @param field The field containing the binary data to encode. @return The string encoded using base64.
[ "Change", "the", "data", "in", "this", "field", "to", "base64", ".", "WARNING", "-", "This", "requires", "64bit", "encoding", "found", "in", "javax", ".", "mail!" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlUtilities.java#L377-L393
152,617
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlUtilities.java
XmlUtilities.decodeFieldData
public static void decodeFieldData(BaseField field, String string) { if ((string == null) || (string.length() == 0)) return; byte[] ba = Base64.decode(string.toCharArray()); InputStream is = new ByteArrayInputStream(ba); DataInputStream daIn = new DataInputStream(is); field.read(daIn, false); }
java
public static void decodeFieldData(BaseField field, String string) { if ((string == null) || (string.length() == 0)) return; byte[] ba = Base64.decode(string.toCharArray()); InputStream is = new ByteArrayInputStream(ba); DataInputStream daIn = new DataInputStream(is); field.read(daIn, false); }
[ "public", "static", "void", "decodeFieldData", "(", "BaseField", "field", ",", "String", "string", ")", "{", "if", "(", "(", "string", "==", "null", ")", "||", "(", "string", ".", "length", "(", ")", "==", "0", ")", ")", "return", ";", "byte", "[", "]", "ba", "=", "Base64", ".", "decode", "(", "string", ".", "toCharArray", "(", ")", ")", ";", "InputStream", "is", "=", "new", "ByteArrayInputStream", "(", "ba", ")", ";", "DataInputStream", "daIn", "=", "new", "DataInputStream", "(", "is", ")", ";", "field", ".", "read", "(", "daIn", ",", "false", ")", ";", "}" ]
Change this base64 string to raw data and set the value in this field. WARNING - This requires 64bit encoding found in javax.mail! @param field The field containing the binary data to decode. @param The string to decode using base64.
[ "Change", "this", "base64", "string", "to", "raw", "data", "and", "set", "the", "value", "in", "this", "field", ".", "WARNING", "-", "This", "requires", "64bit", "encoding", "found", "in", "javax", ".", "mail!" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/xmlutil/XmlUtilities.java#L400-L408
152,618
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.isNumeric
public static boolean isNumeric(String string, boolean bAllowFormatting) { if ((string == null) || (string.length() == 0)) return false; boolean bIsNumeric = true; for (int i = 0; i < string.length(); i++) { if (!Character.isDigit(string.charAt(i))) { if ((!bAllowFormatting) || (Character.isLetter(string.charAt(i)))) bIsNumeric = false; } } return bIsNumeric; }
java
public static boolean isNumeric(String string, boolean bAllowFormatting) { if ((string == null) || (string.length() == 0)) return false; boolean bIsNumeric = true; for (int i = 0; i < string.length(); i++) { if (!Character.isDigit(string.charAt(i))) { if ((!bAllowFormatting) || (Character.isLetter(string.charAt(i)))) bIsNumeric = false; } } return bIsNumeric; }
[ "public", "static", "boolean", "isNumeric", "(", "String", "string", ",", "boolean", "bAllowFormatting", ")", "{", "if", "(", "(", "string", "==", "null", ")", "||", "(", "string", ".", "length", "(", ")", "==", "0", ")", ")", "return", "false", ";", "boolean", "bIsNumeric", "=", "true", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "string", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "!", "Character", ".", "isDigit", "(", "string", ".", "charAt", "(", "i", ")", ")", ")", "{", "if", "(", "(", "!", "bAllowFormatting", ")", "||", "(", "Character", ".", "isLetter", "(", "string", ".", "charAt", "(", "i", ")", ")", ")", ")", "bIsNumeric", "=", "false", ";", "}", "}", "return", "bIsNumeric", ";", "}" ]
Is this string a valid number? @param string The string to check. @return true if this string is a valid number (all characters numeric).
[ "Is", "this", "string", "a", "valid", "number?" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L135-L150
152,619
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.addXMLMap
public static StringBuffer addXMLMap(StringBuffer sbXML, Map<String,Object> mapMessage) { if (sbXML == null) sbXML = new StringBuffer(); if (mapMessage != null) { for (String strParam : mapMessage.keySet()) { Object objValue = mapMessage.get(strParam); if (objValue != null) Util.getXML(sbXML, strParam, objValue); } } return sbXML; }
java
public static StringBuffer addXMLMap(StringBuffer sbXML, Map<String,Object> mapMessage) { if (sbXML == null) sbXML = new StringBuffer(); if (mapMessage != null) { for (String strParam : mapMessage.keySet()) { Object objValue = mapMessage.get(strParam); if (objValue != null) Util.getXML(sbXML, strParam, objValue); } } return sbXML; }
[ "public", "static", "StringBuffer", "addXMLMap", "(", "StringBuffer", "sbXML", ",", "Map", "<", "String", ",", "Object", ">", "mapMessage", ")", "{", "if", "(", "sbXML", "==", "null", ")", "sbXML", "=", "new", "StringBuffer", "(", ")", ";", "if", "(", "mapMessage", "!=", "null", ")", "{", "for", "(", "String", "strParam", ":", "mapMessage", ".", "keySet", "(", ")", ")", "{", "Object", "objValue", "=", "mapMessage", ".", "get", "(", "strParam", ")", ";", "if", "(", "objValue", "!=", "null", ")", "Util", ".", "getXML", "(", "sbXML", ",", "strParam", ",", "objValue", ")", ";", "}", "}", "return", "sbXML", ";", "}" ]
Add this map as an xml string.
[ "Add", "this", "map", "as", "an", "xml", "string", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L297-L311
152,620
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.getXML
@SuppressWarnings({ "rawtypes", "unchecked" }) public static StringBuffer getXML(StringBuffer sbXML, String strParam, Object objValue) { Util.addStartTag(sbXML, strParam); if (objValue instanceof Map) { Util.addXMLMap(sbXML, (Map)objValue); } else { String strValue = Constant.BLANK; if (objValue != null) strValue = objValue.toString(); if (Util.isCData(strValue)) strValue = CDATA_START + strValue + CDATA_END; sbXML.append(strValue); } return Util.addEndTag(sbXML, strParam).append(Constant.RETURN); }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public static StringBuffer getXML(StringBuffer sbXML, String strParam, Object objValue) { Util.addStartTag(sbXML, strParam); if (objValue instanceof Map) { Util.addXMLMap(sbXML, (Map)objValue); } else { String strValue = Constant.BLANK; if (objValue != null) strValue = objValue.toString(); if (Util.isCData(strValue)) strValue = CDATA_START + strValue + CDATA_END; sbXML.append(strValue); } return Util.addEndTag(sbXML, strParam).append(Constant.RETURN); }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "StringBuffer", "getXML", "(", "StringBuffer", "sbXML", ",", "String", "strParam", ",", "Object", "objValue", ")", "{", "Util", ".", "addStartTag", "(", "sbXML", ",", "strParam", ")", ";", "if", "(", "objValue", "instanceof", "Map", ")", "{", "Util", ".", "addXMLMap", "(", "sbXML", ",", "(", "Map", ")", "objValue", ")", ";", "}", "else", "{", "String", "strValue", "=", "Constant", ".", "BLANK", ";", "if", "(", "objValue", "!=", "null", ")", "strValue", "=", "objValue", ".", "toString", "(", ")", ";", "if", "(", "Util", ".", "isCData", "(", "strValue", ")", ")", "strValue", "=", "CDATA_START", "+", "strValue", "+", "CDATA_END", ";", "sbXML", ".", "append", "(", "strValue", ")", ";", "}", "return", "Util", ".", "addEndTag", "(", "sbXML", ",", "strParam", ")", ".", "append", "(", "Constant", ".", "RETURN", ")", ";", "}" ]
Convert this value to a XML string. @param This value's tag. @param objValue The raw data value. @return The XML string for this value.
[ "Convert", "this", "value", "to", "a", "XML", "string", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L318-L336
152,621
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.isCData
public static boolean isCData(String string) { if (string != null) { for (int i = 0; i < string.length(); i++) { char chChar = string.charAt(i); if ((chChar == 0x9) || (chChar == 0xD) || (chChar == 0xA)) return true; // Carriage return/Line feed/newline } } return false; }
java
public static boolean isCData(String string) { if (string != null) { for (int i = 0; i < string.length(); i++) { char chChar = string.charAt(i); if ((chChar == 0x9) || (chChar == 0xD) || (chChar == 0xA)) return true; // Carriage return/Line feed/newline } } return false; }
[ "public", "static", "boolean", "isCData", "(", "String", "string", ")", "{", "if", "(", "string", "!=", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "string", ".", "length", "(", ")", ";", "i", "++", ")", "{", "char", "chChar", "=", "string", ".", "charAt", "(", "i", ")", ";", "if", "(", "(", "chChar", "==", "0x9", ")", "||", "(", "chChar", "==", "0xD", ")", "||", "(", "chChar", "==", "0xA", ")", ")", "return", "true", ";", "// Carriage return/Line feed/newline", "}", "}", "return", "false", ";", "}" ]
Is this a CData string? @param string The string to analyze. @return true if this string must be a CDATA area (if it has carriage-returns).
[ "Is", "this", "a", "CData", "string?" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L344-L358
152,622
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.fixDOMElementName
public static String fixDOMElementName(String string) { for (int i = 0; i < string.length(); i++) { if (!Character.isJavaIdentifierPart(string.charAt(i))) string = string.substring(0, i) + "." + string.substring(i + 1); } return string; }
java
public static String fixDOMElementName(String string) { for (int i = 0; i < string.length(); i++) { if (!Character.isJavaIdentifierPart(string.charAt(i))) string = string.substring(0, i) + "." + string.substring(i + 1); } return string; }
[ "public", "static", "String", "fixDOMElementName", "(", "String", "string", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "string", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "!", "Character", ".", "isJavaIdentifierPart", "(", "string", ".", "charAt", "(", "i", ")", ")", ")", "string", "=", "string", ".", "substring", "(", "0", ",", "i", ")", "+", "\".\"", "+", "string", ".", "substring", "(", "i", "+", "1", ")", ";", "}", "return", "string", ";", "}" ]
Fix this string so it can be a DOM element name.
[ "Fix", "this", "string", "so", "it", "can", "be", "a", "DOM", "element", "name", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L362-L370
152,623
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.convertClassName
public static String convertClassName(String className, String stringToInsert, int location) { int startSeq = 0; if (location >= 0) { for (int i = 0; i < location; i++) { startSeq = className.indexOf('.', startSeq + 1); } } else { startSeq = className.length(); for (int i = location; i < 0; i++) { startSeq = className.lastIndexOf('.', startSeq - 1); } } if (startSeq == -1) return null; int domainSeq = startSeq; if (className.indexOf(Constant.THIN_SUBPACKAGE, startSeq) == startSeq + 1) startSeq = startSeq + Constant.THIN_SUBPACKAGE.length(); className = className.substring(0, domainSeq + 1) + stringToInsert + className.substring(startSeq + 1); return className; }
java
public static String convertClassName(String className, String stringToInsert, int location) { int startSeq = 0; if (location >= 0) { for (int i = 0; i < location; i++) { startSeq = className.indexOf('.', startSeq + 1); } } else { startSeq = className.length(); for (int i = location; i < 0; i++) { startSeq = className.lastIndexOf('.', startSeq - 1); } } if (startSeq == -1) return null; int domainSeq = startSeq; if (className.indexOf(Constant.THIN_SUBPACKAGE, startSeq) == startSeq + 1) startSeq = startSeq + Constant.THIN_SUBPACKAGE.length(); className = className.substring(0, domainSeq + 1) + stringToInsert + className.substring(startSeq + 1); return className; }
[ "public", "static", "String", "convertClassName", "(", "String", "className", ",", "String", "stringToInsert", ",", "int", "location", ")", "{", "int", "startSeq", "=", "0", ";", "if", "(", "location", ">=", "0", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "location", ";", "i", "++", ")", "{", "startSeq", "=", "className", ".", "indexOf", "(", "'", "'", ",", "startSeq", "+", "1", ")", ";", "}", "}", "else", "{", "startSeq", "=", "className", ".", "length", "(", ")", ";", "for", "(", "int", "i", "=", "location", ";", "i", "<", "0", ";", "i", "++", ")", "{", "startSeq", "=", "className", ".", "lastIndexOf", "(", "'", "'", ",", "startSeq", "-", "1", ")", ";", "}", "}", "if", "(", "startSeq", "==", "-", "1", ")", "return", "null", ";", "int", "domainSeq", "=", "startSeq", ";", "if", "(", "className", ".", "indexOf", "(", "Constant", ".", "THIN_SUBPACKAGE", ",", "startSeq", ")", "==", "startSeq", "+", "1", ")", "startSeq", "=", "startSeq", "+", "Constant", ".", "THIN_SUBPACKAGE", ".", "length", "(", ")", ";", "className", "=", "className", ".", "substring", "(", "0", ",", "domainSeq", "+", "1", ")", "+", "stringToInsert", "+", "className", ".", "substring", "(", "startSeq", "+", "1", ")", ";", "return", "className", ";", "}" ]
Convert this class name by inserting this package after the domain. ie., if location = 2, com.xyz.abc.ClassName -> com.xyz.newpackage.abc.ClassName. @param className @param package location (positive = from left, negative = from right; 0 = before package, -1 = before class name, etc.) @param stringToInsert @return Converted string
[ "Convert", "this", "class", "name", "by", "inserting", "this", "package", "after", "the", "domain", ".", "ie", ".", "if", "location", "=", "2", "com", ".", "xyz", ".", "abc", ".", "ClassName", "-", ">", "com", ".", "xyz", ".", "newpackage", ".", "abc", ".", "ClassName", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L469-L494
152,624
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.getDomainName
public static String getDomainName(String className) { int i = className.indexOf('.'); i = className.indexOf('.', i + 1); if (i == -1) return null; return className.substring(0, i); }
java
public static String getDomainName(String className) { int i = className.indexOf('.'); i = className.indexOf('.', i + 1); if (i == -1) return null; return className.substring(0, i); }
[ "public", "static", "String", "getDomainName", "(", "String", "className", ")", "{", "int", "i", "=", "className", ".", "indexOf", "(", "'", "'", ")", ";", "i", "=", "className", ".", "indexOf", "(", "'", "'", ",", "i", "+", "1", ")", ";", "if", "(", "i", "==", "-", "1", ")", "return", "null", ";", "return", "className", ".", "substring", "(", "0", ",", "i", ")", ";", "}" ]
Get the domain name from this package or class name @param className @return
[ "Get", "the", "domain", "name", "from", "this", "package", "or", "class", "name" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L500-L507
152,625
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.getPackageName
public static String getPackageName(String className, boolean resource) { String packageName = null; if (className != null) { if (resource) if (className.endsWith(PROPERTIES)) className = className.substring(0, className.length() - PROPERTIES.length()); if (className.lastIndexOf('.') != -1) packageName = className.substring(0, className.lastIndexOf('.')); } return packageName; }
java
public static String getPackageName(String className, boolean resource) { String packageName = null; if (className != null) { if (resource) if (className.endsWith(PROPERTIES)) className = className.substring(0, className.length() - PROPERTIES.length()); if (className.lastIndexOf('.') != -1) packageName = className.substring(0, className.lastIndexOf('.')); } return packageName; }
[ "public", "static", "String", "getPackageName", "(", "String", "className", ",", "boolean", "resource", ")", "{", "String", "packageName", "=", "null", ";", "if", "(", "className", "!=", "null", ")", "{", "if", "(", "resource", ")", "if", "(", "className", ".", "endsWith", "(", "PROPERTIES", ")", ")", "className", "=", "className", ".", "substring", "(", "0", ",", "className", ".", "length", "(", ")", "-", "PROPERTIES", ".", "length", "(", ")", ")", ";", "if", "(", "className", ".", "lastIndexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "packageName", "=", "className", ".", "substring", "(", "0", ",", "className", ".", "lastIndexOf", "(", "'", "'", ")", ")", ";", "}", "return", "packageName", ";", "}" ]
Get the package name of this class name @param className @return
[ "Get", "the", "package", "name", "of", "this", "class", "name" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L553-L565
152,626
jbundle/jbundle
model/base/src/main/java/org/jbundle/model/util/Util.java
Util.getLogger
public static Logger getLogger() { if (m_logger == null) { m_logger = Logger.getLogger(Constant.ROOT_PACKAGE.substring(0, Constant.ROOT_PACKAGE.length() - 1)); try { LogManager logManager = LogManager.getLogManager(); logManager.reset();//removeAllGlobalHandlers(); ConsoleHandler fh = new ConsoleHandler(); fh.setFormatter(new SimpleFormatter()); // Send logger output to our FileHandler. m_logger.addHandler(fh); } catch (java.security.AccessControlException ex) { // Access error if running in an applet. m_logger = Logger.getAnonymousLogger(); } finally { try { // Request that every detail gets logged. // m_logger.setLevel(Level.OFF); // m_logger.setLevel(Level.ALL); m_logger.setLevel(Level.WARNING); } catch (java.security.AccessControlException ex) { ex.printStackTrace(); // Never } } } return m_logger; }
java
public static Logger getLogger() { if (m_logger == null) { m_logger = Logger.getLogger(Constant.ROOT_PACKAGE.substring(0, Constant.ROOT_PACKAGE.length() - 1)); try { LogManager logManager = LogManager.getLogManager(); logManager.reset();//removeAllGlobalHandlers(); ConsoleHandler fh = new ConsoleHandler(); fh.setFormatter(new SimpleFormatter()); // Send logger output to our FileHandler. m_logger.addHandler(fh); } catch (java.security.AccessControlException ex) { // Access error if running in an applet. m_logger = Logger.getAnonymousLogger(); } finally { try { // Request that every detail gets logged. // m_logger.setLevel(Level.OFF); // m_logger.setLevel(Level.ALL); m_logger.setLevel(Level.WARNING); } catch (java.security.AccessControlException ex) { ex.printStackTrace(); // Never } } } return m_logger; }
[ "public", "static", "Logger", "getLogger", "(", ")", "{", "if", "(", "m_logger", "==", "null", ")", "{", "m_logger", "=", "Logger", ".", "getLogger", "(", "Constant", ".", "ROOT_PACKAGE", ".", "substring", "(", "0", ",", "Constant", ".", "ROOT_PACKAGE", ".", "length", "(", ")", "-", "1", ")", ")", ";", "try", "{", "LogManager", "logManager", "=", "LogManager", ".", "getLogManager", "(", ")", ";", "logManager", ".", "reset", "(", ")", ";", "//removeAllGlobalHandlers();", "ConsoleHandler", "fh", "=", "new", "ConsoleHandler", "(", ")", ";", "fh", ".", "setFormatter", "(", "new", "SimpleFormatter", "(", ")", ")", ";", "// Send logger output to our FileHandler.", "m_logger", ".", "addHandler", "(", "fh", ")", ";", "}", "catch", "(", "java", ".", "security", ".", "AccessControlException", "ex", ")", "{", "// Access error if running in an applet.", "m_logger", "=", "Logger", ".", "getAnonymousLogger", "(", ")", ";", "}", "finally", "{", "try", "{", "// Request that every detail gets logged.", "// m_logger.setLevel(Level.OFF);", "// m_logger.setLevel(Level.ALL);", "m_logger", ".", "setLevel", "(", "Level", ".", "WARNING", ")", ";", "}", "catch", "(", "java", ".", "security", ".", "AccessControlException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "// Never", "}", "}", "}", "return", "m_logger", ";", "}" ]
Get the logger. @return The logger.
[ "Get", "the", "logger", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/model/base/src/main/java/org/jbundle/model/util/Util.java#L615-L642
152,627
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.addSelectParams
public String addSelectParams(String seekSign, int iAreaDesc, boolean bAddOnlyMods, boolean bIncludeFileName, boolean bUseCurrentValues, Vector<BaseField> vParamList, boolean bForceUniqueKey, boolean bIncludeTempFields) { if (iAreaDesc == DBConstants.START_SELECT_KEY) if (bAddOnlyMods) if (bForceUniqueKey) if (">=".equals(seekSign)) if (this.getRecord().getCounterField() != this.getField(0)) if (this.getKeyField(this.getKeyFields(bForceUniqueKey, false) - 1, bForceUniqueKey).getField(iAreaDesc).isModified()) return this.addGreaterThanParams(seekSign, iAreaDesc, bAddOnlyMods, bIncludeFileName, bUseCurrentValues, vParamList, bForceUniqueKey); String strFilter = DBConstants.BLANK; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, bIncludeTempFields); if (bAddOnlyMods) iKeyFieldCount = this.lastModified(iAreaDesc, bForceUniqueKey) + 1; for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField pParamField = keyField.getField(iAreaDesc); BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA); if (">=".equals(seekSign)) if (pParamField.isNull()) break; // Can't say >=? if null. if (strFilter.length() > 0) strFilter += " AND "; String strCompare = null; strFilter += field.getFieldName(true, bIncludeFileName); String strSign = seekSign; if (bUseCurrentValues == false) { strCompare = "?"; strFilter += strSign + strCompare; if (vParamList != null) vParamList.add(pParamField); } else strFilter += pParamField.getSQLFilter(strSign, strCompare, true); } return strFilter; }
java
public String addSelectParams(String seekSign, int iAreaDesc, boolean bAddOnlyMods, boolean bIncludeFileName, boolean bUseCurrentValues, Vector<BaseField> vParamList, boolean bForceUniqueKey, boolean bIncludeTempFields) { if (iAreaDesc == DBConstants.START_SELECT_KEY) if (bAddOnlyMods) if (bForceUniqueKey) if (">=".equals(seekSign)) if (this.getRecord().getCounterField() != this.getField(0)) if (this.getKeyField(this.getKeyFields(bForceUniqueKey, false) - 1, bForceUniqueKey).getField(iAreaDesc).isModified()) return this.addGreaterThanParams(seekSign, iAreaDesc, bAddOnlyMods, bIncludeFileName, bUseCurrentValues, vParamList, bForceUniqueKey); String strFilter = DBConstants.BLANK; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, bIncludeTempFields); if (bAddOnlyMods) iKeyFieldCount = this.lastModified(iAreaDesc, bForceUniqueKey) + 1; for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField pParamField = keyField.getField(iAreaDesc); BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA); if (">=".equals(seekSign)) if (pParamField.isNull()) break; // Can't say >=? if null. if (strFilter.length() > 0) strFilter += " AND "; String strCompare = null; strFilter += field.getFieldName(true, bIncludeFileName); String strSign = seekSign; if (bUseCurrentValues == false) { strCompare = "?"; strFilter += strSign + strCompare; if (vParamList != null) vParamList.add(pParamField); } else strFilter += pParamField.getSQLFilter(strSign, strCompare, true); } return strFilter; }
[ "public", "String", "addSelectParams", "(", "String", "seekSign", ",", "int", "iAreaDesc", ",", "boolean", "bAddOnlyMods", ",", "boolean", "bIncludeFileName", ",", "boolean", "bUseCurrentValues", ",", "Vector", "<", "BaseField", ">", "vParamList", ",", "boolean", "bForceUniqueKey", ",", "boolean", "bIncludeTempFields", ")", "{", "if", "(", "iAreaDesc", "==", "DBConstants", ".", "START_SELECT_KEY", ")", "if", "(", "bAddOnlyMods", ")", "if", "(", "bForceUniqueKey", ")", "if", "(", "\">=\"", ".", "equals", "(", "seekSign", ")", ")", "if", "(", "this", ".", "getRecord", "(", ")", ".", "getCounterField", "(", ")", "!=", "this", ".", "getField", "(", "0", ")", ")", "if", "(", "this", ".", "getKeyField", "(", "this", ".", "getKeyFields", "(", "bForceUniqueKey", ",", "false", ")", "-", "1", ",", "bForceUniqueKey", ")", ".", "getField", "(", "iAreaDesc", ")", ".", "isModified", "(", ")", ")", "return", "this", ".", "addGreaterThanParams", "(", "seekSign", ",", "iAreaDesc", ",", "bAddOnlyMods", ",", "bIncludeFileName", ",", "bUseCurrentValues", ",", "vParamList", ",", "bForceUniqueKey", ")", ";", "String", "strFilter", "=", "DBConstants", ".", "BLANK", ";", "int", "iKeyFieldCount", "=", "this", ".", "getKeyFields", "(", "bForceUniqueKey", ",", "bIncludeTempFields", ")", ";", "if", "(", "bAddOnlyMods", ")", "iKeyFieldCount", "=", "this", ".", "lastModified", "(", "iAreaDesc", ",", "bForceUniqueKey", ")", "+", "1", ";", "for", "(", "int", "iKeyFieldSeq", "=", "DBConstants", ".", "MAIN_KEY_FIELD", ";", "iKeyFieldSeq", "<", "iKeyFieldCount", ";", "iKeyFieldSeq", "++", ")", "{", "KeyField", "keyField", "=", "this", ".", "getKeyField", "(", "iKeyFieldSeq", ",", "bForceUniqueKey", ")", ";", "BaseField", "pParamField", "=", "keyField", ".", "getField", "(", "iAreaDesc", ")", ";", "BaseField", "field", "=", "keyField", ".", "getField", "(", "DBConstants", ".", "FILE_KEY_AREA", ")", ";", "if", "(", "\">=\"", ".", "equals", "(", "seekSign", ")", ")", "if", "(", "pParamField", ".", "isNull", "(", ")", ")", "break", ";", "// Can't say >=? if null.", "if", "(", "strFilter", ".", "length", "(", ")", ">", "0", ")", "strFilter", "+=", "\" AND \"", ";", "String", "strCompare", "=", "null", ";", "strFilter", "+=", "field", ".", "getFieldName", "(", "true", ",", "bIncludeFileName", ")", ";", "String", "strSign", "=", "seekSign", ";", "if", "(", "bUseCurrentValues", "==", "false", ")", "{", "strCompare", "=", "\"?\"", ";", "strFilter", "+=", "strSign", "+", "strCompare", ";", "if", "(", "vParamList", "!=", "null", ")", "vParamList", ".", "add", "(", "pParamField", ")", ";", "}", "else", "strFilter", "+=", "pParamField", ".", "getSQLFilter", "(", "strSign", ",", "strCompare", ",", "true", ")", ";", "}", "return", "strFilter", ";", "}" ]
Setup the SQL Key Filter. @param seekSign The seek sign. @param iAreaDesc The key area to select. @param bAddOnlyMods Add only the keys which have modified? @param bIncludeFileName Include the file name in the string? @param bUseCurrentValues Use current values? @param vParamList The parameter list. @param bForceUniqueKey If params must be unique, if they aren't, add the unique key to the end. @param bIncludeTempFields If true, include any temporary key fields that have been added to the end if this keyarea @return The select string.
[ "Setup", "the", "SQL", "Key", "Filter", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L136-L173
152,628
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.getField
public BaseField getField(int iKeyFieldSeq) { if (this.getKeyField(iKeyFieldSeq) == null) return null; return this.getKeyField(iKeyFieldSeq).getField(DBConstants.FILE_KEY_AREA); }
java
public BaseField getField(int iKeyFieldSeq) { if (this.getKeyField(iKeyFieldSeq) == null) return null; return this.getKeyField(iKeyFieldSeq).getField(DBConstants.FILE_KEY_AREA); }
[ "public", "BaseField", "getField", "(", "int", "iKeyFieldSeq", ")", "{", "if", "(", "this", ".", "getKeyField", "(", "iKeyFieldSeq", ")", "==", "null", ")", "return", "null", ";", "return", "this", ".", "getKeyField", "(", "iKeyFieldSeq", ")", ".", "getField", "(", "DBConstants", ".", "FILE_KEY_AREA", ")", ";", "}" ]
Get the Field in this KeyField. This is just a convenience to get the field from the KeyField. @param iKeyFieldSeq The position of this field in the key area. @return The field.
[ "Get", "the", "Field", "in", "this", "KeyField", ".", "This", "is", "just", "a", "convenience", "to", "get", "the", "field", "from", "the", "KeyField", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L283-L288
152,629
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.getKeyField
public KeyField getKeyField(int iKeyFieldSeq) { if (iKeyFieldSeq >= m_vKeyFieldList.size()) return null; return (KeyField)m_vKeyFieldList.elementAt(iKeyFieldSeq); }
java
public KeyField getKeyField(int iKeyFieldSeq) { if (iKeyFieldSeq >= m_vKeyFieldList.size()) return null; return (KeyField)m_vKeyFieldList.elementAt(iKeyFieldSeq); }
[ "public", "KeyField", "getKeyField", "(", "int", "iKeyFieldSeq", ")", "{", "if", "(", "iKeyFieldSeq", ">=", "m_vKeyFieldList", ".", "size", "(", ")", ")", "return", "null", ";", "return", "(", "KeyField", ")", "m_vKeyFieldList", ".", "elementAt", "(", "iKeyFieldSeq", ")", ";", "}" ]
Get this Key Field. @param iKeyFieldSeq The position of this keyfield in the key area. @return The key field.
[ "Get", "this", "Key", "Field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L294-L299
152,630
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.getKeySeq
public int getKeySeq() { // This is a dumb way to do this int iLastIndexArea = m_record.getKeyAreaCount() - 1 + DBConstants.MAIN_KEY_AREA; for (int nIndex = DBConstants.MAIN_KEY_AREA; nIndex <= iLastIndexArea; nIndex++) { KeyAreaInfo index = m_record.getKeyArea(nIndex); if (index == null) return -1; // Not found if (this == index) return nIndex; // Zero based . MAIN_FIELD based } return -1; // Not found }
java
public int getKeySeq() { // This is a dumb way to do this int iLastIndexArea = m_record.getKeyAreaCount() - 1 + DBConstants.MAIN_KEY_AREA; for (int nIndex = DBConstants.MAIN_KEY_AREA; nIndex <= iLastIndexArea; nIndex++) { KeyAreaInfo index = m_record.getKeyArea(nIndex); if (index == null) return -1; // Not found if (this == index) return nIndex; // Zero based . MAIN_FIELD based } return -1; // Not found }
[ "public", "int", "getKeySeq", "(", ")", "{", "// This is a dumb way to do this", "int", "iLastIndexArea", "=", "m_record", ".", "getKeyAreaCount", "(", ")", "-", "1", "+", "DBConstants", ".", "MAIN_KEY_AREA", ";", "for", "(", "int", "nIndex", "=", "DBConstants", ".", "MAIN_KEY_AREA", ";", "nIndex", "<=", "iLastIndexArea", ";", "nIndex", "++", ")", "{", "KeyAreaInfo", "index", "=", "m_record", ".", "getKeyArea", "(", "nIndex", ")", ";", "if", "(", "index", "==", "null", ")", "return", "-", "1", ";", "// Not found", "if", "(", "this", "==", "index", ")", "return", "nIndex", ";", "// Zero based . MAIN_FIELD based", "}", "return", "-", "1", ";", "// Not found", "}" ]
Get the seq of this key area. Get rid of this method. @return The sequence of the keyarea.
[ "Get", "the", "seq", "of", "this", "key", "area", ".", "Get", "rid", "of", "this", "method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L322-L334
152,631
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.lastModified
public int lastModified(int iAreaDesc, boolean bForceUniqueKey) { // Set up the end key int iLastKeyField = this.getKeyFields(bForceUniqueKey, false) - 1; for (int iKeyFieldSeq = iLastKeyField; iKeyFieldSeq >= DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq--) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); if (keyField.getField(iAreaDesc).isModified()) return iKeyFieldSeq; } return -1; }
java
public int lastModified(int iAreaDesc, boolean bForceUniqueKey) { // Set up the end key int iLastKeyField = this.getKeyFields(bForceUniqueKey, false) - 1; for (int iKeyFieldSeq = iLastKeyField; iKeyFieldSeq >= DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq--) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); if (keyField.getField(iAreaDesc).isModified()) return iKeyFieldSeq; } return -1; }
[ "public", "int", "lastModified", "(", "int", "iAreaDesc", ",", "boolean", "bForceUniqueKey", ")", "{", "// Set up the end key", "int", "iLastKeyField", "=", "this", ".", "getKeyFields", "(", "bForceUniqueKey", ",", "false", ")", "-", "1", ";", "for", "(", "int", "iKeyFieldSeq", "=", "iLastKeyField", ";", "iKeyFieldSeq", ">=", "DBConstants", ".", "MAIN_KEY_FIELD", ";", "iKeyFieldSeq", "--", ")", "{", "KeyField", "keyField", "=", "this", ".", "getKeyField", "(", "iKeyFieldSeq", ",", "bForceUniqueKey", ")", ";", "if", "(", "keyField", ".", "getField", "(", "iAreaDesc", ")", ".", "isModified", "(", ")", ")", "return", "iKeyFieldSeq", ";", "}", "return", "-", "1", ";", "}" ]
Any of these key fields modified? @param iAreaDesc The key field area to get the values from. @param iStartKeyFieldSeq The starting key field to check (from here on). @return true if any have been modified.
[ "Any", "of", "these", "key", "fields", "modified?" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L391-L401
152,632
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.reverseBookmark
public void reverseBookmark(Object bookmark, int iAreaDesc) { if (this.getKeyFields() == 1) // Special case - single unique key; { BaseField field = this.getField(iAreaDesc); boolean[] rgbEnabled = field.setEnableListeners(false); field.setData(bookmark, DBConstants.DONT_DISPLAY, DBConstants.INIT_MOVE); field.setEnableListeners(rgbEnabled); } else { BaseBuffer buffer = (BaseBuffer)bookmark; if (buffer != null) buffer.resetPosition(); this.reverseKeyBuffer(buffer, iAreaDesc); } }
java
public void reverseBookmark(Object bookmark, int iAreaDesc) { if (this.getKeyFields() == 1) // Special case - single unique key; { BaseField field = this.getField(iAreaDesc); boolean[] rgbEnabled = field.setEnableListeners(false); field.setData(bookmark, DBConstants.DONT_DISPLAY, DBConstants.INIT_MOVE); field.setEnableListeners(rgbEnabled); } else { BaseBuffer buffer = (BaseBuffer)bookmark; if (buffer != null) buffer.resetPosition(); this.reverseKeyBuffer(buffer, iAreaDesc); } }
[ "public", "void", "reverseBookmark", "(", "Object", "bookmark", ",", "int", "iAreaDesc", ")", "{", "if", "(", "this", ".", "getKeyFields", "(", ")", "==", "1", ")", "// Special case - single unique key;", "{", "BaseField", "field", "=", "this", ".", "getField", "(", "iAreaDesc", ")", ";", "boolean", "[", "]", "rgbEnabled", "=", "field", ".", "setEnableListeners", "(", "false", ")", ";", "field", ".", "setData", "(", "bookmark", ",", "DBConstants", ".", "DONT_DISPLAY", ",", "DBConstants", ".", "INIT_MOVE", ")", ";", "field", ".", "setEnableListeners", "(", "rgbEnabled", ")", ";", "}", "else", "{", "BaseBuffer", "buffer", "=", "(", "BaseBuffer", ")", "bookmark", ";", "if", "(", "buffer", "!=", "null", ")", "buffer", ".", "resetPosition", "(", ")", ";", "this", ".", "reverseKeyBuffer", "(", "buffer", ",", "iAreaDesc", ")", ";", "}", "}" ]
Take this BOOKMARK handle and back it into the fields. @param bookmark The bookmark handle. @param iAreaDesc The area to move it into.
[ "Take", "this", "BOOKMARK", "handle", "and", "back", "it", "into", "the", "fields", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L407-L423
152,633
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.setupBookmark
public Object setupBookmark(int iAreaDesc) { if (this.getKeyFields() == 1) // Special case - single unique key; return this.getField(iAreaDesc).getData(); BaseBuffer buffer = new org.jbundle.thin.base.db.buff.str.StrBuffer(null); this.setupKeyBuffer(buffer, iAreaDesc); return buffer; }
java
public Object setupBookmark(int iAreaDesc) { if (this.getKeyFields() == 1) // Special case - single unique key; return this.getField(iAreaDesc).getData(); BaseBuffer buffer = new org.jbundle.thin.base.db.buff.str.StrBuffer(null); this.setupKeyBuffer(buffer, iAreaDesc); return buffer; }
[ "public", "Object", "setupBookmark", "(", "int", "iAreaDesc", ")", "{", "if", "(", "this", ".", "getKeyFields", "(", ")", "==", "1", ")", "// Special case - single unique key;", "return", "this", ".", "getField", "(", "iAreaDesc", ")", ".", "getData", "(", ")", ";", "BaseBuffer", "buffer", "=", "new", "org", ".", "jbundle", ".", "thin", ".", "base", ".", "db", ".", "buff", ".", "str", ".", "StrBuffer", "(", "null", ")", ";", "this", ".", "setupKeyBuffer", "(", "buffer", ",", "iAreaDesc", ")", ";", "return", "buffer", ";", "}" ]
Create a BOOKMARK handle for this key area. @return bookmark The bookmark handle. @param iAreaDesc The area to move it into.
[ "Create", "a", "BOOKMARK", "handle", "for", "this", "key", "area", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L429-L436
152,634
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.setupKeyBuffer
public void setupKeyBuffer(BaseBuffer destBuffer, int iAreaDesc, boolean bMoveToField) { boolean bForceUniqueKey = true; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA); BaseField paramField = keyField.getField(iAreaDesc); if (bMoveToField) if (iAreaDesc != DBConstants.FILE_KEY_AREA) // Don't move this they are the same field { paramField.moveFieldToThis(field, DBConstants.DONT_DISPLAY, DBConstants.INIT_MOVE); // opy the value boolean bIsModified = field.isModified(); paramField.setModified(bIsModified); } if (destBuffer != null) { // Copy to buffer also? destBuffer.addNextField(paramField); } } if (destBuffer != null) destBuffer.finishBuffer(); }
java
public void setupKeyBuffer(BaseBuffer destBuffer, int iAreaDesc, boolean bMoveToField) { boolean bForceUniqueKey = true; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField field = keyField.getField(DBConstants.FILE_KEY_AREA); BaseField paramField = keyField.getField(iAreaDesc); if (bMoveToField) if (iAreaDesc != DBConstants.FILE_KEY_AREA) // Don't move this they are the same field { paramField.moveFieldToThis(field, DBConstants.DONT_DISPLAY, DBConstants.INIT_MOVE); // opy the value boolean bIsModified = field.isModified(); paramField.setModified(bIsModified); } if (destBuffer != null) { // Copy to buffer also? destBuffer.addNextField(paramField); } } if (destBuffer != null) destBuffer.finishBuffer(); }
[ "public", "void", "setupKeyBuffer", "(", "BaseBuffer", "destBuffer", ",", "int", "iAreaDesc", ",", "boolean", "bMoveToField", ")", "{", "boolean", "bForceUniqueKey", "=", "true", ";", "int", "iKeyFieldCount", "=", "this", ".", "getKeyFields", "(", "bForceUniqueKey", ",", "false", ")", ";", "for", "(", "int", "iKeyFieldSeq", "=", "DBConstants", ".", "MAIN_KEY_FIELD", ";", "iKeyFieldSeq", "<", "iKeyFieldCount", ";", "iKeyFieldSeq", "++", ")", "{", "KeyField", "keyField", "=", "this", ".", "getKeyField", "(", "iKeyFieldSeq", ",", "bForceUniqueKey", ")", ";", "BaseField", "field", "=", "keyField", ".", "getField", "(", "DBConstants", ".", "FILE_KEY_AREA", ")", ";", "BaseField", "paramField", "=", "keyField", ".", "getField", "(", "iAreaDesc", ")", ";", "if", "(", "bMoveToField", ")", "if", "(", "iAreaDesc", "!=", "DBConstants", ".", "FILE_KEY_AREA", ")", "// Don't move this they are the same field", "{", "paramField", ".", "moveFieldToThis", "(", "field", ",", "DBConstants", ".", "DONT_DISPLAY", ",", "DBConstants", ".", "INIT_MOVE", ")", ";", "// opy the value", "boolean", "bIsModified", "=", "field", ".", "isModified", "(", ")", ";", "paramField", ".", "setModified", "(", "bIsModified", ")", ";", "}", "if", "(", "destBuffer", "!=", "null", ")", "{", "// Copy to buffer also?", "destBuffer", ".", "addNextField", "(", "paramField", ")", ";", "}", "}", "if", "(", "destBuffer", "!=", "null", ")", "destBuffer", ".", "finishBuffer", "(", ")", ";", "}" ]
Set up the key area indicated. Remember to clear the destBuffer first. @param destBuffer A BaseBuffer to fill with data (ignore if null). @param iAreaDesc The (optional) temporary area to copy the current fields to. @param bMoveToField If true, move the param field to the field (default).
[ "Set", "up", "the", "key", "area", "indicated", ".", "Remember", "to", "clear", "the", "destBuffer", "first", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L481-L504
152,635
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.zeroKeyFields
public void zeroKeyFields(int iAreaDesc) { // Set up the initial key boolean bForceUniqueKey = true; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField thisField = keyField.getField(DBConstants.FILE_KEY_AREA); int limitDesc = iAreaDesc; if (keyField.getKeyOrder() == DBConstants.DESCENDING) { // If Descending, set to opposite if (iAreaDesc == DBConstants.START_SELECT_KEY) limitDesc = DBConstants.END_SELECT_KEY; else limitDesc = DBConstants.START_SELECT_KEY; } thisField.setToLimit(limitDesc); // Set this field to largest/smallest value possible thisField.setModified(false); // So you can sense a change // Match the param fields to the start/end value. keyField.getField(iAreaDesc).moveFieldToThis(thisField, false, DBConstants.INIT_MOVE); keyField.getField(iAreaDesc).setModified(false); } }
java
public void zeroKeyFields(int iAreaDesc) { // Set up the initial key boolean bForceUniqueKey = true; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); BaseField thisField = keyField.getField(DBConstants.FILE_KEY_AREA); int limitDesc = iAreaDesc; if (keyField.getKeyOrder() == DBConstants.DESCENDING) { // If Descending, set to opposite if (iAreaDesc == DBConstants.START_SELECT_KEY) limitDesc = DBConstants.END_SELECT_KEY; else limitDesc = DBConstants.START_SELECT_KEY; } thisField.setToLimit(limitDesc); // Set this field to largest/smallest value possible thisField.setModified(false); // So you can sense a change // Match the param fields to the start/end value. keyField.getField(iAreaDesc).moveFieldToThis(thisField, false, DBConstants.INIT_MOVE); keyField.getField(iAreaDesc).setModified(false); } }
[ "public", "void", "zeroKeyFields", "(", "int", "iAreaDesc", ")", "{", "// Set up the initial key", "boolean", "bForceUniqueKey", "=", "true", ";", "int", "iKeyFieldCount", "=", "this", ".", "getKeyFields", "(", "bForceUniqueKey", ",", "false", ")", ";", "for", "(", "int", "iKeyFieldSeq", "=", "DBConstants", ".", "MAIN_KEY_FIELD", ";", "iKeyFieldSeq", "<", "iKeyFieldCount", ";", "iKeyFieldSeq", "++", ")", "{", "KeyField", "keyField", "=", "this", ".", "getKeyField", "(", "iKeyFieldSeq", ",", "bForceUniqueKey", ")", ";", "BaseField", "thisField", "=", "keyField", ".", "getField", "(", "DBConstants", ".", "FILE_KEY_AREA", ")", ";", "int", "limitDesc", "=", "iAreaDesc", ";", "if", "(", "keyField", ".", "getKeyOrder", "(", ")", "==", "DBConstants", ".", "DESCENDING", ")", "{", "// If Descending, set to opposite", "if", "(", "iAreaDesc", "==", "DBConstants", ".", "START_SELECT_KEY", ")", "limitDesc", "=", "DBConstants", ".", "END_SELECT_KEY", ";", "else", "limitDesc", "=", "DBConstants", ".", "START_SELECT_KEY", ";", "}", "thisField", ".", "setToLimit", "(", "limitDesc", ")", ";", "// Set this field to largest/smallest value possible", "thisField", ".", "setModified", "(", "false", ")", ";", "// So you can sense a change", "// Match the param fields to the start/end value.", "keyField", ".", "getField", "(", "iAreaDesc", ")", ".", "moveFieldToThis", "(", "thisField", ",", "false", ",", "DBConstants", ".", "INIT_MOVE", ")", ";", "keyField", ".", "getField", "(", "iAreaDesc", ")", ".", "setModified", "(", "false", ")", ";", "}", "}" ]
Initialize the Key Fields. @param iAreaDesc The (optional) temporary area to copy the current fields to. @see BaseField.zeroKeyFields(int).
[ "Initialize", "the", "Key", "Fields", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L510-L532
152,636
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.setKeyOrder
public void setKeyOrder(boolean bKeyOrder) { super.setKeyOrder(bKeyOrder); boolean bForceUniqueKey = true; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); keyField.setKeyOrder(bKeyOrder); } }
java
public void setKeyOrder(boolean bKeyOrder) { super.setKeyOrder(bKeyOrder); boolean bForceUniqueKey = true; int iKeyFieldCount = this.getKeyFields(bForceUniqueKey, false); for (int iKeyFieldSeq = DBConstants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFieldCount; iKeyFieldSeq++) { KeyField keyField = this.getKeyField(iKeyFieldSeq, bForceUniqueKey); keyField.setKeyOrder(bKeyOrder); } }
[ "public", "void", "setKeyOrder", "(", "boolean", "bKeyOrder", ")", "{", "super", ".", "setKeyOrder", "(", "bKeyOrder", ")", ";", "boolean", "bForceUniqueKey", "=", "true", ";", "int", "iKeyFieldCount", "=", "this", ".", "getKeyFields", "(", "bForceUniqueKey", ",", "false", ")", ";", "for", "(", "int", "iKeyFieldSeq", "=", "DBConstants", ".", "MAIN_KEY_FIELD", ";", "iKeyFieldSeq", "<", "iKeyFieldCount", ";", "iKeyFieldSeq", "++", ")", "{", "KeyField", "keyField", "=", "this", ".", "getKeyField", "(", "iKeyFieldSeq", ",", "bForceUniqueKey", ")", ";", "keyField", ".", "setKeyOrder", "(", "bKeyOrder", ")", ";", "}", "}" ]
Order the keys ascending or descending?
[ "Order", "the", "keys", "ascending", "or", "descending?" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L648-L658
152,637
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.isNull
public boolean isNull(int iAreaDesc, boolean bIncludeTempFields) { for (int i = 0; i < this.getKeyFields(false, bIncludeTempFields); i++) { if (this.getField(i) != this.getRecord().getCounterField()) if (this.getKeyField(i).getField(iAreaDesc).isNull()) return true; // Is null } return false; // is not null }
java
public boolean isNull(int iAreaDesc, boolean bIncludeTempFields) { for (int i = 0; i < this.getKeyFields(false, bIncludeTempFields); i++) { if (this.getField(i) != this.getRecord().getCounterField()) if (this.getKeyField(i).getField(iAreaDesc).isNull()) return true; // Is null } return false; // is not null }
[ "public", "boolean", "isNull", "(", "int", "iAreaDesc", ",", "boolean", "bIncludeTempFields", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "getKeyFields", "(", "false", ",", "bIncludeTempFields", ")", ";", "i", "++", ")", "{", "if", "(", "this", ".", "getField", "(", "i", ")", "!=", "this", ".", "getRecord", "(", ")", ".", "getCounterField", "(", ")", ")", "if", "(", "this", ".", "getKeyField", "(", "i", ")", ".", "getField", "(", "iAreaDesc", ")", ".", "isNull", "(", ")", ")", "return", "true", ";", "// Is null", "}", "return", "false", ";", "// is not null", "}" ]
If any of the non-counter fields are null, return true. @param iAreaDesc @return
[ "If", "any", "of", "the", "non", "-", "counter", "fields", "are", "null", "return", "true", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L664-L673
152,638
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/KeyArea.java
KeyArea.isNullable
public boolean isNullable() { for (int i = 0; i < this.getKeyFields(); i++) { if (this.getKeyField(i).getField(DBConstants.FILE_KEY_AREA).isNullable()) return true; // Is nullable } return false; // is not nullable }
java
public boolean isNullable() { for (int i = 0; i < this.getKeyFields(); i++) { if (this.getKeyField(i).getField(DBConstants.FILE_KEY_AREA).isNullable()) return true; // Is nullable } return false; // is not nullable }
[ "public", "boolean", "isNullable", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "getKeyFields", "(", ")", ";", "i", "++", ")", "{", "if", "(", "this", ".", "getKeyField", "(", "i", ")", ".", "getField", "(", "DBConstants", ".", "FILE_KEY_AREA", ")", ".", "isNullable", "(", ")", ")", "return", "true", ";", "// Is nullable", "}", "return", "false", ";", "// is not nullable", "}" ]
Can any of the fields in this key be null? @return
[ "Can", "any", "of", "the", "fields", "in", "this", "key", "be", "null?" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/KeyArea.java#L678-L686
152,639
tvesalainen/util
security/src/main/java/org/vesalainen/net/ssl/AbstractSSLSocketChannel.java
AbstractSSLSocketChannel.read
@Override public long read(ByteBuffer[] dsts, int offset, int length) throws IOException { long rc = fillAppRead(); if (rc <= 0) { return rc; } return ByteBuffers.move(appRead, dsts, offset, length); }
java
@Override public long read(ByteBuffer[] dsts, int offset, int length) throws IOException { long rc = fillAppRead(); if (rc <= 0) { return rc; } return ByteBuffers.move(appRead, dsts, offset, length); }
[ "@", "Override", "public", "long", "read", "(", "ByteBuffer", "[", "]", "dsts", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "long", "rc", "=", "fillAppRead", "(", ")", ";", "if", "(", "rc", "<=", "0", ")", "{", "return", "rc", ";", "}", "return", "ByteBuffers", ".", "move", "(", "appRead", ",", "dsts", ",", "offset", ",", "length", ")", ";", "}" ]
Reads ByteBuffer from peer. Starts handshaking if needed. @param dsts @param offset @param length @return @throws IOException @throws HelloForwardException if client hello triggers host filter. @see org.vesalainen.net.ssl.AbstractSSLSocketChannel#setHostFilter(java.util.function.Predicate)
[ "Reads", "ByteBuffer", "from", "peer", ".", "Starts", "handshaking", "if", "needed", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/security/src/main/java/org/vesalainen/net/ssl/AbstractSSLSocketChannel.java#L349-L358
152,640
tvesalainen/util
security/src/main/java/org/vesalainen/net/ssl/AbstractSSLSocketChannel.java
AbstractSSLSocketChannel.write
@Override public long write(ByteBuffer[] srcs, int offset, int length) throws IOException { appWrite.compact(); long len = ByteBuffers.move(srcs, offset, length, appWrite); appWrite.flip(); wrap(); return len; }
java
@Override public long write(ByteBuffer[] srcs, int offset, int length) throws IOException { appWrite.compact(); long len = ByteBuffers.move(srcs, offset, length, appWrite); appWrite.flip(); wrap(); return len; }
[ "@", "Override", "public", "long", "write", "(", "ByteBuffer", "[", "]", "srcs", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "appWrite", ".", "compact", "(", ")", ";", "long", "len", "=", "ByteBuffers", ".", "move", "(", "srcs", ",", "offset", ",", "length", ",", "appWrite", ")", ";", "appWrite", ".", "flip", "(", ")", ";", "wrap", "(", ")", ";", "return", "len", ";", "}" ]
Writes ByteBuffer to peer. Starts handshaking if needed. @param srcs @param offset @param length @return @throws IOException @throws HelloForwardException if client hello triggers host filter. @see org.vesalainen.net.ssl.AbstractSSLSocketChannel#setHostFilter(java.util.function.Predicate)
[ "Writes", "ByteBuffer", "to", "peer", ".", "Starts", "handshaking", "if", "needed", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/security/src/main/java/org/vesalainen/net/ssl/AbstractSSLSocketChannel.java#L405-L413
152,641
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/misc/EncodingSupport.java
EncodingSupport.encodeBase64
public static String encodeBase64(byte[] rawData, int lineLength) { if (rawData == null) { return ""; } StringBuffer retval = new StringBuffer(); int i = 0; int n = 0; for (; i < rawData.length - 2; i += 3) { if (lineLength > 0 && i > 0 && i % lineLength == 0) { retval.append("\n"); } //n is a 32 bit number //shift all the way to left first to get rid of sign // 3.shift last 8 bits to left 2.shift next 8 bits left of first 1. start here with last 8 bits shifted into int n = (((rawData[i] << 24) >>> 8) + ((rawData[i + 1] << 24) >>> 16) + ((rawData[i + 2] << 24) >>> 24)); //this results in a 24 bit number (stored in 32 bit int) //of which 4 chunks of 6 bits are used to pick characters of base64Chars retval.append(base64Chars.charAt((n >>> 18) & 63)); retval.append(base64Chars.charAt((n >>> 12) & 63)); retval.append(base64Chars.charAt((n >>> 6) & 63)); retval.append(base64Chars.charAt(n & 63)); } //finish according to spec if (i + 1 == rawData.length) { n = ((rawData[i] << 24) >>> 8); retval.append(base64Chars.charAt((n >>> 18) & 63)); retval.append(base64Chars.charAt((n >>> 12) & 63)); retval.append("=="); } if (i + 2 == rawData.length) { n = ((rawData[i] << 24) >>> 8) + ((rawData[i + 1] << 24) >>> 16); retval.append(base64Chars.charAt((n >>> 18) & 63)); retval.append(base64Chars.charAt((n >>> 12) & 63)); retval.append(base64Chars.charAt((n >>> 6) & 63)); retval.append('='); } return retval.toString(); }
java
public static String encodeBase64(byte[] rawData, int lineLength) { if (rawData == null) { return ""; } StringBuffer retval = new StringBuffer(); int i = 0; int n = 0; for (; i < rawData.length - 2; i += 3) { if (lineLength > 0 && i > 0 && i % lineLength == 0) { retval.append("\n"); } //n is a 32 bit number //shift all the way to left first to get rid of sign // 3.shift last 8 bits to left 2.shift next 8 bits left of first 1. start here with last 8 bits shifted into int n = (((rawData[i] << 24) >>> 8) + ((rawData[i + 1] << 24) >>> 16) + ((rawData[i + 2] << 24) >>> 24)); //this results in a 24 bit number (stored in 32 bit int) //of which 4 chunks of 6 bits are used to pick characters of base64Chars retval.append(base64Chars.charAt((n >>> 18) & 63)); retval.append(base64Chars.charAt((n >>> 12) & 63)); retval.append(base64Chars.charAt((n >>> 6) & 63)); retval.append(base64Chars.charAt(n & 63)); } //finish according to spec if (i + 1 == rawData.length) { n = ((rawData[i] << 24) >>> 8); retval.append(base64Chars.charAt((n >>> 18) & 63)); retval.append(base64Chars.charAt((n >>> 12) & 63)); retval.append("=="); } if (i + 2 == rawData.length) { n = ((rawData[i] << 24) >>> 8) + ((rawData[i + 1] << 24) >>> 16); retval.append(base64Chars.charAt((n >>> 18) & 63)); retval.append(base64Chars.charAt((n >>> 12) & 63)); retval.append(base64Chars.charAt((n >>> 6) & 63)); retval.append('='); } return retval.toString(); }
[ "public", "static", "String", "encodeBase64", "(", "byte", "[", "]", "rawData", ",", "int", "lineLength", ")", "{", "if", "(", "rawData", "==", "null", ")", "{", "return", "\"\"", ";", "}", "StringBuffer", "retval", "=", "new", "StringBuffer", "(", ")", ";", "int", "i", "=", "0", ";", "int", "n", "=", "0", ";", "for", "(", ";", "i", "<", "rawData", ".", "length", "-", "2", ";", "i", "+=", "3", ")", "{", "if", "(", "lineLength", ">", "0", "&&", "i", ">", "0", "&&", "i", "%", "lineLength", "==", "0", ")", "{", "retval", ".", "append", "(", "\"\\n\"", ")", ";", "}", "//n is a 32 bit number", "//shift all the way to left first to get rid of sign", "// 3.shift last 8 bits to left 2.shift next 8 bits left of first 1. start here with last 8 bits shifted into int", "n", "=", "(", "(", "(", "rawData", "[", "i", "]", "<<", "24", ")", ">>>", "8", ")", "+", "(", "(", "rawData", "[", "i", "+", "1", "]", "<<", "24", ")", ">>>", "16", ")", "+", "(", "(", "rawData", "[", "i", "+", "2", "]", "<<", "24", ")", ">>>", "24", ")", ")", ";", "//this results in a 24 bit number (stored in 32 bit int)", "//of which 4 chunks of 6 bits are used to pick characters of base64Chars", "retval", ".", "append", "(", "base64Chars", ".", "charAt", "(", "(", "n", ">>>", "18", ")", "&", "63", ")", ")", ";", "retval", ".", "append", "(", "base64Chars", ".", "charAt", "(", "(", "n", ">>>", "12", ")", "&", "63", ")", ")", ";", "retval", ".", "append", "(", "base64Chars", ".", "charAt", "(", "(", "n", ">>>", "6", ")", "&", "63", ")", ")", ";", "retval", ".", "append", "(", "base64Chars", ".", "charAt", "(", "n", "&", "63", ")", ")", ";", "}", "//finish according to spec", "if", "(", "i", "+", "1", "==", "rawData", ".", "length", ")", "{", "n", "=", "(", "(", "rawData", "[", "i", "]", "<<", "24", ")", ">>>", "8", ")", ";", "retval", ".", "append", "(", "base64Chars", ".", "charAt", "(", "(", "n", ">>>", "18", ")", "&", "63", ")", ")", ";", "retval", ".", "append", "(", "base64Chars", ".", "charAt", "(", "(", "n", ">>>", "12", ")", "&", "63", ")", ")", ";", "retval", ".", "append", "(", "\"==\"", ")", ";", "}", "if", "(", "i", "+", "2", "==", "rawData", ".", "length", ")", "{", "n", "=", "(", "(", "rawData", "[", "i", "]", "<<", "24", ")", ">>>", "8", ")", "+", "(", "(", "rawData", "[", "i", "+", "1", "]", "<<", "24", ")", ">>>", "16", ")", ";", "retval", ".", "append", "(", "base64Chars", ".", "charAt", "(", "(", "n", ">>>", "18", ")", "&", "63", ")", ")", ";", "retval", ".", "append", "(", "base64Chars", ".", "charAt", "(", "(", "n", ">>>", "12", ")", "&", "63", ")", ")", ";", "retval", ".", "append", "(", "base64Chars", ".", "charAt", "(", "(", "n", ">>>", "6", ")", "&", "63", ")", ")", ";", "retval", ".", "append", "(", "'", "'", ")", ";", "}", "return", "retval", ".", "toString", "(", ")", ";", "}" ]
Converts a chunk of data into base 64 encoding. @param rawData @param lineLength optional length of lines in return value @return
[ "Converts", "a", "chunk", "of", "data", "into", "base", "64", "encoding", "." ]
971eb022115247b1e34dc26dd02e7e621e29e910
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/EncodingSupport.java#L51-L91
152,642
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/misc/EncodingSupport.java
EncodingSupport.decodeBase64
public static byte[] decodeBase64(String encodedData) { BufferedReader reader = new BufferedReader(new StringReader(encodedData)); int length = encodedData.length(); byte[] retval = new byte[length]; int actualLength = 0; String line; try { while ((line = reader.readLine()) != null) { byte[] rawData = line.getBytes(); int n = 0; for (int i = 0; i < rawData.length; i += 4) { n = (base64Chars.indexOf(rawData[i]) << 18) | (base64Chars.indexOf(rawData[i + 1]) << 12); retval[actualLength++] = (byte) ((n >>> 16) & 255); if (rawData[i + 2] != '=') { n |= (base64Chars.indexOf(rawData[i + 2]) << 6); retval[actualLength++] = (byte) ((n >>> 8) & 255); } if (rawData[i + 3] != '=') { n |= (base64Chars.indexOf(rawData[i + 3])); retval[actualLength++] = (byte) (n & 255); } } } } catch (IOException ioe) { throw new IllegalStateException("exception while reading input with message: " + ioe); } if (actualLength != length) { byte[] actualRetval = new byte[actualLength]; System.arraycopy(retval, 0, actualRetval, 0, actualLength); return actualRetval; } return retval; }
java
public static byte[] decodeBase64(String encodedData) { BufferedReader reader = new BufferedReader(new StringReader(encodedData)); int length = encodedData.length(); byte[] retval = new byte[length]; int actualLength = 0; String line; try { while ((line = reader.readLine()) != null) { byte[] rawData = line.getBytes(); int n = 0; for (int i = 0; i < rawData.length; i += 4) { n = (base64Chars.indexOf(rawData[i]) << 18) | (base64Chars.indexOf(rawData[i + 1]) << 12); retval[actualLength++] = (byte) ((n >>> 16) & 255); if (rawData[i + 2] != '=') { n |= (base64Chars.indexOf(rawData[i + 2]) << 6); retval[actualLength++] = (byte) ((n >>> 8) & 255); } if (rawData[i + 3] != '=') { n |= (base64Chars.indexOf(rawData[i + 3])); retval[actualLength++] = (byte) (n & 255); } } } } catch (IOException ioe) { throw new IllegalStateException("exception while reading input with message: " + ioe); } if (actualLength != length) { byte[] actualRetval = new byte[actualLength]; System.arraycopy(retval, 0, actualRetval, 0, actualLength); return actualRetval; } return retval; }
[ "public", "static", "byte", "[", "]", "decodeBase64", "(", "String", "encodedData", ")", "{", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "StringReader", "(", "encodedData", ")", ")", ";", "int", "length", "=", "encodedData", ".", "length", "(", ")", ";", "byte", "[", "]", "retval", "=", "new", "byte", "[", "length", "]", ";", "int", "actualLength", "=", "0", ";", "String", "line", ";", "try", "{", "while", "(", "(", "line", "=", "reader", ".", "readLine", "(", ")", ")", "!=", "null", ")", "{", "byte", "[", "]", "rawData", "=", "line", ".", "getBytes", "(", ")", ";", "int", "n", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "rawData", ".", "length", ";", "i", "+=", "4", ")", "{", "n", "=", "(", "base64Chars", ".", "indexOf", "(", "rawData", "[", "i", "]", ")", "<<", "18", ")", "|", "(", "base64Chars", ".", "indexOf", "(", "rawData", "[", "i", "+", "1", "]", ")", "<<", "12", ")", ";", "retval", "[", "actualLength", "++", "]", "=", "(", "byte", ")", "(", "(", "n", ">>>", "16", ")", "&", "255", ")", ";", "if", "(", "rawData", "[", "i", "+", "2", "]", "!=", "'", "'", ")", "{", "n", "|=", "(", "base64Chars", ".", "indexOf", "(", "rawData", "[", "i", "+", "2", "]", ")", "<<", "6", ")", ";", "retval", "[", "actualLength", "++", "]", "=", "(", "byte", ")", "(", "(", "n", ">>>", "8", ")", "&", "255", ")", ";", "}", "if", "(", "rawData", "[", "i", "+", "3", "]", "!=", "'", "'", ")", "{", "n", "|=", "(", "base64Chars", ".", "indexOf", "(", "rawData", "[", "i", "+", "3", "]", ")", ")", ";", "retval", "[", "actualLength", "++", "]", "=", "(", "byte", ")", "(", "n", "&", "255", ")", ";", "}", "}", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "throw", "new", "IllegalStateException", "(", "\"exception while reading input with message: \"", "+", "ioe", ")", ";", "}", "if", "(", "actualLength", "!=", "length", ")", "{", "byte", "[", "]", "actualRetval", "=", "new", "byte", "[", "actualLength", "]", ";", "System", ".", "arraycopy", "(", "retval", ",", "0", ",", "actualRetval", ",", "0", ",", "actualLength", ")", ";", "return", "actualRetval", ";", "}", "return", "retval", ";", "}" ]
Decodes base 64 encoded string. @param encodedData @return
[ "Decodes", "base", "64", "encoded", "string", "." ]
971eb022115247b1e34dc26dd02e7e621e29e910
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/misc/EncodingSupport.java#L99-L138
152,643
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/convert/PageNoConverter.java
PageNoConverter.init
public void init(String strPageDesc) { super.init(null); m_PageNo = 0; m_strPageDesc = strPageDesc; if ((m_strPageDesc == null) || (m_strPageDesc.length() == 0)) m_strPageDesc = "Page"; }
java
public void init(String strPageDesc) { super.init(null); m_PageNo = 0; m_strPageDesc = strPageDesc; if ((m_strPageDesc == null) || (m_strPageDesc.length() == 0)) m_strPageDesc = "Page"; }
[ "public", "void", "init", "(", "String", "strPageDesc", ")", "{", "super", ".", "init", "(", "null", ")", ";", "m_PageNo", "=", "0", ";", "m_strPageDesc", "=", "strPageDesc", ";", "if", "(", "(", "m_strPageDesc", "==", "null", ")", "||", "(", "m_strPageDesc", ".", "length", "(", ")", "==", "0", ")", ")", "m_strPageDesc", "=", "\"Page\"", ";", "}" ]
Initialize this Converter. @param strPageDesc The local string for the word "page".
[ "Initialize", "this", "Converter", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/convert/PageNoConverter.java#L55-L62
152,644
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/DatabaseCollection.java
DatabaseCollection.getDatabaseList
public Hashtable<String,Database> getDatabaseList(int iDatabaseType) { String strDbPrefix = this.getDatabasePrefix(iDatabaseType); iDatabaseType = iDatabaseType & DBConstants.TABLE_MASK; if ((iDatabaseType & DBConstants.TABLE_TYPE_MASK) == DBConstants.REMOTE) if (this.getProperty(DBParams.LOCAL) != null) if (this.getProperty(DBParams.LOCAL).equals(this.getProperty(DBParams.REMOTE))) iDatabaseType = (iDatabaseType & ~DBConstants.TABLE_TYPE_MASK) | DBConstants.LOCAL; // Local and Remote use the same database if ((iDatabaseType & DBConstants.TABLE_TYPE_MASK) == DBConstants.TABLE) if (this.getProperty(DBParams.LOCAL) != null) if (this.getProperty(DBParams.LOCAL).equals(this.getProperty(DBParams.TABLE))) iDatabaseType = (iDatabaseType & ~DBConstants.TABLE_TYPE_MASK) | DBConstants.LOCAL; // Local and Table use the same database if (iDatabaseType == DBConstants.SCREEN) iDatabaseType = (iDatabaseType & ~DBConstants.TABLE_TYPE_MASK) | DBConstants.LOCAL; // Local and Screen use the same database if ("Mapped".equalsIgnoreCase(strDbPrefix)) iDatabaseType = DBConstants.INTERNAL_MAPPED; if (m_htDatabaseList[iDatabaseType] == null) m_htDatabaseList[iDatabaseType] = new Hashtable<String,Database>(); return m_htDatabaseList[iDatabaseType]; }
java
public Hashtable<String,Database> getDatabaseList(int iDatabaseType) { String strDbPrefix = this.getDatabasePrefix(iDatabaseType); iDatabaseType = iDatabaseType & DBConstants.TABLE_MASK; if ((iDatabaseType & DBConstants.TABLE_TYPE_MASK) == DBConstants.REMOTE) if (this.getProperty(DBParams.LOCAL) != null) if (this.getProperty(DBParams.LOCAL).equals(this.getProperty(DBParams.REMOTE))) iDatabaseType = (iDatabaseType & ~DBConstants.TABLE_TYPE_MASK) | DBConstants.LOCAL; // Local and Remote use the same database if ((iDatabaseType & DBConstants.TABLE_TYPE_MASK) == DBConstants.TABLE) if (this.getProperty(DBParams.LOCAL) != null) if (this.getProperty(DBParams.LOCAL).equals(this.getProperty(DBParams.TABLE))) iDatabaseType = (iDatabaseType & ~DBConstants.TABLE_TYPE_MASK) | DBConstants.LOCAL; // Local and Table use the same database if (iDatabaseType == DBConstants.SCREEN) iDatabaseType = (iDatabaseType & ~DBConstants.TABLE_TYPE_MASK) | DBConstants.LOCAL; // Local and Screen use the same database if ("Mapped".equalsIgnoreCase(strDbPrefix)) iDatabaseType = DBConstants.INTERNAL_MAPPED; if (m_htDatabaseList[iDatabaseType] == null) m_htDatabaseList[iDatabaseType] = new Hashtable<String,Database>(); return m_htDatabaseList[iDatabaseType]; }
[ "public", "Hashtable", "<", "String", ",", "Database", ">", "getDatabaseList", "(", "int", "iDatabaseType", ")", "{", "String", "strDbPrefix", "=", "this", ".", "getDatabasePrefix", "(", "iDatabaseType", ")", ";", "iDatabaseType", "=", "iDatabaseType", "&", "DBConstants", ".", "TABLE_MASK", ";", "if", "(", "(", "iDatabaseType", "&", "DBConstants", ".", "TABLE_TYPE_MASK", ")", "==", "DBConstants", ".", "REMOTE", ")", "if", "(", "this", ".", "getProperty", "(", "DBParams", ".", "LOCAL", ")", "!=", "null", ")", "if", "(", "this", ".", "getProperty", "(", "DBParams", ".", "LOCAL", ")", ".", "equals", "(", "this", ".", "getProperty", "(", "DBParams", ".", "REMOTE", ")", ")", ")", "iDatabaseType", "=", "(", "iDatabaseType", "&", "~", "DBConstants", ".", "TABLE_TYPE_MASK", ")", "|", "DBConstants", ".", "LOCAL", ";", "// Local and Remote use the same database", "if", "(", "(", "iDatabaseType", "&", "DBConstants", ".", "TABLE_TYPE_MASK", ")", "==", "DBConstants", ".", "TABLE", ")", "if", "(", "this", ".", "getProperty", "(", "DBParams", ".", "LOCAL", ")", "!=", "null", ")", "if", "(", "this", ".", "getProperty", "(", "DBParams", ".", "LOCAL", ")", ".", "equals", "(", "this", ".", "getProperty", "(", "DBParams", ".", "TABLE", ")", ")", ")", "iDatabaseType", "=", "(", "iDatabaseType", "&", "~", "DBConstants", ".", "TABLE_TYPE_MASK", ")", "|", "DBConstants", ".", "LOCAL", ";", "// Local and Table use the same database", "if", "(", "iDatabaseType", "==", "DBConstants", ".", "SCREEN", ")", "iDatabaseType", "=", "(", "iDatabaseType", "&", "~", "DBConstants", ".", "TABLE_TYPE_MASK", ")", "|", "DBConstants", ".", "LOCAL", ";", "// Local and Screen use the same database", "if", "(", "\"Mapped\"", ".", "equalsIgnoreCase", "(", "strDbPrefix", ")", ")", "iDatabaseType", "=", "DBConstants", ".", "INTERNAL_MAPPED", ";", "if", "(", "m_htDatabaseList", "[", "iDatabaseType", "]", "==", "null", ")", "m_htDatabaseList", "[", "iDatabaseType", "]", "=", "new", "Hashtable", "<", "String", ",", "Database", ">", "(", ")", ";", "return", "m_htDatabaseList", "[", "iDatabaseType", "]", ";", "}" ]
Get the table that holds this type of database. @param iDatabaseType The DB Type. @return The database table.
[ "Get", "the", "table", "that", "holds", "this", "type", "of", "database", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/DatabaseCollection.java#L139-L159
152,645
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/DatabaseCollection.java
DatabaseCollection.isConcreteDBClass
public boolean isConcreteDBClass(String strDbPrefix) { if ((DBParams.JDBC.equalsIgnoreCase(strDbPrefix)) || ("Serial".equalsIgnoreCase(strDbPrefix)) || ("Soap".equalsIgnoreCase(strDbPrefix)) || ("Xml".equalsIgnoreCase(strDbPrefix))) return true; return false; }
java
public boolean isConcreteDBClass(String strDbPrefix) { if ((DBParams.JDBC.equalsIgnoreCase(strDbPrefix)) || ("Serial".equalsIgnoreCase(strDbPrefix)) || ("Soap".equalsIgnoreCase(strDbPrefix)) || ("Xml".equalsIgnoreCase(strDbPrefix))) return true; return false; }
[ "public", "boolean", "isConcreteDBClass", "(", "String", "strDbPrefix", ")", "{", "if", "(", "(", "DBParams", ".", "JDBC", ".", "equalsIgnoreCase", "(", "strDbPrefix", ")", ")", "||", "(", "\"Serial\"", ".", "equalsIgnoreCase", "(", "strDbPrefix", ")", ")", "||", "(", "\"Soap\"", ".", "equalsIgnoreCase", "(", "strDbPrefix", ")", ")", "||", "(", "\"Xml\"", ".", "equalsIgnoreCase", "(", "strDbPrefix", ")", ")", ")", "return", "true", ";", "return", "false", ";", "}" ]
Is this DB type directly accessing the data? @param strDbPrefix @return
[ "Is", "this", "DB", "type", "directly", "accessing", "the", "data?" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/DatabaseCollection.java#L165-L173
152,646
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/DatabaseCollection.java
DatabaseCollection.getDatabasePrefix
public String getDatabasePrefix(int iDatabaseType) { int iDBType = (iDatabaseType & DBConstants.TABLE_TYPE_MASK); String strDbPrefix = null; if (iDBType == DBConstants.LOCAL) strDbPrefix = this.getProperty(DBParams.LOCAL); else if (iDBType == DBConstants.REMOTE) strDbPrefix = this.getProperty(DBParams.REMOTE); else if (iDBType == DBConstants.TABLE) strDbPrefix = this.getProperty(DBParams.TABLE); else if (iDBType == DBConstants.MEMORY) strDbPrefix = DBParams.MEMORY; else if (iDBType == DBConstants.UNSHAREABLE_MEMORY) strDbPrefix = DBParams.MEMORY; else if (iDBType == DBConstants.SYSTEM_DATABASE) strDbPrefix = this.getProperty(DBParams.REMOTE); else if (iDBType == DBConstants.REMOTE_MEMORY) { strDbPrefix = this.getProperty(DBParams.REMOTE); // Client for remote, memory for concrete db if ((strDbPrefix == null) || (this.isConcreteDBClass(strDbPrefix))) strDbPrefix = DBParams.MEMORY; } if ((iDatabaseType & DBConstants.MAPPED) != 0) if (this.isConcreteDBClass(strDbPrefix)) strDbPrefix = "Mapped"; return strDbPrefix; }
java
public String getDatabasePrefix(int iDatabaseType) { int iDBType = (iDatabaseType & DBConstants.TABLE_TYPE_MASK); String strDbPrefix = null; if (iDBType == DBConstants.LOCAL) strDbPrefix = this.getProperty(DBParams.LOCAL); else if (iDBType == DBConstants.REMOTE) strDbPrefix = this.getProperty(DBParams.REMOTE); else if (iDBType == DBConstants.TABLE) strDbPrefix = this.getProperty(DBParams.TABLE); else if (iDBType == DBConstants.MEMORY) strDbPrefix = DBParams.MEMORY; else if (iDBType == DBConstants.UNSHAREABLE_MEMORY) strDbPrefix = DBParams.MEMORY; else if (iDBType == DBConstants.SYSTEM_DATABASE) strDbPrefix = this.getProperty(DBParams.REMOTE); else if (iDBType == DBConstants.REMOTE_MEMORY) { strDbPrefix = this.getProperty(DBParams.REMOTE); // Client for remote, memory for concrete db if ((strDbPrefix == null) || (this.isConcreteDBClass(strDbPrefix))) strDbPrefix = DBParams.MEMORY; } if ((iDatabaseType & DBConstants.MAPPED) != 0) if (this.isConcreteDBClass(strDbPrefix)) strDbPrefix = "Mapped"; return strDbPrefix; }
[ "public", "String", "getDatabasePrefix", "(", "int", "iDatabaseType", ")", "{", "int", "iDBType", "=", "(", "iDatabaseType", "&", "DBConstants", ".", "TABLE_TYPE_MASK", ")", ";", "String", "strDbPrefix", "=", "null", ";", "if", "(", "iDBType", "==", "DBConstants", ".", "LOCAL", ")", "strDbPrefix", "=", "this", ".", "getProperty", "(", "DBParams", ".", "LOCAL", ")", ";", "else", "if", "(", "iDBType", "==", "DBConstants", ".", "REMOTE", ")", "strDbPrefix", "=", "this", ".", "getProperty", "(", "DBParams", ".", "REMOTE", ")", ";", "else", "if", "(", "iDBType", "==", "DBConstants", ".", "TABLE", ")", "strDbPrefix", "=", "this", ".", "getProperty", "(", "DBParams", ".", "TABLE", ")", ";", "else", "if", "(", "iDBType", "==", "DBConstants", ".", "MEMORY", ")", "strDbPrefix", "=", "DBParams", ".", "MEMORY", ";", "else", "if", "(", "iDBType", "==", "DBConstants", ".", "UNSHAREABLE_MEMORY", ")", "strDbPrefix", "=", "DBParams", ".", "MEMORY", ";", "else", "if", "(", "iDBType", "==", "DBConstants", ".", "SYSTEM_DATABASE", ")", "strDbPrefix", "=", "this", ".", "getProperty", "(", "DBParams", ".", "REMOTE", ")", ";", "else", "if", "(", "iDBType", "==", "DBConstants", ".", "REMOTE_MEMORY", ")", "{", "strDbPrefix", "=", "this", ".", "getProperty", "(", "DBParams", ".", "REMOTE", ")", ";", "// Client for remote, memory for concrete db", "if", "(", "(", "strDbPrefix", "==", "null", ")", "||", "(", "this", ".", "isConcreteDBClass", "(", "strDbPrefix", ")", ")", ")", "strDbPrefix", "=", "DBParams", ".", "MEMORY", ";", "}", "if", "(", "(", "iDatabaseType", "&", "DBConstants", ".", "MAPPED", ")", "!=", "0", ")", "if", "(", "this", ".", "isConcreteDBClass", "(", "strDbPrefix", ")", ")", "strDbPrefix", "=", "\"Mapped\"", ";", "return", "strDbPrefix", ";", "}" ]
Get Database prefix. @param iDBType The DB Type. @return The database.
[ "Get", "Database", "prefix", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/DatabaseCollection.java#L197-L223
152,647
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/DatabaseCollection.java
DatabaseCollection.removeDatabase
public boolean removeDatabase(Database database) { database = (BaseDatabase)this.getDatabaseList((database.getDatabaseType() & DBConstants.TABLE_MASK)).remove(database.getDatabaseName(false)); if (database == null) return false; return true; }
java
public boolean removeDatabase(Database database) { database = (BaseDatabase)this.getDatabaseList((database.getDatabaseType() & DBConstants.TABLE_MASK)).remove(database.getDatabaseName(false)); if (database == null) return false; return true; }
[ "public", "boolean", "removeDatabase", "(", "Database", "database", ")", "{", "database", "=", "(", "BaseDatabase", ")", "this", ".", "getDatabaseList", "(", "(", "database", ".", "getDatabaseType", "(", ")", "&", "DBConstants", ".", "TABLE_MASK", ")", ")", ".", "remove", "(", "database", ".", "getDatabaseName", "(", "false", ")", ")", ";", "if", "(", "database", "==", "null", ")", "return", "false", ";", "return", "true", ";", "}" ]
Remove this database from my database list. Do not call these directly, used in database free. @param database The database to free. @return true if successful.
[ "Remove", "this", "database", "from", "my", "database", "list", ".", "Do", "not", "call", "these", "directly", "used", "in", "database", "free", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/DatabaseCollection.java#L239-L245
152,648
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/DatabaseCollection.java
DatabaseCollection.getProperty
private String getProperty(String strProperty) { String strValue = m_databaseOwner.getProperty(strProperty); if (strValue == null) if (!(m_databaseOwner instanceof Environment)) if (m_databaseOwner.getEnvironment() != null) strValue = ((Environment)m_databaseOwner.getEnvironment()).getProperty(strProperty); return strValue; }
java
private String getProperty(String strProperty) { String strValue = m_databaseOwner.getProperty(strProperty); if (strValue == null) if (!(m_databaseOwner instanceof Environment)) if (m_databaseOwner.getEnvironment() != null) strValue = ((Environment)m_databaseOwner.getEnvironment()).getProperty(strProperty); return strValue; }
[ "private", "String", "getProperty", "(", "String", "strProperty", ")", "{", "String", "strValue", "=", "m_databaseOwner", ".", "getProperty", "(", "strProperty", ")", ";", "if", "(", "strValue", "==", "null", ")", "if", "(", "!", "(", "m_databaseOwner", "instanceof", "Environment", ")", ")", "if", "(", "m_databaseOwner", ".", "getEnvironment", "(", ")", "!=", "null", ")", "strValue", "=", "(", "(", "Environment", ")", "m_databaseOwner", ".", "getEnvironment", "(", ")", ")", ".", "getProperty", "(", "strProperty", ")", ";", "return", "strValue", ";", "}" ]
This is just a utility method to get the properties from the DB Owner. There is a slight difference between this getProperties and the one in the recordOwner. The recordowner getProperty method only checks up to the application. This method also checks the Environment properties. @param strProperty The key to look up the property. @return The value associated with this key.
[ "This", "is", "just", "a", "utility", "method", "to", "get", "the", "properties", "from", "the", "DB", "Owner", ".", "There", "is", "a", "slight", "difference", "between", "this", "getProperties", "and", "the", "one", "in", "the", "recordOwner", ".", "The", "recordowner", "getProperty", "method", "only", "checks", "up", "to", "the", "application", ".", "This", "method", "also", "checks", "the", "Environment", "properties", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/DatabaseCollection.java#L254-L262
152,649
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/ValidateDigitHandler.java
ValidateDigitHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { // Read a valid record int value = (int)((NumberField)this.getOwner()).getValue(); if ((value / 10) % 7 != value - (value / 10 * 10)) { Task task = null; if (this.getOwner() != null) if (this.getOwner().getRecord() != null) task = this.getOwner().getRecord().getTask(); String strError = "Incorrect Magic number"; if (task != null) { strError = ((BaseApplication)task.getApplication()).getResources(ResourceConstants.ERROR_RESOURCE, true).getString(strError); return task.setLastError(strError); } return DBConstants.ERROR_RETURN; } return super.fieldChanged(bDisplayOption, iMoveMode); }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { // Read a valid record int value = (int)((NumberField)this.getOwner()).getValue(); if ((value / 10) % 7 != value - (value / 10 * 10)) { Task task = null; if (this.getOwner() != null) if (this.getOwner().getRecord() != null) task = this.getOwner().getRecord().getTask(); String strError = "Incorrect Magic number"; if (task != null) { strError = ((BaseApplication)task.getApplication()).getResources(ResourceConstants.ERROR_RESOURCE, true).getString(strError); return task.setLastError(strError); } return DBConstants.ERROR_RETURN; } return super.fieldChanged(bDisplayOption, iMoveMode); }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "// Read a valid record", "int", "value", "=", "(", "int", ")", "(", "(", "NumberField", ")", "this", ".", "getOwner", "(", ")", ")", ".", "getValue", "(", ")", ";", "if", "(", "(", "value", "/", "10", ")", "%", "7", "!=", "value", "-", "(", "value", "/", "10", "*", "10", ")", ")", "{", "Task", "task", "=", "null", ";", "if", "(", "this", ".", "getOwner", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", "!=", "null", ")", "task", "=", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getTask", "(", ")", ";", "String", "strError", "=", "\"Incorrect Magic number\"", ";", "if", "(", "task", "!=", "null", ")", "{", "strError", "=", "(", "(", "BaseApplication", ")", "task", ".", "getApplication", "(", ")", ")", ".", "getResources", "(", "ResourceConstants", ".", "ERROR_RESOURCE", ",", "true", ")", ".", "getString", "(", "strError", ")", ";", "return", "task", ".", "setLastError", "(", "strError", ")", ";", "}", "return", "DBConstants", ".", "ERROR_RETURN", ";", "}", "return", "super", ".", "fieldChanged", "(", "bDisplayOption", ",", "iMoveMode", ")", ";", "}" ]
The Field has Changed. Make sure this is a valid modulus-7 number, if not, return an error. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "The", "Field", "has", "Changed", ".", "Make", "sure", "this", "is", "a", "valid", "modulus", "-", "7", "number", "if", "not", "return", "an", "error", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ValidateDigitHandler.java#L60-L78
152,650
OwlPlatform/java-owl-worldmodel
src/main/java/com/owlplatform/worldmodel/solver/protocol/messages/OnDemandRequest.java
OnDemandRequest.getLength
public int getLength() { // Alias, number of patterns int length = 4 + 4; if (this.identifierPatterns != null) { for (String identifier : this.identifierPatterns) { try { length += (4 + identifier.getBytes("UTF-16BE").length); } catch (UnsupportedEncodingException e) { log.error("Unable to encode to UTF-16BE."); } } } return length; }
java
public int getLength() { // Alias, number of patterns int length = 4 + 4; if (this.identifierPatterns != null) { for (String identifier : this.identifierPatterns) { try { length += (4 + identifier.getBytes("UTF-16BE").length); } catch (UnsupportedEncodingException e) { log.error("Unable to encode to UTF-16BE."); } } } return length; }
[ "public", "int", "getLength", "(", ")", "{", "// Alias, number of patterns", "int", "length", "=", "4", "+", "4", ";", "if", "(", "this", ".", "identifierPatterns", "!=", "null", ")", "{", "for", "(", "String", "identifier", ":", "this", ".", "identifierPatterns", ")", "{", "try", "{", "length", "+=", "(", "4", "+", "identifier", ".", "getBytes", "(", "\"UTF-16BE\"", ")", ".", "length", ")", ";", "}", "catch", "(", "UnsupportedEncodingException", "e", ")", "{", "log", ".", "error", "(", "\"Unable to encode to UTF-16BE.\"", ")", ";", "}", "}", "}", "return", "length", ";", "}" ]
Length of this object when encoded according to the Solver-World Model protocol. @return the length, in bytes, of the encoded form of this object.
[ "Length", "of", "this", "object", "when", "encoded", "according", "to", "the", "Solver", "-", "World", "Model", "protocol", "." ]
a850e8b930c6e9787c7cad30c0de887858ca563d
https://github.com/OwlPlatform/java-owl-worldmodel/blob/a850e8b930c6e9787c7cad30c0de887858ca563d/src/main/java/com/owlplatform/worldmodel/solver/protocol/messages/OnDemandRequest.java#L35-L49
152,651
js-lib-com/commons
src/main/java/js/converter/NumbersConverter.java
NumbersConverter.asObject
@Override public <T> T asObject(String string, Class<T> valueType) throws BugError { if ("null".equals(string)) { return null; } Number number = string.isEmpty() ? 0 : parseNumber(string); // hopefully int and double are most used numeric types and test them first if (Types.equalsAny(valueType, int.class, Integer.class)) { return (T) (Integer) number.intValue(); } if (Types.equalsAny(valueType, double.class, Double.class)) { return (T) (Double) number.doubleValue(); } if (Types.equalsAny(valueType, byte.class, Byte.class)) { return (T) (Byte) number.byteValue(); } if (Types.equalsAny(valueType, short.class, Short.class)) { return (T) (Short) number.shortValue(); } if (Types.equalsAny(valueType, long.class, Long.class)) { // because converting between doubles and longs may result in loss of precision we need // special treatment for longs. @see ConverterUnitTest.testConversionPrecision if (string.length() > 0 && string.indexOf('.') == -1) { // handle hexadecimal notation if (string.length() > 1 && string.charAt(0) == '0' && string.charAt(1) == 'x') { return (T) (Long) Long.parseLong(string.substring(2), 16); } return (T) (Long) Long.parseLong(string); } return (T) (Long) number.longValue(); } if (Types.equalsAny(valueType, float.class, Float.class)) { return (T) (Float) number.floatValue(); } // if(Classes.equalsAny(t,BigInteger.class) { // return (T)new BigInteger(number.doubleValue()); // } if (Types.equalsAny(valueType, BigDecimal.class)) { return (T) new BigDecimal(number.doubleValue()); } throw new BugError("Unsupported numeric value |%s|.", valueType); }
java
@Override public <T> T asObject(String string, Class<T> valueType) throws BugError { if ("null".equals(string)) { return null; } Number number = string.isEmpty() ? 0 : parseNumber(string); // hopefully int and double are most used numeric types and test them first if (Types.equalsAny(valueType, int.class, Integer.class)) { return (T) (Integer) number.intValue(); } if (Types.equalsAny(valueType, double.class, Double.class)) { return (T) (Double) number.doubleValue(); } if (Types.equalsAny(valueType, byte.class, Byte.class)) { return (T) (Byte) number.byteValue(); } if (Types.equalsAny(valueType, short.class, Short.class)) { return (T) (Short) number.shortValue(); } if (Types.equalsAny(valueType, long.class, Long.class)) { // because converting between doubles and longs may result in loss of precision we need // special treatment for longs. @see ConverterUnitTest.testConversionPrecision if (string.length() > 0 && string.indexOf('.') == -1) { // handle hexadecimal notation if (string.length() > 1 && string.charAt(0) == '0' && string.charAt(1) == 'x') { return (T) (Long) Long.parseLong(string.substring(2), 16); } return (T) (Long) Long.parseLong(string); } return (T) (Long) number.longValue(); } if (Types.equalsAny(valueType, float.class, Float.class)) { return (T) (Float) number.floatValue(); } // if(Classes.equalsAny(t,BigInteger.class) { // return (T)new BigInteger(number.doubleValue()); // } if (Types.equalsAny(valueType, BigDecimal.class)) { return (T) new BigDecimal(number.doubleValue()); } throw new BugError("Unsupported numeric value |%s|.", valueType); }
[ "@", "Override", "public", "<", "T", ">", "T", "asObject", "(", "String", "string", ",", "Class", "<", "T", ">", "valueType", ")", "throws", "BugError", "{", "if", "(", "\"null\"", ".", "equals", "(", "string", ")", ")", "{", "return", "null", ";", "}", "Number", "number", "=", "string", ".", "isEmpty", "(", ")", "?", "0", ":", "parseNumber", "(", "string", ")", ";", "// hopefully int and double are most used numeric types and test them first\r", "if", "(", "Types", ".", "equalsAny", "(", "valueType", ",", "int", ".", "class", ",", "Integer", ".", "class", ")", ")", "{", "return", "(", "T", ")", "(", "Integer", ")", "number", ".", "intValue", "(", ")", ";", "}", "if", "(", "Types", ".", "equalsAny", "(", "valueType", ",", "double", ".", "class", ",", "Double", ".", "class", ")", ")", "{", "return", "(", "T", ")", "(", "Double", ")", "number", ".", "doubleValue", "(", ")", ";", "}", "if", "(", "Types", ".", "equalsAny", "(", "valueType", ",", "byte", ".", "class", ",", "Byte", ".", "class", ")", ")", "{", "return", "(", "T", ")", "(", "Byte", ")", "number", ".", "byteValue", "(", ")", ";", "}", "if", "(", "Types", ".", "equalsAny", "(", "valueType", ",", "short", ".", "class", ",", "Short", ".", "class", ")", ")", "{", "return", "(", "T", ")", "(", "Short", ")", "number", ".", "shortValue", "(", ")", ";", "}", "if", "(", "Types", ".", "equalsAny", "(", "valueType", ",", "long", ".", "class", ",", "Long", ".", "class", ")", ")", "{", "// because converting between doubles and longs may result in loss of precision we need\r", "// special treatment for longs. @see ConverterUnitTest.testConversionPrecision\r", "if", "(", "string", ".", "length", "(", ")", ">", "0", "&&", "string", ".", "indexOf", "(", "'", "'", ")", "==", "-", "1", ")", "{", "// handle hexadecimal notation\r", "if", "(", "string", ".", "length", "(", ")", ">", "1", "&&", "string", ".", "charAt", "(", "0", ")", "==", "'", "'", "&&", "string", ".", "charAt", "(", "1", ")", "==", "'", "'", ")", "{", "return", "(", "T", ")", "(", "Long", ")", "Long", ".", "parseLong", "(", "string", ".", "substring", "(", "2", ")", ",", "16", ")", ";", "}", "return", "(", "T", ")", "(", "Long", ")", "Long", ".", "parseLong", "(", "string", ")", ";", "}", "return", "(", "T", ")", "(", "Long", ")", "number", ".", "longValue", "(", ")", ";", "}", "if", "(", "Types", ".", "equalsAny", "(", "valueType", ",", "float", ".", "class", ",", "Float", ".", "class", ")", ")", "{", "return", "(", "T", ")", "(", "Float", ")", "number", ".", "floatValue", "(", ")", ";", "}", "// if(Classes.equalsAny(t,BigInteger.class) {\r", "// return (T)new BigInteger(number.doubleValue());\r", "// }\r", "if", "(", "Types", ".", "equalsAny", "(", "valueType", ",", "BigDecimal", ".", "class", ")", ")", "{", "return", "(", "T", ")", "new", "BigDecimal", "(", "number", ".", "doubleValue", "(", ")", ")", ";", "}", "throw", "new", "BugError", "(", "\"Unsupported numeric value |%s|.\"", ",", "valueType", ")", ";", "}" ]
Convert a string to a number of given type. If given string can't be stored into required type silent rounding is applied. If given string is empty return 0 since it is considered as an optional numeric input. @throws BugError if value type is not supported.
[ "Convert", "a", "string", "to", "a", "number", "of", "given", "type", ".", "If", "given", "string", "can", "t", "be", "stored", "into", "required", "type", "silent", "rounding", "is", "applied", ".", "If", "given", "string", "is", "empty", "return", "0", "since", "it", "is", "considered", "as", "an", "optional", "numeric", "input", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/NumbersConverter.java#L27-L69
152,652
js-lib-com/commons
src/main/java/js/converter/NumbersConverter.java
NumbersConverter.parseNumber
private Number parseNumber(String string) { if (string.length() > 2 && string.charAt(0) == '0' && string.charAt(1) == 'x') { return Long.parseLong(string.substring(2), 16); } return Double.parseDouble(string); }
java
private Number parseNumber(String string) { if (string.length() > 2 && string.charAt(0) == '0' && string.charAt(1) == 'x') { return Long.parseLong(string.substring(2), 16); } return Double.parseDouble(string); }
[ "private", "Number", "parseNumber", "(", "String", "string", ")", "{", "if", "(", "string", ".", "length", "(", ")", ">", "2", "&&", "string", ".", "charAt", "(", "0", ")", "==", "'", "'", "&&", "string", ".", "charAt", "(", "1", ")", "==", "'", "'", ")", "{", "return", "Long", ".", "parseLong", "(", "string", ".", "substring", "(", "2", ")", ",", "16", ")", ";", "}", "return", "Double", ".", "parseDouble", "(", "string", ")", ";", "}" ]
Parse numeric string value to a number. @param string numeric string value. @return number instance.
[ "Parse", "numeric", "string", "value", "to", "a", "number", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/NumbersConverter.java#L77-L82
152,653
entrusc/xdata
src/main/java/com/moebiusgames/xdata/ListDataKey.java
ListDataKey.create
public static <T> ListDataKey<T> create(String name, Class<T> dataClass) { return create(name, dataClass, true); }
java
public static <T> ListDataKey<T> create(String name, Class<T> dataClass) { return create(name, dataClass, true); }
[ "public", "static", "<", "T", ">", "ListDataKey", "<", "T", ">", "create", "(", "String", "name", ",", "Class", "<", "T", ">", "dataClass", ")", "{", "return", "create", "(", "name", ",", "dataClass", ",", "true", ")", ";", "}" ]
creates a list data key with the given name and type. Null types are allowed. @param <T> the type of the value @param name the name of the key that is stored in the xdata file @param dataClass the class of the type @return
[ "creates", "a", "list", "data", "key", "with", "the", "given", "name", "and", "type", ".", "Null", "types", "are", "allowed", "." ]
44ba4c59fd639c99b89fc8995ba83fe89ca4239d
https://github.com/entrusc/xdata/blob/44ba4c59fd639c99b89fc8995ba83fe89ca4239d/src/main/java/com/moebiusgames/xdata/ListDataKey.java#L72-L74
152,654
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToNative.java
BaseConvertToNative.getTimeStamp
public XMLGregorianCalendar getTimeStamp() { GregorianCalendar cal = new GregorianCalendar(); DatatypeFactory dt; try { dt = DatatypeFactory.newInstance(); return dt.newXMLGregorianCalendar(cal); } catch (DatatypeConfigurationException e) { e.printStackTrace(); } return null; }
java
public XMLGregorianCalendar getTimeStamp() { GregorianCalendar cal = new GregorianCalendar(); DatatypeFactory dt; try { dt = DatatypeFactory.newInstance(); return dt.newXMLGregorianCalendar(cal); } catch (DatatypeConfigurationException e) { e.printStackTrace(); } return null; }
[ "public", "XMLGregorianCalendar", "getTimeStamp", "(", ")", "{", "GregorianCalendar", "cal", "=", "new", "GregorianCalendar", "(", ")", ";", "DatatypeFactory", "dt", ";", "try", "{", "dt", "=", "DatatypeFactory", ".", "newInstance", "(", ")", ";", "return", "dt", ".", "newXMLGregorianCalendar", "(", "cal", ")", ";", "}", "catch", "(", "DatatypeConfigurationException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "return", "null", ";", "}" ]
Get the current timestamp. @return
[ "Get", "the", "current", "timestamp", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToNative.java#L154-L165
152,655
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToNative.java
BaseConvertToNative.setPayloadProperties
public void setPayloadProperties(BaseMessage message, Object msg) { MessageDataDesc messageDataDesc = message.getMessageDataDesc(null); // Top level only if (messageDataDesc != null) { Map<String,Class<?>> mapPropertyNames = messageDataDesc.getPayloadPropertyNames(null); if (mapPropertyNames != null) { for (String strKey : mapPropertyNames.keySet()) { Class<?> classKey = mapPropertyNames.get(strKey); this.setPayloadProperty(message, msg, strKey, classKey); } } } if (message.get("Version") == null) this.setPayloadProperty(DEFAULT_VERSION, msg, "Version", Float.class); this.setPayloadProperty(this.getTimeStamp(), msg, "TimeStamp", org.joda.time.DateTime.class); // Current timestamp }
java
public void setPayloadProperties(BaseMessage message, Object msg) { MessageDataDesc messageDataDesc = message.getMessageDataDesc(null); // Top level only if (messageDataDesc != null) { Map<String,Class<?>> mapPropertyNames = messageDataDesc.getPayloadPropertyNames(null); if (mapPropertyNames != null) { for (String strKey : mapPropertyNames.keySet()) { Class<?> classKey = mapPropertyNames.get(strKey); this.setPayloadProperty(message, msg, strKey, classKey); } } } if (message.get("Version") == null) this.setPayloadProperty(DEFAULT_VERSION, msg, "Version", Float.class); this.setPayloadProperty(this.getTimeStamp(), msg, "TimeStamp", org.joda.time.DateTime.class); // Current timestamp }
[ "public", "void", "setPayloadProperties", "(", "BaseMessage", "message", ",", "Object", "msg", ")", "{", "MessageDataDesc", "messageDataDesc", "=", "message", ".", "getMessageDataDesc", "(", "null", ")", ";", "// Top level only", "if", "(", "messageDataDesc", "!=", "null", ")", "{", "Map", "<", "String", ",", "Class", "<", "?", ">", ">", "mapPropertyNames", "=", "messageDataDesc", ".", "getPayloadPropertyNames", "(", "null", ")", ";", "if", "(", "mapPropertyNames", "!=", "null", ")", "{", "for", "(", "String", "strKey", ":", "mapPropertyNames", ".", "keySet", "(", ")", ")", "{", "Class", "<", "?", ">", "classKey", "=", "mapPropertyNames", ".", "get", "(", "strKey", ")", ";", "this", ".", "setPayloadProperty", "(", "message", ",", "msg", ",", "strKey", ",", "classKey", ")", ";", "}", "}", "}", "if", "(", "message", ".", "get", "(", "\"Version\"", ")", "==", "null", ")", "this", ".", "setPayloadProperty", "(", "DEFAULT_VERSION", ",", "msg", ",", "\"Version\"", ",", "Float", ".", "class", ")", ";", "this", ".", "setPayloadProperty", "(", "this", ".", "getTimeStamp", "(", ")", ",", "msg", ",", "\"TimeStamp\"", ",", "org", ".", "joda", ".", "time", ".", "DateTime", ".", "class", ")", ";", "// Current timestamp", "}" ]
Move the standard payload properties from the message to the xml. @param message @param msg
[ "Move", "the", "standard", "payload", "properties", "from", "the", "message", "to", "the", "xml", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToNative.java#L171-L189
152,656
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToNative.java
BaseConvertToNative.setPayloadProperty
public void setPayloadProperty(BaseMessage message, Object msg, String strKey, Class<?> classKey) { Object data = message.get(strKey); if (data == null) return; this.setPayloadProperty(data, msg, strKey, classKey); }
java
public void setPayloadProperty(BaseMessage message, Object msg, String strKey, Class<?> classKey) { Object data = message.get(strKey); if (data == null) return; this.setPayloadProperty(data, msg, strKey, classKey); }
[ "public", "void", "setPayloadProperty", "(", "BaseMessage", "message", ",", "Object", "msg", ",", "String", "strKey", ",", "Class", "<", "?", ">", "classKey", ")", "{", "Object", "data", "=", "message", ".", "get", "(", "strKey", ")", ";", "if", "(", "data", "==", "null", ")", "return", ";", "this", ".", "setPayloadProperty", "(", "data", ",", "msg", ",", "strKey", ",", "classKey", ")", ";", "}" ]
Move this standard payload properties from the message to the xml. @param message @param msg @param strKey
[ "Move", "this", "standard", "payload", "properties", "from", "the", "message", "to", "the", "xml", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToNative.java#L196-L202
152,657
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToNative.java
BaseConvertToNative.setPayloadProperty
public void setPayloadProperty(Object data, Object msg, String strKey, Class<?> classKey) { String name = "set" + strKey; try { Class<?>[] params = {classKey}; Method method = msg.getClass().getMethod(name, params); if (method != null) { Object[] datas = new Object[1]; if (data != null) if (!classKey.isAssignableFrom(data.getClass())) { data = this.convertObjectToDatatype(data, classKey); } datas[0] = data; method.invoke(msg, datas); } } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { // Ignore this one } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }
java
public void setPayloadProperty(Object data, Object msg, String strKey, Class<?> classKey) { String name = "set" + strKey; try { Class<?>[] params = {classKey}; Method method = msg.getClass().getMethod(name, params); if (method != null) { Object[] datas = new Object[1]; if (data != null) if (!classKey.isAssignableFrom(data.getClass())) { data = this.convertObjectToDatatype(data, classKey); } datas[0] = data; method.invoke(msg, datas); } } catch (SecurityException e) { e.printStackTrace(); } catch (NoSuchMethodException e) { // Ignore this one } catch (InvocationTargetException e) { e.printStackTrace(); } catch (IllegalAccessException e) { e.printStackTrace(); } }
[ "public", "void", "setPayloadProperty", "(", "Object", "data", ",", "Object", "msg", ",", "String", "strKey", ",", "Class", "<", "?", ">", "classKey", ")", "{", "String", "name", "=", "\"set\"", "+", "strKey", ";", "try", "{", "Class", "<", "?", ">", "[", "]", "params", "=", "{", "classKey", "}", ";", "Method", "method", "=", "msg", ".", "getClass", "(", ")", ".", "getMethod", "(", "name", ",", "params", ")", ";", "if", "(", "method", "!=", "null", ")", "{", "Object", "[", "]", "datas", "=", "new", "Object", "[", "1", "]", ";", "if", "(", "data", "!=", "null", ")", "if", "(", "!", "classKey", ".", "isAssignableFrom", "(", "data", ".", "getClass", "(", ")", ")", ")", "{", "data", "=", "this", ".", "convertObjectToDatatype", "(", "data", ",", "classKey", ")", ";", "}", "datas", "[", "0", "]", "=", "data", ";", "method", ".", "invoke", "(", "msg", ",", "datas", ")", ";", "}", "}", "catch", "(", "SecurityException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "NoSuchMethodException", "e", ")", "{", "// Ignore this one", "}", "catch", "(", "InvocationTargetException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "IllegalAccessException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Move this standard payload data to the xml. @param message @param msg @param strKey
[ "Move", "this", "standard", "payload", "data", "to", "the", "xml", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/message/external/convert/BaseConvertToNative.java#L209-L236
152,658
krotscheck/data-file-reader
data-file-reader-base/src/main/java/net/krotscheck/dfr/DecoderCache.java
DecoderCache.populateCache
private static void populateCache() { if (cache == null) { cache = new LinkedHashMap<>(); logger.info("IDataDecoders found:"); ServiceLoader<IDataDecoder> loader = ServiceLoader.load(IDataDecoder.class); // Logging. for (IDataDecoder discoveredDecoder : loader) { String name = discoveredDecoder.getClass().getCanonicalName(); String decoderMimeType = discoveredDecoder.getMimeType(); logger.info(String.format(" %s -> %s", decoderMimeType, name)); cache.put(decoderMimeType, discoveredDecoder.getClass()); } } }
java
private static void populateCache() { if (cache == null) { cache = new LinkedHashMap<>(); logger.info("IDataDecoders found:"); ServiceLoader<IDataDecoder> loader = ServiceLoader.load(IDataDecoder.class); // Logging. for (IDataDecoder discoveredDecoder : loader) { String name = discoveredDecoder.getClass().getCanonicalName(); String decoderMimeType = discoveredDecoder.getMimeType(); logger.info(String.format(" %s -> %s", decoderMimeType, name)); cache.put(decoderMimeType, discoveredDecoder.getClass()); } } }
[ "private", "static", "void", "populateCache", "(", ")", "{", "if", "(", "cache", "==", "null", ")", "{", "cache", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "logger", ".", "info", "(", "\"IDataDecoders found:\"", ")", ";", "ServiceLoader", "<", "IDataDecoder", ">", "loader", "=", "ServiceLoader", ".", "load", "(", "IDataDecoder", ".", "class", ")", ";", "// Logging.", "for", "(", "IDataDecoder", "discoveredDecoder", ":", "loader", ")", "{", "String", "name", "=", "discoveredDecoder", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", ";", "String", "decoderMimeType", "=", "discoveredDecoder", ".", "getMimeType", "(", ")", ";", "logger", ".", "info", "(", "String", ".", "format", "(", "\" %s -> %s\"", ",", "decoderMimeType", ",", "name", ")", ")", ";", "cache", ".", "put", "(", "decoderMimeType", ",", "discoveredDecoder", ".", "getClass", "(", ")", ")", ";", "}", "}", "}" ]
Populates the cache.
[ "Populates", "the", "cache", "." ]
b9a85bd07dc9f9b8291ffbfb6945443d96371811
https://github.com/krotscheck/data-file-reader/blob/b9a85bd07dc9f9b8291ffbfb6945443d96371811/data-file-reader-base/src/main/java/net/krotscheck/dfr/DecoderCache.java#L56-L74
152,659
krotscheck/data-file-reader
data-file-reader-base/src/main/java/net/krotscheck/dfr/DecoderCache.java
DecoderCache.getDecoder
public static IDataDecoder getDecoder(final String mimeType) throws ClassNotFoundException, IllegalAccessException, InstantiationException { populateCache(); if (!cache.containsKey(mimeType)) { throw new ClassNotFoundException( String.format("IDataDecoder for" + " mimeType [%s] not found.", mimeType)); } Class<? extends IDataDecoder> decoderClass = cache.get(mimeType); return decoderClass.newInstance(); }
java
public static IDataDecoder getDecoder(final String mimeType) throws ClassNotFoundException, IllegalAccessException, InstantiationException { populateCache(); if (!cache.containsKey(mimeType)) { throw new ClassNotFoundException( String.format("IDataDecoder for" + " mimeType [%s] not found.", mimeType)); } Class<? extends IDataDecoder> decoderClass = cache.get(mimeType); return decoderClass.newInstance(); }
[ "public", "static", "IDataDecoder", "getDecoder", "(", "final", "String", "mimeType", ")", "throws", "ClassNotFoundException", ",", "IllegalAccessException", ",", "InstantiationException", "{", "populateCache", "(", ")", ";", "if", "(", "!", "cache", ".", "containsKey", "(", "mimeType", ")", ")", "{", "throw", "new", "ClassNotFoundException", "(", "String", ".", "format", "(", "\"IDataDecoder for\"", "+", "\" mimeType [%s] not found.\"", ",", "mimeType", ")", ")", ";", "}", "Class", "<", "?", "extends", "IDataDecoder", ">", "decoderClass", "=", "cache", ".", "get", "(", "mimeType", ")", ";", "return", "decoderClass", ".", "newInstance", "(", ")", ";", "}" ]
Retrieve a decoder for a specified mime type. @param mimeType The mimetype to scan for. @return An instance of the decoder. @throws ClassNotFoundException Thrown when no decoder for a mimetype is found. @throws IllegalAccessException Thrown when the decoder's constructor is not accessible. Never thrown, as the service loader would throw it first. @throws InstantiationException Thrown when the decoder's constructor is not accessible. Never thrown, as the service loader would throw it first.
[ "Retrieve", "a", "decoder", "for", "a", "specified", "mime", "type", "." ]
b9a85bd07dc9f9b8291ffbfb6945443d96371811
https://github.com/krotscheck/data-file-reader/blob/b9a85bd07dc9f9b8291ffbfb6945443d96371811/data-file-reader-base/src/main/java/net/krotscheck/dfr/DecoderCache.java#L113-L128
152,660
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/progress/FileCopyProgressPanel.java
FileCopyProgressPanel.setCancelable
public final void setCancelable(final Cancelable cancelable) { if (SwingUtilities.isEventDispatchThread()) { setCancelableIntern(cancelable); } else { try { SwingUtilities.invokeLater(new Runnable() { public void run() { setCancelableIntern(cancelable); } }); } catch (final Exception ex) { ignore(); } } }
java
public final void setCancelable(final Cancelable cancelable) { if (SwingUtilities.isEventDispatchThread()) { setCancelableIntern(cancelable); } else { try { SwingUtilities.invokeLater(new Runnable() { public void run() { setCancelableIntern(cancelable); } }); } catch (final Exception ex) { ignore(); } } }
[ "public", "final", "void", "setCancelable", "(", "final", "Cancelable", "cancelable", ")", "{", "if", "(", "SwingUtilities", ".", "isEventDispatchThread", "(", ")", ")", "{", "setCancelableIntern", "(", "cancelable", ")", ";", "}", "else", "{", "try", "{", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "setCancelableIntern", "(", "cancelable", ")", ";", "}", "}", ")", ";", "}", "catch", "(", "final", "Exception", "ex", ")", "{", "ignore", "(", ")", ";", "}", "}", "}" ]
Sets the listener to inform about the user cancelling the current transfer. @param cancelable Listener or <code>null</code> if cancel is disabled.
[ "Sets", "the", "listener", "to", "inform", "about", "the", "user", "cancelling", "the", "current", "transfer", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/progress/FileCopyProgressPanel.java#L576-L590
152,661
fuinorg/utils4swing
src/main/java/org/fuin/utils4swing/progress/FileCopyProgressPanel.java
FileCopyProgressPanel.main
public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { Utils4Swing.initSystemLookAndFeel(); Utils4Swing.createShowAndPosition("Test Progress Dialog", new FileCopyProgressPanel(), true, new ScreenCenterPositioner()); } }); }
java
public static void main(final String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { Utils4Swing.initSystemLookAndFeel(); Utils4Swing.createShowAndPosition("Test Progress Dialog", new FileCopyProgressPanel(), true, new ScreenCenterPositioner()); } }); }
[ "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "{", "SwingUtilities", ".", "invokeLater", "(", "new", "Runnable", "(", ")", "{", "public", "void", "run", "(", ")", "{", "Utils4Swing", ".", "initSystemLookAndFeel", "(", ")", ";", "Utils4Swing", ".", "createShowAndPosition", "(", "\"Test Progress Dialog\"", ",", "new", "FileCopyProgressPanel", "(", ")", ",", "true", ",", "new", "ScreenCenterPositioner", "(", ")", ")", ";", "}", "}", ")", ";", "}" ]
Main method to test the panel. Only for testing purposes. @param args Not used.
[ "Main", "method", "to", "test", "the", "panel", ".", "Only", "for", "testing", "purposes", "." ]
560fb69eac182e3473de9679c3c15433e524ef6b
https://github.com/fuinorg/utils4swing/blob/560fb69eac182e3473de9679c3c15433e524ef6b/src/main/java/org/fuin/utils4swing/progress/FileCopyProgressPanel.java#L650-L658
152,662
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/ChangedByHandler.java
ChangedByHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { // Read a valid record if (this.getOwner() != null) { IntegerField thisField = ((IntegerField)this.getOwner().getRecord().getField(m_iMainFilesFieldSeq)); if (this.getOwner().getRecord().getRecordOwner() != null) if (this.getOwner().getRecord().getRecordOwner().getTask() != null) if (this.getOwner().getRecord().getRecordOwner().getTask().getApplication() != null) { int iUserID = -1; if (this.getOwner().getRecord().getRecordOwner() != null) if (((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()) != null) if (((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()).getUserID() != null) if (((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()).getUserID().length() > 0) iUserID = Integer.parseInt(((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()).getUserID()); // File written or updated, set the user name int iErrorCode = thisField.setValue(iUserID, bDisplayOption, DBConstants.SCREEN_MOVE); if (iMoveMode == DBConstants.INIT_MOVE) thisField.setModified(false); // Don't make this record modified just because I set this field. return iErrorCode; } } return DBConstants.ERROR_RETURN; // Can't set a field that is not long! }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { // Read a valid record if (this.getOwner() != null) { IntegerField thisField = ((IntegerField)this.getOwner().getRecord().getField(m_iMainFilesFieldSeq)); if (this.getOwner().getRecord().getRecordOwner() != null) if (this.getOwner().getRecord().getRecordOwner().getTask() != null) if (this.getOwner().getRecord().getRecordOwner().getTask().getApplication() != null) { int iUserID = -1; if (this.getOwner().getRecord().getRecordOwner() != null) if (((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()) != null) if (((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()).getUserID() != null) if (((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()).getUserID().length() > 0) iUserID = Integer.parseInt(((BaseApplication)this.getOwner().getRecord().getRecordOwner().getTask().getApplication()).getUserID()); // File written or updated, set the user name int iErrorCode = thisField.setValue(iUserID, bDisplayOption, DBConstants.SCREEN_MOVE); if (iMoveMode == DBConstants.INIT_MOVE) thisField.setModified(false); // Don't make this record modified just because I set this field. return iErrorCode; } } return DBConstants.ERROR_RETURN; // Can't set a field that is not long! }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "// Read a valid record", "if", "(", "this", ".", "getOwner", "(", ")", "!=", "null", ")", "{", "IntegerField", "thisField", "=", "(", "(", "IntegerField", ")", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getField", "(", "m_iMainFilesFieldSeq", ")", ")", ";", "if", "(", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", "!=", "null", ")", "{", "int", "iUserID", "=", "-", "1", ";", "if", "(", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", "!=", "null", ")", "if", "(", "(", "(", "BaseApplication", ")", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", "!=", "null", ")", "if", "(", "(", "(", "BaseApplication", ")", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getUserID", "(", ")", "!=", "null", ")", "if", "(", "(", "(", "BaseApplication", ")", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getUserID", "(", ")", ".", "length", "(", ")", ">", "0", ")", "iUserID", "=", "Integer", ".", "parseInt", "(", "(", "(", "BaseApplication", ")", "this", ".", "getOwner", "(", ")", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getUserID", "(", ")", ")", ";", "// File written or updated, set the user name", "int", "iErrorCode", "=", "thisField", ".", "setValue", "(", "iUserID", ",", "bDisplayOption", ",", "DBConstants", ".", "SCREEN_MOVE", ")", ";", "if", "(", "iMoveMode", "==", "DBConstants", ".", "INIT_MOVE", ")", "thisField", ".", "setModified", "(", "false", ")", ";", "// Don't make this record modified just because I set this field.", "return", "iErrorCode", ";", "}", "}", "return", "DBConstants", ".", "ERROR_RETURN", ";", "// Can't set a field that is not long!", "}" ]
The Field has Changed. Change the changed by user field. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "The", "Field", "has", "Changed", ".", "Change", "the", "changed", "by", "user", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/ChangedByHandler.java#L97-L119
152,663
tvesalainen/util
util/src/main/java/org/vesalainen/math/sliding/AbstractSliding.java
AbstractSliding.eliminate
protected void eliminate() { int count = end-begin; int mod = Math.floorMod(begin, size); while (count > 0 && isRemovable(mod)) { remove(mod); begin++; count--; mod = Math.floorMod(begin, size); } }
java
protected void eliminate() { int count = end-begin; int mod = Math.floorMod(begin, size); while (count > 0 && isRemovable(mod)) { remove(mod); begin++; count--; mod = Math.floorMod(begin, size); } }
[ "protected", "void", "eliminate", "(", ")", "{", "int", "count", "=", "end", "-", "begin", ";", "int", "mod", "=", "Math", ".", "floorMod", "(", "begin", ",", "size", ")", ";", "while", "(", "count", ">", "0", "&&", "isRemovable", "(", "mod", ")", ")", "{", "remove", "(", "mod", ")", ";", "begin", "++", ";", "count", "--", ";", "mod", "=", "Math", ".", "floorMod", "(", "begin", ",", "size", ")", ";", "}", "}" ]
Eliminate values that are no longer used in calculation
[ "Eliminate", "values", "that", "are", "no", "longer", "used", "in", "calculation" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/sliding/AbstractSliding.java#L129-L140
152,664
tvesalainen/util
util/src/main/java/org/vesalainen/math/sliding/AbstractSliding.java
AbstractSliding.newArray
protected Object newArray(Object old, int oldLen, Object arr) { int sb = Math.floorMod(begin, oldLen); int se = Math.floorMod(end, oldLen); if (sb < se) { System.arraycopy(old, sb, arr, sb, se - sb); } else { System.arraycopy(old, sb, arr, sb, oldLen - sb); System.arraycopy(old, 0, arr, 0, se); } return arr; }
java
protected Object newArray(Object old, int oldLen, Object arr) { int sb = Math.floorMod(begin, oldLen); int se = Math.floorMod(end, oldLen); if (sb < se) { System.arraycopy(old, sb, arr, sb, se - sb); } else { System.arraycopy(old, sb, arr, sb, oldLen - sb); System.arraycopy(old, 0, arr, 0, se); } return arr; }
[ "protected", "Object", "newArray", "(", "Object", "old", ",", "int", "oldLen", ",", "Object", "arr", ")", "{", "int", "sb", "=", "Math", ".", "floorMod", "(", "begin", ",", "oldLen", ")", ";", "int", "se", "=", "Math", ".", "floorMod", "(", "end", ",", "oldLen", ")", ";", "if", "(", "sb", "<", "se", ")", "{", "System", ".", "arraycopy", "(", "old", ",", "sb", ",", "arr", ",", "sb", ",", "se", "-", "sb", ")", ";", "}", "else", "{", "System", ".", "arraycopy", "(", "old", ",", "sb", ",", "arr", ",", "sb", ",", "oldLen", "-", "sb", ")", ";", "System", ".", "arraycopy", "(", "old", ",", "0", ",", "arr", ",", "0", ",", "se", ")", ";", "}", "return", "arr", ";", "}" ]
Returns new oldLen ring buffer @param old @param oldLen @param arr @return
[ "Returns", "new", "oldLen", "ring", "buffer" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/sliding/AbstractSliding.java#L163-L177
152,665
FrodeRanders/java-vopn
src/main/java/org/gautelis/vopn/db/utils/BatchReader.java
BatchReader.readFile
public List<String> readFile(Reader reader) throws Exception { try { if (characteristics.doIgnoreCase()) { if (characteristics.aloneOnLine()) { // Batch separator is located alone on a line // beginning at first position. Ignore case. // // Example with separator "GO": // // create index blipp ( blopp ) // go // // -or- // // CREATE INDEX blipp ( blopp ) // GO // return readFileIgnoreCaseAloneOnLine(reader); } else { // Batch separator may be located anywhere on a // line. Ignore case. // // Example with separator ";": // // CREATE INDEX blipp ( blopp ); // // Beware of case (separator "GO"): // // CREATE TABLE blipp ( // pogopop INTEGER // ) // // which will accept "go" in pogopop as separator. // // Since this is a "dangerous" case we do not support it! throw new Exception("Batch separator detection scheme not implemented"); } } else { if (characteristics.aloneOnLine()) { // Batch separator is located alone on a line // beginning at first position. Consider case. // // Example with separator "GO": // // CREATE INDEX blipp ( blopp ) // GO // // is handled while // // create index blipp ( blopp ) // go // // is not handled // return readFileConsiderCaseAloneOnLine(reader); } else { // Batch separator may be located anywhere on a // line. Consider case. // // Example with separator ";": // // CREATE INDEX blipp ( blopp ); // // If we follow our coding standards (keeping SQL uppercased // and identifiers/names lowercased) the following // is also handled correctly (separator "GO"): // // CREATE TABLE blipp ( // pogopop INTEGER // ) // GO // // which will -NOT- accidentaly accept "go" in pogopop as separator. // In the latter case it would be better still to use the alone-on-line // model. // return readFileConsiderCase(reader); } } } catch (Exception e) { throw new Exception("Failed to read file: " + e.getMessage()); } finally { if (options.debug) System.out.println("Done reading"); } }
java
public List<String> readFile(Reader reader) throws Exception { try { if (characteristics.doIgnoreCase()) { if (characteristics.aloneOnLine()) { // Batch separator is located alone on a line // beginning at first position. Ignore case. // // Example with separator "GO": // // create index blipp ( blopp ) // go // // -or- // // CREATE INDEX blipp ( blopp ) // GO // return readFileIgnoreCaseAloneOnLine(reader); } else { // Batch separator may be located anywhere on a // line. Ignore case. // // Example with separator ";": // // CREATE INDEX blipp ( blopp ); // // Beware of case (separator "GO"): // // CREATE TABLE blipp ( // pogopop INTEGER // ) // // which will accept "go" in pogopop as separator. // // Since this is a "dangerous" case we do not support it! throw new Exception("Batch separator detection scheme not implemented"); } } else { if (characteristics.aloneOnLine()) { // Batch separator is located alone on a line // beginning at first position. Consider case. // // Example with separator "GO": // // CREATE INDEX blipp ( blopp ) // GO // // is handled while // // create index blipp ( blopp ) // go // // is not handled // return readFileConsiderCaseAloneOnLine(reader); } else { // Batch separator may be located anywhere on a // line. Consider case. // // Example with separator ";": // // CREATE INDEX blipp ( blopp ); // // If we follow our coding standards (keeping SQL uppercased // and identifiers/names lowercased) the following // is also handled correctly (separator "GO"): // // CREATE TABLE blipp ( // pogopop INTEGER // ) // GO // // which will -NOT- accidentaly accept "go" in pogopop as separator. // In the latter case it would be better still to use the alone-on-line // model. // return readFileConsiderCase(reader); } } } catch (Exception e) { throw new Exception("Failed to read file: " + e.getMessage()); } finally { if (options.debug) System.out.println("Done reading"); } }
[ "public", "List", "<", "String", ">", "readFile", "(", "Reader", "reader", ")", "throws", "Exception", "{", "try", "{", "if", "(", "characteristics", ".", "doIgnoreCase", "(", ")", ")", "{", "if", "(", "characteristics", ".", "aloneOnLine", "(", ")", ")", "{", "// Batch separator is located alone on a line", "// beginning at first position. Ignore case.", "//", "// Example with separator \"GO\":", "//", "// create index blipp ( blopp )", "// go", "//", "// -or-", "//", "// CREATE INDEX blipp ( blopp )", "// GO", "//", "return", "readFileIgnoreCaseAloneOnLine", "(", "reader", ")", ";", "}", "else", "{", "// Batch separator may be located anywhere on a", "// line. Ignore case.", "//", "// Example with separator \";\":", "//", "// CREATE INDEX blipp ( blopp );", "//", "// Beware of case (separator \"GO\"):", "//", "// CREATE TABLE blipp (", "// pogopop INTEGER", "// )", "//", "// which will accept \"go\" in pogopop as separator.", "//", "// Since this is a \"dangerous\" case we do not support it!", "throw", "new", "Exception", "(", "\"Batch separator detection scheme not implemented\"", ")", ";", "}", "}", "else", "{", "if", "(", "characteristics", ".", "aloneOnLine", "(", ")", ")", "{", "// Batch separator is located alone on a line", "// beginning at first position. Consider case.", "//", "// Example with separator \"GO\":", "//", "// CREATE INDEX blipp ( blopp )", "// GO", "//", "// is handled while", "//", "// create index blipp ( blopp )", "// go", "//", "// is not handled", "//", "return", "readFileConsiderCaseAloneOnLine", "(", "reader", ")", ";", "}", "else", "{", "// Batch separator may be located anywhere on a", "// line. Consider case.", "//", "// Example with separator \";\":", "//", "// CREATE INDEX blipp ( blopp );", "//", "// If we follow our coding standards (keeping SQL uppercased", "// and identifiers/names lowercased) the following", "// is also handled correctly (separator \"GO\"):", "//", "// CREATE TABLE blipp (", "// pogopop INTEGER", "// )", "// GO", "//", "// which will -NOT- accidentaly accept \"go\" in pogopop as separator.", "// In the latter case it would be better still to use the alone-on-line", "// model.", "//", "return", "readFileConsiderCase", "(", "reader", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "Exception", "(", "\"Failed to read file: \"", "+", "e", ".", "getMessage", "(", ")", ")", ";", "}", "finally", "{", "if", "(", "options", ".", "debug", ")", "System", ".", "out", ".", "println", "(", "\"Done reading\"", ")", ";", "}", "}" ]
Reads an SQL-script and identifies individual statements. The batch separator handling is dependent on the database manager
[ "Reads", "an", "SQL", "-", "script", "and", "identifies", "individual", "statements", ".", "The", "batch", "separator", "handling", "is", "dependent", "on", "the", "database", "manager" ]
4c7b2f90201327af4eaa3cd46b3fee68f864e5cc
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/db/utils/BatchReader.java#L54-L139
152,666
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/util/ResourceTable.java
ResourceTable.syncRecords
public void syncRecords(Record recAlt, Record recMain) { boolean bFieldsInSync = true; // Copy the language-specific fields m_buffer = new VectorBuffer(null); for (int iIndex = 0; iIndex < recMain.getFieldCount(); iIndex++) { BaseField fieldAlt = recAlt.getField(iIndex); BaseField fieldMain = null; if (bFieldsInSync) fieldMain = recMain.getField(iIndex); if ((fieldMain == null) || (!fieldMain.getFieldName().equals(fieldAlt.getFieldName()))) { fieldMain = recMain.getField(fieldAlt.getFieldName()); bFieldsInSync = false; } if (fieldMain != null) if (fieldAlt != null) if (this.isLanguageOverride(fieldMain)) { // Move this field, but don't call doRecordChange (READ_MOVE) m_buffer.addNextField(fieldMain); // Save these to restore later if (!fieldAlt.isNull()) // Don't move a null { fieldMain.moveFieldToThis((BaseField)fieldAlt, DBConstants.DISPLAY, DBConstants.READ_MOVE); fieldMain.setModified(false); } } } }
java
public void syncRecords(Record recAlt, Record recMain) { boolean bFieldsInSync = true; // Copy the language-specific fields m_buffer = new VectorBuffer(null); for (int iIndex = 0; iIndex < recMain.getFieldCount(); iIndex++) { BaseField fieldAlt = recAlt.getField(iIndex); BaseField fieldMain = null; if (bFieldsInSync) fieldMain = recMain.getField(iIndex); if ((fieldMain == null) || (!fieldMain.getFieldName().equals(fieldAlt.getFieldName()))) { fieldMain = recMain.getField(fieldAlt.getFieldName()); bFieldsInSync = false; } if (fieldMain != null) if (fieldAlt != null) if (this.isLanguageOverride(fieldMain)) { // Move this field, but don't call doRecordChange (READ_MOVE) m_buffer.addNextField(fieldMain); // Save these to restore later if (!fieldAlt.isNull()) // Don't move a null { fieldMain.moveFieldToThis((BaseField)fieldAlt, DBConstants.DISPLAY, DBConstants.READ_MOVE); fieldMain.setModified(false); } } } }
[ "public", "void", "syncRecords", "(", "Record", "recAlt", ",", "Record", "recMain", ")", "{", "boolean", "bFieldsInSync", "=", "true", ";", "// Copy the language-specific fields", "m_buffer", "=", "new", "VectorBuffer", "(", "null", ")", ";", "for", "(", "int", "iIndex", "=", "0", ";", "iIndex", "<", "recMain", ".", "getFieldCount", "(", ")", ";", "iIndex", "++", ")", "{", "BaseField", "fieldAlt", "=", "recAlt", ".", "getField", "(", "iIndex", ")", ";", "BaseField", "fieldMain", "=", "null", ";", "if", "(", "bFieldsInSync", ")", "fieldMain", "=", "recMain", ".", "getField", "(", "iIndex", ")", ";", "if", "(", "(", "fieldMain", "==", "null", ")", "||", "(", "!", "fieldMain", ".", "getFieldName", "(", ")", ".", "equals", "(", "fieldAlt", ".", "getFieldName", "(", ")", ")", ")", ")", "{", "fieldMain", "=", "recMain", ".", "getField", "(", "fieldAlt", ".", "getFieldName", "(", ")", ")", ";", "bFieldsInSync", "=", "false", ";", "}", "if", "(", "fieldMain", "!=", "null", ")", "if", "(", "fieldAlt", "!=", "null", ")", "if", "(", "this", ".", "isLanguageOverride", "(", "fieldMain", ")", ")", "{", "// Move this field, but don't call doRecordChange (READ_MOVE)", "m_buffer", ".", "addNextField", "(", "fieldMain", ")", ";", "// Save these to restore later", "if", "(", "!", "fieldAlt", ".", "isNull", "(", ")", ")", "// Don't move a null", "{", "fieldMain", ".", "moveFieldToThis", "(", "(", "BaseField", ")", "fieldAlt", ",", "DBConstants", ".", "DISPLAY", ",", "DBConstants", ".", "READ_MOVE", ")", ";", "fieldMain", ".", "setModified", "(", "false", ")", ";", "}", "}", "}", "}" ]
Save the record state and copy the localized fields from the language record to the main record. @param tblTarget The table to read the same record from. @param recSource Source record @return The target table's record.
[ "Save", "the", "record", "state", "and", "copy", "the", "localized", "fields", "from", "the", "language", "record", "to", "the", "main", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/ResourceTable.java#L142-L169
152,667
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/util/ResourceTable.java
ResourceTable.restoreMainRecord
public void restoreMainRecord(Record record, boolean altMatchesToNull) { Iterator<BaseTable> iterator = this.getTables(); while (iterator.hasNext()) { BaseTable table = iterator.next(); if ((table != null) && (table != this.getNextTable())) { Record record2 = table.getRecord(); this.restoreMainRecord(record2, record, altMatchesToNull); } } }
java
public void restoreMainRecord(Record record, boolean altMatchesToNull) { Iterator<BaseTable> iterator = this.getTables(); while (iterator.hasNext()) { BaseTable table = iterator.next(); if ((table != null) && (table != this.getNextTable())) { Record record2 = table.getRecord(); this.restoreMainRecord(record2, record, altMatchesToNull); } } }
[ "public", "void", "restoreMainRecord", "(", "Record", "record", ",", "boolean", "altMatchesToNull", ")", "{", "Iterator", "<", "BaseTable", ">", "iterator", "=", "this", ".", "getTables", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "BaseTable", "table", "=", "iterator", ".", "next", "(", ")", ";", "if", "(", "(", "table", "!=", "null", ")", "&&", "(", "table", "!=", "this", ".", "getNextTable", "(", ")", ")", ")", "{", "Record", "record2", "=", "table", ".", "getRecord", "(", ")", ";", "this", ".", "restoreMainRecord", "(", "record2", ",", "record", ",", "altMatchesToNull", ")", ";", "}", "}", "}" ]
Restore the unchangeable info from the buffer to this main record. @param record The main record @param altMatchesToNull If the alternate field is the same as the main field, set it to null (no change).
[ "Restore", "the", "unchangeable", "info", "from", "the", "buffer", "to", "this", "main", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/ResourceTable.java#L175-L187
152,668
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/util/ResourceTable.java
ResourceTable.restoreMainRecord
public void restoreMainRecord(Record recAlt, Record recMain, boolean altMatchesToNull) { if (m_buffer != null) m_buffer.resetPosition(); boolean bFieldsInSync = true; for (int iIndex = 0; iIndex < recAlt.getFieldCount(); iIndex++) { BaseField fieldAlt = recAlt.getField(iIndex); BaseField fieldMain = null; if (bFieldsInSync) fieldMain = recMain.getField(iIndex); if ((fieldMain == null) || (!fieldMain.getFieldName().equals(fieldAlt.getFieldName()))) { fieldMain = recMain.getField(fieldAlt.getFieldName()); bFieldsInSync = false; } fieldAlt.moveFieldToThis((BaseField)fieldMain); // All values belong in the alt record. if (fieldMain != null) if (fieldAlt != null) if (this.isLanguageOverride(fieldMain)) { // Move this field, but don't call doRecordChange (READ_MOVE) if (m_buffer != null) m_buffer.getNextField(fieldMain, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE); // Get the original value back fieldMain.setModified(false); // No change from original //x if (fieldMain.isNull()) // If the value was null, set it to new (Why not?) //x fieldMain.moveFieldToThis((BaseField)fieldAlt); } if (altMatchesToNull) if (fieldMain.equals(fieldAlt)) if ((fieldAlt.isNullable()) && (fieldAlt != recAlt.getCounterField())) fieldAlt.setData(null); } }
java
public void restoreMainRecord(Record recAlt, Record recMain, boolean altMatchesToNull) { if (m_buffer != null) m_buffer.resetPosition(); boolean bFieldsInSync = true; for (int iIndex = 0; iIndex < recAlt.getFieldCount(); iIndex++) { BaseField fieldAlt = recAlt.getField(iIndex); BaseField fieldMain = null; if (bFieldsInSync) fieldMain = recMain.getField(iIndex); if ((fieldMain == null) || (!fieldMain.getFieldName().equals(fieldAlt.getFieldName()))) { fieldMain = recMain.getField(fieldAlt.getFieldName()); bFieldsInSync = false; } fieldAlt.moveFieldToThis((BaseField)fieldMain); // All values belong in the alt record. if (fieldMain != null) if (fieldAlt != null) if (this.isLanguageOverride(fieldMain)) { // Move this field, but don't call doRecordChange (READ_MOVE) if (m_buffer != null) m_buffer.getNextField(fieldMain, DBConstants.DONT_DISPLAY, DBConstants.READ_MOVE); // Get the original value back fieldMain.setModified(false); // No change from original //x if (fieldMain.isNull()) // If the value was null, set it to new (Why not?) //x fieldMain.moveFieldToThis((BaseField)fieldAlt); } if (altMatchesToNull) if (fieldMain.equals(fieldAlt)) if ((fieldAlt.isNullable()) && (fieldAlt != recAlt.getCounterField())) fieldAlt.setData(null); } }
[ "public", "void", "restoreMainRecord", "(", "Record", "recAlt", ",", "Record", "recMain", ",", "boolean", "altMatchesToNull", ")", "{", "if", "(", "m_buffer", "!=", "null", ")", "m_buffer", ".", "resetPosition", "(", ")", ";", "boolean", "bFieldsInSync", "=", "true", ";", "for", "(", "int", "iIndex", "=", "0", ";", "iIndex", "<", "recAlt", ".", "getFieldCount", "(", ")", ";", "iIndex", "++", ")", "{", "BaseField", "fieldAlt", "=", "recAlt", ".", "getField", "(", "iIndex", ")", ";", "BaseField", "fieldMain", "=", "null", ";", "if", "(", "bFieldsInSync", ")", "fieldMain", "=", "recMain", ".", "getField", "(", "iIndex", ")", ";", "if", "(", "(", "fieldMain", "==", "null", ")", "||", "(", "!", "fieldMain", ".", "getFieldName", "(", ")", ".", "equals", "(", "fieldAlt", ".", "getFieldName", "(", ")", ")", ")", ")", "{", "fieldMain", "=", "recMain", ".", "getField", "(", "fieldAlt", ".", "getFieldName", "(", ")", ")", ";", "bFieldsInSync", "=", "false", ";", "}", "fieldAlt", ".", "moveFieldToThis", "(", "(", "BaseField", ")", "fieldMain", ")", ";", "// All values belong in the alt record.", "if", "(", "fieldMain", "!=", "null", ")", "if", "(", "fieldAlt", "!=", "null", ")", "if", "(", "this", ".", "isLanguageOverride", "(", "fieldMain", ")", ")", "{", "// Move this field, but don't call doRecordChange (READ_MOVE)", "if", "(", "m_buffer", "!=", "null", ")", "m_buffer", ".", "getNextField", "(", "fieldMain", ",", "DBConstants", ".", "DONT_DISPLAY", ",", "DBConstants", ".", "READ_MOVE", ")", ";", "// Get the original value back", "fieldMain", ".", "setModified", "(", "false", ")", ";", "// No change from original", "//x if (fieldMain.isNull()) // If the value was null, set it to new (Why not?)", "//x fieldMain.moveFieldToThis((BaseField)fieldAlt);", "}", "if", "(", "altMatchesToNull", ")", "if", "(", "fieldMain", ".", "equals", "(", "fieldAlt", ")", ")", "if", "(", "(", "fieldAlt", ".", "isNullable", "(", ")", ")", "&&", "(", "fieldAlt", "!=", "recAlt", ".", "getCounterField", "(", ")", ")", ")", "fieldAlt", ".", "setData", "(", "null", ")", ";", "}", "}" ]
Restore the main record's string fields to their original state from the buffer. @param recAlt The alternate record @param altMatchesToNull If the alternate field is the same as the main field, set it to null (no change). @param record The main record
[ "Restore", "the", "main", "record", "s", "string", "fields", "to", "their", "original", "state", "from", "the", "buffer", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/util/ResourceTable.java#L194-L225
152,669
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.moveFieldToThis
public int moveFieldToThis(BaseField field, boolean bDisplayOption, int iMoveMode) { // Save the record and datarecord. if (field == null) return DBConstants.NORMAL_RETURN; if (field instanceof CounterField) { if (this.getReferenceRecord(null, false) == null) if (field.getRecord().getListener(ClearFieldReferenceOnCloseHandler.class) == null) // While it is okay to have two fields reference on record, don't default it. this.setReferenceRecord(field.getRecord()); } else if (field instanceof ReferenceField) { //x no this.setReferenceRecord(((ReferenceField)field).getReferenceRecord()); } else this.setReferenceRecord(null); return super.moveFieldToThis(field, bDisplayOption, iMoveMode); }
java
public int moveFieldToThis(BaseField field, boolean bDisplayOption, int iMoveMode) { // Save the record and datarecord. if (field == null) return DBConstants.NORMAL_RETURN; if (field instanceof CounterField) { if (this.getReferenceRecord(null, false) == null) if (field.getRecord().getListener(ClearFieldReferenceOnCloseHandler.class) == null) // While it is okay to have two fields reference on record, don't default it. this.setReferenceRecord(field.getRecord()); } else if (field instanceof ReferenceField) { //x no this.setReferenceRecord(((ReferenceField)field).getReferenceRecord()); } else this.setReferenceRecord(null); return super.moveFieldToThis(field, bDisplayOption, iMoveMode); }
[ "public", "int", "moveFieldToThis", "(", "BaseField", "field", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "// Save the record and datarecord.", "if", "(", "field", "==", "null", ")", "return", "DBConstants", ".", "NORMAL_RETURN", ";", "if", "(", "field", "instanceof", "CounterField", ")", "{", "if", "(", "this", ".", "getReferenceRecord", "(", "null", ",", "false", ")", "==", "null", ")", "if", "(", "field", ".", "getRecord", "(", ")", ".", "getListener", "(", "ClearFieldReferenceOnCloseHandler", ".", "class", ")", "==", "null", ")", "// While it is okay to have two fields reference on record, don't default it.", "this", ".", "setReferenceRecord", "(", "field", ".", "getRecord", "(", ")", ")", ";", "}", "else", "if", "(", "field", "instanceof", "ReferenceField", ")", "{", "//x no this.setReferenceRecord(((ReferenceField)field).getReferenceRecord());", "}", "else", "this", ".", "setReferenceRecord", "(", "null", ")", ";", "return", "super", ".", "moveFieldToThis", "(", "field", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "}" ]
Move data to this field from another field. If these isn't a reference record yet, figures out the reference record. @param field The source field. @return The error code (or NORMAL_RETURN).
[ "Move", "data", "to", "this", "field", "from", "another", "field", ".", "If", "these", "isn", "t", "a", "reference", "record", "yet", "figures", "out", "the", "reference", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L83-L100
152,670
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.getReference
public Record getReference() { Record record = this.getReferenceRecord(); if (record != null) { try { if (this.getData() == null) { record.addNew(); return record; } Object bookmark = this.getData(); if ((record.getEditMode() == Constants.EDIT_IN_PROGRESS) || (record.getEditMode() == Constants.EDIT_CURRENT)) { Object oldBookmark = record.getHandle(DBConstants.BOOKMARK_HANDLE); if ((bookmark != null) && (bookmark.equals(oldBookmark))) return record; // This record is already current } record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); } catch (DBException ex) { ex.printStackTrace(); record = null; } } return record; }
java
public Record getReference() { Record record = this.getReferenceRecord(); if (record != null) { try { if (this.getData() == null) { record.addNew(); return record; } Object bookmark = this.getData(); if ((record.getEditMode() == Constants.EDIT_IN_PROGRESS) || (record.getEditMode() == Constants.EDIT_CURRENT)) { Object oldBookmark = record.getHandle(DBConstants.BOOKMARK_HANDLE); if ((bookmark != null) && (bookmark.equals(oldBookmark))) return record; // This record is already current } record.setHandle(bookmark, DBConstants.BOOKMARK_HANDLE); } catch (DBException ex) { ex.printStackTrace(); record = null; } } return record; }
[ "public", "Record", "getReference", "(", ")", "{", "Record", "record", "=", "this", ".", "getReferenceRecord", "(", ")", ";", "if", "(", "record", "!=", "null", ")", "{", "try", "{", "if", "(", "this", ".", "getData", "(", ")", "==", "null", ")", "{", "record", ".", "addNew", "(", ")", ";", "return", "record", ";", "}", "Object", "bookmark", "=", "this", ".", "getData", "(", ")", ";", "if", "(", "(", "record", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_IN_PROGRESS", ")", "||", "(", "record", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_CURRENT", ")", ")", "{", "Object", "oldBookmark", "=", "record", ".", "getHandle", "(", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ";", "if", "(", "(", "bookmark", "!=", "null", ")", "&&", "(", "bookmark", ".", "equals", "(", "oldBookmark", ")", ")", ")", "return", "record", ";", "// This record is already current", "}", "record", ".", "setHandle", "(", "bookmark", ",", "DBConstants", ".", "BOOKMARK_HANDLE", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "record", "=", "null", ";", "}", "}", "return", "record", ";", "}" ]
Get the record that this field references and make it current. @return tour.db.Record Record pointing to the current data.
[ "Get", "the", "record", "that", "this", "field", "references", "and", "make", "it", "current", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L105-L131
152,671
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.getReferenceRecordName
public String getReferenceRecordName() { if (m_recordReference != null) return this.getReferenceRecord().getTableNames(false); else { // This code just takes a guess if (this.getClass().getName().indexOf("Field") != -1) return this.getClass().getName().substring(Math.max(0, this.getClass().getName().lastIndexOf('.') + 1), this.getClass().getName().indexOf("Field")); else if (this.getFieldName(false, false).indexOf("ID") != -1) return this.getFieldName(false, false).substring(0, this.getFieldName(false, false).indexOf("ID")); else this.getFieldName(false, false); } return Constants.BLANK; // Never }
java
public String getReferenceRecordName() { if (m_recordReference != null) return this.getReferenceRecord().getTableNames(false); else { // This code just takes a guess if (this.getClass().getName().indexOf("Field") != -1) return this.getClass().getName().substring(Math.max(0, this.getClass().getName().lastIndexOf('.') + 1), this.getClass().getName().indexOf("Field")); else if (this.getFieldName(false, false).indexOf("ID") != -1) return this.getFieldName(false, false).substring(0, this.getFieldName(false, false).indexOf("ID")); else this.getFieldName(false, false); } return Constants.BLANK; // Never }
[ "public", "String", "getReferenceRecordName", "(", ")", "{", "if", "(", "m_recordReference", "!=", "null", ")", "return", "this", ".", "getReferenceRecord", "(", ")", ".", "getTableNames", "(", "false", ")", ";", "else", "{", "// This code just takes a guess", "if", "(", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "indexOf", "(", "\"Field\"", ")", "!=", "-", "1", ")", "return", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "substring", "(", "Math", ".", "max", "(", "0", ",", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "lastIndexOf", "(", "'", "'", ")", "+", "1", ")", ",", "this", ".", "getClass", "(", ")", ".", "getName", "(", ")", ".", "indexOf", "(", "\"Field\"", ")", ")", ";", "else", "if", "(", "this", ".", "getFieldName", "(", "false", ",", "false", ")", ".", "indexOf", "(", "\"ID\"", ")", "!=", "-", "1", ")", "return", "this", ".", "getFieldName", "(", "false", ",", "false", ")", ".", "substring", "(", "0", ",", "this", ".", "getFieldName", "(", "false", ",", "false", ")", ".", "indexOf", "(", "\"ID\"", ")", ")", ";", "else", "this", ".", "getFieldName", "(", "false", ",", "false", ")", ";", "}", "return", "Constants", ".", "BLANK", ";", "// Never", "}" ]
Get the record name that this field references. @return String Name of the record.
[ "Get", "the", "record", "name", "that", "this", "field", "references", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L136-L150
152,672
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.setReference
public int setReference(Record record, boolean bDisplayOption, int iMoveMode) { return this.moveFieldToThis((BaseField)record.getCounterField(), bDisplayOption, iMoveMode); }
java
public int setReference(Record record, boolean bDisplayOption, int iMoveMode) { return this.moveFieldToThis((BaseField)record.getCounterField(), bDisplayOption, iMoveMode); }
[ "public", "int", "setReference", "(", "Record", "record", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "return", "this", ".", "moveFieldToThis", "(", "(", "BaseField", ")", "record", ".", "getCounterField", "(", ")", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "}" ]
Make this field a reference to the current object in this record info class. @param record tour.db.Record The current record to set this field to reference. @param bDisplayOption If true, display changes. @param iMoveMode The move mode. @return The error code (or NORMAL_RETURN).
[ "Make", "this", "field", "a", "reference", "to", "the", "current", "object", "in", "this", "record", "info", "class", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L167-L170
152,673
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.syncReference
public void syncReference(Record record) { this.setReferenceRecord(record); BaseField recordKeyField = (BaseField)record.getCounterField(); if ((recordKeyField.isNull()) && (!this.isNull()) && (!record.isModified()) && (record.getEditMode() != DBConstants.EDIT_CURRENT) && (record.getEditMode() != DBConstants.EDIT_IN_PROGRESS) && ((record.getOpenMode() & DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY) == 0)) { recordKeyField.moveFieldToThis(this, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Start with this field's value if you arn't going to mess up the record recordKeyField.setModified(false); } else this.setReference(record, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // If the screen field is changed, make sure the passed in header record's key field is changed to match. MoveOnChangeHandler listener = (MoveOnChangeHandler)this.getListener(MoveOnChangeHandler.class.getName()); if ((listener == null) || (listener.getDestField() != recordKeyField)) this.addListener(new MoveOnChangeHandler(recordKeyField, null)); // If the record is externally selected, sync the record's key with the screenfield MoveOnValidHandler listener2 = (MoveOnValidHandler)record.getListener(MoveOnValidHandler.class.getName()); if ((listener2 == null) || (listener2.getSourceField() != recordKeyField)) record.addListener(new MoveOnValidHandler(this, recordKeyField)); MainReadOnlyHandler listener3 = (MainReadOnlyHandler)recordKeyField.getListener(MainReadOnlyHandler.class.getName()); if (listener3 == null) recordKeyField.addListener(new MainReadOnlyHandler(null)); }
java
public void syncReference(Record record) { this.setReferenceRecord(record); BaseField recordKeyField = (BaseField)record.getCounterField(); if ((recordKeyField.isNull()) && (!this.isNull()) && (!record.isModified()) && (record.getEditMode() != DBConstants.EDIT_CURRENT) && (record.getEditMode() != DBConstants.EDIT_IN_PROGRESS) && ((record.getOpenMode() & DBConstants.OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY) == 0)) { recordKeyField.moveFieldToThis(this, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // Start with this field's value if you arn't going to mess up the record recordKeyField.setModified(false); } else this.setReference(record, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // If the screen field is changed, make sure the passed in header record's key field is changed to match. MoveOnChangeHandler listener = (MoveOnChangeHandler)this.getListener(MoveOnChangeHandler.class.getName()); if ((listener == null) || (listener.getDestField() != recordKeyField)) this.addListener(new MoveOnChangeHandler(recordKeyField, null)); // If the record is externally selected, sync the record's key with the screenfield MoveOnValidHandler listener2 = (MoveOnValidHandler)record.getListener(MoveOnValidHandler.class.getName()); if ((listener2 == null) || (listener2.getSourceField() != recordKeyField)) record.addListener(new MoveOnValidHandler(this, recordKeyField)); MainReadOnlyHandler listener3 = (MainReadOnlyHandler)recordKeyField.getListener(MainReadOnlyHandler.class.getName()); if (listener3 == null) recordKeyField.addListener(new MainReadOnlyHandler(null)); }
[ "public", "void", "syncReference", "(", "Record", "record", ")", "{", "this", ".", "setReferenceRecord", "(", "record", ")", ";", "BaseField", "recordKeyField", "=", "(", "BaseField", ")", "record", ".", "getCounterField", "(", ")", ";", "if", "(", "(", "recordKeyField", ".", "isNull", "(", ")", ")", "&&", "(", "!", "this", ".", "isNull", "(", ")", ")", "&&", "(", "!", "record", ".", "isModified", "(", ")", ")", "&&", "(", "record", ".", "getEditMode", "(", ")", "!=", "DBConstants", ".", "EDIT_CURRENT", ")", "&&", "(", "record", ".", "getEditMode", "(", ")", "!=", "DBConstants", ".", "EDIT_IN_PROGRESS", ")", "&&", "(", "(", "record", ".", "getOpenMode", "(", ")", "&", "DBConstants", ".", "OPEN_REFRESH_AND_LOCK_ON_CHANGE_STRATEGY", ")", "==", "0", ")", ")", "{", "recordKeyField", ".", "moveFieldToThis", "(", "this", ",", "DBConstants", ".", "DISPLAY", ",", "DBConstants", ".", "SCREEN_MOVE", ")", ";", "// Start with this field's value if you arn't going to mess up the record", "recordKeyField", ".", "setModified", "(", "false", ")", ";", "}", "else", "this", ".", "setReference", "(", "record", ",", "DBConstants", ".", "DISPLAY", ",", "DBConstants", ".", "SCREEN_MOVE", ")", ";", "// If the screen field is changed, make sure the passed in header record's key field is changed to match.", "MoveOnChangeHandler", "listener", "=", "(", "MoveOnChangeHandler", ")", "this", ".", "getListener", "(", "MoveOnChangeHandler", ".", "class", ".", "getName", "(", ")", ")", ";", "if", "(", "(", "listener", "==", "null", ")", "||", "(", "listener", ".", "getDestField", "(", ")", "!=", "recordKeyField", ")", ")", "this", ".", "addListener", "(", "new", "MoveOnChangeHandler", "(", "recordKeyField", ",", "null", ")", ")", ";", "// If the record is externally selected, sync the record's key with the screenfield", "MoveOnValidHandler", "listener2", "=", "(", "MoveOnValidHandler", ")", "record", ".", "getListener", "(", "MoveOnValidHandler", ".", "class", ".", "getName", "(", ")", ")", ";", "if", "(", "(", "listener2", "==", "null", ")", "||", "(", "listener2", ".", "getSourceField", "(", ")", "!=", "recordKeyField", ")", ")", "record", ".", "addListener", "(", "new", "MoveOnValidHandler", "(", "this", ",", "recordKeyField", ")", ")", ";", "MainReadOnlyHandler", "listener3", "=", "(", "MainReadOnlyHandler", ")", "recordKeyField", ".", "getListener", "(", "MainReadOnlyHandler", ".", "class", ".", "getName", "(", ")", ")", ";", "if", "(", "listener3", "==", "null", ")", "recordKeyField", ".", "addListener", "(", "new", "MainReadOnlyHandler", "(", "null", ")", ")", ";", "}" ]
Synchronize this refernce field with this record. Adds the behaviors to sync this field and the record. Used for popup screenfields where the referencerecord has a detail to display on change. @param record The reference record to synchronize.
[ "Synchronize", "this", "refernce", "field", "with", "this", "record", ".", "Adds", "the", "behaviors", "to", "sync", "this", "field", "and", "the", "record", ".", "Used", "for", "popup", "screenfields", "where", "the", "referencerecord", "has", "a", "detail", "to", "display", "on", "change", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L214-L242
152,674
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.setupIconView
public ScreenComponent setupIconView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, boolean bIncludeBlankOption) { ScreenComponent screenField = null; Record record = this.makeReferenceRecord(); // Set up the listener to read the current record on a valid main record ImageField fldDisplayFieldDesc = this.getIconField(record); if (fldDisplayFieldDesc.getListener(BlankButtonHandler.class) == null) fldDisplayFieldDesc.addListener(new BlankButtonHandler(null)); if (fldDisplayFieldDesc != null) { // The next two lines are so in GridScreen(s), the converter leads to this field, while it displays the fielddesc. FieldConverter fldDescConverter = new FieldDescConverter(fldDisplayFieldDesc, (Converter)converter); Map<String,Object> properties = new HashMap<String,Object>(); properties.put(ScreenModel.IMAGE, ScreenModel.NONE); properties.put(ScreenModel.NEVER_DISABLE, Constants.TRUE); screenField = createScreenComponent(ScreenModel.BUTTON_BOX, itsLocation, targetScreen, fldDescConverter, iDisplayFieldDesc, properties); //?{ //? public void setEnabled(boolean bEnabled) //? { //? super.setEnabled(true); // Never disable //? } //?}; String strDisplay = converter.getFieldDesc(); if (!(targetScreen instanceof GridScreenParent)) if ((strDisplay != null) && (strDisplay.length() > 0)) { // Since display string does not come with buttons ScreenLoc descLocation = targetScreen.getNextLocation(ScreenConstants.FIELD_DESC, ScreenConstants.DONT_SET_ANCHOR); properties = new HashMap<String,Object>(); properties.put(ScreenModel.DISPLAY_STRING, strDisplay); createScreenComponent(ScreenModel.STATIC_STRING, descLocation, targetScreen, converter, iDisplayFieldDesc, properties); } } if (((targetScreen instanceof GridScreenParent)) || (iDisplayFieldDesc == ScreenConstants.DONT_DISPLAY_FIELD_DESC)) { // If there is no popupbox to display the icon, I must explicitly read it. this.addListener(new ReadSecondaryHandler(fldDisplayFieldDesc.getRecord())); } return screenField; }
java
public ScreenComponent setupIconView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, boolean bIncludeBlankOption) { ScreenComponent screenField = null; Record record = this.makeReferenceRecord(); // Set up the listener to read the current record on a valid main record ImageField fldDisplayFieldDesc = this.getIconField(record); if (fldDisplayFieldDesc.getListener(BlankButtonHandler.class) == null) fldDisplayFieldDesc.addListener(new BlankButtonHandler(null)); if (fldDisplayFieldDesc != null) { // The next two lines are so in GridScreen(s), the converter leads to this field, while it displays the fielddesc. FieldConverter fldDescConverter = new FieldDescConverter(fldDisplayFieldDesc, (Converter)converter); Map<String,Object> properties = new HashMap<String,Object>(); properties.put(ScreenModel.IMAGE, ScreenModel.NONE); properties.put(ScreenModel.NEVER_DISABLE, Constants.TRUE); screenField = createScreenComponent(ScreenModel.BUTTON_BOX, itsLocation, targetScreen, fldDescConverter, iDisplayFieldDesc, properties); //?{ //? public void setEnabled(boolean bEnabled) //? { //? super.setEnabled(true); // Never disable //? } //?}; String strDisplay = converter.getFieldDesc(); if (!(targetScreen instanceof GridScreenParent)) if ((strDisplay != null) && (strDisplay.length() > 0)) { // Since display string does not come with buttons ScreenLoc descLocation = targetScreen.getNextLocation(ScreenConstants.FIELD_DESC, ScreenConstants.DONT_SET_ANCHOR); properties = new HashMap<String,Object>(); properties.put(ScreenModel.DISPLAY_STRING, strDisplay); createScreenComponent(ScreenModel.STATIC_STRING, descLocation, targetScreen, converter, iDisplayFieldDesc, properties); } } if (((targetScreen instanceof GridScreenParent)) || (iDisplayFieldDesc == ScreenConstants.DONT_DISPLAY_FIELD_DESC)) { // If there is no popupbox to display the icon, I must explicitly read it. this.addListener(new ReadSecondaryHandler(fldDisplayFieldDesc.getRecord())); } return screenField; }
[ "public", "ScreenComponent", "setupIconView", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "Convert", "converter", ",", "int", "iDisplayFieldDesc", ",", "boolean", "bIncludeBlankOption", ")", "{", "ScreenComponent", "screenField", "=", "null", ";", "Record", "record", "=", "this", ".", "makeReferenceRecord", "(", ")", ";", "// Set up the listener to read the current record on a valid main record", "ImageField", "fldDisplayFieldDesc", "=", "this", ".", "getIconField", "(", "record", ")", ";", "if", "(", "fldDisplayFieldDesc", ".", "getListener", "(", "BlankButtonHandler", ".", "class", ")", "==", "null", ")", "fldDisplayFieldDesc", ".", "addListener", "(", "new", "BlankButtonHandler", "(", "null", ")", ")", ";", "if", "(", "fldDisplayFieldDesc", "!=", "null", ")", "{", "// The next two lines are so in GridScreen(s), the converter leads to this field, while it displays the fielddesc.", "FieldConverter", "fldDescConverter", "=", "new", "FieldDescConverter", "(", "fldDisplayFieldDesc", ",", "(", "Converter", ")", "converter", ")", ";", "Map", "<", "String", ",", "Object", ">", "properties", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "properties", ".", "put", "(", "ScreenModel", ".", "IMAGE", ",", "ScreenModel", ".", "NONE", ")", ";", "properties", ".", "put", "(", "ScreenModel", ".", "NEVER_DISABLE", ",", "Constants", ".", "TRUE", ")", ";", "screenField", "=", "createScreenComponent", "(", "ScreenModel", ".", "BUTTON_BOX", ",", "itsLocation", ",", "targetScreen", ",", "fldDescConverter", ",", "iDisplayFieldDesc", ",", "properties", ")", ";", "//?{", "//? public void setEnabled(boolean bEnabled)", "//? {", "//? super.setEnabled(true); // Never disable", "//? }", "//?};", "String", "strDisplay", "=", "converter", ".", "getFieldDesc", "(", ")", ";", "if", "(", "!", "(", "targetScreen", "instanceof", "GridScreenParent", ")", ")", "if", "(", "(", "strDisplay", "!=", "null", ")", "&&", "(", "strDisplay", ".", "length", "(", ")", ">", "0", ")", ")", "{", "// Since display string does not come with buttons", "ScreenLoc", "descLocation", "=", "targetScreen", ".", "getNextLocation", "(", "ScreenConstants", ".", "FIELD_DESC", ",", "ScreenConstants", ".", "DONT_SET_ANCHOR", ")", ";", "properties", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "properties", ".", "put", "(", "ScreenModel", ".", "DISPLAY_STRING", ",", "strDisplay", ")", ";", "createScreenComponent", "(", "ScreenModel", ".", "STATIC_STRING", ",", "descLocation", ",", "targetScreen", ",", "converter", ",", "iDisplayFieldDesc", ",", "properties", ")", ";", "}", "}", "if", "(", "(", "(", "targetScreen", "instanceof", "GridScreenParent", ")", ")", "||", "(", "iDisplayFieldDesc", "==", "ScreenConstants", ".", "DONT_DISPLAY_FIELD_DESC", ")", ")", "{", "// If there is no popupbox to display the icon, I must explicitly read it.", "this", ".", "addListener", "(", "new", "ReadSecondaryHandler", "(", "fldDisplayFieldDesc", ".", "getRecord", "(", ")", ")", ")", ";", "}", "return", "screenField", ";", "}" ]
Display a button that shows the icon from the current record in the secondary file.
[ "Display", "a", "button", "that", "shows", "the", "icon", "from", "the", "current", "record", "in", "the", "secondary", "file", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L305-L343
152,675
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.getIconField
public ImageField getIconField(Record record) { if (record == null) record = this.getReferenceRecord(); for (int i = 0; i < record.getFieldCount(); i++) { BaseField field = record.getField(i); if (field instanceof ImageField) return (ImageField)field; } return null; // No icon in this status record }
java
public ImageField getIconField(Record record) { if (record == null) record = this.getReferenceRecord(); for (int i = 0; i < record.getFieldCount(); i++) { BaseField field = record.getField(i); if (field instanceof ImageField) return (ImageField)field; } return null; // No icon in this status record }
[ "public", "ImageField", "getIconField", "(", "Record", "record", ")", "{", "if", "(", "record", "==", "null", ")", "record", "=", "this", ".", "getReferenceRecord", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "record", ".", "getFieldCount", "(", ")", ";", "i", "++", ")", "{", "BaseField", "field", "=", "record", ".", "getField", "(", "i", ")", ";", "if", "(", "field", "instanceof", "ImageField", ")", "return", "(", "ImageField", ")", "field", ";", "}", "return", "null", ";", "// No icon in this status record", "}" ]
Get the IconField from this record.
[ "Get", "the", "IconField", "from", "this", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L347-L358
152,676
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/ReferenceField.java
ReferenceField.setupPopupView
public ScreenComponent setupPopupView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, boolean bIncludeBlankOption) { ScreenComponent screenField = null; Record record = this.makeReferenceRecord(); // Set up the listener to read the current record on a valid main record screenField = this.setupIconView(itsLocation, targetScreen, converter, iDisplayFieldDesc, bIncludeBlankOption); if ((!(targetScreen instanceof GridScreenParent)) && (iDisplayFieldDesc != ScreenConstants.DONT_DISPLAY_FIELD_DESC)) { // If it is not in a grid screen, add the description if (screenField != null) { itsLocation = targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR); iDisplayFieldDesc = ScreenConstants.DONT_DISPLAY_FIELD_DESC; } screenField = this.setupTablePopup(itsLocation, targetScreen, converter, iDisplayFieldDesc, record, -1, -1, bIncludeBlankOption, false); } return screenField; }
java
public ScreenComponent setupPopupView(ScreenLoc itsLocation, ComponentParent targetScreen, Convert converter, int iDisplayFieldDesc, boolean bIncludeBlankOption) { ScreenComponent screenField = null; Record record = this.makeReferenceRecord(); // Set up the listener to read the current record on a valid main record screenField = this.setupIconView(itsLocation, targetScreen, converter, iDisplayFieldDesc, bIncludeBlankOption); if ((!(targetScreen instanceof GridScreenParent)) && (iDisplayFieldDesc != ScreenConstants.DONT_DISPLAY_FIELD_DESC)) { // If it is not in a grid screen, add the description if (screenField != null) { itsLocation = targetScreen.getNextLocation(ScreenConstants.RIGHT_OF_LAST, ScreenConstants.DONT_SET_ANCHOR); iDisplayFieldDesc = ScreenConstants.DONT_DISPLAY_FIELD_DESC; } screenField = this.setupTablePopup(itsLocation, targetScreen, converter, iDisplayFieldDesc, record, -1, -1, bIncludeBlankOption, false); } return screenField; }
[ "public", "ScreenComponent", "setupPopupView", "(", "ScreenLoc", "itsLocation", ",", "ComponentParent", "targetScreen", ",", "Convert", "converter", ",", "int", "iDisplayFieldDesc", ",", "boolean", "bIncludeBlankOption", ")", "{", "ScreenComponent", "screenField", "=", "null", ";", "Record", "record", "=", "this", ".", "makeReferenceRecord", "(", ")", ";", "// Set up the listener to read the current record on a valid main record", "screenField", "=", "this", ".", "setupIconView", "(", "itsLocation", ",", "targetScreen", ",", "converter", ",", "iDisplayFieldDesc", ",", "bIncludeBlankOption", ")", ";", "if", "(", "(", "!", "(", "targetScreen", "instanceof", "GridScreenParent", ")", ")", "&&", "(", "iDisplayFieldDesc", "!=", "ScreenConstants", ".", "DONT_DISPLAY_FIELD_DESC", ")", ")", "{", "// If it is not in a grid screen, add the description", "if", "(", "screenField", "!=", "null", ")", "{", "itsLocation", "=", "targetScreen", ".", "getNextLocation", "(", "ScreenConstants", ".", "RIGHT_OF_LAST", ",", "ScreenConstants", ".", "DONT_SET_ANCHOR", ")", ";", "iDisplayFieldDesc", "=", "ScreenConstants", ".", "DONT_DISPLAY_FIELD_DESC", ";", "}", "screenField", "=", "this", ".", "setupTablePopup", "(", "itsLocation", ",", "targetScreen", ",", "converter", ",", "iDisplayFieldDesc", ",", "record", ",", "-", "1", ",", "-", "1", ",", "bIncludeBlankOption", ",", "false", ")", ";", "}", "return", "screenField", ";", "}" ]
Add icon to popup.
[ "Add", "icon", "to", "popup", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/ReferenceField.java#L362-L380
152,677
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyDirectory
public static boolean copyDirectory(final File source, final File destination) throws FileIsSecurityRestrictedException, IOException, FileIsADirectoryException, FileIsNotADirectoryException, DirectoryAlreadyExistsException { return copyDirectory(source, destination, true); }
java
public static boolean copyDirectory(final File source, final File destination) throws FileIsSecurityRestrictedException, IOException, FileIsADirectoryException, FileIsNotADirectoryException, DirectoryAlreadyExistsException { return copyDirectory(source, destination, true); }
[ "public", "static", "boolean", "copyDirectory", "(", "final", "File", "source", ",", "final", "File", "destination", ")", "throws", "FileIsSecurityRestrictedException", ",", "IOException", ",", "FileIsADirectoryException", ",", "FileIsNotADirectoryException", ",", "DirectoryAlreadyExistsException", "{", "return", "copyDirectory", "(", "source", ",", "destination", ",", "true", ")", ";", "}" ]
Copies the given source directory to the given destination directory. @param source The source directory. @param destination The destination directory. @return 's true if the directory is copied, otherwise false. @throws FileIsSecurityRestrictedException Is thrown if the source file is security restricted. @throws IOException Is thrown if an error occurs by reading or writing. @throws FileIsADirectoryException Is thrown if the destination file is a directory. @throws FileIsNotADirectoryException Is thrown if the source file is not a directory. @throws DirectoryAlreadyExistsException Is thrown if the directory all ready exists.
[ "Copies", "the", "given", "source", "directory", "to", "the", "given", "destination", "directory", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L80-L85
152,678
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyDirectory
public static boolean copyDirectory(final File source, final File destination, final boolean lastModified) throws FileIsSecurityRestrictedException, IOException, FileIsADirectoryException, FileIsNotADirectoryException, DirectoryAlreadyExistsException { return copyDirectoryWithFileFilter(source, destination, null, lastModified); }
java
public static boolean copyDirectory(final File source, final File destination, final boolean lastModified) throws FileIsSecurityRestrictedException, IOException, FileIsADirectoryException, FileIsNotADirectoryException, DirectoryAlreadyExistsException { return copyDirectoryWithFileFilter(source, destination, null, lastModified); }
[ "public", "static", "boolean", "copyDirectory", "(", "final", "File", "source", ",", "final", "File", "destination", ",", "final", "boolean", "lastModified", ")", "throws", "FileIsSecurityRestrictedException", ",", "IOException", ",", "FileIsADirectoryException", ",", "FileIsNotADirectoryException", ",", "DirectoryAlreadyExistsException", "{", "return", "copyDirectoryWithFileFilter", "(", "source", ",", "destination", ",", "null", ",", "lastModified", ")", ";", "}" ]
Copies the given source directory to the given destination directory with the option to set the lastModified time from the given destination file or directory. @param source The source directory. @param destination The destination directory. @param lastModified Flag the tells if the attribute lastModified has to be set with the attribute from the destination file. @return 's true if the directory is copied, otherwise false. @throws FileIsSecurityRestrictedException Is thrown if the source file is security restricted. @throws IOException Is thrown if an error occurs by reading or writing. @throws FileIsADirectoryException Is thrown if the destination file is a directory. @throws FileIsNotADirectoryException Is thrown if the source file is not a directory. @throws DirectoryAlreadyExistsException Is thrown if the directory all ready exists.
[ "Copies", "the", "given", "source", "directory", "to", "the", "given", "destination", "directory", "with", "the", "option", "to", "set", "the", "lastModified", "time", "from", "the", "given", "destination", "file", "or", "directory", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L112-L117
152,679
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyDirectoryWithFileFilter
public static boolean copyDirectoryWithFileFilter(final File source, final File destination, final FileFilter fileFilter, final boolean lastModified) throws IOException, FileIsNotADirectoryException, FileIsADirectoryException, FileIsSecurityRestrictedException, DirectoryAlreadyExistsException { return copyDirectoryWithFileFilter(source, destination, fileFilter, null, lastModified); }
java
public static boolean copyDirectoryWithFileFilter(final File source, final File destination, final FileFilter fileFilter, final boolean lastModified) throws IOException, FileIsNotADirectoryException, FileIsADirectoryException, FileIsSecurityRestrictedException, DirectoryAlreadyExistsException { return copyDirectoryWithFileFilter(source, destination, fileFilter, null, lastModified); }
[ "public", "static", "boolean", "copyDirectoryWithFileFilter", "(", "final", "File", "source", ",", "final", "File", "destination", ",", "final", "FileFilter", "fileFilter", ",", "final", "boolean", "lastModified", ")", "throws", "IOException", ",", "FileIsNotADirectoryException", ",", "FileIsADirectoryException", ",", "FileIsSecurityRestrictedException", ",", "DirectoryAlreadyExistsException", "{", "return", "copyDirectoryWithFileFilter", "(", "source", ",", "destination", ",", "fileFilter", ",", "null", ",", "lastModified", ")", ";", "}" ]
Copies all files that match to the FileFilter from the given source directory to the given destination directory with the option to set the lastModified time from the given destination file or directory. @param source The source directory. @param destination The destination directory. @param fileFilter The FileFilter for the files to be copied. If null all files will be copied. @param lastModified Flag the tells if the attribute lastModified has to be set with the attribute from the destination file. @return 's true if the directory is copied, otherwise false. @throws IOException Is thrown if an error occurs by reading or writing. @throws FileIsNotADirectoryException Is thrown if the source file is not a directory. @throws FileIsADirectoryException Is thrown if the destination file is a directory. @throws FileIsSecurityRestrictedException Is thrown if the source file is security restricted. @throws DirectoryAlreadyExistsException Is thrown if the directory all ready exists.
[ "Copies", "all", "files", "that", "match", "to", "the", "FileFilter", "from", "the", "given", "source", "directory", "to", "the", "given", "destination", "directory", "with", "the", "option", "to", "set", "the", "lastModified", "time", "from", "the", "given", "destination", "file", "or", "directory", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L145-L151
152,680
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyDirectoryWithFileFilter
public static boolean copyDirectoryWithFileFilter(final File source, final File destination, final FileFilter includeFileFilter, final FileFilter excludeFileFilter, final Collection<File> excludeFiles, final boolean lastModified) throws IOException, FileIsNotADirectoryException, FileIsADirectoryException, FileIsSecurityRestrictedException, DirectoryAlreadyExistsException { if (!source.isDirectory()) { throw new FileIsNotADirectoryException( "Source file '" + source.getAbsolutePath() + "' is not a directory."); } if (!destination.exists()) { CreateFileExtensions.newDirectory(destination); } boolean copied = false; File[] includeFilesArray; if (null != includeFileFilter) { includeFilesArray = source.listFiles(includeFileFilter); } else { includeFilesArray = source.listFiles(); } if (null != includeFilesArray) { File[] excludeFilesArray; List<File> allExcludeFilesList = null; List<File> excludeFileFilterList; if (null != excludeFileFilter) { excludeFilesArray = source.listFiles(excludeFileFilter); excludeFileFilterList = Arrays.asList(excludeFilesArray); allExcludeFilesList = new ArrayList<>(excludeFileFilterList); } if (excludeFiles != null && !excludeFiles.isEmpty()) { if (allExcludeFilesList != null) { allExcludeFilesList.addAll(excludeFiles); } else { allExcludeFilesList = new ArrayList<>(excludeFiles); } } // if excludeFilesList is not null and not empty if (null != allExcludeFilesList && !allExcludeFilesList.isEmpty()) { for (final File element : includeFilesArray) { final File currentFile = element; // if the excludeFilesList does not contain the current file do copy... if (!allExcludeFilesList.contains(currentFile)) { final File copy = new File(destination, currentFile.getName()); if (currentFile.isDirectory()) { // copy directory recursive... copied = copyDirectoryWithFileFilter(currentFile, copy, includeFileFilter, excludeFileFilter, lastModified); } else { copied = copyFile(currentFile, copy, lastModified); } } // otherwise do not copy the current file... } } else { // otherwise copy all files and directories for (final File currentFile : includeFilesArray) { final File copy = new File(destination, currentFile.getName()); if (currentFile.isDirectory()) { // copy directory recursive... copied = copyDirectoryWithFileFilter(currentFile, copy, includeFileFilter, excludeFileFilter, lastModified); } else { copied = copyFile(currentFile, copy, lastModified); } } } } else { throw new FileIsSecurityRestrictedException( "File '" + source.getAbsolutePath() + "' is security restricted."); } return copied; }
java
public static boolean copyDirectoryWithFileFilter(final File source, final File destination, final FileFilter includeFileFilter, final FileFilter excludeFileFilter, final Collection<File> excludeFiles, final boolean lastModified) throws IOException, FileIsNotADirectoryException, FileIsADirectoryException, FileIsSecurityRestrictedException, DirectoryAlreadyExistsException { if (!source.isDirectory()) { throw new FileIsNotADirectoryException( "Source file '" + source.getAbsolutePath() + "' is not a directory."); } if (!destination.exists()) { CreateFileExtensions.newDirectory(destination); } boolean copied = false; File[] includeFilesArray; if (null != includeFileFilter) { includeFilesArray = source.listFiles(includeFileFilter); } else { includeFilesArray = source.listFiles(); } if (null != includeFilesArray) { File[] excludeFilesArray; List<File> allExcludeFilesList = null; List<File> excludeFileFilterList; if (null != excludeFileFilter) { excludeFilesArray = source.listFiles(excludeFileFilter); excludeFileFilterList = Arrays.asList(excludeFilesArray); allExcludeFilesList = new ArrayList<>(excludeFileFilterList); } if (excludeFiles != null && !excludeFiles.isEmpty()) { if (allExcludeFilesList != null) { allExcludeFilesList.addAll(excludeFiles); } else { allExcludeFilesList = new ArrayList<>(excludeFiles); } } // if excludeFilesList is not null and not empty if (null != allExcludeFilesList && !allExcludeFilesList.isEmpty()) { for (final File element : includeFilesArray) { final File currentFile = element; // if the excludeFilesList does not contain the current file do copy... if (!allExcludeFilesList.contains(currentFile)) { final File copy = new File(destination, currentFile.getName()); if (currentFile.isDirectory()) { // copy directory recursive... copied = copyDirectoryWithFileFilter(currentFile, copy, includeFileFilter, excludeFileFilter, lastModified); } else { copied = copyFile(currentFile, copy, lastModified); } } // otherwise do not copy the current file... } } else { // otherwise copy all files and directories for (final File currentFile : includeFilesArray) { final File copy = new File(destination, currentFile.getName()); if (currentFile.isDirectory()) { // copy directory recursive... copied = copyDirectoryWithFileFilter(currentFile, copy, includeFileFilter, excludeFileFilter, lastModified); } else { copied = copyFile(currentFile, copy, lastModified); } } } } else { throw new FileIsSecurityRestrictedException( "File '" + source.getAbsolutePath() + "' is security restricted."); } return copied; }
[ "public", "static", "boolean", "copyDirectoryWithFileFilter", "(", "final", "File", "source", ",", "final", "File", "destination", ",", "final", "FileFilter", "includeFileFilter", ",", "final", "FileFilter", "excludeFileFilter", ",", "final", "Collection", "<", "File", ">", "excludeFiles", ",", "final", "boolean", "lastModified", ")", "throws", "IOException", ",", "FileIsNotADirectoryException", ",", "FileIsADirectoryException", ",", "FileIsSecurityRestrictedException", ",", "DirectoryAlreadyExistsException", "{", "if", "(", "!", "source", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "FileIsNotADirectoryException", "(", "\"Source file '\"", "+", "source", ".", "getAbsolutePath", "(", ")", "+", "\"' is not a directory.\"", ")", ";", "}", "if", "(", "!", "destination", ".", "exists", "(", ")", ")", "{", "CreateFileExtensions", ".", "newDirectory", "(", "destination", ")", ";", "}", "boolean", "copied", "=", "false", ";", "File", "[", "]", "includeFilesArray", ";", "if", "(", "null", "!=", "includeFileFilter", ")", "{", "includeFilesArray", "=", "source", ".", "listFiles", "(", "includeFileFilter", ")", ";", "}", "else", "{", "includeFilesArray", "=", "source", ".", "listFiles", "(", ")", ";", "}", "if", "(", "null", "!=", "includeFilesArray", ")", "{", "File", "[", "]", "excludeFilesArray", ";", "List", "<", "File", ">", "allExcludeFilesList", "=", "null", ";", "List", "<", "File", ">", "excludeFileFilterList", ";", "if", "(", "null", "!=", "excludeFileFilter", ")", "{", "excludeFilesArray", "=", "source", ".", "listFiles", "(", "excludeFileFilter", ")", ";", "excludeFileFilterList", "=", "Arrays", ".", "asList", "(", "excludeFilesArray", ")", ";", "allExcludeFilesList", "=", "new", "ArrayList", "<>", "(", "excludeFileFilterList", ")", ";", "}", "if", "(", "excludeFiles", "!=", "null", "&&", "!", "excludeFiles", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "allExcludeFilesList", "!=", "null", ")", "{", "allExcludeFilesList", ".", "addAll", "(", "excludeFiles", ")", ";", "}", "else", "{", "allExcludeFilesList", "=", "new", "ArrayList", "<>", "(", "excludeFiles", ")", ";", "}", "}", "// if excludeFilesList is not null and not empty", "if", "(", "null", "!=", "allExcludeFilesList", "&&", "!", "allExcludeFilesList", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "final", "File", "element", ":", "includeFilesArray", ")", "{", "final", "File", "currentFile", "=", "element", ";", "// if the excludeFilesList does not contain the current file do copy...", "if", "(", "!", "allExcludeFilesList", ".", "contains", "(", "currentFile", ")", ")", "{", "final", "File", "copy", "=", "new", "File", "(", "destination", ",", "currentFile", ".", "getName", "(", ")", ")", ";", "if", "(", "currentFile", ".", "isDirectory", "(", ")", ")", "{", "// copy directory recursive...", "copied", "=", "copyDirectoryWithFileFilter", "(", "currentFile", ",", "copy", ",", "includeFileFilter", ",", "excludeFileFilter", ",", "lastModified", ")", ";", "}", "else", "{", "copied", "=", "copyFile", "(", "currentFile", ",", "copy", ",", "lastModified", ")", ";", "}", "}", "// otherwise do not copy the current file...", "}", "}", "else", "{", "// otherwise copy all files and directories", "for", "(", "final", "File", "currentFile", ":", "includeFilesArray", ")", "{", "final", "File", "copy", "=", "new", "File", "(", "destination", ",", "currentFile", ".", "getName", "(", ")", ")", ";", "if", "(", "currentFile", ".", "isDirectory", "(", ")", ")", "{", "// copy directory recursive...", "copied", "=", "copyDirectoryWithFileFilter", "(", "currentFile", ",", "copy", ",", "includeFileFilter", ",", "excludeFileFilter", ",", "lastModified", ")", ";", "}", "else", "{", "copied", "=", "copyFile", "(", "currentFile", ",", "copy", ",", "lastModified", ")", ";", "}", "}", "}", "}", "else", "{", "throw", "new", "FileIsSecurityRestrictedException", "(", "\"File '\"", "+", "source", ".", "getAbsolutePath", "(", ")", "+", "\"' is security restricted.\"", ")", ";", "}", "return", "copied", ";", "}" ]
Copies all files that match to the given includeFileFilter and does not copy all the files that match the excludeFileFilter from the given source directory to the given destination directory with the option to set the lastModified time from the given destination file or directory. @param source The source directory. @param destination The destination directory. @param includeFileFilter The FileFilter for the files to be copied. If null all files will be copied. @param excludeFileFilter The FileFilter for the files to be not copied. If null no files will be excluded by copy process. @param excludeFiles A list of files that should be not copied. If null no files will be excluded by copy process. @param lastModified Flag the tells if the attribute lastModified has to be set with the attribute from the destination file. @return 's true if the directory is copied, otherwise false. @throws IOException Is thrown if an error occurs by reading or writing. @throws FileIsNotADirectoryException Is thrown if the source file is not a directory. @throws FileIsADirectoryException Is thrown if the source or destination file is a directory. @throws FileIsSecurityRestrictedException Is thrown if the source file is security restricted. @throws DirectoryAlreadyExistsException Is thrown if the directory all ready exists.
[ "Copies", "all", "files", "that", "match", "to", "the", "given", "includeFileFilter", "and", "does", "not", "copy", "all", "the", "files", "that", "match", "the", "excludeFileFilter", "from", "the", "given", "source", "directory", "to", "the", "given", "destination", "directory", "with", "the", "option", "to", "set", "the", "lastModified", "time", "from", "the", "given", "destination", "file", "or", "directory", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L226-L322
152,681
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyDirectoryWithFilenameFilter
public static boolean copyDirectoryWithFilenameFilter(final File source, final File destination, final FilenameFilter filenameFilter, final boolean lastModified) throws IOException, FileIsNotADirectoryException, FileIsADirectoryException, FileIsSecurityRestrictedException, DirectoryAlreadyExistsException { return copyDirectoryWithFilenameFilter(source, destination, filenameFilter, null, lastModified); }
java
public static boolean copyDirectoryWithFilenameFilter(final File source, final File destination, final FilenameFilter filenameFilter, final boolean lastModified) throws IOException, FileIsNotADirectoryException, FileIsADirectoryException, FileIsSecurityRestrictedException, DirectoryAlreadyExistsException { return copyDirectoryWithFilenameFilter(source, destination, filenameFilter, null, lastModified); }
[ "public", "static", "boolean", "copyDirectoryWithFilenameFilter", "(", "final", "File", "source", ",", "final", "File", "destination", ",", "final", "FilenameFilter", "filenameFilter", ",", "final", "boolean", "lastModified", ")", "throws", "IOException", ",", "FileIsNotADirectoryException", ",", "FileIsADirectoryException", ",", "FileIsSecurityRestrictedException", ",", "DirectoryAlreadyExistsException", "{", "return", "copyDirectoryWithFilenameFilter", "(", "source", ",", "destination", ",", "filenameFilter", ",", "null", ",", "lastModified", ")", ";", "}" ]
Copies all files that match to the FilenameFilter from the given source directory to the given destination directory with the option to set the lastModified time from the given destination file or directory. @param source The source directory. @param destination The destination directory. @param filenameFilter The FilenameFilter for the files to be copied. If null all files will be copied. @param lastModified Flag the tells if the attribute lastModified has to be set with the attribute from the destination file. @return 's true if the directory is copied, otherwise false. @throws IOException Is thrown if an error occurs by reading or writing. @throws FileIsNotADirectoryException Is thrown if the source file is not a directory. @throws FileIsADirectoryException Is thrown if the destination file is a directory. @throws FileIsSecurityRestrictedException Is thrown if the source file is security restricted. @throws DirectoryAlreadyExistsException Is thrown if the directory all ready exists.
[ "Copies", "all", "files", "that", "match", "to", "the", "FilenameFilter", "from", "the", "given", "source", "directory", "to", "the", "given", "destination", "directory", "with", "the", "option", "to", "set", "the", "lastModified", "time", "from", "the", "given", "destination", "file", "or", "directory", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L350-L357
152,682
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyDirectoryWithFilenameFilter
public static boolean copyDirectoryWithFilenameFilter(final File source, final File destination, final FilenameFilter includeFilenameFilter, final FilenameFilter excludeFilenameFilter, final boolean lastModified) throws IOException, FileIsNotADirectoryException, FileIsADirectoryException, FileIsSecurityRestrictedException { if (!source.isDirectory()) { throw new FileIsNotADirectoryException( "Source file '" + source.getAbsolutePath() + "' is not a directory."); } if (!destination.exists()) { CreateFileExtensions.newDirectory(destination); } boolean copied = false; File[] includeFilesArray; if (null != includeFilenameFilter) { includeFilesArray = source.listFiles(includeFilenameFilter); } else { includeFilesArray = source.listFiles(); } if (null != includeFilesArray) { File[] excludeFilesArray; List<File> excludeFilesList = null; if (null != excludeFilenameFilter) { excludeFilesArray = source.listFiles(excludeFilenameFilter); excludeFilesList = Arrays.asList(excludeFilesArray); } // if excludeFilesList is not null and not empty if (null != excludeFilesList && !excludeFilesList.isEmpty()) { for (final File element : includeFilesArray) { final File currentFile = element; // if the excludeFilesList does not contain the current file do copy... if (!excludeFilesList.contains(currentFile)) { final File copy = new File(destination, currentFile.getName()); if (currentFile.isDirectory()) { // copy directory recursive... copied = copyDirectoryWithFilenameFilter(currentFile, copy, includeFilenameFilter, excludeFilenameFilter, lastModified); } else { copied = copyFile(currentFile, copy, lastModified); } } // otherwise do not copy the current file... } } else { for (final File currentFile : includeFilesArray) { final File copy = new File(destination, currentFile.getName()); if (currentFile.isDirectory()) { // copy directory recursive... copied = copyDirectoryWithFilenameFilter(currentFile, copy, includeFilenameFilter, excludeFilenameFilter, lastModified); } else { copied = copyFile(currentFile, copy, lastModified); } } } } else { throw new FileIsSecurityRestrictedException( "File '" + source.getAbsolutePath() + "' is security restricted."); } return copied; }
java
public static boolean copyDirectoryWithFilenameFilter(final File source, final File destination, final FilenameFilter includeFilenameFilter, final FilenameFilter excludeFilenameFilter, final boolean lastModified) throws IOException, FileIsNotADirectoryException, FileIsADirectoryException, FileIsSecurityRestrictedException { if (!source.isDirectory()) { throw new FileIsNotADirectoryException( "Source file '" + source.getAbsolutePath() + "' is not a directory."); } if (!destination.exists()) { CreateFileExtensions.newDirectory(destination); } boolean copied = false; File[] includeFilesArray; if (null != includeFilenameFilter) { includeFilesArray = source.listFiles(includeFilenameFilter); } else { includeFilesArray = source.listFiles(); } if (null != includeFilesArray) { File[] excludeFilesArray; List<File> excludeFilesList = null; if (null != excludeFilenameFilter) { excludeFilesArray = source.listFiles(excludeFilenameFilter); excludeFilesList = Arrays.asList(excludeFilesArray); } // if excludeFilesList is not null and not empty if (null != excludeFilesList && !excludeFilesList.isEmpty()) { for (final File element : includeFilesArray) { final File currentFile = element; // if the excludeFilesList does not contain the current file do copy... if (!excludeFilesList.contains(currentFile)) { final File copy = new File(destination, currentFile.getName()); if (currentFile.isDirectory()) { // copy directory recursive... copied = copyDirectoryWithFilenameFilter(currentFile, copy, includeFilenameFilter, excludeFilenameFilter, lastModified); } else { copied = copyFile(currentFile, copy, lastModified); } } // otherwise do not copy the current file... } } else { for (final File currentFile : includeFilesArray) { final File copy = new File(destination, currentFile.getName()); if (currentFile.isDirectory()) { // copy directory recursive... copied = copyDirectoryWithFilenameFilter(currentFile, copy, includeFilenameFilter, excludeFilenameFilter, lastModified); } else { copied = copyFile(currentFile, copy, lastModified); } } } } else { throw new FileIsSecurityRestrictedException( "File '" + source.getAbsolutePath() + "' is security restricted."); } return copied; }
[ "public", "static", "boolean", "copyDirectoryWithFilenameFilter", "(", "final", "File", "source", ",", "final", "File", "destination", ",", "final", "FilenameFilter", "includeFilenameFilter", ",", "final", "FilenameFilter", "excludeFilenameFilter", ",", "final", "boolean", "lastModified", ")", "throws", "IOException", ",", "FileIsNotADirectoryException", ",", "FileIsADirectoryException", ",", "FileIsSecurityRestrictedException", "{", "if", "(", "!", "source", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "FileIsNotADirectoryException", "(", "\"Source file '\"", "+", "source", ".", "getAbsolutePath", "(", ")", "+", "\"' is not a directory.\"", ")", ";", "}", "if", "(", "!", "destination", ".", "exists", "(", ")", ")", "{", "CreateFileExtensions", ".", "newDirectory", "(", "destination", ")", ";", "}", "boolean", "copied", "=", "false", ";", "File", "[", "]", "includeFilesArray", ";", "if", "(", "null", "!=", "includeFilenameFilter", ")", "{", "includeFilesArray", "=", "source", ".", "listFiles", "(", "includeFilenameFilter", ")", ";", "}", "else", "{", "includeFilesArray", "=", "source", ".", "listFiles", "(", ")", ";", "}", "if", "(", "null", "!=", "includeFilesArray", ")", "{", "File", "[", "]", "excludeFilesArray", ";", "List", "<", "File", ">", "excludeFilesList", "=", "null", ";", "if", "(", "null", "!=", "excludeFilenameFilter", ")", "{", "excludeFilesArray", "=", "source", ".", "listFiles", "(", "excludeFilenameFilter", ")", ";", "excludeFilesList", "=", "Arrays", ".", "asList", "(", "excludeFilesArray", ")", ";", "}", "// if excludeFilesList is not null and not empty", "if", "(", "null", "!=", "excludeFilesList", "&&", "!", "excludeFilesList", ".", "isEmpty", "(", ")", ")", "{", "for", "(", "final", "File", "element", ":", "includeFilesArray", ")", "{", "final", "File", "currentFile", "=", "element", ";", "// if the excludeFilesList does not contain the current file do copy...", "if", "(", "!", "excludeFilesList", ".", "contains", "(", "currentFile", ")", ")", "{", "final", "File", "copy", "=", "new", "File", "(", "destination", ",", "currentFile", ".", "getName", "(", ")", ")", ";", "if", "(", "currentFile", ".", "isDirectory", "(", ")", ")", "{", "// copy directory recursive...", "copied", "=", "copyDirectoryWithFilenameFilter", "(", "currentFile", ",", "copy", ",", "includeFilenameFilter", ",", "excludeFilenameFilter", ",", "lastModified", ")", ";", "}", "else", "{", "copied", "=", "copyFile", "(", "currentFile", ",", "copy", ",", "lastModified", ")", ";", "}", "}", "// otherwise do not copy the current file...", "}", "}", "else", "{", "for", "(", "final", "File", "currentFile", ":", "includeFilesArray", ")", "{", "final", "File", "copy", "=", "new", "File", "(", "destination", ",", "currentFile", ".", "getName", "(", ")", ")", ";", "if", "(", "currentFile", ".", "isDirectory", "(", ")", ")", "{", "// copy directory recursive...", "copied", "=", "copyDirectoryWithFilenameFilter", "(", "currentFile", ",", "copy", ",", "includeFilenameFilter", ",", "excludeFilenameFilter", ",", "lastModified", ")", ";", "}", "else", "{", "copied", "=", "copyFile", "(", "currentFile", ",", "copy", ",", "lastModified", ")", ";", "}", "}", "}", "}", "else", "{", "throw", "new", "FileIsSecurityRestrictedException", "(", "\"File '\"", "+", "source", ".", "getAbsolutePath", "(", ")", "+", "\"' is security restricted.\"", ")", ";", "}", "return", "copied", ";", "}" ]
Copies all files that match to the given includeFilenameFilter and does not copy all the files that match the excludeFilenameFilter from the given source directory to the given destination directory with the option to set the lastModified time from the given destination file or directory. @param source The source directory. @param destination The destination directory. @param includeFilenameFilter The FilenameFilter for the files to be copied. If null all files will be copied. @param excludeFilenameFilter The FilenameFilter for the files to be not copied. If null no files will be excluded by copy process. @param lastModified Flag the tells if the attribute lastModified has to be set with the attribute from the destination file. @return 's true if the directory is copied, otherwise false. @throws IOException Is thrown if an error occurs by reading or writing. @throws FileIsNotADirectoryException Is thrown if the source file is not a directory. @throws FileIsADirectoryException Is thrown if the destination file is a directory. @throws FileIsSecurityRestrictedException Is thrown if the source file is security restricted.
[ "Copies", "all", "files", "that", "match", "to", "the", "given", "includeFilenameFilter", "and", "does", "not", "copy", "all", "the", "files", "that", "match", "the", "excludeFilenameFilter", "from", "the", "given", "source", "directory", "to", "the", "given", "destination", "directory", "with", "the", "option", "to", "set", "the", "lastModified", "time", "from", "the", "given", "destination", "file", "or", "directory", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L387-L467
152,683
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyFile
public static boolean copyFile(final File source, final File destination) throws IOException, FileIsADirectoryException { return copyFile(source, destination, true); }
java
public static boolean copyFile(final File source, final File destination) throws IOException, FileIsADirectoryException { return copyFile(source, destination, true); }
[ "public", "static", "boolean", "copyFile", "(", "final", "File", "source", ",", "final", "File", "destination", ")", "throws", "IOException", ",", "FileIsADirectoryException", "{", "return", "copyFile", "(", "source", ",", "destination", ",", "true", ")", ";", "}" ]
Copies the given source file to the given destination file. @param source The source file. @param destination The destination file. @return 's true if the file is copied, otherwise false. @throws IOException Is thrown if an error occurs by reading or writing. @throws FileIsADirectoryException Is thrown if the destination file is a directory.
[ "Copies", "the", "given", "source", "file", "to", "the", "given", "destination", "file", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L484-L488
152,684
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyFile
public static boolean copyFile(final File source, final File destination, final boolean lastModified) throws IOException { return copyFile(source, destination, null, null, lastModified); }
java
public static boolean copyFile(final File source, final File destination, final boolean lastModified) throws IOException { return copyFile(source, destination, null, null, lastModified); }
[ "public", "static", "boolean", "copyFile", "(", "final", "File", "source", ",", "final", "File", "destination", ",", "final", "boolean", "lastModified", ")", "throws", "IOException", "{", "return", "copyFile", "(", "source", ",", "destination", ",", "null", ",", "null", ",", "lastModified", ")", ";", "}" ]
Copies the given source file to the given destination file with the option to set the lastModified time from the given destination file. @param source The source file. @param destination The destination file. @param lastModified Flag the tells if the attribute lastModified has to be set with the attribute from the destination file. @return 's true if the file is copied, otherwise false. @throws IOException Is thrown if an error occurs by reading or writing.
[ "Copies", "the", "given", "source", "file", "to", "the", "given", "destination", "file", "with", "the", "option", "to", "set", "the", "lastModified", "time", "from", "the", "given", "destination", "file", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L507-L511
152,685
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyFile
public static boolean copyFile(final File source, final File destination, final Charset sourceEncoding, final Charset destinationEncoding, final boolean lastModified) throws IOException { if (source.isDirectory()) { throw new IllegalArgumentException("The source File " + destination.getName() + " should be a File but is a Directory."); } if (destination.isDirectory()) { throw new IllegalArgumentException("The destination File " + destination.getName() + " should be a File but is a Directory."); } boolean copied = false; try (InputStream inputStream = StreamExtensions.getInputStream(source); InputStreamReader reader = sourceEncoding != null ? new InputStreamReader(inputStream, sourceEncoding) : new InputStreamReader(inputStream); OutputStream outputStream = StreamExtensions.getOutputStream(destination, !destination.exists()); BufferedOutputStream bos = new BufferedOutputStream(outputStream); OutputStreamWriter writer = destinationEncoding != null ? new OutputStreamWriter(bos, destinationEncoding) : new OutputStreamWriter(bos)) { int tmp; final char[] charArray = new char[FileConst.BLOCKSIZE]; while ((tmp = reader.read(charArray)) > 0) { writer.write(charArray, 0, tmp); } copied = true; } catch (final IOException e) { throw e; } if (lastModified) { destination.setLastModified(source.lastModified()); } return copied; }
java
public static boolean copyFile(final File source, final File destination, final Charset sourceEncoding, final Charset destinationEncoding, final boolean lastModified) throws IOException { if (source.isDirectory()) { throw new IllegalArgumentException("The source File " + destination.getName() + " should be a File but is a Directory."); } if (destination.isDirectory()) { throw new IllegalArgumentException("The destination File " + destination.getName() + " should be a File but is a Directory."); } boolean copied = false; try (InputStream inputStream = StreamExtensions.getInputStream(source); InputStreamReader reader = sourceEncoding != null ? new InputStreamReader(inputStream, sourceEncoding) : new InputStreamReader(inputStream); OutputStream outputStream = StreamExtensions.getOutputStream(destination, !destination.exists()); BufferedOutputStream bos = new BufferedOutputStream(outputStream); OutputStreamWriter writer = destinationEncoding != null ? new OutputStreamWriter(bos, destinationEncoding) : new OutputStreamWriter(bos)) { int tmp; final char[] charArray = new char[FileConst.BLOCKSIZE]; while ((tmp = reader.read(charArray)) > 0) { writer.write(charArray, 0, tmp); } copied = true; } catch (final IOException e) { throw e; } if (lastModified) { destination.setLastModified(source.lastModified()); } return copied; }
[ "public", "static", "boolean", "copyFile", "(", "final", "File", "source", ",", "final", "File", "destination", ",", "final", "Charset", "sourceEncoding", ",", "final", "Charset", "destinationEncoding", ",", "final", "boolean", "lastModified", ")", "throws", "IOException", "{", "if", "(", "source", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The source File \"", "+", "destination", ".", "getName", "(", ")", "+", "\" should be a File but is a Directory.\"", ")", ";", "}", "if", "(", "destination", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"The destination File \"", "+", "destination", ".", "getName", "(", ")", "+", "\" should be a File but is a Directory.\"", ")", ";", "}", "boolean", "copied", "=", "false", ";", "try", "(", "InputStream", "inputStream", "=", "StreamExtensions", ".", "getInputStream", "(", "source", ")", ";", "InputStreamReader", "reader", "=", "sourceEncoding", "!=", "null", "?", "new", "InputStreamReader", "(", "inputStream", ",", "sourceEncoding", ")", ":", "new", "InputStreamReader", "(", "inputStream", ")", ";", "OutputStream", "outputStream", "=", "StreamExtensions", ".", "getOutputStream", "(", "destination", ",", "!", "destination", ".", "exists", "(", ")", ")", ";", "BufferedOutputStream", "bos", "=", "new", "BufferedOutputStream", "(", "outputStream", ")", ";", "OutputStreamWriter", "writer", "=", "destinationEncoding", "!=", "null", "?", "new", "OutputStreamWriter", "(", "bos", ",", "destinationEncoding", ")", ":", "new", "OutputStreamWriter", "(", "bos", ")", ")", "{", "int", "tmp", ";", "final", "char", "[", "]", "charArray", "=", "new", "char", "[", "FileConst", ".", "BLOCKSIZE", "]", ";", "while", "(", "(", "tmp", "=", "reader", ".", "read", "(", "charArray", ")", ")", ">", "0", ")", "{", "writer", ".", "write", "(", "charArray", ",", "0", ",", "tmp", ")", ";", "}", "copied", "=", "true", ";", "}", "catch", "(", "final", "IOException", "e", ")", "{", "throw", "e", ";", "}", "if", "(", "lastModified", ")", "{", "destination", ".", "setLastModified", "(", "source", ".", "lastModified", "(", ")", ")", ";", "}", "return", "copied", ";", "}" ]
Copies the given source file to the given destination file with the given source encodings and destination encodings. @param source the source @param destination the destination @param sourceEncoding the source encoding @param destinationEncoding the destination encoding @param lastModified if true the last modified flag is set. @return true if the given file is copied otherwise false. @throws IOException Signals that an I/O exception has occurred.
[ "Copies", "the", "given", "source", "file", "to", "the", "given", "destination", "file", "with", "the", "given", "source", "encodings", "and", "destination", "encodings", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L531-L574
152,686
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyFileToDirectory
public static boolean copyFileToDirectory(final File source, final File destinationDir) throws FileIsNotADirectoryException, IOException, FileIsADirectoryException { return copyFileToDirectory(source, destinationDir, true); }
java
public static boolean copyFileToDirectory(final File source, final File destinationDir) throws FileIsNotADirectoryException, IOException, FileIsADirectoryException { return copyFileToDirectory(source, destinationDir, true); }
[ "public", "static", "boolean", "copyFileToDirectory", "(", "final", "File", "source", ",", "final", "File", "destinationDir", ")", "throws", "FileIsNotADirectoryException", ",", "IOException", ",", "FileIsADirectoryException", "{", "return", "copyFileToDirectory", "(", "source", ",", "destinationDir", ",", "true", ")", ";", "}" ]
Copies the given source file to the given destination directory. @param source The source file to copy in the destination directory. @param destinationDir The destination directory. @return 's true if the file is copied to the destination directory, otherwise false. @throws FileIsNotADirectoryException Is thrown if the source file is not a directory. @throws IOException Is thrown if an error occurs by reading or writing. @throws FileIsADirectoryException Is thrown if the destination file is a directory.
[ "Copies", "the", "given", "source", "file", "to", "the", "given", "destination", "directory", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L593-L597
152,687
lightblueseas/file-worker
src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java
CopyFileExtensions.copyFileToDirectory
public static boolean copyFileToDirectory(final File source, final File destinationDir, final boolean lastModified) throws FileIsNotADirectoryException, IOException, FileIsADirectoryException { if (null == destinationDir) { throw new IllegalArgumentException("Destination must not be null"); } if (!destinationDir.isDirectory()) { throw new FileIsNotADirectoryException("Destination File-object '" + destinationDir.getAbsolutePath() + "' is not a directory."); } final File destinationFile = new File(destinationDir, source.getName()); return copyFile(source, destinationFile, lastModified); }
java
public static boolean copyFileToDirectory(final File source, final File destinationDir, final boolean lastModified) throws FileIsNotADirectoryException, IOException, FileIsADirectoryException { if (null == destinationDir) { throw new IllegalArgumentException("Destination must not be null"); } if (!destinationDir.isDirectory()) { throw new FileIsNotADirectoryException("Destination File-object '" + destinationDir.getAbsolutePath() + "' is not a directory."); } final File destinationFile = new File(destinationDir, source.getName()); return copyFile(source, destinationFile, lastModified); }
[ "public", "static", "boolean", "copyFileToDirectory", "(", "final", "File", "source", ",", "final", "File", "destinationDir", ",", "final", "boolean", "lastModified", ")", "throws", "FileIsNotADirectoryException", ",", "IOException", ",", "FileIsADirectoryException", "{", "if", "(", "null", "==", "destinationDir", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Destination must not be null\"", ")", ";", "}", "if", "(", "!", "destinationDir", ".", "isDirectory", "(", ")", ")", "{", "throw", "new", "FileIsNotADirectoryException", "(", "\"Destination File-object '\"", "+", "destinationDir", ".", "getAbsolutePath", "(", ")", "+", "\"' is not a directory.\"", ")", ";", "}", "final", "File", "destinationFile", "=", "new", "File", "(", "destinationDir", ",", "source", ".", "getName", "(", ")", ")", ";", "return", "copyFile", "(", "source", ",", "destinationFile", ",", "lastModified", ")", ";", "}" ]
Copies the given source file to the given destination directory with the option to set the lastModified time from the given destination directory. @param source The source directory. @param destinationDir The destination directory. @param lastModified Flag the tells if the attribute lastModified has to be set with the attribute from the destination directory. @return 's true if the file is copied to the given directory, otherwise false. @throws FileIsNotADirectoryException Is thrown if the source file is not a directory. @throws IOException Is thrown if an error occurs by reading or writing. @throws FileIsADirectoryException Is thrown if the destination file is a directory.
[ "Copies", "the", "given", "source", "file", "to", "the", "given", "destination", "directory", "with", "the", "option", "to", "set", "the", "lastModified", "time", "from", "the", "given", "destination", "directory", "." ]
2c81de10fb5d68de64c1abc3ed64ca681ce76da8
https://github.com/lightblueseas/file-worker/blob/2c81de10fb5d68de64c1abc3ed64ca681ce76da8/src/main/java/de/alpharogroup/file/copy/CopyFileExtensions.java#L620-L637
152,688
drewwills/cernunnos
cernunnos-core/src/main/java/org/danann/cernunnos/sql/UpsertTask.java
UpsertTask.doUpdate
protected int doUpdate(JdbcTemplate jdbcTemplate, TaskRequest req, TaskResponse res) { //Setup the update parameters and setter final List<Phrase> parametersInUse = update_parameters != null ? update_parameters : parameters; final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter(parametersInUse, req, res); //Get the update sql and execute the update. final String fUpdateSql = (String) update_sql.evaluate(req, res); return jdbcTemplate.update(fUpdateSql, preparedStatementSetter); }
java
protected int doUpdate(JdbcTemplate jdbcTemplate, TaskRequest req, TaskResponse res) { //Setup the update parameters and setter final List<Phrase> parametersInUse = update_parameters != null ? update_parameters : parameters; final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter(parametersInUse, req, res); //Get the update sql and execute the update. final String fUpdateSql = (String) update_sql.evaluate(req, res); return jdbcTemplate.update(fUpdateSql, preparedStatementSetter); }
[ "protected", "int", "doUpdate", "(", "JdbcTemplate", "jdbcTemplate", ",", "TaskRequest", "req", ",", "TaskResponse", "res", ")", "{", "//Setup the update parameters and setter", "final", "List", "<", "Phrase", ">", "parametersInUse", "=", "update_parameters", "!=", "null", "?", "update_parameters", ":", "parameters", ";", "final", "PreparedStatementSetter", "preparedStatementSetter", "=", "new", "PhraseParameterPreparedStatementSetter", "(", "parametersInUse", ",", "req", ",", "res", ")", ";", "//Get the update sql and execute the update.", "final", "String", "fUpdateSql", "=", "(", "String", ")", "update_sql", ".", "evaluate", "(", "req", ",", "res", ")", ";", "return", "jdbcTemplate", ".", "update", "(", "fUpdateSql", ",", "preparedStatementSetter", ")", ";", "}" ]
Executes the update and returns the affected row count Moved to its own method to reduce possibility for variable name confusion
[ "Executes", "the", "update", "and", "returns", "the", "affected", "row", "count" ]
dc6848e0253775e22b6c869fd06506d4ddb6d728
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/sql/UpsertTask.java#L158-L166
152,689
drewwills/cernunnos
cernunnos-core/src/main/java/org/danann/cernunnos/sql/UpsertTask.java
UpsertTask.doInsert
protected int doInsert(JdbcTemplate jdbcTemplate, TaskRequest req, TaskResponse res) { //Setup the insert parameters and setter final List<Phrase> parametersInUse = insert_parameters != null ? insert_parameters : parameters; final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter(parametersInUse, req, res); //Get the insert sql and execute the insert final String fInsertSql = (String) insert_sql.evaluate(req, res); return jdbcTemplate.update(fInsertSql, preparedStatementSetter); }
java
protected int doInsert(JdbcTemplate jdbcTemplate, TaskRequest req, TaskResponse res) { //Setup the insert parameters and setter final List<Phrase> parametersInUse = insert_parameters != null ? insert_parameters : parameters; final PreparedStatementSetter preparedStatementSetter = new PhraseParameterPreparedStatementSetter(parametersInUse, req, res); //Get the insert sql and execute the insert final String fInsertSql = (String) insert_sql.evaluate(req, res); return jdbcTemplate.update(fInsertSql, preparedStatementSetter); }
[ "protected", "int", "doInsert", "(", "JdbcTemplate", "jdbcTemplate", ",", "TaskRequest", "req", ",", "TaskResponse", "res", ")", "{", "//Setup the insert parameters and setter", "final", "List", "<", "Phrase", ">", "parametersInUse", "=", "insert_parameters", "!=", "null", "?", "insert_parameters", ":", "parameters", ";", "final", "PreparedStatementSetter", "preparedStatementSetter", "=", "new", "PhraseParameterPreparedStatementSetter", "(", "parametersInUse", ",", "req", ",", "res", ")", ";", "//Get the insert sql and execute the insert", "final", "String", "fInsertSql", "=", "(", "String", ")", "insert_sql", ".", "evaluate", "(", "req", ",", "res", ")", ";", "return", "jdbcTemplate", ".", "update", "(", "fInsertSql", ",", "preparedStatementSetter", ")", ";", "}" ]
Executes the insert and returns the affected row count Moved to its own method to reduce possibility for variable name confusion
[ "Executes", "the", "insert", "and", "returns", "the", "affected", "row", "count" ]
dc6848e0253775e22b6c869fd06506d4ddb6d728
https://github.com/drewwills/cernunnos/blob/dc6848e0253775e22b6c869fd06506d4ddb6d728/cernunnos-core/src/main/java/org/danann/cernunnos/sql/UpsertTask.java#L173-L181
152,690
jinahya/hex-codec
src/main/java/com/github/jinahya/codec/HexDecoder.java
HexDecoder.decodeSingle
public static int decodeSingle(final byte[] input, final int inoff) { if (input == null) { throw new NullPointerException("input"); } if (input.length < 2) { // not required by (inoff >= input.length -1) checked below throw new IllegalArgumentException( "input.length(" + input.length + ") < 2"); } if (inoff < 0) { throw new IllegalArgumentException("inoff(" + inoff + ") < 0"); } if (inoff >= input.length - 1) { throw new IllegalArgumentException( "inoff(" + inoff + ") >= input.length(" + input.length + ") - 1"); } return (decodeHalf(input[inoff] & 0xFF) << 4) | decodeHalf(input[inoff + 1] & 0xFF); }
java
public static int decodeSingle(final byte[] input, final int inoff) { if (input == null) { throw new NullPointerException("input"); } if (input.length < 2) { // not required by (inoff >= input.length -1) checked below throw new IllegalArgumentException( "input.length(" + input.length + ") < 2"); } if (inoff < 0) { throw new IllegalArgumentException("inoff(" + inoff + ") < 0"); } if (inoff >= input.length - 1) { throw new IllegalArgumentException( "inoff(" + inoff + ") >= input.length(" + input.length + ") - 1"); } return (decodeHalf(input[inoff] & 0xFF) << 4) | decodeHalf(input[inoff + 1] & 0xFF); }
[ "public", "static", "int", "decodeSingle", "(", "final", "byte", "[", "]", "input", ",", "final", "int", "inoff", ")", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"input\"", ")", ";", "}", "if", "(", "input", ".", "length", "<", "2", ")", "{", "// not required by (inoff >= input.length -1) checked below", "throw", "new", "IllegalArgumentException", "(", "\"input.length(\"", "+", "input", ".", "length", "+", "\") < 2\"", ")", ";", "}", "if", "(", "inoff", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"inoff(\"", "+", "inoff", "+", "\") < 0\"", ")", ";", "}", "if", "(", "inoff", ">=", "input", ".", "length", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"inoff(\"", "+", "inoff", "+", "\") >= input.length(\"", "+", "input", ".", "length", "+", "\") - 1\"", ")", ";", "}", "return", "(", "decodeHalf", "(", "input", "[", "inoff", "]", "&", "0xFF", ")", "<<", "4", ")", "|", "decodeHalf", "(", "input", "[", "inoff", "+", "1", "]", "&", "0xFF", ")", ";", "}" ]
Decodes two nibbles in given input array and returns the decoded octet. @param input the input array of nibbles. @param inoff the offset in the array. @return the decoded octet.
[ "Decodes", "two", "nibbles", "in", "given", "input", "array", "and", "returns", "the", "decoded", "octet", "." ]
159aa54010821655496177e76a3ef35a49fbd433
https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexDecoder.java#L91-L115
152,691
jinahya/hex-codec
src/main/java/com/github/jinahya/codec/HexDecoder.java
HexDecoder.decodeSingle
public static void decodeSingle(final byte[] input, final int inoff, final byte[] output, final int outoff) { if (output == null) { throw new NullPointerException("output"); } if (outoff < 0) { throw new IllegalArgumentException("outoff(" + outoff + ") < 0"); } if (outoff >= output.length) { throw new IllegalArgumentException( "outoff(" + outoff + ") >= output.length(" + output.length + ")"); } output[outoff] = (byte) decodeSingle(input, inoff); }
java
public static void decodeSingle(final byte[] input, final int inoff, final byte[] output, final int outoff) { if (output == null) { throw new NullPointerException("output"); } if (outoff < 0) { throw new IllegalArgumentException("outoff(" + outoff + ") < 0"); } if (outoff >= output.length) { throw new IllegalArgumentException( "outoff(" + outoff + ") >= output.length(" + output.length + ")"); } output[outoff] = (byte) decodeSingle(input, inoff); }
[ "public", "static", "void", "decodeSingle", "(", "final", "byte", "[", "]", "input", ",", "final", "int", "inoff", ",", "final", "byte", "[", "]", "output", ",", "final", "int", "outoff", ")", "{", "if", "(", "output", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"output\"", ")", ";", "}", "if", "(", "outoff", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"outoff(\"", "+", "outoff", "+", "\") < 0\"", ")", ";", "}", "if", "(", "outoff", ">=", "output", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"outoff(\"", "+", "outoff", "+", "\") >= output.length(\"", "+", "output", ".", "length", "+", "\")\"", ")", ";", "}", "output", "[", "outoff", "]", "=", "(", "byte", ")", "decodeSingle", "(", "input", ",", "inoff", ")", ";", "}" ]
Decodes two nibbles in given input array and writes the resulting single octet into specified output array. @param input the input array @param inoff the offset in input array @param output the output array @param outoff the offset in output array
[ "Decodes", "two", "nibbles", "in", "given", "input", "array", "and", "writes", "the", "resulting", "single", "octet", "into", "specified", "output", "array", "." ]
159aa54010821655496177e76a3ef35a49fbd433
https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexDecoder.java#L127-L145
152,692
jinahya/hex-codec
src/main/java/com/github/jinahya/codec/HexDecoder.java
HexDecoder.decodeMultiple
public static void decodeMultiple(final byte[] input, int inoff, final byte[] output, int outoff, final int count) { if (count < 0) { throw new IllegalArgumentException("count(" + count + ") < 0"); } for (int i = 0; i < count; i++) { decodeSingle(input, inoff, output, outoff); inoff += 2; outoff += 1; } }
java
public static void decodeMultiple(final byte[] input, int inoff, final byte[] output, int outoff, final int count) { if (count < 0) { throw new IllegalArgumentException("count(" + count + ") < 0"); } for (int i = 0; i < count; i++) { decodeSingle(input, inoff, output, outoff); inoff += 2; outoff += 1; } }
[ "public", "static", "void", "decodeMultiple", "(", "final", "byte", "[", "]", "input", ",", "int", "inoff", ",", "final", "byte", "[", "]", "output", ",", "int", "outoff", ",", "final", "int", "count", ")", "{", "if", "(", "count", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"count(\"", "+", "count", "+", "\") < 0\"", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "decodeSingle", "(", "input", ",", "inoff", ",", "output", ",", "outoff", ")", ";", "inoff", "+=", "2", ";", "outoff", "+=", "1", ";", "}", "}" ]
Decodes multiple units in given input array and writes the resulting octets into specifed output array. @param input the input array @param inoff the offset in input array @param output the output array @param outoff the offset in output array @param count the number of units to process
[ "Decodes", "multiple", "units", "in", "given", "input", "array", "and", "writes", "the", "resulting", "octets", "into", "specifed", "output", "array", "." ]
159aa54010821655496177e76a3ef35a49fbd433
https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexDecoder.java#L158-L171
152,693
jinahya/hex-codec
src/main/java/com/github/jinahya/codec/HexDecoder.java
HexDecoder.decodeMultiple
public static byte[] decodeMultiple(final byte[] input) { if (input == null) { throw new NullPointerException("input"); } final byte[] output = new byte[input.length >> 1]; // /2 decodeMultiple(input, 0, output, 0, output.length); return output; }
java
public static byte[] decodeMultiple(final byte[] input) { if (input == null) { throw new NullPointerException("input"); } final byte[] output = new byte[input.length >> 1]; // /2 decodeMultiple(input, 0, output, 0, output.length); return output; }
[ "public", "static", "byte", "[", "]", "decodeMultiple", "(", "final", "byte", "[", "]", "input", ")", "{", "if", "(", "input", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", "\"input\"", ")", ";", "}", "final", "byte", "[", "]", "output", "=", "new", "byte", "[", "input", ".", "length", ">>", "1", "]", ";", "// /2", "decodeMultiple", "(", "input", ",", "0", ",", "output", ",", "0", ",", "output", ".", "length", ")", ";", "return", "output", ";", "}" ]
Encodes given sequence of nibbles into a sequence of octets. @param input the nibbles to decode. @return the decoded octets.
[ "Encodes", "given", "sequence", "of", "nibbles", "into", "a", "sequence", "of", "octets", "." ]
159aa54010821655496177e76a3ef35a49fbd433
https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexDecoder.java#L181-L192
152,694
jinahya/hex-codec
src/main/java/com/github/jinahya/codec/HexDecoder.java
HexDecoder.decodeToString
public String decodeToString(final byte[] input, final String outputCharset) throws UnsupportedEncodingException { return new String(decode(input), outputCharset); }
java
public String decodeToString(final byte[] input, final String outputCharset) throws UnsupportedEncodingException { return new String(decode(input), outputCharset); }
[ "public", "String", "decodeToString", "(", "final", "byte", "[", "]", "input", ",", "final", "String", "outputCharset", ")", "throws", "UnsupportedEncodingException", "{", "return", "new", "String", "(", "decode", "(", "input", ")", ",", "outputCharset", ")", ";", "}" ]
Decodes given sequence of nibbles into a string. @param input the nibbles to decode @param outputCharset the charset name to encode output string @return the decoded string. @throws UnsupportedEncodingException if outputCharset is not supported
[ "Decodes", "given", "sequence", "of", "nibbles", "into", "a", "string", "." ]
159aa54010821655496177e76a3ef35a49fbd433
https://github.com/jinahya/hex-codec/blob/159aa54010821655496177e76a3ef35a49fbd433/src/main/java/com/github/jinahya/codec/HexDecoder.java#L218-L222
152,695
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/NumberField.java
NumberField.setString
public int setString(String strField, boolean bDisplayOption, int iMoveMode) // init this field override for other value { int iFieldLength = 0; Object objTempBinary = null; if (strField != null) { iFieldLength = strField.length(); int iMaxLength = this.getMaxLength(); if ((iFieldLength > iMaxLength) || (iFieldLength > 40)) iFieldLength = iMaxLength; try { objTempBinary = this.stringToBinary(strField); } catch (Exception ex) { String strError = ex.getMessage(); if (strError == null) strError = ex.getClass().getName(); Task task = null; if (this.getRecord() != null) if (this.getRecord().getRecordOwner() != null) task = this.getRecord().getRecordOwner().getTask(); //if (task == null) // task = BaseApplet.getSharedInstance(); if (task == null) return DBConstants.ERROR_RETURN; return task.setLastError(strError); } } return this.setData(objTempBinary, bDisplayOption, iMoveMode); }
java
public int setString(String strField, boolean bDisplayOption, int iMoveMode) // init this field override for other value { int iFieldLength = 0; Object objTempBinary = null; if (strField != null) { iFieldLength = strField.length(); int iMaxLength = this.getMaxLength(); if ((iFieldLength > iMaxLength) || (iFieldLength > 40)) iFieldLength = iMaxLength; try { objTempBinary = this.stringToBinary(strField); } catch (Exception ex) { String strError = ex.getMessage(); if (strError == null) strError = ex.getClass().getName(); Task task = null; if (this.getRecord() != null) if (this.getRecord().getRecordOwner() != null) task = this.getRecord().getRecordOwner().getTask(); //if (task == null) // task = BaseApplet.getSharedInstance(); if (task == null) return DBConstants.ERROR_RETURN; return task.setLastError(strError); } } return this.setData(objTempBinary, bDisplayOption, iMoveMode); }
[ "public", "int", "setString", "(", "String", "strField", ",", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "// init this field override for other value", "{", "int", "iFieldLength", "=", "0", ";", "Object", "objTempBinary", "=", "null", ";", "if", "(", "strField", "!=", "null", ")", "{", "iFieldLength", "=", "strField", ".", "length", "(", ")", ";", "int", "iMaxLength", "=", "this", ".", "getMaxLength", "(", ")", ";", "if", "(", "(", "iFieldLength", ">", "iMaxLength", ")", "||", "(", "iFieldLength", ">", "40", ")", ")", "iFieldLength", "=", "iMaxLength", ";", "try", "{", "objTempBinary", "=", "this", ".", "stringToBinary", "(", "strField", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "String", "strError", "=", "ex", ".", "getMessage", "(", ")", ";", "if", "(", "strError", "==", "null", ")", "strError", "=", "ex", ".", "getClass", "(", ")", ".", "getName", "(", ")", ";", "Task", "task", "=", "null", ";", "if", "(", "this", ".", "getRecord", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", "!=", "null", ")", "task", "=", "this", ".", "getRecord", "(", ")", ".", "getRecordOwner", "(", ")", ".", "getTask", "(", ")", ";", "//if (task == null)", "// task = BaseApplet.getSharedInstance();", "if", "(", "task", "==", "null", ")", "return", "DBConstants", ".", "ERROR_RETURN", ";", "return", "task", ".", "setLastError", "(", "strError", ")", ";", "}", "}", "return", "this", ".", "setData", "(", "objTempBinary", ",", "bDisplayOption", ",", "iMoveMode", ")", ";", "}" ]
Convert and move string to this field. This Data is in a binary format, so convert it and move it. @param bState the state to set the data to. @param bDisplayOption Display the data on the screen if true. @param iMoveMode INIT, SCREEN, or READ move mode. @return The error code.
[ "Convert", "and", "move", "string", "to", "this", "field", ".", "This", "Data", "is", "in", "a", "binary", "format", "so", "convert", "it", "and", "move", "it", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/NumberField.java#L170-L198
152,696
tvesalainen/util
util/src/main/java/org/vesalainen/util/navi/RateOfTurn.java
RateOfTurn.getRadius
public Distance getRadius(Velocity velocity) { Distance circle = velocity.getDistance(getTimeForFullCircle()); circle.mul(1/Math.PI); return circle; }
java
public Distance getRadius(Velocity velocity) { Distance circle = velocity.getDistance(getTimeForFullCircle()); circle.mul(1/Math.PI); return circle; }
[ "public", "Distance", "getRadius", "(", "Velocity", "velocity", ")", "{", "Distance", "circle", "=", "velocity", ".", "getDistance", "(", "getTimeForFullCircle", "(", ")", ")", ";", "circle", ".", "mul", "(", "1", "/", "Math", ".", "PI", ")", ";", "return", "circle", ";", "}" ]
Returns the radius of the circle @param velocity Speed of the vessel @return
[ "Returns", "the", "radius", "of", "the", "circle" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/RateOfTurn.java#L79-L84
152,697
tvesalainen/util
util/src/main/java/org/vesalainen/util/navi/RateOfTurn.java
RateOfTurn.getMotionAfter
public Motion getMotionAfter(Motion motion, TimeSpan span) { return new Motion(motion.getSpeed(), getBearingAfter(motion.getAngle(), span)); }
java
public Motion getMotionAfter(Motion motion, TimeSpan span) { return new Motion(motion.getSpeed(), getBearingAfter(motion.getAngle(), span)); }
[ "public", "Motion", "getMotionAfter", "(", "Motion", "motion", ",", "TimeSpan", "span", ")", "{", "return", "new", "Motion", "(", "motion", ".", "getSpeed", "(", ")", ",", "getBearingAfter", "(", "motion", ".", "getAngle", "(", ")", ",", "span", ")", ")", ";", "}" ]
Return's motion after timespan @param motion Motion at the beginning @param span TimeSpan of turning @return
[ "Return", "s", "motion", "after", "timespan" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/navi/RateOfTurn.java#L104-L107
152,698
krotscheck/data-file-reader
data-file-filter-column/src/main/java/net/krotscheck/dfr/filter/column/ColumnFilter.java
ColumnFilter.apply
@Override public Map<String, Object> apply(final Map<String, Object> row) { Map<String, Object> cleanRow, filteredRow; // Make sure the row isn't null. if (row == null) { cleanRow = new LinkedHashMap<>(); } else { cleanRow = new LinkedHashMap<>(row); } // Copy the row so we avoid concurrent modifications. filteredRow = new LinkedHashMap<>(); // Iterate through the requested columns and add/override the ones // the user wants to see. for (String column : columns) { if (cleanRow.containsKey(column)) { filteredRow.put(column, cleanRow.get(column)); } else { filteredRow.put(column, null); } } return filteredRow; }
java
@Override public Map<String, Object> apply(final Map<String, Object> row) { Map<String, Object> cleanRow, filteredRow; // Make sure the row isn't null. if (row == null) { cleanRow = new LinkedHashMap<>(); } else { cleanRow = new LinkedHashMap<>(row); } // Copy the row so we avoid concurrent modifications. filteredRow = new LinkedHashMap<>(); // Iterate through the requested columns and add/override the ones // the user wants to see. for (String column : columns) { if (cleanRow.containsKey(column)) { filteredRow.put(column, cleanRow.get(column)); } else { filteredRow.put(column, null); } } return filteredRow; }
[ "@", "Override", "public", "Map", "<", "String", ",", "Object", ">", "apply", "(", "final", "Map", "<", "String", ",", "Object", ">", "row", ")", "{", "Map", "<", "String", ",", "Object", ">", "cleanRow", ",", "filteredRow", ";", "// Make sure the row isn't null.", "if", "(", "row", "==", "null", ")", "{", "cleanRow", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "}", "else", "{", "cleanRow", "=", "new", "LinkedHashMap", "<>", "(", "row", ")", ";", "}", "// Copy the row so we avoid concurrent modifications.", "filteredRow", "=", "new", "LinkedHashMap", "<>", "(", ")", ";", "// Iterate through the requested columns and add/override the ones", "// the user wants to see.", "for", "(", "String", "column", ":", "columns", ")", "{", "if", "(", "cleanRow", ".", "containsKey", "(", "column", ")", ")", "{", "filteredRow", ".", "put", "(", "column", ",", "cleanRow", ".", "get", "(", "column", ")", ")", ";", "}", "else", "{", "filteredRow", ".", "put", "(", "column", ",", "null", ")", ";", "}", "}", "return", "filteredRow", ";", "}" ]
Apply the filter. @param row The data row to apply this filter to. @return A row that only contains the configured columns.
[ "Apply", "the", "filter", "." ]
b9a85bd07dc9f9b8291ffbfb6945443d96371811
https://github.com/krotscheck/data-file-reader/blob/b9a85bd07dc9f9b8291ffbfb6945443d96371811/data-file-filter-column/src/main/java/net/krotscheck/dfr/filter/column/ColumnFilter.java#L102-L127
152,699
DependencyWatcher/agent
src/main/java/com/dependencywatcher/collector/ProjectInfoCollector.java
ProjectInfoCollector.collect
public File collect(Path projectRoot) throws IOException, ZipException { DataArchiver dataArchiver = new DataArchiver(projectRoot); try { ProjectFileVisitor fileVisitor = new ProjectFileVisitor( dataArchiver, projectRoot); Files.walkFileTree(projectRoot, fileVisitor); dataArchiver.add("DWFileList.txt", fileVisitor.getFileList()); return dataArchiver.createArchive(); } finally { dataArchiver.dispose(); } }
java
public File collect(Path projectRoot) throws IOException, ZipException { DataArchiver dataArchiver = new DataArchiver(projectRoot); try { ProjectFileVisitor fileVisitor = new ProjectFileVisitor( dataArchiver, projectRoot); Files.walkFileTree(projectRoot, fileVisitor); dataArchiver.add("DWFileList.txt", fileVisitor.getFileList()); return dataArchiver.createArchive(); } finally { dataArchiver.dispose(); } }
[ "public", "File", "collect", "(", "Path", "projectRoot", ")", "throws", "IOException", ",", "ZipException", "{", "DataArchiver", "dataArchiver", "=", "new", "DataArchiver", "(", "projectRoot", ")", ";", "try", "{", "ProjectFileVisitor", "fileVisitor", "=", "new", "ProjectFileVisitor", "(", "dataArchiver", ",", "projectRoot", ")", ";", "Files", ".", "walkFileTree", "(", "projectRoot", ",", "fileVisitor", ")", ";", "dataArchiver", ".", "add", "(", "\"DWFileList.txt\"", ",", "fileVisitor", ".", "getFileList", "(", ")", ")", ";", "return", "dataArchiver", ".", "createArchive", "(", ")", ";", "}", "finally", "{", "dataArchiver", ".", "dispose", "(", ")", ";", "}", "}" ]
Gathers needed information about project @param projectRoot Project root path @return archive containing the collected data @throws IOException @throws ZipException
[ "Gathers", "needed", "information", "about", "project" ]
6a082650275f9555993f5607d1f0bbe7aceceee1
https://github.com/DependencyWatcher/agent/blob/6a082650275f9555993f5607d1f0bbe7aceceee1/src/main/java/com/dependencywatcher/collector/ProjectInfoCollector.java#L24-L38