Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 9108e7e0517881a800f396488d4942013082133a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
 * Copyright (c) 2014 CEA LIST.
 * 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:
 *     CEA LIST - initial API and implementation
 */
package org.eclipse.papyrus.cpp.codegen.xtend;

import com.google.common.base.Objects;
import java.util.Collection;
import org.eclipse.papyrus.cpp.codegen.xtend.CppAttribute;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.VisibilityKind;
import org.eclipse.xtend2.lib.StringConcatenation;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;

/**
 * @author Önder GÜRCAN (onder.gurcan@cea.fr)
 */
@SuppressWarnings("all")
public class CppClassAttributesDeclaration {
  public static CharSequence CppClassAttributesDeclaration(final Classifier clazz, final VisibilityKind visibilityFilter) {
    StringConcatenation _builder = new StringConcatenation();
    {
      Collection<Property> _ownedAttributes = CppAttribute.getOwnedAttributes(clazz);
      final Function1<Property, Boolean> _function = new Function1<Property, Boolean>() {
        public Boolean apply(final Property it) {
          VisibilityKind _visibility = it.getVisibility();
          return Boolean.valueOf(Objects.equal(_visibility, visibilityFilter));
        }
      };
      Iterable<Property> _filter = IterableExtensions.<Property>filter(_ownedAttributes, _function);
      for(final Property oa : _filter) {
        CharSequence _CppAttributeDeclaration = CppAttribute.CppAttributeDeclaration(oa);
        _builder.append(_CppAttributeDeclaration, "");
        _builder.newLineIfNotEmpty();
      }
    }
    return _builder;
  }
}

Back to the top