Java 类org.apache.commons.collections15.OrderedMap 实例源码

项目:Automacron    文件:RenderingUtils.java   
private static void processNodeType(OrderedMap<String, Integer> nodeTypeToSize, String subMotif) {
    String type = subMotif;
    System.out.println(type);
    if (type.contains("#")) {
        type = type.substring(type.indexOf("#") + 1);
    }
    type = type.replaceAll(":|\\{|\\}", "");

    if (!type.isEmpty()) {
        if (!nodeTypeToSize.containsKey(type)) {
            nodeTypeToSize.put(type, 0);
        }

        nodeTypeToSize.put(type, nodeTypeToSize.get(type) + 1);
    }
}
项目:VarJ    文件:UnmodifiableOrderedMap.java   
/**
 * Factory method to create an unmodifiable sorted map.
 *
 * @param map the map to decorate, must not be null
 * @throws IllegalArgumentException if map is null
 */
public static <K,V> OrderedMap<K, V> decorate(OrderedMap<K, V> map) {
    if (map instanceof Unmodifiable) {
        return map;
    }
    return new UnmodifiableOrderedMap<K, V>(map);
}
项目:VarJ    文件:TestUnmodifiableOrderedMap.java   
public void testDecorateFactory() {
    Map map = makeFullMap();
    assertSame(map, UnmodifiableOrderedMap.decorate((OrderedMap) map));

    try {
        UnmodifiableOrderedMap.decorate(null);
        fail();
    } catch (IllegalArgumentException ex) {
    }
}
项目:VarJ    文件:TestUnmodifiableOrderedMapIterator.java   
public void testDecorateFactory() {
    OrderedMapIterator it = makeFullOrderedMapIterator();
    assertSame(it, UnmodifiableOrderedMapIterator.decorate(it));

    it = ((OrderedMap) getMap()).orderedMapIterator();
    assertTrue(it != UnmodifiableOrderedMapIterator.decorate(it));

    try {
        UnmodifiableOrderedMapIterator.decorate(null);
        fail();
    } catch (IllegalArgumentException ex) {
    }
}
项目:Automacron    文件:TaxonomyRenderer.java   
private OrderedMap<String, Integer> processTaxonomyString(String taxonomyAsString) {
    //"protocol(2):in vivo(3):material amplification(5):organism(7)"
    String[] fragments = taxonomyAsString.split(":");
    taxonomyToRender = new ListOrderedMap<String, Integer>();
    for (String fragment : fragments) {
        String classification = fragment.substring(0, fragment.indexOf("("));
        taxonomyToRender.put(classification, Integer.valueOf(fragment.replaceAll(classification, "").replaceAll("\\(|\\)", "")));
    }


    return taxonomyToRender;
}
项目:Automacron    文件:ISAFileFlattener.java   
public static List<File> flattenISATabFiles(File isatabDirectory, Investigation investigation, Set<String> sampleFilter) {
    List<File> flattenedFiles = new ArrayList<File>();
    if (investigation != null) {

        System.out.printf("Just imported %s with %d studies.\r", isatabDirectory.getName(), investigation.getStudies().size());

        createProtocolLookup(investigation);
        // for each study, create a merged representation of the information. Meaning, attach the sample information to each
        // corresponding row in the assay

        Converter<Object[][], List<String[]>> arrayToListConversion = new ArrayToListConversion();

        for (String studyId : investigation.getStudies().keySet()) {

            Study study = investigation.getStudies().get(studyId);
            if (study.getStudySample() != null && study.getStudySample().getTableReferenceObject() != null) {
                List<String[]> studySampleRows = arrayToListConversion.convert(study.getStudySample().getAssayDataMatrix());

                for (Assay assay : study.getAssays().values()) {
                    // strange to have to do this, but apparently I must. Otherwise assay.getAssayDataMatrix() fails with a null pointer.
                    if (assay.getTableReferenceObject() != null) {
                        OrderedMap<Integer, List<String>> merged = new ListOrderedMap<Integer, List<String>>();

                        Object[][] assayDataMatrix = assay.getAssayDataMatrix();
                        List<String[]> assayRows = arrayToListConversion.convert(assayDataMatrix);

                        performMergeAssayWithStudySample(merged, studySampleRows, assayRows, sampleFilter);

                        // now do output of file
                        File flattenedStudyFileName = constructFlattenedFileName(isatabDirectory, studyId + ":" + assay.getAssayReference());
                        printMergedInformationToFile(flattenedStudyFileName, merged);
                        flattenedFiles.add(flattenedStudyFileName);
                    }
                }
            }
        }
    }

    return flattenedFiles;
}
项目:Automacron    文件:RenderingUtils.java   
/**
 * Returns two OrderedMaps composed of Strings to Integers describing the structure of a motif in terms of it's
 * topological features (in order) and node types with frequencies.
 *
 * @param representation - The motif representation
 * @return Returns two OrderedMaps composed of Strings to Integers
 */
public static Pair<OrderedMap<String, Integer>, OrderedMap<String, Integer>> getMotifStructure(String representation) {

    // e.g. Linear:Sample Name -> 1 or Branch:Protocol REF -> 4
    OrderedMap<String, Integer> topologyToSize = new ListOrderedMap<String, Integer>();
    OrderedMap<String, Integer> nodeTypeToSize = new ListOrderedMap<String, Integer>();

    List<String> subMotifsInMotif = MotifProcessingUtils.getNodesInBranch(representation);

    for (String subMotif : subMotifsInMotif) {
        processNodeType(nodeTypeToSize, subMotif);
    }

    return new Pair<OrderedMap<String, Integer>, OrderedMap<String, Integer>>(topologyToSize, nodeTypeToSize);
}
项目:VarJ    文件:AbstractTestOrderedMap.java   
public MapIterator makeEmptyMapIterator() {
    resetEmpty();
    return ((OrderedMap) AbstractTestOrderedMap.this.map).orderedMapIterator();
}
项目:VarJ    文件:AbstractTestOrderedMap.java   
public MapIterator makeFullMapIterator() {
    resetFull();
    return ((OrderedMap) AbstractTestOrderedMap.this.map).orderedMapIterator();
}
项目:VarJ    文件:TestUnmodifiableOrderedMap.java   
public Map makeFullMap() {
    OrderedMap m = ListOrderedMap.decorate(new HashMap());
    addSampleMappings(m);
    return UnmodifiableOrderedMap.decorate(m);
}
项目:VarJ    文件:TestUnmodifiableOrderedMapIterator.java   
public MapIterator makeFullMapIterator() {
    return UnmodifiableOrderedMapIterator.decorate(((OrderedMap) getMap()).orderedMapIterator());
}
项目:Automacron    文件:TaxonomyLevel.java   
public void setTaxonomyItems(OrderedMap<String, TaxonomyItem> taxonomyItems) {
    this.taxonomyItems = taxonomyItems;
}
项目:sstore-soft    文件:TransactionTrace.java   
/**
 * Return a mapping of batch ids to a list of QueryTrace elements
 * @return
 */
public OrderedMap<Integer, List<QueryTrace>> getBatches() {
    return (this.query_batches);
}
项目:s-store    文件:TransactionTrace.java   
/**
 * Return a mapping of batch ids to a list of QueryTrace elements
 * @return
 */
public OrderedMap<Integer, List<QueryTrace>> getBatches() {
    return (this.query_batches);
}
项目:VarJ    文件:AbstractOrderedMapDecorator.java   
/**
 * Constructor that wraps (not copies).
 *
 * @param map the map to decorate, must not be null
 * @throws IllegalArgumentException if the collection is null
 */
public AbstractOrderedMapDecorator(OrderedMap<K, V> map) {
    super(map);
}
项目:VarJ    文件:AbstractOrderedMapDecorator.java   
/**
 * Gets the map being decorated.
 *
 * @return the decorated map
 */
protected OrderedMap<K, V> getOrderedMap() {
    return (OrderedMap<K, V>) map;
}
项目:VarJ    文件:ListOrderedMap.java   
/**
 * Factory method to create an ordered map.
 * <p/>
 * An <code>ArrayList</code> is used to retain order.
 *
 * @param map the map to decorate, must not be null
 * @throws IllegalArgumentException if map is null
 */
public static <K,V> OrderedMap<K, V> decorate(Map<K, V> map) {
    return new ListOrderedMap<K, V>(map);
}
项目:VarJ    文件:UnmodifiableOrderedMap.java   
/**
 * Constructor that wraps (not copies).
 *
 * @param map the map to decorate, must not be null
 * @throws IllegalArgumentException if map is null
 */
private UnmodifiableOrderedMap(OrderedMap<K, V> map) {
    super(map);
}