Esempio n. 1
0
  /**
   * Convert a BAM file containing paried-end tags to the ascii "pair" format used for HiC.
   *
   * @param inputBam
   * @param outputFile
   * @throws IOException
   */
  public static void filterBam(String inputBam, String outputFile, List<Chromosome> chromosomes)
      throws IOException {

    CloseableIterator<Alignment> iter = null;
    AlignmentReader reader = null;
    PrintWriter pw = null;

    HashSet allChroms = new HashSet(chromosomes);

    try {
      pw = new PrintWriter(new FileWriter(outputFile));
      reader = AlignmentReaderFactory.getReader(inputBam, false);
      iter = reader.iterator();
      while (iter.hasNext()) {

        Alignment alignment = iter.next();
        ReadMate mate = alignment.getMate();

        // Filter unpaired and "normal" pairs.  Only interested in abnormals
        if (alignment.isPaired()
            && alignment.isMapped()
            && alignment.getMappingQuality() > 10
            && mate != null
            && mate.isMapped()
            && allChroms.contains(alignment.getChr())
            && allChroms.contains(mate.getChr())
            && (!alignment.getChr().equals(mate.getChr())
                || alignment.getInferredInsertSize() > 1000)) {

          // Each pair is represented twice in the file,  keep the record with the "leftmost"
          // coordinate
          if (alignment.getStart() < mate.getStart()) {
            String strand = alignment.isNegativeStrand() ? "-" : "+";
            String mateStrand = mate.isNegativeStrand() ? "-" : "+";
            pw.println(
                alignment.getReadName()
                    + "\t"
                    + alignment.getChr()
                    + "\t"
                    + alignment.getStart()
                    + "\t"
                    + strand
                    + "\t.\t"
                    + mate.getChr()
                    + "\t"
                    + mate.getStart()
                    + "\t"
                    + mateStrand);
          }
        }
      }
    } finally {
      pw.close();
      iter.close();
      reader.close();
    }
  }
Esempio n. 2
0
  public static void main(String[] args) {
    if (args.length != 1) {
      System.err.println("Usage: Generator number_of_data.");
      System.exit(-1);
    }

    Random rand = new Random();

    int numberOfObjects = new Integer(args[0]).intValue();
    HashMap data = new HashMap(numberOfObjects);

    for (int i = 0; i < numberOfObjects; i++) {
      MyRegion r =
          new MyRegion(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), rand.nextDouble());
      data.put(new Integer(i), r);

      System.out.println(
          "1 " + i + " " + r.m_xmin + " " + r.m_ymin + " " + r.m_xmax + " " + r.m_ymax);
    }

    int A = (int) (Math.floor((double) numberOfObjects * 0.1));

    for (int T = 100; T > 0; T--) {
      System.err.println(T);
      HashSet examined = new HashSet();

      for (int a = 0; a < A; a++) {
        // find an id that is not yet examined.
        Integer id = new Integer((int) ((double) numberOfObjects * rand.nextDouble()));
        boolean b = examined.contains(id);

        while (b) {
          id = new Integer((int) ((double) numberOfObjects * rand.nextDouble()));
          b = examined.contains(id);
        }
        examined.add(id);
        MyRegion r = (MyRegion) data.get(id);

        System.out.println(
            "0 " + id + " " + r.m_xmin + " " + r.m_ymin + " " + r.m_xmax + " " + r.m_ymax);

        r =
            new MyRegion(
                rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), rand.nextDouble());
        data.put(id, r);

        System.out.println(
            "1 " + id + " " + r.m_xmin + " " + r.m_ymin + " " + r.m_xmax + " " + r.m_ymax);
      }

      double stx = rand.nextDouble();
      double sty = rand.nextDouble();
      System.out.println("2 9999999 " + stx + " " + sty + " " + (stx + 0.01) + " " + (sty + 0.01));
    }
  }
 protected String makeConstraintName(String consName) throws SchemaException {
   boolean prev_constr = constraintList.contains(consName);
   if (prev_constr) { // need to find new name --
     Debugger.trace("Changing duplicate constraint name " + consName, Debugger.SHORT);
     int i = 1;
     while (constraintList.contains(consName + i)) i++;
     consName += i;
   }
   constraintList.add(consName);
   return consName;
 }
    public LinkedHashSet<Path> scan(FileSystem fs, Path filePath, Set<String> consumedFiles) {
      LinkedHashSet<Path> pathSet = Sets.newLinkedHashSet();
      try {
        LOG.debug("Scanning {} with pattern {}", filePath, this.filePatternRegexp);
        FileStatus[] files = fs.listStatus(filePath);
        for (FileStatus status : files) {
          Path path = status.getPath();
          String filePathStr = path.toString();

          if (consumedFiles.contains(filePathStr)) {
            continue;
          }

          if (ignoredFiles.contains(filePathStr)) {
            continue;
          }

          if (acceptFile(filePathStr)) {
            LOG.debug("Found {}", filePathStr);
            pathSet.add(path);
          } else {
            // don't look at it again
            ignoredFiles.add(filePathStr);
          }
        }
      } catch (FileNotFoundException e) {
        LOG.warn("Failed to list directory {}", filePath, e);
      } catch (IOException e) {
        throw new RuntimeException(e);
      }
      return pathSet;
    }
Esempio n. 5
0
  /**
   * Return top K authorities (result from SALSA), but do not include users in the removeList
   *
   * @param K
   * @param removeList
   * @return
   */
  public ArrayList<SalsaVertex> topAuthorities(int K, HashSet<Integer> removeList) {
    // TODO: faster top-K implementation
    ArrayList<SalsaVertex> all = new ArrayList<SalsaVertex>(authorities.size());
    all.addAll(authorities.values());
    Collections.sort(
        all,
        new Comparator<SalsaVertex>() {
          @Override
          public int compare(SalsaVertex salsaVertex, SalsaVertex salsaVertex1) {
            if (salsaVertex.value < salsaVertex1.value) return 1;
            else return (salsaVertex.value > salsaVertex1.value ? -1 : 0);
          }
        });

    ArrayList<SalsaVertex> result = new ArrayList<SalsaVertex>(K);
    int i = 0;
    while (result.size() < K) {
      if (i < all.size()) {
        SalsaVertex x = all.get(i);
        if (!removeList.contains(x.id)) result.add(x);
      } else {
        break;
      }
      i++;
    }
    return result;
  }
Esempio n. 6
0
  /**
   * Updates the information in the friend list about a player if that player is a friend
   *
   * @param friend The player
   */
  public static void updateFriend(final Player friend) {
    synchronized (monitor) {
      if (friends.contains(friend) == false) return;

      saveFriends();
    }
  }
Esempio n. 7
0
  public ArrayList<CellTagPair> findMarkupTags() {
    Pattern tagPattern = Pattern.compile("\\{(.+?)\\}");
    ArrayList<CellTagPair> result = new ArrayList<CellTagPair>();

    int width = getWidth();
    int height = getHeight();
    for (int y = 0; y < height; y++) {
      for (int x = 0; x < width - 3; x++) {
        Cell cell = new Cell(x, y);
        char c = get(cell);
        if (c == '{') {
          String rowPart = rows.get(y).substring(x);
          Matcher matcher = tagPattern.matcher(rowPart);
          if (matcher.find()) {
            String tagName = matcher.group(1);
            if (markupTags.contains(tagName)) {
              if (DEBUG) System.out.println("found tag " + tagName + " at " + x + ", " + y);
              result.add(new CellTagPair(new Cell(x, y), tagName));
            }
          }
        }
      }
    }
    return result;
  }
Esempio n. 8
0
  static void runTest(HashSet<Integer> caseSet) {
    int cases = 0, passed = 0;
    while (true) {
      String label = Reader.nextLine();
      if (label == null || !label.startsWith("--")) break;

      int N = Integer.parseInt(Reader.nextLine());
      Reader.nextLine();
      double __answer = Double.parseDouble(Reader.nextLine());

      cases++;
      if (caseSet.size() > 0 && !caseSet.contains(cases - 1)) continue;
      System.err.print(String.format("  Testcase #%d ... ", cases - 1));

      if (doTest(N, __answer)) passed++;
    }
    if (caseSet.size() > 0) cases = caseSet.size();
    System.err.println(String.format("%nPassed : %d/%d cases", passed, cases));

    int T = (int) (System.currentTimeMillis() / 1000) - 1398529188;
    double PT = T / 60.0, TT = 75.0;
    System.err.println(
        String.format(
            "Time   : %d minutes %d secs%nScore  : %.2f points",
            T / 60, T % 60, 950 * (0.3 + (0.7 * TT * TT) / (10.0 * PT * PT + TT * TT))));
  }
  public static void main(String args[]) throws Exception {
    HashSet<String> hs = new HashSet<String>();

    FileReader fr1 = new FileReader("sample.txt");
    BufferedReader br = new BufferedReader(fr1);
    String s;
    while ((s = br.readLine()) != null) {
      hs.add(s);
    }
    fr1.close();
    FileReader fr2 = new FileReader("input.txt");
    br = new BufferedReader(fr2);
    while ((s = br.readLine()) != null) {

      Scanner ip = new Scanner(s);

      String word;
      while (ip.hasNext()) {
        word = ip.next();
        if (hs.contains(word)) ;
        else System.out.print(word + " ");
      }
    }
    fr2.close();
  }
Esempio n. 10
0
    public static void printViewPatterns() {
      processedViewsForPatterns = new HashSet<ViewTrace>();
      HashMap<String, Integer> viewPatterns = new HashMap<String, Integer>();

      ps.println("ViewPatterns ------------------- \n");
      for (ViewTrace trace : viewsRegistry) {
        if (processedViewsForPatterns.contains(trace)) {
          continue;
        }
        ViewTrace v = trace.getRootView();
        StringBuilder p = new StringBuilder();
        p.append("PATTERN ");
        extractViewPattern(0, v, p);
        p.append("\n");
        String pattern = p.toString();
        Integer count = viewPatterns.get(pattern);
        if (count == null) {
          viewPatterns.put(pattern, 1);
        } else {
          viewPatterns.put(pattern, count + 1);
        }
      }
      processedViewsForPatterns = null;
      for (Map.Entry<String, Integer> e : viewPatterns.entrySet()) {
        ps.print("(" + e.getValue() + ") ");
        ps.println(e.getKey());
      }
    }
  protected void writeAttributes(DOMOutput out) throws IOException {
    Figure prototype = (Figure) out.getPrototype();

    boolean isElementOpen = false;
    for (Map.Entry<AttributeKey, Object> entry : attributes.entrySet()) {
      AttributeKey key = entry.getKey();
      if (forbiddenAttributes == null || !forbiddenAttributes.contains(key)) {
        Object prototypeValue = key.get(prototype);
        Object attributeValue = key.get(this);
        if (prototypeValue != attributeValue
            || (prototypeValue != null
                && attributeValue != null
                && !prototypeValue.equals(attributeValue))) {
          if (!isElementOpen) {
            out.openElement("a");
            isElementOpen = true;
          }
          out.openElement(key.getKey());
          out.writeObject(entry.getValue());
          out.closeElement();
        }
      }
    }
    if (isElementOpen) {
      out.closeElement();
    }
  }
  public void init() {
    Scanner scan = new Scanner(System.in);
    n = scan.nextInt();
    m = scan.nextInt();
    for (int i = 0; i < n; i++) {
      String input = scan.next();
      record.add(input);
    }

    for (int i = 0; i < m; i++) {
      String input = scan.next();
      char[] charArray = input.toCharArray();
      boolean isValid = false;
      for (int j = 0; j < charArray.length; j++) {
        char c = charArray[j];
        for (char d = 'a'; d <= 'c'; d = (char) (d + 1)) {
          if (d == c) continue;
          charArray[j] = d;
          if (record.contains(new String(charArray))) {
            isValid = true;
            break;
          }
        }
        charArray[j] = c;
        if (isValid) break;
      }
      if (isValid) System.out.println("YES");
      else System.out.println("NO");
    }
    scan.close();
  }
Esempio n. 13
0
    public static void printSite(Site s, StringBuilder out) {
      if (s == null) {
        out.append("(null)");
        return;
      }
      StackTraceElement[] st = s.site();

      int interestingSitesPrinted = 0;
      for (int i = s.offset; i < st.length; i++) {
        StackTraceElement e = st[i];
        String fileName = e.getFileName();
        if (THIS_FILE_NAME.equals(fileName)) {
          continue;
        }
        out.append(" " + e.getMethodName() + "(" + e.getFileName() + ":" + e.getLineNumber() + ")");
        interestingSitesPrinted++;
        if (interestingSitesPrinted <= SITES_TO_PRINT) {
          continue;
        }
        if (fileName == null || "View.java".equals(fileName)) {
          continue;
        }
        String methodName = e.getMethodName();
        if (skipMethods.contains(methodName)) {
          continue;
        }
        break;
      }
    }
Esempio n. 14
0
  /**
   * Chooses tokens from the file cache that match the specified pattern.
   *
   * @param pattern file pattern
   * @param search search string
   * @param mode search mode (0-2)
   * @param results search result
   * @param exclude exclude file from content search
   * @param pathSearch path flag
   * @param pc file cache
   * @param id search id
   * @throws InterruptedException interruption
   */
  private void filter(
      final String pattern,
      final int[] search,
      final int mode,
      final TreeSet<String> results,
      final HashSet<String> exclude,
      final boolean pathSearch,
      final ProjectCache pc,
      final long id)
      throws InterruptedException {

    if (results.size() >= MAXHITS) return;

    for (final String path : pc) {
      // check if current file matches the pattern
      final String lc = path.toLowerCase(Locale.ENGLISH).replace('\\', '/');
      final int offset = offset(lc, pathSearch);
      if (mode == 0
          ? lc.startsWith(pattern, offset)
          : mode == 1 ? (lc.indexOf(pattern, offset) != -1) : matches(lc, pattern, offset)) {
        if (!exclude.contains(path)) {
          exclude.add(path);
          if (filterContent(path, search)) {
            results.add(path);
            if (results.size() >= MAXHITS) return;
          }
        }
      }
      if (id != filterId) throw new InterruptedException();
    }
  }
Esempio n. 15
0
 static Method[] getOverridableMethods(Class c) {
   ArrayList<Method> list = new ArrayList<Method>();
   HashSet<String> skip = new HashSet<String>();
   while (c != null) {
     Method[] methods = c.getDeclaredMethods();
     for (int i = 0; i < methods.length; i++) {
       String methodKey =
           methods[i].getName() + getMethodSignature(methods[i], methods[i].getParameterTypes());
       if (skip.contains(methodKey)) continue; // skip this method
       int mods = methods[i].getModifiers();
       if (Modifier.isStatic(mods)) continue;
       if (Modifier.isFinal(mods)) {
         // Make sure we don't add a final method to the list
         // of overridable methods.
         skip.add(methodKey);
         continue;
       }
       if (Modifier.isPublic(mods) || Modifier.isProtected(mods)) {
         list.add(methods[i]);
         skip.add(methodKey);
       }
     }
     c = c.getSuperclass();
   }
   return list.toArray(new Method[list.size()]);
 }
Esempio n. 16
0
 /**
  * Overwrite this method if you want to filter the input, apply hashing, etc.
  *
  * @param feature the current feature.
  * @param document the current document.
  * @param featureFieldName the field hashFunctionsFileName of the feature.
  */
 protected void addToDocument(LireFeature feature, Document document, String featureFieldName) {
   if (run == 0) {
   } // just count documents
   else if (run == 1) { // Select the representatives ...
     if (representativesID.contains(docCount)
         && feature
             .getClass()
             .getCanonicalName()
             .equals(featureClass.getCanonicalName())) { // it's a representative.
       // put it into a temporary data structure ...
       representatives.add(feature);
     }
   } else if (run
       == 2) { // actual hashing: find the nearest representatives and put those as a hash into a
     // document.
     if (feature
         .getClass()
         .getCanonicalName()
         .equals(featureClass.getCanonicalName())) { // it's a feature to be hashed
       int[] hashes = getHashes(feature);
       document.add(
           new TextField(
               featureFieldName + "_hash",
               createDocumentString(hashes, hashes.length),
               Field.Store.YES));
       document.add(
           new TextField(
               featureFieldName + "_hash_q", createDocumentString(hashes, 10), Field.Store.YES));
     }
     document.add(new StoredField(featureFieldName, feature.getByteArrayRepresentation()));
   }
 }
Esempio n. 17
0
  /**
   * Adds a player to the friend list
   *
   * @param friend The player
   */
  public static void addFriend(final Player friend) {
    synchronized (monitor) {
      if (friends.contains(friend)) return;

      friends.add(friend);
      saveFriends();
    }
  }
Esempio n. 18
0
 public static void main(String[] args) {
   StringKeyLinkedMap<Object> defMap = ConfigValueUtil.getConfigDefault(new Configure(true));
   StringEnumer enu = defMap.keys();
   while (enu.hasMoreElements()) {
     String key = enu.nextString();
     if (ignoreSet.contains(key)) continue;
     System.out.println(key + " : " + ConfigValueUtil.toValue(defMap.get(key)));
   }
 }
  //
  // Returns true if this method is allowed to raise SQLFeatureNotSupportedException.
  //
  private boolean isExcludable(Method method) throws Exception {
    Class iface = method.getDeclaringClass();
    HashSet<Method> excludableMethods = excludableMap.get(iface);

    if (excludableMethods == null) {
      return false;
    }

    return excludableMethods.contains(method);
  }
Esempio n. 20
0
  /**
   * Garbage collect repository
   *
   * @throws Exception
   */
  public void gc() throws Exception {
    HashSet<byte[]> deps = new HashSet<byte[]>();

    // deps.add(SERVICE_JAR_FILE);

    for (File cmd : commandDir.listFiles()) {
      CommandData data = getData(CommandData.class, cmd);
      addDependencies(deps, data);
    }

    for (File service : serviceDir.listFiles()) {
      File dataFile = new File(service, "data");
      ServiceData data = getData(ServiceData.class, dataFile);
      addDependencies(deps, data);
    }

    int count = 0;
    for (File f : repoDir.listFiles()) {
      String name = f.getName();
      if (!deps.contains(name)) {
        if (!name.endsWith(".json")
            || !deps.contains(name.substring(0, name.length() - ".json".length()))) { // Remove
          // json
          // files
          // only
          // if
          // the
          // bin
          // is
          // going
          // as
          // well
          f.delete();
          count++;
        } else {

        }
      }
    }
    System.out.format("Garbage collection done (%d file(s) removed)%n", count);
  }
Esempio n. 21
0
  // Returns true iff all items in subset are in superset, treating null and
  // empty collections as
  // the same.
  public static <T> boolean isSubset(Collection<T> subset, Collection<T> superset) {
    if ((superset == null) || (superset.size() == 0)) {
      return ((subset == null) || (subset.size() == 0));
    }

    HashSet<T> hash = new HashSet<T>(superset);
    for (T t : subset) {
      if (!hash.contains(t)) {
        return false;
      }
    }
    return true;
  }
Esempio n. 22
0
 public boolean hashSetContainsSameOperations(HashSet set1, HashSet set2) {
   boolean result = false;
   HashSet s1 = (HashSet) set1.clone();
   HashSet s2 = (HashSet) set2.clone();
   // first part, are all elements of s1 also in s2?
   boolean one = false;
   Iterator it = set1.iterator();
   while (it.hasNext()) {
     PDMOperation d = (PDMOperation) it.next();
     if (s2.contains(d)) {
       s1.remove(d);
     }
   }
   if (s1.isEmpty()) {
     one = true;
   }
   // second part, are all elements of s21 also in s1?
   boolean two = false;
   HashSet s3 = (HashSet) set1.clone();
   HashSet s4 = (HashSet) set2.clone();
   Iterator it2 = set2.iterator();
   while (it2.hasNext()) {
     PDMOperation d = (PDMOperation) it2.next();
     if (s3.contains(d)) {
       s4.remove(d);
     }
   }
   if (s4.isEmpty()) {
     two = true;
   }
   // administrative stuff
   s1.clear();
   s2.clear();
   s3.clear();
   s4.clear();
   result = one && two;
   return result;
 }
Esempio n. 23
0
 public static void printIndividualViews() {
   printedIndividualViews = new HashSet<ViewTrace>();
   ps.println("Individual views statistics ------------------- \n");
   for (ViewTrace trace : viewsRegistry) {
     if (printedIndividualViews.contains(trace)) {
       continue;
     }
     ViewTrace v = trace.getRootView();
     ps.print("ROOT ");
     dumpView(0, v);
     ps.println();
   }
   printViewPatterns();
   printedIndividualViews = null;
 }
Esempio n. 24
0
 Schema computeAvroSchema() {
   HashSet<String> observedSchemas = new HashSet<String>();
   List<Schema> fields = new ArrayList<Schema>();
   for (InferredType it : unionTypes) {
     Schema itS = it.getAvroSchema();
     if (itS == null) {
       continue;
     }
     String schemaDesc = itS.toString();
     if (!observedSchemas.contains(schemaDesc)) {
       observedSchemas.add(schemaDesc);
       fields.add(it.getAvroSchema());
     }
   }
   return Schema.createUnion(fields);
 }
  /*
   * returns # of valid words given message and dictionary against which to check words in
   * the message.  Lowercases the word before checking in dictionary
   */
  public int countWords(String message, HashSet<String> dictionary) {

    int validWords = 0;
    int totalWords = 0;
    // split the message into words

    for (String word : message.split("\\W")) {
      totalWords++;
      word = word.toLowerCase();
      if (dictionary.contains(word)) {
        validWords++;
      }
    }
    System.out.println("total words: " + totalWords + " valid words: " + validWords);
    return validWords;
  }
Esempio n. 26
0
  synchronized void updateAll() {
    HashSet<Node> seenNodes = new HashSet<Node>();
    for (int i = 0; i < _all.size(); i++) {
      Node n = _all.get(i);
      n.update(seenNodes);
    }

    if (!seenNodes.isEmpty()) {
      // not empty, means that at least 1 server gave node list
      // remove unused hosts
      Iterator<Node> it = _all.iterator();
      while (it.hasNext()) {
        if (!seenNodes.contains(it.next())) it.remove();
      }
    }
  }
Esempio n. 27
0
  public int count(int[] seq, int bound) {
    HashSet<String> set = new HashSet<String>();
    HashSet<Integer> nums = new HashSet<Integer>();

    int n = seq.length;

    for (int i = 0; i < n; i++) {
      nums.add(seq[i]);
    }

    int t = nums.size();
    int total = 0;

    nums.add(-1);

    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        for (int x : nums) {
          int seq2[] = seq.clone();

          if (i < j) {
            for (int k = i + 1; k < j + 1; k++) {
              seq2[k - 1] = seq2[k];
            }
          } else if (i > j) {
            for (int k = i; k > j; k--) {
              seq2[k] = seq2[k - 1];
            }
          }
          seq2[j] = x;

          String key = Arrays.toString(seq2);
          if (!set.contains(key)) {
            if (x == -1) {
              total += bound - t;
            } else {
              total++;
            }
            total %= MOD;
            set.add(key);
          }
        }
      }
    }

    return total;
  }
Esempio n. 28
0
 public MapValue getKeyValueInfo() {
   StringKeyLinkedMap<Object> defMap = ConfigValueUtil.getConfigDefault(new Configure(true));
   StringKeyLinkedMap<Object> curMap = ConfigValueUtil.getConfigDefault(this);
   MapValue m = new MapValue();
   ListValue nameList = m.newList("key");
   ListValue valueList = m.newList("value");
   ListValue defList = m.newList("default");
   StringEnumer enu = defMap.keys();
   while (enu.hasMoreElements()) {
     String key = enu.nextString();
     if (ignoreSet.contains(key)) continue;
     nameList.add(key);
     valueList.add(ConfigValueUtil.toValue(curMap.get(key)));
     defList.add(ConfigValueUtil.toValue(defMap.get(key)));
   }
   return m;
 }
Esempio n. 29
0
 void solve() throws IOException {
   int[] gr = new int[5001];
   for (int i = 1; i < 5001; i++) {
     HashSet<Integer> s = new HashSet<Integer>();
     for (int j = 1; j + j <= i; j++) {
       s.add(gr[i - j]);
     }
     for (int t = 0; t <= s.size(); t++) {
       if (!s.contains(t)) {
         gr[i] = t;
         break;
       }
     }
   }
   /*for (int i = 0;i < 1000; i++) {
   	out.println(i + " " + gr[i]);
   }*/
   int a = nextInt();
   int b = nextInt();
   int c = nextInt();
   int ans = gr[a] ^ gr[b] ^ gr[c];
   if (ans == 0) {
     out.println("NO");
   } else {
     out.println("YES");
     for (int i = 1; i + i <= a; i++) {
       if ((gr[a - i] ^ gr[b] ^ gr[c]) == 0) {
         out.println((a - i) + " " + b + " " + c);
         return;
       }
     }
     for (int i = 1; i + i <= b; i++) {
       if ((gr[a] ^ gr[b - i] ^ gr[c]) == 0) {
         out.println(a + " " + (b - i) + " " + c);
         return;
       }
     }
     for (int i = 1; i + i <= c; i++) {
       if ((gr[a] ^ gr[b] ^ gr[c - i]) == 0) {
         out.println(a + " " + b + " " + (c - i));
         return;
       }
     }
   }
 }
 @SuppressWarnings("unchecked")
 protected void readAttributes(DOMInput in) throws IOException {
   if (in.getElementCount("a") > 0) {
     in.openElement("a");
     for (int i = in.getElementCount() - 1; i >= 0; i--) {
       in.openElement(i);
       String name = in.getTagName();
       Object value = in.readObject();
       AttributeKey key = getAttributeKey(name);
       if (key != null && key.isAssignable(value)) {
         if (forbiddenAttributes == null || !forbiddenAttributes.contains(key)) {
           setAttribute(key, value);
         }
       }
       in.closeElement();
     }
     in.closeElement();
   }
 }