当前位置: 首页>>代码示例>>Java>>正文


Java Record类代码示例

本文整理汇总了Java中edu.stanford.nlp.util.logging.Redwood.Record的典型用法代码示例。如果您正苦于以下问题:Java Record类的具体用法?Java Record怎么用?Java Record使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Record类属于edu.stanford.nlp.util.logging.Redwood包,在下文中一共展示了Record类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: flush

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
private void flush(RepeatedRecordInfo info, List<Record> willReturn) {
  //(suppress all printing)
  if(info.suppressRecord){ return; }
  //(get time)
  int repeatedRecordCount = info.timesSeen - info.timesPrinted;
  if (repeatedRecordCount > 0) {
    //(send message record)
    //((add force tag))
    Object[] newTags = new Object[info.lastRecord.channels().length+1];
    System.arraycopy(info.lastRecord.channels(),0,newTags,1,info.lastRecord.channels().length);
    newTags[0] = Redwood.FORCE;
    //((create record))
    Record newRecord = new Record(
        repeatSemantics.message(repeatedRecordCount),
        newTags,
        info.lastRecord.depth,
        info.lastRecord.callingClass,
        info.lastRecord.callingMethod,
        info.lastRecord.timesstamp);
    //((pass record))
    willReturn.add(newRecord);
    info.timesSeen = 0;
    info.timesPrinted = 0;
  }
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:26,代码来源:RepeatedRecordHandler.java

示例2: recordVerdict

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
private boolean recordVerdict(Record r, boolean isRepeat, boolean shouldPrint, List<Record> willReturn){
  if(r.force()){
    flushParents(willReturn);
    if(isRepeat){ flush(current,willReturn); } //if not repeat, will flush below
    shouldPrint = true;
  }
  if(!isRepeat) {
    flush(current,willReturn);
    current.lastRecord = r;
  }
  if(shouldPrint){
    current.timeOfLastPrintedRecord = r.timesstamp;
    current.timesPrinted += 1;
  }
  current.timesSeen += 1;
  current.somethingPrinted = true;
  //(return)
  return shouldPrint;
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:20,代码来源:RepeatedRecordHandler.java

示例3: signalStartTrack

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public List<Record> signalStartTrack(Record signal) {
  //(handle record)
  List<Record> willReturn = new ArrayList<Record>();
  boolean isPrinting = internalHandle(signal, willReturn);
  //(adjust state for track)
  if(!signal.force()){
    if(isPrinting){
      current.trackCountPending = PendingType.PRINTING;
      current.timesPrinted -= 1;
    }else{
      current.trackCountPending = PendingType.SEEN;
    }
    current.timesSeen -= 1;
  }
  //(push stack)
  stack.push(current);
  current = new RepeatedRecordInfo();
  if(!isPrinting){ current.suppressRecord = true; }
  return willReturn;
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:23,代码来源:RepeatedRecordHandler.java

示例4: signalEndTrack

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public List<Record> signalEndTrack(int newDepth, long timeEnded) {
  List<Record> willReturn = new ArrayList<Record>();
  //(get state info)
  boolean trackWasNonempty = current.somethingPrinted;
  //(flush)
  flush(current,willReturn);
  current = stack.pop();
  //(update seen counts)
  if(trackWasNonempty){
    if(current.trackCountPending == PendingType.PRINTING){
      //((track was in fact printed))
      current.timesPrinted += 1;
    }
    if(current.trackCountPending != PendingType.NONE){
      //((track was in fact seen))
      current.timesSeen += 1;
    }
    //((track is nonempty))
    current.somethingPrinted = true;
  }
  //(update this track)
  current.trackCountPending = PendingType.NONE;
  return willReturn;
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:27,代码来源:RepeatedRecordHandler.java

示例5: updateTracks

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
private void updateTracks(int untilDepth){
  while(!queuedTracks.isEmpty()){
    //(get record to update)
    Record signal = queuedTracks.removeFirst();
    if(signal.depth >= untilDepth){ queuedTracks.add(signal); return; }
    //(begin record message)
    StringBuilder b = new StringBuilder();
    if(missingOpenBracket){
      b.append("{\n");
    }
    //(write margin)
    for(int i=0; i<leftMargin; i++){
      b.append(" ");
    }
    //(write name)
    writeContent(signal.depth,signal.content,b);
    if(signal.content.toString().length() > 0){ b.append(" "); }
    //(print)
    print(null, this.style(new StringBuilder(), b.toString(), trackColor, trackStyle).toString() );
    this.missingOpenBracket = true;  //only set to false if actually updated track state
    //(update lines printed)
    if(info != null){
      info.numElementsPrinted += 1;
    }
  }
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:27,代码来源:OutputHandler.java

示例6: signalStartTrack

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public List<Record> signalStartTrack(Record signal) {
  //(queue track)
  this.queuedTracks.addLast(signal);
  //(push info)
  if(info != null){
    this.trackStack.push(info);
  }
  info = new TrackInfo(signal.content.toString(), signal.timesstamp);
  //(force print)
  if(signal.force()){
    updateTracks(signal.depth+1);
  }
  //(return)
  return EMPTY; //don't send extra records
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:18,代码来源:OutputHandler.java

示例7: flushParents

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
private void flushParents(List<Record> willReturn){
  Stack<RepeatedRecordInfo> reverseStack = new Stack<RepeatedRecordInfo>();
    while(!stack.isEmpty()){
      reverseStack.push(stack.pop());
    }
    while(!reverseStack.isEmpty()){
      RepeatedRecordInfo info = reverseStack.pop();
      info.timesSeen -= 1;
      flush(info, willReturn);
      stack.push(info);
    }
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:13,代码来源:RepeatedRecordHandler.java

示例8: internalHandle

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
private boolean internalHandle(Record record, List<Record> willReturn){
  // We are passing the record through a number of filters,
  // ordered by priority, to determine whether or not
  // to continue passing it on

  //--Special Cases
  //--Regular Cases
  //(ckeck squashing)
  if(this.current.suppressRecord){
    return recordVerdict(record, false, false, willReturn); //arg 2 is irrelevant here
  }
  //(check first record printed)
  if(this.current.lastRecord == null){
    return recordVerdict(record,false, true, willReturn);
  }
  //(check equality)
  if(this.repeatSemantics.equals(current.lastRecord,record)){
    //(check time)
    long currentTime = record.timesstamp;
    if(currentTime - this.current.timeOfLastPrintedRecord > this.repeatSemantics.maxWaitTimeInMillis()){
      return recordVerdict(record, true, true, willReturn);
    }
    //(check num printed)
    if(this.current.timesSeen < this.repeatSemantics.numToForcePrint()){
      return recordVerdict(record, true, true, willReturn);
    } else {
      return recordVerdict(record, true, false, willReturn);
    }
  } else {
    //(different record)
    return recordVerdict(record, false, true, willReturn);
  }
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:34,代码来源:RepeatedRecordHandler.java

示例9: handle

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
/** {@inheritDoc} */
public List<Record> handle(Record record) {
  List<Record> willReturn = new ArrayList<Record>();
  if(internalHandle(record, willReturn)){
    willReturn.add(record);
  }
  return willReturn;
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:9,代码来源:RepeatedRecordHandler.java

示例10: signalShutdown

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public List<Record> signalShutdown(){
  List<Record> willReturn = new ArrayList<Record>();
  flush(current,willReturn);
  return willReturn;
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:8,代码来源:RepeatedRecordHandler.java

示例11: equals

import edu.stanford.nlp.util.logging.Redwood.Record; //导入依赖的package包/类
public boolean equals(Record lastRecord, Record record) {
  return record.callingClass.equals(lastRecord.callingClass) &&
      record.callingMethod.equals(lastRecord.callingMethod) &&
      Arrays.equals(record.channels(), lastRecord.channels()) &&
      sameMessage(
        lastRecord.content == null ? "null" : lastRecord.content.toString(),
        record.content == null ? "null" : record.content.toString()
      );
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:10,代码来源:RepeatedRecordHandler.java


注:本文中的edu.stanford.nlp.util.logging.Redwood.Record类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。