blob: e830d5ef87f7d26a12b1d7c66202cfd723a3f1e7 [file] [log] [blame]
/**
* <copyright>
*
* Copyright (c) 2010 E.D.Willink 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:
* E.D.Willink - initial API and implementation
*
* </copyright>
*
* $Id: Pivot2Moniker.java,v 1.4 2011/04/20 19:02:46 ewillink Exp $
*/
package org.eclipse.ocl.examples.pivot.utilities;
import java.util.List;
import java.util.Map;
import org.eclipse.ocl.examples.pivot.Element;
import org.eclipse.ocl.examples.pivot.ParameterableElement;
import org.eclipse.ocl.examples.pivot.TemplateParameter;
public class Pivot2Moniker extends Abstract2Moniker
{
public static String toString(Element pivotElement) {
Pivot2Moniker moniker = new Pivot2Moniker(pivotElement);
moniker.appendElement(pivotElement);
String string = moniker.toString();
assert !"".equals(string);
return string;
}
public Pivot2Moniker(Element target) {
super(target);
}
public void appendTemplateArguments(List<? extends ParameterableElement> templateArguments, Map<TemplateParameter, ParameterableElement> templateBindings) {
if (!templateArguments.isEmpty()) {
append(TEMPLATE_BINDING_PREFIX);
String prefix = ""; //$NON-NLS-1$
for (ParameterableElement templateArgument : templateArguments) {
append(prefix);
appendElement(templateArgument, templateBindings);
prefix = TEMPLATE_BINDING_SEPARATOR;
}
append(TEMPLATE_BINDING_SUFFIX);
}
}
}