rhsBytes = ((CollationKeyICU) other).bytes; } else { rhsBytes = other.toByteArray();
@Override public void setStringValue(String value) { bytes.bytes = collator.getCollationKey(value).toByteArray(); bytes.offset = 0; bytes.length = bytes.bytes.length; } }
@Override public BytesRef getBytesRef() { final BytesRef ref = this.builder.get(); ref.bytes = collator.getCollationKey(toString()).toByteArray(); ref.offset = 0; ref.length = ref.bytes.length; return ref; }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression expression = getChildren().get(0); if (!expression.evaluate(tuple, ptr)) { return false; } String inputString = (String) PVarchar.INSTANCE.toObject(ptr, expression.getSortOrder()); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey inputString: " + inputString); } if (inputString == null) { return true; } byte[] collationKeyByteArray = collator.getCollationKey(inputString).toByteArray(); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey bytes: " + VarBinaryFormatter.INSTANCE.format(collationKeyByteArray)); } ptr.set(collationKeyByteArray); return true; }
@Override public void setStringValue(String value) { bytes.bytes = collator.getCollationKey(value).toByteArray(); bytes.offset = 0; bytes.length = bytes.bytes.length; } }
/** * Get an atomic value that encapsulates this match key. Needed to support the collation-key() function. * * @return an atomic value that encapsulates this match key */ public AtomicValue asAtomic() { return new Base64BinaryValue(key.toByteArray()); } }
/** * Get an atomic value that encapsulates this match key. Needed to support the collation-key() function. * * @return an atomic value that encapsulates this match key */ public AtomicValue asAtomic() { return new Base64BinaryValue(key.toByteArray()); } }
@Override public void setStringValue(String value) { bytes.bytes = collator.getCollationKey(value).toByteArray(); bytes.offset = 0; bytes.length = bytes.bytes.length; } }
private static byte[] getCollationKeyInBytes(String name) { if (mColl == null) { mColl = Collator.getInstance(); mColl.setStrength(Collator.PRIMARY); } return mColl.getCollationKey(name).toByteArray(); }
@Override public int hashCode() { // TODO safe expensive MemoryFileSystem memoryFileSystem = this.getMemoryFileSystem(); Collator collator = memoryFileSystem.getCollator(); int result = 17; result = 31 * result + memoryFileSystem.hashCode(); CollationKey collationKey = collator.getCollationKey(Character.toString(this.letter)); result = 31 * result + Arrays.hashCode(collationKey.toByteArray()); return result; }
@Override public int hashCode() { MemoryFileSystem memoryFileSystem = this.getMemoryFileSystem(); Collator collator = memoryFileSystem.getCollator(); // TODO expensive, safe CollationKey collationKey = collator.getCollationKey(this.fileName); int result = 17; result = 31 * result + memoryFileSystem.hashCode(); result = 31 * result + Arrays.hashCode(collationKey.toByteArray()); return result; }
public void appendSortKey(KeyBuilder keyBuilder, String s) { /* * Note: the collation key is expressed as signed bytes since that * is how the JDK normally compares byte[]s. Therefore append it * into the key builder using the API that translates signed bytes * to unsigned bytes. */ final byte[] sortKey = collator.getCollationKey(s).toByteArray(); keyBuilder.append( sortKey ); }
public void appendSortKey(KeyBuilder keyBuilder, String s) { /* * Note: the collation key is expressed as signed bytes since that * is how the JDK normally compares byte[]s. Therefore append it * into the key builder using the API that translates signed bytes * to unsigned bytes. */ final byte[] sortKey = collator.getCollationKey(s).toByteArray(); keyBuilder.append( sortKey ); }
@Override public int hashCode() { MemoryFileSystem memoryFileSystem = this.getMemoryFileSystem(); Collator collator = memoryFileSystem.getCollator(); int result = 17; result = 31 * result + memoryFileSystem.hashCode(); for (String each : this.getNameElements()) { // TODO expensive, safe CollationKey collationKey = collator.getCollationKey(each); result = 31 * result + Arrays.hashCode(collationKey.toByteArray()); } return result; }
@Override public int hashCode() { // TODO expensive, safe Collator collator = this.getMemoryFileSystem().getCollator(); int result = 17; result = 31 * result + this.root.hashCode(); for (String each : this.getNameElements()) { CollationKey collationKey = collator.getCollationKey(each); result = 31 * result + Arrays.hashCode(collationKey.toByteArray()); } return result; }
@Override public BytesRef getBytesRef() { final BytesRef ref = this.builder.get(); ref.bytes = collator.getCollationKey(toString()).toByteArray(); ref.offset = 0; ref.length = ref.bytes.length; return ref; }
@Override public BytesRef getBytesRef() { final BytesRef ref = this.builder.get(); ref.bytes = collator.getCollationKey(toString()).toByteArray(); ref.offset = 0; ref.length = ref.bytes.length; return ref; }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression expression = getChildren().get(0); if (!expression.evaluate(tuple, ptr)) { return false; } String inputString = (String) PVarchar.INSTANCE.toObject(ptr, expression.getSortOrder()); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey inputString: " + inputString); } if (inputString == null) { return true; } byte[] collationKeyByteArray = collator.getCollationKey(inputString).toByteArray(); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey bytes: " + VarBinaryFormatter.INSTANCE.format(collationKeyByteArray)); } ptr.set(collationKeyByteArray); return true; }
@Override public boolean evaluate(Tuple tuple, ImmutableBytesWritable ptr) { Expression expression = getChildren().get(0); if (!expression.evaluate(tuple, ptr)) { return false; } String inputString = (String) PVarchar.INSTANCE.toObject(ptr, expression.getSortOrder()); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey inputString: " + inputString); } if (inputString == null) { return true; } byte[] collationKeyByteArray = collator.getCollationKey(inputString).toByteArray(); if (LOG.isTraceEnabled()) { LOG.trace("CollationKey bytes: " + VarBinaryFormatter.INSTANCE.format(collationKeyByteArray)); } ptr.set(collationKeyByteArray); return true; }
@Override public boolean incrementToken() throws IOException { if (input.incrementToken()) { char[] termBuffer = termAtt.termBuffer(); String termText = new String(termBuffer, 0, termAtt.termLength()); byte[] collationKey = collator.getCollationKey(termText).toByteArray(); ByteBuffer collationKeyBuf = ByteBuffer.wrap(collationKey); int encodedLength = IndexableBinaryStringTools.getEncodedLength(collationKeyBuf); if (encodedLength > termBuffer.length) { termAtt.resizeTermBuffer(encodedLength); } termAtt.setTermLength(encodedLength); CharBuffer wrappedTermBuffer = CharBuffer.wrap(termAtt.termBuffer()); IndexableBinaryStringTools.encode(collationKeyBuf, wrappedTermBuffer); return true; } else { return false; } } }