Class: 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.



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

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

Instance Attribute Details

#compMapObject

[Integer]:Integer


5
6
7
# File 'lib/arch_store.rb', line 5

def compMap
  @compMap
end

Instance Method Details

#get(archetypeId) ⇒ Object



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

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

#get_archetype_id(componentIds) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/arch_store.rb', line 19

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