问题标签 [hierarchical]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1102 浏览

html - HTML+CSS:结合
    /
      和假表格格式

我有一个要以 HTML 格式显示的分层表。<ul>和标签适用于事物的<ol>分层部分,但我希望总共有 2 或 3 列,其中最左边的列按层次缩进,例如

    • foo1
    • foo2
      • foo2a
    • foo3
      • foo3a
      • foo3b
  • 酒吧
    • 酒吧1
      • 酒吧1a
      • 酒吧1b
    • 酒吧2

但我也希望每个项目在右侧的列上都有一些相应的信息。

如何使用 HTML 和 CSS 做到这一点?

0 投票
2 回答
2786 浏览

model - 软件质量的层次模型

谁能帮我列出软件质量的分层模型?请问谁能说我

它只是 McCall 和 Bohem 模型还是存在许多其他层次模型?

0 投票
5 回答
5949 浏览

mysql - 如何在分层mysql表中选择节点的所有父节点?

我有一个 MySQL 表,它代表树 GUI 组件的数据,这是我的表的结构:

parentId是一个自引用的外键。

现在我想编写一个存储过程,它获取一个节点 ID 并返回一个包含该节点及其所有父节点的结果集。

例如,假设我的表填充了以下数据:

现在我想获取节点 3 的所有父节点(节点 1 和 2)并返回一个包含所有树记录的结果集。有人可以帮我吗?

0 投票
2 回答
1403 浏览

tree - 用正交线绘制层次树(HV-Drawing – 二叉树)

我需要绘制一个层次树结构(HV-Drawing – 二叉树),在根和孩子之间使用正交线(直矩形连接线)(如下所示:http: //lab.kapit.fr/display/visualizationlayouts/分层+树+布局 )。我想知道是否有这样的绘制树算法的开源示例,以便我可以在 actionscript 中实现相同的算法。谢谢帕拉什

0 投票
3 回答
6558 浏览

matlab - 在 MATLAB 中使用 clusterdata 时出现内存不足错误

我正在尝试聚类一个矩阵(大小:20057x2)。:

但我收到此错误:

有人能帮我吗。我有 4GB 的内存,但认为问题出在其他地方..

0 投票
2 回答
3405 浏览

php - 如何从mysql获取分层菜单

我有一个具有分层菜单的表,例如

我这里有 100 多个菜单项。为了获取数组中的所有项目,我必须编写一个像这样的递归函数

但这会执行 100 次查询。这是从数据库中获取分层菜单的最佳方法吗?这种方式加载mysql很多吗?

0 投票
1 回答
1105 浏览

c# - C# MVVM TreeView TwoWay-Binding of hierarchical data

I googled for an answer to this for more than two weeks now. This usually means either I am blind or the idea is absurd. Anyways:

In a middle-sized, quite flexible project I'm storing configuration data in a hierarchical structure in the like of this one:

  • Configuration (collection)
    1. Audio (class)
      • BaseDir (struct)
      • PlayMode (enum)
      • Input (class)
      • CalibrateOnConnect (bool)
      • KnownDevices (collection)
        1. ... (class)
          • ...
      • UseDevice (integer)
      • Playlist (collection)
        1. FirstAudio (class)
          • Path (string)
          • Repeat (integer)
      • ...

I already managed to display these in a TreeView in a MVVM pattern. Since I can't exactly tell which options will be added in future, I used a generic approach, creating ViewModels for class, ienumerable, my custom structs and the basic value types (string, bool, enum, ...).

In my XAML these have their corresponding (Hierarchical)DataTemplates, e.g. with a CheckBox for booleans or a textblock for general value types.

Each ViewModel instance has a field to store the data of the underlying Model.

I manage to edit these values in the View and via TwoWay-Binding also in the ViewModel.
But what makes my head hurt is how to update this data in the Model.
Since I create the hierarchical ViewModel structure through reflection, the parents do not have get/set properties corresponding to the field names / indexers / ... of the equivalent configuration class / collection. Though each ViewModel instance knows the field/property name of the parent's model's data structure it was created from and knows its parent ViewModel instance, too (but not its parent Model instance).
Every attempt to solve this problem via Commands or by calling some parent's update function made a knot into my brain.

Isn't there a simple way to achieve this via regular binding techniques?
Would it be better if I created ViewModels for each configuration (sub)class I'm using?
Hint: Each ViewModel instance knows its field / property name in the parent's model's data structure.

0 投票
6 回答
12571 浏览

wordpress - Wordpress 自定义帖子类型层次结构和菜单突出显示(current_page_parent)

我创建了一个自定义帖子类型的“投资组合”和一个带有模板的页面,该模板检索与该自定义帖子类型匹配的所有帖子。

问题是当我深入研究实际帖子时,该帖子似乎位于主菜单突出显示的“博客”下(将 current_page_parent 显示为一个类)

永久链接网址正确:www.site.com/portfolio/post-slug

但菜单认为父母是“博客”。

这显然是一个分层问题,但我不知道如何解决它。

0 投票
1 回答
1293 浏览

mysql - 使用 mysql 存储和检索好友联系人列表

我想创建一个可以像社交网络一样存储朋友联系人列表的数据库,这是设计数据库结构的最佳方法,并且使用 mysql 轻松检索朋友的联系人。

我需要解决这个问题,帮帮我

0 投票
4 回答
8428 浏览

c# - 使用状态模式的分层状态机的最佳实践是什么?

我即将使用状态模式在 C# 中实现分层状态机。作为一个指南,我正在使用这个例子。但是,该示例并未提供有关分层状态的答案。不幸的是,我似乎无法在其他地方找到好的例子。我的第一个想法是为分层状态创建嵌套类。但这被认为是最佳实践还是有更好的解决方案?

问候!

更新:

我整个下午都在尝试实现上述状态模式。HSM 基于一个非常简单的媒体播放器:

替代文字 http://www.freeimagehosting.net/uploads/e8d2d6486a.jpg

我以为我已经做到了,但有一件事我不明白。首先是我写的代码(对不起,很多):

在 MediaPlayer 类中定义事件时,我不能调用任何其他函数

  • OnButtonPressed
  • OffButtonPressed

所以我想知道,我的实施有什么好处吗?怎么了?我还尝试查看使用复合模式的建议,但我不明白它应该如何与状态模式一起使用。希望任何人都可以提供帮助!