juliac.generated.ComponentImpl Maven / Gradle / Ivy
package juliac.generated;
import org.objectweb.fractal.julia.ChainedNoSuchInterfaceException;
import org.objectweb.fractal.api.Component;
import org.objectweb.fractal.julia.ComponentInterface;
import org.objectweb.fractal.api.type.ComponentType;
import org.objectweb.fractal.julia.Controller;
import org.objectweb.fractal.julia.loader.Generated;
import org.objectweb.fractal.julia.InitializationContext;
import org.objectweb.fractal.api.factory.InstantiationException;
import org.objectweb.fractal.api.type.InterfaceType;
import java.util.Map;
import org.objectweb.fractal.api.NoSuchInterfaceException;
import java.util.Set;
import org.objectweb.fractal.api.Type;
/**
* @see org.objectweb.fractal.julia.BasicControllerMixin
* @see org.objectweb.fractal.julia.BasicComponentMixin
* @see org.objectweb.fractal.julia.TypeComponentMixin
*/
public class ComponentImpl implements Component , Controller , Generated {
/**
* @see org.objectweb.fractal.julia.BasicControllerMixin#initFcController(org.objectweb.fractal.julia.InitializationContext)
*/
private void initFcController$0(final InitializationContext ic) throws InstantiationException {
}
/**
* @see org.objectweb.fractal.julia.BasicComponentMixin#fcType
*/
public Type fcType;
/**
* @see org.objectweb.fractal.julia.BasicComponentMixin#fcInterfaces
*/
public Map fcInterfaces;
/**
* @see org.objectweb.fractal.julia.TypeComponentMixin#getFcInterface(java.lang.String)
*/
public Object getFcInterface(final String interfaceName) throws NoSuchInterfaceException {
if ((interfaceName.indexOf('/')) == 0) {
return getFcInterface$0(interfaceName);
}
ComponentType compType = ((ComponentType)(getFcType()));
InterfaceType itfType;
try {
itfType = compType.getFcInterfaceType(interfaceName);
} catch (NoSuchInterfaceException e) {
throw new ChainedNoSuchInterfaceException(null , this , interfaceName);
}
Object result;
try {
result = getFcInterface$0(interfaceName);
} catch (NoSuchInterfaceException e) {
if (itfType.isFcCollectionItf()) {
result = getFcInterface$0(("/collection/" + (itfType.getFcItfName())));
result = ((ComponentInterface)(result)).clone();
((ComponentInterface)(result)).setFcItfName(interfaceName);
fcInterfaces.put(interfaceName ,result);
} else {
throw e;
}
}
return result;
}
/**
* @see org.objectweb.fractal.julia.BasicComponentMixin#initFcController(org.objectweb.fractal.julia.InitializationContext)
*/
public void initFcController(final InitializationContext ic) throws InstantiationException {
this.fcType = ic.type;
this.fcInterfaces = ic.interfaces;
initFcController$0(ic);
}
/**
* @see org.objectweb.fractal.julia.BasicComponentMixin#getFcType()
*/
public Type getFcType() {
return fcType;
}
/**
* @see org.objectweb.fractal.julia.BasicComponentMixin#getFcInterfaces()
*/
public Object[] getFcInterfaces() {
if ((fcInterfaces) == null) {
return new Object[0];
}
int size = 0;
String[] names = new String[fcInterfaces.size()];
names = ((String[])(fcInterfaces.keySet().toArray(names)));
for (int i = 0 ; i < (names.length) ; ++i) {
if ((names[i].charAt(0)) != '/') {
++size;
}
}
int index = 0;
Object[] itfs = new Object[size];
for (int i = 0 ; i < (names.length) ; ++i) {
if ((names[i].charAt(0)) != '/') {
itfs[index++] = fcInterfaces.get(names[i]);
}
}
return itfs;
}
/**
* @see org.objectweb.fractal.julia.BasicComponentMixin#getFcInterface(java.lang.String)
*/
private Object getFcInterface$0(final String interfaceName) throws NoSuchInterfaceException {
Object itf = (fcInterfaces) == null ? null : fcInterfaces.get(interfaceName);
if (itf == null) {
throw new ChainedNoSuchInterfaceException(null , this , interfaceName);
}
return itf;
}
private Object getFcInterface$1(String interfaceName) throws NoSuchInterfaceException {
return null;
}
private void initFcController$1(InitializationContext ic) throws InstantiationException {
}
public String getFcGeneratorParameters() {
return "(org.objectweb.fractal.juliac.spoon.MixinClassGenerator juliac.generated.ComponentImpl org.objectweb.fractal.julia.BasicControllerMixin org.objectweb.fractal.julia.BasicComponentMixin org.objectweb.fractal.julia.TypeComponentMixin)";
}
}