net.sf.okapi.common.Event.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(134)

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

Event.<init>介绍

[英]Creates a new event without any associated resource. Used for filter events that have no resources such as START and FINISH.
[中]创建没有任何关联资源的新事件。用于筛选没有资源(如开始和完成)的事件。

代码示例

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

/**
 * Cancel current processing and add the CANCELED {@link Event} to the event queue.
 */
public void cancel() {
  // flush out all pending events
  filterEvents.clear();
  referencableFilterEvents.clear();
  Event event = new Event(EventType.CANCELED);
  filterEvents.add(event);
}

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

private void buildEndDocument () {
  Ending ed = new Ending(docId);
  events.add(new Event(EventType.END_DOCUMENT, ed));
  done = true;
}

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

private void sendStartSubDocumentIfNeeded () {
  if ( startSubDoc == null ) return; // Done already
  queue.add(new Event(EventType.START_SUBDOCUMENT, startSubDoc, skel));
  skel = new XMLSkeleton();
  startSubDoc = null;
}

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

@Override
public void cancel () {
  canceled = true;
  queue.clear();
  queue.add(new Event(EventType.CANCELED));
  close();
}

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

@Override
public void  process(RawDocument input) {
  process(new Event(EventType.RAW_DOCUMENT, input));
}

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

/**
 * Add the END_SUBDOCUMENT {@link Event} to the event queue.
 */
public void endSubDocument() {
  if (!subFilter) {
    Ending endDocument = new Ending(subDocumentId.createId(IdGenerator.END_SUBDOCUMENT));
    Event event = new Event(EventType.END_SUBDOCUMENT, endDocument);
    filterEvents.add(event);
    LOGGER.debug("End Sub-Document for " + endDocument.getId());
  }
}

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

private Event open(XMLEventReader xmlEventReader) throws XMLStreamException {
  DocumentPart documentPart;
  try {
    documentPart = handlePart(xmlEventReader);
  } finally {
    if (null != xmlEventReader) {
      xmlEventReader.close();
    }
  }
  return new Event(EventType.DOCUMENT_PART, documentPart);
}

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

/**
 * create a END_DOCUMENT {@link Event}
 * @return the newly created {@link Ending} event.
 */
protected Event createEndFilterEvent() {
  Ending endDocument = new Ending(documentId.getLastId());
  LOGGER.debug("End Document for " + endDocument.getId()); //$NON-NLS-1$
  return new Event(EventType.END_DOCUMENT, endDocument);
}

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

private void process() throws XMLStreamException, IOException {
  DocumentPart documentPart = new DocumentPart(documentPartIdGenerator.createId(), false);
  documentPart.setSkeleton(new GenericSkeleton(getModifiedContent()));
  filterEvents.add(new Event(EventType.DOCUMENT_PART, documentPart));
  filterEvents.add(new Event(EventType.END_DOCUMENT, new Ending(subDocumentId)));
  filterEventIterator = filterEvents.iterator();
}

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

@Override
public void startBatch() {
  state = PipelineReturnValue.RUNNING;
  initialize();
  Event event = new Event(EventType.START_BATCH);
  for (IPipelineStep step : steps) {
    step.handleEvent(event);
  }
  notifyObservers(event);
}

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

private Event processEvents () {
  // Do the translations
  getTranslations();
  // Translations are done
  // Now we sent all the stored events down the pipeline
  needReset = true; // To reset the list next time around
  return new Event(EventType.MULTI_EVENT, new MultiEvent(events));
}

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

protected void flushDocumentPart() {
  DocumentPart documentPart = new DocumentPart(documentPartIdGenerator.createId(), false, new GenericSkeleton(serialize(documentPartEvents)));
  filterEvents.add(new Event(EventType.DOCUMENT_PART, documentPart));
  documentPartEvents = new ArrayList<>();
}

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

private Event createDocumentPartEvent(List<StoryChildElement> textUnitElements) {
    DocumentPart documentPart = new DocumentPart(documentPartIdGenerator.createId(), false);
    documentPart.setSkeleton(new StyledTextSkeleton(textUnitElements, Collections.<Integer, Object>emptyMap()));

    return new Event(EventType.DOCUMENT_PART, documentPart);
  }
}

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

/**
 * Create an {@link Custom} {@link Event} that tells the SegmenterStep that it needs
 * to deepen existing segmentation.
 * @return {@link Event} with {@link Custom} resource and {@link DeepenSegmentationAnnotaton}.
 */
public static final Event createDeepenSegmentationEvent() {
  Custom cr = new Custom();
  DeepenSegmentationAnnotaton a = new DeepenSegmentationAnnotaton();
  cr.setAnnotation(a);
  return new Event(EventType.CUSTOM, cr);
}

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

@Override
public Event open(String documentId, String subDocumentId, LocaleId srcLang) throws IOException, XMLStreamException {
  DocumentPart dp = new DocumentPart(entry.getName(), false);
  ZipSkeleton skel = new ZipSkeleton(zipFile.getZip(), entry);
  skel.setModifiedContents(getModifiedContent());
  return new Event(EventType.DOCUMENT_PART, dp, skel);
}

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

protected Event createStartSubDocumentEvent() {
  StartSubDocument sd = new StartSubDocument(parentId, id);
  sd.setName(zipEntry.getName());
  sd.setMimeType(MIME_TYPE);
  ZipSkeleton zs = new ZipSkeleton(zipFile, zipEntry);
  sd.setSkeleton(zs);
  sd.setFilterParameters(parameters);
  return new Event(EventType.START_SUBDOCUMENT, sd);
}

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

@Override
  public Event build() {
    Markup markup = markupBuilder.build();

    if (markup.getMarkupRanges().isEmpty()) {
      return null;
    }

    DocumentPart documentPart = new DocumentPart(documentPartIdGenerator.createId(), false);
    documentPart.setSkeleton(new MarkupSkeleton(markup));

    return new Event(EventType.DOCUMENT_PART, documentPart);
  }
}

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

private void flushSkeleton(String resId, int dpIndex, MultiEvent me) {
  if (newSkel.isEmpty()) return;
    
  //me.addEvent(new Event(EventType.DOCUMENT_PART, new DocumentPart(String.format("%s_%d", resId, dpIndex), false, newSkel)));
  me.addEvent(new Event(EventType.DOCUMENT_PART, new DocumentPart("", false, newSkel))); // IDs are set in packMultiEvent()
  newSkel = new GenericSkeleton(); // newSkel.clear() would damage an already sent skeleton
}

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

private Event nextInDocument() throws IOException, XMLStreamException {
  while (document.hasNextSubDocument()) {
    subDocument = document.nextSubDocument();
    nextAction = NextAction.NEXT_IN_SUB_DOCUMENT;
    return subDocument.open();
  }
  close();
  Ending ending = new Ending(END_DOCUMENT_ID);
  return new Event(EventType.END_DOCUMENT, ending);
}

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

private Event createTextUnitEvent(List<StoryChildElement> textUnitElements, TextFragment textFragment, String id) {
  ITextUnit textUnit = new TextUnit(id);
  textUnit.setPreserveWhitespaces(true);
  textUnit.setSource(new TextContainer(textFragment));
  ISkeleton skeleton = new StyledTextSkeleton(textUnitElements, codeMap);
  skeleton.setParent(textUnit);
  textUnit.setSkeleton(skeleton);
  return new Event(EventType.TEXT_UNIT, textUnit);
}

相关文章