Class: Kiwi::Internal::ArchStore

Inherits:
Object
  • Object
show all
Defined in:
lib/arch_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeArchStore

Returns a new instance of ArchStore.



11
12
13
14
15
16
# File 'lib/arch_store.rb', line 11

def initialize
  # [Archetype]
  @archetypes = []
  # [[ComponentId]:ArchetypeId]
  @compMap = Hash.new
end

Instance Attribute Details

#compMapObject

[Integer]:Integer


9
10
11
# File 'lib/arch_store.rb', line 9

def compMap
  @compMap
end

Instance Method Details

#get(archetypeId) ⇒ Object



18
19
20
# File 'lib/arch_store.rb', line 18

def get(archetypeId)
  return @archetypes[archetypeId]
end

#get_archetype_id(componentIds) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/arch_store.rb', line 23

def get_archetype_id(componentIds)
  archId = @compMap[componentIds]
  if archId != nil
    return archId
  else
    id = @archetypes.size
    @archetypes.push Archetype.new(componentIds)
    @compMap[componentIds] = id
    return id
  end
end