<bdo id='Pz4rk'></bdo><ul id='Pz4rk'></ul>

      <i id='Pz4rk'><tr id='Pz4rk'><dt id='Pz4rk'><q id='Pz4rk'><span id='Pz4rk'><b id='Pz4rk'><form id='Pz4rk'><ins id='Pz4rk'></ins><ul id='Pz4rk'></ul><sub id='Pz4rk'></sub></form><legend id='Pz4rk'></legend><bdo id='Pz4rk'><pre id='Pz4rk'><center id='Pz4rk'></center></pre></bdo></b><th id='Pz4rk'></th></span></q></dt></tr></i><div id='Pz4rk'><tfoot id='Pz4rk'></tfoot><dl id='Pz4rk'><fieldset id='Pz4rk'></fieldset></dl></div>

      1. <small id='Pz4rk'></small><noframes id='Pz4rk'>

        <tfoot id='Pz4rk'></tfoot>
        <legend id='Pz4rk'><style id='Pz4rk'><dir id='Pz4rk'><q id='Pz4rk'></q></dir></style></legend>
      2. Java 中是否存在有向无环图 (DAG) 数据类型,我应该使用它吗?

        时间:2023-10-13
            <tfoot id='QowL9'></tfoot>
              <bdo id='QowL9'></bdo><ul id='QowL9'></ul>

                  <i id='QowL9'><tr id='QowL9'><dt id='QowL9'><q id='QowL9'><span id='QowL9'><b id='QowL9'><form id='QowL9'><ins id='QowL9'></ins><ul id='QowL9'></ul><sub id='QowL9'></sub></form><legend id='QowL9'></legend><bdo id='QowL9'><pre id='QowL9'><center id='QowL9'></center></pre></bdo></b><th id='QowL9'></th></span></q></dt></tr></i><div id='QowL9'><tfoot id='QowL9'></tfoot><dl id='QowL9'><fieldset id='QowL9'></fieldset></dl></div>
                1. <small id='QowL9'></small><noframes id='QowL9'>

                  <legend id='QowL9'><style id='QowL9'><dir id='QowL9'><q id='QowL9'></q></dir></style></legend>

                    <tbody id='QowL9'></tbody>
                2. 本文介绍了Java 中是否存在有向无环图 (DAG) 数据类型,我应该使用它吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在用 Java 对电源子系统进行建模.一个简单的 SQLite 数据库包含一组 Line Replaceable Units (LRU) 和它们之间的连接.我正在编写一个 Power Model API 来简化对数据存储的查询,使用 DDD 模式和存储库.

                  I am modeling a power subsystem in Java. A simple SQLite database contains a set of Line Replaceable Units (LRUs) and the connections between them. I am writing a Power Model API to simplify queries of the data store, using DDD patterns and repositories.

                  我正在寻找合适的 Java 集合来为查询结果建模.LRU 连接流中有一些特殊情况需要建模:

                  I am seeking an appropriate Java collection to model the query results. There are some special cases in a LRU connection stream that have to be modeled:

                  1. 最初,有一个配电单元 (PDU) 具有多个端口 (<=16),可为下游 LRU 供电.
                  2. 电源流中的典型连接涉及产生电源的单个源 LRU 和消耗电源的单个 Sink LRU.
                  3. 但是,下游可能有一个源 LRU 连接到多个接收器 LRU.
                  4. 电源流中没有循环.

                  上面 #3 的包含使我想到从 API 中返回查询结果作为树.但我在 java.util 中找到的唯一树是 TreeMap 键值配对红黑树,这似乎不合适(或者我想不出用它来建模功率流的适当抽象.)我也一直在考虑 LinkedHashSet,但我不相信也是合适的.我不清楚这个结构中的节点如何指向下游节点.

                  The inclusion of #3 above has led me to think about returning query results from the API as a tree. But the only tree I've found in java.util is a TreeMap key-value paired red-black tree, which doesn't seem appropriate (or I can't think of an appropriate abstraction for modeling power streams with it.) I've also been considering a LinkedHashSet, but I'm not convinced it is appropriate either. It's not clear to me how a node in this structure would point to downstream nodes.

                  此时我并不关心时间或空间上的效率.我的 API 只需通过向外部客户端(即基于 Java 的电源监控和控制应用程序的表示层)提供电源连接信息来工作.对开源数据类型/库的使用也没有限制.

                  I'm not concerned about efficiency in time or space at this point. My API just has to work by supplying power connection information to external clients (i.e., the Presentation Tier of a Java-based Power Monitoring & Control app.) There are also no restrictions on the use of open source data types/libraries.

                  按照一般计算机科学的说法,我真正想要的是有向无环图 (DAG).

                  In general computer science parlance, what I'm really seeking is a Directed-Acyclic-Graph (DAG).

                  是否有针对 Java 的实现?我是否正确地认为 DAG 适合我的场景?

                  Is there an implementation of that for Java? Am I correct that a DAG is appropriate for my scenario?

                  推荐答案

                  针对这个特殊问题.我决定使用来自 Guava 的 LinkedListMultimap.

                  For this particular problem. I've decided to use a LinkedListMultimap from Guava.

                  这篇关于Java 中是否存在有向无环图 (DAG) 数据类型,我应该使用它吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:JavaScript 中是否有类似 Java Set 的数据结构? 下一篇:顺序无关的哈希算法

                  相关文章

                  1. <tfoot id='QEBO2'></tfoot>

                    • <bdo id='QEBO2'></bdo><ul id='QEBO2'></ul>
                      <i id='QEBO2'><tr id='QEBO2'><dt id='QEBO2'><q id='QEBO2'><span id='QEBO2'><b id='QEBO2'><form id='QEBO2'><ins id='QEBO2'></ins><ul id='QEBO2'></ul><sub id='QEBO2'></sub></form><legend id='QEBO2'></legend><bdo id='QEBO2'><pre id='QEBO2'><center id='QEBO2'></center></pre></bdo></b><th id='QEBO2'></th></span></q></dt></tr></i><div id='QEBO2'><tfoot id='QEBO2'></tfoot><dl id='QEBO2'><fieldset id='QEBO2'></fieldset></dl></div>
                      <legend id='QEBO2'><style id='QEBO2'><dir id='QEBO2'><q id='QEBO2'></q></dir></style></legend>
                    1. <small id='QEBO2'></small><noframes id='QEBO2'>