Sha256: d08d30ec39ff0d68dda9bdc92a8b5332223021d3650ec9623ce331f330e4442c

Contents?: true

Size: 1.2 KB

Versions: 9

Compression:

Stored size: 1.2 KB

Contents

module Finitio
  #
  # The MultiRelation type generator allows capturing sets of information
  # facts, but allowing optional attributes. E. g.,
  #
  #     ColoredPoints = {{ point: Point, color :? Color }}
  #
  # This class allows capturing those types, in a way similar to
  # MultiTupleType:
  #
  #     ColoredPoints = MultiRelationType.new( Heading[...] )
  #
  # A ruby Set is used as concrete representation, and will contain hashes
  # that are valid representations of the associated multi tuple type:
  #
  #     R(ColoredPoints) = Set[ R({...}) ] = Set[Hash[...]]
  #
  # Accordingly, the dress transformation function has the signature below.
  # It expects an Enumerable as input and fails if any duplicate is found
  # (after tuple transformation), or if any tuple fails at being transformed.
  #
  #     dress :: Alpha  -> ColoredPoints   throws TypeError
  #     dress :: Object -> Set[Hash[...]]  throws TypeError
  #
  class MultiRelationType < Type
    include HeadingBasedType
    include RelBasedType

    def default_name
      "{{#{heading.to_name}}}"
    end

    def suppremum(other)
      super(other, RelationType, MultiRelationType)
    end

  end # class MultiRelationType
end # module Finitio

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
finitio-0.12.0 lib/finitio/type/multi_relation_type.rb
finitio-0.11.4 lib/finitio/type/multi_relation_type.rb
finitio-0.11.3 lib/finitio/type/multi_relation_type.rb
finitio-0.11.2 lib/finitio/type/multi_relation_type.rb
finitio-0.11.1 lib/finitio/type/multi_relation_type.rb
finitio-0.10.0 lib/finitio/type/multi_relation_type.rb
finitio-0.9.1 lib/finitio/type/multi_relation_type.rb
finitio-0.9.0 lib/finitio/type/multi_relation_type.rb
finitio-0.8.0 lib/finitio/type/multi_relation_type.rb