gt:                 if (!qWords.contains(tempWord)) {
context: package focusedCrawler.query;
  
  import java.io.BufferedReader;
  import java.io.FileInputStream;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.ObjectInputStream;
  import java.io.StringReader;
  import java.net.HttpURLConnection;
  import java.net.MalformedURLException;
  import java.net.URL;
  import java.net.URLConnection;
  import java.util.Vector;
  import java.util.HashMap;
  import java.util.HashSet;
  
  import org.apache.commons.codec.binary.Base64;
  import org.apache.xerces.parsers.DOMParser;
  import org.w3c.dom.NamedNodeMap;
  import org.w3c.dom.Node;
  import org.w3c.dom.Document;
  import org.w3c.dom.NodeList;
  import org.xml.sax.InputSource;
  import org.xml.sax.SAXException;
  
  
  import weka.classifiers.Classifier;
  import weka.core.Instances;
  
  
  import focusedCrawler.util.Page;
  import focusedCrawler.util.ParameterFile;
  import focusedCrawler.util.parser.PaginaURL;
  import focusedCrawler.util.string.PorterStemmer;
  import focusedCrawler.util.string.StopList;
  import focusedCrawler.util.string.StopListArquivo;
  import focusedCrawler.target.TargetClassifier;
  import focusedCrawler.target.TargetClassifierException;
  import focusedCrawler.target.TargetClassifierImpl;
  import focusedCrawler.util.vsm.VSMVector;
  import focusedCrawler.util.vsm.VSMElement;
  
  public class RelevanceFeedback {
  
      private String appID = "87E3D4B83FBB733A778CCB8CF950FF62BD6243FC";
  
      private String urlQuery = "http://api.bing.net/xml.aspx?AppId=87E3D4B83FBB733A778CCB8CF950FF62BD6243FC&Version=2.2&Market=en-US&Sources=web+spell&web.count=50&xmltype=attributebased&Query=";
  
  
      private int connectTimeout = 5000;
      private int readTimeout = 5000;
      private int iterations = 20;
      private StopList stoplist = null;
      private TargetClassifier classifier;
      private int total = 0;
      private VSMVector positive = new VSMVector();
      private VSMVector negative = new VSMVector();
  
  //	private HashMap<String,Integer> urlCode = new HashMap<String, Integer>();
  
      private Vector<HashSet<String>> usedQueries = new Vector<HashSet<String>>();
      private HashSet<String> usedURLs = new HashSet<String>();
  
      //	private InvertedIndex invIndex = new InvertedIndex();
      public RelevanceFeedback() {
  
      }
  
  
      public RelevanceFeedback(StopList stoplist, TargetClassifier classifier) throws MalformedURLException, IOException, SAXException {
          this.stoplist = stoplist;
          this.classifier = classifier;
      }
  
      public void execute(String initialQuery) throws MalformedURLException, IOException, SAXException, TargetClassifierException {
          Page page = downloadResults(initialQuery);
  //		System.out.println("Page:" + page.getContent());
          HashSet<String> temp = new HashSet<String>();
          PorterStemmer stem = new PorterStemmer();
          String[] queryWords = initialQuery.split("\\+");
          for (int j = 0; j < queryWords.length; j++) {
              temp.add(queryWords[j].trim());
              usedTerms.add(stem.stem(queryWords[j].trim()));
          }
          String currentQuery = initialQuery;
          usedQueries.add(temp);
          previousQuery = initialQuery;
          for (int i = 0; i < iterations; i++) {
              int count = 0;
              System.out.println("Iteration:" + i);
              String[] urls = parseXMLPage(page);
              int newPages = 0;
              Vector<Page> tempPages = new Vector<Page>();
              VSMVector positiveTemp = new VSMVector();
              VSMVector negativeTemp = new VSMVector();
              for (int j = 0; j < urls.length; j++) {
                  if (!usedURLs.contains(urls[j]) && !urls[j].endsWith("pdf") && !urls[j].endsWith("pps")) {
                      newPages++;
  //					System.out.println("URL:" + urls[j]);
                      page = downloadPage(new URL(urls[j]));
  
                      if (page != null) {
                          boolean relevant = classifier.classify(page);
                          if (relevant) {
                              System.out.println(getClass().getName());
                              tempPages.add(page);
                              VSMVector positiveTemp1 = new VSMVector(page.getContent(), stoplist, false);
                              positiveTemp1.normalize();
                              positiveTemp.addVector(positiveTemp1);
                              count++;
                          } else {
  //							System.out.println("NonRelevant:" + urls[j]);
                              VSMVector negativeTemp1 = new VSMVector(page.getContent(), stoplist, false);
                              negativeTemp1.normalize();
                              negativeTemp.addVector(negativeTemp1);
                          }
                      }
                      usedURLs.add(urls[j]);
                  }
              }
              Page[] pages = new Page[tempPages.size()];
              tempPages.toArray(pages);
              total = total + count;
              double currentPrecision = (double) count / (double) newPages;
              currentQuery = nextQuery(currentPrecision, newPages, currentQuery, positiveTemp, negativeTemp);
              System.out.println("PREICSION:" + currentPrecision);
              System.out.println("NEW PAGES:" + newPages);
              System.out.println("NEXT QUERY:" + currentQuery);
              page = downloadResults(currentQuery);
          }
          System.out.println("TOTAL RELEVANT:" + total);
      }
  
      private int previousQuerySize = 2;
  
      private String previousQuery = "";
  
      private int pointer = 1;
  
      private HashSet<String> usedTerms = new HashSet<String>();
  
      private int offsetCounter = 1;
  
      private String nextQuery(double currentPrecision, int currentUnique, String currentQuery, VSMVector pos, VSMVector neg) {
          String offset = "&$skip=50";
          PorterStemmer stem = new PorterStemmer();
          boolean changeQuery = false;
          if (currentPrecision > 0.5) {
              positive.addVector(pos);
              negative.addVector(neg);
          } else {
              changeQuery = true;
          }
          if (currentUnique <= 0.5) {
              changeQuery = true;
          }
          double proportionUnique = (double) currentUnique / (double) 50;
          if (proportionUnique <= 0.5) {
              changeQuery = true;
          }
          if (!changeQuery && (offsetCounter / 50) + 1 <= 6) {
              int index = currentQuery.indexOf(offset);
              if (index != -1) {
                  previousQuery = currentQuery.substring(0, currentQuery.indexOf(offset));
              } else {
                  previousQuery = currentQuery;
              }
  
              offsetCounter = offsetCounter + 50;
              return previousQuery + offset + offsetCounter;
          }
          offsetCounter = 1;
          int index = currentQuery.indexOf(offset);
          String tempQuery = "";
          if (index != -1) {
              tempQuery = currentQuery.substring(0, currentQuery.indexOf(offset));
          } else {
              tempQuery = currentQuery;
          }
          String[] currentQueryWords = tempQuery.split("\\+");
          for (int i = 0; i < currentQueryWords.length; i++) {
              VSMElement elem = positive.getElement(currentQueryWords[i]);
              elem.setWeight(currentPrecision * elem.getWeight());
              positive.addElement(elem);
          }
          VSMVector tempPos = new VSMVector();
          tempPos.addVector(positive);
  //		tempPos.normalize();
  //		System.out.println(invIndex.toString());
          VSMVector tempNeg = new VSMVector();
          tempNeg.addVector(negative);
  //		tempNeg.normalize();
          tempNeg.negativeVector();
          tempPos.addVector(tempNeg);
          String queryTemp = null;
          VSMElement[] elems = tempPos.topElements(tempPos.getArrayElements().length);
          for (int i = 0; i < elems.length && i < 10; i++) {
              System.out.print(elems[i].getWord() + " ");
          }
          System.out.println("");
          int querySize = previousQuerySize;
  
          HashSet<String> qWords = new HashSet<String>();
          if (currentPrecision <= 0.5) {
              querySize++;
          } else {
              if (currentUnique <= 0.5) {
                  querySize--;
              }
          }
  
          int usedTermsSize = usedTerms.size();
          if (queryTemp == null) {
              queryTemp = elems[0].getWord();
              String tempWord = stem.stem(elems[0].getWord());
              if (!usedTerms.contains(tempWord)) {
                  usedTerms.add(tempWord);
              }
              if (!qWords.contains(tempWord)) {
                  qWords.add(tempWord);
              }
              for (int i = pointer, step = 1; step < querySize - 1; i++, step++) {
                  tempWord = stem.stem(elems[i].getWord());
                  if (!usedTerms.contains(tempWord)) {
                      usedTerms.add(tempWord);
                  }
  