| /* |
| * Copyright (c) 2008, 2010 Borland Software Corporation and others |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Artem Tikhomirov (Borland) - initial API and implementation |
| */ |
| |
| import gmf.CodeGenerationUtils; |
| |
| modeltype gmfgen uses "http://www.eclipse.org/gmf/2009/GenModel"; |
| |
| library Metrics; |
| |
| -- MODIFIERS: cached |
| helper getNotationMetrics(c : gmfgen::GenMetricContainer) : Sequence(gmfgen::GenMetricRule) { |
| return c.metrics->asSequence()->select(target.oclIsKindOf(gmfgen::GenNotationElementTarget)) |
| } |
| |
| -- MODIFIERS: cached |
| helper getDiagramMetrics(c : gmfgen::GenMetricContainer) : Sequence(gmfgen::GenMetricRule) { |
| return c.metrics->asSequence()->select(target.oclIsKindOf(gmfgen::GenDiagramElementTarget)) |
| } |
| |
| -- MODIFIERS: cached |
| helper getDomainMetrics(c : gmfgen::GenMetricContainer) : Sequence(gmfgen::GenMetricRule) { |
| return c.metrics->asSequence()->select(target.oclIsKindOf(gmfgen::GenDomainElementTarget)) |
| } |
| |
| helper calcMethodName(m : gmfgen::GenMetricRule) : String { |
| return 'calc' + validJavaIdentifier(m.key).firstToUpper() |
| } |
| |