Sha256: 4c08ae3695715d02e3e281c8985fe31e4a1161fe7fa29824c752c38195c55ff6

Contents?: true

Size: 1.81 KB

Versions: 31

Compression:

Stored size: 1.81 KB

Contents

# unpack vector representation
# Reader - ADIwg JSON to internal data structure

# History:
# 	Stan Smith 2016-10-19 original script

require_relative 'module_vectorObject'

module ADIWG
    module Mdtranslator
        module Readers
            module MdJson

                module VectorRepresentation

                    def self.unpack(hVector, responseObj)

                        # return nil object if input is empty
                        if hVector.empty?
                            responseObj[:readerExecutionMessages] << 'Vector Representation object is empty'
                            responseObj[:readerExecutionPass] = false
                            return nil
                        end

                        # instance classes needed in script
                        intMetadataClass = InternalMetadata.new
                        intVector = intMetadataClass.newVectorInfo

                        # vector representation - topology level
                        if hVector.has_key?('topologyLevel')
                            if hVector['topologyLevel'] != ''
                                intVector[:topologyLevel] = hVector['topologyLevel']
                            end
                        end

                        # vector representation - vector object []
                        if hVector.has_key?('vectorObject')
                            hVector['vectorObject'].each do |item|
                                hVec = VectorObject.unpack(item, responseObj)
                                unless hVec.nil?
                                    intVector[:vectorObject] << hVec
                                end
                            end
                        end

                        return intVector

                    end

                end

            end
        end
    end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.9.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.9.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.9.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.7.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.6.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.6.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.5.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.4.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.3.5 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.3.4 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.3.3 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.3.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.3.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.3.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.2.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.1.2 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.1.1 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.1.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb
adiwg-mdtranslator-2.0.0 lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb