예제 #1
1
 /*
  * public HashMap getLeafElements() { HashMap map = new HashMap(); Object[]
  * elts = dataElements.values().toArray(); for (int j=0; j<elts.length; j++)
  * { PDMDataElement data = (PDMDataElement) elts[j];
  * map.put(data.getID(),data); } Object[] ops =
  * operations.values().toArray(); for (int i=0; i<ops.length; i++){
  * PDMOperation op = (PDMOperation) ops[i]; if
  * (!(op.getInputElements().isEmpty())){ HashMap outs =
  * op.getOutputElements(); Object[] outArray = outs.values().toArray(); for
  * (int j=0; j<outArray.length; j++) { PDMDataElement d = (PDMDataElement)
  * outArray[j]; map.remove(d.getID()); } } } return map; }
  */
 public HashMap getLeafElements() {
   HashMap result = new HashMap();
   HashSet leafOps = getLeafOperations();
   if (!(leafOps.isEmpty())) {
     Iterator it = leafOps.iterator();
     while (it.hasNext()) {
       PDMOperation op = (PDMOperation) it.next();
       PDMDataElement data = op.getOutputElement();
       result.put(data.getID(), data);
     }
   } else {
     Object[] elts = dataElements.values().toArray();
     for (int j = 0; j < elts.length; j++) {
       PDMDataElement data = (PDMDataElement) elts[j];
       result.put(data.getID(), data);
     }
     Object[] ops = operations.values().toArray();
     for (int i = 0; i < ops.length; i++) {
       PDMOperation op = (PDMOperation) ops[i];
       HashMap outs = op.getOutputElements();
       Object[] outArray = outs.values().toArray();
       for (int j = 0; j < outArray.length; j++) {
         PDMDataElement d = (PDMDataElement) outArray[j];
         result.remove(d.getID());
       }
     }
   }
   return result;
 }
예제 #2
1
  public int count(int b1, int q1, int n1, int b2, int q2, int n2) {
    if (b2 == 0 || q2 <= 1) {
      int tb = b1;
      int tq = q1;
      int tn = n1;
      b1 = b2;
      q1 = q2;
      n1 = n2;
      b2 = tb;
      q2 = tq;
      n2 = tn;
    }

    if (b1 == 0 || q1 <= 1) {
      HashSet<Integer> set = new HashSet<Integer>();
      set.add(b1);
      if (n1 > 1) {
        set.add(b1 * q1);
      }

      long curr = b2;
      for (int i = 0; i < n2; i++) {
        set.add((int) curr);
        curr *= q2;
        if (curr > 500000000) {
          return (n2 - i - 1) + set.size();
        }
      }

      return set.size();
    } else {
      HashSet<String> set = new HashSet<String>();

      int factors[] = findFactors(b1, q1, b2, q2);
      int repb1[] = decompose(b1, factors);
      int repb2[] = decompose(b2, factors);
      int repq1[] = decompose(q1, factors);
      int repq2[] = decompose(q2, factors);

      for (int i = 0; i < n1; i++) {
        set.add(Arrays.toString(repb1));
        for (int j = 0; j < repb1.length; j++) {
          repb1[j] += repq1[j];
        }
      }

      for (int i = 0; i < n2; i++) {
        set.add(Arrays.toString(repb2));
        for (int j = 0; j < repb2.length; j++) {
          repb2[j] += repq2[j];
        }
      }

      return set.size();
    }
  }
예제 #3
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()]);
 }
예제 #4
0
  public PDMState checkIfStateExists(
      PDMStateSpace statespace, HashSet data, HashSet exec, HashSet failed) {
    PDMState result = null;
    boolean bool = false;
    HashSet states = statespace.getStates();
    Iterator it = states.iterator();
    while (it.hasNext() && !bool) {
      PDMState state2 = (PDMState) it.next();
      boolean one = false;
      boolean two = false;
      boolean three = false;
      HashSet data2 = state2.dataElements;
      HashSet exec2 = state2.executedOperations;
      HashSet failed2 = state2.failedOperations;
      one = hashSetContainsSameDataElements(data, data2);
      two = hashSetContainsSameOperations(exec, exec2);
      three = hashSetContainsSameOperations(failed, failed2);

      if (one && two && three) {
        bool = true;
        result = state2;
      }
    }
    return result;
  }
예제 #5
0
  public static int close() {
    int count = 0;

    Iterator iterator = m_notUsedConnection.iterator();
    while (iterator.hasNext()) {
      try {
        ((ConnectionWrapper) iterator.next()).close();
        count++;
      } catch (Exception e) {
      }
    }
    m_notUsedConnection.clear();

    iterator = m_usedUsedConnection.iterator();
    while (iterator.hasNext()) {
      try {
        ConnectionWrapper wrapper = (ConnectionWrapper) iterator.next();
        wrapper.close();
        if (DEBUG) {
          wrapper.debugInfo.printStackTrace();
        }
        count++;
      } catch (Exception e) {
      }
    }
    m_usedUsedConnection.clear();

    return count;
  }
예제 #6
0
  public static void main(String[] args) throws IOException {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(new OutputStreamWriter(System.out));
    // br = new BufferedReader(new FileReader("in.txt"));
    // out = new PrintWriter(new FileWriter("out.txt"));

    TreeMap<Character, TreeSet<Integer>> tm = new TreeMap<Character, TreeSet<Integer>>();

    N = readInt();
    HashSet<Character> open = new HashSet<Character>();

    for (int i = 0; i < N; i++) {
      String next = readLine();
      if (next.charAt(0) == '^') {
        open.add(next.charAt(1));
        if (tm.get(next.charAt(1)) == null) tm.put(next.charAt(1), new TreeSet<Integer>());
      } else if (next.charAt(0) == '/') {
        open.remove(next.charAt(1));
      } else {
        int val = Integer.parseInt(next);
        for (Character c : open) {
          tm.get(c).add(val);
        }
      }
    }

    for (Map.Entry<Character, TreeSet<Integer>> e : tm.entrySet()) {
      out.print(e.getKey() + " ");
      for (Integer i : e.getValue()) out.print(i + " ");
      out.println();
    }
    out.close();
  }
예제 #7
0
  public static Set<RepairedCell> getUnfound(Set<RepairedCell> truth, Set<RepairedCell> found) {
    Set<RepairedCell> rst = new HashSet<RepairedCell>();
    if (found.size() != 0) {
      HashMap<Integer, HashSet<String>> foundMap = new HashMap<Integer, HashSet<String>>();

      for (RepairedCell cell : found) {
        HashSet<String> columnIds = null;
        if (foundMap.get(cell.getRowId()) == null) {
          columnIds = new HashSet<String>();
        } else {
          columnIds = foundMap.get(cell.getRowId());
        }
        columnIds.add(cell.getColumnId());
        foundMap.put(cell.getRowId(), columnIds);
      }

      for (RepairedCell cell : truth) {
        if (foundMap.get(cell.getRowId()) == null
            || !foundMap.get(cell.getRowId()).contains(cell.getColumnId())) {
          rst.add(cell);
        }
      }
    }
    return rst;
  }
    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;
    }
예제 #9
0
 public static <T> HashSet<T> hashSet(T... ts) {
   HashSet<T> hashSet = new HashSet<T>(ts.length);
   for (T t : ts) {
     hashSet.add(t);
   }
   return hashSet;
 }
예제 #10
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))));
  }
예제 #11
0
파일: Friends.java 프로젝트: maandree/cnt
 /**
  * Returns the list of friends
  *
  * @return The list of friends
  */
 public static Player[] getFriends() {
   synchronized (monitor) {
     final Player[] rc = new Player[friends.size()];
     friends.toArray(rc);
     return rc;
   }
 }
예제 #12
0
  public static void main(String[] args) throws IOException {
    input.init(System.in);
    PrintWriter out = new PrintWriter(System.out);

    int n = input.nextInt(), k = input.nextInt();
    int[] data = new int[n];
    for (int i = 0; i < n; i++) data[i] = input.nextInt();
    int res = 0;
    for (int i = 0; i < k; i++) {
      HashSet<Integer> set = new HashSet<Integer>();
      for (int j = i; j < n; j += k) set.add(data[j]);
      int max = 1;
      for (int x : set) {
        int count = 0;
        for (int j = i; j < n; j += k) {
          if (data[j] == x) count++;
        }
        max = Math.max(max, count);
      }
      res += (n / k) - max;
    }
    out.println(res);

    out.close();
  }
  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();
  }
예제 #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();
    }
  }
예제 #15
0
  /**
   * Returns a Set of Strings containing the names of all available algorithms or types for the
   * specified Java cryptographic service (e.g., Signature, MessageDigest, Cipher, Mac, KeyStore).
   * Returns an empty Set if there is no provider that supports the specified service or if
   * serviceName is null. For a complete list of Java cryptographic services, please see the <a
   * href="../../../guide/security/CryptoSpec.html">Java Cryptography Architecture API Specification
   * &amp; Reference</a>. Note: the returned set is immutable.
   *
   * @param serviceName the name of the Java cryptographic service (e.g., Signature, MessageDigest,
   *     Cipher, Mac, KeyStore). Note: this parameter is case-insensitive.
   * @return a Set of Strings containing the names of all available algorithms or types for the
   *     specified Java cryptographic service or an empty set if no provider supports the specified
   *     service.
   * @since 1.4
   */
  public static Set<String> getAlgorithms(String serviceName) {

    if ((serviceName == null) || (serviceName.length() == 0) || (serviceName.endsWith("."))) {
      return Collections.EMPTY_SET;
    }

    HashSet result = new HashSet();
    Provider[] providers = Security.getProviders();

    for (int i = 0; i < providers.length; i++) {
      // Check the keys for each provider.
      for (Enumeration e = providers[i].keys(); e.hasMoreElements(); ) {
        String currentKey = ((String) e.nextElement()).toUpperCase();
        if (currentKey.startsWith(serviceName.toUpperCase())) {
          // We should skip the currentKey if it contains a
          // whitespace. The reason is: such an entry in the
          // provider property contains attributes for the
          // implementation of an algorithm. We are only interested
          // in entries which lead to the implementation
          // classes.
          if (currentKey.indexOf(" ") < 0) {
            result.add(currentKey.substring(serviceName.length() + 1));
          }
        }
      }
    }
    return Collections.unmodifiableSet(result);
  }
  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();
  }
예제 #17
0
파일: Biba.java 프로젝트: tfausak/class
  public boolean bibaWrite(String[] arguments) {
    String subject, object, subjectLevel, objectLevel;
    HashSet<String> subjectCategories, objectCategories;

    if (!(arguments.length == 2 || arguments.length == 3)) {
      return false;
    }

    subject = arguments[0];
    object = arguments[1];
    // arguments[2] can be the value (ignored)

    if (!this.subjectLevels.containsKey(subject)
        || !this.objectLevels.containsKey(object)
        || !this.subjectCategories.containsKey(subject)
        || !this.objectCategories.containsKey(object)) {
      return false;
    }

    subjectLevel = this.subjectLevels.get(subject);
    objectLevel = this.objectLevels.get(object);
    subjectCategories = this.subjectCategories.get(subject);
    objectCategories = this.objectCategories.get(object);

    if (this.levels.indexOf(subjectLevel) < this.levels.indexOf(objectLevel)) {
      return false;
    }

    if (!subjectCategories.containsAll(objectCategories)) {
      return false;
    }

    System.out.println("Subject '" + subject + "' writes object '" + object + "'.");
    return true;
  }
예제 #18
0
  public static double findAccuracy(Set<RepairedCell> truth, Set<RepairedCell> found) {
    if (found.size() != 0) {
      HashMap<Integer, HashSet<String>> foundMap = new HashMap<Integer, HashSet<String>>();

      for (RepairedCell cell : found) {
        HashSet<String> columnIds = null;
        if (foundMap.get(cell.getRowId()) == null) {
          columnIds = new HashSet<String>();
        } else {
          columnIds = foundMap.get(cell.getRowId());
        }
        columnIds.add(cell.getColumnId());
        foundMap.put(cell.getRowId(), columnIds);
      }

      int tAndF = 0;
      for (RepairedCell cell : truth) {
        if (foundMap.get(cell.getRowId()) != null) {
          if (foundMap.get(cell.getRowId()).contains(cell.getColumnId())) {
            tAndF++;
          }
        }
      }
      double precision = tAndF * 1.0 / found.size(), recall = tAndF * 1.0 / truth.size();
      if (debug) System.out.println("find precision = " + precision + ", find recall = " + recall);

      return 2 * precision * recall / (precision + recall);
    }
    return 0;
  }
예제 #19
0
  public synchronized void messageReceived(int to, Message m) {

    DrainMsg mhMsg = (DrainMsg) m;

    log.debug(
        "incoming: localDest: "
            + to
            + " type:"
            + mhMsg.get_type()
            + " hops:"
            + (16 - mhMsg.get_ttl())
            + " seqNo:"
            + mhMsg.get_seqNo()
            + " source:"
            + mhMsg.get_source()
            + " finalDest:"
            + mhMsg.get_dest());

    // lets assume that the network cannot buffer more than 25 drain msgs from a single source at a
    // time (should be more than reasonable)
    if (seqNos.containsKey(new Integer(mhMsg.get_source()))) {
      int oldSeqNo = ((Integer) seqNos.get(new Integer(mhMsg.get_source()))).intValue();
      int upperBound = mhMsg.get_seqNo() + 25;
      int wrappedUpperBound = 25 - (255 - mhMsg.get_seqNo());
      if ((oldSeqNo >= mhMsg.get_seqNo() && oldSeqNo < upperBound)
          || (oldSeqNo >= 0 && oldSeqNo < wrappedUpperBound)) {
        log.debug(
            "Dropping message from "
                + mhMsg.get_source()
                + " with duplicate seqNo: "
                + mhMsg.get_seqNo());
        return;
      }
    }
    seqNos.put(new Integer(mhMsg.get_source()), new Integer(mhMsg.get_seqNo()));

    if (to != spAddr && to != MoteIF.TOS_BCAST_ADDR && to != TOS_UART_ADDR) {
      log.debug("Dropping message not for me.");
      return;
    }

    HashSet promiscuousSet = (HashSet) idTable.get(new Integer(BCAST_ID));
    HashSet listenerSet = (HashSet) idTable.get(new Integer(mhMsg.get_type()));

    if (listenerSet != null && promiscuousSet != null) {
      listenerSet.addAll(promiscuousSet);
    } else if (listenerSet == null && promiscuousSet != null) {
      listenerSet = promiscuousSet;
    }

    if (listenerSet == null) {
      log.debug("No Listener for type: " + mhMsg.get_type());
      return;
    }

    for (Iterator it = listenerSet.iterator(); it.hasNext(); ) {
      MessageListener ml = (MessageListener) it.next();
      ml.messageReceived(to, mhMsg);
    }
  }
예제 #20
0
파일: Biba.java 프로젝트: tfausak/class
  public boolean bibaRead(String[] arguments) {
    String subject, object, subjectLevel, objectLevel;
    HashSet<String> subjectCategories, objectCategories;

    if (arguments.length != 2) {
      return false;
    }

    subject = arguments[0];
    object = arguments[1];

    if (!this.subjectLevels.containsKey(subject)
        || !this.objectLevels.containsKey(object)
        || !this.subjectCategories.containsKey(subject)
        || !this.objectCategories.containsKey(object)) {
      return false;
    }

    subjectLevel = this.subjectLevels.get(subject);
    objectLevel = this.objectLevels.get(object);
    subjectCategories = this.subjectCategories.get(subject);
    objectCategories = this.objectCategories.get(object);

    if (this.levels.indexOf(subjectLevel) > this.levels.indexOf(objectLevel)) {
      return false;
    }

    if (!subjectCategories.containsAll(objectCategories)) {
      return false;
    }

    System.out.println("Subject '" + subject + "' reads object '" + object + "'.");
    return true;
  }
예제 #21
0
 // CUT begin
 public static void main(String[] args) {
   System.err.println("RedPaint (950 Points)");
   System.err.println();
   HashSet<Integer> cases = new HashSet<Integer>();
   for (int i = 0; i < args.length; ++i) cases.add(Integer.parseInt(args[i]));
   runTest(cases);
 }
예제 #22
0
  public void deregisterListener(int id, MessageListener m) {
    HashSet listenerSet = (HashSet) idTable.get(new Integer(id));

    if (listenerSet == null) {
      throw new IllegalArgumentException("No listeners registered for message type " + id);
    }
    listenerSet.remove(m);
  }
예제 #23
0
파일: Friends.java 프로젝트: maandree/cnt
  /**
   * Removes a player from the friend list
   *
   * @param friend The player
   */
  public static void removeFriend(final Player friend) {
    synchronized (monitor) {
      if (friends.contains(friend) == false) return;

      friends.remove(friend);
      saveFriends();
    }
  }
예제 #24
0
 private void addDependencies(HashSet<byte[]> deps, CommandData data) {
   for (byte[] dep : data.dependencies) {
     deps.add(dep);
   }
   for (byte[] dep : data.runbundles) {
     deps.add(dep);
   }
 }
예제 #25
0
파일: Friends.java 프로젝트: maandree/cnt
  /**
   * 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();
    }
  }
예제 #26
0
 static {
   markupTags.add("d");
   markupTags.add("s");
   markupTags.add("io");
   markupTags.add("c");
   markupTags.add("mo");
   markupTags.add("tr");
   markupTags.add("o");
 }
예제 #27
0
 @Override
 public Enumeration<URL> findResources(String name) throws IOException {
   final HashSet<URL> urls = new HashSet<>();
   for (PomClassLoader cl : parents) {
     urls.addAll(Collections.list(cl.findResources(name)));
   }
   urls.addAll(Collections.list(super.findResources(name)));
   return Collections.enumeration(urls);
 }
예제 #28
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();
    }
  }
예제 #29
0
파일: Grafo.java 프로젝트: daru23/graphs
  ///////////////////////////////////////////////////////// Mostrar lados
  // ///////////////////////////////////////////////
  public HashSet lados(Grafo g) {

    HashSet aux = new HashSet();
    for (Enumeration e = g.CjtoLados.keys(); e.hasMoreElements(); ) {
      String l = (String) e.nextElement();
      aux.add(l);
    }
    ;
    return aux;
  }
  private Set<Artifact> filterArtifacts(Set<Artifact> resolvedArtifacts, String... scopes) {
    HashSet<Artifact> artifacts = new HashSet<Artifact>();
    List<String> checkScopes = Arrays.asList(scopes);

    for (Artifact artifact : resolvedArtifacts) {
      if (checkScopes.contains(artifact.getScope())) artifacts.add(artifact);
    }

    return artifacts;
  }