mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-19 01:44:44 -04:00
added some comments
This commit is contained in:
parent
d9efeff324
commit
aaf243381f
@ -19,7 +19,10 @@ import java.util.HashMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to call a java function from the template code.
|
* Used to call a java function from the template code.
|
||||||
* Uses reflection to invoke the method;
|
* Uses reflection to invoke the methods.
|
||||||
|
* All public methods which are declared in the given class are available via a
|
||||||
|
* {@link HGSMap} instance obtained by calling {@link JavaClass#createMap(Object)}.
|
||||||
|
* See {@link de.neemann.digital.hdl.vhdl.lib.VHDLTemplate} as an example.
|
||||||
*
|
*
|
||||||
* @param <T> the type of the instance
|
* @param <T> the type of the instance
|
||||||
*/
|
*/
|
||||||
@ -40,7 +43,7 @@ public final class JavaClass<T> {
|
|||||||
if (methods.containsKey(name))
|
if (methods.containsKey(name))
|
||||||
throw new RuntimeException("Method overloading ("
|
throw new RuntimeException("Method overloading ("
|
||||||
+ name + ") is not supported! Try to use the ellipsis (...) instead.");
|
+ name + ") is not supported! Try to use the ellipsis (...) instead.");
|
||||||
methods.put(name, new MyMethod<>(m, Modifier.isStatic(mod)));
|
methods.put(name, new MyMethod<>(m));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,9 +67,9 @@ public final class JavaClass<T> {
|
|||||||
private final boolean isVarArgs;
|
private final boolean isVarArgs;
|
||||||
private Class<?> compType;
|
private Class<?> compType;
|
||||||
|
|
||||||
private MyMethod(Method method, boolean isStatic) {
|
private MyMethod(Method method) {
|
||||||
this.method = method;
|
this.method = method;
|
||||||
this.isStatic = isStatic;
|
this.isStatic = Modifier.isStatic(method.getModifiers());
|
||||||
|
|
||||||
Class<?>[] argTypes = method.getParameterTypes();
|
Class<?>[] argTypes = method.getParameterTypes();
|
||||||
javaArgCount = argTypes.length;
|
javaArgCount = argTypes.length;
|
||||||
@ -151,7 +154,6 @@ public final class JavaClass<T> {
|
|||||||
if (m == null) return null;
|
if (m == null) return null;
|
||||||
return new MethodCall<>(m, instance);
|
return new MethodCall<>(m, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final class MethodCall<T> extends InnerFunction {
|
private static final class MethodCall<T> extends InnerFunction {
|
||||||
|
@ -23,7 +23,7 @@ import java.util.HashMap;
|
|||||||
import static de.neemann.digital.hdl.vhdl.VHDLLibrary.writePort;
|
import static de.neemann.digital.hdl.vhdl.VHDLLibrary.writePort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reads a file with the vhdl code to create the entity
|
* Reads a file with the vhdl code to create the entity.
|
||||||
*/
|
*/
|
||||||
public class VHDLTemplate implements VHDLEntity {
|
public class VHDLTemplate implements VHDLEntity {
|
||||||
private static final JavaClass<VHDLTemplateFunctions> TEMP_FUNCTIONS_CLASS
|
private static final JavaClass<VHDLTemplateFunctions> TEMP_FUNCTIONS_CLASS
|
||||||
|
Loading…
x
Reference in New Issue
Block a user