gpt4 book ai didi

pl.edu.icm.model.bwmeta.y.YDate类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 23:00:40 28 4
gpt4 key购买 nike

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

YDate介绍

暂无

代码示例

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

protected void fillDates(YElement yElement, List<YExportable> referedElements, Map<String, List<StringWithAttributes>> ret) {
  //        date element
  if (!yElement.getDates().isEmpty()) {
    ret.put(E_DATE, new ArrayList<StringWithAttributes>());
  }
  for (YDate yDate : yElement.getDates()) {
    String yDateStr;
    String y = String.format("%02d", yDate.getYear());
    String m = String.format("%02d", yDate.getMonth());
    String d = String.format("%02d", yDate.getDay());
    if (y != null && m != null && d != null) {
      yDateStr = y + "-" + m + "-" + d;
    } else if (y != null && m != null) {
      yDateStr = y + "-" + m;
    } else if (y != null) {
      yDateStr = y;
    } else {
      yDateStr = yDate.getText();
    }
    StringWithAttributes dat = new StringWithAttributes(yDateStr);
    dat.addAttribute("dateType", yDate.getType());
    ret.get(E_DATE).add(dat);
    // root.addContent(date);
  }
}

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

@Override
protected boolean enhanceMetadata(MatchResult result, YElement metadata) {
  YDate date = new YDate().setType(dateType);
  date.setDay(Integer.parseInt(result.group(2)));
  for (int i = 0; i < 12; i++) {
    if (result.group(i + 3) != null) {
      date.setMonth(i + 1);
      break;
    }
  }
  date.setYear(Integer.parseInt(result.group(15)));
  date.setText(result.group(1));
  metadata.addDate(date);
  return true;
}

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

private String parseDate(YDate yDate) {
  if (yDate.getYear() > 0 && yDate.getMonth() > 0 && yDate.getDay() > 0) {
    return yDate.getYear() + "/" + yDate.getMonth() + "/" + yDate.getDay();
  }
  if (yDate.getYear() > 0) {
    return String.valueOf(yDate.getYear());
  }
  return null;
}

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

private void updateArticleYear(String pyYear) {
  if (pyYear != null && pyYear.length() == 4) {
    YDate year = new YDate();
    year.setType(YConstants.DT_PUBLISHED);
    year.setYear(pyYear);
    yArticle.addDate(year);
  }
}

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

@Override
  protected boolean enhanceMetadata(MatchResult result, YElement metadata) {
    for (int i = 1; i <= result.groupCount(); i++) {
      String year = result.group(i);
      try {
        int y = Integer.parseInt(year);
        if (y >= 1900 && y < 2020) {
          metadata.addDate(new YDate().setType(YConstants.DT_PUBLISHED).setYear(y).setText(year));
          return true;
        }
      } catch (NumberFormatException e) {}
    }
    return false;
  }
}

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

if (!YConstants.DT_PUBLISHED.equals(elementDate.getType())) {
  continue;
if (elementDate.getYear() == 0) {
  continue;
metadata.setYear(Integer.toString(elementDate.getYear()));
if (elementDate.getMonth() != 0) {
  metadata.setMonth(Integer.toString(elementDate.getMonth()));

代码示例来源: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 selectBestDate(List<YDate> dates) {
  if (dates == null || dates.size() == 0) {
    return null;
  }
  StringBuilder text = new StringBuilder();
    
  for (YDate date : dates) {
    text.append(date.getType() + ":"+date.getYear()+YElementToZentralBlattConverter.SUGGESTED_MULTIVALUE_FIELD_SEPARATOR);
  }
  return text.toString();
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

protected Integer getYear(List<YDate> dates) {
  for (YDate date : dates) {
    return date.getYear();
  }
  return null;
}

代码示例来源:origin: pl.edu.icm.synat/synat-importer-direct

public static YDate parseDate(String date, String type) {
  if (StringUtils.isBlank(date)) {
    return null;
  }
  try {
    DateTime dateTime = ISODateTimeFormat.dateParser().parseDateTime(date);
    return new YDate(type, dateTime.getYear(), dateTime.getMonthOfYear(), dateTime.getDayOfMonth(), date);
  } catch (IllegalArgumentException e) {
    LOGGER.warn("Couldn't parse date", date);
    return null;
  }
}

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

protected void convertDate(YElement yElement, BibEntry bibEntry) {
  YDate date = yElement.getDate(YConstants.DT_PUBLISHED);
  if (date != null) {
    if (bibEntry.getFirstFieldValue(BibEntry.FIELD_YEAR) == null) {
      bibEntry.setField(BibEntry.FIELD_YEAR, String.valueOf(date.getYear()));
    }
    bibEntry.setField(BibEntry.FIELD_MONTH, String.valueOf(date.getMonth()));
    date.getYear();
  }
}

代码示例来源:origin: pl.edu.icm.yadda/yaddaweb-lite-core

private DateDTO dateDTOFromYDate(YDate date) {
  return new DateDTO(date.getType(), date.getText());
}

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

YDate yd = new YDate();
yd.setYear(val.getValue());
ydl.add(yd);
ye.setDates(ydl);

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

private Map<String, YDate> processYDates(final List<YDate> yDates) {
  Map<String, YDate> dates = new HashMap<>();
  if (yDates != null) {
    for (final YDate yDate : yDates) {
      dates.put(yDate.getType(), yDate);
    }
  }
  return dates;
}

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

@Override
  void compare(YElement expected, YElement actual, EvalResult result) {
    List<YDate> expDates = expected.getDates();
    Map<String, YDate> actDatesMap = new HashMap<String, YDate>();
    for (YDate date : actual.getDates()) {
      String type = date.getType();
      actDatesMap.put(type, date);
    }
    for (YDate date : expDates) {
      String type = date.getType();
      if (actDatesMap.containsKey(type)) {
        if (date.equals(actDatesMap.get(type))) {
          result.append("Date - " + type, ResultStatus.RECOGNIZED, 1);
        } else {
          result.append("Date - " + type, ResultStatus.FAILED, 1);
        }
        actDatesMap.remove(type);
      } else {
        result.append("Date - " + type, ResultStatus.FAILED, 1);
      }
    }
    for (String type : actDatesMap.keySet()) {
      result.append("Date - " + type, ResultStatus.REDUNDANT, 1);
    }
  }
},

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

protected void fillDates(HtmlMetaHeaders metadata, YElement yElement) {
  for (YDate yDate : yElement.getDates()) {
    metadata.addMetadataName(DC_NAMESPACE + SEPARATOR + DublinCoreStrings.E_DATE, yDate.getText());
  }
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

YDate pubdate=createDateFromDateLikeElement(pd, DateTypes.DT_PUBLISHED);
if ("epub".equalsIgnoreCase(pd.getAttributeValue("pub-type"))) {
 pubdate.setType(DateTypes.DT_ONLINE);

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

public DateTime parseDate(final YDate yDate) throws InvalidDateException {
  DateTime parsedDate;
  try {
    parsedDate = new DateTime(yDate.getYear(), yDate.getMonth() > 0 ? yDate.getMonth() : 1, yDate.getDay() > 0 ? yDate.getDay() : 1, 0, 0,
        DateTimeZone.UTC);
  } catch (IllegalFieldValueException e) {
    throw new InvalidDateException("Incorrect values in YDates.", e);
  }
  if (yDate.getDay() == 0) {
    parsedDate = parsedDate.dayOfMonth().withMinimumValue();
  }
  if (yDate.getMonth() == 0) {
    parsedDate = parsedDate.dayOfYear().withMinimumValue();
  }
  return parsedDate;
}

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

/**
 * Selects most appropriate (Publication's if available) data.
 */
protected static String selectBestDate(List<YDate> dates) {
  if (dates == null || dates.size() == 0) {
    return null;
  }
        int py = dates.get(0).getYear();
  for (YDate date: dates) { //Search for English version
    if (date.getType().equals(YConstants.DT_PUBLISHED)) {
      py = date.getYear();
    }
  }
  
  if (py > 1000) {
    return new Integer(py).toString();
  } else {
    return null;    
  } 
}

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

/**
 * accomplished
 */
private void parseDates() {
  if(!in_item.getDates().isEmpty()){
    for(YDate yd : in_item.getDates()){
      if(yd.getYear()!=0)
        paos_doc.add(new PredicateAndObject(RelConstants.RL_YEAR, ""+yd.getYear()));
    }
  }
}

代码示例来源:origin: pl.edu.icm.bwmeta/bwmeta-2-foreign-transformers

protected YDate convert(PublicationDate publicationDate) {
  int year = publicationDate.getYear();
  int month = publicationDate.getMonth() != null ? publicationDate.getMonth() : 1;
  int day = publicationDate.getDay() != null ? publicationDate.getDay() : 1;
  switch (publicationDate.getMediaType()) {
    case ONLINE:
      return new YDate(DateTypes.DT_PUBLISHED, year, month, day, StringUtils.EMPTY);
    case PRINT:
      return new YDate(DateTypes.DT_ISSUED, year, month, day, StringUtils.EMPTY);
    default:
  }
  return null;
}

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com