Skip to content

Commit

Permalink
[all] Applying code style.
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Galland <galland@arakhne.org>
  • Loading branch information
gallandarakhneorg committed Jun 24, 2016
1 parent bd5f430 commit f11817d
Show file tree
Hide file tree
Showing 53 changed files with 640 additions and 547 deletions.
Expand Up @@ -36,22 +36,22 @@
*/
public class SARLSpecCreator extends AbstractSpecCreator {

private final static SARLInjectorProvider injectorProvider = new SARLInjectorProvider();
private static final SARLInjectorProvider INJECTOR_PROVIDER = new SARLInjectorProvider();

static {
injectorProvider.setupRegistry();
INJECTOR_PROVIDER.setupRegistry();
}

private Injector injector;

@Override
protected <T> T create(Class<T> klass) {
return this.injector.getInstance(klass);
}

@Override
public void beforeSpecRun() {
this.injector = injectorProvider.getInjector();
this.injector = INJECTOR_PROVIDER.getInjector();
}

@Override
Expand Down
Expand Up @@ -49,6 +49,7 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import com.google.common.io.Files;
import org.arakhne.afc.vmutil.ClassLoaderFinder;
import org.arakhne.afc.vmutil.ClasspathUtil;
import org.arakhne.afc.vmutil.FileSystem;
Expand All @@ -67,8 +68,6 @@
import org.eclipse.xtext.xbase.lib.Pair;
import org.osgi.framework.Version;

import com.google.common.io.Files;


/** Helper for tests.
* This class should disappear when the Jnario API will provide
Expand Down
2 changes: 1 addition & 1 deletion plugins/io.sarl.core/src/main/sarl/io/sarl/core/bic.sarl
Expand Up @@ -4,7 +4,7 @@
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright (C) 2014-2015 the original authors or authors.
* Copyright (C) 2014-2016 the original authors or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Expand Up @@ -4,7 +4,7 @@
* SARL is an general-purpose agent programming language.
* More details on http://www.sarl.io
*
* Copyright (C) 2014-2015 the original authors or authors.
* Copyright (C) 2014-2016 the original authors or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
35 changes: 21 additions & 14 deletions plugins/io.sarl.eclipse/src/io/sarl/eclipse/util/Jdt2Ecore.java
Expand Up @@ -96,7 +96,7 @@ public class Jdt2Ecore {

@Inject
private TypeReferences typeReferences;

@Inject
private IActionPrototypeProvider actionPrototypeProvider;

Expand Down Expand Up @@ -386,7 +386,7 @@ private String extractDefaultValue(IMethod operation, IAnnotation annot)
}
return null;
}

/** Create the formal parameters for the given operation.
*
* @param parameterBuilder the code builder.
Expand Down Expand Up @@ -427,7 +427,7 @@ public void createStandardConstructors(
IBehaviorBuilder codeBuilder,
Collection<IMethod> superClassConstructors,
XtendTypeDeclaration context) throws JavaModelException {
createStandardConstructorsWith(() -> { return codeBuilder.addConstructor(); },
createStandardConstructorsWith(() -> codeBuilder.addConstructor(),
superClassConstructors, context);
}

Expand All @@ -442,7 +442,7 @@ public void createStandardConstructors(
IEventBuilder codeBuilder,
Collection<IMethod> superClassConstructors,
XtendTypeDeclaration context) throws JavaModelException {
createStandardConstructorsWith(() -> { return codeBuilder.addConstructor(); },
createStandardConstructorsWith(() -> codeBuilder.addConstructor(),
superClassConstructors, context);
}

Expand All @@ -457,7 +457,7 @@ public void createStandardConstructors(
ISkillBuilder codeBuilder,
Collection<IMethod> superClassConstructors,
XtendTypeDeclaration context) throws JavaModelException {
createStandardConstructorsWith(() -> { return codeBuilder.addConstructor(); },
createStandardConstructorsWith(() -> codeBuilder.addConstructor(),
superClassConstructors, context);
}

Expand Down Expand Up @@ -488,7 +488,7 @@ protected void createStandardConstructorsWith(
//
IConstructorBuilder cons = codeBuilder.addConstructor();
cons.getExpression().addExpression().setXExpression(call);
createFormalParametersWith((name) -> { return cons.addParameter(name); }, constructor);
createFormalParametersWith((name) -> cons.addParameter(name), constructor);
}
}
}
Expand All @@ -504,9 +504,9 @@ protected void createStandardConstructorsWith(
public void createActions(
IAgentBuilder codeBuilder,
Collection<IMethod> methods) throws JavaModelException, IllegalArgumentException {
createActionsWith( (name) -> { return codeBuilder.addAction(name); }, methods);
createActionsWith((name) -> codeBuilder.addAction(name), methods);
}

/** Create the operations into the SARL feature container.
*
* @param codeBuilder - the builder of the script.
Expand All @@ -517,7 +517,7 @@ public void createActions(
public void createActions(
IBehaviorBuilder codeBuilder,
Collection<IMethod> methods) throws JavaModelException, IllegalArgumentException {
createActionsWith( (name) -> { return codeBuilder.addAction(name); }, methods);
createActionsWith((name) -> codeBuilder.addAction(name), methods);
}

/** Create the operations into the SARL feature container.
Expand All @@ -530,7 +530,7 @@ public void createActions(
public void createActions(
ISkillBuilder codeBuilder,
Collection<IMethod> methods) throws JavaModelException, IllegalArgumentException {
createActionsWith( (name) -> { return codeBuilder.addAction(name); }, methods);
createActionsWith((name) -> codeBuilder.addAction(name), methods);
}

/** Create the operations into the SARL feature container.
Expand All @@ -548,7 +548,7 @@ protected void createActionsWith(
if (!isGeneratedOperation(operation)) {
final IActionBuilder action = codeBuilder.addAction(operation.getElementName());
action.setReturnType(operation.getReturnType());
createFormalParametersWith( (name) -> { return action.addParameter(name); }, operation);
createFormalParametersWith((name) -> action.addParameter(name), operation);
}
}
}
Expand Down Expand Up @@ -740,6 +740,7 @@ public EObject getFormalParameter(int position) {
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@FunctionalInterface
public interface TypeFinder {

/** Find the definition of a type.
Expand All @@ -753,32 +754,38 @@ public interface TypeFinder {

}

/**
/** Parameter builder.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@FunctionalInterface
private interface ParameterBuilder {
IFormalParameterBuilder addParameter(String name);
}

/**
/** Action builder.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@FunctionalInterface
private interface ActionBuilder {
IActionBuilder addAction(String name);
}

/**
/** Constructor builder.
*
* @author $Author: sgalland$
* @version $FullVersion$
* @mavengroupid $GroupId$
* @mavenartifactid $ArtifactId$
*/
@FunctionalInterface
private interface ConstructorBuilder {
IConstructorBuilder addConstructor();
}
Expand Down
Expand Up @@ -108,7 +108,7 @@ public abstract class AbstractNewSarlElementWizardPage extends NewTypeWizardPage
*/
@Inject
protected CodeBuilderFactory codeBuilderFactory;

/** The trnaslator from JDT to SARL Ecore.
*/
@Inject
Expand Down
2 changes: 1 addition & 1 deletion plugins/io.sarl.lang.mwe2/GenerateSARL2.mwe2
Expand Up @@ -30,7 +30,7 @@ import org.eclipse.xtext.resource.XtextResourceSet

import io.sarl.lang.mwe2.*
import io.sarl.lang.mwe2.binding.*
import io.sarl.lang.mwe2.externalLang.*
import io.sarl.lang.mwe2.externalspec.*
import io.sarl.lang.mwe2.prettify.*
import io.sarl.lang.mwe2.latex.*
import io.sarl.lang.mwe2.gtk.*
Expand Down
2 changes: 1 addition & 1 deletion plugins/io.sarl.lang.mwe2/META-INF/MANIFEST.MF
Expand Up @@ -20,7 +20,7 @@ Export-Package: io.sarl.lang.mwe2,
io.sarl.lang.mwe2.binding,
io.sarl.lang.mwe2.codebuilder,
io.sarl.lang.mwe2.codebuilder.fragments,
io.sarl.lang.mwe2.externalLang,
io.sarl.lang.mwe2.externalspec,
io.sarl.lang.mwe2.gtk,
io.sarl.lang.mwe2.latex,
io.sarl.lang.mwe2.prettify
Expand Up @@ -26,7 +26,7 @@
import org.eclipse.xtext.xtext.generator.DefaultGeneratorModule;

import io.sarl.lang.mwe2.codebuilder.CodeBuilderConfig;
import io.sarl.lang.mwe2.externalLang.ExternalHighlightingConfig;
import io.sarl.lang.mwe2.externalspec.ExternalHighlightingConfig;

/**
* The generation module for SARL.
Expand Down
Expand Up @@ -36,25 +36,25 @@
* @mavenartifactid $ArtifactId$
*/
public class BindingElement {

private static final int HASH_VALUE = 31;

private String functionName;

private boolean singleton;

private boolean eagerSingleton;

private boolean instance;

private String injectedType;

private String concreteType;

private String annotatedWith;

private String annotatedWithName;

private boolean overridePreviousDefinition;

@Override
Expand All @@ -66,16 +66,16 @@ public boolean equals(Object obj) {
}
return false;
}

@Override
public int hashCode() {
int h = 1;
h = h * HASH_VALUE + (getBind() != null ? getBind().hashCode() : 0);
h = h * HASH_VALUE + (getAnnotatedWith() != null ? getAnnotatedWith().hashCode() : 0);
h = h * HASH_VALUE + (getAnnotatedWithName() != null ? getAnnotatedWithName().hashCode() : 0);
return h;
int bits = 1;
bits = bits * HASH_VALUE + Objects.hashCode(getBind());
bits = bits * HASH_VALUE + Objects.hashCode(getAnnotatedWith());
bits = bits * HASH_VALUE + Objects.hashCode(getAnnotatedWithName());
return bits ^ (bits >> 31);
}

@Override
public String toString() {
if (!Strings.isEmpty(getAnnotatedWith())) {
Expand All @@ -86,15 +86,15 @@ public String toString() {
}
return MessageFormat.format("{0} => {1}", getBind(), getTo()); //$NON-NLS-1$
}

/** Set the element could override a previously defined element.
*
* @param override <code>true</code> for overriding.
*/
public void setOverride(boolean override) {
this.overridePreviousDefinition = override;
}

/** Replies if the element could override a previously defined element.
*
* @return <code>true</code> for overriding.
Expand All @@ -113,7 +113,7 @@ public void setFunctionName(String name) {
this.functionName = name;
}
}

/** Replies the function name.
*
* @return the name of the binding function, or <code>null</code>.
Expand All @@ -132,7 +132,7 @@ public void setAnnotatedWith(String annotation) {
this.annotatedWith = annotation;
}
}

/** Replies the annotation.
*
* @return the annotation.
Expand All @@ -151,7 +151,7 @@ public void setAnnotatedWithName(String name) {
this.annotatedWithName = name;
}
}

/** Replies the <code>@</code><code>Named</code> property..
*
* @return the name.
Expand All @@ -168,7 +168,7 @@ public String getAnnotatedWithName() {
public void setSingleton(boolean singleton) {
this.singleton = singleton;
}

/** Replies if it is a singleton binding.
*
* @return <code>true</code> for singleton binding.
Expand All @@ -185,7 +185,7 @@ public boolean isSingleton() {
public void setEager(boolean eager) {
this.eagerSingleton = eager;
}

/** Replies if it is an eager singleton binding.
*
* @return <code>true</code> for eager singleton binding.
Expand All @@ -202,7 +202,7 @@ public boolean isEager() {
public void setInstance(boolean instance) {
this.instance = instance;
}

/** Replies if it is an instance binding.
*
* @return <code>true</code> for instance binding.
Expand All @@ -221,7 +221,7 @@ public void setBind(String injectedType) {
this.injectedType = injectedType;
}
}

/** Replies the binded type.
*
* @return the binded type.
Expand All @@ -240,7 +240,7 @@ public void setTo(String concreteType) {
this.concreteType = concreteType;
}
}

/** Replies the concrete type.
*
* @return the concrete type.
Expand Down

0 comments on commit f11817d

Please sign in to comment.