@Override public boolean equals(Object obj) { if (obj instanceof CollationKeyICU) { return ((CollationKeyICU)obj).fIcuCollKey.equals(fIcuCollKey); } return false; }
@Override public int compareTo(java.text.CollationKey target) { if (target instanceof CollationKeyICU) { return fIcuCollKey.compareTo(((CollationKeyICU)target).fIcuCollKey); } return 0; }
private CollationKeyICU(CollationKey icuCollKey) { super(icuCollKey.getSourceString()); fIcuCollKey = icuCollKey; }
private CollationKey getCollationKey(String source, CollationBuffer buffer) { buffer.rawCollationKey = getRawCollationKey(source, buffer.rawCollationKey, buffer); return new CollationKey(source, buffer.rawCollationKey); }
if (source == null || source.getLength() == 0) { throw new IllegalArgumentException( "CollationKey argument can not be null or of 0 length"); byte result[] = new byte[getLength() + source.getLength() + 2]; return new CollationKey(null, result, rindex);
@Override public int hashCode() { return fIcuCollKey.hashCode(); } }
@Override public byte[] toByteArray() { return fIcuCollKey.toByteArray(); }
int length = getLength() + 1; byte result[] = new byte[length]; System.arraycopy(m_key_, 0, result, 0, length);
/** * <p> * Transforms the String into a CollationKey suitable for efficient * repeated comparison. The resulting key depends on the collator's * rules, strength and decomposition mode. * </p> * <p>See the CollationKey class documentation for more information.</p> * @param source the string to be transformed into a CollationKey. * @return the CollationKey for the given String based on this Collator's * collation rules. If the source String is null, a null * CollationKey is returned. * @see CollationKey * @see #compare(String, String) * @see #getRawCollationKey * @stable ICU 2.8 */ public CollationKey getCollationKey(String source) { return new CollationKey(collator.getCollationKey(source)); }
/** * <p>Compare this CollationKey and the specified Object for * equality. The collation rules of the Collator that created * this key are applied.</p> * * <p>See note in compareTo(CollationKey) for warnings about * possible incorrect results.</p> * * @param target the object to compare to. * @return true if the two keys compare as equal, false otherwise. * @see #compareTo(CollationKey) * @exception ClassCastException is thrown when the argument is not * a CollationKey. NullPointerException is thrown when the argument * is null. * @stable ICU 2.8 */ public boolean equals(Object target) { if (!(target instanceof CollationKey)) { return false; } return equals((CollationKey)target); }
/** * <p> * Transforms the String into a CollationKey suitable for efficient * repeated comparison. The resulting key depends on the collator's * rules, strength and decomposition mode. * </p> * <p>See the CollationKey class documentation for more information.</p> * @param source the string to be transformed into a CollationKey. * @return the CollationKey for the given String based on this Collator's * collation rules. If the source String is null, a null * CollationKey is returned. * @see CollationKey * @see #compare(String, String) * @see #getRawCollationKey * @stable ICU 2.8 */ public CollationKey getCollationKey(String source) { return new CollationKey(collator.getCollationKey(source)); }
@Override public int compare(MarkerItem item1, MarkerItem item2) { return getDescriptionKey(item1).compareTo(getDescriptionKey(item2)); }
@Override public String getSourceString() { return fIcuCollKey.getSourceString(); }
/** * <p>Compare this CollationKey and the specified Object for * equality. The collation rules of the Collator that created * this key are applied.</p> * * <p>See note in compareTo(CollationKey) for warnings about * possible incorrect results.</p> * * @param target the object to compare to. * @return true if the two keys compare as equal, false otherwise. * @see #compareTo(CollationKey) * @exception ClassCastException is thrown when the argument is not * a CollationKey. NullPointerException is thrown when the argument * is null. * @stable ICU 2.8 */ public boolean equals(Object target) { if (!(target instanceof CollationKey)) { return false; } return equals((CollationKey)target); }
return new CollationKey(null, resultkey, offset);
public int compare (Object element1, Object element2) { if (isValid (element1, element2)) { String string1 = getName (element1); String string2 = getName (element2); return string1 != null && string2 != null ? collator.getCollationKey(string1).compareTo(collator.getCollationKey(string2)) : -1; } return -1; } }
@Override Object getAttributeValue(String attribute) { Object value = getCache().get(attribute); if(value == null) { value = markerDelta.getAttribute(attribute); if(value != null) { getCache().put(attribute, value); } } if (value instanceof CollationKey) return ((CollationKey) value).getSourceString(); return value; }
/** * Compare this CollationKey and the specified Object for * equality. The collation rules of the Collator that created * this key are applied. * * <p>See note in compareTo(CollationKey) for warnings about * possible incorrect results. * * @param target the object to compare to. * @return true if the two keys compare as equal, false otherwise. * @see #compareTo(CollationKey) * @exception ClassCastException is thrown when the argument is not * a CollationKey. NullPointerException is thrown when the argument * is null. * @stable ICU 2.8 */ @Override public boolean equals(Object target) { if (!(target instanceof CollationKey)) { return false; } return equals((CollationKey)target); }
@Override public String getLocation() { if(stale||checkIfMarkerStale()){ return MarkerSupportInternalUtilities.UNKNOWN_ATRRIBTE_VALUE_STRING; } if (getCache().containsKey(LOCATION_STRING)) { Object value = getCache().get(LOCATION_STRING); if (value instanceof CollationKey) { return ((CollationKey) value).getSourceString(); } return (String) value; } // Is the location override set? String locationString = getAttributeValue(IMarker.LOCATION, MarkerSupportInternalUtilities.EMPTY_STRING); if (locationString.length() > 0) { getCache().put(LOCATION_STRING, locationString); return locationString; } // No override so use line number int lineNumber = getAttributeValue(IMarker.LINE_NUMBER, -1); String lineNumberString; if (lineNumber < 0) { lineNumberString = MarkerMessages.Unknown; } else { lineNumberString = NLS.bind(MarkerMessages.label_lineNumber, Integer.toString(lineNumber)); } getCache().put(LOCATION_STRING, lineNumberString); return lineNumberString; }
/** * Return the Object that is the marker value for attribute. Return null if * it is not found. * * @param attribute * @return Object or <code>null</code> */ Object getAttributeValue(String attribute) { Object value = getCache().get(attribute); if(value == null) { if(stale){ return value; } try { value = marker.getAttribute(attribute); } catch (CoreException e) { checkIfMarkerStale() ; value = null; } if(value != null) { getCache().put(attribute, value); } } if (value instanceof CollationKey) { return ((CollationKey) value).getSourceString(); } return value; }