@Test public void createFunctionCallTest(){ State state = new State(SimpleDummyDomainRoot.domain, new SimpleDummyDomainRoot(), true); MethodId methodId = SimpleDummyDomainRoot.getMethodIdOfDummyNliMethod(); List<Argument> args; args = Arrays.asList( new PrimitiveArgument(SimpleDummyDomainRoot.EnumUsedToDefineFieldInRoot.USED), new PrimitiveArgument()); assertNotNull(DenotationUtils.createFunctionCall(state, methodId, args)); args = Arrays.asList( new PrimitiveArgument(SimpleDummyDomainRoot.EnumUsedToDefineFieldInRoot.USED), new PrimitiveArgument(SimpleDummyDomainRoot.EnumUsed.USED2, SimpleDummyDomainRoot.EnumUsed.USED_BUT_NOT_FOR_QUERYING)); assertNotNull(DenotationUtils.createFunctionCall(state, methodId, args)); args = Arrays.asList( new PrimitiveArgument(SimpleDummyDomainRoot.EnumUsed.USED2), new PrimitiveArgument(SimpleDummyDomainRoot.EnumUsed.USED2, SimpleDummyDomainRoot.EnumUsed.USED_BUT_NOT_FOR_QUERYING)); assertNull(DenotationUtils.createFunctionCall(state, methodId, args)); args = Arrays.asList( new PrimitiveArgument(SimpleDummyDomainRoot.EnumUsedToDefineFieldInRoot.USED, SimpleDummyDomainRoot.EnumUsedToDefineFieldInRoot.USED), new PrimitiveArgument(SimpleDummyDomainRoot.EnumUsed.USED2, SimpleDummyDomainRoot.EnumUsed.USED_BUT_NOT_FOR_QUERYING)); assertNull(DenotationUtils.createFunctionCall(state, methodId, args)); args = Arrays.asList( new PrimitiveArgument(SimpleDummyDomainRoot.EnumUsed.USED2, SimpleDummyDomainRoot.EnumUsed.USED_BUT_NOT_FOR_QUERYING), new PrimitiveArgument(SimpleDummyDomainRoot.EnumUsedToDefineFieldInRoot.USED)); assertNull(DenotationUtils.createFunctionCall(state, methodId, args)); }
static @Nullable MethodCall createFunctionCall(State initialState, MethodId methodId, List<Argument> argsIncludingPerhapsObjToInvokeOn) { String idOfObjToInvokeOn; ArrayList<Argument> args = new ArrayList<>(); if (firstArgumentIsObjToInvokeMethodOn(methodId)) { NonPrimitiveArgument firstArg = (NonPrimitiveArgument) argsIncludingPerhapsObjToInvokeOn.get(0); if (firstArg.getNonPrimitiveEntityIds().size() != 1) return null; idOfObjToInvokeOn = firstArg.getNonPrimitiveEntityIds().iterator().next(); if (argsIncludingPerhapsObjToInvokeOn.size()>1) args.addAll(argsIncludingPerhapsObjToInvokeOn.subList(1, argsIncludingPerhapsObjToInvokeOn.size())); } else { idOfObjToInvokeOn = initialState.getEntityId(initialState.getRootEntity()); args.addAll(argsIncludingPerhapsObjToInvokeOn); } return MethodCall.createValidFunctionCall(methodId, idOfObjToInvokeOn, args, initialState); }
DenotationUtils { static @Nullable MethodCall createFunctionCall(State initialState, MethodId methodId, List<Argument> argsIncludingPerhapsObjToInvokeOn) { String idOfObjToInvokeOn; ArrayList<Argument> args = new ArrayList<>(); if (firstArgumentIsObjToInvokeMethodOn(methodId)) { NonPrimitiveArgument firstArg = (NonPrimitiveArgument) argsIncludingPerhapsObjToInvokeOn.get(0); if (firstArg.getNonPrimitiveEntityIds().size() != 1) return null; idOfObjToInvokeOn = firstArg.getNonPrimitiveEntityIds().iterator().next(); if (argsIncludingPerhapsObjToInvokeOn.size()>1) args.addAll(argsIncludingPerhapsObjToInvokeOn.subList(1, argsIncludingPerhapsObjToInvokeOn.size())); } else { idOfObjToInvokeOn = initialState.getEntityId(initialState.getRootEntity()); args.addAll(argsIncludingPerhapsObjToInvokeOn); } return MethodCall.createValidFunctionCall(methodId, idOfObjToInvokeOn, args, initialState); } }
DenotationUtils { static @Nullable MethodCall createFunctionCall(State initialState, MethodId methodId, List<Argument> argsIncludingPerhapsObjToInvokeOn) { String idOfObjToInvokeOn; ArrayList<Argument> args = new ArrayList<>(); if (firstArgumentIsObjToInvokeMethodOn(methodId)) { NonPrimitiveArgument firstArg = (NonPrimitiveArgument) argsIncludingPerhapsObjToInvokeOn.get(0); if (firstArg.getNonPrimitiveEntityIds().size() != 1) return null; idOfObjToInvokeOn = firstArg.getNonPrimitiveEntityIds().iterator().next(); if (argsIncludingPerhapsObjToInvokeOn.size()>1) args.addAll(argsIncludingPerhapsObjToInvokeOn.subList(1, argsIncludingPerhapsObjToInvokeOn.size())); } else { idOfObjToInvokeOn = initialState.getEntityId(initialState.getRootEntity()); args.addAll(argsIncludingPerhapsObjToInvokeOn); } return MethodCall.createValidFunctionCall(methodId, idOfObjToInvokeOn, args, initialState); }  }
DenotationUtils { static @Nullable MethodCall createFunctionCall(State initialState, MethodId methodId, List<Argument> argsIncludingPerhapsObjToInvokeOn) { String idOfObjToInvokeOn; ArrayList<Argument> args = new ArrayList<>(); if (firstArgumentIsObjToInvokeMethodOn(methodId)) { NonPrimitiveArgument firstArg = (NonPrimitiveArgument) argsIncludingPerhapsObjToInvokeOn.get(0); if (firstArg.getNonPrimitiveEntityIds().size() != 1) return null; idOfObjToInvokeOn = firstArg.getNonPrimitiveEntityIds().iterator().next(); if (argsIncludingPerhapsObjToInvokeOn.size()>1) args.addAll(argsIncludingPerhapsObjToInvokeOn.subList(1, argsIncludingPerhapsObjToInvokeOn.size())); } else { idOfObjToInvokeOn = initialState.getEntityId(initialState.getRootEntity()); args.addAll(argsIncludingPerhapsObjToInvokeOn); } return MethodCall.createValidFunctionCall(methodId, idOfObjToInvokeOn, args, initialState); }  static boolean firstArgumentIsObjToInvokeMethodOn(MethodId methodId); static UnaryDenotation createLazyStateDenotationAsSingletonUnaryDenotation(
            LambdaDCSCoreLogic lambdaDCSCoreLogic, NliMethodCallFormula functionCall); static @NotNull LazyStateValue getEndStateValueDenotedByDerivation(
            Example sempreExample, Derivation derivation); static @Nullable Value getDenotationOfDerivation(Example sempreExample, Derivation derivation); }
DenotationUtils { static @Nullable MethodCall createFunctionCall(State initialState, MethodId methodId, List<Argument> argsIncludingPerhapsObjToInvokeOn) { String idOfObjToInvokeOn; ArrayList<Argument> args = new ArrayList<>(); if (firstArgumentIsObjToInvokeMethodOn(methodId)) { NonPrimitiveArgument firstArg = (NonPrimitiveArgument) argsIncludingPerhapsObjToInvokeOn.get(0); if (firstArg.getNonPrimitiveEntityIds().size() != 1) return null; idOfObjToInvokeOn = firstArg.getNonPrimitiveEntityIds().iterator().next(); if (argsIncludingPerhapsObjToInvokeOn.size()>1) args.addAll(argsIncludingPerhapsObjToInvokeOn.subList(1, argsIncludingPerhapsObjToInvokeOn.size())); } else { idOfObjToInvokeOn = initialState.getEntityId(initialState.getRootEntity()); args.addAll(argsIncludingPerhapsObjToInvokeOn); } return MethodCall.createValidFunctionCall(methodId, idOfObjToInvokeOn, args, initialState); }  static boolean firstArgumentIsObjToInvokeMethodOn(MethodId methodId); static UnaryDenotation createLazyStateDenotationAsSingletonUnaryDenotation(
            LambdaDCSCoreLogic lambdaDCSCoreLogic, NliMethodCallFormula functionCall); static @NotNull LazyStateValue getEndStateValueDenotedByDerivation(
            Example sempreExample, Derivation derivation); static @Nullable Value getDenotationOfDerivation(Example sempreExample, Derivation derivation);  }