/** * Returns a String that represents the contents of this object. This method * is for debugging purposes only. */ protected String toStringContents() { StringBuffer result = new StringBuffer(); ToStringSorter<K> sorter = new ToStringSorter<>(o -> o instanceof JavaElement ? ((JavaElement) o).getElementName() : o.toString()); List<Pair<K>> sortedObjects = sorter.sort(this.entryTable.keySet()); for (Pair<K> pair : sortedObjects) { String toString = pair.string; V value = get(pair.object); result.append(toString); result.append(" -> "); //$NON-NLS-1$ result.append(value); result.append("\n"); //$NON-NLS-1$ } return result.toString(); }
/** * Return a new sorted collection from this unsorted collection. * Sort using quick sort. */ public void sort(Object[] unSortedObjects, String[] unsortedStrings) { int size = unSortedObjects.length; this.sortedObjects = new Object[size]; this.sortedStrings = new String[size]; //copy the array so can return a new sorted collection System.arraycopy(unSortedObjects, 0, this.sortedObjects, 0, size); System.arraycopy(unsortedStrings, 0, this.sortedStrings, 0, size); if (size > 1) quickSort(0, size - 1); } }
/** * Returns a String that represents the contents of this object. This method * is for debugging purposes only. */ protected String toStringContents() { StringBuffer result = new StringBuffer(); int length = this.entryTable.size(); Object[] unsortedKeys = new Object[length]; String[] unsortedToStrings = new String[length]; Enumeration e = keys(); for (int i = 0; i < length; i++) { Object key = e.nextElement(); unsortedKeys[i] = key; unsortedToStrings[i] = (key instanceof org.eclipse.jdt.internal.core.JavaElement) ? ((org.eclipse.jdt.internal.core.JavaElement)key).getElementName() : key.toString(); } ToStringSorter sorter = new ToStringSorter(); sorter.sort(unsortedKeys, unsortedToStrings); for (int i = 0; i < length; i++) { String toString = sorter.sortedStrings[i]; Object value = get(sorter.sortedObjects[i]); result.append(toString); result.append(" -> "); //$NON-NLS-1$ result.append(value); result.append("\n"); //$NON-NLS-1$ } return result.toString(); }
/** * Return a new sorted collection from this unsorted collection. * Sort using quick sort. */ public void sort(Object[] unSortedObjects, String[] unsortedStrings) { int size = unSortedObjects.length; this.sortedObjects = new Object[size]; this.sortedStrings = new String[size]; //copy the array so can return a new sorted collection System.arraycopy(unSortedObjects, 0, this.sortedObjects, 0, size); System.arraycopy(unsortedStrings, 0, this.sortedStrings, 0, size); if (size > 1) quickSort(0, size - 1); } }
/** * Returns a String that represents the contents of this object. This method * is for debugging purposes only. */ protected String toStringContents() { StringBuffer result = new StringBuffer(); int length = this.entryTable.size(); Object[] unsortedKeys = new Object[length]; String[] unsortedToStrings = new String[length]; Enumeration e = keys(); for (int i = 0; i < length; i++) { Object key = e.nextElement(); unsortedKeys[i] = key; unsortedToStrings[i] = (key instanceof org.eclipse.jdt.internal.core.JavaElement) ? ((org.eclipse.jdt.internal.core.JavaElement)key).getElementName() : key.toString(); } ToStringSorter sorter = new ToStringSorter(); sorter.sort(unsortedKeys, unsortedToStrings); for (int i = 0; i < length; i++) { String toString = sorter.sortedStrings[i]; Object value = get(sorter.sortedObjects[i]); result.append(toString); result.append(" -> "); //$NON-NLS-1$ result.append(value); result.append("\n"); //$NON-NLS-1$ } return result.toString(); }
/** * Return a new sorted collection from this unsorted collection. * Sort using quick sort. */ public void sort(Object[] unSortedObjects, String[] unsortedStrings) { int size = unSortedObjects.length; this.sortedObjects = new Object[size]; this.sortedStrings = new String[size]; //copy the array so can return a new sorted collection System.arraycopy(unSortedObjects, 0, this.sortedObjects, 0, size); System.arraycopy(unsortedStrings, 0, this.sortedStrings, 0, size); if (size > 1) quickSort(0, size - 1); } }
/** * Returns a String that represents the contents of this object. This method * is for debugging purposes only. */ protected String toStringContents() { StringBuffer result = new StringBuffer(); int length = this.entryTable.size(); Object[] unsortedKeys = new Object[length]; String[] unsortedToStrings = new String[length]; Enumeration e = keys(); for (int i = 0; i < length; i++) { Object key = e.nextElement(); unsortedKeys[i] = key; unsortedToStrings[i] = (key instanceof org.eclipse.jdt.internal.core.JavaElement) ? ((org.eclipse.jdt.internal.core.JavaElement)key).getElementName() : key.toString(); } ToStringSorter sorter = new ToStringSorter(); sorter.sort(unsortedKeys, unsortedToStrings); for (int i = 0; i < length; i++) { String toString = sorter.sortedStrings[i]; Object value = get(sorter.sortedObjects[i]); result.append(toString); result.append(" -> "); //$NON-NLS-1$ result.append(value); result.append("\n"); //$NON-NLS-1$ } return result.toString(); }
/** * Return a new sorted collection from this unsorted collection. * Sort using quick sort. */ public void sort(Object[] unSortedObjects, String[] unsortedStrings) { int size = unSortedObjects.length; this.sortedObjects = new Object[size]; this.sortedStrings = new String[size]; //copy the array so can return a new sorted collection System.arraycopy(unSortedObjects, 0, this.sortedObjects, 0, size); System.arraycopy(unsortedStrings, 0, this.sortedStrings, 0, size); if (size > 1) quickSort(0, size - 1); } }
/** * Returns a String that represents the contents of this object. This method * is for debugging purposes only. */ protected String toStringContents() { StringBuffer result = new StringBuffer(); int length = this.entryTable.size(); Object[] unsortedKeys = new Object[length]; String[] unsortedToStrings = new String[length]; Enumeration e = keys(); for (int i = 0; i < length; i++) { Object key = e.nextElement(); unsortedKeys[i] = key; unsortedToStrings[i] = (key instanceof org.eclipse.jdt.internal.core.JavaElement) ? ((org.eclipse.jdt.internal.core.JavaElement)key).getElementName() : key.toString(); } ToStringSorter sorter = new ToStringSorter(); sorter.sort(unsortedKeys, unsortedToStrings); for (int i = 0; i < length; i++) { String toString = sorter.sortedStrings[i]; Object value = get(sorter.sortedObjects[i]); result.append(toString); result.append(" -> "); //$NON-NLS-1$ result.append(value); result.append("\n"); //$NON-NLS-1$ } return result.toString(); }
/** * Return a new sorted collection from this unsorted collection. * Sort using quick sort. */ public void sort(Object[] unSortedObjects, String[] unsortedStrings) { int size = unSortedObjects.length; this.sortedObjects = new Object[size]; this.sortedStrings = new String[size]; //copy the array so can return a new sorted collection System.arraycopy(unSortedObjects, 0, this.sortedObjects, 0, size); System.arraycopy(unsortedStrings, 0, this.sortedStrings, 0, size); if (size > 1) quickSort(0, size - 1); } }
/** * Returns a String that represents the contents of this object. This method * is for debugging purposes only. */ protected String toStringContents() { StringBuffer result = new StringBuffer(); int length = this.entryTable.size(); Object[] unsortedKeys = new Object[length]; String[] unsortedToStrings = new String[length]; Enumeration e = keys(); for (int i = 0; i < length; i++) { Object key = e.nextElement(); unsortedKeys[i] = key; unsortedToStrings[i] = (key instanceof org.eclipse.jdt.internal.core.JavaElement) ? ((org.eclipse.jdt.internal.core.JavaElement)key).getElementName() : key.toString(); } ToStringSorter sorter = new ToStringSorter(); sorter.sort(unsortedKeys, unsortedToStrings); for (int i = 0; i < length; i++) { String toString = sorter.sortedStrings[i]; Object value = get(sorter.sortedObjects[i]); result.append(toString); result.append(" -> "); //$NON-NLS-1$ result.append(value); result.append("\n"); //$NON-NLS-1$ } return result.toString(); }
/** * Return a new sorted collection from this unsorted collection. * Sort using quick sort. */ public void sort(Object[] unSortedObjects, String[] unsortedStrings) { int size = unSortedObjects.length; this.sortedObjects = new Object[size]; this.sortedStrings = new String[size]; //copy the array so can return a new sorted collection System.arraycopy(unSortedObjects, 0, this.sortedObjects, 0, size); System.arraycopy(unsortedStrings, 0, this.sortedStrings, 0, size); if (size > 1) quickSort(0, size - 1); } }
/** * Returns a String that represents the contents of this object. This method * is for debugging purposes only. */ protected String toStringContents() { StringBuffer result = new StringBuffer(); int length = this.entryTable.size(); Object[] unsortedKeys = new Object[length]; String[] unsortedToStrings = new String[length]; Enumeration e = keys(); for (int i = 0; i < length; i++) { Object key = e.nextElement(); unsortedKeys[i] = key; unsortedToStrings[i] = (key instanceof org.eclipse.jdt.internal.core.JavaElement) ? ((org.eclipse.jdt.internal.core.JavaElement)key).getElementName() : key.toString(); } ToStringSorter sorter = new ToStringSorter(); sorter.sort(unsortedKeys, unsortedToStrings); for (int i = 0; i < length; i++) { String toString = sorter.sortedStrings[i]; Object value = get(sorter.sortedObjects[i]); result.append(toString); result.append(" -> "); //$NON-NLS-1$ result.append(value); result.append("\n"); //$NON-NLS-1$ } return result.toString(); }