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


Java BlipIterators类代码示例

本文整理汇总了Java中org.waveprotocol.wave.model.conversation.BlipIterators的典型用法代码示例。如果您正苦于以下问题:Java BlipIterators类的具体用法?Java BlipIterators怎么用?Java BlipIterators使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: countBlips

import org.waveprotocol.wave.model.conversation.BlipIterators; //导入依赖的package包/类
/**
 * Populates {@link #readBlips} and {@link #unreadBlips} by counting all blips.
 */
private void countBlips() {
  readBlips.clear();
  read = 0;
  unreadBlips.clear();
  unread = 0;

  for (Conversation conversation : conversationView.getConversations()) {
    for (ConversationBlip blip : BlipIterators.breadthFirst(conversation)) {
      if (supplementedWave.isUnread(blip)) {
        unreadBlips.add(blip);
        unread++;
      } else {
        readBlips.add(blip);
        read++;
      }
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:BlipReadStateMonitorImpl.java

示例2: generateDigest

import org.waveprotocol.wave.model.conversation.BlipIterators; //导入依赖的package包/类
/**
 * Produces a digest for a set of conversations. Never returns null.
 *
 * @param conversations the conversation.
 * @param rawWaveletData the waveletData from which the digest is generated.
 *        This wavelet is a copy.
 * @return the server representation of the digest for the query.
 */
public WaveDigest generateDigest(ConversationView conversations,
    WaveletData rawWaveletData) {
  String title = TitleHelper.extractTitle(conversations);
  String snippet = Snippets.renderSnippet(conversations, DIGEST_SNIPPET_LENGTH, title);
  String waveId = ApiIdSerializer.instance().serialiseWaveId(rawWaveletData.getWaveId());
  List<String> participants = CollectionUtils.newArrayList();
  for (ParticipantId p : rawWaveletData.getParticipants()) {
    participants.add(p.getAddress());
  }
  int blipCount = 0;
  Conversation rootConversation = conversations.getRoot();    
  for (ConversationBlip blip : BlipIterators.breadthFirst(rootConversation)) {
    blipCount++;
  }
  return new WaveDigest(waveId, title, snippet,
      rawWaveletData.getCreator().getAddress(), participants, blipCount,
      rawWaveletData.getCreationTime(), rawWaveletData.getLastModifiedTime());
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:27,代码来源:WaveDigester.java

示例3: countBlips

import org.waveprotocol.wave.model.conversation.BlipIterators; //导入依赖的package包/类
/**
 * Populates {@link #readBlips} and {@link #unreadBlips} by counting all blips.
 */
private void countBlips() {
  readBlips.clear();
  read = 0;
  unreadBlips.clear();
  unread = 0;

  if (conversation != null) {
    for (ConversationBlip blip : BlipIterators.breadthFirst(conversation)) {
      if (supplementedWave.isUnread(blip)) {
        unreadBlips.add(blip);
        unread++;
      } else {
        readBlips.add(blip);
        read++;
      }
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:22,代码来源:BlipReadStateMonitorImpl.java

示例4: renderToText

import org.waveprotocol.wave.model.conversation.BlipIterators; //导入依赖的package包/类
/**
 * Renders a wavelet into text.
 */
public static String renderToText(Conversation conv) {
  checkNotNull(conv, "Null conv");
  StringBuilder b = new StringBuilder();
  for (ConversationBlip blip : BlipIterators.breadthFirst(conv)) {
    render(blip.getContent().toInitialization(), b);
  }
  return b.toString();
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:12,代码来源:TextRenderer.java

示例5: countUnreadBlips

import org.waveprotocol.wave.model.conversation.BlipIterators; //导入依赖的package包/类
private int countUnreadBlips(Conversation conv, WaveletId convId, int convVersion,
    Supplement supplement) {
  log.info("Seen wavelets: " + supplement.getSeenWavelets());
  log.info("Conv wavelet: " + convId);
  int unreadBlips = 0;
  for (ConversationBlip blip : BlipIterators.breadthFirst(conv)) {
    if (supplement.isBlipUnread(
            convId, blip.getId(), Versions.truncate(blip.getLastModifiedVersion()))) {
      unreadBlips++;
    }
  }
  return unreadBlips;
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:14,代码来源:WaveIndexer.java

示例6: look

import org.waveprotocol.wave.model.conversation.BlipIterators; //导入依赖的package包/类
public void look(ObservableConversationView conversationView) {
  for (Conversation conversation : conversationView.getConversations()) {
    WaveletId waveletId = WaveletBasedConversation.widFor(conversation.getId());
    if (!supplement.isWaveletLooked(waveletId)) {
      supplement.firstLookWavelet(waveletId);
    } else {
      for (ConversationBlip blip : BlipIterators.breadthFirst(conversation)) {
        if (!supplement.isBlipLooked(blip)) {
          supplement.firstLookBlip(blip);
        }
      }
    }
  }
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:15,代码来源:BlipReader.java

示例7: hasUnreadBlips

import org.waveprotocol.wave.model.conversation.BlipIterators; //导入依赖的package包/类
private boolean hasUnreadBlips(Conversation conversation) {
  for(ConversationBlip blip : BlipIterators.breadthFirst(conversation)) {
    if (isUnread(blip)) {
      return true;
    }
  }
  return false;
}
 
开发者ID:jorkey,项目名称:Wiab.pro,代码行数:9,代码来源:LocalSupplementedWaveImpl.java

示例8: getBlipVersions

import org.waveprotocol.wave.model.conversation.BlipIterators; //导入依赖的package包/类
@Override
public Map<String, Long> getBlipVersions(WaveletId id) {
  Conversation c = view.getConversation(WaveletBasedConversation.idFor(id));
  Map<String, Long> blipVersions = new HashMap<String, Long>();
  for (ConversationBlip blip : BlipIterators.breadthFirst(c)) {
    blipVersions.put(blip.getId(), blip.getLastModifiedVersion());
  }
  return blipVersions;
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:10,代码来源:SupplementedWaveImpl.java

示例9: countBlips

import org.waveprotocol.wave.model.conversation.BlipIterators; //导入依赖的package包/类
private int countBlips(Conversation conv) {
  return Iterables.size(BlipIterators.breadthFirst(conv));
}
 
开发者ID:ArloJamesBarnes,项目名称:walkaround,代码行数:4,代码来源:WaveIndexer.java

示例10: generateDigest

import org.waveprotocol.wave.model.conversation.BlipIterators; //导入依赖的package包/类
/**
 * Produces a digest for a set of conversations. Never returns null.
 *
 * @param conversations the conversation.
 * @param supplement the supplement that allows to easily perform various
 *        queries on user related state of the wavelet.
 * @param rawWaveletData the waveletData from which the digest is generated.
 *        This wavelet is a copy.
 * @return the server representation of the digest for the query.
 */
Digest generateDigest(ObservableConversationView conversations, SupplementedWave supplement,
    WaveletData rawWaveletData) {
  ObservableConversation rootConversation = conversations.getRoot();
  ObservableConversationBlip firstBlip = null;
  if ((rootConversation != null) && (rootConversation.getRootThread() != null)
      && (rootConversation.getRootThread().getFirstBlip() != null)) {
    firstBlip = rootConversation.getRootThread().getFirstBlip();
  }
  String title;
  if (firstBlip != null) {
    Document firstBlipContents = firstBlip.getContent();
    title = TitleHelper.extractTitle(firstBlipContents).trim();
  } else {
    title = EMPTY_WAVELET_TITLE;
  }

  String snippet = Snippets.renderSnippet(rawWaveletData, DIGEST_SNIPPET_LENGTH).trim();
  if (snippet.startsWith(title) && !title.isEmpty()) {
    // Strip the title from the snippet if the snippet starts with the title.
    snippet = snippet.substring(title.length());
  }
  String waveId = ApiIdSerializer.instance().serialiseWaveId(rawWaveletData.getWaveId());
  List<String> participants = CollectionUtils.newArrayList();
  for (ParticipantId p : rawWaveletData.getParticipants()) {
    if (participants.size() < PARTICIPANTS_SNIPPET_LENGTH) {
      participants.add(p.getAddress());
    } else {
      break;
    }
  }
  int unreadCount = 0;
  int blipCount = 0;
  long lastModified = -1;
  for (ConversationBlip blip : BlipIterators.breadthFirst(rootConversation)) {
    if (supplement.isUnread(blip)) {
      unreadCount++;
    }
    lastModified = Math.max(blip.getLastModifiedTime(), lastModified);
    blipCount++;
  }
  return new Digest(title, snippet, waveId, participants, lastModified,
      rawWaveletData.getCreationTime(), unreadCount, blipCount);
}
 
开发者ID:apache,项目名称:incubator-wave,代码行数:54,代码来源:WaveDigester.java


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