Sha256: ff540295d1c1ccc9e38b7cb85bee6b1bbdc3bae4eb1cccdb58f0e8a132df6507
Contents?: true
Size: 1.88 KB
Versions: 3
Compression:
Stored size: 1.88 KB
Contents
# class String # Clones a string # return self by default.(String are not cloned) def rdfx_clone return self end end module Mrdf_Resource # Clones a uml resource. # Referenced objects are cloned if rdfx_copyOnClone says so. def rdfx_clone c=self.clone c.rdf_uri="_transient_#{c.object_id}" c.rdf_Repository[c.rdf_uri]=c instance_variables.each { |v| ivg=instance_variable_get(v) next if (!ivg.kind_of?(ArrayOrSingleElement)) || (!isResetable?(v)) || (!rdfx_copyOnClone?(v)) newVal=createEmptyAttributeValue #puts "clone v=#{v}" self.instance_variable_get(v).each { | res| newVal.push(res.rdfx_clone) c.instance_variable_set(v,newVal) } } return c end # Returns true if object should be copied on clone for this property. # NOTE: # returns true if property name contains "_owned". (works for UML) def rdfx_copyOnClone?(prop) return prop.include?('_owned') #copyOrClone=copyOnCloneProperties[prop] #if copyOrClone.nil? #puts "WARNING: unspecified copy on clone for #{prop} on #{self.class.name}" #end #return copyOrClone end end #module Mrdf_Resource # #CopyOnCloneProperties={ } # def copyOnCloneProperties # #CopyOnCloneProperties # end #end #module Muml_Class # CopyOnCloneProperties={ '@uml_packageableElement_packageableElement_visibility' => true, # '@uml_structuredClassifier_ownedAttribute' => true, # '@mtk_rubyClassGenerated' => true, # '@uml_classifier_generalization' => true, # '@uml_namedElement_visibility' => true, # '@uml_namedElement_clientDependency' => true, # '@umlx_packageableElement_owner' => true, # '@ext_isReferencedBy' => true, # '@uml_class_ownedOperation' => true, # '@uml_behavioredClassifier_implementation' => true, # '@uml_namedElement_name' => true } # #def copyOnCloneProperties # # CopyOnCloneProperties #_class # #end #end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ontomde-core-2.0.0 | lib/ontomde-core/clone.rb |
ontomde-core-2.0.4 | lib/ontomde-core/clone.rb |
ontomde-core-2.0.5 | lib/ontomde-core/clone.rb |