Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPhy argument matching does not handle the array of objects #464

Closed
walterxie opened this issue Apr 29, 2024 · 0 comments
Closed

LPhy argument matching does not handle the array of objects #464

walterxie opened this issue Apr 29, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@walterxie
Copy link
Collaborator

walterxie commented Apr 29, 2024

To match the argument type, lphy core does not handle the array of types. For example br = localClock(tree=tree, clades=[node1,node2], cladeRates=[0.4,0.1], rootRate=0.2, includeStem=true);, the java is

@ParameterInfo(name = cladeArrayName, description = "...") Value<TimeTreeNode[]> clades,

But in ArgumentUtils.matchingParameterTypes(List<Argument> arguments, ...), that value type is casted to Object[] as we do not have the TimeTreeNodeArrayValue. This value class has to be in the base, so the SPI for ArrayValue will be the general solution.

Alternatively, the easy treatment is to get the Object[] and cast the component during the for loop, such as :

Object[] clades = (Object[]) params.get(cladeArrayName).value();

for (int i = 0; i < clades.length; i++){
            TimeTreeNode clade = (TimeTreeNode) clades[i];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant