本文整理了Java中java.text.Collator.getCollationKey()
方法的一些代码示例,展示了Collator.getCollationKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Collator.getCollationKey()
方法的具体详情如下:
包路径:java.text.Collator
类名称:Collator
方法名:getCollationKey
[英]Returns a CollationKey for the specified string for this collator with the current decomposition rule and strength value.
[中]使用当前分解规则和强度值返回此排序器的指定字符串的排序规则键。
代码示例来源:origin: stackoverflow.com
Collator c = Collator.getInstance();
c.setStrength(Collator.PRIMARY);
Map<CollationKey, String> dictionary = new TreeMap<CollationKey, String>();
dictionary.put(c.getCollationKey("Björn"), "Björn");
...
CollationKey query = c.getCollationKey("bjorn");
System.out.println(dictionary.get(query)); // --> "Björn"
代码示例来源:origin: com.h2database/h2
private CollationKey getKey(String a) {
synchronized (collationKeys) {
CollationKey key = collationKeys.get(a);
if (key == null) {
key = collator.getCollationKey(a);
collationKeys.put(a, key);
}
return key;
}
}
代码示例来源:origin: lealone/Lealone
private CollationKey getKey(String a) {
synchronized (collationKeys) {
CollationKey key = collationKeys.get(a);
if (key == null) {
key = collator.getCollationKey(a);
collationKeys.put(a, key);
}
return key;
}
}
代码示例来源:origin: robovm/robovm
m_key1Value = k1.m_col.getCollationKey(r.str());
m_key2Value = new Double(d);
} else {
m_key2Value = k2.m_col.getCollationKey(r2.str());
代码示例来源:origin: xalan/xalan
m_key1Value = k1.m_col.getCollationKey(r.str());
m_key2Value = new Double(d);
} else {
m_key2Value = k2.m_col.getCollationKey(r2.str());
代码示例来源:origin: robovm/robovm
k.m_namespaceContext);
n1String = k.m_col.getCollationKey(r1.str());
n2String = k.m_col.getCollationKey(r2.str());
代码示例来源:origin: xalan/xalan
k.m_namespaceContext);
n1String = k.m_col.getCollationKey(r1.str());
n2String = k.m_col.getCollationKey(r2.str());
代码示例来源:origin: org.apache.lucene/lucene-analyzers-common
@Override
public void setStringValue(String value) {
bytes.bytes = collator.getCollationKey(value).toByteArray();
bytes.offset = 0;
bytes.length = bytes.bytes.length;
}
}
代码示例来源:origin: stackoverflow.com
class Person implements Comparable<Person> {
private static final Collator collator = Collator.getInstance(Locale.ITALY);
private final String lastname;
private final CollationKey key;
Person(String lastname) {
this.lastname = lastname;
this.key = collator.getCollationKey(lastname);
}
public int compareTo(Person person) {
return key.compareTo(person.key);
}
}
代码示例来源:origin: org.apache.lucene/lucene-analyzers-common
@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;
}
代码示例来源:origin: apache/phoenix
@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;
}
代码示例来源:origin: org.eclipse.jetty.aggregate/jetty-all-server
private CollationKey toKey(Node node)
{
return collator.getCollationKey(node.getName());
}
}
代码示例来源:origin: org.eclipse.jetty/jetty-deploy
private CollationKey toKey(Node node)
{
return collator.getCollationKey(node.getName());
}
}
代码示例来源:origin: net.sourceforge.saxon/saxon
/**
* Given a collation, get a collation key. The essential property of collation keys
* is that if two values are equal under the collation, then the collation keys are
* compare correctly under the equals() method.
*
* @throws ClassCastException if the collation is not one that is capable of supplying
* collation keys (this should have been checked in advance)
*/
public Object getCollationKey(NamedCollation namedCollation, String value) {
return ((Collator)namedCollation.getCollation()).getCollationKey(value);
}
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
private CollationKey toKey(Node node)
{
return collator.getCollationKey(node.getName());
}
}
代码示例来源:origin: mapsforge/mapsforge
private static byte[] getCollationKeyInBytes(String name) {
if (mColl == null) {
mColl = Collator.getInstance();
mColl.setStrength(Collator.PRIMARY);
}
return mColl.getCollationKey(name).toByteArray();
}
代码示例来源:origin: com.github.marschall/memoryfilesystem
@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;
}
代码示例来源:origin: net.sf.saxon/Saxon-HE
/**
* Given a collation, get a collation key. The essential property of collation keys
* is that if two values are equal under the collation, then the collation keys are
* compare correctly under the equals() method.
*
* @throws ClassCastException if the collation is not one that is capable of supplying
* collation keys (this should have been checked in advance)
*/
public AtomicMatchKey getCollationKey(SimpleCollation namedCollation, String value) {
CollationKey ck = ((Collator) namedCollation.getComparator()).getCollationKey(value);
return new CollationMatchKey(ck);
}
代码示例来源:origin: blazegraph/database
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 );
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
@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;
}
内容来源于网络,如有侵权,请联系作者删除!