target
stringlengths
20
113k
src_fm
stringlengths
11
86.3k
src_fm_fc
stringlengths
21
86.4k
src_fm_fc_co
stringlengths
30
86.4k
src_fm_fc_ms
stringlengths
42
86.8k
src_fm_fc_ms_ff
stringlengths
43
86.8k
@Test(expected = NullPointerException.class) public void test_comparator_indexOf_null_arguments() { indexOf(null, new String[] {null}, String.CASE_INSENSITIVE_ORDER); }
public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
@Test(expected = NullPointerException.class) public void test_comparator_indexOf_null_arguments_null_comparator() { indexOf(null, new String[] {null}, null); }
public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
@Test(expected = NullPointerException.class) public void test_comparator_indexOf_illegal_arg() { indexOf(10, null, null); }
public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
@Test public void test_bounded_comparator_indexOf() { String[] ary = new String[] {"a", "b", "c", "d", "B"}; assertEquals(1, indexOf("B", ary, 0, 5, String.CASE_INSENSITIVE_ORDER)); assertEquals(4, indexOf("b", ary, 2, 5, String.CASE_INSENSITIVE_ORDER)); assertEquals(-1, indexOf("b", ary, 2, 4, String.CASE_INSENSITIVE_...
public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
@Test public void test_bounded_comparator_indexOf_illegal_arg() { String[] ary = new String[] {"a", "b", "c", "d", "B"}; try { indexOf("b", null, 2, 1, null); fail(); } catch (NullPointerException ignored) {} try { indexOf("b", ary, -2, -1, null); fail(); } catch (IndexOutOfBoundsException ignored) {} try { indexOf("b"...
public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
@Test(expected = NullPointerException.class) public void test_bounded_comparator_indexOf_null_arguments() { indexOf(null, new String[] {null}, 0, 1, String.CASE_INSENSITIVE_ORDER); }
public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
@Test(expected = NullPointerException.class) public void test_bounded_comparator_indexOf_null_arguments_null_comparator() { indexOf(null, new String[] {null}, 0, 1, null); }
public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
@Test public void test_lastIndexOf() { Integer[] ary = new Integer[] {10, 11, 12, 13, null, 10, 11, 12, 13, null}; assertEquals(9, lastIndexOf(null, ary)); assertEquals(6, lastIndexOf(11, ary)); assertEquals(-1, lastIndexOf(42, ary)); assertEquals(-1, lastIndexOf(null, new Integer[] {1, 2, 3})); }
public static <T> int lastIndexOf(T element, T[] array) { if (element == null) { for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; } } } else { for (int i = array.length - 1; i >= 0; i--) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int lastIndexOf(T element, T[] array) { if (element == null) { for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; } } } else { for (int i = array.length - 1; i >= 0; i--) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int lastIndexOf(T element, T[] array) { if (element == null) { for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; } } } else { for (int i = array.length - 1; i >= 0; i--) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int lastIndexOf(T element, T[] array) { if (element == null) { for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; } } } else { for (int i = array.length - 1; i >= 0; i--) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); sta...
ArrayTools { public static <T> int lastIndexOf(T element, T[] array) { if (element == null) { for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; } } } else { for (int i = array.length - 1; i >= 0; i--) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); sta...
@Test(expected = NullPointerException.class) public void test_lastIndexOf_illegal_arg() { lastIndexOf(10, null); }
public static <T> int lastIndexOf(T element, T[] array) { if (element == null) { for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; } } } else { for (int i = array.length - 1; i >= 0; i--) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int lastIndexOf(T element, T[] array) { if (element == null) { for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; } } } else { for (int i = array.length - 1; i >= 0; i--) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int lastIndexOf(T element, T[] array) { if (element == null) { for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; } } } else { for (int i = array.length - 1; i >= 0; i--) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int lastIndexOf(T element, T[] array) { if (element == null) { for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; } } } else { for (int i = array.length - 1; i >= 0; i--) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); sta...
ArrayTools { public static <T> int lastIndexOf(T element, T[] array) { if (element == null) { for (int i = array.length - 1; i >= 0; i--) { if (array[i] == null) { return i; } } } else { for (int i = array.length - 1; i >= 0; i--) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); sta...
@Test public void test_collectProperties_composite_type_with_diamond() throws IntrospectionException { List<GrainProperty> result; result = collectProperties(C.class); assertEquals(3, result.size()); assertEquals("c", result.get(0).getName()); assertEquals("a", result.get(1).getName()); assertEquals("b", result.get(2)....
static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpty()) { Type cu...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
@Test public void test_check_range() { checkRange(0, 0, 2); checkRange(0, 2, 2); checkRange(2, 2, 2); try { checkRange(-1, 2, 2); fail(); } catch (IndexOutOfBoundsException ignored) {} try { checkRange( 0, 3, 2); fail(); } catch (IndexOutOfBoundsException ignored) {} try { checkRange( 7, 6, 2); fail(); } catch (IndexOu...
public static void checkRange(int fromIndex, int toIndex, int length) { if (fromIndex < 0 || toIndex > length) { throw new IndexOutOfBoundsException( String.format("range [%d, %d) is outside bounds [%d, %d)", fromIndex, toIndex, 0, length)); } if (fromIndex > toIndex) { throw new IllegalArgumentException( String.format...
ArrayTools { public static void checkRange(int fromIndex, int toIndex, int length) { if (fromIndex < 0 || toIndex > length) { throw new IndexOutOfBoundsException( String.format("range [%d, %d) is outside bounds [%d, %d)", fromIndex, toIndex, 0, length)); } if (fromIndex > toIndex) { throw new IllegalArgumentException( ...
ArrayTools { public static void checkRange(int fromIndex, int toIndex, int length) { if (fromIndex < 0 || toIndex > length) { throw new IndexOutOfBoundsException( String.format("range [%d, %d) is outside bounds [%d, %d)", fromIndex, toIndex, 0, length)); } if (fromIndex > toIndex) { throw new IllegalArgumentException( ...
ArrayTools { public static void checkRange(int fromIndex, int toIndex, int length) { if (fromIndex < 0 || toIndex > length) { throw new IndexOutOfBoundsException( String.format("range [%d, %d) is outside bounds [%d, %d)", fromIndex, toIndex, 0, length)); } if (fromIndex > toIndex) { throw new IllegalArgumentException( ...
ArrayTools { public static void checkRange(int fromIndex, int toIndex, int length) { if (fromIndex < 0 || toIndex > length) { throw new IndexOutOfBoundsException( String.format("range [%d, %d) is outside bounds [%d, %d)", fromIndex, toIndex, 0, length)); } if (fromIndex > toIndex) { throw new IllegalArgumentException( ...
@Test public void test_sort() { Integer[] a = new Integer[] {3, 2, 1}; assertArrayEquals(new Integer[] {1, 2, 3}, sort(a)); assertSame(a, sort(a)); }
public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); static int indexOf(T element, T[] array); static int indexOf(T element, T[] array, int fromIndex, int toIndex); static int indexOf(T element, T[] array, Comparator<? super T> comparator); static int indexOf(T element, T[...
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); static int indexOf(T element, T[] array); static int indexOf(T element, T[] array, int fromIndex, int toIndex); static int indexOf(T element, T[] array, Comparator<? super T> comparator); static int indexOf(T element, T[...
@Test(expected = NullPointerException.class) public void test_sort_nulls() { Integer[] a = new Integer[] {null, null}; sort(a); }
public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); static int indexOf(T element, T[] array); static int indexOf(T element, T[] array, int fromIndex, int toIndex); static int indexOf(T element, T[] array, Comparator<? super T> comparator); static int indexOf(T element, T[...
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); static int indexOf(T element, T[] array); static int indexOf(T element, T[] array, int fromIndex, int toIndex); static int indexOf(T element, T[] array, Comparator<? super T> comparator); static int indexOf(T element, T[...
@Test public void test_sort_comparator() { Integer[] a = new Integer[] {2, 1, 3}; assertArrayEquals(new Integer[] {1, 2, 3}, sort(a, null)); assertSame(a, sort(a, null)); assertArrayEquals(new Integer[] {3, 2, 1}, sort(a, Collections.reverseOrder())); assertSame(a, sort(a, Collections.reverseOrder())); }
public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); static int indexOf(T element, T[] array); static int indexOf(T element, T[] array, int fromIndex, int toIndex); static int indexOf(T element, T[] array, Comparator<? super T> comparator); static int indexOf(T element, T[...
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); static int indexOf(T element, T[] array); static int indexOf(T element, T[] array, int fromIndex, int toIndex); static int indexOf(T element, T[] array, Comparator<? super T> comparator); static int indexOf(T element, T[...
@Test(expected = NullPointerException.class) public void test_sort_comparator_nulls() { String[] a = new String[] {null, null}; sort(a, String.CASE_INSENSITIVE_ORDER); }
public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); }
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); static int indexOf(T element, T[] array); static int indexOf(T element, T[] array, int fromIndex, int toIndex); static int indexOf(T element, T[] array, Comparator<? super T> comparator); static int indexOf(T element, T[...
ArrayTools { public static <T> T[] sort(T[] a) { Arrays.sort(a); return a; } private ArrayTools(); static int indexOf(T element, T[] array); static int indexOf(T element, T[] array, int fromIndex, int toIndex); static int indexOf(T element, T[] array, Comparator<? super T> comparator); static int indexOf(T element, T[...
@Test public void test_indexOf_bad_types() { final Object[] EMPTY = new Object[0]; final Object notComparable = new Object(); @SuppressWarnings("unchecked") Comparator<Object> comparator = (Comparator)String.CASE_INSENSITIVE_ORDER; assertEquals(-1, indexOf(notComparable, EMPTY, null)); assertEquals(-1, indexOf(null, EM...
public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
@Test public void test_indexOf_range_bad_types() { final Object[] items = new Object[] {"a", "b", "c"}; final Object notComparable = new Object(); @SuppressWarnings("unchecked") Comparator<Object> comparator = (Comparator)String.CASE_INSENSITIVE_ORDER; assertEquals(-1, indexOf(notComparable, items, 1, 1, null)); assert...
public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); }
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
ArrayTools { public static <T> int indexOf(T element, T[] array) { if (element == null) { for (int i = 0; i < array.length; i++) { if (array[i] == null) { return i; } } } else { for (int i = 0; i < array.length; i++) { if (element.equals(array[i])) { return i; } } } return -1; } private ArrayTools(); static int indexO...
@Test public void test_daemon_thread_factory() { Runnable r = mock(Runnable.class); Thread thread = new Thread(r); thread.setDaemon(false); ThreadFactory factory = mock(ThreadFactory.class); when(factory.newThread(any(Runnable.class))).thenReturn(thread); assertSame(thread, newDaemonThreadFactory(factory).newThread(r))...
public static ThreadFactory newDaemonThreadFactory(final ThreadFactory wrapped) { Objects.requireNonNull(wrapped); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = wrapped.newThread(r); if (!t.isDaemon()) { t.setDaemon(true); } return t; } }; }
ThreadTools { public static ThreadFactory newDaemonThreadFactory(final ThreadFactory wrapped) { Objects.requireNonNull(wrapped); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = wrapped.newThread(r); if (!t.isDaemon()) { t.setDaemon(true); } return t; } }; } }
ThreadTools { public static ThreadFactory newDaemonThreadFactory(final ThreadFactory wrapped) { Objects.requireNonNull(wrapped); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = wrapped.newThread(r); if (!t.isDaemon()) { t.setDaemon(true); } return t; } }; } private ThreadTools()...
ThreadTools { public static ThreadFactory newDaemonThreadFactory(final ThreadFactory wrapped) { Objects.requireNonNull(wrapped); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = wrapped.newThread(r); if (!t.isDaemon()) { t.setDaemon(true); } return t; } }; } private ThreadTools()...
ThreadTools { public static ThreadFactory newDaemonThreadFactory(final ThreadFactory wrapped) { Objects.requireNonNull(wrapped); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = wrapped.newThread(r); if (!t.isDaemon()) { t.setDaemon(true); } return t; } }; } private ThreadTools()...
@Test public void test_naming_thread_factory() { Runnable r = mock(Runnable.class); Thread thread = new Thread(r); thread.setName("Foo"); ThreadFactory factory = mock(ThreadFactory.class); when(factory.newThread(any(Runnable.class))).thenReturn(thread); assertSame(thread, newNamingThreadFactory("#%d %s", factory).newTh...
public static ThreadFactory newNamingThreadFactory(final String format, final ThreadFactory wrapped) { String.format(format, 0, "test name"); Objects.requireNonNull(wrapped); final AtomicInteger threadNumber = new AtomicInteger(0); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = ...
ThreadTools { public static ThreadFactory newNamingThreadFactory(final String format, final ThreadFactory wrapped) { String.format(format, 0, "test name"); Objects.requireNonNull(wrapped); final AtomicInteger threadNumber = new AtomicInteger(0); return new ThreadFactory() { @Override public Thread newThread(Runnable r)...
ThreadTools { public static ThreadFactory newNamingThreadFactory(final String format, final ThreadFactory wrapped) { String.format(format, 0, "test name"); Objects.requireNonNull(wrapped); final AtomicInteger threadNumber = new AtomicInteger(0); return new ThreadFactory() { @Override public Thread newThread(Runnable r)...
ThreadTools { public static ThreadFactory newNamingThreadFactory(final String format, final ThreadFactory wrapped) { String.format(format, 0, "test name"); Objects.requireNonNull(wrapped); final AtomicInteger threadNumber = new AtomicInteger(0); return new ThreadFactory() { @Override public Thread newThread(Runnable r)...
ThreadTools { public static ThreadFactory newNamingThreadFactory(final String format, final ThreadFactory wrapped) { String.format(format, 0, "test name"); Objects.requireNonNull(wrapped); final AtomicInteger threadNumber = new AtomicInteger(0); return new ThreadFactory() { @Override public Thread newThread(Runnable r)...
@Test public void test_context_thread_factory() { Runnable r = mock(Runnable.class); Thread thread = new Thread(r); ThreadFactory factory = mock(ThreadFactory.class); when(factory.newThread(any(Runnable.class))).thenReturn(thread); ClassLoader cl = new URLClassLoader(new URL[] {}); assertSame(thread, newContextThreadFa...
public static ThreadFactory newContextThreadFactory(final ClassLoader classLoader, final ThreadFactory wrapped) { Objects.requireNonNull(wrapped); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = wrapped.newThread(r); t.setContextClassLoader(classLoader); return t; } }; }
ThreadTools { public static ThreadFactory newContextThreadFactory(final ClassLoader classLoader, final ThreadFactory wrapped) { Objects.requireNonNull(wrapped); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = wrapped.newThread(r); t.setContextClassLoader(classLoader); return t; }...
ThreadTools { public static ThreadFactory newContextThreadFactory(final ClassLoader classLoader, final ThreadFactory wrapped) { Objects.requireNonNull(wrapped); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = wrapped.newThread(r); t.setContextClassLoader(classLoader); return t; }...
ThreadTools { public static ThreadFactory newContextThreadFactory(final ClassLoader classLoader, final ThreadFactory wrapped) { Objects.requireNonNull(wrapped); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = wrapped.newThread(r); t.setContextClassLoader(classLoader); return t; }...
ThreadTools { public static ThreadFactory newContextThreadFactory(final ClassLoader classLoader, final ThreadFactory wrapped) { Objects.requireNonNull(wrapped); return new ThreadFactory() { @Override public Thread newThread(Runnable r) { Thread t = wrapped.newThread(r); t.setContextClassLoader(classLoader); return t; }...
@Test public void test_collectProperties_with_duplicate_property_names() throws IntrospectionException { List<GrainProperty> result; result = collectProperties(R.class); assertEquals(3, result.size()); assertEquals(R.class, result.get(0).getType()); assertEquals(P.class, result.get(1).getType()); assertEquals(Q.class, ...
static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpty()) { Type cu...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
@Test public void test_capitalize() { assertEquals("HellO", capitalize("hellO")); assertEquals("HellO", capitalize("HellO")); assertEquals("A", capitalize("a")); assertEquals("", capitalize("")); assertNull(capitalize(null)); }
public static String capitalize(String s) { return s == null || s.isEmpty() ? s : s.substring(0, 1).toUpperCase(Locale.ENGLISH) + s.substring(1); }
StringTools { public static String capitalize(String s) { return s == null || s.isEmpty() ? s : s.substring(0, 1).toUpperCase(Locale.ENGLISH) + s.substring(1); } }
StringTools { public static String capitalize(String s) { return s == null || s.isEmpty() ? s : s.substring(0, 1).toUpperCase(Locale.ENGLISH) + s.substring(1); } private StringTools(); }
StringTools { public static String capitalize(String s) { return s == null || s.isEmpty() ? s : s.substring(0, 1).toUpperCase(Locale.ENGLISH) + s.substring(1); } private StringTools(); static String capitalize(String s); }
StringTools { public static String capitalize(String s) { return s == null || s.isEmpty() ? s : s.substring(0, 1).toUpperCase(Locale.ENGLISH) + s.substring(1); } private StringTools(); static String capitalize(String s); }
@Test public void test_coalesce() { Object x = new Object(); Object y = new Object(); assertSame(x, coalesce(x, y)); assertSame(x, coalesce(x, null)); assertNull(coalesce(null, null)); assertSame(y, coalesce(null, y)); }
public static <T> T coalesce(T x, T y) { return x != null ? x : y; }
ObjectTools { public static <T> T coalesce(T x, T y) { return x != null ? x : y; } }
ObjectTools { public static <T> T coalesce(T x, T y) { return x != null ? x : y; } private ObjectTools(); }
ObjectTools { public static <T> T coalesce(T x, T y) { return x != null ? x : y; } private ObjectTools(); static T coalesce(T x, T y); static int compare(T left, T right, Comparator<? super T> comparator); }
ObjectTools { public static <T> T coalesce(T x, T y) { return x != null ? x : y; } private ObjectTools(); static T coalesce(T x, T y); static int compare(T left, T right, Comparator<? super T> comparator); }
@Test public void test_compare() { assertEquals( 0, compare(1, 1, null)); assertEquals(-1, compare(0, 1, null)); assertEquals( 1, compare(1, 0, null)); assertEquals( 0, compare(1, 1, Collections.reverseOrder())); assertEquals( 1, compare(0, 1, Collections.reverseOrder())); assertEquals(-1, compare(1, 0, Collections.rev...
public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); static...
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); static...
@Test public void test_compare_nulls() { @SuppressWarnings("unchecked") Comparator<Object> c = (Comparator<Object>)mock(Comparator.class); when(c.compare(any(), any())).thenReturn(5); assertEquals(5, compare(null, null, c)); }
public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); static...
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); static...
@Test(expected = NullPointerException.class) public void test_natural_compare_nulls() { compare(null, 5, null); }
public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); static...
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); static...
@Test(expected = ClassCastException.class) public void test_compare_not_comparable() { compare(int.class, int.class, null); }
public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); }
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); static...
ObjectTools { public static <T> int compare(T left, T right, Comparator<? super T> comparator) { if (comparator == null) { @SuppressWarnings("unchecked") Comparable<T> leftComparable = (Comparable<T>)left; return leftComparable.compareTo(right); } return comparator.compare(left, right); } private ObjectTools(); static...
@Test public void test_recursive_type_variable() { compare(MY_ENUM.getE(), new LateTypeVariable<Class>("E", MyEnum.class, MY_ENUM.getE().getBounds()[0])); }
@Override public Type[] getBounds() { if (bounds != null) { return bounds.clone(); } throw new IllegalStateException("bounds have not yet been assigned"); }
LateTypeVariable implements TypeVariable<D> { @Override public Type[] getBounds() { if (bounds != null) { return bounds.clone(); } throw new IllegalStateException("bounds have not yet been assigned"); } }
LateTypeVariable implements TypeVariable<D> { @Override public Type[] getBounds() { if (bounds != null) { return bounds.clone(); } throw new IllegalStateException("bounds have not yet been assigned"); } LateTypeVariable(String name, D genericDeclaration, Type... bounds); }
LateTypeVariable implements TypeVariable<D> { @Override public Type[] getBounds() { if (bounds != null) { return bounds.clone(); } throw new IllegalStateException("bounds have not yet been assigned"); } LateTypeVariable(String name, D genericDeclaration, Type... bounds); static LateTypeVariable<D> copyOf(TypeVariable<D...
LateTypeVariable implements TypeVariable<D> { @Override public Type[] getBounds() { if (bounds != null) { return bounds.clone(); } throw new IllegalStateException("bounds have not yet been assigned"); } LateTypeVariable(String name, D genericDeclaration, Type... bounds); static LateTypeVariable<D> copyOf(TypeVariable<D...
@Test public void test_equality() { TypeToken<Set<String>> setOfString1 = new TypeToken<Set<String>>(){}; TypeToken<Set<String>> setOfString2 = new TypeToken<Set<String>>(){}; TypeToken<Set<Long>> setOfLong = new TypeToken<Set<Long>>(){}; assertEquals(setOfString1, setOfString2); assertEquals(setOfString1.hashCode(), s...
@Override public final int hashCode() { return type.hashCode(); }
TypeToken { @Override public final int hashCode() { return type.hashCode(); } }
TypeToken { @Override public final int hashCode() { return type.hashCode(); } protected TypeToken(); }
TypeToken { @Override public final int hashCode() { return type.hashCode(); } protected TypeToken(); final Type asType(); final T asNull(); @Override final boolean equals(Object that); @Override final int hashCode(); @Override final String toString(); }
TypeToken { @Override public final int hashCode() { return type.hashCode(); } protected TypeToken(); final Type asType(); final T asNull(); @Override final boolean equals(Object that); @Override final int hashCode(); @Override final String toString(); }
@Test public void test_typed_null() { TypeToken<Long> token = new TypeToken<Long>(){}; assertEquals(42, invoke(token.asNull())); }
public final T asNull() { return null; }
TypeToken { public final T asNull() { return null; } }
TypeToken { public final T asNull() { return null; } protected TypeToken(); }
TypeToken { public final T asNull() { return null; } protected TypeToken(); final Type asType(); final T asNull(); @Override final boolean equals(Object that); @Override final int hashCode(); @Override final String toString(); }
TypeToken { public final T asNull() { return null; } protected TypeToken(); final Type asType(); final T asNull(); @Override final boolean equals(Object that); @Override final int hashCode(); @Override final String toString(); }
@Test public void test_nested_print() { assertEquals( "net.nullschool.reflect.Outer<java.lang.Short>.Inner1<java.lang.Integer>.Inner2<java.lang.Long>", new TypeToken<Outer<Short>.Inner1<Integer>.Inner2<Long>>(){}.asType().toString()); assertEquals( "net.nullschool.reflect.Outer.$Inner3<java.lang.Integer>", new TypeToke...
@Override public String toString() { return print(this); }
LateParameterizedType implements ParameterizedType { @Override public String toString() { return print(this); } }
LateParameterizedType implements ParameterizedType { @Override public String toString() { return print(this); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); }
LateParameterizedType implements ParameterizedType { @Override public String toString() { return print(this); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType(); @Ov...
LateParameterizedType implements ParameterizedType { @Override public String toString() { return print(this); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType(); @Ov...
@Test public void test_collectProperties_with_narrowest_type_in_upper_level() throws IntrospectionException { List<GrainProperty> result; result = collectProperties(W.class); assertEquals(3, result.size()); assertEquals(Object.class, result.get(0).getType()); assertEquals(Integer.class, result.get(1).getType()); assert...
static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpty()) { Type cu...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
SymbolTable { static List<GrainProperty> collectProperties(Type type) throws IntrospectionException { List<GrainProperty> results = new ArrayList<>(); Set<Type> visited = new HashSet<>(); visited.add(null); visited.add(Object.class); Deque<Type> workList = new LinkedList<>(); workList.add(type); while (!workList.isEmpt...
@Test public void test_resolve() throws Exception { LateParameterizedType lpc = new LateParameterizedType(Map.class, null, String.class, Integer.class); Method putMethod = Map.class.getMethod("put", Object.class, Object.class); assertEquals(Integer.class, lpc.resolve(putMethod.getGenericReturnType())); assertArrayEqual...
public Type resolve(Type type) { return resolver.apply(type); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
@Test public void test_recursive_resolve() throws Exception { LateParameterizedType lpc = new LateParameterizedType(Map.class, null, String.class, Integer.class); assertEquals(lpc, lpc.resolve(new LateParameterizedType(Map.class, null, Map.class.getTypeParameters()))); }
public Type resolve(Type type) { return resolver.apply(type); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
@Test public void test_resolve_uninstantiated_type() throws Exception { TypeVariable<?>[] typeVars = Map.class.getTypeParameters(); LateParameterizedType lpc = new LateParameterizedType(Map.class, null, Map.class.getTypeParameters()); Method m = Map.class.getMethod("put", Object.class, Object.class); assertEquals(typeV...
public Type resolve(Type type) { return resolver.apply(type); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
@Test public void test_resolve_partially_instantiated_type() throws Exception { TypeVariable<?>[] typeVars = Map.class.getTypeParameters(); LateParameterizedType lpc = new LateParameterizedType(Map.class, null, String.class, typeVars[1]); Method m = Map.class.getMethod("put", Object.class, Object.class); assertEquals(t...
public Type resolve(Type type) { return resolver.apply(type); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
@Test public void test_resolve_causes_concrete_array_instantiation() throws Exception { TypeVariable<?> E = List.class.getTypeParameters()[0]; LateParameterizedType lpc = new LateParameterizedType(List.class, null, Integer.class); LateGenericArrayType arrayOfE = new LateGenericArrayType(E); LateGenericArrayType arrayOf...
public Type resolve(Type type) { return resolver.apply(type); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
@Test public void test_generic_method_shadows_enclosing_type_parameter() throws Exception { LateParameterizedType lpc = new LateParameterizedType(Foo.class, null, Integer.class); Method m = Foo.class.getMethod("bar", Object.class); assertEquals(m.getGenericReturnType(), lpc.resolve(m.getGenericReturnType())); assertArr...
public Type resolve(Type type) { return resolver.apply(type); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); }
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
LateParameterizedType implements ParameterizedType { public Type resolve(Type type) { return resolver.apply(type); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Type getOwnerType()...
@Test public void test_superclass() { LateParameterizedType lpc = new LateParameterizedType(ArrayList.class, null, Long.class); compare( new JavaToken<AbstractList<Long>>(){}.asParameterizedType(), lpc = (LateParameterizedType)lpc.getSuperclass()); compare( new JavaToken<AbstractCollection<Long>>(){}.asParameterizedTyp...
public Type getSuperclass() { return resolve(rawType.getGenericSuperclass()); }
LateParameterizedType implements ParameterizedType { public Type getSuperclass() { return resolve(rawType.getGenericSuperclass()); } }
LateParameterizedType implements ParameterizedType { public Type getSuperclass() { return resolve(rawType.getGenericSuperclass()); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); }
LateParameterizedType implements ParameterizedType { public Type getSuperclass() { return resolve(rawType.getGenericSuperclass()); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Typ...
LateParameterizedType implements ParameterizedType { public Type getSuperclass() { return resolve(rawType.getGenericSuperclass()); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override Typ...
@Test public void test_interfaces() { LateParameterizedType lpc = new LateParameterizedType(ArrayList.class, null, Long.class); Type[] result = lpc.getInterfaces(); assertEquals(4, result.length); compare(new JavaToken<List<Long>>(){}.asParameterizedType(), lpc = (LateParameterizedType)result[0]); assertSame(RandomAcce...
public Type[] getInterfaces() { return resolve(rawType.getGenericInterfaces()); }
LateParameterizedType implements ParameterizedType { public Type[] getInterfaces() { return resolve(rawType.getGenericInterfaces()); } }
LateParameterizedType implements ParameterizedType { public Type[] getInterfaces() { return resolve(rawType.getGenericInterfaces()); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); }
LateParameterizedType implements ParameterizedType { public Type[] getInterfaces() { return resolve(rawType.getGenericInterfaces()); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override T...
LateParameterizedType implements ParameterizedType { public Type[] getInterfaces() { return resolve(rawType.getGenericInterfaces()); } LateParameterizedType(Type rawType, Type ownerType, Type... actualTypeArguments); static LateParameterizedType copyOf(ParameterizedType pt); @Override Class<?> getRawType(); @Override T...
@Test public void test_buildArrayType() { assertSame(int[].class, buildArrayType(int.class)); assertSame(int[][].class, buildArrayType(int[].class)); assertSame(Integer[].class, buildArrayType(Integer.class)); assertSame(Map[].class, buildArrayType(Map.class)); }
public static Class<?> buildArrayType(Class<?> componentType) { return Array.newInstance(componentType, 0).getClass(); }
TypeTools { public static Class<?> buildArrayType(Class<?> componentType) { return Array.newInstance(componentType, 0).getClass(); } }
TypeTools { public static Class<?> buildArrayType(Class<?> componentType) { return Array.newInstance(componentType, 0).getClass(); } private TypeTools(); }
TypeTools { public static Class<?> buildArrayType(Class<?> componentType) { return Array.newInstance(componentType, 0).getClass(); } private TypeTools(); static boolean isInnerClass(Class<?> clazz); static Class<?> buildArrayType(Class<?> componentType); static Class<?> erase(Type type); static String print(Type type)...
TypeTools { public static Class<?> buildArrayType(Class<?> componentType) { return Array.newInstance(componentType, 0).getClass(); } private TypeTools(); static boolean isInnerClass(Class<?> clazz); static Class<?> buildArrayType(Class<?> componentType); static Class<?> erase(Type type); static String print(Type type)...
@Test public void test_erasure() { assertSame(int.class, erase(int.class)); assertSame(Object.class, erase(Object.class)); assertSame(Object[].class, erase(Object[].class)); assertSame(Set[].class, erase(new JavaToken<Set<?>[]>(){}.asGenericArrayType())); assertSame(Object.class, erase(new JavaToken<Set<?>>(){}.asWildc...
public static Class<?> erase(Type type) { return Eraser.INSTANCE.apply(type); }
TypeTools { public static Class<?> erase(Type type) { return Eraser.INSTANCE.apply(type); } }
TypeTools { public static Class<?> erase(Type type) { return Eraser.INSTANCE.apply(type); } private TypeTools(); }
TypeTools { public static Class<?> erase(Type type) { return Eraser.INSTANCE.apply(type); } private TypeTools(); static boolean isInnerClass(Class<?> clazz); static Class<?> buildArrayType(Class<?> componentType); static Class<?> erase(Type type); static String print(Type type); static String print(Type type, TypePrin...
TypeTools { public static Class<?> erase(Type type) { return Eraser.INSTANCE.apply(type); } private TypeTools(); static boolean isInnerClass(Class<?> clazz); static Class<?> buildArrayType(Class<?> componentType); static Class<?> erase(Type type); static String print(Type type); static String print(Type type, TypePrin...
@Test public void test_immutify_known_immutable_types() { assertSame(boolean.class, immutify(boolean.class)); assertSame(byte.class, immutify(byte.class)); assertSame(short.class, immutify(short.class)); assertSame(int.class, immutify(int.class)); assertSame(long.class, immutify(long.class)); assertSame(float.class, im...
Immutify(TypeTable typeTable) { this.typeTable = typeTable; }
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } }
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } Immutify(TypeTable typeTable); }
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } Immutify(TypeTable typeTable); @Override Class<?> apply(Class<?> clazz); @Override Type apply(ParameterizedType pt); @Override Type apply(GenericArrayType gat); @Override Type apply(WildcardType wt); @Override Ty...
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } Immutify(TypeTable typeTable); @Override Class<?> apply(Class<?> clazz); @Override Type apply(ParameterizedType pt); @Override Type apply(GenericArrayType gat); @Override Type apply(WildcardType wt); @Override Ty...
@Test public void test_print() { assertEquals("java.util.List", print(List.class)); assertEquals("java.util.List[]", print(List[].class)); assertEquals( "java.util.List<? extends java.lang.Integer>", print(new JavaToken<List<? extends Integer>>(){}.asType())); assertEquals( "java.util.List<? extends java.lang.Integer>[...
public static String print(Type type) { return print(type, new FullNamePrinter()); }
TypeTools { public static String print(Type type) { return print(type, new FullNamePrinter()); } }
TypeTools { public static String print(Type type) { return print(type, new FullNamePrinter()); } private TypeTools(); }
TypeTools { public static String print(Type type) { return print(type, new FullNamePrinter()); } private TypeTools(); static boolean isInnerClass(Class<?> clazz); static Class<?> buildArrayType(Class<?> componentType); static Class<?> erase(Type type); static String print(Type type); static String print(Type type, Typ...
TypeTools { public static String print(Type type) { return print(type, new FullNamePrinter()); } private TypeTools(); static boolean isInnerClass(Class<?> clazz); static Class<?> buildArrayType(Class<?> componentType); static Class<?> erase(Type type); static String print(Type type); static String print(Type type, Typ...
@Test public void test_print_with_custom_printer() { assertEquals("~List", print(List.class, new PrependTildePrinter())); assertEquals("~List[]", print(List[].class, new PrependTildePrinter())); assertEquals( "~List<? extends ~Integer>", print(new JavaToken<List<? extends Integer>>(){}.asType(), new PrependTildePrinter...
public static String print(Type type) { return print(type, new FullNamePrinter()); }
TypeTools { public static String print(Type type) { return print(type, new FullNamePrinter()); } }
TypeTools { public static String print(Type type) { return print(type, new FullNamePrinter()); } private TypeTools(); }
TypeTools { public static String print(Type type) { return print(type, new FullNamePrinter()); } private TypeTools(); static boolean isInnerClass(Class<?> clazz); static Class<?> buildArrayType(Class<?> componentType); static Class<?> erase(Type type); static String print(Type type); static String print(Type type, Typ...
TypeTools { public static String print(Type type) { return print(type, new FullNamePrinter()); } private TypeTools(); static boolean isInnerClass(Class<?> clazz); static Class<?> buildArrayType(Class<?> componentType); static Class<?> erase(Type type); static String print(Type type); static String print(Type type, Typ...
@Test public void test_apply() { @SuppressWarnings("unchecked") TypeOperator<Type> operator = (TypeOperator<Type>)mock(TypeOperator.class); when(operator.apply((Type)String.class)).thenReturn(Character.class); when(operator.apply((Type)Integer.class)).thenReturn(Byte.class); Type[] result = apply(operator, new Type[] {...
public static Type[] apply(TypeOperator<? extends Type> operator, Type[] types) { Type[] result = types.length > 0 ? new Type[types.length] : types; for (int i = 0; i < types.length; i++) { result[i] = operator.apply(types[i]); } return result; }
TypeTools { public static Type[] apply(TypeOperator<? extends Type> operator, Type[] types) { Type[] result = types.length > 0 ? new Type[types.length] : types; for (int i = 0; i < types.length; i++) { result[i] = operator.apply(types[i]); } return result; } }
TypeTools { public static Type[] apply(TypeOperator<? extends Type> operator, Type[] types) { Type[] result = types.length > 0 ? new Type[types.length] : types; for (int i = 0; i < types.length; i++) { result[i] = operator.apply(types[i]); } return result; } private TypeTools(); }
TypeTools { public static Type[] apply(TypeOperator<? extends Type> operator, Type[] types) { Type[] result = types.length > 0 ? new Type[types.length] : types; for (int i = 0; i < types.length; i++) { result[i] = operator.apply(types[i]); } return result; } private TypeTools(); static boolean isInnerClass(Class<?> cl...
TypeTools { public static Type[] apply(TypeOperator<? extends Type> operator, Type[] types) { Type[] result = types.length > 0 ? new Type[types.length] : types; for (int i = 0; i < types.length; i++) { result[i] = operator.apply(types[i]); } return result; } private TypeTools(); static boolean isInnerClass(Class<?> cl...
@Test public void test_copyOf() { assertEquals(Class.class, copyOf(Object.class).getClass()); assertEquals(LateParameterizedType.class, copyOf(new JavaToken<Set<Byte>>(){}.asParameterizedType()).getClass()); assertEquals(LateGenericArrayType.class, copyOf(new JavaToken<Set<Byte>[]>(){}.asGenericArrayType()).getClass())...
static Type copyOf(Type type) { return LateTypeConverter.INSTANCE.apply(type); }
TypeTools { static Type copyOf(Type type) { return LateTypeConverter.INSTANCE.apply(type); } }
TypeTools { static Type copyOf(Type type) { return LateTypeConverter.INSTANCE.apply(type); } private TypeTools(); }
TypeTools { static Type copyOf(Type type) { return LateTypeConverter.INSTANCE.apply(type); } private TypeTools(); static boolean isInnerClass(Class<?> clazz); static Class<?> buildArrayType(Class<?> componentType); static Class<?> erase(Type type); static String print(Type type); static String print(Type type, TypePri...
TypeTools { static Type copyOf(Type type) { return LateTypeConverter.INSTANCE.apply(type); } private TypeTools(); static boolean isInnerClass(Class<?> clazz); static Class<?> buildArrayType(Class<?> componentType); static Class<?> erase(Type type); static String print(Type type); static String print(Type type, TypePri...
@Test public void test_extra_linguistic_wildcard_bounds() { assertEquals( "? extends java.io.Serializable & java.lang.Comparable", new LateWildcardType("? extends", Serializable.class, Comparable.class).toString()); assertEquals( "? extends java.lang.Class & java.lang.Class", new LateWildcardType("? extends", Class.cla...
@Override public String toString() { return print(this); }
LateWildcardType implements WildcardType { @Override public String toString() { return print(this); } }
LateWildcardType implements WildcardType { @Override public String toString() { return print(this); } private LateWildcardType(Type[] upperBounds, Type[] lowerBounds); LateWildcardType(String keyword, Type... bounds); }
LateWildcardType implements WildcardType { @Override public String toString() { return print(this); } private LateWildcardType(Type[] upperBounds, Type[] lowerBounds); LateWildcardType(String keyword, Type... bounds); static LateWildcardType copyOf(WildcardType wt); @Override Type[] getUpperBounds(); @Override Type[]...
LateWildcardType implements WildcardType { @Override public String toString() { return print(this); } private LateWildcardType(Type[] upperBounds, Type[] lowerBounds); LateWildcardType(String keyword, Type... bounds); static LateWildcardType copyOf(WildcardType wt); @Override Type[] getUpperBounds(); @Override Type[]...
@Test public void test_eraser() { Eraser eraser = Eraser.INSTANCE; assertSame(Object.class, eraser.apply(Object.class)); assertSame(Object[].class, eraser.apply(Object[].class)); assertSame(Set[].class, eraser.apply(new JavaToken<Set<?>[]>(){}.asGenericArrayType())); assertSame(Object.class, eraser.apply(new LateWildca...
@Override public Class<?> apply(Class<?> clazz) { return clazz; }
Eraser extends AbstractTypeOperator<Class<?>> { @Override public Class<?> apply(Class<?> clazz) { return clazz; } }
Eraser extends AbstractTypeOperator<Class<?>> { @Override public Class<?> apply(Class<?> clazz) { return clazz; } }
Eraser extends AbstractTypeOperator<Class<?>> { @Override public Class<?> apply(Class<?> clazz) { return clazz; } @Override Class<?> apply(Class<?> clazz); @Override Class<?> apply(ParameterizedType pt); @Override Class<?> apply(GenericArrayType gat); @Override Class<?> apply(WildcardType wt); @Override Class<?> apply...
Eraser extends AbstractTypeOperator<Class<?>> { @Override public Class<?> apply(Class<?> clazz) { return clazz; } @Override Class<?> apply(Class<?> clazz); @Override Class<?> apply(ParameterizedType pt); @Override Class<?> apply(GenericArrayType gat); @Override Class<?> apply(WildcardType wt); @Override Class<?> apply...
@Test(expected = IllegalArgumentException.class) public void test_eraser_unknown() { Eraser.INSTANCE.apply(new Type(){}); }
@Override public Class<?> apply(Class<?> clazz) { return clazz; }
Eraser extends AbstractTypeOperator<Class<?>> { @Override public Class<?> apply(Class<?> clazz) { return clazz; } }
Eraser extends AbstractTypeOperator<Class<?>> { @Override public Class<?> apply(Class<?> clazz) { return clazz; } }
Eraser extends AbstractTypeOperator<Class<?>> { @Override public Class<?> apply(Class<?> clazz) { return clazz; } @Override Class<?> apply(Class<?> clazz); @Override Class<?> apply(ParameterizedType pt); @Override Class<?> apply(GenericArrayType gat); @Override Class<?> apply(WildcardType wt); @Override Class<?> apply...
Eraser extends AbstractTypeOperator<Class<?>> { @Override public Class<?> apply(Class<?> clazz) { return clazz; } @Override Class<?> apply(Class<?> clazz); @Override Class<?> apply(ParameterizedType pt); @Override Class<?> apply(GenericArrayType gat); @Override Class<?> apply(WildcardType wt); @Override Class<?> apply...
@Test public void test_invoke() { TypeOperator<?> operator = mock(AbstractTypeOperator.class); given(operator.apply(any(Type.class))).willCallRealMethod(); operator.apply((Type)Object.class); operator.apply((Type)new LateParameterizedType(Set.class, null, Integer.class)); operator.apply((Type)new LateGenericArrayType(n...
@Override public T apply(Type type) { if (type instanceof Class) { return apply((Class<?>)type); } else if (type instanceof ParameterizedType) { return apply((ParameterizedType)type); } else if (type instanceof WildcardType) { return apply((WildcardType)type); } else if (type instanceof GenericArrayType) { return apply...
AbstractTypeOperator implements TypeOperator<T> { @Override public T apply(Type type) { if (type instanceof Class) { return apply((Class<?>)type); } else if (type instanceof ParameterizedType) { return apply((ParameterizedType)type); } else if (type instanceof WildcardType) { return apply((WildcardType)type); } else if...
AbstractTypeOperator implements TypeOperator<T> { @Override public T apply(Type type) { if (type instanceof Class) { return apply((Class<?>)type); } else if (type instanceof ParameterizedType) { return apply((ParameterizedType)type); } else if (type instanceof WildcardType) { return apply((WildcardType)type); } else if...
AbstractTypeOperator implements TypeOperator<T> { @Override public T apply(Type type) { if (type instanceof Class) { return apply((Class<?>)type); } else if (type instanceof ParameterizedType) { return apply((ParameterizedType)type); } else if (type instanceof WildcardType) { return apply((WildcardType)type); } else if...
AbstractTypeOperator implements TypeOperator<T> { @Override public T apply(Type type) { if (type instanceof Class) { return apply((Class<?>)type); } else if (type instanceof ParameterizedType) { return apply((ParameterizedType)type); } else if (type instanceof WildcardType) { return apply((WildcardType)type); } else if...
@Test(expected = IllegalArgumentException.class) public void test_invoke_unknown() { TypeOperator<?> operator = mock(AbstractTypeOperator.class); given(operator.apply(any(Type.class))).willCallRealMethod(); operator.apply(new Type(){}); }
@Override public T apply(Type type) { if (type instanceof Class) { return apply((Class<?>)type); } else if (type instanceof ParameterizedType) { return apply((ParameterizedType)type); } else if (type instanceof WildcardType) { return apply((WildcardType)type); } else if (type instanceof GenericArrayType) { return apply...
AbstractTypeOperator implements TypeOperator<T> { @Override public T apply(Type type) { if (type instanceof Class) { return apply((Class<?>)type); } else if (type instanceof ParameterizedType) { return apply((ParameterizedType)type); } else if (type instanceof WildcardType) { return apply((WildcardType)type); } else if...
AbstractTypeOperator implements TypeOperator<T> { @Override public T apply(Type type) { if (type instanceof Class) { return apply((Class<?>)type); } else if (type instanceof ParameterizedType) { return apply((ParameterizedType)type); } else if (type instanceof WildcardType) { return apply((WildcardType)type); } else if...
AbstractTypeOperator implements TypeOperator<T> { @Override public T apply(Type type) { if (type instanceof Class) { return apply((Class<?>)type); } else if (type instanceof ParameterizedType) { return apply((ParameterizedType)type); } else if (type instanceof WildcardType) { return apply((WildcardType)type); } else if...
AbstractTypeOperator implements TypeOperator<T> { @Override public T apply(Type type) { if (type instanceof Class) { return apply((Class<?>)type); } else if (type instanceof ParameterizedType) { return apply((ParameterizedType)type); } else if (type instanceof WildcardType) { return apply((WildcardType)type); } else if...
@Test public void test_with() { compare_lists(Arrays.asList(1, 1), new BasicList1<>(1).with(1)); compare_lists(Arrays.asList(1, null), new BasicList1<>(1).with(null)); }
@Override public ConstList<E> with(E e) { return listOf(e0, e); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @...
@Test public void test_arrays_not_immutable() { try { immutify(char[].class); fail(); } catch (IllegalArgumentException expected) {} try { immutify(String[].class); fail(); } catch (IllegalArgumentException expected) {} }
Immutify(TypeTable typeTable) { this.typeTable = typeTable; }
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } }
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } Immutify(TypeTable typeTable); }
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } Immutify(TypeTable typeTable); @Override Class<?> apply(Class<?> clazz); @Override Type apply(ParameterizedType pt); @Override Type apply(GenericArrayType gat); @Override Type apply(WildcardType wt); @Override Ty...
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } Immutify(TypeTable typeTable); @Override Class<?> apply(Class<?> clazz); @Override Type apply(ParameterizedType pt); @Override Type apply(GenericArrayType gat); @Override Type apply(WildcardType wt); @Override Ty...
@Test public void test_with_index() { compare_lists(Arrays.asList(2, 1), new BasicList1<>(1).with(0, 2)); compare_lists(Arrays.asList(1, 2), new BasicList1<>(1).with(1, 2)); }
@Override public ConstList<E> with(E e) { return listOf(e0, e); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @...
@Test(expected = IndexOutOfBoundsException.class) public void test_with_index_out_of_bounds() { new BasicList1<>(1).with(2, 1); }
@Override public ConstList<E> with(E e) { return listOf(e0, e); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> with(E e) { return listOf(e0, e); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override int indexOf(Object o); @Override int lastIndexOf(Object o); @...
@Test public void test_withAll() { ConstList<Integer> list = new BasicList1<>(1); compare_lists(Arrays.asList(1, 1, 2, 3), list.withAll(Arrays.asList(1, 2, 3))); assertSame(list, list.withAll(Collections.<Integer>emptyList())); }
@Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override bool...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override bool...
@Test(expected = NullPointerException.class) public void test_withAll_throws() { new BasicList1<>(1).withAll(null); }
@Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override bool...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override bool...
@Test public void test_withAll_index() { ConstList<Integer> list = new BasicList1<>(0); compare_lists(Arrays.asList(1, 2, 3, 0), list.withAll(0, Arrays.asList(1, 2, 3))); compare_lists(Arrays.asList(0, 1, 2, 3), list.withAll(1, Arrays.asList(1, 2, 3))); assertSame(list, list.withAll(0, Collections.<Integer>emptyList())...
@Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override bool...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override bool...
@Test(expected = IndexOutOfBoundsException.class) public void test_withAll_index_out_of_bounds() { new BasicList1<>(1).withAll(2, Collections.<Integer>emptyList()); }
@Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override bool...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override bool...
@Test(expected = NullPointerException.class) public void test_withAll_index_throws() { new BasicList1<>(1).withAll(0, null); }
@Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override bool...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> withAll(Collection<? extends E> c) { return c.isEmpty() ? this : BasicCollections.<E>condenseToList(insert(c.toArray(), 0, e0)); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override bool...
@Test public void test_replace() { compare_lists(Collections.singletonList(9), new BasicList1<>(1).replace(0, 9)); }
@Override public ConstList<E> replace(int index, E e) { if (index == 0) { return listOf(e); } throw new IndexOutOfBoundsException(); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> replace(int index, E e) { if (index == 0) { return listOf(e); } throw new IndexOutOfBoundsException(); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> replace(int index, E e) { if (index == 0) { return listOf(e); } throw new IndexOutOfBoundsException(); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> replace(int index, E e) { if (index == 0) { return listOf(e); } throw new IndexOutOfBoundsException(); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @O...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> replace(int index, E e) { if (index == 0) { return listOf(e); } throw new IndexOutOfBoundsException(); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @O...
@Test(expected = IndexOutOfBoundsException.class) public void test_replace_out_of_bounds() { new BasicList1<>(1).replace(1, 1); }
@Override public ConstList<E> replace(int index, E e) { if (index == 0) { return listOf(e); } throw new IndexOutOfBoundsException(); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> replace(int index, E e) { if (index == 0) { return listOf(e); } throw new IndexOutOfBoundsException(); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> replace(int index, E e) { if (index == 0) { return listOf(e); } throw new IndexOutOfBoundsException(); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> replace(int index, E e) { if (index == 0) { return listOf(e); } throw new IndexOutOfBoundsException(); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @O...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> replace(int index, E e) { if (index == 0) { return listOf(e); } throw new IndexOutOfBoundsException(); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @O...
@Test public void test_without() { ConstList<Integer> list = new BasicList1<>(1); assertSame(BasicList0.instance(), list.without(1)); assertSame(list, list.without(2)); assertSame(list, list.without(null)); }
@Override public ConstList<E> without(Object o) { return !contains(o) ? this : BasicCollections.<E>emptyList(); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> without(Object o) { return !contains(o) ? this : BasicCollections.<E>emptyList(); } }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> without(Object o) { return !contains(o) ? this : BasicCollections.<E>emptyList(); } @SuppressWarnings("unchecked") BasicList1(Object e0); }
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> without(Object o) { return !contains(o) ? this : BasicCollections.<E>emptyList(); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override int indexOf(O...
BasicList1 extends BasicConstList<E> { @Override public ConstList<E> without(Object o) { return !contains(o) ? this : BasicCollections.<E>emptyList(); } @SuppressWarnings("unchecked") BasicList1(Object e0); @Override int size(); @Override boolean isEmpty(); @Override boolean contains(Object o); @Override int indexOf(O...
@Test public void test_immutify_enum() { assertEquals(new TypeToken<Enum>(){}.asType(), immutify(Enum.class)); assertSame(Color.class, immutify(Color.class)); }
Immutify(TypeTable typeTable) { this.typeTable = typeTable; }
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } }
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } Immutify(TypeTable typeTable); }
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } Immutify(TypeTable typeTable); @Override Class<?> apply(Class<?> clazz); @Override Type apply(ParameterizedType pt); @Override Type apply(GenericArrayType gat); @Override Type apply(WildcardType wt); @Override Ty...
Immutify extends AbstractTypeOperator<Type> { Immutify(TypeTable typeTable) { this.typeTable = typeTable; } Immutify(TypeTable typeTable); @Override Class<?> apply(Class<?> clazz); @Override Type apply(ParameterizedType pt); @Override Type apply(GenericArrayType gat); @Override Type apply(WildcardType wt); @Override Ty...
@Test public void suspectBehaviour() throws Exception { GraphDatabaseService db = createDatabase(); EmailQueries queries = new EmailQueries( db, new PrintingExecutionEngineWrapper( db, "email", name ) ); ExecutionResult result = queries.suspectBehaviour(); Iterator<Map<String, Object>> iterator = result.iterator(); Map...
public ExecutionResult suspectBehaviour() { String query = "MATCH (bob:User {username:'Bob'})-[:SENT]->(email)-[:CC]->(alias),\n" + " (alias)-[:ALIAS_OF]->(bob)\n" + "RETURN email.id"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); }
EmailQueries { public ExecutionResult suspectBehaviour() { String query = "MATCH (bob:User {username:'Bob'})-[:SENT]->(email)-[:CC]->(alias),\n" + " (alias)-[:ALIAS_OF]->(bob)\n" + "RETURN email.id"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } }
EmailQueries { public ExecutionResult suspectBehaviour() { String query = "MATCH (bob:User {username:'Bob'})-[:SENT]->(email)-[:CC]->(alias),\n" + " (alias)-[:ALIAS_OF]->(bob)\n" + "RETURN email.id"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } Em...
EmailQueries { public ExecutionResult suspectBehaviour() { String query = "MATCH (bob:User {username:'Bob'})-[:SENT]->(email)-[:CC]->(alias),\n" + " (alias)-[:ALIAS_OF]->(bob)\n" + "RETURN email.id"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } Em...
EmailQueries { public ExecutionResult suspectBehaviour() { String query = "MATCH (bob:User {username:'Bob'})-[:SENT]->(email)-[:CC]->(alias),\n" + " (alias)-[:ALIAS_OF]->(bob)\n" + "RETURN email.id"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } Em...
@Test public void friendOfAFriendWithMultipleInterest() throws Exception { ExecutionResult results = queries.friendOfAFriendWithMultipleInterest( "Arnold", 5, "Art", "Design" ); Iterator<Map<String, Object>> iterator = results.iterator(); Map<String, Object> result = iterator.next(); assertEquals( "Emily", result.get( ...
public ExecutionResult friendOfAFriendWithMultipleInterest( String userName, int limit, String... interestLabels ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH p=(subject)-[:WORKED_ON]->()-[:WORKED_ON*0..2]-()\n" + " <-[:WORKED_ON]-(person)-[:INTERESTED_IN]->(interest)\n" + "WHERE person<>subject AN...
SocialNetworkQueries { public ExecutionResult friendOfAFriendWithMultipleInterest( String userName, int limit, String... interestLabels ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH p=(subject)-[:WORKED_ON]->()-[:WORKED_ON*0..2]-()\n" + " <-[:WORKED_ON]-(person)-[:INTERESTED_IN]->(interest)\n" + "W...
SocialNetworkQueries { public ExecutionResult friendOfAFriendWithMultipleInterest( String userName, int limit, String... interestLabels ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH p=(subject)-[:WORKED_ON]->()-[:WORKED_ON*0..2]-()\n" + " <-[:WORKED_ON]-(person)-[:INTERESTED_IN]->(interest)\n" + "W...
SocialNetworkQueries { public ExecutionResult friendOfAFriendWithMultipleInterest( String userName, int limit, String... interestLabels ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH p=(subject)-[:WORKED_ON]->()-[:WORKED_ON*0..2]-()\n" + " <-[:WORKED_ON]-(person)-[:INTERESTED_IN]->(interest)\n" + "W...
SocialNetworkQueries { public ExecutionResult friendOfAFriendWithMultipleInterest( String userName, int limit, String... interestLabels ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH p=(subject)-[:WORKED_ON]->()-[:WORKED_ON*0..2]-()\n" + " <-[:WORKED_ON]-(person)-[:INTERESTED_IN]->(interest)\n" + "W...
@Test public void friendOfAFriendWithMultipleInterestShouldOrderByScore() throws Exception { ExecutionResult results = queries.friendOfAFriendWithMultipleInterest( "Sarah", 5, "Java", "Travel", "Medicine" ); Iterator<Map<String, Object>> iterator = results.iterator(); Map<String, Object> result = iterator.next(); asser...
public ExecutionResult friendOfAFriendWithMultipleInterest( String userName, int limit, String... interestLabels ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH p=(subject)-[:WORKED_ON]->()-[:WORKED_ON*0..2]-()\n" + " <-[:WORKED_ON]-(person)-[:INTERESTED_IN]->(interest)\n" + "WHERE person<>subject AN...
SocialNetworkQueries { public ExecutionResult friendOfAFriendWithMultipleInterest( String userName, int limit, String... interestLabels ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH p=(subject)-[:WORKED_ON]->()-[:WORKED_ON*0..2]-()\n" + " <-[:WORKED_ON]-(person)-[:INTERESTED_IN]->(interest)\n" + "W...
SocialNetworkQueries { public ExecutionResult friendOfAFriendWithMultipleInterest( String userName, int limit, String... interestLabels ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH p=(subject)-[:WORKED_ON]->()-[:WORKED_ON*0..2]-()\n" + " <-[:WORKED_ON]-(person)-[:INTERESTED_IN]->(interest)\n" + "W...
SocialNetworkQueries { public ExecutionResult friendOfAFriendWithMultipleInterest( String userName, int limit, String... interestLabels ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH p=(subject)-[:WORKED_ON]->()-[:WORKED_ON*0..2]-()\n" + " <-[:WORKED_ON]-(person)-[:INTERESTED_IN]->(interest)\n" + "W...
SocialNetworkQueries { public ExecutionResult friendOfAFriendWithMultipleInterest( String userName, int limit, String... interestLabels ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH p=(subject)-[:WORKED_ON]->()-[:WORKED_ON*0..2]-()\n" + " <-[:WORKED_ON]-(person)-[:INTERESTED_IN]->(interest)\n" + "W...
@Test public void shouldCreateNewWorkedWithRelationships() throws Exception { String cypher = "MATCH (sarah:User {name:'Sarah'}),\n" + " (ben:User {name:'Ben'})\n" + "CREATE sarah-[:WORKED_WITH]->ben"; createFromCypher( db, "Enriched Social Network", cypher ); ExecutionResult results = queries.createWorkedWithRelations...
public ExecutionResult createWorkedWithRelationships( String userName ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH (subject)-[:WORKED_ON]->()<-[:WORKED_ON]-(person)\n" + "WHERE NOT((subject)-[:WORKED_WITH]-(person))\n" + "WITH DISTINCT subject, person\n" + "CREATE UNIQUE (subject)-[:WORKED_WITH]-(...
SocialNetworkQueries { public ExecutionResult createWorkedWithRelationships( String userName ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH (subject)-[:WORKED_ON]->()<-[:WORKED_ON]-(person)\n" + "WHERE NOT((subject)-[:WORKED_WITH]-(person))\n" + "WITH DISTINCT subject, person\n" + "CREATE UNIQUE (su...
SocialNetworkQueries { public ExecutionResult createWorkedWithRelationships( String userName ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH (subject)-[:WORKED_ON]->()<-[:WORKED_ON]-(person)\n" + "WHERE NOT((subject)-[:WORKED_WITH]-(person))\n" + "WITH DISTINCT subject, person\n" + "CREATE UNIQUE (su...
SocialNetworkQueries { public ExecutionResult createWorkedWithRelationships( String userName ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH (subject)-[:WORKED_ON]->()<-[:WORKED_ON]-(person)\n" + "WHERE NOT((subject)-[:WORKED_WITH]-(person))\n" + "WITH DISTINCT subject, person\n" + "CREATE UNIQUE (su...
SocialNetworkQueries { public ExecutionResult createWorkedWithRelationships( String userName ) { String query = "MATCH (subject:User {name:{name}})\n" + "MATCH (subject)-[:WORKED_ON]->()<-[:WORKED_ON]-(person)\n" + "WHERE NOT((subject)-[:WORKED_WITH]-(person))\n" + "WITH DISTINCT subject, person\n" + "CREATE UNIQUE (su...
@Test public void allowedWithInheritTrueGivesAccessToSubcompaniesAndAccounts() throws Exception { QueryUnionExecutionResult results = queries.findAccessibleResources( "Ben" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Account-1", ((Path) iterator.next(...
public QueryUnionExecutionResult findAccessibleResources( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH paths=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-()" + "<-[:WORKS_FOR]-(employee)-[:HAS_ACCOUNT]->(account)\n" + "WHERE (permission....
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleResources( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH paths=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-()" + "<-[:WORKS_FOR]-(employee)-[...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleResources( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH paths=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-()" + "<-[:WORKS_FOR]-(employee)-[...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleResources( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH paths=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-()" + "<-[:WORKS_FOR]-(employee)-[...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleResources( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH paths=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-()" + "<-[:WORKS_FOR]-(employee)-[...
@Test public void deniedExcludesCompanyFromPermissionsTree() throws Exception { QueryUnionExecutionResult results = queries.findAccessibleResources( "Sarah" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Account-4", ((Path) iterator.next().get( "paths" )...
public QueryUnionExecutionResult findAccessibleResources( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH paths=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-()" + "<-[:WORKS_FOR]-(employee)-[:HAS_ACCOUNT]->(account)\n" + "WHERE (permission....
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleResources( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH paths=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-()" + "<-[:WORKS_FOR]-(employee)-[...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleResources( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH paths=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-()" + "<-[:WORKS_FOR]-(employee)-[...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleResources( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH paths=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-()" + "<-[:WORKS_FOR]-(employee)-[...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleResources( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH paths=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-()" + "<-[:WORKS_FOR]-(employee)-[...
@Test public void shouldGetAccessibleCompaniesForAdmin() throws Exception { QueryUnionExecutionResult results = queries.findAccessibleCompanies( "Sarah" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Startup", ((Node) iterator.next().get( "company" )).ge...
public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=true) AND NOT (admin-[:MEMBER_OF]->()-[:DENIED]->()...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
@Test public void shouldGetAccessibleCompaniesForAdminWhereNoAllowedInheritFalse() throws Exception { QueryUnionExecutionResult results = queries.findAccessibleCompanies( "Ben" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Acme", ((Node) iterator.next()...
public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=true) AND NOT (admin-[:MEMBER_OF]->()-[:DENIED]->()...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
@Test public void moreComplexShouldGetAccessibleCompaniesForAdmin() throws Exception { QueryUnionExecutionResult results = queries.findAccessibleCompanies( "Liz" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "BigCompany", ((Node) iterator.next().get( "co...
public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=true) AND NOT (admin-[:MEMBER_OF]->()-[:DENIED]->()...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleCompanies( String adminName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}})\n" + "MATCH admin-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0..3]-company\n" + "WHERE (permission.inherit=tr...
@Test public void shouldFindAccessibleAccountsForAdminAndCompany() throws Exception { QueryUnionExecutionResult results = queries.findAccessibleAccountsForCompany( "Sarah", "Startup" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Account-4", ((Node) iter...
public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permission:ALLOWED]->company<-[:CHILD_OF*0." + ".3]-sub...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
@Test public void moreComplexShouldFindAccessibleAccountsForAdminAndCompany() throws Exception { QueryUnionExecutionResult results = queries.findAccessibleAccountsForCompany( "Liz", "BigCompany" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Account-8", ...
public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permission:ALLOWED]->company<-[:CHILD_OF*0." + ".3]-sub...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
@Test public void suspectBehaviour2() throws Exception { GraphDatabaseService db = createDatabase2(); EmailQueries queries = new EmailQueries( db, new PrintingExecutionEngineWrapper( db, "email", name ) ); ExecutionResult result = queries.suspectBehaviour2(); Iterator<Map<String, Object>> iterator = result.iterator(); ...
public ExecutionResult suspectBehaviour2() { String query = "MATCH p=(email:Email {id:'6'})<-[:REPLY_TO*1..4]-()<-[:SENT]-(replier)\n" + "RETURN replier.username AS replier, length(p) - 1 AS depth ORDER BY depth"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, ...
EmailQueries { public ExecutionResult suspectBehaviour2() { String query = "MATCH p=(email:Email {id:'6'})<-[:REPLY_TO*1..4]-()<-[:SENT]-(replier)\n" + "RETURN replier.username AS replier, length(p) - 1 AS depth ORDER BY depth"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.e...
EmailQueries { public ExecutionResult suspectBehaviour2() { String query = "MATCH p=(email:Email {id:'6'})<-[:REPLY_TO*1..4]-()<-[:SENT]-(replier)\n" + "RETURN replier.username AS replier, length(p) - 1 AS depth ORDER BY depth"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.e...
EmailQueries { public ExecutionResult suspectBehaviour2() { String query = "MATCH p=(email:Email {id:'6'})<-[:REPLY_TO*1..4]-()<-[:SENT]-(replier)\n" + "RETURN replier.username AS replier, length(p) - 1 AS depth ORDER BY depth"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.e...
EmailQueries { public ExecutionResult suspectBehaviour2() { String query = "MATCH p=(email:Email {id:'6'})<-[:REPLY_TO*1..4]-()<-[:SENT]-(replier)\n" + "RETURN replier.username AS replier, length(p) - 1 AS depth ORDER BY depth"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.e...
@Test public void shouldFindAccessibleAccountsForAdminAndCompanyWhenNoAllowedWithInheritFalse() throws Exception { QueryUnionExecutionResult results = queries.findAccessibleAccountsForCompany( "Ben", "Startup" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals...
public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permission:ALLOWED]->company<-[:CHILD_OF*0." + ".3]-sub...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAccessibleAccountsForCompany( String adminName, String companyName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company:Company{name:{companyName}})\n" + "MATCH admin-[:MEMBER_OF]->group-[permis...
@Test public void shouldFindAdminForAccountResourceWhereAllowedInheritAndAllowedNotInherit() throws Exception { QueryUnionExecutionResult results = queries.findAdminForResource( "Account-10" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Phil", ((Node) i...
public QueryUnionExecutionResult findAdminForResource( String resourceName ) { String inheritedQuery = "MATCH (resource:Resource {name:{resourceName}}) \n" + "MATCH p=resource-[:WORKS_FOR|HAS_ACCOUNT*1..2]-company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()" + "<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=tru...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForResource( String resourceName ) { String inheritedQuery = "MATCH (resource:Resource {name:{resourceName}}) \n" + "MATCH p=resource-[:WORKS_FOR|HAS_ACCOUNT*1..2]-company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()" + "<-[:MEM...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForResource( String resourceName ) { String inheritedQuery = "MATCH (resource:Resource {name:{resourceName}}) \n" + "MATCH p=resource-[:WORKS_FOR|HAS_ACCOUNT*1..2]-company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()" + "<-[:MEM...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForResource( String resourceName ) { String inheritedQuery = "MATCH (resource:Resource {name:{resourceName}}) \n" + "MATCH p=resource-[:WORKS_FOR|HAS_ACCOUNT*1..2]-company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()" + "<-[:MEM...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForResource( String resourceName ) { String inheritedQuery = "MATCH (resource:Resource {name:{resourceName}}) \n" + "MATCH p=resource-[:WORKS_FOR|HAS_ACCOUNT*1..2]-company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()" + "<-[:MEM...
@Test public void shouldFindAdminForEmployeeResourceWhereAllowedInheritAndDenied() throws Exception { QueryUnionExecutionResult results = queries.findAdminForResource( "Kate" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Ben", ((Node) iterator.next().ge...
public QueryUnionExecutionResult findAdminForResource( String resourceName ) { String inheritedQuery = "MATCH (resource:Resource {name:{resourceName}}) \n" + "MATCH p=resource-[:WORKS_FOR|HAS_ACCOUNT*1..2]-company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()" + "<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=tru...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForResource( String resourceName ) { String inheritedQuery = "MATCH (resource:Resource {name:{resourceName}}) \n" + "MATCH p=resource-[:WORKS_FOR|HAS_ACCOUNT*1..2]-company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()" + "<-[:MEM...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForResource( String resourceName ) { String inheritedQuery = "MATCH (resource:Resource {name:{resourceName}}) \n" + "MATCH p=resource-[:WORKS_FOR|HAS_ACCOUNT*1..2]-company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()" + "<-[:MEM...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForResource( String resourceName ) { String inheritedQuery = "MATCH (resource:Resource {name:{resourceName}}) \n" + "MATCH p=resource-[:WORKS_FOR|HAS_ACCOUNT*1..2]-company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()" + "<-[:MEM...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForResource( String resourceName ) { String inheritedQuery = "MATCH (resource:Resource {name:{resourceName}}) \n" + "MATCH p=resource-[:WORKS_FOR|HAS_ACCOUNT*1..2]-company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()" + "<-[:MEM...
@Test public void shouldFindAdminForCompanyWithAllowedInherit() throws Exception { QueryUnionExecutionResult results = queries.findAdminForCompany( "BigCompany" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Liz", ((Node) iterator.next().get( "admin" ))....
public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true) AND NOT (admin-[:MEMBER_OF]->()-[:DENIED]->()<-[...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
@Test public void shouldFindAdminForCompanyWithDenied() throws Exception { QueryUnionExecutionResult results = queries.findAdminForCompany( "AcquiredLtd" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertFalse( iterator.hasNext() ); }
public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true) AND NOT (admin-[:MEMBER_OF]->()-[:DENIED]->()<-[...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
@Test public void shouldFindAdminForCompanyWithAllowedInheritAndAllowedDoNotInheritTooLowInTree() throws Exception { QueryUnionExecutionResult results = queries.findAdminForCompany( "Subsidiary" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Phil", ((Nod...
public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true) AND NOT (admin-[:MEMBER_OF]->()-[:DENIED]->()<-[...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
@Test public void shouldFindAdminForCompanyWithAllowedInheritAndAllowedAllowedDoNotInherit() throws Exception { QueryUnionExecutionResult results = queries.findAdminForCompany( "One-ManShop" ); Iterator<Map<String, Object>> iterator = results.iterator(); assertTrue( iterator.hasNext() ); assertEquals( "Phil", ((Node) i...
public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true) AND NOT (admin-[:MEMBER_OF]->()-[:DENIED]->()<-[...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult findAdminForCompany( String companyName ) { String inheritedQuery = "MATCH (company:Company{name:{companyName}})\n" + "MATCH p=company-[:CHILD_OF*0..3]->()<-[permission:ALLOWED]-()<-[:MEMBER_OF]-admin\n" + "WHERE (permission.inherit=true)...
@Test public void shouldDetermineWhetherAdminHasAccessToResource() throws Exception { Map<String, List<Long>> testData = new HashMap<String, List<Long>>(); testData.put( "Alistair", asList( 1L, 0L ) ); testData.put( "Account-8", asList( 1L, 0L ) ); testData.put( "Eve", asList( 0L, 0L ) ); testData.put( "Account-9", asL...
public QueryUnionExecutionResult hasAccessToResource( String adminName, String resourceName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (resource:Resource{name:{resourceName}})\n" + "MATCH p=(admin)-[:MEMBER_OF]->()-[permission:ALLOWED]->()<-[:CHILD_OF*0." + ".3]-(company)-[:WORK...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult hasAccessToResource( String adminName, String resourceName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (resource:Resource{name:{resourceName}})\n" + "MATCH p=(admin)-[:MEMBER_OF]->()-[permission:ALL...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult hasAccessToResource( String adminName, String resourceName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (resource:Resource{name:{resourceName}})\n" + "MATCH p=(admin)-[:MEMBER_OF]->()-[permission:ALL...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult hasAccessToResource( String adminName, String resourceName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (resource:Resource{name:{resourceName}})\n" + "MATCH p=(admin)-[:MEMBER_OF]->()-[permission:ALL...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult hasAccessToResource( String adminName, String resourceName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (resource:Resource{name:{resourceName}})\n" + "MATCH p=(admin)-[:MEMBER_OF]->()-[permission:ALL...
@Test @Ignore("does not work conceptually") public void shouldDetermineWhetherAdminHasAccessToIndexedResource() throws Exception { Map<String, List<Long>> testData = new LinkedHashMap<>(); testData.put( "Alistair", asList( 1L, 0L ) ); testData.put( "Account-8", asList( 1L, 0L ) ); testData.put( "Eve", asList( 0L, 0L ) ...
public QueryUnionExecutionResult hasAccessToIndexedResource( String adminName, String resourceName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company)<-[:CHILD_OF*0..3]-(:Company)-[:WORKS_FOR|HAS_ACCOUNT*1..2]-(resource:Resource {name:{resourceName}})\n" + "MATCH p=(admin)-[:ME...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult hasAccessToIndexedResource( String adminName, String resourceName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company)<-[:CHILD_OF*0..3]-(:Company)-[:WORKS_FOR|HAS_ACCOUNT*1..2]-(resource:Resource ...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult hasAccessToIndexedResource( String adminName, String resourceName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company)<-[:CHILD_OF*0..3]-(:Company)-[:WORKS_FOR|HAS_ACCOUNT*1..2]-(resource:Resource ...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult hasAccessToIndexedResource( String adminName, String resourceName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company)<-[:CHILD_OF*0..3]-(:Company)-[:WORKS_FOR|HAS_ACCOUNT*1..2]-(resource:Resource ...
AccessControlWithRelationshipPropertiesQueries { public QueryUnionExecutionResult hasAccessToIndexedResource( String adminName, String resourceName ) { String inheritedQuery = "MATCH (admin:Administrator {name:{adminName}}),\n" + " (company)<-[:CHILD_OF*0..3]-(:Company)-[:WORKS_FOR|HAS_ACCOUNT*1..2]-(resource:Resource ...
@Test public void theatreCityBard() throws Exception { try ( Transaction tx = db.beginTx() ) { assertTheatreCityBard( queries.theatreCityBard() ); assertTheatreCityBard( queries2.theatreCityBard() ); assertTheatreCityBard( queriesUsingAutoIndexes.theatreCityBard() ); tx.success(); } }
public ExecutionResult theatreCityBard() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "RETURN theater.name AS theater, newcastle.name AS city, bard.lastname AS bard"; Map<String, Object> params = new Hash...
ShakespeareQueries { public ExecutionResult theatreCityBard() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "RETURN theater.name AS theater, newcastle.name AS city, bard.lastname AS bard"; Map<String, Obje...
ShakespeareQueries { public ExecutionResult theatreCityBard() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "RETURN theater.name AS theater, newcastle.name AS city, bard.lastname AS bard"; Map<String, Obje...
ShakespeareQueries { public ExecutionResult theatreCityBard() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "RETURN theater.name AS theater, newcastle.name AS city, bard.lastname AS bard"; Map<String, Obje...
ShakespeareQueries { public ExecutionResult theatreCityBard() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "RETURN theater.name AS theater, newcastle.name AS city, bard.lastname AS bard"; Map<String, Obje...
@Test public void suspectBehaviour3() throws Exception { GraphDatabaseService db = createDatabase3(); EmailQueries queries = new EmailQueries( db, new PrintingExecutionEngineWrapper( db, "email", name ) ); ExecutionResult result = queries.suspectBehaviour3(); Iterator<Object> objectIterator = result.columnAs( "count(f)...
public ExecutionResult suspectBehaviour3() { String query = "MATCH (email:Email {id:'11'})<-[f:FORWARD_OF*]-() \n" + "RETURN count(f)"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); }
EmailQueries { public ExecutionResult suspectBehaviour3() { String query = "MATCH (email:Email {id:'11'})<-[f:FORWARD_OF*]-() \n" + "RETURN count(f)"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } }
EmailQueries { public ExecutionResult suspectBehaviour3() { String query = "MATCH (email:Email {id:'11'})<-[f:FORWARD_OF*]-() \n" + "RETURN count(f)"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } EmailQueries( GraphDatabaseService db, ExecutionEng...
EmailQueries { public ExecutionResult suspectBehaviour3() { String query = "MATCH (email:Email {id:'11'})<-[f:FORWARD_OF*]-() \n" + "RETURN count(f)"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } EmailQueries( GraphDatabaseService db, ExecutionEng...
EmailQueries { public ExecutionResult suspectBehaviour3() { String query = "MATCH (email:Email {id:'11'})<-[f:FORWARD_OF*]-() \n" + "RETURN count(f)"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } EmailQueries( GraphDatabaseService db, ExecutionEng...
@Test public void exampleOfWith() throws Exception { try ( Transaction tx = db.beginTx() ) { assertExampleOfWith( queries.exampleOfWith() ); assertExampleOfWith( queries2.exampleOfWith() ); assertExampleOfWith( queriesUsingAutoIndexes.exampleOfWith() ); tx.success(); } }
public ExecutionResult exampleOfWith() { String query = "MATCH (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (bard)-[w:WROTE_PLAY]->(play)\n" + "WITH play \n" + "ORDER BY w.year DESC \n" + "RETURN collect(play.title) AS plays"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapp...
ShakespeareQueries { public ExecutionResult exampleOfWith() { String query = "MATCH (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (bard)-[w:WROTE_PLAY]->(play)\n" + "WITH play \n" + "ORDER BY w.year DESC \n" + "RETURN collect(play.title) AS plays"; Map<String, Object> params = new HashMap<String, Object>(); return...
ShakespeareQueries { public ExecutionResult exampleOfWith() { String query = "MATCH (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (bard)-[w:WROTE_PLAY]->(play)\n" + "WITH play \n" + "ORDER BY w.year DESC \n" + "RETURN collect(play.title) AS plays"; Map<String, Object> params = new HashMap<String, Object>(); return...
ShakespeareQueries { public ExecutionResult exampleOfWith() { String query = "MATCH (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (bard)-[w:WROTE_PLAY]->(play)\n" + "WITH play \n" + "ORDER BY w.year DESC \n" + "RETURN collect(play.title) AS plays"; Map<String, Object> params = new HashMap<String, Object>(); return...
ShakespeareQueries { public ExecutionResult exampleOfWith() { String query = "MATCH (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (bard)-[w:WROTE_PLAY]->(play)\n" + "WITH play \n" + "ORDER BY w.year DESC \n" + "RETURN collect(play.title) AS plays"; Map<String, Object> params = new HashMap<String, Object>(); return...
@Test public void shouldReturnAllPlays() throws Exception { try ( Transaction tx = db.beginTx() ) { assertAllPlays( queries.allPlays() ); assertAllPlays( queries2.allPlays() ); assertAllPlays( queriesUsingAutoIndexes.allPlays() ); } }
public ExecutionResult allPlays() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)\n" + " <-[:VENUE]-()-[:PERFORMANCE_OF]->()-[:PRODUCTION_OF]->\n" + " (play)...
ShakespeareQueries { public ExecutionResult allPlays() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)\n" + " <-[:VENUE]-()-[:PERFORMANCE_OF]->()-[:PRODUCTIO...
ShakespeareQueries { public ExecutionResult allPlays() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)\n" + " <-[:VENUE]-()-[:PERFORMANCE_OF]->()-[:PRODUCTIO...
ShakespeareQueries { public ExecutionResult allPlays() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)\n" + " <-[:VENUE]-()-[:PERFORMANCE_OF]->()-[:PRODUCTIO...
ShakespeareQueries { public ExecutionResult allPlays() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)\n" + " <-[:VENUE]-()-[:PERFORMANCE_OF]->()-[:PRODUCTIO...
@Test public void shouldReturnLatePeriodPlays() throws Exception { try ( Transaction tx = db.beginTx() ) { assertLatePeriodPlays( queries.latePeriodPlays() ); assertLatePeriodPlays( queries2.latePeriodPlays() ); assertLatePeriodPlays( queriesUsingAutoIndexes.latePeriodPlays() ); tx.success(); } }
public ExecutionResult latePeriodPlays() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)<-[:VENUE]-()-[:PERFORMANCE_OF]->()\n" + " -[:PRODUCTION_OF]->(play)<...
ShakespeareQueries { public ExecutionResult latePeriodPlays() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)<-[:VENUE]-()-[:PERFORMANCE_OF]->()\n" + " -[:PR...
ShakespeareQueries { public ExecutionResult latePeriodPlays() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)<-[:VENUE]-()-[:PERFORMANCE_OF]->()\n" + " -[:PR...
ShakespeareQueries { public ExecutionResult latePeriodPlays() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)<-[:VENUE]-()-[:PERFORMANCE_OF]->()\n" + " -[:PR...
ShakespeareQueries { public ExecutionResult latePeriodPlays() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)<-[:VENUE]-()-[:PERFORMANCE_OF]->()\n" + " -[:PR...
@Test public void orderedByPerformance() throws Exception { try ( Transaction tx = db.beginTx() ) { assertOrderedByPerformance( queries.orderedByPerformance() ); assertOrderedByPerformance( queries2.orderedByPerformance() ); assertOrderedByPerformance( queriesUsingAutoIndexes.orderedByPerformance() ); tx.success(); } }
public ExecutionResult orderedByPerformance() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)<-[:VENUE]-()-[p:PERFORMANCE_OF]->()\n" + " -[:PRODUCTION_OF]->(...
ShakespeareQueries { public ExecutionResult orderedByPerformance() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)<-[:VENUE]-()-[p:PERFORMANCE_OF]->()\n" + "...
ShakespeareQueries { public ExecutionResult orderedByPerformance() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)<-[:VENUE]-()-[p:PERFORMANCE_OF]->()\n" + "...
ShakespeareQueries { public ExecutionResult orderedByPerformance() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)<-[:VENUE]-()-[p:PERFORMANCE_OF]->()\n" + "...
ShakespeareQueries { public ExecutionResult orderedByPerformance() { String query = "MATCH (theater:Venue {name:'Theatre Royal'}), \n" + " (newcastle:City {name:'Newcastle'}), \n" + " (bard:Author {lastname:'Shakespeare'})\n" + "MATCH (newcastle)<-[:STREET|CITY*1..2]-(theater)<-[:VENUE]-()-[p:PERFORMANCE_OF]->()\n" + "...
@Test public void parcelRoutingUsingParcelRouteCalculator() throws Exception { DateTime startDtm = interval1.getStart().plusDays( 2 ); Interval queryInterval = new Interval( startDtm, startDtm.plusDays( 1 ) ); Iterable<Node> results = queries.findShortestPathWithParcelRouteCalculator( "DeliveryArea-1", "DeliverySegment...
public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); Iterable<Node> findShorte...
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); Iterable<Node> findShorte...
@Test public void parcelRoutingUsingParcelRouteCalculatorChoosesShortestRouteBetweenDeliveryBases() throws Exception { DateTime startDtm = interval2.getStart().plusDays( 2 ); Interval queryInterval = new Interval( startDtm, startDtm.plusDays( 1 ) ); Iterable<Node> results = queries.findShortestPathWithParcelRouteCalcul...
public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); Iterable<Node> findShorte...
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); Iterable<Node> findShorte...
@Test public void parcelRoutingUsingParcelRouteCalculatorRespectsIntervals() throws Exception { DateTime startDtm = interval3.getStart().plusDays( 2 ); Interval queryInterval = new Interval( startDtm, startDtm.plusDays( 1 ) ); Iterable<Node> results = queries.findShortestPathWithParcelRouteCalculator( "DeliveryArea-1",...
public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); Iterable<Node> findShorte...
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); Iterable<Node> findShorte...
@Test public void parcelRoutingUsingSimpleParcelRouteCalculatorRespectsIntervals() throws Exception { DateTime startDtm = interval3.getStart().plusDays( 2 ); Interval queryInterval = new Interval( startDtm, startDtm.plusDays( 1 ) ); Iterable<Node> results = queries.findShortestPathWithSimpleParcelRouteCalculator( "Deli...
public Iterable<Node> findShortestPathWithSimpleParcelRouteCalculator( String start, String end, Interval interval ) { return simpleParcelRouteCalculator.calculateRoute( start, end, interval ); }
LogisticsQueries { public Iterable<Node> findShortestPathWithSimpleParcelRouteCalculator( String start, String end, Interval interval ) { return simpleParcelRouteCalculator.calculateRoute( start, end, interval ); } }
LogisticsQueries { public Iterable<Node> findShortestPathWithSimpleParcelRouteCalculator( String start, String end, Interval interval ) { return simpleParcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); }
LogisticsQueries { public Iterable<Node> findShortestPathWithSimpleParcelRouteCalculator( String start, String end, Interval interval ) { return simpleParcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); Iterable<Node...
LogisticsQueries { public Iterable<Node> findShortestPathWithSimpleParcelRouteCalculator( String start, String end, Interval interval ) { return simpleParcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); Iterable<Node...
@Test public void withinScopeOfSingleParcelCentreParcelRouteCalculator() throws Exception { DateTime startDtm = interval2.getStart().plusDays( 2 ); Interval queryInterval = new Interval( startDtm, startDtm.plusDays( 1 ) ); Iterable<Node> results = queries.findShortestPathWithParcelRouteCalculator( "DeliveryArea-1", "De...
public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); }
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); Iterable<Node> findShorte...
LogisticsQueries { public Iterable<Node> findShortestPathWithParcelRouteCalculator( String start, String end, Interval interval ) { return parcelRouteCalculator.calculateRoute( start, end, interval ); } LogisticsQueries( GraphDatabaseService db, ExecutionEngineWrapper executionEngineWrapper ); Iterable<Node> findShorte...
@Test public void parcelRoutingUsingCypherReduce() throws Exception { DateTime startDtm = interval1.getStart().plusDays( 2 ); Interval queryInterval = new Interval( startDtm, startDtm.plusDays( 1 ) ); ExecutionResult result = queries.findShortestPathWithCypherReduce( "DeliveryArea-1", "DeliverySegment-3", queryInterval...
public ExecutionResult findShortestPathWithCypherReduce( String start, String end, Interval interval ) { String query = "MATCH (s:Location {name:{startLocation}}),\n" + " (e:Location {name:{endLocation}})\n" + "MATCH upLeg = (s)<-[:DELIVERY_ROUTE*1..2]-(db1)\n" + "WHERE all(r in relationships(upLeg)\n" + " WHERE r.star...
LogisticsQueries { public ExecutionResult findShortestPathWithCypherReduce( String start, String end, Interval interval ) { String query = "MATCH (s:Location {name:{startLocation}}),\n" + " (e:Location {name:{endLocation}})\n" + "MATCH upLeg = (s)<-[:DELIVERY_ROUTE*1..2]-(db1)\n" + "WHERE all(r in relationships(upLeg)\...
LogisticsQueries { public ExecutionResult findShortestPathWithCypherReduce( String start, String end, Interval interval ) { String query = "MATCH (s:Location {name:{startLocation}}),\n" + " (e:Location {name:{endLocation}})\n" + "MATCH upLeg = (s)<-[:DELIVERY_ROUTE*1..2]-(db1)\n" + "WHERE all(r in relationships(upLeg)\...
LogisticsQueries { public ExecutionResult findShortestPathWithCypherReduce( String start, String end, Interval interval ) { String query = "MATCH (s:Location {name:{startLocation}}),\n" + " (e:Location {name:{endLocation}})\n" + "MATCH upLeg = (s)<-[:DELIVERY_ROUTE*1..2]-(db1)\n" + "WHERE all(r in relationships(upLeg)\...
LogisticsQueries { public ExecutionResult findShortestPathWithCypherReduce( String start, String end, Interval interval ) { String query = "MATCH (s:Location {name:{startLocation}}),\n" + " (e:Location {name:{endLocation}})\n" + "MATCH upLeg = (s)<-[:DELIVERY_ROUTE*1..2]-(db1)\n" + "WHERE all(r in relationships(upLeg)\...
@Test public void lossyDb() throws Exception { GraphDatabaseService db = createDatabase4(); EmailQueries queries = new EmailQueries( db, new PrintingExecutionEngineWrapper( db, "email", name ) ); ExecutionResult result = queries.lossyDb(); assertEquals(1, count(result.iterator())); db.shutdown(); }
public ExecutionResult lossyDb() { String query = "MATCH (bob:User {username:'Bob'})-[e:EMAILED]->(charlie:User {username:'Charlie'})\n" + "RETURN e"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); }
EmailQueries { public ExecutionResult lossyDb() { String query = "MATCH (bob:User {username:'Bob'})-[e:EMAILED]->(charlie:User {username:'Charlie'})\n" + "RETURN e"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } }
EmailQueries { public ExecutionResult lossyDb() { String query = "MATCH (bob:User {username:'Bob'})-[e:EMAILED]->(charlie:User {username:'Charlie'})\n" + "RETURN e"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } EmailQueries( GraphDatabaseService d...
EmailQueries { public ExecutionResult lossyDb() { String query = "MATCH (bob:User {username:'Bob'})-[e:EMAILED]->(charlie:User {username:'Charlie'})\n" + "RETURN e"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } EmailQueries( GraphDatabaseService d...
EmailQueries { public ExecutionResult lossyDb() { String query = "MATCH (bob:User {username:'Bob'})-[e:EMAILED]->(charlie:User {username:'Charlie'})\n" + "RETURN e"; Map<String, Object> params = new HashMap<String, Object>(); return executionEngineWrapper.execute( query, params ); } EmailQueries( GraphDatabaseService d...
@Test public void parcelRoutingUsingCypherReduceChoosesShortestRouteBetweenDeliveryBases() throws Exception { DateTime startDtm = interval2.getStart().plusDays( 2 ); Interval queryInterval = new Interval( startDtm, startDtm.plusDays( 1 ) ); ExecutionResult result = queries.findShortestPathWithCypherReduce( "DeliveryAre...
public ExecutionResult findShortestPathWithCypherReduce( String start, String end, Interval interval ) { String query = "MATCH (s:Location {name:{startLocation}}),\n" + " (e:Location {name:{endLocation}})\n" + "MATCH upLeg = (s)<-[:DELIVERY_ROUTE*1..2]-(db1)\n" + "WHERE all(r in relationships(upLeg)\n" + " WHERE r.star...
LogisticsQueries { public ExecutionResult findShortestPathWithCypherReduce( String start, String end, Interval interval ) { String query = "MATCH (s:Location {name:{startLocation}}),\n" + " (e:Location {name:{endLocation}})\n" + "MATCH upLeg = (s)<-[:DELIVERY_ROUTE*1..2]-(db1)\n" + "WHERE all(r in relationships(upLeg)\...
LogisticsQueries { public ExecutionResult findShortestPathWithCypherReduce( String start, String end, Interval interval ) { String query = "MATCH (s:Location {name:{startLocation}}),\n" + " (e:Location {name:{endLocation}})\n" + "MATCH upLeg = (s)<-[:DELIVERY_ROUTE*1..2]-(db1)\n" + "WHERE all(r in relationships(upLeg)\...
LogisticsQueries { public ExecutionResult findShortestPathWithCypherReduce( String start, String end, Interval interval ) { String query = "MATCH (s:Location {name:{startLocation}}),\n" + " (e:Location {name:{endLocation}})\n" + "MATCH upLeg = (s)<-[:DELIVERY_ROUTE*1..2]-(db1)\n" + "WHERE all(r in relationships(upLeg)\...
LogisticsQueries { public ExecutionResult findShortestPathWithCypherReduce( String start, String end, Interval interval ) { String query = "MATCH (s:Location {name:{startLocation}}),\n" + " (e:Location {name:{endLocation}})\n" + "MATCH upLeg = (s)<-[:DELIVERY_ROUTE*1..2]-(db1)\n" + "WHERE all(r in relationships(upLeg)\...