Example #1
0
 /**
  * Adds coocs to term.
  * @param content content
  * @param str term
  * @param coocs list of coocs per term
  */
 private void addCoocs( List<String> content,  String str,
        Dictionary<String, Dictionary<String, int>> coocs) {
    Dictionary<String, int> strcoocs = coocs.get(str);
    if (strcoocs == null) { strcoocs = new Dictionary<String, int>(); }
    for (String s : content) {
       if (!s.equals(str)) {
          if (strcoocs.containsKey(s)) {
              int tmp = strcoocs.get(s) + 1;
             strcoocs.put(s, tmp);
          } else {
             strcoocs.put(s, 1);
          }
       }
    }
    coocs.put(str, strcoocs);
 }
Example #2
0
        private void reopenConnection()
        {
            if (_connection != null)
            {
                return;
            }

            _connection = _transport.openFetch();

            // Since we opened a new connection we cannot be certain
            // that the system we connected to has the same exact set
            // of objects available (think round-robin DNS and mirrors
            // that aren't updated at the same time).
            //
            // We rebuild our askFor list using only the refs that the
            // new connection has offered to us.
            //
            IDictionary<ObjectId, Ref> avail = new Dictionary<ObjectId, Ref>();
            foreach (Ref r in _connection.Refs)
            {
                avail.put(r.getObjectId(), r);
            }

            ICollection<Ref> wants = new List<Ref>(_askFor.Values);
            _askFor.Clear();
            foreach (Ref want in wants)
            {
                Ref newRef = avail.get(want.ObjectId);
                if (newRef != null)
                {
                    _askFor.put(newRef.ObjectId, newRef);
                }
                else
                {
                    removeFetchHeadRecord(want.ObjectId);
                    removeTrackingRefUpdate(want.ObjectId);
                }
            }
        }
Example #3
0
 /**
  * Adds tuples to term.
  * @param tuple tuple
  * @param str term
  * @param termTuples list of tuples per term
  */
 private void addTuples( PointEvent<TwitterDataTerm> tuple,  String str,  Dictionary<String, ISet<PointEvent<TwitterDataTerm>>> termTuples) {
    ISet<PointEvent<TwitterDataTerm>> tuples = termTuples.get(str);
    if (tuples == null) { tuples = new HashSet<PointEvent<TwitterDataTerm>>(); }
    tuples.add(tuple);
    termTuples.put(str, tuples);
 }