X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.fmil%2Fsrc%2Forg%2Fsimantics%2Ffmil%2FFMIL.java;h=39b90b1d0e0b474d1a57b0729deda3cf5341b529;hb=2f1722c73a054adc1df1fcd07a61c82ad96b2063;hp=70d6028a2c410f5f45697bfb3e816c81da1208dd;hpb=d37b372df3c35c5f89c139146422041a79a726e5;p=simantics%2Ffmil.git diff --git a/org.simantics.fmil/src/org/simantics/fmil/FMIL.java b/org.simantics.fmil/src/org/simantics/fmil/FMIL.java index 70d6028..39b90b1 100644 --- a/org.simantics.fmil/src/org/simantics/fmil/FMIL.java +++ b/org.simantics.fmil/src/org/simantics/fmil/FMIL.java @@ -106,7 +106,18 @@ public class FMIL { private String dirName; private String[] variableNames; + private String[] variableDescriptions; + private String[] variableDeclaredTypes; private int[] variableReferences; + private int[] variableTypes; + private int[] variableCausalities; + private int[] variableVariabilities; + + private String[] declaredTypes; + private String[] declaredTypeDescriptions; + private String[] declaredTypeQuantities; + private String[] declaredTypeUnits; + private TObjectIntHashMap variableMap = new TObjectIntHashMap(); private Set subscriptionSet = new HashSet(); @@ -208,7 +219,7 @@ public class FMIL { fmuLoaded = true; } catch (UnsatisfiedLinkError err) { - throw new FMILException(UNSATISFIED_LINK); + throw new FMILException(UNSATISFIED_LINK, err); } catch (Exception e) { throw new FMILException(e.getMessage()); } @@ -583,10 +594,46 @@ public class FMIL { private native String[] getAllVariables_(int id); - /** - * Get all variables in a loaded model - * @return all variables in a loaded model - */ + public String[] getAllVariableDescriptions() throws FMILException { + synchronized(syncObject) { + + try { + + if(variableDescriptions == null) { + variableDescriptions = getAllVariableDescriptions_(getModelIDNew()); + } + return variableDescriptions; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllVariableDescriptions_(int id); + + public String[] getAllVariableDeclaredTypes() throws FMILException { + synchronized(syncObject) { + + try { + + if(variableDeclaredTypes == null) { + variableDeclaredTypes = getAllVariableDeclaredTypes_(getModelIDNew()); + } + return variableDeclaredTypes; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllVariableDeclaredTypes_(int id); + public int[] getAllVariableReferences() throws FMILException { synchronized(syncObject) { @@ -606,6 +653,151 @@ public class FMIL { } private native int[] getAllVariableReferences_(int id, int[] array); + + public int[] getAllVariableTypes() throws FMILException { + synchronized(syncObject) { + + try { + + if(variableTypes == null) { + variableTypes = getAllVariableTypes_(getModelIDNew(), new int[variableNames.length]); + } + return variableTypes; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native int[] getAllVariableTypes_(int id, int[] array); + + public int[] getAllVariableCausalities() throws FMILException { + synchronized(syncObject) { + + try { + + if(variableCausalities == null) { + variableCausalities = getAllVariableCausalities_(getModelIDNew(), new int[variableNames.length]); + } + return variableCausalities; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native int[] getAllVariableCausalities_(int id, int[] array); + + public int[] getAllVariableVariabilities() throws FMILException { + synchronized(syncObject) { + + try { + + if(variableVariabilities == null) { + variableVariabilities = getAllVariableVariabilities_(getModelIDNew(), new int[variableNames.length]); + } + return variableVariabilities; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native int[] getAllVariableVariabilities_(int id, int[] array); + + /** + * Get all variables in a loaded model + * @return all variables in a loaded model + */ + public String[] getAllDeclaredTypes() throws FMILException { + synchronized(syncObject) { + + try { + + if(declaredTypes == null) { + declaredTypes = getAllDeclaredTypes_(getModelIDNew()); + } + return declaredTypes; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllDeclaredTypes_(int id); + + public String[] getAllDeclaredTypeDescriptions() throws FMILException { + synchronized(syncObject) { + + try { + + if(declaredTypeDescriptions == null) { + declaredTypeDescriptions = getAllDeclaredTypeDescriptions_(getModelIDNew()); + } + return declaredTypeDescriptions; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllDeclaredTypeDescriptions_(int id); + + public String[] getAllDeclaredTypeQuantities() throws FMILException { + synchronized(syncObject) { + + try { + + if(declaredTypeQuantities == null) { + declaredTypeQuantities = getAllDeclaredTypeQuantities_(getModelIDNew()); + } + return declaredTypeQuantities; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllDeclaredTypeQuantities_(int id); + + public String[] getAllDeclaredTypeUnits() throws FMILException { + synchronized(syncObject) { + + try { + + if(declaredTypeUnits == null) { + declaredTypeUnits = getAllDeclaredTypeUnits_(getModelIDNew()); + } + return declaredTypeUnits; + + } catch (UnsatisfiedLinkError err) { + throw new FMILException(UNSATISFIED_LINK); + } catch (Exception e) { + throw new FMILException(e.getMessage()); + } + } + } + + private native String[] getAllDeclaredTypeUnits_(int id); + // // /**