net.sf.okapi.common.Util.makeId()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(2.3k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中net.sf.okapi.common.Util.makeId()方法的一些代码示例,展示了Util.makeId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.makeId()方法的具体详情如下:
包路径:net.sf.okapi.common.Util
类名称:Util
方法名:makeId

Util.makeId介绍

[英]Creates a string Identifier based on the hash code of the given text.
[中]基于给定文本的哈希代码创建字符串标识符。

代码示例

代码示例来源:origin: net.sf.okapi/okapi-core

private void create (String root,
  String prefix)
{
  // Set the root part
  if ( Util.isEmpty(root) ) {
    // Use null for empty or null
    rootId = null;
  }
  else {
    // makeId() uses the String.hashCode which should be reproducible across VM and sessions
    rootId = Util.makeId(root);
  }

  // Set the prefix part (empty is OK)
  setPrefix(prefix);
}

代码示例来源:origin: net.sf.okapi/okapi-core

/**
 * Clones this annotation and make sure its still has a unique ID.
 * @return A new InlineAnnotation object that is a copy of this one.
 */
@Override
public GenericAnnotations clone () {
  GenericAnnotations newAnns = new GenericAnnotations(this.toString());
  // This type of annotation uses the data field for its unique ID
  // So we need to create a new unique ID
  if ( newAnns.getData() != null ) {
    newAnns.setData(Util.makeId(UUID.randomUUID().toString()));
  }
  return newAnns;
}

代码示例来源:origin: net.sf.okapi/okapi-core

private static <T extends IWithAnnotations & IWithProperties> void addAnnotationsHelper (T resource,
  GenericAnnotation issue)
{
  if ( issue == null ) return;
  ITSLQIAnnotations current = resource.getAnnotation(ITSLQIAnnotations.class);
  if ( current == null ) {
    ITSLQIAnnotations anns = new ITSLQIAnnotations();
    String id = Util.makeId(UUID.randomUUID().toString());
    resource.setProperty(new Property(Property.ITS_LQI,
      " its:locQualityIssuesRef=\"#"+id+"\""));
    anns.setData(id);
    anns.add(issue);
    resource.setAnnotation(anns);
  }
  else {
    current.add(issue);
  }
}

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

String projectId = Util.makeId(params.getPackageName()+srcLoc.toString()+trgLoc.toString());

代码示例来源:origin: net.sf.okapi.filters/okapi-filter-po

tu.setName(Util.makeId(base));
tu.setName(Util.makeId(base)
  + String.format("-%d", pluralCount-1));

代码示例来源:origin: net.sf.okapi/okapi-core

anns.setData(Util.makeId(UUID.randomUUID().toString()));
refId = anns.getData();
anns.setData(Util.makeId(UUID.randomUUID().toString()));
refId = anns.getData();

代码示例来源:origin: net.sf.okapi.steps/okapi-step-rainbowkit

String subdir = Util.getDirectoryName(info.getRelativeInputPath());
if ( !subdir.isEmpty() ) {
  resourceFile = Util.makeId(subdir) + "_" + resourceFile;

相关文章