Spec-Zone.ru › Ruby 2.6

класс Bundler::Molinillo::DependencyGraph::Vertex

Родитель:
Объект

Вершина в {DependencyGraph}, которая инкапсулирует имя {#name} и данные {#payload}

Атрибуты

explicit_requirements[R]

@return [Массив<Объект>] явные требования, которые требуются

this vertex
incoming_edges[RW]

@return [Массив<Ребро>] рёбра из {#graph}, у которых `self` является

{Edge#destination}
name[RW]

@return [Строка] имя вершины

outgoing_edges[RW]

@return [Массив<Ребро>] рёбра из {#graph}, у которых `self` является

{Edge#origin}
payload[RW]

@return [Объект] данные, которые хранит вершина

root[RW]

@return [Булево] является ли вершина корневой вершиной

root?[RW]

@return [Булево] является ли вершина корневой вершиной

Публичные Классовые Методы

new(name, payload) Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 25
def initialize(name, payload)
  @name = name.frozen? ? name : name.dup.freeze
  @payload = payload
  @explicit_requirements = []
  @outgoing_edges = []
  @incoming_edges = []
end

Инициализирует вершину с заданным именем и данными. @param [Строка] name см. {#name} @param [Объект] payload см. {#payload}

Публичные Методы Экземпляра

==(other) Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 84
def ==(other)
  return true if equal?(other)
  shallow_eql?(other) &&
    successors.to_set == other.successors.to_set
end

@return [Булево] равны ли две вершины, определяется

by a recursive traversal of each {Vertex#successors}
Также алиас для: eql?
ancestor?(other) Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 129
def ancestor?(other)
  other.path_to?(self)
end

Существует ли путь от `other` к `self`, следуя рёбрам в графе зависимостей? @return true, если существует путь, следуя рёбрам в этом {#graph}

Также алиас для: is_reachable_from?
descendent?(other)
Алиас для: path_to?
eql?(other)
Алиас для: ==
hash() Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 103
def hash
  name.hash
end

@return [Целое] хэш для вершины, основанный на её имени {#name}

inspect() Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 78
def inspect
  "#{self.class}:#{name}(#{payload.inspect})"
end

@return [Строка] строка, подходящая для отладки

is_reachable_from?(other)
Алиас для: ancestor?
path_to?(other) Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 110
def path_to?(other)
  _path_to?(other)
end

Существует ли путь от `self` к `other`, следуя рёбрам в графе зависимостей? @return true, если существует путь, следуя рёбрам в этом {#graph}

Также алиас для: descendent?
predecessors() Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 49
def predecessors
  incoming_edges.map(&:origin)
end

@return [Массив<Вершина>] вершины из {#graph}, у которых есть ребро с

`self` as their {Edge#destination}
recursive_predecessors() Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 55
def recursive_predecessors
  vertices = predecessors
  vertices += Compatibility.flat_map(vertices, &:recursive_predecessors)
  vertices.uniq!
  vertices
end

@return [Массив<Вершина>] вершины из {#graph}, где `self` является

{#descendent?}
recursive_successors() Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 70
def recursive_successors
  vertices = successors
  vertices += Compatibility.flat_map(vertices, &:recursive_successors)
  vertices.uniq!
  vertices
end

@return [Массив<Вершина>] вершины из {#graph}, где `self` является

{#ancestor?}
requirements() Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 35
def requirements
  (incoming_edges.map(&:requirement) + explicit_requirements).uniq
end

@return [Массив<Объект>] все требования, которые требуются

this vertex
shallow_eql?(other) Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 93
def shallow_eql?(other)
  return true if equal?(other)
  other &&
    name == other.name &&
    payload == other.payload
end

@param [Вершина] other другая вершина для сравнения @return [Булево] равны ли две вершины, определяется

solely by {#name} and {#payload} equality
successors() Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 64
def successors
  outgoing_edges.map(&:destination)
end

@return [Массив<Вершина>] вершины из {#graph}, у которых есть ребро с

`self` as their {Edge#origin}

Защищённые Методы Экземпляра

_path_to?(other, visited = Set.new) Показать исходный код
# File lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph/vertex.rb, line 119
def _path_to?(other, visited = Set.new)
  return false unless visited.add?(self)
  return true if equal?(other)
  successors.any? { |v| v._path_to?(other, visited) }
end

@param [Вершина] other вершина, для которой проверяется путь @param [Множество<Вершина>] visited вершины из {#graph}, которые были посещены @return [Булево] существует ли путь к `other` от `self`

Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API