public void addPeer(Peer newPeer)
        {
            RRLib.SortedList peers;

            foreach (InformationEntropy IE in newPeer.IE)
            {
                peers = (RRLib.SortedList)contentIndex.getInvertedList(IE.keyword);
                if (peers == null)
                {
                    peers = new RRLib.SortedList();
                    contentIndex.add(IE.keyword, peers);
                }

                peers.Add(new WeightedPeer(IE.weight, newPeer));
            }
        }
        public void addResources(Resource[] resources)
        {
            QueryProcessor queryProcessor = QueryProcessor.getInstance();
            float partialWeight;  /*
                                   * This is partial because only after all resources have been inserted we can update the
                                   * second part of the weight formula N/dfk
                                   */
            try
            {
                foreach (Resource resource in resources)
                {
                    foreach (InformationEntropy IE in resource.IE)
                    {
                        string keyword = IE.keyword;

                        //note that IE.weight contains the frequency of keyword in resource (FDk)
                        partialWeight = IE.weight/resource.IE.Length;
                        RRLib.SortedList invertedList = (RRLib.SortedList)resourcesIndex.getInvertedList(keyword);
                        if (invertedList == null)
                        {
                            invertedList = new RRLib.SortedList();
                            resourcesIndex.add(keyword, invertedList);
                        }

                        invertedList.Add(new ResourceDescriptor(resource, partialWeight,
                            (uint)(partialWeight*resource.IE.Length), (uint)resource.IE.Length));
                    }
                    updateUI(1);
                }
            }
            catch (Exception e)
            {
                int x = 2;
            }
        }