⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cheddar2xml.atl

📁 papyrus插件MARTE例子,uml建模
💻 ATL
📖 第 1 页 / 共 2 页
字号:
rule Root {	from		cheddar : CHEDDAR!Root	to		root : XML!Root (			name <- 'cheddar',			children <- Sequence{}		)				do {						if (CHEDDAR!processor.allInstances()->notEmpty()) {				thisModule.Processors(root);			}			if (CHEDDAR!address_space.allInstances()->notEmpty()) {				thisModule.AddressSpaces(root);			}			if (CHEDDAR!task.allInstances()->notEmpty()) {				thisModule.Tasks(root);			}			if (CHEDDAR!message.allInstances()->notEmpty()) {				thisModule.Messages(root);			}			if (CHEDDAR!resource.allInstances()->notEmpty()) {				thisModule.Resources(root);			}			if (CHEDDAR!buffer.allInstances()->notEmpty()) {				thisModule.Buffers(root);			}			if (CHEDDAR!dependency.allInstances()->notEmpty()) {				thisModule.Dependencies(root);			}			if (CHEDDAR!event_analyzer.allInstances()->notEmpty()) {				thisModule.EventAnalyzers(root);			}		}}rule Processor {	from		processor : CHEDDAR!processor	to		element : XML!Element (			name <- 'processor',			children <- Sequence{}		)	do {		if (not processor.name.oclIsUndefined()) {			thisModule.ElementText('name',processor.name,element);		}		if (not processor.scheduler.oclIsUndefined()) {			thisModule.Scheduler(processor.scheduler,element);		}		if (not processor.network_link.oclIsUndefined()) {			thisModule.Network(processor.network_link,element);		}	}}rule AddressSpace {	from		address_space : CHEDDAR!address_space	to		element : XML!Element (			name <- 'address_space',			children <- Sequence{}		)	do {		if (not address_space.name.oclIsUndefined()) {			thisModule.ElementText('name',address_space.name,element);		}		if (not address_space.cpu_name.oclIsUndefined()) {			thisModule.ElementText('cpu_name',address_space.cpu_name.name,element);		}		if (not address_space.text_memory_size.oclIsUndefined()) {			thisModule.ElementText('text_memory_size',address_space.text_memory_size.toString(),element);		}		if (not address_space.stack_memory_size.oclIsUndefined()) {			thisModule.ElementText('stack_memory_size',address_space.stack_memory_size.toString(),element);		}		if (not address_space.data_memory_size.oclIsUndefined()) {			thisModule.ElementText('data_memory_size',address_space.data_memory_size.toString(),element);		}		if (not address_space.heap_memory_size.oclIsUndefined()) {			thisModule.ElementText('heap_memory_size',address_space.heap_memory_size.toString(),element);		}		if (not address_space.scheduler.oclIsUndefined()) {			thisModule.Scheduler(address_space.scheduler,element);		}	}}rule Task {	from		task : CHEDDAR!task	to		element : XML!Element (			name <- 'task',			children <- Sequence{}		)	do {		if (not task.x.oclIsUndefined()) {			thisModule.Attribute('x',task.x.toString(),element);		}		if (not task.y.oclIsUndefined()) {			thisModule.Attribute('y',task.y.toString(),element);		}		if (not task.task_type.oclIsUndefined()) {			thisModule.Attribute('task_type',task.task_type.toString(),element);		}		if (not task.cpu_name.oclIsUndefined()) {			thisModule.ElementText('cpu_name',task.cpu_name.name,element);		}		if (not task.address_space_name.oclIsUndefined()) {			thisModule.ElementText('address_space_name',task.address_space_name.name,element);		}		if (not task.name.oclIsUndefined()) {			thisModule.ElementText('name',task.name,element);		}		if (not task.capacity.oclIsUndefined()) {			thisModule.ElementText('capacity',task.capacity.toString(),element);		}		if (not task.start_time.oclIsUndefined()) {			thisModule.ElementText('start_time',task.start_time.toString(),element);		}		if (not task.policy.oclIsUndefined()) {			thisModule.ElementText('policy',task.policy.toString(),element);		}		if (not task.deadline.oclIsUndefined()) {			thisModule.ElementText('deadline',task.deadline.toString(),element);		}		if (not task.criticality.oclIsUndefined()) {			thisModule.ElementText('criticality',task.criticality.toString(),element);		}		if (not task.blocking_time.oclIsUndefined()) {			thisModule.ElementText('blocking_time',task.blocking_time.toString(),element);		}		if (not task.priority.oclIsUndefined()) {			thisModule.ElementText('priority',task.priority.toString(),element);		}		if (not task.text_memory_size.oclIsUndefined()) {			thisModule.ElementText('text_memory_size',task.text_memory_size.toString(),element);		}		if (not task.stack_memory_size.oclIsUndefined()) {			thisModule.ElementText('stack_memory_size',task.stack_memory_size.toString(),element);		}		if (not task.period.oclIsUndefined()) {			thisModule.ElementText('period',task.period.toString(),element);		}		if (not task.jitter.oclIsUndefined()) {			thisModule.ElementText('jitter',task.jitter.toString(),element);		}		if (not task.parameters.oclIsUndefined() and task.parameters.notEmpty()) {			thisModule.Parameters(task,element);		}		if (not task.offsets.oclIsUndefined() and task.offsets.notEmpty()) {			thisModule.Offsets(task,element);		}	}}rule Resource {	from		resource : CHEDDAR!resource	to		element : XML!Element (			name <- 'resource',			children <- Sequence{}		)	do {		if (not resource.cpu_name.oclIsUndefined()) {			if (not resource.cpu_name.name.oclIsUndefined()) {				thisModule.ElementText('cpu_name',resource.cpu_name.name,element);			}		}		if (not resource.address_space_name.oclIsUndefined()) {			if (not resource.address_space_name.name.oclIsUndefined()) {				thisModule.ElementText('address_space_name',resource.address_space_name.name,element);			}		}		if (not resource.name.oclIsUndefined()) {			thisModule.ElementText('name',resource.name,element);		}		if (not resource.state.oclIsUndefined()) {			thisModule.ElementText('state',resource.state.toString(),element);		}		if (not resource.protocol.oclIsUndefined()) {			thisModule.ElementText('protocol',				let m:String=resource.protocol.toString()				in if m='PCP' then 'PRIORITY_CEILING_PROTOCOL'					else if m='PIP' then 'PRIORITY_INHERITANCE_PROTOCOL'					else if m='IPCP' then 'IMMEDIATE_PRIORITY_CEILING_PROTOCOL'					else 'NO_PROTOCOL' endif endif endif 				,element);		}		if (not resource.resource_used_by.oclIsUndefined() and resource.resource_used_by.notEmpty()) {			thisModule.ResourceUsedBy(resource,element);		}	}}rule EventAnalyzer {	from		event_analyzer : CHEDDAR!event_analyzer	to		element : XML!Element (			name <- 'event_analyzer',			children <- Sequence{}		)	do {		if (not event_analyzer.parametric_filename.oclIsUndefined()) {			thisModule.Attribute('parametric_filename',event_analyzer.parametric_filename,element);		}	}}rule Buffer {	from		buffer : CHEDDAR!buffer	to		element : XML!Element (			name <- 'buffer',			children <- Sequence{}		)	do {		if (not buffer.x.oclIsUndefined()) {			thisModule.Attribute('x',buffer.x.toString(),element);		}		if (not buffer.y.oclIsUndefined()) {			thisModule.Attribute('y',buffer.y.toString(),element);		}		if (not buffer.cpu_name.oclIsUndefined()) {			thisModule.ElementText('cpu_name',buffer.cpu_name.name,element);		}		if (not buffer.address_space_name.oclIsUndefined()) {			thisModule.ElementText('address_space_name',buffer.address_space_name.name,element);		}		if (not buffer.name.oclIsUndefined()) {			thisModule.ElementText('name',buffer.name,element);		}		if (not buffer.size.oclIsUndefined()) {			thisModule.ElementText('size',buffer.size.toString(),element);		}		if (not buffer.qs.oclIsUndefined()) {			thisModule.ElementText('qs',buffer.qs.toString(),element);		}		if (not buffer.buffer_used_by.oclIsUndefined() and buffer.buffer_used_by.notEmpty()) {			thisModule.BufferUsedBy(buffer,element);		}	}}rule Dependency {	from		dependency : CHEDDAR!dependency	to		element : XML!Element (			name <- 'dependency',			children <- Sequence{}		)	do {		if (not dependency.to_type.oclIsUndefined()) {			thisModule.Attribute('to_type',dependency.to_type.toString(),element);		}		if (not dependency.from_type.oclIsUndefined()) {			thisModule.Attribute('from_type',dependency.from_type.toString(),element);		}		if (not dependency.from.oclIsUndefined() and not dependency.to.oclIsUndefined()) {			thisModule.Text(dependency.from.name+' '+dependency.to.name,element);		}	}}rule Message {	from		message : CHEDDAR!message	to		element : XML!Element (			name <- 'message',			children <- Sequence{}		)	do {		if (not message.x.oclIsUndefined()) {			thisModule.Attribute('x',message.x.toString(),element);		}		if (not message.y.oclIsUndefined()) {			thisModule.Attribute('y',message.y.toString(),element);		}		if (not message.name.oclIsUndefined()) {			thisModule.ElementText('name',message.name,element);		}		if (not message.jitter.oclIsUndefined()) {			thisModule.ElementText('jitter',message.jitter.toString(),element);		}		if (not message.deadline.oclIsUndefined()) {			thisModule.ElementText('deadline',message.deadline.toString(),element);		}		if (not message.period.oclIsUndefined()) {			thisModule.ElementText('period',message.period.toString(),element);		}		if (not message.size.oclIsUndefined()) {			thisModule.ElementText('size',message.size.toString(),element);		}		if (not message.response_time.oclIsUndefined()) {			thisModule.ElementText('response_time',message.response_time.toString(),element);		}		if (not message.communication_time.oclIsUndefined()) {			thisModule.ElementText('communication_time',message.communication_time.toString(),element);		}	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -