Sha256: 34b6394f1b07ef22d0d68fad9010950042cc4c10bc377f476e71f8ff820aa423

Contents?: true

Size: 981 Bytes

Versions: 3

Compression:

Stored size: 981 Bytes

Contents

# OpenStudio::Analysis::Algorithm define the algorithm parameters. The module and class names start to conflict
# with OpenStudio's namespace. Be careful adding new classes without first making sure that the namespace conflict
# is clear.
module OpenStudio
  module Analysis
    class AlgorithmAttributes
      # Create a new instance of an algorithm
      #
      def initialize
        @attributes = {}
      end

      def set_attribute(attribute_name, attribute_value)
        @attributes[attribute_name] = attribute_value
        begin
          if Float(attribute_value) != nil
            if Float(attribute_value).abs >= Float('1.0e+19')
              raise "ERROR: Attribute `#{attribute_name}` is greater than 1E19. This may cause failures."
            end
          end
        rescue ArgumentError, TypeError
        end
      end

      def [](name)
        @attributes[name]
      end

      def to_hash(_version = 1)
        @attributes
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
openstudio-analysis-1.0.0.rc19 lib/openstudio/analysis/algorithm_attributes.rb
openstudio-analysis-1.0.0.rc18 lib/openstudio/analysis/algorithm_attributes.rb
openstudio-analysis-1.0.0.rc17 lib/openstudio/analysis/algorithm_attributes.rb