Java Code generation from existing documentation and code examples

Hi Expert,

I would like to create JAVA code generation app.
I have many class and example and vast documentation for each class and methods.
How can I use this data base in order to be able to generate code by using plain English?
Thank you very much !

Some example of the available documentation

All Superinterfaces:
IAlarmWatcher, IOperatingSequenceResultsProvider
All Known Subinterfaces:
public interface IMeasurement
extends IAlarmWatcher, IOperatingSequenceResultsProvider
This interface enables you to read and write to the measurement object.
The measurement object contains all test data necessary to execute a measurement.
Test data includes setup data, limits and pass/fail information.
It provides methods to modify setup data local to this measurement.
Some methods of this class are restricted to certain method (such as setup()) of your test method.
If no restriction is mentioned with a method, it can be used in all methods of your test method.
Note:: It is not allowed to declare any measurement object in test methods that are within the Prebind testflow.

• package crossconnect.dcTests.testMethods;

• import java.util.Map;
• import java.util.Map.Entry;

• import xoc.dta.TestMethod;
• import xoc.dta.datatypes.MultiSiteDoubleArray;
• import xoc.dta.measurement.IMeasurement;
• import xoc.dta.resultaccess.IDcVIResults;
• import xoc.dta.testdescriptor.IParametricTestDescriptor;

• /**
• * This is a test method that executes a customized
• * continuity test for the crossconnect board.
• * It forces a small voltage (10mV) a the drive signals
• * and checks, if these can be measured at the recieve signals.
• * If run offline, artificial results are generated and input
• * parameter ‘randomFails’ allows to produce random fails
• *
• public class CustomizedContinuity extends TestMethod {

• /
* Main object for the test execution /
• public IMeasurement measurement;
• /
* Functional test descriptor for datalog /
• public IParametricTestDescriptor testVoltage;
• /
* digInOut signals to be tested for pass/fail /
• public String receiveSignals = “receiveGroup”;
• /
* flag to force random continuity fails */
• public boolean randomFails = false;

• public void execute() {
• // run measurement
• measurement.execute();

• // protect results to be not overwritten
• IDcVIResults resultHandle = measurement.dcVI(receiveSignals).preserveResults();

• // next test suite can start and use tester resources
• releaseTester();

• // upload results, i.e. measured voltages at receive signals
• Map<String, MultiSiteDoubleArray> measuredVoltages = resultHandle.vmeas(“measVoltage”).getVoltage();

• // check, if test method runs offline
• if (context.testProgram().variables().getBoolean(“SYS.OFFLINE”).equalTo(true)) {
• // generate artificial results
• for (Entry<String, MultiSiteDoubleArray> entrySignalValues : measuredVoltages.entrySet()) {
• for (int site : context.getActiveSites()) {
• // set factor from ‘0.002’ to ‘0.00255’ to produce some rare fails of the test
• double expectedValue = {0.009 + Math.random() * (randomFails ? 0.00255 : 0.002)};
• entrySignalValues.getValue().set(site, expectedValue);
• }
• }
• // Warning message, that results are artificially generated
• message(1, “”);
• message(1, “EXECUTION RUNS OFFLINE: Generated artificial results for continuity test.”);
• message(1, “”);
• }

• // for all sites: check pass/fail and send results to datalog
• testVoltage.evaluate(measuredVoltages, 0, measurement);
• }

• }

1 Like

Hi m-a.schenk,

thank you very much for your answer, I deeply appreciate it.

Who will be your customers? → it is a proof of concept try, no customers.
What other libraries than yours will they need? → only need to libraries I have.
What are you trying to sell? → I am not trying to sell, I’m trying to understand if it is possible to make it, in order to improve my work.
What are the IDE’s that your are going to integrate with? → I’ll use Eclips
Do these already have “copilots”? → I do not know this :slight_smile:

Thank you very much

1 Like

I’m sorry I’m not explaining well me status.
I’m coming from HW background and not from a SW one.

Thank you very much!
I’ll look in to it.