Class: ADSL::DS::DSClass

Inherits:
DSNode show all
Defined in:
lib/adsl/ds/data_store_spec.rb,
lib/adsl/spass/spass_ds_extensions.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from DSNode

#list_entity_classes_read, #list_entity_classes_written_to, #replace, #replace_var

Class Method Details

.common_supertype(classes) ⇒ Object



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/adsl/ds/data_store_spec.rb', line 69

def self.common_supertype(classes)
  types = classes.uniq
  types.delete nil
  while types.length > 1
    type1 = types.pop
    type2 = types.pop
    if type1.superclass_of? type2
      types << type2
    elsif type2.superclass_of? type1
      types << type1
    else
      raise ADSLError, "Object sets are not of compatible types: #{classes.map { |c| c.name }.join(", ")}"
    end
  end
  types.first
end

Instance Method Details

#[](variable) ⇒ Object



155
156
157
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 155

def [](variable)
  @type_pred[variable]
end

#superclass_of?(other_class) ⇒ Boolean

Returns:

  • (Boolean)


61
62
63
64
65
66
67
# File 'lib/adsl/ds/data_store_spec.rb', line 61

def superclass_of?(other_class)
  until other_class.nil?
    return true if other_class == self
    other_class = other_class.parent
  end
  return false
end

#to_sObject



57
58
59
# File 'lib/adsl/ds/data_store_spec.rb', line 57

def to_s
  @name
end

#translate(translation) ⇒ Object



159
160
161
# File 'lib/adsl/spass/spass_ds_extensions.rb', line 159

def translate(translation)
  @type_pred = translation.create_predicate "of_#{@name}_type", 1
end