Class: Pacer::GroupVertex

Inherits:
Object
  • Object
show all
Defined in:
lib/pacer/blueprints/group_vertex.rb

Overview

Created without property support, though it could easily be added if it is ever needed.

Constant Summary collapse

IN =
com.tinkerpop.blueprints.Direction::IN
OUT =
com.tinkerpop.blueprints.Direction::OUT
BOTH =
com.tinkerpop.blueprints.Direction::BOTH

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, graph, wrapper, components = nil) ⇒ GroupVertex

Initialize it with an empty set to force uniqueness. Non-unique by default.



13
14
15
16
17
18
19
20
21
# File 'lib/pacer/blueprints/group_vertex.rb', line 13

def initialize(key, graph, wrapper, components = nil)
  @key = key
  @wrapper = wrapper
  if components
    @components = components
  else
    @components = []
  end
end

Instance Attribute Details

#componentsObject (readonly)

Returns the value of attribute components.



9
10
11
# File 'lib/pacer/blueprints/group_vertex.rb', line 9

def components
  @components
end

#graphObject (readonly)

Returns the value of attribute graph.



10
11
12
# File 'lib/pacer/blueprints/group_vertex.rb', line 10

def graph
  @graph
end

#keyObject (readonly)

Returns the value of attribute key.



9
10
11
# File 'lib/pacer/blueprints/group_vertex.rb', line 9

def key
  @key
end

#pathsObject (readonly)

Returns the value of attribute paths.



10
11
12
# File 'lib/pacer/blueprints/group_vertex.rb', line 10

def paths
  @paths
end

#wrapperObject (readonly)

Returns the value of attribute wrapper.



10
11
12
# File 'lib/pacer/blueprints/group_vertex.rb', line 10

def wrapper
  @wrapper
end

Instance Method Details

#add_component(vertex) ⇒ Object



23
24
25
# File 'lib/pacer/blueprints/group_vertex.rb', line 23

def add_component(vertex)
  components << vertex
end

#getEdges(direction, *labels) ⇒ Object



55
56
57
# File 'lib/pacer/blueprints/group_vertex.rb', line 55

def getEdges(direction, *labels)
  Pacer::Pipes::MultiPipe.new components.map { |v| v.getEdges(direction, *labels) }
end

#getIdObject



29
30
31
# File 'lib/pacer/blueprints/group_vertex.rb', line 29

def getId
  "#{ key }:#{ components.count }"
end

#getProperty(key) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/pacer/blueprints/group_vertex.rb', line 37

def getProperty(key)
  case key
  when 'components' then components.map { |c| wrapper.new graph, c }
  when 'key' then key
  when 'count' then components.count
  end
end

#getPropertyKeysObject



33
34
35
# File 'lib/pacer/blueprints/group_vertex.rb', line 33

def getPropertyKeys
  Set[]
end

#getRawVertexObject



47
48
49
# File 'lib/pacer/blueprints/group_vertex.rb', line 47

def getRawVertex
  self
end

#getVertices(direction, *labels) ⇒ Object



51
52
53
# File 'lib/pacer/blueprints/group_vertex.rb', line 51

def getVertices(direction, *labels)
  VerticesFromEdgesIterable.new self, direction, *labels
end