當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。