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

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

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

Event.isNoop介绍

暂无

代码示例

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

/**
 * Adds an event to this object.
 * @param event the event to add.
 */
public void addEvent (Event event) {
  if (!event.isNoop())
    events.add(event);
}

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

/**
 * Inserts an event in this object at the specified position.
 * @param event the event to insert.
 * @param index index at which the event is to be inserted.
 */
public void addEvent (Event event, int index) {
  if (!event.isNoop())
    events.add(index, event);
}

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

@Override
public List<Event> convertToList(Event event) {
  List<Event> list = new LinkedList<Event>();
  Event me = convert(event);
  if (me.isMultiEvent()) {
    for (Event e : me.getMultiEvent()) {
      if (e.isNoop()) continue;
      list.add(e);
    }
  } else {
    list.add(me);
  }
  
  return list;
}

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

if (event.isNoop()) break; // The event has been processed in expandEvent(), no need to process further here
if (!notifiedObserver && !event.isNoop()) {
  notifyObservers(event);

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

private MultiEvent assignIDs(MultiEvent me, IResource resource) {
  int counter = 0;
  for (Event event : me) {
    if (event.isNoop()) continue;
    
    IResource res = event.getResource();
    String resId = resource.getId();
    
    if (res instanceof DocumentPart && !(resource instanceof DocumentPart)) {
      String id = "";
      if (counter++ == 0) id = resId;
      else
        id = String.format("%s_%d", resId, counter++);
      
      res.setId("" + String.format("dp_%s", id));
    }
    else {
      res.setId(resId);
      if (res instanceof BaseNameable && resource instanceof BaseNameable) {
        ResourceUtil.copyProperties((BaseNameable) resource, (BaseNameable) res);
      }
    }                            
  }
  return me;
}

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

private Event expandEvent(Event event, IPipelineStep currentStep) {
  // We send each of the events in MULTI_EVENT down the pipeline before
  // processing any other events but only if the event is configured for multi-event propagation
  if (event.getEventType() == EventType.MULTI_EVENT
      && !(((MultiEvent) event.getResource()).isPropagateAsSingleEvent())) {
    // add the remaining steps to a temp list - these are the steps that will receive the expanded
    // MULT_EVENTS
    List<IPipelineStep> remainingSteps = steps.subList(steps.indexOf(currentStep) + 1,
        steps.size());
    for (Event me : ((MultiEvent)event.getResource())) {
      event = me;
      // send the current event from MULTI_EVENT down the remaining steps in the pipeline
      for (IPipelineStep remainingStep : remainingSteps) {
        event = remainingStep.handleEvent(event);
        event = expandEvent(event, remainingStep);
        if (event.isNoop()) break; // The event has been processed in expandEvent(), no need to process further here
      }
      // notify observers that the final step has sent an Event
      // always filter out NO_OP events
      if (!event.isNoop()) {
        notifyObservers(event);
        notifiedObserver = true;
      }                
    }
    return Event.NOOP_EVENT; // All events have been propagated and processed by remaining steps 
  }
  
  return event;
}

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

Event e = filter.next();
if (e == null) return;
if (e.isNoop()) continue; // Get next filter event
if (e.isStartDocument()) {
  StartDocument sd = e.getStartDocument();
    e = step.handleEvent(e);
  if (e.isNoop()) continue; // Get next filter event

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

private Event processEvent(Event event) {
  if (!isCollectingEvents || isReferentGroup)
    return convertEvent(event);
  
  Event ev = convertEvent(event); // Subclass invocation
  if (ev.isMultiEvent()) {
    for (Event e : ev.getMultiEvent()) {
      if (e.isNoop()) continue;
      group.addEvent(e);
    }
  } else {
    group.addEvent(ev);
  }

  return ev;
}

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

if (event.isNoop()) continue;

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

if (group != null)
  for (Event event : group) {
    if (event.isNoop()) continue;

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

throw new InvalidParameterException("Event cannot be null");
if (event.isNoop()) return event;

相关文章