pl.edu.icm.model.bwmeta.y.YLanguage.equals()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(202)

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

YLanguage.equals介绍

暂无

代码示例

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

private List<YName> returnNameInLang(AbstractNDA<?> element, YLanguage language) {
  final List<YName> yNameList = new ArrayList<YName>();
  for (YName name : element.getNames()) {
    if (name.getLanguage().equals(language)) {
      yNameList.add(name);
    }
  }
  return yNameList;
}

代码示例来源:origin: pl.edu.icm.yadda.repowebeditor/repository-web-editor-core

private String findNameInLanguage(List<YName> names, YLanguage yLanguage){
    for(YName name: names){
      if(yLanguage.equals(name.getLanguage()))
        return name.getText();
    }
    return null;
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

@Override
public boolean hasContentInLanguage(YElement yElement, YLanguage lang) {
  for (YName data : yElement.getNames()) {
    if (lang.equals(data.getLanguage())) {
      return true;
    }
  }
  for (YDescription data : yElement.getDescriptions()) {
    if (lang.equals(data.getLanguage())) {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import

/**
 * Selects most apropriate (English if available) title.
 * 
 * @param titles list of available titles
 * @return best found title or null if list is empty
 */
public static String selectBestName(List<YName> titles) {
  if (titles == null || titles.size() == 0) {
    return null;
  }
      
  for (YName title: titles) { //Search for English version
    if (title.getLanguage().equals(YLanguage.English)) {
      return title.getText();
    }
  }
  
  return titles.get(0).getText();
}

代码示例来源:origin: pl.edu.icm.yadda/bwmeta-import

/**
 * Selects most apropriate (English if available) description.
 * 
 * @param descriptions
 *            list of available descriptions
 * @return best found description or null if list is empty
 */
protected static String selectBestDescription(List<YDescription> descriptions) {
  if (descriptions == null || descriptions.size() == 0) {
    return null;
  }
  for (YDescription description : descriptions) { // Search for English version
    if (description.getLanguage().equals(YLanguage.English)) {
      return description.getText();
    }
  }
  return descriptions.get(0).getText();
}

代码示例来源:origin: pl.edu.icm.synat/synat-business-services-api

public static boolean acceptableDescription(YDescription yDescription, YLanguage language) {
  if (language == null) {
    return acceptableDescription(yDescription);
  } else {
    return yDescription.getLanguage().equals(language) && acceptableDescription(yDescription);
  }
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

private String extractTextFromYElement(final YElement yElement) throws IOException {
  final String sep = " ";
  final YLanguage lang = YLanguage.Polish;
  StringBuilder builder = new StringBuilder();
  for (YName data : yElement.getNames()) {
    if(lang.equals(data.getLanguage())){
      builder.append(data.getText());
      builder.append(sep);
    }
  }
  for (YDescription data : yElement.getDescriptions()) {
    if(lang.equals(data.getLanguage())){
      builder.append(data.getText());
      builder.append(sep);
    }
  }
  
  for(FilteredContentEntry<?> plainTextFile:ResourceDisplayUtilsImpl.fetchPlainTextContentEntries(yElement)){
    if(plainTextFile.getSource() instanceof YContentFile){
      YContentFile file = (YContentFile)plainTextFile.getSource();
      ElementContent elementContent = repositoryFacade.fetchContent(yElement.getId(), file.getLocations().get(0));
      
      builder.append(IOUtils.toString(elementContent.getStream()));
      builder.append(sep);
    }
  }
  return builder.toString().trim();
}

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

/**
 * Method for preparation of keywords list
 * 
 * @param yElement
 *            Ymodel element
 * @return List of keywords in yElement
 */
@Override
public List<KeywordsData> prepareKeywords(YElement yElement, Locale locale) {
  final YLanguage yDefaultLanguage = YModelUtils.getDefaultLanguage(yElement);
  List<KeywordsData> keywords = new ArrayList<KeywordsData>();
  for (YTagList tagList : yElement.getTagLists()) {
    final YLanguage yLanguage = tagList.getLanguage();
    final KeywordsData localizedKeywordsData = makeLocalizedKeywordsData(tagList, yLanguage, locale);
    if (null != localizedKeywordsData && yLanguage.equals(yDefaultLanguage)) {
      keywords.add(localizedKeywordsData);
    }
  }
  for (YTagList tagList : yElement.getTagLists()) {
    final YLanguage yLanguage = tagList.getLanguage();
    final KeywordsData localizedKeywordsData = makeLocalizedKeywordsData(tagList, yLanguage, locale);
    if (null != localizedKeywordsData && !yLanguage.equals(yDefaultLanguage)) {
      keywords.add(localizedKeywordsData);
    }
  }
  return keywords;
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-cli

for (YDescription desc : elem.getDescriptions()) {
  if (YConstants.DS_ABSTRACT.equalsIgnoreCase(desc.getType())) {
    if (lang==null || lang.equals(desc.getLanguage())) {
      textsTexts.add(new Pair<String, TextType>(normalize(desc.getText()), TextType.ABSTRACT));
      hasAbstarct = true;
  if (lang==null || lang.equals(name.getLanguage())) {
    textsTexts.add(new Pair<String, TextType>(normalize(name.getText()), TextType.TITLE));
    hasTitle = true;

代码示例来源:origin: pl.edu.icm.synat/synat-process-common

private void prepareTagsWithExistedTags(YElement enrichedElement,
    final String from, YElement element, final String to) {
  for (YTagList tags : enrichedElement.getTagLists(from)) {
    for (YTagList orgTags : element.getTagLists(to)) {
      if ( ! tags.getLanguage().equals(orgTags.getLanguage())) {
        continue;
      }
      prepareElementKeywords(element, to, tags, orgTags);
    }
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yadda-cli

for (YDescription desc : elem.getDescriptions()) {
  if (YConstants.DS_ABSTRACT.equalsIgnoreCase(desc.getType())) {
    if (lang==null || lang.equals(desc.getLanguage())) {
     textsTexts.add(new Pair<String, TextType>(normalize(desc.getText()), TextType.ABSTRACT));
     hasAbstarct = true;
  if (lang==null || lang.equals(name.getLanguage())) {
   textsTexts.add(new Pair<String, TextType>(normalize(name.getText()), TextType.TITLE));
   hasTitle = true;

代码示例来源:origin: pl.edu.icm.synat/synat-portal-core

@Override
@Cacheable("datasetTranslationResult")
public String getTranslation(String dataSetId, Locale locale, DictionaryDataTypes type) {
  try {
    YElement element = dataSetDictionary.getYElement(dataSetId);
    for (YName name : element.getNames()) {
      if (name.getLanguage() != null && name.getLanguage().equals(YLanguage.byCode(locale.getISO3Language()))) {
        return name.getText();
      }
    }
    final String name = YModelUtils.getDefaultName(element);
    if (StringUtils.isNotEmpty(name)) {
      return name;
    }
  } catch (NotFoundException e) {
    return dataSetId;
  }
  return dataSetId;
}

相关文章