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

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

本文整理了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

  1. private void create (String root,
  2. String prefix)
  3. {
  4. // Set the root part
  5. if ( Util.isEmpty(root) ) {
  6. // Use null for empty or null
  7. rootId = null;
  8. }
  9. else {
  10. // makeId() uses the String.hashCode which should be reproducible across VM and sessions
  11. rootId = Util.makeId(root);
  12. }
  13. // Set the prefix part (empty is OK)
  14. setPrefix(prefix);
  15. }

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

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

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

  1. private static <T extends IWithAnnotations & IWithProperties> void addAnnotationsHelper (T resource,
  2. GenericAnnotation issue)
  3. {
  4. if ( issue == null ) return;
  5. ITSLQIAnnotations current = resource.getAnnotation(ITSLQIAnnotations.class);
  6. if ( current == null ) {
  7. ITSLQIAnnotations anns = new ITSLQIAnnotations();
  8. String id = Util.makeId(UUID.randomUUID().toString());
  9. resource.setProperty(new Property(Property.ITS_LQI,
  10. " its:locQualityIssuesRef=\"#"+id+"\""));
  11. anns.setData(id);
  12. anns.add(issue);
  13. resource.setAnnotation(anns);
  14. }
  15. else {
  16. current.add(issue);
  17. }
  18. }

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

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

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

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

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

  1. anns.setData(Util.makeId(UUID.randomUUID().toString()));
  2. refId = anns.getData();
  3. anns.setData(Util.makeId(UUID.randomUUID().toString()));
  4. refId = anns.getData();

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

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

相关文章