id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
151,200
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/RecordChangedHandler.java
RecordChangedHandler.setTheDate
public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); }
java
public void setTheDate() { boolean[] rgbEnabled = m_field.setEnableListeners(false); Calendar calAfter = m_field.getCalendar(); Calendar calBefore = m_field.getCalendar(); m_field.setValue(DateTimeField.currentTime(), DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); // File written or updated, set the update date calAfter = m_field.getCalendar(); if (calBefore != null) if (calAfter.before(calBefore)) calAfter = calBefore; // If this was set with a different computer (clock), make sure it always increases! if (calAfter != null) if (calAfter.equals(calBefore)) { calAfter.add(Calendar.SECOND, 1); // Can't be the same as last time. m_field.setCalendar(calAfter, DBConstants.DISPLAY, DBConstants.SCREEN_MOVE); } Utility.getLogger().info("Set date: " + m_field.toString()); m_field.setEnableListeners(rgbEnabled); }
[ "public", "void", "setTheDate", "(", ")", "{", "boolean", "[", "]", "rgbEnabled", "=", "m_field", ".", "setEnableListeners", "(", "false", ")", ";", "Calendar", "calAfter", "=", "m_field", ".", "getCalendar", "(", ")", ";", "Calendar", "calBefore", "=", "m_field", ".", "getCalendar", "(", ")", ";", "m_field", ".", "setValue", "(", "DateTimeField", ".", "currentTime", "(", ")", ",", "DBConstants", ".", "DISPLAY", ",", "DBConstants", ".", "SCREEN_MOVE", ")", ";", "// File written or updated, set the update date", "calAfter", "=", "m_field", ".", "getCalendar", "(", ")", ";", "if", "(", "calBefore", "!=", "null", ")", "if", "(", "calAfter", ".", "before", "(", "calBefore", ")", ")", "calAfter", "=", "calBefore", ";", "// If this was set with a different computer (clock), make sure it always increases!", "if", "(", "calAfter", "!=", "null", ")", "if", "(", "calAfter", ".", "equals", "(", "calBefore", ")", ")", "{", "calAfter", ".", "add", "(", "Calendar", ".", "SECOND", ",", "1", ")", ";", "// Can't be the same as last time.", "m_field", ".", "setCalendar", "(", "calAfter", ",", "DBConstants", ".", "DISPLAY", ",", "DBConstants", ".", "SCREEN_MOVE", ")", ";", "}", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"Set date: \"", "+", "m_field", ".", "toString", "(", ")", ")", ";", "m_field", ".", "setEnableListeners", "(", "rgbEnabled", ")", ";", "}" ]
Set the date field to the current time. Also make sure the time is not the same as it is currently.
[ "Set", "the", "date", "field", "to", "the", "current", "time", ".", "Also", "make", "sure", "the", "time", "is", "not", "the", "same", "as", "it", "is", "currently", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/RecordChangedHandler.java#L169-L187
151,201
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/RecordChangedHandler.java
RecordChangedHandler.clearTemporaryKeyField
public void clearTemporaryKeyField() { Record record = this.getOwner(); KeyArea keyArea = record.getKeyArea(0); if (keyArea.getKeyFields(false, true) == 2) if (m_fakeKeyField != null) // Always keyArea.removeKeyField(m_fakeKeyField); }
java
public void clearTemporaryKeyField() { Record record = this.getOwner(); KeyArea keyArea = record.getKeyArea(0); if (keyArea.getKeyFields(false, true) == 2) if (m_fakeKeyField != null) // Always keyArea.removeKeyField(m_fakeKeyField); }
[ "public", "void", "clearTemporaryKeyField", "(", ")", "{", "Record", "record", "=", "this", ".", "getOwner", "(", ")", ";", "KeyArea", "keyArea", "=", "record", ".", "getKeyArea", "(", "0", ")", ";", "if", "(", "keyArea", ".", "getKeyFields", "(", "false", ",", "true", ")", "==", "2", ")", "if", "(", "m_fakeKeyField", "!=", "null", ")", "// Always", "keyArea", ".", "removeKeyField", "(", "m_fakeKeyField", ")", ";", "}" ]
Remove the temporary key field.
[ "Remove", "the", "temporary", "key", "field", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/RecordChangedHandler.java#L217-L224
151,202
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static <E> void swap(E[] array1, int array1Index, E[] array2, int array2Index) { if(array1[array1Index] != array2[array2Index]) { E hold = array1[array1Index]; array1[array1Index] = array2[array2Index]; array2[array2Index] = hold; } }
java
public static <E> void swap(E[] array1, int array1Index, E[] array2, int array2Index) { if(array1[array1Index] != array2[array2Index]) { E hold = array1[array1Index]; array1[array1Index] = array2[array2Index]; array2[array2Index] = hold; } }
[ "public", "static", "<", "E", ">", "void", "swap", "(", "E", "[", "]", "array1", ",", "int", "array1Index", ",", "E", "[", "]", "array2", ",", "int", "array2Index", ")", "{", "if", "(", "array1", "[", "array1Index", "]", "!=", "array2", "[", "array2Index", "]", ")", "{", "E", "hold", "=", "array1", "[", "array1Index", "]", ";", "array1", "[", "array1Index", "]", "=", "array2", "[", "array2Index", "]", ";", "array2", "[", "array2Index", "]", "=", "hold", ";", "}", "}" ]
Swap the elements of two arrays at the specified positions. @param <E> the type of elements in this array. @param array1 one of the arrays that will have one of its values swapped. @param array1Index the index of the first array that will be swapped. @param array2 the other array that will have one of its values swapped. @param array2Index the index of the second array that will be swapped.
[ "Swap", "the", "elements", "of", "two", "arrays", "at", "the", "specified", "positions", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L39-L46
151,203
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static <E> void swap(E[] array1, E[] array2, int index) { TrivialSwap.swap(array1, index, array2, index); }
java
public static <E> void swap(E[] array1, E[] array2, int index) { TrivialSwap.swap(array1, index, array2, index); }
[ "public", "static", "<", "E", ">", "void", "swap", "(", "E", "[", "]", "array1", ",", "E", "[", "]", "array2", ",", "int", "index", ")", "{", "TrivialSwap", ".", "swap", "(", "array1", ",", "index", ",", "array2", ",", "index", ")", ";", "}" ]
Swap the elements of two arrays at the same position @param <E> the type of elements in this list. @param array1 one of the arrays that will have one of its values swapped. @param array2 the other array that will have one of its values swapped. @param index the index of the arrays that will have their values swapped.
[ "Swap", "the", "elements", "of", "two", "arrays", "at", "the", "same", "position" ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L57-L59
151,204
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static <E> void swap(E[] array, int index1, int index2) { TrivialSwap.swap(array, index1, array, index2); }
java
public static <E> void swap(E[] array, int index1, int index2) { TrivialSwap.swap(array, index1, array, index2); }
[ "public", "static", "<", "E", ">", "void", "swap", "(", "E", "[", "]", "array", ",", "int", "index1", ",", "int", "index2", ")", "{", "TrivialSwap", ".", "swap", "(", "array", ",", "index1", ",", "array", ",", "index2", ")", ";", "}" ]
Swap two elements of array at the specified positions @param <E> the type of elements in this list. @param array array that will have two of its values swapped. @param index1 one of the indexes of the array. @param index2 other index of the array.
[ "Swap", "two", "elements", "of", "array", "at", "the", "specified", "positions" ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L70-L72
151,205
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static <E> void swap(List<E> list1, int list1Index, List<E> list2, int list2Index) { if(list1.get(list1Index) != list2.get(list2Index)) { E hold = list1.remove(list1Index); if(list1 != list2 || list1Index > list2Index){ list1.add(list1Index, list2.get(list2Index)); } else { list1.add(list1Index, list2.get(list2Index-1)); } list2.remove(list2Index); list2.add(list2Index, hold); } }
java
public static <E> void swap(List<E> list1, int list1Index, List<E> list2, int list2Index) { if(list1.get(list1Index) != list2.get(list2Index)) { E hold = list1.remove(list1Index); if(list1 != list2 || list1Index > list2Index){ list1.add(list1Index, list2.get(list2Index)); } else { list1.add(list1Index, list2.get(list2Index-1)); } list2.remove(list2Index); list2.add(list2Index, hold); } }
[ "public", "static", "<", "E", ">", "void", "swap", "(", "List", "<", "E", ">", "list1", ",", "int", "list1Index", ",", "List", "<", "E", ">", "list2", ",", "int", "list2Index", ")", "{", "if", "(", "list1", ".", "get", "(", "list1Index", ")", "!=", "list2", ".", "get", "(", "list2Index", ")", ")", "{", "E", "hold", "=", "list1", ".", "remove", "(", "list1Index", ")", ";", "if", "(", "list1", "!=", "list2", "||", "list1Index", ">", "list2Index", ")", "{", "list1", ".", "add", "(", "list1Index", ",", "list2", ".", "get", "(", "list2Index", ")", ")", ";", "}", "else", "{", "list1", ".", "add", "(", "list1Index", ",", "list2", ".", "get", "(", "list2Index", "-", "1", ")", ")", ";", "}", "list2", ".", "remove", "(", "list2Index", ")", ";", "list2", ".", "add", "(", "list2Index", ",", "hold", ")", ";", "}", "}" ]
Swap the elements of two lists at the specified positions. The run time of this method depends on the implementation of the lists since elements are removed and added in the lists. @param <E> the type of elements in this list. @param list1 one of the lists that will have one of its values swapped. @param list1Index the index of the first list that will be swapped. @param list2 the other list that will have one of its values swapped. @param list2Index the index of the second list that will be swapped.
[ "Swap", "the", "elements", "of", "two", "lists", "at", "the", "specified", "positions", ".", "The", "run", "time", "of", "this", "method", "depends", "on", "the", "implementation", "of", "the", "lists", "since", "elements", "are", "removed", "and", "added", "in", "the", "lists", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L103-L117
151,206
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static <E> void swap(List<E> list1, List<E> list2, int index) { TrivialSwap.swap(list1, index, list2, index); }
java
public static <E> void swap(List<E> list1, List<E> list2, int index) { TrivialSwap.swap(list1, index, list2, index); }
[ "public", "static", "<", "E", ">", "void", "swap", "(", "List", "<", "E", ">", "list1", ",", "List", "<", "E", ">", "list2", ",", "int", "index", ")", "{", "TrivialSwap", ".", "swap", "(", "list1", ",", "index", ",", "list2", ",", "index", ")", ";", "}" ]
Swap all the elements of two lists at the same position. The run time of this method depends on the implementation of the lists since elements are removed and added in the lists. @param <E> the type of elements in this list. @param list1 one of the lists that will have one of its values swapped. @param list2 the other list that will have one of its values swapped. @param index the index of the lists that will have their values swapped.
[ "Swap", "all", "the", "elements", "of", "two", "lists", "at", "the", "same", "position", ".", "The", "run", "time", "of", "this", "method", "depends", "on", "the", "implementation", "of", "the", "lists", "since", "elements", "are", "removed", "and", "added", "in", "the", "lists", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L130-L132
151,207
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static <E> void swap(List<E> list, int index1, int index2) { TrivialSwap.swap(list, index1, list, index2); }
java
public static <E> void swap(List<E> list, int index1, int index2) { TrivialSwap.swap(list, index1, list, index2); }
[ "public", "static", "<", "E", ">", "void", "swap", "(", "List", "<", "E", ">", "list", ",", "int", "index1", ",", "int", "index2", ")", "{", "TrivialSwap", ".", "swap", "(", "list", ",", "index1", ",", "list", ",", "index2", ")", ";", "}" ]
Swap two elements of a list at the specified positions. The run time of this method depends on the implementation of the lists since elements are removed and added in the lists. @param <E> the type of elements in this list. @param list list that will have two of its values swapped. @param index1 one of the indexes of the list. @param index2 other index of the list.
[ "Swap", "two", "elements", "of", "a", "list", "at", "the", "specified", "positions", ".", "The", "run", "time", "of", "this", "method", "depends", "on", "the", "implementation", "of", "the", "lists", "since", "elements", "are", "removed", "and", "added", "in", "the", "lists", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L145-L147
151,208
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static <E> void swap(List<E> list1, List<E> list2) { int minLength = Math.min(list1.size(), list2.size()); for(int i = 0; i < minLength; i++) { TrivialSwap.swap(list1, list2, i); } }
java
public static <E> void swap(List<E> list1, List<E> list2) { int minLength = Math.min(list1.size(), list2.size()); for(int i = 0; i < minLength; i++) { TrivialSwap.swap(list1, list2, i); } }
[ "public", "static", "<", "E", ">", "void", "swap", "(", "List", "<", "E", ">", "list1", ",", "List", "<", "E", ">", "list2", ")", "{", "int", "minLength", "=", "Math", ".", "min", "(", "list1", ".", "size", "(", ")", ",", "list2", ".", "size", "(", ")", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "minLength", ";", "i", "++", ")", "{", "TrivialSwap", ".", "swap", "(", "list1", ",", "list2", ",", "i", ")", ";", "}", "}" ]
Helper method that swaps all the elements of the arrays. The run time of this method depends on the implementation of the lists since elements are removed and added in the lists. It also depends on the length of the shortest list. @param <E> the type of elements in this list. @param list1 one array that will have its values swapped. @param list2 the other array that will have its values swapped.
[ "Helper", "method", "that", "swaps", "all", "the", "elements", "of", "the", "arrays", ".", "The", "run", "time", "of", "this", "method", "depends", "on", "the", "implementation", "of", "the", "lists", "since", "elements", "are", "removed", "and", "added", "in", "the", "lists", ".", "It", "also", "depends", "on", "the", "length", "of", "the", "shortest", "list", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L159-L165
151,209
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static void swap(int[] intArray1, int array1Index, int[] intArray2, int array2Index) { if(intArray1[array1Index] != intArray2[array2Index]) { int hold = intArray1[array1Index]; intArray1[array1Index] = intArray2[array2Index]; intArray2[array2Index] = hold; } }
java
public static void swap(int[] intArray1, int array1Index, int[] intArray2, int array2Index) { if(intArray1[array1Index] != intArray2[array2Index]) { int hold = intArray1[array1Index]; intArray1[array1Index] = intArray2[array2Index]; intArray2[array2Index] = hold; } }
[ "public", "static", "void", "swap", "(", "int", "[", "]", "intArray1", ",", "int", "array1Index", ",", "int", "[", "]", "intArray2", ",", "int", "array2Index", ")", "{", "if", "(", "intArray1", "[", "array1Index", "]", "!=", "intArray2", "[", "array2Index", "]", ")", "{", "int", "hold", "=", "intArray1", "[", "array1Index", "]", ";", "intArray1", "[", "array1Index", "]", "=", "intArray2", "[", "array2Index", "]", ";", "intArray2", "[", "array2Index", "]", "=", "hold", ";", "}", "}" ]
Swap the elements of two int arrays at the specified positions. @param intArray1 one of the arrays that will have one of its values swapped. @param array1Index the index of the first array that will be swapped. @param intArray2 the other array that will have one of its values swapped. @param array2Index the index of the second array that will be swapped.
[ "Swap", "the", "elements", "of", "two", "int", "arrays", "at", "the", "specified", "positions", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L175-L182
151,210
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static void swap(short[] shortArray1, int array1Index, short[] shortArray2, int array2Index) { if(shortArray1[array1Index] != shortArray2[array2Index]) { short hold = shortArray1[array1Index]; shortArray1[array1Index] = shortArray2[array2Index]; shortArray2[array2Index] = hold; } }
java
public static void swap(short[] shortArray1, int array1Index, short[] shortArray2, int array2Index) { if(shortArray1[array1Index] != shortArray2[array2Index]) { short hold = shortArray1[array1Index]; shortArray1[array1Index] = shortArray2[array2Index]; shortArray2[array2Index] = hold; } }
[ "public", "static", "void", "swap", "(", "short", "[", "]", "shortArray1", ",", "int", "array1Index", ",", "short", "[", "]", "shortArray2", ",", "int", "array2Index", ")", "{", "if", "(", "shortArray1", "[", "array1Index", "]", "!=", "shortArray2", "[", "array2Index", "]", ")", "{", "short", "hold", "=", "shortArray1", "[", "array1Index", "]", ";", "shortArray1", "[", "array1Index", "]", "=", "shortArray2", "[", "array2Index", "]", ";", "shortArray2", "[", "array2Index", "]", "=", "hold", ";", "}", "}" ]
Swap the elements of two short arrays at the specified positions. @param shortArray1 one of the arrays that will have one of its values swapped. @param array1Index the index of the first array that will be swapped. @param shortArray2 the other array that will have one of its values swapped. @param array2Index the index of the second array that will be swapped.
[ "Swap", "the", "elements", "of", "two", "short", "arrays", "at", "the", "specified", "positions", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L337-L344
151,211
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static void swap(short[] shortArray1, short[] shortArray2, int index) { TrivialSwap.swap(shortArray1, index, shortArray2, index); }
java
public static void swap(short[] shortArray1, short[] shortArray2, int index) { TrivialSwap.swap(shortArray1, index, shortArray2, index); }
[ "public", "static", "void", "swap", "(", "short", "[", "]", "shortArray1", ",", "short", "[", "]", "shortArray2", ",", "int", "index", ")", "{", "TrivialSwap", ".", "swap", "(", "shortArray1", ",", "index", ",", "shortArray2", ",", "index", ")", ";", "}" ]
Swap the elements of two short arrays at the same position @param shortArray1 one of the arrays that will have one of its values swapped. @param shortArray2 the other array that will have one of its values swapped. @param index the index of the arrays that will have their values swapped.
[ "Swap", "the", "elements", "of", "two", "short", "arrays", "at", "the", "same", "position" ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L353-L355
151,212
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static void swap(float[] floatArray1, int array1Index, float[] floatArray2, int array2Index) { if(floatArray1[array1Index] != floatArray2[array2Index]) { float hold = floatArray1[array1Index]; floatArray1[array1Index] = floatArray2[array2Index]; floatArray2[array2Index] = hold; } }
java
public static void swap(float[] floatArray1, int array1Index, float[] floatArray2, int array2Index) { if(floatArray1[array1Index] != floatArray2[array2Index]) { float hold = floatArray1[array1Index]; floatArray1[array1Index] = floatArray2[array2Index]; floatArray2[array2Index] = hold; } }
[ "public", "static", "void", "swap", "(", "float", "[", "]", "floatArray1", ",", "int", "array1Index", ",", "float", "[", "]", "floatArray2", ",", "int", "array2Index", ")", "{", "if", "(", "floatArray1", "[", "array1Index", "]", "!=", "floatArray2", "[", "array2Index", "]", ")", "{", "float", "hold", "=", "floatArray1", "[", "array1Index", "]", ";", "floatArray1", "[", "array1Index", "]", "=", "floatArray2", "[", "array2Index", "]", ";", "floatArray2", "[", "array2Index", "]", "=", "hold", ";", "}", "}" ]
Swap the elements of two float arrays at the specified positions. @param floatArray1 one of the arrays that will have one of its values swapped. @param array1Index the index of the first array that will be swapped. @param floatArray2 the other array that will have one of its values swapped. @param array2Index the index of the second array that will be swapped.
[ "Swap", "the", "elements", "of", "two", "float", "arrays", "at", "the", "specified", "positions", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L445-L452
151,213
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static void swap(float[] floatArray1, float[] floatArray2, int index) { TrivialSwap.swap(floatArray1, index, floatArray2, index); }
java
public static void swap(float[] floatArray1, float[] floatArray2, int index) { TrivialSwap.swap(floatArray1, index, floatArray2, index); }
[ "public", "static", "void", "swap", "(", "float", "[", "]", "floatArray1", ",", "float", "[", "]", "floatArray2", ",", "int", "index", ")", "{", "TrivialSwap", ".", "swap", "(", "floatArray1", ",", "index", ",", "floatArray2", ",", "index", ")", ";", "}" ]
Swap the elements of two float arrays at the same position @param floatArray1 one of the arrays that will have one of its values swapped. @param floatArray2 the other array that will have one of its values swapped. @param index the index of the arrays that will have their values swapped.
[ "Swap", "the", "elements", "of", "two", "float", "arrays", "at", "the", "same", "position" ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L461-L463
151,214
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static void swap(float[] floatArray, int index1, int index2) { TrivialSwap.swap(floatArray, index1, floatArray, index2); }
java
public static void swap(float[] floatArray, int index1, int index2) { TrivialSwap.swap(floatArray, index1, floatArray, index2); }
[ "public", "static", "void", "swap", "(", "float", "[", "]", "floatArray", ",", "int", "index1", ",", "int", "index2", ")", "{", "TrivialSwap", ".", "swap", "(", "floatArray", ",", "index1", ",", "floatArray", ",", "index2", ")", ";", "}" ]
Swap two elements of a float array at the specified positions @param floatArray array that will have two of its values swapped. @param index1 one of the indexes of the array. @param index2 other index of the array.
[ "Swap", "two", "elements", "of", "a", "float", "array", "at", "the", "specified", "positions" ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L472-L474
151,215
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static void swap(double[] doubleArray1, int array1Index, double[] doubleArray2, int array2Index) { if(doubleArray1[array1Index] != doubleArray2[array2Index]) { double hold = doubleArray1[array1Index]; doubleArray1[array1Index] = doubleArray2[array2Index]; doubleArray2[array2Index] = hold; } }
java
public static void swap(double[] doubleArray1, int array1Index, double[] doubleArray2, int array2Index) { if(doubleArray1[array1Index] != doubleArray2[array2Index]) { double hold = doubleArray1[array1Index]; doubleArray1[array1Index] = doubleArray2[array2Index]; doubleArray2[array2Index] = hold; } }
[ "public", "static", "void", "swap", "(", "double", "[", "]", "doubleArray1", ",", "int", "array1Index", ",", "double", "[", "]", "doubleArray2", ",", "int", "array2Index", ")", "{", "if", "(", "doubleArray1", "[", "array1Index", "]", "!=", "doubleArray2", "[", "array2Index", "]", ")", "{", "double", "hold", "=", "doubleArray1", "[", "array1Index", "]", ";", "doubleArray1", "[", "array1Index", "]", "=", "doubleArray2", "[", "array2Index", "]", ";", "doubleArray2", "[", "array2Index", "]", "=", "hold", ";", "}", "}" ]
Swap the elements of two double arrays at the specified positions. @param doubleArray1 one of the arrays that will have one of its values swapped. @param array1Index the index of the first array that will be swapped. @param doubleArray2 the other array that will have one of its values swapped. @param array2Index the index of the second array that will be swapped.
[ "Swap", "the", "elements", "of", "two", "double", "arrays", "at", "the", "specified", "positions", "." ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L499-L506
151,216
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static void swap(double[] doubleArray1, double[] doubleArray2, int index) { TrivialSwap.swap(doubleArray1, index, doubleArray2, index); }
java
public static void swap(double[] doubleArray1, double[] doubleArray2, int index) { TrivialSwap.swap(doubleArray1, index, doubleArray2, index); }
[ "public", "static", "void", "swap", "(", "double", "[", "]", "doubleArray1", ",", "double", "[", "]", "doubleArray2", ",", "int", "index", ")", "{", "TrivialSwap", ".", "swap", "(", "doubleArray1", ",", "index", ",", "doubleArray2", ",", "index", ")", ";", "}" ]
Swap the elements of two double arrays at the same position @param doubleArray1 one of the arrays that will have one of its values swapped. @param doubleArray2 the other array that will have one of its values swapped. @param index the index of the arrays that will have their values swapped.
[ "Swap", "the", "elements", "of", "two", "double", "arrays", "at", "the", "same", "position" ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L515-L517
151,217
mijecu25/dsa
src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java
TrivialSwap.swap
public static void swap(double[] doubleArray, int index1, int index2) { TrivialSwap.swap(doubleArray, index1, doubleArray, index2); }
java
public static void swap(double[] doubleArray, int index1, int index2) { TrivialSwap.swap(doubleArray, index1, doubleArray, index2); }
[ "public", "static", "void", "swap", "(", "double", "[", "]", "doubleArray", ",", "int", "index1", ",", "int", "index2", ")", "{", "TrivialSwap", ".", "swap", "(", "doubleArray", ",", "index1", ",", "doubleArray", ",", "index2", ")", ";", "}" ]
Swap two elements of a double array at the specified positions @param doubleArray array that will have two of its values swapped. @param index1 one of the indexes of the array. @param index2 other index of the array.
[ "Swap", "two", "elements", "of", "a", "double", "array", "at", "the", "specified", "positions" ]
a22971b746833e78a3939ae4de65e8f6bf2e3fd4
https://github.com/mijecu25/dsa/blob/a22971b746833e78a3939ae4de65e8f6bf2e3fd4/src/main/java/com/mijecu25/dsa/algorithms/swap/TrivialSwap.java#L526-L528
151,218
davidcarboni-archive/httpino
src/main/java/com/github/davidcarboni/httpino/Http.java
Http.getFile
public static Path getFile(HttpServletRequest request) throws IOException { Path result = null; // Set up the objects that do all the heavy lifting DiskFileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); try { // Read the items - this will save the values to temp files for (FileItem item : upload.parseRequest(request)) { if (!item.isFormField()) { result = Files.createTempFile("upload", ".file"); item.write(result.toFile()); } } } catch (Exception e) { // item.write throws a general Exception, so specialise it by wrapping with IOException throw new IOException("Error processing uploaded file", e); } return result; }
java
public static Path getFile(HttpServletRequest request) throws IOException { Path result = null; // Set up the objects that do all the heavy lifting DiskFileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); try { // Read the items - this will save the values to temp files for (FileItem item : upload.parseRequest(request)) { if (!item.isFormField()) { result = Files.createTempFile("upload", ".file"); item.write(result.toFile()); } } } catch (Exception e) { // item.write throws a general Exception, so specialise it by wrapping with IOException throw new IOException("Error processing uploaded file", e); } return result; }
[ "public", "static", "Path", "getFile", "(", "HttpServletRequest", "request", ")", "throws", "IOException", "{", "Path", "result", "=", "null", ";", "// Set up the objects that do all the heavy lifting", "DiskFileItemFactory", "factory", "=", "new", "DiskFileItemFactory", "(", ")", ";", "ServletFileUpload", "upload", "=", "new", "ServletFileUpload", "(", "factory", ")", ";", "try", "{", "// Read the items - this will save the values to temp files", "for", "(", "FileItem", "item", ":", "upload", ".", "parseRequest", "(", "request", ")", ")", "{", "if", "(", "!", "item", ".", "isFormField", "(", ")", ")", "{", "result", "=", "Files", ".", "createTempFile", "(", "\"upload\"", ",", "\".file\"", ")", ";", "item", ".", "write", "(", "result", ".", "toFile", "(", ")", ")", ";", "}", "}", "}", "catch", "(", "Exception", "e", ")", "{", "// item.write throws a general Exception, so specialise it by wrapping with IOException", "throw", "new", "IOException", "(", "\"Error processing uploaded file\"", ",", "e", ")", ";", "}", "return", "result", ";", "}" ]
Handles reading an uploaded file. @param request The http request. @return A temp file containing the file data. @throws IOException If an error occurs in processing the file.
[ "Handles", "reading", "an", "uploaded", "file", "." ]
a78c91874e6d9b2e452cf3aa68d4fea804d977ca
https://github.com/davidcarboni-archive/httpino/blob/a78c91874e6d9b2e452cf3aa68d4fea804d977ca/src/main/java/com/github/davidcarboni/httpino/Http.java#L385-L407
151,219
davidcarboni-archive/httpino
src/main/java/com/github/davidcarboni/httpino/Http.java
Http.combineHeaders
private Header[] combineHeaders(NameValuePair[] headers) { Header[] fullHeaders = new Header[this.headers.size() + headers.length]; // Add class-level headers (for all requests) for (int i = 0; i < this.headers.size(); i++) { fullHeaders[i] = this.headers.get(i); } // Add headers specific to this request: for (int i = 0; i < headers.length; i++) { NameValuePair header = headers[i]; fullHeaders[i + this.headers.size()] = new BasicHeader(header.getName(), header.getValue()); } //System.out.println(Arrays.toString(fullHeaders)); return fullHeaders; }
java
private Header[] combineHeaders(NameValuePair[] headers) { Header[] fullHeaders = new Header[this.headers.size() + headers.length]; // Add class-level headers (for all requests) for (int i = 0; i < this.headers.size(); i++) { fullHeaders[i] = this.headers.get(i); } // Add headers specific to this request: for (int i = 0; i < headers.length; i++) { NameValuePair header = headers[i]; fullHeaders[i + this.headers.size()] = new BasicHeader(header.getName(), header.getValue()); } //System.out.println(Arrays.toString(fullHeaders)); return fullHeaders; }
[ "private", "Header", "[", "]", "combineHeaders", "(", "NameValuePair", "[", "]", "headers", ")", "{", "Header", "[", "]", "fullHeaders", "=", "new", "Header", "[", "this", ".", "headers", ".", "size", "(", ")", "+", "headers", ".", "length", "]", ";", "// Add class-level headers (for all requests)", "for", "(", "int", "i", "=", "0", ";", "i", "<", "this", ".", "headers", ".", "size", "(", ")", ";", "i", "++", ")", "{", "fullHeaders", "[", "i", "]", "=", "this", ".", "headers", ".", "get", "(", "i", ")", ";", "}", "// Add headers specific to this request:", "for", "(", "int", "i", "=", "0", ";", "i", "<", "headers", ".", "length", ";", "i", "++", ")", "{", "NameValuePair", "header", "=", "headers", "[", "i", "]", ";", "fullHeaders", "[", "i", "+", "this", ".", "headers", ".", "size", "(", ")", "]", "=", "new", "BasicHeader", "(", "header", ".", "getName", "(", ")", ",", "header", ".", "getValue", "(", ")", ")", ";", "}", "//System.out.println(Arrays.toString(fullHeaders));", "return", "fullHeaders", ";", "}" ]
Sets the combined request headers. @param headers Additional header values to add over and above {@link #headers}.
[ "Sets", "the", "combined", "request", "headers", "." ]
a78c91874e6d9b2e452cf3aa68d4fea804d977ca
https://github.com/davidcarboni-archive/httpino/blob/a78c91874e6d9b2e452cf3aa68d4fea804d977ca/src/main/java/com/github/davidcarboni/httpino/Http.java#L415-L432
151,220
tvesalainen/util
util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java
SymmetricDifferenceMatcher.map
public void map(I item, T target) { mapSet.add(item, target); reverseMap.add(target, item); }
java
public void map(I item, T target) { mapSet.add(item, target); reverseMap.add(target, item); }
[ "public", "void", "map", "(", "I", "item", ",", "T", "target", ")", "{", "mapSet", ".", "add", "(", "item", ",", "target", ")", ";", "reverseMap", ".", "add", "(", "target", ",", "item", ")", ";", "}" ]
Maps item to target @param item @param target
[ "Maps", "item", "to", "target" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java#L72-L76
151,221
tvesalainen/util
util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java
SymmetricDifferenceMatcher.map
public void map(Collection<I> items, T target) { for (I item : items) { map(item, target); } }
java
public void map(Collection<I> items, T target) { for (I item : items) { map(item, target); } }
[ "public", "void", "map", "(", "Collection", "<", "I", ">", "items", ",", "T", "target", ")", "{", "for", "(", "I", "item", ":", "items", ")", "{", "map", "(", "item", ",", "target", ")", ";", "}", "}" ]
Maps collections of items to target @param items @param target
[ "Maps", "collections", "of", "items", "to", "target" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java#L82-L88
151,222
tvesalainen/util
util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java
SymmetricDifferenceMatcher.unmap
public void unmap(Collection<I> items, T target) { for (I item : items) { unmap(item, target); } }
java
public void unmap(Collection<I> items, T target) { for (I item : items) { unmap(item, target); } }
[ "public", "void", "unmap", "(", "Collection", "<", "I", ">", "items", ",", "T", "target", ")", "{", "for", "(", "I", "item", ":", "items", ")", "{", "unmap", "(", "item", ",", "target", ")", ";", "}", "}" ]
Remove collection mappings to target @param items @param target
[ "Remove", "collection", "mappings", "to", "target" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java#L104-L110
151,223
tvesalainen/util
util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java
SymmetricDifferenceMatcher.unmap
public void unmap(T target) { Set<I> items = reverseMap.get(target); items.forEach((i)->mapSet.removeItem(i, target)); reverseMap.remove(target); }
java
public void unmap(T target) { Set<I> items = reverseMap.get(target); items.forEach((i)->mapSet.removeItem(i, target)); reverseMap.remove(target); }
[ "public", "void", "unmap", "(", "T", "target", ")", "{", "Set", "<", "I", ">", "items", "=", "reverseMap", ".", "get", "(", "target", ")", ";", "items", ".", "forEach", "(", "(", "i", ")", "-", ">", "mapSet", ".", "removeItem", "(", "i", ",", "target", ")", ")", ";", "reverseMap", ".", "remove", "(", "target", ")", ";", "}" ]
Remove all mappings to target @param target
[ "Remove", "all", "mappings", "to", "target" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java#L115-L120
151,224
tvesalainen/util
util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java
SymmetricDifferenceMatcher.match
public T match(Collection<I> items) { for (I item : items) { T match = match(item); if (match != null) { return match; } } return null; }
java
public T match(Collection<I> items) { for (I item : items) { T match = match(item); if (match != null) { return match; } } return null; }
[ "public", "T", "match", "(", "Collection", "<", "I", ">", "items", ")", "{", "for", "(", "I", "item", ":", "items", ")", "{", "T", "match", "=", "match", "(", "item", ")", ";", "if", "(", "match", "!=", "null", ")", "{", "return", "match", ";", "}", "}", "return", "null", ";", "}" ]
Returns target if one of collection items match. Otherwise returns null. Matched targets mappings are removed. @param items @return
[ "Returns", "target", "if", "one", "of", "collection", "items", "match", ".", "Otherwise", "returns", "null", ".", "Matched", "targets", "mappings", "are", "removed", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java#L127-L138
151,225
tvesalainen/util
util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java
SymmetricDifferenceMatcher.match
public T match(I item) { Set<T> set = mapSet.get(item); if (set.size() == 1) { T match = set.iterator().next(); unmap(match); return match; } return null; }
java
public T match(I item) { Set<T> set = mapSet.get(item); if (set.size() == 1) { T match = set.iterator().next(); unmap(match); return match; } return null; }
[ "public", "T", "match", "(", "I", "item", ")", "{", "Set", "<", "T", ">", "set", "=", "mapSet", ".", "get", "(", "item", ")", ";", "if", "(", "set", ".", "size", "(", ")", "==", "1", ")", "{", "T", "match", "=", "set", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "unmap", "(", "match", ")", ";", "return", "match", ";", "}", "return", "null", ";", "}" ]
Returns target if item match. Otherwise returns null. Matched targets mappings are removed. @param item @return
[ "Returns", "target", "if", "item", "match", ".", "Otherwise", "returns", "null", ".", "Matched", "targets", "mappings", "are", "removed", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java#L145-L155
151,226
tvesalainen/util
util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java
SymmetricDifferenceMatcher.match
public <A> void match(Map<A,? extends Collection<I>> samples, BiConsumer<T, A> consumer) { Map<A,Collection<I>> m = new HashMap<>(samples); boolean cont = true; while (cont) { cont = false; Iterator<Entry<A, Collection<I>>> iterator = m.entrySet().iterator(); while (iterator.hasNext()) { Entry<A, Collection<I>> e = iterator.next(); T match = match(e.getValue()); if (match != null) { consumer.accept(match, e.getKey()); cont = true; iterator.remove(); } } } }
java
public <A> void match(Map<A,? extends Collection<I>> samples, BiConsumer<T, A> consumer) { Map<A,Collection<I>> m = new HashMap<>(samples); boolean cont = true; while (cont) { cont = false; Iterator<Entry<A, Collection<I>>> iterator = m.entrySet().iterator(); while (iterator.hasNext()) { Entry<A, Collection<I>> e = iterator.next(); T match = match(e.getValue()); if (match != null) { consumer.accept(match, e.getKey()); cont = true; iterator.remove(); } } } }
[ "public", "<", "A", ">", "void", "match", "(", "Map", "<", "A", ",", "?", "extends", "Collection", "<", "I", ">", ">", "samples", ",", "BiConsumer", "<", "T", ",", "A", ">", "consumer", ")", "{", "Map", "<", "A", ",", "Collection", "<", "I", ">", ">", "m", "=", "new", "HashMap", "<>", "(", "samples", ")", ";", "boolean", "cont", "=", "true", ";", "while", "(", "cont", ")", "{", "cont", "=", "false", ";", "Iterator", "<", "Entry", "<", "A", ",", "Collection", "<", "I", ">", ">", ">", "iterator", "=", "m", ".", "entrySet", "(", ")", ".", "iterator", "(", ")", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "Entry", "<", "A", ",", "Collection", "<", "I", ">", ">", "e", "=", "iterator", ".", "next", "(", ")", ";", "T", "match", "=", "match", "(", "e", ".", "getValue", "(", ")", ")", ";", "if", "(", "match", "!=", "null", ")", "{", "consumer", ".", "accept", "(", "match", ",", "e", ".", "getKey", "(", ")", ")", ";", "cont", "=", "true", ";", "iterator", ".", "remove", "(", ")", ";", "}", "}", "}", "}" ]
Matches A objects to T targets. Each A is mapped to subset of items. Each match is passed to consumer. Map is traversed as long as there are matches. Each match will remove targets mappings. @param <A> @param samples @param consumer
[ "Matches", "A", "objects", "to", "T", "targets", ".", "Each", "A", "is", "mapped", "to", "subset", "of", "items", ".", "Each", "match", "is", "passed", "to", "consumer", ".", "Map", "is", "traversed", "as", "long", "as", "there", "are", "matches", ".", "Each", "match", "will", "remove", "targets", "mappings", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/SymmetricDifferenceMatcher.java#L164-L184
151,227
tacitknowledge/discovery
src/main/java/com/tacitknowledge/util/discovery/ClassDiscoveryUtil.java
ClassDiscoveryUtil.getResources
public static String[] getResources(String basePath, String regex) { RegexResourceCriteria criteria = new RegexResourceCriteria(regex); String[] resourcesNames = classpathResources.getResources(basePath, criteria); return resourcesNames; }
java
public static String[] getResources(String basePath, String regex) { RegexResourceCriteria criteria = new RegexResourceCriteria(regex); String[] resourcesNames = classpathResources.getResources(basePath, criteria); return resourcesNames; }
[ "public", "static", "String", "[", "]", "getResources", "(", "String", "basePath", ",", "String", "regex", ")", "{", "RegexResourceCriteria", "criteria", "=", "new", "RegexResourceCriteria", "(", "regex", ")", ";", "String", "[", "]", "resourcesNames", "=", "classpathResources", ".", "getResources", "(", "basePath", ",", "criteria", ")", ";", "return", "resourcesNames", ";", "}" ]
Returns the names of the resources in the given directory that match the given regular expression. @param basePath the directory containing the resources @param regex the regular expression used to filter the resources @return the names of the resources in the given directory that match the given regular expression
[ "Returns", "the", "names", "of", "the", "resources", "in", "the", "given", "directory", "that", "match", "the", "given", "regular", "expression", "." ]
700f5492c9cb5c0146d684acb38b71fd4ef4e97a
https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ClassDiscoveryUtil.java#L82-L87
151,228
tacitknowledge/discovery
src/main/java/com/tacitknowledge/util/discovery/ClassDiscoveryUtil.java
ClassDiscoveryUtil.getClasses
public static Class[] getClasses(String basePackage, Class requiredInterface) { return getClasses(basePackage, new Class[] {requiredInterface}); }
java
public static Class[] getClasses(String basePackage, Class requiredInterface) { return getClasses(basePackage, new Class[] {requiredInterface}); }
[ "public", "static", "Class", "[", "]", "getClasses", "(", "String", "basePackage", ",", "Class", "requiredInterface", ")", "{", "return", "getClasses", "(", "basePackage", ",", "new", "Class", "[", "]", "{", "requiredInterface", "}", ")", ";", "}" ]
Returns an array of concrete classes in the given package that implement the specified interface. @param basePackage the name of the package containing the classes to discover @param requiredInterface the inteface that the returned classes must implement @return an array of concrete classes in the given package that implement the specified interface
[ "Returns", "an", "array", "of", "concrete", "classes", "in", "the", "given", "package", "that", "implement", "the", "specified", "interface", "." ]
700f5492c9cb5c0146d684acb38b71fd4ef4e97a
https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ClassDiscoveryUtil.java#L98-L101
151,229
tacitknowledge/discovery
src/main/java/com/tacitknowledge/util/discovery/ClassDiscoveryUtil.java
ClassDiscoveryUtil.getClasses
public static Class[] getClasses(String basePackage, Class[] requiredInterfaces) { List classes = new ArrayList(); ClassCriteria criteria = new ClassCriteria(requiredInterfaces); String basePath = basePackage.replace('.', File.separatorChar); String[] resourcesNames = classpathResources.getResources(basePath, criteria); for (int i = 0; i < resourcesNames.length; i++) { String resourceName = resourcesNames[i]; if (resourceName == null) { continue; } String className = getClassName(resourceName); try { Class c = Class.forName(className); classes.add(c); } catch (ClassNotFoundException e) { // This should not happen since we've already validated the class } } return (Class[]) classes.toArray(new Class[classes.size()]); }
java
public static Class[] getClasses(String basePackage, Class[] requiredInterfaces) { List classes = new ArrayList(); ClassCriteria criteria = new ClassCriteria(requiredInterfaces); String basePath = basePackage.replace('.', File.separatorChar); String[] resourcesNames = classpathResources.getResources(basePath, criteria); for (int i = 0; i < resourcesNames.length; i++) { String resourceName = resourcesNames[i]; if (resourceName == null) { continue; } String className = getClassName(resourceName); try { Class c = Class.forName(className); classes.add(c); } catch (ClassNotFoundException e) { // This should not happen since we've already validated the class } } return (Class[]) classes.toArray(new Class[classes.size()]); }
[ "public", "static", "Class", "[", "]", "getClasses", "(", "String", "basePackage", ",", "Class", "[", "]", "requiredInterfaces", ")", "{", "List", "classes", "=", "new", "ArrayList", "(", ")", ";", "ClassCriteria", "criteria", "=", "new", "ClassCriteria", "(", "requiredInterfaces", ")", ";", "String", "basePath", "=", "basePackage", ".", "replace", "(", "'", "'", ",", "File", ".", "separatorChar", ")", ";", "String", "[", "]", "resourcesNames", "=", "classpathResources", ".", "getResources", "(", "basePath", ",", "criteria", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "resourcesNames", ".", "length", ";", "i", "++", ")", "{", "String", "resourceName", "=", "resourcesNames", "[", "i", "]", ";", "if", "(", "resourceName", "==", "null", ")", "{", "continue", ";", "}", "String", "className", "=", "getClassName", "(", "resourceName", ")", ";", "try", "{", "Class", "c", "=", "Class", ".", "forName", "(", "className", ")", ";", "classes", ".", "add", "(", "c", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "// This should not happen since we've already validated the class", "}", "}", "return", "(", "Class", "[", "]", ")", "classes", ".", "toArray", "(", "new", "Class", "[", "classes", ".", "size", "(", ")", "]", ")", ";", "}" ]
Returns an array of concrete classes in the given package that implement all of the specified interfaces. @param basePackage the name of the package containing the classes to discover @param requiredInterfaces the intefaces that the returned classes must implement @return an array of concrete classes in the given package that implement the specified interface
[ "Returns", "an", "array", "of", "concrete", "classes", "in", "the", "given", "package", "that", "implement", "all", "of", "the", "specified", "interfaces", "." ]
700f5492c9cb5c0146d684acb38b71fd4ef4e97a
https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ClassDiscoveryUtil.java#L112-L137
151,230
tacitknowledge/discovery
src/main/java/com/tacitknowledge/util/discovery/ClassDiscoveryUtil.java
ClassDiscoveryUtil.getClassName
public static String getClassName(String resourceName) { String className = resourceName.replace(File.separatorChar, '.'); if (className.length() > 7) { className = className.substring(0, className.length() - 6); } return className; }
java
public static String getClassName(String resourceName) { String className = resourceName.replace(File.separatorChar, '.'); if (className.length() > 7) { className = className.substring(0, className.length() - 6); } return className; }
[ "public", "static", "String", "getClassName", "(", "String", "resourceName", ")", "{", "String", "className", "=", "resourceName", ".", "replace", "(", "File", ".", "separatorChar", ",", "'", "'", ")", ";", "if", "(", "className", ".", "length", "(", ")", ">", "7", ")", "{", "className", "=", "className", ".", "substring", "(", "0", ",", "className", ".", "length", "(", ")", "-", "6", ")", ";", "}", "return", "className", ";", "}" ]
Returns the fully qualified class name represented by the given resource. @param resourceName the file name of the resource to convert to a class name; may not be <code>null</code> @return the fully qualified class name represented by the given resource
[ "Returns", "the", "fully", "qualified", "class", "name", "represented", "by", "the", "given", "resource", "." ]
700f5492c9cb5c0146d684acb38b71fd4ef4e97a
https://github.com/tacitknowledge/discovery/blob/700f5492c9cb5c0146d684acb38b71fd4ef4e97a/src/main/java/com/tacitknowledge/util/discovery/ClassDiscoveryUtil.java#L146-L154
151,231
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/ProxyTask.java
ProxyTask.getSessionFromPath
public BaseHolder getSessionFromPath(String strSessionPathID) { if (strSessionPathID == null) return null; BaseHolder rootHolder = null; // Now, traverse the path int iStartPosition = 0; int iEndPosition = 0; while (iEndPosition < strSessionPathID.length()) { iEndPosition = strSessionPathID.indexOf(PATH_SEPARATOR, iStartPosition); if (iEndPosition == -1) iEndPosition = strSessionPathID.length(); String strID = strSessionPathID.substring(iStartPosition, iEndPosition); if (iStartPosition == 0) rootHolder = (TaskHolder)m_mapTasks.get(strID); else rootHolder = rootHolder.get(strID); if (rootHolder == null) return null; iStartPosition = iEndPosition + 1; } return rootHolder; }
java
public BaseHolder getSessionFromPath(String strSessionPathID) { if (strSessionPathID == null) return null; BaseHolder rootHolder = null; // Now, traverse the path int iStartPosition = 0; int iEndPosition = 0; while (iEndPosition < strSessionPathID.length()) { iEndPosition = strSessionPathID.indexOf(PATH_SEPARATOR, iStartPosition); if (iEndPosition == -1) iEndPosition = strSessionPathID.length(); String strID = strSessionPathID.substring(iStartPosition, iEndPosition); if (iStartPosition == 0) rootHolder = (TaskHolder)m_mapTasks.get(strID); else rootHolder = rootHolder.get(strID); if (rootHolder == null) return null; iStartPosition = iEndPosition + 1; } return rootHolder; }
[ "public", "BaseHolder", "getSessionFromPath", "(", "String", "strSessionPathID", ")", "{", "if", "(", "strSessionPathID", "==", "null", ")", "return", "null", ";", "BaseHolder", "rootHolder", "=", "null", ";", "// Now, traverse the path", "int", "iStartPosition", "=", "0", ";", "int", "iEndPosition", "=", "0", ";", "while", "(", "iEndPosition", "<", "strSessionPathID", ".", "length", "(", ")", ")", "{", "iEndPosition", "=", "strSessionPathID", ".", "indexOf", "(", "PATH_SEPARATOR", ",", "iStartPosition", ")", ";", "if", "(", "iEndPosition", "==", "-", "1", ")", "iEndPosition", "=", "strSessionPathID", ".", "length", "(", ")", ";", "String", "strID", "=", "strSessionPathID", ".", "substring", "(", "iStartPosition", ",", "iEndPosition", ")", ";", "if", "(", "iStartPosition", "==", "0", ")", "rootHolder", "=", "(", "TaskHolder", ")", "m_mapTasks", ".", "get", "(", "strID", ")", ";", "else", "rootHolder", "=", "rootHolder", ".", "get", "(", "strID", ")", ";", "if", "(", "rootHolder", "==", "null", ")", "return", "null", ";", "iStartPosition", "=", "iEndPosition", "+", "1", ";", "}", "return", "rootHolder", ";", "}" ]
Look up this session in the hierarchy.
[ "Look", "up", "this", "session", "in", "the", "hierarchy", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/ProxyTask.java#L214-L237
151,232
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/ProxyTask.java
ProxyTask.getApplicationProperties
public Map<String, Object> getApplicationProperties(Map<String, Object> properties) { if (properties == null) return null; Map<String, Object> propApp = new Hashtable<String,Object>(); if (properties.get(DBParams.LANGUAGE) != null) propApp.put(DBParams.LANGUAGE, properties.get(DBParams.LANGUAGE)); if (properties.get(DBParams.DOMAIN) != null) propApp.put(DBParams.DOMAIN, properties.get(DBParams.DOMAIN)); return propApp; }
java
public Map<String, Object> getApplicationProperties(Map<String, Object> properties) { if (properties == null) return null; Map<String, Object> propApp = new Hashtable<String,Object>(); if (properties.get(DBParams.LANGUAGE) != null) propApp.put(DBParams.LANGUAGE, properties.get(DBParams.LANGUAGE)); if (properties.get(DBParams.DOMAIN) != null) propApp.put(DBParams.DOMAIN, properties.get(DBParams.DOMAIN)); return propApp; }
[ "public", "Map", "<", "String", ",", "Object", ">", "getApplicationProperties", "(", "Map", "<", "String", ",", "Object", ">", "properties", ")", "{", "if", "(", "properties", "==", "null", ")", "return", "null", ";", "Map", "<", "String", ",", "Object", ">", "propApp", "=", "new", "Hashtable", "<", "String", ",", "Object", ">", "(", ")", ";", "if", "(", "properties", ".", "get", "(", "DBParams", ".", "LANGUAGE", ")", "!=", "null", ")", "propApp", ".", "put", "(", "DBParams", ".", "LANGUAGE", ",", "properties", ".", "get", "(", "DBParams", ".", "LANGUAGE", ")", ")", ";", "if", "(", "properties", ".", "get", "(", "DBParams", ".", "DOMAIN", ")", "!=", "null", ")", "propApp", ".", "put", "(", "DBParams", ".", "DOMAIN", ",", "properties", ".", "get", "(", "DBParams", ".", "DOMAIN", ")", ")", ";", "return", "propApp", ";", "}" ]
Get application properties from proxy properties. @return Just the application properties
[ "Get", "application", "properties", "from", "proxy", "properties", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/transport/ProxyTask.java#L329-L339
151,233
js-lib-com/commons
src/main/java/js/util/FilteredStrings.java
FilteredStrings.add
@Override public boolean add(String string) { if (filter.accept(string)) { list.add(string); return true; } return false; }
java
@Override public boolean add(String string) { if (filter.accept(string)) { list.add(string); return true; } return false; }
[ "@", "Override", "public", "boolean", "add", "(", "String", "string", ")", "{", "if", "(", "filter", ".", "accept", "(", "string", ")", ")", "{", "list", ".", "add", "(", "string", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Add a string if it matches this filter pattern. @param string string to add to this strings list. @return true if given <code>string</code> argument matches the pattern and was added to this strings list.
[ "Add", "a", "string", "if", "it", "matches", "this", "filter", "pattern", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/FilteredStrings.java#L53-L60
151,234
jbundle/jbundle
thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/sort/SortableHeaderRenderer.java
SortableHeaderRenderer.getTableCellRendererComponent
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c = tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (c instanceof JLabel) { JLabel l = (JLabel) c; l.setHorizontalTextPosition(JLabel.LEFT); if (column == m_iCurrentSortedColumn) { if (l.getIcon() == null) l.setIcon(getHeaderRendererIcon(m_bCurrentOrder)); } else { if ((l.getIcon() == ASCENDING_ICON) || (l.getIcon() == DESCENDING_ICON)) l.setIcon(null); } } return c; }
java
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { Component c = tableCellRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); if (c instanceof JLabel) { JLabel l = (JLabel) c; l.setHorizontalTextPosition(JLabel.LEFT); if (column == m_iCurrentSortedColumn) { if (l.getIcon() == null) l.setIcon(getHeaderRendererIcon(m_bCurrentOrder)); } else { if ((l.getIcon() == ASCENDING_ICON) || (l.getIcon() == DESCENDING_ICON)) l.setIcon(null); } } return c; }
[ "public", "Component", "getTableCellRendererComponent", "(", "JTable", "table", ",", "Object", "value", ",", "boolean", "isSelected", ",", "boolean", "hasFocus", ",", "int", "row", ",", "int", "column", ")", "{", "Component", "c", "=", "tableCellRenderer", ".", "getTableCellRendererComponent", "(", "table", ",", "value", ",", "isSelected", ",", "hasFocus", ",", "row", ",", "column", ")", ";", "if", "(", "c", "instanceof", "JLabel", ")", "{", "JLabel", "l", "=", "(", "JLabel", ")", "c", ";", "l", ".", "setHorizontalTextPosition", "(", "JLabel", ".", "LEFT", ")", ";", "if", "(", "column", "==", "m_iCurrentSortedColumn", ")", "{", "if", "(", "l", ".", "getIcon", "(", ")", "==", "null", ")", "l", ".", "setIcon", "(", "getHeaderRendererIcon", "(", "m_bCurrentOrder", ")", ")", ";", "}", "else", "{", "if", "(", "(", "l", ".", "getIcon", "(", ")", "==", "ASCENDING_ICON", ")", "||", "(", "l", ".", "getIcon", "(", ")", "==", "DESCENDING_ICON", ")", ")", "l", ".", "setIcon", "(", "null", ")", ";", "}", "}", "return", "c", ";", "}" ]
Tweek the column label if this column is sorted.
[ "Tweek", "the", "column", "label", "if", "this", "column", "is", "sorted", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/grid/src/main/java/org/jbundle/thin/base/screen/grid/sort/SortableHeaderRenderer.java#L47-L71
151,235
jbundle/jbundle
main/db/src/main/java/org/jbundle/main/db/base/ContactType.java
ContactType.getContactTypeFromID
public String getContactTypeFromID(String strContactTypeID) { if (Utility.isNumeric(strContactTypeID)) { int iOldKeyArea = this.getDefaultOrder(); this.setKeyArea(ContactType.ID_KEY); this.getCounterField().setString(strContactTypeID); try { if (this.seek(null)) strContactTypeID = this.getField(ContactType.CODE).toString(); } catch (DBException ex) { ex.printStackTrace(); } finally { this.setKeyArea(iOldKeyArea); } } return strContactTypeID; }
java
public String getContactTypeFromID(String strContactTypeID) { if (Utility.isNumeric(strContactTypeID)) { int iOldKeyArea = this.getDefaultOrder(); this.setKeyArea(ContactType.ID_KEY); this.getCounterField().setString(strContactTypeID); try { if (this.seek(null)) strContactTypeID = this.getField(ContactType.CODE).toString(); } catch (DBException ex) { ex.printStackTrace(); } finally { this.setKeyArea(iOldKeyArea); } } return strContactTypeID; }
[ "public", "String", "getContactTypeFromID", "(", "String", "strContactTypeID", ")", "{", "if", "(", "Utility", ".", "isNumeric", "(", "strContactTypeID", ")", ")", "{", "int", "iOldKeyArea", "=", "this", ".", "getDefaultOrder", "(", ")", ";", "this", ".", "setKeyArea", "(", "ContactType", ".", "ID_KEY", ")", ";", "this", ".", "getCounterField", "(", ")", ".", "setString", "(", "strContactTypeID", ")", ";", "try", "{", "if", "(", "this", ".", "seek", "(", "null", ")", ")", "strContactTypeID", "=", "this", ".", "getField", "(", "ContactType", ".", "CODE", ")", ".", "toString", "(", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "this", ".", "setKeyArea", "(", "iOldKeyArea", ")", ";", "}", "}", "return", "strContactTypeID", ";", "}" ]
GetContactTypeFromID Method.
[ "GetContactTypeFromID", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/base/ContactType.java#L162-L179
151,236
jbundle/jbundle
main/db/src/main/java/org/jbundle/main/db/base/ContactType.java
ContactType.makeRecordFromRecordName
public Record makeRecordFromRecordName(String strRecordName, RecordOwner recordOwner) { int iOldKeyArea = this.getDefaultOrder(); try { this.addNew(); this.setKeyArea(ContactType.CODE_KEY); this.getField(ContactType.CODE).setString(strRecordName); if (this.seek(DBConstants.EQUALS)) return this.makeContactRecord(recordOwner); } catch (DBException ex) { this.setKeyArea(iOldKeyArea); } return null; }
java
public Record makeRecordFromRecordName(String strRecordName, RecordOwner recordOwner) { int iOldKeyArea = this.getDefaultOrder(); try { this.addNew(); this.setKeyArea(ContactType.CODE_KEY); this.getField(ContactType.CODE).setString(strRecordName); if (this.seek(DBConstants.EQUALS)) return this.makeContactRecord(recordOwner); } catch (DBException ex) { this.setKeyArea(iOldKeyArea); } return null; }
[ "public", "Record", "makeRecordFromRecordName", "(", "String", "strRecordName", ",", "RecordOwner", "recordOwner", ")", "{", "int", "iOldKeyArea", "=", "this", ".", "getDefaultOrder", "(", ")", ";", "try", "{", "this", ".", "addNew", "(", ")", ";", "this", ".", "setKeyArea", "(", "ContactType", ".", "CODE_KEY", ")", ";", "this", ".", "getField", "(", "ContactType", ".", "CODE", ")", ".", "setString", "(", "strRecordName", ")", ";", "if", "(", "this", ".", "seek", "(", "DBConstants", ".", "EQUALS", ")", ")", "return", "this", ".", "makeContactRecord", "(", "recordOwner", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "this", ".", "setKeyArea", "(", "iOldKeyArea", ")", ";", "}", "return", "null", ";", "}" ]
MakeRecordFromRecordName Method.
[ "MakeRecordFromRecordName", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/base/ContactType.java#L183-L196
151,237
jbundle/jbundle
main/db/src/main/java/org/jbundle/main/db/base/ContactType.java
ContactType.makeContactRecord
public Record makeContactRecord(RecordOwner recordOwner) { String strRecordClass = this.getField(ContactType.RECORD_CLASS).toString(); return Record.makeRecordFromClassName(strRecordClass, recordOwner, true, false); }
java
public Record makeContactRecord(RecordOwner recordOwner) { String strRecordClass = this.getField(ContactType.RECORD_CLASS).toString(); return Record.makeRecordFromClassName(strRecordClass, recordOwner, true, false); }
[ "public", "Record", "makeContactRecord", "(", "RecordOwner", "recordOwner", ")", "{", "String", "strRecordClass", "=", "this", ".", "getField", "(", "ContactType", ".", "RECORD_CLASS", ")", ".", "toString", "(", ")", ";", "return", "Record", ".", "makeRecordFromClassName", "(", "strRecordClass", ",", "recordOwner", ",", "true", ",", "false", ")", ";", "}" ]
MakeContactRecord Method.
[ "MakeContactRecord", "Method", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/db/src/main/java/org/jbundle/main/db/base/ContactType.java#L200-L204
151,238
jbundle/jbundle
main/msg/src/main/java/org/jbundle/main/msg/db/MessageTransport.java
MessageTransport.isDirectTransport
public static boolean isDirectTransport(String strTransportCode) { if ((MessageTransport.DIRECT.equalsIgnoreCase(strTransportCode)) || (MessageTransport.SERVER.equalsIgnoreCase(strTransportCode)) || (MessageTransport.CLIENT.equalsIgnoreCase(strTransportCode))) return true; // These are the direct types return false; // The others are not direct }
java
public static boolean isDirectTransport(String strTransportCode) { if ((MessageTransport.DIRECT.equalsIgnoreCase(strTransportCode)) || (MessageTransport.SERVER.equalsIgnoreCase(strTransportCode)) || (MessageTransport.CLIENT.equalsIgnoreCase(strTransportCode))) return true; // These are the direct types return false; // The others are not direct }
[ "public", "static", "boolean", "isDirectTransport", "(", "String", "strTransportCode", ")", "{", "if", "(", "(", "MessageTransport", ".", "DIRECT", ".", "equalsIgnoreCase", "(", "strTransportCode", ")", ")", "||", "(", "MessageTransport", ".", "SERVER", ".", "equalsIgnoreCase", "(", "strTransportCode", ")", ")", "||", "(", "MessageTransport", ".", "CLIENT", ".", "equalsIgnoreCase", "(", "strTransportCode", ")", ")", ")", "return", "true", ";", "// These are the direct types", "return", "false", ";", "// The others are not direct", "}" ]
Is this transport code a direct type?.
[ "Is", "this", "transport", "code", "a", "direct", "type?", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageTransport.java#L208-L215
151,239
jbundle/jbundle
main/msg/src/main/java/org/jbundle/main/msg/db/MessageTransport.java
MessageTransport.createMessageTransport
public Object createMessageTransport(String messageTransportType, Task task) { MessageTransport messageTransport = this.getMessageTransport(messageTransportType); String className = null; if (messageTransport != null) className = ((PropertiesField)messageTransport.getField(MessageTransport.PROPERTIES)).getProperty("className"); if (className == null) { String packageName = BaseMessageTransport.class.getPackage().getName(); className = packageName + '.' + messageTransportType.toLowerCase() + '.' + messageTransportType + "MessageTransport"; } BaseMessageTransport transport = (BaseMessageTransport)ClassServiceUtility.getClassService().makeObjectFromClassName(className); if (transport != null) transport.init(task, null, null); return transport; }
java
public Object createMessageTransport(String messageTransportType, Task task) { MessageTransport messageTransport = this.getMessageTransport(messageTransportType); String className = null; if (messageTransport != null) className = ((PropertiesField)messageTransport.getField(MessageTransport.PROPERTIES)).getProperty("className"); if (className == null) { String packageName = BaseMessageTransport.class.getPackage().getName(); className = packageName + '.' + messageTransportType.toLowerCase() + '.' + messageTransportType + "MessageTransport"; } BaseMessageTransport transport = (BaseMessageTransport)ClassServiceUtility.getClassService().makeObjectFromClassName(className); if (transport != null) transport.init(task, null, null); return transport; }
[ "public", "Object", "createMessageTransport", "(", "String", "messageTransportType", ",", "Task", "task", ")", "{", "MessageTransport", "messageTransport", "=", "this", ".", "getMessageTransport", "(", "messageTransportType", ")", ";", "String", "className", "=", "null", ";", "if", "(", "messageTransport", "!=", "null", ")", "className", "=", "(", "(", "PropertiesField", ")", "messageTransport", ".", "getField", "(", "MessageTransport", ".", "PROPERTIES", ")", ")", ".", "getProperty", "(", "\"className\"", ")", ";", "if", "(", "className", "==", "null", ")", "{", "String", "packageName", "=", "BaseMessageTransport", ".", "class", ".", "getPackage", "(", ")", ".", "getName", "(", ")", ";", "className", "=", "packageName", "+", "'", "'", "+", "messageTransportType", ".", "toLowerCase", "(", ")", "+", "'", "'", "+", "messageTransportType", "+", "\"MessageTransport\"", ";", "}", "BaseMessageTransport", "transport", "=", "(", "BaseMessageTransport", ")", "ClassServiceUtility", ".", "getClassService", "(", ")", ".", "makeObjectFromClassName", "(", "className", ")", ";", "if", "(", "transport", "!=", "null", ")", "transport", ".", "init", "(", "task", ",", "null", ",", "null", ")", ";", "return", "transport", ";", "}" ]
Get the message transport for this type @param messageTransportType @returns The concrete BaseMessageTransport implementation.
[ "Get", "the", "message", "transport", "for", "this", "type" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/main/msg/src/main/java/org/jbundle/main/msg/db/MessageTransport.java#L221-L237
151,240
99soft/sameas4j
src/main/java/org/nnsoft/sameas4j/SameAsServiceImpl.java
SameAsServiceImpl.invokeURL
private <T> T invokeURL(String toBeInvoked, Class<T> returnType) throws SameAsServiceException { URL url; try { url = new URL(toBeInvoked); } catch (MalformedURLException e) { throw new SameAsServiceException("An error occurred while building the URL '" + toBeInvoked + "'"); } URLConnection connection = null; Reader reader = null; if (this.cache != null) { lock.lock(); } try { connection = url.openConnection(); long lastModified = connection.getLastModified(); if (this.cache != null) { CacheKey cacheKey = new CacheKey(toBeInvoked, lastModified); T cached = this.cache.get(cacheKey, returnType); if (cached != null) { return cached; } } if (connection instanceof HttpURLConnection) { ((HttpURLConnection) connection).connect(); } reader = new InputStreamReader(connection.getInputStream()); Gson gson = this.gsonBuilder.create(); T response = gson.fromJson(reader, returnType); if (this.cache != null) { CacheKey cacheKey = new CacheKey(toBeInvoked, lastModified); this.cache.put(cacheKey, response); } return response; } catch (IOException e) { throw new SameAsServiceException(format("An error occurred while invoking the URL '%s': %s", toBeInvoked, e.getMessage())); } catch (JsonParseException e) { throw new SameAsServiceException("An error occurred while parsing the JSON response", e); } finally { if (this.cache != null) { lock.unlock(); } if (connection != null && connection instanceof HttpURLConnection) { ((HttpURLConnection) connection).disconnect(); } if (reader != null) { try { reader.close(); } catch (IOException e) { // close it quietly } } } }
java
private <T> T invokeURL(String toBeInvoked, Class<T> returnType) throws SameAsServiceException { URL url; try { url = new URL(toBeInvoked); } catch (MalformedURLException e) { throw new SameAsServiceException("An error occurred while building the URL '" + toBeInvoked + "'"); } URLConnection connection = null; Reader reader = null; if (this.cache != null) { lock.lock(); } try { connection = url.openConnection(); long lastModified = connection.getLastModified(); if (this.cache != null) { CacheKey cacheKey = new CacheKey(toBeInvoked, lastModified); T cached = this.cache.get(cacheKey, returnType); if (cached != null) { return cached; } } if (connection instanceof HttpURLConnection) { ((HttpURLConnection) connection).connect(); } reader = new InputStreamReader(connection.getInputStream()); Gson gson = this.gsonBuilder.create(); T response = gson.fromJson(reader, returnType); if (this.cache != null) { CacheKey cacheKey = new CacheKey(toBeInvoked, lastModified); this.cache.put(cacheKey, response); } return response; } catch (IOException e) { throw new SameAsServiceException(format("An error occurred while invoking the URL '%s': %s", toBeInvoked, e.getMessage())); } catch (JsonParseException e) { throw new SameAsServiceException("An error occurred while parsing the JSON response", e); } finally { if (this.cache != null) { lock.unlock(); } if (connection != null && connection instanceof HttpURLConnection) { ((HttpURLConnection) connection).disconnect(); } if (reader != null) { try { reader.close(); } catch (IOException e) { // close it quietly } } } }
[ "private", "<", "T", ">", "T", "invokeURL", "(", "String", "toBeInvoked", ",", "Class", "<", "T", ">", "returnType", ")", "throws", "SameAsServiceException", "{", "URL", "url", ";", "try", "{", "url", "=", "new", "URL", "(", "toBeInvoked", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "throw", "new", "SameAsServiceException", "(", "\"An error occurred while building the URL '\"", "+", "toBeInvoked", "+", "\"'\"", ")", ";", "}", "URLConnection", "connection", "=", "null", ";", "Reader", "reader", "=", "null", ";", "if", "(", "this", ".", "cache", "!=", "null", ")", "{", "lock", ".", "lock", "(", ")", ";", "}", "try", "{", "connection", "=", "url", ".", "openConnection", "(", ")", ";", "long", "lastModified", "=", "connection", ".", "getLastModified", "(", ")", ";", "if", "(", "this", ".", "cache", "!=", "null", ")", "{", "CacheKey", "cacheKey", "=", "new", "CacheKey", "(", "toBeInvoked", ",", "lastModified", ")", ";", "T", "cached", "=", "this", ".", "cache", ".", "get", "(", "cacheKey", ",", "returnType", ")", ";", "if", "(", "cached", "!=", "null", ")", "{", "return", "cached", ";", "}", "}", "if", "(", "connection", "instanceof", "HttpURLConnection", ")", "{", "(", "(", "HttpURLConnection", ")", "connection", ")", ".", "connect", "(", ")", ";", "}", "reader", "=", "new", "InputStreamReader", "(", "connection", ".", "getInputStream", "(", ")", ")", ";", "Gson", "gson", "=", "this", ".", "gsonBuilder", ".", "create", "(", ")", ";", "T", "response", "=", "gson", ".", "fromJson", "(", "reader", ",", "returnType", ")", ";", "if", "(", "this", ".", "cache", "!=", "null", ")", "{", "CacheKey", "cacheKey", "=", "new", "CacheKey", "(", "toBeInvoked", ",", "lastModified", ")", ";", "this", ".", "cache", ".", "put", "(", "cacheKey", ",", "response", ")", ";", "}", "return", "response", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "SameAsServiceException", "(", "format", "(", "\"An error occurred while invoking the URL '%s': %s\"", ",", "toBeInvoked", ",", "e", ".", "getMessage", "(", ")", ")", ")", ";", "}", "catch", "(", "JsonParseException", "e", ")", "{", "throw", "new", "SameAsServiceException", "(", "\"An error occurred while parsing the JSON response\"", ",", "e", ")", ";", "}", "finally", "{", "if", "(", "this", ".", "cache", "!=", "null", ")", "{", "lock", ".", "unlock", "(", ")", ";", "}", "if", "(", "connection", "!=", "null", "&&", "connection", "instanceof", "HttpURLConnection", ")", "{", "(", "(", "HttpURLConnection", ")", "connection", ")", ".", "disconnect", "(", ")", ";", "}", "if", "(", "reader", "!=", "null", ")", "{", "try", "{", "reader", ".", "close", "(", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "// close it quietly", "}", "}", "}", "}" ]
Invokes a Sameas.org service URL and parses the JSON response. @param <T> the expected return type. @param toBeInvoked the service URL has to be invoked. @param returnType the type the JSON response has to be bind to. @return the bound object. @throws SameAsServiceException is any error occurs.
[ "Invokes", "a", "Sameas", ".", "org", "service", "URL", "and", "parses", "the", "JSON", "response", "." ]
d6fcb6a137c5a80278001a6d11ee917be4f5ea41
https://github.com/99soft/sameas4j/blob/d6fcb6a137c5a80278001a6d11ee917be4f5ea41/src/main/java/org/nnsoft/sameas4j/SameAsServiceImpl.java#L111-L176
151,241
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseScreen.java
JBaseScreen.disconnectControls
public void disconnectControls(FieldList fieldList) { if (fieldList == null) { // Disconnect controls from all fieldlists for (int i = 0; ; i++) { // Step 1 - Disconnect the controls from the fields fieldList = this.getFieldList(i); if (fieldList == null) break; this.disconnectControls(fieldList); } } else { // Step 1 - Disconnect the controls from the fields for (int iFieldSeq = 0; iFieldSeq < fieldList.getFieldCount(); iFieldSeq++) { FieldInfo field = fieldList.getField(iFieldSeq); Component component = null; int iIndex = 0; while ((component = (Component)field.getComponent(iIndex)) != null) { if ((component.getParent() == null) || (this.isAncestorOf(component))) { if (component instanceof Freeable) ((Freeable)component).free(); field.removeComponent(component); // No need to change the index } else iIndex++; // Skip this one } } } }
java
public void disconnectControls(FieldList fieldList) { if (fieldList == null) { // Disconnect controls from all fieldlists for (int i = 0; ; i++) { // Step 1 - Disconnect the controls from the fields fieldList = this.getFieldList(i); if (fieldList == null) break; this.disconnectControls(fieldList); } } else { // Step 1 - Disconnect the controls from the fields for (int iFieldSeq = 0; iFieldSeq < fieldList.getFieldCount(); iFieldSeq++) { FieldInfo field = fieldList.getField(iFieldSeq); Component component = null; int iIndex = 0; while ((component = (Component)field.getComponent(iIndex)) != null) { if ((component.getParent() == null) || (this.isAncestorOf(component))) { if (component instanceof Freeable) ((Freeable)component).free(); field.removeComponent(component); // No need to change the index } else iIndex++; // Skip this one } } } }
[ "public", "void", "disconnectControls", "(", "FieldList", "fieldList", ")", "{", "if", "(", "fieldList", "==", "null", ")", "{", "// Disconnect controls from all fieldlists", "for", "(", "int", "i", "=", "0", ";", ";", "i", "++", ")", "{", "// Step 1 - Disconnect the controls from the fields", "fieldList", "=", "this", ".", "getFieldList", "(", "i", ")", ";", "if", "(", "fieldList", "==", "null", ")", "break", ";", "this", ".", "disconnectControls", "(", "fieldList", ")", ";", "}", "}", "else", "{", "// Step 1 - Disconnect the controls from the fields", "for", "(", "int", "iFieldSeq", "=", "0", ";", "iFieldSeq", "<", "fieldList", ".", "getFieldCount", "(", ")", ";", "iFieldSeq", "++", ")", "{", "FieldInfo", "field", "=", "fieldList", ".", "getField", "(", "iFieldSeq", ")", ";", "Component", "component", "=", "null", ";", "int", "iIndex", "=", "0", ";", "while", "(", "(", "component", "=", "(", "Component", ")", "field", ".", "getComponent", "(", "iIndex", ")", ")", "!=", "null", ")", "{", "if", "(", "(", "component", ".", "getParent", "(", ")", "==", "null", ")", "||", "(", "this", ".", "isAncestorOf", "(", "component", ")", ")", ")", "{", "if", "(", "component", "instanceof", "Freeable", ")", "(", "(", "Freeable", ")", "component", ")", ".", "free", "(", ")", ";", "field", ".", "removeComponent", "(", "component", ")", ";", "// No need to change the index", "}", "else", "iIndex", "++", ";", "// Skip this one", "}", "}", "}", "}" ]
Go through all the fields in this record and remove all their components. Free the component if they are freeable. @param fieldList The record to remove the field component references from.
[ "Go", "through", "all", "the", "fields", "in", "this", "record", "and", "remove", "all", "their", "components", ".", "Free", "the", "component", "if", "they", "are", "freeable", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseScreen.java#L223-L256
151,242
jbundle/jbundle
thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseScreen.java
JBaseScreen.doAction
public boolean doAction(String strAction, int iOptions) { if (strAction == Constants.SUBMIT) { this.controlsToFields(); // Move screen data to record } else if (strAction == Constants.RESET) { this.resetFields(); } return super.doAction(strAction, iOptions); }
java
public boolean doAction(String strAction, int iOptions) { if (strAction == Constants.SUBMIT) { this.controlsToFields(); // Move screen data to record } else if (strAction == Constants.RESET) { this.resetFields(); } return super.doAction(strAction, iOptions); }
[ "public", "boolean", "doAction", "(", "String", "strAction", ",", "int", "iOptions", ")", "{", "if", "(", "strAction", "==", "Constants", ".", "SUBMIT", ")", "{", "this", ".", "controlsToFields", "(", ")", ";", "// Move screen data to record", "}", "else", "if", "(", "strAction", "==", "Constants", ".", "RESET", ")", "{", "this", ".", "resetFields", "(", ")", ";", "}", "return", "super", ".", "doAction", "(", "strAction", ",", "iOptions", ")", ";", "}" ]
Process this action. This class calls controltofields on submit and resetfields on reset. @param strAction The message or command to propagate.
[ "Process", "this", "action", ".", "This", "class", "calls", "controltofields", "on", "submit", "and", "resetfields", "on", "reset", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/screen/src/main/java/org/jbundle/thin/base/screen/JBaseScreen.java#L291-L302
151,243
FrodeRanders/java-vopn
src/main/java/org/gautelis/vopn/lang/DynamicLoader.java
DynamicLoader.createObject
public C createObject(String className, Class clazz) throws ClassNotFoundException { return createObject(className, clazz, /* no dynamic init */ null); }
java
public C createObject(String className, Class clazz) throws ClassNotFoundException { return createObject(className, clazz, /* no dynamic init */ null); }
[ "public", "C", "createObject", "(", "String", "className", ",", "Class", "clazz", ")", "throws", "ClassNotFoundException", "{", "return", "createObject", "(", "className", ",", "clazz", ",", "/* no dynamic init */", "null", ")", ";", "}" ]
Creates an instance from a Class. @param className name of class -- used for logging purposes and nothing else. @param clazz the class template from which an object is wrought. @throws ClassNotFoundException if class could not be found.
[ "Creates", "an", "instance", "from", "a", "Class", "." ]
4c7b2f90201327af4eaa3cd46b3fee68f864e5cc
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/lang/DynamicLoader.java#L329-L331
151,244
FrodeRanders/java-vopn
src/main/java/org/gautelis/vopn/lang/DynamicLoader.java
DynamicLoader.createMethod
public Method createMethod(C object, String methodName, Class[] parameterTypes) throws NoSuchMethodException { Class clazz = object.getClass(); try { @SuppressWarnings("unchecked") Method method = clazz.getMethod(methodName, parameterTypes); return method; } catch (NoSuchMethodException nsme) { String info = "The specified class " + clazz.getName(); info += " does not have a method \"" + methodName + "\" as expected: "; info += nsme.getMessage(); throw new NoSuchMethodException(info); } }
java
public Method createMethod(C object, String methodName, Class[] parameterTypes) throws NoSuchMethodException { Class clazz = object.getClass(); try { @SuppressWarnings("unchecked") Method method = clazz.getMethod(methodName, parameterTypes); return method; } catch (NoSuchMethodException nsme) { String info = "The specified class " + clazz.getName(); info += " does not have a method \"" + methodName + "\" as expected: "; info += nsme.getMessage(); throw new NoSuchMethodException(info); } }
[ "public", "Method", "createMethod", "(", "C", "object", ",", "String", "methodName", ",", "Class", "[", "]", "parameterTypes", ")", "throws", "NoSuchMethodException", "{", "Class", "clazz", "=", "object", ".", "getClass", "(", ")", ";", "try", "{", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "Method", "method", "=", "clazz", ".", "getMethod", "(", "methodName", ",", "parameterTypes", ")", ";", "return", "method", ";", "}", "catch", "(", "NoSuchMethodException", "nsme", ")", "{", "String", "info", "=", "\"The specified class \"", "+", "clazz", ".", "getName", "(", ")", ";", "info", "+=", "\" does not have a method \\\"\"", "+", "methodName", "+", "\"\\\" as expected: \"", ";", "info", "+=", "nsme", ".", "getMessage", "(", ")", ";", "throw", "new", "NoSuchMethodException", "(", "info", ")", ";", "}", "}" ]
Creates a method for a class. @param object the object to which the method belongs. @param methodName name of method. @param parameterTypes an array of parameter types for the method. @throws NoSuchMethodException if method is not found on object.
[ "Creates", "a", "method", "for", "a", "class", "." ]
4c7b2f90201327af4eaa3cd46b3fee68f864e5cc
https://github.com/FrodeRanders/java-vopn/blob/4c7b2f90201327af4eaa3cd46b3fee68f864e5cc/src/main/java/org/gautelis/vopn/lang/DynamicLoader.java#L340-L354
151,245
caspervg/SC4D-LEX4J
lex4j/src/main/java/net/caspervg/lex4j/route/SearchRoute.java
SearchRoute.addFilter
public void addFilter(Filter filter, Object value) { if (filter.getParameterClass().isInstance(value)) { parameters.put(filter.repr(), value); } else { String msg = "You need to supply the correct parameter for the " + filter + " filter. Expecting a(n) " + filter.getParameterClass().getSimpleName(); throw new FilterParameterException(msg); } }
java
public void addFilter(Filter filter, Object value) { if (filter.getParameterClass().isInstance(value)) { parameters.put(filter.repr(), value); } else { String msg = "You need to supply the correct parameter for the " + filter + " filter. Expecting a(n) " + filter.getParameterClass().getSimpleName(); throw new FilterParameterException(msg); } }
[ "public", "void", "addFilter", "(", "Filter", "filter", ",", "Object", "value", ")", "{", "if", "(", "filter", ".", "getParameterClass", "(", ")", ".", "isInstance", "(", "value", ")", ")", "{", "parameters", ".", "put", "(", "filter", ".", "repr", "(", ")", ",", "value", ")", ";", "}", "else", "{", "String", "msg", "=", "\"You need to supply the correct parameter for the \"", "+", "filter", "+", "\" filter. Expecting a(n) \"", "+", "filter", ".", "getParameterClass", "(", ")", ".", "getSimpleName", "(", ")", ";", "throw", "new", "FilterParameterException", "(", "msg", ")", ";", "}", "}" ]
Adds a parameter to the search operation @param filter the filter to be added @param value value of the filter to be added. String.valueOf() of this Object is used for the search.
[ "Adds", "a", "parameter", "to", "the", "search", "operation" ]
3d086ec70c817119a88573c2e23af27276cdb1d6
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/SearchRoute.java#L45-L53
151,246
caspervg/SC4D-LEX4J
lex4j/src/main/java/net/caspervg/lex4j/route/SearchRoute.java
SearchRoute.doSearch
public List<Lot> doSearch(ExtraLotInfo extras) { ClientResource resource = new ClientResource(Route.SEARCH.url()); Route.handleExtraInfo(resource, extras, auth); Route.addParameters(resource.getReference(), this.parameters); try { Representation repr = resource.get(); return new ObjectMapper().readValue(repr.getText(), new TypeReference<List<Lot>>() {}); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve search results correctly!"); return null; } }
java
public List<Lot> doSearch(ExtraLotInfo extras) { ClientResource resource = new ClientResource(Route.SEARCH.url()); Route.handleExtraInfo(resource, extras, auth); Route.addParameters(resource.getReference(), this.parameters); try { Representation repr = resource.get(); return new ObjectMapper().readValue(repr.getText(), new TypeReference<List<Lot>>() {}); } catch (IOException ex) { LEX4JLogger.log(Level.WARNING, "Could not retrieve search results correctly!"); return null; } }
[ "public", "List", "<", "Lot", ">", "doSearch", "(", "ExtraLotInfo", "extras", ")", "{", "ClientResource", "resource", "=", "new", "ClientResource", "(", "Route", ".", "SEARCH", ".", "url", "(", ")", ")", ";", "Route", ".", "handleExtraInfo", "(", "resource", ",", "extras", ",", "auth", ")", ";", "Route", ".", "addParameters", "(", "resource", ".", "getReference", "(", ")", ",", "this", ".", "parameters", ")", ";", "try", "{", "Representation", "repr", "=", "resource", ".", "get", "(", ")", ";", "return", "new", "ObjectMapper", "(", ")", ".", "readValue", "(", "repr", ".", "getText", "(", ")", ",", "new", "TypeReference", "<", "List", "<", "Lot", ">", ">", "(", ")", "{", "}", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "LEX4JLogger", ".", "log", "(", "Level", ".", "WARNING", ",", "\"Could not retrieve search results correctly!\"", ")", ";", "return", "null", ";", "}", "}" ]
Performs the search operation based on filters that are currently active. @param extras Which extra lot information should be included in each search result @return the lots/files that were returned by the search operation @see ExtraLotInfo
[ "Performs", "the", "search", "operation", "based", "on", "filters", "that", "are", "currently", "active", "." ]
3d086ec70c817119a88573c2e23af27276cdb1d6
https://github.com/caspervg/SC4D-LEX4J/blob/3d086ec70c817119a88573c2e23af27276cdb1d6/lex4j/src/main/java/net/caspervg/lex4j/route/SearchRoute.java#L89-L101
151,247
tvesalainen/util
util/src/main/java/org/vesalainen/util/fi/StringParser.java
StringParser.skipped
public String skipped() { int start = 0; if (stack.size() > 1) { start = stack.get(stack.size() - 2).end(); } int end = stack.get(stack.size() - 1).start(); return text.subSequence(start, end).toString(); }
java
public String skipped() { int start = 0; if (stack.size() > 1) { start = stack.get(stack.size() - 2).end(); } int end = stack.get(stack.size() - 1).start(); return text.subSequence(start, end).toString(); }
[ "public", "String", "skipped", "(", ")", "{", "int", "start", "=", "0", ";", "if", "(", "stack", ".", "size", "(", ")", ">", "1", ")", "{", "start", "=", "stack", ".", "get", "(", "stack", ".", "size", "(", ")", "-", "2", ")", ".", "end", "(", ")", ";", "}", "int", "end", "=", "stack", ".", "get", "(", "stack", ".", "size", "(", ")", "-", "1", ")", ".", "start", "(", ")", ";", "return", "text", ".", "subSequence", "(", "start", ",", "end", ")", ".", "toString", "(", ")", ";", "}" ]
Returns the skipped text after successfull call to find @return
[ "Returns", "the", "skipped", "text", "after", "successfull", "call", "to", "find" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/fi/StringParser.java#L111-L120
151,248
tsweets/jdefault
src/main/java/org/beer30/jdefault/JDefaultLorem.java
JDefaultLorem.paragraph
public static String paragraph(int sentenceCount, boolean supplemental, int randomSentencesToAdd) { String paragraphString = sentences(sentenceCount + RandomUtils.nextInt(randomSentencesToAdd), supplemental); return paragraphString; }
java
public static String paragraph(int sentenceCount, boolean supplemental, int randomSentencesToAdd) { String paragraphString = sentences(sentenceCount + RandomUtils.nextInt(randomSentencesToAdd), supplemental); return paragraphString; }
[ "public", "static", "String", "paragraph", "(", "int", "sentenceCount", ",", "boolean", "supplemental", ",", "int", "randomSentencesToAdd", ")", "{", "String", "paragraphString", "=", "sentences", "(", "sentenceCount", "+", "RandomUtils", ".", "nextInt", "(", "randomSentencesToAdd", ")", ",", "supplemental", ")", ";", "return", "paragraphString", ";", "}" ]
random lorem paragraph @param sentenceCount min number of sentences @param supplemental if true add additional words @param randomSentencesToAdd max random number of sentences to add @return paragraph string
[ "random", "lorem", "paragraph" ]
1793ab8e1337e930f31e362071db4af0c3978b70
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultLorem.java#L72-L76
151,249
tsweets/jdefault
src/main/java/org/beer30/jdefault/JDefaultLorem.java
JDefaultLorem.words
public static List<String> words(int count, boolean supplemental) { List<String> words = new ArrayList<String>(); for (int i = 0; i < count; i++) { String wordString = word(); if (supplemental) { wordString = wordString + fetchString("lorem.supplemental"); } words.add(wordString); } return words; }
java
public static List<String> words(int count, boolean supplemental) { List<String> words = new ArrayList<String>(); for (int i = 0; i < count; i++) { String wordString = word(); if (supplemental) { wordString = wordString + fetchString("lorem.supplemental"); } words.add(wordString); } return words; }
[ "public", "static", "List", "<", "String", ">", "words", "(", "int", "count", ",", "boolean", "supplemental", ")", "{", "List", "<", "String", ">", "words", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "String", "wordString", "=", "word", "(", ")", ";", "if", "(", "supplemental", ")", "{", "wordString", "=", "wordString", "+", "fetchString", "(", "\"lorem.supplemental\"", ")", ";", "}", "words", ".", "add", "(", "wordString", ")", ";", "}", "return", "words", ";", "}" ]
generate a list of random words @param count of words to add to the list @param supplemental if true add additional word to each word @return word list
[ "generate", "a", "list", "of", "random", "words" ]
1793ab8e1337e930f31e362071db4af0c3978b70
https://github.com/tsweets/jdefault/blob/1793ab8e1337e930f31e362071db4af0c3978b70/src/main/java/org/beer30/jdefault/JDefaultLorem.java#L181-L192
151,250
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.getOwner
public static final String getOwner(Path file) throws IOException { if (supports("posix")) { UserPrincipal owner = (UserPrincipal) Files.getAttribute(file, "posix:owner"); return owner.getName(); } else { JavaLogging.getLogger(PosixHelp.class).warning("no owner support. getOwner(%s) returns \"\"", file); return ""; } }
java
public static final String getOwner(Path file) throws IOException { if (supports("posix")) { UserPrincipal owner = (UserPrincipal) Files.getAttribute(file, "posix:owner"); return owner.getName(); } else { JavaLogging.getLogger(PosixHelp.class).warning("no owner support. getOwner(%s) returns \"\"", file); return ""; } }
[ "public", "static", "final", "String", "getOwner", "(", "Path", "file", ")", "throws", "IOException", "{", "if", "(", "supports", "(", "\"posix\"", ")", ")", "{", "UserPrincipal", "owner", "=", "(", "UserPrincipal", ")", "Files", ".", "getAttribute", "(", "file", ",", "\"posix:owner\"", ")", ";", "return", "owner", ".", "getName", "(", ")", ";", "}", "else", "{", "JavaLogging", ".", "getLogger", "(", "PosixHelp", ".", "class", ")", ".", "warning", "(", "\"no owner support. getOwner(%s) returns \\\"\\\"\"", ",", "file", ")", ";", "return", "\"\"", ";", "}", "}" ]
Return linux file owner name. Or "" @param file @return @throws IOException
[ "Return", "linux", "file", "owner", "name", ".", "Or" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L92-L104
151,251
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.getGroup
public static final String getGroup(Path file) throws IOException { if (supports("posix")) { PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class); PosixFileAttributes attrs = view.readAttributes(); GroupPrincipal group = attrs.group(); return group.getName(); } else { JavaLogging.getLogger(PosixHelp.class).warning("no posix support. getGroup(%s) returns \"\"", file); return ""; } }
java
public static final String getGroup(Path file) throws IOException { if (supports("posix")) { PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class); PosixFileAttributes attrs = view.readAttributes(); GroupPrincipal group = attrs.group(); return group.getName(); } else { JavaLogging.getLogger(PosixHelp.class).warning("no posix support. getGroup(%s) returns \"\"", file); return ""; } }
[ "public", "static", "final", "String", "getGroup", "(", "Path", "file", ")", "throws", "IOException", "{", "if", "(", "supports", "(", "\"posix\"", ")", ")", "{", "PosixFileAttributeView", "view", "=", "Files", ".", "getFileAttributeView", "(", "file", ",", "PosixFileAttributeView", ".", "class", ")", ";", "PosixFileAttributes", "attrs", "=", "view", ".", "readAttributes", "(", ")", ";", "GroupPrincipal", "group", "=", "attrs", ".", "group", "(", ")", ";", "return", "group", ".", "getName", "(", ")", ";", "}", "else", "{", "JavaLogging", ".", "getLogger", "(", "PosixHelp", ".", "class", ")", ".", "warning", "(", "\"no posix support. getGroup(%s) returns \\\"\\\"\"", ",", "file", ")", ";", "return", "\"\"", ";", "}", "}" ]
Return linux file group name. Or "" @param file @return @throws IOException
[ "Return", "linux", "file", "group", "name", ".", "Or" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L111-L125
151,252
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.permsPart
private static String permsPart(String perms) { int length = perms.length(); if (length > 10 || length < 9) { throw new IllegalArgumentException(perms+" not permission. E.g. -rwxr--r--"); } return length == 10 ? perms.substring(1) : perms; }
java
private static String permsPart(String perms) { int length = perms.length(); if (length > 10 || length < 9) { throw new IllegalArgumentException(perms+" not permission. E.g. -rwxr--r--"); } return length == 10 ? perms.substring(1) : perms; }
[ "private", "static", "String", "permsPart", "(", "String", "perms", ")", "{", "int", "length", "=", "perms", ".", "length", "(", ")", ";", "if", "(", "length", ">", "10", "||", "length", "<", "9", ")", "{", "throw", "new", "IllegalArgumentException", "(", "perms", "+", "\" not permission. E.g. -rwxr--r--\"", ")", ";", "}", "return", "length", "==", "10", "?", "perms", ".", "substring", "(", "1", ")", ":", "perms", ";", "}" ]
Returns permission part of mode string @param perms @return
[ "Returns", "permission", "part", "of", "mode", "string" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L131-L139
151,253
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.getModeString
public static final String getModeString(Path path) throws IOException { char letter = getFileTypeLetter(path); if (supports("posix")) { Set<PosixFilePermission> perms = Files.getPosixFilePermissions(path); return letter+PosixFilePermissions.toString(perms); } else { switch (letter) { case '-': return "-rw-r--r--"; case 'd': return "drwxr-xr-x"; case 'l': return "drw-r--r--"; } } throw new UnsupportedOperationException("should not happen"); }
java
public static final String getModeString(Path path) throws IOException { char letter = getFileTypeLetter(path); if (supports("posix")) { Set<PosixFilePermission> perms = Files.getPosixFilePermissions(path); return letter+PosixFilePermissions.toString(perms); } else { switch (letter) { case '-': return "-rw-r--r--"; case 'd': return "drwxr-xr-x"; case 'l': return "drw-r--r--"; } } throw new UnsupportedOperationException("should not happen"); }
[ "public", "static", "final", "String", "getModeString", "(", "Path", "path", ")", "throws", "IOException", "{", "char", "letter", "=", "getFileTypeLetter", "(", "path", ")", ";", "if", "(", "supports", "(", "\"posix\"", ")", ")", "{", "Set", "<", "PosixFilePermission", ">", "perms", "=", "Files", ".", "getPosixFilePermissions", "(", "path", ")", ";", "return", "letter", "+", "PosixFilePermissions", ".", "toString", "(", "perms", ")", ";", "}", "else", "{", "switch", "(", "letter", ")", "{", "case", "'", "'", ":", "return", "\"-rw-r--r--\"", ";", "case", "'", "'", ":", "return", "\"drwxr-xr-x\"", ";", "case", "'", "'", ":", "return", "\"drw-r--r--\"", ";", "}", "}", "throw", "new", "UnsupportedOperationException", "(", "\"should not happen\"", ")", ";", "}" ]
Returns mode string for path. Real mode for linux. Others guess work. @param path @return @throws IOException
[ "Returns", "mode", "string", "for", "path", ".", "Real", "mode", "for", "linux", ".", "Others", "guess", "work", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L146-L167
151,254
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.setGroup
public static final void setGroup(String name, Path... files) throws IOException { if (supports("posix")) { for (Path file : files) { FileSystem fs = file.getFileSystem(); UserPrincipalLookupService upls = fs.getUserPrincipalLookupService(); GroupPrincipal group = upls.lookupPrincipalByGroupName(name); PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class); view.setGroup(group); } } else { JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setGroup(%s)", name); } }
java
public static final void setGroup(String name, Path... files) throws IOException { if (supports("posix")) { for (Path file : files) { FileSystem fs = file.getFileSystem(); UserPrincipalLookupService upls = fs.getUserPrincipalLookupService(); GroupPrincipal group = upls.lookupPrincipalByGroupName(name); PosixFileAttributeView view = Files.getFileAttributeView(file, PosixFileAttributeView.class); view.setGroup(group); } } else { JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setGroup(%s)", name); } }
[ "public", "static", "final", "void", "setGroup", "(", "String", "name", ",", "Path", "...", "files", ")", "throws", "IOException", "{", "if", "(", "supports", "(", "\"posix\"", ")", ")", "{", "for", "(", "Path", "file", ":", "files", ")", "{", "FileSystem", "fs", "=", "file", ".", "getFileSystem", "(", ")", ";", "UserPrincipalLookupService", "upls", "=", "fs", ".", "getUserPrincipalLookupService", "(", ")", ";", "GroupPrincipal", "group", "=", "upls", ".", "lookupPrincipalByGroupName", "(", "name", ")", ";", "PosixFileAttributeView", "view", "=", "Files", ".", "getFileAttributeView", "(", "file", ",", "PosixFileAttributeView", ".", "class", ")", ";", "view", ".", "setGroup", "(", "group", ")", ";", "}", "}", "else", "{", "JavaLogging", ".", "getLogger", "(", "PosixHelp", ".", "class", ")", ".", "warning", "(", "\"no posix support. setGroup(%s)\"", ",", "name", ")", ";", "}", "}" ]
Change group of given files. Works only in linux @param name @param files @throws IOException @see org.vesalainen.util.OSProcess#call(java.lang.String...)
[ "Change", "group", "of", "given", "files", ".", "Works", "only", "in", "linux" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L175-L192
151,255
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.setOwner
public static final void setOwner(String name, Path... files) throws IOException { if (supports("posix")) { for (Path file : files) { FileSystem fs = file.getFileSystem(); UserPrincipalLookupService upls = fs.getUserPrincipalLookupService(); UserPrincipal user = upls.lookupPrincipalByName(name); Files.setOwner(file, user); } } else { JavaLogging.getLogger(PosixHelp.class).warning("no owner support. setOwner(%s)", name); } }
java
public static final void setOwner(String name, Path... files) throws IOException { if (supports("posix")) { for (Path file : files) { FileSystem fs = file.getFileSystem(); UserPrincipalLookupService upls = fs.getUserPrincipalLookupService(); UserPrincipal user = upls.lookupPrincipalByName(name); Files.setOwner(file, user); } } else { JavaLogging.getLogger(PosixHelp.class).warning("no owner support. setOwner(%s)", name); } }
[ "public", "static", "final", "void", "setOwner", "(", "String", "name", ",", "Path", "...", "files", ")", "throws", "IOException", "{", "if", "(", "supports", "(", "\"posix\"", ")", ")", "{", "for", "(", "Path", "file", ":", "files", ")", "{", "FileSystem", "fs", "=", "file", ".", "getFileSystem", "(", ")", ";", "UserPrincipalLookupService", "upls", "=", "fs", ".", "getUserPrincipalLookupService", "(", ")", ";", "UserPrincipal", "user", "=", "upls", ".", "lookupPrincipalByName", "(", "name", ")", ";", "Files", ".", "setOwner", "(", "file", ",", "user", ")", ";", "}", "}", "else", "{", "JavaLogging", ".", "getLogger", "(", "PosixHelp", ".", "class", ")", ".", "warning", "(", "\"no owner support. setOwner(%s)\"", ",", "name", ")", ";", "}", "}" ]
Change user of given files. Works only in linux. @param name @param files @throws IOException @see java.nio.file.Files#setOwner(java.nio.file.Path, java.nio.file.attribute.UserPrincipal)
[ "Change", "user", "of", "given", "files", ".", "Works", "only", "in", "linux", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L200-L216
151,256
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.setPermission
public static final void setPermission(Path path, String perms) throws IOException { checkFileType(path, perms); if (supports("posix")) { Set<PosixFilePermission> posixPerms = PosixFilePermissions.fromString(permsPart(perms)); Files.setPosixFilePermissions(path, posixPerms); } else { JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setPermission(%s, %s)", path, perms); } }
java
public static final void setPermission(Path path, String perms) throws IOException { checkFileType(path, perms); if (supports("posix")) { Set<PosixFilePermission> posixPerms = PosixFilePermissions.fromString(permsPart(perms)); Files.setPosixFilePermissions(path, posixPerms); } else { JavaLogging.getLogger(PosixHelp.class).warning("no posix support. setPermission(%s, %s)", path, perms); } }
[ "public", "static", "final", "void", "setPermission", "(", "Path", "path", ",", "String", "perms", ")", "throws", "IOException", "{", "checkFileType", "(", "path", ",", "perms", ")", ";", "if", "(", "supports", "(", "\"posix\"", ")", ")", "{", "Set", "<", "PosixFilePermission", ">", "posixPerms", "=", "PosixFilePermissions", ".", "fromString", "(", "permsPart", "(", "perms", ")", ")", ";", "Files", ".", "setPosixFilePermissions", "(", "path", ",", "posixPerms", ")", ";", "}", "else", "{", "JavaLogging", ".", "getLogger", "(", "PosixHelp", ".", "class", ")", ".", "warning", "(", "\"no posix support. setPermission(%s, %s)\"", ",", "path", ",", "perms", ")", ";", "}", "}" ]
Set posix permissions if supported. @param path @param perms 10 or 9 length E.g. -rwxr--r-- @throws java.io.IOException
[ "Set", "posix", "permissions", "if", "supported", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L223-L235
151,257
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.checkFileType
public static final void checkFileType(Path path, String perms) { if (perms.length() != 10) { throw new IllegalArgumentException(perms+" not permission. E.g. -rwxr--r--"); } switch (perms.charAt(0)) { case '-': if (!Files.isRegularFile(path)) { throw new IllegalArgumentException("file is not regular file"); } break; case 'd': if (!Files.isDirectory(path)) { throw new IllegalArgumentException("file is not directory"); } break; case 'l': if (!Files.isSymbolicLink(path)) { throw new IllegalArgumentException("file is not symbolic link"); } break; default: throw new UnsupportedOperationException(perms+" not supported"); } }
java
public static final void checkFileType(Path path, String perms) { if (perms.length() != 10) { throw new IllegalArgumentException(perms+" not permission. E.g. -rwxr--r--"); } switch (perms.charAt(0)) { case '-': if (!Files.isRegularFile(path)) { throw new IllegalArgumentException("file is not regular file"); } break; case 'd': if (!Files.isDirectory(path)) { throw new IllegalArgumentException("file is not directory"); } break; case 'l': if (!Files.isSymbolicLink(path)) { throw new IllegalArgumentException("file is not symbolic link"); } break; default: throw new UnsupportedOperationException(perms+" not supported"); } }
[ "public", "static", "final", "void", "checkFileType", "(", "Path", "path", ",", "String", "perms", ")", "{", "if", "(", "perms", ".", "length", "(", ")", "!=", "10", ")", "{", "throw", "new", "IllegalArgumentException", "(", "perms", "+", "\" not permission. E.g. -rwxr--r--\"", ")", ";", "}", "switch", "(", "perms", ".", "charAt", "(", "0", ")", ")", "{", "case", "'", "'", ":", "if", "(", "!", "Files", ".", "isRegularFile", "(", "path", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"file is not regular file\"", ")", ";", "}", "break", ";", "case", "'", "'", ":", "if", "(", "!", "Files", ".", "isDirectory", "(", "path", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"file is not directory\"", ")", ";", "}", "break", ";", "case", "'", "'", ":", "if", "(", "!", "Files", ".", "isSymbolicLink", "(", "path", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"file is not symbolic link\"", ")", ";", "}", "break", ";", "default", ":", "throw", "new", "UnsupportedOperationException", "(", "perms", "+", "\" not supported\"", ")", ";", "}", "}" ]
Throws IllegalArgumentException if perms length != 10 or files type doesn't match with permission. @param path @param perms
[ "Throws", "IllegalArgumentException", "if", "perms", "length", "!", "=", "10", "or", "files", "type", "doesn", "t", "match", "with", "permission", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L242-L271
151,258
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.getFileTypeLetter
public static final char getFileTypeLetter(Path path) { if (Files.isRegularFile(path)) { return '-'; } if (Files.isDirectory(path)) { return 'd'; } if (Files.isSymbolicLink(path)) { return 'l'; } throw new IllegalArgumentException(path+" is either regular file, directory or symbolic link"); }
java
public static final char getFileTypeLetter(Path path) { if (Files.isRegularFile(path)) { return '-'; } if (Files.isDirectory(path)) { return 'd'; } if (Files.isSymbolicLink(path)) { return 'l'; } throw new IllegalArgumentException(path+" is either regular file, directory or symbolic link"); }
[ "public", "static", "final", "char", "getFileTypeLetter", "(", "Path", "path", ")", "{", "if", "(", "Files", ".", "isRegularFile", "(", "path", ")", ")", "{", "return", "'", "'", ";", "}", "if", "(", "Files", ".", "isDirectory", "(", "path", ")", ")", "{", "return", "'", "'", ";", "}", "if", "(", "Files", ".", "isSymbolicLink", "(", "path", ")", ")", "{", "return", "'", "'", ";", "}", "throw", "new", "IllegalArgumentException", "(", "path", "+", "\" is either regular file, directory or symbolic link\"", ")", ";", "}" ]
Returns '-' for regular file, 'd' for directory or 'l' for symbolic link. @param path @return
[ "Returns", "-", "for", "regular", "file", "d", "for", "directory", "or", "l", "for", "symbolic", "link", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L277-L292
151,259
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.create
public static final Path create(Path path, String perms) throws IOException { return create(path, null, perms); }
java
public static final Path create(Path path, String perms) throws IOException { return create(path, null, perms); }
[ "public", "static", "final", "Path", "create", "(", "Path", "path", ",", "String", "perms", ")", "throws", "IOException", "{", "return", "create", "(", "path", ",", "null", ",", "perms", ")", ";", "}" ]
Creates regular file or directory @param path @param perms E.g. -rwxr--r-- @return @throws IOException
[ "Creates", "regular", "file", "or", "directory" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L300-L303
151,260
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.create
public static final Path create(Path path, Path target, String perms) throws IOException { FileAttribute<?>[] attrs = getFileAttributes(perms); switch (perms.charAt(0)) { case '-': return Files.createFile(path, attrs); case 'l': if (target == null) { throw new IllegalArgumentException("no target"); } return Files.createSymbolicLink(path, target, attrs); case 'd': return Files.createDirectories(path, attrs); default: throw new IllegalArgumentException(perms+" illegal to this method"); } }
java
public static final Path create(Path path, Path target, String perms) throws IOException { FileAttribute<?>[] attrs = getFileAttributes(perms); switch (perms.charAt(0)) { case '-': return Files.createFile(path, attrs); case 'l': if (target == null) { throw new IllegalArgumentException("no target"); } return Files.createSymbolicLink(path, target, attrs); case 'd': return Files.createDirectories(path, attrs); default: throw new IllegalArgumentException(perms+" illegal to this method"); } }
[ "public", "static", "final", "Path", "create", "(", "Path", "path", ",", "Path", "target", ",", "String", "perms", ")", "throws", "IOException", "{", "FileAttribute", "<", "?", ">", "[", "]", "attrs", "=", "getFileAttributes", "(", "perms", ")", ";", "switch", "(", "perms", ".", "charAt", "(", "0", ")", ")", "{", "case", "'", "'", ":", "return", "Files", ".", "createFile", "(", "path", ",", "attrs", ")", ";", "case", "'", "'", ":", "if", "(", "target", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"no target\"", ")", ";", "}", "return", "Files", ".", "createSymbolicLink", "(", "path", ",", "target", ",", "attrs", ")", ";", "case", "'", "'", ":", "return", "Files", ".", "createDirectories", "(", "path", ",", "attrs", ")", ";", "default", ":", "throw", "new", "IllegalArgumentException", "(", "perms", "+", "\" illegal to this method\"", ")", ";", "}", "}" ]
Creates regular file, directory or symbolic link @param path @param target Can be null @param perms E.g. -rwxr--r-- @return @throws IOException
[ "Creates", "regular", "file", "directory", "or", "symbolic", "link" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L312-L330
151,261
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.supports
public static final boolean supports(String view) { Set<String> supportedFileAttributeViews = FileSystems.getDefault().supportedFileAttributeViews(); return supportedFileAttributeViews.contains(view); }
java
public static final boolean supports(String view) { Set<String> supportedFileAttributeViews = FileSystems.getDefault().supportedFileAttributeViews(); return supportedFileAttributeViews.contains(view); }
[ "public", "static", "final", "boolean", "supports", "(", "String", "view", ")", "{", "Set", "<", "String", ">", "supportedFileAttributeViews", "=", "FileSystems", ".", "getDefault", "(", ")", ".", "supportedFileAttributeViews", "(", ")", ";", "return", "supportedFileAttributeViews", ".", "contains", "(", "view", ")", ";", "}" ]
Return true if default file system supports given view @param view @return
[ "Return", "true", "if", "default", "file", "system", "supports", "given", "view" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L635-L639
151,262
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.getOwnerAsAttribute
public static final FileAttribute<UserPrincipal> getOwnerAsAttribute(String owner) throws IOException { if (supports("posix")) { UserPrincipalLookupService upls = FileSystems.getDefault().getUserPrincipalLookupService(); UserPrincipal user = upls.lookupPrincipalByName(owner); return new FileAttributeImpl<>("posix:owner", user); } else { return null; } }
java
public static final FileAttribute<UserPrincipal> getOwnerAsAttribute(String owner) throws IOException { if (supports("posix")) { UserPrincipalLookupService upls = FileSystems.getDefault().getUserPrincipalLookupService(); UserPrincipal user = upls.lookupPrincipalByName(owner); return new FileAttributeImpl<>("posix:owner", user); } else { return null; } }
[ "public", "static", "final", "FileAttribute", "<", "UserPrincipal", ">", "getOwnerAsAttribute", "(", "String", "owner", ")", "throws", "IOException", "{", "if", "(", "supports", "(", "\"posix\"", ")", ")", "{", "UserPrincipalLookupService", "upls", "=", "FileSystems", ".", "getDefault", "(", ")", ".", "getUserPrincipalLookupService", "(", ")", ";", "UserPrincipal", "user", "=", "upls", ".", "lookupPrincipalByName", "(", "owner", ")", ";", "return", "new", "FileAttributeImpl", "<>", "(", "\"posix:owner\"", ",", "user", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Return file owner as attribute if posix supported. Otherwise returns null. @param owner @return @throws IOException
[ "Return", "file", "owner", "as", "attribute", "if", "posix", "supported", ".", "Otherwise", "returns", "null", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L646-L658
151,263
tvesalainen/util
util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java
PosixHelp.getGroupAsAttribute
public static final FileAttribute<GroupPrincipal> getGroupAsAttribute(String group) throws IOException { if (supports("posix")) { UserPrincipalLookupService upls = FileSystems.getDefault().getUserPrincipalLookupService(); GroupPrincipal grp = upls.lookupPrincipalByGroupName(group); return new FileAttributeImpl<>("posix:group", grp); } else { return null; } }
java
public static final FileAttribute<GroupPrincipal> getGroupAsAttribute(String group) throws IOException { if (supports("posix")) { UserPrincipalLookupService upls = FileSystems.getDefault().getUserPrincipalLookupService(); GroupPrincipal grp = upls.lookupPrincipalByGroupName(group); return new FileAttributeImpl<>("posix:group", grp); } else { return null; } }
[ "public", "static", "final", "FileAttribute", "<", "GroupPrincipal", ">", "getGroupAsAttribute", "(", "String", "group", ")", "throws", "IOException", "{", "if", "(", "supports", "(", "\"posix\"", ")", ")", "{", "UserPrincipalLookupService", "upls", "=", "FileSystems", ".", "getDefault", "(", ")", ".", "getUserPrincipalLookupService", "(", ")", ";", "GroupPrincipal", "grp", "=", "upls", ".", "lookupPrincipalByGroupName", "(", "group", ")", ";", "return", "new", "FileAttributeImpl", "<>", "(", "\"posix:group\"", ",", "grp", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Return file group as attribute if posix supported. Otherwise returns null. @param group @return @throws IOException
[ "Return", "file", "group", "as", "attribute", "if", "posix", "supported", ".", "Otherwise", "returns", "null", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/file/attribute/PosixHelp.java#L665-L677
151,264
mlhartme/jasmin
src/main/java/net/oneandone/jasmin/model/Engine.java
Engine.request
public int request(String path, HttpServletResponse response, boolean gzip) throws IOException { Content content; byte[] bytes; try { content = doRequest(path); } catch (IOException e) { Servlet.LOG.error("request failed: " + e.getMessage(), e); response.setStatus(500); response.setContentType("text/html"); try (Writer writer = response.getWriter()) { writer.write("<html><body><h1>" + e.getMessage() + "</h1>"); writer.write("<details><br/>"); printException(e, writer); writer.write("</body></html>"); } return -1; } if (gzip) { // see http://cs193h.stevesouders.com and "High Performance Websites", by Steve Souders response.setHeader("Content-Encoding", "gzip"); bytes = content.bytes; } else { bytes = unzip(content.bytes); } response.addHeader("Vary", "Accept-Encoding"); response.setBufferSize(0); response.setContentType(content.mimeType); response.setCharacterEncoding(ENCODING); // TODO: inspect header - does this have an effect? if (content.lastModified != -1) { response.setDateHeader("Last-Modified", content.lastModified); } response.getOutputStream().write(bytes); return bytes.length; }
java
public int request(String path, HttpServletResponse response, boolean gzip) throws IOException { Content content; byte[] bytes; try { content = doRequest(path); } catch (IOException e) { Servlet.LOG.error("request failed: " + e.getMessage(), e); response.setStatus(500); response.setContentType("text/html"); try (Writer writer = response.getWriter()) { writer.write("<html><body><h1>" + e.getMessage() + "</h1>"); writer.write("<details><br/>"); printException(e, writer); writer.write("</body></html>"); } return -1; } if (gzip) { // see http://cs193h.stevesouders.com and "High Performance Websites", by Steve Souders response.setHeader("Content-Encoding", "gzip"); bytes = content.bytes; } else { bytes = unzip(content.bytes); } response.addHeader("Vary", "Accept-Encoding"); response.setBufferSize(0); response.setContentType(content.mimeType); response.setCharacterEncoding(ENCODING); // TODO: inspect header - does this have an effect? if (content.lastModified != -1) { response.setDateHeader("Last-Modified", content.lastModified); } response.getOutputStream().write(bytes); return bytes.length; }
[ "public", "int", "request", "(", "String", "path", ",", "HttpServletResponse", "response", ",", "boolean", "gzip", ")", "throws", "IOException", "{", "Content", "content", ";", "byte", "[", "]", "bytes", ";", "try", "{", "content", "=", "doRequest", "(", "path", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "Servlet", ".", "LOG", ".", "error", "(", "\"request failed: \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "response", ".", "setStatus", "(", "500", ")", ";", "response", ".", "setContentType", "(", "\"text/html\"", ")", ";", "try", "(", "Writer", "writer", "=", "response", ".", "getWriter", "(", ")", ")", "{", "writer", ".", "write", "(", "\"<html><body><h1>\"", "+", "e", ".", "getMessage", "(", ")", "+", "\"</h1>\"", ")", ";", "writer", ".", "write", "(", "\"<details><br/>\"", ")", ";", "printException", "(", "e", ",", "writer", ")", ";", "writer", ".", "write", "(", "\"</body></html>\"", ")", ";", "}", "return", "-", "1", ";", "}", "if", "(", "gzip", ")", "{", "// see http://cs193h.stevesouders.com and \"High Performance Websites\", by Steve Souders", "response", ".", "setHeader", "(", "\"Content-Encoding\"", ",", "\"gzip\"", ")", ";", "bytes", "=", "content", ".", "bytes", ";", "}", "else", "{", "bytes", "=", "unzip", "(", "content", ".", "bytes", ")", ";", "}", "response", ".", "addHeader", "(", "\"Vary\"", ",", "\"Accept-Encoding\"", ")", ";", "response", ".", "setBufferSize", "(", "0", ")", ";", "response", ".", "setContentType", "(", "content", ".", "mimeType", ")", ";", "response", ".", "setCharacterEncoding", "(", "ENCODING", ")", ";", "// TODO: inspect header - does this have an effect?", "if", "(", "content", ".", "lastModified", "!=", "-", "1", ")", "{", "response", ".", "setDateHeader", "(", "\"Last-Modified\"", ",", "content", ".", "lastModified", ")", ";", "}", "response", ".", "getOutputStream", "(", ")", ".", "write", "(", "bytes", ")", ";", "return", "bytes", ".", "length", ";", "}" ]
Output is prepared in-memory before the response is written because a) that's the common case where output is cached. If output is to big for this, that whole caching doesn't work b) I send sent proper error pages c) I can return the number of bytes actually written @return bytes written or -1 if building the module content failed.
[ "Output", "is", "prepared", "in", "-", "memory", "before", "the", "response", "is", "written", "because", "a", ")", "that", "s", "the", "common", "case", "where", "output", "is", "cached", ".", "If", "output", "is", "to", "big", "for", "this", "that", "whole", "caching", "doesn", "t", "work", "b", ")", "I", "send", "sent", "proper", "error", "pages", "c", ")", "I", "can", "return", "the", "number", "of", "bytes", "actually", "written" ]
1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d
https://github.com/mlhartme/jasmin/blob/1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d/src/main/java/net/oneandone/jasmin/model/Engine.java#L88-L122
151,265
mlhartme/jasmin
src/main/java/net/oneandone/jasmin/model/Engine.java
Engine.request
public String request(String path) throws IOException { Content content; content = doRequest(path); return new String(unzip(content.bytes), ENCODING); }
java
public String request(String path) throws IOException { Content content; content = doRequest(path); return new String(unzip(content.bytes), ENCODING); }
[ "public", "String", "request", "(", "String", "path", ")", "throws", "IOException", "{", "Content", "content", ";", "content", "=", "doRequest", "(", "path", ")", ";", "return", "new", "String", "(", "unzip", "(", "content", ".", "bytes", ")", ",", "ENCODING", ")", ";", "}" ]
Convenience method for testing
[ "Convenience", "method", "for", "testing" ]
1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d
https://github.com/mlhartme/jasmin/blob/1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d/src/main/java/net/oneandone/jasmin/model/Engine.java#L139-L144
151,266
mlhartme/jasmin
src/main/java/net/oneandone/jasmin/model/Engine.java
Engine.doComputeUnlimited
private Content doComputeUnlimited(String path, CountDownLatch gate) throws IOException { long startContent; long endContent; ByteArrayOutputStream result; References references; byte[] bytes; String hash; Content content; if (gate.getCount() != 1) { throw new IllegalStateException(path + " " + gate.getCount()); } startContent = System.currentTimeMillis(); try { try { references = repository.resolve(Request.parse(path)); } catch (CyclicDependency e) { throw new RuntimeException(e.toString(), e); } catch (IOException e) { throw new IOException(path + ": " + e.getMessage(), e); } result = new ByteArrayOutputStream(); try (OutputStream dest = new GZIPOutputStream(result); Writer writer = new OutputStreamWriter(dest, ENCODING)) { references.writeTo(writer); } bytes = result.toByteArray(); endContent = System.currentTimeMillis(); hash = hash(bytes); content = new Content(references.type.getMime(), references.getLastModified(), bytes); hashCache.add(path, hash, endContent /* that's where hash computation starts */, 0 /* too small for meaningful measures */); contentCache.add(hash, content, startContent, endContent - startContent); } finally { synchronized (pending) { if (gate.getCount() != 1) { throw new IllegalStateException(path + " " + gate.getCount()); } if (pending.remove(path) != gate) { throw new IllegalStateException(); } gate.countDown(); } } return content; }
java
private Content doComputeUnlimited(String path, CountDownLatch gate) throws IOException { long startContent; long endContent; ByteArrayOutputStream result; References references; byte[] bytes; String hash; Content content; if (gate.getCount() != 1) { throw new IllegalStateException(path + " " + gate.getCount()); } startContent = System.currentTimeMillis(); try { try { references = repository.resolve(Request.parse(path)); } catch (CyclicDependency e) { throw new RuntimeException(e.toString(), e); } catch (IOException e) { throw new IOException(path + ": " + e.getMessage(), e); } result = new ByteArrayOutputStream(); try (OutputStream dest = new GZIPOutputStream(result); Writer writer = new OutputStreamWriter(dest, ENCODING)) { references.writeTo(writer); } bytes = result.toByteArray(); endContent = System.currentTimeMillis(); hash = hash(bytes); content = new Content(references.type.getMime(), references.getLastModified(), bytes); hashCache.add(path, hash, endContent /* that's where hash computation starts */, 0 /* too small for meaningful measures */); contentCache.add(hash, content, startContent, endContent - startContent); } finally { synchronized (pending) { if (gate.getCount() != 1) { throw new IllegalStateException(path + " " + gate.getCount()); } if (pending.remove(path) != gate) { throw new IllegalStateException(); } gate.countDown(); } } return content; }
[ "private", "Content", "doComputeUnlimited", "(", "String", "path", ",", "CountDownLatch", "gate", ")", "throws", "IOException", "{", "long", "startContent", ";", "long", "endContent", ";", "ByteArrayOutputStream", "result", ";", "References", "references", ";", "byte", "[", "]", "bytes", ";", "String", "hash", ";", "Content", "content", ";", "if", "(", "gate", ".", "getCount", "(", ")", "!=", "1", ")", "{", "throw", "new", "IllegalStateException", "(", "path", "+", "\" \"", "+", "gate", ".", "getCount", "(", ")", ")", ";", "}", "startContent", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "try", "{", "try", "{", "references", "=", "repository", ".", "resolve", "(", "Request", ".", "parse", "(", "path", ")", ")", ";", "}", "catch", "(", "CyclicDependency", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ".", "toString", "(", ")", ",", "e", ")", ";", "}", "catch", "(", "IOException", "e", ")", "{", "throw", "new", "IOException", "(", "path", "+", "\": \"", "+", "e", ".", "getMessage", "(", ")", ",", "e", ")", ";", "}", "result", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "try", "(", "OutputStream", "dest", "=", "new", "GZIPOutputStream", "(", "result", ")", ";", "Writer", "writer", "=", "new", "OutputStreamWriter", "(", "dest", ",", "ENCODING", ")", ")", "{", "references", ".", "writeTo", "(", "writer", ")", ";", "}", "bytes", "=", "result", ".", "toByteArray", "(", ")", ";", "endContent", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "hash", "=", "hash", "(", "bytes", ")", ";", "content", "=", "new", "Content", "(", "references", ".", "type", ".", "getMime", "(", ")", ",", "references", ".", "getLastModified", "(", ")", ",", "bytes", ")", ";", "hashCache", ".", "add", "(", "path", ",", "hash", ",", "endContent", "/* that's where hash computation starts */", ",", "0", "/* too small for meaningful measures */", ")", ";", "contentCache", ".", "add", "(", "hash", ",", "content", ",", "startContent", ",", "endContent", "-", "startContent", ")", ";", "}", "finally", "{", "synchronized", "(", "pending", ")", "{", "if", "(", "gate", ".", "getCount", "(", ")", "!=", "1", ")", "{", "throw", "new", "IllegalStateException", "(", "path", "+", "\" \"", "+", "gate", ".", "getCount", "(", ")", ")", ";", "}", "if", "(", "pending", ".", "remove", "(", "path", ")", "!=", "gate", ")", "{", "throw", "new", "IllegalStateException", "(", ")", ";", "}", "gate", ".", "countDown", "(", ")", ";", "}", "}", "return", "content", ";", "}" ]
exactly one thread will invoke this method for one path
[ "exactly", "one", "thread", "will", "invoke", "this", "method", "for", "one", "path" ]
1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d
https://github.com/mlhartme/jasmin/blob/1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d/src/main/java/net/oneandone/jasmin/model/Engine.java#L232-L276
151,267
DDTH/ddth-tsc
ddth-tsc-core/src/main/java/com/github/ddth/tsc/AbstractCounterFactory.java
AbstractCounterFactory.destroyCounter
protected void destroyCounter(ICounter counter) { try { if (counter instanceof AbstractCounter) { ((AbstractCounter) counter).destroy(); } } catch (Exception e) { } }
java
protected void destroyCounter(ICounter counter) { try { if (counter instanceof AbstractCounter) { ((AbstractCounter) counter).destroy(); } } catch (Exception e) { } }
[ "protected", "void", "destroyCounter", "(", "ICounter", "counter", ")", "{", "try", "{", "if", "(", "counter", "instanceof", "AbstractCounter", ")", "{", "(", "(", "AbstractCounter", ")", "counter", ")", ".", "destroy", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "}", "}" ]
Destroys and removes a counter from the cache. @param counter @since 0.2.0
[ "Destroys", "and", "removes", "a", "counter", "from", "the", "cache", "." ]
d233c304c8fed2f3c069de42a36b7bbd5c8be01b
https://github.com/DDTH/ddth-tsc/blob/d233c304c8fed2f3c069de42a36b7bbd5c8be01b/ddth-tsc-core/src/main/java/com/github/ddth/tsc/AbstractCounterFactory.java#L85-L92
151,268
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/ControlFileHandler.java
ControlFileHandler.init
public void init(Record record) { super.init(record); this.setMasterSlaveFlag(FileListener.RUN_IN_MASTER | FileListener.DONT_REPLICATE_TO_SLAVE); }
java
public void init(Record record) { super.init(record); this.setMasterSlaveFlag(FileListener.RUN_IN_MASTER | FileListener.DONT_REPLICATE_TO_SLAVE); }
[ "public", "void", "init", "(", "Record", "record", ")", "{", "super", ".", "init", "(", "record", ")", ";", "this", ".", "setMasterSlaveFlag", "(", "FileListener", ".", "RUN_IN_MASTER", "|", "FileListener", ".", "DONT_REPLICATE_TO_SLAVE", ")", ";", "}" ]
ControlFileHandler - Constructor. @param record My owner (usually passed as null, and set on addListener in setOwner()).
[ "ControlFileHandler", "-", "Constructor", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/ControlFileHandler.java#L53-L57
151,269
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/event/ControlFileHandler.java
ControlFileHandler.setOwner
public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner == null) return; boolean bEnabledFlag = this.setEnabledListener(true); // Disabled automatically on setOwner. try { // Open this table and move to the control record if (!this.getOwner().isOpen()) if (this.isEnabled()) // Not on a slave this.getOwner().open(); // Open the control file if (this.getOwner().getEditMode() == Constants.EDIT_NONE) if (this.isEnabled()) // Not on a slave this.doNewRecord(true); // Read the control file } catch (DBException ex) { ex.printStackTrace(); } finally { this.setEnabledListener(bEnabledFlag); // Set back } }
java
public void setOwner(ListenerOwner owner) { super.setOwner(owner); if (owner == null) return; boolean bEnabledFlag = this.setEnabledListener(true); // Disabled automatically on setOwner. try { // Open this table and move to the control record if (!this.getOwner().isOpen()) if (this.isEnabled()) // Not on a slave this.getOwner().open(); // Open the control file if (this.getOwner().getEditMode() == Constants.EDIT_NONE) if (this.isEnabled()) // Not on a slave this.doNewRecord(true); // Read the control file } catch (DBException ex) { ex.printStackTrace(); } finally { this.setEnabledListener(bEnabledFlag); // Set back } }
[ "public", "void", "setOwner", "(", "ListenerOwner", "owner", ")", "{", "super", ".", "setOwner", "(", "owner", ")", ";", "if", "(", "owner", "==", "null", ")", "return", ";", "boolean", "bEnabledFlag", "=", "this", ".", "setEnabledListener", "(", "true", ")", ";", "// Disabled automatically on setOwner.", "try", "{", "// Open this table and move to the control record", "if", "(", "!", "this", ".", "getOwner", "(", ")", ".", "isOpen", "(", ")", ")", "if", "(", "this", ".", "isEnabled", "(", ")", ")", "// Not on a slave", "this", ".", "getOwner", "(", ")", ".", "open", "(", ")", ";", "// Open the control file", "if", "(", "this", ".", "getOwner", "(", ")", ".", "getEditMode", "(", ")", "==", "Constants", ".", "EDIT_NONE", ")", "if", "(", "this", ".", "isEnabled", "(", ")", ")", "// Not on a slave", "this", ".", "doNewRecord", "(", "true", ")", ";", "// Read the control file", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "finally", "{", "this", ".", "setEnabledListener", "(", "bEnabledFlag", ")", ";", "// Set back", "}", "}" ]
Set the field or file that owns this listener. This method calls doNewRecord when the owner is set. @see doNewRecord. @param owner My owner.
[ "Set", "the", "field", "or", "file", "that", "owns", "this", "listener", ".", "This", "method", "calls", "doNewRecord", "when", "the", "owner", "is", "set", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/event/ControlFileHandler.java#L64-L82
151,270
eostermueller/headlessInTraceClient
src/main/java/org/headlessintrace/client/connection/command/ClassInstrumentationCommand.java
ClassInstrumentationCommand.create
public static ClassInstrumentationCommand create(String rawMultiLineText) { List<String> list = rawTextToList(rawMultiLineText); String classesIncludeRegEx = getStringFromList(list); ClassInstrumentationCommand cic = new ClassInstrumentationCommand(); cic.setIncludeClassRegEx(classesIncludeRegEx); return cic; }
java
public static ClassInstrumentationCommand create(String rawMultiLineText) { List<String> list = rawTextToList(rawMultiLineText); String classesIncludeRegEx = getStringFromList(list); ClassInstrumentationCommand cic = new ClassInstrumentationCommand(); cic.setIncludeClassRegEx(classesIncludeRegEx); return cic; }
[ "public", "static", "ClassInstrumentationCommand", "create", "(", "String", "rawMultiLineText", ")", "{", "List", "<", "String", ">", "list", "=", "rawTextToList", "(", "rawMultiLineText", ")", ";", "String", "classesIncludeRegEx", "=", "getStringFromList", "(", "list", ")", ";", "ClassInstrumentationCommand", "cic", "=", "new", "ClassInstrumentationCommand", "(", ")", ";", "cic", ".", "setIncludeClassRegEx", "(", "classesIncludeRegEx", ")", ";", "return", "cic", ";", "}" ]
Designed to take the text straight from the list box. @param rawMultiLineText @return
[ "Designed", "to", "take", "the", "text", "straight", "from", "the", "list", "box", "." ]
50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604
https://github.com/eostermueller/headlessInTraceClient/blob/50b1dccc5ff9e342c7c1d06b5a382e8c0afc7604/src/main/java/org/headlessintrace/client/connection/command/ClassInstrumentationCommand.java#L55-L63
151,271
js-lib-com/commons
src/main/java/js/converter/UrlConverter.java
UrlConverter.asObject
@Override public <T> T asObject(String string, Class<T> valueType) throws ConverterException { // at this point value type is guaranteed to be URL try { return (T) new URL(string); } catch (MalformedURLException e) { throw new ConverterException(e.getMessage()); } }
java
@Override public <T> T asObject(String string, Class<T> valueType) throws ConverterException { // at this point value type is guaranteed to be URL try { return (T) new URL(string); } catch (MalformedURLException e) { throw new ConverterException(e.getMessage()); } }
[ "@", "Override", "public", "<", "T", ">", "T", "asObject", "(", "String", "string", ",", "Class", "<", "T", ">", "valueType", ")", "throws", "ConverterException", "{", "// at this point value type is guaranteed to be URL\r", "try", "{", "return", "(", "T", ")", "new", "URL", "(", "string", ")", ";", "}", "catch", "(", "MalformedURLException", "e", ")", "{", "throw", "new", "ConverterException", "(", "e", ".", "getMessage", "(", ")", ")", ";", "}", "}" ]
Convert URL string representation into URL instance. @throws ConverterException if given string is not a valid URL.
[ "Convert", "URL", "string", "representation", "into", "URL", "instance", "." ]
f8c64482142b163487745da74feb106f0765c16b
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/converter/UrlConverter.java#L23-L31
151,272
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/view/ViewFactory.java
ViewFactory.getViewFactory
public static ViewFactory getViewFactory(String strSubPackage, char chPrefix) { ViewFactory viewFactory = null; viewFactory = (ViewFactory)m_htFactories.get(strSubPackage); if (viewFactory == null) { viewFactory = new ViewFactory(strSubPackage, chPrefix); m_htFactories.put(strSubPackage, viewFactory); } return viewFactory; }
java
public static ViewFactory getViewFactory(String strSubPackage, char chPrefix) { ViewFactory viewFactory = null; viewFactory = (ViewFactory)m_htFactories.get(strSubPackage); if (viewFactory == null) { viewFactory = new ViewFactory(strSubPackage, chPrefix); m_htFactories.put(strSubPackage, viewFactory); } return viewFactory; }
[ "public", "static", "ViewFactory", "getViewFactory", "(", "String", "strSubPackage", ",", "char", "chPrefix", ")", "{", "ViewFactory", "viewFactory", "=", "null", ";", "viewFactory", "=", "(", "ViewFactory", ")", "m_htFactories", ".", "get", "(", "strSubPackage", ")", ";", "if", "(", "viewFactory", "==", "null", ")", "{", "viewFactory", "=", "new", "ViewFactory", "(", "strSubPackage", ",", "chPrefix", ")", ";", "m_htFactories", ".", "put", "(", "strSubPackage", ",", "viewFactory", ")", ";", "}", "return", "viewFactory", ";", "}" ]
Lookup a standard view factory. @param strSubPackage The subpackage name (such as swing/xml/etc.). @param chPrefix The prefix to add on the view classes. @return The View Factory for this sub-package.
[ "Lookup", "a", "standard", "view", "factory", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/view/ViewFactory.java#L213-L223
151,273
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java
BaseRecordOwner.addRecord
public void addRecord(Rec record, boolean bMainQuery) { if (m_vRecordList == null) m_vRecordList = new RecordList(null); if (record == null) return; if (((Record)record).getRecordOwner() != null) // Screen already here? if (((Record)record).getRecordOwner() != this) // Screen already here? ((Record)record).getRecordOwner().removeRecord(record); // Already belongs to another owner, remove it! m_vRecordList.addRecord(record, bMainQuery); if (((Record)record).getRecordOwner() == null) // Screen already here? ((Record)record).setRecordOwner(this); // This is the file for this screen }
java
public void addRecord(Rec record, boolean bMainQuery) { if (m_vRecordList == null) m_vRecordList = new RecordList(null); if (record == null) return; if (((Record)record).getRecordOwner() != null) // Screen already here? if (((Record)record).getRecordOwner() != this) // Screen already here? ((Record)record).getRecordOwner().removeRecord(record); // Already belongs to another owner, remove it! m_vRecordList.addRecord(record, bMainQuery); if (((Record)record).getRecordOwner() == null) // Screen already here? ((Record)record).setRecordOwner(this); // This is the file for this screen }
[ "public", "void", "addRecord", "(", "Rec", "record", ",", "boolean", "bMainQuery", ")", "{", "if", "(", "m_vRecordList", "==", "null", ")", "m_vRecordList", "=", "new", "RecordList", "(", "null", ")", ";", "if", "(", "record", "==", "null", ")", "return", ";", "if", "(", "(", "(", "Record", ")", "record", ")", ".", "getRecordOwner", "(", ")", "!=", "null", ")", "// Screen already here?", "if", "(", "(", "(", "Record", ")", "record", ")", ".", "getRecordOwner", "(", ")", "!=", "this", ")", "// Screen already here?", "(", "(", "Record", ")", "record", ")", ".", "getRecordOwner", "(", ")", ".", "removeRecord", "(", "record", ")", ";", "// Already belongs to another owner, remove it!", "m_vRecordList", ".", "addRecord", "(", "record", ",", "bMainQuery", ")", ";", "if", "(", "(", "(", "Record", ")", "record", ")", ".", "getRecordOwner", "(", ")", "==", "null", ")", "// Screen already here?", "(", "(", "Record", ")", "record", ")", ".", "setRecordOwner", "(", "this", ")", ";", "// This is the file for this screen", "}" ]
Add this record to this screen. @param record The record to add. @param bMainQuery If this is the main record.
[ "Add", "this", "record", "to", "this", "screen", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java#L162-L174
151,274
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java
BaseRecordOwner.removeRecord
public boolean removeRecord(Rec record) { if (m_vRecordList == null) return false; boolean bFlag = m_vRecordList.removeRecord(record); if (((Record)record).getRecordOwner() == this) ((Record)record).setRecordOwner(null); return bFlag; }
java
public boolean removeRecord(Rec record) { if (m_vRecordList == null) return false; boolean bFlag = m_vRecordList.removeRecord(record); if (((Record)record).getRecordOwner() == this) ((Record)record).setRecordOwner(null); return bFlag; }
[ "public", "boolean", "removeRecord", "(", "Rec", "record", ")", "{", "if", "(", "m_vRecordList", "==", "null", ")", "return", "false", ";", "boolean", "bFlag", "=", "m_vRecordList", ".", "removeRecord", "(", "record", ")", ";", "if", "(", "(", "(", "Record", ")", "record", ")", ".", "getRecordOwner", "(", ")", "==", "this", ")", "(", "(", "Record", ")", "record", ")", ".", "setRecordOwner", "(", "null", ")", ";", "return", "bFlag", ";", "}" ]
Remove this record from this screen. @param record The record to remove. @return true if successful.
[ "Remove", "this", "record", "from", "this", "screen", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java#L180-L188
151,275
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java
BaseRecordOwner.addListenerMessageFilter
public void addListenerMessageFilter(BaseMessageFilter messageFilter) { if (m_messageFilterList == null) m_messageFilterList = new MessageListenerFilterList(this); m_messageFilterList.addMessageFilter(messageFilter); }
java
public void addListenerMessageFilter(BaseMessageFilter messageFilter) { if (m_messageFilterList == null) m_messageFilterList = new MessageListenerFilterList(this); m_messageFilterList.addMessageFilter(messageFilter); }
[ "public", "void", "addListenerMessageFilter", "(", "BaseMessageFilter", "messageFilter", ")", "{", "if", "(", "m_messageFilterList", "==", "null", ")", "m_messageFilterList", "=", "new", "MessageListenerFilterList", "(", "this", ")", ";", "m_messageFilterList", ".", "addMessageFilter", "(", "messageFilter", ")", ";", "}" ]
Add this message filter to my list.
[ "Add", "this", "message", "filter", "to", "my", "list", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java#L283-L288
151,276
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java
BaseRecordOwner.getEnvironment
public Environment getEnvironment() { if (this.getTask() != null) if (this.getTask().getApplication() instanceof BaseApplication) return ((BaseApplication)this.getTask().getApplication()).getEnvironment(); return null; }
java
public Environment getEnvironment() { if (this.getTask() != null) if (this.getTask().getApplication() instanceof BaseApplication) return ((BaseApplication)this.getTask().getApplication()).getEnvironment(); return null; }
[ "public", "Environment", "getEnvironment", "(", ")", "{", "if", "(", "this", ".", "getTask", "(", ")", "!=", "null", ")", "if", "(", "this", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", "instanceof", "BaseApplication", ")", "return", "(", "(", "BaseApplication", ")", "this", ".", "getTask", "(", ")", ".", "getApplication", "(", ")", ")", ".", "getEnvironment", "(", ")", ";", "return", "null", ";", "}" ]
Get the environment. From the database owner interface. @return The Environment.
[ "Get", "the", "environment", ".", "From", "the", "database", "owner", "interface", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/thread/BaseRecordOwner.java#L436-L442
151,277
jbundle/jbundle
base/screen/model/src/main/java/org/jbundle/base/screen/model/report/parser/BaseMenuParser.java
BaseMenuParser.printHtmlItems
public void printHtmlItems(PrintWriter out, String strTag, String strParams, String strData) { int iTableColumns = 1; String strColumns = this.getProperty(DBParams.COLUMNS, strParams); if ((strColumns != null) && (strColumns.length() > 0)) iTableColumns = Integer.parseInt(strColumns); String strCellFormat = strData; if ((strCellFormat == null) || (strCellFormat.length() == 0)) strCellFormat = "<td><a href=\"<link/>\"><img src=\"" + "<icon/>\" width=\"24\" height=\"24\" alt=\"Run this program\"></a></td>" + "<td><a href=\"<link/>&help=\"><img src=\"" + HtmlConstants.HELP_ICON + "\" width=\"24\" height=\"24\"></a></td><td><a href=\"<link/>&help=\">" + HtmlConstants.TITLE_TAG + "</a></td><td>" + HtmlConstants.MENU_DESC_TAG + "</td>"; this.preSetupGrid(null); boolean bFirstRow = true; try { int iRowCount = 0; m_recDetail.close(); out.println("<table border=\"0\" cellspacing=\"10\" width=\"100%\">"); while (m_recDetail.hasNext()) { m_recDetail.next(); if (iRowCount == 0) out.println("<tr>"); String strHTML = strCellFormat; int iIndex; if (bFirstRow) { // Special case - First row iIndex = strHTML.indexOf("<HR"); if (iIndex == -1) iIndex = strHTML.indexOf("<hr"); if (iIndex != -1) if ((iIndex < strHTML.indexOf("<A")) || (iIndex < strHTML.indexOf("<a"))) { // Before the first reference (Get rid of the horizontal break) strHTML = strHTML.substring(0, iIndex) + strHTML.substring(strHTML.indexOf('>', iIndex) + 1); } } this.parseHtmlData(out, strHTML); iRowCount++; if ((iRowCount == iTableColumns) || (!m_recDetail.hasNext())) { iRowCount = 0; bFirstRow = false; out.println("</tr>"); } } } catch (DBException ex) { ex.printStackTrace(); } if (bFirstRow) { // No items in list out.println("<tr><td>Empty Menu</td></tr>"); } out.println("</table>"); this.postSetupGrid(); }
java
public void printHtmlItems(PrintWriter out, String strTag, String strParams, String strData) { int iTableColumns = 1; String strColumns = this.getProperty(DBParams.COLUMNS, strParams); if ((strColumns != null) && (strColumns.length() > 0)) iTableColumns = Integer.parseInt(strColumns); String strCellFormat = strData; if ((strCellFormat == null) || (strCellFormat.length() == 0)) strCellFormat = "<td><a href=\"<link/>\"><img src=\"" + "<icon/>\" width=\"24\" height=\"24\" alt=\"Run this program\"></a></td>" + "<td><a href=\"<link/>&help=\"><img src=\"" + HtmlConstants.HELP_ICON + "\" width=\"24\" height=\"24\"></a></td><td><a href=\"<link/>&help=\">" + HtmlConstants.TITLE_TAG + "</a></td><td>" + HtmlConstants.MENU_DESC_TAG + "</td>"; this.preSetupGrid(null); boolean bFirstRow = true; try { int iRowCount = 0; m_recDetail.close(); out.println("<table border=\"0\" cellspacing=\"10\" width=\"100%\">"); while (m_recDetail.hasNext()) { m_recDetail.next(); if (iRowCount == 0) out.println("<tr>"); String strHTML = strCellFormat; int iIndex; if (bFirstRow) { // Special case - First row iIndex = strHTML.indexOf("<HR"); if (iIndex == -1) iIndex = strHTML.indexOf("<hr"); if (iIndex != -1) if ((iIndex < strHTML.indexOf("<A")) || (iIndex < strHTML.indexOf("<a"))) { // Before the first reference (Get rid of the horizontal break) strHTML = strHTML.substring(0, iIndex) + strHTML.substring(strHTML.indexOf('>', iIndex) + 1); } } this.parseHtmlData(out, strHTML); iRowCount++; if ((iRowCount == iTableColumns) || (!m_recDetail.hasNext())) { iRowCount = 0; bFirstRow = false; out.println("</tr>"); } } } catch (DBException ex) { ex.printStackTrace(); } if (bFirstRow) { // No items in list out.println("<tr><td>Empty Menu</td></tr>"); } out.println("</table>"); this.postSetupGrid(); }
[ "public", "void", "printHtmlItems", "(", "PrintWriter", "out", ",", "String", "strTag", ",", "String", "strParams", ",", "String", "strData", ")", "{", "int", "iTableColumns", "=", "1", ";", "String", "strColumns", "=", "this", ".", "getProperty", "(", "DBParams", ".", "COLUMNS", ",", "strParams", ")", ";", "if", "(", "(", "strColumns", "!=", "null", ")", "&&", "(", "strColumns", ".", "length", "(", ")", ">", "0", ")", ")", "iTableColumns", "=", "Integer", ".", "parseInt", "(", "strColumns", ")", ";", "String", "strCellFormat", "=", "strData", ";", "if", "(", "(", "strCellFormat", "==", "null", ")", "||", "(", "strCellFormat", ".", "length", "(", ")", "==", "0", ")", ")", "strCellFormat", "=", "\"<td><a href=\\\"<link/>\\\"><img src=\\\"\"", "+", "\"<icon/>\\\" width=\\\"24\\\" height=\\\"24\\\" alt=\\\"Run this program\\\"></a></td>\"", "+", "\"<td><a href=\\\"<link/>&help=\\\"><img src=\\\"\"", "+", "HtmlConstants", ".", "HELP_ICON", "+", "\"\\\" width=\\\"24\\\" height=\\\"24\\\"></a></td><td><a href=\\\"<link/>&help=\\\">\"", "+", "HtmlConstants", ".", "TITLE_TAG", "+", "\"</a></td><td>\"", "+", "HtmlConstants", ".", "MENU_DESC_TAG", "+", "\"</td>\"", ";", "this", ".", "preSetupGrid", "(", "null", ")", ";", "boolean", "bFirstRow", "=", "true", ";", "try", "{", "int", "iRowCount", "=", "0", ";", "m_recDetail", ".", "close", "(", ")", ";", "out", ".", "println", "(", "\"<table border=\\\"0\\\" cellspacing=\\\"10\\\" width=\\\"100%\\\">\"", ")", ";", "while", "(", "m_recDetail", ".", "hasNext", "(", ")", ")", "{", "m_recDetail", ".", "next", "(", ")", ";", "if", "(", "iRowCount", "==", "0", ")", "out", ".", "println", "(", "\"<tr>\"", ")", ";", "String", "strHTML", "=", "strCellFormat", ";", "int", "iIndex", ";", "if", "(", "bFirstRow", ")", "{", "// Special case - First row", "iIndex", "=", "strHTML", ".", "indexOf", "(", "\"<HR\"", ")", ";", "if", "(", "iIndex", "==", "-", "1", ")", "iIndex", "=", "strHTML", ".", "indexOf", "(", "\"<hr\"", ")", ";", "if", "(", "iIndex", "!=", "-", "1", ")", "if", "(", "(", "iIndex", "<", "strHTML", ".", "indexOf", "(", "\"<A\"", ")", ")", "||", "(", "iIndex", "<", "strHTML", ".", "indexOf", "(", "\"<a\"", ")", ")", ")", "{", "// Before the first reference (Get rid of the horizontal break)", "strHTML", "=", "strHTML", ".", "substring", "(", "0", ",", "iIndex", ")", "+", "strHTML", ".", "substring", "(", "strHTML", ".", "indexOf", "(", "'", "'", ",", "iIndex", ")", "+", "1", ")", ";", "}", "}", "this", ".", "parseHtmlData", "(", "out", ",", "strHTML", ")", ";", "iRowCount", "++", ";", "if", "(", "(", "iRowCount", "==", "iTableColumns", ")", "||", "(", "!", "m_recDetail", ".", "hasNext", "(", ")", ")", ")", "{", "iRowCount", "=", "0", ";", "bFirstRow", "=", "false", ";", "out", ".", "println", "(", "\"</tr>\"", ")", ";", "}", "}", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "if", "(", "bFirstRow", ")", "{", "// No items in list", "out", ".", "println", "(", "\"<tr><td>Empty Menu</td></tr>\"", ")", ";", "}", "out", ".", "println", "(", "\"</table>\"", ")", ";", "this", ".", "postSetupGrid", "(", ")", ";", "}" ]
Detail items.
[ "Detail", "items", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/model/src/main/java/org/jbundle/base/screen/model/report/parser/BaseMenuParser.java#L186-L246
151,278
wigforss/Ka-Commons-Reflection
src/main/java/org/kasource/commons/reflection/util/ConstructorUtils.java
ConstructorUtils.getInstance
public static <T> T getInstance(String className, Class<T> ofType) throws IllegalStateException { return getInstance(className, ofType, new Class<?>[]{}, new Object[]{}); }
java
public static <T> T getInstance(String className, Class<T> ofType) throws IllegalStateException { return getInstance(className, ofType, new Class<?>[]{}, new Object[]{}); }
[ "public", "static", "<", "T", ">", "T", "getInstance", "(", "String", "className", ",", "Class", "<", "T", ">", "ofType", ")", "throws", "IllegalStateException", "{", "return", "getInstance", "(", "className", ",", "ofType", ",", "new", "Class", "<", "?", ">", "[", "]", "{", "}", ",", "new", "Object", "[", "]", "{", "}", ")", ";", "}" ]
Creates and returns a new instance of class with name className, loading the class and using the default constructor. @param <T> @param className @param ofType @return a new instance of class loaded from className. @throws IllegalStateException if className could not be loaded or if that class does not have a default constructor or if the loaded class is not of the supplied type (ofType).
[ "Creates", "and", "returns", "a", "new", "instance", "of", "class", "with", "name", "className", "loading", "the", "class", "and", "using", "the", "default", "constructor", "." ]
a80f7a164cd800089e4f4dd948ca6f0e7badcf33
https://github.com/wigforss/Ka-Commons-Reflection/blob/a80f7a164cd800089e4f4dd948ca6f0e7badcf33/src/main/java/org/kasource/commons/reflection/util/ConstructorUtils.java#L115-L117
151,279
jbundle/jbundle
thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/cal/JCalendarDualField.java
JCalendarDualField.addFocusListener
public void addFocusListener(FocusListener l) { super.addFocusListener(l); if (l instanceof JBasePanel) { m_tf.addFocusListener(l); if (m_button != null) m_button.addFocusListener(l); if (m_buttonTime != null) m_buttonTime.addFocusListener(l); } }
java
public void addFocusListener(FocusListener l) { super.addFocusListener(l); if (l instanceof JBasePanel) { m_tf.addFocusListener(l); if (m_button != null) m_button.addFocusListener(l); if (m_buttonTime != null) m_buttonTime.addFocusListener(l); } }
[ "public", "void", "addFocusListener", "(", "FocusListener", "l", ")", "{", "super", ".", "addFocusListener", "(", "l", ")", ";", "if", "(", "l", "instanceof", "JBasePanel", ")", "{", "m_tf", ".", "addFocusListener", "(", "l", ")", ";", "if", "(", "m_button", "!=", "null", ")", "m_button", ".", "addFocusListener", "(", "l", ")", ";", "if", "(", "m_buttonTime", "!=", "null", ")", "m_buttonTime", ".", "addFocusListener", "(", "l", ")", ";", "}", "}" ]
When a focus listener is added to this, actually add it to the components. @param l The listener to add.
[ "When", "a", "focus", "listener", "is", "added", "to", "this", "actually", "add", "it", "to", "the", "components", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util/src/main/java/org/jbundle/thin/base/screen/util/cal/JCalendarDualField.java#L204-L215
151,280
tvesalainen/util
util/src/main/java/org/vesalainen/util/ThreadLocalFormatter.java
ThreadLocalFormatter.getFormatter
public static Formatter getFormatter() { Formatter formatter = out.get(); if (formatter == null) { formatter = new Formatter(new StringBuilder()); out.set(formatter); } else { StringBuilder sb = (StringBuilder) formatter.out(); sb.setLength(0); } return formatter; }
java
public static Formatter getFormatter() { Formatter formatter = out.get(); if (formatter == null) { formatter = new Formatter(new StringBuilder()); out.set(formatter); } else { StringBuilder sb = (StringBuilder) formatter.out(); sb.setLength(0); } return formatter; }
[ "public", "static", "Formatter", "getFormatter", "(", ")", "{", "Formatter", "formatter", "=", "out", ".", "get", "(", ")", ";", "if", "(", "formatter", "==", "null", ")", "{", "formatter", "=", "new", "Formatter", "(", "new", "StringBuilder", "(", ")", ")", ";", "out", ".", "set", "(", "formatter", ")", ";", "}", "else", "{", "StringBuilder", "sb", "=", "(", "StringBuilder", ")", "formatter", ".", "out", "(", ")", ";", "sb", ".", "setLength", "(", "0", ")", ";", "}", "return", "formatter", ";", "}" ]
Returns thread-local formatter. Inner Appendable is StringBuider which's length is set to 0. @return
[ "Returns", "thread", "-", "local", "formatter", ".", "Inner", "Appendable", "is", "StringBuider", "which", "s", "length", "is", "set", "to", "0", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/util/ThreadLocalFormatter.java#L79-L93
151,281
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/VirtualFile.java
VirtualFile.readView
ByteBuffer readView(int position) { ByteBuffer bb = content.duplicate().asReadOnlyBuffer(); bb.position(position); return bb; }
java
ByteBuffer readView(int position) { ByteBuffer bb = content.duplicate().asReadOnlyBuffer(); bb.position(position); return bb; }
[ "ByteBuffer", "readView", "(", "int", "position", ")", "{", "ByteBuffer", "bb", "=", "content", ".", "duplicate", "(", ")", ".", "asReadOnlyBuffer", "(", ")", ";", "bb", ".", "position", "(", "position", ")", ";", "return", "bb", ";", "}" ]
Returns read-only view of content. Position = 0, limit=size; @return ByteBuffer position set to given position limit is file size.
[ "Returns", "read", "-", "only", "view", "of", "content", ".", "Position", "=", "0", "limit", "=", "size", ";" ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/VirtualFile.java#L326-L331
151,282
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/VirtualFile.java
VirtualFile.writeView
ByteBuffer writeView(int position, int needs) throws IOException { int waterMark = position+needs; if (waterMark > content.capacity()) { if (refSet.containsKey(content)) { throw new IOException("cannot grow file because of writable mapping for content. (non carbage collected mapping?)"); } int blockSize = fileStore.getBlockSize(); int newCapacity = Math.max(((waterMark / blockSize) + 1) * blockSize, 2*content.capacity()); ByteBuffer newBB = ByteBuffer.allocateDirect(newCapacity); newBB.put(content); newBB.flip(); content = newBB; } ByteBuffer bb = content.duplicate(); refSet.add(content, bb); bb.limit(waterMark).position(position); return bb; }
java
ByteBuffer writeView(int position, int needs) throws IOException { int waterMark = position+needs; if (waterMark > content.capacity()) { if (refSet.containsKey(content)) { throw new IOException("cannot grow file because of writable mapping for content. (non carbage collected mapping?)"); } int blockSize = fileStore.getBlockSize(); int newCapacity = Math.max(((waterMark / blockSize) + 1) * blockSize, 2*content.capacity()); ByteBuffer newBB = ByteBuffer.allocateDirect(newCapacity); newBB.put(content); newBB.flip(); content = newBB; } ByteBuffer bb = content.duplicate(); refSet.add(content, bb); bb.limit(waterMark).position(position); return bb; }
[ "ByteBuffer", "writeView", "(", "int", "position", ",", "int", "needs", ")", "throws", "IOException", "{", "int", "waterMark", "=", "position", "+", "needs", ";", "if", "(", "waterMark", ">", "content", ".", "capacity", "(", ")", ")", "{", "if", "(", "refSet", ".", "containsKey", "(", "content", ")", ")", "{", "throw", "new", "IOException", "(", "\"cannot grow file because of writable mapping for content. (non carbage collected mapping?)\"", ")", ";", "}", "int", "blockSize", "=", "fileStore", ".", "getBlockSize", "(", ")", ";", "int", "newCapacity", "=", "Math", ".", "max", "(", "(", "(", "waterMark", "/", "blockSize", ")", "+", "1", ")", "*", "blockSize", ",", "2", "*", "content", ".", "capacity", "(", ")", ")", ";", "ByteBuffer", "newBB", "=", "ByteBuffer", ".", "allocateDirect", "(", "newCapacity", ")", ";", "newBB", ".", "put", "(", "content", ")", ";", "newBB", ".", "flip", "(", ")", ";", "content", "=", "newBB", ";", "}", "ByteBuffer", "bb", "=", "content", ".", "duplicate", "(", ")", ";", "refSet", ".", "add", "(", "content", ",", "bb", ")", ";", "bb", ".", "limit", "(", "waterMark", ")", ".", "position", "(", "position", ")", ";", "return", "bb", ";", "}" ]
Returns view of content. @return ByteBuffer position set to given position limit is position+needs.
[ "Returns", "view", "of", "content", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/VirtualFile.java#L336-L356
151,283
tvesalainen/util
vfs/src/main/java/org/vesalainen/vfs/VirtualFile.java
VirtualFile.commit
void commit(ByteBuffer bb) { content.limit(Math.max(content.limit(), bb.position())); boolean removed = refSet.removeItem(content, bb); assert removed; }
java
void commit(ByteBuffer bb) { content.limit(Math.max(content.limit(), bb.position())); boolean removed = refSet.removeItem(content, bb); assert removed; }
[ "void", "commit", "(", "ByteBuffer", "bb", ")", "{", "content", ".", "limit", "(", "Math", ".", "max", "(", "content", ".", "limit", "(", ")", ",", "bb", ".", "position", "(", ")", ")", ")", ";", "boolean", "removed", "=", "refSet", ".", "removeItem", "(", "content", ",", "bb", ")", ";", "assert", "removed", ";", "}" ]
called after writing to commit that writing succeeded up to position. If position > size the size is updated. @param pos
[ "called", "after", "writing", "to", "commit", "that", "writing", "succeeded", "up", "to", "position", ".", "If", "position", ">", "size", "the", "size", "is", "updated", "." ]
bba7a44689f638ffabc8be40a75bdc9a33676433
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/vfs/src/main/java/org/vesalainen/vfs/VirtualFile.java#L366-L371
151,284
js-lib-com/transaction.hibernate
src/main/java/js/transaction/hibernate/SqlQueryImpl.java
SqlQueryImpl.query
private SQLQuery query(Class<?>... entity) { SQLQuery q = session.createSQLQuery(sql); if (entity.length == 1) { q.addEntity(entity[0]); } for (Map.Entry<String, Type> scalar : scalars.entrySet()) { q.addScalar(scalar.getKey(), scalar.getValue()); } for (int i = 0; i < positionedParameters.length; i++) { q.setParameter(i, positionedParameters[i]); } for (Map.Entry<String, Object> entry : namedParameters.entrySet()) { Object value = entry.getValue(); if (Types.isArray(value)) { Object[] parameter = (Object[]) value; if (parameter.length == 0) { throw new HibernateException(String.format("Invalid named parameter |%s|. Empty array.", entry.getKey())); } q.setParameterList(entry.getKey(), parameter); } else if (Types.isCollection(value)) { Collection<?> parameter = (Collection<?>) value; if (parameter.isEmpty()) { throw new HibernateException(String.format("Invalid named parameter |%s|. Empty list.", entry.getKey())); } q.setParameterList(entry.getKey(), parameter); } else { q.setParameter(entry.getKey(), value); } } if (offset > 0) { q.setFirstResult(offset); } if (rowsCount > 0) { q.setMaxResults(rowsCount); } return q; }
java
private SQLQuery query(Class<?>... entity) { SQLQuery q = session.createSQLQuery(sql); if (entity.length == 1) { q.addEntity(entity[0]); } for (Map.Entry<String, Type> scalar : scalars.entrySet()) { q.addScalar(scalar.getKey(), scalar.getValue()); } for (int i = 0; i < positionedParameters.length; i++) { q.setParameter(i, positionedParameters[i]); } for (Map.Entry<String, Object> entry : namedParameters.entrySet()) { Object value = entry.getValue(); if (Types.isArray(value)) { Object[] parameter = (Object[]) value; if (parameter.length == 0) { throw new HibernateException(String.format("Invalid named parameter |%s|. Empty array.", entry.getKey())); } q.setParameterList(entry.getKey(), parameter); } else if (Types.isCollection(value)) { Collection<?> parameter = (Collection<?>) value; if (parameter.isEmpty()) { throw new HibernateException(String.format("Invalid named parameter |%s|. Empty list.", entry.getKey())); } q.setParameterList(entry.getKey(), parameter); } else { q.setParameter(entry.getKey(), value); } } if (offset > 0) { q.setFirstResult(offset); } if (rowsCount > 0) { q.setMaxResults(rowsCount); } return q; }
[ "private", "SQLQuery", "query", "(", "Class", "<", "?", ">", "...", "entity", ")", "{", "SQLQuery", "q", "=", "session", ".", "createSQLQuery", "(", "sql", ")", ";", "if", "(", "entity", ".", "length", "==", "1", ")", "{", "q", ".", "addEntity", "(", "entity", "[", "0", "]", ")", ";", "}", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Type", ">", "scalar", ":", "scalars", ".", "entrySet", "(", ")", ")", "{", "q", ".", "addScalar", "(", "scalar", ".", "getKey", "(", ")", ",", "scalar", ".", "getValue", "(", ")", ")", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "positionedParameters", ".", "length", ";", "i", "++", ")", "{", "q", ".", "setParameter", "(", "i", ",", "positionedParameters", "[", "i", "]", ")", ";", "}", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "namedParameters", ".", "entrySet", "(", ")", ")", "{", "Object", "value", "=", "entry", ".", "getValue", "(", ")", ";", "if", "(", "Types", ".", "isArray", "(", "value", ")", ")", "{", "Object", "[", "]", "parameter", "=", "(", "Object", "[", "]", ")", "value", ";", "if", "(", "parameter", ".", "length", "==", "0", ")", "{", "throw", "new", "HibernateException", "(", "String", ".", "format", "(", "\"Invalid named parameter |%s|. Empty array.\"", ",", "entry", ".", "getKey", "(", ")", ")", ")", ";", "}", "q", ".", "setParameterList", "(", "entry", ".", "getKey", "(", ")", ",", "parameter", ")", ";", "}", "else", "if", "(", "Types", ".", "isCollection", "(", "value", ")", ")", "{", "Collection", "<", "?", ">", "parameter", "=", "(", "Collection", "<", "?", ">", ")", "value", ";", "if", "(", "parameter", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "HibernateException", "(", "String", ".", "format", "(", "\"Invalid named parameter |%s|. Empty list.\"", ",", "entry", ".", "getKey", "(", ")", ")", ")", ";", "}", "q", ".", "setParameterList", "(", "entry", ".", "getKey", "(", ")", ",", "parameter", ")", ";", "}", "else", "{", "q", ".", "setParameter", "(", "entry", ".", "getKey", "(", ")", ",", "value", ")", ";", "}", "}", "if", "(", "offset", ">", "0", ")", "{", "q", ".", "setFirstResult", "(", "offset", ")", ";", "}", "if", "(", "rowsCount", ">", "0", ")", "{", "q", ".", "setMaxResults", "(", "rowsCount", ")", ";", "}", "return", "q", ";", "}" ]
Create SQL query object and initialize it from this helper properties. @param entity optional Hibernate entity. @return newly create SQL object.
[ "Create", "SQL", "query", "object", "and", "initialize", "it", "from", "this", "helper", "properties", "." ]
3aaafa6fa573f27733e6edaef3a4b2cf97cf67d6
https://github.com/js-lib-com/transaction.hibernate/blob/3aaafa6fa573f27733e6edaef3a4b2cf97cf67d6/src/main/java/js/transaction/hibernate/SqlQueryImpl.java#L194-L230
151,285
kirgor/enklib
sql/src/main/java/com/kirgor/enklib/sql/proxy/ParameterUtils.java
ParameterUtils.likePrefix
public static String likePrefix(String param) { return param != null ? param.toLowerCase().replace("_", "\\_").replace("%", "\\%") + "%" : null; }
java
public static String likePrefix(String param) { return param != null ? param.toLowerCase().replace("_", "\\_").replace("%", "\\%") + "%" : null; }
[ "public", "static", "String", "likePrefix", "(", "String", "param", ")", "{", "return", "param", "!=", "null", "?", "param", ".", "toLowerCase", "(", ")", ".", "replace", "(", "\"_\"", ",", "\"\\\\_\"", ")", ".", "replace", "(", "\"%\"", ",", "\"\\\\%\"", ")", "+", "\"%\"", ":", "null", ";", "}" ]
Builds prefix search parameter for LIKE operator from non-formatted string. Basically, this method insert escape character before special symbols and adds '%' at the end.
[ "Builds", "prefix", "search", "parameter", "for", "LIKE", "operator", "from", "non", "-", "formatted", "string", ".", "Basically", "this", "method", "insert", "escape", "character", "before", "special", "symbols", "and", "adds", "%", "at", "the", "end", "." ]
8a24db296dc43db5d8fe509cf64ace0a0c7be8f2
https://github.com/kirgor/enklib/blob/8a24db296dc43db5d8fe509cf64ace0a0c7be8f2/sql/src/main/java/com/kirgor/enklib/sql/proxy/ParameterUtils.java#L28-L30
151,286
jbundle/jbundle
thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/SyncPageLoader.java
SyncPageLoader.run
public void run() { if ((m_url == null) && (m_strHtmlText == null)) { // restore the original cursor if (m_bChangeCursor) { if (m_applet != null) m_applet.setStatus(0, m_editorPane, m_oldCursor); else { Component component = m_editorPane; while (component.getParent() != null) { component = component.getParent(); } component.setCursor((Cursor)m_oldCursor); } Container parent = m_editorPane.getParent(); parent.repaint(); } } else { if (m_bChangeCursor) { if (m_applet != null) m_oldCursor = m_applet.setStatus(Cursor.WAIT_CURSOR, m_editorPane, null); else { Component component = m_editorPane; boolean bIsVisible = true; while (component.getParent() != null) { component = component.getParent(); if (!component.isVisible()) bIsVisible = false; } m_oldCursor = component.getCursor(); Cursor cursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); if (bIsVisible) component.setCursor(cursor); } } synchronized (m_editorPane) { Document doc = m_editorPane.getDocument(); try { if (m_url != null) { m_editorPane.setPage(m_url); } else { this.setText(doc, m_strHtmlText); } } catch (IOException ioe) { String error = ioe.getLocalizedMessage(); if ((error != null) && (error.length() > 0)) { String errorText = m_strHtmlErrorText; if (errorText == null) errorText = DEFAULT_ERROR_TEXT; errorText = MessageFormat.format(errorText, m_url.toString(), error); this.setText(doc, errorText); } else m_editorPane.setDocument(doc); // getToolkit().beep(); } finally { // schedule the cursor to revert after // the paint has happened. m_url = null; m_strHtmlText = null; if (m_bChangeCursor) SwingUtilities.invokeLater(this); } } } }
java
public void run() { if ((m_url == null) && (m_strHtmlText == null)) { // restore the original cursor if (m_bChangeCursor) { if (m_applet != null) m_applet.setStatus(0, m_editorPane, m_oldCursor); else { Component component = m_editorPane; while (component.getParent() != null) { component = component.getParent(); } component.setCursor((Cursor)m_oldCursor); } Container parent = m_editorPane.getParent(); parent.repaint(); } } else { if (m_bChangeCursor) { if (m_applet != null) m_oldCursor = m_applet.setStatus(Cursor.WAIT_CURSOR, m_editorPane, null); else { Component component = m_editorPane; boolean bIsVisible = true; while (component.getParent() != null) { component = component.getParent(); if (!component.isVisible()) bIsVisible = false; } m_oldCursor = component.getCursor(); Cursor cursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); if (bIsVisible) component.setCursor(cursor); } } synchronized (m_editorPane) { Document doc = m_editorPane.getDocument(); try { if (m_url != null) { m_editorPane.setPage(m_url); } else { this.setText(doc, m_strHtmlText); } } catch (IOException ioe) { String error = ioe.getLocalizedMessage(); if ((error != null) && (error.length() > 0)) { String errorText = m_strHtmlErrorText; if (errorText == null) errorText = DEFAULT_ERROR_TEXT; errorText = MessageFormat.format(errorText, m_url.toString(), error); this.setText(doc, errorText); } else m_editorPane.setDocument(doc); // getToolkit().beep(); } finally { // schedule the cursor to revert after // the paint has happened. m_url = null; m_strHtmlText = null; if (m_bChangeCursor) SwingUtilities.invokeLater(this); } } } }
[ "public", "void", "run", "(", ")", "{", "if", "(", "(", "m_url", "==", "null", ")", "&&", "(", "m_strHtmlText", "==", "null", ")", ")", "{", "// restore the original cursor", "if", "(", "m_bChangeCursor", ")", "{", "if", "(", "m_applet", "!=", "null", ")", "m_applet", ".", "setStatus", "(", "0", ",", "m_editorPane", ",", "m_oldCursor", ")", ";", "else", "{", "Component", "component", "=", "m_editorPane", ";", "while", "(", "component", ".", "getParent", "(", ")", "!=", "null", ")", "{", "component", "=", "component", ".", "getParent", "(", ")", ";", "}", "component", ".", "setCursor", "(", "(", "Cursor", ")", "m_oldCursor", ")", ";", "}", "Container", "parent", "=", "m_editorPane", ".", "getParent", "(", ")", ";", "parent", ".", "repaint", "(", ")", ";", "}", "}", "else", "{", "if", "(", "m_bChangeCursor", ")", "{", "if", "(", "m_applet", "!=", "null", ")", "m_oldCursor", "=", "m_applet", ".", "setStatus", "(", "Cursor", ".", "WAIT_CURSOR", ",", "m_editorPane", ",", "null", ")", ";", "else", "{", "Component", "component", "=", "m_editorPane", ";", "boolean", "bIsVisible", "=", "true", ";", "while", "(", "component", ".", "getParent", "(", ")", "!=", "null", ")", "{", "component", "=", "component", ".", "getParent", "(", ")", ";", "if", "(", "!", "component", ".", "isVisible", "(", ")", ")", "bIsVisible", "=", "false", ";", "}", "m_oldCursor", "=", "component", ".", "getCursor", "(", ")", ";", "Cursor", "cursor", "=", "Cursor", ".", "getPredefinedCursor", "(", "Cursor", ".", "WAIT_CURSOR", ")", ";", "if", "(", "bIsVisible", ")", "component", ".", "setCursor", "(", "cursor", ")", ";", "}", "}", "synchronized", "(", "m_editorPane", ")", "{", "Document", "doc", "=", "m_editorPane", ".", "getDocument", "(", ")", ";", "try", "{", "if", "(", "m_url", "!=", "null", ")", "{", "m_editorPane", ".", "setPage", "(", "m_url", ")", ";", "}", "else", "{", "this", ".", "setText", "(", "doc", ",", "m_strHtmlText", ")", ";", "}", "}", "catch", "(", "IOException", "ioe", ")", "{", "String", "error", "=", "ioe", ".", "getLocalizedMessage", "(", ")", ";", "if", "(", "(", "error", "!=", "null", ")", "&&", "(", "error", ".", "length", "(", ")", ">", "0", ")", ")", "{", "String", "errorText", "=", "m_strHtmlErrorText", ";", "if", "(", "errorText", "==", "null", ")", "errorText", "=", "DEFAULT_ERROR_TEXT", ";", "errorText", "=", "MessageFormat", ".", "format", "(", "errorText", ",", "m_url", ".", "toString", "(", ")", ",", "error", ")", ";", "this", ".", "setText", "(", "doc", ",", "errorText", ")", ";", "}", "else", "m_editorPane", ".", "setDocument", "(", "doc", ")", ";", "// getToolkit().beep();", "}", "finally", "{", "// schedule the cursor to revert after", "// the paint has happened.", "m_url", "=", "null", ";", "m_strHtmlText", "=", "null", ";", "if", "(", "m_bChangeCursor", ")", "SwingUtilities", ".", "invokeLater", "(", "this", ")", ";", "}", "}", "}", "}" ]
Display the target html in the pane.
[ "Display", "the", "target", "html", "in", "the", "pane", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/SyncPageLoader.java#L88-L165
151,287
jbundle/jbundle
thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/SyncPageLoader.java
SyncPageLoader.setText
public void setText(Document doc, String text) { StringReader reader = new StringReader(text); HTMLEditorKit kit = (HTMLEditorKit) m_editorPane.getEditorKitForContentType(HTML_CONTENT); try { int iLength = doc.getLength(); if (iLength > 0) doc.remove(0, iLength); kit.read(reader, doc, 0); } catch (IOException ex) { ex.printStackTrace(); } catch (BadLocationException ex) { ex.printStackTrace(); } }
java
public void setText(Document doc, String text) { StringReader reader = new StringReader(text); HTMLEditorKit kit = (HTMLEditorKit) m_editorPane.getEditorKitForContentType(HTML_CONTENT); try { int iLength = doc.getLength(); if (iLength > 0) doc.remove(0, iLength); kit.read(reader, doc, 0); } catch (IOException ex) { ex.printStackTrace(); } catch (BadLocationException ex) { ex.printStackTrace(); } }
[ "public", "void", "setText", "(", "Document", "doc", ",", "String", "text", ")", "{", "StringReader", "reader", "=", "new", "StringReader", "(", "text", ")", ";", "HTMLEditorKit", "kit", "=", "(", "HTMLEditorKit", ")", "m_editorPane", ".", "getEditorKitForContentType", "(", "HTML_CONTENT", ")", ";", "try", "{", "int", "iLength", "=", "doc", ".", "getLength", "(", ")", ";", "if", "(", "iLength", ">", "0", ")", "doc", ".", "remove", "(", "0", ",", "iLength", ")", ";", "kit", ".", "read", "(", "reader", ",", "doc", ",", "0", ")", ";", "}", "catch", "(", "IOException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "catch", "(", "BadLocationException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "}", "}" ]
Set the control to this html text. @param doc @param text
[ "Set", "the", "control", "to", "this", "html", "text", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/util-misc/src/main/java/org/jbundle/thin/base/screen/util/html/SyncPageLoader.java#L171-L185
151,288
kazocsaba/matrix
src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java
ImmutableMatrixFactory.createVector
public static ImmutableVector2 createVector(final double x, final double y) { return new ImmutableVector2(new ImmutableData(2, 1) { @Override public double getQuick(int row, int col) { if (row == 0) return x; else return y; } }); }
java
public static ImmutableVector2 createVector(final double x, final double y) { return new ImmutableVector2(new ImmutableData(2, 1) { @Override public double getQuick(int row, int col) { if (row == 0) return x; else return y; } }); }
[ "public", "static", "ImmutableVector2", "createVector", "(", "final", "double", "x", ",", "final", "double", "y", ")", "{", "return", "new", "ImmutableVector2", "(", "new", "ImmutableData", "(", "2", ",", "1", ")", "{", "@", "Override", "public", "double", "getQuick", "(", "int", "row", ",", "int", "col", ")", "{", "if", "(", "row", "==", "0", ")", "return", "x", ";", "else", "return", "y", ";", "}", "}", ")", ";", "}" ]
Creates a new immutable 2D column vector. @param x the x coordinate of the new vector @param y the y coordinate of the new vector @return the new vector
[ "Creates", "a", "new", "immutable", "2D", "column", "vector", "." ]
018570db945fe616b25606fe605fa6e0c180ab5b
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java#L24-L34
151,289
kazocsaba/matrix
src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java
ImmutableMatrixFactory.createVector
public static ImmutableVector3 createVector(final double x, final double y, final double z) { return new ImmutableVector3(new ImmutableData(3, 1) { @Override public double getQuick(int row, int col) { switch (row) { case 0: return x; case 1: return y; default: return z; } } }); }
java
public static ImmutableVector3 createVector(final double x, final double y, final double z) { return new ImmutableVector3(new ImmutableData(3, 1) { @Override public double getQuick(int row, int col) { switch (row) { case 0: return x; case 1: return y; default: return z; } } }); }
[ "public", "static", "ImmutableVector3", "createVector", "(", "final", "double", "x", ",", "final", "double", "y", ",", "final", "double", "z", ")", "{", "return", "new", "ImmutableVector3", "(", "new", "ImmutableData", "(", "3", ",", "1", ")", "{", "@", "Override", "public", "double", "getQuick", "(", "int", "row", ",", "int", "col", ")", "{", "switch", "(", "row", ")", "{", "case", "0", ":", "return", "x", ";", "case", "1", ":", "return", "y", ";", "default", ":", "return", "z", ";", "}", "}", "}", ")", ";", "}" ]
Creates a new immutable 3D column vector. @param x the x coordinate of the new vector @param y the y coordinate of the new vector @param z the z coordinate of the new vector @return the new vector
[ "Creates", "a", "new", "immutable", "3D", "column", "vector", "." ]
018570db945fe616b25606fe605fa6e0c180ab5b
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java#L44-L58
151,290
kazocsaba/matrix
src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java
ImmutableMatrixFactory.createVector
public static ImmutableVector4 createVector(final double x, final double y, final double z, final double h) { return new ImmutableVector4(new ImmutableData(4, 1) { @Override public double getQuick(int row, int col) { switch (row) { case 0: return x; case 1: return y; case 2: return z; default: return h; } } }); }
java
public static ImmutableVector4 createVector(final double x, final double y, final double z, final double h) { return new ImmutableVector4(new ImmutableData(4, 1) { @Override public double getQuick(int row, int col) { switch (row) { case 0: return x; case 1: return y; case 2: return z; default: return h; } } }); }
[ "public", "static", "ImmutableVector4", "createVector", "(", "final", "double", "x", ",", "final", "double", "y", ",", "final", "double", "z", ",", "final", "double", "h", ")", "{", "return", "new", "ImmutableVector4", "(", "new", "ImmutableData", "(", "4", ",", "1", ")", "{", "@", "Override", "public", "double", "getQuick", "(", "int", "row", ",", "int", "col", ")", "{", "switch", "(", "row", ")", "{", "case", "0", ":", "return", "x", ";", "case", "1", ":", "return", "y", ";", "case", "2", ":", "return", "z", ";", "default", ":", "return", "h", ";", "}", "}", "}", ")", ";", "}" ]
Creates a new immutable 4D column vector. @param x the x coordinate of the new vector @param y the y coordinate of the new vector @param z the z coordinate of the new vector @param h the h coordinate of the new vector @return the new vector
[ "Creates", "a", "new", "immutable", "4D", "column", "vector", "." ]
018570db945fe616b25606fe605fa6e0c180ab5b
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java#L69-L85
151,291
kazocsaba/matrix
src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java
ImmutableMatrixFactory.zeros
public static ImmutableMatrix zeros(final int rows, final int cols) { if (rows <= 0 || cols <= 0) throw new IllegalArgumentException("Invalid dimensions"); return create(new ImmutableData(rows, cols) { @Override public double getQuick(int row, int col) { return 0; } }); }
java
public static ImmutableMatrix zeros(final int rows, final int cols) { if (rows <= 0 || cols <= 0) throw new IllegalArgumentException("Invalid dimensions"); return create(new ImmutableData(rows, cols) { @Override public double getQuick(int row, int col) { return 0; } }); }
[ "public", "static", "ImmutableMatrix", "zeros", "(", "final", "int", "rows", ",", "final", "int", "cols", ")", "{", "if", "(", "rows", "<=", "0", "||", "cols", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid dimensions\"", ")", ";", "return", "create", "(", "new", "ImmutableData", "(", "rows", ",", "cols", ")", "{", "@", "Override", "public", "double", "getQuick", "(", "int", "row", ",", "int", "col", ")", "{", "return", "0", ";", "}", "}", ")", ";", "}" ]
Returns an immutable matrix of the specified size whose elements are all 0. @param rows the number of rows @param cols the number of columns @return a <code>rows</code>×<code>cols</code> matrix whose elements are all 0 @throws IllegalArgumentException if either argument is non-positive
[ "Returns", "an", "immutable", "matrix", "of", "the", "specified", "size", "whose", "elements", "are", "all", "0", "." ]
018570db945fe616b25606fe605fa6e0c180ab5b
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java#L223-L231
151,292
kazocsaba/matrix
src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java
ImmutableMatrixFactory.identity
public static ImmutableMatrix identity(final int size) { if (size <= 0) throw new IllegalArgumentException("Invalid size"); return create(new ImmutableData(size, size) { @Override public double getQuick(int row, int col) { return row == col ? 1 : 0; } }); }
java
public static ImmutableMatrix identity(final int size) { if (size <= 0) throw new IllegalArgumentException("Invalid size"); return create(new ImmutableData(size, size) { @Override public double getQuick(int row, int col) { return row == col ? 1 : 0; } }); }
[ "public", "static", "ImmutableMatrix", "identity", "(", "final", "int", "size", ")", "{", "if", "(", "size", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid size\"", ")", ";", "return", "create", "(", "new", "ImmutableData", "(", "size", ",", "size", ")", "{", "@", "Override", "public", "double", "getQuick", "(", "int", "row", ",", "int", "col", ")", "{", "return", "row", "==", "col", "?", "1", ":", "0", ";", "}", "}", ")", ";", "}" ]
Returns an immutable identity matrix of the specified dimension. @param size the dimension of the matrix @return a <code>size</code>×<code>size</code> identity matrix @throws IllegalArgumentException if the size is not positive
[ "Returns", "an", "immutable", "identity", "matrix", "of", "the", "specified", "dimension", "." ]
018570db945fe616b25606fe605fa6e0c180ab5b
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java#L258-L266
151,293
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/MessageRecordDesc.java
MessageRecordDesc.handlePutRawRecordData
public int handlePutRawRecordData(Rec record) { int iErrorCode = Constant.NORMAL_RETURN; int iRecordCount = this.getRecordCount(record); Rec recTargetRecord = this.setDataIndex(RESET_INDEX, record); // Reset index if multiple for (int index = 1; index <= iRecordCount; index++) { Rec recNext = this.setDataIndex(index, recTargetRecord); if (recNext == null) break; iErrorCode = super.handlePutRawRecordData(recNext); if (iErrorCode != Constant.NORMAL_RETURN) break; } this.setDataIndex(END_OF_NODES, recTargetRecord); return iErrorCode; }
java
public int handlePutRawRecordData(Rec record) { int iErrorCode = Constant.NORMAL_RETURN; int iRecordCount = this.getRecordCount(record); Rec recTargetRecord = this.setDataIndex(RESET_INDEX, record); // Reset index if multiple for (int index = 1; index <= iRecordCount; index++) { Rec recNext = this.setDataIndex(index, recTargetRecord); if (recNext == null) break; iErrorCode = super.handlePutRawRecordData(recNext); if (iErrorCode != Constant.NORMAL_RETURN) break; } this.setDataIndex(END_OF_NODES, recTargetRecord); return iErrorCode; }
[ "public", "int", "handlePutRawRecordData", "(", "Rec", "record", ")", "{", "int", "iErrorCode", "=", "Constant", ".", "NORMAL_RETURN", ";", "int", "iRecordCount", "=", "this", ".", "getRecordCount", "(", "record", ")", ";", "Rec", "recTargetRecord", "=", "this", ".", "setDataIndex", "(", "RESET_INDEX", ",", "record", ")", ";", "// Reset index if multiple", "for", "(", "int", "index", "=", "1", ";", "index", "<=", "iRecordCount", ";", "index", "++", ")", "{", "Rec", "recNext", "=", "this", ".", "setDataIndex", "(", "index", ",", "recTargetRecord", ")", ";", "if", "(", "recNext", "==", "null", ")", "break", ";", "iErrorCode", "=", "super", ".", "handlePutRawRecordData", "(", "recNext", ")", ";", "if", "(", "iErrorCode", "!=", "Constant", ".", "NORMAL_RETURN", ")", "break", ";", "}", "this", ".", "setDataIndex", "(", "END_OF_NODES", ",", "recTargetRecord", ")", ";", "return", "iErrorCode", ";", "}" ]
Move the correct fields from ALL the detail records to the map. Typically, you override this and loop through the records in the table. If this method is used, is must be overidden to move the correct fields. @param record The record to get the data from.
[ "Move", "the", "correct", "fields", "from", "ALL", "the", "detail", "records", "to", "the", "map", ".", "Typically", "you", "override", "this", "and", "loop", "through", "the", "records", "in", "the", "table", ".", "If", "this", "method", "is", "used", "is", "must", "be", "overidden", "to", "move", "the", "correct", "fields", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/MessageRecordDesc.java#L68-L88
151,294
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/MessageRecordDesc.java
MessageRecordDesc.updateRecord
public Rec updateRecord(Rec record, boolean bRefresh) { try { Object bookmark = null; if (record.getEditMode() == Constant.EDIT_IN_PROGRESS) { if (bRefresh) bookmark = record.getTable().getHandle(0); record.getTable().set(record); } else if ((record.getEditMode() == Constant.EDIT_ADD) && (record.isModified())) { record.getTable().add(record); if (bRefresh) bookmark = record.getTable().getLastModified(0); } if (bRefresh) if (bookmark != null) { record.getTable().setHandle(bookmark, 0); record.getTable().edit(); } } catch (DBException ex) { ex.printStackTrace(); if (record != null) if (record.getTask() != null) record.getTask().setLastError(ex.getMessage()); return null; } return record; }
java
public Rec updateRecord(Rec record, boolean bRefresh) { try { Object bookmark = null; if (record.getEditMode() == Constant.EDIT_IN_PROGRESS) { if (bRefresh) bookmark = record.getTable().getHandle(0); record.getTable().set(record); } else if ((record.getEditMode() == Constant.EDIT_ADD) && (record.isModified())) { record.getTable().add(record); if (bRefresh) bookmark = record.getTable().getLastModified(0); } if (bRefresh) if (bookmark != null) { record.getTable().setHandle(bookmark, 0); record.getTable().edit(); } } catch (DBException ex) { ex.printStackTrace(); if (record != null) if (record.getTask() != null) record.getTask().setLastError(ex.getMessage()); return null; } return record; }
[ "public", "Rec", "updateRecord", "(", "Rec", "record", ",", "boolean", "bRefresh", ")", "{", "try", "{", "Object", "bookmark", "=", "null", ";", "if", "(", "record", ".", "getEditMode", "(", ")", "==", "Constant", ".", "EDIT_IN_PROGRESS", ")", "{", "if", "(", "bRefresh", ")", "bookmark", "=", "record", ".", "getTable", "(", ")", ".", "getHandle", "(", "0", ")", ";", "record", ".", "getTable", "(", ")", ".", "set", "(", "record", ")", ";", "}", "else", "if", "(", "(", "record", ".", "getEditMode", "(", ")", "==", "Constant", ".", "EDIT_ADD", ")", "&&", "(", "record", ".", "isModified", "(", ")", ")", ")", "{", "record", ".", "getTable", "(", ")", ".", "add", "(", "record", ")", ";", "if", "(", "bRefresh", ")", "bookmark", "=", "record", ".", "getTable", "(", ")", ".", "getLastModified", "(", "0", ")", ";", "}", "if", "(", "bRefresh", ")", "if", "(", "bookmark", "!=", "null", ")", "{", "record", ".", "getTable", "(", ")", ".", "setHandle", "(", "bookmark", ",", "0", ")", ";", "record", ".", "getTable", "(", ")", ".", "edit", "(", ")", ";", "}", "}", "catch", "(", "DBException", "ex", ")", "{", "ex", ".", "printStackTrace", "(", ")", ";", "if", "(", "record", "!=", "null", ")", "if", "(", "record", ".", "getTask", "(", ")", "!=", "null", ")", "record", ".", "getTask", "(", ")", ".", "setLastError", "(", "ex", ".", "getMessage", "(", ")", ")", ";", "return", "null", ";", "}", "return", "record", ";", "}" ]
Update this record if it has been changed @param record @return The record (or null if error)
[ "Update", "this", "record", "if", "it", "has", "been", "changed" ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/MessageRecordDesc.java#L185-L215
151,295
jbundle/jbundle
thin/base/message/src/main/java/org/jbundle/thin/base/message/MessageRecordDesc.java
MessageRecordDesc.freeSubNodeRecord
public boolean freeSubNodeRecord(Rec record) { m_recTargetFieldList = null; if (record != null) { record.free(); return true; } return false; }
java
public boolean freeSubNodeRecord(Rec record) { m_recTargetFieldList = null; if (record != null) { record.free(); return true; } return false; }
[ "public", "boolean", "freeSubNodeRecord", "(", "Rec", "record", ")", "{", "m_recTargetFieldList", "=", "null", ";", "if", "(", "record", "!=", "null", ")", "{", "record", ".", "free", "(", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}" ]
Create the sub-detail record. @param record @return
[ "Create", "the", "sub", "-", "detail", "record", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/message/src/main/java/org/jbundle/thin/base/message/MessageRecordDesc.java#L302-L311
151,296
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/BitReferenceField.java
BitReferenceField.getBitsToCheck
public int getBitsToCheck() { if (m_iBitsToCheck == 0) { Record record = this.makeReferenceRecord(); try { record.close(); while (record.hasNext()) // 0 = First Day -> 6 = Last Day of Week { record.next(); int sBitPosition = (int)record.getCounterField().getValue(); m_iBitsToCheck |= 1 << sBitPosition; } } catch (DBException e) { e.printStackTrace(); } } return m_iBitsToCheck; }
java
public int getBitsToCheck() { if (m_iBitsToCheck == 0) { Record record = this.makeReferenceRecord(); try { record.close(); while (record.hasNext()) // 0 = First Day -> 6 = Last Day of Week { record.next(); int sBitPosition = (int)record.getCounterField().getValue(); m_iBitsToCheck |= 1 << sBitPosition; } } catch (DBException e) { e.printStackTrace(); } } return m_iBitsToCheck; }
[ "public", "int", "getBitsToCheck", "(", ")", "{", "if", "(", "m_iBitsToCheck", "==", "0", ")", "{", "Record", "record", "=", "this", ".", "makeReferenceRecord", "(", ")", ";", "try", "{", "record", ".", "close", "(", ")", ";", "while", "(", "record", ".", "hasNext", "(", ")", ")", "// 0 = First Day -> 6 = Last Day of Week", "{", "record", ".", "next", "(", ")", ";", "int", "sBitPosition", "=", "(", "int", ")", "record", ".", "getCounterField", "(", ")", ".", "getValue", "(", ")", ";", "m_iBitsToCheck", "|=", "1", "<<", "sBitPosition", ";", "}", "}", "catch", "(", "DBException", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "}", "}", "return", "m_iBitsToCheck", ";", "}" ]
Mask of valid bits.
[ "Mask", "of", "valid", "bits", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/BitReferenceField.java#L121-L139
151,297
microfocus-idol/java-configuration-impl
src/main/java/com/hp/autonomy/frontend/configuration/redis/RedisConfig.java
RedisConfig.basicValidate
@Override public void basicValidate(final String section) throws ConfigException { super.basicValidate(CONFIG_SECTION); if (address == null && (sentinels == null || sentinels.isEmpty())) { throw new ConfigException(CONFIG_SECTION, "Redis configuration requires either an address or at least one sentinel to connect to"); } if (sentinels != null && !sentinels.isEmpty()) { if (StringUtils.isBlank(masterName)) { throw new ConfigException(CONFIG_SECTION, "Redis configuration requires a masterName when connecting to sentinel"); } for (final HostAndPort sentinel : sentinels) { sentinel.basicValidate(CONFIG_SECTION); } } }
java
@Override public void basicValidate(final String section) throws ConfigException { super.basicValidate(CONFIG_SECTION); if (address == null && (sentinels == null || sentinels.isEmpty())) { throw new ConfigException(CONFIG_SECTION, "Redis configuration requires either an address or at least one sentinel to connect to"); } if (sentinels != null && !sentinels.isEmpty()) { if (StringUtils.isBlank(masterName)) { throw new ConfigException(CONFIG_SECTION, "Redis configuration requires a masterName when connecting to sentinel"); } for (final HostAndPort sentinel : sentinels) { sentinel.basicValidate(CONFIG_SECTION); } } }
[ "@", "Override", "public", "void", "basicValidate", "(", "final", "String", "section", ")", "throws", "ConfigException", "{", "super", ".", "basicValidate", "(", "CONFIG_SECTION", ")", ";", "if", "(", "address", "==", "null", "&&", "(", "sentinels", "==", "null", "||", "sentinels", ".", "isEmpty", "(", ")", ")", ")", "{", "throw", "new", "ConfigException", "(", "CONFIG_SECTION", ",", "\"Redis configuration requires either an address or at least one sentinel to connect to\"", ")", ";", "}", "if", "(", "sentinels", "!=", "null", "&&", "!", "sentinels", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "StringUtils", ".", "isBlank", "(", "masterName", ")", ")", "{", "throw", "new", "ConfigException", "(", "CONFIG_SECTION", ",", "\"Redis configuration requires a masterName when connecting to sentinel\"", ")", ";", "}", "for", "(", "final", "HostAndPort", "sentinel", ":", "sentinels", ")", "{", "sentinel", ".", "basicValidate", "(", "CONFIG_SECTION", ")", ";", "}", "}", "}" ]
Validates the configuration @throws ConfigException If either: <ul> <li>address is non null and invalid</li> <li>address is null and sentinels is null or empty </li> <li>sentinels is non null and non empty and masterName is null or blank</li> <li>any sentinels are invalid</li> </ul>
[ "Validates", "the", "configuration" ]
cd9d744cacfaaae3c76cacc211e65742bbc7b00a
https://github.com/microfocus-idol/java-configuration-impl/blob/cd9d744cacfaaae3c76cacc211e65742bbc7b00a/src/main/java/com/hp/autonomy/frontend/configuration/redis/RedisConfig.java#L57-L74
151,298
openCage/eightyfs
src/main/java/de/pfabulist/lindwurm/eighty/path/RealPath.java
RealPath.to
public EightyPath to() { EightyPath inital = start; final RealIt it = new RealIt( start ); if( !Repeater.repeat(). upto( 1000 ). until( () -> { it.set( minusOne( it ) ); return !it.foundSymLink; } ) ) { throw new IllegalStateException( "sym link loop detected in path " + start ); } EightyPath ret = it.path; if( inital.equals( ret ) ) { inital.setTestedReal(); return inital; } ret.setTestedReal(); return ret; }
java
public EightyPath to() { EightyPath inital = start; final RealIt it = new RealIt( start ); if( !Repeater.repeat(). upto( 1000 ). until( () -> { it.set( minusOne( it ) ); return !it.foundSymLink; } ) ) { throw new IllegalStateException( "sym link loop detected in path " + start ); } EightyPath ret = it.path; if( inital.equals( ret ) ) { inital.setTestedReal(); return inital; } ret.setTestedReal(); return ret; }
[ "public", "EightyPath", "to", "(", ")", "{", "EightyPath", "inital", "=", "start", ";", "final", "RealIt", "it", "=", "new", "RealIt", "(", "start", ")", ";", "if", "(", "!", "Repeater", ".", "repeat", "(", ")", ".", "upto", "(", "1000", ")", ".", "until", "(", "(", ")", "->", "{", "it", ".", "set", "(", "minusOne", "(", "it", ")", ")", ";", "return", "!", "it", ".", "foundSymLink", ";", "}", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"sym link loop detected in path \"", "+", "start", ")", ";", "}", "EightyPath", "ret", "=", "it", ".", "path", ";", "if", "(", "inital", ".", "equals", "(", "ret", ")", ")", "{", "inital", ".", "setTestedReal", "(", ")", ";", "return", "inital", ";", "}", "ret", ".", "setTestedReal", "(", ")", ";", "return", "ret", ";", "}" ]
build an absolute, normalized and symbolic link free path of the same file or dir @return
[ "build", "an", "absolute", "normalized", "and", "symbolic", "link", "free", "path", "of", "the", "same", "file", "or", "dir" ]
708ec4d336ee5e3dbd4196099f64091eaf6b3387
https://github.com/openCage/eightyfs/blob/708ec4d336ee5e3dbd4196099f64091eaf6b3387/src/main/java/de/pfabulist/lindwurm/eighty/path/RealPath.java#L55-L77
151,299
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseHolder.java
BaseHolder.free
public void free() { if ((m_mapChildHolders != null) && (m_mapChildHolders.size() > 0)) { Utility.getLogger().info("Not all sub-sessions freed by client - I will free them"); synchronized (this) { Object[] keys = m_mapChildHolders.keySet().toArray(); // Since these are removed on free for (Object strID : keys) { BaseHolder baseHolder = (BaseHolder)m_mapChildHolders.get(strID); baseHolder.free(); // Should be removed from collection. } m_mapChildHolders.clear(); } } m_mapChildHolders = null; if (m_parentHolder != null) m_parentHolder.remove(this); m_parentHolder = null; m_remoteObject = null; }
java
public void free() { if ((m_mapChildHolders != null) && (m_mapChildHolders.size() > 0)) { Utility.getLogger().info("Not all sub-sessions freed by client - I will free them"); synchronized (this) { Object[] keys = m_mapChildHolders.keySet().toArray(); // Since these are removed on free for (Object strID : keys) { BaseHolder baseHolder = (BaseHolder)m_mapChildHolders.get(strID); baseHolder.free(); // Should be removed from collection. } m_mapChildHolders.clear(); } } m_mapChildHolders = null; if (m_parentHolder != null) m_parentHolder.remove(this); m_parentHolder = null; m_remoteObject = null; }
[ "public", "void", "free", "(", ")", "{", "if", "(", "(", "m_mapChildHolders", "!=", "null", ")", "&&", "(", "m_mapChildHolders", ".", "size", "(", ")", ">", "0", ")", ")", "{", "Utility", ".", "getLogger", "(", ")", ".", "info", "(", "\"Not all sub-sessions freed by client - I will free them\"", ")", ";", "synchronized", "(", "this", ")", "{", "Object", "[", "]", "keys", "=", "m_mapChildHolders", ".", "keySet", "(", ")", ".", "toArray", "(", ")", ";", "// Since these are removed on free", "for", "(", "Object", "strID", ":", "keys", ")", "{", "BaseHolder", "baseHolder", "=", "(", "BaseHolder", ")", "m_mapChildHolders", ".", "get", "(", "strID", ")", ";", "baseHolder", ".", "free", "(", ")", ";", "// Should be removed from collection.", "}", "m_mapChildHolders", ".", "clear", "(", ")", ";", "}", "}", "m_mapChildHolders", "=", "null", ";", "if", "(", "m_parentHolder", "!=", "null", ")", "m_parentHolder", ".", "remove", "(", "this", ")", ";", "m_parentHolder", "=", "null", ";", "m_remoteObject", "=", "null", ";", "}" ]
Free the resources for this holder.
[ "Free", "the", "resources", "for", "this", "holder", "." ]
4037fcfa85f60c7d0096c453c1a3cd573c2b0abc
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/proxy/BaseHolder.java#L67-L88